From 8d006f414557022f78b689524053d4ed47150153 Mon Sep 17 00:00:00 2001 From: openssl-machine Date: Fri, 12 Jul 2024 15:29:14 +0000 Subject: [PATCH] Deployed af845f8 to 3.1 with MkDocs 1.6.0 and mike 2.1.2 --- 3.1/man3/EVP_DigestInit/index.html | 2 +- 3.1/search/search_index.json | 2 +- 3.1/sitemap.xml | 1606 ++++++++++++++-------------- 3.1/sitemap.xml.gz | Bin 5967 -> 5967 bytes 4 files changed, 805 insertions(+), 805 deletions(-) diff --git a/3.1/man3/EVP_DigestInit/index.html b/3.1/man3/EVP_DigestInit/index.html index 8e8d2c438..fb95e7868 100644 --- a/3.1/man3/EVP_DigestInit/index.html +++ b/3.1/man3/EVP_DigestInit/index.html @@ -94,7 +94,7 @@ void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count)); -

DESCRIPTION

The EVP digest routines are a high-level interface to message digests, and should be used instead of the digest-specific functions.

The EVP_MD type is a structure for digest method implementation.

PARAMETERS

See OSSL_PARAM(3) for information about passing parameters.

EVP_MD_CTX_set_params() can be used with the following OSSL_PARAM keys:

EVP_MD_CTX_get_params() can be used with the following OSSL_PARAM keys:

CONTROLS

EVP_MD_CTX_ctrl() can be used to send the following standard controls:

FLAGS

EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags() and EVP_MD_CTX_test_flags() can be used the manipulate and test these EVP_MD_CTX flags:

RETURN VALUES

NOTES

The EVP interface to message digests should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the digest used and much more flexible.

New applications should use the SHA-2 (such as EVP_sha256(3)) or the SHA-3 digest algorithms (such as EVP_sha3_512(3)). The other digest algorithms are still in common use.

For most applications the impl parameter to EVP_DigestInit_ex() will be set to NULL to use the default digest implementation.

Ignoring failure returns of EVP_DigestInit_ex(), EVP_DigestInit_ex2(), or EVP_DigestInit() can lead to undefined behavior on subsequent calls updating or finalizing the EVP_MD_CTX such as the EVP_DigestUpdate() or EVP_DigestFinal() functions. The only valid calls on the EVP_MD_CTX when initialization fails are calls that attempt another initialization of the context or release the context.

The functions EVP_DigestInit(), EVP_DigestFinal() and EVP_MD_CTX_copy() are obsolete but are retained to maintain compatibility with existing code. New applications should use EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex() because they can efficiently reuse a digest context instead of initializing and cleaning it up on each call and allow non default implementations of digests to be specified.

If digest contexts are not cleaned up after use, memory leaks will occur.

EVP_MD_CTX_get0_name(), EVP_MD_CTX_get_size(), EVP_MD_CTX_get_block_size(), EVP_MD_CTX_get_type(), EVP_get_digestbynid() and EVP_get_digestbyobj() are defined as macros.

EVP_MD_CTX_ctrl() sends commands to message digests for additional configuration or control.

EXAMPLES

This example digests the data "Test Message\n" and "Hello World\n", using the digest name passed on the command line.

#include <stdio.h>
+

DESCRIPTION

The EVP digest routines are a high-level interface to message digests, and should be used instead of the digest-specific functions.

The EVP_MD type is a structure for digest method implementation.

PARAMETERS

See OSSL_PARAM(3) for information about passing parameters.

EVP_MD_CTX_set_params() can be used with the following OSSL_PARAM keys:

EVP_MD_CTX_get_params() can be used with the following OSSL_PARAM keys:

CONTROLS

EVP_MD_CTX_ctrl() can be used to send the following standard controls:

FLAGS

EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags() and EVP_MD_CTX_test_flags() can be used the manipulate and test these EVP_MD_CTX flags:

RETURN VALUES

NOTES

The EVP interface to message digests should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the digest used and much more flexible.

New applications should use the SHA-2 (such as EVP_sha256(3)) or the SHA-3 digest algorithms (such as EVP_sha3_512(3)). The other digest algorithms are still in common use.

For most applications the impl parameter to EVP_DigestInit_ex() will be set to NULL to use the default digest implementation.

Ignoring failure returns of EVP_DigestInit_ex(), EVP_DigestInit_ex2(), or EVP_DigestInit() can lead to undefined behavior on subsequent calls updating or finalizing the EVP_MD_CTX such as the EVP_DigestUpdate() or EVP_DigestFinal() functions. The only valid calls on the EVP_MD_CTX when initialization fails are calls that attempt another initialization of the context or release the context.

The functions EVP_DigestInit(), EVP_DigestFinal() and EVP_MD_CTX_copy() are obsolete but are retained to maintain compatibility with existing code. New applications should use EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex() because they can efficiently reuse a digest context instead of initializing and cleaning it up on each call and allow non default implementations of digests to be specified.

If digest contexts are not cleaned up after use, memory leaks will occur.

EVP_MD_CTX_get0_name(), EVP_MD_CTX_get_size(), EVP_MD_CTX_get_block_size(), EVP_MD_CTX_get_type(), EVP_get_digestbynid() and EVP_get_digestbyobj() are defined as macros.

EVP_MD_CTX_ctrl() sends commands to message digests for additional configuration or control.

EXAMPLES

This example digests the data "Test Message\n" and "Hello World\n", using the digest name passed on the command line.

#include <stdio.h>
 #include <string.h>
 #include <openssl/evp.h>
 
diff --git a/3.1/search/search_index.json b/3.1/search/search_index.json
index 878b0937d..11cf6ff95 100644
--- a/3.1/search/search_index.json
+++ b/3.1/search/search_index.json
@@ -1 +1 @@
-{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"man1/CA.pl/","title":"CA.pl","text":""},{"location":"man1/CA.pl/#name","title":"NAME","text":"

CA.pl - friendlier interface for OpenSSL certificate programs

"},{"location":"man1/CA.pl/#synopsis","title":"SYNOPSIS","text":"

CA.pl -? | -h | -help

CA.pl -newcert | -newreq | -newreq-nodes | -xsign | -sign | -signCA | -signcert | -crl | -newca [-extra-cmd parameter]

CA.pl -pkcs12 [certname]

CA.pl -verify certfile ...

CA.pl -revoke certfile [reason]

"},{"location":"man1/CA.pl/#description","title":"DESCRIPTION","text":"

The CA.pl script is a perl script that supplies the relevant command line arguments to the openssl(1) command for some common certificate operations. It is intended to simplify the process of certificate creation and management by the use of some simple options.

The script is intended as a simple front end for the openssl(1) program for use by a beginner. Its behaviour isn't always what is wanted. For more control over the behaviour of the certificate commands call the openssl(1) command directly.

Most of the filenames mentioned below can be modified by editing the CA.pl script.

Under some environments it may not be possible to run the CA.pl script directly (for example Win32) and the default configuration file location may be wrong. In this case the command:

perl -S CA.pl\n

can be used and the OPENSSL_CONF environment variable can be set to point to the correct path of the configuration file.

"},{"location":"man1/CA.pl/#options","title":"OPTIONS","text":"
  • -?, -h, -help

    Prints a usage message.

  • -newcert

    Creates a new self signed certificate. The private key is written to the file newkey.pem and the request written to the file newreq.pem. Invokes openssl-req(1).

  • -newreq

    Creates a new certificate request. The private key is written to the file newkey.pem and the request written to the file newreq.pem. Executes openssl-req(1) under the hood.

  • -newreq-nodes

    Is like -newreq except that the private key will not be encrypted. Uses openssl-req(1).

  • -newca

    Creates a new CA hierarchy for use with the ca program (or the -signcert and -xsign options). The user is prompted to enter the filename of the CA certificates (which should also contain the private key) or by hitting ENTER details of the CA will be prompted for. The relevant files and directories are created in a directory called demoCA in the current directory. Uses openssl-req(1) and openssl-ca(1).

    If the demoCA directory already exists then the -newca command will not overwrite it and will do nothing. This can happen if a previous call using the -newca option terminated abnormally. To get the correct behaviour delete the directory if it already exists.

  • -pkcs12

    Create a PKCS#12 file containing the user certificate, private key and CA certificate. It expects the user certificate and private key to be in the file newcert.pem and the CA certificate to be in the file demoCA/cacert.pem, it creates a file newcert.p12. This command can thus be called after the -sign option. The PKCS#12 file can be imported directly into a browser. If there is an additional argument on the command line it will be used as the \"friendly name\" for the certificate (which is typically displayed in the browser list box), otherwise the name \"My Certificate\" is used. Delegates work to openssl-pkcs12(1).

  • -sign, -signcert, -xsign

    Calls the openssl-ca(1) command to sign a certificate request. It expects the request to be in the file newreq.pem. The new certificate is written to the file newcert.pem except in the case of the -xsign option when it is written to standard output.

  • -signCA

    This option is the same as the -sign option except it uses the configuration file section v3_ca and so makes the signed request a valid CA certificate. This is useful when creating intermediate CA from a root CA. Extra params are passed to openssl-ca(1).

  • -signcert

    This option is the same as -sign except it expects a self signed certificate to be present in the file newreq.pem. Extra params are passed to openssl-x509(1) and openssl-ca(1).

  • -crl

    Generate a CRL. Executes openssl-ca(1).

  • -revoke certfile [reason]

    Revoke the certificate contained in the specified certfile. An optional reason may be specified, and must be one of: unspecified, keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold, or removeFromCRL. Leverages openssl-ca(1).

  • -verify

    Verifies certificates against the CA certificate for demoCA. If no certificates are specified on the command line it tries to verify the file newcert.pem. Invokes openssl-verify(1).

  • -extra-cmd parameter

    For each option extra-cmd, pass parameter to the openssl(1) sub-command with the same name as cmd, if that sub-command is invoked. For example, if openssl-req(1) is invoked, the parameter given with -extra-req will be passed to it. For multi-word parameters, either repeat the option or quote the parameters so it looks like one word to your shell. See the individual command documentation for more information.

"},{"location":"man1/CA.pl/#examples","title":"EXAMPLES","text":"

Create a CA hierarchy:

CA.pl -newca\n

Complete certificate creation example: create a CA, create a request, sign the request and finally create a PKCS#12 file containing it.

CA.pl -newca\nCA.pl -newreq\nCA.pl -sign\nCA.pl -pkcs12 \"My Test Certificate\"\n
"},{"location":"man1/CA.pl/#environment","title":"ENVIRONMENT","text":"

The environment variable OPENSSL may be used to specify the name of the OpenSSL program. It can be a full pathname, or a relative one.

The environment variable OPENSSL_CONFIG may be used to specify a configuration option and value to the req and ca commands invoked by this script. It's value should be the option and pathname, as in -config /path/to/conf-file.

"},{"location":"man1/CA.pl/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-x509(1), openssl-ca(1), openssl-req(1), openssl-pkcs12(1), config(5)

"},{"location":"man1/CA.pl/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-asn1parse/","title":"openssl-asn1parse","text":""},{"location":"man1/openssl-asn1parse/#name","title":"NAME","text":"

openssl-asn1parse - ASN.1 parsing command

"},{"location":"man1/openssl-asn1parse/#synopsis","title":"SYNOPSIS","text":"

openssl asn1parse [-help] [-inform DER|PEM] [-in filename] [-out filename] [-noout] [-offset number] [-length number] [-i] [-oid filename] [-dump] [-dlimit num] [-strparse offset] [-genstr string] [-genconf file] [-strictpem] [-item name]

"},{"location":"man1/openssl-asn1parse/#description","title":"DESCRIPTION","text":"

This command is a diagnostic utility that can parse ASN.1 structures. It can also be used to extract data from ASN.1 formatted data.

"},{"location":"man1/openssl-asn1parse/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM

    The input format; the default is PEM. See openssl-format-options(1) for details.

  • -in filename

    The input file, default is standard input.

  • -out filename

    Output file to place the DER encoded data into. If this option is not present then no data will be output. This is most useful when combined with the -strparse option.

  • -noout

    Don't output the parsed version of the input file.

  • -offset number

    Starting offset to begin parsing, default is start of file.

  • -length number

    Number of bytes to parse, default is until end of file.

  • -i

    Indents the output according to the \"depth\" of the structures.

  • -oid filename

    A file containing additional OBJECT IDENTIFIERs (OIDs). The format of this file is described in the NOTES section below.

  • -dump

    Dump unknown data in hex format.

  • -dlimit num

    Like -dump, but only the first num bytes are output.

  • -strparse offset

    Parse the contents octets of the ASN.1 object starting at offset. This option can be used multiple times to \"drill down\" into a nested structure.

  • -genstr string, -genconf file

    Generate encoded data based on string, file or both using ASN1_generate_nconf(3) format. If file only is present then the string is obtained from the default section using the name asn1. The encoded data is passed through the ASN1 parser and printed out as though it came from a file, the contents can thus be examined and written to a file using the -out option.

  • -strictpem

    If this option is used then -inform will be ignored. Without this option any data in a PEM format input file will be treated as being base64 encoded and processed whether it has the normal PEM BEGIN and END markers or not. This option will ignore any data prior to the start of the BEGIN marker, or after an END marker in a PEM file.

  • -item name

    Attempt to decode and print the data as an ASN1_ITEM name. This can be used to print out the fields of any supported ASN.1 structure if the type is known.

"},{"location":"man1/openssl-asn1parse/#output","title":"Output","text":"

The output will typically contain lines like this:

0:d=0  hl=4 l= 681 cons: SEQUENCE\n

.....

229:d=3  hl=3 l= 141 prim: BIT STRING\n373:d=2  hl=3 l= 162 cons: cont [ 3 ]\n376:d=3  hl=3 l= 159 cons: SEQUENCE\n379:d=4  hl=2 l=  29 cons: SEQUENCE\n381:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Subject Key Identifier\n386:d=5  hl=2 l=  22 prim: OCTET STRING\n410:d=4  hl=2 l= 112 cons: SEQUENCE\n412:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Authority Key Identifier\n417:d=5  hl=2 l= 105 prim: OCTET STRING\n524:d=4  hl=2 l=  12 cons: SEQUENCE\n

.....

This example is part of a self-signed certificate. Each line starts with the offset in decimal. d=XX specifies the current depth. The depth is increased within the scope of any SET or SEQUENCE. hl=XX gives the header length (tag and length octets) of the current type. l=XX gives the length of the contents octets.

The -i option can be used to make the output more readable.

Some knowledge of the ASN.1 structure is needed to interpret the output.

In this example the BIT STRING at offset 229 is the certificate public key. The contents octets of this will contain the public key information. This can be examined using the option -strparse 229 to yield:

  0:d=0  hl=3 l= 137 cons: SEQUENCE\n  3:d=1  hl=3 l= 129 prim: INTEGER           :E5D21E1F5C8D208EA7A2166C7FAF9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A9746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9E1158A56E4A6F47E5897\n135:d=1  hl=2 l=   3 prim: INTEGER           :010001\n
"},{"location":"man1/openssl-asn1parse/#notes","title":"NOTES","text":"

If an OID is not part of OpenSSL's internal table it will be represented in numerical form (for example 1.2.3.4). The file passed to the -oid option allows additional OIDs to be included. Each line consists of three columns, the first column is the OID in numerical format and should be followed by white space. The second column is the \"short name\" which is a single word followed by whitespace. The final column is the rest of the line and is the \"long name\". Example:

1.2.3.4 shortName A long name

For any OID with an associated short and long name, this command will display the long name.

"},{"location":"man1/openssl-asn1parse/#examples","title":"EXAMPLES","text":"

Parse a file:

openssl asn1parse -in file.pem\n

Parse a DER file:

openssl asn1parse -inform DER -in file.der\n

Generate a simple UTF8String:

openssl asn1parse -genstr 'UTF8:Hello World'\n

Generate and write out a UTF8String, don't print parsed output:

openssl asn1parse -genstr 'UTF8:Hello World' -noout -out utf8.der\n

Generate using a config file:

openssl asn1parse -genconf asn1.cnf -noout -out asn1.der\n

Example config file:

asn1=SEQUENCE:seq_sect\n\n[seq_sect]\n\nfield1=BOOL:TRUE\nfield2=EXP:0, UTF8:some random string\n
"},{"location":"man1/openssl-asn1parse/#bugs","title":"BUGS","text":"

There should be options to change the format of output lines. The output of some ASN.1 types is not well handled (if at all).

"},{"location":"man1/openssl-asn1parse/#see-also","title":"SEE ALSO","text":"

openssl(1), ASN1_generate_nconf(3)

"},{"location":"man1/openssl-asn1parse/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-ca/","title":"openssl-ca","text":""},{"location":"man1/openssl-ca/#name","title":"NAME","text":"

openssl-ca - sample minimal CA application

"},{"location":"man1/openssl-ca/#synopsis","title":"SYNOPSIS","text":"

openssl ca [-help] [-verbose] [-config filename] [-name section] [-section section] [-gencrl] [-revoke file] [-valid file] [-status serial] [-updatedb] [-crl_reason reason] [-crl_hold instruction] [-crl_compromise time] [-crl_CA_compromise time] [-crl_lastupdate date] [-crl_nextupdate date] [-crldays days] [-crlhours hours] [-crlsec seconds] [-crlexts section] [-startdate date] [-enddate date] [-days arg] [-md arg] [-policy arg] [-keyfile filename|uri] [-keyform DER|PEM|P12|ENGINE] [-key arg] [-passin arg] [-cert file] [-certform DER|PEM|P12] [-selfsign] [-in file] [-inform DER|] [-out file] [-notext] [-dateopt] [-outdir dir] [-infiles] [-spkac file] [-ss_cert file] [-preserveDN] [-noemailDN] [-batch] [-msie_hack] [-extensions section] [-extfile section] [-subj arg] [-utf8] [-sigopt nm:v] [-vfyopt nm:v] [-create_serial] [-rand_serial] [-multivalue-rdn] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [certreq...]"},{"location":"man1/openssl-ca/#description","title":"DESCRIPTION","text":"

This command emulates a CA application. See the WARNINGS especially when considering to use it productively. It can be used to sign certificate requests (CSRs) in a variety of forms and generate certificate revocation lists (CRLs). It also maintains a text database of issued certificates and their status. When signing certificates, a single request can be specified with the -in option, or multiple requests can be processed by specifying a set of certreq files after all options.

Note that there are also very lean ways of generating certificates: the req and x509 commands can be used for directly creating certificates. See openssl-req(1) and openssl-x509(1) for details.

The descriptions of the ca command options are divided into each purpose.

"},{"location":"man1/openssl-ca/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -verbose

    This prints extra details about the operations being performed.

  • -config filename

    Specifies the configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

  • -name section, -section section

    Specifies the configuration file section to use (overrides default_ca in the ca section).

  • -in filename

    An input filename containing a single certificate request (CSR) to be signed by the CA.

  • -inform DER|PEM

    The format of the data in certificate request input files; unspecified by default. See openssl-format-options(1) for details.

  • -ss_cert filename

    A single self-signed certificate to be signed by the CA.

  • -spkac filename

    A file containing a single Netscape signed public key and challenge and additional field values to be signed by the CA. See the SPKAC FORMAT section for information on the required input and output format.

  • -infiles

    If present this should be the last option, all subsequent arguments are taken as the names of files containing certificate requests.

  • -out filename

    The output file to output certificates to. The default is standard output. The certificate details will also be printed out to this file in PEM format (except that -spkac outputs DER format).

  • -outdir directory

    The directory to output certificates to. The certificate will be written to a filename consisting of the serial number in hex with .pem appended.

  • -cert filename

    The CA certificate, which must match with -keyfile.

  • -certform DER|PEM|P12

    The format of the data in certificate input files; unspecified by default. See openssl-format-options(1) for details.

  • -keyfile filename|uri

    The CA private key to sign certificate requests with. This must match with -cert.

  • -keyform DER|PEM|P12|ENGINE

    The format of the private key input file; unspecified by default. See openssl-format-options(1) for details.

  • -sigopt nm:v

    Pass options to the signature algorithm during sign operations. Names and values of these options are algorithm-specific.

  • -vfyopt nm:v

    Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

    This often needs to be given while signing too, because the self-signature of a certificate signing request (CSR) is verified against the included public key, and that verification may need its own set of options.

  • -key password

    The password used to encrypt the private key. Since on some systems the command line arguments are visible (e.g., when using ps(1) on Unix), this option should be used with caution. Better use -passin.

  • -passin arg

    The key password source for key files and certificate PKCS#12 files. For more information about the format of arg see openssl-passphrase-options(1).

  • -selfsign

    Indicates the issued certificates are to be signed with the key the certificate requests were signed with (given with -keyfile). Certificate requests signed with a different key are ignored. If -spkac, -ss_cert or -gencrl are given, -selfsign is ignored.

    A consequence of using -selfsign is that the self-signed certificate appears among the entries in the certificate database (see the configuration option database), and uses the same serial number counter as all other certificates sign with the self-signed certificate.

  • -notext

    Don't output the text form of a certificate to the output file.

  • -dateopt

    Specify the date output format. Values are: rfc_822 and iso_8601. Defaults to rfc_822.

  • -startdate date

    This allows the start date to be explicitly set. The format of the date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or YYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In both formats, seconds SS and timezone Z must be present.

  • -enddate date

    This allows the expiry date to be explicitly set. The format of the date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or YYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In both formats, seconds SS and timezone Z must be present.

  • -days arg

    The number of days to certify the certificate for.

  • -md alg

    The message digest to use. Any digest supported by the openssl-dgst(1) command can be used. For signing algorithms that do not support a digest (i.e. Ed25519 and Ed448) any message digest that is set is ignored. This option also applies to CRLs.

  • -policy arg

    This option defines the CA \"policy\" to use. This is a section in the configuration file which decides which fields should be mandatory or match the CA certificate. Check out the POLICY FORMAT section for more information.

  • -msie_hack

    This is a deprecated option to make this command work with very old versions of the IE certificate enrollment control \"certenr3\". It used UniversalStrings for almost everything. Since the old control has various security bugs its use is strongly discouraged.

  • -preserveDN

    Normally the DN order of a certificate is the same as the order of the fields in the relevant policy section. When this option is set the order is the same as the request. This is largely for compatibility with the older IE enrollment control which would only accept certificates if their DNs match the order of the request. This is not needed for Xenroll.

  • -noemailDN

    The DN of a certificate can contain the EMAIL field if present in the request DN, however, it is good policy just having the e-mail set into the altName extension of the certificate. When this option is set the EMAIL field is removed from the certificate' subject and set only in the, eventually present, extensions. The email_in_dn keyword can be used in the configuration file to enable this behaviour.

  • -batch

    This sets the batch mode. In this mode no questions will be asked and all certificates will be certified automatically.

  • -extensions section

    The section of the configuration file containing certificate extensions to be added when a certificate is issued (defaults to x509_extensions unless the -extfile option is used). If no X.509 extensions are specified then a V1 certificate is created, else a V3 certificate is created. See the x509v3_config(5) manual page for details of the extension section format.

  • -extfile file

    An additional configuration file to read certificate extensions from (using the default section unless the -extensions option is also used).

  • -subj arg

    Supersedes subject name given in the request.

    The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted, but the corresponding type will not be included in the resulting certificate. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

    /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

  • -utf8

    This option causes field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.

  • -create_serial

    If reading serial from the text file as specified in the configuration fails, specifying this option creates a new random serial to be used as next serial number. To get random serial numbers, use the -rand_serial flag instead; this should only be used for simple error-recovery.

  • -rand_serial

    Generate a large random number to use as the serial number. This overrides any option or configuration to use a serial number file.

  • -multivalue-rdn

    This option has been deprecated and has no effect.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-ca/#crl-options","title":"CRL OPTIONS","text":"
  • -gencrl

    This option generates a CRL based on information in the index file.

  • -crl_lastupdate time

    Allows the value of the CRL's lastUpdate field to be explicitly set; if this option is not present, the current time is used. Accepts times in YYMMDDHHMMSSZ format (the same as an ASN1 UTCTime structure) or YYYYMMDDHHMMSSZ format (the same as an ASN1 GeneralizedTime structure).

  • -crl_nextupdate time

    Allows the value of the CRL's nextUpdate field to be explicitly set; if this option is present, any values given for -crldays, -crlhours and -crlsec are ignored. Accepts times in the same formats as -crl_lastupdate.

  • -crldays num

    The number of days before the next CRL is due. That is the days from now to place in the CRL nextUpdate field.

  • -crlhours num

    The number of hours before the next CRL is due.

  • -crlsec num

    The number of seconds before the next CRL is due.

  • -revoke filename

    A filename containing a certificate to revoke.

  • -valid filename

    A filename containing a certificate to add a Valid certificate entry.

  • -status serial

    Displays the revocation status of the certificate with the specified serial number and exits.

  • -updatedb

    Updates the database index to purge expired certificates.

  • -crl_reason reason

    Revocation reason, where reason is one of: unspecified, keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold or removeFromCRL. The matching of reason is case insensitive. Setting any revocation reason will make the CRL v2.

    In practice removeFromCRL is not particularly useful because it is only used in delta CRLs which are not currently implemented.

  • -crl_hold instruction

    This sets the CRL revocation reason code to certificateHold and the hold instruction to instruction which must be an OID. Although any OID can be used only holdInstructionNone (the use of which is discouraged by RFC2459) holdInstructionCallIssuer or holdInstructionReject will normally be used.

  • -crl_compromise time

    This sets the revocation reason to keyCompromise and the compromise time to time. time should be in GeneralizedTime format that is YYYYMMDDHHMMSSZ.

  • -crl_CA_compromise time

    This is the same as crl_compromise except the revocation reason is set to CACompromise.

  • -crlexts section

    The section of the configuration file containing CRL extensions to include. If no CRL extension section is present then a V1 CRL is created, if the CRL extension section is present (even if it is empty) then a V2 CRL is created. The CRL extensions specified are CRL extensions and not CRL entry extensions. It should be noted that some software (for example Netscape) can't handle V2 CRLs. See x509v3_config(5) manual page for details of the extension section format.

"},{"location":"man1/openssl-ca/#configuration-file-options","title":"CONFIGURATION FILE OPTIONS","text":"

The section of the configuration file containing options for this command is found as follows: If the -name command line option is used, then it names the section to be used. Otherwise the section to be used must be named in the default_ca option of the ca section of the configuration file (or in the default section of the configuration file). Besides default_ca, the following options are read directly from the ca section: RANDFILE preserve msie_hack With the exception of RANDFILE, this is probably a bug and may change in future releases.

Many of the configuration file options are identical to command line options. Where the option is present in the configuration file and the command line the command line value is used. Where an option is described as mandatory then it must be present in the configuration file or the command line equivalent (if any) used.

  • oid_file

    This specifies a file containing additional OBJECT IDENTIFIERS. Each line of the file should consist of the numerical form of the object identifier followed by whitespace then the short name followed by whitespace and finally the long name.

  • oid_section

    This specifies a section in the configuration file containing extra object identifiers. Each line should consist of the short name of the object identifier followed by = and the numerical form. The short and long names are the same when this option is used.

  • new_certs_dir

    The same as the -outdir command line option. It specifies the directory where new certificates will be placed. Mandatory.

  • certificate

    The same as -cert. It gives the file containing the CA certificate. Mandatory.

  • private_key

    Same as the -keyfile option. The file containing the CA private key. Mandatory.

  • RANDFILE

    At startup the specified file is loaded into the random number generator, and at exit 256 bytes will be written to it. (Note: Using a RANDFILE is not necessary anymore, see the \"HISTORY\" section.

  • default_days

    The same as the -days option. The number of days to certify a certificate for.

  • default_startdate

    The same as the -startdate option. The start date to certify a certificate for. If not set the current time is used.

  • default_enddate

    The same as the -enddate option. Either this option or default_days (or the command line equivalents) must be present.

  • default_crl_hours default_crl_days

    The same as the -crlhours and the -crldays options. These will only be used if neither command line option is present. At least one of these must be present to generate a CRL.

  • default_md

    The same as the -md option. Mandatory except where the signing algorithm does not require a digest (i.e. Ed25519 and Ed448).

  • database

    The text database file to use. Mandatory. This file must be present though initially it will be empty.

  • unique_subject

    If the value yes is given, the valid certificate entries in the database must have unique subjects. if the value no is given, several valid certificate entries may have the exact same subject. The default value is yes, to be compatible with older (pre 0.9.8) versions of OpenSSL. However, to make CA certificate roll-over easier, it's recommended to use the value no, especially if combined with the -selfsign command line option.

    Note that it is valid in some circumstances for certificates to be created without any subject. In the case where there are multiple certificates without subjects this does not count as a duplicate.

  • serial

    A text file containing the next serial number to use in hex. Mandatory. This file must be present and contain a valid serial number.

  • crlnumber

    A text file containing the next CRL number to use in hex. The crl number will be inserted in the CRLs only if this file exists. If this file is present, it must contain a valid CRL number.

  • x509_extensions

    A fallback to the -extensions option.

  • crl_extensions

    A fallback to the -crlexts option.

  • preserve

    The same as -preserveDN

  • email_in_dn

    The same as -noemailDN. If you want the EMAIL field to be removed from the DN of the certificate simply set this to 'no'. If not present the default is to allow for the EMAIL filed in the certificate's DN.

  • msie_hack

    The same as -msie_hack

  • policy

    The same as -policy. Mandatory. See the POLICY FORMAT section for more information.

  • name_opt, cert_opt

    These options allow the format used to display the certificate details when asking the user to confirm signing. All the options supported by the x509 utilities -nameopt and -certopt switches can be used here, except the no_signame and no_sigdump are permanently set and cannot be disabled (this is because the certificate signature cannot be displayed because the certificate has not been signed at this point).

    For convenience the values ca_default are accepted by both to produce a reasonable output.

    If neither option is present the format used in earlier versions of OpenSSL is used. Use of the old format is strongly discouraged because it only displays fields mentioned in the policy section, mishandles multicharacter string types and does not display extensions.

  • copy_extensions

    Determines how extensions in certificate requests should be handled. If set to none or this option is not present then extensions are ignored and not copied to the certificate. If set to copy then any extensions present in the request that are not already present are copied to the certificate. If set to copyall then all extensions in the request are copied to the certificate: if the extension is already present in the certificate it is deleted first. See the WARNINGS section before using this option.

    The main use of this option is to allow a certificate request to supply values for certain extensions such as subjectAltName.

"},{"location":"man1/openssl-ca/#policy-format","title":"POLICY FORMAT","text":"

The policy section consists of a set of variables corresponding to certificate DN fields. If the value is \"match\" then the field value must match the same field in the CA certificate. If the value is \"supplied\" then it must be present. If the value is \"optional\" then it may be present. Any fields not mentioned in the policy section are silently deleted, unless the -preserveDN option is set but this can be regarded more of a quirk than intended behaviour.

"},{"location":"man1/openssl-ca/#spkac-format","title":"SPKAC FORMAT","text":"

The input to the -spkac command line option is a Netscape signed public key and challenge. This will usually come from the KEYGEN tag in an HTML form to create a new private key. It is however possible to create SPKACs using openssl-spkac(1).

The file should contain the variable SPKAC set to the value of the SPKAC and also the required DN components as name value pairs. If you need to include the same component twice then it can be preceded by a number and a '.'.

When processing SPKAC format, the output is DER if the -out flag is used, but PEM format if sending to stdout or the -outdir flag is used.

"},{"location":"man1/openssl-ca/#examples","title":"EXAMPLES","text":"

Note: these examples assume that the directory structure this command assumes is already set up and the relevant files already exist. This usually involves creating a CA certificate and private key with openssl-req(1), a serial number file and an empty index file and placing them in the relevant directories.

To use the sample configuration file below the directories demoCA, demoCA/private and demoCA/newcerts would be created. The CA certificate would be copied to demoCA/cacert.pem and its private key to demoCA/private/cakey.pem. A file demoCA/serial would be created containing for example \"01\" and the empty index file demoCA/index.txt.

Sign a certificate request:

openssl ca -in req.pem -out newcert.pem\n

Sign an SM2 certificate request:

openssl ca -in sm2.csr -out sm2.crt -md sm3 \\\n        -sigopt \"distid:1234567812345678\" \\\n        -vfyopt \"distid:1234567812345678\"\n

Sign a certificate request, using CA extensions:

openssl ca -in req.pem -extensions v3_ca -out newcert.pem\n

Generate a CRL

openssl ca -gencrl -out crl.pem\n

Sign several requests:

openssl ca -infiles req1.pem req2.pem req3.pem\n

Certify a Netscape SPKAC:

openssl ca -spkac spkac.txt\n

A sample SPKAC file (the SPKAC line has been truncated for clarity):

SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5\nCN=Steve Test\nemailAddress=steve@openssl.org\n0.OU=OpenSSL Group\n1.OU=Another Group\n

A sample configuration file with the relevant sections for this command:

[ ca ]\ndefault_ca      = CA_default         #   # The default ca section\n\n[ CA_default ]\n\ndir            = ./demoCA           #   # top dir\ndatabase       = $dir/index.txt     #   # index file.\nnew_certs_dir  = $dir/newcerts      #   # new certs dir\n\ncertificate    = $dir/cacert.pem    #   # The CA cert\nserial         = $dir/serial        #   # serial no file\n#rand_serial    = yes               #   # for random serial#'s\nprivate_key    = $dir/private/cakey.pem## CA private key\n\ndefault_days   = 365                #   # how long to certify for\ndefault_crl_days= 30                #   # how long before next CRL\ndefault_md     = md5                #   # md to use\n\npolicy         = policy_any         #   # default policy\nemail_in_dn    = no                 #   # Don't add the email into cert DN\n\nname_opt       = ca_default         #   # Subject name display option\ncert_opt       = ca_default         #   # Certificate display option\ncopy_extensions = none              #   # Don't copy extensions from request\n\n[ policy_any ]\ncountryName            = supplied\nstateOrProvinceName    = optional\norganizationName       = optional\norganizationalUnitName = optional\ncommonName             = supplied\nemailAddress           = optional\n
"},{"location":"man1/openssl-ca/#files","title":"FILES","text":"

Note: the location of all files can change either by compile time options, configuration file entries, environment variables or command line options. The values below reflect the default values.

/usr/local/ssl/lib/openssl.cnf - master configuration file\n./demoCA                       - main CA directory\n./demoCA/cacert.pem            - CA certificate\n./demoCA/private/cakey.pem     - CA private key\n./demoCA/serial                - CA serial number file\n./demoCA/serial.old            - CA serial number backup file\n./demoCA/index.txt             - CA text database file\n./demoCA/index.txt.old         - CA text database backup file\n./demoCA/certs                 - certificate output file\n
"},{"location":"man1/openssl-ca/#restrictions","title":"RESTRICTIONS","text":"

The text database index file is a critical part of the process and if corrupted it can be difficult to fix. It is theoretically possible to rebuild the index file from all the issued certificates and a current CRL: however there is no option to do this.

V2 CRL features like delta CRLs are not currently supported.

Although several requests can be input and handled at once it is only possible to include one SPKAC or self-signed certificate.

"},{"location":"man1/openssl-ca/#bugs","title":"BUGS","text":"

This command is quirky and at times downright unfriendly.

The use of an in-memory text database can cause problems when large numbers of certificates are present because, as the name implies the database has to be kept in memory.

This command really needs rewriting or the required functionality exposed at either a command or interface level so that a more user-friendly replacement could handle things properly. The script CA.pl helps a little but not very much.

Any fields in a request that are not present in a policy are silently deleted. This does not happen if the -preserveDN option is used. To enforce the absence of the EMAIL field within the DN, as suggested by RFCs, regardless the contents of the request' subject the -noemailDN option can be used. The behaviour should be more friendly and configurable.

Canceling some commands by refusing to certify a certificate can create an empty file.

"},{"location":"man1/openssl-ca/#warnings","title":"WARNINGS","text":"

This command was originally meant as an example of how to do things in a CA. Its code does not have production quality. It was not supposed to be used as a full blown CA itself, nevertheless some people are using it for this purpose at least internally. When doing so, specific care should be taken to properly secure the private key(s) used for signing certificates. It is advisable to keep them in a secure HW storage such as a smart card or HSM and access them via a suitable engine or crypto provider.

This command command is effectively a single user command: no locking is done on the various files and attempts to run more than one openssl ca command on the same database can have unpredictable results.

The copy_extensions option should be used with caution. If care is not taken then it can be a security risk. For example if a certificate request contains a basicConstraints extension with CA:TRUE and the copy_extensions value is set to copyall and the user does not spot this when the certificate is displayed then this will hand the requester a valid CA certificate. This situation can be avoided by setting copy_extensions to copy and including basicConstraints with CA:FALSE in the configuration file. Then if the request contains a basicConstraints extension it will be ignored.

It is advisable to also include values for other extensions such as keyUsage to prevent a request supplying its own values.

Additional restrictions can be placed on the CA certificate itself. For example if the CA certificate has:

basicConstraints = CA:TRUE, pathlen:0\n

then even if a certificate is issued with CA:TRUE it will not be valid.

"},{"location":"man1/openssl-ca/#history","title":"HISTORY","text":"

Since OpenSSL 1.1.1, the program follows RFC5280. Specifically, certificate validity period (specified by any of -startdate, -enddate and -days) and CRL last/next update time (specified by any of -crl_lastupdate, -crl_nextupdate, -crldays, -crlhours and -crlsec) will be encoded as UTCTime if the dates are earlier than year 2049 (included), and as GeneralizedTime if the dates are in year 2050 or later.

OpenSSL 1.1.1 introduced a new random generator (CSPRNG) with an improved seeding mechanism. The new seeding mechanism makes it unnecessary to define a RANDFILE for saving and restoring randomness. This option is retained mainly for compatibility reasons.

The -section option was added in OpenSSL 3.0.0.

The -multivalue-rdn option has become obsolete in OpenSSL 3.0.0 and has no effect.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-ca/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-req(1), openssl-spkac(1), openssl-x509(1), CA.pl(1), config(5), x509v3_config(5)

"},{"location":"man1/openssl-ca/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-ciphers/","title":"openssl-ciphers","text":""},{"location":"man1/openssl-ciphers/#name","title":"NAME","text":"

openssl-ciphers - SSL cipher display and cipher list command

"},{"location":"man1/openssl-ciphers/#synopsis","title":"SYNOPSIS","text":"

openssl ciphers [-help] [-s] [-v] [-V] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-s] [-psk] [-srp] [-stdname] [-convert name] [-ciphersuites val] [-provider name] [-provider-path path] [-propquery propq] [cipherlist]

"},{"location":"man1/openssl-ciphers/#description","title":"DESCRIPTION","text":"

This command converts textual OpenSSL cipher lists into ordered SSL cipher preference lists. It can be used to determine the appropriate cipherlist.

"},{"location":"man1/openssl-ciphers/#options","title":"OPTIONS","text":"
  • -help

    Print a usage message.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -s

    Only list supported ciphers: those consistent with the security level, and minimum and maximum protocol version. This is closer to the actual cipher list an application will support.

    PSK and SRP ciphers are not enabled by default: they require -psk or -srp to enable them.

    It also does not change the default list of supported signature algorithms.

    On a server the list of supported ciphers might also exclude other ciphers depending on the configured certificates and presence of DH parameters.

    If this option is not used then all ciphers that match the cipherlist will be listed.

  • -psk

    When combined with -s includes cipher suites which require PSK.

  • -srp

    When combined with -s includes cipher suites which require SRP. This option is deprecated.

  • -v

    Verbose output: For each cipher suite, list details as provided by SSL_CIPHER_description(3).

  • -V

    Like -v, but include the official cipher suite values in hex.

  • -tls1_3, -tls1_2, -tls1_1, -tls1, -ssl3

    In combination with the -s option, list the ciphers which could be used if the specified protocol were negotiated. Note that not all protocols and flags may be available, depending on how OpenSSL was built.

  • -stdname

    Precede each cipher suite by its standard name.

  • -convert name

    Convert a standard cipher name to its OpenSSL name.

  • -ciphersuites val

    Sets the list of TLSv1.3 ciphersuites. This list will be combined with any TLSv1.2 and below ciphersuites that have been configured. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names. By default this value is:

    TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256\n
  • cipherlist

    A cipher list of TLSv1.2 and below ciphersuites to convert to a cipher preference list. This list will be combined with any TLSv1.3 ciphersuites that have been configured. If it is not included then the default cipher list will be used. The format is described below.

"},{"location":"man1/openssl-ciphers/#cipher-list-format","title":"CIPHER LIST FORMAT","text":"

The cipher list consists of one or more cipher strings separated by colons. Commas or spaces are also acceptable separators but colons are normally used.

The actual cipher string can take several different forms.

It can consist of a single cipher suite such as RC4-SHA.

It can represent a list of cipher suites containing a certain algorithm, or cipher suites of a certain type. For example SHA1 represents all ciphers suites using the digest algorithm SHA1 and SSLv3 represents all SSL v3 algorithms.

Lists of cipher suites can be combined in a single cipher string using the + character. This is used as a logical and operation. For example SHA1+DES represents all cipher suites containing the SHA1 and the DES algorithms.

Each cipher string can be optionally preceded by the characters !, - or +.

If ! is used then the ciphers are permanently deleted from the list. The ciphers deleted can never reappear in the list even if they are explicitly stated.

If - is used then the ciphers are deleted from the list, but some or all of the ciphers can be added again by later options.

If + is used then the ciphers are moved to the end of the list. This option doesn't add any new ciphers it just moves matching existing ones.

If none of these characters is present then the string is just interpreted as a list of ciphers to be appended to the current preference list. If the list includes any ciphers already present they will be ignored: that is they will not moved to the end of the list.

The cipher string @STRENGTH can be used at any point to sort the current cipher list in order of encryption algorithm key length.

The cipher string @SECLEVEL=n can be used at any point to set the security level to n, which should be a number between zero and five, inclusive. See SSL_CTX_set_security_level(3) for a description of what each level means.

The cipher list can be prefixed with the DEFAULT keyword, which enables the default cipher list as defined below. Unlike cipher strings, this prefix may not be combined with other strings using + character. For example, DEFAULT+DES is not valid.

The content of the default list is determined at compile time and normally corresponds to ALL:!COMPLEMENTOFDEFAULT:!eNULL.

"},{"location":"man1/openssl-ciphers/#cipher-strings","title":"CIPHER STRINGS","text":"

The following is a list of all permitted cipher strings and their meanings.

  • COMPLEMENTOFDEFAULT

    The ciphers included in ALL, but not enabled by default. Currently this includes all RC4 and anonymous ciphers. Note that this rule does not cover eNULL, which is not included by ALL (use COMPLEMENTOFALL if necessary). Note that RC4 based cipher suites are not built into OpenSSL by default (see the enable-weak-ssl-ciphers option to Configure).

  • ALL

    All cipher suites except the eNULL ciphers (which must be explicitly enabled if needed). As of OpenSSL 1.0.0, the ALL cipher suites are sensibly ordered by default.

  • COMPLEMENTOFALL

    The cipher suites not enabled by ALL, currently eNULL.

  • HIGH

    \"High\" encryption cipher suites. This currently means those with key lengths larger than 128 bits, and some cipher suites with 128-bit keys.

  • MEDIUM

    \"Medium\" encryption cipher suites, currently some of those using 128 bit encryption.

  • LOW

    \"Low\" encryption cipher suites, currently those using 64 or 56 bit encryption algorithms but excluding export cipher suites. All these cipher suites have been removed as of OpenSSL 1.1.0.

  • eNULL, NULL

    The \"NULL\" ciphers that is those offering no encryption. Because these offer no encryption at all and are a security risk they are not enabled via either the DEFAULT or ALL cipher strings. Be careful when building cipherlists out of lower-level primitives such as kRSA or aECDSA as these do overlap with the eNULL ciphers. When in doubt, include !eNULL in your cipherlist.

  • aNULL

    The cipher suites offering no authentication. This is currently the anonymous DH algorithms and anonymous ECDH algorithms. These cipher suites are vulnerable to \"man in the middle\" attacks and so their use is discouraged. These are excluded from the DEFAULT ciphers, but included in the ALL ciphers. Be careful when building cipherlists out of lower-level primitives such as kDHE or AES as these do overlap with the aNULL ciphers. When in doubt, include !aNULL in your cipherlist.

  • kRSA, aRSA, RSA

    Cipher suites using RSA key exchange or authentication. RSA is an alias for kRSA.

  • kDHr, kDHd, kDH

    Cipher suites using static DH key agreement and DH certificates signed by CAs with RSA and DSS keys or either respectively. All these cipher suites have been removed in OpenSSL 1.1.0.

  • kDHE, kEDH, DH

    Cipher suites using ephemeral DH key agreement, including anonymous cipher suites.

  • DHE, EDH

    Cipher suites using authenticated ephemeral DH key agreement.

  • ADH

    Anonymous DH cipher suites, note that this does not include anonymous Elliptic Curve DH (ECDH) cipher suites.

  • kEECDH, kECDHE, ECDH

    Cipher suites using ephemeral ECDH key agreement, including anonymous cipher suites.

  • ECDHE, EECDH

    Cipher suites using authenticated ephemeral ECDH key agreement.

  • AECDH

    Anonymous Elliptic Curve Diffie-Hellman cipher suites.

  • aDSS, DSS

    Cipher suites using DSS authentication, i.e. the certificates carry DSS keys.

  • aDH

    Cipher suites effectively using DH authentication, i.e. the certificates carry DH keys. All these cipher suites have been removed in OpenSSL 1.1.0.

  • aECDSA, ECDSA

    Cipher suites using ECDSA authentication, i.e. the certificates carry ECDSA keys.

  • TLSv1.2, TLSv1.0, SSLv3

    Lists cipher suites which are only supported in at least TLS v1.2, TLS v1.0 or SSL v3.0 respectively. Note: there are no cipher suites specific to TLS v1.1. Since this is only the minimum version, if, for example, TLSv1.0 is negotiated then both TLSv1.0 and SSLv3.0 cipher suites are available.

    Note: these cipher strings do not change the negotiated version of SSL or TLS, they only affect the list of available cipher suites.

  • AES128, AES256, AES

    cipher suites using 128 bit AES, 256 bit AES or either 128 or 256 bit AES.

  • AESGCM

    AES in Galois Counter Mode (GCM): these cipher suites are only supported in TLS v1.2.

  • AESCCM, AESCCM8

    AES in Cipher Block Chaining - Message Authentication Mode (CCM): these cipher suites are only supported in TLS v1.2. AESCCM references CCM cipher suites using both 16 and 8 octet Integrity Check Value (ICV) while AESCCM8 only references 8 octet ICV.

  • ARIA128, ARIA256, ARIA

    Cipher suites using 128 bit ARIA, 256 bit ARIA or either 128 or 256 bit ARIA.

  • CAMELLIA128, CAMELLIA256, CAMELLIA

    Cipher suites using 128 bit CAMELLIA, 256 bit CAMELLIA or either 128 or 256 bit CAMELLIA.

  • CHACHA20

    Cipher suites using ChaCha20.

  • 3DES

    Cipher suites using triple DES.

  • DES

    Cipher suites using DES (not triple DES). All these cipher suites have been removed in OpenSSL 1.1.0.

  • RC4

    Cipher suites using RC4.

  • RC2

    Cipher suites using RC2.

  • IDEA

    Cipher suites using IDEA.

  • SEED

    Cipher suites using SEED.

  • MD5

    Cipher suites using MD5.

  • SHA1, SHA

    Cipher suites using SHA1.

  • SHA256, SHA384

    Cipher suites using SHA256 or SHA384.

  • aGOST

    Cipher suites using GOST R 34.10 (either 2001 or 94) for authentication (needs an engine supporting GOST algorithms).

  • aGOST01

    Cipher suites using GOST R 34.10-2001 authentication.

  • kGOST

    Cipher suites, using VKO 34.10 key exchange, specified in the RFC 4357.

  • GOST94

    Cipher suites, using HMAC based on GOST R 34.11-94.

  • GOST89MAC

    Cipher suites using GOST 28147-89 MAC instead of HMAC.

  • PSK

    All cipher suites using pre-shared keys (PSK).

  • kPSK, kECDHEPSK, kDHEPSK, kRSAPSK

    Cipher suites using PSK key exchange, ECDHE_PSK, DHE_PSK or RSA_PSK.

  • aPSK

    Cipher suites using PSK authentication (currently all PSK modes apart from RSA_PSK).

  • SUITEB128, SUITEB128ONLY, SUITEB192

    Enables suite B mode of operation using 128 (permitting 192 bit mode by peer) 128 bit (not permitting 192 bit by peer) or 192 bit level of security respectively. If used these cipherstrings should appear first in the cipher list and anything after them is ignored. Setting Suite B mode has additional consequences required to comply with RFC6460. In particular the supported signature algorithms is reduced to support only ECDSA and SHA256 or SHA384, only the elliptic curves P-256 and P-384 can be used and only the two suite B compliant cipher suites (ECDHE-ECDSA-AES128-GCM-SHA256 and ECDHE-ECDSA-AES256-GCM-SHA384) are permissible.

  • CBC

    All cipher suites using encryption algorithm in Cipher Block Chaining (CBC) mode. These cipher suites are only supported in TLS v1.2 and earlier. Currently it's an alias for the following cipherstrings: SSL_DES, SSL_3DES, SSL_RC2, SSL_IDEA, SSL_AES128, SSL_AES256, SSL_CAMELLIA128, SSL_CAMELLIA256, SSL_SEED.

"},{"location":"man1/openssl-ciphers/#cipher-suite-names","title":"CIPHER SUITE NAMES","text":"

The following lists give the SSL or TLS cipher suites names from the relevant specification and their OpenSSL equivalents. It should be noted, that several cipher suite names do not include the authentication used, e.g. DES-CBC3-SHA. In these cases, RSA authentication is used.

"},{"location":"man1/openssl-ciphers/#ssl-v30-cipher-suites","title":"SSL v3.0 cipher suites","text":"
SSL_RSA_WITH_NULL_MD5                   NULL-MD5\nSSL_RSA_WITH_NULL_SHA                   NULL-SHA\nSSL_RSA_WITH_RC4_128_MD5                RC4-MD5\nSSL_RSA_WITH_RC4_128_SHA                RC4-SHA\nSSL_RSA_WITH_IDEA_CBC_SHA               IDEA-CBC-SHA\nSSL_RSA_WITH_3DES_EDE_CBC_SHA           DES-CBC3-SHA\n\nSSL_DH_DSS_WITH_3DES_EDE_CBC_SHA        DH-DSS-DES-CBC3-SHA\nSSL_DH_RSA_WITH_3DES_EDE_CBC_SHA        DH-RSA-DES-CBC3-SHA\nSSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA       DHE-DSS-DES-CBC3-SHA\nSSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA       DHE-RSA-DES-CBC3-SHA\n\nSSL_DH_anon_WITH_RC4_128_MD5            ADH-RC4-MD5\nSSL_DH_anon_WITH_3DES_EDE_CBC_SHA       ADH-DES-CBC3-SHA\n\nSSL_FORTEZZA_KEA_WITH_NULL_SHA          Not implemented.\nSSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA  Not implemented.\nSSL_FORTEZZA_KEA_WITH_RC4_128_SHA       Not implemented.\n
"},{"location":"man1/openssl-ciphers/#tls-v10-cipher-suites","title":"TLS v1.0 cipher suites","text":"
TLS_RSA_WITH_NULL_MD5                   NULL-MD5\nTLS_RSA_WITH_NULL_SHA                   NULL-SHA\nTLS_RSA_WITH_RC4_128_MD5                RC4-MD5\nTLS_RSA_WITH_RC4_128_SHA                RC4-SHA\nTLS_RSA_WITH_IDEA_CBC_SHA               IDEA-CBC-SHA\nTLS_RSA_WITH_3DES_EDE_CBC_SHA           DES-CBC3-SHA\n\nTLS_DH_DSS_WITH_3DES_EDE_CBC_SHA        Not implemented.\nTLS_DH_RSA_WITH_3DES_EDE_CBC_SHA        Not implemented.\nTLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA       DHE-DSS-DES-CBC3-SHA\nTLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA       DHE-RSA-DES-CBC3-SHA\n\nTLS_DH_anon_WITH_RC4_128_MD5            ADH-RC4-MD5\nTLS_DH_anon_WITH_3DES_EDE_CBC_SHA       ADH-DES-CBC3-SHA\n
"},{"location":"man1/openssl-ciphers/#aes-cipher-suites-from-rfc3268-extending-tls-v10","title":"AES cipher suites from RFC3268, extending TLS v1.0","text":"
TLS_RSA_WITH_AES_128_CBC_SHA            AES128-SHA\nTLS_RSA_WITH_AES_256_CBC_SHA            AES256-SHA\n\nTLS_DH_DSS_WITH_AES_128_CBC_SHA         DH-DSS-AES128-SHA\nTLS_DH_DSS_WITH_AES_256_CBC_SHA         DH-DSS-AES256-SHA\nTLS_DH_RSA_WITH_AES_128_CBC_SHA         DH-RSA-AES128-SHA\nTLS_DH_RSA_WITH_AES_256_CBC_SHA         DH-RSA-AES256-SHA\n\nTLS_DHE_DSS_WITH_AES_128_CBC_SHA        DHE-DSS-AES128-SHA\nTLS_DHE_DSS_WITH_AES_256_CBC_SHA        DHE-DSS-AES256-SHA\nTLS_DHE_RSA_WITH_AES_128_CBC_SHA        DHE-RSA-AES128-SHA\nTLS_DHE_RSA_WITH_AES_256_CBC_SHA        DHE-RSA-AES256-SHA\n\nTLS_DH_anon_WITH_AES_128_CBC_SHA        ADH-AES128-SHA\nTLS_DH_anon_WITH_AES_256_CBC_SHA        ADH-AES256-SHA\n
"},{"location":"man1/openssl-ciphers/#camellia-cipher-suites-from-rfc4132-extending-tls-v10","title":"Camellia cipher suites from RFC4132, extending TLS v1.0","text":"
TLS_RSA_WITH_CAMELLIA_128_CBC_SHA      CAMELLIA128-SHA\nTLS_RSA_WITH_CAMELLIA_256_CBC_SHA      CAMELLIA256-SHA\n\nTLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA   DH-DSS-CAMELLIA128-SHA\nTLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA   DH-DSS-CAMELLIA256-SHA\nTLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA   DH-RSA-CAMELLIA128-SHA\nTLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA   DH-RSA-CAMELLIA256-SHA\n\nTLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA  DHE-DSS-CAMELLIA128-SHA\nTLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA  DHE-DSS-CAMELLIA256-SHA\nTLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA  DHE-RSA-CAMELLIA128-SHA\nTLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA  DHE-RSA-CAMELLIA256-SHA\n\nTLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA  ADH-CAMELLIA128-SHA\nTLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA  ADH-CAMELLIA256-SHA\n
"},{"location":"man1/openssl-ciphers/#seed-cipher-suites-from-rfc4162-extending-tls-v10","title":"SEED cipher suites from RFC4162, extending TLS v1.0","text":"
TLS_RSA_WITH_SEED_CBC_SHA              SEED-SHA\n\nTLS_DH_DSS_WITH_SEED_CBC_SHA           DH-DSS-SEED-SHA\nTLS_DH_RSA_WITH_SEED_CBC_SHA           DH-RSA-SEED-SHA\n\nTLS_DHE_DSS_WITH_SEED_CBC_SHA          DHE-DSS-SEED-SHA\nTLS_DHE_RSA_WITH_SEED_CBC_SHA          DHE-RSA-SEED-SHA\n\nTLS_DH_anon_WITH_SEED_CBC_SHA          ADH-SEED-SHA\n
"},{"location":"man1/openssl-ciphers/#gost-cipher-suites-from-draft-chudov-cryptopro-cptls-extending-tls-v10","title":"GOST cipher suites from draft-chudov-cryptopro-cptls, extending TLS v1.0","text":"

Note: these ciphers require an engine which including GOST cryptographic algorithms, such as the gost engine, which isn't part of the OpenSSL distribution.

TLS_GOSTR341094_WITH_28147_CNT_IMIT GOST94-GOST89-GOST89\nTLS_GOSTR341001_WITH_28147_CNT_IMIT GOST2001-GOST89-GOST89\nTLS_GOSTR341094_WITH_NULL_GOSTR3411 GOST94-NULL-GOST94\nTLS_GOSTR341001_WITH_NULL_GOSTR3411 GOST2001-NULL-GOST94\n
"},{"location":"man1/openssl-ciphers/#gost-cipher-suites-extending-tls-v12","title":"GOST cipher suites, extending TLS v1.2","text":"

Note: these ciphers require an engine which including GOST cryptographic algorithms, such as the gost engine, which isn't part of the OpenSSL distribution.

TLS_GOSTR341112_256_WITH_28147_CNT_IMIT GOST2012-GOST8912-GOST8912\nTLS_GOSTR341112_256_WITH_NULL_GOSTR3411 GOST2012-NULL-GOST12\n

Note: GOST2012-GOST8912-GOST8912 is an alias for two ciphers ID old LEGACY-GOST2012-GOST8912-GOST8912 and new IANA-GOST2012-GOST8912-GOST8912

"},{"location":"man1/openssl-ciphers/#additional-export-1024-and-other-cipher-suites","title":"Additional Export 1024 and other cipher suites","text":"

Note: these ciphers can also be used in SSL v3.

TLS_DHE_DSS_WITH_RC4_128_SHA            DHE-DSS-RC4-SHA\n
"},{"location":"man1/openssl-ciphers/#elliptic-curve-cipher-suites","title":"Elliptic curve cipher suites","text":"
TLS_ECDHE_RSA_WITH_NULL_SHA             ECDHE-RSA-NULL-SHA\nTLS_ECDHE_RSA_WITH_RC4_128_SHA          ECDHE-RSA-RC4-SHA\nTLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA     ECDHE-RSA-DES-CBC3-SHA\nTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA      ECDHE-RSA-AES128-SHA\nTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA      ECDHE-RSA-AES256-SHA\n\nTLS_ECDHE_ECDSA_WITH_NULL_SHA           ECDHE-ECDSA-NULL-SHA\nTLS_ECDHE_ECDSA_WITH_RC4_128_SHA        ECDHE-ECDSA-RC4-SHA\nTLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA   ECDHE-ECDSA-DES-CBC3-SHA\nTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA    ECDHE-ECDSA-AES128-SHA\nTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA    ECDHE-ECDSA-AES256-SHA\n\nTLS_ECDH_anon_WITH_NULL_SHA             AECDH-NULL-SHA\nTLS_ECDH_anon_WITH_RC4_128_SHA          AECDH-RC4-SHA\nTLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA     AECDH-DES-CBC3-SHA\nTLS_ECDH_anon_WITH_AES_128_CBC_SHA      AECDH-AES128-SHA\nTLS_ECDH_anon_WITH_AES_256_CBC_SHA      AECDH-AES256-SHA\n
"},{"location":"man1/openssl-ciphers/#tls-v12-cipher-suites","title":"TLS v1.2 cipher suites","text":"
TLS_RSA_WITH_NULL_SHA256                  NULL-SHA256\n\nTLS_RSA_WITH_AES_128_CBC_SHA256           AES128-SHA256\nTLS_RSA_WITH_AES_256_CBC_SHA256           AES256-SHA256\nTLS_RSA_WITH_AES_128_GCM_SHA256           AES128-GCM-SHA256\nTLS_RSA_WITH_AES_256_GCM_SHA384           AES256-GCM-SHA384\n\nTLS_DH_RSA_WITH_AES_128_CBC_SHA256        DH-RSA-AES128-SHA256\nTLS_DH_RSA_WITH_AES_256_CBC_SHA256        DH-RSA-AES256-SHA256\nTLS_DH_RSA_WITH_AES_128_GCM_SHA256        DH-RSA-AES128-GCM-SHA256\nTLS_DH_RSA_WITH_AES_256_GCM_SHA384        DH-RSA-AES256-GCM-SHA384\n\nTLS_DH_DSS_WITH_AES_128_CBC_SHA256        DH-DSS-AES128-SHA256\nTLS_DH_DSS_WITH_AES_256_CBC_SHA256        DH-DSS-AES256-SHA256\nTLS_DH_DSS_WITH_AES_128_GCM_SHA256        DH-DSS-AES128-GCM-SHA256\nTLS_DH_DSS_WITH_AES_256_GCM_SHA384        DH-DSS-AES256-GCM-SHA384\n\nTLS_DHE_RSA_WITH_AES_128_CBC_SHA256       DHE-RSA-AES128-SHA256\nTLS_DHE_RSA_WITH_AES_256_CBC_SHA256       DHE-RSA-AES256-SHA256\nTLS_DHE_RSA_WITH_AES_128_GCM_SHA256       DHE-RSA-AES128-GCM-SHA256\nTLS_DHE_RSA_WITH_AES_256_GCM_SHA384       DHE-RSA-AES256-GCM-SHA384\n\nTLS_DHE_DSS_WITH_AES_128_CBC_SHA256       DHE-DSS-AES128-SHA256\nTLS_DHE_DSS_WITH_AES_256_CBC_SHA256       DHE-DSS-AES256-SHA256\nTLS_DHE_DSS_WITH_AES_128_GCM_SHA256       DHE-DSS-AES128-GCM-SHA256\nTLS_DHE_DSS_WITH_AES_256_GCM_SHA384       DHE-DSS-AES256-GCM-SHA384\n\nTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256     ECDHE-RSA-AES128-SHA256\nTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384     ECDHE-RSA-AES256-SHA384\nTLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256     ECDHE-RSA-AES128-GCM-SHA256\nTLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384     ECDHE-RSA-AES256-GCM-SHA384\n\nTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256   ECDHE-ECDSA-AES128-SHA256\nTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384   ECDHE-ECDSA-AES256-SHA384\nTLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256   ECDHE-ECDSA-AES128-GCM-SHA256\nTLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384   ECDHE-ECDSA-AES256-GCM-SHA384\n\nTLS_DH_anon_WITH_AES_128_CBC_SHA256       ADH-AES128-SHA256\nTLS_DH_anon_WITH_AES_256_CBC_SHA256       ADH-AES256-SHA256\nTLS_DH_anon_WITH_AES_128_GCM_SHA256       ADH-AES128-GCM-SHA256\nTLS_DH_anon_WITH_AES_256_GCM_SHA384       ADH-AES256-GCM-SHA384\n\nRSA_WITH_AES_128_CCM                      AES128-CCM\nRSA_WITH_AES_256_CCM                      AES256-CCM\nDHE_RSA_WITH_AES_128_CCM                  DHE-RSA-AES128-CCM\nDHE_RSA_WITH_AES_256_CCM                  DHE-RSA-AES256-CCM\nRSA_WITH_AES_128_CCM_8                    AES128-CCM8\nRSA_WITH_AES_256_CCM_8                    AES256-CCM8\nDHE_RSA_WITH_AES_128_CCM_8                DHE-RSA-AES128-CCM8\nDHE_RSA_WITH_AES_256_CCM_8                DHE-RSA-AES256-CCM8\nECDHE_ECDSA_WITH_AES_128_CCM              ECDHE-ECDSA-AES128-CCM\nECDHE_ECDSA_WITH_AES_256_CCM              ECDHE-ECDSA-AES256-CCM\nECDHE_ECDSA_WITH_AES_128_CCM_8            ECDHE-ECDSA-AES128-CCM8\nECDHE_ECDSA_WITH_AES_256_CCM_8            ECDHE-ECDSA-AES256-CCM8\n
"},{"location":"man1/openssl-ciphers/#aria-cipher-suites-from-rfc6209-extending-tls-v12","title":"ARIA cipher suites from RFC6209, extending TLS v1.2","text":"

Note: the CBC modes mentioned in this RFC are not supported.

TLS_RSA_WITH_ARIA_128_GCM_SHA256          ARIA128-GCM-SHA256\nTLS_RSA_WITH_ARIA_256_GCM_SHA384          ARIA256-GCM-SHA384\nTLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256      DHE-RSA-ARIA128-GCM-SHA256\nTLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384      DHE-RSA-ARIA256-GCM-SHA384\nTLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256      DHE-DSS-ARIA128-GCM-SHA256\nTLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384      DHE-DSS-ARIA256-GCM-SHA384\nTLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256  ECDHE-ECDSA-ARIA128-GCM-SHA256\nTLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384  ECDHE-ECDSA-ARIA256-GCM-SHA384\nTLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256    ECDHE-ARIA128-GCM-SHA256\nTLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384    ECDHE-ARIA256-GCM-SHA384\nTLS_PSK_WITH_ARIA_128_GCM_SHA256          PSK-ARIA128-GCM-SHA256\nTLS_PSK_WITH_ARIA_256_GCM_SHA384          PSK-ARIA256-GCM-SHA384\nTLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256      DHE-PSK-ARIA128-GCM-SHA256\nTLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384      DHE-PSK-ARIA256-GCM-SHA384\nTLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256      RSA-PSK-ARIA128-GCM-SHA256\nTLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384      RSA-PSK-ARIA256-GCM-SHA384\n
"},{"location":"man1/openssl-ciphers/#camellia-hmac-based-cipher-suites-from-rfc6367-extending-tls-v12","title":"Camellia HMAC-Based cipher suites from RFC6367, extending TLS v1.2","text":"
TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 ECDHE-ECDSA-CAMELLIA128-SHA256\nTLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 ECDHE-ECDSA-CAMELLIA256-SHA384\nTLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256   ECDHE-RSA-CAMELLIA128-SHA256\nTLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384   ECDHE-RSA-CAMELLIA256-SHA384\n
"},{"location":"man1/openssl-ciphers/#pre-shared-keying-psk-cipher-suites","title":"Pre-shared keying (PSK) cipher suites","text":"
PSK_WITH_NULL_SHA                         PSK-NULL-SHA\nDHE_PSK_WITH_NULL_SHA                     DHE-PSK-NULL-SHA\nRSA_PSK_WITH_NULL_SHA                     RSA-PSK-NULL-SHA\n\nPSK_WITH_RC4_128_SHA                      PSK-RC4-SHA\nPSK_WITH_3DES_EDE_CBC_SHA                 PSK-3DES-EDE-CBC-SHA\nPSK_WITH_AES_128_CBC_SHA                  PSK-AES128-CBC-SHA\nPSK_WITH_AES_256_CBC_SHA                  PSK-AES256-CBC-SHA\n\nDHE_PSK_WITH_RC4_128_SHA                  DHE-PSK-RC4-SHA\nDHE_PSK_WITH_3DES_EDE_CBC_SHA             DHE-PSK-3DES-EDE-CBC-SHA\nDHE_PSK_WITH_AES_128_CBC_SHA              DHE-PSK-AES128-CBC-SHA\nDHE_PSK_WITH_AES_256_CBC_SHA              DHE-PSK-AES256-CBC-SHA\n\nRSA_PSK_WITH_RC4_128_SHA                  RSA-PSK-RC4-SHA\nRSA_PSK_WITH_3DES_EDE_CBC_SHA             RSA-PSK-3DES-EDE-CBC-SHA\nRSA_PSK_WITH_AES_128_CBC_SHA              RSA-PSK-AES128-CBC-SHA\nRSA_PSK_WITH_AES_256_CBC_SHA              RSA-PSK-AES256-CBC-SHA\n\nPSK_WITH_AES_128_GCM_SHA256               PSK-AES128-GCM-SHA256\nPSK_WITH_AES_256_GCM_SHA384               PSK-AES256-GCM-SHA384\nDHE_PSK_WITH_AES_128_GCM_SHA256           DHE-PSK-AES128-GCM-SHA256\nDHE_PSK_WITH_AES_256_GCM_SHA384           DHE-PSK-AES256-GCM-SHA384\nRSA_PSK_WITH_AES_128_GCM_SHA256           RSA-PSK-AES128-GCM-SHA256\nRSA_PSK_WITH_AES_256_GCM_SHA384           RSA-PSK-AES256-GCM-SHA384\n\nPSK_WITH_AES_128_CBC_SHA256               PSK-AES128-CBC-SHA256\nPSK_WITH_AES_256_CBC_SHA384               PSK-AES256-CBC-SHA384\nPSK_WITH_NULL_SHA256                      PSK-NULL-SHA256\nPSK_WITH_NULL_SHA384                      PSK-NULL-SHA384\nDHE_PSK_WITH_AES_128_CBC_SHA256           DHE-PSK-AES128-CBC-SHA256\nDHE_PSK_WITH_AES_256_CBC_SHA384           DHE-PSK-AES256-CBC-SHA384\nDHE_PSK_WITH_NULL_SHA256                  DHE-PSK-NULL-SHA256\nDHE_PSK_WITH_NULL_SHA384                  DHE-PSK-NULL-SHA384\nRSA_PSK_WITH_AES_128_CBC_SHA256           RSA-PSK-AES128-CBC-SHA256\nRSA_PSK_WITH_AES_256_CBC_SHA384           RSA-PSK-AES256-CBC-SHA384\nRSA_PSK_WITH_NULL_SHA256                  RSA-PSK-NULL-SHA256\nRSA_PSK_WITH_NULL_SHA384                  RSA-PSK-NULL-SHA384\nPSK_WITH_AES_128_GCM_SHA256               PSK-AES128-GCM-SHA256\nPSK_WITH_AES_256_GCM_SHA384               PSK-AES256-GCM-SHA384\n\nECDHE_PSK_WITH_RC4_128_SHA                ECDHE-PSK-RC4-SHA\nECDHE_PSK_WITH_3DES_EDE_CBC_SHA           ECDHE-PSK-3DES-EDE-CBC-SHA\nECDHE_PSK_WITH_AES_128_CBC_SHA            ECDHE-PSK-AES128-CBC-SHA\nECDHE_PSK_WITH_AES_256_CBC_SHA            ECDHE-PSK-AES256-CBC-SHA\nECDHE_PSK_WITH_AES_128_CBC_SHA256         ECDHE-PSK-AES128-CBC-SHA256\nECDHE_PSK_WITH_AES_256_CBC_SHA384         ECDHE-PSK-AES256-CBC-SHA384\nECDHE_PSK_WITH_NULL_SHA                   ECDHE-PSK-NULL-SHA\nECDHE_PSK_WITH_NULL_SHA256                ECDHE-PSK-NULL-SHA256\nECDHE_PSK_WITH_NULL_SHA384                ECDHE-PSK-NULL-SHA384\n\nPSK_WITH_CAMELLIA_128_CBC_SHA256          PSK-CAMELLIA128-SHA256\nPSK_WITH_CAMELLIA_256_CBC_SHA384          PSK-CAMELLIA256-SHA384\n\nDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256      DHE-PSK-CAMELLIA128-SHA256\nDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384      DHE-PSK-CAMELLIA256-SHA384\n\nRSA_PSK_WITH_CAMELLIA_128_CBC_SHA256      RSA-PSK-CAMELLIA128-SHA256\nRSA_PSK_WITH_CAMELLIA_256_CBC_SHA384      RSA-PSK-CAMELLIA256-SHA384\n\nECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256    ECDHE-PSK-CAMELLIA128-SHA256\nECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384    ECDHE-PSK-CAMELLIA256-SHA384\n\nPSK_WITH_AES_128_CCM                      PSK-AES128-CCM\nPSK_WITH_AES_256_CCM                      PSK-AES256-CCM\nDHE_PSK_WITH_AES_128_CCM                  DHE-PSK-AES128-CCM\nDHE_PSK_WITH_AES_256_CCM                  DHE-PSK-AES256-CCM\nPSK_WITH_AES_128_CCM_8                    PSK-AES128-CCM8\nPSK_WITH_AES_256_CCM_8                    PSK-AES256-CCM8\nDHE_PSK_WITH_AES_128_CCM_8                DHE-PSK-AES128-CCM8\nDHE_PSK_WITH_AES_256_CCM_8                DHE-PSK-AES256-CCM8\n
"},{"location":"man1/openssl-ciphers/#chacha20-poly1305-cipher-suites-extending-tls-v12","title":"ChaCha20-Poly1305 cipher suites, extending TLS v1.2","text":"
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256      ECDHE-RSA-CHACHA20-POLY1305\nTLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256    ECDHE-ECDSA-CHACHA20-POLY1305\nTLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256        DHE-RSA-CHACHA20-POLY1305\nTLS_PSK_WITH_CHACHA20_POLY1305_SHA256            PSK-CHACHA20-POLY1305\nTLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256      ECDHE-PSK-CHACHA20-POLY1305\nTLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256        DHE-PSK-CHACHA20-POLY1305\nTLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256        RSA-PSK-CHACHA20-POLY1305\n
"},{"location":"man1/openssl-ciphers/#tls-v13-cipher-suites","title":"TLS v1.3 cipher suites","text":"
TLS_AES_128_GCM_SHA256                     TLS_AES_128_GCM_SHA256\nTLS_AES_256_GCM_SHA384                     TLS_AES_256_GCM_SHA384\nTLS_CHACHA20_POLY1305_SHA256               TLS_CHACHA20_POLY1305_SHA256\nTLS_AES_128_CCM_SHA256                     TLS_AES_128_CCM_SHA256\nTLS_AES_128_CCM_8_SHA256                   TLS_AES_128_CCM_8_SHA256\n
"},{"location":"man1/openssl-ciphers/#older-names-used-by-openssl","title":"Older names used by OpenSSL","text":"

The following names are accepted by older releases:

SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA    EDH-RSA-DES-CBC3-SHA (DHE-RSA-DES-CBC3-SHA)\nSSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA    EDH-DSS-DES-CBC3-SHA (DHE-DSS-DES-CBC3-SHA)\n
"},{"location":"man1/openssl-ciphers/#notes","title":"NOTES","text":"

Some compiled versions of OpenSSL may not include all the ciphers listed here because some ciphers were excluded at compile time.

"},{"location":"man1/openssl-ciphers/#examples","title":"EXAMPLES","text":"

Verbose listing of all OpenSSL ciphers including NULL ciphers:

openssl ciphers -v 'ALL:eNULL'\n

Include all ciphers except NULL and anonymous DH then sort by strength:

openssl ciphers -v 'ALL:!ADH:@STRENGTH'\n

Include all ciphers except ones with no encryption (eNULL) or no authentication (aNULL):

openssl ciphers -v 'ALL:!aNULL'\n

Include only 3DES ciphers and then place RSA ciphers last:

openssl ciphers -v '3DES:+RSA'\n

Include all RC4 ciphers but leave out those without authentication:

openssl ciphers -v 'RC4:!COMPLEMENTOFDEFAULT'\n

Include all ciphers with RSA authentication but leave out ciphers without encryption.

openssl ciphers -v 'RSA:!COMPLEMENTOFALL'\n

Set security level to 2 and display all ciphers consistent with level 2:

openssl ciphers -s -v 'ALL:@SECLEVEL=2'\n
"},{"location":"man1/openssl-ciphers/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-s_client(1), openssl-s_server(1), ssl(7)

"},{"location":"man1/openssl-ciphers/#history","title":"HISTORY","text":"

The -V option was added in OpenSSL 1.0.0.

The -stdname is only available if OpenSSL is built with tracing enabled (enable-ssl-trace argument to Configure) before OpenSSL 1.1.1.

The -convert option was added in OpenSSL 1.1.1.

"},{"location":"man1/openssl-ciphers/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-cmds/","title":"openssl-cmds","text":""},{"location":"man1/openssl-cmds/#name","title":"NAME","text":"

asn1parse, ca, ciphers, cmp, cms, crl, crl2pkcs7, dgst, dhparam, dsa, dsaparam, ec, ecparam, enc, engine, errstr, gendsa, genpkey, genrsa, info, kdf, mac, nseq, ocsp, passwd, pkcs12, pkcs7, pkcs8, pkey, pkeyparam, pkeyutl, prime, rand, rehash, req, rsa, rsautl, s_client, s_server, s_time, sess_id, smime, speed, spkac, srp, storeutl, ts, verify, version, x509 - OpenSSL application commands

"},{"location":"man1/openssl-cmds/#synopsis","title":"SYNOPSIS","text":"

openssl cmd -help | [-option | -option arg] ... [arg] ...

"},{"location":"man1/openssl-cmds/#description","title":"DESCRIPTION","text":"

Every cmd listed above is a (sub-)command of the openssl(1) application. It has its own detailed manual page at openssl-cmd(1). For example, to view the manual page for the openssl dgst command, type man openssl-dgst.

"},{"location":"man1/openssl-cmds/#options","title":"OPTIONS","text":"

Among others, every subcommand has a help option.

  • -help

    Print out a usage message for the subcommand.

"},{"location":"man1/openssl-cmds/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-asn1parse(1), openssl-ca(1), openssl-ciphers(1), openssl-cmp(1), openssl-cms(1), openssl-crl(1), openssl-crl2pkcs7(1), openssl-dgst(1), openssl-dhparam(1), openssl-dsa(1), openssl-dsaparam(1), openssl-ec(1), openssl-ecparam(1), openssl-enc(1), openssl-engine(1), openssl-errstr(1), openssl-gendsa(1), openssl-genpkey(1), openssl-genrsa(1), openssl-info(1), openssl-kdf(1), openssl-mac(1), openssl-nseq(1), openssl-ocsp(1), openssl-passwd(1), openssl-pkcs12(1), openssl-pkcs7(1), openssl-pkcs8(1), openssl-pkey(1), openssl-pkeyparam(1), openssl-pkeyutl(1), openssl-prime(1), openssl-rand(1), openssl-rehash(1), openssl-req(1), openssl-rsa(1), openssl-rsautl(1), openssl-s_client(1), openssl-s_server(1), openssl-s_time(1), openssl-sess_id(1), openssl-smime(1), openssl-speed(1), openssl-spkac(1), openssl-srp(1), openssl-storeutl(1), openssl-ts(1), openssl-verify(1), openssl-version(1), openssl-x509(1),

"},{"location":"man1/openssl-cmds/#history","title":"HISTORY","text":"

Initially, the manual page entry for the openssl _cmd_ command used to be available at cmd(1). Later, the alias openssl-cmd(1) was introduced, which made it easier to group the openssl commands using the apropos(1) command or the shell's tab completion.

In order to reduce cluttering of the global manual page namespace, the manual page entries without the 'openssl-' prefix have been deprecated in OpenSSL 3.0 and will be removed in OpenSSL 4.0.

"},{"location":"man1/openssl-cmds/#copyright","title":"COPYRIGHT","text":"

Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-cmp/","title":"openssl-cmp","text":""},{"location":"man1/openssl-cmp/#name","title":"NAME","text":"

openssl-cmp - Certificate Management Protocol (CMP, RFC 4210) application

"},{"location":"man1/openssl-cmp/#synopsis","title":"SYNOPSIS","text":"

openssl cmp [-help] [-config filename] [-section names] [-verbosity level]

Generic message options:

[-cmd ir|cr|kur|p10cr|rr|genm] [-infotype name] [-geninfo OID:int:N]

Certificate enrollment options:

[-newkey filename|uri] [-newkeypass arg] [-subject name] [-issuer name] [-days number] [-reqexts name] [-sans spec] [-san_nodefault] [-policies name] [-policy_oids names] [-policy_oids_critical] [-popo number] [-csr filename] [-out_trusted filenames|uris] [-implicit_confirm] [-disable_confirm] [-certout filename] [-chainout filename]

Certificate enrollment and revocation options:

[-oldcert filename|uri] [-revreason number]

Message transfer options:

[-server [http[s]://][userinfo@]host[:port][/path][?query][#fragment]] [-proxy [http[s]://][userinfo@]host[:port][/path][?query][#fragment]] [-no_proxy addresses] [-recipient name] [-path remote_path] [-keep_alive value] [-msg_timeout seconds] [-total_timeout seconds]

Server authentication options:

[-trusted filenames|uris] [-untrusted filenames|uris] [-srvcert filename|uri] [-expect_sender name] [-ignore_keyusage] [-unprotected_errors] [-extracertsout filename] [-cacertsout filename]

Client authentication and protection options:

[-ref value] [-secret arg] [-cert filename|uri] [-own_trusted filenames|uris] [-key filename|uri] [-keypass arg] [-digest name] [-mac name] [-extracerts filenames|uris] [-unprotected_requests]

Credentials format options:

[-certform PEM|DER] [-keyform PEM|DER|P12|ENGINE] [-otherpass arg] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

Random state options:

[-rand files] [-writerand file]

TLS connection options:

[-tls_used] [-tls_cert filename|uri] [-tls_key filename|uri] [-tls_keypass arg] [-tls_extra filenames|uris] [-tls_trusted filenames|uris] [-tls_host name]

Client-side debugging options:

[-batch] [-repeat number] [-reqin filenames] [-reqin_new_tid] [-reqout filenames] [-rspin filenames] [-rspout filenames] [-use_mock_srv]

Mock server options:

[-port number] [-max_msgs number] [-srv_ref value] [-srv_secret arg] [-srv_cert filename|uri] [-srv_key filename|uri] [-srv_keypass arg] [-srv_trusted filenames|uris] [-srv_untrusted filenames|uris] [-rsp_cert filename|uri] [-rsp_extracerts filenames|uris] [-rsp_capubs filenames|uris] [-poll_count number] [-check_after number] [-grant_implicitconf] [-pkistatus number] [-failure number] [-failurebits number] [-statusstring arg] [-send_error] [-send_unprotected] [-send_unprot_err] [-accept_unprotected] [-accept_unprot_err] [-accept_raverified]

Certificate verification options, for both CMP and TLS:

[-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks]

"},{"location":"man1/openssl-cmp/#description","title":"DESCRIPTION","text":"

The cmp command is a client implementation for the Certificate Management Protocol (CMP) as defined in RFC4210. It can be used to request certificates from a CA server, update their certificates, request certificates to be revoked, and perform other types of CMP requests.

"},{"location":"man1/openssl-cmp/#options","title":"OPTIONS","text":"
  • -help

    Display a summary of all options

  • -config filename

    Configuration file to use. An empty string \"\" means none. Default filename is from the environment variable OPENSSL_CONF.

  • -section names

    Section(s) to use within config file defining CMP options. An empty string \"\" means no specific section. Default is cmp.

    Multiple section names may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Contents of sections named later may override contents of sections named before. In any case, as usual, the [default] section and finally the unnamed section (as far as present) can provide per-option fallback values.

  • -verbosity level

    Level of verbosity for logging, error output, etc. 0 = EMERG, 1 = ALERT, 2 = CRIT, 3 = ERR, 4 = WARN, 5 = NOTE, 6 = INFO, 7 = DEBUG, 8 = TRACE. Defaults to 6 = INFO.

"},{"location":"man1/openssl-cmp/#generic-message-options","title":"Generic message options","text":"
  • -cmd ir|cr|kur|p10cr|rr|genm

    CMP command to execute. Currently implemented commands are:

    • ir \u00a0 - Initialization Request
    • cr \u00a0 - Certificate Request
    • p10cr - PKCS#10 Certification Request (for legacy support)
    • kur \u00a0\u00a0- Key Update Request
    • rr \u00a0 - Revocation Request
    • genm - General Message

    ir requests initialization of an end entity into a PKI hierarchy by issuing a first certificate.

    cr requests issuing an additional certificate for an end entity already initialized to the PKI hierarchy.

    p10cr requests issuing an additional certificate similarly to cr but using legacy PKCS#10 CSR format.

    kur requests a (key) update for an existing certificate.

    rr requests revocation of an existing certificate.

    genm requests information using a General Message, where optionally included InfoTypeAndValues may be used to state which info is of interest. Upon receipt of the General Response, information about all received ITAV infoTypes is printed to stdout.

  • -infotype name

    Set InfoType name to use for requesting specific info in genm, e.g., signKeyPairTypes.

  • -geninfo OID:int:N

    generalInfo integer values to place in request PKIHeader with given OID, e.g., 1.2.3.4:int:56789.

"},{"location":"man1/openssl-cmp/#certificate-enrollment-options","title":"Certificate enrollment options","text":"
  • -newkey filename|uri

    The source of the private or public key for the certificate being requested. Defaults to the public key in the PKCS#10 CSR given with the -csr option, the public key of the reference certificate, or the current client key.

    The public portion of the key is placed in the certification request.

    Unless -cmd p10cr, -popo -1, or -popo 0 is given, the private key will be needed as well to provide the proof of possession (POPO), where the -key option may provide a fallback.

  • -newkeypass arg

    Pass phrase source for the key given with the -newkey option. If not given here, the password will be prompted for if needed.

    For more information about the format of arg see openssl-passphrase-options(1).

  • -subject name

    X509 Distinguished Name (DN) of subject to use in the requested certificate template. If the NULL-DN (\"/\") is given then no subject is placed in the template. Default is the subject DN of any PKCS#10 CSR given with the -csr option. For KUR, a further fallback is the subject DN of the reference certificate (see -oldcert) if provided. This fallback is used for IR and CR only if no SANs are set.

    If provided and neither -cert nor -oldcert is given, the subject DN is used as fallback sender of outgoing CMP messages.

    The argument must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash); whitespace is retained. Empty values are permitted, but the corresponding type will not be included. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

    /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

  • -issuer name

    X509 issuer Distinguished Name (DN) of the CA server to place in the requested certificate template in IR/CR/KUR. If the NULL-DN (\"/\") is given then no issuer is placed in the template.

    If provided and neither -recipient nor -srvcert is given, the issuer DN is used as fallback recipient of outgoing CMP messages.

    The argument must be formatted as /type0=value0/type1=value1/type2=.... For details see the description of the -subject option.

  • -days number

    Number of days the new certificate is requested to be valid for, counting from the current time of the host. Also triggers the explicit request that the validity period starts from the current time (as seen by the host).

  • -reqexts name

    Name of section in OpenSSL config file defining certificate request extensions. If the -csr option is present, these extensions augment the extensions contained the given PKCS#10 CSR, overriding any extensions with same OIDs.

  • -sans spec

    One or more IP addresses, DNS names, or URIs separated by commas or whitespace (where in the latter case the whole argument must be enclosed in \"...\") to add as Subject Alternative Name(s) (SAN) certificate request extension. If the special element \"critical\" is given the SANs are flagged as critical. Cannot be used if any Subject Alternative Name extension is set via -reqexts.

  • -san_nodefault

    When Subject Alternative Names are not given via -sans nor defined via -reqexts, they are copied by default from the reference certificate (see -oldcert). This can be disabled by giving the -san_nodefault option.

  • -policies name

    Name of section in OpenSSL config file defining policies to be set as certificate request extension. This option cannot be used together with -policy_oids.

  • -policy_oids names

    One or more OID(s), separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\") to add as certificate policies request extension. This option cannot be used together with -policies.

  • -policy_oids_critical

    Flag the policies given with -policy_oids as critical.

  • -popo number

    Proof-of-possession (POPO) method to use for IR/CR/KUR; values: -1..<2> where -1 = NONE, 0 = RAVERIFIED, 1 = SIGNATURE (default), 2 = KEYENC.

    Note that a signature-based POPO can only be produced if a private key is provided via the -newkey or -key options.

  • -csr filename

    PKCS#10 CSR in PEM or DER format containing a certificate request. With -cmd p10cr it is used directly in a legacy P10CR message.

    When used with -cmd ir, cr, or kur, it is transformed into the respective regular CMP request. In this case, a private key must be provided (with -newkey or -key) for the proof of possession (unless -popo -1 or -popo 0 is used) and the respective public key is placed in the certification request (rather than taking over the public key contained in the PKCS#10 CSR).

    PKCS#10 CSR input may also be used with -cmd rr to specify the certificate to be revoked via the included subject name and public key.

  • -out_trusted filenames|uris

    Trusted certificate(s) to use for validating the newly enrolled certificate. During this verification, any certificate status checking is disabled.

    Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

    The certificate verification options -verify_hostname, -verify_ip, and -verify_email only affect the certificate verification enabled via this option.

  • -implicit_confirm

    Request implicit confirmation of newly enrolled certificates.

  • -disable_confirm

    Do not send certificate confirmation message for newly enrolled certificate without requesting implicit confirmation to cope with broken servers not supporting implicit confirmation correctly. WARNING: This leads to behavior violating RFC 4210.

  • -certout filename

    The file where the newly enrolled certificate should be saved.

  • -chainout filename

    The file where the chain of the newly enrolled certificate should be saved.

"},{"location":"man1/openssl-cmp/#certificate-enrollment-and-revocation-options","title":"Certificate enrollment and revocation options","text":"
  • -oldcert filename|uri

    The certificate to be updated (i.e., renewed or re-keyed) in Key Update Request (KUR) messages or to be revoked in Revocation Request (RR) messages. For KUR the certificate to be updated defaults to -cert, and the resulting certificate is called reference certificate. For RR the certificate to be revoked can also be specified using -csr.

    The reference certificate, if any, is also used for deriving default subject DN and Subject Alternative Names and the default issuer entry in the requested certificate template of an IR/CR/KUR. Its public key is used as a fallback in the template of certification requests. Its subject is used as sender of outgoing messages if -cert is not given. Its issuer is used as default recipient in CMP message headers if neither -recipient, -srvcert, nor -issuer is given.

  • -revreason number

    Set CRLReason to be included in revocation request (RR); values: 0..10 or -1 for none (which is the default).

    Reason numbers defined in RFC 5280 are:

    CRLReason ::= ENUMERATED {\n     unspecified             (0),\n     keyCompromise           (1),\n     cACompromise            (2),\n     affiliationChanged      (3),\n     superseded              (4),\n     cessationOfOperation    (5),\n     certificateHold         (6),\n     -- value 7 is not used\n     removeFromCRL           (8),\n     privilegeWithdrawn      (9),\n     aACompromise           (10)\n }\n
"},{"location":"man1/openssl-cmp/#message-transfer-options","title":"Message transfer options","text":"
  • -server [http[s]://][userinfo@]host[:port][/path][?query][#fragment]

    The DNS hostname or IP address and optionally port of the CMP server to connect to using HTTP(S). This option excludes -port and -use_mock_srv. It is ignored if -rspin is given with enough filename arguments.

    The scheme https may be given only if the -tls_used option is used. In this case the default port is 443, else 80. The optional userinfo and fragment components are ignored. Any given query component is handled as part of the path component. If a path is included it provides the default value for the -path option.

  • -proxy [http[s]://][userinfo@]host[:port][/path][?query][#fragment]

    The HTTP(S) proxy server to use for reaching the CMP server unless -no_proxy applies, see below. The proxy port defaults to 80 or 443 if the scheme is https; apart from that the optional http:// or https:// prefix is ignored (note that TLS may be selected by -tls_used), as well as any path, userinfo, and query, and fragment components. Defaults to the environment variable http_proxy if set, else HTTP_PROXY in case no TLS is used, otherwise https_proxy if set, else HTTPS_PROXY. This option is ignored if -server is not given.

  • -no_proxy addresses

    List of IP addresses and/or DNS names of servers not to use an HTTP(S) proxy for, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Default is from the environment variable no_proxy if set, else NO_PROXY. This option is ignored if -server is not given.

  • -recipient name

    Distinguished Name (DN) to use in the recipient field of CMP request message headers, i.e., the CMP server (usually the addressed CA).

    The recipient field in the header of a CMP message is mandatory. If not given explicitly the recipient is determined in the following order: the subject of the CMP server certificate given with the -srvcert option, the -issuer option, the issuer of the certificate given with the -oldcert option, the issuer of the CMP client certificate (-cert option), as far as any of those is present, else the NULL-DN as last resort.

    The argument must be formatted as /type0=value0/type1=value1/type2=.... For details see the description of the -subject option.

  • -path remote_path

    HTTP path at the CMP server (aka CMP alias) to use for POST requests. Defaults to any path given with -server, else \"/\".

  • -keep_alive value

    If the given value is 0 then HTTP connections are not kept open after receiving a response, which is the default behavior for HTTP 1.0. If the value is 1 or 2 then persistent connections are requested. If the value is 2 then persistent connections are required, i.e., in case the server does not grant them an error occurs. The default value is 1, which means preferring to keep the connection open.

  • -msg_timeout seconds

    Number of seconds a CMP request-response message round trip is allowed to take before a timeout error is returned. A value <= 0 means no limitation (waiting indefinitely). Default is to use the -total_timeout setting.

  • -total_timeout seconds

    Maximum total number of seconds a transaction may take, including polling etc. A value <= 0 means no limitation (waiting indefinitely). Default is 0.

"},{"location":"man1/openssl-cmp/#server-authentication-options","title":"Server authentication options","text":"
  • -trusted filenames|uris

    The certificate(s), typically of root CAs, the client shall use as trust anchors when validating signature-based protection of CMP response messages. This option is ignored if the -srvcert option is given as well. It provides more flexibility than -srvcert because the CMP protection certificate of the server is not pinned but may be any certificate from which a chain to one of the given trust anchors can be constructed.

    If none of -trusted, -srvcert, and -secret is given, message validation errors will be thrown unless -unprotected_errors permits an exception.

    Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

    The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

  • -untrusted filenames|uris

    Non-trusted intermediate CA certificate(s). Any extra certificates given with the -cert option are appended to it. All these certificates may be useful for cert path construction for the own CMP signer certificate (to include in the extraCerts field of request messages) and for the TLS client certificate (if TLS is enabled) as well as for chain building when validating server certificates (checking signature-based CMP message protection) and when validating newly enrolled certificates.

    Multiple filenames or URLs may be given, separated by commas and/or whitespace. Each source may contain multiple certificates.

  • -srvcert filename|uri

    The specific CMP server certificate to expect and directly trust (even if it is expired) when verifying signature-based protection of CMP response messages. This pins the accepted server and results in ignoring the -trusted option.

    If set, the subject of the certificate is also used as default value for the recipient of CMP requests and as default value for the expected sender of CMP responses.

  • -expect_sender name

    Distinguished Name (DN) expected in the sender field of incoming CMP messages. Defaults to the subject DN of the pinned -srvcert, if any.

    This can be used to make sure that only a particular entity is accepted as CMP message signer, and attackers are not able to use arbitrary certificates of a trusted PKI hierarchy to fraudulently pose as a CMP server. Note that this option gives slightly more freedom than setting the -srvcert, which pins the server to the holder of a particular certificate, while the expected sender name will continue to match after updates of the server cert.

    The argument must be formatted as /type0=value0/type1=value1/type2=.... For details see the description of the -subject option.

  • -ignore_keyusage

    Ignore key usage restrictions in CMP signer certificates when validating signature-based protection of incoming CMP messages. By default, digitalSignature must be allowed by CMP signer certificates.

  • -unprotected_errors

    Accept missing or invalid protection of negative responses from the server. This applies to the following message types and contents:

    • error messages
    • negative certificate responses (IP/CP/KUP)
    • negative revocation responses (RP)
    • negative PKIConf messages

    WARNING: This setting leads to unspecified behavior and it is meant exclusively to allow interoperability with server implementations violating RFC 4210, e.g.:

    • section 5.1.3.1 allows exceptions from protecting only for special cases: \"There MAY be cases in which the PKIProtection BIT STRING is deliberately not used to protect a message [...] because other protection, external to PKIX, will be applied instead.\"
    • section 5.3.21 is clear on ErrMsgContent: \"The CA MUST always sign it with a signature key.\"
    • appendix D.4 shows PKIConf message having protection
  • -extracertsout filename

    The file where to save all certificates contained in the extraCerts field of the last received response message (except for pollRep and PKIConf).

  • -cacertsout filename

    The file where to save any CA certificates contained in the caPubs field of the last received certificate response (i.e., IP, CP, or KUP) message.

"},{"location":"man1/openssl-cmp/#client-authentication-options","title":"Client authentication options","text":"
  • -ref value

    Reference number/string/value to use as fallback senderKID; this is required if no sender name can be determined from the -cert or <-subject> options and is typically used when authenticating with pre-shared key (password-based MAC).

  • -secret arg

    Provides the source of a secret value to use with MAC-based message protection. This takes precedence over the -cert and -key options. The secret is used for creating MAC-based protection of outgoing messages and for validating incoming messages that have MAC-based protection. The algorithm used by default is Password-Based Message Authentication Code (PBM) as defined in RFC 4210 section 5.1.3.1.

    For more information about the format of arg see openssl-passphrase-options(1).

  • -cert filename|uri

    The client's current CMP signer certificate. Requires the corresponding key to be given with -key.

    The subject and the public key contained in this certificate serve as fallback values in the certificate template of IR/CR/KUR messages.

    The subject of this certificate will be used as sender of outgoing CMP messages, while the subject of -oldcert or -subjectName may provide fallback values.

    The issuer of this certificate is used as one of the recipient fallback values and as fallback issuer entry in the certificate template of IR/CR/KUR messages.

    When performing signature-based message protection, this \"protection certificate\", also called \"signer certificate\", will be included first in the extraCerts field of outgoing messages and the signature is done with the corresponding key. In Initialization Request (IR) messages this can be used for authenticating using an external entity certificate as defined in appendix E.7 of RFC 4210.

    For Key Update Request (KUR) messages this is also used as the certificate to be updated if the -oldcert option is not given.

    If the file includes further certs, they are appended to the untrusted certs because they typically constitute the chain of the client certificate, which is included in the extraCerts field in signature-protected request messages.

  • -own_trusted filenames|uris

    If this list of certificates is provided then the chain built for the client-side CMP signer certificate given with the -cert option is verified using the given certificates as trust anchors.

    Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

    The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

  • -key filename|uri

    The corresponding private key file for the client's current certificate given in the -cert option. This will be used for signature-based message protection unless the -secret option indicating MAC-based protection or -unprotected_requests is given.

    It is also used as a fallback for the -newkey option with IR/CR/KUR messages.

  • -keypass arg

    Pass phrase source for the private key given with the -key option. Also used for -cert and -oldcert in case it is an encrypted PKCS#12 file. If not given here, the password will be prompted for if needed.

    For more information about the format of arg see openssl-passphrase-options(1).

  • -digest name

    Specifies name of supported digest to use in RFC 4210's MSG_SIG_ALG and as the one-way function (OWF) in MSG_MAC_ALG. If applicable, this is used for message protection and proof-of-possession (POPO) signatures. To see the list of supported digests, use openssl list -digest-commands. Defaults to sha256.

  • -mac name

    Specifies the name of the MAC algorithm in MSG_MAC_ALG. To get the names of supported MAC algorithms use openssl list -mac-algorithms and possibly combine such a name with the name of a supported digest algorithm, e.g., hmacWithSHA256. Defaults to hmac-sha1 as per RFC 4210.

  • -extracerts filenames|uris

    Certificates to append in the extraCerts field when sending messages. They can be used as the default CMP signer certificate chain to include.

    Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

  • -unprotected_requests

    Send request messages without CMP-level protection.

"},{"location":"man1/openssl-cmp/#credentials-format-options","title":"Credentials format options","text":"
  • -certform PEM|DER

    File format to use when saving a certificate to a file. Default value is PEM.

  • -keyform PEM|DER|P12|ENGINE

    The format of the key input; unspecified by default. See \"Format Options\" in openssl(1) for details.

  • -otherpass arg

    Pass phrase source for certificate given with the -trusted, -untrusted, -own_trusted, -srvcert, -out_trusted, -extracerts, -srv_trusted, -srv_untrusted, -rsp_extracerts, -rsp_capubs, -tls_extra, and -tls_trusted options. If not given here, the password will be prompted for if needed.

    For more information about the format of arg see openssl-passphrase-options(1).

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

    As an alternative to using this combination:

    -engine {engineid} -key {keyid} -keyform ENGINE\n

    ... it's also possible to just give the key ID in URI form to -key, like this:

    -key org.openssl.engine:{engineid}:{keyid}\n

    This applies to all options specifying keys: -key, -newkey, and -tls_key.

"},{"location":"man1/openssl-cmp/#provider-options","title":"Provider options","text":"
  • -provider name
  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-cmp/#random-state-options","title":"Random state options","text":"
  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

"},{"location":"man1/openssl-cmp/#tls-connection-options","title":"TLS connection options","text":"
  • -tls_used

    Enable using TLS (even when other TLS-related options are not set) for message exchange with CMP server via HTTP. This option is not supported with the -port option. It is ignored if the -server option is not given or -use_mock_srv is given or -rspin is given with enough filename arguments.

    The following TLS-related options are ignored if -tls_used is not given or does not take effect.

  • -tls_cert filename|uri

    Client's TLS certificate. If the source includes further certs they are used (along with -untrusted certs) for constructing the client cert chain provided to the TLS server.

  • -tls_key filename|uri

    Private key for the client's TLS certificate.

  • -tls_keypass arg

    Pass phrase source for client's private TLS key -tls_key. Also used for -tls_cert in case it is an encrypted PKCS#12 file. If not given here, the password will be prompted for if needed.

    For more information about the format of arg see openssl-passphrase-options(1).

  • -tls_extra filenames|uris

    Extra certificates to provide to TLS server during TLS handshake

  • -tls_trusted filenames|uris

    Trusted certificate(s) to use for validating the TLS server certificate. This implies hostname validation.

    Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

    The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

  • -tls_host name

    Address to be checked during hostname validation. This may be a DNS name or an IP address. If not given it defaults to the -server address.

"},{"location":"man1/openssl-cmp/#client-side-debugging-options","title":"Client-side debugging options","text":"
  • -batch

    Do not interactively prompt for input, for instance when a password is needed. This can be useful for batch processing and testing.

  • -repeat number

    Invoke the command the given positive number of times with the same parameters. Default is one invocation.

  • -reqin filenames

    Take the sequence of CMP requests to send to the server from the given file(s) rather than from the sequence of requests produced internally.

    This option is ignored if the -rspin option is given because in the latter case no requests are actually sent.

    Multiple filenames may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\").

    The files are read as far as needed to complete the transaction and filenames have been provided. If more requests are needed, the remaining ones are taken from the items at the respective position in the sequence of requests produced internally.

    The client needs to update the recipNonce field in the given requests (except for the first one) in order to satisfy the checks to be performed by the server. This causes re-protection (if protecting requests is required).

  • -reqin_new_tid

    Use a fresh transactionID for CMP request messages read using -reqin, which causes their reprotection (if protecting requests is required). This may be needed in case the sequence of requests is reused and the CMP server complains that the transaction ID has already been used.

  • -reqout filenames

    Save the sequence of CMP requests created by the client to the given file(s). These requests are not sent to the server if the -reqin option is used, too.

    Multiple filenames may be given, separated by commas and/or whitespace.

    Files are written as far as needed to save the transaction and filenames have been provided. If the transaction contains more requests, the remaining ones are not saved.

  • -rspin filenames

    Process the sequence of CMP responses provided in the given file(s), not contacting any given server, as long as enough filenames are provided to complete the transaction.

    Multiple filenames may be given, separated by commas and/or whitespace.

    Any server specified via the -server or -use_mock_srv options is contacted only if more responses are needed to complete the transaction. In this case the transaction will fail unless the server has been prepared to continue the already started transaction.

  • -rspout filenames

    Save the sequence of actually used CMP responses to the given file(s). These have been received from the server unless -rspin takes effect.

    Multiple filenames may be given, separated by commas and/or whitespace.

    Files are written as far as needed to save the responses contained in the transaction and filenames have been provided. If the transaction contains more responses, the remaining ones are not saved.

  • -use_mock_srv

    Test the client using the internal CMP server mock-up at API level, bypassing socket-based transfer via HTTP. This excludes the -server and -port options.

"},{"location":"man1/openssl-cmp/#mock-server-options","title":"Mock server options","text":"
  • -port number

    Act as HTTP-based CMP server mock-up listening on the given port. This excludes the -server and -use_mock_srv options. The -rspin, -rspout, -reqin, and -reqout options so far are not supported in this mode.

  • -max_msgs number

    Maximum number of CMP (request) messages the CMP HTTP server mock-up should handle, which must be nonnegative. The default value is 0, which means that no limit is imposed. In any case the server terminates on internal errors, but not when it detects a CMP-level error that it can successfully answer with an error message.

  • -srv_ref value

    Reference value to use as senderKID of server in case no -srv_cert is given.

  • -srv_secret arg

    Password source for server authentication with a pre-shared key (secret).

  • -srv_cert filename|uri

    Certificate of the server.

  • -srv_key filename|uri

    Private key used by the server for signing messages.

  • -srv_keypass arg

    Server private key (and cert) file pass phrase source.

  • -srv_trusted filenames|uris

    Trusted certificates for client authentication.

    The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

  • -srv_untrusted filenames|uris

    Intermediate CA certs that may be useful when validating client certificates.

  • -rsp_cert filename|uri

    Certificate to be returned as mock enrollment result.

  • -rsp_extracerts filenames|uris

    Extra certificates to be included in mock certification responses.

  • -rsp_capubs filenames|uris

    CA certificates to be included in mock Initialization Response (IP) message.

  • -poll_count number

    Number of times the client must poll before receiving a certificate.

  • -check_after number

    The checkAfter value (number of seconds to wait) to include in poll response.

  • -grant_implicitconf

    Grant implicit confirmation of newly enrolled certificate.

  • -pkistatus number

    PKIStatus to be included in server response. Valid range is 0 (accepted) .. 6 (keyUpdateWarning).

  • -failure number

    A single failure info bit number to be included in server response. Valid range is 0 (badAlg) .. 26 (duplicateCertReq).

  • -failurebits number Number representing failure bits to be included in server response. Valid range is 0 .. 2^27 - 1.

  • -statusstring arg

    Text to be included as status string in server response.

  • -send_error

    Force server to reply with error message.

  • -send_unprotected

    Send response messages without CMP-level protection.

  • -send_unprot_err

    In case of negative responses, server shall send unprotected error messages, certificate responses (IP/CP/KUP), and revocation responses (RP). WARNING: This setting leads to behavior violating RFC 4210.

  • -accept_unprotected

    Accept missing or invalid protection of requests.

  • -accept_unprot_err

    Accept unprotected error messages from client. So far this has no effect because the server does not accept any error messages.

  • -accept_raverified

    Accept RAVERIFED as proof of possession (POPO).

"},{"location":"man1/openssl-cmp/#certificate-verification-options-for-both-cmp-and-tls","title":"Certificate verification options, for both CMP and TLS","text":"
  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

    The certificate verification options -verify_hostname, -verify_ip, and -verify_email only affect the certificate verification enabled via the -out_trusted option.

"},{"location":"man1/openssl-cmp/#notes","title":"NOTES","text":"

When a client obtains from a CMP server CA certificates that it is going to trust, for instance via the caPubs field of a certificate response, authentication of the CMP server is particularly critical. So special care must be taken setting up server authentication using -trusted and related options for certificate-based authentication or -secret for MAC-based protection.

When setting up CMP configurations and experimenting with enrollment options typically various errors occur until the configuration is correct and complete. When the CMP server reports an error the client will by default check the protection of the CMP response message. Yet some CMP services tend not to protect negative responses. In this case the client will reject them, and thus their contents are not shown although they usually contain hints that would be helpful for diagnostics. For assisting in such cases the CMP client offers a workaround via the -unprotected_errors option, which allows accepting such negative messages.

If OpenSSL was built with trace support enabled and the environment variable OPENSSL_TRACE includes HTTP, the request and response headers of HTTP transfers are printed.

"},{"location":"man1/openssl-cmp/#examples","title":"EXAMPLES","text":""},{"location":"man1/openssl-cmp/#simple-examples-using-the-default-openssl-configuration-file","title":"Simple examples using the default OpenSSL configuration file","text":"

This CMP client implementation comes with demonstrative CMP sections in the example configuration file openssl/apps/openssl.cnf, which can be used to interact conveniently with the Insta Demo CA.

In order to enroll an initial certificate from that CA it is sufficient to issue the following shell commands.

export OPENSSL_CONF=/path/to/openssl/apps/openssl.cnf\n\nopenssl genrsa -out insta.priv.pem\nopenssl cmp -section insta\n

This should produce the file insta.cert.pem containing a new certificate for the private key held in insta.priv.pem. It can be viewed using, e.g.,

openssl x509 -noout -text -in insta.cert.pem\n

In case the network setup requires using an HTTP proxy it may be given as usual via the environment variable http_proxy or via the -proxy option in the configuration file or the CMP command-line argument -proxy, for example

-proxy http://192.168.1.1:8080\n

In the Insta Demo CA scenario both clients and the server may use the pre-shared secret insta and the reference value 3078 to authenticate to each other.

Alternatively, CMP messages may be protected in signature-based manner, where the trust anchor in this case is insta.ca.crt and the client may use any certificate already obtained from that CA, as specified in the [signature] section of the example configuration. This can be used in combination with the [insta] section simply by

openssl cmp -section insta,signature\n

By default the CMP IR message type is used, yet CR works equally here. This may be specified directly at the command line:

openssl cmp -section insta -cmd cr\n

or by referencing in addition the [cr] section of the example configuration:

openssl cmp -section insta,cr\n

In order to update the enrolled certificate one may call

openssl cmp -section insta,kur\n

using MAC-based protection with PBM or

openssl cmp -section insta,kur,signature\n

using signature-based protection.

In a similar way any previously enrolled certificate may be revoked by

openssl cmp -section insta,rr -trusted insta.ca.crt\n

or

openssl cmp -section insta,rr,signature\n

Many more options can be given in the configuration file and/or on the command line. For instance, the -reqexts CLI option may refer to a section in the configuration file defining X.509 extensions to use in certificate requests, such as v3_req in openssl/apps/openssl.cnf:

openssl cmp -section insta,cr -reqexts v3_req\n
"},{"location":"man1/openssl-cmp/#certificate-enrollment","title":"Certificate enrollment","text":"

The following examples do not make use of a configuration file at first. They assume that a CMP server can be contacted on the local TCP port 80 and accepts requests under the alias /pkix/.

For enrolling its very first certificate the client generates a client key and sends an initial request message to the local CMP server using a pre-shared secret key for mutual authentication. In this example the client does not have the CA certificate yet, so we specify the name of the CA with the -recipient option and save any CA certificates that we may receive in the capubs.pem file.

In below command line usage examples the \\ at line ends is used just for formatting; each of the command invocations should be on a single line.

openssl genrsa -out cl_key.pem\nopenssl cmp -cmd ir -server 127.0.0.1:80/pkix/ -recipient \"/CN=CMPserver\" \\\n  -ref 1234 -secret pass:1234-5678 \\\n  -newkey cl_key.pem -subject \"/CN=MyName\" \\\n  -cacertsout capubs.pem -certout cl_cert.pem\n
"},{"location":"man1/openssl-cmp/#certificate-update","title":"Certificate update","text":"

Then, when the client certificate and its related key pair needs to be updated, the client can send a key update request taking the certs in capubs.pem as trusted for authenticating the server and using the previous cert and key for its own authentication. Then it can start using the new cert and key.

openssl genrsa -out cl_key_new.pem\nopenssl cmp -cmd kur -server 127.0.0.1:80/pkix/ \\\n  -trusted capubs.pem \\\n  -cert cl_cert.pem -key cl_key.pem \\\n  -newkey cl_key_new.pem -certout cl_cert.pem\ncp cl_key_new.pem cl_key.pem\n

This command sequence can be repeated as often as needed.

"},{"location":"man1/openssl-cmp/#requesting-information-from-cmp-server","title":"Requesting information from CMP server","text":"

Requesting \"all relevant information\" with an empty General Message. This prints information about all received ITAV infoTypes to stdout.

openssl cmp -cmd genm -server 127.0.0.1/pkix/ -recipient \"/CN=CMPserver\" \\\n  -ref 1234 -secret pass:1234-5678\n
"},{"location":"man1/openssl-cmp/#using-a-custom-configuration-file","title":"Using a custom configuration file","text":"

For CMP client invocations, in particular for certificate enrollment, usually many parameters need to be set, which is tedious and error-prone to do on the command line. Therefore, the client offers the possibility to read options from sections of the OpenSSL config file, usually called openssl.cnf. The values found there can still be extended and even overridden by any subsequently loaded sections and on the command line.

After including in the configuration file the following sections:

[cmp]\nserver = 127.0.0.1\npath = pkix/\ntrusted = capubs.pem\ncert = cl_cert.pem\nkey = cl_key.pem\nnewkey = cl_key.pem\ncertout = cl_cert.pem\n\n[init]\nrecipient = \"/CN=CMPserver\"\ntrusted =\ncert =\nkey =\nref = 1234\nsecret = pass:1234-5678-1234-567\nsubject = \"/CN=MyName\"\ncacertsout = capubs.pem\n

the above enrollment transactions reduce to

openssl cmp -section cmp,init\nopenssl cmp -cmd kur -newkey cl_key_new.pem\n

and the above transaction using a general message reduces to

openssl cmp -section cmp,init -cmd genm\n
"},{"location":"man1/openssl-cmp/#see-also","title":"SEE ALSO","text":"

openssl-genrsa(1), openssl-ecparam(1), openssl-list(1), openssl-req(1), openssl-x509(1), x509v3_config(5)

"},{"location":"man1/openssl-cmp/#history","title":"HISTORY","text":"

The cmp application was added in OpenSSL 3.0.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-cmp/#copyright","title":"COPYRIGHT","text":"

Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-cms/","title":"openssl-cms","text":""},{"location":"man1/openssl-cms/#name","title":"NAME","text":"

openssl-cms - CMS command

"},{"location":"man1/openssl-cms/#synopsis","title":"SYNOPSIS","text":"

openssl cms [-help]

General options:

[-in filename] [-out filename] [-config configfile]

Operation options:

[-encrypt] [-decrypt] [-sign] [-verify] [-resign] [-sign_receipt] [-verify_receipt receipt] [-digest_create] [-digest_verify] [-compress] [-uncompress] [-EncryptedData_encrypt] [-EncryptedData_decrypt] [-data_create] [-data_out] [-cmsout]

File format options:

[-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform DER|PEM|SMIME] [-stream] [-indef] [-noindef] [-binary] [-crlfeol] [-asciicrlf]

Keys and password options:

[-pwri_password password] [-secretkey key] [-secretkeyid id] [-inkey filename|uri] [-passin arg] [-keyopt name:parameter] [-keyform DER|PEM|P12|ENGINE] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-rand files] [-writerand file]

Encryption options:

[-originator file] [-recip file] [recipient-cert ...] [-cipher] [-wrap cipher] [-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap] [-debug_decrypt]

Signing options:

[-md digest] [-signer file] [-certfile file] [-cades] [-nodetach] [-nocerts] [-noattr] [-nosmimecap] [-receipt_request_all] [-receipt_request_first] [-receipt_request_from emailaddress] [-receipt_request_to emailaddress]

Verification options:

[-signer file] [-content filename] [-no_content_verify] [-no_attr_verify] [-nosigs] [-noverify] [-nointern] [-cades] [-verify_retcode] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore]

Output options:

[-keyid] [-econtent_type type] [-text] [-certsout file] [-to addr] [-from addr] [-subject subj]

Printing options:

[-noout] [-print] [-nameopt option] [-receipt_request_print]

Validation options:

[-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks]

"},{"location":"man1/openssl-cms/#description","title":"DESCRIPTION","text":"

This command handles data in CMS format such as S/MIME v3.1 email messages. It can encrypt, decrypt, sign, verify, compress, uncompress, and print messages.

"},{"location":"man1/openssl-cms/#options","title":"OPTIONS","text":"

There are a number of operation options that set the type of operation to be performed: encrypt, decrypt, sign, verify, resign, sign_receipt, verify_receipt, digest_create, digest_verify, compress, uncompress, EncryptedData_encrypt, EncryptedData_decrypt, data_create, data_out, or cmsout. The relevance of the other options depends on the operation type and their meaning may vary according to it.

  • -help

    Print out a usage message.

"},{"location":"man1/openssl-cms/#general-options","title":"General options","text":"
  • -in filename

    The input message to be encrypted or signed or the message to be decrypted or verified.

  • -out filename

    The message text that has been decrypted or verified or the output MIME format message that has been signed or verified.

  • -config configfile

    See \"Configuration Option\" in openssl(1).

"},{"location":"man1/openssl-cms/#operation-options","title":"Operation options","text":"
  • -encrypt

    Encrypt data for the given recipient certificates. Input file is the message to be encrypted. The output file is the encrypted data in MIME format. The actual CMS type is EnvelopedData.

    Note that no revocation check is done for the recipient cert, so if that key has been compromised, others may be able to decrypt the text.

  • -decrypt

    Decrypt data using the supplied certificate and private key. Expects encrypted datain MIME format for the input file. The decrypted data is written to the output file.

  • -sign

    Sign data using the supplied certificate and private key. Input file is the message to be signed. The signed data in MIME format is written to the output file.

  • -verify

    Verify signed data. Expects a signed data on input and outputs the signed data. Both clear text and opaque signing is supported.

  • -resign

    Resign a message: take an existing message and one or more new signers.

  • -sign_receipt

    Generate and output a signed receipt for the supplied message. The input message must contain a signed receipt request. Functionality is otherwise similar to the -sign operation.

  • -verify_receipt receipt

    Verify a signed receipt in filename receipt. The input message must contain the original receipt request. Functionality is otherwise similar to the -verify operation.

  • -digest_create

    Create a CMS DigestedData type.

  • -digest_verify

    Verify a CMS DigestedData type and output the content.

  • -compress

    Create a CMS CompressedData type. OpenSSL must be compiled with zlib support for this option to work, otherwise it will output an error.

  • -uncompress

    Uncompress a CMS CompressedData type and output the content. OpenSSL must be compiled with zlib support for this option to work, otherwise it will output an error.

  • -EncryptedData_encrypt

    Encrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type and output the content.

  • -EncryptedData_decrypt

    Decrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type and output the content.

  • -data_create

    Create a CMS Data type.

  • -data_out

    Data type and output the content.

  • -cmsout

    Takes an input message and writes out a PEM encoded CMS structure.

"},{"location":"man1/openssl-cms/#file-format-options","title":"File format options","text":"
  • -inform DER|PEM|SMIME

    The input format of the CMS structure (if one is being read); the default is SMIME. See openssl-format-options(1) for details.

  • -outform DER|PEM|SMIME

    The output format of the CMS structure (if one is being written); the default is SMIME. See openssl-format-options(1) for details.

  • -rctform DER|PEM|SMIME

    The signed receipt format for use with the -receipt_verify; the default is SMIME. See openssl-format-options(1) for details.

  • -stream, -indef

    The -stream and -indef options are equivalent and enable streaming I/O for encoding operations. This permits single pass processing of data without the need to hold the entire contents in memory, potentially supporting very large files. Streaming is automatically set for S/MIME signing with detached data if the output format is SMIME it is currently off by default for all other operations.

  • -noindef

    Disable streaming I/O where it would produce and indefinite length constructed encoding. This option currently has no effect. In future streaming will be enabled by default on all relevant operations and this option will disable it.

  • -binary

    Normally the input message is converted to \"canonical\" format which is effectively using CR and LF as end of line: as required by the S/MIME specification. When this option is present no translation occurs. This is useful when handling binary data which may not be in MIME format.

  • -crlfeol

    Normally the output file uses a single LF as end of line. When this option is present CRLF is used instead.

  • -asciicrlf

    When signing use ASCII CRLF format canonicalisation. This strips trailing whitespace from all lines, deletes trailing blank lines at EOF and sets the encapsulated content type. This option is normally used with detached content and an output signature format of DER. This option is not normally needed when verifying as it is enabled automatically if the encapsulated content format is detected.

"},{"location":"man1/openssl-cms/#keys-and-password-options","title":"Keys and password options","text":"
  • -pwri_password password

    Specify password for recipient.

  • -secretkey key

    Specify symmetric key to use. The key must be supplied in hex format and be consistent with the algorithm used. Supported by the -EncryptedData_encrypt -EncryptedData_decrypt, -encrypt and -decrypt options. When used with -encrypt or -decrypt the supplied key is used to wrap or unwrap the content encryption key using an AES key in the KEKRecipientInfo type.

  • -secretkeyid id

    The key identifier for the supplied symmetric key for KEKRecipientInfo type. This option must be present if the -secretkey option is used with -encrypt. With -decrypt operations the id is used to locate the relevant key if it is not supplied then an attempt is used to decrypt any KEKRecipientInfo structures.

  • -inkey filename|uri

    The private key to use when signing or decrypting. This must match the corresponding certificate. If this option is not specified then the private key must be included in the certificate file specified with the -recip or -signer file. When signing this option can be used multiple times to specify successive keys.

  • -passin arg

    The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -keyopt name:parameter

    For signing and encryption this option can be used multiple times to set customised parameters for the preceding key or certificate. It can currently be used to set RSA-PSS for signing, RSA-OAEP for encryption or to modify default parameters for ECDH.

  • -keyform DER|PEM|P12|ENGINE

    The format of the private key file; unspecified by default. See openssl-format-options(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

"},{"location":"man1/openssl-cms/#encryption-and-decryption-options","title":"Encryption and decryption options","text":"
  • -originator file

    A certificate of the originator of the encrypted message. Necessary for decryption when Key Agreement is in use for a shared key.

  • -recip file

    When decrypting a message this specifies the certificate of the recipient. The certificate must match one of the recipients of the message.

    When encrypting a message this option may be used multiple times to specify each recipient. This form must be used if customised parameters are required (for example to specify RSA-OAEP).

    Only certificates carrying RSA, Diffie-Hellman or EC keys are supported by this option.

  • recipient-cert ...

    This is an alternative to using the -recip option when encrypting a message. One or more certificate filenames may be given.

  • -cipher

    The encryption algorithm to use. For example triple DES (168 bits) - -des3 or 256 bit AES - -aes256. Any standard algorithm name (as used by the EVP_get_cipherbyname() function) can also be used preceded by a dash, for example -aes-128-cbc. See openssl-enc(1) for a list of ciphers supported by your version of OpenSSL.

    Currently the AES variants with GCM mode are the only supported AEAD algorithms.

    If not specified triple DES is used. Only used with -encrypt and -EncryptedData_create commands.

  • -wrap cipher

    Cipher algorithm to use for key wrap when encrypting the message using Key Agreement for key transport. The algorithm specified should be suitable for key wrap.

  • -aes128-wrap, -aes192-wrap, -aes256-wrap, -des3-wrap

    Use AES128, AES192, AES256, or 3DES-EDE, respectively, to wrap key. Depending on the OpenSSL build options used, -des3-wrap may not be supported.

  • -debug_decrypt

    This option sets the CMS_DEBUG_DECRYPT flag. This option should be used with caution: see the notes section below.

"},{"location":"man1/openssl-cms/#signing-options","title":"Signing options","text":"
  • -md digest

    Digest algorithm to use when signing or resigning. If not present then the default digest algorithm for the signing key will be used (usually SHA1).

  • -signer file

    A signing certificate. When signing or resigning a message, this option can be used multiple times if more than one signer is required.

  • -certfile file

    Allows additional certificates to be specified. When signing these will be included with the message. When verifying these will be searched for the signers certificates. The input can be in PEM, DER, or PKCS#12 format.

  • -cades

    When used with -sign, add an ESS signingCertificate or ESS signingCertificateV2 signed-attribute to the SignerInfo, in order to make the signature comply with the requirements for a CAdES Basic Electronic Signature (CAdES-BES).

  • -nodetach

    When signing a message use opaque signing: this form is more resistant to translation by mail relays but it cannot be read by mail agents that do not support S/MIME. Without this option cleartext signing with the MIME type multipart/signed is used.

  • -nocerts

    When signing a message the signer's certificate is normally included with this option it is excluded. This will reduce the size of the signed message but the verifier must have a copy of the signers certificate available locally (passed using the -certfile option for example).

  • -noattr

    Normally when a message is signed a set of attributes are included which include the signing time and supported symmetric algorithms. With this option they are not included.

  • -nosmimecap

    Exclude the list of supported algorithms from signed attributes, other options such as signing time and content type are still included.

  • -receipt_request_all, -receipt_request_first

    For -sign option include a signed receipt request. Indicate requests should be provided by all recipient or first tier recipients (those mailed directly and not from a mailing list). Ignored it -receipt_request_from is included.

  • -receipt_request_from emailaddress

    For -sign option include a signed receipt request. Add an explicit email address where receipts should be supplied.

  • -receipt_request_to emailaddress

    Add an explicit email address where signed receipts should be sent to. This option must but supplied if a signed receipt is requested.

"},{"location":"man1/openssl-cms/#verification-options","title":"Verification options","text":"
  • -signer file

    If a message has been verified successfully then the signers certificate(s) will be written to this file if the verification was successful.

  • -content filename

    This specifies a file containing the detached content for operations taking S/MIME input, such as the -verify command. This is only usable if the CMS structure is using the detached signature form where the content is not included. This option will override any content if the input format is S/MIME and it uses the multipart/signed MIME content type.

  • -no_content_verify

    Do not verify signed content signatures.

  • -no_attr_verify

    Do not verify signed attribute signatures.

  • -nosigs

    Don't verify message signature.

  • -noverify

    Do not verify the signers certificate of a signed message.

  • -nointern

    When verifying a message normally certificates (if any) included in the message are searched for the signing certificate. With this option only the certificates specified in the -certfile option are used. The supplied certificates can still be used as untrusted CAs however.

  • -cades

    When used with -verify, require and check signer certificate digest. See the NOTES section for more details.

  • -verify_retcode

    Exit nonzero on verification failure.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

"},{"location":"man1/openssl-cms/#output-options","title":"Output options","text":"
  • -keyid

    Use subject key identifier to identify certificates instead of issuer name and serial number. The supplied certificate must include a subject key identifier extension. Supported by -sign and -encrypt options.

  • -econtent_type type

    Set the encapsulated content type to type if not supplied the Data type is used. The type argument can be any valid OID name in either text or numerical format.

  • -text

    This option adds plain text (text/plain) MIME headers to the supplied message if encrypting or signing. If decrypting or verifying it strips off text headers: if the decrypted or verified message is not of MIME type text/plain then an error occurs.

  • -certsout file

    Any certificates contained in the input message are written to file.

  • -to, -from, -subject

    The relevant email headers. These are included outside the signed portion of a message so they may be included manually. If signing then many S/MIME mail clients check the signers certificate's email address matches that specified in the From: address.

"},{"location":"man1/openssl-cms/#printing-options","title":"Printing options","text":"
  • -noout

    For the -cmsout operation do not output the parsed CMS structure. This is useful if the syntax of the CMS structure is being checked.

  • -print

    For the -cmsout operation print out all fields of the CMS structure. This implies -noout. This is mainly useful for testing purposes.

  • -nameopt option

    For the -cmsout operation when -print option is in use, specifies printing options for string fields. For most cases utf8 is reasonable value. See openssl-namedisplay-options(1) for details.

  • -receipt_request_print

    For the -verify operation print out the contents of any signed receipt requests.

"},{"location":"man1/openssl-cms/#validation-options","title":"Validation options","text":"
  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

    Any validation errors cause the command to exit.

"},{"location":"man1/openssl-cms/#notes","title":"NOTES","text":"

The MIME message must be sent without any blank lines between the headers and the output. Some mail programs will automatically add a blank line. Piping the mail directly to sendmail is one way to achieve the correct format.

The supplied message to be signed or encrypted must include the necessary MIME headers or many S/MIME clients won't display it properly (if at all). You can use the -text option to automatically add plain text headers.

A \"signed and encrypted\" message is one where a signed message is then encrypted. This can be produced by encrypting an already signed message: see the examples section.

This version of the program only allows one signer per message but it will verify multiple signers on received messages. Some S/MIME clients choke if a message contains multiple signers. It is possible to sign messages \"in parallel\" by signing an already signed message.

The options -encrypt and -decrypt reflect common usage in S/MIME clients. Strictly speaking these process CMS enveloped data: CMS encrypted data is used for other purposes.

The -resign option uses an existing message digest when adding a new signer. This means that attributes must be present in at least one existing signer using the same message digest or this operation will fail.

The -stream and -indef options enable streaming I/O support. As a result the encoding is BER using indefinite length constructed encoding and no longer DER. Streaming is supported for the -encrypt operation and the -sign operation if the content is not detached.

Streaming is always used for the -sign operation with detached data but since the content is no longer part of the CMS structure the encoding remains DER.

If the -decrypt option is used without a recipient certificate then an attempt is made to locate the recipient by trying each potential recipient in turn using the supplied private key. To thwart the MMA attack (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all recipients are tried whether they succeed or not and if no recipients match the message is \"decrypted\" using a random key which will typically output garbage. The -debug_decrypt option can be used to disable the MMA attack protection and return an error if no recipient can be found: this option should be used with caution. For a fuller description see CMS_decrypt(3)).

"},{"location":"man1/openssl-cms/#cades-basic-electronic-signature-cades-bes","title":"CADES BASIC ELECTRONIC SIGNATURE (CADES-BES)","text":"

A CAdES Basic Electronic Signature (CAdES-BES), as defined in the European Standard ETSI EN 319 122-1 V1.1.1, contains:

  • The signed user data as defined in CMS (RFC 3852);
  • Content-type of the EncapsulatedContentInfo value being signed;
  • Message-digest of the eContent OCTET STRING within encapContentInfo being signed;
  • An ESS signingCertificate or ESS signingCertificateV2 attribute, as defined in Enhanced Security Services (ESS), RFC 2634 and RFC 5035. An ESS signingCertificate attribute only allows for SHA-1 as digest algorithm. An ESS signingCertificateV2 attribute allows for any digest algorithm.
  • The digital signature value computed on the user data and, when present, on the signed attributes.

    NOTE that the -cades option applies to the -sign or -verify operations. With this option, the -verify operation also requires that the signingCertificate attribute is present and checks that the given identifiers match the verification trust chain built during the verification process.

"},{"location":"man1/openssl-cms/#exit-codes","title":"EXIT CODES","text":"
  • 0

    The operation was completely successfully.

  • 1

    An error occurred parsing the command options.

  • 2

    One of the input files could not be read.

  • 3

    An error occurred creating the CMS file or when reading the MIME message.

  • 4

    An error occurred decrypting or verifying the message.

  • 5

    The message was verified correctly but an error occurred writing out the signers certificates.

"},{"location":"man1/openssl-cms/#compatibility-with-pkcs7-format","title":"COMPATIBILITY WITH PKCS#7 FORMAT","text":"

openssl-smime(1) can only process the older PKCS#7 format. openssl cms supports Cryptographic Message Syntax format. Use of some features will result in messages which cannot be processed by applications which only support the older format. These are detailed below.

The use of the -keyid option with -sign or -encrypt.

The -outform PEM option uses different headers.

The -compress option.

The -secretkey option when used with -encrypt.

The use of PSS with -sign.

The use of OAEP or non-RSA keys with -encrypt.

Additionally the -EncryptedData_create and -data_create type cannot be processed by the older openssl-smime(1) command.

"},{"location":"man1/openssl-cms/#examples","title":"EXAMPLES","text":"

Create a cleartext signed message:

openssl cms -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem\n

Create an opaque signed message

openssl cms -sign -in message.txt -text -out mail.msg -nodetach \\\n       -signer mycert.pem\n

Create a signed message, include some additional certificates and read the private key from another file:

openssl cms -sign -in in.txt -text -out mail.msg \\\n       -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem\n

Create a signed message with two signers, use key identifier:

openssl cms -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem -signer othercert.pem -keyid\n

Send a signed message under Unix directly to sendmail, including headers:

openssl cms -sign -in in.txt -text -signer mycert.pem \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed message\" | sendmail someone@somewhere\n

Verify a message and extract the signer's certificate if successful:

openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt\n

Send encrypted mail using triple DES:

openssl cms -encrypt -in in.txt -from steve@openssl.org \\\n       -to someone@somewhere -subject \"Encrypted message\" \\\n       -des3 user.pem -out mail.msg\n

Sign and encrypt mail:

openssl cms -sign -in ml.txt -signer my.pem -text \\\n       | openssl cms -encrypt -out mail.msg \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed and Encrypted message\" -des3 user.pem\n

Note: the encryption command does not include the -text option because the message being encrypted already has MIME headers.

Decrypt a message:

openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem\n

The output from Netscape form signing is a PKCS#7 structure with the detached signature format. You can use this program to verify the signature by line wrapping the base64 encoded structure and surrounding it with:

-----BEGIN PKCS7-----\n-----END PKCS7-----\n

and using the command,

openssl cms -verify -inform PEM -in signature.pem -content content.txt\n

alternatively you can base64 decode the signature and use

openssl cms -verify -inform DER -in signature.der -content content.txt\n

Create an encrypted message using 128 bit Camellia:

openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem\n

Add a signer to an existing message:

openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg\n

Sign a message using RSA-PSS:

openssl cms -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem -keyopt rsa_padding_mode:pss\n

Create an encrypted message using RSA-OAEP:

openssl cms -encrypt -in plain.txt -out mail.msg \\\n       -recip cert.pem -keyopt rsa_padding_mode:oaep\n

Use SHA256 KDF with an ECDH certificate:

openssl cms -encrypt -in plain.txt -out mail.msg \\\n       -recip ecdhcert.pem -keyopt ecdh_kdf_md:sha256\n

Print CMS signed binary data in human-readable form:

openssl cms -in signed.cms -binary -inform DER -cmsout -print

"},{"location":"man1/openssl-cms/#bugs","title":"BUGS","text":"

The MIME parser isn't very clever: it seems to handle most messages that I've thrown at it but it may choke on others.

The code currently will only write out the signer's certificate to a file: if the signer has a separate encryption certificate this must be manually extracted. There should be some heuristic that determines the correct encryption certificate.

Ideally a database should be maintained of a certificates for each email address.

The code doesn't currently take note of the permitted symmetric encryption algorithms as supplied in the SMIMECapabilities signed attribute. this means the user has to manually include the correct encryption algorithm. It should store the list of permitted ciphers in a database and only use those.

No revocation checking is done on the signer's certificate.

"},{"location":"man1/openssl-cms/#see-also","title":"SEE ALSO","text":"

ossl_store-file(7)

"},{"location":"man1/openssl-cms/#history","title":"HISTORY","text":"

The use of multiple -signer options and the -resign command were first added in OpenSSL 1.0.0.

The -keyopt option was added in OpenSSL 1.0.2.

Support for RSA-OAEP and RSA-PSS was added in OpenSSL 1.0.2.

The use of non-RSA keys with -encrypt and -decrypt was added in OpenSSL 1.0.2.

The -no_alt_chains option was added in OpenSSL 1.0.2b.

The -nameopt option was added in OpenSSL 3.0.0.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-cms/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-crl/","title":"openssl-crl","text":""},{"location":"man1/openssl-crl/#name","title":"NAME","text":"

openssl-crl - CRL command

"},{"location":"man1/openssl-crl/#synopsis","title":"SYNOPSIS","text":"

openssl crl [-help] [-inform DER|PEM] [-outform DER|PEM] [-key filename] [-keyform DER|PEM|P12] [-dateopt] [-text] [-in filename] [-out filename] [-gendelta filename] [-badsig] [-verify] [-noout] [-hash] [-hash_old] [-fingerprint] [-crlnumber] [-issuer] [-lastupdate] [-nextupdate] [-nameopt option] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-crl/#description","title":"DESCRIPTION","text":"

This command processes CRL files in DER or PEM format.

"},{"location":"man1/openssl-crl/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM

    The CRL input format; unspecified by default. See openssl-format-options(1) for details.

  • -outform DER|PEM

    The CRL output format; the default is PEM. See openssl-format-options(1) for details.

  • -key filename

    The private key to be used to sign the CRL.

  • -keyform DER|PEM|P12

    The format of the private key file; unspecified by default. See openssl-format-options(1) for details.

  • -in filename

    This specifies the input filename to read from or standard input if this option is not specified.

  • -out filename

    Specifies the output filename to write to or standard output by default.

  • -gendelta filename

    Output a comparison of the main CRL and the one specified here.

  • -badsig

    Corrupt the signature before writing it; this can be useful for testing.

  • -dateopt

    Specify the date output format. Values are: rfc_822 and iso_8601. Defaults to rfc_822.

  • -text

    Print out the CRL in text form.

  • -verify

    Verify the signature in the CRL.

    This option is implicitly enabled if any of -CApath, -CAfile or -CAstore is specified.

  • -noout

    Don't output the encoded version of the CRL.

  • -fingerprint

    Output the fingerprint of the CRL.

  • -crlnumber

    Output the number of the CRL.

  • -hash

    Output a hash of the issuer name. This can be use to lookup CRLs in a directory by issuer name.

  • -hash_old

    Outputs the \"hash\" of the CRL issuer name using the older algorithm as used by OpenSSL before version 1.0.0.

  • -issuer

    Output the issuer name.

  • -lastupdate

    Output the lastUpdate field.

  • -nextupdate

    Output the nextUpdate field.

  • -nameopt option

    This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-crl/#examples","title":"EXAMPLES","text":"

Convert a CRL file from PEM to DER:

openssl crl -in crl.pem -outform DER -out crl.der\n

Output the text form of a DER encoded certificate:

openssl crl -in crl.der -text -noout\n
"},{"location":"man1/openssl-crl/#bugs","title":"BUGS","text":"

Ideally it should be possible to create a CRL using appropriate options and files too.

"},{"location":"man1/openssl-crl/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-crl2pkcs7(1), openssl-ca(1), openssl-x509(1), ossl_store-file(7)

"},{"location":"man1/openssl-crl/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-crl2pkcs7/","title":"openssl-crl2pkcs7","text":""},{"location":"man1/openssl-crl2pkcs7/#name","title":"NAME","text":"

openssl-crl2pkcs7 - Create a PKCS#7 structure from a CRL and certificates

"},{"location":"man1/openssl-crl2pkcs7/#synopsis","title":"SYNOPSIS","text":"

openssl crl2pkcs7 [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-certfile filename] [-nocrl] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-crl2pkcs7/#description","title":"DESCRIPTION","text":"

This command takes an optional CRL and one or more certificates and converts them into a PKCS#7 degenerate \"certificates only\" structure.

"},{"location":"man1/openssl-crl2pkcs7/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM

    The input format of the CRL; the default is PEM. See openssl-format-options(1) for details.

  • -outform DER|PEM

    The output format of the PKCS#7 object; the default is PEM. See openssl-format-options(1) for details.

  • -in filename

    This specifies the input filename to read a CRL from or standard input if this option is not specified.

  • -out filename

    Specifies the output filename to write the PKCS#7 structure to or standard output by default.

  • -certfile filename

    Specifies a filename containing one or more certificates in PEM format. All certificates in the file will be added to the PKCS#7 structure. This option can be used more than once to read certificates from multiple files.

  • -nocrl

    Normally a CRL is included in the output file. With this option no CRL is included in the output file and a CRL is not read from the input file.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-crl2pkcs7/#examples","title":"EXAMPLES","text":"

Create a PKCS#7 structure from a certificate and CRL:

openssl crl2pkcs7 -in crl.pem -certfile cert.pem -out p7.pem\n

Creates a PKCS#7 structure in DER format with no CRL from several different certificates:

openssl crl2pkcs7 -nocrl -certfile newcert.pem\n       -certfile demoCA/cacert.pem -outform DER -out p7.der\n
"},{"location":"man1/openssl-crl2pkcs7/#notes","title":"NOTES","text":"

The output file is a PKCS#7 signed data structure containing no signers and just certificates and an optional CRL.

This command can be used to send certificates and CAs to Netscape as part of the certificate enrollment process. This involves sending the DER encoded output as MIME type application/x-x509-user-cert.

The PEM encoded form with the header and footer lines removed can be used to install user certificates and CAs in MSIE using the Xenroll control.

"},{"location":"man1/openssl-crl2pkcs7/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkcs7(1)

"},{"location":"man1/openssl-crl2pkcs7/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-dgst/","title":"openssl-dgst","text":""},{"location":"man1/openssl-dgst/#name","title":"NAME","text":"

openssl-dgst - perform digest operations

"},{"location":"man1/openssl-dgst/#synopsis","title":"SYNOPSIS","text":"

openssl dgst|digest [-digest] [-list] [-help] [-c] [-d] [-debug] [-hex] [-binary] [-xoflen length] [-r] [-out filename] [-sign filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-verify filename] [-prverify filename] [-signature filename] [-sigopt nm:v] [-hmac key] [-mac alg] [-macopt nm:v] [-fips-fingerprint] [-engine id] [-engine_impl id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [file ...]

"},{"location":"man1/openssl-dgst/#description","title":"DESCRIPTION","text":"

This command output the message digest of a supplied file or files in hexadecimal, and also generates and verifies digital signatures using message digests.

The generic name, openssl dgst, may be used with an option specifying the algorithm to be used. The default digest is sha256. A supported digest name may also be used as the sub-command name. To see the list of supported algorithms, use openssl list -digest-algorithms

"},{"location":"man1/openssl-dgst/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -digest

    Specifies name of a supported digest to be used. See option -list below :

  • -list

    Prints out a list of supported message digests.

  • -c

    Print out the digest in two digit groups separated by colons, only relevant if the -hex option is given as well.

  • -d, -debug

    Print out BIO debugging information.

  • -hex

    Digest is to be output as a hex dump. This is the default case for a \"normal\" digest as opposed to a digital signature. See NOTES below for digital signatures using -hex.

  • -binary

    Output the digest or signature in binary form.

  • -xoflen length

    Set the output length for XOF algorithms, such as shake128 and shake256. This option is not supported for signing operations.

    For OpenSSL providers it is recommended to set this value for shake algorithms, since the default values are set to only supply half of the maximum security strength.

    For backwards compatibility reasons the default xoflen length for shake128 is 16 (bytes) which results in a security strength of only 64 bits. To ensure the maximum security strength of 128 bits, the xoflen should be set to at least 32.

    For backwards compatibility reasons the default xoflen length for shake256 is 32 (bytes) which results in a security strength of only 128 bits. To ensure the maximum security strength of 256 bits, the xoflen should be set to at least 64.

  • -r

    Output the digest in the \"coreutils\" format, including newlines. Used by programs like sha1sum(1).

  • -out filename

    Filename to output to, or standard output by default.

  • -sign filename|uri

    Digitally sign the digest using the given private key. Note this option does not support Ed25519 or Ed448 private keys. Use the openssl-pkeyutl(1) command instead for this.

  • -keyform DER|PEM|P12|ENGINE

    The format of the key to sign with; unspecified by default. See openssl-format-options(1) for details.

  • -sigopt nm:v

    Pass options to the signature algorithm during sign or verify operations. Names and values of these options are algorithm-specific.

  • -passin arg

    The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -verify filename

    Verify the signature using the public key in \"filename\". The output is either \"Verified OK\" or \"Verification Failure\".

  • -prverify filename

    Verify the signature using the private key in \"filename\".

  • -signature filename

    The actual signature to verify.

  • -hmac key

    Create a hashed MAC using \"key\".

    The openssl-mac(1) command should be preferred to using this command line option.

  • -mac alg

    Create MAC (keyed Message Authentication Code). The most popular MAC algorithm is HMAC (hash-based MAC), but there are other MAC algorithms which are not based on hash, for instance gost-mac algorithm, supported by the gost engine. MAC keys and other options should be set via -macopt parameter.

    The openssl-mac(1) command should be preferred to using this command line option.

  • -macopt nm:v

    Passes options to MAC algorithm, specified by -mac key. Following options are supported by both by HMAC and gost-mac:

    • key:string

      Specifies MAC key as alphanumeric string (use if key contain printable characters only). String length must conform to any restrictions of the MAC algorithm for example exactly 32 chars for gost-mac.

    • hexkey:string

      Specifies MAC key in hexadecimal form (two hex digits per byte). Key length must conform to any restrictions of the MAC algorithm for example exactly 32 chars for gost-mac.

    The openssl-mac(1) command should be preferred to using this command line option.

  • -fips-fingerprint

    Compute HMAC using a specific key for certain OpenSSL-FIPS operations.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

    The engine is not used for digests unless the -engine_impl option is used or it is configured to do so, see \"Engine Configuration Module\" in config(5).

  • -engine_impl id

    When used with the -engine option, it specifies to also use engine id for digest operations.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • file ...

    File or files to digest. If no files are specified then standard input is used.

"},{"location":"man1/openssl-dgst/#examples","title":"EXAMPLES","text":"

To create a hex-encoded message digest of a file:

openssl dgst -md5 -hex file.txt\nor\nopenssl md5 file.txt\n

To sign a file using SHA-256 with binary file output:

openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt\nor\nopenssl sha256 -sign privatekey.pem -out signature.sign file.txt\n

To verify a signature:

openssl dgst -sha256 -verify publickey.pem \\\n-signature signature.sign \\\nfile.txt\n
"},{"location":"man1/openssl-dgst/#notes","title":"NOTES","text":"

The digest mechanisms that are available will depend on the options used when building OpenSSL. The openssl list -digest-algorithms command can be used to list them.

New or agile applications should use probably use SHA-256. Other digests, particularly SHA-1 and MD5, are still widely used for interoperating with existing formats and protocols.

When signing a file, this command will automatically determine the algorithm (RSA, ECC, etc) to use for signing based on the private key's ASN.1 info. When verifying signatures, it only handles the RSA, DSA, or ECDSA signature itself, not the related data to identify the signer and algorithm used in formats such as x.509, CMS, and S/MIME.

A source of random numbers is required for certain signing algorithms, in particular ECDSA and DSA.

The signing and verify options should only be used if a single file is being signed or verified.

Hex signatures cannot be verified using openssl. Instead, use \"xxd -r\" or similar program to transform the hex signature into a binary signature prior to verification.

The openssl-mac(1) command is preferred over the -hmac, -mac and -macopt command line options.

"},{"location":"man1/openssl-dgst/#see-also","title":"SEE ALSO","text":"

openssl-mac(1)

"},{"location":"man1/openssl-dgst/#history","title":"HISTORY","text":"

The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0. The FIPS-related options were removed in OpenSSL 1.1.0.

The -engine and -engine_impl options were deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-dgst/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-dhparam/","title":"openssl-dhparam","text":""},{"location":"man1/openssl-dhparam/#name","title":"NAME","text":"

openssl-dhparam - DH parameter manipulation and generation

"},{"location":"man1/openssl-dhparam/#synopsis","title":"SYNOPSIS","text":"

openssl dhparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-dsaparam] [-check] [-noout] [-text] [-2] [-3] [-5] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [numbits]

"},{"location":"man1/openssl-dhparam/#description","title":"DESCRIPTION","text":"

This command is used to manipulate DH parameter files.

See \"EXAMPLES\" in openssl-genpkey(1) for examples on how to generate a key using a named safe prime group without generating intermediate parameters.

"},{"location":"man1/openssl-dhparam/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM, -outform DER|PEM

    The input format and output format; the default is PEM. The object is compatible with the PKCS#3 DHparameter structure. See openssl-format-options(1) for details.

  • -in filename

    This specifies the input filename to read parameters from or standard input if this option is not specified.

  • -out filename

    This specifies the output filename parameters to. Standard output is used if this option is not present. The output filename should not be the same as the input filename.

  • -dsaparam

    If this option is used, DSA rather than DH parameters are read or created; they are converted to DH format. Otherwise, safe primes (such that (p-1)/2 is also prime) will be used for DH parameter generation.

    DH parameter generation with the -dsaparam option is much faster. Beware that with such DSA-style DH parameters, a fresh DH key should be created for each use to avoid small-subgroup attacks that may be possible otherwise.

  • -check

    Performs numerous checks to see if the supplied parameters are valid and displays a warning if not.

  • -2, -3, -5

    The generator to use, either 2, 3 or 5. If present then the input file is ignored and parameters are generated instead. If not present but numbits is present, parameters are generated with the default generator 2.

  • numbits

    This option specifies that a parameter set should be generated of size numbits. It must be the last option. If this option is present then the input file is ignored and parameters are generated instead. If this option is not present but a generator (-2, -3 or -5) is present, parameters are generated with a default length of 2048 bits. The minimum length is 512 bits. The maximum length is 10000 bits.

  • -noout

    This option inhibits the output of the encoded version of the parameters.

  • -text

    This option prints out the DH parameters in human readable form.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-dhparam/#notes","title":"NOTES","text":"

This command replaces the dh and gendh commands of previous releases.

"},{"location":"man1/openssl-dhparam/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkeyparam(1), openssl-dsaparam(1), openssl-genpkey(1).

"},{"location":"man1/openssl-dhparam/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

The -C option was removed in OpenSSL 3.0.

"},{"location":"man1/openssl-dhparam/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-dsa/","title":"openssl-dsa","text":""},{"location":"man1/openssl-dsa/#name","title":"NAME","text":"

openssl-dsa - DSA key processing

"},{"location":"man1/openssl-dsa/#synopsis","title":"SYNOPSIS","text":"

openssl dsa [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-passin arg] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-text] [-noout] [-modulus] [-pubin] [-pubout] [-pvk-strong] [-pvk-weak] [-pvk-none] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-dsa/#description","title":"DESCRIPTION","text":"

This command processes DSA keys. They can be converted between various forms and their components printed out. Note This command uses the traditional SSLeay compatible format for private key encryption: newer applications should use the more secure PKCS#8 format using the pkcs8

"},{"location":"man1/openssl-dsa/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM

    The key input format; unspecified by default. See openssl-format-options(1) for details.

  • -outform DER|PEM

    The key output format; the default is PEM. See openssl-format-options(1) for details.

    Private keys are a sequence of ASN.1 INTEGERS: the version (zero), p, q, g, and the public and private key components. Public keys are a SubjectPublicKeyInfo structure with the DSA type.

    The PEM format also accepts PKCS#8 data.

  • -in filename

    This specifies the input filename to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

  • -out filename

    This specifies the output filename to write a key to or standard output by is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

  • -passin arg, -passout arg

    The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

  • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

    These options encrypt the private key with the specified cipher before outputting it. A pass phrase is prompted for. If none of these options is specified the key is written in plain text. This means that this command can be used to remove the pass phrase from a key by not giving any encryption option is given, or to add or change the pass phrase by setting them. These options can only be used with PEM format output files.

  • -text

    Prints out the public, private key components and parameters.

  • -noout

    This option prevents output of the encoded version of the key.

  • -modulus

    This option prints out the value of the public key component of the key.

  • -pubin

    By default, a private key is read from the input file. With this option a public key is read instead.

  • -pubout

    By default, a private key is output. With this option a public key will be output instead. This option is automatically set if the input is a public key.

  • -pvk-strong

    Enable 'Strong' PVK encoding level (default).

  • -pvk-weak

    Enable 'Weak' PVK encoding level.

  • -pvk-none

    Don't enforce PVK encoding.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

The openssl-pkey(1) command is capable of performing all the operations this command can, as well as supporting other public key types.

"},{"location":"man1/openssl-dsa/#examples","title":"EXAMPLES","text":"

The documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here.

To remove the pass phrase on a DSA private key:

openssl dsa -in key.pem -out keyout.pem\n

To encrypt a private key using triple DES:

openssl dsa -in key.pem -des3 -out keyout.pem\n

To convert a private key from PEM to DER format:

openssl dsa -in key.pem -outform DER -out keyout.der\n

To print out the components of a private key to standard output:

openssl dsa -in key.pem -text -noout\n

To just output the public part of a private key:

openssl dsa -in key.pem -pubout -out pubkey.pem\n
"},{"location":"man1/openssl-dsa/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkey(1), openssl-dsaparam(1), openssl-gendsa(1), openssl-rsa(1), openssl-genrsa(1)

"},{"location":"man1/openssl-dsa/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-dsa/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-dsaparam/","title":"openssl-dsaparam","text":""},{"location":"man1/openssl-dsaparam/#name","title":"NAME","text":"

openssl-dsaparam - DSA parameter manipulation and generation

"},{"location":"man1/openssl-dsaparam/#synopsis","title":"SYNOPSIS","text":"

openssl dsaparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-noout] [-text] [-genkey] [-verbose] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [numbits]

"},{"location":"man1/openssl-dsaparam/#description","title":"DESCRIPTION","text":"

This command is used to manipulate or generate DSA parameter files.

DSA parameter generation can be a slow process and as a result the same set of DSA parameters is often used to generate several distinct keys.

"},{"location":"man1/openssl-dsaparam/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM

    The DSA parameters input format; unspecified by default. See openssl-format-options(1) for details.

  • -outform DER|PEM

    The DSA parameters output format; the default is PEM. See openssl-format-options(1) for details.

    Parameters are a sequence of ASN.1 INTEGERs: p, q, and g. This is compatible with RFC 2459 DSS-Parms structure.

  • -in filename

    This specifies the input filename to read parameters from or standard input if this option is not specified. If the numbits parameter is included then this option will be ignored.

  • -out filename

    This specifies the output filename parameters to. Standard output is used if this option is not present. The output filename should not be the same as the input filename.

  • -noout

    This option inhibits the output of the encoded version of the parameters.

  • -text

    This option prints out the DSA parameters in human readable form.

  • -genkey

    This option will generate a DSA either using the specified or generated parameters.

  • -verbose

    Print extra details about the operations being performed.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • numbits

    This option specifies that a parameter set should be generated of size numbits. It must be the last option. If this option is included then the input file (if any) is ignored.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-dsaparam/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkeyparam(1), openssl-gendsa(1), openssl-dsa(1), openssl-genrsa(1), openssl-rsa(1)

"},{"location":"man1/openssl-dsaparam/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

The -C option was removed in OpenSSL 3.0.

"},{"location":"man1/openssl-dsaparam/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-ec/","title":"openssl-ec","text":""},{"location":"man1/openssl-ec/#name","title":"NAME","text":"

openssl-ec - EC key processing

"},{"location":"man1/openssl-ec/#synopsis","title":"SYNOPSIS","text":"

openssl ec [-help] [-inform DER|PEM|P12|ENGINE] [-outform DER|PEM] [-in filename|uri] [-passin arg] [-out filename] [-passout arg] [-des] [-des3] [-idea] [-text] [-noout] [-param_out] [-pubin] [-pubout] [-conv_form arg] [-param_enc arg] [-no_public] [-check] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-ec/#description","title":"DESCRIPTION","text":"

The openssl-ec(1) command processes EC keys. They can be converted between various forms and their components printed out. Note OpenSSL uses the private key format specified in 'SEC 1: Elliptic Curve Cryptography' (http://www.secg.org/). To convert an OpenSSL EC private key into the PKCS#8 private key format use the openssl-pkcs8(1) command.

"},{"location":"man1/openssl-ec/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM|P12|ENGINE

    The key input format; unspecified by default. See openssl-format-options(1) for details.

  • -outform DER|PEM

    The key output format; the default is PEM. See openssl-format-options(1) for details.

    Private keys are an SEC1 private key or PKCS#8 format. Public keys are a SubjectPublicKeyInfo as specified in IETF RFC 3280.

  • -in filename|uri

    This specifies the input to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

  • -out filename

    This specifies the output filename to write a key to or standard output by is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

  • -passin arg, -passout arg

    The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

  • -des|-des3|-idea

    These options encrypt the private key with the DES, triple DES, IDEA or any other cipher supported by OpenSSL before outputting it. A pass phrase is prompted for. If none of these options is specified the key is written in plain text. This means that using this command to read in an encrypted key with no encryption option can be used to remove the pass phrase from a key, or by setting the encryption options it can be use to add or change the pass phrase. These options can only be used with PEM format output files.

  • -text

    Prints out the public, private key components and parameters.

  • -noout

    This option prevents output of the encoded version of the key.

  • -param_out

    Print the elliptic curve parameters.

  • -pubin

    By default, a private key is read from the input file. With this option a public key is read instead.

  • -pubout

    By default a private key is output. With this option a public key will be output instead. This option is automatically set if the input is a public key.

  • -conv_form arg

    This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: compressed, uncompressed (the default value) and hybrid. For more information regarding the point conversion forms please read the X9.62 standard. Note Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at compile time.

  • -param_enc arg

    This specifies how the elliptic curve parameters are encoded. Possible value are: named_curve, i.e. the ec parameters are specified by an OID, or explicit where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is named_curve. Note the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL.

  • -no_public

    This option omits the public key components from the private key output.

  • -check

    This option checks the consistency of an EC private or public key.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

The openssl-pkey(1) command is capable of performing all the operations this command can, as well as supporting other public key types.

"},{"location":"man1/openssl-ec/#examples","title":"EXAMPLES","text":"

The documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here.

To encrypt a private key using triple DES:

openssl ec -in key.pem -des3 -out keyout.pem\n

To convert a private key from PEM to DER format:

openssl ec -in key.pem -outform DER -out keyout.der\n

To print out the components of a private key to standard output:

openssl ec -in key.pem -text -noout\n

To just output the public part of a private key:

openssl ec -in key.pem -pubout -out pubkey.pem\n

To change the parameters encoding to explicit:

openssl ec -in key.pem -param_enc explicit -out keyout.pem\n

To change the point conversion form to compressed:

openssl ec -in key.pem -conv_form compressed -out keyout.pem\n
"},{"location":"man1/openssl-ec/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkey(1), openssl-ecparam(1), openssl-dsa(1), openssl-rsa(1)

"},{"location":"man1/openssl-ec/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

The -conv_form and -no_public options are no longer supported with keys loaded from an engine in OpenSSL 3.0.

"},{"location":"man1/openssl-ec/#copyright","title":"COPYRIGHT","text":"

Copyright 2003-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-ecparam/","title":"openssl-ecparam","text":""},{"location":"man1/openssl-ecparam/#name","title":"NAME","text":"

openssl-ecparam - EC parameter manipulation and generation

"},{"location":"man1/openssl-ecparam/#synopsis","title":"SYNOPSIS","text":"

openssl ecparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-noout] [-text] [-check] [-check_named] [-name arg] [-list_curves] [-conv_form arg] [-param_enc arg] [-no_seed] [-genkey] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-ecparam/#description","title":"DESCRIPTION","text":"

This command is used to manipulate or generate EC parameter files.

OpenSSL is currently not able to generate new groups and therefore this command can only create EC parameters from known (named) curves.

"},{"location":"man1/openssl-ecparam/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM

    The EC parameters input format; unspecified by default. See openssl-format-options(1) for details.

  • -outform DER|PEM

    The EC parameters output format; the default is PEM. See openssl-format-options(1) for details.

    Parameters are encoded as EcpkParameters as specified in IETF RFC 3279.

  • -in filename

    This specifies the input filename to read parameters from or standard input if this option is not specified.

  • -out filename

    This specifies the output filename parameters to. Standard output is used if this option is not present. The output filename should not be the same as the input filename.

  • -noout

    This option inhibits the output of the encoded version of the parameters.

  • -text

    This option prints out the EC parameters in human readable form.

  • -check

    Validate the elliptic curve parameters.

  • -check_named

    Validate the elliptic name curve parameters by checking if the curve parameters match any built-in curves.

  • -name arg

    Use the EC parameters with the specified 'short' name. Use -list_curves to get a list of all currently implemented EC parameters.

  • -list_curves

    Print out a list of all currently implemented EC parameters names and exit.

  • -conv_form arg

    This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: compressed, uncompressed (the default value) and hybrid. For more information regarding the point conversion forms please read the X9.62 standard. Note Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at compile time.

  • -param_enc arg

    This specifies how the elliptic curve parameters are encoded. Possible value are: named_curve, i.e. the ec parameters are specified by an OID, or explicit where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is named_curve. Note the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL.

  • -no_seed

    This option inhibits that the 'seed' for the parameter generation is included in the ECParameters structure (see RFC 3279).

  • -genkey

    This option will generate an EC private key using the specified parameters.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

The openssl-genpkey(1) and openssl-pkeyparam(1) commands are capable of performing all the operations this command can, as well as supporting other public key types.

"},{"location":"man1/openssl-ecparam/#examples","title":"EXAMPLES","text":"

The documentation for the openssl-genpkey(1) and openssl-pkeyparam(1) commands contains examples equivalent to the ones listed here.

To create EC parameters with the group 'prime192v1':

openssl ecparam -out ec_param.pem -name prime192v1\n

To create EC parameters with explicit parameters:

openssl ecparam -out ec_param.pem -name prime192v1 -param_enc explicit\n

To validate given EC parameters:

openssl ecparam -in ec_param.pem -check\n

To create EC parameters and a private key:

openssl ecparam -out ec_key.pem -name prime192v1 -genkey\n

To change the point encoding to 'compressed':

openssl ecparam -in ec_in.pem -out ec_out.pem -conv_form compressed\n

To print out the EC parameters to standard output:

openssl ecparam -in ec_param.pem -noout -text\n
"},{"location":"man1/openssl-ecparam/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkeyparam(1), openssl-genpkey(1), openssl-ec(1), openssl-dsaparam(1)

"},{"location":"man1/openssl-ecparam/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

The -C option was removed in OpenSSL 3.0.

"},{"location":"man1/openssl-ecparam/#copyright","title":"COPYRIGHT","text":"

Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-enc/","title":"openssl-enc","text":""},{"location":"man1/openssl-enc/#name","title":"NAME","text":"

openssl-enc - symmetric cipher routines

"},{"location":"man1/openssl-enc/#synopsis","title":"SYNOPSIS","text":"

openssl enc|cipher [-cipher] [-help] [-list] [-ciphers] [-in filename] [-out filename] [-pass arg] [-e] [-d] [-a] [-base64] [-A] [-k password] [-kfile filename] [-K key] [-iv IV] [-S salt] [-salt] [-nosalt] [-z] [-md digest] [-iter count] [-pbkdf2] [-p] [-P] [-bufsize number] [-nopad] [-v] [-debug] [-none] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

openssl cipher [...]

"},{"location":"man1/openssl-enc/#description","title":"DESCRIPTION","text":"

The symmetric cipher commands allow data to be encrypted or decrypted using various block and stream ciphers using keys based on passwords or explicitly provided. Base64 encoding or decoding can also be performed either by itself or in addition to the encryption or decryption.

"},{"location":"man1/openssl-enc/#options","title":"OPTIONS","text":"
  • -cipher

    The cipher to use.

  • -help

    Print out a usage message.

  • -list

    List all supported ciphers.

  • -ciphers

    Alias of -list to display all supported ciphers.

  • -in filename

    The input filename, standard input by default.

  • -out filename

    The output filename, standard output by default.

  • -pass arg

    The password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -e

    Encrypt the input data: this is the default.

  • -d

    Decrypt the input data.

  • -a

    Base64 process the data. This means that if encryption is taking place the data is base64 encoded after encryption. If decryption is set then the input data is base64 decoded before being decrypted.

    When the -A option not given, on encoding a newline is inserted after each 64 characters, and on decoding a newline is expected among the first 1024 bytes of input.

  • -base64

    Same as -a

  • -A

    If the -a option is set then base64 encoding produces output without any newline character, and base64 decoding does not require any newlines. Therefore it can be helpful to use the -A option when decoding unknown input.

  • -k password

    The password to derive the key from. This is for compatibility with previous versions of OpenSSL. Superseded by the -pass argument.

  • -kfile filename

    Read the password to derive the key from the first line of filename. This is for compatibility with previous versions of OpenSSL. Superseded by the -pass argument.

  • -md digest

    Use the specified digest to create the key from the passphrase. The default algorithm is sha-256.

  • -iter count

    Use a given number of iterations on the password in deriving the encryption key. High values increase the time required to brute-force the resulting file. This option enables the use of PBKDF2 algorithm to derive the key.

  • -pbkdf2

    Use PBKDF2 algorithm with a default iteration count of 10000 unless otherwise specified by the -iter command line option.

  • -nosalt

    Don't use a salt in the key derivation routines. This option SHOULD NOT be used except for test purposes or compatibility with ancient versions of OpenSSL.

  • -salt

    Use salt (randomly generated or provide with -S option) when encrypting, this is the default.

  • -S salt

    The actual salt to use: this must be represented as a string of hex digits. If this option is used while encrypting, the same exact value will be needed again during decryption.

  • -K key

    The actual key to use: this must be represented as a string comprised only of hex digits. If only the key is specified, the IV must additionally specified using the -iv option. When both a key and a password are specified, the key given with the -K option will be used and the IV generated from the password will be taken. It does not make much sense to specify both key and password.

  • -iv IV

    The actual IV to use: this must be represented as a string comprised only of hex digits. When only the key is specified using the -K option, the IV must explicitly be defined. When a password is being specified using one of the other options, the IV is generated from this password.

  • -p

    Print out the key and IV used.

  • -P

    Print out the key and IV used then immediately exit: don't do any encryption or decryption.

  • -bufsize number

    Set the buffer size for I/O.

  • -nopad

    Disable standard block padding.

  • -v

    Verbose print; display some statistics about I/O and buffer sizes.

  • -debug

    Debug the BIOs used for I/O.

  • -z

    Compress or decompress encrypted data using zlib after encryption or before decryption. This option exists only if OpenSSL was compiled with the zlib or zlib-dynamic option.

  • -none

    Use NULL cipher (no encryption or decryption of input).

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

"},{"location":"man1/openssl-enc/#notes","title":"NOTES","text":"

The program can be called either as openssl _cipher_ or openssl enc -_cipher_. The first form doesn't work with engine-provided ciphers, because this form is processed before the configuration file is read and any ENGINEs loaded. Use the openssl-list(1) command to get a list of supported ciphers.

Engines which provide entirely new encryption algorithms (such as the ccgost engine which provides gost89 algorithm) should be configured in the configuration file. Engines specified on the command line using -engine option can only be used for hardware-assisted implementations of ciphers which are supported by the OpenSSL core or another engine specified in the configuration file.

When the enc command lists supported ciphers, ciphers provided by engines, specified in the configuration files are listed too.

A password will be prompted for to derive the key and IV if necessary.

The -salt option should ALWAYS be used if the key is being derived from a password unless you want compatibility with previous versions of OpenSSL.

Without the -salt option it is possible to perform efficient dictionary attacks on the password and to attack stream cipher encrypted data. The reason for this is that without the salt the same password always generates the same encryption key.

When the salt is generated at random (that means when encrypting using a passphrase without explicit salt given using -S option), the first bytes of the encrypted data are reserved to store the salt for later decrypting.

Some of the ciphers do not have large keys and others have security implications if not used correctly. A beginner is advised to just use a strong block cipher, such as AES, in CBC mode.

All the block ciphers normally use PKCS#5 padding, also known as standard block padding. This allows a rudimentary integrity or password check to be performed. However, since the chance of random data passing the test is better than 1 in 256 it isn't a very good test.

If padding is disabled then the input data must be a multiple of the cipher block length.

All RC2 ciphers have the same key and effective key length.

Blowfish and RC5 algorithms use a 128 bit key.

Please note that OpenSSL 3.0 changed the effect of the -S option. Any explicit salt value specified via this option is no longer prepended to the ciphertext when encrypting, and must again be explicitly provided when decrypting. Conversely, when the -S option is used during decryption, the ciphertext is expected to not have a prepended salt value.

When using OpenSSL 3.0 or later to decrypt data that was encrypted with an explicit salt under OpenSSL 1.1.1 do not use the -S option, the salt will then be read from the ciphertext. To generate ciphertext that can be decrypted with OpenSSL 1.1.1 do not use the -S option, the salt will be then be generated randomly and prepended to the output.

"},{"location":"man1/openssl-enc/#supported-ciphers","title":"SUPPORTED CIPHERS","text":"

Note that some of these ciphers can be disabled at compile time and some are available only if an appropriate engine is configured in the configuration file. The output when invoking this command with the -list option (that is openssl enc -list) is a list of ciphers, supported by your version of OpenSSL, including ones provided by configured engines.

This command does not support authenticated encryption modes like CCM and GCM, and will not support such modes in the future. This is due to having to begin streaming output (e.g., to standard output when -out is not used) before the authentication tag could be validated. When this command is used in a pipeline, the receiving end will not be able to roll back upon authentication failure. The AEAD modes currently in common use also suffer from catastrophic failure of confidentiality and/or integrity upon reuse of key/iv/nonce, and since openssl enc places the entire burden of key/iv/nonce management upon the user, the risk of exposing AEAD modes is too great to allow. These key/iv/nonce management issues also affect other modes currently exposed in this command, but the failure modes are less extreme in these cases, and the functionality cannot be removed with a stable release branch. For bulk encryption of data, whether using authenticated encryption modes or other modes, openssl-cms(1) is recommended, as it provides a standard data format and performs the needed key/iv/nonce management.

base64             Base 64\n\nbf-cbc             Blowfish in CBC mode\nbf                 Alias for bf-cbc\nblowfish           Alias for bf-cbc\nbf-cfb             Blowfish in CFB mode\nbf-ecb             Blowfish in ECB mode\nbf-ofb             Blowfish in OFB mode\n\ncast-cbc           CAST in CBC mode\ncast               Alias for cast-cbc\ncast5-cbc          CAST5 in CBC mode\ncast5-cfb          CAST5 in CFB mode\ncast5-ecb          CAST5 in ECB mode\ncast5-ofb          CAST5 in OFB mode\n\nchacha20           ChaCha20 algorithm\n\ndes-cbc            DES in CBC mode\ndes                Alias for des-cbc\ndes-cfb            DES in CFB mode\ndes-ofb            DES in OFB mode\ndes-ecb            DES in ECB mode\n\ndes-ede-cbc        Two key triple DES EDE in CBC mode\ndes-ede            Two key triple DES EDE in ECB mode\ndes-ede-cfb        Two key triple DES EDE in CFB mode\ndes-ede-ofb        Two key triple DES EDE in OFB mode\n\ndes-ede3-cbc       Three key triple DES EDE in CBC mode\ndes-ede3           Three key triple DES EDE in ECB mode\ndes3               Alias for des-ede3-cbc\ndes-ede3-cfb       Three key triple DES EDE CFB mode\ndes-ede3-ofb       Three key triple DES EDE in OFB mode\n\ndesx               DESX algorithm.\n\ngost89             GOST 28147-89 in CFB mode (provided by ccgost engine)\ngost89-cnt         GOST 28147-89 in CNT mode (provided by ccgost engine)\n\nidea-cbc           IDEA algorithm in CBC mode\nidea               same as idea-cbc\nidea-cfb           IDEA in CFB mode\nidea-ecb           IDEA in ECB mode\nidea-ofb           IDEA in OFB mode\n\nrc2-cbc            128 bit RC2 in CBC mode\nrc2                Alias for rc2-cbc\nrc2-cfb            128 bit RC2 in CFB mode\nrc2-ecb            128 bit RC2 in ECB mode\nrc2-ofb            128 bit RC2 in OFB mode\nrc2-64-cbc         64 bit RC2 in CBC mode\nrc2-40-cbc         40 bit RC2 in CBC mode\n\nrc4                128 bit RC4\nrc4-64             64 bit RC4\nrc4-40             40 bit RC4\n\nrc5-cbc            RC5 cipher in CBC mode\nrc5                Alias for rc5-cbc\nrc5-cfb            RC5 cipher in CFB mode\nrc5-ecb            RC5 cipher in ECB mode\nrc5-ofb            RC5 cipher in OFB mode\n\nseed-cbc           SEED cipher in CBC mode\nseed               Alias for seed-cbc\nseed-cfb           SEED cipher in CFB mode\nseed-ecb           SEED cipher in ECB mode\nseed-ofb           SEED cipher in OFB mode\n\nsm4-cbc            SM4 cipher in CBC mode\nsm4                Alias for sm4-cbc\nsm4-cfb            SM4 cipher in CFB mode\nsm4-ctr            SM4 cipher in CTR mode\nsm4-ecb            SM4 cipher in ECB mode\nsm4-ofb            SM4 cipher in OFB mode\n\naes-[128|192|256]-cbc  128/192/256 bit AES in CBC mode\naes[128|192|256]       Alias for aes-[128|192|256]-cbc\naes-[128|192|256]-cfb  128/192/256 bit AES in 128 bit CFB mode\naes-[128|192|256]-cfb1 128/192/256 bit AES in 1 bit CFB mode\naes-[128|192|256]-cfb8 128/192/256 bit AES in 8 bit CFB mode\naes-[128|192|256]-ctr  128/192/256 bit AES in CTR mode\naes-[128|192|256]-ecb  128/192/256 bit AES in ECB mode\naes-[128|192|256]-ofb  128/192/256 bit AES in OFB mode\n\naria-[128|192|256]-cbc  128/192/256 bit ARIA in CBC mode\naria[128|192|256]       Alias for aria-[128|192|256]-cbc\naria-[128|192|256]-cfb  128/192/256 bit ARIA in 128 bit CFB mode\naria-[128|192|256]-cfb1 128/192/256 bit ARIA in 1 bit CFB mode\naria-[128|192|256]-cfb8 128/192/256 bit ARIA in 8 bit CFB mode\naria-[128|192|256]-ctr  128/192/256 bit ARIA in CTR mode\naria-[128|192|256]-ecb  128/192/256 bit ARIA in ECB mode\naria-[128|192|256]-ofb  128/192/256 bit ARIA in OFB mode\n\ncamellia-[128|192|256]-cbc  128/192/256 bit Camellia in CBC mode\ncamellia[128|192|256]       Alias for camellia-[128|192|256]-cbc\ncamellia-[128|192|256]-cfb  128/192/256 bit Camellia in 128 bit CFB mode\ncamellia-[128|192|256]-cfb1 128/192/256 bit Camellia in 1 bit CFB mode\ncamellia-[128|192|256]-cfb8 128/192/256 bit Camellia in 8 bit CFB mode\ncamellia-[128|192|256]-ctr  128/192/256 bit Camellia in CTR mode\ncamellia-[128|192|256]-ecb  128/192/256 bit Camellia in ECB mode\ncamellia-[128|192|256]-ofb  128/192/256 bit Camellia in OFB mode\n
"},{"location":"man1/openssl-enc/#examples","title":"EXAMPLES","text":"

Just base64 encode a binary file:

openssl base64 -in file.bin -out file.b64\n

Decode the same file

openssl base64 -d -in file.b64 -out file.bin\n

Encrypt a file using AES-128 using a prompted password and PBKDF2 key derivation:

openssl enc -aes128 -pbkdf2 -in file.txt -out file.aes128\n

Decrypt a file using a supplied password:

openssl enc -aes128 -pbkdf2 -d -in file.aes128 -out file.txt \\\n   -pass pass:<password>\n

Encrypt a file then base64 encode it (so it can be sent via mail for example) using AES-256 in CTR mode and PBKDF2 key derivation:

openssl enc -aes-256-ctr -pbkdf2 -a -in file.txt -out file.aes256\n

Base64 decode a file then decrypt it using a password supplied in a file:

openssl enc -aes-256-ctr -pbkdf2 -d -a -in file.aes256 -out file.txt \\\n   -pass file:<passfile>\n
"},{"location":"man1/openssl-enc/#bugs","title":"BUGS","text":"

The -A option when used with large files doesn't work properly. On the other hand, when base64 decoding without the -A option, if the first 1024 bytes of input do not include a newline character the first two lines of input are ignored.

The openssl enc command only supports a fixed number of algorithms with certain parameters. So if, for example, you want to use RC2 with a 76 bit key or RC4 with an 84 bit key you can't use this program.

"},{"location":"man1/openssl-enc/#history","title":"HISTORY","text":"

The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0.

The -list option was added in OpenSSL 1.1.1e.

The -ciphers and -engine options were deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-enc/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-engine/","title":"openssl-engine","text":""},{"location":"man1/openssl-engine/#name","title":"NAME","text":"

openssl-engine - load and query engines

"},{"location":"man1/openssl-engine/#synopsis","title":"SYNOPSIS","text":"

openssl engine [-help] [-v] [-vv] [-vvv] [-vvvv] [-c] [-t] [-tt] [-pre command] ... [-post command] ... [engine ...]

"},{"location":"man1/openssl-engine/#description","title":"DESCRIPTION","text":"

This command has been deprecated. Providers should be used instead of engines.

This command is used to query the status and capabilities of the specified _engine_s. Engines may be specified before and after all other command-line flags. Only those specified are queried.

"},{"location":"man1/openssl-engine/#options","title":"OPTIONS","text":"
  • -help

    Display an option summary.

  • -v -vv -vvv -vvvv

    Provides information about each specified engine. The first flag lists all the possible run-time control commands; the second adds a description of each command; the third adds the input flags, and the final option adds the internal input flags.

  • -c

    Lists the capabilities of each engine.

  • -t

    Tests if each specified engine is available, and displays the answer.

  • -tt

    Displays an error trace for any unavailable engine.

  • -pre command

  • -post command

    Command-line configuration of engines. The -pre command is given to the engine before it is loaded and the -post command is given after the engine is loaded. The command is of the form cmd:val where cmd is the command, and val is the value for the command. See the example below.

    These two options are cumulative, so they may be given more than once in the same command.

"},{"location":"man1/openssl-engine/#examples","title":"EXAMPLES","text":"

To list all the commands available to a dynamic engine:

$ openssl engine -t -tt -vvvv dynamic\n(dynamic) Dynamic engine loading support\n     [ unavailable ]\n     SO_PATH: Specifies the path to the new ENGINE shared library\n          (input flags): STRING\n     NO_VCHECK: Specifies to continue even if version checking fails (boolean)\n          (input flags): NUMERIC\n     ID: Specifies an ENGINE id name for loading\n          (input flags): STRING\n     LIST_ADD: Whether to add a loaded ENGINE to the internal list (0=no,1=yes,2=mandatory)\n          (input flags): NUMERIC\n     DIR_LOAD: Specifies whether to load from 'DIR_ADD' directories (0=no,1=yes,2=mandatory)\n          (input flags): NUMERIC\n     DIR_ADD: Adds a directory from which ENGINEs can be loaded\n          (input flags): STRING\n     LOAD: Load up the ENGINE specified by other settings\n          (input flags): NO_INPUT\n

To list the capabilities of the rsax engine:

$ openssl engine -c\n(rsax) RSAX engine support\n [RSA]\n(dynamic) Dynamic engine loading support\n
"},{"location":"man1/openssl-engine/#environment","title":"ENVIRONMENT","text":"
  • OPENSSL_ENGINES

    The path to the engines directory.

"},{"location":"man1/openssl-engine/#see-also","title":"SEE ALSO","text":"

openssl(1), config(5)

"},{"location":"man1/openssl-engine/#history","title":"HISTORY","text":"

This command was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-engine/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-errstr/","title":"openssl-errstr","text":""},{"location":"man1/openssl-errstr/#name","title":"NAME","text":"

openssl-errstr - lookup error codes

"},{"location":"man1/openssl-errstr/#synopsis","title":"SYNOPSIS","text":"

openssl errstr [-help] error_code...

"},{"location":"man1/openssl-errstr/#description","title":"DESCRIPTION","text":"

Sometimes an application will not load error message texts and only numerical forms will be available. This command can be used to display the meaning of the hex code. The hex code is the hex digits after the second colon.

"},{"location":"man1/openssl-errstr/#options","title":"OPTIONS","text":"
  • -help

    Display a usage message.

"},{"location":"man1/openssl-errstr/#examples","title":"EXAMPLES","text":"

The error code:

27594:error:2006D080:lib(32)::reason(128)::107:\n

can be displayed with:

openssl errstr 2006D080\n

to produce the error message:

error:2006D080:BIO routines::no such file\n
"},{"location":"man1/openssl-errstr/#copyright","title":"COPYRIGHT","text":"

Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-fipsinstall/","title":"openssl-fipsinstall","text":""},{"location":"man1/openssl-fipsinstall/#name","title":"NAME","text":"

openssl-fipsinstall - perform FIPS configuration installation

"},{"location":"man1/openssl-fipsinstall/#synopsis","title":"SYNOPSIS","text":"

openssl fipsinstall [-help] [-in configfilename] [-out configfilename] [-module modulefilename] [-provider_name providername] [-section_name sectionname] [-verify] [-mac_name macname] [-macopt nm:v] [-noout] [-quiet] [-pedantic] [-no_conditional_errors] [-no_security_checks] [-ems_check] [-no_drbg_truncated_digests] [-self_test_onload] [-self_test_oninstall] [-corrupt_desc selftest_description] [-corrupt_type selftest_type] [-config parent_config]

"},{"location":"man1/openssl-fipsinstall/#description","title":"DESCRIPTION","text":"

This command is used to generate a FIPS module configuration file. This configuration file can be used each time a FIPS module is loaded in order to pass data to the FIPS module self tests. The FIPS module always verifies its MAC, but optionally only needs to run the KAT's once, at installation.

The generated configuration file consists of:

    • A MAC of the FIPS module file.
    • A test status indicator.

    This indicates if the Known Answer Self Tests (KAT's) have successfully run.

    • A MAC of the status indicator.
    • A control for conditional self tests errors.

    By default if a continuous test (e.g a key pair test) fails then the FIPS module will enter an error state, and no services or cryptographic algorithms will be able to be accessed after this point. The default value of '1' will cause the fips module error state to be entered. If the value is '0' then the module error state will not be entered. Regardless of whether the error state is entered or not, the current operation (e.g. key generation) will return an error. The user is responsible for retrying the operation if the module error state is not entered.

    • A control to indicate whether run-time security checks are done.

    This indicates if run-time checks related to enforcement of security parameters such as minimum security strength of keys and approved curve names are used. The default value of '1' will perform the checks. If the value is '0' the checks are not performed and FIPS compliance must be done by procedures documented in the relevant Security Policy.

This file is described in fips_config(5).

"},{"location":"man1/openssl-fipsinstall/#options","title":"OPTIONS","text":"
  • -help

    Print a usage message.

  • -module filename

    Filename of the FIPS module to perform an integrity check on. The path provided in the filename is used to load the module when it is activated, and this overrides the environment variable OPENSSL_MODULES.

  • -out configfilename

    Filename to output the configuration data to; the default is standard output.

  • -in configfilename

    Input filename to load configuration data from. Must be used if the -verify option is specified.

  • -verify

    Verify that the input configuration file contains the correct information.

  • -provider_name providername

    Name of the provider inside the configuration file. The default value is fips.

  • -section_name sectionname

    Name of the section inside the configuration file. The default value is fips_sect.

  • -mac_name name

    Specifies the name of a supported MAC algorithm which will be used. The MAC mechanisms that are available will depend on the options used when building OpenSSL. To see the list of supported MAC's use the command openssl list -mac-algorithms. The default is HMAC.

  • -macopt nm:v

    Passes options to the MAC algorithm. A comprehensive list of controls can be found in the EVP_MAC implementation documentation. Common control strings used for this command are:

    • key:string

      Specifies the MAC key as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm. If no key is provided, the default that was specified when OpenSSL was configured is used.

    • hexkey:string

      Specifies the MAC key in hexadecimal form (two hex digits per byte). The key length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm. If no key is provided, the default that was specified when OpenSSL was configured is used.

    • digest:string

      Used by HMAC as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. To see the list of supported digests, use the command openssl list -digest-commands. The default digest is SHA-256.

  • -noout

    Disable logging of the self tests.

  • -pedantic

    Configure the module so that it is strictly FIPS compliant rather than being backwards compatible. This enables conditional errors, security checks etc. Note that any previous configuration options will be overwritten and any subsequent configuration options that violate FIPS compliance will result in an error.

  • -no_conditional_errors

    Configure the module to not enter an error state if a conditional self test fails as described above.

  • -no_security_checks

    Configure the module to not perform run-time security checks as described above.

    Enabling the configuration option \"no-fips-securitychecks\" provides another way to turn off the check at compile time.

  • -ems_check

    Configure the module to enable a run-time Extended Master Secret (EMS) check when using the TLS1_PRF KDF algorithm. This check is disabled by default. See RFC 7627 for information related to EMS.

  • -no_drbg_truncated_digests

    Configure the module to not allow truncated digests to be used with Hash and HMAC DRBGs. See FIPS 140-3 IG D.R for details.

  • -self_test_onload

    Do not write the two fields related to the \"test status indicator\" and \"MAC status indicator\" to the output configuration file. Without these fields the self tests KATS will run each time the module is loaded. This option could be used for cross compiling, since the self tests need to run at least once on each target machine. Once the self tests have run on the target machine the user could possibly then add the 2 fields into the configuration using some other mechanism.

    This is the default.

  • -self_test_oninstall

    The converse of -self_test_oninstall. The two fields related to the \"test status indicator\" and \"MAC status indicator\" are written to the output configuration file.

  • -quiet

    Do not output pass/fail messages. Implies -noout.

  • -corrupt_desc selftest_description, -corrupt_type selftest_type

    The corrupt options can be used to test failure of one or more self tests by name. Either option or both may be used to select the tests to corrupt. Refer to the entries for st-desc and st-type in OSSL_PROVIDER-FIPS(7) for values that can be used.

  • -config parent_config

    Test that a FIPS provider can be loaded from the specified configuration file. A previous call to this application needs to generate the extra configuration data that is included by the base parent_config configuration file. See config(5) for further information on how to set up a provider section. All other options are ignored if '-config' is used.

"},{"location":"man1/openssl-fipsinstall/#notes","title":"NOTES","text":"

Self tests results are logged by default if the options -quiet and -noout are not specified, or if either of the options -corrupt_desc or -corrupt_type are used. If the base configuration file is set up to autoload the fips module, then the fips module will be loaded and self tested BEFORE the fipsinstall application has a chance to set up its own self test callback. As a result of this the self test output and the options -corrupt_desc and -corrupt_type will be ignored. For normal usage the base configuration file should use the default provider when generating the fips configuration file.

The -self_test_oninstall option was added and the -self_test_onload option was made the default in OpenSSL 3.1.

The command and all remaining options were added in OpenSSL 3.0.

"},{"location":"man1/openssl-fipsinstall/#examples","title":"EXAMPLES","text":"

Calculate the mac of a FIPS module fips.so and run a FIPS self test for the module, and save the fips.cnf configuration file:

openssl fipsinstall -module ./fips.so -out fips.cnf -provider_name fips\n

Verify that the configuration file fips.cnf contains the correct info:

openssl fipsinstall -module ./fips.so -in fips.cnf  -provider_name fips -verify\n

Corrupt any self tests which have the description SHA1:

openssl fipsinstall -module ./fips.so -out fips.cnf -provider_name fips \\\n        -corrupt_desc 'SHA1'\n

Validate that the fips module can be loaded from a base configuration file:

export OPENSSL_CONF_INCLUDE=<path of configuration files>\nexport OPENSSL_MODULES=<provider-path>\nopenssl fipsinstall -config' 'default.cnf'\n
"},{"location":"man1/openssl-fipsinstall/#see-also","title":"SEE ALSO","text":"

config(5), fips_config(5), OSSL_PROVIDER-FIPS(7), EVP_MAC(3)

"},{"location":"man1/openssl-fipsinstall/#copyright","title":"COPYRIGHT","text":"

Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-format-options/","title":"openssl-format-options","text":""},{"location":"man1/openssl-format-options/#name","title":"NAME","text":"

openssl-format-options - OpenSSL command input and output format options

"},{"location":"man1/openssl-format-options/#synopsis","title":"SYNOPSIS","text":"

openssl command [ options ... ] [ parameters ... ]

"},{"location":"man1/openssl-format-options/#description","title":"DESCRIPTION","text":"

Several OpenSSL commands can take input or generate output in a variety of formats.

Since OpenSSL 3.0 keys, single certificates, and CRLs can be read from files in any of the DER, PEM or P12 formats. Specifying their input format is no more needed and the openssl commands will automatically try all the possible formats. However if the DER or PEM input format is specified it will be enforced.

In order to access a key via an engine the input format ENGINE may be used; alternatively the key identifier in the <uri> argument of the respective key option may be preceded by org.openssl.engine:. See \"Engine Options\" in openssl(1) for an example usage of the latter.

"},{"location":"man1/openssl-format-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-format-options/#format-options","title":"Format Options","text":"

The options to specify the format are as follows. Refer to the individual man page to see which options are accepted.

  • -inform format, -outform format

    The format of the input or output streams.

  • -keyform format

    Format of a private key input source.

  • -CRLform format

    Format of a CRL input source.

"},{"location":"man1/openssl-format-options/#format-option-arguments","title":"Format Option Arguments","text":"

The possible format arguments are described below. Both uppercase and lowercase are accepted.

The list of acceptable format arguments, and the default, is described in each command documentation.

  • DER

    A binary format, encoded or parsed according to Distinguished Encoding Rules (DER) of the ASN.1 data language.

  • ENGINE

    Used to specify that the cryptographic material is in an OpenSSL engine. An engine must be configured or specified using the -engine option. A password or PIN may be supplied to the engine using the -passin option.

  • P12

    A DER-encoded file containing a PKCS#12 object. It might be necessary to provide a decryption password to retrieve the private key.

  • PEM

    A text format defined in IETF RFC 1421 and IETF RFC 7468. Briefly, this is a block of base-64 encoding (defined in IETF RFC 4648), with specific lines used to mark the start and end:

    Text before the BEGIN line is ignored.\n----- BEGIN object-type -----\nOT43gQKBgQC/2OHZoko6iRlNOAQ/tMVFNq7fL81GivoQ9F1U0Qr+DH3ZfaH8eIkX\nxT0ToMPJUzWAn8pZv0snA0um6SIgvkCuxO84OkANCVbttzXImIsL7pFzfcwV/ERK\nUM6j0ZuSMFOCr/lGPAoOQU0fskidGEHi1/kW+suSr28TqsyYZpwBDQ==\n----- END object-type -----\nText after the END line is also ignored\n

    The object-type must match the type of object that is expected. For example a BEGIN X509 CERTIFICATE will not match if the command is trying to read a private key. The types supported include:

    ANY PRIVATE KEY\nCERTIFICATE\nCERTIFICATE REQUEST\nCMS\nDH PARAMETERS\nDSA PARAMETERS\nDSA PUBLIC KEY\nEC PARAMETERS\nEC PRIVATE KEY\nECDSA PUBLIC KEY\nENCRYPTED PRIVATE KEY\nPARAMETERS\nPKCS #7 SIGNED DATA\nPKCS7\nPRIVATE KEY\nPUBLIC KEY\nRSA PRIVATE KEY\nSSL SESSION PARAMETERS\nTRUSTED CERTIFICATE\nX509 CRL\nX9.42 DH PARAMETERS\n

    The following legacy object-type's are also supported for compatibility with earlier releases:

    DSA PRIVATE KEY\nNEW CERTIFICATE REQUEST\nRSA PUBLIC KEY\nX509 CERTIFICATE\n
  • SMIME

    An S/MIME object as described in IETF RFC 8551. Earlier versions were known as CMS and are compatible. Note that the parsing is simple and might fail to parse some legal data.

"},{"location":"man1/openssl-format-options/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-gendsa/","title":"openssl-gendsa","text":""},{"location":"man1/openssl-gendsa/#name","title":"NAME","text":"

openssl-gendsa - generate a DSA private key from a set of parameters

"},{"location":"man1/openssl-gendsa/#synopsis","title":"SYNOPSIS","text":"

openssl gendsa [-help] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-verbose] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [paramfile]

"},{"location":"man1/openssl-gendsa/#description","title":"DESCRIPTION","text":"

This command generates a DSA private key from a DSA parameter file (which will be typically generated by the openssl-dsaparam(1) command).

"},{"location":"man1/openssl-gendsa/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -out filename

    Output the key to the specified file. If this argument is not specified then standard output is used.

  • -passout arg

    The passphrase used for the output file. See openssl-passphrase-options(1).

  • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

    These options encrypt the private key with specified cipher before outputting it. A pass phrase is prompted for. If none of these options is specified no encryption is used.

    Note that all options must be given before the paramfile argument. Otherwise they are ignored.

  • -verbose

    Print extra details about the operations being performed.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • paramfile

    The DSA parameter file to use. The parameters in this file determine the size of the private key. DSA parameters can be generated and examined using the openssl-dsaparam(1) command.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-gendsa/#notes","title":"NOTES","text":"

DSA key generation is little more than random number generation so it is much quicker that RSA key generation for example.

"},{"location":"man1/openssl-gendsa/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-genpkey(1), openssl-dsaparam(1), openssl-dsa(1), openssl-genrsa(1), openssl-rsa(1)

"},{"location":"man1/openssl-gendsa/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-gendsa/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-genpkey/","title":"openssl-genpkey","text":""},{"location":"man1/openssl-genpkey/#name","title":"NAME","text":"

openssl-genpkey - generate a private key

"},{"location":"man1/openssl-genpkey/#synopsis","title":"SYNOPSIS","text":"

openssl genpkey [-help] [-out filename] [-outform DER|PEM] [-quiet] [-pass arg] [-cipher] [-paramfile file] [-algorithm alg] [-pkeyopt opt:value] [-genparam] [-text] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-config configfile]

"},{"location":"man1/openssl-genpkey/#description","title":"DESCRIPTION","text":"

This command generates a private key.

"},{"location":"man1/openssl-genpkey/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -out filename

    Output the key to the specified file. If this argument is not specified then standard output is used.

  • -outform DER|PEM

    The output format, except when -genparam is given; the default is PEM. See openssl-format-options(1) for details.

    When -genparam is given, -outform is ignored.

  • -quiet

    Do not output \"status dots\" while generating keys.

  • -pass arg

    The output file password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -cipher

    This option encrypts the private key with the supplied cipher. Any algorithm name accepted by EVP_get_cipherbyname() is acceptable such as des3.

  • -algorithm alg

    Public key algorithm to use such as RSA, DSA, DH or DHX. If used this option must precede any -pkeyopt options. The options -paramfile and -algorithm are mutually exclusive. Engines may add algorithms in addition to the standard built-in ones.

    Valid built-in algorithm names for private key generation are RSA, RSA-PSS, EC, X25519, X448, ED25519 and ED448.

    Valid built-in algorithm names for parameter generation (see the -genparam option) are DH, DSA and EC.

    Note that the algorithm name X9.42 DH may be used as a synonym for DHX keys and PKCS#3 refers to DH Keys. Some options are not shared between DH and DHX keys.

  • -pkeyopt opt:value

    Set the public key algorithm option opt to value. The precise set of options supported depends on the public key algorithm used and its implementation. See \"KEY GENERATION OPTIONS\" and \"PARAMETER GENERATION OPTIONS\" below for more details.

  • -genparam

    Generate a set of parameters instead of a private key. If used this option must precede any -algorithm, -paramfile or -pkeyopt options.

  • -paramfile filename

    Some public key algorithms generate a private key based on a set of parameters. They can be supplied using this option. If this option is used the public key algorithm used is determined by the parameters. If used this option must precede any -pkeyopt options. The options -paramfile and -algorithm are mutually exclusive.

  • -text

    Print an (unencrypted) text representation of private and public keys and parameters along with the PEM or DER structure.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -config configfile

    See \"Configuration Option\" in openssl(1).

"},{"location":"man1/openssl-genpkey/#key-generation-options","title":"KEY GENERATION OPTIONS","text":"

The options supported by each algorithm and indeed each implementation of an algorithm can vary. The options for the OpenSSL implementations are detailed below. There are no key generation options defined for the X25519, X448, ED25519 or ED448 algorithms.

"},{"location":"man1/openssl-genpkey/#rsa-key-generation-options","title":"RSA Key Generation Options","text":"
  • rsa_keygen_bits:numbits

    The number of bits in the generated key. If not specified 2048 is used.

  • rsa_keygen_primes:numprimes

    The number of primes in the generated key. If not specified 2 is used.

  • rsa_keygen_pubexp:value

    The RSA public exponent value. This can be a large decimal or hexadecimal value if preceded by 0x. Default value is 65537.

"},{"location":"man1/openssl-genpkey/#rsa-pss-key-generation-options","title":"RSA-PSS Key Generation Options","text":"

Note: by default an RSA-PSS key has no parameter restrictions.

  • rsa_keygen_bits:numbits, rsa_keygen_primes:numprimes, rsa_keygen_pubexp:value

    These options have the same meaning as the RSA algorithm.

  • rsa_pss_keygen_md:digest

    If set the key is restricted and can only use digest for signing.

  • rsa_pss_keygen_mgf1_md:digest

    If set the key is restricted and can only use digest as it's MGF1 parameter.

  • rsa_pss_keygen_saltlen:len

    If set the key is restricted and len specifies the minimum salt length.

"},{"location":"man1/openssl-genpkey/#ec-key-generation-options","title":"EC Key Generation Options","text":"

The EC key generation options can also be used for parameter generation.

  • ec_paramgen_curve:curve

    The EC curve to use. OpenSSL supports NIST curve names such as \"P-256\".

  • ec_param_enc:encoding

    The encoding to use for parameters. The encoding parameter must be either named_curve or explicit. The default value is named_curve.

"},{"location":"man1/openssl-genpkey/#dh-key-generation-options","title":"DH Key Generation Options","text":"
  • group:name

    The paramfile option is not required if a named group is used here. See the \"DH Parameter Generation Options\" section below.

"},{"location":"man1/openssl-genpkey/#parameter-generation-options","title":"PARAMETER GENERATION OPTIONS","text":"

The options supported by each algorithm and indeed each implementation of an algorithm can vary. The options for the OpenSSL implementations are detailed below.

"},{"location":"man1/openssl-genpkey/#dsa-parameter-generation-options","title":"DSA Parameter Generation Options","text":"
  • dsa_paramgen_bits:numbits

    The number of bits in the generated prime. If not specified 2048 is used.

  • dsa_paramgen_q_bits:numbits

  • qbits:numbits

    The number of bits in the q parameter. Must be one of 160, 224 or 256. If not specified 224 is used.

  • dsa_paramgen_md:digest

  • digest:digest

    The digest to use during parameter generation. Must be one of sha1, sha224 or sha256. If set, then the number of bits in q will match the output size of the specified digest and the dsa_paramgen_q_bits parameter will be ignored. If not set, then a digest will be used that gives an output matching the number of bits in q, i.e. sha1 if q length is 160, sha224 if it 224 or sha256 if it is 256.

  • properties:query

    The digest property query string to use when fetching a digest from a provider.

  • type:type

    The type of generation to use. Set this to 1 to use legacy FIPS186-2 parameter generation. The default of 0 uses FIPS186-4 parameter generation.

  • gindex:index

    The index to use for canonical generation and verification of the generator g. Set this to a positive value ranging from 0..255 to use this mode. Larger values will only use the bottom byte. This index must then be reused during key validation to verify the value of g. If this value is not set then g is not verifiable. The default value is -1.

  • hexseed:seed

    The seed seed data to use instead of generating a random seed internally. This should be used for testing purposes only. This will either produced fixed values for the generated parameters OR it will fail if the seed did not generate valid primes.

"},{"location":"man1/openssl-genpkey/#dh-parameter-generation-options","title":"DH Parameter Generation Options","text":"

For most use cases it is recommended to use the group option rather than the type options. Note that the group option is not used by default if no parameter generation options are specified.

  • group:name
  • dh_param:name

    Use a named DH group to select constant values for the DH parameters. All other options will be ignored if this value is set.

    Valid values that are associated with the algorithm of \"DH\" are: \"ffdhe2048\", \"ffdhe3072\", \"ffdhe4096\", \"ffdhe6144\", \"ffdhe8192\", \"modp_1536\", \"modp_2048\", \"modp_3072\", \"modp_4096\", \"modp_6144\", \"modp_8192\".

    Valid values that are associated with the algorithm of \"DHX\" are the RFC5114 names \"dh_1024_160\", \"dh_2048_224\", \"dh_2048_256\".

  • dh_rfc5114:num

    If this option is set, then the appropriate RFC5114 parameters are used instead of generating new parameters. The value num can be one of 1, 2 or 3 that are equivalent to using the option group with one of \"dh_1024_160\", \"dh_2048_224\" or \"dh_2048_256\". All other options will be ignored if this value is set.

  • pbits:numbits

  • dh_paramgen_prime_len:numbits

    The number of bits in the prime parameter p. The default is 2048.

  • qbits:numbits

  • dh_paramgen_subprime_len:numbits

    The number of bits in the sub prime parameter q. The default is 224. Only relevant if used in conjunction with the dh_paramgen_type option to generate DHX parameters.

  • safeprime-generator:value

  • dh_paramgen_generator:value

    The value to use for the generator g. The default is 2. The algorithm option must be \"DH\" for this parameter to be used.

  • type:string

    The type name of DH parameters to generate. Valid values are:

    • \"generator\"

      Use a safe prime generator with the option safeprime_generator The algorithm option must be \"DH\".

    • \"fips186_4\"

      FIPS186-4 parameter generation. The algorithm option must be \"DHX\".

    • \"fips186_2\"

      FIPS186-4 parameter generation. The algorithm option must be \"DHX\".

    • \"group\"

      Can be used with the option pbits to select one of \"ffdhe2048\", \"ffdhe3072\", \"ffdhe4096\", \"ffdhe6144\" or \"ffdhe8192\". The algorithm option must be \"DH\".

    • \"default\"

      Selects a default type based on the algorithm. This is used by the OpenSSL default provider to set the type for backwards compatibility. If algorithm is \"DH\" then \"generator\" is used. If algorithm is \"DHX\" then \"fips186_2\" is used.

  • dh_paramgen_type:value

    The type of DH parameters to generate. Valid values are 0, 1, 2 or 3 which correspond to setting the option type to \"generator\", \"fips186_2\", \"fips186_4\" or \"group\".

  • digest:digest

    The digest to use during parameter generation. Must be one of sha1, sha224 or sha256. If set, then the number of bits in qbits will match the output size of the specified digest and the qbits parameter will be ignored. If not set, then a digest will be used that gives an output matching the number of bits in q, i.e. sha1 if q length is 160, sha224 if it is 224 or sha256 if it is 256. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

  • properties:query

    The digest property query string to use when fetching a digest from a provider. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

  • gindex:index

    The index to use for canonical generation and verification of the generator g. Set this to a positive value ranging from 0..255 to use this mode. Larger values will only use the bottom byte. This index must then be reused during key validation to verify the value of g. If this value is not set then g is not verifiable. The default value is -1. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

  • hexseed:seed

    The seed seed data to use instead of generating a random seed internally. This should be used for testing purposes only. This will either produced fixed values for the generated parameters OR it will fail if the seed did not generate valid primes. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

"},{"location":"man1/openssl-genpkey/#ec-parameter-generation-options","title":"EC Parameter Generation Options","text":"

The EC parameter generation options are the same as for key generation. See \"EC Key Generation Options\" above.

"},{"location":"man1/openssl-genpkey/#notes","title":"NOTES","text":"

The use of the genpkey program is encouraged over the algorithm specific utilities because additional algorithm options and ENGINE provided algorithms can be used.

"},{"location":"man1/openssl-genpkey/#examples","title":"EXAMPLES","text":"

Generate an RSA private key using default parameters:

openssl genpkey -algorithm RSA -out key.pem\n

Encrypt output private key using 128 bit AES and the passphrase \"hello\":

openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello\n

Generate a 2048 bit RSA key using 3 as the public exponent:

openssl genpkey -algorithm RSA -out key.pem \\\n    -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:3\n

Generate 2048 bit DSA parameters that can be validated: The output values for gindex and seed are required for key validation purposes and are not saved to the output pem file).

openssl genpkey -genparam -algorithm DSA -out dsap.pem -pkeyopt pbits:2048 \\\n    -pkeyopt qbits:224 -pkeyopt digest:SHA256 -pkeyopt gindex:1 -text\n

Generate DSA key from parameters:

openssl genpkey -paramfile dsap.pem -out dsakey.pem\n

Generate 4096 bit DH Key using safe prime group ffdhe4096:

openssl genpkey -algorithm DH -out dhkey.pem -pkeyopt group:ffdhe4096\n

Generate 2048 bit X9.42 DH key with 256 bit subgroup using RFC5114 group3:

openssl genpkey -algorithm DHX -out dhkey.pem -pkeyopt dh_rfc5114:3\n

Generate a DH key using a DH parameters file:

openssl genpkey -paramfile dhp.pem -out dhkey.pem\n

Output DH parameters for safe prime group ffdhe2048:

openssl genpkey -genparam -algorithm DH -out dhp.pem -pkeyopt group:ffdhe2048\n

Output 2048 bit X9.42 DH parameters with 224 bit subgroup using RFC5114 group2:

openssl genpkey -genparam -algorithm DHX -out dhp.pem -pkeyopt dh_rfc5114:2\n

Output 2048 bit X9.42 DH parameters with 224 bit subgroup using FIP186-4 keygen:

openssl genpkey -genparam -algorithm DHX -out dhp.pem -text \\\n    -pkeyopt pbits:2048 -pkeyopt qbits:224 -pkeyopt digest:SHA256 \\\n    -pkeyopt gindex:1 -pkeyopt dh_paramgen_type:2\n

Output 1024 bit X9.42 DH parameters with 160 bit subgroup using FIP186-2 keygen:

openssl genpkey -genparam -algorithm DHX -out dhp.pem -text \\\n    -pkeyopt pbits:1024 -pkeyopt qbits:160 -pkeyopt digest:SHA1 \\\n    -pkeyopt gindex:1 -pkeyopt dh_paramgen_type:1\n

Output 2048 bit DH parameters:

openssl genpkey -genparam -algorithm DH -out dhp.pem \\\n    -pkeyopt dh_paramgen_prime_len:2048\n

Output 2048 bit DH parameters using a generator:

openssl genpkey -genparam -algorithm DH -out dhpx.pem \\\n    -pkeyopt dh_paramgen_prime_len:2048 \\\n    -pkeyopt dh_paramgen_type:1\n

Generate EC parameters:

openssl genpkey -genparam -algorithm EC -out ecp.pem \\\n       -pkeyopt ec_paramgen_curve:secp384r1 \\\n       -pkeyopt ec_param_enc:named_curve\n

Generate EC key from parameters:

openssl genpkey -paramfile ecp.pem -out eckey.pem\n

Generate EC key directly:

openssl genpkey -algorithm EC -out eckey.pem \\\n       -pkeyopt ec_paramgen_curve:P-384 \\\n       -pkeyopt ec_param_enc:named_curve\n

Generate an X25519 private key:

openssl genpkey -algorithm X25519 -out xkey.pem\n

Generate an ED448 private key:

openssl genpkey -algorithm ED448 -out xkey.pem\n
"},{"location":"man1/openssl-genpkey/#history","title":"HISTORY","text":"

The ability to use NIST curve names, and to generate an EC key directly, were added in OpenSSL 1.0.2. The ability to generate X25519 keys was added in OpenSSL 1.1.0. The ability to generate X448, ED25519 and ED448 keys was added in OpenSSL 1.1.1.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-genpkey/#copyright","title":"COPYRIGHT","text":"

Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-genrsa/","title":"openssl-genrsa","text":""},{"location":"man1/openssl-genrsa/#name","title":"NAME","text":"

openssl-genrsa - generate an RSA private key

"},{"location":"man1/openssl-genrsa/#synopsis","title":"SYNOPSIS","text":"

openssl genrsa [-help] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-F4] [-f4] [-3] [-primes num] [-verbose] [-traditional] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [numbits]

"},{"location":"man1/openssl-genrsa/#description","title":"DESCRIPTION","text":"

This command generates an RSA private key.

"},{"location":"man1/openssl-genrsa/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -out filename

    Output the key to the specified file. If this argument is not specified then standard output is used.

  • -passout arg

    The output file password source. For more information about the format see openssl-passphrase-options(1).

  • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

    These options encrypt the private key with specified cipher before outputting it. If none of these options is specified no encryption is used. If encryption is used a pass phrase is prompted for if it is not supplied via the -passout argument.

  • -F4, -f4, -3

    The public exponent to use, either 65537 or 3. The default is 65537. The -3 option has been deprecated.

  • -primes num

    Specify the number of primes to use while generating the RSA key. The num parameter must be a positive integer that is greater than 1 and less than 16. If num is greater than 2, then the generated key is called a 'multi-prime' RSA key, which is defined in RFC 8017.

  • -verbose

    Print extra details about the operations being performed.

  • -traditional

    Write the key using the traditional PKCS#1 format instead of the PKCS#8 format.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • numbits

    The size of the private key to generate in bits. This must be the last option specified. The default is 2048 and values less than 512 are not allowed.

"},{"location":"man1/openssl-genrsa/#notes","title":"NOTES","text":"

RSA private key generation essentially involves the generation of two or more prime numbers. When generating a private key various symbols will be output to indicate the progress of the generation. A . represents each number which has passed an initial sieve test, + means a number has passed a single round of the Miller-Rabin primality test, * means the current prime starts a regenerating progress due to some failed tests. A newline means that the number has passed all the prime tests (the actual number depends on the key size).

Because key generation is a random process the time taken to generate a key may vary somewhat. But in general, more primes lead to less generation time of a key.

"},{"location":"man1/openssl-genrsa/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-genpkey(1), openssl-gendsa(1)

"},{"location":"man1/openssl-genrsa/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-info/","title":"openssl-info","text":""},{"location":"man1/openssl-info/#name","title":"NAME","text":"

openssl-info - print OpenSSL built-in information

"},{"location":"man1/openssl-info/#synopsis","title":"SYNOPSIS","text":"

openssl info [-help] [-configdir] [-enginesdir] [-modulesdir ] [-dsoext] [-dirnamesep] [-listsep] [-seeds] [-cpusettings]

"},{"location":"man1/openssl-info/#description","title":"DESCRIPTION","text":"

This command is used to print out information about OpenSSL. The information is written exactly as it is with no extra text, which makes useful for scripts.

As a consequence, only one item may be chosen for each run of this command.

"},{"location":"man1/openssl-info/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -configdir

    Outputs the default directory for OpenSSL configuration files.

  • -enginesdir

    Outputs the default directory for OpenSSL engine modules.

  • -modulesdir

    Outputs the default directory for OpenSSL dynamically loadable modules other than engine modules.

  • -dsoext

    Outputs the DSO extension OpenSSL uses.

  • -dirnamesep

    Outputs the separator character between a directory specification and a filename. Note that on some operating systems, this is not the same as the separator between directory elements.

  • -listsep

    Outputs the OpenSSL list separator character. This is typically used to construct $PATH (%PATH% on Windows) style lists.

  • -seeds

    Outputs the randomness seed sources.

  • -cpusettings

    Outputs the OpenSSL CPU settings info.

"},{"location":"man1/openssl-info/#history","title":"HISTORY","text":"

This command was added in OpenSSL 3.0.

"},{"location":"man1/openssl-info/#copyright","title":"COPYRIGHT","text":"

Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-kdf/","title":"openssl-kdf","text":""},{"location":"man1/openssl-kdf/#name","title":"NAME","text":"

openssl-kdf - perform Key Derivation Function operations

"},{"location":"man1/openssl-kdf/#synopsis","title":"SYNOPSIS","text":"

openssl kdf [-help] [-cipher] [-digest] [-mac] [-kdfopt nm:v] [-keylen num] [-out filename] [-binary] [-provider name] [-provider-path path] [-propquery propq] kdf_name

"},{"location":"man1/openssl-kdf/#description","title":"DESCRIPTION","text":"

The key derivation functions generate a derived key from either a secret or password.

"},{"location":"man1/openssl-kdf/#options","title":"OPTIONS","text":"
  • -help

    Print a usage message.

  • -keylen num

    The output size of the derived key. This field is required.

  • -out filename

    Filename to output to, or standard output by default.

  • -binary

    Output the derived key in binary form. Uses hexadecimal text format if not specified.

  • -cipher name

    Specify the cipher to be used by the KDF. Not all KDFs require a cipher and it is an error to use this option in such cases.

  • -digest name

    Specify the digest to be used by the KDF. Not all KDFs require a digest and it is an error to use this option in such cases. To see the list of supported digests, use openssl list -digest-commands.

  • -mac name

    Specify the MAC to be used by the KDF. Not all KDFs require a MAC and it is an error to use this option in such cases.

  • -kdfopt nm:v

    Passes options to the KDF algorithm. A comprehensive list of parameters can be found in \"PARAMETERS\" in EVP_KDF(3). Common parameter names used by EVP_KDF_CTX_set_params() are:

    • key:string

      Specifies the secret key as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the KDF algorithm. A key must be specified for most KDF algorithms.

    • hexkey:string

      Alternative to the key: option where the secret key is specified in hexadecimal form (two hex digits per byte).

    • pass:string

      Specifies the password as an alphanumeric string (use if the password contains printable characters only). The password must be specified for PBKDF2 and scrypt.

    • hexpass:string

      Alternative to the pass: option where the password is specified in hexadecimal form (two hex digits per byte).

    • salt:string

      Specifies a non-secret unique cryptographic salt as an alphanumeric string (use if it contains printable characters only). The length must conform to any restrictions of the KDF algorithm. A salt parameter is required for several KDF algorithms, such as EVP_KDF-PBKDF2(7).

    • hexsalt:string

      Alternative to the salt: option where the salt is specified in hexadecimal form (two hex digits per byte).

    • info:string

      Some KDF implementations, such as EVP_KDF-HKDF(7), take an 'info' parameter for binding the derived key material to application- and context-specific information. Specifies the info, fixed info, other info or shared info argument as an alphanumeric string (use if it contains printable characters only). The length must conform to any restrictions of the KDF algorithm.

    • hexinfo:string

      Alternative to the info: option where the info is specified in hexadecimal form (two hex digits per byte).

    • digest:string

      This option is identical to the -digest option.

    • cipher:string

      This option is identical to the -cipher option.

    • mac:string

      This option is identical to the -mac option.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • kdf_name

    Specifies the name of a supported KDF algorithm which will be used. The supported algorithms names include TLS1-PRF, HKDF, SSKDF, PBKDF2, SSHKDF, X942KDF-ASN1, X942KDF-CONCAT, X963KDF and SCRYPT.

"},{"location":"man1/openssl-kdf/#examples","title":"EXAMPLES","text":"

Use TLS1-PRF to create a hex-encoded derived key from a secret key and seed:

openssl kdf -keylen 16 -kdfopt digest:SHA2-256 -kdfopt key:secret \\\n            -kdfopt seed:seed TLS1-PRF\n

Use HKDF to create a hex-encoded derived key from a secret key, salt and info:

openssl kdf -keylen 10 -kdfopt digest:SHA2-256 -kdfopt key:secret \\\n            -kdfopt salt:salt -kdfopt info:label HKDF\n

Use SSKDF with KMAC to create a hex-encoded derived key from a secret key, salt and info:

openssl kdf -keylen 64 -kdfopt mac:KMAC-128 -kdfopt maclen:20 \\\n            -kdfopt hexkey:b74a149a161545 -kdfopt hexinfo:348a37a2 \\\n            -kdfopt hexsalt:3638271ccd68a2 SSKDF\n

Use SSKDF with HMAC to create a hex-encoded derived key from a secret key, salt and info:

openssl kdf -keylen 16 -kdfopt mac:HMAC -kdfopt digest:SHA2-256 \\\n            -kdfopt hexkey:b74a149a -kdfopt hexinfo:348a37a2 \\\n            -kdfopt hexsalt:3638271c SSKDF\n

Use SSKDF with Hash to create a hex-encoded derived key from a secret key, salt and info:

openssl kdf -keylen 14 -kdfopt digest:SHA2-256 \\\n            -kdfopt hexkey:6dbdc23f045488 \\\n            -kdfopt hexinfo:a1b2c3d4 SSKDF\n

Use SSHKDF to create a hex-encoded derived key from a secret key, hash and session_id:

openssl kdf -keylen 16 -kdfopt digest:SHA2-256 \\\n            -kdfopt hexkey:0102030405 \\\n            -kdfopt hexxcghash:06090A \\\n            -kdfopt hexsession_id:01020304 \\\n            -kdfopt type:A SSHKDF\n

Use PBKDF2 to create a hex-encoded derived key from a password and salt:

openssl kdf -keylen 32 -kdfopt digest:SHA256 -kdfopt pass:password \\\n            -kdfopt salt:salt -kdfopt iter:2 PBKDF2\n

Use scrypt to create a hex-encoded derived key from a password and salt:

openssl kdf -keylen 64 -kdfopt pass:password -kdfopt salt:NaCl \\\n            -kdfopt n:1024 -kdfopt r:8 -kdfopt p:16 \\\n            -kdfopt maxmem_bytes:10485760 SCRYPT\n
"},{"location":"man1/openssl-kdf/#notes","title":"NOTES","text":"

The KDF mechanisms that are available will depend on the options used when building OpenSSL.

"},{"location":"man1/openssl-kdf/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkeyutl(1), EVP_KDF(3), EVP_KDF-SCRYPT(7), EVP_KDF-TLS1_PRF(7), EVP_KDF-PBKDF2(7), EVP_KDF-HKDF(7), EVP_KDF-SS(7), EVP_KDF-SSHKDF(7), EVP_KDF-X942-ASN1(7), EVP_KDF-X942-CONCAT(7), EVP_KDF-X963(7)

"},{"location":"man1/openssl-kdf/#history","title":"HISTORY","text":"

Added in OpenSSL 3.0

"},{"location":"man1/openssl-kdf/#copyright","title":"COPYRIGHT","text":"

Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-list/","title":"openssl-list","text":""},{"location":"man1/openssl-list/#name","title":"NAME","text":"

openssl-list - list algorithms and features

"},{"location":"man1/openssl-list/#synopsis","title":"SYNOPSIS","text":"

openssl list [-help] [-verbose] [-select name] [-1] [-commands] [-standard-commands] [-digest-algorithms] [-digest-commands] [-kdf-algorithms] [-mac-algorithms] [-random-instances] [-random-generators] [-cipher-algorithms] [-cipher-commands] [-encoders] [-decoders] [-key-managers] [-key-exchange-algorithms] [-kem-algorithms] [-signature-algorithms] [-asymcipher-algorithms] [-public-key-algorithms] [-public-key-methods] [-store-loaders] [-providers] [-engines] [-disabled] [-objects] [-options command] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-list/#description","title":"DESCRIPTION","text":"

This command is used to generate list of algorithms or disabled features.

"},{"location":"man1/openssl-list/#options","title":"OPTIONS","text":"
  • -help

    Display a usage message.

  • -verbose

    Displays extra information. The options below where verbosity applies say a bit more about what that means.

  • -select name

    Only list algorithms that match this name.

  • -1

    List the commands, digest-commands, or cipher-commands in a single column. If used, this option must be given first.

  • -commands

    Display a list of standard commands.

  • -standard-commands

    List of standard commands.

  • -digest-commands

    This option is deprecated. Use digest-algorithms instead.

    Display a list of message digest commands, which are typically used as input to the openssl-dgst(1) or openssl-speed(1) commands.

  • -cipher-commands

    This option is deprecated. Use cipher-algorithms instead.

    Display a list of cipher commands, which are typically used as input to the openssl-enc(1) or openssl-speed(1) commands.

  • -cipher-algorithms, -digest-algorithms, -kdf-algorithms, -mac-algorithms,

    Display a list of symmetric cipher, digest, kdf and mac algorithms. See \"Display of algorithm names\" for a description of how names are displayed.

    In verbose mode, the algorithms provided by a provider will get additional information on what parameters each implementation supports.

  • -random-instances

    List the primary, public and private random number generator details.

  • -random-generators

    Display a list of random number generators. See \"Display of algorithm names\" for a description of how names are displayed.

  • -encoders

    Display a list of encoders. See \"Display of algorithm names\" for a description of how names are displayed.

    In verbose mode, the algorithms provided by a provider will get additional information on what parameters each implementation supports.

  • -decoders

    Display a list of decoders. See \"Display of algorithm names\" for a description of how names are displayed.

    In verbose mode, the algorithms provided by a provider will get additional information on what parameters each implementation supports.

  • -public-key-algorithms

    Display a list of public key algorithms, with each algorithm as a block of multiple lines, all but the first are indented. The options key-exchange-algorithms, kem-algorithms, signature-algorithms, and asymcipher-algorithms will display similar info.

  • -public-key-methods

    Display a list of public key methods.

  • -key-managers

    Display a list of key managers.

  • -key-exchange-algorithms

    Display a list of key exchange algorithms.

  • -kem-algorithms

    Display a list of key encapsulation algorithms.

  • -signature-algorithms

    Display a list of signature algorithms.

  • -asymcipher-algorithms

    Display a list of asymmetric cipher algorithms.

  • -store-loaders

    Display a list of store loaders.

  • -providers

    Display a list of all loaded providers with their names, version and status.

    In verbose mode, the full version and all provider parameters will additionally be displayed.

  • -engines

    This option is deprecated.

    Display a list of loaded engines.

  • -disabled

    Display a list of disabled features, those that were compiled out of the installation.

  • -objects

    Display a list of built in objects, i.e. OIDs with names. They're listed in the format described in \"ASN1 Object Configuration Module\" in config(5).

  • -options command

    Output a two-column list of the options accepted by the specified command. The first is the option name, and the second is a one-character indication of what type of parameter it takes, if any. This is an internal option, used for checking that the documentation is complete.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-list/#display-of-algorithm-names","title":"Display of algorithm names","text":"

Algorithm names may be displayed in one of two manners:

  • Legacy implementations

    Legacy implementations will simply display the main name of the algorithm on a line of its own, or in the form <foo bar>> to show that foo is an alias for the main name, bar

  • Provided implementations

    Implementations from a provider are displayed like this if the implementation is labeled with a single name:

    foo @ bar\n

    or like this if it's labeled with multiple names:

    { foo1, foo2 } @bar\n

    In both cases, bar is the name of the provider.

"},{"location":"man1/openssl-list/#history","title":"HISTORY","text":"

The -engines, -digest-commands, and -cipher-commands options were deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-list/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-mac/","title":"openssl-mac","text":""},{"location":"man1/openssl-mac/#name","title":"NAME","text":"

openssl-mac - perform Message Authentication Code operations

"},{"location":"man1/openssl-mac/#synopsis","title":"SYNOPSIS","text":"

openssl mac [-help] [-cipher] [-digest] [-macopt] [-in filename] [-out filename] [-binary] [-provider name] [-provider-path path] [-propquery propq] mac_name

"},{"location":"man1/openssl-mac/#description","title":"DESCRIPTION","text":"

The message authentication code functions output the MAC of a supplied input file.

"},{"location":"man1/openssl-mac/#options","title":"OPTIONS","text":"
  • -help

    Print a usage message.

  • -in filename

    Input filename to calculate a MAC for, or standard input by default. Standard input is used if the filename is '-'. Files and standard input are expected to be in binary format.

  • -out filename

    Filename to output to, or standard output by default.

  • -binary

    Output the MAC in binary form. Uses hexadecimal text format if not specified.

  • -cipher name

    Used by CMAC and GMAC to specify the cipher algorithm. For CMAC it must be one of AES-128-CBC, AES-192-CBC, AES-256-CBC or DES-EDE3-CBC. For GMAC it should be a GCM mode cipher e.g. AES-128-GCM.

  • -digest name

    Used by HMAC as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. To see the list of supported digests, use openssl list -digest-commands.

  • -macopt nm:v

    Passes options to the MAC algorithm. A comprehensive list of controls can be found in the EVP_MAC implementation documentation. Common parameter names used by EVP_MAC_CTX_get_params() are:

    • key:string

      Specifies the MAC key as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm.

    • hexkey:string

      Specifies the MAC key in hexadecimal form (two hex digits per byte). The key length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm.

    • iv:string

      Used by GMAC to specify an IV as an alphanumeric string (use if the IV contains printable characters only).

    • hexiv:string

      Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte).

    • size:int

      Used by KMAC128 or KMAC256 to specify an output length. The default sizes are 32 or 64 bytes respectively.

    • custom:string

      Used by KMAC128 or KMAC256 to specify a customization string. The default is the empty string \"\".

    • digest:string

      This option is identical to the -digest option.

    • cipher:string

      This option is identical to the -cipher option.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • mac_name

    Specifies the name of a supported MAC algorithm which will be used. To see the list of supported MAC's use the command openssl list \\-mac-algorithms.

"},{"location":"man1/openssl-mac/#examples","title":"EXAMPLES","text":"

To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout:

openssl mac -digest SHA1 \\\n        -macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \\\n        -in msg.bin HMAC\n

To create a SipHash MAC from a file with a binary file output:

openssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \\\n        -in msg.bin -out out.bin -binary SipHash\n

To create a hex-encoded CMAC-AES-128-CBC MAC from a file:

openssl mac -cipher AES-128-CBC \\\n        -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \\\n        -in msg.bin CMAC\n

To create a hex-encoded KMAC128 MAC from a file with a Customisation String 'Tag' and output length of 16:

openssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \\\n        -macopt size:16 -in msg.bin KMAC128\n

To create a hex-encoded GMAC-AES-128-GCM with a IV from a file:

openssl mac -cipher AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3 \\\n        -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin GMAC\n
"},{"location":"man1/openssl-mac/#notes","title":"NOTES","text":"

The MAC mechanisms that are available will depend on the options used when building OpenSSL. Use openssl list -mac-algorithms to list them.

"},{"location":"man1/openssl-mac/#see-also","title":"SEE ALSO","text":"

openssl(1), EVP_MAC(3), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-HMAC(7), EVP_MAC-KMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7)

"},{"location":"man1/openssl-mac/#copyright","title":"COPYRIGHT","text":"

Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-namedisplay-options/","title":"openssl-namedisplay-options","text":""},{"location":"man1/openssl-namedisplay-options/#name","title":"NAME","text":"

openssl-namedisplay-options - Distinguished name display options

"},{"location":"man1/openssl-namedisplay-options/#synopsis","title":"SYNOPSIS","text":"

openssl command [ options ... ] [ parameters ... ]

"},{"location":"man1/openssl-namedisplay-options/#description","title":"DESCRIPTION","text":"

OpenSSL provides fine-grain control over how the subject and issuer DN's are displayed. This is specified by using the -nameopt option, which takes a comma-separated list of options from the following set. An option may be preceded by a minus sign, -, to turn it off. The default value is oneline. The first four are the most commonly used.

"},{"location":"man1/openssl-namedisplay-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-namedisplay-options/#name-format-option-arguments","title":"Name Format Option Arguments","text":"

The DN output format can be fine tuned with the following flags.

  • compat

    Display the name using an old format from previous OpenSSL versions.

  • RFC2253

    Display the name using the format defined in RFC 2253. It is equivalent to esc_2253, esc_ctrl, esc_msb, utf8, dump_nostr, dump_unknown, dump_der, sep_comma_plus, dn_rev and sname.

  • oneline

    Display the name in one line, using a format that is more readable RFC 2253. It is equivalent to esc_2253, esc_ctrl, esc_msb, utf8, dump_nostr, dump_der, use_quote, sep_comma_plus_space, space_eq and sname options.

  • multiline

    Display the name using multiple lines. It is equivalent to esc_ctrl, esc_msb, sep_multiline, space_eq, lname and align.

  • esc_2253

    Escape the \"special\" characters in a field, as required by RFC 2253. That is, any of the characters ,+\"<>;, # at the beginning of a string and leading or trailing spaces.

  • esc_2254

    Escape the \"special\" characters in a field as required by RFC 2254 in a field. That is, the NUL character and of ()*.

  • esc_ctrl

    Escape non-printable ASCII characters, codes less than 0x20 (space) or greater than 0x7F (DELETE). They are displayed using RFC 2253 \\XX notation where XX are the two hex digits representing the character value.

  • esc_msb

    Escape any characters with the most significant bit set, that is with values larger than 127, as described in esc_ctrl.

  • use_quote

    Escapes some characters by surrounding the entire string with quotation marks, \". Without this option, individual special characters are preceded with a backslash character, \\.

  • utf8

    Convert all strings to UTF-8 format first as required by RFC 2253. If the output device is UTF-8 compatible, then using this option (and not setting esc_msb) may give the correct display of multibyte characters. If this option is not set, then multibyte characters larger than 0xFF will be output as \\UXXXX for 16 bits or \\WXXXXXXXX for 32 bits. In addition, any UTF8Strings will be converted to their character form first.

  • ignore_type

    This option does not attempt to interpret multibyte characters in any way. That is, the content octets are merely dumped as though one octet represents each character. This is useful for diagnostic purposes but will result in rather odd looking output.

  • show_type

    Display the type of the ASN1 character string before the value, such as BMPSTRING: Hello World.

  • dump_der

    Any fields that would be output in hex format are displayed using the DER encoding of the field. If not set, just the content octets are displayed. Either way, the #XXXX... format of RFC 2253 is used.

  • dump_nostr

    Dump non-character strings, such as ASN.1 OCTET STRING. If this option is not set, then non character string types will be displayed as though each content octet represents a single character.

  • dump_all

    Dump all fields. When this used with dump_der, this allows the DER encoding of the structure to be unambiguously determined.

  • dump_unknown

    Dump any field whose OID is not recognised by OpenSSL.

  • sep_comma_plus, sep_comma_plus_space, sep_semi_plus_space, sep_multiline

    Specify the field separators. The first word is used between the Relative Distinguished Names (RDNs) and the second is between multiple Attribute Value Assertions (AVAs). Multiple AVAs are very rare and their use is discouraged. The options ending in \"space\" additionally place a space after the separator to make it more readable. The sep_multiline starts each field on its own line, and uses \"plus space\" for the AVA separator. It also indents the fields by four characters. The default value is sep_comma_plus_space.

  • dn_rev

    Reverse the fields of the DN as required by RFC 2253. This also reverses the order of multiple AVAs in a field, but this is permissible as there is no ordering on values.

  • nofname, sname, lname, oid

    Specify how the field name is displayed. nofname does not display the field at all. sname uses the \"short name\" form (CN for commonName for example). lname uses the long form. oid represents the OID in numerical form and is useful for diagnostic purpose.

  • align

    Align field values for a more readable output. Only usable with sep_multiline.

  • space_eq

    Places spaces round the equal sign, =, character which follows the field name.

"},{"location":"man1/openssl-namedisplay-options/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-nseq/","title":"openssl-nseq","text":""},{"location":"man1/openssl-nseq/#name","title":"NAME","text":"

openssl-nseq - create or examine a Netscape certificate sequence

"},{"location":"man1/openssl-nseq/#synopsis","title":"SYNOPSIS","text":"

openssl nseq [-help] [-in filename] [-out filename] [-toseq] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-nseq/#description","title":"DESCRIPTION","text":"

This command takes a file containing a Netscape certificate sequence and prints out the certificates contained in it or takes a file of certificates and converts it into a Netscape certificate sequence.

A Netscape certificate sequence is an old Netscape-specific format that can be sometimes be sent to browsers as an alternative to the standard PKCS#7 format when several certificates are sent to the browser, for example during certificate enrollment. It was also used by Netscape certificate server.

"},{"location":"man1/openssl-nseq/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -in filename

    This specifies the input filename to read or standard input if this option is not specified.

  • -out filename

    Specifies the output filename or standard output by default.

  • -toseq

    Normally a Netscape certificate sequence will be input and the output is the certificates contained in it. With the -toseq option the situation is reversed: a Netscape certificate sequence is created from a file of certificates.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-nseq/#examples","title":"EXAMPLES","text":"

Output the certificates in a Netscape certificate sequence

openssl nseq -in nseq.pem -out certs.pem\n

Create a Netscape certificate sequence

openssl nseq -in certs.pem -toseq -out nseq.pem\n
"},{"location":"man1/openssl-nseq/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-ocsp/","title":"openssl-ocsp","text":""},{"location":"man1/openssl-ocsp/#name","title":"NAME","text":"

openssl-ocsp - Online Certificate Status Protocol command

"},{"location":"man1/openssl-ocsp/#synopsis","title":"SYNOPSIS","text":""},{"location":"man1/openssl-ocsp/#ocsp-client","title":"OCSP Client","text":"

openssl ocsp [-help] [-out file] [-issuer file] [-cert file] [-no_certs] [-serial n] [-signer file] [-signkey file] [-sign_other file] [-nonce] [-no_nonce] [-req_text] [-resp_text] [-text] [-reqout file] [-respout file] [-reqin file] [-respin file] [-url URL] [-host host:port] [-path] [-proxy [http[s]://][userinfo@]host[:port][/path]] [-no_proxy addresses] [-header] [-timeout seconds] [-VAfile file] [-validity_period n] [-status_age n] [-noverify] [-verify_other file] [-trust_other] [-no_intern] [-no_signature_verify] [-no_cert_verify] [-no_chain] [-no_cert_checks] [-no_explicit] [-port num] [-ignore_err]

"},{"location":"man1/openssl-ocsp/#ocsp-server","title":"OCSP Server","text":"

openssl ocsp [-index file] [-CA file] [-rsigner file] [-rkey file] [-passin arg] [-rother file] [-rsigopt nm:v] [-rmd digest] [-badsig] [-resp_no_certs] [-nmin n] [-ndays n] [-resp_key_id] [-nrequest n] [-multi process-count] [-rcid digest] [-digest] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-ocsp/#description","title":"DESCRIPTION","text":"

The Online Certificate Status Protocol (OCSP) enables applications to determine the (revocation) state of an identified certificate (RFC 2560).

This command performs many common OCSP tasks. It can be used to print out requests and responses, create requests and send queries to an OCSP responder and behave like a mini OCSP server itself.

"},{"location":"man1/openssl-ocsp/#options","title":"OPTIONS","text":"

This command operates as either a client or a server. The options are described below, divided into those two modes.

"},{"location":"man1/openssl-ocsp/#ocsp-client-options","title":"OCSP Client Options","text":"
  • -help

    Print out a usage message.

  • -out filename

    specify output filename, default is standard output.

  • -issuer filename

    This specifies the current issuer certificate. This option can be used multiple times. This option MUST come before any -cert options.

  • -cert filename

    Add the certificate filename to the request. The issuer certificate is taken from the previous -issuer option, or an error occurs if no issuer certificate is specified.

  • -no_certs

    Don't include any certificates in signed request.

  • -serial num

    Same as the -cert option except the certificate with serial number num is added to the request. The serial number is interpreted as a decimal integer unless preceded by 0x. Negative integers can also be specified by preceding the value by a - sign.

  • -signer filename, -signkey filename

    Sign the OCSP request using the certificate specified in the -signer option and the private key specified by the -signkey option. If the -signkey option is not present then the private key is read from the same file as the certificate. If neither option is specified then the OCSP request is not signed.

  • -sign_other filename

    Additional certificates to include in the signed request. The input can be in PEM, DER, or PKCS#12 format.

  • -nonce, -no_nonce

    Add an OCSP nonce extension to a request or disable OCSP nonce addition. Normally if an OCSP request is input using the -reqin option no nonce is added: using the -nonce option will force addition of a nonce. If an OCSP request is being created (using -cert and -serial options) a nonce is automatically added specifying -no_nonce overrides this.

  • -req_text, -resp_text, -text

    Print out the text form of the OCSP request, response or both respectively.

  • -reqout file, -respout file

    Write out the DER encoded certificate request or response to file.

  • -reqin file, -respin file

    Read OCSP request or response file from file. These option are ignored if OCSP request or response creation is implied by other options (for example with -serial, -cert and -host options).

  • -url responder_url

    Specify the responder URL. Both HTTP and HTTPS (SSL/TLS) URLs can be specified. The optional userinfo and fragment components are ignored. Any given query component is handled as part of the path component.

  • -host hostname:port, -path pathname

    If the -host option is present then the OCSP request is sent to the host hostname on port port. The -path option specifies the HTTP pathname to use or \"/\" by default. This is equivalent to specifying -url with scheme http:// and the given hostname, port, and pathname.

  • -proxy [http[s]://][userinfo@]host[:port][/path]

    The HTTP(S) proxy server to use for reaching the OCSP server unless -no_proxy applies, see below. The proxy port defaults to 80 or 443 if the scheme is https; apart from that the optional http:// or https:// prefix is ignored, as well as any userinfo and path components. Defaults to the environment variable http_proxy if set, else HTTP_PROXY in case no TLS is used, otherwise https_proxy if set, else HTTPS_PROXY.

  • -no_proxy addresses

    List of IP addresses and/or DNS names of servers not to use an HTTP(S) proxy for, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Default is from the environment variable no_proxy if set, else NO_PROXY.

  • -header name=value

    Adds the header name with the specified value to the OCSP request that is sent to the responder. This may be repeated.

  • -timeout seconds

    Connection timeout to the OCSP responder in seconds. On POSIX systems, when running as an OCSP responder, this option also limits the time that the responder is willing to wait for the client request. This time is measured from the time the responder accepts the connection until the complete request is received.

  • -verify_other file

    File or URI containing additional certificates to search when attempting to locate the OCSP response signing certificate. Some responders omit the actual signer's certificate from the response: this option can be used to supply the necessary certificate in such cases. The input can be in PEM, DER, or PKCS#12 format.

  • -trust_other

    The certificates specified by the -verify_other option should be explicitly trusted and no additional checks will be performed on them. This is useful when the complete responder certificate chain is not available or trusting a root CA is not appropriate.

  • -VAfile file

    File or URI containing explicitly trusted responder certificates. Equivalent to the -verify_other and -trust_other options. The input can be in PEM, DER, or PKCS#12 format.

  • -noverify

    Don't attempt to verify the OCSP response signature or the nonce values. This option will normally only be used for debugging since it disables all verification of the responders certificate.

  • -no_intern

    Ignore certificates contained in the OCSP response when searching for the signers certificate. With this option the signers certificate must be specified with either the -verify_other or -VAfile options.

  • -no_signature_verify

    Don't check the signature on the OCSP response. Since this option tolerates invalid signatures on OCSP responses it will normally only be used for testing purposes.

  • -no_cert_verify

    Don't verify the OCSP response signers certificate at all. Since this option allows the OCSP response to be signed by any certificate it should only be used for testing purposes.

  • -no_chain

    Do not use certificates in the response as additional untrusted CA certificates.

  • -no_explicit

    Do not explicitly trust the root CA if it is set to be trusted for OCSP signing.

  • -no_cert_checks

    Don't perform any additional checks on the OCSP response signers certificate. That is do not make any checks to see if the signers certificate is authorised to provide the necessary status information: as a result this option should only be used for testing purposes.

  • -validity_period nsec, -status_age age

    These options specify the range of times, in seconds, which will be tolerated in an OCSP response. Each certificate status response includes a notBefore time and an optional notAfter time. The current time should fall between these two values, but the interval between the two times may be only a few seconds. In practice the OCSP responder and clients clocks may not be precisely synchronised and so such a check may fail. To avoid this the -validity_period option can be used to specify an acceptable error range in seconds, the default value is 5 minutes.

    If the notAfter time is omitted from a response then this means that new status information is immediately available. In this case the age of the notBefore field is checked to see it is not older than age seconds old. By default this additional check is not performed.

  • -rcid digest

    This option sets the digest algorithm to use for certificate identification in the OCSP response. Any digest supported by the openssl-dgst(1) command can be used. The default is the same digest algorithm used in the request.

  • -digest

    This option sets digest algorithm to use for certificate identification in the OCSP request. Any digest supported by the OpenSSL dgst command can be used. The default is SHA-1. This option may be used multiple times to specify the digest used by subsequent certificate identifiers.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-ocsp/#ocsp-server-options","title":"OCSP Server Options","text":"
  • -index indexfile

    The indexfile parameter is the name of a text index file in ca format containing certificate revocation information.

    If the -index option is specified then this command switches to responder mode, otherwise it is in client mode. The request(s) the responder processes can be either specified on the command line (using -issuer and -serial options), supplied in a file (using the -reqin option) or via external OCSP clients (if -port or -url is specified).

    If the -index option is present then the -CA and -rsigner options must also be present.

  • -CA file

    CA certificate corresponding to the revocation information in the index file given with -index. The input can be in PEM, DER, or PKCS#12 format.

  • -rsigner file

    The certificate to sign OCSP responses with.

  • -rkey file

    The private key to sign OCSP responses with: if not present the file specified in the -rsigner option is used.

  • -passin arg

    The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -rother file

    Additional certificates to include in the OCSP response. The input can be in PEM, DER, or PKCS#12 format.

  • -rsigopt nm:v

    Pass options to the signature algorithm when signing OCSP responses. Names and values of these options are algorithm-specific.

  • -rmd digest

    The digest to use when signing the response.

  • -badsig

    Corrupt the response signature before writing it; this can be useful for testing.

  • -resp_no_certs

    Don't include any certificates in the OCSP response.

  • -resp_key_id

    Identify the signer certificate using the key ID, default is to use the subject name.

  • -port portnum

    Port to listen for OCSP requests on. The port may also be specified using the url option. A 0 argument indicates that any available port shall be chosen automatically.

  • -ignore_err

    Ignore malformed requests or responses: When acting as an OCSP client, retry if a malformed response is received. When acting as an OCSP responder, continue running instead of terminating upon receiving a malformed request.

  • -nrequest number

    The OCSP server will exit after receiving number requests, default unlimited.

  • -multi process-count

    Run the specified number of OCSP responder child processes, with the parent process respawning child processes as needed. Child processes will detect changes in the CA index file and automatically reload it. When running as a responder -timeout option is recommended to limit the time each child is willing to wait for the client's OCSP response. This option is available on POSIX systems (that support the fork() and other required unix system-calls).

  • -nmin minutes, -ndays days

    Number of minutes or days when fresh revocation information is available: used in the nextUpdate field. If neither option is present then the nextUpdate field is omitted meaning fresh revocation information is immediately available.

"},{"location":"man1/openssl-ocsp/#ocsp-response-verification","title":"OCSP RESPONSE VERIFICATION","text":"

OCSP Response follows the rules specified in RFC2560.

Initially the OCSP responder certificate is located and the signature on the OCSP request checked using the responder certificate's public key.

Then a normal certificate verify is performed on the OCSP responder certificate building up a certificate chain in the process. The locations of the trusted certificates used to build the chain can be specified by the -CAfile, -CApath or -CAstore options or they will be looked for in the standard OpenSSL certificates directory.

If the initial verify fails then the OCSP verify process halts with an error.

Otherwise the issuing CA certificate in the request is compared to the OCSP responder certificate: if there is a match then the OCSP verify succeeds.

Otherwise the OCSP responder certificate's CA is checked against the issuing CA certificate in the request. If there is a match and the OCSPSigning extended key usage is present in the OCSP responder certificate then the OCSP verify succeeds.

Otherwise, if -no_explicit is not set the root CA of the OCSP responders CA is checked to see if it is trusted for OCSP signing. If it is the OCSP verify succeeds.

If none of these checks is successful then the OCSP verify fails.

What this effectively means if that if the OCSP responder certificate is authorised directly by the CA it is issuing revocation information about (and it is correctly configured) then verification will succeed.

If the OCSP responder is a \"global responder\" which can give details about multiple CAs and has its own separate certificate chain then its root CA can be trusted for OCSP signing. For example:

openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem\n

Alternatively the responder certificate itself can be explicitly trusted with the -VAfile option.

"},{"location":"man1/openssl-ocsp/#notes","title":"NOTES","text":"

As noted, most of the verify options are for testing or debugging purposes. Normally only the -CApath, -CAfile, -CAstore and (if the responder is a 'global VA') -VAfile options need to be used.

The OCSP server is only useful for test and demonstration purposes: it is not really usable as a full OCSP responder. It contains only a very simple HTTP request handling and can only handle the POST form of OCSP queries. It also handles requests serially meaning it cannot respond to new requests until it has processed the current one. The text index file format of revocation is also inefficient for large quantities of revocation data.

It is possible to run this command in responder mode via a CGI script using the -reqin and -respout options.

"},{"location":"man1/openssl-ocsp/#examples","title":"EXAMPLES","text":"

Create an OCSP request and write it to a file:

openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der\n

Send a query to an OCSP responder with URL http://ocsp.myhost.com/ save the response to a file, print it out in text form, and verify the response:

openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \\\n    -url http://ocsp.myhost.com/ -resp_text -respout resp.der\n

Read in an OCSP response and print out text form:

openssl ocsp -respin resp.der -text -noverify\n

OCSP server on port 8888 using a standard ca configuration, and a separate responder certificate. All requests and responses are printed to a file.

openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem\n       -text -out log.txt\n

As above but exit after processing one request:

openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem\n    -nrequest 1\n

Query status information using an internally generated request:

openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem\n    -issuer demoCA/cacert.pem -serial 1\n

Query status information using request read from a file, and write the response to a second file.

openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem\n    -reqin req.der -respout resp.der\n
"},{"location":"man1/openssl-ocsp/#history","title":"HISTORY","text":"

The -no_alt_chains option was added in OpenSSL 1.1.0.

"},{"location":"man1/openssl-ocsp/#copyright","title":"COPYRIGHT","text":"

Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-passphrase-options/","title":"openssl-passphrase-options","text":""},{"location":"man1/openssl-passphrase-options/#name","title":"NAME","text":"

openssl-passphrase-options - Pass phrase options

"},{"location":"man1/openssl-passphrase-options/#synopsis","title":"SYNOPSIS","text":"

openssl command [ options ... ] [ parameters ... ]

"},{"location":"man1/openssl-passphrase-options/#description","title":"DESCRIPTION","text":"

Several OpenSSL commands accept password arguments, typically using -passin and -passout for input and output passwords respectively. These allow the password to be obtained from a variety of sources. Both of these options take a single argument whose format is described below. If no password argument is given and a password is required then the user is prompted to enter one: this will typically be read from the current terminal with echoing turned off.

Note that character encoding may be relevant, please see passphrase-encoding(7).

"},{"location":"man1/openssl-passphrase-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-passphrase-options/#pass-phrase-option-arguments","title":"Pass Phrase Option Arguments","text":"

Pass phrase arguments can be formatted as follows.

  • pass:password

    The actual password is password. Since the password is visible to utilities (like 'ps' under Unix) this form should only be used where security is not important.

  • env:var

    Obtain the password from the environment variable var. Since the environment of other processes is visible on certain platforms (e.g. ps under certain Unix OSes) this option should be used with caution.

  • file:pathname

    The first line of pathname is the password. If the same pathname argument is supplied to -passin and -passout arguments then the first line will be used for the input password and the next line for the output password. pathname need not refer to a regular file: it could for example refer to a device or named pipe.

  • fd:number

    Read the password from the file descriptor number. This can be used to send the data via a pipe for example.

  • stdin

    Read the password from standard input.

"},{"location":"man1/openssl-passphrase-options/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-passwd/","title":"openssl-passwd","text":""},{"location":"man1/openssl-passwd/#name","title":"NAME","text":"

openssl-passwd - compute password hashes

"},{"location":"man1/openssl-passwd/#synopsis","title":"SYNOPSIS","text":"

openssl passwd [-help] [-1] [-apr1] [-aixmd5] [-5] [-6] [-salt string] [-in file] [-stdin] [-noverify] [-quiet] [-table] [-reverse] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [password]

"},{"location":"man1/openssl-passwd/#description","title":"DESCRIPTION","text":"

This command computes the hash of a password typed at run-time or the hash of each password in a list. The password list is taken from the named file for option -in, from stdin for option -stdin, or from the command line, or from the terminal otherwise.

"},{"location":"man1/openssl-passwd/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -1

    Use the MD5 based BSD password algorithm 1 (default).

  • -apr1

    Use the apr1 algorithm (Apache variant of the BSD algorithm).

  • -aixmd5

    Use the AIX MD5 algorithm (AIX variant of the BSD algorithm).

  • -5

  • -6

    Use the SHA256 / SHA512 based algorithms defined by Ulrich Drepper. See https://www.akkadia.org/drepper/SHA-crypt.txt.

  • -salt string

    Use the specified salt. When reading a password from the terminal, this implies -noverify.

  • -in file

    Read passwords from file.

  • -stdin

    Read passwords from stdin.

  • -noverify

    Don't verify when reading a password from the terminal.

  • -quiet

    Don't output warnings when passwords given at the command line are truncated.

  • -table

    In the output list, prepend the cleartext password and a TAB character to each password hash.

  • -reverse

    When the -table option is used, reverse the order of cleartext and hash.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-passwd/#examples","title":"EXAMPLES","text":"
% openssl passwd -1 -salt xxxxxxxx password\n$1$xxxxxxxx$UYCIxa628.9qXjpQCjM4a.\n\n% openssl passwd -apr1 -salt xxxxxxxx password\n$apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0\n\n% openssl passwd -aixmd5 -salt xxxxxxxx password\nxxxxxxxx$8Oaipk/GPKhC64w/YVeFD/\n
"},{"location":"man1/openssl-passwd/#history","title":"HISTORY","text":"

The -crypt option was removed in OpenSSL 3.0.

"},{"location":"man1/openssl-passwd/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-pkcs12/","title":"openssl-pkcs12","text":""},{"location":"man1/openssl-pkcs12/#name","title":"NAME","text":"

openssl-pkcs12 - PKCS#12 file command

"},{"location":"man1/openssl-pkcs12/#synopsis","title":"SYNOPSIS","text":"

openssl pkcs12 [-help] [-passin arg] [-passout arg] [-password arg] [-twopass] [-in filename|uri] [-out filename] [-nokeys] [-nocerts] [-noout] [-legacy] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-rand files] [-writerand file]

PKCS#12 input (parsing) options: [-info] [-nomacver] [-clcerts] [-cacerts]

[-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-noenc] [-nodes]

PKCS#12 output (export) options:

[-export] [-inkey filename|uri] [-certfile filename] [-passcerts arg] [-chain] [-untrusted filename] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-name name] [-caname name] [-CSP name] [-LMK] [-keyex] [-keysig] [-keypbe cipher] [-certpbe cipher] [-descert] [-macalg digest] [-iter count] [-noiter] [-nomaciter] [-maciter] [-nomac]

"},{"location":"man1/openssl-pkcs12/#description","title":"DESCRIPTION","text":"

This command allows PKCS#12 files (sometimes referred to as PFX files) to be created and parsed. PKCS#12 files are used by several programs including Netscape, MSIE and MS Outlook.

"},{"location":"man1/openssl-pkcs12/#options","title":"OPTIONS","text":"

There are a lot of options the meaning of some depends of whether a PKCS#12 file is being created or parsed. By default a PKCS#12 file is parsed. A PKCS#12 file can be created by using the -export option (see below). The PKCS#12 export encryption and MAC options such as -certpbe and -iter and many further options such as -chain are relevant only with -export. Conversely, the options regarding encryption of private keys when outputting PKCS#12 input are relevant only when the -export option is not given.

The default encryption algorithm is AES-256-CBC with PBKDF2 for key derivation.

When encountering problems loading legacy PKCS#12 files that involve, for example, RC2-40-CBC, try using the -legacy option and, if needed, the -provider-path option.

  • -help

    Print out a usage message.

  • -passin arg

    The password source for the input, and for encrypting any private keys that are output. For more information about the format of arg see openssl-passphrase-options(1).

  • -passout arg

    The password source for output files.

  • -password arg

    With -export, -password is equivalent to -passout, otherwise it is equivalent to -passin.

  • -twopass

    Prompt for separate integrity and encryption passwords: most software always assumes these are the same so this option will render such PKCS#12 files unreadable. Cannot be used in combination with the options -password, -passin if importing from PKCS#12, or -passout if exporting.

  • -nokeys

    No private keys will be output.

  • -nocerts

    No certificates will be output.

  • -noout

    This option inhibits all credentials output, and so the input is just verified.

  • -legacy

    Use legacy mode of operation and automatically load the legacy provider. If OpenSSL is not installed system-wide, it is necessary to also use, for example, -provider-path ./providers or to set the environment variable OPENSSL_MODULES to point to the directory where the providers can be found.

    In the legacy mode, the default algorithm for certificate encryption is RC2_CBC or 3DES_CBC depending on whether the RC2 cipher is enabled in the build. The default algorithm for private key encryption is 3DES_CBC. If the legacy option is not specified, then the legacy provider is not loaded and the default encryption algorithm for both certificates and private keys is AES_256_CBC with PBKDF2 for key derivation.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

"},{"location":"man1/openssl-pkcs12/#pkcs12-input-parsing-options","title":"PKCS#12 input (parsing) options","text":"
  • -in filename|uri

    This specifies the input filename or URI. Standard input is used by default. Without the -export option this must be PKCS#12 file to be parsed. For use with the -export option see the \"PKCS#12 output (export) options\" section.

  • -out filename

    The filename to write certificates and private keys to, standard output by default. They are all written in PEM format.

  • -info

    Output additional information about the PKCS#12 file structure, algorithms used and iteration counts.

  • -nomacver

    Don't attempt to verify the integrity MAC.

  • -clcerts

    Only output client certificates (not CA certificates).

  • -cacerts

    Only output CA certificates (not client certificates).

  • -aes128, -aes192, -aes256

    Use AES to encrypt private keys before outputting.

  • -aria128, -aria192, -aria256

    Use ARIA to encrypt private keys before outputting.

  • -camellia128, -camellia192, -camellia256

    Use Camellia to encrypt private keys before outputting.

  • -des

    Use DES to encrypt private keys before outputting.

  • -des3

    Use triple DES to encrypt private keys before outputting.

  • -idea

    Use IDEA to encrypt private keys before outputting.

  • -noenc

    Don't encrypt private keys at all.

  • -nodes

    This option is deprecated since OpenSSL 3.0; use -noenc instead.

"},{"location":"man1/openssl-pkcs12/#pkcs12-output-export-options","title":"PKCS#12 output (export) options","text":"
  • -export

    This option specifies that a PKCS#12 file will be created rather than parsed.

  • -out filename

    This specifies filename to write the PKCS#12 file to. Standard output is used by default.

  • -in filename|uri

    This specifies the input filename or URI. Standard input is used by default. With the -export option this is a file with certificates and a key, or a URI that refers to a key accessed via an engine. The order of credentials in a file doesn't matter but one private key and its corresponding certificate should be present. If additional certificates are present they will also be included in the PKCS#12 output file.

  • -inkey filename|uri

    The private key input for PKCS12 output. If this option is not specified then the input file (-in argument) must contain a private key. If no engine is used, the argument is taken as a file. If the -engine option is used or the URI has prefix org.openssl.engine: then the rest of the URI is taken as key identifier for the given engine.

  • -certfile filename

    An input file with extra certificates to be added to the PKCS#12 output if the -export option is given.

  • -passcerts arg

    The password source for certificate input such as -certfile and -untrusted. For more information about the format of arg see openssl-passphrase-options(1).

  • -chain

    If this option is present then the certificate chain of the end entity certificate is built and included in the PKCS#12 output file. The end entity certificate is the first one read from the -in file if no key is given, else the first certificate matching the given key. The standard CA trust store is used for chain building, as well as any untrusted CA certificates given with the -untrusted option.

  • -untrusted filename

    An input file of untrusted certificates that may be used for chain building, which is relevant only when a PKCS#12 file is created with the -export option and the -chain option is given as well. Any certificates that are actually part of the chain are added to the output.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -name friendlyname

    This specifies the \"friendly name\" for the certificates and private key. This name is typically displayed in list boxes by software importing the file.

  • -caname friendlyname

    This specifies the \"friendly name\" for other certificates. This option may be used multiple times to specify names for all certificates in the order they appear. Netscape ignores friendly names on other certificates whereas MSIE displays them.

  • -CSP name

    Write name as a Microsoft CSP name. The password source for the input, and for encrypting any private keys that are output. For more information about the format of arg see openssl-passphrase-options(1).

  • -LMK

    Add the \"Local Key Set\" identifier to the attributes.

  • -keyex|-keysig

    Specifies that the private key is to be used for key exchange or just signing. This option is only interpreted by MSIE and similar MS software. Normally \"export grade\" software will only allow 512 bit RSA keys to be used for encryption purposes but arbitrary length keys for signing. The -keysig option marks the key for signing only. Signing only keys can be used for S/MIME signing, authenticode (ActiveX control signing) and SSL client authentication, however, due to a bug only MSIE 5.0 and later support the use of signing only keys for SSL client authentication.

  • -keypbe alg, -certpbe alg

    These options allow the algorithm used to encrypt the private key and certificates to be selected. Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used (see \"NOTES\" section for more information). If a cipher name (as output by openssl list -cipher-algorithms) is specified then it is used with PKCS#5 v2.0. For interoperability reasons it is advisable to only use PKCS#12 algorithms.

    Special value NONE disables encryption of the private key and certificates.

  • -descert

    Encrypt the certificates using triple DES. By default the private key and the certificates are encrypted using AES-256-CBC unless the '-legacy' option is used. If '-descert' is used with the '-legacy' then both, the private key and the certificates are encrypted using triple DES.

  • -macalg digest

    Specify the MAC digest algorithm. If not included SHA256 will be used.

  • -iter count

    This option specifies the iteration count for the encryption key and MAC. The default value is 2048.

    To discourage attacks by using large dictionaries of common passwords the algorithm that derives keys from passwords can have an iteration count applied to it: this causes a certain part of the algorithm to be repeated and slows it down. The MAC is used to check the file integrity but since it will normally have the same password as the keys and certificates it could also be attacked.

  • -noiter, -nomaciter

    By default both encryption and MAC iteration counts are set to 2048, using these options the MAC and encryption iteration counts can be set to 1, since this reduces the file security you should not use these options unless you really have to. Most software supports both MAC and encryption iteration counts. MSIE 4.0 doesn't support MAC iteration counts so it needs the -nomaciter option.

  • -maciter

    This option is included for compatibility with previous versions, it used to be needed to use MAC iterations counts but they are now used by default.

  • -nomac

    Do not attempt to provide the MAC integrity. This can be useful with the FIPS provider as the PKCS12 MAC requires PKCS12KDF which is not an approved FIPS algorithm and cannot be supported by the FIPS provider.

"},{"location":"man1/openssl-pkcs12/#notes","title":"NOTES","text":"

Although there are a large number of options most of them are very rarely used. For PKCS#12 file parsing only -in and -out need to be used for PKCS#12 file creation -export and -name are also used.

If none of the -clcerts, -cacerts or -nocerts options are present then all certificates will be output in the order they appear in the input PKCS#12 files. There is no guarantee that the first certificate present is the one corresponding to the private key. Certain software which tries to get a private key and the corresponding certificate might assume that the first certificate in the file is the one corresponding to the private key, but that may not always be the case. Using the -clcerts option will solve this problem by only outputting the certificate corresponding to the private key. If the CA certificates are required then they can be output to a separate file using the -nokeys -cacerts options to just output CA certificates.

The -keypbe and -certpbe algorithms allow the precise encryption algorithms for private keys and certificates to be specified. Normally the defaults are fine but occasionally software can't handle triple DES encrypted private keys, then the option -keypbe PBE-SHA1-RC2-40 can be used to reduce the private key encryption to 40 bit RC2. A complete description of all algorithms is contained in openssl-pkcs8(1).

Prior 1.1 release passwords containing non-ASCII characters were encoded in non-compliant manner, which limited interoperability, in first hand with Windows. But switching to standard-compliant password encoding poses problem accessing old data protected with broken encoding. For this reason even legacy encodings is attempted when reading the data. If you use PKCS#12 files in production application you are advised to convert the data, because implemented heuristic approach is not MT-safe, its sole goal is to facilitate the data upgrade with this command.

"},{"location":"man1/openssl-pkcs12/#examples","title":"EXAMPLES","text":"

Parse a PKCS#12 file and output it to a PEM file:

openssl pkcs12 -in file.p12 -out file.pem\n

Output only client certificates to a file:

openssl pkcs12 -in file.p12 -clcerts -out file.pem\n

Don't encrypt the private key:

openssl pkcs12 -in file.p12 -out file.pem -noenc\n

Print some info about a PKCS#12 file:

openssl pkcs12 -in file.p12 -info -noout\n

Print some info about a PKCS#12 file in legacy mode:

openssl pkcs12 -in file.p12 -info -noout -legacy\n

Create a PKCS#12 file from a PEM file that may contain a key and certificates:

openssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\"\n

Include some extra certificates:

openssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\" \\\n -certfile othercerts.pem\n

Export a PKCS#12 file with data from a certificate PEM file and from a further PEM file containing a key, with default algorithms as in the legacy provider:

openssl pkcs12 -export -in cert.pem -inkey key.pem -out file.p12 -legacy\n
"},{"location":"man1/openssl-pkcs12/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkcs8(1), ossl_store-file(7)

"},{"location":"man1/openssl-pkcs12/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0. The -nodes option was deprecated in OpenSSL 3.0, too; use -noenc instead.

"},{"location":"man1/openssl-pkcs12/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-pkcs7/","title":"openssl-pkcs7","text":""},{"location":"man1/openssl-pkcs7/#name","title":"NAME","text":"

openssl-pkcs7 - PKCS#7 command

"},{"location":"man1/openssl-pkcs7/#synopsis","title":"SYNOPSIS","text":"

openssl pkcs7 [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-print] [-print_certs] [-text] [-noout] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-pkcs7/#description","title":"DESCRIPTION","text":"

This command processes PKCS#7 files. Note that it only understands PKCS#7 v 1.5 as specified in IETF RFC 2315. It cannot currently parse CMS as described in IETF RFC 2630.

"},{"location":"man1/openssl-pkcs7/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM, -outform DER|PEM

    The input and formats; the default is PEM. See openssl-format-options(1) for details.

    The data is a PKCS#7 Version 1.5 structure.

  • -in filename

    This specifies the input filename to read from or standard input if this option is not specified.

  • -out filename

    Specifies the output filename to write to or standard output by default.

  • -print

    Print out the full PKCS7 object.

  • -print_certs

    Prints out any certificates or CRLs contained in the file. They are preceded by their subject and issuer names in one line format.

  • -text

    Prints out certificate details in full rather than just subject and issuer names.

  • -noout

    Don't output the encoded version of the PKCS#7 structure (or certificates if -print_certs is set).

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-pkcs7/#examples","title":"EXAMPLES","text":"

Convert a PKCS#7 file from PEM to DER:

openssl pkcs7 -in file.pem -outform DER -out file.der\n

Output all certificates in a file:

openssl pkcs7 -in file.pem -print_certs -out certs.pem\n
"},{"location":"man1/openssl-pkcs7/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-crl2pkcs7(1)

"},{"location":"man1/openssl-pkcs7/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-pkcs7/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-pkcs8/","title":"openssl-pkcs8","text":""},{"location":"man1/openssl-pkcs8/#name","title":"NAME","text":"

openssl-pkcs8 - PKCS#8 format private key conversion command

"},{"location":"man1/openssl-pkcs8/#synopsis","title":"SYNOPSIS","text":"

openssl pkcs8 [-help] [-topk8] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-passin arg] [-out filename] [-passout arg] [-iter count] [-noiter] [-nocrypt] [-traditional] [-v2 alg] [-v2prf alg] [-v1 alg] [-scrypt] [-scrypt_N N] [-scrypt_r r] [-scrypt_p p] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-pkcs8/#description","title":"DESCRIPTION","text":"

This command processes private keys in PKCS#8 format. It can handle both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo format with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.

"},{"location":"man1/openssl-pkcs8/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -topk8

    Normally a PKCS#8 private key is expected on input and a private key will be written to the output file. With the -topk8 option the situation is reversed: it reads a private key and writes a PKCS#8 format key.

  • -inform DER|PEM, -outform DER|PEM

    The input and formats; the default is PEM. See openssl-format-options(1) for details.

    If a key is being converted from PKCS#8 form (i.e. the -topk8 option is not used) then the input file must be in PKCS#8 format. An encrypted key is expected unless -nocrypt is included.

    If -topk8 is not used and PEM mode is set the output file will be an unencrypted private key in PKCS#8 format. If the -traditional option is used then a traditional format private key is written instead.

    If -topk8 is not used and DER mode is set the output file will be an unencrypted private key in traditional DER format.

    If -topk8 is used then any supported private key can be used for the input file in a format specified by -inform. The output file will be encrypted PKCS#8 format using the specified encryption parameters unless -nocrypt is included.

  • -traditional

    When this option is present and -topk8 is not a traditional format private key is written.

  • -in filename

    This specifies the input filename to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

  • -passin arg, -passout arg

    The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

  • -out filename

    This specifies the output filename to write a key to or standard output by default. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

  • -iter count

    When creating new PKCS#8 containers, use a given number of iterations on the password in deriving the encryption key for the PKCS#8 output. High values increase the time required to brute-force a PKCS#8 container.

  • -noiter

    When creating new PKCS#8 containers, use 1 as iteration count.

  • -nocrypt

    PKCS#8 keys generated or input are normally PKCS#8 EncryptedPrivateKeyInfo structures using an appropriate password based encryption algorithm. With this option an unencrypted PrivateKeyInfo structure is expected or output. This option does not encrypt private keys at all and should only be used when absolutely necessary. Certain software such as some versions of Java code signing software used unencrypted private keys.

  • -v2 alg

    This option sets the PKCS#5 v2.0 algorithm.

    The alg argument is the encryption algorithm to use, valid values include aes128, aes256 and des3. If this option isn't specified then aes256 is used.

  • -v2prf alg

    This option sets the PRF algorithm to use with PKCS#5 v2.0. A typical value value would be hmacWithSHA256. If this option isn't set then the default for the cipher is used or hmacWithSHA256 if there is no default.

    Some implementations may not support custom PRF algorithms and may require the hmacWithSHA1 option to work.

  • -v1 alg

    This option indicates a PKCS#5 v1.5 or PKCS#12 algorithm should be used. Some older implementations may not support PKCS#5 v2.0 and may require this option. If not specified PKCS#5 v2.0 form is used.

  • -scrypt

    Uses the scrypt algorithm for private key encryption using default parameters: currently N=16384, r=8 and p=1 and AES in CBC mode with a 256 bit key. These parameters can be modified using the -scrypt_N, -scrypt_r, -scrypt_p and -v2 options.

  • -scrypt_N N, -scrypt_r r, -scrypt_p p

    Sets the scrypt N, r or p parameters.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-pkcs8/#notes","title":"NOTES","text":"

By default, when converting a key to PKCS#8 format, PKCS#5 v2.0 using 256 bit AES with HMAC and SHA256 is used.

Some older implementations do not support PKCS#5 v2.0 format and require the older PKCS#5 v1.5 form instead, possibly also requiring insecure weak encryption algorithms such as 56 bit DES.

Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts are more secure that those encrypted using the traditional SSLeay compatible formats. So if additional security is considered important the keys should be converted.

It is possible to write out DER encoded encrypted private keys in PKCS#8 format because the encryption details are included at an ASN1 level whereas the traditional format includes them at a PEM level.

"},{"location":"man1/openssl-pkcs8/#pkcs5-v15-and-pkcs12-algorithms","title":"PKCS#5 V1.5 AND PKCS#12 ALGORITHMS","text":"

Various algorithms can be used with the -v1 command line option, including PKCS#5 v1.5 and PKCS#12. These are described in more detail below.

  • PBE-MD2-DES PBE-MD5-DES

    These algorithms were included in the original PKCS#5 v1.5 specification. They only offer 56 bits of protection since they both use DES.

  • PBE-SHA1-RC2-64, PBE-MD2-RC2-64, PBE-MD5-RC2-64, PBE-SHA1-DES

    These algorithms are not mentioned in the original PKCS#5 v1.5 specification but they use the same key derivation algorithm and are supported by some software. They are mentioned in PKCS#5 v2.0. They use either 64 bit RC2 or 56 bit DES.

  • PBE-SHA1-RC4-128, PBE-SHA1-RC4-40, PBE-SHA1-3DES, PBE-SHA1-2DES, PBE-SHA1-RC2-128, PBE-SHA1-RC2-40

    These algorithms use the PKCS#12 password based encryption algorithm and allow strong encryption algorithms like triple DES or 128 bit RC2 to be used.

"},{"location":"man1/openssl-pkcs8/#examples","title":"EXAMPLES","text":"

Convert a private key to PKCS#8 format using default parameters (AES with 256 bit key and hmacWithSHA256):

openssl pkcs8 -in key.pem -topk8 -out enckey.pem\n

Convert a private key to PKCS#8 unencrypted format:

openssl pkcs8 -in key.pem -topk8 -nocrypt -out enckey.pem\n

Convert a private key to PKCS#5 v2.0 format using triple DES:

openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem\n

Convert a private key to PKCS#5 v2.0 format using AES with 256 bits in CBC mode and hmacWithSHA512 PRF:

openssl pkcs8 -in key.pem -topk8 -v2 aes-256-cbc -v2prf hmacWithSHA512 -out enckey.pem\n

Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm (DES):

openssl pkcs8 -in key.pem -topk8 -v1 PBE-MD5-DES -out enckey.pem\n

Convert a private key to PKCS#8 using a PKCS#12 compatible algorithm (3DES):

openssl pkcs8 -in key.pem -topk8 -out enckey.pem -v1 PBE-SHA1-3DES\n

Read a DER unencrypted PKCS#8 format private key:

openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem\n

Convert a private key from any PKCS#8 encrypted format to traditional format:

openssl pkcs8 -in pk8.pem -traditional -out key.pem\n

Convert a private key to PKCS#8 format, encrypting with AES-256 and with one million iterations of the password:

openssl pkcs8 -in key.pem -topk8 -v2 aes-256-cbc -iter 1000000 -out pk8.pem\n
"},{"location":"man1/openssl-pkcs8/#standards","title":"STANDARDS","text":"

Test vectors from this PKCS#5 v2.0 implementation were posted to the pkcs-tng mailing list using triple DES, DES and RC2 with high iteration counts, several people confirmed that they could decrypt the private keys produced and therefore, it can be assumed that the PKCS#5 v2.0 implementation is reasonably accurate at least as far as these algorithms are concerned.

The format of PKCS#8 DSA (and other) private keys is not well documented: it is hidden away in PKCS#11 v2.01, section 11.9. OpenSSL's default DSA PKCS#8 private key format complies with this standard.

"},{"location":"man1/openssl-pkcs8/#bugs","title":"BUGS","text":"

There should be an option that prints out the encryption algorithm in use and other details such as the iteration count.

"},{"location":"man1/openssl-pkcs8/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-dsa(1), openssl-rsa(1), openssl-genrsa(1), openssl-gendsa(1)

"},{"location":"man1/openssl-pkcs8/#history","title":"HISTORY","text":"

The -iter option was added in OpenSSL 1.1.0.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-pkcs8/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-pkey/","title":"openssl-pkey","text":""},{"location":"man1/openssl-pkey/#name","title":"NAME","text":"

openssl-pkey - public or private key processing command

"},{"location":"man1/openssl-pkey/#synopsis","title":"SYNOPSIS","text":"

openssl pkey [-help] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-check] [-pubcheck] [-in filename|uri] [-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin] [-out filename] [-outform DER|PEM] [-cipher] [-passout arg] [-traditional] [-pubout] [-noout] [-text] [-text_pub] [-ec_conv_form arg] [-ec_param_enc arg]

"},{"location":"man1/openssl-pkey/#description","title":"DESCRIPTION","text":"

This command processes public or private keys. They can be converted between various forms and their components printed.

"},{"location":"man1/openssl-pkey/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-pkey/#general-options","title":"General options","text":"
  • -help

    Print out a usage message.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -check

    This option checks the consistency of a key pair for both public and private components.

  • -pubcheck

    This option checks the correctness of either a public key or the public component of a key pair.

"},{"location":"man1/openssl-pkey/#input-options","title":"Input options","text":"
  • -in filename|uri

    This specifies the input to read a key from or standard input if this option is not specified. If the key input is encrypted and -passin is not given a pass phrase will be prompted for.

  • -inform DER|PEM|P12|ENGINE

    The key input format; unspecified by default. See openssl-format-options(1) for details.

  • -passin arg

    The password source for the key input.

    For more information about the format of arg see openssl-passphrase-options(1).

  • -pubin

    By default a private key is read from the input. With this option only the public components are read.

"},{"location":"man1/openssl-pkey/#output-options","title":"Output options","text":"
  • -out filename

    This specifies the output filename to save the encoded and/or text output of key or standard output if this option is not specified. If any cipher option is set but no -passout is given then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

  • -outform DER|PEM

    The key output format; the default is PEM. See openssl-format-options(1) for details.

  • -cipher

    Encrypt the PEM encoded private key with the supplied cipher. Any algorithm name accepted by EVP_get_cipherbyname() is acceptable such as aes128. Encryption is not supported for DER output.

  • -passout arg

    The password source for the output file.

    For more information about the format of arg see openssl-passphrase-options(1).

  • -traditional

    Normally a private key is written using standard format: this is PKCS#8 form with the appropriate encryption algorithm (if any). If the -traditional option is specified then the older \"traditional\" format is used instead.

  • -pubout

    By default the private and public key is output; this option restricts the output to the public components. This option is automatically set if the input is a public key.

    When combined with -text, this is equivalent to -text_pub.

  • -noout

    Do not output the key in encoded form.

  • -text

    Output the various key components in plain text (possibly in addition to the PEM encoded form). This cannot be combined with encoded output in DER format.

  • -text_pub

    Output in text form only the public key components (also for private keys). This cannot be combined with encoded output in DER format.

  • -ec_conv_form arg

    This option only applies to elliptic-curve based keys.

    This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: compressed (the default value), uncompressed and hybrid. For more information regarding the point conversion forms please read the X9.62 standard. Note Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at compile time.

  • -ec_param_enc arg

    This option only applies to elliptic curve based public and private keys.

    This specifies how the elliptic curve parameters are encoded. Possible value are: named_curve, i.e. the ec parameters are specified by an OID, or explicit where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is named_curve. Note the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL.

"},{"location":"man1/openssl-pkey/#examples","title":"EXAMPLES","text":"

To remove the pass phrase on a private key:

openssl pkey -in key.pem -out keyout.pem\n

To encrypt a private key using triple DES:

openssl pkey -in key.pem -des3 -out keyout.pem\n

To convert a private key from PEM to DER format:

openssl pkey -in key.pem -outform DER -out keyout.der\n

To print out the components of a private key to standard output:

openssl pkey -in key.pem -text -noout\n

To print out the public components of a private key to standard output:

openssl pkey -in key.pem -text_pub -noout\n

To just output the public part of a private key:

openssl pkey -in key.pem -pubout -out pubkey.pem\n

To change the EC parameters encoding to explicit:

openssl pkey -in key.pem -ec_param_enc explicit -out keyout.pem\n

To change the EC point conversion form to compressed:

openssl pkey -in key.pem -ec_conv_form compressed -out keyout.pem\n
"},{"location":"man1/openssl-pkey/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-genpkey(1), openssl-rsa(1), openssl-pkcs8(1), openssl-dsa(1), openssl-genrsa(1), openssl-gendsa(1)

"},{"location":"man1/openssl-pkey/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-pkey/#copyright","title":"COPYRIGHT","text":"

Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-pkeyparam/","title":"openssl-pkeyparam","text":""},{"location":"man1/openssl-pkeyparam/#name","title":"NAME","text":"

openssl-pkeyparam - public key algorithm parameter processing command

"},{"location":"man1/openssl-pkeyparam/#synopsis","title":"SYNOPSIS","text":"

openssl pkeyparam [-help] [-in filename] [-out filename] [-text] [-noout] [-check] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-pkeyparam/#description","title":"DESCRIPTION","text":"

This command processes public key algorithm parameters. They can be checked for correctness and their components printed out.

"},{"location":"man1/openssl-pkeyparam/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -in filename

    This specifies the input filename to read parameters from or standard input if this option is not specified.

  • -out filename

    This specifies the output filename to write parameters to or standard output if this option is not specified.

  • -text

    Prints out the parameters in plain text in addition to the encoded version.

  • -noout

    Do not output the encoded version of the parameters.

  • -check

    This option checks the correctness of parameters.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-pkeyparam/#examples","title":"EXAMPLES","text":"

Print out text version of parameters:

openssl pkeyparam -in param.pem -text\n
"},{"location":"man1/openssl-pkeyparam/#notes","title":"NOTES","text":"

There are no -inform or -outform options for this command because only PEM format is supported because the key type is determined by the PEM headers.

"},{"location":"man1/openssl-pkeyparam/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-genpkey(1), openssl-rsa(1), openssl-pkcs8(1), openssl-dsa(1), openssl-genrsa(1), openssl-gendsa(1)

"},{"location":"man1/openssl-pkeyparam/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-pkeyparam/#copyright","title":"COPYRIGHT","text":"

Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-pkeyutl/","title":"openssl-pkeyutl","text":""},{"location":"man1/openssl-pkeyutl/#name","title":"NAME","text":"

openssl-pkeyutl - public key algorithm command

"},{"location":"man1/openssl-pkeyutl/#synopsis","title":"SYNOPSIS","text":"

openssl pkeyutl [-help] [-in file] [-rawin] [-digest algorithm] [-out file] [-sigfile file] [-inkey filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-peerkey file] [-peerform DER|PEM|P12|ENGINE] [-pubin] [-certin] [-rev] [-sign] [-verify] [-verifyrecover] [-encrypt] [-decrypt] [-derive] [-kdf algorithm] [-kdflen length] [-pkeyopt opt:value] [-pkeyopt_passin opt[:passarg]] [-hexdump] [-asn1parse] [-engine id] [-engine_impl] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [-config configfile]

"},{"location":"man1/openssl-pkeyutl/#description","title":"DESCRIPTION","text":"

This command can be used to perform low-level public key operations using any supported algorithm.

"},{"location":"man1/openssl-pkeyutl/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -in filename

    This specifies the input filename to read data from or standard input if this option is not specified.

  • -rawin

    This indicates that the input data is raw data, which is not hashed by any message digest algorithm. The user can specify a digest algorithm by using the -digest option. This option can only be used with -sign and -verify and must be used with the Ed25519 and Ed448 algorithms.

  • -digest algorithm

    This specifies the digest algorithm which is used to hash the input data before signing or verifying it with the input key. This option could be omitted if the signature algorithm does not require one (for instance, EdDSA). If this option is omitted but the signature algorithm requires one, a default value will be used. For signature algorithms like RSA, DSA and ECDSA, SHA-256 will be the default digest algorithm. For SM2, it will be SM3. If this option is present, then the -rawin option must be also specified.

  • -out filename

    Specifies the output filename to write to or standard output by default.

  • -sigfile file

    Signature file, required for -verify operations only

  • -inkey filename|uri

    The input key, by default it should be a private key.

  • -keyform DER|PEM|P12|ENGINE

    The key format; unspecified by default. See openssl-format-options(1) for details.

  • -passin arg

    The input key password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -peerkey file

    The peer key file, used by key derivation (agreement) operations.

  • -peerform DER|PEM|P12|ENGINE

    The peer key format; unspecified by default. See openssl-format-options(1) for details.

  • -pubin

    The input file is a public key.

  • -certin

    The input is a certificate containing a public key.

  • -rev

    Reverse the order of the input buffer. This is useful for some libraries (such as CryptoAPI) which represent the buffer in little endian format.

  • -sign

    Sign the input data (which must be a hash) and output the signed result. This requires a private key.

  • -verify

    Verify the input data (which must be a hash) against the signature file and indicate if the verification succeeded or failed.

  • -verifyrecover

    Verify the input data (which must be a hash) and output the recovered data.

  • -encrypt

    Encrypt the input data using a public key.

  • -decrypt

    Decrypt the input data using a private key.

  • -derive

    Derive a shared secret using the peer key.

  • -kdf algorithm

    Use key derivation function algorithm. The supported algorithms are at present TLS1-PRF and HKDF. Note: additional parameters and the KDF output length will normally have to be set for this to work. See EVP_PKEY_CTX_set_hkdf_md(3) and EVP_PKEY_CTX_set_tls1_prf_md(3) for the supported string parameters of each algorithm.

  • -kdflen length

    Set the output length for KDF.

  • -pkeyopt opt:value

    Public key options specified as opt:value. See NOTES below for more details.

  • -pkeyopt_passin opt[:passarg]

    Allows reading a public key option opt from stdin or a password source. If only opt is specified, the user will be prompted to enter a password on stdin. Alternatively, passarg can be specified which can be any value supported by openssl-passphrase-options(1).

  • -hexdump

    hex dump the output data.

  • -asn1parse

    Parse the ASN.1 output data, this is useful when combined with the -verifyrecover option when an ASN1 structure is signed.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -engine_impl

    When used with the -engine option, it specifies to also use engine id for crypto operations.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -config configfile

    See \"Configuration Option\" in openssl(1).

"},{"location":"man1/openssl-pkeyutl/#notes","title":"NOTES","text":"

The operations and options supported vary according to the key algorithm and its implementation. The OpenSSL operations and options are indicated below.

Unless otherwise mentioned all algorithms support the digest:alg option which specifies the digest in use for sign, verify and verifyrecover operations. The value alg should represent a digest name as used in the EVP_get_digestbyname() function for example sha1. This value is not used to hash the input data. It is used (by some algorithms) for sanity-checking the lengths of data passed in and for creating the structures that make up the signature (e.g. DigestInfo in RSASSA PKCS#1 v1.5 signatures).

This command does not hash the input data (except where -rawin is used) but rather it will use the data directly as input to the signature algorithm. Depending on the key type, signature type, and mode of padding, the maximum acceptable lengths of input data differ. The signed data can't be longer than the key modulus with RSA. In case of ECDSA and DSA the data shouldn't be longer than the field size, otherwise it will be silently truncated to the field size. In any event the input size must not be larger than the largest supported digest size.

In other words, if the value of digest is sha1 the input should be the 20 bytes long binary encoding of the SHA-1 hash function output.

"},{"location":"man1/openssl-pkeyutl/#rsa-algorithm","title":"RSA ALGORITHM","text":"

The RSA algorithm generally supports the encrypt, decrypt, sign, verify and verifyrecover operations. However, some padding modes support only a subset of these operations. The following additional pkeyopt values are supported:

  • rsa_padding_mode:mode

    This sets the RSA padding mode. Acceptable values for mode are pkcs1 for PKCS#1 padding, none for no padding, oaep for OAEP mode, x931 for X9.31 mode and pss for PSS.

    In PKCS#1 padding, if the message digest is not set, then the supplied data is signed or verified directly instead of using a DigestInfo structure. If a digest is set, then the DigestInfo structure is used and its length must correspond to the digest type.

    For oaep mode only encryption and decryption is supported.

    For x931 if the digest type is set it is used to format the block data otherwise the first byte is used to specify the X9.31 digest ID. Sign, verify and verifyrecover are can be performed in this mode.

    For pss mode only sign and verify are supported and the digest type must be specified.

  • rsa_pss_saltlen:len

    For pss mode only this option specifies the salt length. Three special values are supported: digest sets the salt length to the digest length, max sets the salt length to the maximum permissible value. When verifying auto causes the salt length to be automatically determined based on the PSS block structure.

  • rsa_mgf1_md:digest

    For PSS and OAEP padding sets the MGF1 digest. If the MGF1 digest is not explicitly set in PSS mode then the signing digest is used.

  • rsa_oaep_md:digest

    Sets the digest used for the OAEP hash function. If not explicitly set then SHA1 is used.

"},{"location":"man1/openssl-pkeyutl/#rsa-pss-algorithm","title":"RSA-PSS ALGORITHM","text":"

The RSA-PSS algorithm is a restricted version of the RSA algorithm which only supports the sign and verify operations with PSS padding. The following additional -pkeyopt values are supported:

  • rsa_padding_mode:mode, rsa_pss_saltlen:len, rsa_mgf1_md:digest

    These have the same meaning as the RSA algorithm with some additional restrictions. The padding mode can only be set to pss which is the default value.

    If the key has parameter restrictions than the digest, MGF1 digest and salt length are set to the values specified in the parameters. The digest and MG cannot be changed and the salt length cannot be set to a value less than the minimum restriction.

"},{"location":"man1/openssl-pkeyutl/#dsa-algorithm","title":"DSA ALGORITHM","text":"

The DSA algorithm supports signing and verification operations only. Currently there are no additional -pkeyopt options other than digest. The SHA1 digest is assumed by default.

"},{"location":"man1/openssl-pkeyutl/#dh-algorithm","title":"DH ALGORITHM","text":"

The DH algorithm only supports the derivation operation and no additional -pkeyopt options.

"},{"location":"man1/openssl-pkeyutl/#ec-algorithm","title":"EC ALGORITHM","text":"

The EC algorithm supports sign, verify and derive operations. The sign and verify operations use ECDSA and derive uses ECDH. SHA1 is assumed by default for the -pkeyopt digest option.

"},{"location":"man1/openssl-pkeyutl/#x25519-and-x448-algorithms","title":"X25519 AND X448 ALGORITHMS","text":"

The X25519 and X448 algorithms support key derivation only. Currently there are no additional options.

"},{"location":"man1/openssl-pkeyutl/#ed25519-and-ed448-algorithms","title":"ED25519 AND ED448 ALGORITHMS","text":"

These algorithms only support signing and verifying. OpenSSL only implements the \"pure\" variants of these algorithms so raw data can be passed directly to them without hashing them first. The option -rawin must be used with these algorithms with no -digest specified. Additionally OpenSSL only supports \"oneshot\" operation with these algorithms. This means that the entire file to be signed/verified must be read into memory before processing it. Signing or Verifying very large files should be avoided. Additionally the size of the file must be known for this to work. If the size of the file cannot be determined (for example if the input is stdin) then the sign or verify operation will fail.

"},{"location":"man1/openssl-pkeyutl/#sm2","title":"SM2","text":"

The SM2 algorithm supports sign, verify, encrypt and decrypt operations. For the sign and verify operations, SM2 requires an Distinguishing ID string to be passed in. The following -pkeyopt value is supported:

  • distid:string

    This sets the ID string used in SM2 sign or verify operations. While verifying an SM2 signature, the ID string must be the same one used when signing the data. Otherwise the verification will fail.

  • hexdistid:hex_string

    This sets the ID string used in SM2 sign or verify operations. While verifying an SM2 signature, the ID string must be the same one used when signing the data. Otherwise the verification will fail. The ID string provided with this option should be a valid hexadecimal value.

"},{"location":"man1/openssl-pkeyutl/#examples","title":"EXAMPLES","text":"

Sign some data using a private key:

openssl pkeyutl -sign -in file -inkey key.pem -out sig\n

Recover the signed data (e.g. if an RSA key is used):

openssl pkeyutl -verifyrecover -in sig -inkey key.pem\n

Verify the signature (e.g. a DSA key):

openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem\n

Sign data using a message digest value (this is currently only valid for RSA):

openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256\n

Derive a shared secret value:

openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret\n

Hexdump 48 bytes of TLS1 PRF using digest SHA256 and shared secret and seed consisting of the single byte 0xFF:

openssl pkeyutl -kdf TLS1-PRF -kdflen 48 -pkeyopt md:SHA256 \\\n   -pkeyopt hexsecret:ff -pkeyopt hexseed:ff -hexdump\n

Derive a key using scrypt where the password is read from command line:

openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyopt_passin pass \\\n   -pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1\n

Derive using the same algorithm, but read key from environment variable MYPASS:

openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyopt_passin pass:env:MYPASS \\\n   -pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1\n

Sign some data using an SM2(7) private key and a specific ID:

openssl pkeyutl -sign -in file -inkey sm2.key -out sig -rawin -digest sm3 \\\n   -pkeyopt distid:someid\n

Verify some data using an SM2(7) certificate and a specific ID:

openssl pkeyutl -verify -certin -in file -inkey sm2.cert -sigfile sig \\\n   -rawin -digest sm3 -pkeyopt distid:someid\n

Decrypt some data using a private key with OAEP padding using SHA256:

openssl pkeyutl -decrypt -in file -inkey key.pem -out secret \\\n   -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256\n
"},{"location":"man1/openssl-pkeyutl/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-genpkey(1), openssl-pkey(1), openssl-rsautl(1) openssl-dgst(1), openssl-rsa(1), openssl-genrsa(1), openssl-kdf(1) EVP_PKEY_CTX_set_hkdf_md(3), EVP_PKEY_CTX_set_tls1_prf_md(3),

"},{"location":"man1/openssl-pkeyutl/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-pkeyutl/#copyright","title":"COPYRIGHT","text":"

Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-prime/","title":"openssl-prime","text":""},{"location":"man1/openssl-prime/#name","title":"NAME","text":"

openssl-prime - compute prime numbers

"},{"location":"man1/openssl-prime/#synopsis","title":"SYNOPSIS","text":"

openssl prime [-help] [-hex] [-generate] [-bits num] [-safe] [-provider name] [-provider-path path] [-propquery propq] [-checks num] [number ...]

"},{"location":"man1/openssl-prime/#description","title":"DESCRIPTION","text":"

This command checks if the specified numbers are prime.

If no numbers are given on the command line, the -generate flag should be used to generate primes according to the requirements specified by the rest of the flags.

"},{"location":"man1/openssl-prime/#options","title":"OPTIONS","text":"
  • -help

    Display an option summary.

  • -hex

    Generate hex output.

  • -generate

    Generate a prime number.

  • -bits num

    Generate a prime with num bits.

  • -safe

    When used with -generate, generates a \"safe\" prime. If the number generated is n, then check that (_n_-1)/2 is also prime.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -checks num

    This parameter is ignored.

"},{"location":"man1/openssl-prime/#copyright","title":"COPYRIGHT","text":"

Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-rand/","title":"openssl-rand","text":""},{"location":"man1/openssl-rand/#name","title":"NAME","text":"

openssl-rand - generate pseudo-random bytes

"},{"location":"man1/openssl-rand/#synopsis","title":"SYNOPSIS","text":"

openssl rand [-help] [-out file] [-base64] [-hex] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] num

"},{"location":"man1/openssl-rand/#description","title":"DESCRIPTION","text":"

This command generates num random bytes using a cryptographically secure pseudo random number generator (CSPRNG).

The random bytes are generated using the RAND_bytes(3) function, which provides a security level of 256 bits, provided it managed to seed itself successfully from a trusted operating system entropy source. Otherwise, the command will fail with a nonzero error code. For more details, see RAND_bytes(3), RAND(7), and EVP_RAND(7).

"},{"location":"man1/openssl-rand/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -out file

    Write to file instead of standard output.

  • -base64

    Perform base64 encoding on the output.

  • -hex

    Show the output as a hex string.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-rand/#see-also","title":"SEE ALSO","text":"

openssl(1), RAND_bytes(3), RAND(7), EVP_RAND(7)

"},{"location":"man1/openssl-rand/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-rand/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-rehash/","title":"openssl-rehash","text":""},{"location":"man1/openssl-rehash/#name","title":"NAME","text":"

openssl-rehash, c_rehash - Create symbolic links to files named by the hash values

"},{"location":"man1/openssl-rehash/#synopsis","title":"SYNOPSIS","text":"

openssl rehash [-h] [-help] [-old] [-compat] [-n] [-v] [-provider name] [-provider-path path] [-propquery propq] [directory] ...

c_rehash [-h] [-help] [-old] [-n] [-v] [-provider name] [-provider-path path] [-propquery propq] [directory] ...

"},{"location":"man1/openssl-rehash/#description","title":"DESCRIPTION","text":"

This command is generally equivalent to the external script c_rehash, except for minor differences noted below.

openssl rehash scans directories and calculates a hash value of each .pem, .crt, .cer, or .crl file in the specified directory list and creates symbolic links for each file, where the name of the link is the hash value. (If the platform does not support symbolic links, a copy is made.) This command is useful as many programs that use OpenSSL require directories to be set up like this in order to find certificates.

If any directories are named on the command line, then those are processed in turn. If not, then the SSL_CERT_DIR environment variable is consulted; this should be a colon-separated list of directories, like the Unix PATH variable. If that is not set then the default directory (installation-specific but often /usr/local/ssl/certs) is processed.

In order for a directory to be processed, the user must have write permissions on that directory, otherwise an error will be generated.

The links created are of the form HHHHHHHH.D, where each H is a hexadecimal character and D is a single decimal digit. When a directory is processed, all links in it that have a name in that syntax are first removed, even if they are being used for some other purpose. To skip the removal step, use the -n flag. Hashes for CRL's look similar except the letter r appears after the period, like this: HHHHHHHH.rD.

Multiple objects may have the same hash; they will be indicated by incrementing the D value. Duplicates are found by comparing the full SHA-1 fingerprint. A warning will be displayed if a duplicate is found.

A warning will also be displayed if there are files that cannot be parsed as either a certificate or a CRL or if more than one such object appears in the file.

"},{"location":"man1/openssl-rehash/#script-configuration","title":"Script Configuration","text":"

The c_rehash script uses the openssl program to compute the hashes and fingerprints. If not found in the user's PATH, then set the OPENSSL environment variable to the full pathname. Any program can be used, it will be invoked as follows for either a certificate or CRL:

$OPENSSL x509 -hash -fingerprint -noout -in FILENAME\n$OPENSSL crl -hash -fingerprint -noout -in FILENAME\n

where FILENAME is the filename. It must output the hash of the file on the first line, and the fingerprint on the second, optionally prefixed with some text and an equals sign.

"},{"location":"man1/openssl-rehash/#options","title":"OPTIONS","text":"
  • -help -h

    Display a brief usage message.

  • -old

    Use old-style hashing (MD5, as opposed to SHA-1) for generating links to be used for releases before 1.0.0. Note that current versions will not use the old style.

  • -n

    Do not remove existing links. This is needed when keeping new and old-style links in the same directory.

  • -compat

    Generate links for both old-style (MD5) and new-style (SHA1) hashing. This allows releases before 1.0.0 to use these links along-side newer releases.

  • -v

    Print messages about old links removed and new links created. By default, this command only lists each directory as it is processed.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-rehash/#environment","title":"ENVIRONMENT","text":"
  • OPENSSL

    The path to an executable to use to generate hashes and fingerprints (see above).

  • SSL_CERT_DIR

    Colon separated list of directories to operate on. Ignored if directories are listed on the command line.

"},{"location":"man1/openssl-rehash/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-crl(1), openssl-x509(1)

"},{"location":"man1/openssl-rehash/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-req/","title":"openssl-req","text":""},{"location":"man1/openssl-req/#name","title":"NAME","text":"

openssl-req - PKCS#10 certificate request and certificate generating command

"},{"location":"man1/openssl-req/#synopsis","title":"SYNOPSIS","text":"

openssl req [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-passin arg] [-out filename] [-passout arg] [-text] [-pubkey] [-noout] [-verify] [-modulus] [-new] [-newkey arg] [-pkeyopt opt:value] [-noenc] [-nodes] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-keyout filename] [-keygen_engine id] [-digest] [-config filename] [-section name] [-x509] [-CA filename|uri] [-CAkey filename|uri] [-days n] [-set_serial n] [-newhdr] [-copy_extensions arg] [-addext ext] [-extensions section] [-reqexts section] [-precert] [-utf8] [-reqopt] [-subject] [-subj arg] [-multivalue-rdn] [-sigopt nm:v] [-vfyopt nm:v] [-batch] [-verbose] [-nameopt option] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-req/#description","title":"DESCRIPTION","text":"

This command primarily creates and processes certificate requests (CSRs) in PKCS#10 format. It can additionally create self-signed certificates for use as root CAs for example.

"},{"location":"man1/openssl-req/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM, -outform DER|PEM

    The input and output formats; unspecified by default. See openssl-format-options(1) for details.

    The data is a PKCS#10 object.

  • -in filename

    This specifies the input filename to read a request from. This defaults to standard input unless -x509 or -CA is specified. A request is only read if the creation options (-new or -newkey or -precert) are not specified.

  • -sigopt nm:v

    Pass options to the signature algorithm during sign operations. Names and values of these options are algorithm-specific.

  • -vfyopt nm:v

    Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

  • -passin arg

    The password source for private key and certificate input. For more information about the format of arg see openssl-passphrase-options(1).

  • -passout arg

    The password source for the output file. For more information about the format of arg see openssl-passphrase-options(1).

  • -out filename

    This specifies the output filename to write to or standard output by default.

  • -text

    Prints out the certificate request in text form.

  • -subject

    Prints out the certificate request subject (or certificate subject if -x509 is in use).

  • -pubkey

    Prints out the public key.

  • -noout

    This option prevents output of the encoded version of the certificate request.

  • -modulus

    Prints out the value of the modulus of the public key contained in the request.

  • -verify

    Verifies the self-signature on the request.

  • -new

    This option generates a new certificate request. It will prompt the user for the relevant field values. The actual fields prompted for and their maximum and minimum sizes are specified in the configuration file and any requested extensions.

    If the -key option is not given it will generate a new private key using information specified in the configuration file or given with the -newkey and -pkeyopt options, else by default an RSA key with 2048 bits length.

  • -newkey arg

    This option is used to generate a new private key unless -key is given. It is subsequently used as if it was given using the -key option.

    This option implies the -new flag to create a new certificate request or a new certificate in case -x509 is given.

    The argument takes one of several forms.

    [rsa:]nbits generates an RSA key nbits in size. If nbits is omitted, i.e., -newkey rsa is specified, the default key size specified in the configuration file with the default_bits option is used if present, else 2048.

    All other algorithms support the -newkey algname:file form, where file is an algorithm parameter file, created with openssl genpkey -genparam or an X.509 certificate for a key with appropriate algorithm.

    param:file generates a key using the parameter file or certificate file, the algorithm is determined by the parameters.

    algname[:file] generates a key using the given algorithm algname. If a parameter file file is given then the parameters specified there are used, where the algorithm parameters must match algname. If algorithm parameters are not given, any necessary parameters should be specified via the -pkeyopt option.

    dsa:filename generates a DSA key using the parameters in the file filename. ec:filename generates EC key (usable both with ECDSA or ECDH algorithms), gost2001:filename generates GOST R 34.10-2001 key (requires gost engine configured in the configuration file). If just gost2001 is specified a parameter set should be specified by -pkeyopt paramset:X

  • -pkeyopt opt:value

    Set the public key algorithm option opt to value. The precise set of options supported depends on the public key algorithm used and its implementation. See \"KEY GENERATION OPTIONS\" in openssl-genpkey(1) for more details.

  • -key filename|uri

    This option provides the private key for signing a new certificate or certificate request. Unless -in is given, the corresponding public key is placed in the new certificate or certificate request, resulting in a self-signature.

    For certificate signing this option is overridden by the -CA option.

    This option also accepts PKCS#8 format private keys for PEM format files.

  • -keyform DER|PEM|P12|ENGINE

    The format of the private key; unspecified by default. See openssl-format-options(1) for details.

  • -keyout filename

    This gives the filename to write any private key to that has been newly created or read from -key. If neither the -keyout option nor the -key option are given then the filename specified in the configuration file with the default_keyfile option is used, if present. Thus, if you want to write the private key and the -key option is provided, you should provide the -keyout option explicitly. If a new key is generated and no filename is specified the key is written to standard output.

  • -noenc

    If this option is specified then if a private key is created it will not be encrypted.

  • -nodes

    This option is deprecated since OpenSSL 3.0; use -noenc instead.

  • -digest

    This specifies the message digest to sign the request. Any digest supported by the OpenSSL dgst command can be used. This overrides the digest algorithm specified in the configuration file.

    Some public key algorithms may override this choice. For instance, DSA signatures always use SHA1, GOST R 34.10 signatures always use GOST R 34.11-94 (-md_gost94), Ed25519 and Ed448 never use any digest.

  • -config filename

    This allows an alternative configuration file to be specified. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

  • -section name

    Specifies the name of the section to use; the default is req.

  • -subj arg

    Sets subject name for new request or supersedes the subject name when processing a certificate request.

    The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted, but the corresponding type will not be included in the request. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

    /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

  • -multivalue-rdn

    This option has been deprecated and has no effect.

  • -x509

    This option outputs a certificate instead of a certificate request. This is typically used to generate test certificates. It is implied by the -CA option.

    This option implies the -new flag if -in is not given.

    If an existing request is specified with the -in option, it is converted to a certificate; otherwise a request is created from scratch.

    Unless specified using the -set_serial option, a large random number will be used for the serial number.

    Unless the -copy_extensions option is used, X.509 extensions are not copied from any provided request input file.

    X.509 extensions to be added can be specified in the configuration file or using the -addext option.

  • -CA filename|uri

    Specifies the \"CA\" certificate to be used for signing a new certificate and implies use of -x509. When present, this behaves like a \"micro CA\" as follows: The subject name of the \"CA\" certificate is placed as issuer name in the new certificate, which is then signed using the \"CA\" key given as specified below.

  • -CAkey filename|uri

    Sets the \"CA\" private key to sign a certificate with. The private key must match the public key of the certificate given with -CA. If this option is not provided then the key must be present in the -CA input.

  • -days n

    When -x509 is in use this specifies the number of days to certify the certificate for, otherwise it is ignored. n should be a positive integer. The default is 30 days.

  • -set_serial n

    Serial number to use when outputting a self-signed certificate. This may be specified as a decimal value or a hex value if preceded by 0x. If not given, a large random number will be used.

  • -copy_extensions arg

    Determines how X.509 extensions in certificate requests should be handled when -x509 is in use. If arg is none or this option is not present then extensions are ignored. If arg is copy or copyall then all extensions in the request are copied to the certificate.

    The main use of this option is to allow a certificate request to supply values for certain extensions such as subjectAltName.

  • -addext ext

    Add a specific extension to the certificate (if -x509 is in use) or certificate request. The argument must have the form of a key=value pair as it would appear in a config file.

    This option can be given multiple times.

  • -extensions section

  • -reqexts section

    These options specify alternative sections to include certificate extensions (if -x509 is in use) or certificate request extensions. This allows several different sections to be used in the same configuration file to specify requests for a variety of purposes.

  • -precert

    A poison extension will be added to the certificate, making it a \"pre-certificate\" (see RFC6962). This can be submitted to Certificate Transparency logs in order to obtain signed certificate timestamps (SCTs). These SCTs can then be embedded into the pre-certificate as an extension, before removing the poison and signing the certificate.

    This implies the -new flag.

  • -utf8

    This option causes field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.

  • -reqopt option

    Customise the printing format used with -text. The option argument can be a single option or multiple options separated by commas.

    See discussion of the -certopt parameter in the openssl-x509(1) command.

  • -newhdr

    Adds the word NEW to the PEM file header and footer lines on the outputted request. Some software (Netscape certificate server) and some CAs need this.

  • -batch

    Non-interactive mode.

  • -verbose

    Print extra details about the operations being performed.

  • -keygen_engine id

    Specifies an engine (by its unique id string) which would be used for key generation operations.

  • -nameopt option

    This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-req/#configuration-file-format","title":"CONFIGURATION FILE FORMAT","text":"

The configuration options are specified in the req section of the configuration file. An alternate name be specified by using the -section option. As with all configuration files, if no value is specified in the specific section then the initial unnamed or default section is searched too.

The options available are described in detail below.

  • input_password, output_password

    The passwords for the input private key file (if present) and the output private key file (if one will be created). The command line options passin and passout override the configuration file values.

  • default_bits

    Specifies the default key size in bits.

    This option is used in conjunction with the -new option to generate a new key. It can be overridden by specifying an explicit key size in the -newkey option. The smallest accepted key size is 512 bits. If no key size is specified then 2048 bits is used.

  • default_keyfile

    This is the default filename to write a private key to. If not specified the key is written to standard output. This can be overridden by the -keyout option.

  • oid_file

    This specifies a file containing additional OBJECT IDENTIFIERS. Each line of the file should consist of the numerical form of the object identifier followed by whitespace then the short name followed by whitespace and finally the long name.

  • oid_section

    This specifies a section in the configuration file containing extra object identifiers. Each line should consist of the short name of the object identifier followed by = and the numerical form. The short and long names are the same when this option is used.

  • RANDFILE

    At startup the specified file is loaded into the random number generator, and at exit 256 bytes will be written to it. It is used for private key generation.

  • encrypt_key

    If this is set to no then if a private key is generated it is not encrypted. This is equivalent to the -noenc command line option. For compatibility encrypt_rsa_key is an equivalent option.

  • default_md

    This option specifies the digest algorithm to use. Any digest supported by the OpenSSL dgst command can be used. This option can be overridden on the command line. Certain signing algorithms (i.e. Ed25519 and Ed448) will ignore any digest that has been set.

  • string_mask

    This option masks out the use of certain string types in certain fields. Most users will not need to change this option. It can be set to several values:

    • utf8only
    • only UTF8Strings are used (this is the default value)
    • pkix
    • any string type except T61Strings
    • nombstr
    • any string type except BMPStrings and UTF8Strings
    • default
    • any kind of string type

    Note that utf8only is the PKIX recommendation in RFC2459 after 2003, and the default string_mask; default is not the default option. The nombstr value is a workaround for some software that has problems with variable-sized BMPStrings and UTF8Strings.

  • req_extensions

    This specifies the configuration file section containing a list of extensions to add to the certificate request. It can be overridden by the -reqexts command line switch. See the x509v3_config(5) manual page for details of the extension section format.

  • x509_extensions

    This specifies the configuration file section containing a list of extensions to add to certificate generated when -x509 is in use. It can be overridden by the -extensions command line switch.

  • prompt

    If set to the value no this disables prompting of certificate fields and just takes values from the config file directly. It also changes the expected format of the distinguished_name and attributes sections.

  • utf8

    If set to the value yes then field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.

  • attributes

    This specifies the section containing any request attributes: its format is the same as distinguished_name. Typically these may contain the challengePassword or unstructuredName types. They are currently ignored by OpenSSL's request signing utilities but some CAs might want them.

  • distinguished_name

    This specifies the section containing the distinguished name fields to prompt for when generating a certificate or certificate request. The format is described in the next section.

"},{"location":"man1/openssl-req/#distinguished-name-and-attribute-section-format","title":"DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT","text":"

There are two separate formats for the distinguished name and attribute sections. If the prompt option is set to no then these sections just consist of field names and values: for example,

CN=My Name\nOU=My Organization\nemailAddress=someone@somewhere.org\n

This allows external programs (e.g. GUI based) to generate a template file with all the field names and values and just pass it to this command. An example of this kind of configuration file is contained in the EXAMPLES section.

Alternatively if the prompt option is absent or not set to no then the file contains field prompting information. It consists of lines of the form:

fieldName=\"prompt\"\nfieldName_default=\"default field value\"\nfieldName_min= 2\nfieldName_max= 4\n

\"fieldName\" is the field name being used, for example commonName (or CN). The \"prompt\" string is used to ask the user to enter the relevant details. If the user enters nothing then the default value is used if no default value is present then the field is omitted. A field can still be omitted if a default value is present if the user just enters the '.' character.

The number of characters entered must be between the fieldName_min and fieldName_max limits: there may be additional restrictions based on the field being used (for example countryName can only ever be two characters long and must fit in a PrintableString).

Some fields (such as organizationName) can be used more than once in a DN. This presents a problem because configuration files will not recognize the same name occurring twice. To avoid this problem if the fieldName contains some characters followed by a full stop they will be ignored. So for example a second organizationName can be input by calling it \"1.organizationName\".

The actual permitted field names are any object identifier short or long names. These are compiled into OpenSSL and include the usual values such as commonName, countryName, localityName, organizationName, organizationalUnitName, stateOrProvinceName. Additionally emailAddress is included as well as name, surname, givenName, initials, and dnQualifier.

Additional object identifiers can be defined with the oid_file or oid_section options in the configuration file. Any additional fields will be treated as though they were a DirectoryString.

"},{"location":"man1/openssl-req/#examples","title":"EXAMPLES","text":"

Examine and verify certificate request:

openssl req -in req.pem -text -verify -noout\n

Create a private key and then generate a certificate request from it:

openssl genrsa -out key.pem 2048\nopenssl req -new -key key.pem -out req.pem\n

The same but just using req:

openssl req -newkey rsa:2048 -keyout key.pem -out req.pem\n

Generate a self-signed root certificate:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out req.pem\n

Create an SM2 private key and then generate a certificate request from it:

openssl ecparam -genkey -name SM2 -out sm2.key\nopenssl req -new -key sm2.key -out sm2.csr -sm3 -sigopt \"distid:1234567812345678\"\n

Examine and verify an SM2 certificate request:

openssl req -verify -in sm2.csr -sm3 -vfyopt \"distid:1234567812345678\"\n

Example of a file pointed to by the oid_file option:

1.2.3.4        shortName       A longer Name\n1.2.3.6        otherName       Other longer Name\n

Example of a section pointed to by oid_section making use of variable expansion:

testoid1=1.2.3.5\ntestoid2=${testoid1}.6\n

Sample configuration file prompting for field values:

[ req ]\ndefault_bits           = 2048\ndefault_keyfile        = privkey.pem\ndistinguished_name     = req_distinguished_name\nattributes             = req_attributes\nreq_extensions         = v3_ca\n\ndirstring_type = nobmp\n\n[ req_distinguished_name ]\ncountryName                    = Country Name (2 letter code)\ncountryName_default            = AU\ncountryName_min                = 2\ncountryName_max                = 2\n\nlocalityName                   = Locality Name (eg, city)\n\norganizationalUnitName         = Organizational Unit Name (eg, section)\n\ncommonName                     = Common Name (eg, YOUR name)\ncommonName_max                 = 64\n\nemailAddress                   = Email Address\nemailAddress_max               = 40\n\n[ req_attributes ]\nchallengePassword              = A challenge password\nchallengePassword_min          = 4\nchallengePassword_max          = 20\n\n[ v3_ca ]\n\nsubjectKeyIdentifier=hash\nauthorityKeyIdentifier=keyid:always,issuer:always\nbasicConstraints = critical, CA:true\n

Sample configuration containing all field values:

[ req ]\ndefault_bits           = 2048\ndefault_keyfile        = keyfile.pem\ndistinguished_name     = req_distinguished_name\nattributes             = req_attributes\nprompt                 = no\noutput_password        = mypass\n\n[ req_distinguished_name ]\nC                      = GB\nST                     = Test State or Province\nL                      = Test Locality\nO                      = Organization Name\nOU                     = Organizational Unit Name\nCN                     = Common Name\nemailAddress           = test@email.address\n\n[ req_attributes ]\nchallengePassword              = A challenge password\n

Example of giving the most common attributes (subject and extensions) on the command line:

openssl req -new -subj \"/C=GB/CN=foo\" \\\n                 -addext \"subjectAltName = DNS:foo.co.uk\" \\\n                 -addext \"certificatePolicies = 1.2.3.4\" \\\n                 -newkey rsa:2048 -keyout key.pem -out req.pem\n
"},{"location":"man1/openssl-req/#notes","title":"NOTES","text":"

The certificate requests generated by Xenroll with MSIE have extensions added. It includes the keyUsage extension which determines the type of key (signature only or general purpose) and any additional OIDs entered by the script in an extendedKeyUsage extension.

"},{"location":"man1/openssl-req/#diagnostics","title":"DIAGNOSTICS","text":"

The following messages are frequently asked about:

    Using configuration from /some/path/openssl.cnf\n    Unable to load config info\n

This is followed some time later by:

    unable to find 'distinguished_name' in config\n    problems making Certificate Request\n

The first error message is the clue: it can't find the configuration file! Certain operations (like examining a certificate request) don't need a configuration file so its use isn't enforced. Generation of certificates or requests however does need a configuration file. This could be regarded as a bug.

Another puzzling message is this:

    Attributes:\n        a0:00\n

this is displayed when no attributes are present and the request includes the correct empty SET OF structure (the DER encoding of which is 0xa0 0x00). If you just see:

    Attributes:\n

then the SET OF is missing and the encoding is technically invalid (but it is tolerated). See the description of the command line option -asn1-kludge for more information.

"},{"location":"man1/openssl-req/#bugs","title":"BUGS","text":"

OpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively treats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour. This can cause problems if you need characters that aren't available in PrintableStrings and you don't want to or can't use BMPStrings.

As a consequence of the T61String handling the only correct way to represent accented characters in OpenSSL is to use a BMPString: unfortunately Netscape currently chokes on these. If you have to use accented characters with Netscape and MSIE then you currently need to use the invalid T61String form.

The current prompting is not very friendly. It doesn't allow you to confirm what you've just entered. Other things like extensions in certificate requests are statically defined in the configuration file. Some of these: like an email address in subjectAltName should be input by the user.

"},{"location":"man1/openssl-req/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-x509(1), openssl-ca(1), openssl-genrsa(1), openssl-gendsa(1), config(5), x509v3_config(5)

"},{"location":"man1/openssl-req/#history","title":"HISTORY","text":"

The -section option was added in OpenSSL 3.0.0.

The -multivalue-rdn option has become obsolete in OpenSSL 3.0.0 and has no effect.

The -engine option was deprecated in OpenSSL 3.0. The <-nodes> option was deprecated in OpenSSL 3.0, too; use -noenc instead.

"},{"location":"man1/openssl-req/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-rsa/","title":"openssl-rsa","text":""},{"location":"man1/openssl-rsa/#name","title":"NAME","text":"

openssl-rsa - RSA key processing command

"},{"location":"man1/openssl-rsa/#synopsis","title":"SYNOPSIS","text":"

openssl rsa [-help] [-inform DER|PEM|P12|ENGINE] [-outform DER|PEM] [-in filename|uri] [-passin arg] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-text] [-noout] [-modulus] [-traditional] [-check] [-pubin] [-pubout] [-RSAPublicKey_in] [-RSAPublicKey_out] [-pvk-strong] [-pvk-weak] [-pvk-none] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-rsa/#description","title":"DESCRIPTION","text":"

This command processes RSA keys. They can be converted between various forms and their components printed out.

"},{"location":"man1/openssl-rsa/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM|P12|ENGINE

    The key input format; unspecified by default. See openssl-format-options(1) for details.

  • -outform DER|PEM

    The key output format; the default is PEM. See openssl-format-options(1) for details.

  • -traditional

    When writing a private key, use the traditional PKCS#1 format instead of the PKCS#8 format.

  • -in filename|uri

    This specifies the input to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

  • -passin arg, -passout arg

    The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

  • -out filename

    This specifies the output filename to write a key to or standard output if this option is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

  • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

    These options encrypt the private key with the specified cipher before outputting it. A pass phrase is prompted for. If none of these options is specified the key is written in plain text. This means that this command can be used to remove the pass phrase from a key by not giving any encryption option is given, or to add or change the pass phrase by setting them. These options can only be used with PEM format output files.

  • -text

    Prints out the various public or private key components in plain text in addition to the encoded version.

  • -noout

    This option prevents output of the encoded version of the key.

  • -modulus

    This option prints out the value of the modulus of the key.

  • -check

    This option checks the consistency of an RSA private key.

  • -pubin

    By default a private key is read from the input file: with this option a public key is read instead.

  • -pubout

    By default a private key is output: with this option a public key will be output instead. This option is automatically set if the input is a public key.

  • -RSAPublicKey_in, -RSAPublicKey_out

    Like -pubin and -pubout except RSAPublicKey format is used instead.

  • -pvk-strong

    Enable 'Strong' PVK encoding level (default).

  • -pvk-weak

    Enable 'Weak' PVK encoding level.

  • -pvk-none

    Don't enforce PVK encoding.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-rsa/#notes","title":"NOTES","text":"

The openssl-pkey(1) command is capable of performing all the operations this command can, as well as supporting other public key types.

"},{"location":"man1/openssl-rsa/#examples","title":"EXAMPLES","text":"

The documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here.

To remove the pass phrase on an RSA private key:

openssl rsa -in key.pem -out keyout.pem\n

To encrypt a private key using triple DES:

openssl rsa -in key.pem -des3 -out keyout.pem\n

To convert a private key from PEM to DER format:

openssl rsa -in key.pem -outform DER -out keyout.der\n

To print out the components of a private key to standard output:

openssl rsa -in key.pem -text -noout\n

To just output the public part of a private key:

openssl rsa -in key.pem -pubout -out pubkey.pem\n

Output the public part of a private key in RSAPublicKey format:

openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem\n
"},{"location":"man1/openssl-rsa/#bugs","title":"BUGS","text":"

There should be an option that automatically handles .key files, without having to manually edit them.

"},{"location":"man1/openssl-rsa/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkey(1), openssl-pkcs8(1), openssl-dsa(1), openssl-genrsa(1), openssl-gendsa(1)

"},{"location":"man1/openssl-rsa/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-rsa/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-rsautl/","title":"openssl-rsautl","text":""},{"location":"man1/openssl-rsautl/#name","title":"NAME","text":"

openssl-rsautl - RSA command

"},{"location":"man1/openssl-rsautl/#synopsis","title":"SYNOPSIS","text":"

openssl rsautl [-help] [-in file] [-passin arg] [-rev] [-out file] [-inkey filename|uri] [-keyform DER|PEM|P12|ENGINE] [-pubin] [-certin] [-sign] [-verify] [-encrypt] [-decrypt] [-pkcs] [-x931] [-oaep] [-raw] [-hexdump] [-asn1parse] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-rsautl/#description","title":"DESCRIPTION","text":"

This command has been deprecated. The openssl-pkeyutl(1) command should be used instead.

This command can be used to sign, verify, encrypt and decrypt data using the RSA algorithm.

"},{"location":"man1/openssl-rsautl/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -in filename

    This specifies the input filename to read data from or standard input if this option is not specified.

  • -passin arg

    The passphrase used in the output file. See see openssl-passphrase-options(1).

  • -rev

    Reverse the order of the input.

  • -out filename

    Specifies the output filename to write to or standard output by default.

  • -inkey filename|uri

    The input key, by default it should be an RSA private key.

  • -keyform DER|PEM|P12|ENGINE

    The key format; unspecified by default. See openssl-format-options(1) for details.

  • -pubin

    The input file is an RSA public key.

  • -certin

    The input is a certificate containing an RSA public key.

  • -sign

    Sign the input data and output the signed result. This requires an RSA private key.

  • -verify

    Verify the input data and output the recovered data.

  • -encrypt

    Encrypt the input data using an RSA public key.

  • -decrypt

    Decrypt the input data using an RSA private key.

  • -pkcs, -oaep, -x931, -raw

    The padding to use: PKCS#1 v1.5 (the default), PKCS#1 OAEP, ANSI X9.31, or no padding, respectively. For signatures, only -pkcs and -raw can be used.

  • -hexdump

    Hex dump the output data.

  • -asn1parse

    Parse the ASN.1 output data, this is useful when combined with the -verify option.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-rsautl/#notes","title":"NOTES","text":"

Since this command uses the RSA algorithm directly, it can only be used to sign or verify small pieces of data.

"},{"location":"man1/openssl-rsautl/#examples","title":"EXAMPLES","text":"

Examples equivalent to these can be found in the documentation for the non-deprecated openssl-pkeyutl(1) command.

Sign some data using a private key:

openssl rsautl -sign -in file -inkey key.pem -out sig\n

Recover the signed data

openssl rsautl -verify -in sig -inkey key.pem\n

Examine the raw signed data:

openssl rsautl -verify -in sig -inkey key.pem -raw -hexdump\n\n0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64   .....hello world\n

The PKCS#1 block formatting is evident from this. If this was done using encrypt and decrypt the block would have been of type 2 (the second byte) and random padding data visible instead of the 0xff bytes.

It is possible to analyse the signature of certificates using this command in conjunction with openssl-asn1parse(1). Consider the self signed example in certs/pca-cert.pem. Running openssl-asn1parse(1) as follows yields:

openssl asn1parse -in pca-cert.pem\n\n   0:d=0  hl=4 l= 742 cons: SEQUENCE\n   4:d=1  hl=4 l= 591 cons:  SEQUENCE\n   8:d=2  hl=2 l=   3 cons:   cont [ 0 ]\n  10:d=3  hl=2 l=   1 prim:    INTEGER           :02\n  13:d=2  hl=2 l=   1 prim:   INTEGER           :00\n  16:d=2  hl=2 l=  13 cons:   SEQUENCE\n  18:d=3  hl=2 l=   9 prim:    OBJECT            :md5WithRSAEncryption\n  29:d=3  hl=2 l=   0 prim:    NULL\n  31:d=2  hl=2 l=  92 cons:   SEQUENCE\n  33:d=3  hl=2 l=  11 cons:    SET\n  35:d=4  hl=2 l=   9 cons:     SEQUENCE\n  37:d=5  hl=2 l=   3 prim:      OBJECT            :countryName\n  42:d=5  hl=2 l=   2 prim:      PRINTABLESTRING   :AU\n ....\n 599:d=1  hl=2 l=  13 cons:  SEQUENCE\n 601:d=2  hl=2 l=   9 prim:   OBJECT            :md5WithRSAEncryption\n 612:d=2  hl=2 l=   0 prim:   NULL\n 614:d=1  hl=3 l= 129 prim:  BIT STRING\n

The final BIT STRING contains the actual signature. It can be extracted with:

openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614\n

The certificate public key can be extracted with:

openssl x509 -in test/testx509.pem -pubkey -noout >pubkey.pem\n

The signature can be analysed with:

openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin\n\n   0:d=0  hl=2 l=  32 cons: SEQUENCE\n   2:d=1  hl=2 l=  12 cons:  SEQUENCE\n   4:d=2  hl=2 l=   8 prim:   OBJECT            :md5\n  14:d=2  hl=2 l=   0 prim:   NULL\n  16:d=1  hl=2 l=  16 prim:  OCTET STRING\n     0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5   .F...Js.7...H%..\n

This is the parsed version of an ASN1 DigestInfo structure. It can be seen that the digest used was md5. The actual part of the certificate that was signed can be extracted with:

openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4\n

and its digest computed with:

openssl md5 -c tbs\nMD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5\n

which it can be seen agrees with the recovered value above.

"},{"location":"man1/openssl-rsautl/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-pkeyutl(1), openssl-dgst(1), openssl-rsa(1), openssl-genrsa(1)

"},{"location":"man1/openssl-rsautl/#history","title":"HISTORY","text":"

This command was deprecated in OpenSSL 3.0.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-rsautl/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-s_client/","title":"openssl-s_client","text":""},{"location":"man1/openssl-s_client/#name","title":"NAME","text":"

openssl-s_client - SSL/TLS client program

"},{"location":"man1/openssl-s_client/#synopsis","title":"SYNOPSIS","text":"

openssl s_client [-help] [-ssl_config section] [-connect host:port] [-host hostname] [-port port] [-bind host:port] [-proxy host:port] [-proxy_user userid] [-proxy_pass arg] [-unix path] [-4] [-6] [-servername name] [-noservername] [-verify depth] [-verify_return_error] [-verify_quiet] [-verifyCAfile filename] [-verifyCApath dir] [-verifyCAstore uri] [-cert filename] [-certform DER|PEM|P12] [-cert_chain filename] [-build_chain] [-CRL filename] [-CRLform DER|PEM] [-crl_download] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-pass arg] [-chainCAfile filename] [-chainCApath directory] [-chainCAstore uri] [-requestCAfile filename] [-dane_tlsa_domain domain] [-dane_tlsa_rrdata rrdata] [-dane_ee_no_namechecks] [-reconnect] [-showcerts] [-prexit] [-debug] [-trace] [-nocommands] [-security_debug] [-security_debug_verbose] [-msg] [-timeout] [-mtu size] [-no_etm] [-keymatexport label] [-keymatexportlen len] [-msgfile filename] [-nbio_test] [-state] [-nbio] [-crlf] [-ign_eof] [-no_ign_eof] [-psk_identity identity] [-psk key] [-psk_session file] [-quiet] [-sctp] [-sctp_label_bug] [-fallback_scsv] [-async] [-maxfraglen len] [-max_send_frag] [-split_send_frag] [-max_pipelines] [-read_buf] [-ignore_unexpected_eof] [-bugs] [-comp] [-no_comp] [-brief] [-legacy_server_connect] [-no_legacy_server_connect] [-allow_no_dhe_kex] [-sigalgs sigalglist] [-curves curvelist] [-cipher cipherlist] [-ciphersuites val] [-serverpref] [-starttls protocol] [-name hostname] [-xmpphost hostname] [-name hostname] [-tlsextdebug] [-no_ticket] [-sess_out filename] [-serverinfo types] [-sess_in filename] [-serverinfo types] [-status] [-alpn protocols] [-nextprotoneg protocols] [-ct] [-noct] [-ctlogfile] [-keylogfile file] [-early_data file] [-enable_pha] [-use_srtp value] [-srpuser value] [-srppass value] [-srp_lateuser] [-srp_moregroups] [-srp_strength number] [-nameopt option] [-no_ssl3] [-no_tls1] [-no_tls1_1] [-no_tls1_2] [-no_tls1_3] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-dtls] [-dtls1] [-dtls1_2] [-xkey infile] [-xcert file] [-xchain file] [-xchain_build file] [-xcertform DER|PEM]> [-xkeyform DER|PEM]> [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-bugs] [-no_comp] [-comp] [-no_ticket] [-serverpref] [-client_renegotiation] [-legacy_renegotiation] [-no_renegotiation] [-no_resumption_on_reneg] [-legacy_server_connect] [-no_legacy_server_connect] [-no_etm] [-allow_no_dhe_kex] [-prioritize_chacha] [-strict] [-sigalgs algs] [-client_sigalgs algs] [-groups groups] [-curves curves] [-named_curve curve] [-cipher ciphers] [-ciphersuites 1.3ciphers] [-min_protocol minprot] [-max_protocol maxprot] [-record_padding padding] [-debug_broken_protocol] [-no_middlebox] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [-engine id] [-ssl_client_engine id] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [host:port]

"},{"location":"man1/openssl-s_client/#description","title":"DESCRIPTION","text":"

This command implements a generic SSL/TLS client which connects to a remote host using SSL/TLS. It is a very useful diagnostic tool for SSL servers.

"},{"location":"man1/openssl-s_client/#options","title":"OPTIONS","text":"

In addition to the options below, this command also supports the common and client only options documented in the \"Supported Command Line Commands\" section of the SSL_CONF_cmd(3) manual page.

  • -help

    Print out a usage message.

  • -ssl_config section

    Use the specified section of the configuration file to configure the SSL_CTX object.

  • -connect host:port

    This specifies the host and optional port to connect to. It is possible to select the host and port using the optional target positional argument instead. If neither this nor the target positional argument are specified then an attempt is made to connect to the local host on port 4433.

  • -host hostname

    Host to connect to; use -connect instead.

  • -port port

    Connect to the specified port; use -connect instead.

  • -bind host:port

    This specifies the host address and or port to bind as the source for the connection. For Unix-domain sockets the port is ignored and the host is used as the source socket address.

  • -proxy host:port

    When used with the -connect flag, the program uses the host and port specified with this flag and issues an HTTP CONNECT command to connect to the desired server.

  • -proxy_user userid

    When used with the -proxy flag, the program will attempt to authenticate with the specified proxy using basic (base64) authentication. NB: Basic authentication is insecure; the credentials are sent to the proxy in easily reversible base64 encoding before any TLS/SSL session is established. Therefore, these credentials are easily recovered by anyone able to sniff/trace the network. Use with caution.

  • -proxy_pass arg

    The proxy password source, used with the -proxy_user flag. For more information about the format of arg see openssl-passphrase-options(1).

  • -unix path

    Connect over the specified Unix-domain socket.

  • -4

    Use IPv4 only.

  • -6

    Use IPv6 only.

  • -servername name

    Set the TLS SNI (Server Name Indication) extension in the ClientHello message to the given value. If -servername is not provided, the TLS SNI extension will be populated with the name given to -connect if it follows a DNS name format. If -connect is not provided either, the SNI is set to \"localhost\". This is the default since OpenSSL 1.1.1.

    Even though SNI should normally be a DNS name and not an IP address, if -servername is provided then that name will be sent, regardless of whether it is a DNS name or not.

    This option cannot be used in conjunction with -noservername.

  • -noservername

    Suppresses sending of the SNI (Server Name Indication) extension in the ClientHello message. Cannot be used in conjunction with the -servername or -dane_tlsa_domain options.

  • -cert filename

    The client certificate to use, if one is requested by the server. The default is not to use a certificate.

    The chain for the client certificate may be specified using -cert_chain.

  • -certform DER|PEM|P12

    The client certificate file format to use; unspecified by default. See openssl-format-options(1) for details.

  • -cert_chain

    A file or URI of untrusted certificates to use when attempting to build the certificate chain related to the certificate specified via the -cert option. The input can be in PEM, DER, or PKCS#12 format.

  • -build_chain

    Specify whether the application should build the client certificate chain to be provided to the server.

  • -CRL filename

    CRL file to use to check the server's certificate.

  • -CRLform DER|PEM

    The CRL file format; unspecified by default. See openssl-format-options(1) for details.

  • -crl_download

    Download CRL from distribution points in the certificate.

  • -key filename|uri

    The client private key to use. If not specified then the certificate file will be used to read also the key.

  • -keyform DER|PEM|P12|ENGINE

    The key format; unspecified by default. See openssl-format-options(1) for details.

  • -pass arg

    the private key and certificate file password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -verify depth

    The verify depth to use. This specifies the maximum length of the server certificate chain and turns on server certificate verification. Currently the verify operation continues after errors so all the problems with a certificate chain can be seen. As a side effect the connection will never fail due to a server certificate verify failure.

  • -verify_return_error

    Return verification errors instead of continuing. This will typically abort the handshake with a fatal error.

  • -verify_quiet

    Limit verify output to only errors.

  • -verifyCAfile filename

    A file in PEM format containing trusted certificates to use for verifying the server's certificate.

  • -verifyCApath dir

    A directory containing trusted certificates to use for verifying the server's certificate. This directory must be in \"hash format\", see openssl-verify(1) for more information.

  • -verifyCAstore uri

    The URI of a store containing trusted certificates to use for verifying the server's certificate.

  • -chainCAfile file

    A file in PEM format containing trusted certificates to use when attempting to build the client certificate chain.

  • -chainCApath directory

    A directory containing trusted certificates to use for building the client certificate chain provided to the server. This directory must be in \"hash format\", see openssl-verify(1) for more information.

  • -chainCAstore uri

    The URI of a store containing trusted certificates to use when attempting to build the client certificate chain. The URI may indicate a single certificate, as well as a collection of them. With URIs in the file: scheme, this acts as -chainCAfile or -chainCApath, depending on if the URI indicates a directory or a single file. See ossl_store-file(7) for more information on the file: scheme.

  • -requestCAfile file

    A file containing a list of certificates whose subject names will be sent to the server in the certificate_authorities extension. Only supported for TLS 1.3

  • -dane_tlsa_domain domain

    Enable RFC6698/RFC7671 DANE TLSA authentication and specify the TLSA base domain which becomes the default SNI hint and the primary reference identifier for hostname checks. This must be used in combination with at least one instance of the -dane_tlsa_rrdata option below.

    When DANE authentication succeeds, the diagnostic output will include the lowest (closest to 0) depth at which a TLSA record authenticated a chain certificate. When that TLSA record is a \"2 1 0\" trust anchor public key that signed (rather than matched) the top-most certificate of the chain, the result is reported as \"TA public key verified\". Otherwise, either the TLSA record \"matched TA certificate\" at a positive depth or else \"matched EE certificate\" at depth 0.

  • -dane_tlsa_rrdata rrdata

    Use one or more times to specify the RRDATA fields of the DANE TLSA RRset associated with the target service. The rrdata value is specified in \"presentation form\", that is four whitespace separated fields that specify the usage, selector, matching type and associated data, with the last of these encoded in hexadecimal. Optional whitespace is ignored in the associated data field. For example:

    $ openssl s_client -brief -starttls smtp \\\n  -connect smtp.example.com:25 \\\n  -dane_tlsa_domain smtp.example.com \\\n  -dane_tlsa_rrdata \"2 1 1\n    B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B\" \\\n  -dane_tlsa_rrdata \"2 1 1\n    60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18\"\n...\nVerification: OK\nVerified peername: smtp.example.com\nDANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1\n...\n
  • -dane_ee_no_namechecks

    This disables server name checks when authenticating via DANE-EE(3) TLSA records. For some applications, primarily web browsers, it is not safe to disable name checks due to \"unknown key share\" attacks, in which a malicious server can convince a client that a connection to a victim server is instead a secure connection to the malicious server. The malicious server may then be able to violate cross-origin scripting restrictions. Thus, despite the text of RFC7671, name checks are by default enabled for DANE-EE(3) TLSA records, and can be disabled in applications where it is safe to do so. In particular, SMTP and XMPP clients should set this option as SRV and MX records already make it possible for a remote domain to redirect client connections to any server of its choice, and in any case SMTP and XMPP clients do not execute scripts downloaded from remote servers.

  • -reconnect

    Reconnects to the same server 5 times using the same session ID, this can be used as a test that session caching is working.

  • -showcerts

    Displays the server certificate list as sent by the server: it only consists of certificates the server has sent (in the order the server has sent them). It is not a verified chain.

  • -prexit

    Print session information when the program exits. This will always attempt to print out information even if the connection fails. Normally information will only be printed out once if the connection succeeds. This option is useful because the cipher in use may be renegotiated or the connection may fail because a client certificate is required or is requested only after an attempt is made to access a certain URL. Note: the output produced by this option is not always accurate because a connection might never have been established.

  • -state

    Prints out the SSL session states.

  • -debug

    Print extensive debugging information including a hex dump of all traffic.

  • -nocommands

    Do not use interactive command letters.

  • -security_debug

    Enable security debug messages.

  • -security_debug_verbose

    Output more security debug output.

  • -msg

    Show protocol messages.

  • -timeout

    Enable send/receive timeout on DTLS connections.

  • -mtu size

    Set MTU of the link layer to the specified size.

  • -no_etm

    Disable Encrypt-then-MAC negotiation.

  • -keymatexport label

    Export keying material using the specified label.

  • -keymatexportlen len

    Export the specified number of bytes of keying material; default is 20.

    Show all protocol messages with hex dump.

  • -trace

    Show verbose trace output of protocol messages.

  • -msgfile filename

    File to send output of -msg or -trace to, default standard output.

  • -nbio_test

    Tests nonblocking I/O

  • -nbio

    Turns on nonblocking I/O

  • -crlf

    This option translated a line feed from the terminal into CR+LF as required by some servers.

  • -ign_eof

    Inhibit shutting down the connection when end of file is reached in the input.

  • -quiet

    Inhibit printing of session and certificate information. This implicitly turns on -ign_eof as well.

  • -no_ign_eof

    Shut down the connection when end of file is reached in the input. Can be used to override the implicit -ign_eof after -quiet.

  • -psk_identity identity

    Use the PSK identity identity when using a PSK cipher suite. The default value is \"Client_identity\" (without the quotes).

  • -psk key

    Use the PSK key key when using a PSK cipher suite. The key is given as a hexadecimal number without leading 0x, for example -psk 1a2b3c4d. This option must be provided in order to use a PSK cipher.

  • -psk_session file

    Use the pem encoded SSL_SESSION data stored in file as the basis of a PSK. Note that this will only work if TLSv1.3 is negotiated.

  • -sctp

    Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in conjunction with -dtls, -dtls1 or -dtls1_2. This option is only available where OpenSSL has support for SCTP enabled.

  • -sctp_label_bug

    Use the incorrect behaviour of older OpenSSL implementations when computing endpoint-pair shared secrets for DTLS/SCTP. This allows communication with older broken implementations but breaks interoperability with correct implementations. Must be used in conjunction with -sctp. This option is only available where OpenSSL has support for SCTP enabled.

  • -fallback_scsv

    Send TLS_FALLBACK_SCSV in the ClientHello.

  • -async

    Switch on asynchronous mode. Cryptographic operations will be performed asynchronously. This will only have an effect if an asynchronous capable engine is also used via the -engine option. For test purposes the dummy async engine (dasync) can be used (if available).

  • -maxfraglen len

    Enable Maximum Fragment Length Negotiation; allowed values are 512, 1024, 2048, and 4096.

  • -max_send_frag int

    The maximum size of data fragment to send. See SSL_CTX_set_max_send_fragment(3) for further information.

  • -split_send_frag int

    The size used to split data for encrypt pipelines. If more data is written in one go than this value then it will be split into multiple pipelines, up to the maximum number of pipelines defined by max_pipelines. This only has an effect if a suitable cipher suite has been negotiated, an engine that supports pipelining has been loaded, and max_pipelines is greater than 1. See SSL_CTX_set_split_send_fragment(3) for further information.

  • -max_pipelines int

    The maximum number of encrypt/decrypt pipelines to be used. This will only have an effect if an engine has been loaded that supports pipelining (e.g. the dasync engine) and a suitable cipher suite has been negotiated. The default value is 1. See SSL_CTX_set_max_pipelines(3) for further information.

  • -read_buf int

    The default read buffer size to be used for connections. This will only have an effect if the buffer size is larger than the size that would otherwise be used and pipelining is in use (see SSL_CTX_set_default_read_buffer_len(3) for further information).

  • -ignore_unexpected_eof

    Some TLS implementations do not send the mandatory close_notify alert on shutdown. If the application tries to wait for the close_notify alert but the peer closes the connection without sending it, an error is generated. When this option is enabled the peer does not need to send the close_notify alert and a closed connection will be treated as if the close_notify alert was received. For more information on shutting down a connection, see SSL_shutdown(3).

  • -bugs

    There are several known bugs in SSL and TLS implementations. Adding this option enables various workarounds.

  • -comp

    Enables support for SSL/TLS compression. This option was introduced in OpenSSL 1.1.0. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

  • -no_comp

    Disables support for SSL/TLS compression. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

  • -brief

    Only provide a brief summary of connection parameters instead of the normal verbose output.

  • -sigalgs sigalglist

    Specifies the list of signature algorithms that are sent by the client. The server selects one entry in the list based on its preferences. For example strings, see SSL_CTX_set1_sigalgs(3)

  • -curves curvelist

    Specifies the list of supported curves to be sent by the client. The curve is ultimately selected by the server.

    The list of all supported groups includes named EC parameters as well as X25519 and X448 or FFDHE groups, and may also include groups implemented in 3rd-party providers. For a list of named EC parameters, use:

    $ openssl ecparam -list_curves\n
  • -cipher cipherlist

    This allows the TLSv1.2 and below cipher list sent by the client to be modified. This list will be combined with any TLSv1.3 ciphersuites that have been configured. Although the server determines which ciphersuite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information.

  • -ciphersuites val

    This allows the TLSv1.3 ciphersuites sent by the client to be modified. This list will be combined with any TLSv1.2 and below ciphersuites that have been configured. Although the server determines which cipher suite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names.

  • -starttls protocol

    Send the protocol-specific message(s) to switch to TLS for communication. protocol is a keyword for the intended protocol. Currently, the only supported keywords are \"smtp\", \"pop3\", \"imap\", \"ftp\", \"xmpp\", \"xmpp-server\", \"irc\", \"postgres\", \"mysql\", \"lmtp\", \"nntp\", \"sieve\" and \"ldap\".

  • -xmpphost hostname

    This option, when used with \"-starttls xmpp\" or \"-starttls xmpp-server\", specifies the host for the \"to\" attribute of the stream element. If this option is not specified, then the host specified with \"-connect\" will be used.

    This option is an alias of the -name option for \"xmpp\" and \"xmpp-server\".

  • -name hostname

    This option is used to specify hostname information for various protocols used with -starttls option. Currently only \"xmpp\", \"xmpp-server\", \"smtp\" and \"lmtp\" can utilize this -name option.

    If this option is used with \"-starttls xmpp\" or \"-starttls xmpp-server\", if specifies the host for the \"to\" attribute of the stream element. If this option is not specified, then the host specified with \"-connect\" will be used.

    If this option is used with \"-starttls lmtp\" or \"-starttls smtp\", it specifies the name to use in the \"LMTP LHLO\" or \"SMTP EHLO\" message, respectively. If this option is not specified, then \"mail.example.com\" will be used.

  • -tlsextdebug

    Print out a hex dump of any TLS extensions received from the server.

  • -no_ticket

    Disable RFC4507bis session ticket support.

  • -sess_out filename

    Output SSL session to filename.

  • -sess_in filename

    Load SSL session from filename. The client will attempt to resume a connection from this session.

  • -serverinfo types

    A list of comma-separated TLS Extension Types (numbers between 0 and 65535). Each type will be sent as an empty ClientHello TLS Extension. The server's response (if any) will be encoded and displayed as a PEM file.

  • -status

    Sends a certificate status request to the server (OCSP stapling). The server response (if any) is printed out.

  • -alpn protocols, -nextprotoneg protocols

    These flags enable the Enable the Application-Layer Protocol Negotiation or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the IETF standard and replaces NPN. The protocols list is a comma-separated list of protocol names that the client should advertise support for. The list should contain the most desirable protocols first. Protocol names are printable ASCII strings, for example \"http/1.1\" or \"spdy/3\". An empty list of protocols is treated specially and will cause the client to advertise support for the TLS extension but disconnect just after receiving ServerHello with a list of server supported protocols. The flag -nextprotoneg cannot be specified if -tls1_3 is used.

  • -ct, -noct

    Use one of these two options to control whether Certificate Transparency (CT) is enabled (-ct) or disabled (-noct). If CT is enabled, signed certificate timestamps (SCTs) will be requested from the server and reported at handshake completion.

    Enabling CT also enables OCSP stapling, as this is one possible delivery method for SCTs.

  • -ctlogfile

    A file containing a list of known Certificate Transparency logs. See SSL_CTX_set_ctlog_list_file(3) for the expected file format.

  • -keylogfile file

    Appends TLS secrets to the specified keylog file such that external programs (like Wireshark) can decrypt TLS connections.

  • -early_data file

    Reads the contents of the specified file and attempts to send it as early data to the server. This will only work with resumed sessions that support early data and when the server accepts the early data.

  • -enable_pha

    For TLSv1.3 only, send the Post-Handshake Authentication extension. This will happen whether or not a certificate has been provided via -cert.

  • -use_srtp value

    Offer SRTP key management, where value is a colon-separated profile list.

  • -srpuser value

    Set the SRP username to the specified value. This option is deprecated.

  • -srppass value

    Set the SRP password to the specified value. This option is deprecated.

  • -srp_lateuser

    SRP username for the second ClientHello message. This option is deprecated.

  • -srp_moregroups This option is deprecated.

    Tolerate other than the known g and N values.

  • -srp_strength number

    Set the minimal acceptable length, in bits, for N. This option is deprecated.

  • -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3, -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3

    See \"TLS Version Options\" in openssl(1).

  • -dtls, -dtls1, -dtls1_2

    These specify the use of DTLS instead of TLS. See \"TLS Version Options\" in openssl(1).

  • -nameopt option

    This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

  • -xkey infile, -xcert file, -xchain file, -xchain_build file, -xcertform DER|PEM, -xkeyform DER|PEM

    Set extended certificate verification options. See \"Extended Verification Options\" in openssl-verification-options(1) for details.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -bugs, -comp, -no_comp, -no_ticket, -serverpref, -client_renegotiation, -legacy_renegotiation, -no_renegotiation, -no_resumption_on_reneg, -legacy_server_connect, -no_legacy_server_connect, -no_etm -allow_no_dhe_kex, -prioritize_chacha, -strict, -sigalgs algs, -client_sigalgs algs, -groups groups, -curves curves, -named_curve curve, -cipher ciphers, -ciphersuites 1.3ciphers, -min_protocol minprot, -max_protocol maxprot, -record_padding padding, -debug_broken_protocol, -no_middlebox

    See \"SUPPORTED COMMAND LINE COMMANDS\" in SSL_CONF_cmd(3) for details.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -ssl_client_engine id

    Specify engine to be used for client certificate operations.

  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

    Verification errors are displayed, for debugging, but the command will proceed unless the -verify_return_error option is used.

  • host:port

    Rather than providing -connect, the target hostname and optional port may be provided as a single positional argument after all options. If neither this nor -connect are provided, falls back to attempting to connect to localhost on port 4433.

"},{"location":"man1/openssl-s_client/#connected-commands","title":"CONNECTED COMMANDS","text":"

If a connection is established with an SSL server then any data received from the server is displayed and any key presses will be sent to the server. If end of file is reached then the connection will be closed down. When used interactively (which means neither -quiet nor -ign_eof have been given), then certain commands are also recognized which perform special operations. These commands are a letter which must appear at the start of a line. They are listed below.

  • Q

    End the current SSL connection and exit.

  • R

    Renegotiate the SSL session (TLSv1.2 and below only).

  • k

    Send a key update message to the server (TLSv1.3 only)

  • K

    Send a key update message to the server and request one back (TLSv1.3 only)

"},{"location":"man1/openssl-s_client/#notes","title":"NOTES","text":"

This command can be used to debug SSL servers. To connect to an SSL HTTP server the command:

openssl s_client -connect servername:443\n

would typically be used (https uses port 443). If the connection succeeds then an HTTP command can be given such as \"GET /\" to retrieve a web page.

If the handshake fails then there are several possible causes, if it is nothing obvious like no client certificate then the -bugs, -ssl3, -tls1, -no_ssl3, -no_tls1 options can be tried in case it is a buggy server. In particular you should play with these options before submitting a bug report to an OpenSSL mailing list.

A frequent problem when attempting to get client certificates working is that a web client complains it has no certificates or gives an empty list to choose from. This is normally because the server is not sending the clients certificate authority in its \"acceptable CA list\" when it requests a certificate. By using this command, the CA list can be viewed and checked. However, some servers only request client authentication after a specific URL is requested. To obtain the list in this case it is necessary to use the -prexit option and send an HTTP request for an appropriate page.

If a certificate is specified on the command line using the -cert option it will not be used unless the server specifically requests a client certificate. Therefore, merely including a client certificate on the command line is no guarantee that the certificate works.

If there are problems verifying a server certificate then the -showcerts option can be used to show all the certificates sent by the server.

This command is a test tool and is designed to continue the handshake after any certificate verification errors. As a result it will accept any certificate chain (trusted or not) sent by the peer. Non-test applications should not do this as it makes them vulnerable to a MITM attack. This behaviour can be changed by with the -verify_return_error option: any verify errors are then returned aborting the handshake.

The -bind option may be useful if the server or a firewall requires connections to come from some particular address and or port.

"},{"location":"man1/openssl-s_client/#bugs","title":"BUGS","text":"

Because this program has a lot of options and also because some of the techniques used are rather old, the C source for this command is rather hard to read and not a model of how things should be done. A typical SSL client program would be much simpler.

The -prexit option is a bit of a hack. We should really report information whenever a session is renegotiated.

"},{"location":"man1/openssl-s_client/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-sess_id(1), openssl-s_server(1), openssl-ciphers(1), SSL_CONF_cmd(3), SSL_CTX_set_max_send_fragment(3), SSL_CTX_set_split_send_fragment(3), SSL_CTX_set_max_pipelines(3), ossl_store-file(7)

"},{"location":"man1/openssl-s_client/#history","title":"HISTORY","text":"

The -no_alt_chains option was added in OpenSSL 1.1.0. The -name option was added in OpenSSL 1.1.1.

The -certform option has become obsolete in OpenSSL 3.0.0 and has no effect.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-s_client/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-s_server/","title":"openssl-s_server","text":""},{"location":"man1/openssl-s_server/#name","title":"NAME","text":"

openssl-s_server - SSL/TLS server program

"},{"location":"man1/openssl-s_server/#synopsis","title":"SYNOPSIS","text":"

openssl s_server [-help] [-port +int] [-accept val] [-unix val] [-4] [-6] [-unlink] [-context val] [-verify int] [-Verify int] [-cert infile] [-cert2 infile] [-certform DER|PEM|P12] [-cert_chain infile] [-build_chain] [-serverinfo val] [-key filename|uri] [-key2 filename|uri] [-keyform DER|PEM|P12|ENGINE] [-pass val] [-dcert infile] [-dcertform DER|PEM|P12] [-dcert_chain infile] [-dkey filename|uri] [-dkeyform DER|PEM|P12|ENGINE] [-dpass val] [-nbio_test] [-crlf] [-debug] [-msg] [-msgfile outfile] [-state] [-nocert] [-quiet] [-no_resume_ephemeral] [-www] [-WWW] [-http_server_binmode] [-no_ca_names] [-ignore_unexpected_eof] [-servername] [-servername_fatal] [-tlsextdebug] [-HTTP] [-id_prefix val] [-keymatexport val] [-keymatexportlen +int] [-CRL infile] [-CRLform DER|PEM] [-crl_download] [-chainCAfile infile] [-chainCApath dir] [-chainCAstore uri] [-verifyCAfile infile] [-verifyCApath dir] [-verifyCAstore uri] [-no_cache] [-ext_cache] [-verify_return_error] [-verify_quiet] [-ign_eof] [-no_ign_eof] [-no_etm] [-status] [-status_verbose] [-status_timeout int] [-proxy [http[s]://][userinfo@]host[:port][/path]] [-no_proxy addresses] [-status_url val] [-status_file infile] [-ssl_config val] [-trace] [-security_debug] [-security_debug_verbose] [-brief] [-rev] [-async] [-max_send_frag +int] [-split_send_frag +int] [-max_pipelines +int] [-naccept +int] [-read_buf +int] [-bugs] [-no_comp] [-comp] [-no_ticket] [-serverpref] [-legacy_renegotiation] [-no_renegotiation] [-no_resumption_on_reneg] [-allow_no_dhe_kex] [-prioritize_chacha] [-strict] [-sigalgs val] [-client_sigalgs val] [-groups val] [-curves val] [-named_curve val] [-cipher val] [-ciphersuites val] [-dhparam infile] [-record_padding val] [-debug_broken_protocol] [-nbio] [-psk_identity val] [-psk_hint val] [-psk val] [-psk_session file] [-srpvfile infile] [-srpuserseed val] [-timeout] [-mtu +int] [-listen] [-sctp] [-sctp_label_bug] [-use_srtp val] [-no_dhe] [-nextprotoneg val] [-alpn val] [-sendfile] [-keylogfile outfile] [-recv_max_early_data int] [-max_early_data int] [-early_data] [-stateless] [-anti_replay] [-no_anti_replay] [-num_tickets] [-nameopt option] [-no_ssl3] [-no_tls1] [-no_tls1_1] [-no_tls1_2] [-no_tls1_3] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-dtls] [-dtls1] [-dtls1_2] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-bugs] [-no_comp] [-comp] [-no_ticket] [-serverpref] [-client_renegotiation] [-legacy_renegotiation] [-no_renegotiation] [-no_resumption_on_reneg] [-legacy_server_connect] [-no_legacy_server_connect] [-no_etm] [-allow_no_dhe_kex] [-prioritize_chacha] [-strict] [-sigalgs algs] [-client_sigalgs algs] [-groups groups] [-curves curves] [-named_curve curve] [-cipher ciphers] [-ciphersuites 1.3ciphers] [-min_protocol minprot] [-max_protocol maxprot] [-record_padding padding] [-debug_broken_protocol] [-no_middlebox] [-xkey infile] [-xcert file] [-xchain file] [-xchain_build file] [-xcertform DER|PEM]> [-xkeyform DER|PEM]> [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-s_server/#description","title":"DESCRIPTION","text":"

This command implements a generic SSL/TLS server which listens for connections on a given port using SSL/TLS.

"},{"location":"man1/openssl-s_server/#options","title":"OPTIONS","text":"

In addition to the options below, this command also supports the common and server only options documented \"Supported Command Line Commands\" in SSL_CONF_cmd(3)

  • -help

    Print out a usage message.

  • -port +int

    The TCP port to listen on for connections. If not specified 4433 is used.

  • -accept val

    The optional TCP host and port to listen on for connections. If not specified, *:4433 is used.

  • -unix val

    Unix domain socket to accept on.

  • -4

    Use IPv4 only.

  • -6

    Use IPv6 only.

  • -unlink

    For -unix, unlink any existing socket first.

  • -context val

    Sets the SSL context id. It can be given any string value. If this option is not present a default value will be used.

  • -verify int, -Verify int

    The verify depth to use. This specifies the maximum length of the client certificate chain and makes the server request a certificate from the client. With the -verify option a certificate is requested but the client does not have to send one, with the -Verify option the client must supply a certificate or an error occurs.

    If the cipher suite cannot request a client certificate (for example an anonymous cipher suite or PSK) this option has no effect.

  • -cert infile

    The certificate to use, most servers cipher suites require the use of a certificate and some require a certificate with a certain public key type: for example the DSS cipher suites require a certificate containing a DSS (DSA) key. If not specified then the filename server.pem will be used.

  • -cert2 infile

    The certificate file to use for servername; default is server2.pem.

  • -certform DER|PEM|P12

    The server certificate file format; unspecified by default. See openssl-format-options(1) for details.

  • -cert_chain

    A file or URI of untrusted certificates to use when attempting to build the certificate chain related to the certificate specified via the -cert option. The input can be in PEM, DER, or PKCS#12 format.

  • -build_chain

    Specify whether the application should build the server certificate chain to be provided to the client.

  • -serverinfo val

    A file containing one or more blocks of PEM data. Each PEM block must encode a TLS ServerHello extension (2 bytes type, 2 bytes length, followed by \"length\" bytes of extension data). If the client sends an empty TLS ClientHello extension matching the type, the corresponding ServerHello extension will be returned.

  • -key filename|uri

    The private key to use. If not specified then the certificate file will be used.

  • -key2 filename|uri

    The private Key file to use for servername if not given via -cert2.

  • -keyform DER|PEM|P12|ENGINE

    The key format; unspecified by default. See openssl-format-options(1) for details.

  • -pass val

    The private key and certificate file password source. For more information about the format of val, see openssl-passphrase-options(1).

  • -dcert infile, -dkey filename|uri

    Specify an additional certificate and private key, these behave in the same manner as the -cert and -key options except there is no default if they are not specified (no additional certificate and key is used). As noted above some cipher suites require a certificate containing a key of a certain type. Some cipher suites need a certificate carrying an RSA key and some a DSS (DSA) key. By using RSA and DSS certificates and keys a server can support clients which only support RSA or DSS cipher suites by using an appropriate certificate.

  • -dcert_chain

    A file or URI of untrusted certificates to use when attempting to build the server certificate chain when a certificate specified via the -dcert option is in use. The input can be in PEM, DER, or PKCS#12 format.

  • -dcertform DER|PEM|P12

    The format of the additional certificate file; unspecified by default. See openssl-format-options(1) for details.

  • -dkeyform DER|PEM|P12|ENGINE

    The format of the additional private key; unspecified by default. See openssl-format-options(1) for details.

  • -dpass val

    The passphrase for the additional private key and certificate. For more information about the format of val, see openssl-passphrase-options(1).

  • -nbio_test

    Tests non blocking I/O.

  • -crlf

    This option translated a line feed from the terminal into CR+LF.

  • -debug

    Print extensive debugging information including a hex dump of all traffic.

  • -security_debug

    Print output from SSL/TLS security framework.

  • -security_debug_verbose

    Print more output from SSL/TLS security framework

  • -msg

    Show all protocol messages with hex dump.

  • -msgfile outfile

    File to send output of -msg or -trace to, default standard output.

  • -state

    Prints the SSL session states.

  • -CRL infile

    The CRL file to use.

  • -CRLform DER|PEM

    The CRL file format; unspecified by default. See openssl-format-options(1) for details.

  • -crl_download

    Download CRLs from distribution points given in CDP extensions of certificates

  • -verifyCAfile filename

    A file in PEM format CA containing trusted certificates to use for verifying client certificates.

  • -verifyCApath dir

    A directory containing trusted certificates to use for verifying client certificates. This directory must be in \"hash format\", see openssl-verify(1) for more information.

  • -verifyCAstore uri

    The URI of a store containing trusted certificates to use for verifying client certificates.

  • -chainCAfile file

    A file in PEM format containing trusted certificates to use when attempting to build the server certificate chain.

  • -chainCApath dir

    A directory containing trusted certificates to use for building the server certificate chain provided to the client. This directory must be in \"hash format\", see openssl-verify(1) for more information.

  • -chainCAstore uri

    The URI of a store containing trusted certificates to use for building the server certificate chain provided to the client. The URI may indicate a single certificate, as well as a collection of them. With URIs in the file: scheme, this acts as -chainCAfile or -chainCApath, depending on if the URI indicates a directory or a single file. See ossl_store-file(7) for more information on the file: scheme.

  • -nocert

    If this option is set then no certificate is used. This restricts the cipher suites available to the anonymous ones (currently just anonymous DH).

  • -quiet

    Inhibit printing of session and certificate information.

  • -no_resume_ephemeral

    Disable caching and tickets if ephemeral (EC)DH is used.

  • -tlsextdebug

    Print a hex dump of any TLS extensions received from the server.

  • -www

    Sends a status message back to the client when it connects. This includes information about the ciphers used and various session parameters. The output is in HTML format so this option can be used with a web browser. The special URL /renegcert turns on client cert validation, and /reneg tells the server to request renegotiation. The -early_data option cannot be used with this option.

  • -WWW, -HTTP

    Emulates a simple web server. Pages will be resolved relative to the current directory, for example if the URL https://myhost/page.html is requested the file ./page.html will be sent. If the -HTTP flag is used, the files are sent directly, and should contain any HTTP response headers (including status response line). If the -WWW option is used, the response headers are generated by the server, and the file extension is examined to determine the Content-Type header. Extensions of html, htm, and php are text/html and all others are text/plain. In addition, the special URL /stats will return status information like the -www option. Neither of these options can be used in conjunction with -early_data.

  • -http_server_binmode

    When acting as web-server (using option -WWW or -HTTP) open files requested by the client in binary mode.

  • -no_ca_names

    Disable TLS Extension CA Names. You may want to disable it for security reasons or for compatibility with some Windows TLS implementations crashing when this extension is larger than 1024 bytes.

  • -ignore_unexpected_eof

    Some TLS implementations do not send the mandatory close_notify alert on shutdown. If the application tries to wait for the close_notify alert but the peer closes the connection without sending it, an error is generated. When this option is enabled the peer does not need to send the close_notify alert and a closed connection will be treated as if the close_notify alert was received. For more information on shutting down a connection, see SSL_shutdown(3).

  • -servername

    Servername for HostName TLS extension.

  • -servername_fatal

    On servername mismatch send fatal alert (default: warning alert).

  • -id_prefix val

    Generate SSL/TLS session IDs prefixed by val. This is mostly useful for testing any SSL/TLS code (e.g. proxies) that wish to deal with multiple servers, when each of which might be generating a unique range of session IDs (e.g. with a certain prefix).

  • -keymatexport

    Export keying material using label.

  • -keymatexportlen

    Export the given number of bytes of keying material; default 20.

  • -no_cache

    Disable session cache.

  • -ext_cache.

    Disable internal cache, set up and use external cache.

  • -verify_return_error

    Verification errors normally just print a message but allow the connection to continue, for debugging purposes. If this option is used, then verification errors close the connection.

  • -verify_quiet

    No verify output except verify errors.

  • -ign_eof

    Ignore input EOF (default: when -quiet).

  • -no_ign_eof

    Do not ignore input EOF.

  • -no_etm

    Disable Encrypt-then-MAC negotiation.

  • -status

    Enables certificate status request support (aka OCSP stapling).

  • -status_verbose

    Enables certificate status request support (aka OCSP stapling) and gives a verbose printout of the OCSP response.

  • -status_timeout int

    Sets the timeout for OCSP response to int seconds.

  • -proxy [http[s]://][userinfo@]host[:port][/path]

    The HTTP(S) proxy server to use for reaching the OCSP server unless -no_proxy applies, see below. The proxy port defaults to 80 or 443 if the scheme is https; apart from that the optional http:// or https:// prefix is ignored, as well as any userinfo and path components. Defaults to the environment variable http_proxy if set, else HTTP_PROXY in case no TLS is used, otherwise https_proxy if set, else HTTPS_PROXY.

  • -no_proxy addresses

    List of IP addresses and/or DNS names of servers not to use an HTTP(S) proxy for, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Default is from the environment variable no_proxy if set, else NO_PROXY.

  • -status_url val

    Sets a fallback responder URL to use if no responder URL is present in the server certificate. Without this option an error is returned if the server certificate does not contain a responder address. The optional userinfo and fragment URL components are ignored. Any given query component is handled as part of the path component.

  • -status_file infile

    Overrides any OCSP responder URLs from the certificate and always provides the OCSP Response stored in the file. The file must be in DER format.

  • -ssl_config val

    Configure SSL_CTX using the given configuration value.

  • -trace

    Show verbose trace output of protocol messages.

  • -brief

    Provide a brief summary of connection parameters instead of the normal verbose output.

  • -rev

    Simple echo server that sends back received text reversed. Also sets -brief. Cannot be used in conjunction with -early_data.

  • -async

    Switch on asynchronous mode. Cryptographic operations will be performed asynchronously. This will only have an effect if an asynchronous capable engine is also used via the -engine option. For test purposes the dummy async engine (dasync) can be used (if available).

  • -max_send_frag +int

    The maximum size of data fragment to send. See SSL_CTX_set_max_send_fragment(3) for further information.

  • -split_send_frag +int

    The size used to split data for encrypt pipelines. If more data is written in one go than this value then it will be split into multiple pipelines, up to the maximum number of pipelines defined by max_pipelines. This only has an effect if a suitable cipher suite has been negotiated, an engine that supports pipelining has been loaded, and max_pipelines is greater than 1. See SSL_CTX_set_split_send_fragment(3) for further information.

  • -max_pipelines +int

    The maximum number of encrypt/decrypt pipelines to be used. This will only have an effect if an engine has been loaded that supports pipelining (e.g. the dasync engine) and a suitable cipher suite has been negotiated. The default value is 1. See SSL_CTX_set_max_pipelines(3) for further information.

  • -naccept +int

    The server will exit after receiving the specified number of connections, default unlimited.

  • -read_buf +int

    The default read buffer size to be used for connections. This will only have an effect if the buffer size is larger than the size that would otherwise be used and pipelining is in use (see SSL_CTX_set_default_read_buffer_len(3) for further information).

  • -bugs

    There are several known bugs in SSL and TLS implementations. Adding this option enables various workarounds.

  • -no_comp

    Disable negotiation of TLS compression. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

  • -comp

    Enable negotiation of TLS compression. This option was introduced in OpenSSL 1.1.0. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

  • -no_ticket

    Disable RFC4507bis session ticket support. This option has no effect if TLSv1.3 is negotiated. See -num_tickets.

  • -num_tickets

    Control the number of tickets that will be sent to the client after a full handshake in TLSv1.3. The default number of tickets is 2. This option does not affect the number of tickets sent after a resumption handshake.

  • -serverpref

    Use the server's cipher preferences, rather than the client's preferences.

  • -prioritize_chacha

    Prioritize ChaCha ciphers when preferred by clients. Requires -serverpref.

  • -no_resumption_on_reneg

    Set the SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION option.

  • -client_sigalgs val

    Signature algorithms to support for client certificate authentication (colon-separated list).

  • -named_curve val

    Specifies the elliptic curve to use. NOTE: this is single curve, not a list.

    The list of all supported groups includes named EC parameters as well as X25519 and X448 or FFDHE groups, and may also include groups implemented in 3rd-party providers. For a list of named EC parameters, use:

    $ openssl ecparam -list_curves\n
  • -cipher val

    This allows the list of TLSv1.2 and below ciphersuites used by the server to be modified. This list is combined with any TLSv1.3 ciphersuites that have been configured. When the client sends a list of supported ciphers the first client cipher also included in the server list is used. Because the client specifies the preference order, the order of the server cipherlist is irrelevant. See openssl-ciphers(1) for more information.

  • -ciphersuites val

    This allows the list of TLSv1.3 ciphersuites used by the server to be modified. This list is combined with any TLSv1.2 and below ciphersuites that have been configured. When the client sends a list of supported ciphers the first client cipher also included in the server list is used. Because the client specifies the preference order, the order of the server cipherlist is irrelevant. See openssl-ciphers(1) command for more information. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names.

  • -dhparam infile

    The DH parameter file to use. The ephemeral DH cipher suites generate keys using a set of DH parameters. If not specified then an attempt is made to load the parameters from the server certificate file. If this fails then a static set of parameters hard coded into this command will be used.

  • -nbio

    Turns on non blocking I/O.

  • -timeout

    Enable timeouts.

  • -mtu

    Set link-layer MTU.

  • -psk_identity val

    Expect the client to send PSK identity val when using a PSK cipher suite, and warn if they do not. By default, the expected PSK identity is the string \"Client_identity\".

  • -psk_hint val

    Use the PSK identity hint val when using a PSK cipher suite.

  • -psk val

    Use the PSK key val when using a PSK cipher suite. The key is given as a hexadecimal number without leading 0x, for example -psk 1a2b3c4d. This option must be provided in order to use a PSK cipher.

  • -psk_session file

    Use the pem encoded SSL_SESSION data stored in file as the basis of a PSK. Note that this will only work if TLSv1.3 is negotiated.

  • -srpvfile

    The verifier file for SRP. This option is deprecated.

  • -srpuserseed

    A seed string for a default user salt. This option is deprecated.

  • -listen

    This option can only be used in conjunction with one of the DTLS options above. With this option, this command will listen on a UDP port for incoming connections. Any ClientHellos that arrive will be checked to see if they have a cookie in them or not. Any without a cookie will be responded to with a HelloVerifyRequest. If a ClientHello with a cookie is received then this command will connect to that peer and complete the handshake.

  • -sctp

    Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in conjunction with -dtls, -dtls1 or -dtls1_2. This option is only available where OpenSSL has support for SCTP enabled.

  • -sctp_label_bug

    Use the incorrect behaviour of older OpenSSL implementations when computing endpoint-pair shared secrets for DTLS/SCTP. This allows communication with older broken implementations but breaks interoperability with correct implementations. Must be used in conjunction with -sctp. This option is only available where OpenSSL has support for SCTP enabled.

  • -use_srtp

    Offer SRTP key management with a colon-separated profile list.

  • -no_dhe

    If this option is set then no DH parameters will be loaded effectively disabling the ephemeral DH cipher suites.

  • -alpn val, -nextprotoneg val

    These flags enable the Application-Layer Protocol Negotiation or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the IETF standard and replaces NPN. The val list is a comma-separated list of supported protocol names. The list should contain the most desirable protocols first. Protocol names are printable ASCII strings, for example \"http/1.1\" or \"spdy/3\". The flag -nextprotoneg cannot be specified if -tls1_3 is used.

  • -sendfile

    If this option is set and KTLS is enabled, SSL_sendfile() will be used instead of BIO_write() to send the HTTP response requested by a client. This option is only valid if -WWW or -HTTP is specified.

  • -keylogfile outfile

    Appends TLS secrets to the specified keylog file such that external programs (like Wireshark) can decrypt TLS connections.

  • -max_early_data int

    Change the default maximum early data bytes that are specified for new sessions and any incoming early data (when used in conjunction with the -early_data flag). The default value is approximately 16k. The argument must be an integer greater than or equal to 0.

  • -recv_max_early_data int

    Specify the hard limit on the maximum number of early data bytes that will be accepted.

  • -early_data

    Accept early data where possible. Cannot be used in conjunction with -www, -WWW, -HTTP or -rev.

  • -stateless

    Require TLSv1.3 cookies.

  • -anti_replay, -no_anti_replay

    Switches replay protection on or off, respectively. Replay protection is on by default unless overridden by a configuration file. When it is on, OpenSSL will automatically detect if a session ticket has been used more than once, TLSv1.3 has been negotiated, and early data is enabled on the server. A full handshake is forced if a session ticket is used a second or subsequent time. Any early data that was sent will be rejected.

  • -nameopt option

    This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

  • -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3, -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3

    See \"TLS Version Options\" in openssl(1).

  • -dtls, -dtls1, -dtls1_2

    These specify the use of DTLS instead of TLS. See \"TLS Version Options\" in openssl(1).

  • -bugs, -comp, -no_comp, -no_ticket, -serverpref, -client_renegotiation, -legacy_renegotiation, -no_renegotiation, -no_resumption_on_reneg, -legacy_server_connect, -no_legacy_server_connect, -no_etm -allow_no_dhe_kex, -prioritize_chacha, -strict, -sigalgs algs, -client_sigalgs algs, -groups groups, -curves curves, -named_curve curve, -cipher ciphers, -ciphersuites 1.3ciphers, -min_protocol minprot, -max_protocol maxprot, -record_padding padding, -debug_broken_protocol, -no_middlebox

    See \"SUPPORTED COMMAND LINE COMMANDS\" in SSL_CONF_cmd(3) for details.

  • -xkey infile, -xcert file, -xchain file, -xchain_build file, -xcertform DER|PEM, -xkeyform DER|PEM

    Set extended certificate verification options. See \"Extended Verification Options\" in openssl-verification-options(1) for details.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

    If the server requests a client certificate, then verification errors are displayed, for debugging, but the command will proceed unless the -verify_return_error option is used.

"},{"location":"man1/openssl-s_server/#connected-commands","title":"CONNECTED COMMANDS","text":"

If a connection request is established with an SSL client and neither the -www nor the -WWW option has been used then normally any data received from the client is displayed and any key presses will be sent to the client.

Certain commands are also recognized which perform special operations. These commands are a letter which must appear at the start of a line. They are listed below.

  • q

    End the current SSL connection but still accept new connections.

  • Q

    End the current SSL connection and exit.

  • r

    Renegotiate the SSL session (TLSv1.2 and below only).

  • R

    Renegotiate the SSL session and request a client certificate (TLSv1.2 and below only).

  • P

    Send some plain text down the underlying TCP connection: this should cause the client to disconnect due to a protocol violation.

  • S

    Print out some session cache status information.

  • k

    Send a key update message to the client (TLSv1.3 only)

  • K

    Send a key update message to the client and request one back (TLSv1.3 only)

  • c

    Send a certificate request to the client (TLSv1.3 only)

"},{"location":"man1/openssl-s_server/#notes","title":"NOTES","text":"

This command can be used to debug SSL clients. To accept connections from a web browser the command:

openssl s_server -accept 443 -www\n

can be used for example.

Although specifying an empty list of CAs when requesting a client certificate is strictly speaking a protocol violation, some SSL clients interpret this to mean any CA is acceptable. This is useful for debugging purposes.

The session parameters can printed out using the openssl-sess_id(1) command.

"},{"location":"man1/openssl-s_server/#bugs","title":"BUGS","text":"

Because this program has a lot of options and also because some of the techniques used are rather old, the C source for this command is rather hard to read and not a model of how things should be done. A typical SSL server program would be much simpler.

The output of common ciphers is wrong: it just gives the list of ciphers that OpenSSL recognizes and the client supports.

There should be a way for this command to print out details of any unknown cipher suites a client says it supports.

"},{"location":"man1/openssl-s_server/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-sess_id(1), openssl-s_client(1), openssl-ciphers(1), SSL_CONF_cmd(3), SSL_CTX_set_max_send_fragment(3), SSL_CTX_set_split_send_fragment(3), SSL_CTX_set_max_pipelines(3), ossl_store-file(7)

"},{"location":"man1/openssl-s_server/#history","title":"HISTORY","text":"

The -no_alt_chains option was added in OpenSSL 1.1.0.

The -allow-no-dhe-kex and -prioritize_chacha options were added in OpenSSL 1.1.1.

The -srpvfile, -srpuserseed, and -engine option were deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-s_server/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-s_time/","title":"openssl-s_time","text":""},{"location":"man1/openssl-s_time/#name","title":"NAME","text":"

openssl-s_time - SSL/TLS performance timing program

"},{"location":"man1/openssl-s_time/#synopsis","title":"SYNOPSIS","text":"

openssl s_time [-help] [-connect host:port] [-www page] [-cert filename] [-key filename] [-reuse] [-new] [-verify depth] [-time seconds] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-bugs] [-cipher cipherlist] [-ciphersuites val] [-nameopt option] [-cafile file] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-s_time/#description","title":"DESCRIPTION","text":"

This command implements a generic SSL/TLS client which connects to a remote host using SSL/TLS. It can request a page from the server and includes the time to transfer the payload data in its timing measurements. It measures the number of connections within a given timeframe, the amount of data transferred (if any), and calculates the average time spent for one connection.

"},{"location":"man1/openssl-s_time/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -connect host:port

    This specifies the host and optional port to connect to.

  • -www page

    This specifies the page to GET from the server. A value of '/' gets the index.html page. If this parameter is not specified, then this command will only perform the handshake to establish SSL connections but not transfer any payload data.

  • -cert certname

    The certificate to use, if one is requested by the server. The default is not to use a certificate. The file is in PEM format.

  • -key keyfile

    The private key to use. If not specified then the certificate file will be used. The file is in PEM format.

  • -verify depth

    The verify depth to use. This specifies the maximum length of the server certificate chain and turns on server certificate verification. Currently the verify operation continues after errors so all the problems with a certificate chain can be seen. As a side effect the connection will never fail due to a server certificate verify failure.

  • -new

    Performs the timing test using a new session ID for each connection. If neither -new nor -reuse are specified, they are both on by default and executed in sequence.

  • -reuse

    Performs the timing test using the same session ID; this can be used as a test that session caching is working. If neither -new nor -reuse are specified, they are both on by default and executed in sequence.

  • -bugs

    There are several known bugs in SSL and TLS implementations. Adding this option enables various workarounds.

  • -cipher cipherlist

    This allows the TLSv1.2 and below cipher list sent by the client to be modified. This list will be combined with any TLSv1.3 ciphersuites that have been configured. Although the server determines which cipher suite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information.

  • -ciphersuites val

    This allows the TLSv1.3 ciphersuites sent by the client to be modified. This list will be combined with any TLSv1.2 and below ciphersuites that have been configured. Although the server determines which cipher suite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names.

  • -time length

    Specifies how long (in seconds) this command should establish connections and optionally transfer payload data from a server. Server and client performance and the link speed determine how many connections it can establish.

  • -nameopt option

    This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -cafile file

    This is an obsolete synonym for -CAfile.

  • -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3

    See \"TLS Version Options\" in openssl(1).

"},{"location":"man1/openssl-s_time/#notes","title":"NOTES","text":"

This command can be used to measure the performance of an SSL connection. To connect to an SSL HTTP server and get the default page the command

openssl s_time -connect servername:443 -www / -CApath yourdir -CAfile yourfile.pem -cipher commoncipher [-ssl3]\n

would typically be used (https uses port 443). commoncipher is a cipher to which both client and server can agree, see the openssl-ciphers(1) command for details.

If the handshake fails then there are several possible causes, if it is nothing obvious like no client certificate then the -bugs and -ssl3 options can be tried in case it is a buggy server. In particular you should play with these options before submitting a bug report to an OpenSSL mailing list.

A frequent problem when attempting to get client certificates working is that a web client complains it has no certificates or gives an empty list to choose from. This is normally because the server is not sending the clients certificate authority in its \"acceptable CA list\" when it requests a certificate. By using openssl-s_client(1) the CA list can be viewed and checked. However, some servers only request client authentication after a specific URL is requested. To obtain the list in this case it is necessary to use the -prexit option of openssl-s_client(1) and send an HTTP request for an appropriate page.

If a certificate is specified on the command line using the -cert option it will not be used unless the server specifically requests a client certificate. Therefore, merely including a client certificate on the command line is no guarantee that the certificate works.

"},{"location":"man1/openssl-s_time/#bugs","title":"BUGS","text":"

Because this program does not have all the options of the openssl-s_client(1) program to turn protocols on and off, you may not be able to measure the performance of all protocols with all servers.

The -verify option should really exit if the server verification fails.

"},{"location":"man1/openssl-s_time/#history","title":"HISTORY","text":"

The -cafile option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-s_time/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-s_client(1), openssl-s_server(1), openssl-ciphers(1), ossl_store-file(7)

"},{"location":"man1/openssl-s_time/#copyright","title":"COPYRIGHT","text":"

Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-sess_id/","title":"openssl-sess_id","text":""},{"location":"man1/openssl-sess_id/#name","title":"NAME","text":"

openssl-sess_id - SSL/TLS session handling command

"},{"location":"man1/openssl-sess_id/#synopsis","title":"SYNOPSIS","text":"

openssl sess_id [-help] [-inform DER|PEM] [-outform DER|PEM|NSS] [-in filename] [-out filename] [-text] [-cert] [-noout] [-context ID]

"},{"location":"man1/openssl-sess_id/#description","title":"DESCRIPTION","text":"

This command processes the encoded version of the SSL session structure and optionally prints out SSL session details (for example the SSL session master key) in human readable format. Since this is a diagnostic tool that needs some knowledge of the SSL protocol to use properly, most users will not need to use it.

The precise format of the data can vary across OpenSSL versions and is not documented.

"},{"location":"man1/openssl-sess_id/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -inform DER|PEM, -outform DER|PEM|NSS

    The input and output formats; the default is PEM. See openssl-format-options(1) for details.

    For NSS output, the session ID and master key are reported in NSS \"keylog\" format.

  • -in filename

    This specifies the input filename to read session information from or standard input by default.

  • -out filename

    This specifies the output filename to write session information to or standard output if this option is not specified.

  • -text

    Prints out the various public or private key components in plain text in addition to the encoded version.

  • -cert

    If a certificate is present in the session it will be output using this option, if the -text option is also present then it will be printed out in text form.

  • -noout

    This option prevents output of the encoded version of the session.

  • -context ID

    This option can set the session id so the output session information uses the supplied ID. The ID can be any string of characters. This option won't normally be used.

"},{"location":"man1/openssl-sess_id/#output","title":"OUTPUT","text":"

Typical output:

SSL-Session:\n    Protocol  : TLSv1\n    Cipher    : 0016\n    Session-ID: 871E62626C554CE95488823752CBD5F3673A3EF3DCE9C67BD916C809914B40ED\n    Session-ID-ctx: 01000000\n    Master-Key: A7CEFC571974BE02CAC305269DC59F76EA9F0B180CB6642697A68251F2D2BB57E51DBBB4C7885573192AE9AEE220FACD\n    Key-Arg   : None\n    Start Time: 948459261\n    Timeout   : 300 (sec)\n    Verify return code 0 (ok)\n

These are described below in more detail.

  • Protocol

    This is the protocol in use TLSv1.3, TLSv1.2, TLSv1.1, TLSv1 or SSLv3.

  • Cipher

    The cipher used this is the actual raw SSL or TLS cipher code, see the SSL or TLS specifications for more information.

  • Session-ID

    The SSL session ID in hex format.

  • Session-ID-ctx

    The session ID context in hex format.

  • Master-Key

    This is the SSL session master key.

  • Start Time

    This is the session start time represented as an integer in standard Unix format.

  • Timeout

    The timeout in seconds.

  • Verify return code

    This is the return code when an SSL client certificate is verified.

"},{"location":"man1/openssl-sess_id/#notes","title":"NOTES","text":"

Since the SSL session output contains the master key it is possible to read the contents of an encrypted session using this information. Therefore, appropriate security precautions should be taken if the information is being output by a \"real\" application. This is however strongly discouraged and should only be used for debugging purposes.

"},{"location":"man1/openssl-sess_id/#bugs","title":"BUGS","text":"

The cipher and start time should be printed out in human readable form.

"},{"location":"man1/openssl-sess_id/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-ciphers(1), openssl-s_server(1)

"},{"location":"man1/openssl-sess_id/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-smime/","title":"openssl-smime","text":""},{"location":"man1/openssl-smime/#name","title":"NAME","text":"

openssl-smime - S/MIME command

"},{"location":"man1/openssl-smime/#synopsis","title":"SYNOPSIS","text":"

openssl smime [-help] [-encrypt] [-decrypt] [-sign] [-resign] [-verify] [-pk7out] [-binary] [-crlfeol] [-cipher] [-in file] [-certfile file] [-signer file] [-nointern] [-noverify] [-nochain] [-nosigs] [-nocerts] [-noattr] [-nodetach] [-nosmimecap] [-recip _ file_] [-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-inkey filename|uri] [-out file] [-content file] [-to addr] [-from ad] [-subject s] [-text] [-indef] [-noindef] [-stream] [-md digest] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-engine id] [-rand files] [-writerand file] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq] [-config configfile] recipcert ...

"},{"location":"man1/openssl-smime/#description","title":"DESCRIPTION","text":"

This command handles S/MIME mail. It can encrypt, decrypt, sign and verify S/MIME messages.

"},{"location":"man1/openssl-smime/#options","title":"OPTIONS","text":"

There are six operation options that set the type of operation to be performed. The meaning of the other options varies according to the operation type.

  • -help

    Print out a usage message.

  • -encrypt

    Encrypt mail for the given recipient certificates. Input file is the message to be encrypted. The output file is the encrypted mail in MIME format.

    Note that no revocation check is done for the recipient cert, so if that key has been compromised, others may be able to decrypt the text.

  • -decrypt

    Decrypt mail using the supplied certificate and private key. Expects an encrypted mail message in MIME format for the input file. The decrypted mail is written to the output file.

  • -sign

    Sign mail using the supplied certificate and private key. Input file is the message to be signed. The signed message in MIME format is written to the output file.

  • -verify

    Verify signed mail. Expects a signed mail message on input and outputs the signed data. Both clear text and opaque signing is supported.

  • -pk7out

    Takes an input message and writes out a PEM encoded PKCS#7 structure.

  • -resign

    Resign a message: take an existing message and one or more new signers.

  • -in filename

    The input message to be encrypted or signed or the MIME message to be decrypted or verified.

  • -out filename

    The message text that has been decrypted or verified or the output MIME format message that has been signed or verified.

  • -inform DER|PEM|SMIME

    The input format of the PKCS#7 (S/MIME) structure (if one is being read); the default is SMIME. See openssl-format-options(1) for details.

  • -outform DER|PEM|SMIME

    The output format of the PKCS#7 (S/MIME) structure (if one is being written); the default is SMIME. See openssl-format-options(1) for details.

  • -keyform DER|PEM|P12|ENGINE

    The key format; unspecified by default. See openssl-format-options(1) for details.

  • -stream, -indef, -noindef

    The -stream and -indef options are equivalent and enable streaming I/O for encoding operations. This permits single pass processing of data without the need to hold the entire contents in memory, potentially supporting very large files. Streaming is automatically set for S/MIME signing with detached data if the output format is SMIME it is currently off by default for all other operations.

  • -noindef

    Disable streaming I/O where it would produce and indefinite length constructed encoding. This option currently has no effect. In future streaming will be enabled by default on all relevant operations and this option will disable it.

  • -content filename

    This specifies a file containing the detached content, this is only useful with the -verify command. This is only usable if the PKCS#7 structure is using the detached signature form where the content is not included. This option will override any content if the input format is S/MIME and it uses the multipart/signed MIME content type.

  • -text

    This option adds plain text (text/plain) MIME headers to the supplied message if encrypting or signing. If decrypting or verifying it strips off text headers: if the decrypted or verified message is not of MIME type text/plain then an error occurs.

  • -md digest

    Digest algorithm to use when signing or resigning. If not present then the default digest algorithm for the signing key will be used (usually SHA1).

  • -cipher

    The encryption algorithm to use. For example DES (56 bits) - -des, triple DES (168 bits) - -des3, EVP_get_cipherbyname() function) can also be used preceded by a dash, for example -aes-128-cbc. See openssl-enc(1) for list of ciphers supported by your version of OpenSSL.

    If not specified triple DES is used. Only used with -encrypt.

  • -nointern

    When verifying a message normally certificates (if any) included in the message are searched for the signing certificate. With this option only the certificates specified in the -certfile option are used. The supplied certificates can still be used as untrusted CAs however.

  • -noverify

    Do not verify the signers certificate of a signed message.

  • -nochain

    Do not do chain verification of signers certificates; that is, do not use the certificates in the signed message as untrusted CAs.

  • -nosigs

    Don't try to verify the signatures on the message.

  • -nocerts

    When signing a message, the signer's certificate is normally included. With this option it is excluded. This will reduce the size of the signed message, but the verifier must have a copy of the signers certificate available locally (passed using the -certfile option for example).

  • -noattr

    Normally, when a message is signed, a set of attributes are included which include the signing time and supported symmetric algorithms. With this option they are not included.

  • -nodetach

    When signing a message use opaque signing. This form is more resistant to translation by mail relays but it cannot be read by mail agents that do not support S/MIME. Without this option cleartext signing with the MIME type multipart/signed is used.

  • -nosmimecap

    When signing a message, do not include the SMIMECapabilities attribute.

  • -binary

    Normally the input message is converted to \"canonical\" format which is effectively using CR and LF as end of line: as required by the S/MIME specification. When this option is present no translation occurs. This is useful when handling binary data which may not be in MIME format.

  • -crlfeol

    Normally the output file uses a single LF as end of line. When this option is present CRLF is used instead.

  • -certfile file

    Allows additional certificates to be specified. When signing these will be included with the message. When verifying these will be searched for the signers certificates. The input can be in PEM, DER, or PKCS#12 format.

  • -signer file

    A signing certificate when signing or resigning a message, this option can be used multiple times if more than one signer is required. If a message is being verified then the signers certificates will be written to this file if the verification was successful.

  • -recip file

    The recipients certificate when decrypting a message. This certificate must match one of the recipients of the message or an error occurs.

  • -inkey filename|uri

    The private key to use when signing or decrypting. This must match the corresponding certificate. If this option is not specified then the private key must be included in the certificate file specified with the -recip or -signer file. When signing this option can be used multiple times to specify successive keys.

  • -passin arg

    The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -to, -from, -subject

    The relevant mail headers. These are included outside the signed portion of a message so they may be included manually. If signing then many S/MIME mail clients check the signers certificate's email address matches that specified in the From: address.

  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

    Any verification errors cause the command to exit.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -config configfile

    See \"Configuration Option\" in openssl(1).

  • recipcert ...

    One or more certificates of message recipients, used when encrypting a message.

"},{"location":"man1/openssl-smime/#notes","title":"NOTES","text":"

The MIME message must be sent without any blank lines between the headers and the output. Some mail programs will automatically add a blank line. Piping the mail directly to sendmail is one way to achieve the correct format.

The supplied message to be signed or encrypted must include the necessary MIME headers or many S/MIME clients won't display it properly (if at all). You can use the -text option to automatically add plain text headers.

A \"signed and encrypted\" message is one where a signed message is then encrypted. This can be produced by encrypting an already signed message: see the examples section.

This version of the program only allows one signer per message but it will verify multiple signers on received messages. Some S/MIME clients choke if a message contains multiple signers. It is possible to sign messages \"in parallel\" by signing an already signed message.

The options -encrypt and -decrypt reflect common usage in S/MIME clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7 encrypted data is used for other purposes.

The -resign option uses an existing message digest when adding a new signer. This means that attributes must be present in at least one existing signer using the same message digest or this operation will fail.

The -stream and -indef options enable streaming I/O support. As a result the encoding is BER using indefinite length constructed encoding and no longer DER. Streaming is supported for the -encrypt operation and the -sign operation if the content is not detached.

Streaming is always used for the -sign operation with detached data but since the content is no longer part of the PKCS#7 structure the encoding remains DER.

"},{"location":"man1/openssl-smime/#exit-codes","title":"EXIT CODES","text":"
  • 0

    The operation was completely successfully.

  • 1

    An error occurred parsing the command options.

  • 2

    One of the input files could not be read.

  • 3

    An error occurred creating the PKCS#7 file or when reading the MIME message.

  • 4

    An error occurred decrypting or verifying the message.

  • 5

    The message was verified correctly but an error occurred writing out the signers certificates.

"},{"location":"man1/openssl-smime/#examples","title":"EXAMPLES","text":"

Create a cleartext signed message:

openssl smime -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem\n

Create an opaque signed message:

openssl smime -sign -in message.txt -text -out mail.msg -nodetach \\\n       -signer mycert.pem\n

Create a signed message, include some additional certificates and read the private key from another file:

openssl smime -sign -in in.txt -text -out mail.msg \\\n       -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem\n

Create a signed message with two signers:

openssl smime -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem -signer othercert.pem\n

Send a signed message under Unix directly to sendmail, including headers:

openssl smime -sign -in in.txt -text -signer mycert.pem \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed message\" | sendmail someone@somewhere\n

Verify a message and extract the signer's certificate if successful:

openssl smime -verify -in mail.msg -signer user.pem -out signedtext.txt\n

Send encrypted mail using triple DES:

openssl smime -encrypt -in in.txt -from steve@openssl.org \\\n       -to someone@somewhere -subject \"Encrypted message\" \\\n       -des3 user.pem -out mail.msg\n

Sign and encrypt mail:

openssl smime -sign -in ml.txt -signer my.pem -text \\\n       | openssl smime -encrypt -out mail.msg \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed and Encrypted message\" -des3 user.pem\n

Note: the encryption command does not include the -text option because the message being encrypted already has MIME headers.

Decrypt mail:

openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem\n

The output from Netscape form signing is a PKCS#7 structure with the detached signature format. You can use this program to verify the signature by line wrapping the base64 encoded structure and surrounding it with:

-----BEGIN PKCS7-----\n-----END PKCS7-----\n

and using the command:

openssl smime -verify -inform PEM -in signature.pem -content content.txt\n

Alternatively you can base64 decode the signature and use:

openssl smime -verify -inform DER -in signature.der -content content.txt\n

Create an encrypted message using 128 bit Camellia:

openssl smime -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem\n

Add a signer to an existing message:

openssl smime -resign -in mail.msg -signer newsign.pem -out mail2.msg\n
"},{"location":"man1/openssl-smime/#bugs","title":"BUGS","text":"

The MIME parser isn't very clever: it seems to handle most messages that I've thrown at it but it may choke on others.

The code currently will only write out the signer's certificate to a file: if the signer has a separate encryption certificate this must be manually extracted. There should be some heuristic that determines the correct encryption certificate.

Ideally a database should be maintained of a certificates for each email address.

The code doesn't currently take note of the permitted symmetric encryption algorithms as supplied in the SMIMECapabilities signed attribute. This means the user has to manually include the correct encryption algorithm. It should store the list of permitted ciphers in a database and only use those.

No revocation checking is done on the signer's certificate.

The current code can only handle S/MIME v2 messages, the more complex S/MIME v3 structures may cause parsing errors.

"},{"location":"man1/openssl-smime/#see-also","title":"SEE ALSO","text":"

ossl_store-file(7)

"},{"location":"man1/openssl-smime/#history","title":"HISTORY","text":"

The use of multiple -signer options and the -resign command were first added in OpenSSL 1.0.0

The -no_alt_chains option was added in OpenSSL 1.1.0.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-smime/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-speed/","title":"openssl-speed","text":""},{"location":"man1/openssl-speed/#name","title":"NAME","text":"

openssl-speed - test library performance

"},{"location":"man1/openssl-speed/#synopsis","title":"SYNOPSIS","text":"

openssl speed [-help] [-config filename] [-elapsed] [-evp algo] [-hmac algo] [-cmac algo] [-mb] [-aead] [-multi num] [-async_jobs num] [-misalign num] [-decrypt] [-primes num] [-seconds num] [-bytes num] [-mr] [-mlock] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [algorithm ...]

"},{"location":"man1/openssl-speed/#description","title":"DESCRIPTION","text":"

This command is used to test the performance of cryptographic algorithms.

"},{"location":"man1/openssl-speed/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -config filename

    Specifies the configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

  • -elapsed

    When calculating operations- or bytes-per-second, use wall-clock time instead of CPU user time as divisor. It can be useful when testing speed of hardware engines.

  • -evp algo

    Use the specified cipher or message digest algorithm via the EVP interface. If algo is an AEAD cipher, then you can pass -aead to benchmark a TLS-like sequence. And if algo is a multi-buffer capable cipher, e.g. aes-128-cbc-hmac-sha1, then -mb will time multi-buffer operation.

    To see the algorithms supported with this option, use openssl list -digest-algorithms or openssl list -cipher-algorithms command.

  • -multi num

    Run multiple operations in parallel.

  • -async_jobs num

    Enable async mode and start specified number of jobs.

  • -misalign num

    Misalign the buffers by the specified number of bytes.

  • -hmac digest

    Time the HMAC algorithm using the specified message digest.

  • -cmac cipher

    Time the CMAC algorithm using the specified cipher e.g. openssl speed -cmac aes128.

  • -decrypt

    Time the decryption instead of encryption. Affects only the EVP testing.

  • -mb

    Enable multi-block mode on EVP-named cipher.

  • -aead

    Benchmark EVP-named AEAD cipher in TLS-like sequence.

  • -primes num

    Generate a num-prime RSA key and use it to run the benchmarks. This option is only effective if RSA algorithm is specified to test.

  • -seconds num

    Run benchmarks for num seconds.

  • -bytes num

    Run benchmarks on num-byte buffers. Affects ciphers, digests and the CSPRNG. The limit on the size of the buffer is INT_MAX - 64 bytes, which for a 32-bit int would be 2147483583 bytes.

  • -mr

    Produce the summary in a mechanical, machine-readable, format.

  • -mlock

    Lock memory into RAM for more deterministic measurements.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • algorithm ...

    If any algorithm is given, then those algorithms are tested, otherwise a pre-compiled grand selection is tested.

"},{"location":"man1/openssl-speed/#bugs","title":"BUGS","text":"

The algorithm can be selected only from a pre-compiled subset of things that the openssl speed command knows about. To test any additional digest or cipher algorithm supported by OpenSSL use the -evp option.

There is no way to test the speed of any additional public key algorithms supported by third party providers with the openssl speed command.

"},{"location":"man1/openssl-speed/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-speed/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-spkac/","title":"openssl-spkac","text":""},{"location":"man1/openssl-spkac/#name","title":"NAME","text":"

openssl-spkac - SPKAC printing and generating command

"},{"location":"man1/openssl-spkac/#synopsis","title":"SYNOPSIS","text":"

openssl spkac [-help] [-in filename] [-out filename] [-digest digest] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-challenge string] [-pubkey] [-spkac spkacname] [-spksect section] [-noout] [-verify] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-spkac/#description","title":"DESCRIPTION","text":"

This command processes Netscape signed public key and challenge (SPKAC) files. It can print out their contents, verify the signature and produce its own SPKACs from a supplied private key.

"},{"location":"man1/openssl-spkac/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -in filename

    This specifies the input filename to read from or standard input if this option is not specified. Ignored if the -key option is used.

  • -out filename

    Specifies the output filename to write to or standard output by default.

  • -digest digest

    Use the specified digest to sign a created SPKAC file. The default digest algorithm is MD5.

  • -key filename|uri

    Create an SPKAC file using the private key specified by filename or uri. The -in, -noout, -spksect and -verify options are ignored if present.

  • -keyform DER|PEM|P12|ENGINE

    The key format; unspecified by default. See openssl-format-options(1) for details.

  • -passin arg

    The input file password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -challenge string

    Specifies the challenge string if an SPKAC is being created.

  • -spkac spkacname

    Allows an alternative name form the variable containing the SPKAC. The default is \"SPKAC\". This option affects both generated and input SPKAC files.

  • -spksect section

    Allows an alternative name form the section containing the SPKAC. The default is the default section.

  • -noout

    Don't output the text version of the SPKAC (not used if an SPKAC is being created).

  • -pubkey

    Output the public key of an SPKAC (not used if an SPKAC is being created).

  • -verify

    Verifies the digital signature on the supplied SPKAC.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-spkac/#examples","title":"EXAMPLES","text":"

Print out the contents of an SPKAC:

openssl spkac -in spkac.cnf\n

Verify the signature of an SPKAC:

openssl spkac -in spkac.cnf -noout -verify\n

Create an SPKAC using the challenge string \"hello\":

openssl spkac -key key.pem -challenge hello -out spkac.cnf\n

Example of an SPKAC, (long lines split up for clarity):

SPKAC=MIG5MGUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA\\\n1cCoq2Wa3Ixs47uI7FPVwHVIPDx5yso105Y6zpozam135a\\\n8R0CpoRvkkigIyXfcCjiVi5oWk+6FfPaD03uPFoQIDAQAB\\\nFgVoZWxsbzANBgkqhkiG9w0BAQQFAANBAFpQtY/FojdwkJ\\\nh1bEIYuc2EeM2KHTWPEepWYeawvHD0gQ3DngSC75YCWnnD\\\ndq+NQ3F+X4deMx9AaEglZtULwV4=\n
"},{"location":"man1/openssl-spkac/#notes","title":"NOTES","text":"

A created SPKAC with suitable DN components appended can be fed to openssl-ca(1).

SPKACs are typically generated by Netscape when a form is submitted containing the KEYGEN tag as part of the certificate enrollment process.

The challenge string permits a primitive form of proof of possession of private key. By checking the SPKAC signature and a random challenge string some guarantee is given that the user knows the private key corresponding to the public key being certified. This is important in some applications. Without this it is possible for a previous SPKAC to be used in a \"replay attack\".

"},{"location":"man1/openssl-spkac/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-ca(1)

"},{"location":"man1/openssl-spkac/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

The -digest option was added in OpenSSL 3.0.

"},{"location":"man1/openssl-spkac/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-srp/","title":"openssl-srp","text":""},{"location":"man1/openssl-srp/#name","title":"NAME","text":"

openssl-srp - maintain SRP password file

"},{"location":"man1/openssl-srp/#synopsis","title":"SYNOPSIS","text":"

openssl srp [-help] [-verbose] [-add] [-modify] [-delete] [-list] [-name section] [-srpvfile file] [-gn identifier] [-userinfo text] [-passin arg] [-passout arg] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [-config configfile] [user ...]

"},{"location":"man1/openssl-srp/#description","title":"DESCRIPTION","text":"

This command is deprecated. It is used to maintain an SRP (secure remote password) file. At most one of the -add, -modify, -delete, and -list options can be specified. These options take zero or more usernames as parameters and perform the appropriate operation on the SRP file. For -list, if no user is given then all users are displayed.

The configuration file to use, and the section within the file, can be specified with the -config and -name flags, respectively.

"},{"location":"man1/openssl-srp/#options","title":"OPTIONS","text":"
  • -help

    Display an option summary.

  • -verbose

    Generate verbose output while processing.

  • -add

    Add a user and SRP verifier.

  • -modify

    Modify the SRP verifier of an existing user.

  • -delete

    Delete user from verifier file.

  • -list

    List users.

  • -name

    The particular SRP definition to use.

  • -srpvfile file

    If the config file is not specified, -srpvfile can be used to specify the file to operate on.

  • -gn

    Specifies the g and N values, using one of the strengths defined in IETF RFC 5054.

  • -userinfo

    specifies additional information to add when adding or modifying a user.

  • -passin arg, -passout arg

    The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • -config configfile

    See \"Configuration Option\" in openssl(1).

    [-rand files] [-writerand file]

"},{"location":"man1/openssl-srp/#history","title":"HISTORY","text":"

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-srp/#copyright","title":"COPYRIGHT","text":"

Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-storeutl/","title":"openssl-storeutl","text":""},{"location":"man1/openssl-storeutl/#name","title":"NAME","text":"

openssl-storeutl - STORE command

"},{"location":"man1/openssl-storeutl/#synopsis","title":"SYNOPSIS","text":"

openssl storeutl [-help] [-out file] [-noout] [-passin arg] [-text arg] [-r] [-certs] [-keys] [-crls] [-subject arg] [-issuer arg] [-serial arg] [-alias arg] [-fingerprint arg] [-digest] [-engine id] [-provider name] [-provider-path path] [-propquery propq] uri

"},{"location":"man1/openssl-storeutl/#description","title":"DESCRIPTION","text":"

This command can be used to display the contents (after decryption as the case may be) fetched from the given URI.

"},{"location":"man1/openssl-storeutl/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -out filename

    specifies the output filename to write to or standard output by default.

  • -noout

    this option prevents output of the PEM data.

  • -passin arg

    the key password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -text

    Prints out the objects in text form, similarly to the -text output from openssl-x509(1), openssl-pkey(1), etc.

  • -r

    Fetch objects recursively when possible.

  • -certs

  • -keys
  • -crls

    Only select the certificates, keys or CRLs from the given URI. However, if this URI would return a set of names (URIs), those are always returned.

    Note that all options must be given before the uri argument. Otherwise they are ignored.

    Note -keys selects exclusively private keys, there is no selector for public keys only.

  • -subject arg

    Search for an object having the subject name arg.

    The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted but are ignored for the search. That is, a search with an empty value will have the same effect as not specifying the type at all. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set.

    Example:

    /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

  • -issuer arg

  • -serial arg

    Search for an object having the given issuer name and serial number. These two options must be used together. The issuer arg must be formatted as /type0=value0/type1=value1/type2=..., characters may be escaped by \\ (backslash), no spaces are skipped. The serial arg may be specified as a decimal value or a hex value if preceded by 0x.

  • -alias arg

    Search for an object having the given alias.

  • -fingerprint arg

    Search for an object having the given fingerprint.

  • -digest

    The digest that was used to compute the fingerprint given with -fingerprint.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-storeutl/#see-also","title":"SEE ALSO","text":"

openssl(1)

"},{"location":"man1/openssl-storeutl/#history","title":"HISTORY","text":"

This command was added in OpenSSL 1.1.1.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-storeutl/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-ts/","title":"openssl-ts","text":""},{"location":"man1/openssl-ts/#name","title":"NAME","text":"

openssl-ts - Time Stamping Authority command

"},{"location":"man1/openssl-ts/#synopsis","title":"SYNOPSIS","text":"

openssl ts -help

openssl ts -query [-config configfile] [-data file_to_hash] [-digest digest_bytes] [-digest] [-tspolicy object_id] [-no_nonce] [-cert] [-in request.tsq] [-out request.tsq] [-text] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

openssl ts -reply [-config configfile] [-section tsa_section] [-queryfile request.tsq] [-passin password_src] [-signer tsa_cert.pem] [-inkey filename|uri] [-digest] [-chain certs_file.pem] [-tspolicy object_id] [-in response.tsr] [-token_in] [-out response.tsr] [-token_out] [-text] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

openssl ts -verify [-data file_to_hash] [-digest digest_bytes] [-queryfile request.tsq] [-in response.tsr] [-token_in] [-untrusted files|uris] [-CAfile file] [-CApath dir] [-CAstore uri] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-ts/#description","title":"DESCRIPTION","text":"

This command is a basic Time Stamping Authority (TSA) client and server application as specified in RFC 3161 (Time-Stamp Protocol, TSP). A TSA can be part of a PKI deployment and its role is to provide long term proof of the existence of a certain datum before a particular time. Here is a brief description of the protocol:

  1. The TSA client computes a one-way hash value for a data file and sends the hash to the TSA.
  2. The TSA attaches the current date and time to the received hash value, signs them and sends the timestamp token back to the client. By creating this token the TSA certifies the existence of the original data file at the time of response generation.
  3. The TSA client receives the timestamp token and verifies the signature on it. It also checks if the token contains the same hash value that it had sent to the TSA.

There is one DER encoded protocol data unit defined for transporting a timestamp request to the TSA and one for sending the timestamp response back to the client. This command has three main functions: creating a timestamp request based on a data file, creating a timestamp response based on a request, verifying if a response corresponds to a particular request or a data file.

There is no support for sending the requests/responses automatically over HTTP or TCP yet as suggested in RFC 3161. The users must send the requests either by ftp or e-mail.

"},{"location":"man1/openssl-ts/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -query

    Generate a TS query. For details see \"Timestamp Request generation\".

  • -reply

    Generate a TS reply. For details see \"Timestamp Response generation\".

  • -verify

    Verify a TS response. For details see \"Timestamp Response verification\".

"},{"location":"man1/openssl-ts/#timestamp-request-generation","title":"Timestamp Request generation","text":"

The -query command can be used for creating and printing a timestamp request with the following options:

  • -config configfile

    The configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

  • -data file_to_hash

    The data file for which the timestamp request needs to be created. stdin is the default if neither the -data nor the -digest parameter is specified. (Optional)

  • -digest digest_bytes

    It is possible to specify the message imprint explicitly without the data file. The imprint must be specified in a hexadecimal format, two characters per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or 1AF601...). The number of bytes must match the message digest algorithm in use. (Optional)

  • -digest

    The message digest to apply to the data file. Any digest supported by the openssl-dgst(1) command can be used. The default is SHA-256. (Optional)

  • -tspolicy object_id

    The policy that the client expects the TSA to use for creating the timestamp token. Either the dotted OID notation or OID names defined in the config file can be used. If no policy is requested the TSA will use its own default policy. (Optional)

  • -no_nonce

    No nonce is specified in the request if this option is given. Otherwise, a 64-bit long pseudo-random nonce is included in the request. It is recommended to use a nonce to protect against replay attacks. (Optional)

  • -cert

    The TSA is expected to include its signing certificate in the response. (Optional)

  • -in request.tsq

    This option specifies a previously created timestamp request in DER format that will be printed into the output file. Useful when you need to examine the content of a request in human-readable format. (Optional)

  • -out request.tsq

    Name of the output file to which the request will be written. Default is stdout. (Optional)

  • -text

    If this option is specified the output is human-readable text format instead of DER. (Optional)

  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

"},{"location":"man1/openssl-ts/#timestamp-response-generation","title":"Timestamp Response generation","text":"

A timestamp response (TimeStampResp) consists of a response status and the timestamp token itself (ContentInfo), if the token generation was successful. The -reply command is for creating a timestamp response or timestamp token based on a request and printing the response/token in human-readable format. If -token_out is not specified the output is always a timestamp response (TimeStampResp), otherwise it is a timestamp token (ContentInfo).

  • -config configfile

    The configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1). See \"CONFIGURATION FILE OPTIONS\" for configurable variables.

  • -section tsa_section

    The name of the config file section containing the settings for the response generation. If not specified the default TSA section is used, see \"CONFIGURATION FILE OPTIONS\" for details. (Optional)

  • -queryfile request.tsq

    The name of the file containing a DER encoded timestamp request. (Optional)

  • -passin password_src

    Specifies the password source for the private key of the TSA. See description in openssl(1). (Optional)

  • -signer tsa_cert.pem

    The signer certificate of the TSA in PEM format. The TSA signing certificate must have exactly one extended key usage assigned to it: timeStamping. The extended key usage must also be critical, otherwise the certificate is going to be refused. Overrides the signer_cert variable of the config file. (Optional)

  • -inkey filename|uri

    The signer private key of the TSA in PEM format. Overrides the signer_key config file option. (Optional)

  • -digest

    Signing digest to use. Overrides the signer_digest config file option. (Mandatory unless specified in the config file)

  • -chain certs_file.pem

    The collection of certificates in PEM format that will all be included in the response in addition to the signer certificate if the -cert option was used for the request. This file is supposed to contain the certificate chain for the signer certificate from its issuer upwards. The -reply command does not build a certificate chain automatically. (Optional)

  • -tspolicy object_id

    The default policy to use for the response unless the client explicitly requires a particular TSA policy. The OID can be specified either in dotted notation or with its name. Overrides the default_policy config file option. (Optional)

  • -in response.tsr

    Specifies a previously created timestamp response or timestamp token (if -token_in is also specified) in DER format that will be written to the output file. This option does not require a request, it is useful e.g. when you need to examine the content of a response or token or you want to extract the timestamp token from a response. If the input is a token and the output is a timestamp response a default 'granted' status info is added to the token. (Optional)

  • -token_in

    This flag can be used together with the -in option and indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)

  • -out response.tsr

    The response is written to this file. The format and content of the file depends on other options (see -text, -token_out). The default is stdout. (Optional)

  • -token_out

    The output is a timestamp token (ContentInfo) instead of timestamp response (TimeStampResp). (Optional)

  • -text

    If this option is specified the output is human-readable text format instead of DER. (Optional)

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-ts/#timestamp-response-verification","title":"Timestamp Response verification","text":"

The -verify command is for verifying if a timestamp response or timestamp token is valid and matches a particular timestamp request or data file. The -verify command does not use the configuration file.

  • -data file_to_hash

    The response or token must be verified against file_to_hash. The file is hashed with the message digest algorithm specified in the token. The -digest and -queryfile options must not be specified with this one. (Optional)

  • -digest digest_bytes

    The response or token must be verified against the message digest specified with this option. The number of bytes must match the message digest algorithm specified in the token. The -data and -queryfile options must not be specified with this one. (Optional)

  • -queryfile request.tsq

    The original timestamp request in DER format. The -data and -digest options must not be specified with this one. (Optional)

  • -in response.tsr

    The timestamp response that needs to be verified in DER format. (Mandatory)

  • -token_in

    This flag can be used together with the -in option and indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)

  • -untrusted files|uris

    A set of additional untrusted certificates which may be needed when building the certificate chain for the TSA's signing certificate. These do not need to contain the TSA signing certificate and intermediate CA certificates as far as the response already includes them. (Optional)

    Multiple sources may be given, separated by commas and/or whitespace. Each file may contain multiple certificates.

  • -CAfile file, -CApath dir, -CAstore uri

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details. At least one of -CAfile, -CApath or -CAstore must be specified.

  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

    Any verification errors cause the command to exit.

"},{"location":"man1/openssl-ts/#configuration-file-options","title":"CONFIGURATION FILE OPTIONS","text":"

The -query and -reply commands make use of a configuration file. See config(5) for a general description of the syntax of the config file. The -query command uses only the symbolic OID names section and it can work without it. However, the -reply command needs the config file for its operation.

When there is a command line switch equivalent of a variable the switch always overrides the settings in the config file.

  • tsa section, default_tsa

    This is the main section and it specifies the name of another section that contains all the options for the -reply command. This default section can be overridden with the -section command line switch. (Optional)

  • oid_file

    This specifies a file containing additional OBJECT IDENTIFIERS. Each line of the file should consist of the numerical form of the object identifier followed by whitespace then the short name followed by whitespace and finally the long name. (Optional)

  • oid_section

    This specifies a section in the configuration file containing extra object identifiers. Each line should consist of the short name of the object identifier followed by = and the numerical form. The short and long names are the same when this option is used. (Optional)

  • RANDFILE

    At startup the specified file is loaded into the random number generator, and at exit 256 bytes will be written to it. (Note: Using a RANDFILE is not necessary anymore, see the \"HISTORY\" section.

  • serial

    The name of the file containing the hexadecimal serial number of the last timestamp response created. This number is incremented by 1 for each response. If the file does not exist at the time of response generation a new file is created with serial number 1. (Mandatory)

  • crypto_device

    Specifies the OpenSSL engine that will be set as the default for all available algorithms. The default value is built-in, you can specify any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM). (Optional)

  • signer_cert

    TSA signing certificate in PEM format. The same as the -signer command line option. (Optional)

  • certs

    A file containing a set of PEM encoded certificates that need to be included in the response. The same as the -chain command line option. (Optional)

  • signer_key

    The private key of the TSA in PEM format. The same as the -inkey command line option. (Optional)

  • signer_digest

    Signing digest to use. The same as the -digest command line option. (Mandatory unless specified on the command line)

  • default_policy

    The default policy to use when the request does not mandate any policy. The same as the -tspolicy command line option. (Optional)

  • other_policies

    Comma separated list of policies that are also acceptable by the TSA and used only if the request explicitly specifies one of them. (Optional)

  • digests

    The list of message digest algorithms that the TSA accepts. At least one algorithm must be specified. (Mandatory)

  • accuracy

    The accuracy of the time source of the TSA in seconds, milliseconds and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of the components is missing zero is assumed for that field. (Optional)

  • clock_precision_digits

    Specifies the maximum number of digits, which represent the fraction of seconds, that need to be included in the time field. The trailing zeros must be removed from the time, so there might actually be fewer digits, or no fraction of seconds at all. Supported only on UNIX platforms. The maximum value is 6, default is 0. (Optional)

  • ordering

    If this option is yes the responses generated by this TSA can always be ordered, even if the time difference between two responses is less than the sum of their accuracies. Default is no. (Optional)

  • tsa_name

    Set this option to yes if the subject name of the TSA must be included in the TSA name field of the response. Default is no. (Optional)

  • ess_cert_id_chain

    The SignedData objects created by the TSA always contain the certificate identifier of the signing certificate in a signed attribute (see RFC 2634, Enhanced Security Services). If this variable is set to no, only this signing certificate identifier is included in the SigningCertificate signed attribute. If this variable is set to yes and the certs variable or the -chain option is specified then the certificate identifiers of the chain will also be included, where the -chain option overrides the certs variable. Default is no. (Optional)

  • ess_cert_id_alg

    This option specifies the hash function to be used to calculate the TSA's public key certificate identifier. Default is sha1. (Optional)

"},{"location":"man1/openssl-ts/#examples","title":"EXAMPLES","text":"

All the examples below presume that OPENSSL_CONF is set to a proper configuration file, e.g. the example configuration file openssl/apps/openssl.cnf will do.

"},{"location":"man1/openssl-ts/#timestamp-request","title":"Timestamp Request","text":"

To create a timestamp request for design1.txt with SHA-256 digest, without nonce and policy, and without requirement for a certificate in the response:

openssl ts -query -data design1.txt -no_nonce \\\n      -out design1.tsq\n

To create a similar timestamp request with specifying the message imprint explicitly:

openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \\\n       -no_nonce -out design1.tsq\n

To print the content of the previous request in human readable format:

openssl ts -query -in design1.tsq -text\n

To create a timestamp request which includes the SHA-512 digest of design2.txt, requests the signer certificate and nonce, and specifies a policy id (assuming the tsa_policy1 name is defined in the OID section of the config file):

openssl ts -query -data design2.txt -sha512 \\\n      -tspolicy tsa_policy1 -cert -out design2.tsq\n
"},{"location":"man1/openssl-ts/#timestamp-response","title":"Timestamp Response","text":"

Before generating a response a signing certificate must be created for the TSA that contains the timeStamping critical extended key usage extension without any other key usage extensions. You can add this line to the user certificate section of the config file to generate a proper certificate;

extendedKeyUsage = critical,timeStamping\n

See openssl-req(1), openssl-ca(1), and openssl-x509(1) for instructions. The examples below assume that cacert.pem contains the certificate of the CA, tsacert.pem is the signing certificate issued by cacert.pem and tsakey.pem is the private key of the TSA.

To create a timestamp response for a request:

openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \\\n      -signer tsacert.pem -out design1.tsr\n

If you want to use the settings in the config file you could just write:

openssl ts -reply -queryfile design1.tsq -out design1.tsr\n

To print a timestamp reply to stdout in human readable format:

openssl ts -reply -in design1.tsr -text\n

To create a timestamp token instead of timestamp response:

openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_out\n

To print a timestamp token to stdout in human readable format:

openssl ts -reply -in design1_token.der -token_in -text -token_out\n

To extract the timestamp token from a response:

openssl ts -reply -in design1.tsr -out design1_token.der -token_out\n

To add 'granted' status info to a timestamp token thereby creating a valid response:

openssl ts -reply -in design1_token.der -token_in -out design1.tsr\n
"},{"location":"man1/openssl-ts/#timestamp-verification","title":"Timestamp Verification","text":"

To verify a timestamp reply against a request:

openssl ts -verify -queryfile design1.tsq -in design1.tsr \\\n      -CAfile cacert.pem -untrusted tsacert.pem\n

To verify a timestamp reply that includes the certificate chain:

openssl ts -verify -queryfile design2.tsq -in design2.tsr \\\n      -CAfile cacert.pem\n

To verify a timestamp token against the original data file: openssl ts -verify -data design2.txt -in design2.tsr \\ -CAfile cacert.pem

To verify a timestamp token against a message imprint: openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \\ -in design2.tsr -CAfile cacert.pem

You could also look at the 'test' directory for more examples.

"},{"location":"man1/openssl-ts/#bugs","title":"BUGS","text":"
  • No support for timestamps over SMTP, though it is quite easy to implement an automatic e-mail based TSA with procmail(1) and perl(1). HTTP server support is provided in the form of a separate apache module. HTTP client support is provided by tsget(1). Pure TCP/IP protocol is not supported.
  • The file containing the last serial number of the TSA is not locked when being read or written. This is a problem if more than one instance of openssl(1) is trying to create a timestamp response at the same time. This is not an issue when using the apache server module, it does proper locking.
  • Look for the FIXME word in the source files.
  • The source code should really be reviewed by somebody else, too.
  • More testing is needed, I have done only some basic tests (see test/testtsa).
"},{"location":"man1/openssl-ts/#history","title":"HISTORY","text":"

OpenSSL 1.1.1 introduced a new random generator (CSPRNG) with an improved seeding mechanism. The new seeding mechanism makes it unnecessary to define a RANDFILE for saving and restoring randomness. This option is retained mainly for compatibility reasons.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-ts/#see-also","title":"SEE ALSO","text":"

openssl(1), tsget(1), openssl-req(1), openssl-x509(1), openssl-ca(1), openssl-genrsa(1), config(5), ossl_store-file(7)

"},{"location":"man1/openssl-ts/#copyright","title":"COPYRIGHT","text":"

Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-verification-options/","title":"openssl-verification-options","text":""},{"location":"man1/openssl-verification-options/#name","title":"NAME","text":"

openssl-verification-options - generic X.509 certificate verification options

"},{"location":"man1/openssl-verification-options/#synopsis","title":"SYNOPSIS","text":"

openssl command [ options ... ] [ parameters ... ]

"},{"location":"man1/openssl-verification-options/#description","title":"DESCRIPTION","text":"

There are many situations where X.509 certificates are verified within the OpenSSL libraries and in various OpenSSL commands.

Certificate verification is implemented by X509_verify_cert(3). It is a complicated process consisting of a number of steps and depending on numerous options. The most important of them are detailed in the following sections.

In a nutshell, a valid chain of certificates needs to be built up and verified starting from the target certificate that is to be verified and ending in a certificate that due to some policy is trusted. Verification is done relative to the given purpose, which is the intended use of the target certificate, such as SSL server, or by default for any purpose.

The details of how each OpenSSL command handles errors are documented on the specific command page.

DANE support is documented in openssl-s_client(1), SSL_CTX_dane_enable(3), SSL_set1_host(3), X509_VERIFY_PARAM_set_flags(3), and X509_check_host(3).

"},{"location":"man1/openssl-verification-options/#trust-anchors","title":"Trust Anchors","text":"

In general, according to RFC 4158 and RFC 5280, a trust anchor is any public key and related subject distinguished name (DN) that for some reason is considered trusted and thus is acceptable as the root of a chain of certificates.

In practice, trust anchors are given in the form of certificates, where their essential fields are the public key and the subject DN. In addition to the requirements in RFC 5280, OpenSSL checks the validity period of such certificates and makes use of some further fields. In particular, the subject key identifier extension, if present, is used for matching trust anchors during chain building.

In the most simple and common case, trust anchors are by default all self-signed \"root\" CA certificates that are placed in the trust store, which is a collection of certificates that are trusted for certain uses. This is akin to what is used in the trust stores of Mozilla Firefox, or Apple's and Microsoft's certificate stores, ...

From the OpenSSL perspective, a trust anchor is a certificate that should be augmented with an explicit designation for which uses of a target certificate the certificate may serve as a trust anchor. In PEM encoding, this is indicated by the TRUSTED CERTIFICATE string. Such a designation provides a set of positive trust attributes explicitly stating trust for the listed purposes and/or a set of negative trust attributes explicitly rejecting the use for the listed purposes. The purposes are encoded using the values defined for the extended key usages (EKUs) that may be given in X.509 extensions of end-entity certificates. See also the \"Extended Key Usage\" section below.

The currently recognized uses are clientAuth (SSL client use), serverAuth (SSL server use), emailProtection (S/MIME email use), codeSigning (object signer use), OCSPSigning (OCSP responder use), OCSP (OCSP request use), timeStamping (TSA server use), and anyExtendedKeyUsage. As of OpenSSL 1.1.0, the last of these blocks all uses when rejected or enables all uses when trusted.

A certificate, which may be CA certificate or an end-entity certificate, is considered a trust anchor for the given use if and only if all the following conditions hold:

  • It is an an element of the trust store.
  • It does not have a negative trust attribute rejecting the given use.
  • It has a positive trust attribute accepting the given use or (by default) one of the following compatibility conditions apply: It is self-signed or the -partial_chain option is given (which corresponds to the X509_V_FLAG_PARTIAL_CHAIN flag being set).
"},{"location":"man1/openssl-verification-options/#certification-path-building","title":"Certification Path Building","text":"

First, a certificate chain is built up starting from the target certificate and ending in a trust anchor.

The chain is built up iteratively, looking up in turn a certificate with suitable key usage that matches as an issuer of the current \"subject\" certificate as described below. If there is such a certificate, the first one found that is currently valid is taken, otherwise the one that expired most recently of all such certificates. For efficiency, no backtracking is performed, thus any further candidate issuer certificates that would match equally are ignored.

When a self-signed certificate has been added, chain construction stops. In this case it must fully match a trust anchor, otherwise chain building fails.

A candidate issuer certificate matches a subject certificate if all of the following conditions hold:

  • Its subject name matches the issuer name of the subject certificate.
  • If the subject certificate has an authority key identifier extension, each of its sub-fields equals the corresponding subject key identifier, serial number, and issuer field of the candidate issuer certificate, as far as the respective fields are present in both certificates.
  • The certificate signature algorithm used to sign the subject certificate is supported and equals the public key algorithm of the candidate issuer certificate.

The lookup first searches for issuer certificates in the trust store. If it does not find a match there it consults the list of untrusted (\"intermediate\" CA) certificates, if provided.

"},{"location":"man1/openssl-verification-options/#certification-path-validation","title":"Certification Path Validation","text":"

When the certificate chain building process was successful the chain components and their links are checked thoroughly.

The first step is to check that each certificate is well-formed. Part of these checks are enabled only if the -x509_strict option is given.

The second step is to check the extensions of every untrusted certificate for consistency with the supplied purpose. If the -purpose option is not given then no such checks are done except for SSL/TLS connection setup, where by default sslserver or sslclient, are checked. The target or \"leaf\" certificate, as well as any other untrusted certificates, must have extensions compatible with the specified purpose. All certificates except the target or \"leaf\" must also be valid CA certificates. The precise extensions required are described in more detail in \"CERTIFICATE EXTENSIONS\" in openssl-x509(1).

The third step is to check the trust settings on the last certificate (which typically is a self-signed root CA certificate). It must be trusted for the given use. For compatibility with previous versions of OpenSSL, a self-signed certificate with no trust attributes is considered to be valid for all uses.

The fourth, and final, step is to check the validity of the certificate chain. For each element in the chain, including the root CA certificate, the validity period as specified by the notBefore and notAfter fields is checked against the current system time. The -attime flag may be used to use a reference time other than \"now.\" The certificate signature is checked as well (except for the signature of the typically self-signed root CA certificate, which is verified only if the -check_ss_sig option is given). When verifying a certificate signature the keyUsage extension (if present) of the candidate issuer certificate is checked to permit digitalSignature for signing proxy certificates or to permit keyCertSign for signing other certificates, respectively. If all operations complete successfully then certificate is considered valid. If any operation fails then the certificate is not valid.

"},{"location":"man1/openssl-verification-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-verification-options/#trusted-certificate-options","title":"Trusted Certificate Options","text":"

The following options specify how to supply the certificates that can be used as trust anchors for certain uses. As mentioned, a collection of such certificates is called a trust store.

Note that OpenSSL does not provide a default set of trust anchors. Many Linux distributions include a system default and configure OpenSSL to point to that. Mozilla maintains an influential trust store that can be found at https://www.mozilla.org/en-US/about/governance/policies/security-group/certs/.

The certificates to add to the trust store can be specified using following options.

  • -CAfile file

    Load the specified file which contains a certificate or several of them in case the input is in PEM or PKCS#12 format. PEM-encoded certificates may also have trust attributes set.

  • -no-CAfile

    Do not load the default file of trusted certificates.

  • -CApath dir

    Use the specified directory as a collection of trusted certificates, i.e., a trust store. Files should be named with the hash value of the X.509 SubjectName of each certificate. This is so that the library can extract the IssuerName, hash it, and directly lookup the file to get the issuer certificate. See openssl-rehash(1) for information on creating this type of directory.

  • -no-CApath

    Do not use the default directory of trusted certificates.

  • -CAstore uri

    Use uri as a store of CA certificates. The URI may indicate a single certificate, as well as a collection of them. With URIs in the file: scheme, this acts as -CAfile or -CApath, depending on if the URI indicates a single file or directory. See ossl_store-file(7) for more information on the file: scheme.

    These certificates are also used when building the server certificate chain (for example with openssl-s_server(1)) or client certificate chain (for example with openssl-s_time(1)).

  • -no-CAstore

    Do not use the default store of trusted CA certificates.

"},{"location":"man1/openssl-verification-options/#verification-options","title":"Verification Options","text":"

The certificate verification can be fine-tuned with the following flags.

  • -verbose

    Print extra information about the operations being performed.

  • -attime timestamp

    Perform validation checks using time specified by timestamp and not current system time. timestamp is the number of seconds since January 1, 1970 (i.e., the Unix Epoch).

  • -no_check_time

    This option suppresses checking the validity period of certificates and CRLs against the current time. If option -attime is used to specify a verification time, the check is not suppressed.

  • -x509_strict

    This disables non-compliant workarounds for broken certificates. Thus errors are thrown on certificates not compliant with RFC 5280.

    When this option is set, among others, the following certificate well-formedness conditions are checked:

    • The basicConstraints of CA certificates must be marked critical.
    • CA certificates must explicitly include the keyUsage extension.
    • If a pathlenConstraint is given the key usage keyCertSign must be allowed.
    • The pathlenConstraint must not be given for non-CA certificates.
    • The issuer name of any certificate must not be empty.
    • The subject name of CA certs, certs with keyUsage crlSign, and certs without subjectAlternativeName must not be empty.
    • If a subjectAlternativeName extension is given it must not be empty.
    • The signatureAlgorithm field and the cert signature must be consistent.
    • Any given authorityKeyIdentifier and any given subjectKeyIdentifier must not be marked critical.
    • The authorityKeyIdentifier must be given for X.509v3 certs unless they are self-signed.
    • The subjectKeyIdentifier must be given for all X.509v3 CA certs.
  • -ignore_critical

    Normally if an unhandled critical extension is present that is not supported by OpenSSL the certificate is rejected (as required by RFC5280). If this option is set critical extensions are ignored.

  • -issuer_checks

    Ignored.

  • -crl_check

    Checks end entity certificate validity by attempting to look up a valid CRL. If a valid CRL cannot be found an error occurs.

  • -crl_check_all

    Checks the validity of all certificates in the chain by attempting to look up valid CRLs.

  • -use_deltas

    Enable support for delta CRLs.

  • -extended_crl

    Enable extended CRL features such as indirect CRLs and alternate CRL signing keys.

  • -suiteB_128_only, -suiteB_128, -suiteB_192

    Enable the Suite B mode operation at 128 bit Level of Security, 128 bit or 192 bit, or only 192 bit Level of Security respectively. See RFC6460 for details. In particular the supported signature algorithms are reduced to support only ECDSA and SHA256 or SHA384 and only the elliptic curves P-256 and P-384.

  • -auth_level level

    Set the certificate chain authentication security level to level. The authentication security level determines the acceptable signature and public key strength when verifying certificate chains. For a certificate chain to validate, the public keys of all the certificates must meet the specified security level. The signature algorithm security level is enforced for all the certificates in the chain except for the chain's trust anchor, which is either directly trusted or validated by means other than its signature. See SSL_CTX_set_security_level(3) for the definitions of the available levels. The default security level is -1, or \"not set\". At security level 0 or lower all algorithms are acceptable. Security level 1 requires at least 80-bit-equivalent security and is broadly interoperable, though it will, for example, reject MD5 signatures or RSA keys shorter than 1024 bits.

  • -partial_chain

    Allow verification to succeed if an incomplete chain can be built. That is, a chain ending in a certificate that normally would not be trusted (because it has no matching positive trust attributes and is not self-signed) but is an element of the trust store. This certificate may be self-issued or belong to an intermediate CA.

  • -check_ss_sig

    Verify the signature of the last certificate in a chain if the certificate is supposedly self-signed. This is prohibited and will result in an error if it is a non-conforming CA certificate with key usage restrictions not including the keyCertSign bit. This verification is disabled by default because it doesn't add any security.

  • -allow_proxy_certs

    Allow the verification of proxy certificates.

  • -trusted_first

    As of OpenSSL 1.1.0 this option is on by default and cannot be disabled.

    When constructing the certificate chain, the trusted certificates specified via -CAfile, -CApath, -CAstore or -trusted are always used before any certificates specified via -untrusted.

  • -no_alt_chains

    As of OpenSSL 1.1.0, since -trusted_first always on, this option has no effect.

  • -trusted file

    Parse file as a set of one or more certificates. Each of them qualifies as trusted if has a suitable positive trust attribute or it is self-signed or the -partial_chain option is specified. This option implies the -no-CAfile, -no-CApath, and -no-CAstore options and it cannot be used with the -CAfile, -CApath or -CAstore options, so only certificates specified using the -trusted option are trust anchors. This option may be used multiple times.

  • -untrusted file

    Parse file as a set of one or more certificates. All certificates (typically of intermediate CAs) are considered untrusted and may be used to construct a certificate chain from the target certificate to a trust anchor. This option may be used multiple times.

  • -policy arg

    Enable policy processing and add arg to the user-initial-policy-set (see RFC5280). The policy arg can be an object name or an OID in numeric form. This argument can appear more than once.

  • -explicit_policy

    Set policy variable require-explicit-policy (see RFC5280).

  • -policy_check

    Enables certificate policy processing.

  • -policy_print

    Print out diagnostics related to policy processing.

  • -inhibit_any

    Set policy variable inhibit-any-policy (see RFC5280).

  • -inhibit_map

    Set policy variable inhibit-policy-mapping (see RFC5280).

  • -purpose purpose

    The intended use for the certificate. Currently defined purposes are sslclient, sslserver, nssslserver, smimesign, smimeencrypt, crlsign, ocsphelper, timestampsign, and any. If peer certificate verification is enabled, by default the TLS implementation as well as the commands s_client and s_server check for consistency with TLS server or TLS client use, respectively.

    While IETF RFC 5280 says that id-kp-serverAuth and id-kp-clientAuth are only for WWW use, in practice they are used for all kinds of TLS clients and servers, and this is what OpenSSL assumes as well.

  • -verify_depth num

    Limit the certificate chain to num intermediate CA certificates. A maximal depth chain can have up to num+2 certificates, since neither the end-entity certificate nor the trust-anchor certificate count against the -verify_depth limit.

  • -verify_email email

    Verify if email matches the email address in Subject Alternative Name or the email in the subject Distinguished Name.

  • -verify_hostname hostname

    Verify if hostname matches DNS name in Subject Alternative Name or Common Name in the subject certificate.

  • -verify_ip ip

    Verify if ip matches the IP address in Subject Alternative Name of the subject certificate.

  • -verify_name name

    Use default verification policies like trust model and required certificate policies identified by name. The trust model determines which auxiliary trust or reject OIDs are applicable to verifying the given certificate chain. They can be given using the -addtrust and -addreject options for openssl-x509(1). Supported policy names include: default, pkcs7, smime_sign, ssl_client, ssl_server. These mimics the combinations of purpose and trust settings used in SSL, CMS and S/MIME. As of OpenSSL 1.1.0, the trust model is inferred from the purpose when not specified, so the -verify_name options are functionally equivalent to the corresponding -purpose settings.

"},{"location":"man1/openssl-verification-options/#extended-verification-options","title":"Extended Verification Options","text":"

Sometimes there may be more than one certificate chain leading to an end-entity certificate. This usually happens when a root or intermediate CA signs a certificate for another a CA in other organization. Another reason is when a CA might have intermediates that use two different signature formats, such as a SHA-1 and a SHA-256 digest.

The following options can be used to provide data that will allow the OpenSSL command to generate an alternative chain.

  • -xkey infile, -xcert infile, -xchain

    Specify an extra certificate, private key and certificate chain. These behave in the same manner as the -cert, -key and -cert_chain options. When specified, the callback returning the first valid chain will be in use by the client.

  • -xchain_build

    Specify whether the application should build the certificate chain to be provided to the server for the extra certificates via the -xkey, -xcert, and -xchain options.

  • -xcertform DER|PEM|P12

    The input format for the extra certificate. This option has no effect and is retained for backward compatibility only.

  • -xkeyform DER|PEM|P12

    The input format for the extra key. This option has no effect and is retained for backward compatibility only.

"},{"location":"man1/openssl-verification-options/#certificate-extensions","title":"Certificate Extensions","text":"

Options like -purpose lead to checking the certificate extensions, which determine what the target certificate and intermediate CA certificates can be used for.

"},{"location":"man1/openssl-verification-options/#basic-constraints","title":"Basic Constraints","text":"

The basicConstraints extension CA flag is used to determine whether the certificate can be used as a CA. If the CA flag is true then it is a CA, if the CA flag is false then it is not a CA. All CAs should have the CA flag set to true.

If the basicConstraints extension is absent, which includes the case that it is an X.509v1 certificate, then the certificate is considered to be a \"possible CA\" and other extensions are checked according to the intended use of the certificate. The treatment of certificates without basicConstraints as a CA is presently supported, but this could change in the future.

"},{"location":"man1/openssl-verification-options/#key-usage","title":"Key Usage","text":"

If the keyUsage extension is present then additional restraints are made on the uses of the certificate. A CA certificate must have the keyCertSign bit set if the keyUsage extension is present.

"},{"location":"man1/openssl-verification-options/#extended-key-usage","title":"Extended Key Usage","text":"

The extKeyUsage (EKU) extension places additional restrictions on the certificate uses. If this extension is present (whether critical or not) the key can only be used for the purposes specified.

A complete description of each check is given below. The comments about basicConstraints and keyUsage and X.509v1 certificates above apply to all CA certificates.

  • SSL Client

    The extended key usage extension must be absent or include the \"web client authentication\" OID. The keyUsage extension must be absent or it must have the digitalSignature bit set. The Netscape certificate type must be absent or it must have the SSL client bit set.

  • SSL Client CA

    The extended key usage extension must be absent or include the \"web client authentication\" OID. The Netscape certificate type must be absent or it must have the SSL CA bit set. This is used as a work around if the basicConstraints extension is absent.

  • SSL Server

    The extended key usage extension must be absent or include the \"web server authentication\" and/or one of the SGC OIDs. The keyUsage extension must be absent or it must have the digitalSignature, the keyEncipherment set or both bits set. The Netscape certificate type must be absent or have the SSL server bit set.

  • SSL Server CA

    The extended key usage extension must be absent or include the \"web server authentication\" and/or one of the SGC OIDs. The Netscape certificate type must be absent or the SSL CA bit must be set. This is used as a work around if the basicConstraints extension is absent.

  • Netscape SSL Server

    For Netscape SSL clients to connect to an SSL server it must have the keyEncipherment bit set if the keyUsage extension is present. This isn't always valid because some cipher suites use the key for digital signing. Otherwise it is the same as a normal SSL server.

  • Common S/MIME Client Tests

    The extended key usage extension must be absent or include the \"email protection\" OID. The Netscape certificate type must be absent or should have the S/MIME bit set. If the S/MIME bit is not set in the Netscape certificate type then the SSL client bit is tolerated as an alternative but a warning is shown. This is because some Verisign certificates don't set the S/MIME bit.

  • S/MIME Signing

    In addition to the common S/MIME client tests the digitalSignature bit or the nonRepudiation bit must be set if the keyUsage extension is present.

  • S/MIME Encryption

    In addition to the common S/MIME tests the keyEncipherment bit must be set if the keyUsage extension is present.

  • S/MIME CA

    The extended key usage extension must be absent or include the \"email protection\" OID. The Netscape certificate type must be absent or must have the S/MIME CA bit set. This is used as a work around if the basicConstraints extension is absent.

  • CRL Signing

    The keyUsage extension must be absent or it must have the CRL signing bit set.

  • CRL Signing CA

    The normal CA tests apply. Except in this case the basicConstraints extension must be present.

"},{"location":"man1/openssl-verification-options/#bugs","title":"BUGS","text":"

The issuer checks still suffer from limitations in the underlying X509_LOOKUP API. One consequence of this is that trusted certificates with matching subject name must appear in a file (as specified by the -CAfile option), a directory (as specified by -CApath), or a store (as specified by -CAstore). If there are multiple such matches, possibly in multiple locations, only the first one (in the mentioned order of locations) is recognised.

"},{"location":"man1/openssl-verification-options/#see-also","title":"SEE ALSO","text":"

X509_verify_cert(3), openssl-verify(1), openssl-ocsp(1), openssl-ts(1), openssl-s_client(1), openssl-s_server(1), openssl-smime(1), openssl-cmp(1), openssl-cms(1)

"},{"location":"man1/openssl-verification-options/#history","title":"HISTORY","text":"

The checks enabled by -x509_strict have been extended in OpenSSL 3.0.

"},{"location":"man1/openssl-verification-options/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-verify/","title":"openssl-verify","text":""},{"location":"man1/openssl-verify/#name","title":"NAME","text":"

openssl-verify - certificate verification command

"},{"location":"man1/openssl-verify/#synopsis","title":"SYNOPSIS","text":"

openssl verify [-help] [-CRLfile filename|uri] [-crl_download] [-show_chain] [-verbose] [-trusted filename|uri] [-untrusted filename|uri] [-vfyopt nm:v] [-nameopt option] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-engine id] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq] [--] [certificate ...]

"},{"location":"man1/openssl-verify/#description","title":"DESCRIPTION","text":"

This command verifies certificate chains. If a certificate chain has multiple problems, this program attempts to display all of them.

"},{"location":"man1/openssl-verify/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -CRLfile filename|uri

    The file or URI should contain one or more CRLs in PEM or DER format. This option can be specified more than once to include CRLs from multiple sources.

  • -crl_download

    Attempt to download CRL information for certificates via their CDP entries.

  • -show_chain

    Display information about the certificate chain that has been built (if successful). Certificates in the chain that came from the untrusted list will be flagged as \"untrusted\".

  • -verbose

    Print extra information about the operations being performed.

  • -trusted filename|uri

    A file or URI of (more or less) trusted certificates. See openssl-verification-options(1) for more information on trust settings.

    This option can be specified more than once to load certificates from multiple sources.

  • -untrusted filename|uri

    A file or URI of untrusted certificates to use for chain building. This option can be specified more than once to load certificates from multiple sources.

  • -vfyopt nm:v

    Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

  • -nameopt option

    This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

    To load certificates or CRLs that require engine support, specify the -engine option before any of the -trusted, -untrusted or -CRLfile options.

  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

    See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

    Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

  • --

    Indicates the last option. All arguments following this are assumed to be certificate files. This is useful if the first certificate filename begins with a -.

  • certificate ...

    One or more target certificates to verify, one per file. If no certificates are given, this command will attempt to read a single certificate from standard input.

"},{"location":"man1/openssl-verify/#diagnostics","title":"DIAGNOSTICS","text":"

When a verify operation fails the output messages can be somewhat cryptic. The general form of the error message is:

server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)\nerror 24 at 1 depth lookup:invalid CA certificate\n

The first line contains the name of the certificate being verified followed by the subject name of the certificate. The second line contains the error number and the depth. The depth is number of the certificate being verified when a problem was detected starting with zero for the target (\"leaf\") certificate itself then 1 for the CA that signed the target certificate and so on. Finally a textual version of the error number is presented.

A list of the error codes and messages can be found in X509_STORE_CTX_get_error(3); the full list is defined in the header file <openssl/x509_vfy.h>.

This command ignores many errors, in order to allow all the problems with a certificate chain to be determined.

"},{"location":"man1/openssl-verify/#see-also","title":"SEE ALSO","text":"

openssl-verification-options(1), openssl-x509(1), ossl_store-file(7)

"},{"location":"man1/openssl-verify/#history","title":"HISTORY","text":"

The -show_chain option was added in OpenSSL 1.1.0.

The -engine option was deprecated in OpenSSL 3.0.

"},{"location":"man1/openssl-verify/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-version/","title":"openssl-version","text":""},{"location":"man1/openssl-version/#name","title":"NAME","text":"

openssl-version - print OpenSSL version information

"},{"location":"man1/openssl-version/#synopsis","title":"SYNOPSIS","text":"

openssl version [-help] [-a] [-v] [-b] [-o] [-f] [-p] [-d] [-e] [-m] [-r] [-c]

"},{"location":"man1/openssl-version/#description","title":"DESCRIPTION","text":"

This command is used to print out version information about OpenSSL.

"},{"location":"man1/openssl-version/#options","title":"OPTIONS","text":"
  • -help

    Print out a usage message.

  • -a

    All information, this is the same as setting all the other flags.

  • -v

    The current OpenSSL version.

  • -b

    The date the current version of OpenSSL was built.

  • -o

    Option information: various options set when the library was built.

  • -f

    Compilation flags.

  • -p

    Platform setting.

  • -d

    OPENSSLDIR setting.

  • -e

    ENGINESDIR settings.

  • -m

    MODULESDIR settings.

  • -r

    The random number generator source settings.

  • -c

    The OpenSSL CPU settings info.

"},{"location":"man1/openssl-version/#notes","title":"NOTES","text":"

The output of openssl version -a would typically be used when sending in a bug report.

"},{"location":"man1/openssl-version/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl-x509/","title":"openssl-x509","text":""},{"location":"man1/openssl-x509/#name","title":"NAME","text":"

openssl-x509 - Certificate display and signing command

"},{"location":"man1/openssl-x509/#synopsis","title":"SYNOPSIS","text":"

openssl x509 [-help] [-in filename|uri] [-passin arg] [-new] [-x509toreq] [-req] [-copy_extensions arg] [-inform DER|PEM] [-vfyopt nm:v] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-signkey filename|uri] [-out filename] [-outform DER|PEM] [-nocert] [-noout] [-dateopt] [-text] [-certopt option] [-fingerprint] [-alias] [-serial] [-startdate] [-enddate] [-dates] [-subject] [-issuer] [-nameopt option] [-email] [-hash] [-subject_hash] [-subject_hash_old] [-issuer_hash] [-issuer_hash_old] [-ext extensions] [-ocspid] [-ocsp_uri] [-purpose] [-pubkey] [-modulus] [-checkend num] [-checkhost host] [-checkemail host] [-checkip ipaddr] [-set_serial n] [-next_serial] [-days arg] [-preserve_dates] [-subj arg] [-force_pubkey filename] [-clrext] [-extfile filename] [-extensions section] [-sigopt nm:v] [-badsig] [-digest] [-CA filename|uri] [-CAform DER|PEM|P12] [-CAkey filename|uri] [-CAkeyform DER|PEM|P12|ENGINE] [-CAserial filename] [-CAcreateserial] [-trustout] [-setalias arg] [-clrtrust] [-addtrust arg] [-clrreject] [-addreject arg] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

"},{"location":"man1/openssl-x509/#description","title":"DESCRIPTION","text":"

This command is a multi-purposes certificate handling command. It can be used to print certificate information, convert certificates to various forms, edit certificate trust settings, generate certificates from scratch or from certificating requests and then self-signing them or signing them like a \"micro CA\".

Since there are a large number of options they will split up into various sections.

"},{"location":"man1/openssl-x509/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-x509/#input-output-and-general-purpose-options","title":"Input, Output, and General Purpose Options","text":"
  • -help

    Print out a usage message.

  • -in filename|uri

    This specifies the input to read a certificate from or the input file for reading a certificate request if the -req flag is used. In both cases this defaults to standard input.

    This option cannot be combined with the -new flag.

  • -passin arg

    The key and certificate file password source. For more information about the format of arg see openssl-passphrase-options(1).

  • -new

    Generate a certificate from scratch, not using an input certificate or certificate request. So the -in option must not be used in this case. Instead, the -subj option needs to be given. The public key to include can be given with the -force_pubkey option and defaults to the key given with the -key (or -signkey) option, which implies self-signature.

  • -x509toreq

    Output a PKCS#10 certificate request (rather than a certificate). The -key (or -signkey) option must be used to provide the private key for self-signing; the corresponding public key is placed in the subjectPKInfo field.

    X.509 extensions included in a certificate input are not copied by default. X.509 extensions to be added can be specified using the -extfile option.

  • -req

    By default a certificate is expected on input. With this option a PKCS#10 certificate request is expected instead, which must be correctly self-signed.

    X.509 extensions included in the request are not copied by default. X.509 extensions to be added can be specified using the -extfile option.

  • -copy_extensions arg

    Determines how to handle X.509 extensions when converting from a certificate to a request using the -x509toreq option or converting from a request to a certificate using the -req option. If arg is none or this option is not present then extensions are ignored. If arg is copy or copyall then all extensions are copied, except that subject identifier and authority key identifier extensions are not taken over when producing a certificate request.

    The -ext option can be used to further restrict which extensions to copy.

  • -inform DER|PEM

    The input file format; unspecified by default. See openssl-format-options(1) for details.

  • -vfyopt nm:v

    Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

  • -key filename|uri

    This option provides the private key for signing a new certificate or certificate request. Unless -force_pubkey is given, the corresponding public key is placed in the new certificate or certificate request, resulting in a self-signature.

    This option cannot be used in conjunction with the -CA option.

    It sets the issuer name to the subject name (i.e., makes it self-issued) and changes the public key to the supplied value (unless overridden by -force_pubkey). Unless the -preserve_dates option is supplied, it sets the validity start date to the current time and the end date to a value determined by the -days option.

  • -signkey filename|uri

    This option is an alias of -key.

  • -keyform DER|PEM|P12|ENGINE

    The key input format; unspecified by default. See openssl-format-options(1) for details.

  • -out filename

    This specifies the output filename to write to or standard output by default.

  • -outform DER|PEM

    The output format; the default is PEM. See openssl-format-options(1) for details.

  • -nocert

    Do not output a certificate (except for printing as requested by below options).

  • -noout

    This option prevents output except for printing as requested by below options.

"},{"location":"man1/openssl-x509/#certificate-printing-options","title":"Certificate Printing Options","text":"

Note: the -alias and -purpose options are also printing options but are described in the \"Trust Settings\" section.

  • -dateopt

    Specify the date output format. Values are: rfc_822 and iso_8601. Defaults to rfc_822.

  • -text

    Prints out the certificate in text form. Full details are printed including the public key, signature algorithms, issuer and subject names, serial number any extensions present and any trust settings.

  • -certopt option

    Customise the print format used with -text. The option argument can be a single option or multiple options separated by commas. The -certopt switch may be also be used more than once to set multiple options. See the \"Text Printing Flags\" section for more information.

  • -fingerprint

    Calculates and prints the digest of the DER encoded version of the entire certificate (see digest options). This is commonly called a \"fingerprint\". Because of the nature of message digests, the fingerprint of a certificate is unique to that certificate and two certificates with the same fingerprint can be considered to be the same.

  • -alias

    Prints the certificate \"alias\" (nickname), if any.

  • -serial

    Prints the certificate serial number.

  • -startdate

    Prints out the start date of the certificate, that is the notBefore date.

  • -enddate

    Prints out the expiry date of the certificate, that is the notAfter date.

  • -dates

    Prints out the start and expiry dates of a certificate.

  • -subject

    Prints the subject name.

  • -issuer

    Prints the issuer name.

  • -nameopt option

    This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

  • -email

    Prints the email address(es) if any.

  • -hash

    Synonym for \"-subject_hash\" for backward compatibility reasons.

  • -subject_hash

    Prints the \"hash\" of the certificate subject name. This is used in OpenSSL to form an index to allow certificates in a directory to be looked up by subject name.

  • -subject_hash_old

    Prints the \"hash\" of the certificate subject name using the older algorithm as used by OpenSSL before version 1.0.0.

  • -issuer_hash

    Prints the \"hash\" of the certificate issuer name.

  • -issuer_hash_old

    Prints the \"hash\" of the certificate issuer name using the older algorithm as used by OpenSSL before version 1.0.0.

  • -ext extensions

    Prints out the certificate extensions in text form. Can also be used to restrict which extensions to copy. Extensions are specified with a comma separated string, e.g., \"subjectAltName,subjectKeyIdentifier\". See the x509v3_config(5) manual page for the extension names.

  • -ocspid

    Prints the OCSP hash values for the subject name and public key.

  • -ocsp_uri

    Prints the OCSP responder address(es) if any.

  • -purpose

    This option performs tests on the certificate extensions and outputs the results. For a more complete description see \"Certificate Extensions\" in openssl-verification-options(1).

  • -pubkey

    Prints the certificate's SubjectPublicKeyInfo block in PEM format.

  • -modulus

    This option prints out the value of the modulus of the public key contained in the certificate.

"},{"location":"man1/openssl-x509/#certificate-checking-options","title":"Certificate Checking Options","text":"
  • -checkend arg

    Checks if the certificate expires within the next arg seconds and exits nonzero if yes it will expire or zero if not.

  • -checkhost host

    Check that the certificate matches the specified host.

  • -checkemail email

    Check that the certificate matches the specified email address.

  • -checkip ipaddr

    Check that the certificate matches the specified IP address.

"},{"location":"man1/openssl-x509/#certificate-output-options","title":"Certificate Output Options","text":"
  • -set_serial n

    Specifies the serial number to use. This option can be used with the -key, -signkey, or -CA options. If used in conjunction with the -CA option the serial number file (as specified by the -CAserial option) is not used.

    The serial number can be decimal or hex (if preceded by 0x).

  • -next_serial

    Set the serial to be one more than the number in the certificate.

  • -days arg

    Specifies the number of days until a newly generated certificate expires. The default is 30. Cannot be used together with the -preserve_dates option.

  • -preserve_dates

    When signing a certificate, preserve \"notBefore\" and \"notAfter\" dates of any input certificate instead of adjusting them to current time and duration. Cannot be used together with the -days option.

  • -subj arg

    When a certificate is created set its subject name to the given value. When the certificate is self-signed the issuer name is set to the same value.

    The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted, but the corresponding type will not be included in the certificate. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

    /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

    This option can be used in conjunction with the -force_pubkey option to create a certificate even without providing an input certificate or certificate request.

  • -force_pubkey filename

    When a certificate is created set its public key to the key in filename instead of the key contained in the input or given with the -key (or -signkey) option.

    This option is useful for creating self-issued certificates that are not self-signed, for instance when the key cannot be used for signing, such as DH. It can also be used in conjunction with -new and -subj to directly generate a certificate containing any desired public key.

  • -clrext

    When transforming a certificate to a new certificate by default all certificate extensions are retained.

    When transforming a certificate or certificate request, the -clrext option prevents taking over any extensions from the source. In any case, when producing a certificate request, neither subject identifier nor authority key identifier extensions are included.

  • -extfile filename

    Configuration file containing certificate and request X.509 extensions to add.

  • -extensions section

    The section in the extfile to add X.509 extensions from. If this option is not specified then the extensions should either be contained in the unnamed (default) section or the default section should contain a variable called \"extensions\" which contains the section to use. See the x509v3_config(5) manual page for details of the extension section format.

  • -sigopt nm:v

    Pass options to the signature algorithm during sign operations. This option may be given multiple times. Names and values provided using this option are algorithm-specific.

  • -badsig

    Corrupt the signature before writing it; this can be useful for testing.

  • -digest

    The digest to use. This affects any signing or printing option that uses a message digest, such as the -fingerprint, -key, and -CA options. Any digest supported by the openssl-dgst(1) command can be used. If not specified then SHA1 is used with -fingerprint or the default digest for the signing algorithm is used, typically SHA256.

"},{"location":"man1/openssl-x509/#micro-ca-options","title":"Micro-CA Options","text":"
  • -CA filename|uri

    Specifies the \"CA\" certificate to be used for signing. When present, this behaves like a \"micro CA\" as follows: The subject name of the \"CA\" certificate is placed as issuer name in the new certificate, which is then signed using the \"CA\" key given as detailed below.

    This option cannot be used in conjunction with -key (or -signkey). This option is normally combined with the -req option referencing a CSR. Without the -req option the input must be an existing certificate unless the -new option is given, which generates a certificate from scratch.

  • -CAform DER|PEM|P12,

    The format for the CA certificate; unspecified by default. See openssl-format-options(1) for details.

  • -CAkey filename|uri

    Sets the CA private key to sign a certificate with. The private key must match the public key of the certificate given with -CA. If this option is not provided then the key must be present in the -CA input.

  • -CAkeyform DER|PEM|P12|ENGINE

    The format for the CA key; unspecified by default. See openssl-format-options(1) for details.

  • -CAserial filename

    Sets the CA serial number file to use.

    When creating a certificate with this option and with the -CA option, the certificate serial number is stored in the given file. This file consists of one line containing an even number of hex digits with the serial number used last time. After reading this number, it is incremented and used, and the file is updated.

    The default filename consists of the CA certificate file base name with .srl appended. For example if the CA certificate file is called mycacert.pem it expects to find a serial number file called mycacert.srl.

    If the -CA option is specified and neither <-CAserial> or <-CAcreateserial> is given and the default serial number file does not exist, a random number is generated; this is the recommended practice.

  • -CAcreateserial

    With this option and the -CA option the CA serial number file is created if it does not exist. A random number is generated, used for the certificate, and saved into the serial number file determined as described above.

"},{"location":"man1/openssl-x509/#trust-settings","title":"Trust Settings","text":"

A trusted certificate is an ordinary certificate which has several additional pieces of information attached to it such as the permitted and prohibited uses of the certificate and possibly an \"alias\" (nickname).

Normally when a certificate is being verified at least one certificate must be \"trusted\". By default a trusted certificate must be stored locally and must be a root CA: any certificate chain ending in this CA is then usable for any purpose.

Trust settings currently are only used with a root CA. They allow a finer control over the purposes the root CA can be used for. For example, a CA may be trusted for SSL client but not SSL server use.

See openssl-verification-options(1) for more information on the meaning of trust settings.

Future versions of OpenSSL will recognize trust settings on any certificate: not just root CAs.

  • -trustout

    Mark any certificate PEM output as <trusted> certificate rather than ordinary. An ordinary or trusted certificate can be input but by default an ordinary certificate is output and any trust settings are discarded. With the -trustout option a trusted certificate is output. A trusted certificate is automatically output if any trust settings are modified.

  • -setalias arg

    Sets the \"alias\" of the certificate. This will allow the certificate to be referred to using a nickname for example \"Steve's Certificate\".

  • -clrtrust

    Clears all the permitted or trusted uses of the certificate.

  • -addtrust arg

    Adds a trusted certificate use. Any object name can be used here but currently only clientAuth, serverAuth, emailProtection, and anyExtendedKeyUsage are defined. As of OpenSSL 1.1.0, the last of these blocks all purposes when rejected or enables all purposes when trusted. Other OpenSSL applications may define additional uses.

  • -clrreject

    Clears all the prohibited or rejected uses of the certificate.

  • -addreject arg

    Adds a prohibited trust anchor purpose. It accepts the same values as the -addtrust option.

"},{"location":"man1/openssl-x509/#generic-options","title":"Generic options","text":"
  • -rand files, -writerand file

    See \"Random State Options\" in openssl(1) for details.

  • -engine id

    See \"Engine Options\" in openssl(1). This option is deprecated.

  • -provider name

  • -provider-path path
  • -propquery propq

    See \"Provider Options\" in openssl(1), provider(7), and property(7).

"},{"location":"man1/openssl-x509/#text-printing-flags","title":"Text Printing Flags","text":"

As well as customising the name printing format, it is also possible to customise the actual fields printed using the certopt option when the text option is present. The default behaviour is to print all fields.

  • compatible

    Use the old format. This is equivalent to specifying no printing options at all.

  • no_header

    Don't print header information: that is the lines saying \"Certificate\" and \"Data\".

  • no_version

    Don't print out the version number.

  • no_serial

    Don't print out the serial number.

  • no_signame

    Don't print out the signature algorithm used.

  • no_validity

    Don't print the validity, that is the notBefore and notAfter fields.

  • no_subject

    Don't print out the subject name.

  • no_issuer

    Don't print out the issuer name.

  • no_pubkey

    Don't print out the public key.

  • no_sigdump

    Don't give a hexadecimal dump of the certificate signature.

  • no_aux

    Don't print out certificate trust information.

  • no_extensions

    Don't print out any X509V3 extensions.

  • ext_default

    Retain default extension behaviour: attempt to print out unsupported certificate extensions.

  • ext_error

    Print an error message for unsupported certificate extensions.

  • ext_parse

    ASN1 parse unsupported extensions.

  • ext_dump

    Hex dump unsupported extensions.

  • ca_default

    The value used by openssl-ca(1), equivalent to no_issuer, no_pubkey, no_header, and no_version.

"},{"location":"man1/openssl-x509/#examples","title":"EXAMPLES","text":"

Note: in these examples the '\\' means the example should be all on one line.

Print the contents of a certificate:

openssl x509 -in cert.pem -noout -text\n

Print the \"Subject Alternative Name\" extension of a certificate:

openssl x509 -in cert.pem -noout -ext subjectAltName\n

Print more extensions of a certificate:

openssl x509 -in cert.pem -noout -ext subjectAltName,nsCertType\n

Print the certificate serial number:

openssl x509 -in cert.pem -noout -serial\n

Print the certificate subject name:

openssl x509 -in cert.pem -noout -subject\n

Print the certificate subject name in RFC2253 form:

openssl x509 -in cert.pem -noout -subject -nameopt RFC2253\n

Print the certificate subject name in oneline form on a terminal supporting UTF8:

openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb\n

Print the certificate SHA1 fingerprint:

openssl x509 -sha1 -in cert.pem -noout -fingerprint\n

Convert a certificate from PEM to DER format:

openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER\n

Convert a certificate to a certificate request:

openssl x509 -x509toreq -in cert.pem -out req.pem -key key.pem\n

Convert a certificate request into a self-signed certificate using extensions for a CA:

openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \\\n       -key key.pem -out cacert.pem\n

Sign a certificate request using the CA certificate above and add user certificate extensions:

openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \\\n       -CA cacert.pem -CAkey key.pem -CAcreateserial\n

Set a certificate to be trusted for SSL client use and change set its alias to \"Steve's Class 1 CA\"

openssl x509 -in cert.pem -addtrust clientAuth \\\n       -setalias \"Steve's Class 1 CA\" -out trust.pem\n
"},{"location":"man1/openssl-x509/#notes","title":"NOTES","text":"

The conversion to UTF8 format used with the name options assumes that T61Strings use the ISO8859-1 character set. This is wrong but Netscape and MSIE do this as do many certificates. So although this is incorrect it is more likely to print the majority of certificates correctly.

The -email option searches the subject name and the subject alternative name extension. Only unique email addresses will be printed out: it will not print the same address more than once.

"},{"location":"man1/openssl-x509/#bugs","title":"BUGS","text":"

It is possible to produce invalid certificates or requests by specifying the wrong private key, using unsuitable X.509 extensions, or using inconsistent options in some cases: these should be checked.

There should be options to explicitly set such things as start and end dates rather than an offset from the current time.

"},{"location":"man1/openssl-x509/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-req(1), openssl-ca(1), openssl-genrsa(1), openssl-gendsa(1), openssl-verify(1), x509v3_config(5)

"},{"location":"man1/openssl-x509/#history","title":"HISTORY","text":"

The hash algorithm used in the -subject_hash and -issuer_hash options before OpenSSL 1.0.0 was based on the deprecated MD5 algorithm and the encoding of the distinguished name. In OpenSSL 1.0.0 and later it is based on a canonical version of the DN using SHA1. This means that any directories using the old form must have their links rebuilt using openssl-rehash(1) or similar.

The -signkey option has been renamed to -key in OpenSSL 3.0, keeping the old name as an alias.

The -engine option was deprecated in OpenSSL 3.0.

The -C option was removed in OpenSSL 3.0.

"},{"location":"man1/openssl-x509/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/openssl/","title":"openssl","text":""},{"location":"man1/openssl/#name","title":"NAME","text":"

openssl - OpenSSL command line program

"},{"location":"man1/openssl/#synopsis","title":"SYNOPSIS","text":"

openssl command [ options ... ] [ parameters ... ]

openssl no-XXX [ options ]

"},{"location":"man1/openssl/#description","title":"DESCRIPTION","text":"

OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them.

The openssl program is a command line program for using the various cryptography functions of OpenSSL's crypto library from the shell. It can be used for

o  Creation and management of private keys, public keys and parameters\no  Public key cryptographic operations\no  Creation of X.509 certificates, CSRs and CRLs\no  Calculation of Message Digests and Message Authentication Codes\no  Encryption and Decryption with Ciphers\no  SSL/TLS Client and Server Tests\no  Handling of S/MIME signed or encrypted mail\no  Timestamp requests, generation and verification\n
"},{"location":"man1/openssl/#command-summary","title":"COMMAND SUMMARY","text":"

The openssl program provides a rich variety of commands (command in the \"SYNOPSIS\" above). Each command can have many options and argument parameters, shown above as options and parameters.

Detailed documentation and use cases for most standard subcommands are available (e.g., openssl-x509(1)). The subcommand openssl-list(1) may be used to list subcommands.

The command no-XXX tests whether a command of the specified name is available. If no command named XXX exists, it returns 0 (success) and prints no-XXX; otherwise it returns 1 and prints XXX. In both cases, the output goes to stdout and nothing is printed to stderr. Additional command line arguments are always ignored. Since for each cipher there is a command of the same name, this provides an easy way for shell scripts to test for the availability of ciphers in the openssl program. (no-XXX is not able to detect pseudo-commands such as quit, list, or no-XXX itself.)

"},{"location":"man1/openssl/#configuration-option","title":"Configuration Option","text":"

Many commands use an external configuration file for some or all of their arguments and have a -config option to specify that file. The default name of the file is openssl.cnf in the default certificate storage area, which can be determined from the openssl-version(1) command using the -d or -a option. The environment variable OPENSSL_CONF can be used to specify a different file location or to disable loading a configuration (using the empty string).

Among others, the configuration file can be used to load modules and to specify parameters for generating certificates and random numbers. See config(5) for details.

"},{"location":"man1/openssl/#standard-commands","title":"Standard Commands","text":"
  • asn1parse

    Parse an ASN.1 sequence.

  • ca

    Certificate Authority (CA) Management.

  • ciphers

    Cipher Suite Description Determination.

  • cms

    CMS (Cryptographic Message Syntax) command.

  • crl

    Certificate Revocation List (CRL) Management.

  • crl2pkcs7

    CRL to PKCS#7 Conversion.

  • dgst

    Message Digest calculation. MAC calculations are superseded by openssl-mac(1).

  • dhparam

    Generation and Management of Diffie-Hellman Parameters. Superseded by openssl-genpkey(1) and openssl-pkeyparam(1).

  • dsa

    DSA Data Management.

  • dsaparam

    DSA Parameter Generation and Management. Superseded by openssl-genpkey(1) and openssl-pkeyparam(1).

  • ec

    EC (Elliptic curve) key processing.

  • ecparam

    EC parameter manipulation and generation.

  • enc

    Encryption, decryption, and encoding.

  • engine

    Engine (loadable module) information and manipulation.

  • errstr

    Error Number to Error String Conversion.

  • fipsinstall

    FIPS configuration installation.

  • gendsa

    Generation of DSA Private Key from Parameters. Superseded by openssl-genpkey(1) and openssl-pkey(1).

  • genpkey

    Generation of Private Key or Parameters.

  • genrsa

    Generation of RSA Private Key. Superseded by openssl-genpkey(1).

  • help

    Display information about a command's options.

  • info

    Display diverse information built into the OpenSSL libraries.

  • kdf

    Key Derivation Functions.

  • list

    List algorithms and features.

  • mac

    Message Authentication Code Calculation.

  • nseq

    Create or examine a Netscape certificate sequence.

  • ocsp

    Online Certificate Status Protocol command.

  • passwd

    Generation of hashed passwords.

  • pkcs12

    PKCS#12 Data Management.

  • pkcs7

    PKCS#7 Data Management.

  • pkcs8

    PKCS#8 format private key conversion command.

  • pkey

    Public and private key management.

  • pkeyparam

    Public key algorithm parameter management.

  • pkeyutl

    Public key algorithm cryptographic operation command.

  • prime

    Compute prime numbers.

  • rand

    Generate pseudo-random bytes.

  • rehash

    Create symbolic links to certificate and CRL files named by the hash values.

  • req

    PKCS#10 X.509 Certificate Signing Request (CSR) Management.

  • rsa

    RSA key management.

  • rsautl

    RSA command for signing, verification, encryption, and decryption. Superseded by openssl-pkeyutl(1).

  • s_client

    This implements a generic SSL/TLS client which can establish a transparent connection to a remote server speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library.

  • s_server

    This implements a generic SSL/TLS server which accepts connections from remote clients speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library. It provides both an own command line oriented protocol for testing SSL functions and a simple HTTP response facility to emulate an SSL/TLS-aware webserver.

  • s_time

    SSL Connection Timer.

  • sess_id

    SSL Session Data Management.

  • smime

    S/MIME mail processing.

  • speed

    Algorithm Speed Measurement.

  • spkac

    SPKAC printing and generating command.

  • srp

    Maintain SRP password file. This command is deprecated.

  • storeutl

    Command to list and display certificates, keys, CRLs, etc.

  • ts

    Time Stamping Authority command.

  • verify

    X.509 Certificate Verification. See also the openssl-verification-options(1) manual page.

  • version

    OpenSSL Version Information.

  • x509

    X.509 Certificate Data Management.

"},{"location":"man1/openssl/#message-digest-commands","title":"Message Digest Commands","text":"
  • blake2b512

    BLAKE2b-512 Digest

  • blake2s256

    BLAKE2s-256 Digest

  • md2

    MD2 Digest

  • md4

    MD4 Digest

  • md5

    MD5 Digest

  • mdc2

    MDC2 Digest

  • rmd160

    RMD-160 Digest

  • sha1

    SHA-1 Digest

  • sha224

    SHA-2 224 Digest

  • sha256

    SHA-2 256 Digest

  • sha384

    SHA-2 384 Digest

  • sha512

    SHA-2 512 Digest

  • sha3-224

    SHA-3 224 Digest

  • sha3-256

    SHA-3 256 Digest

  • sha3-384

    SHA-3 384 Digest

  • sha3-512

    SHA-3 512 Digest

  • shake128

    SHA-3 SHAKE128 Digest

  • shake256

    SHA-3 SHAKE256 Digest

  • sm3

    SM3 Digest

"},{"location":"man1/openssl/#encryption-decryption-and-encoding-commands","title":"Encryption, Decryption, and Encoding Commands","text":"

The following aliases provide convenient access to the most used encodings and ciphers.

Depending on how OpenSSL was configured and built, not all ciphers listed here may be present. See openssl-enc(1) for more information.

  • aes128, aes-128-cbc, aes-128-cfb, aes-128-ctr, aes-128-ecb, aes-128-ofb

    AES-128 Cipher

  • aes192, aes-192-cbc, aes-192-cfb, aes-192-ctr, aes-192-ecb, aes-192-ofb

    AES-192 Cipher

  • aes256, aes-256-cbc, aes-256-cfb, aes-256-ctr, aes-256-ecb, aes-256-ofb

    AES-256 Cipher

  • aria128, aria-128-cbc, aria-128-cfb, aria-128-ctr, aria-128-ecb, aria-128-ofb

    Aria-128 Cipher

  • aria192, aria-192-cbc, aria-192-cfb, aria-192-ctr, aria-192-ecb, aria-192-ofb

    Aria-192 Cipher

  • aria256, aria-256-cbc, aria-256-cfb, aria-256-ctr, aria-256-ecb, aria-256-ofb

    Aria-256 Cipher

  • base64

    Base64 Encoding

  • bf, bf-cbc, bf-cfb, bf-ecb, bf-ofb

    Blowfish Cipher

  • camellia128, camellia-128-cbc, camellia-128-cfb, camellia-128-ctr, camellia-128-ecb, camellia-128-ofb

    Camellia-128 Cipher

  • camellia192, camellia-192-cbc, camellia-192-cfb, camellia-192-ctr, camellia-192-ecb, camellia-192-ofb

    Camellia-192 Cipher

  • camellia256, camellia-256-cbc, camellia-256-cfb, camellia-256-ctr, camellia-256-ecb, camellia-256-ofb

    Camellia-256 Cipher

  • cast, cast-cbc

    CAST Cipher

  • cast5-cbc, cast5-cfb, cast5-ecb, cast5-ofb

    CAST5 Cipher

  • chacha20

    Chacha20 Cipher

  • des, des-cbc, des-cfb, des-ecb, des-ede, des-ede-cbc, des-ede-cfb, des-ede-ofb, des-ofb

    DES Cipher

  • des3, desx, des-ede3, des-ede3-cbc, des-ede3-cfb, des-ede3-ofb

    Triple-DES Cipher

  • idea, idea-cbc, idea-cfb, idea-ecb, idea-ofb

    IDEA Cipher

  • rc2, rc2-cbc, rc2-cfb, rc2-ecb, rc2-ofb

    RC2 Cipher

  • rc4

    RC4 Cipher

  • rc5, rc5-cbc, rc5-cfb, rc5-ecb, rc5-ofb

    RC5 Cipher

  • seed, seed-cbc, seed-cfb, seed-ecb, seed-ofb

    SEED Cipher

  • sm4, sm4-cbc, sm4-cfb, sm4-ctr, sm4-ecb, sm4-ofb

    SM4 Cipher

"},{"location":"man1/openssl/#options","title":"OPTIONS","text":"

Details of which options are available depend on the specific command. This section describes some common options with common behavior.

"},{"location":"man1/openssl/#common-options","title":"Common Options","text":"
  • -help

    Provides a terse summary of all options. If an option takes an argument, the \"type\" of argument is also given.

  • --

    This terminates the list of options. It is mostly useful if any filename parameters start with a minus sign:

    openssl verify [flags...] -- -cert1.pem...\n
"},{"location":"man1/openssl/#format-options","title":"Format Options","text":"

See openssl-format-options(1) for manual page.

"},{"location":"man1/openssl/#pass-phrase-options","title":"Pass Phrase Options","text":"

See the openssl-passphrase-options(1) manual page.

"},{"location":"man1/openssl/#random-state-options","title":"Random State Options","text":"

Prior to OpenSSL 1.1.1, it was common for applications to store information about the state of the random-number generator in a file that was loaded at startup and rewritten upon exit. On modern operating systems, this is generally no longer necessary as OpenSSL will seed itself from a trusted entropy source provided by the operating system. These flags are still supported for special platforms or circumstances that might require them.

It is generally an error to use the same seed file more than once and every use of -rand should be paired with -writerand.

  • -rand files

    A file or files containing random data used to seed the random number generator. Multiple files can be specified separated by an OS-dependent character. The separator is ; for MS-Windows, , for OpenVMS, and : for all others. Another way to specify multiple files is to repeat this flag with different filenames.

  • -writerand file

    Writes the seed data to the specified file upon exit. This file can be used in a subsequent command invocation.

"},{"location":"man1/openssl/#certificate-verification-options","title":"Certificate Verification Options","text":"

See the openssl-verification-options(1) manual page.

"},{"location":"man1/openssl/#name-format-options","title":"Name Format Options","text":"

See the openssl-namedisplay-options(1) manual page.

"},{"location":"man1/openssl/#tls-version-options","title":"TLS Version Options","text":"

Several commands use SSL, TLS, or DTLS. By default, the commands use TLS and clients will offer the lowest and highest protocol version they support, and servers will pick the highest version that the client offers that is also supported by the server.

The options below can be used to limit which protocol versions are used, and whether TCP (SSL and TLS) or UDP (DTLS) is used. Note that not all protocols and flags may be available, depending on how OpenSSL was built.

  • -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3, -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3

    These options require or disable the use of the specified SSL or TLS protocols. When a specific TLS version is required, only that version will be offered or accepted. Only one specific protocol can be given and it cannot be combined with any of the no_ options. The no_* options do not work with s_time and ciphers commands but work with s_client and s_server commands.

  • -dtls, -dtls1, -dtls1_2

    These options specify to use DTLS instead of TLS. With -dtls, clients will negotiate any supported DTLS protocol version. Use the -dtls1 or -dtls1_2 options to support only DTLS1.0 or DTLS1.2, respectively.

"},{"location":"man1/openssl/#engine-options","title":"Engine Options","text":"
  • -engine id

    Load the engine identified by id and use all the methods it implements (algorithms, key storage, etc.), unless specified otherwise in the command-specific documentation or it is configured to do so, as described in \"Engine Configuration\" in config(5).

    The engine will be used for key ids specified with -key and similar options when an option like -keyform engine is given.

    A special case is the loader_attic engine, which is meant just for internal OpenSSL testing purposes and supports loading keys, parameters, certificates, and CRLs from files. When this engine is used, files with such credentials are read via this engine. Using the file: schema is optional; a plain file (path) name will do.

Options specifying keys, like -key and similar, can use the generic OpenSSL engine key loading URI scheme org.openssl.engine: to retrieve private keys and public keys. The URI syntax is as follows, in simplified form:

org.openssl.engine:{engineid}:{keyid}\n

Where {engineid} is the identity/name of the engine, and {keyid} is a key identifier that's acceptable by that engine. For example, when using an engine that interfaces against a PKCS#11 implementation, the generic key URI would be something like this (this happens to be an example for the PKCS#11 engine that's part of OpenSC):

-key org.openssl.engine:pkcs11:label_some-private-key\n

As a third possibility, for engines and providers that have implemented their own OSSL_STORE_LOADER(3), org.openssl.engine: should not be necessary. For a PKCS#11 implementation that has implemented such a loader, the PKCS#11 URI as defined in RFC 7512 should be possible to use directly:

-key pkcs11:object=some-private-key;pin-value=1234\n
"},{"location":"man1/openssl/#provider-options","title":"Provider Options","text":"
  • -provider name

    Load and initialize the provider identified by name. The name can be also a path to the provider module. In that case the provider name will be the specified path and not just the provider module name. Interpretation of relative paths is platform specific. The configured \"MODULESDIR\" path, OPENSSL_MODULES environment variable, or the path specified by -provider-path is prepended to relative paths. See provider(7) for a more detailed description.

  • -provider-path path

    Specifies the search path that is to be used for looking for providers. Equivalently, the OPENSSL_MODULES environment variable may be set.

  • -propquery propq

    Specifies the property query clause to be used when fetching algorithms from the loaded providers. See property(7) for a more detailed description.

"},{"location":"man1/openssl/#environment","title":"ENVIRONMENT","text":"

The OpenSSL library can be take some configuration parameters from the environment. Some of these variables are listed below. For information about specific commands, see openssl-engine(1), openssl-rehash(1), and tsget(1).

For information about the use of environment variables in configuration, see \"ENVIRONMENT\" in config(5).

For information about querying or specifying CPU architecture flags, see OPENSSL_ia32cap(3), and OPENSSL_s390xcap(3).

For information about all environment variables used by the OpenSSL libraries, see openssl-env(7).

  • OPENSSL_TRACE=name[,...]

    Enable tracing output of OpenSSL library, by name. This output will only make sense if you know OpenSSL internals well. Also, it might not give you any output at all if OpenSSL was built without tracing support.

    The value is a comma separated list of names, with the following available:

    • TRACE

      Traces the OpenSSL trace API itself.

    • INIT

      Traces OpenSSL library initialization and cleanup.

    • TLS

      Traces the TLS/SSL protocol.

    • TLS_CIPHER

      Traces the ciphers used by the TLS/SSL protocol.

    • CONF

      Show details about provider and engine configuration.

    • ENGINE_TABLE

      The function that is used by RSA, DSA (etc) code to select registered ENGINEs, cache defaults and functional references (etc), will generate debugging summaries.

    • ENGINE_REF_COUNT

      Reference counts in the ENGINE structure will be monitored with a line of generated for each change.

    • PKCS5V2

      Traces PKCS#5 v2 key generation.

    • PKCS12_KEYGEN

      Traces PKCS#12 key generation.

    • PKCS12_DECRYPT

      Traces PKCS#12 decryption.

    • X509V3_POLICY

      Generates the complete policy tree at various points during X.509 v3 policy evaluation.

    • BN_CTX

      Traces BIGNUM context operations.

    • CMP

      Traces CMP client and server activity.

    • STORE

      Traces STORE operations.

    • DECODER

      Traces decoder operations.

    • ENCODER

      Traces encoder operations.

    • REF_COUNT

      Traces decrementing certain ASN.1 structure references.

    • HTTP

      HTTP client diagnostics

"},{"location":"man1/openssl/#see-also","title":"SEE ALSO","text":"

openssl-asn1parse(1), openssl-ca(1), openssl-ciphers(1), openssl-cms(1), openssl-crl(1), openssl-crl2pkcs7(1), openssl-dgst(1), openssl-dhparam(1), openssl-dsa(1), openssl-dsaparam(1), openssl-ec(1), openssl-ecparam(1), openssl-enc(1), openssl-engine(1), openssl-errstr(1), openssl-gendsa(1), openssl-genpkey(1), openssl-genrsa(1), openssl-kdf(1), openssl-list(1), openssl-mac(1), openssl-nseq(1), openssl-ocsp(1), openssl-passwd(1), openssl-pkcs12(1), openssl-pkcs7(1), openssl-pkcs8(1), openssl-pkey(1), openssl-pkeyparam(1), openssl-pkeyutl(1), openssl-prime(1), openssl-rand(1), openssl-rehash(1), openssl-req(1), openssl-rsa(1), openssl-rsautl(1), openssl-s_client(1), openssl-s_server(1), openssl-s_time(1), openssl-sess_id(1), openssl-smime(1), openssl-speed(1), openssl-spkac(1), openssl-srp(1), openssl-storeutl(1), openssl-ts(1), openssl-verify(1), openssl-version(1), openssl-x509(1), config(5), crypto(7), openssl-env(7). ssl(7), x509v3_config(5)

"},{"location":"man1/openssl/#history","title":"HISTORY","text":"

The list -XXX-algorithms options were added in OpenSSL 1.0.0; For notes on the availability of other commands, see their individual manual pages.

The -issuer_checks option is deprecated as of OpenSSL 1.1.0 and is silently ignored.

The -xcertform and -xkeyform options are obsolete since OpenSSL 3.0 and have no effect.

The interactive mode, which could be invoked by running openssl with no further arguments, was removed in OpenSSL 3.0, and running that program with no arguments is now equivalent to openssl help.

"},{"location":"man1/openssl/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man1/tsget/","title":"tsget","text":""},{"location":"man1/tsget/#name","title":"NAME","text":"

tsget - Time Stamping HTTP/HTTPS client

"},{"location":"man1/tsget/#synopsis","title":"SYNOPSIS","text":"

tsget -h server_url [-e extension] [-o output] [-v] [-d] [-k private_key.pem] [-p key_password] [-c client_cert.pem] [-C CA_certs.pem] [-P CA_path] [-r files] [-g EGD_socket] [request ...]

"},{"location":"man1/tsget/#description","title":"DESCRIPTION","text":"

This command can be used for sending a timestamp request, as specified in RFC 3161, to a timestamp server over HTTP or HTTPS and storing the timestamp response in a file. It cannot be used for creating the requests and verifying responses, you have to use openssl-ts(1) to do that. This command can send several requests to the server without closing the TCP connection if more than one requests are specified on the command line.

This command sends the following HTTP request for each timestamp request:

    POST url HTTP/1.1\n    User-Agent: OpenTSA tsget.pl/<version>\n    Host: <host>:<port>\n    Pragma: no-cache\n    Content-Type: application/timestamp-query\n    Accept: application/timestamp-reply\n    Content-Length: length of body\n\n    ...binary request specified by the user...\n

It expects a response of type application/timestamp-reply, which is written to a file without any interpretation.

"},{"location":"man1/tsget/#options","title":"OPTIONS","text":"
  • -h server_url

    The URL of the HTTP/HTTPS server listening for timestamp requests.

  • -e extension

    If the -o option is not given this argument specifies the extension of the output files. The base name of the output file will be the same as those of the input files. Default extension is .tsr. (Optional)

  • -o output

    This option can be specified only when just one request is sent to the server. The timestamp response will be written to the given output file. '-' means standard output. In case of multiple timestamp requests or the absence of this argument the names of the output files will be derived from the names of the input files and the default or specified extension argument. (Optional)

  • -v

    The name of the currently processed request is printed on standard error. (Optional)

  • -d

    Switches on verbose mode for the underlying perl module WWW::Curl::Easy. You can see detailed debug messages for the connection. (Optional)

  • -k private_key.pem

    (HTTPS) In case of certificate-based client authentication over HTTPS private_key.pem must contain the private key of the user. The private key file can optionally be protected by a passphrase. The -c option must also be specified. (Optional)

  • -p key_password

    (HTTPS) Specifies the passphrase for the private key specified by the -k argument. If this option is omitted and the key is passphrase protected, it will be prompted for. (Optional)

  • -c client_cert.pem

    (HTTPS) In case of certificate-based client authentication over HTTPS client_cert.pem must contain the X.509 certificate of the user. The -k option must also be specified. If this option is not specified no certificate-based client authentication will take place. (Optional)

  • -C CA_certs.pem

    (HTTPS) The trusted CA certificate store. The certificate chain of the peer's certificate must include one of the CA certificates specified in this file. Either option -C or option -P must be given in case of HTTPS. (Optional)

  • -P CA_path

    (HTTPS) The path containing the trusted CA certificates to verify the peer's certificate. The directory must be prepared with openssl-rehash(1). Either option -C or option -P must be given in case of HTTPS. (Optional)

  • -r files

    See \"Random State Options\" in openssl(1) for more information.

  • -g EGD_socket

    The name of an EGD socket to get random data from. (Optional)

  • request ...

    List of files containing RFC 3161 DER-encoded timestamp requests. If no requests are specified only one request will be sent to the server and it will be read from the standard input. (Optional)

"},{"location":"man1/tsget/#environment-variables","title":"ENVIRONMENT VARIABLES","text":"

The TSGET environment variable can optionally contain default arguments. The content of this variable is added to the list of command line arguments.

"},{"location":"man1/tsget/#examples","title":"EXAMPLES","text":"

The examples below presume that file1.tsq and file2.tsq contain valid timestamp requests, tsa.opentsa.org listens at port 8080 for HTTP requests and at port 8443 for HTTPS requests, the TSA service is available at the /tsa absolute path.

Get a timestamp response for file1.tsq over HTTP, output is written to file1.tsr:

tsget -h http://tsa.opentsa.org:8080/tsa file1.tsq\n

Get a timestamp response for file1.tsq and file2.tsq over HTTP showing progress, output is written to file1.reply and file2.reply respectively:

tsget -h http://tsa.opentsa.org:8080/tsa -v -e .reply \\\n      file1.tsq file2.tsq\n

Create a timestamp request, write it to file3.tsq, send it to the server and write the response to file3.tsr:

openssl ts -query -data file3.txt -cert | tee file3.tsq \\\n      | tsget -h http://tsa.opentsa.org:8080/tsa \\\n      -o file3.tsr\n

Get a timestamp response for file1.tsq over HTTPS without client authentication:

tsget -h https://tsa.opentsa.org:8443/tsa \\\n      -C cacerts.pem file1.tsq\n

Get a timestamp response for file1.tsq over HTTPS with certificate-based client authentication (it will ask for the passphrase if client_key.pem is protected):

tsget -h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \\\n      -k client_key.pem -c client_cert.pem file1.tsq\n

You can shorten the previous command line if you make use of the TSGET environment variable. The following commands do the same as the previous example:

TSGET='-h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \\\n      -k client_key.pem -c client_cert.pem'\nexport TSGET\ntsget file1.tsq\n
"},{"location":"man1/tsget/#see-also","title":"SEE ALSO","text":"

openssl(1), openssl-ts(1), WWW::Curl::Easy, https://www.rfc-editor.org/rfc/rfc3161.html

"},{"location":"man1/tsget/#copyright","title":"COPYRIGHT","text":"

Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ADMISSIONS/","title":"ADMISSIONS","text":""},{"location":"man3/ADMISSIONS/#name","title":"NAME","text":"

ADMISSIONS, ADMISSIONS_get0_admissionAuthority, ADMISSIONS_get0_namingAuthority, ADMISSIONS_get0_professionInfos, ADMISSIONS_set0_admissionAuthority, ADMISSIONS_set0_namingAuthority, ADMISSIONS_set0_professionInfos, ADMISSION_SYNTAX, ADMISSION_SYNTAX_get0_admissionAuthority, ADMISSION_SYNTAX_get0_contentsOfAdmissions, ADMISSION_SYNTAX_set0_admissionAuthority, ADMISSION_SYNTAX_set0_contentsOfAdmissions, NAMING_AUTHORITY, NAMING_AUTHORITY_get0_authorityId, NAMING_AUTHORITY_get0_authorityURL, NAMING_AUTHORITY_get0_authorityText, NAMING_AUTHORITY_set0_authorityId, NAMING_AUTHORITY_set0_authorityURL, NAMING_AUTHORITY_set0_authorityText, PROFESSION_INFO, PROFESSION_INFOS, PROFESSION_INFO_get0_addProfessionInfo, PROFESSION_INFO_get0_namingAuthority, PROFESSION_INFO_get0_professionItems, PROFESSION_INFO_get0_professionOIDs, PROFESSION_INFO_get0_registrationNumber, PROFESSION_INFO_set0_addProfessionInfo, PROFESSION_INFO_set0_namingAuthority, PROFESSION_INFO_set0_professionItems, PROFESSION_INFO_set0_professionOIDs, PROFESSION_INFO_set0_registrationNumber - Accessors and settors for ADMISSION_SYNTAX

"},{"location":"man3/ADMISSIONS/#synopsis","title":"SYNOPSIS","text":"
typedef struct NamingAuthority_st NAMING_AUTHORITY;\ntypedef struct ProfessionInfo_st PROFESSION_INFO;\ntypedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS;\ntypedef struct Admissions_st ADMISSIONS;\ntypedef struct AdmissionSyntax_st ADMISSION_SYNTAX;\n\nconst ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId(\n    const NAMING_AUTHORITY *n);\nvoid NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n,\n    ASN1_OBJECT* namingAuthorityId);\nconst ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL(\n    const NAMING_AUTHORITY *n);\nvoid NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n,\n    ASN1_IA5STRING* namingAuthorityUrl);\nconst ASN1_STRING *NAMING_AUTHORITY_get0_authorityText(\n    const NAMING_AUTHORITY *n);\nvoid NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n,\n    ASN1_STRING* namingAuthorityText);\n\nconst GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority(\n    const ADMISSION_SYNTAX *as);\nvoid ADMISSION_SYNTAX_set0_admissionAuthority(\n    ADMISSION_SYNTAX *as, GENERAL_NAME *aa);\nconst STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions(\n    const ADMISSION_SYNTAX *as);\nvoid ADMISSION_SYNTAX_set0_contentsOfAdmissions(\n    ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a);\n\nconst GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a);\nvoid ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa);\nconst NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a);\nvoid ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na);\nconst PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a);\nvoid ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi);\n\nconst ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_addProfessionInfo(\n    PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos);\nconst NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_namingAuthority(\n    PROFESSION_INFO *pi, NAMING_AUTHORITY *na);\nconst STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_professionItems(\n    PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as);\nconst STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_professionOIDs(\n    PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po);\nconst ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_registrationNumber(\n    PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn);\n
"},{"location":"man3/ADMISSIONS/#description","title":"DESCRIPTION","text":"

The PROFESSION_INFOS, ADMISSION_SYNTAX, ADMISSIONS, and PROFESSION_INFO types are opaque structures representing the analogous types defined in the Common PKI Specification published by https://www.t7ev.org. Knowledge of those structures and their semantics is assumed.

The conventional routines to convert between DER and the local format are described in d2i_X509(3). The conventional routines to allocate and free the types are defined in X509_dup(3).

The PROFESSION_INFOS type is a stack of PROFESSION_INFO; see DEFINE_STACK_OF(3) for details.

The NAMING_AUTHORITY type has an authority ID and URL, and text fields. The NAMING_AUTHORITY_get0_authorityId(), NAMING_AUTHORITY_get0_get0_authorityURL(), and NAMING_AUTHORITY_get0_get0_authorityText(), functions return pointers to those values within the object. The NAMING_AUTHORITY_set0_authorityId(), NAMING_AUTHORITY_set0_get0_authorityURL(), and NAMING_AUTHORITY_set0_get0_authorityText(), functions free any existing value and set the pointer to the specified value.

The ADMISSION_SYNTAX type has an authority name and a stack of ADMISSION objects. The ADMISSION_SYNTAX_get0_admissionAuthority() and ADMISSION_SYNTAX_get0_contentsOfAdmissions() functions return pointers to those values within the object. The ADMISSION_SYNTAX_set0_admissionAuthority() and ADMISSION_SYNTAX_set0_contentsOfAdmissions() functions free any existing value and set the pointer to the specified value.

The ADMISSION type has an authority name, authority object, and a stack of PROFESSION_INFO items. The ADMISSIONS_get0_admissionAuthority(), ADMISSIONS_get0_namingAuthority(), and ADMISSIONS_get0_professionInfos() functions return pointers to those values within the object. The ADMISSIONS_set0_admissionAuthority(), ADMISSIONS_set0_namingAuthority(), and ADMISSIONS_set0_professionInfos() functions free any existing value and set the pointer to the specified value.

The PROFESSION_INFO type has a name authority, stacks of profession Items and OIDs, a registration number, and additional profession info. The functions PROFESSION_INFO_get0_addProfessionInfo(), PROFESSION_INFO_get0_namingAuthority(), PROFESSION_INFO_get0_professionItems(), PROFESSION_INFO_get0_professionOIDs(), and PROFESSION_INFO_get0_registrationNumber() functions return pointers to those values within the object. The PROFESSION_INFO_set0_addProfessionInfo(), PROFESSION_INFO_set0_namingAuthority(), PROFESSION_INFO_set0_professionItems(), PROFESSION_INFO_set0_professionOIDs(), and PROFESSION_INFO_set0_registrationNumber() functions free any existing value and set the pointer to the specified value.

"},{"location":"man3/ADMISSIONS/#return-values","title":"RETURN VALUES","text":"

Described above. Note that all of the get0 functions return a pointer to the internal data structure and must not be freed.

"},{"location":"man3/ADMISSIONS/#see-also","title":"SEE ALSO","text":"

X509_dup(3), d2i_X509(3),

"},{"location":"man3/ADMISSIONS/#copyright","title":"COPYRIGHT","text":"

Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_EXTERN_FUNCS/","title":"ASN1_EXTERN_FUNCS","text":""},{"location":"man3/ASN1_EXTERN_FUNCS/#name","title":"NAME","text":"

ASN1_EXTERN_FUNCS, ASN1_ex_d2i, ASN1_ex_d2i_ex, ASN1_ex_i2d, ASN1_ex_new_func, ASN1_ex_new_ex_func, ASN1_ex_free_func, ASN1_ex_print_func, IMPLEMENT_EXTERN_ASN1 - ASN.1 external function support

"},{"location":"man3/ASN1_EXTERN_FUNCS/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1t.h>\n\ntypedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,\n                        const ASN1_ITEM *it, int tag, int aclass, char opt,\n                        ASN1_TLC *ctx);\ntypedef int ASN1_ex_d2i_ex(ASN1_VALUE **pval, const unsigned char **in, long len,\n                           const ASN1_ITEM *it, int tag, int aclass, char opt,\n                           ASN1_TLC *ctx, OSSL_LIB_CTX *libctx,\n                           const char *propq);\ntypedef int ASN1_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,\n                        const ASN1_ITEM *it, int tag, int aclass);\ntypedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\ntypedef int ASN1_ex_new_ex_func(ASN1_VALUE **pval, const ASN1_ITEM *it,\n                                OSSL_LIB_CTX *libctx, const char *propq);\ntypedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\ntypedef int ASN1_ex_print_func(BIO *out, const ASN1_VALUE **pval,\n                               int indent, const char *fname,\n                               const ASN1_PCTX *pctx);\n\nstruct ASN1_EXTERN_FUNCS_st {\n   void *app_data;\n   ASN1_ex_new_func *asn1_ex_new;\n   ASN1_ex_free_func *asn1_ex_free;\n   ASN1_ex_free_func *asn1_ex_clear;\n   ASN1_ex_d2i *asn1_ex_d2i;\n   ASN1_ex_i2d *asn1_ex_i2d;\n   ASN1_ex_print_func *asn1_ex_print;\n   ASN1_ex_new_ex_func *asn1_ex_new_ex;\n   ASN1_ex_d2i_ex *asn1_ex_d2i_ex;\n};\ntypedef struct ASN1_EXTERN_FUNCS_st ASN1_EXTERN_FUNCS;\n\n#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs)\n
"},{"location":"man3/ASN1_EXTERN_FUNCS/#description","title":"DESCRIPTION","text":"

ASN.1 data structures templates are typically defined in OpenSSL using a series of macros such as ASN1_SEQUENCE(), ASN1_SEQUENCE_END() and so on. Instead templates can also be defined based entirely on external functions. These external functions are called to perform operations such as creating a new ASN1_VALUE or converting an ASN1_VALUE to or from DER encoding.

The macro IMPLEMENT_EXTERN_ASN1() can be used to create such an externally defined structure. The name of the structure should be supplied in the sname parameter. The tag for the structure (e.g. typically V_ASN1_SEQUENCE) should be supplied in the tag parameter. Finally a pointer to an ASN1_EXTERN_FUNCS structure should be supplied in the fptrs parameter.

The ASN1_EXTERN_FUNCS structure has the following entries.

  • app_data

    A pointer to arbitrary application specific data.

  • asn1_ex_new

    A \"new\" function responsible for constructing a new ASN1_VALUE object. The newly constructed value should be stored in *pval. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro.

    Returns a positive value on success or 0 on error.

  • asn1_ex_free

    A \"free\" function responsible for freeing the ASN1_VALUE passed in *pval that was previously allocated via a \"new\" function. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro.

  • asn1_ex_clear

    A \"clear\" function responsible for clearing any data in the ASN1_VALUE passed in *pval and making it suitable for reuse. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro.

  • asn1_ex_d2i

    A \"d2i\" function responsible for converting DER data with the tag tag and class class into an ASN1_VALUE. If *pval is non-NULL then the ASN_VALUE it points to should be reused. Otherwise a new ASN1_VALUE should be allocated and stored in *pval. *in points to the DER data to be decoded and len is the length of that data. After decoding *in should be updated to point at the next byte after the decoded data. If the ASN1_VALUE is considered optional in this context then opt will be nonzero. Otherwise it will be zero. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro. A pointer to the current ASN1_TLC context (which may be required for other ASN1 function calls) is passed in the ctx parameter.

    The asn1_ex_d2i entry may be NULL if asn1_ex_d2i_ex has been specified instead.

    Returns <= 0 on error or a positive value on success.

  • asn1_ex_i2d

    An \"i2d\" function responsible for converting an ASN1_VALUE into DER encoding. On entry *pval will contain the ASN1_VALUE to be encoded. If default tagging is to be used then tag will be -1 on entry. Otherwise if implicit tagging should be used then tag and aclass will be the tag and associated class.

    If out is not NULL then this function should write the DER encoded data to the buffer in *out, and then increment *out to point to immediately after the data just written.

    If out is NULL then no data should be written but the length calculated and returned as if it were.

    The asn1_ex_i2d entry may be NULL if asn1_ex_i2d_ex has been specified instead.

    The return value should be negative if a fatal error occurred, or 0 if a non-fatal error occurred. Otherwise it should return the length of the encoded data.

  • asn1_ex_print

    A \"print\" function. out is the BIO to print the output to. *pval is the ASN1_VALUE to be printed. indent is the number of spaces of indenting to be printed before any data is printed. fname is currently unused and is always \"\". pctx is a pointer to the ASN1_PCTX for the print operation.

    Returns 0 on error or a positive value on success. If the return value is 2 then an additional newline will be printed after the data printed by this function.

  • asn1_ex_new_ex

    This is the same as asn1_ex_new except that it is additionally passed the OSSL_LIB_CTX to be used in libctx and any property query string to be used for algorithm fetching in the propq parameter. See \"ALGORITHM FETCHING\" in crypto(7) for further details. If asn1_ex_new_ex is non NULL, then it will always be called in preference to asn1_ex_new.

  • asn1_ex_d2i_ex

    This is the same as asn1_ex_d2i except that it is additionally passed the OSSL_LIB_CTX to be used in libctx and any property query string to be used for algorithm fetching in the propq parameter. See \"ALGORITHM FETCHING\" in crypto(7) for further details. If asn1_ex_d2i_ex is non NULL, then it will always be called in preference to asn1_ex_d2i.

"},{"location":"man3/ASN1_EXTERN_FUNCS/#return-values","title":"RETURN VALUES","text":"

Return values for the various callbacks are as described above.

"},{"location":"man3/ASN1_EXTERN_FUNCS/#see-also","title":"SEE ALSO","text":"

ASN1_item_new_ex(3)

"},{"location":"man3/ASN1_EXTERN_FUNCS/#history","title":"HISTORY","text":"

The asn1_ex_new_ex and asn1_ex_d2i_ex callbacks were added in OpenSSL 3.0.

"},{"location":"man3/ASN1_EXTERN_FUNCS/#copyright","title":"COPYRIGHT","text":"

Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_INTEGER_get_int64/","title":"ASN1_INTEGER_get_int64","text":""},{"location":"man3/ASN1_INTEGER_get_int64/#name","title":"NAME","text":"

ASN1_INTEGER_get_uint64, ASN1_INTEGER_set_uint64, ASN1_INTEGER_get_int64, ASN1_INTEGER_get, ASN1_INTEGER_set_int64, ASN1_INTEGER_set, BN_to_ASN1_INTEGER, ASN1_INTEGER_to_BN, ASN1_ENUMERATED_get_int64, ASN1_ENUMERATED_get, ASN1_ENUMERATED_set_int64, ASN1_ENUMERATED_set, BN_to_ASN1_ENUMERATED, ASN1_ENUMERATED_to_BN - ASN.1 INTEGER and ENUMERATED utilities

"},{"location":"man3/ASN1_INTEGER_get_int64/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nint ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a);\nlong ASN1_INTEGER_get(const ASN1_INTEGER *a);\n\nint ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r);\nint ASN1_INTEGER_set(ASN1_INTEGER *a, long v);\n\nint ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a);\nint ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r);\n\nASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);\nBIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);\n\nint ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a);\nlong ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);\n\nint ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r);\nint ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);\n\nASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);\nBIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);\n
"},{"location":"man3/ASN1_INTEGER_get_int64/#description","title":"DESCRIPTION","text":"

These functions convert to and from ASN1_INTEGER and ASN1_ENUMERATED structures.

ASN1_INTEGER_get_int64() converts an ASN1_INTEGER into an int64_t type If successful it returns 1 and sets *pr to the value of a. If it fails (due to invalid type or the value being too big to fit into an int64_t type) it returns 0.

ASN1_INTEGER_get_uint64() is similar to ASN1_INTEGER_get_int64_t() except it converts to a uint64_t type and an error is returned if the passed integer is negative.

ASN1_INTEGER_get() also returns the value of a but it returns 0 if a is NULL and -1 on error (which is ambiguous because -1 is a legitimate value for an ASN1_INTEGER). New applications should use ASN1_INTEGER_get_int64() instead.

ASN1_INTEGER_set_int64() sets the value of ASN1_INTEGER a to the int64_t value r.

ASN1_INTEGER_set_uint64() sets the value of ASN1_INTEGER a to the uint64_t value r.

ASN1_INTEGER_set() sets the value of ASN1_INTEGER a to the long value v.

BN_to_ASN1_INTEGER() converts BIGNUM bn to an ASN1_INTEGER. If ai is NULL a new ASN1_INTEGER structure is returned. If ai is not NULL then the existing structure will be used instead.

ASN1_INTEGER_to_BN() converts ASN1_INTEGER ai into a BIGNUM. If bn is NULL a new BIGNUM structure is returned. If bn is not NULL then the existing structure will be used instead.

ASN1_ENUMERATED_get_int64(), ASN1_ENUMERATED_set_int64(), ASN1_ENUMERATED_set(), BN_to_ASN1_ENUMERATED() and ASN1_ENUMERATED_to_BN() behave in an identical way to their ASN1_INTEGER counterparts except they operate on an ASN1_ENUMERATED value.

ASN1_ENUMERATED_get() returns the value of a in a similar way to ASN1_INTEGER_get() but it returns 0xffffffffL if the value of a will not fit in a long type. New applications should use ASN1_ENUMERATED_get_int64() instead.

"},{"location":"man3/ASN1_INTEGER_get_int64/#notes","title":"NOTES","text":"

In general an ASN1_INTEGER or ASN1_ENUMERATED type can contain an integer of almost arbitrary size and so cannot always be represented by a C int64_t type. However, in many cases (for example version numbers) they represent small integers which can be more easily manipulated if converted to an appropriate C integer type.

"},{"location":"man3/ASN1_INTEGER_get_int64/#bugs","title":"BUGS","text":"

The ambiguous return values of ASN1_INTEGER_get() and ASN1_ENUMERATED_get() mean these functions should be avoided if possible. They are retained for compatibility. Normally the ambiguous return values are not legitimate values for the fields they represent.

"},{"location":"man3/ASN1_INTEGER_get_int64/#return-values","title":"RETURN VALUES","text":"

ASN1_INTEGER_set_int64(), ASN1_INTEGER_set(), ASN1_ENUMERATED_set_int64() and ASN1_ENUMERATED_set() return 1 for success and 0 for failure. They will only fail if a memory allocation error occurs.

ASN1_INTEGER_get_int64() and ASN1_ENUMERATED_get_int64() return 1 for success and 0 for failure. They will fail if the passed type is incorrect (this will only happen if there is a programming error) or if the value exceeds the range of an int64_t type.

BN_to_ASN1_INTEGER() and BN_to_ASN1_ENUMERATED() return an ASN1_INTEGER or ASN1_ENUMERATED structure respectively or NULL if an error occurs. They will only fail due to a memory allocation error.

ASN1_INTEGER_to_BN() and ASN1_ENUMERATED_to_BN() return a BIGNUM structure of NULL if an error occurs. They can fail if the passed type is incorrect (due to programming error) or due to a memory allocation failure.

"},{"location":"man3/ASN1_INTEGER_get_int64/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ASN1_INTEGER_get_int64/#history","title":"HISTORY","text":"

ASN1_INTEGER_set_int64(), ASN1_INTEGER_get_int64(), ASN1_ENUMERATED_set_int64() and ASN1_ENUMERATED_get_int64() were added in OpenSSL 1.1.0.

"},{"location":"man3/ASN1_INTEGER_get_int64/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_INTEGER_new/","title":"ASN1_INTEGER_new","text":""},{"location":"man3/ASN1_INTEGER_new/#name","title":"NAME","text":"

ASN1_INTEGER_new, ASN1_INTEGER_free - ASN1_INTEGER allocation functions

"},{"location":"man3/ASN1_INTEGER_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nASN1_INTEGER *ASN1_INTEGER_new(void);\nvoid ASN1_INTEGER_free(ASN1_INTEGER *a);\n
"},{"location":"man3/ASN1_INTEGER_new/#description","title":"DESCRIPTION","text":"

ASN1_INTEGER_new() returns an allocated ASN1_INTEGER structure.

ASN1_INTEGER_free() frees up a single ASN1_INTEGER object. If the argument is NULL, nothing is done.

ASN1_INTEGER structure representing the ASN.1 INTEGER type

"},{"location":"man3/ASN1_INTEGER_new/#return-values","title":"RETURN VALUES","text":"

ASN1_INTEGER_new() return a valid ASN1_INTEGER structure or NULL if an error occurred.

ASN1_INTEGER_free() does not return a value.

"},{"location":"man3/ASN1_INTEGER_new/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ASN1_INTEGER_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_ITEM_lookup/","title":"ASN1_ITEM_lookup","text":""},{"location":"man3/ASN1_ITEM_lookup/#name","title":"NAME","text":"

ASN1_ITEM_lookup, ASN1_ITEM_get - lookup ASN.1 structures

"},{"location":"man3/ASN1_ITEM_lookup/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nconst ASN1_ITEM *ASN1_ITEM_lookup(const char *name);\nconst ASN1_ITEM *ASN1_ITEM_get(size_t i);\n
"},{"location":"man3/ASN1_ITEM_lookup/#description","title":"DESCRIPTION","text":"

ASN1_ITEM_lookup() returns the ASN1_ITEM named name.

ASN1_ITEM_get() returns the ASN1_ITEM with index i. This function returns NULL if the index i is out of range.

"},{"location":"man3/ASN1_ITEM_lookup/#return-values","title":"RETURN VALUES","text":"

ASN1_ITEM_lookup() and ASN1_ITEM_get() return a valid ASN1_ITEM structure or NULL if an error occurred.

"},{"location":"man3/ASN1_ITEM_lookup/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ASN1_ITEM_lookup/#copyright","title":"COPYRIGHT","text":"

Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_OBJECT_new/","title":"ASN1_OBJECT_new","text":""},{"location":"man3/ASN1_OBJECT_new/#name","title":"NAME","text":"

ASN1_OBJECT_new, ASN1_OBJECT_free - object allocation functions

"},{"location":"man3/ASN1_OBJECT_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nASN1_OBJECT *ASN1_OBJECT_new(void);\nvoid ASN1_OBJECT_free(ASN1_OBJECT *a);\n
"},{"location":"man3/ASN1_OBJECT_new/#description","title":"DESCRIPTION","text":"

The ASN1_OBJECT allocation routines, allocate and free an ASN1_OBJECT structure, which represents an ASN1 OBJECT IDENTIFIER.

ASN1_OBJECT_new() allocates and initializes an ASN1_OBJECT structure.

ASN1_OBJECT_free() frees up the ASN1_OBJECT structure a. If a is NULL, nothing is done.

"},{"location":"man3/ASN1_OBJECT_new/#notes","title":"NOTES","text":"

Although ASN1_OBJECT_new() allocates a new ASN1_OBJECT structure it is almost never used in applications. The ASN1 object utility functions such as OBJ_nid2obj() are used instead.

"},{"location":"man3/ASN1_OBJECT_new/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, ASN1_OBJECT_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

ASN1_OBJECT_free() returns no value.

"},{"location":"man3/ASN1_OBJECT_new/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), d2i_ASN1_OBJECT(3)

"},{"location":"man3/ASN1_OBJECT_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_STRING_TABLE_add/","title":"ASN1_STRING_TABLE_add","text":""},{"location":"man3/ASN1_STRING_TABLE_add/#name","title":"NAME","text":"

ASN1_STRING_TABLE, ASN1_STRING_TABLE_add, ASN1_STRING_TABLE_get, ASN1_STRING_TABLE_cleanup - ASN1_STRING_TABLE manipulation functions

"},{"location":"man3/ASN1_STRING_TABLE_add/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\ntypedef struct asn1_string_table_st ASN1_STRING_TABLE;\n\nint ASN1_STRING_TABLE_add(int nid, long minsize, long maxsize,\n                          unsigned long mask, unsigned long flags);\nASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);\nvoid ASN1_STRING_TABLE_cleanup(void);\n
"},{"location":"man3/ASN1_STRING_TABLE_add/#description","title":"DESCRIPTION","text":""},{"location":"man3/ASN1_STRING_TABLE_add/#types","title":"Types","text":"

ASN1_STRING_TABLE is a table which holds string information (basically minimum size, maximum size, type and etc) for a NID object.

"},{"location":"man3/ASN1_STRING_TABLE_add/#functions","title":"Functions","text":"

ASN1_STRING_TABLE_add() adds a new ASN1_STRING_TABLE item into the local ASN1 string table based on the nid along with other parameters.

If the item is already in the table, fields of ASN1_STRING_TABLE are updated (depending on the values of those parameters, e.g., minsize and maxsize >= 0, mask and flags != 0). If the nid is standard, a copy of the standard ASN1_STRING_TABLE is created and updated with other parameters.

ASN1_STRING_TABLE_get() searches for an ASN1_STRING_TABLE item based on nid. It will search the local table first, then the standard one.

ASN1_STRING_TABLE_cleanup() frees all ASN1_STRING_TABLE items added by ASN1_STRING_TABLE_add().

"},{"location":"man3/ASN1_STRING_TABLE_add/#return-values","title":"RETURN VALUES","text":"

ASN1_STRING_TABLE_add() returns 1 on success, 0 if an error occurred.

ASN1_STRING_TABLE_get() returns a valid ASN1_STRING_TABLE structure or NULL if nothing is found.

ASN1_STRING_TABLE_cleanup() does not return a value.

"},{"location":"man3/ASN1_STRING_TABLE_add/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ASN1_STRING_TABLE_add/#copyright","title":"COPYRIGHT","text":"

Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_STRING_length/","title":"ASN1_STRING_length","text":""},{"location":"man3/ASN1_STRING_length/#name","title":"NAME","text":"

ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length, ASN1_STRING_type, ASN1_STRING_get0_data, ASN1_STRING_data, ASN1_STRING_to_UTF8 - ASN1_STRING utility functions

"},{"location":"man3/ASN1_STRING_length/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nint ASN1_STRING_length(ASN1_STRING *x);\nconst unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);\nunsigned char *ASN1_STRING_data(ASN1_STRING *x);\n\nASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);\n\nint ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);\n\nint ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);\n\nint ASN1_STRING_type(const ASN1_STRING *x);\n\nint ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in);\n
"},{"location":"man3/ASN1_STRING_length/#description","title":"DESCRIPTION","text":"

These functions allow an ASN1_STRING structure to be manipulated.

ASN1_STRING_length() returns the length of the content of x.

ASN1_STRING_get0_data() returns an internal pointer to the data of x. Since this is an internal pointer it should not be freed or modified in any way.

ASN1_STRING_data() is similar to ASN1_STRING_get0_data() except the returned value is not constant. This function is deprecated: applications should use ASN1_STRING_get0_data() instead.

ASN1_STRING_dup() returns a copy of the structure a.

ASN1_STRING_cmp() compares a and b returning 0 if the two are identical. The string types and content are compared.

ASN1_STRING_set() sets the data of string str to the buffer data or length len. The supplied data is copied. If len is -1 then the length is determined by strlen(data).

ASN1_STRING_type() returns the type of x, using standard constants such as V_ASN1_OCTET_STRING.

ASN1_STRING_to_UTF8() converts the string in to UTF8 format, the converted data is allocated in a buffer in *out. The length of out is returned or a negative error code. The buffer *out should be freed using OPENSSL_free().

"},{"location":"man3/ASN1_STRING_length/#notes","title":"NOTES","text":"

Almost all ASN1 types in OpenSSL are represented as an ASN1_STRING structure. Other types such as ASN1_OCTET_STRING are simply typedef'ed to ASN1_STRING and the functions call the ASN1_STRING equivalents. ASN1_STRING is also used for some CHOICE types which consist entirely of primitive string types such as DirectoryString and Time.

These functions should not be used to examine or modify ASN1_INTEGER or ASN1_ENUMERATED types: the relevant INTEGER or ENUMERATED utility functions should be used instead.

In general it cannot be assumed that the data returned by ASN1_STRING_data() is null terminated or does not contain embedded nulls. The actual format of the data will depend on the actual string type itself: for example for an IA5String the data will be ASCII, for a BMPString two bytes per character in big endian format, and for a UTF8String it will be in UTF8 format.

Similar care should be take to ensure the data is in the correct format when calling ASN1_STRING_set().

"},{"location":"man3/ASN1_STRING_length/#return-values","title":"RETURN VALUES","text":"

ASN1_STRING_length() returns the length of the content of x.

ASN1_STRING_get0_data() and ASN1_STRING_data() return an internal pointer to the data of x.

ASN1_STRING_dup() returns a valid ASN1_STRING structure or NULL if an error occurred.

ASN1_STRING_cmp() returns an integer greater than, equal to, or less than 0, according to whether a is greater than, equal to, or less than b.

ASN1_STRING_set() returns 1 on success or 0 on error.

ASN1_STRING_type() returns the type of x.

ASN1_STRING_to_UTF8() returns the number of bytes in output string out or a negative value if an error occurred.

"},{"location":"man3/ASN1_STRING_length/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ASN1_STRING_length/#copyright","title":"COPYRIGHT","text":"

Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_STRING_new/","title":"ASN1_STRING_new","text":""},{"location":"man3/ASN1_STRING_new/#name","title":"NAME","text":"

ASN1_STRING_new, ASN1_STRING_type_new, ASN1_STRING_free - ASN1_STRING allocation functions

"},{"location":"man3/ASN1_STRING_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nASN1_STRING *ASN1_STRING_new(void);\nASN1_STRING *ASN1_STRING_type_new(int type);\nvoid ASN1_STRING_free(ASN1_STRING *a);\n
"},{"location":"man3/ASN1_STRING_new/#description","title":"DESCRIPTION","text":"

ASN1_STRING_new() returns an allocated ASN1_STRING structure. Its type is undefined.

ASN1_STRING_type_new() returns an allocated ASN1_STRING structure of type type.

ASN1_STRING_free() frees up a. If a is NULL nothing is done.

"},{"location":"man3/ASN1_STRING_new/#notes","title":"NOTES","text":"

Other string types call the ASN1_STRING functions. For example ASN1_OCTET_STRING_new() calls ASN1_STRING_type_new(V_ASN1_OCTET_STRING).

"},{"location":"man3/ASN1_STRING_new/#return-values","title":"RETURN VALUES","text":"

ASN1_STRING_new() and ASN1_STRING_type_new() return a valid ASN1_STRING structure or NULL if an error occurred.

ASN1_STRING_free() does not return a value.

"},{"location":"man3/ASN1_STRING_new/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ASN1_STRING_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_STRING_print_ex/","title":"ASN1_STRING_print_ex","text":""},{"location":"man3/ASN1_STRING_print_ex/#name","title":"NAME","text":"

ASN1_tag2str, ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp, ASN1_STRING_print - ASN1_STRING output routines

"},{"location":"man3/ASN1_STRING_print_ex/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nint ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);\nint ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags);\nint ASN1_STRING_print(BIO *out, const ASN1_STRING *str);\n\nconst char *ASN1_tag2str(int tag);\n
"},{"location":"man3/ASN1_STRING_print_ex/#description","title":"DESCRIPTION","text":"

These functions output an ASN1_STRING structure. ASN1_STRING is used to represent all the ASN1 string types.

ASN1_STRING_print_ex() outputs str to out, the format is determined by the options flags. ASN1_STRING_print_ex_fp() is identical except it outputs to fp instead.

ASN1_STRING_print() prints str to out but using a different format to ASN1_STRING_print_ex(). It replaces unprintable characters (other than CR, LF) with '.'.

ASN1_tag2str() returns a human-readable name of the specified ASN.1 tag.

"},{"location":"man3/ASN1_STRING_print_ex/#notes","title":"NOTES","text":"

ASN1_STRING_print() is a deprecated function which should be avoided; use ASN1_STRING_print_ex() instead.

Although there are a large number of options frequently ASN1_STRFLGS_RFC2253 is suitable, or on UTF8 terminals ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB.

The complete set of supported options for flags is listed below.

Various characters can be escaped. If ASN1_STRFLGS_ESC_2253 is set the characters determined by RFC2253 are escaped. If ASN1_STRFLGS_ESC_CTRL is set control characters are escaped. If ASN1_STRFLGS_ESC_MSB is set characters with the MSB set are escaped: this option should not be used if the terminal correctly interprets UTF8 sequences.

Escaping takes several forms.

If the character being escaped is a 16 bit character then the form \"\\UXXXX\" is used using exactly four characters for the hex representation. If it is 32 bits then \"\\WXXXXXXXX\" is used using eight characters of its hex representation. These forms will only be used if UTF8 conversion is not set (see below).

Printable characters are normally escaped using the backslash '\\' character. If ASN1_STRFLGS_ESC_QUOTE is set then the whole string is instead surrounded by double quote characters: this is arguably more readable than the backslash notation. Other characters use the \"\\XX\" using exactly two characters of the hex representation.

If ASN1_STRFLGS_UTF8_CONVERT is set then characters are converted to UTF8 format first. If the terminal supports the display of UTF8 sequences then this option will correctly display multi byte characters.

If ASN1_STRFLGS_IGNORE_TYPE is set then the string type is not interpreted at all: everything is assumed to be one byte per character. This is primarily for debugging purposes and can result in confusing output in multi character strings.

If ASN1_STRFLGS_SHOW_TYPE is set then the string type itself is printed out before its value (for example \"BMPSTRING\"), this actually uses ASN1_tag2str().

The content of a string instead of being interpreted can be \"dumped\": this just outputs the value of the string using the form #XXXX using hex format for each octet.

If ASN1_STRFLGS_DUMP_ALL is set then any type is dumped.

Normally non character string types (such as OCTET STRING) are assumed to be one byte per character, if ASN1_STRFLGS_DUMP_UNKNOWN is set then they will be dumped instead.

When a type is dumped normally just the content octets are printed, if ASN1_STRFLGS_DUMP_DER is set then the complete encoding is dumped instead (including tag and length octets).

ASN1_STRFLGS_RFC2253 includes all the flags required by RFC2253. It is equivalent to: ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER

"},{"location":"man3/ASN1_STRING_print_ex/#return-values","title":"RETURN VALUES","text":"

ASN1_STRING_print_ex() and ASN1_STRING_print_ex_fp() return the number of characters written or -1 if an error occurred.

ASN1_STRING_print() returns 1 on success or 0 on error.

ASN1_tag2str() returns a human-readable name of the specified ASN.1 tag.

"},{"location":"man3/ASN1_STRING_print_ex/#see-also","title":"SEE ALSO","text":"

X509_NAME_print_ex(3), ASN1_tag2str(3)

"},{"location":"man3/ASN1_STRING_print_ex/#copyright","title":"COPYRIGHT","text":"

Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_TIME_set/","title":"ASN1_TIME_set","text":""},{"location":"man3/ASN1_TIME_set/#name","title":"NAME","text":"

ASN1_TIME_set, ASN1_UTCTIME_set, ASN1_GENERALIZEDTIME_set, ASN1_TIME_adj, ASN1_UTCTIME_adj, ASN1_GENERALIZEDTIME_adj, ASN1_TIME_check, ASN1_UTCTIME_check, ASN1_GENERALIZEDTIME_check, ASN1_TIME_set_string, ASN1_UTCTIME_set_string, ASN1_GENERALIZEDTIME_set_string, ASN1_TIME_set_string_X509, ASN1_TIME_normalize, ASN1_TIME_to_tm, ASN1_TIME_print, ASN1_TIME_print_ex, ASN1_UTCTIME_print, ASN1_GENERALIZEDTIME_print, ASN1_TIME_diff, ASN1_TIME_cmp_time_t, ASN1_UTCTIME_cmp_time_t, ASN1_TIME_compare, ASN1_TIME_to_generalizedtime, ASN1_TIME_dup, ASN1_UTCTIME_dup, ASN1_GENERALIZEDTIME_dup - ASN.1 Time functions

"},{"location":"man3/ASN1_TIME_set/#synopsis","title":"SYNOPSIS","text":"
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);\nASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,\n                                               time_t t);\n\nASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,\n                         long offset_sec);\nASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,\n                               int offset_day, long offset_sec);\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,\n                                               time_t t, int offset_day,\n                                               long offset_sec);\n\nint ASN1_TIME_set_string(ASN1_TIME *s, const char *str);\nint ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str);\nint ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);\nint ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s,\n                                    const char *str);\n\nint ASN1_TIME_normalize(ASN1_TIME *s);\n\nint ASN1_TIME_check(const ASN1_TIME *t);\nint ASN1_UTCTIME_check(const ASN1_UTCTIME *t);\nint ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *t);\n\nint ASN1_TIME_print(BIO *b, const ASN1_TIME *s);\nint ASN1_TIME_print_ex(BIO *bp, const ASN1_TIME *tm, unsigned long flags);\nint ASN1_UTCTIME_print(BIO *b, const ASN1_UTCTIME *s);\nint ASN1_GENERALIZEDTIME_print(BIO *b, const ASN1_GENERALIZEDTIME *s);\n\nint ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm);\nint ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from,\n                   const ASN1_TIME *to);\n\nint ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t);\nint ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);\n\nint ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b);\n\nASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,\n                                                   ASN1_GENERALIZEDTIME **out);\n\nASN1_TIME *ASN1_TIME_dup(const ASN1_TIME *t);\nASN1_UTCTIME *ASN1_UTCTIME_dup(const ASN1_UTCTIME *t);\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_dup(const ASN1_GENERALIZEDTIME *t);\n
"},{"location":"man3/ASN1_TIME_set/#description","title":"DESCRIPTION","text":"

The ASN1_TIME_set(), ASN1_UTCTIME_set() and ASN1_GENERALIZEDTIME_set() functions set the structure s to the time represented by the time_t value t. If s is NULL a new time structure is allocated and returned.

The ASN1_TIME_adj(), ASN1_UTCTIME_adj() and ASN1_GENERALIZEDTIME_adj() functions set the time structure s to the time represented by the time offset_day and offset_sec after the time_t value t. The values of offset_day or offset_sec can be negative to set a time before t. The offset_sec value can also exceed the number of seconds in a day. If s is NULL a new structure is allocated and returned.

The ASN1_TIME_set_string(), ASN1_UTCTIME_set_string() and ASN1_GENERALIZEDTIME_set_string() functions set the time structure s to the time represented by string str which must be in appropriate ASN.1 time format (for example YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ). If s is NULL this function performs a format check on str only. The string str is copied into s.

ASN1_TIME_set_string_X509() sets ASN1_TIME structure s to the time represented by string str which must be in appropriate time format that RFC 5280 requires, which means it only allows YYMMDDHHMMSSZ and YYYYMMDDHHMMSSZ (leap second is rejected), all other ASN.1 time format are not allowed. If s is NULL this function performs a format check on str only.

The ASN1_TIME_normalize() function converts an ASN1_GENERALIZEDTIME or ASN1_UTCTIME into a time value that can be used in a certificate. It should be used after the ASN1_TIME_set_string() functions and before ASN1_TIME_print() functions to get consistent (i.e. GMT) results.

The ASN1_TIME_check(), ASN1_UTCTIME_check() and ASN1_GENERALIZEDTIME_check() functions check the syntax of the time structure s.

The ASN1_TIME_print(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() functions print the time structure s to BIO b in human readable format. It will be of the format MMM DD HH:MM:SS YYYY [GMT], for example \"Feb 3 00:55:52 2015 GMT\", which does not include a newline. If the time structure has invalid format it prints out \"Bad time value\" and returns an error. The output for generalized time may include a fractional part following the second.

ASN1_TIME_print_ex() provides flags to specify the output format of the datetime. This can be either ASN1_DTFLGS_RFC822 or ASN1_DTFLGS_ISO8601.

ASN1_TIME_to_tm() converts the time s to the standard tm structure. If s is NULL, then the current time is converted. The output time is GMT. The tm_sec, tm_min, tm_hour, tm_mday, tm_wday, tm_yday, tm_mon and tm_year fields of tm structure are set to proper values, whereas all other fields are set to 0. If tm is NULL this function performs a format check on s only. If s is in Generalized format with fractional seconds, e.g. YYYYMMDDHHMMSS.SSSZ, the fractional seconds will be lost while converting s to tm structure.

ASN1_TIME_diff() sets *pday and *psec to the time difference between from and to. If to represents a time later than from then one or both (depending on the time difference) of *pday and *psec will be positive. If to represents a time earlier than from then one or both of *pday and *psec will be negative. If to and from represent the same time then *pday and *psec will both be zero. If both *pday and *psec are nonzero they will always have the same sign. The value of *psec will always be less than the number of seconds in a day. If from or to is NULL the current time is used.

The ASN1_TIME_cmp_time_t() and ASN1_UTCTIME_cmp_time_t() functions compare the two times represented by the time structure s and the time_t t.

The ASN1_TIME_compare() function compares the two times represented by the time structures a and b.

The ASN1_TIME_to_generalizedtime() function converts an ASN1_TIME to an ASN1_GENERALIZEDTIME, regardless of year. If either out or *out are NULL, then a new object is allocated and must be freed after use.

The ASN1_TIME_dup(), ASN1_UTCTIME_dup() and ASN1_GENERALIZEDTIME_dup() functions duplicate the time structure t and return the duplicated result correspondingly.

"},{"location":"man3/ASN1_TIME_set/#notes","title":"NOTES","text":"

The ASN1_TIME structure corresponds to the ASN.1 structure Time defined in RFC5280 et al. The time setting functions obey the rules outlined in RFC5280: if the date can be represented by UTCTime it is used, else GeneralizedTime is used.

The ASN1_TIME, ASN1_UTCTIME and ASN1_GENERALIZEDTIME structures are represented as an ASN1_STRING internally and can be freed up using ASN1_STRING_free().

The ASN1_TIME structure can represent years from 0000 to 9999 but no attempt is made to correct ancient calendar changes (for example from Julian to Gregorian calendars).

ASN1_UTCTIME is limited to a year range of 1950 through 2049.

Some applications add offset times directly to a time_t value and pass the results to ASN1_TIME_set() (or equivalent). This can cause problems as the time_t value can overflow on some systems resulting in unexpected results. New applications should use ASN1_TIME_adj() instead and pass the offset value in the offset_sec and offset_day parameters instead of directly manipulating a time_t value.

ASN1_TIME_adj() may change the type from ASN1_GENERALIZEDTIME to ASN1_UTCTIME, or vice versa, based on the resulting year. ASN1_GENERALIZEDTIME_adj() and ASN1_UTCTIME_adj() will not modify the type of the return structure.

It is recommended that functions starting with ASN1_TIME be used instead of those starting with ASN1_UTCTIME or ASN1_GENERALIZEDTIME. The functions starting with ASN1_UTCTIME and ASN1_GENERALIZEDTIME act only on that specific time format. The functions starting with ASN1_TIME will operate on either format.

"},{"location":"man3/ASN1_TIME_set/#bugs","title":"BUGS","text":"

ASN1_TIME_print(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() do not print out the timezone: it either prints out \"GMT\" or nothing. But all certificates complying with RFC5280 et al use GMT anyway.

ASN1_TIME_print(), ASN1_TIME_print_ex(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() do not distinguish if they fail because of an I/O error or invalid time format.

Use the ASN1_TIME_normalize() function to normalize the time value before printing to get GMT results.

"},{"location":"man3/ASN1_TIME_set/#return-values","title":"RETURN VALUES","text":"

ASN1_TIME_set(), ASN1_UTCTIME_set(), ASN1_GENERALIZEDTIME_set(), ASN1_TIME_adj(), ASN1_UTCTIME_adj() and ASN1_GENERALIZEDTIME_set() return a pointer to a time structure or NULL if an error occurred.

ASN1_TIME_set_string(), ASN1_UTCTIME_set_string(), ASN1_GENERALIZEDTIME_set_string() and ASN1_TIME_set_string_X509() return 1 if the time value is successfully set and 0 otherwise.

ASN1_TIME_normalize() returns 1 on success, and 0 on error.

ASN1_TIME_check(), ASN1_UTCTIME_check and ASN1_GENERALIZEDTIME_check() return 1 if the structure is syntactically correct and 0 otherwise.

ASN1_TIME_print(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() return 1 if the time is successfully printed out and 0 if an I/O error occurred an error occurred (I/O error or invalid time format).

ASN1_TIME_to_tm() returns 1 if the time is successfully parsed and 0 if an error occurred (invalid time format).

ASN1_TIME_diff() returns 1 for success and 0 for failure. It can fail if the passed-in time structure has invalid syntax, for example.

ASN1_TIME_cmp_time_t() and ASN1_UTCTIME_cmp_time_t() return -1 if s is before t, 0 if s equals t, or 1 if s is after t. -2 is returned on error.

ASN1_TIME_compare() returns -1 if a is before b, 0 if a equals b, or 1 if a is after b. -2 is returned on error.

ASN1_TIME_to_generalizedtime() returns a pointer to the appropriate time structure on success or NULL if an error occurred.

ASN1_TIME_dup(), ASN1_UTCTIME_dup() and ASN1_GENERALIZEDTIME_dup() return a pointer to a time structure or NULL if an error occurred.

"},{"location":"man3/ASN1_TIME_set/#examples","title":"EXAMPLES","text":"

Set a time structure to one hour after the current time and print it out:

#include <time.h>\n#include <openssl/asn1.h>\n\nASN1_TIME *tm;\ntime_t t;\nBIO *b;\n\nt = time(NULL);\ntm = ASN1_TIME_adj(NULL, t, 0, 60 * 60);\nb = BIO_new_fp(stdout, BIO_NOCLOSE);\nASN1_TIME_print(b, tm);\nASN1_STRING_free(tm);\nBIO_free(b);\n

Determine if one time is later or sooner than the current time:

int day, sec;\n\nif (!ASN1_TIME_diff(&day, &sec, NULL, to))\n    /* Invalid time format */\n\nif (day > 0 || sec > 0)\n    printf(\"Later\\n\");\nelse if (day < 0 || sec < 0)\n    printf(\"Sooner\\n\");\nelse\n    printf(\"Same\\n\");\n
"},{"location":"man3/ASN1_TIME_set/#history","title":"HISTORY","text":"

The ASN1_TIME_to_tm() function was added in OpenSSL 1.1.1. The ASN1_TIME_set_string_X509() function was added in OpenSSL 1.1.1. The ASN1_TIME_normalize() function was added in OpenSSL 1.1.1. The ASN1_TIME_cmp_time_t() function was added in OpenSSL 1.1.1. The ASN1_TIME_compare() function was added in OpenSSL 1.1.1.

"},{"location":"man3/ASN1_TIME_set/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_TYPE_get/","title":"ASN1_TYPE_get","text":""},{"location":"man3/ASN1_TYPE_get/#name","title":"NAME","text":"

ASN1_TYPE_get, ASN1_TYPE_set, ASN1_TYPE_set1, ASN1_TYPE_cmp, ASN1_TYPE_unpack_sequence, ASN1_TYPE_pack_sequence - ASN1_TYPE utility functions

"},{"location":"man3/ASN1_TYPE_get/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nint ASN1_TYPE_get(const ASN1_TYPE *a);\nvoid ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);\nint ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);\nint ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);\n\nvoid *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t);\nASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s,\n                                   ASN1_TYPE **t);\n
"},{"location":"man3/ASN1_TYPE_get/#description","title":"DESCRIPTION","text":"

These functions allow an ASN1_TYPE structure to be manipulated. The ASN1_TYPE structure can contain any ASN.1 type or constructed type such as a SEQUENCE: it is effectively equivalent to the ASN.1 ANY type.

ASN1_TYPE_get() returns the type of a or 0 if it fails.

ASN1_TYPE_set() sets the value of a to type and value. This function uses the pointer value internally so it must not be freed up after the call.

ASN1_TYPE_set1() sets the value of a to type a copy of value.

ASN1_TYPE_cmp() compares ASN.1 types a and b and returns 0 if they are identical and nonzero otherwise.

ASN1_TYPE_unpack_sequence() attempts to parse the SEQUENCE present in t using the ASN.1 structure it. If successful it returns a pointer to the ASN.1 structure corresponding to it which must be freed by the caller. If it fails it return NULL.

ASN1_TYPE_pack_sequence() attempts to encode the ASN.1 structure s corresponding to it into an ASN1_TYPE. If successful the encoded ASN1_TYPE is returned. If t and *t are not NULL the encoded type is written to t overwriting any existing data. If t is not NULL but *t is NULL the returned ASN1_TYPE is written to *t.

"},{"location":"man3/ASN1_TYPE_get/#notes","title":"NOTES","text":"

The type and meaning of the value parameter for ASN1_TYPE_set() and ASN1_TYPE_set1() is determined by the type parameter. If type is V_ASN1_NULL value is ignored. If type is V_ASN1_BOOLEAN then the boolean is set to TRUE if value is not NULL. If type is V_ASN1_OBJECT then value is an ASN1_OBJECT structure. Otherwise type is and ASN1_STRING structure. If type corresponds to a primitive type (or a string type) then the contents of the ASN1_STRING contain the content octets of the type. If type corresponds to a constructed type or a tagged type (V_ASN1_SEQUENCE, V_ASN1_SET or V_ASN1_OTHER) then the ASN1_STRING contains the entire ASN.1 encoding verbatim (including tag and length octets).

ASN1_TYPE_cmp() may not return zero if two types are equivalent but have different encodings. For example the single content octet of the boolean TRUE value under BER can have any nonzero encoding but ASN1_TYPE_cmp() will only return zero if the values are the same.

If either or both of the parameters passed to ASN1_TYPE_cmp() is NULL the return value is nonzero. Technically if both parameters are NULL the two types could be absent OPTIONAL fields and so should match, however, passing NULL values could also indicate a programming error (for example an unparsable type which returns NULL) for types which do not match. So applications should handle the case of two absent values separately.

"},{"location":"man3/ASN1_TYPE_get/#return-values","title":"RETURN VALUES","text":"

ASN1_TYPE_get() returns the type of the ASN1_TYPE argument.

ASN1_TYPE_set() does not return a value.

ASN1_TYPE_set1() returns 1 for success and 0 for failure.

ASN1_TYPE_cmp() returns 0 if the types are identical and nonzero otherwise.

ASN1_TYPE_unpack_sequence() returns a pointer to an ASN.1 structure or NULL on failure.

ASN1_TYPE_pack_sequence() return an ASN1_TYPE structure if it succeeds or NULL on failure.

"},{"location":"man3/ASN1_TYPE_get/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_aux_cb/","title":"ASN1_aux_cb","text":""},{"location":"man3/ASN1_aux_cb/#name","title":"NAME","text":"

ASN1_AUX, ASN1_PRINT_ARG, ASN1_STREAM_ARG, ASN1_aux_cb, ASN1_aux_const_cb - ASN.1 auxiliary data

"},{"location":"man3/ASN1_aux_cb/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1t.h>\n\nstruct ASN1_AUX_st {\n    void *app_data;\n    int flags;\n    int ref_offset;             /* Offset of reference value */\n    int ref_lock;               /* Offset to an CRYPTO_RWLOCK */\n    ASN1_aux_cb *asn1_cb;\n    int enc_offset;             /* Offset of ASN1_ENCODING structure */\n    ASN1_aux_const_cb *asn1_const_cb; /* for ASN1_OP_I2D_ and ASN1_OP_PRINT_ */\n};\ntypedef struct ASN1_AUX_st ASN1_AUX;\n\nstruct ASN1_PRINT_ARG_st {\n    BIO *out;\n    int indent;\n    const ASN1_PCTX *pctx;\n};\ntypedef struct ASN1_PRINT_ARG_st ASN1_PRINT_ARG;\n\nstruct ASN1_STREAM_ARG_st {\n    BIO *out;\n    BIO *ndef_bio;\n    unsigned char **boundary;\n};\ntypedef struct ASN1_STREAM_ARG_st ASN1_STREAM_ARG;\n\ntypedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,\n                        void *exarg);\ntypedef int ASN1_aux_const_cb(int operation, const ASN1_VALUE **in,\n                              const ASN1_ITEM *it, void *exarg);\n
"},{"location":"man3/ASN1_aux_cb/#description","title":"DESCRIPTION","text":"

ASN.1 data structures can be associated with an ASN1_AUX object to supply additional information about the ASN.1 structure. An ASN1_AUX structure is associated with the structure during the definition of the ASN.1 template. For example an ASN1_AUX structure will be associated by using one of the various ASN.1 template definition macros that supply auxiliary information such as ASN1_SEQUENCE_enc(), ASN1_SEQUENCE_ref(), ASN1_SEQUENCE_cb_const_cb(), ASN1_SEQUENCE_const_cb(), ASN1_SEQUENCE_cb() or ASN1_NDEF_SEQUENCE_cb().

An ASN1_AUX structure contains the following information.

  • app_data

    Arbitrary application data

  • flags

    Flags which indicate the auxiliarly functionality supported.

    The ASN1_AFLG_REFCOUNT flag indicates that objects support reference counting.

    The ASN1_AFLG_ENCODING flag indicates that the original encoding of the object will be saved.

    The ASN1_AFLG_BROKEN flag is a work around for broken encoders where the sequence length value may not be correct. This should generally not be used.

    The ASN1_AFLG_CONST_CB flag indicates that the \"const\" form of the ASN1_AUX callback should be used in preference to the non-const form.

  • ref_offset

    If the ASN1_AFLG_REFCOUNT flag is set then this value is assumed to be an offset into the ASN1_VALUE structure where a CRYPTO_REF_COUNT may be found for the purposes of reference counting.

  • ref_lock

    If the ASN1_AFLG_REFCOUNT flag is set then this value is assumed to be an offset into the ASN1_VALUE structure where a CRYPTO_RWLOCK may be found for the purposes of reference counting.

  • asn1_cb

    A callback that will be invoked at various points during the processing of the the ASN1_VALLUE. See below for further details.

  • enc_offset

    Offset into the ASN1_VALUE object where the original encoding of the object will be saved if the ASN1_AFLG_ENCODING flag has been set.

  • asn1_const_cb

    A callback that will be invoked at various points during the processing of the the ASN1_VALLUE. This is used in preference to the asn1_cb callback if the ASN1_AFLG_CONST_CB flag is set. See below for further details.

During the processing of an ASN1_VALUE object the callbacks set via asn1_cb or asn1_const_cb will be invoked as a result of various events indicated via the operation parameter. The value of *in will be the ASN1_VALUE object being processed based on the template in it. An additional operation specific parameter may be passed in exarg. The currently supported operations are as follows. The callbacks should return a positive value on success or zero on error, unless otherwise noted below.

  • ASN1_OP_NEW_PRE

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure prior to an ASN1_VALUE object being allocated. The callback may allocate the ASN1_VALUE itself and store it in *pval. If it does so it should return 2 from the callback. On error it should return 0.

  • ASN1_OP_NEW_POST

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure after an ASN1_VALUE object has been allocated. The allocated object is in *pval.

  • ASN1_OP_FREE_PRE

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately before an ASN1_VALUE is freed. If the callback originally constructed the ASN1_VALUE via ASN1_OP_NEW_PRE then it should free it at this point and return 2 from the callback. Otherwise it should return 1 for success or 0 on error.

  • ASN1_OP_FREE_POST

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately after ASN1_VALUE sub-structures are freed.

  • ASN1_OP_D2I_PRE

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately before a \"d2i\" operation for the ASN1_VALUE.

  • ASN1_OP_D2I_POST

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately after a \"d2i\" operation for the ASN1_VALUE.

  • ASN1_OP_I2D_PRE

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately before a \"i2d\" operation for the ASN1_VALUE.

  • ASN1_OP_I2D_POST

    Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately after a \"i2d\" operation for the ASN1_VALUE.

  • ASN1_OP_PRINT_PRE

    Invoked when processing a SEQUENCE or NDEF_SEQUENCE structure immediately before printing the ASN1_VALUE. The exarg argument will be a pointer to an ASN1_PRINT_ARG structure (see below).

  • ASN1_OP_PRINT_POST

    Invoked when processing a SEQUENCE or NDEF_SEQUENCE structure immediately after printing the ASN1_VALUE. The exarg argument will be a pointer to an ASN1_PRINT_ARG structure (see below).

  • ASN1_OP_STREAM_PRE

    Invoked immediately prior to streaming the ASN1_VALUE data using indefinite length encoding. The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

  • ASN1_OP_STREAM_POST

    Invoked immediately after streaming the ASN1_VALUE data using indefinite length encoding. The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

  • ASN1_OP_DETACHED_PRE

    Invoked immediately prior to processing the ASN1_VALUE data as a \"detached\" value (as used in CMS and PKCS7). The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

  • ASN1_OP_DETACHED_POST

    Invoked immediately after processing the ASN1_VALUE data as a \"detached\" value (as used in CMS and PKCS7). The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

  • ASN1_OP_DUP_PRE

    Invoked immediate prior to an ASN1_VALUE being duplicated via a call to ASN1_item_dup().

  • ASN1_OP_DUP_POST

    Invoked immediate after to an ASN1_VALUE has been duplicated via a call to ASN1_item_dup().

  • ASN1_OP_GET0_LIBCTX

    Invoked in order to obtain the OSSL_LIB_CTX associated with an ASN1_VALUE if any. A pointer to an OSSL_LIB_CTX should be stored in *exarg if such a value exists.

  • ASN1_OP_GET0_PROPQ

    Invoked in order to obtain the property query string associated with an ASN1_VALUE if any. A pointer to the property query string should be stored in *exarg if such a value exists.

An ASN1_PRINT_ARG object is used during processing of ASN1_OP_PRINT_PRE and ASN1_OP_PRINT_POST callback operations. It contains the following information.

  • out

    The BIO being used to print the data out.

  • ndef_bio

    The current number of indent spaces that should be used for printing this data.

  • pctx

    The context for the ASN1_PCTX operation.

An ASN1_STREAM_ARG object is used during processing of ASN1_OP_STREAM_PRE, ASN1_OP_STREAM_POST, ASN1_OP_DETACHED_PRE and ASN1_OP_DETACHED_POST callback operations. It contains the following information.

  • out

    The BIO to stream through

  • ndef_bio

    The BIO with filters appended

  • boundary

    The streaming I/O boundary.

"},{"location":"man3/ASN1_aux_cb/#return-values","title":"RETURN VALUES","text":"

The callbacks return 0 on error and a positive value on success. Some operations require specific positive success values as noted above.

"},{"location":"man3/ASN1_aux_cb/#see-also","title":"SEE ALSO","text":"

ASN1_item_new_ex(3)

"},{"location":"man3/ASN1_aux_cb/#history","title":"HISTORY","text":"

The ASN1_aux_const_cb() callback and the ASN1_OP_GET0_LIBCTX and ASN1_OP_GET0_PROPQ operation types were added in OpenSSL 3.0.

"},{"location":"man3/ASN1_aux_cb/#copyright","title":"COPYRIGHT","text":"

Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_generate_nconf/","title":"ASN1_generate_nconf","text":""},{"location":"man3/ASN1_generate_nconf/#name","title":"NAME","text":"

ASN1_generate_nconf, ASN1_generate_v3 - ASN1 string generation functions

"},{"location":"man3/ASN1_generate_nconf/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf);\nASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf);\n
"},{"location":"man3/ASN1_generate_nconf/#description","title":"DESCRIPTION","text":"

These functions generate the ASN1 encoding of a string in an ASN1_TYPE structure.

str contains the string to encode. nconf or cnf contains the optional configuration information where additional strings will be read from. nconf will typically come from a config file whereas cnf is obtained from an X509V3_CTX structure, which will typically be used by X509 v3 certificate extension functions. cnf or nconf can be set to NULL if no additional configuration will be used.

"},{"location":"man3/ASN1_generate_nconf/#generation-string-format","title":"GENERATION STRING FORMAT","text":"

The actual data encoded is determined by the string str and the configuration information. The general format of the string is:

  • [modifier,]type[:value]

That is zero or more comma separated modifiers followed by a type followed by an optional colon and a value. The formats of type, value and modifier are explained below.

"},{"location":"man3/ASN1_generate_nconf/#supported-types","title":"Supported Types","text":"

The supported types are listed below. Case is not significant in the type names. Unless otherwise specified only the ASCII format is permissible.

  • BOOLEAN, BOOL

    This encodes a boolean type. The value string is mandatory and should be TRUE or FALSE. Additionally TRUE, true, Y, y, YES, yes, FALSE, false, N, n, NO and no are acceptable.

  • NULL

    Encode the NULL type, the value string must not be present.

  • INTEGER, INT

    Encodes an ASN1 INTEGER type. The value string represents the value of the integer, it can be prefaced by a minus sign and is normally interpreted as a decimal value unless the prefix 0x is included.

  • ENUMERATED, ENUM

    Encodes the ASN1 ENUMERATED type, it is otherwise identical to INTEGER.

  • OBJECT, OID

    Encodes an ASN1 OBJECT IDENTIFIER, the value string can be a short name, a long name or numerical format.

  • UTCTIME, UTC

    Encodes an ASN1 UTCTime structure, the value should be in the format YYMMDDHHMMSSZ.

  • GENERALIZEDTIME, GENTIME

    Encodes an ASN1 GeneralizedTime structure, the value should be in the format YYYYMMDDHHMMSSZ.

  • OCTETSTRING, OCT

    Encodes an ASN1 OCTET STRING. value represents the contents of this structure, the format strings ASCII and HEX can be used to specify the format of value.

  • BITSTRING, BITSTR

    Encodes an ASN1 BIT STRING. value represents the contents of this structure, the format strings ASCII, HEX and BITLIST can be used to specify the format of value.

    If the format is anything other than BITLIST the number of unused bits is set to zero.

  • UNIVERSALSTRING, UNIV, IA5, IA5STRING, UTF8, UTF8String, BMP, BMPSTRING, VISIBLESTRING, VISIBLE, PRINTABLESTRING, PRINTABLE, T61, T61STRING, TELETEXSTRING, GeneralString, NUMERICSTRING, NUMERIC

    These encode the corresponding string types. value represents the contents of this structure. The format can be ASCII or UTF8.

  • SEQUENCE, SEQ, SET

    Formats the result as an ASN1 SEQUENCE or SET type. value should be a section name which will contain the contents. The field names in the section are ignored and the values are in the generated string format. If value is absent then an empty SEQUENCE will be encoded.

"},{"location":"man3/ASN1_generate_nconf/#modifiers","title":"Modifiers","text":"

Modifiers affect the following structure, they can be used to add EXPLICIT or IMPLICIT tagging, add wrappers or to change the string format of the final type and value. The supported formats are documented below.

  • EXPLICIT, EXP

    Add an explicit tag to the following structure. This string should be followed by a colon and the tag value to use as a decimal value.

    By following the number with U, A, P or C UNIVERSAL, APPLICATION, PRIVATE or CONTEXT SPECIFIC tagging can be used, the default is CONTEXT SPECIFIC.

  • IMPLICIT, IMP

    This is the same as EXPLICIT except IMPLICIT tagging is used instead.

  • OCTWRAP, SEQWRAP, SETWRAP, BITWRAP

    The following structure is surrounded by an OCTET STRING, a SEQUENCE, a SET or a BIT STRING respectively. For a BIT STRING the number of unused bits is set to zero.

  • FORMAT

    This specifies the format of the ultimate value. It should be followed by a colon and one of the strings ASCII, UTF8, HEX or BITLIST.

    If no format specifier is included then ASCII is used. If UTF8 is specified then the value string must be a valid UTF8 string. For HEX the output must be a set of hex digits. BITLIST (which is only valid for a BIT STRING) is a comma separated list of the indices of the set bits, all other bits are zero.

"},{"location":"man3/ASN1_generate_nconf/#return-values","title":"RETURN VALUES","text":"

ASN1_generate_nconf() and ASN1_generate_v3() return the encoded data as an ASN1_TYPE structure or NULL if an error occurred.

The error codes that can be obtained by ERR_get_error(3).

"},{"location":"man3/ASN1_generate_nconf/#examples","title":"EXAMPLES","text":"

A simple IA5String:

IA5STRING:Hello World\n

An IA5String explicitly tagged:

EXPLICIT:0,IA5STRING:Hello World\n

An IA5String explicitly tagged using APPLICATION tagging:

EXPLICIT:0A,IA5STRING:Hello World\n

A BITSTRING with bits 1 and 5 set and all others zero:

FORMAT:BITLIST,BITSTRING:1,5\n

A more complex example using a config file to produce a SEQUENCE consisting of a BOOL an OID and a UTF8String:

asn1 = SEQUENCE:seq_section\n\n[seq_section]\n\nfield1 = BOOLEAN:TRUE\nfield2 = OID:commonName\nfield3 = UTF8:Third field\n

This example produces an RSAPrivateKey structure, this is the key contained in the file client.pem in all OpenSSL distributions (note: the field names such as 'coeff' are ignored and are present just for clarity):

asn1=SEQUENCE:private_key\n[private_key]\nversion=INTEGER:0\n\nn=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\\\nD4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9\n\ne=INTEGER:0x010001\n\nd=INTEGER:0x6F05EAD2F27FFAEC84BEC360C4B928FD5F3A9865D0FCAAD291E2A52F4A\\\nF810DC6373278C006A0ABBA27DC8C63BF97F7E666E27C5284D7D3B1FFFE16B7A87B51D\n\np=INTEGER:0xF3929B9435608F8A22C208D86795271D54EBDFB09DDEF539AB083DA912\\\nD4BD57\n\nq=INTEGER:0xC50016F89DFF2561347ED1186A46E150E28BF2D0F539A1594BBD7FE467\\\n46EC4F\n\nexp1=INTEGER:0x9E7D4326C924AFC1DEA40B45650134966D6F9DFA3A7F9D698CD4ABEA\\\n9C0A39B9\n\nexp2=INTEGER:0xBA84003BB95355AFB7C50DF140C60513D0BA51D637272E355E397779\\\nE7B2458F\n\ncoeff=INTEGER:0x30B9E4F2AFA5AC679F920FC83F1F2DF1BAF1779CF989447FABC2F5\\\n628657053A\n

This example is the corresponding public key in a SubjectPublicKeyInfo structure:

# # Start with a SEQUENCE asn1=SEQUENCE:pubkeyinfo

# # pubkeyinfo contains an algorithm identifier and the public key wrapped # # in a BIT STRING [pubkeyinfo] algorithm=SEQUENCE:rsa_alg pubkey=BITWRAP,SEQUENCE:rsapubkey

# # algorithm ID for RSA is just an OID and a NULL [rsa_alg] algorithm=OID:rsaEncryption parameter=NULL

# # Actual public key: modulus and exponent [rsapubkey] n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\\ D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9

e=INTEGER:0x010001\n
"},{"location":"man3/ASN1_generate_nconf/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ASN1_generate_nconf/#copyright","title":"COPYRIGHT","text":"

Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_item_d2i_bio/","title":"ASN1_item_d2i_bio","text":""},{"location":"man3/ASN1_item_d2i_bio/#name","title":"NAME","text":"

ASN1_item_d2i_ex, ASN1_item_d2i, ASN1_item_d2i_bio_ex, ASN1_item_d2i_bio, ASN1_item_d2i_fp_ex, ASN1_item_d2i_fp, ASN1_item_i2d_mem_bio - decode and encode DER-encoded ASN.1 structures

"},{"location":"man3/ASN1_item_d2i_bio/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nASN1_VALUE *ASN1_item_d2i_ex(ASN1_VALUE **pval, const unsigned char **in,\n                             long len, const ASN1_ITEM *it,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, const unsigned char **in,\n                          long len, const ASN1_ITEM *it);\n\nvoid *ASN1_item_d2i_bio_ex(const ASN1_ITEM *it, BIO *in, void *x,\n                           OSSL_LIB_CTX *libctx, const char *propq);\nvoid *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);\n\nvoid *ASN1_item_d2i_fp_ex(const ASN1_ITEM *it, FILE *in, void *x,\n                          OSSL_LIB_CTX *libctx, const char *propq);\nvoid *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);\n\nBIO *ASN1_item_i2d_mem_bio(const ASN1_ITEM *it, const ASN1_VALUE *val);\n
"},{"location":"man3/ASN1_item_d2i_bio/#description","title":"DESCRIPTION","text":"

ASN1_item_d2i_ex() decodes the contents of the data stored in *in of length len which must be a DER-encoded ASN.1 structure, using the ASN.1 template it. It places the result in *pval unless pval is NULL. If *pval is non-NULL on entry then the ASN1_VALUE present there will be reused. Otherwise a new ASN1_VALUE will be allocated. If any algorithm fetches are required during the process then they will use the OSSL_LIB_CTXprovided in the libctx parameter and the property query string in propq. See \"ALGORITHM FETCHING\" in crypto(7) for more information about algorithm fetching. On exit *in will be updated to point to the next byte in the buffer after the decoded structure.

ASN1_item_d2i() is the same as ASN1_item_d2i_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

ASN1_item_d2i_bio_ex() decodes the contents of its input BIO in, which must be a DER-encoded ASN.1 structure, using the ASN.1 template it and places the result in *pval unless pval is NULL. If in is NULL it returns NULL, else a pointer to the parsed structure. If any algorithm fetches are required during the process then they will use the OSSL_LIB_CTX provided in the libctx parameter and the property query string in propq. See \"ALGORITHM FETCHING\" in crypto(7) for more information about algorithm fetching.

ASN1_item_d2i_bio() is the same as ASN1_item_d2i_bio_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

ASN1_item_d2i_fp_ex() is the same as ASN1_item_d2i_bio_ex() except that a FILE pointer is provided instead of a BIO.

ASN1_item_d2i_fp() is the same as ASN1_item_d2i_fp_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

ASN1_item_i2d_mem_bio() encodes the given ASN.1 value val using the ASN.1 template it and returns the result in a memory BIO.

"},{"location":"man3/ASN1_item_d2i_bio/#return-values","title":"RETURN VALUES","text":"

ASN1_item_d2i_bio() returns a pointer to an ASN1_VALUE or NULL.

ASN1_item_i2d_mem_bio() returns a pointer to a memory BIO or NULL on error.

"},{"location":"man3/ASN1_item_d2i_bio/#history","title":"HISTORY","text":"

The functions ASN1_item_d2i_ex(), ASN1_item_d2i_bio_ex(), ASN1_item_d2i_fp_ex() and ASN1_item_i2d_mem_bio() were added in OpenSSL 3.0.

"},{"location":"man3/ASN1_item_d2i_bio/#copyright","title":"COPYRIGHT","text":"

Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_item_new/","title":"ASN1_item_new","text":""},{"location":"man3/ASN1_item_new/#name","title":"NAME","text":"

ASN1_item_new_ex, ASN1_item_new - create new ASN.1 values

"},{"location":"man3/ASN1_item_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/asn1.h>\n\nASN1_VALUE *ASN1_item_new_ex(const ASN1_ITEM *it, OSSL_LIB_CTX *libctx,\n                             const char *propq);\nASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);\n
"},{"location":"man3/ASN1_item_new/#description","title":"DESCRIPTION","text":"

ASN1_item_new_ex() creates a new ASN1_VALUE structure based on the ASN1_ITEM template given in the it parameter. If any algorithm fetches are required during the process then they will use the OSSL_LIB_CTX provided in the libctx parameter and the property query string in propq. See \"ALGORITHM FETCHING\" in crypto(7) for more information about algorithm fetching.

ASN1_item_new() is the same as ASN1_item_new_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

"},{"location":"man3/ASN1_item_new/#return-values","title":"RETURN VALUES","text":"

ASN1_item_new_ex() and ASN1_item_new() return a pointer to the newly created ASN1_VALUE or NULL on error.

"},{"location":"man3/ASN1_item_new/#history","title":"HISTORY","text":"

The function ASN1_item_new_ex() was added in OpenSSL 3.0.

"},{"location":"man3/ASN1_item_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASN1_item_sign/","title":"ASN1_item_sign","text":""},{"location":"man3/ASN1_item_sign/#name","title":"NAME","text":"

ASN1_item_sign, ASN1_item_sign_ex, ASN1_item_sign_ctx, ASN1_item_verify, ASN1_item_verify_ex, ASN1_item_verify_ctx - ASN1 sign and verify

"},{"location":"man3/ASN1_item_sign/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/x509.h>\n\nint ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1,\n                      X509_ALGOR *algor2, ASN1_BIT_STRING *signature,\n                      const void *data, const ASN1_OCTET_STRING *id,\n                      EVP_PKEY *pkey, const EVP_MD *md, OSSL_LIB_CTX *libctx,\n                      const char *propq);\n\nint ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,\n                   ASN1_BIT_STRING *signature, const void *data,\n                   EVP_PKEY *pkey, const EVP_MD *md);\n\nint ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,\n                       X509_ALGOR *algor2, ASN1_BIT_STRING *signature,\n                       const void *data, EVP_MD_CTX *ctx);\n\nint ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg,\n                        const ASN1_BIT_STRING *signature, const void *data,\n                        const ASN1_OCTET_STRING *id, EVP_PKEY *pkey,\n                        OSSL_LIB_CTX *libctx, const char *propq);\n\nint ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg,\n                     const ASN1_BIT_STRING *signature, const void *data,\n                     EVP_PKEY *pkey);\n\nint ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg,\n                         const ASN1_BIT_STRING *signature, const void *data,\n                         EVP_MD_CTX *ctx);\n
"},{"location":"man3/ASN1_item_sign/#description","title":"DESCRIPTION","text":"

ASN1_item_sign_ex() is used to sign arbitrary ASN1 data using a data object data, the ASN.1 structure it, private key pkey and message digest md. The data that is signed is formed by taking the data object in data and converting it to der format using the ASN.1 structure it. The data that will be signed, and a structure containing the signature may both have a copy of the X509_ALGOR. The ASN1_item_sign_ex() function will write the correct X509_ALGOR to the structs based on the algorithms and parameters that have been set up. If one of algor1 or algor2 points to the X509_ALGOR of the data to be signed, then that X509_ALGOR will first be written before the signature is generated. Examples of valid values that can be used by the ASN.1 structure it are ASN1_ITEM_rptr(X509_CINF), ASN1_ITEM_rptr(X509_REQ_INFO) and ASN1_ITEM_rptr(X509_CRL_INFO). The OSSL_LIB_CTX specified in libctx and the property query string specified in props are used when searching for algorithms in providers. The generated signature is set into signature. The optional parameter id can be NULL, but can be set for special key types. See EVP_PKEY_CTX_set1_id() for further info. The output parameters <algor1> and algor2 are ignored if they are NULL.

ASN1_item_sign() is similar to ASN1_item_sign_ex() but uses default values of NULL for the id, libctx and propq.

ASN1_item_sign_ctx() is similar to ASN1_item_sign() but uses the parameters contained in digest context ctx.

ASN1_item_verify_ex() is used to verify the signature signature of internal data data using the public key pkey and algorithm identifier alg. The data that is verified is formed by taking the data object in data and converting it to der format using the ASN.1 structure it. The OSSL_LIB_CTX specified in libctx and the property query string specified in props are used when searching for algorithms in providers. The optional parameter id can be NULL, but can be set for special key types. See EVP_PKEY_CTX_set1_id() for further info.

ASN1_item_verify() is similar to ASN1_item_verify_ex() but uses default values of NULL for the id, libctx and propq.

ASN1_item_verify_ctx() is similar to ASN1_item_verify() but uses the parameters contained in digest context ctx.

"},{"location":"man3/ASN1_item_sign/#return-values","title":"RETURN VALUES","text":"

All sign functions return the size of the signature in bytes for success and zero for failure.

All verify functions return 1 if the signature is valid and 0 if the signature check fails. If the signature could not be checked at all because it was ill-formed or some other error occurred then -1 is returned.

"},{"location":"man3/ASN1_item_sign/#examples","title":"EXAMPLES","text":"

In the following example a 'MyObject' object is signed using the key contained in an EVP_MD_CTX. The signature is written to MyObject.signature. The object is then output in DER format and then loaded back in and verified.

#include <openssl/x509.h>\n#include <openssl/asn1t.h>\n\n/* An object used to store the ASN1 data fields that will be signed */\ntypedef struct MySignInfoObject_st\n{\n    ASN1_INTEGER *version;\n    X509_ALGOR sig_alg;\n} MySignInfoObject;\n\nDECLARE_ASN1_FUNCTIONS(MySignInfoObject)\n/*\n * A higher level object containing the ASN1 fields, signature alg and\n * output signature.\n */\ntypedef struct MyObject_st\n{\n    MySignInfoObject info;\n    X509_ALGOR sig_alg;\n    ASN1_BIT_STRING *signature;\n} MyObject;\n\nDECLARE_ASN1_FUNCTIONS(MyObject)\n\n/* The ASN1 definition of MySignInfoObject */\nASN1_SEQUENCE_cb(MySignInfoObject, NULL) = {\n    ASN1_SIMPLE(MySignInfoObject, version, ASN1_INTEGER)\n    ASN1_EMBED(MySignInfoObject, sig_alg, X509_ALGOR),\n} ASN1_SEQUENCE_END_cb(MySignInfoObject, MySignInfoObject)\n\n/* new, free, d2i & i2d functions for MySignInfoObject */\nIMPLEMENT_ASN1_FUNCTIONS(MySignInfoObject)\n\n/* The ASN1 definition of MyObject */\nASN1_SEQUENCE_cb(MyObject, NULL) = {\n    ASN1_EMBED(MyObject, info, MySignInfoObject),\n    ASN1_EMBED(MyObject, sig_alg, X509_ALGOR),\n    ASN1_SIMPLE(MyObject, signature, ASN1_BIT_STRING)\n} ASN1_SEQUENCE_END_cb(MyObject, MyObject)\n\n/* new, free, d2i & i2d functions for MyObject */\nIMPLEMENT_ASN1_FUNCTIONS(MyObject)\n\nint test_asn1_item_sign_verify(const char *mdname, EVP_PKEY *pkey, long version)\n{\n   int ret = 0;\n   unsigned char *obj_der = NULL;\n   const unsigned char *p = NULL;\n   MyObject *obj = NULL, *loaded_obj = NULL;\n   const ASN1_ITEM *it = ASN1_ITEM_rptr(MySignInfoObject);\n   EVP_MD_CTX *sctx = NULL, *vctx = NULL;\n   int len;\n\n   /* Create MyObject and set its version */\n   obj = MyObject_new();\n   if (obj == NULL)\n       goto err;\n   if (!ASN1_INTEGER_set(obj->info.version, version))\n       goto err;\n\n   /* Set the key and digest used for signing */\n   sctx = EVP_MD_CTX_new();\n   if (sctx == NULL\n       || !EVP_DigestSignInit_ex(sctx, NULL, mdname, NULL, NULL, pkey))\n       goto err;\n\n   /*\n    * it contains the mapping between ASN.1 data and an object MySignInfoObject\n    * obj->info is the 'MySignInfoObject' object that will be\n    *   converted into DER data and then signed.\n    * obj->signature will contain the output signature.\n    * obj->sig_alg is filled with the private key's signing algorithm id.\n    * obj->info.sig_alg is another copy of the signing algorithm id that sits\n    * within MyObject.\n    */\n   len = ASN1_item_sign_ctx(it, &obj->sig_alg, &obj->info.sig_alg,\n                            obj->signature, &obj->info, sctx);\n   if (len <= 0\n       || X509_ALGOR_cmp(&obj->sig_alg, &obj->info.sig_alg) != 0)\n       goto err;\n\n   /* Output MyObject in der form */\n   len = i2d_MyObject(obj, &obj_der);\n   if (len <= 0)\n       goto err;\n\n   /* Set the key and digest used for verifying */\n   vctx = EVP_MD_CTX_new();\n   if (vctx == NULL\n       || !EVP_DigestVerifyInit_ex(vctx, NULL, mdname, NULL, NULL, pkey))\n       goto err;\n\n   /* Load the der data back into an object */\n   p = obj_der;\n   loaded_obj = d2i_MyObject(NULL, &p, len);\n   if (loaded_obj == NULL)\n       goto err;\n   /* Verify the loaded object */\n   ret = ASN1_item_verify_ctx(it, &loaded_obj->sig_alg, loaded_obj->signature,\n                              &loaded_obj->info, vctx);\n

err: OPENSSL_free(obj_der); MyObject_free(loaded_obj); MyObject_free(obj); EVP_MD_CTX_free(sctx); EVP_MD_CTX_free(vctx); return ret; }

"},{"location":"man3/ASN1_item_sign/#see-also","title":"SEE ALSO","text":"

X509_sign(3), X509_verify(3)

"},{"location":"man3/ASN1_item_sign/#history","title":"HISTORY","text":"

ASN1_item_sign_ex() and ASN1_item_verify_ex() were added in OpenSSL 3.0.

"},{"location":"man3/ASN1_item_sign/#copyright","title":"COPYRIGHT","text":"

Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASYNC_WAIT_CTX_new/","title":"ASYNC_WAIT_CTX_new","text":""},{"location":"man3/ASYNC_WAIT_CTX_new/#name","title":"NAME","text":"

ASYNC_WAIT_CTX_new, ASYNC_WAIT_CTX_free, ASYNC_WAIT_CTX_set_wait_fd, ASYNC_WAIT_CTX_get_fd, ASYNC_WAIT_CTX_get_all_fds, ASYNC_WAIT_CTX_get_changed_fds, ASYNC_WAIT_CTX_clear_fd, ASYNC_WAIT_CTX_set_callback, ASYNC_WAIT_CTX_get_callback, ASYNC_WAIT_CTX_set_status, ASYNC_WAIT_CTX_get_status, ASYNC_callback_fn, ASYNC_STATUS_UNSUPPORTED, ASYNC_STATUS_ERR, ASYNC_STATUS_OK, ASYNC_STATUS_EAGAIN - functions to manage waiting for asynchronous jobs to complete

"},{"location":"man3/ASYNC_WAIT_CTX_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/async.h>\n\n#define ASYNC_STATUS_UNSUPPORTED    0\n#define ASYNC_STATUS_ERR            1\n#define ASYNC_STATUS_OK             2\n#define ASYNC_STATUS_EAGAIN         3\ntypedef int (*ASYNC_callback_fn)(void *arg);\nASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);\nvoid ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);\nint ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,\n                               OSSL_ASYNC_FD fd,\n                               void *custom_data,\n                               void (*cleanup)(ASYNC_WAIT_CTX *, const void *,\n                                               OSSL_ASYNC_FD, void *));\nint ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,\n                          OSSL_ASYNC_FD *fd, void **custom_data);\nint ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,\n                               size_t *numfds);\nint ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,\n                                   size_t *numaddfds, OSSL_ASYNC_FD *delfd,\n                                   size_t *numdelfds);\nint ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);\nint ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx,\n                                ASYNC_callback_fn callback,\n                                void *callback_arg);\nint ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx,\n                                ASYNC_callback_fn *callback,\n                                void **callback_arg);\nint ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status);\nint ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx);\n
"},{"location":"man3/ASYNC_WAIT_CTX_new/#description","title":"DESCRIPTION","text":"

For an overview of how asynchronous operations are implemented in OpenSSL see ASYNC_start_job(3). An ASYNC_WAIT_CTX object represents an asynchronous \"session\", i.e. a related set of crypto operations. For example in SSL terms this would have a one-to-one correspondence with an SSL connection.

Application code must create an ASYNC_WAIT_CTX using the ASYNC_WAIT_CTX_new() function prior to calling ASYNC_start_job() (see ASYNC_start_job(3)). When the job is started it is associated with the ASYNC_WAIT_CTX for the duration of that job. An ASYNC_WAIT_CTX should only be used for one ASYNC_JOB at any one time, but can be reused after an ASYNC_JOB has finished for a subsequent ASYNC_JOB. When the session is complete (e.g. the SSL connection is closed), application code cleans up with ASYNC_WAIT_CTX_free().

ASYNC_WAIT_CTXs can have \"wait\" file descriptors associated with them. Calling ASYNC_WAIT_CTX_get_all_fds() and passing in a pointer to an ASYNC_WAIT_CTX in the ctx parameter will return the wait file descriptors associated with that job in *fd. The number of file descriptors returned will be stored in *numfds. It is the caller's responsibility to ensure that sufficient memory has been allocated in *fd to receive all the file descriptors. Calling ASYNC_WAIT_CTX_get_all_fds() with a NULL fd value will return no file descriptors but will still populate *numfds. Therefore, application code is typically expected to call this function twice: once to get the number of fds, and then again when sufficient memory has been allocated. If only one asynchronous engine is being used then normally this call will only ever return one fd. If multiple asynchronous engines are being used then more could be returned.

The function ASYNC_WAIT_CTX_get_changed_fds() can be used to detect if any fds have changed since the last call time ASYNC_start_job() returned ASYNC_PAUSE (or since the ASYNC_WAIT_CTX was created if no ASYNC_PAUSE result has been received). The numaddfds and numdelfds parameters will be populated with the number of fds added or deleted respectively. *addfd and *delfd will be populated with the list of added and deleted fds respectively. Similarly to ASYNC_WAIT_CTX_get_all_fds() either of these can be NULL, but if they are not NULL then the caller is responsible for ensuring sufficient memory is allocated.

Implementers of async aware code (e.g. engines) are encouraged to return a stable fd for the lifetime of the ASYNC_WAIT_CTX in order to reduce the \"churn\" of regularly changing fds - although no guarantees of this are provided to applications.

Applications can wait for the file descriptor to be ready for \"read\" using a system function call such as select or poll (being ready for \"read\" indicates that the job should be resumed). If no file descriptor is made available then an application will have to periodically \"poll\" the job by attempting to restart it to see if it is ready to continue.

Async aware code (e.g. engines) can get the current ASYNC_WAIT_CTX from the job via ASYNC_get_wait_ctx(3) and provide a file descriptor to use for waiting on by calling ASYNC_WAIT_CTX_set_wait_fd(). Typically this would be done by an engine immediately prior to calling ASYNC_pause_job() and not by end user code. An existing association with a file descriptor can be obtained using ASYNC_WAIT_CTX_get_fd() and cleared using ASYNC_WAIT_CTX_clear_fd(). Both of these functions requires a key value which is unique to the async aware code. This could be any unique value but a good candidate might be the ENGINE * for the engine. The custom_data parameter can be any value, and will be returned in a subsequent call to ASYNC_WAIT_CTX_get_fd(). The ASYNC_WAIT_CTX_set_wait_fd() function also expects a pointer to a \"cleanup\" routine. This can be NULL but if provided will automatically get called when the ASYNC_WAIT_CTX is freed, and gives the engine the opportunity to close the fd or any other resources. Note: The \"cleanup\" routine does not get called if the fd is cleared directly via a call to ASYNC_WAIT_CTX_clear_fd().

An example of typical usage might be an async capable engine. User code would initiate cryptographic operations. The engine would initiate those operations asynchronously and then call ASYNC_WAIT_CTX_set_wait_fd() followed by ASYNC_pause_job() to return control to the user code. The user code can then perform other tasks or wait for the job to be ready by calling \"select\" or other similar function on the wait file descriptor. The engine can signal to the user code that the job should be resumed by making the wait file descriptor \"readable\". Once resumed the engine should clear the wake signal on the wait file descriptor.

As well as a file descriptor, user code may also be notified via a callback. The callback and data pointers are stored within the ASYNC_WAIT_CTX along with an additional status field that can be used for the notification of retries from an engine. This additional method can be used when the user thinks that a file descriptor is too costly in terms of CPU cycles or in some context where a file descriptor is not appropriate.

ASYNC_WAIT_CTX_set_callback() sets the callback and the callback argument. The callback will be called to notify user code when an engine completes a cryptography operation. It is a requirement that the callback function is small and nonblocking as it will be run in the context of a polling mechanism or an interrupt.

ASYNC_WAIT_CTX_get_callback() returns the callback set in the ASYNC_WAIT_CTX structure.

ASYNC_WAIT_CTX_set_status() allows an engine to set the current engine status. The possible status values are the following:

  • ASYNC_STATUS_UNSUPPORTED

    The engine does not support the callback mechanism. This is the default value. The engine must call ASYNC_WAIT_CTX_set_status() to set the status to some value other than ASYNC_STATUS_UNSUPPORTED if it intends to enable the callback mechanism.

  • ASYNC_STATUS_ERR

    The engine has a fatal problem with this request. The user code should clean up this session.

  • ASYNC_STATUS_OK

    The request has been successfully submitted.

  • ASYNC_STATUS_EAGAIN

    The engine has some problem which will be recovered soon, such as a buffer is full, so user code should resume the job.

ASYNC_WAIT_CTX_get_status() allows user code to obtain the current status value. If the status is any value other than ASYNC_STATUS_OK then the user code should not expect to receive a callback from the engine even if one has been set.

An example of the usage of the callback method might be the following. User code would initiate cryptographic operations, and the engine code would dispatch this operation to hardware, and if the dispatch is successful, then the engine code would call ASYNC_pause_job() to return control to the user code. After that, user code can perform other tasks. When the hardware completes the operation, normally it is detected by a polling function or an interrupt, as the user code set a callback by calling ASYNC_WAIT_CTX_set_callback() previously, then the registered callback will be called.

ASYNC_WAIT_CTX_free() frees up a single ASYNC_WAIT_CTX object. If the argument is NULL, nothing is done.

"},{"location":"man3/ASYNC_WAIT_CTX_new/#return-values","title":"RETURN VALUES","text":"

ASYNC_WAIT_CTX_new() returns a pointer to the newly allocated ASYNC_WAIT_CTX or NULL on error.

ASYNC_WAIT_CTX_set_wait_fd, ASYNC_WAIT_CTX_get_fd, ASYNC_WAIT_CTX_get_all_fds, ASYNC_WAIT_CTX_get_changed_fds, ASYNC_WAIT_CTX_clear_fd, ASYNC_WAIT_CTX_set_callback, ASYNC_WAIT_CTX_get_callback and ASYNC_WAIT_CTX_set_status all return 1 on success or 0 on error. ASYNC_WAIT_CTX_get_status() returns the engine status.

"},{"location":"man3/ASYNC_WAIT_CTX_new/#notes","title":"NOTES","text":"

On Windows platforms the <openssl/async.h> header is dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/async.h>.

"},{"location":"man3/ASYNC_WAIT_CTX_new/#see-also","title":"SEE ALSO","text":"

crypto(7), ASYNC_start_job(3)

"},{"location":"man3/ASYNC_WAIT_CTX_new/#history","title":"HISTORY","text":"

ASYNC_WAIT_CTX_new(), ASYNC_WAIT_CTX_free(), ASYNC_WAIT_CTX_set_wait_fd(), ASYNC_WAIT_CTX_get_fd(), ASYNC_WAIT_CTX_get_all_fds(), ASYNC_WAIT_CTX_get_changed_fds() and ASYNC_WAIT_CTX_clear_fd() were added in OpenSSL 1.1.0.

ASYNC_WAIT_CTX_set_callback(), ASYNC_WAIT_CTX_get_callback(), ASYNC_WAIT_CTX_set_status(), and ASYNC_WAIT_CTX_get_status() were added in OpenSSL 3.0.

"},{"location":"man3/ASYNC_WAIT_CTX_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ASYNC_start_job/","title":"ASYNC_start_job","text":""},{"location":"man3/ASYNC_start_job/#name","title":"NAME","text":"

ASYNC_get_wait_ctx, ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_current_job, ASYNC_block_pause, ASYNC_unblock_pause, ASYNC_is_capable - asynchronous job management functions

"},{"location":"man3/ASYNC_start_job/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/async.h>\n\nint ASYNC_init_thread(size_t max_size, size_t init_size);\nvoid ASYNC_cleanup_thread(void);\n\nint ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,\n                    int (*func)(void *), void *args, size_t size);\nint ASYNC_pause_job(void);\n\nASYNC_JOB *ASYNC_get_current_job(void);\nASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);\nvoid ASYNC_block_pause(void);\nvoid ASYNC_unblock_pause(void);\n\nint ASYNC_is_capable(void);\n
"},{"location":"man3/ASYNC_start_job/#description","title":"DESCRIPTION","text":"

OpenSSL implements asynchronous capabilities through an ASYNC_JOB. This represents code that can be started and executes until some event occurs. At that point the code can be paused and control returns to user code until some subsequent event indicates that the job can be resumed.

The creation of an ASYNC_JOB is a relatively expensive operation. Therefore, for efficiency reasons, jobs can be created up front and reused many times. They are held in a pool until they are needed, at which point they are removed from the pool, used, and then returned to the pool when the job completes. If the user application is multi-threaded, then ASYNC_init_thread() may be called for each thread that will initiate asynchronous jobs. Before user code exits per-thread resources need to be cleaned up. This will normally occur automatically (see OPENSSL_init_crypto(3)) but may be explicitly initiated by using ASYNC_cleanup_thread(). No asynchronous jobs must be outstanding for the thread when ASYNC_cleanup_thread() is called. Failing to ensure this will result in memory leaks.

The max_size argument limits the number of ASYNC_JOBs that will be held in the pool. If max_size is set to 0 then no upper limit is set. When an ASYNC_JOB is needed but there are none available in the pool already then one will be automatically created, as long as the total of ASYNC_JOBs managed by the pool does not exceed max_size. When the pool is first initialised init_size ASYNC_JOBs will be created immediately. If ASYNC_init_thread() is not called before the pool is first used then it will be called automatically with a max_size of 0 (no upper limit) and an init_size of 0 (no ASYNC_JOBs created up front).

An asynchronous job is started by calling the ASYNC_start_job() function. Initially *job should be NULL. ctx should point to an ASYNC_WAIT_CTX object created through the ASYNC_WAIT_CTX_new(3) function. ret should point to a location where the return value of the asynchronous function should be stored on completion of the job. func represents the function that should be started asynchronously. The data pointed to by args and of size size will be copied and then passed as an argument to func when the job starts. ASYNC_start_job will return one of the following values:

  • ASYNC_ERR

    An error occurred trying to start the job. Check the OpenSSL error queue (e.g. see ERR_print_errors(3)) for more details.

  • ASYNC_NO_JOBS

    There are no jobs currently available in the pool. This call can be retried again at a later time.

  • ASYNC_PAUSE

    The job was successfully started but was \"paused\" before it completed (see ASYNC_pause_job() below). A handle to the job is placed in *job. Other work can be performed (if desired) and the job restarted at a later time. To restart a job call ASYNC_start_job() again passing the job handle in *job. The func, args and size parameters will be ignored when restarting a job. When restarting a job ASYNC_start_job() must be called from the same thread that the job was originally started from.

  • ASYNC_FINISH

    The job completed. *job will be NULL and the return value from func will be placed in *ret.

At any one time there can be a maximum of one job actively running per thread (you can have many that are paused). ASYNC_get_current_job() can be used to get a pointer to the currently executing ASYNC_JOB. If no job is currently executing then this will return NULL.

If executing within the context of a job (i.e. having been called directly or indirectly by the function \"func\" passed as an argument to ASYNC_start_job()) then ASYNC_pause_job() will immediately return control to the calling application with ASYNC_PAUSE returned from the ASYNC_start_job() call. A subsequent call to ASYNC_start_job passing in the relevant ASYNC_JOB in the *job parameter will resume execution from the ASYNC_pause_job() call. If ASYNC_pause_job() is called whilst not within the context of a job then no action is taken and ASYNC_pause_job() returns immediately.

ASYNC_get_wait_ctx() can be used to get a pointer to the ASYNC_WAIT_CTX for the job. ASYNC_WAIT_CTXs contain two different ways to notify applications that a job is ready to be resumed. One is a \"wait\" file descriptor, and the other is a \"callback\" mechanism.

The \"wait\" file descriptor associated with ASYNC_WAIT_CTX is used for applications to wait for the file descriptor to be ready for \"read\" using a system function call such as select or poll (being ready for \"read\" indicates that the job should be resumed). If no file descriptor is made available then an application will have to periodically \"poll\" the job by attempting to restart it to see if it is ready to continue.

ASYNC_WAIT_CTXs also have a \"callback\" mechanism to notify applications. The callback is set by an application, and it will be automatically called when an engine completes a cryptography operation, so that the application can resume the paused work flow without polling. An engine could be written to look whether the callback has been set. If it has then it would use the callback mechanism in preference to the file descriptor notifications. If a callback is not set then the engine may use file descriptor based notifications. Please note that not all engines may support the callback mechanism, so the callback may not be used even if it has been set. See ASYNC_WAIT_CTX_new() for more details.

The ASYNC_block_pause() function will prevent the currently active job from pausing. The block will remain in place until a subsequent call to ASYNC_unblock_pause(). These functions can be nested, e.g. if you call ASYNC_block_pause() twice then you must call ASYNC_unblock_pause() twice in order to re-enable pausing. If these functions are called while there is no currently active job then they have no effect. This functionality can be useful to avoid deadlock scenarios. For example during the execution of an ASYNC_JOB an application acquires a lock. It then calls some cryptographic function which invokes ASYNC_pause_job(). This returns control back to the code that created the ASYNC_JOB. If that code then attempts to acquire the same lock before resuming the original job then a deadlock can occur. By calling ASYNC_block_pause() immediately after acquiring the lock and ASYNC_unblock_pause() immediately before releasing it then this situation cannot occur.

Some platforms cannot support async operations. The ASYNC_is_capable() function can be used to detect whether the current platform is async capable or not.

"},{"location":"man3/ASYNC_start_job/#return-values","title":"RETURN VALUES","text":"

ASYNC_init_thread returns 1 on success or 0 otherwise.

ASYNC_start_job returns one of ASYNC_ERR, ASYNC_NO_JOBS, ASYNC_PAUSE or ASYNC_FINISH as described above.

ASYNC_pause_job returns 0 if an error occurred or 1 on success. If called when not within the context of an ASYNC_JOB then this is counted as success so 1 is returned.

ASYNC_get_current_job returns a pointer to the currently executing ASYNC_JOB or NULL if not within the context of a job.

ASYNC_get_wait_ctx() returns a pointer to the ASYNC_WAIT_CTX for the job.

ASYNC_is_capable() returns 1 if the current platform is async capable or 0 otherwise.

"},{"location":"man3/ASYNC_start_job/#notes","title":"NOTES","text":"

On Windows platforms the <openssl/async.h> header is dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/async.h>.

"},{"location":"man3/ASYNC_start_job/#examples","title":"EXAMPLES","text":"

The following example demonstrates how to use most of the core async APIs:

#ifdef _WIN32\n

# # include #endif #include #include #include #include

int unique = 0;\n\nvoid cleanup(ASYNC_WAIT_CTX *ctx, const void *key, OSSL_ASYNC_FD r, void *vw)\n{\n    OSSL_ASYNC_FD *w = (OSSL_ASYNC_FD *)vw;\n\n    close(r);\n    close(*w);\n    OPENSSL_free(w);\n}\n\nint jobfunc(void *arg)\n{\n    ASYNC_JOB *currjob;\n    unsigned char *msg;\n    int pipefds[2] = {0, 0};\n    OSSL_ASYNC_FD *wptr;\n    char buf = 'X';\n\n    currjob = ASYNC_get_current_job();\n    if (currjob != NULL) {\n        printf(\"Executing within a job\\n\");\n    } else {\n        printf(\"Not executing within a job - should not happen\\n\");\n        return 0;\n    }\n\n    msg = (unsigned char *)arg;\n    printf(\"Passed in message is: %s\\n\", msg);\n\n    if (pipe(pipefds) != 0) {\n        printf(\"Failed to create pipe\\n\");\n        return 0;\n    }\n    wptr = OPENSSL_malloc(sizeof(OSSL_ASYNC_FD));\n    if (wptr == NULL) {\n        printf(\"Failed to malloc\\n\");\n        return 0;\n    }\n    *wptr = pipefds[1];\n    ASYNC_WAIT_CTX_set_wait_fd(ASYNC_get_wait_ctx(currjob), &unique,\n                               pipefds[0], wptr, cleanup);\n\n    /*\n     * Normally some external event would cause this to happen at some\n     * later point - but we do it here for demo purposes, i.e.\n     * immediately signalling that the job is ready to be woken up after\n     * we return to main via ASYNC_pause_job().\n     */\n    write(pipefds[1], &buf, 1);\n\n    /* Return control back to main */\n    ASYNC_pause_job();\n\n    /* Clear the wake signal */\n    read(pipefds[0], &buf, 1);\n\n    printf (\"Resumed the job after a pause\\n\");\n\n    return 1;\n}\n\nint main(void)\n{\n    ASYNC_JOB *job = NULL;\n    ASYNC_WAIT_CTX *ctx = NULL;\n    int ret;\n    OSSL_ASYNC_FD waitfd;\n    fd_set waitfdset;\n    size_t numfds;\n    unsigned char msg[13] = \"Hello world!\";\n\n    printf(\"Starting...\\n\");\n\n    ctx = ASYNC_WAIT_CTX_new();\n    if (ctx == NULL) {\n        printf(\"Failed to create ASYNC_WAIT_CTX\\n\");\n        abort();\n    }\n\n    for (;;) {\n        switch (ASYNC_start_job(&job, ctx, &ret, jobfunc, msg, sizeof(msg))) {\n        case ASYNC_ERR:\n        case ASYNC_NO_JOBS:\n            printf(\"An error occurred\\n\");\n            goto end;\n        case ASYNC_PAUSE:\n            printf(\"Job was paused\\n\");\n            break;\n        case ASYNC_FINISH:\n            printf(\"Job finished with return value %d\\n\", ret);\n            goto end;\n        }\n\n        /* Wait for the job to be woken */\n        printf(\"Waiting for the job to be woken up\\n\");\n\n        if (!ASYNC_WAIT_CTX_get_all_fds(ctx, NULL, &numfds)\n                || numfds > 1) {\n            printf(\"Unexpected number of fds\\n\");\n            abort();\n        }\n        ASYNC_WAIT_CTX_get_all_fds(ctx, &waitfd, &numfds);\n        FD_ZERO(&waitfdset);\n        FD_SET(waitfd, &waitfdset);\n        select(waitfd + 1, &waitfdset, NULL, NULL, NULL);\n    }\n\nend:\n    ASYNC_WAIT_CTX_free(ctx);\n    printf(\"Finishing\\n\");\n\n    return 0;\n}\n

The expected output from executing the above example program is:

Starting...\nExecuting within a job\nPassed in message is: Hello world!\nJob was paused\nWaiting for the job to be woken up\nResumed the job after a pause\nJob finished with return value 1\nFinishing\n
"},{"location":"man3/ASYNC_start_job/#see-also","title":"SEE ALSO","text":"

crypto(7), ERR_print_errors(3)

"},{"location":"man3/ASYNC_start_job/#history","title":"HISTORY","text":"

ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_current_job, ASYNC_get_wait_ctx(), ASYNC_block_pause(), ASYNC_unblock_pause() and ASYNC_is_capable() were first added in OpenSSL 1.1.0.

"},{"location":"man3/ASYNC_start_job/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BF_encrypt/","title":"BF_encrypt","text":""},{"location":"man3/BF_encrypt/#name","title":"NAME","text":"

BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt, BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption

"},{"location":"man3/BF_encrypt/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/blowfish.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void BF_set_key(BF_KEY *key, int len, const unsigned char *data);\n\nvoid BF_ecb_encrypt(const unsigned char *in, unsigned char *out,\n                    BF_KEY *key, int enc);\nvoid BF_cbc_encrypt(const unsigned char *in, unsigned char *out,\n                    long length, BF_KEY *schedule,\n                    unsigned char *ivec, int enc);\nvoid BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                      long length, BF_KEY *schedule,\n                      unsigned char *ivec, int *num, int enc);\nvoid BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                      long length, BF_KEY *schedule,\n                      unsigned char *ivec, int *num);\nconst char *BF_options(void);\n\nvoid BF_encrypt(BF_LONG *data, const BF_KEY *key);\nvoid BF_decrypt(BF_LONG *data, const BF_KEY *key);\n
"},{"location":"man3/BF_encrypt/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) or the equivalently named decrypt functions.

This library implements the Blowfish cipher, which was invented and described by Counterpane (see http://www.counterpane.com/blowfish.html ).

Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. It uses a variable size key, but typically, 128 bit (16 byte) keys are considered good for strong encryption. Blowfish can be used in the same modes as DES (see des_modes(7)). Blowfish is currently one of the faster block ciphers. It is quite a bit faster than DES, and much faster than IDEA or RC2.

Blowfish consists of a key setup phase and the actual encryption or decryption phase.

BF_set_key() sets up the BF_KEY key using the len bytes long key at data.

BF_ecb_encrypt() is the basic Blowfish encryption and decryption function. It encrypts or decrypts the first 64 bits of in using the key key, putting the result in out. enc decides if encryption (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed. The vector pointed at by in and out must be 64 bits in length, no less. If they are larger, everything after the first 64 bits is ignored.

The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt() all operate on variable length data. They all take an initialization vector ivec which needs to be passed along into the next call of the same function for the same message. ivec may be initialized with anything, but the recipient needs to know what it was initialized with, or it won't be able to decrypt. Some programs and protocols simplify this, like SSH, where ivec is simply initialized to zero. BF_cbc_encrypt() operates on data that is a multiple of 8 bytes long, while BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt a variable number of bytes (the amount does not have to be an exact multiple of 8). The purpose of the latter two is to simulate stream ciphers, and therefore, they need the parameter num, which is a pointer to an integer where the current offset in ivec is stored between calls. This integer must be initialized to zero when ivec is initialized.

BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It encrypts or decrypts the 64 bits chunks of in using the key schedule, putting the result in out. enc decides if encryption (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed. ivec must point at an 8 byte long initialization vector.

BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback. It encrypts or decrypts the bytes in in using the key schedule, putting the result in out. enc decides if encryption (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed. ivec must point at an 8 byte long initialization vector. num must point at an integer which must be initially zero.

BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback. It uses the same parameters as BF_cfb64_encrypt(), which must be initialized the same way.

BF_encrypt() and BF_decrypt() are the lowest level functions for Blowfish encryption. They encrypt/decrypt the first 64 bits of the vector pointed by data, using the key key. These functions should not be used unless you implement 'modes' of Blowfish. The alternative is to use BF_ecb_encrypt(). If you still want to use these functions, you should be aware that they take each 32-bit chunk in host-byte order, which is little-endian on little-endian platforms and big-endian on big-endian ones.

"},{"location":"man3/BF_encrypt/#return-values","title":"RETURN VALUES","text":"

None of the functions presented here return any value.

"},{"location":"man3/BF_encrypt/#note","title":"NOTE","text":"

Applications should use the higher level functions EVP_EncryptInit(3) etc. instead of calling these functions directly.

"},{"location":"man3/BF_encrypt/#see-also","title":"SEE ALSO","text":"

EVP_EncryptInit(3), des_modes(7)

"},{"location":"man3/BF_encrypt/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/BF_encrypt/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_ADDR/","title":"BIO_ADDR","text":""},{"location":"man3/BIO_ADDR/#name","title":"NAME","text":"

BIO_ADDR, BIO_ADDR_new, BIO_ADDR_clear, BIO_ADDR_free, BIO_ADDR_rawmake, BIO_ADDR_family, BIO_ADDR_rawaddress, BIO_ADDR_rawport, BIO_ADDR_hostname_string, BIO_ADDR_service_string, BIO_ADDR_path_string - BIO_ADDR routines

"},{"location":"man3/BIO_ADDR/#synopsis","title":"SYNOPSIS","text":"
#include <sys/types.h>\n#include <openssl/bio.h>\n\ntypedef union bio_addr_st BIO_ADDR;\n\nBIO_ADDR *BIO_ADDR_new(void);\nvoid BIO_ADDR_free(BIO_ADDR *);\nvoid BIO_ADDR_clear(BIO_ADDR *ap);\nint BIO_ADDR_rawmake(BIO_ADDR *ap, int family,\n                     const void *where, size_t wherelen, unsigned short port);\nint BIO_ADDR_family(const BIO_ADDR *ap);\nint BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l);\nunsigned short BIO_ADDR_rawport(const BIO_ADDR *ap);\nchar *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric);\nchar *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric);\nchar *BIO_ADDR_path_string(const BIO_ADDR *ap);\n
"},{"location":"man3/BIO_ADDR/#description","title":"DESCRIPTION","text":"

The BIO_ADDR type is a wrapper around all types of socket addresses that OpenSSL deals with, currently transparently supporting AF_INET, AF_INET6 and AF_UNIX according to what's available on the platform at hand.

BIO_ADDR_new() creates a new unfilled BIO_ADDR, to be used with routines that will fill it with information, such as BIO_accept_ex().

BIO_ADDR_free() frees a BIO_ADDR created with BIO_ADDR_new(). If the argument is NULL, nothing is done.

BIO_ADDR_clear() clears any data held within the provided BIO_ADDR and sets it back to an uninitialised state.

BIO_ADDR_rawmake() takes a protocol family, a byte array of size wherelen with an address in network byte order pointed at by where and a port number in network byte order in port (except for the AF_UNIX protocol family, where port is meaningless and therefore ignored) and populates the given BIO_ADDR with them. In case this creates a AF_UNIX BIO_ADDR, wherelen is expected to be the length of the path string (not including the terminating NUL, such as the result of a call to strlen()). Read on about the addresses in \"RAW ADDRESSES\" below.

BIO_ADDR_family() returns the protocol family of the given BIO_ADDR. The possible non-error results are one of the constants AF_INET, AF_INET6 and AF_UNIX. It will also return AF_UNSPEC if the BIO_ADDR has not been initialised.

BIO_ADDR_rawaddress() will write the raw address of the given BIO_ADDR in the area pointed at by p if p is non-NULL, and will set *l to be the amount of bytes the raw address takes up if l is non-NULL. A technique to only find out the size of the address is a call with p set to NULL. The raw address will be in network byte order, most significant byte first. In case this is a AF_UNIX BIO_ADDR, l gets the length of the path string (not including the terminating NUL, such as the result of a call to strlen()). Read on about the addresses in \"RAW ADDRESSES\" below.

BIO_ADDR_rawport() returns the raw port of the given BIO_ADDR. The raw port will be in network byte order.

BIO_ADDR_hostname_string() returns a character string with the hostname of the given BIO_ADDR. If numeric is 1, the string will contain the numerical form of the address. This only works for BIO_ADDR of the protocol families AF_INET and AF_INET6. The returned string has been allocated on the heap and must be freed with OPENSSL_free().

BIO_ADDR_service_string() returns a character string with the service name of the port of the given BIO_ADDR. If numeric is 1, the string will contain the port number. This only works for BIO_ADDR of the protocol families AF_INET and AF_INET6. The returned string has been allocated on the heap and must be freed with OPENSSL_free().

BIO_ADDR_path_string() returns a character string with the path of the given BIO_ADDR. This only works for BIO_ADDR of the protocol family AF_UNIX. The returned string has been allocated on the heap and must be freed with OPENSSL_free().

"},{"location":"man3/BIO_ADDR/#raw-addresses","title":"RAW ADDRESSES","text":"

Both BIO_ADDR_rawmake() and BIO_ADDR_rawaddress() take a pointer to a network byte order address of a specific site. Internally, those are treated as a pointer to struct in_addr (for AF_INET), struct in6_addr (for AF_INET6) or char * (for AF_UNIX), all depending on the protocol family the address is for.

"},{"location":"man3/BIO_ADDR/#return-values","title":"RETURN VALUES","text":"

The string producing functions BIO_ADDR_hostname_string(), BIO_ADDR_service_string() and BIO_ADDR_path_string() will return NULL on error and leave an error indication on the OpenSSL error stack.

All other functions described here return 0 or NULL when the information they should return isn't available.

"},{"location":"man3/BIO_ADDR/#see-also","title":"SEE ALSO","text":"

BIO_connect(3), BIO_s_connect(3)

"},{"location":"man3/BIO_ADDR/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_ADDRINFO/","title":"BIO_ADDRINFO","text":""},{"location":"man3/BIO_ADDRINFO/#name","title":"NAME","text":"

BIO_lookup_type, BIO_ADDRINFO, BIO_ADDRINFO_next, BIO_ADDRINFO_free, BIO_ADDRINFO_family, BIO_ADDRINFO_socktype, BIO_ADDRINFO_protocol, BIO_ADDRINFO_address, BIO_lookup_ex, BIO_lookup - BIO_ADDRINFO type and routines

"},{"location":"man3/BIO_ADDRINFO/#synopsis","title":"SYNOPSIS","text":"
#include <sys/types.h>\n#include <openssl/bio.h>\n\ntypedef union bio_addrinfo_st BIO_ADDRINFO;\n\nenum BIO_lookup_type {\n    BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER\n};\n\nint BIO_lookup_ex(const char *host, const char *service, int lookup_type,\n                  int family, int socktype, int protocol, BIO_ADDRINFO **res);\nint BIO_lookup(const char *host, const char *service,\n               enum BIO_lookup_type lookup_type,\n               int family, int socktype, BIO_ADDRINFO **res);\n\nconst BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai);\nint BIO_ADDRINFO_family(const BIO_ADDRINFO *bai);\nint BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai);\nint BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai);\nconst BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai);\nvoid BIO_ADDRINFO_free(BIO_ADDRINFO *bai);\n
"},{"location":"man3/BIO_ADDRINFO/#description","title":"DESCRIPTION","text":"

The BIO_ADDRINFO type is a wrapper for address information types provided on your platform.

BIO_ADDRINFO normally forms a chain of several that can be picked at one by one.

BIO_lookup_ex() looks up a specified host and service, and uses lookup_type to determine what the default address should be if host is NULL. family, socktype and protocol are used to determine what protocol family, socket type and protocol should be used for the lookup. family can be any of AF_INET, AF_INET6, AF_UNIX and AF_UNSPEC. socktype can be SOCK_STREAM, SOCK_DGRAM or 0. Specifying 0 indicates that any type can be used. protocol specifies a protocol such as IPPROTO_TCP, IPPROTO_UDP or IPPORTO_SCTP. If set to 0 than any protocol can be used. res points at a pointer to hold the start of a BIO_ADDRINFO chain.

For the family AF_UNIX, BIO_lookup_ex() will ignore the service parameter and expects the host parameter to hold the path to the socket file.

BIO_lookup() does the same as BIO_lookup_ex() but does not provide the ability to select based on the protocol (any protocol may be returned).

BIO_ADDRINFO_family() returns the family of the given BIO_ADDRINFO. The result will be one of the constants AF_INET, AF_INET6 and AF_UNIX.

BIO_ADDRINFO_socktype() returns the socket type of the given BIO_ADDRINFO. The result will be one of the constants SOCK_STREAM and SOCK_DGRAM.

BIO_ADDRINFO_protocol() returns the protocol id of the given BIO_ADDRINFO. The result will be one of the constants IPPROTO_TCP and IPPROTO_UDP.

BIO_ADDRINFO_address() returns the underlying BIO_ADDR of the given BIO_ADDRINFO.

BIO_ADDRINFO_next() returns the next BIO_ADDRINFO in the chain from the given one.

BIO_ADDRINFO_free() frees the chain of BIO_ADDRINFO starting with the given one. If the argument is NULL, nothing is done.

"},{"location":"man3/BIO_ADDRINFO/#return-values","title":"RETURN VALUES","text":"

BIO_lookup_ex() and BIO_lookup() return 1 on success and 0 when an error occurred, and will leave an error indication on the OpenSSL error stack in that case.

All other functions described here return 0 or NULL when the information they should return isn't available.

"},{"location":"man3/BIO_ADDRINFO/#notes","title":"NOTES","text":"

The BIO_lookup_ex() implementation uses the platform provided getaddrinfo() function. On Linux it is known that specifying 0 for the protocol will not return any SCTP based addresses when calling getaddrinfo(). Therefore, if an SCTP address is required then the protocol parameter to BIO_lookup_ex() should be explicitly set to IPPROTO_SCTP. The same may be true on other platforms.

"},{"location":"man3/BIO_ADDRINFO/#history","title":"HISTORY","text":"

The BIO_lookup_ex() function was added in OpenSSL 1.1.1.

"},{"location":"man3/BIO_ADDRINFO/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_connect/","title":"BIO_connect","text":""},{"location":"man3/BIO_connect/#name","title":"NAME","text":"

BIO_socket, BIO_bind, BIO_connect, BIO_listen, BIO_accept_ex, BIO_closesocket - BIO socket communication setup routines

"},{"location":"man3/BIO_connect/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nint BIO_socket(int domain, int socktype, int protocol, int options);\nint BIO_bind(int sock, const BIO_ADDR *addr, int options);\nint BIO_connect(int sock, const BIO_ADDR *addr, int options);\nint BIO_listen(int sock, const BIO_ADDR *addr, int options);\nint BIO_accept_ex(int accept_sock, BIO_ADDR *peer, int options);\nint BIO_closesocket(int sock);\n
"},{"location":"man3/BIO_connect/#description","title":"DESCRIPTION","text":"

BIO_socket() creates a socket in the domain domain, of type socktype and protocol. Socket options are currently unused, but is present for future use.

BIO_bind() binds the source address and service to a socket and may be useful before calling BIO_connect(). The options may include BIO_SOCK_REUSEADDR, which is described in \"FLAGS\" below.

BIO_connect() connects sock to the address and service given by addr. Connection options may be zero or any combination of BIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK and BIO_SOCK_NODELAY. The flags are described in \"FLAGS\" below.

BIO_listen() has sock start listening on the address and service given by addr. Connection options may be zero or any combination of BIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK, BIO_SOCK_NODELAY, BIO_SOCK_REUSEADDR and BIO_SOCK_V6_ONLY. The flags are described in \"FLAGS\" below.

BIO_accept_ex() waits for an incoming connections on the given socket accept_sock. When it gets a connection, the address and port of the peer gets stored in peer if that one is non-NULL. Accept options may be zero or BIO_SOCK_NONBLOCK, and is applied on the accepted socket. The flags are described in \"FLAGS\" below.

BIO_closesocket() closes sock.

"},{"location":"man3/BIO_connect/#flags","title":"FLAGS","text":"
  • BIO_SOCK_KEEPALIVE

    Enables regular sending of keep-alive messages.

  • BIO_SOCK_NONBLOCK

    Sets the socket to nonblocking mode.

  • BIO_SOCK_NODELAY

    Corresponds to TCP_NODELAY, and disables the Nagle algorithm. With this set, any data will be sent as soon as possible instead of being buffered until there's enough for the socket to send out in one go.

  • BIO_SOCK_REUSEADDR

    Try to reuse the address and port combination for a recently closed port.

  • BIO_SOCK_V6_ONLY

    When creating an IPv6 socket, make it only listen for IPv6 addresses and not IPv4 addresses mapped to IPv6.

These flags are bit flags, so they are to be combined with the | operator, for example:

BIO_connect(sock, addr, BIO_SOCK_KEEPALIVE | BIO_SOCK_NONBLOCK);\n
"},{"location":"man3/BIO_connect/#return-values","title":"RETURN VALUES","text":"

BIO_socket() returns the socket number on success or INVALID_SOCKET (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

BIO_bind(), BIO_connect() and BIO_listen() return 1 on success or 0 on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

BIO_accept_ex() returns the accepted socket on success or INVALID_SOCKET (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

"},{"location":"man3/BIO_connect/#see-also","title":"SEE ALSO","text":"

BIO_ADDR(3)

"},{"location":"man3/BIO_connect/#history","title":"HISTORY","text":"

BIO_gethostname(), BIO_get_port(), BIO_get_host_ip(), BIO_get_accept_socket() and BIO_accept() were deprecated in OpenSSL 1.1.0. Use the functions described above instead.

"},{"location":"man3/BIO_connect/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_ctrl/","title":"BIO_ctrl","text":""},{"location":"man3/BIO_ctrl/#name","title":"NAME","text":"

BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send, BIO_get_ktls_recv - BIO control operations

"},{"location":"man3/BIO_ctrl/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\ntypedef int BIO_info_cb(BIO *b, int state, int res);\n\nlong BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);\nlong BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *cb);\nvoid *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);\nlong BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);\n\nint BIO_reset(BIO *b);\nint BIO_seek(BIO *b, int ofs);\nint BIO_tell(BIO *b);\nint BIO_flush(BIO *b);\nint BIO_eof(BIO *b);\nint BIO_set_close(BIO *b, long flag);\nint BIO_get_close(BIO *b);\nint BIO_pending(BIO *b);\nint BIO_wpending(BIO *b);\nsize_t BIO_ctrl_pending(BIO *b);\nsize_t BIO_ctrl_wpending(BIO *b);\n\nint BIO_get_info_callback(BIO *b, BIO_info_cb **cbp);\nint BIO_set_info_callback(BIO *b, BIO_info_cb *cb);\n\nint BIO_get_ktls_send(BIO *b);\nint BIO_get_ktls_recv(BIO *b);\n
"},{"location":"man3/BIO_ctrl/#description","title":"DESCRIPTION","text":"

BIO_ctrl(), BIO_callback_ctrl(), BIO_ptr_ctrl() and BIO_int_ctrl() are BIO \"control\" operations taking arguments of various types. These functions are not normally called directly, various macros are used instead. The standard macros are described below, macros specific to a particular type of BIO are described in the specific BIOs manual page as well as any special features of the standard calls.

BIO_reset() typically resets a BIO to some initial state, in the case of file related BIOs for example it rewinds the file pointer to the start of the file.

BIO_seek() resets a file related BIO's (that is file descriptor and FILE BIOs) file position pointer to ofs bytes from start of file.

BIO_tell() returns the current file position of a file related BIO.

BIO_flush() normally writes out any internally buffered data, in some cases it is used to signal EOF and that no more data will be written.

BIO_eof() returns 1 if the BIO has read EOF, the precise meaning of \"EOF\" varies according to the BIO type.

BIO_set_close() sets the BIO b close flag to flag. flag can take the value BIO_CLOSE or BIO_NOCLOSE. Typically BIO_CLOSE is used in a source/sink BIO to indicate that the underlying I/O stream should be closed when the BIO is freed.

BIO_get_close() returns the BIOs close flag.

BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() return the number of pending characters in the BIOs read and write buffers. Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending() return a size_t type and are functions, BIO_pending() and BIO_wpending() are macros which call BIO_ctrl().

BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for sending. Otherwise, it returns zero. BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for receiving. Otherwise, it returns zero.

"},{"location":"man3/BIO_ctrl/#return-values","title":"RETURN VALUES","text":"

BIO_reset() normally returns 1 for success and <=0 for failure. File BIOs are an exception, they return 0 for success and -1 for failure.

BIO_seek() and BIO_tell() both return the current file position on success and -1 for failure, except file BIOs which for BIO_seek() always return 0 for success and -1 for failure.

BIO_flush() returns 1 for success and <=0 for failure.

BIO_eof() returns 1 if EOF has been reached, 0 if not, or negative values for failure.

BIO_set_close() returns 1 on success or <=0 for failure.

BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE. It also returns other negative values if an error occurs.

BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() return the amount of pending data. BIO_pending() and BIO_wpending() return negative value or 0 on error. BIO_ctrl_pending() and BIO_ctrl_wpending() return 0 on error.

BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for sending. Otherwise, it returns zero. BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for receiving. Otherwise, it returns zero.

"},{"location":"man3/BIO_ctrl/#notes","title":"NOTES","text":"

BIO_flush(), because it can write data may return 0 or -1 indicating that the call should be retried later in a similar manner to BIO_write_ex(). The BIO_should_retry() call should be used and appropriate action taken is the call fails.

The return values of BIO_pending() and BIO_wpending() may not reliably determine the amount of pending data in all cases. For example in the case of a file BIO some data may be available in the FILE structures internal buffers but it is not possible to determine this in a portably way. For other types of BIO they may not be supported.

Filter BIOs if they do not internally handle a particular BIO_ctrl() operation usually pass the operation to the next BIO in the chain. This often means there is no need to locate the required BIO for a particular operation, it can be called on a chain and it will be automatically passed to the relevant BIO. However, this can cause unexpected results: for example no current filter BIOs implement BIO_seek(), but this may still succeed if the chain ends in a FILE or file descriptor BIO.

Source/sink BIOs return an 0 if they do not recognize the BIO_ctrl() operation.

"},{"location":"man3/BIO_ctrl/#bugs","title":"BUGS","text":"

Some of the return values are ambiguous and care should be taken. In particular a return value of 0 can be returned if an operation is not supported, if an error occurred, if EOF has not been reached and in the case of BIO_seek() on a file BIO for a successful operation.

In older versions of OpenSSL the BIO_ctrl_pending() and BIO_ctrl_wpending() could return values greater than INT_MAX on error.

"},{"location":"man3/BIO_ctrl/#history","title":"HISTORY","text":"

The BIO_get_ktls_send() and BIO_get_ktls_recv() macros were added in OpenSSL 3.0. They were modified to never return -1 in OpenSSL 3.0.4.

"},{"location":"man3/BIO_ctrl/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_base64/","title":"BIO_f_base64","text":""},{"location":"man3/BIO_f_base64/#name","title":"NAME","text":"

BIO_f_base64 - base64 BIO filter

"},{"location":"man3/BIO_f_base64/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n#include <openssl/evp.h>\n\nconst BIO_METHOD *BIO_f_base64(void);\n
"},{"location":"man3/BIO_f_base64/#description","title":"DESCRIPTION","text":"

BIO_f_base64() returns the base64 BIO method. This is a filter BIO that base64 encodes any data written through it and decodes any data read through it.

Base64 BIOs do not support BIO_gets() or BIO_puts().

For writing, by default output is divided to lines of length 64 characters and there is a newline at the end of output. This behavior can be changed with BIO_FLAGS_BASE64_NO_NL flag.

For reading, first line should be at most 1024 bytes long including newline unless the flag BIO_FLAGS_BASE64_NO_NL is set. Further input lines can be of any length (i.e., newlines may appear anywhere in the input) and a newline at the end of input is not needed.

BIO_flush() on a base64 BIO that is being written through is used to signal that no more data is to be encoded: this is used to flush the final block through the BIO.

The flag BIO_FLAGS_BASE64_NO_NL can be set with BIO_set_flags(). For writing, it causes all data to be written on one line without newline at the end. For reading, it removes all expectations on newlines in the input data.

"},{"location":"man3/BIO_f_base64/#notes","title":"NOTES","text":"

Because of the format of base64 encoding the end of the encoded block cannot always be reliably determined.

"},{"location":"man3/BIO_f_base64/#return-values","title":"RETURN VALUES","text":"

BIO_f_base64() returns the base64 BIO method.

"},{"location":"man3/BIO_f_base64/#examples","title":"EXAMPLES","text":"

Base64 encode the string \"Hello World\\n\" and write the result to standard output:

BIO *bio, *b64;\nchar message[] = \"Hello World \\n\";\n\nb64 = BIO_new(BIO_f_base64());\nbio = BIO_new_fp(stdout, BIO_NOCLOSE);\nBIO_push(b64, bio);\nBIO_write(b64, message, strlen(message));\nBIO_flush(b64);\n\nBIO_free_all(b64);\n

Read Base64 encoded data from standard input and write the decoded data to standard output:

BIO *bio, *b64, *bio_out;\nchar inbuf[512];\nint inlen;\n\nb64 = BIO_new(BIO_f_base64());\nbio = BIO_new_fp(stdin, BIO_NOCLOSE);\nbio_out = BIO_new_fp(stdout, BIO_NOCLOSE);\nBIO_push(b64, bio);\nwhile ((inlen = BIO_read(b64, inbuf, 512)) > 0)\n    BIO_write(bio_out, inbuf, inlen);\n\nBIO_flush(bio_out);\nBIO_free_all(b64);\n
"},{"location":"man3/BIO_f_base64/#bugs","title":"BUGS","text":"

On decoding, if the flag BIO_FLAGS_BASE64_NO_NL is not set and the first 1024 bytes of input do not include a newline character the first two lines of input are ignored.

The ambiguity of EOF in base64 encoded data can cause additional data following the base64 encoded block to be misinterpreted.

There should be some way of specifying a test that the BIO can perform to reliably determine EOF (for example a MIME boundary).

"},{"location":"man3/BIO_f_base64/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_buffer/","title":"BIO_f_buffer","text":""},{"location":"man3/BIO_f_buffer/#name","title":"NAME","text":"

BIO_get_buffer_num_lines, BIO_set_read_buffer_size, BIO_set_write_buffer_size, BIO_set_buffer_size, BIO_set_buffer_read_data, BIO_f_buffer - buffering BIO

"},{"location":"man3/BIO_f_buffer/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_buffer(void);\n\nlong BIO_get_buffer_num_lines(BIO *b);\nlong BIO_set_read_buffer_size(BIO *b, long size);\nlong BIO_set_write_buffer_size(BIO *b, long size);\nlong BIO_set_buffer_size(BIO *b, long size);\nlong BIO_set_buffer_read_data(BIO *b, void *buf, long num);\n
"},{"location":"man3/BIO_f_buffer/#description","title":"DESCRIPTION","text":"

BIO_f_buffer() returns the buffering BIO method.

Data written to a buffering BIO is buffered and periodically written to the next BIO in the chain. Data read from a buffering BIO comes from an internal buffer which is filled from the next BIO in the chain. Both BIO_gets() and BIO_puts() are supported.

Calling BIO_reset() on a buffering BIO clears any buffered data.

BIO_get_buffer_num_lines() returns the number of lines currently buffered.

BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() set the read, write or both read and write buffer sizes to size. The initial buffer size is DEFAULT_BUFFER_SIZE, currently 4096. Any attempt to reduce the buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared when the buffer is resized.

BIO_set_buffer_read_data() clears the read buffer and fills it with num bytes of buf. If num is larger than the current buffer size the buffer is expanded.

"},{"location":"man3/BIO_f_buffer/#notes","title":"NOTES","text":"

These functions, other than BIO_f_buffer(), are implemented as macros.

Buffering BIOs implement BIO_read_ex() and BIO_gets() by using BIO_read_ex() operations on the next BIO in the chain and storing the result in an internal buffer, from which bytes are given back to the caller as appropriate for the call; a BIO_gets() is guaranteed to give the caller a whole line, and BIO_read_ex() is guaranteed to give the caller the number of bytes it asks for, unless there's an error or end of communication is reached in the next BIO. By prepending a buffering BIO to a chain it is therefore possible to provide BIO_gets() or exact size BIO_read_ex() functionality if the following BIOs do not support it.

Do not add more than one BIO_f_buffer() to a BIO chain. The result of doing so will force a full read of the size of the internal buffer of the top BIO_f_buffer(), which is 4 KiB at a minimum.

Data is only written to the next BIO in the chain when the write buffer fills or when BIO_flush() is called. It is therefore important to call BIO_flush() whenever any pending data should be written such as when removing a buffering BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate source/sink BIO is non blocking.

"},{"location":"man3/BIO_f_buffer/#return-values","title":"RETURN VALUES","text":"

BIO_f_buffer() returns the buffering BIO method.

BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0) or a negative value in case of errors.

BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() return 1 if the buffer was successfully resized or <=0 for failure.

BIO_set_buffer_read_data() returns 1 if the data was set correctly or <=0 if there was an error.

"},{"location":"man3/BIO_f_buffer/#see-also","title":"SEE ALSO","text":"

bio(7), BIO_reset(3), BIO_flush(3), BIO_pop(3), BIO_ctrl(3).

"},{"location":"man3/BIO_f_buffer/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_cipher/","title":"BIO_f_cipher","text":""},{"location":"man3/BIO_f_cipher/#name","title":"NAME","text":"

BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx - cipher BIO filter

"},{"location":"man3/BIO_f_cipher/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n#include <openssl/evp.h>\n\nconst BIO_METHOD *BIO_f_cipher(void);\nint BIO_set_cipher(BIO *b, const EVP_CIPHER *cipher,\n                   const unsigned char *key, const unsigned char *iv, int enc);\nint BIO_get_cipher_status(BIO *b);\nint BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx);\n
"},{"location":"man3/BIO_f_cipher/#description","title":"DESCRIPTION","text":"

BIO_f_cipher() returns the cipher BIO method. This is a filter BIO that encrypts any data written through it, and decrypts any data read from it. It is a BIO wrapper for the cipher routines EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal().

Cipher BIOs do not support BIO_gets() or BIO_puts().

BIO_flush() on an encryption BIO that is being written through is used to signal that no more data is to be encrypted: this is used to flush and possibly pad the final block through the BIO.

BIO_set_cipher() sets the cipher of BIO b to cipher using key key and IV iv. enc should be set to 1 for encryption and zero for decryption.

When reading from an encryption BIO the final block is automatically decrypted and checked when EOF is detected. BIO_get_cipher_status() is a BIO_ctrl() macro which can be called to determine whether the decryption operation was successful.

BIO_get_cipher_ctx() is a BIO_ctrl() macro which retrieves the internal BIO cipher context. The retrieved context can be used in conjunction with the standard cipher routines to set it up. This is useful when BIO_set_cipher() is not flexible enough for the applications needs.

"},{"location":"man3/BIO_f_cipher/#notes","title":"NOTES","text":"

When encrypting BIO_flush() must be called to flush the final block through the BIO. If it is not then the final block will fail a subsequent decrypt.

When decrypting an error on the final block is signaled by a zero return value from the read operation. A successful decrypt followed by EOF will also return zero for the final read. BIO_get_cipher_status() should be called to determine if the decrypt was successful.

As always, if BIO_gets() or BIO_puts() support is needed then it can be achieved by preceding the cipher BIO with a buffering BIO.

"},{"location":"man3/BIO_f_cipher/#return-values","title":"RETURN VALUES","text":"

BIO_f_cipher() returns the cipher BIO method.

BIO_set_cipher() returns 1 for success and 0 for failure.

BIO_get_cipher_status() returns 1 for a successful decrypt and <=0 for failure.

BIO_get_cipher_ctx() returns 1 for success and <=0 for failure.

"},{"location":"man3/BIO_f_cipher/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_md/","title":"BIO_f_md","text":""},{"location":"man3/BIO_f_md/#name","title":"NAME","text":"

BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx - message digest BIO filter

"},{"location":"man3/BIO_f_md/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n#include <openssl/evp.h>\n\nconst BIO_METHOD *BIO_f_md(void);\nint BIO_set_md(BIO *b, EVP_MD *md);\nint BIO_get_md(BIO *b, EVP_MD **mdp);\nint BIO_get_md_ctx(BIO *b, EVP_MD_CTX **mdcp);\n
"},{"location":"man3/BIO_f_md/#description","title":"DESCRIPTION","text":"

BIO_f_md() returns the message digest BIO method. This is a filter BIO that digests any data passed through it. It is a BIO wrapper for the digest routines EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal().

Any data written or read through a digest BIO using BIO_read_ex() and BIO_write_ex() is digested.

BIO_gets(), if its size parameter is large enough finishes the digest calculation and returns the digest value. BIO_puts() is not supported.

BIO_reset() reinitialises a digest BIO.

BIO_set_md() sets the message digest of BIO b to md: this must be called to initialize a digest BIO before any data is passed through it. It is a BIO_ctrl() macro.

BIO_get_md() places a pointer to the digest BIOs digest method in mdp. It is a BIO_ctrl() macro.

BIO_get_md_ctx() returns the digest BIOs context into mdcp.

"},{"location":"man3/BIO_f_md/#notes","title":"NOTES","text":"

The context returned by BIO_get_md_ctx() can be used in calls to EVP_DigestFinal() and also the signature routines EVP_SignFinal() and EVP_VerifyFinal().

The context returned by BIO_get_md_ctx() is an internal context structure. Changes made to this context will affect the digest BIO itself and the context pointer will become invalid when the digest BIO is freed.

After the digest has been retrieved from a digest BIO it must be reinitialized by calling BIO_reset(), or BIO_set_md() before any more data is passed through it.

If an application needs to call BIO_gets() or BIO_puts() through a chain containing digest BIOs then this can be done by prepending a buffering BIO.

Calling BIO_get_md_ctx() will return the context and initialize the BIO state. This allows applications to initialize the context externally if the standard calls such as BIO_set_md() are not sufficiently flexible.

"},{"location":"man3/BIO_f_md/#return-values","title":"RETURN VALUES","text":"

BIO_f_md() returns the digest BIO method.

BIO_set_md(), BIO_get_md() and BIO_md_ctx() return 1 for success and <=0 for failure.

"},{"location":"man3/BIO_f_md/#examples","title":"EXAMPLES","text":"

The following example creates a BIO chain containing an SHA1 and MD5 digest BIO and passes the string \"Hello World\" through it. Error checking has been omitted for clarity.

BIO *bio, *mdtmp;\nchar message[] = \"Hello World\";\n\nbio = BIO_new(BIO_s_null());\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_sha1());\n/*\n * For BIO_push() we want to append the sink BIO and keep a note of\n * the start of the chain.\n */\nbio = BIO_push(mdtmp, bio);\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_md5());\nbio = BIO_push(mdtmp, bio);\n/* Note: mdtmp can now be discarded */\nBIO_write(bio, message, strlen(message));\n

The next example digests data by reading through a chain instead:

BIO *bio, *mdtmp;\nchar buf[1024];\nint rdlen;\n\nbio = BIO_new_file(file, \"rb\");\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_sha1());\nbio = BIO_push(mdtmp, bio);\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_md5());\nbio = BIO_push(mdtmp, bio);\ndo {\n    rdlen = BIO_read(bio, buf, sizeof(buf));\n    /* Might want to do something with the data here */\n} while (rdlen > 0);\n

This next example retrieves the message digests from a BIO chain and outputs them. This could be used with the examples above.

BIO *mdtmp;\nunsigned char mdbuf[EVP_MAX_MD_SIZE];\nint mdlen;\nint i;\n\nmdtmp = bio;   /* Assume bio has previously been set up */\ndo {\n    EVP_MD *md;\n\n    mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);\n    if (!mdtmp)\n        break;\n    BIO_get_md(mdtmp, &md);\n    printf(\"%s digest\", OBJ_nid2sn(EVP_MD_get_type(md)));\n    mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE);\n    for (i = 0; i < mdlen; i++) printf(\":%02X\", mdbuf[i]);\n    printf(\"\\n\");\n    mdtmp = BIO_next(mdtmp);\n} while (mdtmp);\n\nBIO_free_all(bio);\n
"},{"location":"man3/BIO_f_md/#bugs","title":"BUGS","text":"

The lack of support for BIO_puts() and the non standard behaviour of BIO_gets() could be regarded as anomalous. It could be argued that BIO_gets() and BIO_puts() should be passed to the next BIO in the chain and digest the data passed through and that digests should be retrieved using a separate BIO_ctrl() call.

"},{"location":"man3/BIO_f_md/#history","title":"HISTORY","text":"

Before OpenSSL 1.0.0., the call to BIO_get_md_ctx() would only work if the BIO was initialized first.

"},{"location":"man3/BIO_f_md/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_null/","title":"BIO_f_null","text":""},{"location":"man3/BIO_f_null/#name","title":"NAME","text":"

BIO_f_null - null filter

"},{"location":"man3/BIO_f_null/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_null(void);\n
"},{"location":"man3/BIO_f_null/#description","title":"DESCRIPTION","text":"

BIO_f_null() returns the null filter BIO method. This is a filter BIO that does nothing.

All requests to a null filter BIO are passed through to the next BIO in the chain: this means that a BIO chain containing a null filter BIO behaves just as though the BIO was not there.

"},{"location":"man3/BIO_f_null/#notes","title":"NOTES","text":"

As may be apparent a null filter BIO is not particularly useful.

"},{"location":"man3/BIO_f_null/#return-values","title":"RETURN VALUES","text":"

BIO_f_null() returns the null filter BIO method.

"},{"location":"man3/BIO_f_null/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_prefix/","title":"BIO_f_prefix","text":""},{"location":"man3/BIO_f_prefix/#name","title":"NAME","text":"

BIO_f_prefix, BIO_set_prefix, BIO_set_indent, BIO_get_indent - prefix BIO filter

"},{"location":"man3/BIO_f_prefix/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_prefix(void);\nlong BIO_set_prefix(BIO *b, const char *prefix);\nlong BIO_set_indent(BIO *b, long indent);\nlong BIO_get_indent(BIO *b);\n
"},{"location":"man3/BIO_f_prefix/#description","title":"DESCRIPTION","text":"

BIO_f_cipher() returns the prefix BIO method. This is a filter for text output, where each line gets automatically prefixed and indented according to user input.

The prefix and the indentation are combined. For each line of output going through this filter, the prefix is output first, then the amount of additional spaces indicated by the indentation, and then the line itself.

By default, there is no prefix, and indentation is set to 0.

BIO_set_prefix() sets the prefix to be used for future lines of text, using prefix. prefix may be NULL, signifying that there should be no prefix. If prefix isn't NULL, this function makes a copy of it.

BIO_set_indent() sets the indentation to be used for future lines of text, using indent. Negative values are not allowed.

BIO_get_indent() gets the current indentation.

"},{"location":"man3/BIO_f_prefix/#notes","title":"NOTES","text":"

BIO_set_prefix(), BIO_set_indent() and BIO_get_indent() are implemented as macros.

"},{"location":"man3/BIO_f_prefix/#return-values","title":"RETURN VALUES","text":"

BIO_f_prefix() returns the prefix BIO method.

BIO_set_prefix() returns 1 if the prefix was correctly set, or <=0 on failure.

BIO_set_indent() returns 1 if the prefix was correctly set, or <=0 on failure.

BIO_get_indent() returns the current indentation, or a negative value for failure.

"},{"location":"man3/BIO_f_prefix/#see-also","title":"SEE ALSO","text":"

bio(7)

"},{"location":"man3/BIO_f_prefix/#copyright","title":"COPYRIGHT","text":"

Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_readbuffer/","title":"BIO_f_readbuffer","text":""},{"location":"man3/BIO_f_readbuffer/#name","title":"NAME","text":"

BIO_f_readbuffer - read only buffering BIO that supports BIO_tell() and BIO_seek()

"},{"location":"man3/BIO_f_readbuffer/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_readbuffer(void);\n
"},{"location":"man3/BIO_f_readbuffer/#description","title":"DESCRIPTION","text":"

BIO_f_readbuffer() returns the read buffering BIO method.

This BIO filter can be inserted on top of BIO's that do not support BIO_tell() or BIO_seek() (e.g. A file BIO that uses stdin).

Data read from a read buffering BIO comes from an internal buffer which is filled from the next BIO in the chain.

BIO_gets() is supported for read buffering BIOs. Writing data to a read buffering BIO is not supported.

Calling BIO_reset() on a read buffering BIO does not clear any buffered data.

"},{"location":"man3/BIO_f_readbuffer/#notes","title":"NOTES","text":"

Read buffering BIOs implement BIO_read_ex() by using BIO_read_ex() operations on the next BIO (e.g. a file BIO) in the chain and storing the result in an internal buffer, from which bytes are given back to the caller as appropriate for the call. BIO_read_ex() is guaranteed to give the caller the number of bytes it asks for, unless there's an error or end of communication is reached in the next BIO. The internal buffer can grow to cache the entire contents of the next BIO in the chain. BIO_seek() uses the internal buffer, so that it can only seek into data that is already read.

"},{"location":"man3/BIO_f_readbuffer/#return-values","title":"RETURN VALUES","text":"

BIO_f_readbuffer() returns the read buffering BIO method.

"},{"location":"man3/BIO_f_readbuffer/#see-also","title":"SEE ALSO","text":"

bio(7), BIO_read(3), BIO_gets(3), BIO_reset(3), BIO_ctrl(3).

"},{"location":"man3/BIO_f_readbuffer/#copyright","title":"COPYRIGHT","text":"

Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_f_ssl/","title":"BIO_f_ssl","text":""},{"location":"man3/BIO_f_ssl/#name","title":"NAME","text":"

BIO_do_handshake, BIO_f_ssl, BIO_set_ssl, BIO_get_ssl, BIO_set_ssl_mode, BIO_set_ssl_renegotiate_bytes, BIO_get_num_renegotiates, BIO_set_ssl_renegotiate_timeout, BIO_new_ssl, BIO_new_ssl_connect, BIO_new_buffer_ssl_connect, BIO_ssl_copy_session_id, BIO_ssl_shutdown - SSL BIO

"},{"location":"man3/BIO_f_ssl/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n#include <openssl/ssl.h>\n\nconst BIO_METHOD *BIO_f_ssl(void);\n\nlong BIO_set_ssl(BIO *b, SSL *ssl, long c);\nlong BIO_get_ssl(BIO *b, SSL **sslp);\nlong BIO_set_ssl_mode(BIO *b, long client);\nlong BIO_set_ssl_renegotiate_bytes(BIO *b, long num);\nlong BIO_set_ssl_renegotiate_timeout(BIO *b, long seconds);\nlong BIO_get_num_renegotiates(BIO *b);\n\nBIO *BIO_new_ssl(SSL_CTX *ctx, int client);\nBIO *BIO_new_ssl_connect(SSL_CTX *ctx);\nBIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);\nint BIO_ssl_copy_session_id(BIO *to, BIO *from);\nvoid BIO_ssl_shutdown(BIO *bio);\n\nlong BIO_do_handshake(BIO *b);\n
"},{"location":"man3/BIO_f_ssl/#description","title":"DESCRIPTION","text":"

BIO_f_ssl() returns the SSL BIO method. This is a filter BIO which is a wrapper round the OpenSSL SSL routines adding a BIO \"flavour\" to SSL I/O.

I/O performed on an SSL BIO communicates using the SSL protocol with the SSLs read and write BIOs. If an SSL connection is not established then an attempt is made to establish one on the first I/O call.

If a BIO is appended to an SSL BIO using BIO_push() it is automatically used as the SSL BIOs read and write BIOs.

Calling BIO_reset() on an SSL BIO closes down any current SSL connection by calling SSL_shutdown(). BIO_reset() is then sent to the next BIO in the chain: this will typically disconnect the underlying transport. The SSL BIO is then reset to the initial accept or connect state.

If the close flag is set when an SSL BIO is freed then the internal SSL structure is also freed using SSL_free().

BIO_set_ssl() sets the internal SSL pointer of SSL BIO b to ssl using the close flag c.

BIO_get_ssl() retrieves the SSL pointer of SSL BIO b, it can then be manipulated using the standard SSL library functions.

BIO_set_ssl_mode() sets the SSL BIO mode to client. If client is 1 client mode is set. If client is 0 server mode is set.

BIO_set_ssl_renegotiate_bytes() sets the renegotiate byte count of SSL BIO b to num. When set after every num bytes of I/O (read and write) the SSL session is automatically renegotiated. num must be at least 512 bytes.

BIO_set_ssl_renegotiate_timeout() sets the renegotiate timeout of SSL BIO b to seconds. When the renegotiate timeout elapses the session is automatically renegotiated.

BIO_get_num_renegotiates() returns the total number of session renegotiations due to I/O or timeout of SSL BIO b.

BIO_new_ssl() allocates an SSL BIO using SSL_CTX ctx and using client mode if client is non zero.

BIO_new_ssl_connect() creates a new BIO chain consisting of an SSL BIO (using ctx) followed by a connect BIO.

BIO_new_buffer_ssl_connect() creates a new BIO chain consisting of a buffering BIO, an SSL BIO (using ctx), and a connect BIO.

BIO_ssl_copy_session_id() copies an SSL session id between BIO chains from and to. It does this by locating the SSL BIOs in each chain and calling SSL_copy_session_id() on the internal SSL pointer.

BIO_ssl_shutdown() closes down an SSL connection on BIO chain bio. It does this by locating the SSL BIO in the chain and calling SSL_shutdown() on its internal SSL pointer.

BIO_do_handshake() attempts to complete an SSL handshake on the supplied BIO and establish the SSL connection. For non-SSL BIOs the connection is done typically at TCP level. If domain name resolution yields multiple IP addresses all of them are tried after connect() failures. The function returns 1 if the connection was established successfully. A zero or negative value is returned if the connection could not be established. The call BIO_should_retry() should be used for nonblocking connect BIOs to determine if the call should be retried. If a connection has already been established this call has no effect.

"},{"location":"man3/BIO_f_ssl/#notes","title":"NOTES","text":"

SSL BIOs are exceptional in that if the underlying transport is non blocking they can still request a retry in exceptional circumstances. Specifically this will happen if a session renegotiation takes place during a BIO_read_ex() operation, one case where this happens is when step up occurs.

The SSL flag SSL_AUTO_RETRY can be set to disable this behaviour. That is when this flag is set an SSL BIO using a blocking transport will never request a retry.

Since unknown BIO_ctrl() operations are sent through filter BIOs the servers name and port can be set using BIO_set_host() on the BIO returned by BIO_new_ssl_connect() without having to locate the connect BIO first.

Applications do not have to call BIO_do_handshake() but may wish to do so to separate the handshake process from other I/O processing.

BIO_set_ssl(), BIO_get_ssl(), BIO_set_ssl_mode(), BIO_set_ssl_renegotiate_bytes(), BIO_set_ssl_renegotiate_timeout(), BIO_get_num_renegotiates(), and BIO_do_handshake() are implemented as macros.

"},{"location":"man3/BIO_f_ssl/#return-values","title":"RETURN VALUES","text":"

BIO_f_ssl() returns the SSL BIO_METHOD structure.

BIO_set_ssl(), BIO_get_ssl(), BIO_set_ssl_mode(), BIO_set_ssl_renegotiate_bytes(), BIO_set_ssl_renegotiate_timeout() and BIO_get_num_renegotiates() return 1 on success or a value which is less than or equal to 0 if an error occurred.

BIO_new_ssl(), BIO_new_ssl_connect() and BIO_new_buffer_ssl_connect() return a valid BIO structure on success or NULL if an error occurred.

BIO_ssl_copy_session_id() returns 1 on success or 0 on error.

BIO_do_handshake() returns 1 if the connection was established successfully. A zero or negative value is returned if the connection could not be established.

"},{"location":"man3/BIO_f_ssl/#examples","title":"EXAMPLES","text":"

This SSL/TLS client example attempts to retrieve a page from an SSL/TLS web server. The I/O routines are identical to those of the unencrypted example in BIO_s_connect(3).

BIO *sbio, *out;\nint len;\nchar tmpbuf[1024];\nSSL_CTX *ctx;\nSSL *ssl;\n\n/* XXX Seed the PRNG if needed. */\n\nctx = SSL_CTX_new(TLS_client_method());\n\n/* XXX Set verify paths and mode here. */\n\nsbio = BIO_new_ssl_connect(ctx);\nBIO_get_ssl(sbio, &ssl);\nif (ssl == NULL) {\n    fprintf(stderr, \"Can't locate SSL pointer\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* XXX We might want to do other things with ssl here */\n\n/* An empty host part means the loopback address */\nBIO_set_conn_hostname(sbio, \":https\");\n\nout = BIO_new_fp(stdout, BIO_NOCLOSE);\nif (BIO_do_connect(sbio) <= 0) {\n    fprintf(stderr, \"Error connecting to server\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* XXX Could examine ssl here to get connection info */\n\nBIO_puts(sbio, \"GET / HTTP/1.0\\n\\n\");\nfor (;;) {\n    len = BIO_read(sbio, tmpbuf, 1024);\n    if (len <= 0)\n        break;\n    BIO_write(out, tmpbuf, len);\n}\nBIO_free_all(sbio);\nBIO_free(out);\n

Here is a simple server example. It makes use of a buffering BIO to allow lines to be read from the SSL BIO using BIO_gets. It creates a pseudo web page containing the actual request from a client and also echoes the request to standard output.

BIO *sbio, *bbio, *acpt, *out;\nint len;\nchar tmpbuf[1024];\nSSL_CTX *ctx;\nSSL *ssl;\n\n/* XXX Seed the PRNG if needed. */\n\nctx = SSL_CTX_new(TLS_server_method());\nif (!SSL_CTX_use_certificate_file(ctx, \"server.pem\", SSL_FILETYPE_PEM)\n        || !SSL_CTX_use_PrivateKey_file(ctx, \"server.pem\", SSL_FILETYPE_PEM)\n        || !SSL_CTX_check_private_key(ctx)) {\n    fprintf(stderr, \"Error setting up SSL_CTX\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* XXX Other things like set verify locations, EDH temp callbacks. */\n\n/* New SSL BIO setup as server */\nsbio = BIO_new_ssl(ctx, 0);\nBIO_get_ssl(sbio, &ssl);\nif (ssl == NULL) {\n    fprintf(stderr, \"Can't locate SSL pointer\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\nbbio = BIO_new(BIO_f_buffer());\nsbio = BIO_push(bbio, sbio);\nacpt = BIO_new_accept(\"4433\");\n\n/*\n * By doing this when a new connection is established\n * we automatically have sbio inserted into it. The\n * BIO chain is now 'swallowed' by the accept BIO and\n * will be freed when the accept BIO is freed.\n */\nBIO_set_accept_bios(acpt, sbio);\nout = BIO_new_fp(stdout, BIO_NOCLOSE);\n\n/* First call to BIO_do_accept() sets up accept BIO */\nif (BIO_do_accept(acpt) <= 0) {\n    fprintf(stderr, \"Error setting up accept BIO\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n

/* Second call to BIO_do_accept() waits for incoming connection */ if (BIO_do_accept(acpt) <= 0) { fprintf(stderr, \"Error accepting connection\\n\"); ERR_print_errors_fp(stderr); exit(1); }

/* We only want one connection so remove and free accept BIO */\nsbio = BIO_pop(acpt);\nBIO_free_all(acpt);\n\nif (BIO_do_handshake(sbio) <= 0) {\n    fprintf(stderr, \"Error in SSL handshake\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\nBIO_puts(sbio, \"HTTP/1.0 200 OK\\r\\nContent-type: text/plain\\r\\n\\r\\n\");\nBIO_puts(sbio, \"\\r\\nConnection Established\\r\\nRequest headers:\\r\\n\");\nBIO_puts(sbio, \"--------------------------------------------------\\r\\n\");\n\nfor (;;) {\n    len = BIO_gets(sbio, tmpbuf, 1024);\n    if (len <= 0)\n        break;\n    BIO_write(sbio, tmpbuf, len);\n    BIO_write(out, tmpbuf, len);\n    /* Look for blank line signifying end of headers*/\n    if (tmpbuf[0] == '\\r' || tmpbuf[0] == '\\n')\n        break;\n}\n\nBIO_puts(sbio, \"--------------------------------------------------\\r\\n\");\nBIO_puts(sbio, \"\\r\\n\");\nBIO_flush(sbio);\nBIO_free_all(sbio);\n
"},{"location":"man3/BIO_f_ssl/#history","title":"HISTORY","text":"

In OpenSSL before 1.0.0 the BIO_pop() call was handled incorrectly, the I/O BIO reference count was incorrectly incremented (instead of decremented) and dissociated with the SSL BIO even if the SSL BIO was not explicitly being popped (e.g. a pop higher up the chain). Applications which included workarounds for this bug (e.g. freeing BIOs more than once) should be modified to handle this fix or they may free up an already freed BIO.

"},{"location":"man3/BIO_f_ssl/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_find_type/","title":"BIO_find_type","text":""},{"location":"man3/BIO_find_type/#name","title":"NAME","text":"

BIO_find_type, BIO_next, BIO_method_type - BIO chain traversal

"},{"location":"man3/BIO_find_type/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nBIO *BIO_find_type(BIO *b, int bio_type);\nBIO *BIO_next(BIO *b);\nint BIO_method_type(const BIO *b);\n
"},{"location":"man3/BIO_find_type/#description","title":"DESCRIPTION","text":"

The BIO_find_type() searches for a BIO of a given type in a chain, starting at BIO b. If type is a specific type (such as BIO_TYPE_MEM) then a search is made for a BIO of that type. If type is a general type (such as BIO_TYPE_SOURCE_SINK) then the next matching BIO of the given general type is searched for. BIO_find_type() returns the next matching BIO or NULL if none is found.

The following general types are defined: BIO_TYPE_DESCRIPTOR, BIO_TYPE_FILTER, and BIO_TYPE_SOURCE_SINK.

For a list of the specific types, see the <openssl/bio.h> header file.

BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs in a chain or used in conjunction with BIO_find_type() to find all BIOs of a certain type.

BIO_method_type() returns the type of a BIO.

"},{"location":"man3/BIO_find_type/#return-values","title":"RETURN VALUES","text":"

BIO_find_type() returns a matching BIO or NULL for no match.

BIO_next() returns the next BIO in a chain.

BIO_method_type() returns the type of the BIO b.

"},{"location":"man3/BIO_find_type/#examples","title":"EXAMPLES","text":"

Traverse a chain looking for digest BIOs:

BIO *btmp;\n\nbtmp = in_bio; /* in_bio is chain to search through */\ndo {\n    btmp = BIO_find_type(btmp, BIO_TYPE_MD);\n    if (btmp == NULL)\n        break; /* Not found */\n    /* btmp is a digest BIO, do something with it ...*/\n    ...\n\n    btmp = BIO_next(btmp);\n} while (btmp);\n
"},{"location":"man3/BIO_find_type/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_get_data/","title":"BIO_get_data","text":""},{"location":"man3/BIO_get_data/#name","title":"NAME","text":"

BIO_set_data, BIO_get_data, BIO_set_init, BIO_get_init, BIO_set_shutdown, BIO_get_shutdown - functions for managing BIO state information

"},{"location":"man3/BIO_get_data/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nvoid BIO_set_data(BIO *a, void *ptr);\nvoid *BIO_get_data(BIO *a);\nvoid BIO_set_init(BIO *a, int init);\nint BIO_get_init(BIO *a);\nvoid BIO_set_shutdown(BIO *a, int shut);\nint BIO_get_shutdown(BIO *a);\n
"},{"location":"man3/BIO_get_data/#description","title":"DESCRIPTION","text":"

These functions are mainly useful when implementing a custom BIO.

The BIO_set_data() function associates the custom data pointed to by ptr with the BIO. This data can subsequently be retrieved via a call to BIO_get_data(). This can be used by custom BIOs for storing implementation specific information.

The BIO_set_init() function sets the value of the BIO's \"init\" flag to indicate whether initialisation has been completed for this BIO or not. A nonzero value indicates that initialisation is complete, whilst zero indicates that it is not. Often initialisation will complete during initial construction of the BIO. For some BIOs however, initialisation may not complete until after additional steps have occurred (for example through calling custom ctrls). The BIO_get_init() function returns the value of the \"init\" flag.

The BIO_set_shutdown() and BIO_get_shutdown() functions set and get the state of this BIO's shutdown (i.e. BIO_CLOSE) flag. If set then the underlying resource is also closed when the BIO is freed.

"},{"location":"man3/BIO_get_data/#return-values","title":"RETURN VALUES","text":"

BIO_get_data() returns a pointer to the implementation specific custom data associated with this BIO, or NULL if none has been set.

BIO_get_init() returns the state of the BIO's init flag.

BIO_get_shutdown() returns the stat of the BIO's shutdown (i.e. BIO_CLOSE) flag.

"},{"location":"man3/BIO_get_data/#see-also","title":"SEE ALSO","text":"

bio(7), BIO_meth_new(3)

"},{"location":"man3/BIO_get_data/#history","title":"HISTORY","text":"

The functions described here were added in OpenSSL 1.1.0.

"},{"location":"man3/BIO_get_data/#copyright","title":"COPYRIGHT","text":"

Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_get_ex_new_index/","title":"BIO_get_ex_new_index","text":""},{"location":"man3/BIO_get_ex_new_index/#name","title":"NAME","text":"

BIO_get_ex_new_index, BIO_set_ex_data, BIO_get_ex_data, BIO_set_app_data, BIO_get_app_data, DH_get_ex_new_index, DH_set_ex_data, DH_get_ex_data, DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data, EC_KEY_get_ex_new_index, EC_KEY_set_ex_data, EC_KEY_get_ex_data, ENGINE_get_ex_new_index, ENGINE_set_ex_data, ENGINE_get_ex_data, EVP_PKEY_get_ex_new_index, EVP_PKEY_set_ex_data, EVP_PKEY_get_ex_data, RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data, RSA_set_app_data, RSA_get_app_data, SSL_get_ex_new_index, SSL_set_ex_data, SSL_get_ex_data, SSL_set_app_data, SSL_get_app_data, SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data, SSL_CTX_set_app_data, SSL_CTX_get_app_data, SSL_SESSION_get_ex_new_index, SSL_SESSION_set_ex_data, SSL_SESSION_get_ex_data, SSL_SESSION_set_app_data, SSL_SESSION_get_app_data, UI_get_ex_new_index, UI_set_ex_data, UI_get_ex_data, UI_set_app_data, UI_get_app_data, X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ex_data, X509_STORE_CTX_set_app_data, X509_STORE_CTX_get_app_data, X509_STORE_get_ex_new_index, X509_STORE_set_ex_data, X509_STORE_get_ex_data, X509_get_ex_new_index, X509_set_ex_data, X509_get_ex_data - application-specific data

"},{"location":"man3/BIO_get_ex_new_index/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/x509.h>\n\nint TYPE_get_ex_new_index(long argl, void *argp,\n                          CRYPTO_EX_new *new_func,\n                          CRYPTO_EX_dup *dup_func,\n                          CRYPTO_EX_free *free_func);\n\nint TYPE_set_ex_data(TYPE *d, int idx, void *arg);\n\nvoid *TYPE_get_ex_data(const TYPE *d, int idx);\n\n#define TYPE_set_app_data(TYPE *d, void *arg)\n#define TYPE_get_app_data(TYPE *d)\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                        CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint DH_set_ex_data(DH *type, int idx, void *arg);\nvoid *DH_get_ex_data(DH *type, int idx);\nint DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint DSA_set_ex_data(DSA *type, int idx, void *arg);\nvoid *DSA_get_ex_data(DSA *type, int idx);\nint EC_KEY_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                            CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint EC_KEY_set_ex_data(EC_KEY *type, int idx, void *arg);\nvoid *EC_KEY_get_ex_data(EC_KEY *type, int idx);\nint RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint RSA_set_ex_data(RSA *type, int idx, void *arg);\nvoid *RSA_get_ex_data(RSA *type, int idx);\nint RSA_set_app_data(RSA *type, void *arg);\nvoid *RSA_get_app_data(RSA *type);\nint ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                            CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint ENGINE_set_ex_data(ENGINE *type, int idx, void *arg);\nvoid *ENGINE_get_ex_data(ENGINE *type, int idx);\n
"},{"location":"man3/BIO_get_ex_new_index/#description","title":"DESCRIPTION","text":"

In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes listed in CRYPTO_get_ex_new_index(3).

All functions with a TYPE of DH, DSA, RSA and EC_KEY are deprecated. Applications should instead use EVP_PKEY_set_ex_data(), EVP_PKEY_get_ex_data() and EVP_PKEY_get_ex_new_index().

All functions with a TYPE of ENGINE are deprecated. Applications using engines should be replaced by providers.

These functions handle application-specific data for OpenSSL data structures.

TYPE_get_ex_new_index() is a macro that calls CRYPTO_get_ex_new_index() with the correct index value.

TYPE_set_ex_data() is a function that calls CRYPTO_set_ex_data() with an offset into the opaque exdata part of the TYPE object.

TYPE_get_ex_data() is a function that calls CRYPTO_get_ex_data() with an offset into the opaque exdata part of the TYPE object.

For compatibility with previous releases, the exdata index of zero is reserved for \"application data.\" There are two convenience functions for this. TYPE_set_app_data() is a macro that invokes TYPE_set_ex_data() with idx set to zero. TYPE_get_app_data() is a macro that invokes TYPE_get_ex_data() with idx set to zero.

"},{"location":"man3/BIO_get_ex_new_index/#return-values","title":"RETURN VALUES","text":"

TYPE_get_ex_new_index() returns a new index on success or -1 on error.

TYPE_set_ex_data() returns 1 on success or 0 on error.

TYPE_get_ex_data() returns the application data or NULL if an error occurred.

"},{"location":"man3/BIO_get_ex_new_index/#see-also","title":"SEE ALSO","text":"

CRYPTO_get_ex_new_index(3).

"},{"location":"man3/BIO_get_ex_new_index/#history","title":"HISTORY","text":"

The functions DH_get_ex_new_index(), DH_set_ex_data(), DH_get_ex_data(), DSA_get_ex_new_index(), DSA_set_ex_data(), DSA_get_ex_data(), EC_KEY_get_ex_new_index(), EC_KEY_set_ex_data(), EC_KEY_get_ex_data(), ENGINE_get_ex_new_index(), ENGINE_set_ex_data(), ENGINE_get_ex_data(), RSA_get_ex_new_index(), RSA_set_ex_data(), RSA_get_ex_data(), RSA_set_app_data() and RSA_get_app_data() were deprecated in OpenSSL 3.0.

"},{"location":"man3/BIO_get_ex_new_index/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_meth_new/","title":"BIO_meth_new","text":""},{"location":"man3/BIO_meth_new/#name","title":"NAME","text":"

BIO_get_new_index, BIO_meth_new, BIO_meth_free, BIO_meth_get_read_ex, BIO_meth_set_read_ex, BIO_meth_get_write_ex, BIO_meth_set_write_ex, BIO_meth_get_write, BIO_meth_set_write, BIO_meth_get_read, BIO_meth_set_read, BIO_meth_get_puts, BIO_meth_set_puts, BIO_meth_get_gets, BIO_meth_set_gets, BIO_meth_get_ctrl, BIO_meth_set_ctrl, BIO_meth_get_create, BIO_meth_set_create, BIO_meth_get_destroy, BIO_meth_set_destroy, BIO_meth_get_callback_ctrl, BIO_meth_set_callback_ctrl - Routines to build up BIO methods

"},{"location":"man3/BIO_meth_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nint BIO_get_new_index(void);\n\nBIO_METHOD *BIO_meth_new(int type, const char *name);\n\nvoid BIO_meth_free(BIO_METHOD *biom);\n\nint (*BIO_meth_get_write_ex(const BIO_METHOD *biom))(BIO *, const char *, size_t,\n                                               size_t *);\nint (*BIO_meth_get_write(const BIO_METHOD *biom))(BIO *, const char *, int);\nint BIO_meth_set_write_ex(BIO_METHOD *biom,\n                          int (*bwrite)(BIO *, const char *, size_t, size_t *));\nint BIO_meth_set_write(BIO_METHOD *biom,\n                       int (*write)(BIO *, const char *, int));\n\nint (*BIO_meth_get_read_ex(const BIO_METHOD *biom))(BIO *, char *, size_t, size_t *);\nint (*BIO_meth_get_read(const BIO_METHOD *biom))(BIO *, char *, int);\nint BIO_meth_set_read_ex(BIO_METHOD *biom,\n                         int (*bread)(BIO *, char *, size_t, size_t *));\nint BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int));\n\nint (*BIO_meth_get_puts(const BIO_METHOD *biom))(BIO *, const char *);\nint BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *));\n\nint (*BIO_meth_get_gets(const BIO_METHOD *biom))(BIO *, char *, int);\nint BIO_meth_set_gets(BIO_METHOD *biom,\n                      int (*gets)(BIO *, char *, int));\n\nlong (*BIO_meth_get_ctrl(const BIO_METHOD *biom))(BIO *, int, long, void *);\nint BIO_meth_set_ctrl(BIO_METHOD *biom,\n                      long (*ctrl)(BIO *, int, long, void *));\n\nint (*BIO_meth_get_create(const BIO_METHOD *bion))(BIO *);\nint BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *));\n\nint (*BIO_meth_get_destroy(const BIO_METHOD *biom))(BIO *);\nint BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *));\n\nlong (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))(BIO *, int, BIO_info_cb *);\nint BIO_meth_set_callback_ctrl(BIO_METHOD *biom,\n                               long (*callback_ctrl)(BIO *, int, BIO_info_cb *));\n
"},{"location":"man3/BIO_meth_new/#description","title":"DESCRIPTION","text":"

The BIO_METHOD type is a structure used for the implementation of new BIO types. It provides a set of functions used by OpenSSL for the implementation of the various BIO capabilities. See the bio(7) page for more information.

BIO_meth_new() creates a new BIO_METHOD structure. It should be given a unique integer type and a string that represents its name. Use BIO_get_new_index() to get the value for type.

The set of standard OpenSSL provided BIO types is provided in <openssl/bio.h>. Some examples include BIO_TYPE_BUFFER and BIO_TYPE_CIPHER. Filter BIOs should have a type which have the \"filter\" bit set (BIO_TYPE_FILTER). Source/sink BIOs should have the \"source/sink\" bit set (BIO_TYPE_SOURCE_SINK). File descriptor based BIOs (e.g. socket, fd, connect, accept etc) should additionally have the \"descriptor\" bit set (BIO_TYPE_DESCRIPTOR). See the BIO_find_type(3) page for more information.

BIO_meth_free() destroys a BIO_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

BIO_meth_get_write_ex() and BIO_meth_set_write_ex() get and set the function used for writing arbitrary length data to the BIO respectively. This function will be called in response to the application calling BIO_write_ex() or BIO_write(). The parameters for the function have the same meaning as for BIO_write_ex(). Older code may call BIO_meth_get_write() and BIO_meth_set_write() instead. Applications should not call both BIO_meth_set_write_ex() and BIO_meth_set_write() or call BIO_meth_get_write() when the function was set with BIO_meth_set_write_ex().

BIO_meth_get_read_ex() and BIO_meth_set_read_ex() get and set the function used for reading arbitrary length data from the BIO respectively. This function will be called in response to the application calling BIO_read_ex() or BIO_read(). The parameters for the function have the same meaning as for BIO_read_ex(). Older code may call BIO_meth_get_read() and BIO_meth_set_read() instead. Applications should not call both BIO_meth_set_read_ex() and BIO_meth_set_read() or call BIO_meth_get_read() when the function was set with BIO_meth_set_read_ex().

BIO_meth_get_puts() and BIO_meth_set_puts() get and set the function used for writing a NULL terminated string to the BIO respectively. This function will be called in response to the application calling BIO_puts(). The parameters for the function have the same meaning as for BIO_puts().

BIO_meth_get_gets() and BIO_meth_set_gets() get and set the function typically used for reading a line of data from the BIO respectively (see the BIO_gets(3) page for more information). This function will be called in response to the application calling BIO_gets(). The parameters for the function have the same meaning as for BIO_gets().

BIO_meth_get_ctrl() and BIO_meth_set_ctrl() get and set the function used for processing ctrl messages in the BIO respectively. See the BIO_ctrl(3) page for more information. This function will be called in response to the application calling BIO_ctrl(). The parameters for the function have the same meaning as for BIO_ctrl().

BIO_meth_get_create() and BIO_meth_set_create() get and set the function used for creating a new instance of the BIO respectively. This function will be called in response to the application calling BIO_new() and passing in a pointer to the current BIO_METHOD. The BIO_new() function will allocate the memory for the new BIO, and a pointer to this newly allocated structure will be passed as a parameter to the function. If a create function is set, BIO_new() will not mark the BIO as initialised on allocation. BIO_set_init(3) must then be called either by the create function, or later, by a BIO ctrl function, once BIO initialisation is complete.

BIO_meth_get_destroy() and BIO_meth_set_destroy() get and set the function used for destroying an instance of a BIO respectively. This function will be called in response to the application calling BIO_free(). A pointer to the BIO to be destroyed is passed as a parameter. The destroy function should be used for BIO specific clean up. The memory for the BIO itself should not be freed by this function.

BIO_meth_get_callback_ctrl() and BIO_meth_set_callback_ctrl() get and set the function used for processing callback ctrl messages in the BIO respectively. See the BIO_callback_ctrl(3) page for more information. This function will be called in response to the application calling BIO_callback_ctrl(). The parameters for the function have the same meaning as for BIO_callback_ctrl().

"},{"location":"man3/BIO_meth_new/#return-values","title":"RETURN VALUES","text":"

BIO_get_new_index() returns the new BIO type value or -1 if an error occurred.

BIO_meth_new(int type, const char *name) returns a valid BIO_METHOD or NULL if an error occurred.

The BIO_meth_set functions return 1 on success or 0 on error.

The BIO_meth_get functions return the corresponding function pointers.

"},{"location":"man3/BIO_meth_new/#see-also","title":"SEE ALSO","text":"

bio(7), BIO_find_type(3), BIO_ctrl(3), BIO_read_ex(3), BIO_new(3)

"},{"location":"man3/BIO_meth_new/#history","title":"HISTORY","text":"

The functions described here were added in OpenSSL 1.1.0.

"},{"location":"man3/BIO_meth_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_new/","title":"BIO_new","text":""},{"location":"man3/BIO_new/#name","title":"NAME","text":"

BIO_new_ex, BIO_new, BIO_up_ref, BIO_free, BIO_vfree, BIO_free_all - BIO allocation and freeing functions

"},{"location":"man3/BIO_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nBIO *BIO_new_ex(OSSL_LIB_CTX *libctx, const BIO_METHOD *type);\nBIO *BIO_new(const BIO_METHOD *type);\nint BIO_up_ref(BIO *a);\nint BIO_free(BIO *a);\nvoid BIO_vfree(BIO *a);\nvoid BIO_free_all(BIO *a);\n
"},{"location":"man3/BIO_new/#description","title":"DESCRIPTION","text":"

The BIO_new_ex() function returns a new BIO using method type associated with the library context libctx (see OSSL_LIB_CTX(3)). The library context may be NULL to indicate the default library context.

The BIO_new() is the same as BIO_new_ex() except the default library context is always used.

BIO_up_ref() increments the reference count associated with the BIO object.

BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO but it does not return a value. If a is NULL nothing is done. Calling BIO_free() may also have some effect on the underlying I/O structure, for example it may close the file being referred to under certain circumstances. For more details see the individual BIO_METHOD descriptions.

BIO_free_all() frees up an entire BIO chain, it does not halt if an error occurs freeing up an individual BIO in the chain. If a is NULL nothing is done.

"},{"location":"man3/BIO_new/#return-values","title":"RETURN VALUES","text":"

BIO_new_ex() and BIO_new() return a newly created BIO or NULL if the call fails.

BIO_up_ref() and BIO_free() return 1 for success and 0 for failure.

BIO_free_all() and BIO_vfree() do not return values.

"},{"location":"man3/BIO_new/#notes","title":"NOTES","text":"

If BIO_free() is called on a BIO chain it will only free one BIO resulting in a memory leak.

Calling BIO_free_all() on a single BIO has the same effect as calling BIO_free() on it other than the discarded return value.

"},{"location":"man3/BIO_new/#history","title":"HISTORY","text":"

BIO_set() was removed in OpenSSL 1.1.0 as BIO type is now opaque.

BIO_new_ex() was added in OpenSSL 3.0.

"},{"location":"man3/BIO_new/#examples","title":"EXAMPLES","text":"

Create a memory BIO:

BIO *mem = BIO_new(BIO_s_mem());\n
"},{"location":"man3/BIO_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_new_CMS/","title":"BIO_new_CMS","text":""},{"location":"man3/BIO_new_CMS/#name","title":"NAME","text":"

BIO_new_CMS - CMS streaming filter BIO

"},{"location":"man3/BIO_new_CMS/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nBIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);\n
"},{"location":"man3/BIO_new_CMS/#description","title":"DESCRIPTION","text":"

BIO_new_CMS() returns a streaming filter BIO chain based on cms. The output of the filter is written to out. Any data written to the chain is automatically translated to a BER format CMS structure of the appropriate type.

"},{"location":"man3/BIO_new_CMS/#notes","title":"NOTES","text":"

The chain returned by this function behaves like a standard filter BIO. It supports non blocking I/O. Content is processed and streamed on the fly and not all held in memory at once: so it is possible to encode very large structures. After all content has been written through the chain BIO_flush() must be called to finalise the structure.

The CMS_STREAM flag must be included in the corresponding flags parameter of the cms creation function.

If an application wishes to write additional data to out BIOs should be removed from the chain using BIO_pop() and freed with BIO_free() until out is reached. If no additional data needs to be written BIO_free_all() can be called to free up the whole chain.

Any content written through the filter is used verbatim: no canonical translation is performed.

It is possible to chain multiple BIOs to, for example, create a triple wrapped signed, enveloped, signed structure. In this case it is the applications responsibility to set the inner content type of any outer CMS_ContentInfo structures.

Large numbers of small writes through the chain should be avoided as this will produce an output consisting of lots of OCTET STRING structures. Prepending a BIO_f_buffer() buffering BIO will prevent this.

"},{"location":"man3/BIO_new_CMS/#bugs","title":"BUGS","text":"

There is currently no corresponding inverse BIO: i.e. one which can decode a CMS structure on the fly.

"},{"location":"man3/BIO_new_CMS/#return-values","title":"RETURN VALUES","text":"

BIO_new_CMS() returns a BIO chain when successful or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

"},{"location":"man3/BIO_new_CMS/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_sign(3), CMS_encrypt(3)

"},{"location":"man3/BIO_new_CMS/#history","title":"HISTORY","text":"

The BIO_new_CMS() function was added in OpenSSL 1.0.0.

"},{"location":"man3/BIO_new_CMS/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_parse_hostserv/","title":"BIO_parse_hostserv","text":""},{"location":"man3/BIO_parse_hostserv/#name","title":"NAME","text":"

BIO_hostserv_priorities, BIO_parse_hostserv - utility routines to parse a standard host and service string

"},{"location":"man3/BIO_parse_hostserv/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nenum BIO_hostserv_priorities {\n    BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV\n};\nint BIO_parse_hostserv(const char *hostserv, char **host, char **service,\n                       enum BIO_hostserv_priorities hostserv_prio);\n
"},{"location":"man3/BIO_parse_hostserv/#description","title":"DESCRIPTION","text":"

BIO_parse_hostserv() will parse the information given in hostserv, create strings with the hostname and service name and give those back via host and service. Those will need to be freed after they are used. hostserv_prio helps determine if hostserv shall be interpreted primarily as a hostname or a service name in ambiguous cases.

The syntax the BIO_parse_hostserv() recognises is:

host + ':' + service\nhost + ':' + '*'\nhost + ':'\n       ':' + service\n'*'  + ':' + service\nhost\nservice\n

The host part can be a name or an IP address. If it's a IPv6 address, it MUST be enclosed in brackets, such as '[::1]'.

The service part can be a service name or its port number. A service name will be mapped to a port number using the system function getservbyname().

The returned values will depend on the given hostserv string and hostserv_prio, as follows:

host + ':' + service  => *host = \"host\", *service = \"service\"\nhost + ':' + '*'      => *host = \"host\", *service = NULL\nhost + ':'            => *host = \"host\", *service = NULL\n       ':' + service  => *host = NULL, *service = \"service\"\n '*' + ':' + service  => *host = NULL, *service = \"service\"\n\nin case no ':' is present in the string, the result depends on\nhostserv_prio, as follows:\n\nwhen hostserv_prio == BIO_PARSE_PRIO_HOST\nhost                 => *host = \"host\", *service untouched\n\nwhen hostserv_prio == BIO_PARSE_PRIO_SERV\nservice              => *host untouched, *service = \"service\"\n
"},{"location":"man3/BIO_parse_hostserv/#return-values","title":"RETURN VALUES","text":"

BIO_parse_hostserv() returns 1 on success or 0 on error.

"},{"location":"man3/BIO_parse_hostserv/#see-also","title":"SEE ALSO","text":"

BIO_ADDRINFO(3)

"},{"location":"man3/BIO_parse_hostserv/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_printf/","title":"BIO_printf","text":""},{"location":"man3/BIO_printf/#name","title":"NAME","text":"

BIO_printf, BIO_vprintf, BIO_snprintf, BIO_vsnprintf - formatted output to a BIO

"},{"location":"man3/BIO_printf/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nint BIO_printf(BIO *bio, const char *format, ...);\nint BIO_vprintf(BIO *bio, const char *format, va_list args);\n\nint BIO_snprintf(char *buf, size_t n, const char *format, ...);\nint BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);\n
"},{"location":"man3/BIO_printf/#description","title":"DESCRIPTION","text":"

BIO_printf() is similar to the standard C printf() function, except that the output is sent to the specified BIO, bio, rather than standard output. All common format specifiers are supported.

BIO_vprintf() is similar to the vprintf() function found on many platforms, the output is sent to the specified BIO, bio, rather than standard output. All common format specifiers are supported. The argument list args is a stdarg argument list.

BIO_snprintf() is for platforms that do not have the common snprintf() function. It is like sprintf() except that the size parameter, n, specifies the size of the output buffer.

BIO_vsnprintf() is to BIO_snprintf() as BIO_vprintf() is to BIO_printf().

"},{"location":"man3/BIO_printf/#return-values","title":"RETURN VALUES","text":"

All functions return the number of bytes written, or -1 on error. For BIO_snprintf() and BIO_vsnprintf() this includes when the output buffer is too small.

"},{"location":"man3/BIO_printf/#notes","title":"NOTES","text":"

Except when n is 0, both BIO_snprintf() and BIO_vsnprintf() always terminate their output with '\\0'. This includes cases where -1 is returned, such as when there is insufficient space to output the whole string.

"},{"location":"man3/BIO_printf/#copyright","title":"COPYRIGHT","text":"

Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_push/","title":"BIO_push","text":""},{"location":"man3/BIO_push/#name","title":"NAME","text":"

BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain

"},{"location":"man3/BIO_push/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nBIO *BIO_push(BIO *b, BIO *next);\nBIO *BIO_pop(BIO *b);\nvoid BIO_set_next(BIO *b, BIO *next);\n
"},{"location":"man3/BIO_push/#description","title":"DESCRIPTION","text":"

BIO_push() pushes b on next. If b is NULL the function does nothing and returns next. Otherwise it prepends b, which may be a single BIO or a chain of BIOs, to next (unless next is NULL). It then makes a control call on b and returns b.

BIO_pop() removes the BIO b from any chain is is part of. If b is NULL the function does nothing and returns NULL. Otherwise it makes a control call on b and returns the next BIO in the chain, or NULL if there is no next BIO. The removed BIO becomes a single BIO with no association with the original chain, it can thus be freed or be made part of a different chain.

BIO_set_next() replaces the existing next BIO in a chain with the BIO pointed to by next. The new chain may include some of the same BIOs from the old chain or it may be completely different.

"},{"location":"man3/BIO_push/#notes","title":"NOTES","text":"

The names of these functions are perhaps a little misleading. BIO_push() joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain, the deleted BIO does not need to be at the end of a chain.

The process of calling BIO_push() and BIO_pop() on a BIO may have additional consequences (a control call is made to the affected BIOs). Any effects will be noted in the descriptions of individual BIOs.

"},{"location":"man3/BIO_push/#return-values","title":"RETURN VALUES","text":"

BIO_push() returns the head of the chain, which usually is b, or next if b is NULL.

BIO_pop() returns the next BIO in the chain, or NULL if there is no next BIO.

"},{"location":"man3/BIO_push/#examples","title":"EXAMPLES","text":"

For these examples suppose md1 and md2 are digest BIOs, b64 is a base64 BIO and f is a file BIO.

If the call:

BIO_push(b64, f);\n

is made then the new chain will be b64-f. After making the calls

BIO_push(md2, b64);\nBIO_push(md1, md2);\n

the new chain is md1-md2-b64-f. Data written to md1 will be digested by md1 and md2, base64 encoded, and finally written to f.

It should be noted that reading causes data to pass in the reverse direction, that is data is read from f, base64 decoded, and digested by md2 and then md1.

The call:

BIO_pop(md2);\n

will return b64 and the new chain will be md1-b64-f. Data can be written to and read from md1 as before, except that md2 will no more be applied.

"},{"location":"man3/BIO_push/#see-also","title":"SEE ALSO","text":"

bio(7)

"},{"location":"man3/BIO_push/#history","title":"HISTORY","text":"

The BIO_set_next() function was added in OpenSSL 1.1.0.

"},{"location":"man3/BIO_push/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_read/","title":"BIO_read","text":""},{"location":"man3/BIO_read/#name","title":"NAME","text":"

BIO_read_ex, BIO_write_ex, BIO_read, BIO_write, BIO_gets, BIO_get_line, BIO_puts - BIO I/O functions

"},{"location":"man3/BIO_read/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nint BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes);\nint BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written);\n\nint BIO_read(BIO *b, void *data, int dlen);\nint BIO_gets(BIO *b, char *buf, int size);\nint BIO_get_line(BIO *b, char *buf, int size);\nint BIO_write(BIO *b, const void *data, int dlen);\nint BIO_puts(BIO *b, const char *buf);\n
"},{"location":"man3/BIO_read/#description","title":"DESCRIPTION","text":"

BIO_read_ex() attempts to read dlen bytes from BIO b and places the data in data. If any bytes were successfully read then the number of bytes read is stored in *readbytes.

BIO_write_ex() attempts to write dlen bytes from data to BIO b. If successful then the number of bytes written is stored in *written unless written is NULL.

BIO_read() attempts to read len bytes from BIO b and places the data in buf.

BIO_gets() performs the BIOs \"gets\" operation and places the data in buf. Usually this operation will attempt to read a line of data from the BIO of maximum length size-1. There are exceptions to this, however; for example, BIO_gets() on a digest BIO will calculate and return the digest and other BIOs may not support BIO_gets() at all. The returned string is always NUL-terminated and the '\\n' is preserved if present in the input data. On binary input there may be NUL characters within the string; in this case the return value (if nonnegative) may give an incorrect length.

BIO_get_line() attempts to read from BIO b a line of data up to the next '\\n' or the maximum length size-1 is reached and places the data in buf. The returned string is always NUL-terminated and the '\\n' is preserved if present in the input data. On binary input there may be NUL characters within the string; in this case the return value (if nonnegative) gives the actual length read. For implementing this, unfortunately the data needs to be read byte-by-byte.

BIO_write() attempts to write len bytes from buf to BIO b.

BIO_puts() attempts to write a NUL-terminated string buf to BIO b.

"},{"location":"man3/BIO_read/#return-values","title":"RETURN VALUES","text":"

BIO_read_ex() returns 1 if data was successfully read, and 0 otherwise.

BIO_write_ex() returns 1 if no error was encountered writing data, 0 otherwise. Requesting to write 0 bytes is not considered an error.

BIO_write() returns -2 if the \"write\" operation is not implemented by the BIO or -1 on other errors. Otherwise it returns the number of bytes written. This may be 0 if the BIO b is NULL or dlen <= 0.

BIO_gets() returns -2 if the \"gets\" operation is not implemented by the BIO or -1 on other errors. Otherwise it typically returns the amount of data read, but depending on the implementation it may return only the length up to the first NUL character contained in the data read. In any case the trailing NUL that is added after the data read is not included in the length returned.

All other functions return either the amount of data successfully read or written (if the return value is positive) or that no data was successfully read or written if the result is 0 or -1. If the return value is -2 then the operation is not implemented in the specific BIO type.

"},{"location":"man3/BIO_read/#notes","title":"NOTES","text":"

A 0 or -1 return is not necessarily an indication of an error. In particular when the source/sink is nonblocking or of a certain type it may merely be an indication that no data is currently available and that the application should retry the operation later.

One technique sometimes used with blocking sockets is to use a system call (such as select(), poll() or equivalent) to determine when data is available and then call read() to read the data. The equivalent with BIOs (that is call select() on the underlying I/O structure and then call BIO_read() to read the data) should not be used because a single call to BIO_read() can cause several reads (and writes in the case of SSL BIOs) on the underlying I/O structure and may block as a result. Instead select() (or equivalent) should be combined with non blocking I/O so successive reads will request a retry instead of blocking.

See BIO_should_retry(3) for details of how to determine the cause of a retry and other I/O issues.

If the \"gets\" method is not supported by a BIO then BIO_get_line() can be used. It is also possible to make BIO_gets() usable even if the \"gets\" method is not supported by adding a buffering BIO BIO_f_buffer(3) to the chain.

"},{"location":"man3/BIO_read/#see-also","title":"SEE ALSO","text":"

BIO_should_retry(3)

"},{"location":"man3/BIO_read/#history","title":"HISTORY","text":"

BIO_gets() on 1.1.0 and older when called on BIO_fd() based BIO did not keep the '\\n' at the end of the line in the buffer.

BIO_get_line() was added in OpenSSL 3.0.

BIO_write_ex() returns 1 if the size of the data to write is 0 and the written parameter of the function can be NULL since OpenSSL 3.0.

"},{"location":"man3/BIO_read/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_accept/","title":"BIO_s_accept","text":""},{"location":"man3/BIO_s_accept/#name","title":"NAME","text":"

BIO_s_accept, BIO_set_accept_name, BIO_set_accept_port, BIO_get_accept_name, BIO_get_accept_port, BIO_new_accept, BIO_set_nbio_accept, BIO_set_accept_bios, BIO_get_peer_name, BIO_get_peer_port, BIO_get_accept_ip_family, BIO_set_accept_ip_family, BIO_set_bind_mode, BIO_get_bind_mode, BIO_do_accept - accept BIO

"},{"location":"man3/BIO_s_accept/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_accept(void);\n\nlong BIO_set_accept_name(BIO *b, char *name);\nchar *BIO_get_accept_name(BIO *b);\n\nlong BIO_set_accept_port(BIO *b, char *port);\nchar *BIO_get_accept_port(BIO *b);\n\nBIO *BIO_new_accept(char *host_port);\n\nlong BIO_set_nbio_accept(BIO *b, int n);\nlong BIO_set_accept_bios(BIO *b, char *bio);\n\nchar *BIO_get_peer_name(BIO *b);\nchar *BIO_get_peer_port(BIO *b);\nlong BIO_get_accept_ip_family(BIO *b);\nlong BIO_set_accept_ip_family(BIO *b, long family);\n\nlong BIO_set_bind_mode(BIO *b, long mode);\nlong BIO_get_bind_mode(BIO *b);\n\nint BIO_do_accept(BIO *b);\n
"},{"location":"man3/BIO_s_accept/#description","title":"DESCRIPTION","text":"

BIO_s_accept() returns the accept BIO method. This is a wrapper round the platform's TCP/IP socket accept routines.

Using accept BIOs, TCP/IP connections can be accepted and data transferred using only BIO routines. In this way any platform specific operations are hidden by the BIO abstraction.

Read and write operations on an accept BIO will perform I/O on the underlying connection. If no connection is established and the port (see below) is set up properly then the BIO waits for an incoming connection.

Accept BIOs support BIO_puts() but not BIO_gets().

If the close flag is set on an accept BIO then any active connection on that chain is shutdown and the socket closed when the BIO is freed.

Calling BIO_reset() on an accept BIO will close any active connection and reset the BIO into a state where it awaits another incoming connection.

BIO_get_fd() and BIO_set_fd() can be called to retrieve or set the accept socket. See BIO_s_fd(3)

BIO_set_accept_name() uses the string name to set the accept name. The name is represented as a string of the form \"host:port\", where \"host\" is the interface to use and \"port\" is the port. The host can be \"*\" or empty which is interpreted as meaning any interface. If the host is an IPv6 address, it has to be enclosed in brackets, for example \"[::1]:https\". \"port\" has the same syntax as the port specified in BIO_set_conn_port() for connect BIOs, that is it can be a numerical port string or a string to lookup using getservbyname() and a string table.

BIO_set_accept_port() uses the string port to set the accept port of BIO b. \"port\" has the same syntax as the port specified in BIO_set_conn_port() for connect BIOs, that is it can be a numerical port string or a string to lookup using getservbyname() and a string table. If the given port is 0 then a random available port is chosen. It may be queried using BIO_sock_info() and BIO_ADDR_service_string(3).

BIO_new_accept() combines BIO_new() and BIO_set_accept_name() into a single call: that is it creates a new accept BIO with port host_port.

BIO_set_nbio_accept() sets the accept socket to blocking mode (the default) if n is 0 or non blocking mode if n is 1.

BIO_set_accept_bios() can be used to set a chain of BIOs which will be duplicated and prepended to the chain when an incoming connection is received. This is useful if, for example, a buffering or SSL BIO is required for each connection. The chain of BIOs must not be freed after this call, they will be automatically freed when the accept BIO is freed.

BIO_get_accept_ip_family() returns the IP family accepted by the BIO b, which may be BIO_FAMILY_IPV4, BIO_FAMILY_IPV6, or BIO_FAMILY_IPANY.

BIO_set_accept_ip_family() sets the IP family family accepted by BIO b. The default is BIO_FAMILY_IPANY.

BIO_set_bind_mode() and BIO_get_bind_mode() set and retrieve the current bind mode. If BIO_BIND_NORMAL (the default) is set then another socket cannot be bound to the same port. If BIO_BIND_REUSEADDR is set then other sockets can bind to the same port. If BIO_BIND_REUSEADDR_IF_UNUSED is set then and attempt is first made to use BIO_BIN_NORMAL, if this fails and the port is not in use then a second attempt is made using BIO_BIND_REUSEADDR.

BIO_do_accept() serves two functions. When it is first called, after the accept BIO has been setup, it will attempt to create the accept socket and bind an address to it. Second and subsequent calls to BIO_do_accept() will await an incoming connection, or request a retry in non blocking mode.

"},{"location":"man3/BIO_s_accept/#notes","title":"NOTES","text":"

When an accept BIO is at the end of a chain it will await an incoming connection before processing I/O calls. When an accept BIO is not at then end of a chain it passes I/O calls to the next BIO in the chain.

When a connection is established a new socket BIO is created for the connection and appended to the chain. That is the chain is now accept->socket. This effectively means that attempting I/O on an initial accept socket will await an incoming connection then perform I/O on it.

If any additional BIOs have been set using BIO_set_accept_bios() then they are placed between the socket and the accept BIO, that is the chain will be accept->otherbios->socket.

If a server wishes to process multiple connections (as is normally the case) then the accept BIO must be made available for further incoming connections. This can be done by waiting for a connection and then calling:

connection = BIO_pop(accept);\n

After this call connection will contain a BIO for the recently established connection and accept will now be a single BIO again which can be used to await further incoming connections. If no further connections will be accepted the accept can be freed using BIO_free().

If only a single connection will be processed it is possible to perform I/O using the accept BIO itself. This is often undesirable however because the accept BIO will still accept additional incoming connections. This can be resolved by using BIO_pop() (see above) and freeing up the accept BIO after the initial connection.

If the underlying accept socket is nonblocking and BIO_do_accept() is called to await an incoming connection it is possible for BIO_should_io_special() with the reason BIO_RR_ACCEPT. If this happens then it is an indication that an accept attempt would block: the application should take appropriate action to wait until the underlying socket has accepted a connection and retry the call.

BIO_set_accept_name(), BIO_get_accept_name(), BIO_set_accept_port(), BIO_get_accept_port(), BIO_set_nbio_accept(), BIO_set_accept_bios(), BIO_get_peer_name(), BIO_get_peer_port(), BIO_get_accept_ip_family(), BIO_set_accept_ip_family(), BIO_set_bind_mode(), BIO_get_bind_mode() and BIO_do_accept() are macros.

"},{"location":"man3/BIO_s_accept/#return-values","title":"RETURN VALUES","text":"

BIO_do_accept(), BIO_set_accept_name(), BIO_set_accept_port(), BIO_set_nbio_accept(), BIO_set_accept_bios(), BIO_set_accept_ip_family(), and BIO_set_bind_mode() return 1 for success and <=0 for failure.

BIO_get_accept_name() returns the accept name or NULL on error. BIO_get_peer_name() returns the peer name or NULL on error.

BIO_get_accept_port() returns the accept port as a string or NULL on error. BIO_get_peer_port() returns the peer port as a string or NULL on error. BIO_get_accept_ip_family() returns the IP family or <=0 on error.

BIO_get_bind_mode() returns the set of BIO_BIND flags, or <=0 on failure.

BIO_new_accept() returns a BIO or NULL on error.

"},{"location":"man3/BIO_s_accept/#examples","title":"EXAMPLES","text":"

This example accepts two connections on port 4444, sends messages down each and finally closes both down.

BIO *abio, *cbio, *cbio2;\n\n/* First call to BIO_do_accept() sets up accept BIO */\nabio = BIO_new_accept(\"4444\");\nif (BIO_do_accept(abio) <= 0) {\n    fprintf(stderr, \"Error setting up accept\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* Wait for incoming connection */\nif (BIO_do_accept(abio) <= 0) {\n    fprintf(stderr, \"Error accepting connection\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\nfprintf(stderr, \"Connection 1 established\\n\");\n\n/* Retrieve BIO for connection */\ncbio = BIO_pop(abio);\nBIO_puts(cbio, \"Connection 1: Sending out Data on initial connection\\n\");\nfprintf(stderr, \"Sent out data on connection 1\\n\");\n\n/* Wait for another connection */\nif (BIO_do_accept(abio) <= 0) {\n    fprintf(stderr, \"Error accepting connection\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\nfprintf(stderr, \"Connection 2 established\\n\");\n\n/* Close accept BIO to refuse further connections */\ncbio2 = BIO_pop(abio);\nBIO_free(abio);\nBIO_puts(cbio2, \"Connection 2: Sending out Data on second\\n\");\nfprintf(stderr, \"Sent out data on connection 2\\n\");\n\nBIO_puts(cbio, \"Connection 1: Second connection established\\n\");\n\n/* Close the two established connections */\nBIO_free(cbio);\nBIO_free(cbio2);\n
"},{"location":"man3/BIO_s_accept/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_bio/","title":"BIO_s_bio","text":""},{"location":"man3/BIO_s_bio/#name","title":"NAME","text":"

BIO_s_bio, BIO_make_bio_pair, BIO_destroy_bio_pair, BIO_shutdown_wr, BIO_set_write_buf_size, BIO_get_write_buf_size, BIO_new_bio_pair, BIO_get_write_guarantee, BIO_ctrl_get_write_guarantee, BIO_get_read_request, BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request - BIO pair BIO

"},{"location":"man3/BIO_s_bio/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_bio(void);\n\nint BIO_make_bio_pair(BIO *b1, BIO *b2);\nint BIO_destroy_bio_pair(BIO *b);\nint BIO_shutdown_wr(BIO *b);\n\nint BIO_set_write_buf_size(BIO *b, long size);\nsize_t BIO_get_write_buf_size(BIO *b, long size);\n\nint BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2);\n\nint BIO_get_write_guarantee(BIO *b);\nsize_t BIO_ctrl_get_write_guarantee(BIO *b);\nint BIO_get_read_request(BIO *b);\nsize_t BIO_ctrl_get_read_request(BIO *b);\nint BIO_ctrl_reset_read_request(BIO *b);\n
"},{"location":"man3/BIO_s_bio/#description","title":"DESCRIPTION","text":"

BIO_s_bio() returns the method for a BIO pair. A BIO pair is a pair of source/sink BIOs where data written to either half of the pair is buffered and can be read from the other half. Both halves must usually by handled by the same application thread since no locking is done on the internal data structures.

Since BIO chains typically end in a source/sink BIO it is possible to make this one half of a BIO pair and have all the data processed by the chain under application control.

One typical use of BIO pairs is to place TLS/SSL I/O under application control, this can be used when the application wishes to use a non standard transport for TLS/SSL or the normal socket routines are inappropriate.

Calls to BIO_read_ex() will read data from the buffer or request a retry if no data is available.

Calls to BIO_write_ex() will place data in the buffer or request a retry if the buffer is full.

The standard calls BIO_ctrl_pending() and BIO_ctrl_wpending() can be used to determine the amount of pending data in the read or write buffer.

BIO_reset() clears any data in the write buffer.

BIO_make_bio_pair() joins two separate BIOs into a connected pair.

BIO_destroy_pair() destroys the association between two connected BIOs. Freeing up any half of the pair will automatically destroy the association.

BIO_shutdown_wr() is used to close down a BIO b. After this call no further writes on BIO b are allowed (they will return an error). Reads on the other half of the pair will return any pending data or EOF when all pending data has been read.

BIO_set_write_buf_size() sets the write buffer size of BIO b to size. If the size is not initialized a default value is used. This is currently 17K, sufficient for a maximum size TLS record.

BIO_get_write_buf_size() returns the size of the write buffer.

BIO_new_bio_pair() combines the calls to BIO_new(), BIO_make_bio_pair() and BIO_set_write_buf_size() to create a connected pair of BIOs bio1, bio2 with write buffer sizes writebuf1 and writebuf2. If either size is zero then the default size is used. BIO_new_bio_pair() does not check whether bio1 or bio2 do point to some other BIO, the values are overwritten, BIO_free() is not called.

BIO_get_write_guarantee() and BIO_ctrl_get_write_guarantee() return the maximum length of data that can be currently written to the BIO. Writes larger than this value will return a value from BIO_write_ex() less than the amount requested or if the buffer is full request a retry. BIO_ctrl_get_write_guarantee() is a function whereas BIO_get_write_guarantee() is a macro.

BIO_get_read_request() and BIO_ctrl_get_read_request() return the amount of data requested, or the buffer size if it is less, if the last read attempt at the other half of the BIO pair failed due to an empty buffer. This can be used to determine how much data should be written to the BIO so the next read will succeed: this is most useful in TLS/SSL applications where the amount of data read is usually meaningful rather than just a buffer size. After a successful read this call will return zero. It also will return zero once new data has been written satisfying the read request or part of it. Note that BIO_get_read_request() never returns an amount larger than that returned by BIO_get_write_guarantee().

BIO_ctrl_reset_read_request() can also be used to reset the value returned by BIO_get_read_request() to zero.

"},{"location":"man3/BIO_s_bio/#notes","title":"NOTES","text":"

Both halves of a BIO pair should be freed. That is even if one half is implicit freed due to a BIO_free_all() or SSL_free() call the other half needs to be freed.

When used in bidirectional applications (such as TLS/SSL) care should be taken to flush any data in the write buffer. This can be done by calling BIO_pending() on the other half of the pair and, if any data is pending, reading it and sending it to the underlying transport. This must be done before any normal processing (such as calling select() ) due to a request and BIO_should_read() being true.

To see why this is important consider a case where a request is sent using BIO_write_ex() and a response read with BIO_read_ex(), this can occur during an TLS/SSL handshake for example. BIO_write_ex() will succeed and place data in the write buffer. BIO_read_ex() will initially fail and BIO_should_read() will be true. If the application then waits for data to be available on the underlying transport before flushing the write buffer it will never succeed because the request was never sent!

BIO_eof() is true if no data is in the peer BIO and the peer BIO has been shutdown.

BIO_make_bio_pair(), BIO_destroy_bio_pair(), BIO_shutdown_wr(), BIO_set_write_buf_size(), BIO_get_write_buf_size(), BIO_get_write_guarantee(), and BIO_get_read_request() are implemented as macros.

"},{"location":"man3/BIO_s_bio/#return-values","title":"RETURN VALUES","text":"

BIO_new_bio_pair() returns 1 on success, with the new BIOs available in bio1 and bio2, or 0 on failure, with NULL pointers stored into the locations for bio1 and bio2. Check the error stack for more information.

[XXXXX: More return values need to be added here]

"},{"location":"man3/BIO_s_bio/#examples","title":"EXAMPLES","text":"

The BIO pair can be used to have full control over the network access of an application. The application can call select() on the socket as required without having to go through the SSL-interface.

BIO *internal_bio, *network_bio;\n\n...\nBIO_new_bio_pair(&internal_bio, 0, &network_bio, 0);\nSSL_set_bio(ssl, internal_bio, internal_bio);\nSSL_operations(); /* e.g. SSL_read and SSL_write */\n...\n\napplication |   TLS-engine\n   |        |\n   +----------> SSL_operations()\n            |     /\\    ||\n            |     ||    \\/\n            |   BIO-pair (internal_bio)\n            |   BIO-pair (network_bio)\n            |     ||     /\\\n            |     \\/     ||\n   +-----------< BIO_operations()\n   |        |\n   |        |\n  socket\n\n ...\n SSL_free(ssl);                /* implicitly frees internal_bio */\n BIO_free(network_bio);\n ...\n

As the BIO pair will only buffer the data and never directly access the connection, it behaves nonblocking and will return as soon as the write buffer is full or the read buffer is drained. Then the application has to flush the write buffer and/or fill the read buffer.

Use the BIO_ctrl_pending(), to find out whether data is buffered in the BIO and must be transferred to the network. Use BIO_ctrl_get_read_request() to find out, how many bytes must be written into the buffer before the SSL_operation() can successfully be continued.

"},{"location":"man3/BIO_s_bio/#warnings","title":"WARNINGS","text":"

As the data is buffered, SSL_operation() may return with an ERROR_SSL_WANT_READ condition, but there is still data in the write buffer. An application must not rely on the error value of SSL_operation() but must assure that the write buffer is always flushed first. Otherwise a deadlock may occur as the peer might be waiting for the data before being able to continue.

"},{"location":"man3/BIO_s_bio/#see-also","title":"SEE ALSO","text":"

SSL_set_bio(3), ssl(7), bio(7), BIO_should_retry(3), BIO_read_ex(3)

"},{"location":"man3/BIO_s_bio/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_connect/","title":"BIO_s_connect","text":""},{"location":"man3/BIO_s_connect/#name","title":"NAME","text":"

BIO_s_connect, BIO_new_connect, BIO_set_conn_hostname, BIO_set_conn_port, BIO_set_conn_address, BIO_set_conn_ip_family, BIO_get_conn_hostname, BIO_get_conn_port, BIO_get_conn_address, BIO_get_conn_ip_family, BIO_set_nbio, BIO_do_connect - connect BIO

"},{"location":"man3/BIO_s_connect/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_connect(void);\n\nBIO *BIO_new_connect(const char *name);\n\nlong BIO_set_conn_hostname(BIO *b, char *name);\nlong BIO_set_conn_port(BIO *b, char *port);\nlong BIO_set_conn_address(BIO *b, BIO_ADDR *addr);\nlong BIO_set_conn_ip_family(BIO *b, long family);\nconst char *BIO_get_conn_hostname(BIO *b);\nconst char *BIO_get_conn_port(BIO *b);\nconst BIO_ADDR *BIO_get_conn_address(BIO *b);\nconst long BIO_get_conn_ip_family(BIO *b);\n\nlong BIO_set_nbio(BIO *b, long n);\n\nlong BIO_do_connect(BIO *b);\n
"},{"location":"man3/BIO_s_connect/#description","title":"DESCRIPTION","text":"

BIO_s_connect() returns the connect BIO method. This is a wrapper round the platform's TCP/IP socket connection routines.

Using connect BIOs, TCP/IP connections can be made and data transferred using only BIO routines. In this way any platform specific operations are hidden by the BIO abstraction.

Read and write operations on a connect BIO will perform I/O on the underlying connection. If no connection is established and the port and hostname (see below) is set up properly then a connection is established first.

Connect BIOs support BIO_puts() but not BIO_gets().

If the close flag is set on a connect BIO then any active connection is shutdown and the socket closed when the BIO is freed.

Calling BIO_reset() on a connect BIO will close any active connection and reset the BIO into a state where it can connect to the same host again.

BIO_new_connect() combines BIO_new() and BIO_set_conn_hostname() into a single call: that is it creates a new connect BIO with hostname name.

BIO_set_conn_hostname() uses the string name to set the hostname. The hostname can be an IP address; if the address is an IPv6 one, it must be enclosed with brackets [ and ]. The hostname can also include the port in the form hostname:port; see BIO_parse_hostserv(3) and BIO_set_conn_port() for details.

BIO_set_conn_port() sets the port to port. port can be the numerical form or a service string such as \"http\", which will be mapped to a port number using the system function getservbyname().

BIO_set_conn_address() sets the address and port information using a BIO_ADDR(3ssl).

BIO_set_conn_ip_family() sets the IP family.

BIO_get_conn_hostname() returns the hostname of the connect BIO or NULL if the BIO is initialized but no hostname is set. This return value is an internal pointer which should not be modified.

BIO_get_conn_port() returns the port as a string. This return value is an internal pointer which should not be modified.

BIO_get_conn_address() returns the address information as a BIO_ADDR. This return value is an internal pointer which should not be modified.

BIO_get_conn_ip_family() returns the IP family of the connect BIO.

BIO_set_nbio() sets the non blocking I/O flag to n. If n is zero then blocking I/O is set. If n is 1 then non blocking I/O is set. Blocking I/O is the default. The call to BIO_set_nbio() should be made before the connection is established because non blocking I/O is set during the connect process.

BIO_do_connect() attempts to connect the supplied BIO. This performs an SSL/TLS handshake as far as supported by the BIO. For non-SSL BIOs the connection is done typically at TCP level. If domain name resolution yields multiple IP addresses all of them are tried after connect() failures. The function returns 1 if the connection was established successfully. A zero or negative value is returned if the connection could not be established. The call BIO_should_retry() should be used for non blocking connect BIOs to determine if the call should be retried. If a connection has already been established this call has no effect.

"},{"location":"man3/BIO_s_connect/#notes","title":"NOTES","text":"

If blocking I/O is set then a non positive return value from any I/O call is caused by an error condition, although a zero return will normally mean that the connection was closed.

If the port name is supplied as part of the hostname then this will override any value set with BIO_set_conn_port(). This may be undesirable if the application does not wish to allow connection to arbitrary ports. This can be avoided by checking for the presence of the ':' character in the passed hostname and either indicating an error or truncating the string at that point.

The values returned by BIO_get_conn_hostname(), BIO_get_conn_address(), and BIO_get_conn_port() are updated when a connection attempt is made. Before any connection attempt the values returned are those set by the application itself.

Applications do not have to call BIO_do_connect() but may wish to do so to separate the connection process from other I/O processing.

If non blocking I/O is set then retries will be requested as appropriate.

It addition to BIO_should_read() and BIO_should_write() it is also possible for BIO_should_io_special() to be true during the initial connection process with the reason BIO_RR_CONNECT. If this is returned then this is an indication that a connection attempt would block, the application should then take appropriate action to wait until the underlying socket has connected and retry the call.

BIO_set_conn_hostname(), BIO_set_conn_port(), BIO_get_conn_hostname(), BIO_set_conn_address(), BIO_get_conn_port(), BIO_get_conn_address(), BIO_set_conn_ip_family(), BIO_get_conn_ip_family(), BIO_set_nbio(), and BIO_do_connect() are macros.

"},{"location":"man3/BIO_s_connect/#return-values","title":"RETURN VALUES","text":"

BIO_s_connect() returns the connect BIO method.

BIO_set_conn_address(), BIO_set_conn_port(), and BIO_set_conn_ip_family() return 1 or <=0 if an error occurs.

BIO_set_conn_hostname() returns 1 on success and <=0 on failure.

BIO_get_conn_address() returns the address information or NULL if none was set.

BIO_get_conn_hostname() returns the connected hostname or NULL if none was set.

BIO_get_conn_ip_family() returns the address family or -1 if none was set.

BIO_get_conn_port() returns a string representing the connected port or NULL if not set.

BIO_set_nbio() returns 1 or <=0 if an error occurs.

BIO_do_connect() returns 1 if the connection was successfully established and <=0 if the connection failed.

"},{"location":"man3/BIO_s_connect/#examples","title":"EXAMPLES","text":"

This is example connects to a webserver on the local host and attempts to retrieve a page and copy the result to standard output.

BIO *cbio, *out;\nint len;\nchar tmpbuf[1024];\n\ncbio = BIO_new_connect(\"localhost:http\");\nout = BIO_new_fp(stdout, BIO_NOCLOSE);\nif (BIO_do_connect(cbio) <= 0) {\n    fprintf(stderr, \"Error connecting to server\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\nBIO_puts(cbio, \"GET / HTTP/1.0\\n\\n\");\nfor (;;) {\n    len = BIO_read(cbio, tmpbuf, 1024);\n    if (len <= 0)\n        break;\n    BIO_write(out, tmpbuf, len);\n}\nBIO_free(cbio);\nBIO_free(out);\n
"},{"location":"man3/BIO_s_connect/#see-also","title":"SEE ALSO","text":"

BIO_ADDR(3), BIO_parse_hostserv(3)

"},{"location":"man3/BIO_s_connect/#history","title":"HISTORY","text":"

BIO_set_conn_int_port(), BIO_get_conn_int_port(), BIO_set_conn_ip(), and BIO_get_conn_ip() were removed in OpenSSL 1.1.0. Use BIO_set_conn_address() and BIO_get_conn_address() instead.

"},{"location":"man3/BIO_s_connect/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_core/","title":"BIO_s_core","text":""},{"location":"man3/BIO_s_core/#name","title":"NAME","text":"

BIO_s_core, BIO_new_from_core_bio - OSSL_CORE_BIO functions

"},{"location":"man3/BIO_s_core/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_core(void);\n\nBIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio);\n
"},{"location":"man3/BIO_s_core/#description","title":"DESCRIPTION","text":"

BIO_s_core() returns the core BIO method function.

A core BIO is treated as source/sink BIO which communicates to some external BIO. This is primarily useful to provider authors. A number of calls from libcrypto into a provider supply an OSSL_CORE_BIO parameter. This represents a BIO within libcrypto, but cannot be used directly by a provider. Instead it should be wrapped using a BIO_s_core().

Once a BIO is constructed based on BIO_s_core(), the associated OSSL_CORE_BIO object should be set on it using BIO_set_data(3). Note that the BIO will only operate correctly if it is associated with a library context constructed using OSSL_LIB_CTX_new_from_dispatch(3). To associate the BIO with a library context construct it using BIO_new_ex(3).

BIO_new_from_core_bio() is a convenience function that constructs a new BIO based on BIO_s_core() and that is associated with the given library context. It then also sets the OSSL_CORE_BIO object on the BIO using BIO_set_data(3).

"},{"location":"man3/BIO_s_core/#return-values","title":"RETURN VALUES","text":"

BIO_s_core() return a core BIO BIO_METHOD structure.

BIO_new_from_core_bio() returns a BIO structure on success or NULL on failure. A failure will most commonly be because the library context was not constructed using OSSL_LIB_CTX_new_from_dispatch(3).

"},{"location":"man3/BIO_s_core/#history","title":"HISTORY","text":"

BIO_s_core() and BIO_new_from_core_bio() were added in OpenSSL 3.0.

"},{"location":"man3/BIO_s_core/#examples","title":"EXAMPLES","text":"

Create a core BIO and write some data to it:

int some_function(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio) {\n    BIO *cbio = BIO_new_from_core_bio(libctx, corebio);\n\n    if (cbio == NULL)\n        return 0;\n\n    BIO_puts(cbio, \"Hello World\\n\");\n\n    BIO_free(cbio);\n    return 1;\n}\n
"},{"location":"man3/BIO_s_core/#copyright","title":"COPYRIGHT","text":"

Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_datagram/","title":"BIO_s_datagram","text":""},{"location":"man3/BIO_s_datagram/#name","title":"NAME","text":"

BIO_s_datagram, BIO_new_dgram, BIO_ctrl_dgram_connect, BIO_ctrl_set_connected, BIO_dgram_recv_timedout, BIO_dgram_send_timedout, BIO_dgram_get_peer, BIO_dgram_set_peer, BIO_dgram_get_mtu_overhead - Network BIO with datagram semantics

"},{"location":"man3/BIO_s_datagram/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nBIO_METHOD *BIO_s_datagram(void);\nBIO *BIO_new_dgram(int fd, int close_flag);\n\nint BIO_ctrl_dgram_connect(BIO *bio, const BIO_ADDR *peer);\nint BIO_ctrl_set_connected(BIO *bio, const BIO_ADDR *peer);\nint BIO_dgram_recv_timedout(BIO *bio);\nint BIO_dgram_send_timedout(BIO *bio);\nint BIO_dgram_get_peer(BIO *bio, BIO_ADDR *peer);\nint BIO_dgram_set_peer(BIO *bio, const BIO_ADDR *peer);\nint BIO_dgram_get_mtu_overhead(BIO *bio);\n
"},{"location":"man3/BIO_s_datagram/#description","title":"DESCRIPTION","text":"

BIO_s_datagram() is a BIO implementation designed for use with network sockets which provide datagram semantics, such as UDP sockets. It is suitable for use with DTLSv1.

Because BIO_s_datagram() has datagram semantics, a single BIO_write() call sends a single datagram and a single BIO_read() call receives a single datagram. If the size of the buffer passed to BIO_read() is inadequate, the datagram is silently truncated.

When using BIO_s_datagram(), it is important to note that:

  • This BIO can be used with either a connected or unconnected network socket. A connected socket is a network socket which has had BIO_connect(3) or a similar OS-specific function called on it. Such a socket can only receive datagrams from the specified peer. Any other socket is an unconnected socket and can receive datagrams from any host.
  • Despite their naming, neither BIO_ctrl_dgram_connect() nor BIO_ctrl_set_connected() cause a socket to become connected. These controls are provided to indicate to the BIO how the underlying socket is configured and how it is to be used; see below.
  • Use of BIO_s_datagram() with an unconnected network socket is hazardous hecause any successful call to BIO_read() results in the peer address used for any subsequent call to BIO_write() being set to the source address of the datagram received by that call to BIO_read(). Thus, unless the caller calls BIO_dgram_set_peer() immediately prior to every call to BIO_write(), or never calls BIO_read(), any host on the network may cause future datagrams written to be redirected to that host. Therefore, it is recommended that users use BIO_s_dgram() only with a connected socket. An exception is where DTLSv1_listen(3) must be used; see DTLSv1_listen(3) for further discussion.

Various controls are available for configuring the BIO_s_datagram() using BIO_ctrl(3):

  • BIO_ctrl_dgram_connect (BIO_CTRL_DGRAM_CONNECT)

    This is equivalent to calling BIO_dgram_set_peer(3).

    Despite its name, this function does not cause the underlying socket to become connected.

  • BIO_ctrl_set_connected (BIO_CTRL_SET_CONNECTED)

    This informs the BIO_s_datagram() whether the underlying socket has been connected, and therefore how the BIO_s_datagram() should attempt to use the socket.

    If the peer argument is non-NULL, BIO_s_datagram() assumes that the underlying socket has been connected and will attempt to use the socket using OS APIs which do not specify peer addresses (for example, send(3) and recv(3) or similar). The peer argument should specify the peer address to which the socket is connected.

    If the peer argument is NULL, BIO_s_datagram() assumes that the underlying socket is not connected and will attempt to use the socket using an OS APIs which specify peer addresses (for example, sendto(3) and recvfrom(3)).

  • BIO_dgram_get_peer (BIO_CTRL_DGRAM_GET_PEER)

    This outputs a BIO_ADDR which specifies one of the following values, whichever happened most recently:

    • The peer address last passed to BIO_dgram_set_peer(), BIO_ctrl_dgram_connect() or BIO_ctrl_set_connected().
    • The peer address of the datagram last received by a call to BIO_read().
  • BIO_dgram_set_peer (BIO_CTRL_DGRAM_SET_PEER)

    Sets the peer address to be used for subsequent writes to this BIO.

    Warning: When used with an unconnected network socket, the value set may be modified by future calls to BIO_read(3), making use of BIO_s_datagram() hazardous when used with unconnected network sockets; see above.

  • BIO_dgram_recv_timeout (BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP)

    Returns 1 if the last I/O operation performed on the BIO (for example, via a call to BIO_read(3)) may have been caused by a receive timeout.

  • BIO_dgram_send_timedout (BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP)

    Returns 1 if the last I/O operation performed on the BIO (for example, via a call to BIO_write(3)) may have been caused by a send timeout.

  • BIO_dgram_get_mtu_overhead (BIO_CTRL_DGRAM_GET_MTU_OVERHEAD)

    Returns a quantity in bytes which is a rough estimate of the number of bytes of overhead which should typically be added to a datagram payload size in order to estimate the final size of the Layer 3 (e.g. IP) packet which will contain the datagram. In most cases, the maximum datagram payload size which can be transmitted can be determined by determining the link MTU in bytes and subtracting the value returned by this call.

    The value returned by this call depends on the network layer protocol being used.

    The value returned is not fully reliable because datagram overheads can be higher in atypical network configurations, for example where IPv6 extension headers or IPv4 options are used.

  • BIO_CTRL_DGRAM_SET_DONT_FRAG

    If num is nonzero, configures the underlying network socket to enable Don't Fragment mode, in which datagrams will be set with the IP Don't Fragment (DF) bit set. If num is zero, Don't Fragment mode is disabled.

  • BIO_CTRL_DGRAM_QUERY_MTU

    Queries the OS for its assessment of the Path MTU for the destination to which the underlying network socket, and returns that Path MTU in bytes. This control can only be used with a connected socket.

    This is not supported on all platforms and depends on OS support being available. Returns 0 on failure.

  • BIO_CTRL_DGRAM_MTU_DISCOVER

    This control requests that Path MTU discovery be enabled on the underlying network socket.

  • BIO_CTRL_DGRAM_GET_FALLBACK_MTU

    Returns the estimated minimum size of datagram payload which should always be supported on the BIO. This size is determined by the minimum MTU required to be supported by the applicable underlying network layer. Use of datagrams of this size may lead to suboptimal performance, but should be routable in all circumstances. The value returned is the datagram payload size in bytes and does not include the size of layer 3 or layer 4 protocol headers.

  • BIO_CTRL_DGRAM_MTU_EXCEEDED

    Returns 1 if the last attempted write to the BIO failed due to the size of the attempted write exceeding the applicable MTU.

  • BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT

    Accepts a pointer to a struct timeval. If the time specified is zero, disables receive timeouts. Otherwise, configures the specified time interval as the receive timeout for the socket for the purposes of future BIO_read(3) calls.

  • BIO_CTRL_DGRAM_SET_PEEK_MODE

    If num is nonzero, enables peek mode; otherwise, disables peek mode. Where peek mode is enabled, calls to BIO_read(3) read datagrams from the underlying network socket in peek mode, meaning that a future call to BIO_read(3) will yield the same datagram until peek mode is disabled.

BIO_new_dgram() is a helper function which instantiates a BIO_s_datagram() and sets the BIO to use the socket given in fd by calling BIO_set_fd().

"},{"location":"man3/BIO_s_datagram/#return-values","title":"RETURN VALUES","text":"

BIO_s_datagram() returns a BIO method.

BIO_new_dgram() returns a BIO on success and NULL on failure.

BIO_ctrl_dgram_connect(), BIO_ctrl_set_connected(), BIO_dgram_get_peer(), BIO_dgram_set_peer() return 1 on success and 0 on failure.

BIO_dgram_recv_timedout() and BIO_dgram_send_timedout() return 0 or 1 depending on the circumstance; see discussion above.

BIO_dgram_get_mtu_overhead() returns a value in bytes.

"},{"location":"man3/BIO_s_datagram/#see-also","title":"SEE ALSO","text":"

DTLSv1_listen(3), bio(7)

"},{"location":"man3/BIO_s_datagram/#copyright","title":"COPYRIGHT","text":"

Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_fd/","title":"BIO_s_fd","text":""},{"location":"man3/BIO_s_fd/#name","title":"NAME","text":"

BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO

"},{"location":"man3/BIO_s_fd/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_fd(void);\n\nint BIO_set_fd(BIO *b, int fd, int c);\nint BIO_get_fd(BIO *b, int *c);\n\nBIO *BIO_new_fd(int fd, int close_flag);\n
"},{"location":"man3/BIO_s_fd/#description","title":"DESCRIPTION","text":"

BIO_s_fd() returns the file descriptor BIO method. This is a wrapper round the platforms file descriptor routines such as read() and write().

BIO_read_ex() and BIO_write_ex() read or write the underlying descriptor. BIO_puts() is supported but BIO_gets() is not.

If the close flag is set then close() is called on the underlying file descriptor when the BIO is freed.

BIO_reset() attempts to change the file pointer to the start of file such as by using lseek(fd, 0, 0).

BIO_seek() sets the file pointer to position ofs from start of file such as by using lseek(fd, ofs, 0).

BIO_tell() returns the current file position such as by calling lseek(fd, 0, 1).

BIO_set_fd() sets the file descriptor of BIO b to fd and the close flag to c.

BIO_get_fd() places the file descriptor of BIO b in c if it is not NULL. It also returns the file descriptor.

BIO_new_fd() returns a file descriptor BIO using fd and close_flag.

"},{"location":"man3/BIO_s_fd/#notes","title":"NOTES","text":"

The behaviour of BIO_read_ex() and BIO_write_ex() depends on the behavior of the platforms read() and write() calls on the descriptor. If the underlying file descriptor is in a non blocking mode then the BIO will behave in the manner described in the BIO_read_ex(3) and BIO_should_retry(3) manual pages.

File descriptor BIOs should not be used for socket I/O. Use socket BIOs instead.

BIO_set_fd() and BIO_get_fd() are implemented as macros.

"},{"location":"man3/BIO_s_fd/#return-values","title":"RETURN VALUES","text":"

BIO_s_fd() returns the file descriptor BIO method.

BIO_set_fd() returns 1 on success or <=0 for failure.

BIO_get_fd() returns the file descriptor or -1 if the BIO has not been initialized. It also returns zero and negative values if other error occurs.

BIO_new_fd() returns the newly allocated BIO or NULL is an error occurred.

"},{"location":"man3/BIO_s_fd/#examples","title":"EXAMPLES","text":"

This is a file descriptor BIO version of \"Hello World\":

BIO *out;\n\nout = BIO_new_fd(fileno(stdout), BIO_NOCLOSE);\nBIO_printf(out, \"Hello World\\n\");\nBIO_free(out);\n
"},{"location":"man3/BIO_s_fd/#see-also","title":"SEE ALSO","text":"

BIO_seek(3), BIO_tell(3), BIO_reset(3), BIO_read_ex(3), BIO_write_ex(3), BIO_puts(3), BIO_gets(3), BIO_printf(3), BIO_set_close(3), BIO_get_close(3)

"},{"location":"man3/BIO_s_fd/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_file/","title":"BIO_s_file","text":""},{"location":"man3/BIO_s_file/#name","title":"NAME","text":"

BIO_s_file, BIO_new_file, BIO_new_fp, BIO_set_fp, BIO_get_fp, BIO_read_filename, BIO_write_filename, BIO_append_filename, BIO_rw_filename - FILE bio

"},{"location":"man3/BIO_s_file/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_file(void);\nBIO *BIO_new_file(const char *filename, const char *mode);\nBIO *BIO_new_fp(FILE *stream, int flags);\n\nBIO_set_fp(BIO *b, FILE *fp, int flags);\nBIO_get_fp(BIO *b, FILE **fpp);\n\nint BIO_read_filename(BIO *b, char *name);\nint BIO_write_filename(BIO *b, char *name);\nint BIO_append_filename(BIO *b, char *name);\nint BIO_rw_filename(BIO *b, char *name);\n
"},{"location":"man3/BIO_s_file/#description","title":"DESCRIPTION","text":"

BIO_s_file() returns the BIO file method. As its name implies it is a wrapper round the stdio FILE structure and it is a source/sink BIO.

Calls to BIO_read_ex() and BIO_write_ex() read and write data to the underlying stream. BIO_gets() and BIO_puts() are supported on file BIOs.

BIO_flush() on a file BIO calls the fflush() function on the wrapped stream.

BIO_reset() attempts to change the file pointer to the start of file using fseek(stream, 0, 0).

BIO_seek() sets the file pointer to position ofs from start of file using fseek(stream, ofs, 0).

BIO_eof() calls feof().

Setting the BIO_CLOSE flag calls fclose() on the stream when the BIO is freed.

BIO_new_file() creates a new file BIO with mode mode the meaning of mode is the same as the stdio function fopen(). The BIO_CLOSE flag is set on the returned BIO.

BIO_new_fp() creates a file BIO wrapping stream. Flags can be: BIO_CLOSE, BIO_NOCLOSE (the close flag) BIO_FP_TEXT (sets the underlying stream to text mode, default is binary: this only has any effect under Win32).

BIO_set_fp() sets the fp of a file BIO to fp. flags has the same meaning as in BIO_new_fp(), it is a macro.

BIO_get_fp() retrieves the fp of a file BIO, it is a macro.

BIO_seek() is a macro that sets the position pointer to offset bytes from the start of file.

BIO_tell() returns the value of the position pointer.

BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and BIO_rw_filename() set the file BIO b to use file name for reading, writing, append or read write respectively.

"},{"location":"man3/BIO_s_file/#notes","title":"NOTES","text":"

When wrapping stdout, stdin or stderr the underlying stream should not normally be closed so the BIO_NOCLOSE flag should be set.

Because the file BIO calls the underlying stdio functions any quirks in stdio behaviour will be mirrored by the corresponding BIO.

On Windows BIO_new_files reserves for the filename argument to be UTF-8 encoded. In other words if you have to make it work in multi- lingual environment, encode filenames in UTF-8.

"},{"location":"man3/BIO_s_file/#return-values","title":"RETURN VALUES","text":"

BIO_s_file() returns the file BIO method.

BIO_new_file() and BIO_new_fp() return a file BIO or NULL if an error occurred.

BIO_set_fp() and BIO_get_fp() return 1 for success or <=0 for failure (although the current implementation never return 0).

BIO_seek() returns 0 for success or negative values for failure.

BIO_tell() returns the current file position or negative values for failure.

BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and BIO_rw_filename() return 1 for success or <=0 for failure.

"},{"location":"man3/BIO_s_file/#examples","title":"EXAMPLES","text":"

File BIO \"hello world\":

BIO *bio_out;\n\nbio_out = BIO_new_fp(stdout, BIO_NOCLOSE);\nBIO_printf(bio_out, \"Hello World\\n\");\n

Alternative technique:

BIO *bio_out;\n\nbio_out = BIO_new(BIO_s_file());\nif (bio_out == NULL)\n    /* Error */\nif (BIO_set_fp(bio_out, stdout, BIO_NOCLOSE) <= 0)\n    /* Error */\nBIO_printf(bio_out, \"Hello World\\n\");\n

Write to a file:

BIO *out;\n\nout = BIO_new_file(\"filename.txt\", \"w\");\nif (!out)\n    /* Error */\nBIO_printf(out, \"Hello World\\n\");\nBIO_free(out);\n

Alternative technique:

BIO *out;\n\nout = BIO_new(BIO_s_file());\nif (out == NULL)\n    /* Error */\nif (BIO_write_filename(out, \"filename.txt\") <= 0)\n    /* Error */\nBIO_printf(out, \"Hello World\\n\");\nBIO_free(out);\n
"},{"location":"man3/BIO_s_file/#bugs","title":"BUGS","text":"

BIO_reset() and BIO_seek() are implemented using fseek() on the underlying stream. The return value for fseek() is 0 for success or -1 if an error occurred this differs from other types of BIO which will typically return 1 for success and a non positive value if an error occurred.

"},{"location":"man3/BIO_s_file/#see-also","title":"SEE ALSO","text":"

BIO_seek(3), BIO_tell(3), BIO_reset(3), BIO_flush(3), BIO_read_ex(3), BIO_write_ex(3), BIO_puts(3), BIO_gets(3), BIO_printf(3), BIO_set_close(3), BIO_get_close(3)

"},{"location":"man3/BIO_s_file/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_mem/","title":"BIO_s_mem","text":""},{"location":"man3/BIO_s_mem/#name","title":"NAME","text":"

BIO_s_secmem, BIO_s_mem, BIO_set_mem_eof_return, BIO_get_mem_data, BIO_set_mem_buf, BIO_get_mem_ptr, BIO_new_mem_buf - memory BIO

"},{"location":"man3/BIO_s_mem/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_mem(void);\nconst BIO_METHOD *BIO_s_secmem(void);\n\nBIO_set_mem_eof_return(BIO *b, int v);\nlong BIO_get_mem_data(BIO *b, char **pp);\nBIO_set_mem_buf(BIO *b, BUF_MEM *bm, int c);\nBIO_get_mem_ptr(BIO *b, BUF_MEM **pp);\n\nBIO *BIO_new_mem_buf(const void *buf, int len);\n
"},{"location":"man3/BIO_s_mem/#description","title":"DESCRIPTION","text":"

BIO_s_mem() returns the memory BIO method function.

A memory BIO is a source/sink BIO which uses memory for its I/O. Data written to a memory BIO is stored in a BUF_MEM structure which is extended as appropriate to accommodate the stored data.

BIO_s_secmem() is like BIO_s_mem() except that the secure heap is used for buffer storage.

Any data written to a memory BIO can be recalled by reading from it. Unless the memory BIO is read only any data read from it is deleted from the BIO.

Memory BIOs support BIO_gets() and BIO_puts().

If the BIO_CLOSE flag is set when a memory BIO is freed then the underlying BUF_MEM structure is also freed.

Calling BIO_reset() on a read write memory BIO clears any data in it if the flag BIO_FLAGS_NONCLEAR_RST is not set, otherwise it just restores the read pointer to the state it was just after the last write was performed and the data can be read again. On a read only BIO it similarly restores the BIO to its original state and the read only data can be read again.

BIO_eof() is true if no data is in the BIO.

BIO_ctrl_pending() returns the number of bytes currently stored.

BIO_set_mem_eof_return() sets the behaviour of memory BIO b when it is empty. If the v is zero then an empty memory BIO will return EOF (that is it will return zero and BIO_should_retry(b) will be false. If v is non zero then it will return v when it is empty and it will set the read retry flag (that is BIO_read_retry(b) is true). To avoid ambiguity with a normal positive return value v should be set to a negative value, typically -1.

BIO_get_mem_data() sets *pp to a pointer to the start of the memory BIOs data and returns the total amount of data available. It is implemented as a macro. Note the pointer returned by this call is informative, no transfer of ownership of this memory is implied. See notes on BIO_set_close().

BIO_set_mem_buf() sets the internal BUF_MEM structure to bm and sets the close flag to c, that is c should be either BIO_CLOSE or BIO_NOCLOSE. It is a macro.

BIO_get_mem_ptr() places the underlying BUF_MEM structure in *pp. It is a macro.

BIO_new_mem_buf() creates a memory BIO using len bytes of data at buf, if len is -1 then the buf is assumed to be nul terminated and its length is determined by strlen. The BIO is set to a read only state and as a result cannot be written to. This is useful when some data needs to be made available from a static area of memory in the form of a BIO. The supplied data is read directly from the supplied buffer: it is not copied first, so the supplied area of memory must be unchanged until the BIO is freed.

"},{"location":"man3/BIO_s_mem/#notes","title":"NOTES","text":"

Writes to memory BIOs will always succeed if memory is available: that is their size can grow indefinitely.

Every write after partial read (not all data in the memory buffer was read) to a read write memory BIO will have to move the unread data with an internal copy operation, if a BIO contains a lot of data and it is read in small chunks intertwined with writes the operation can be very slow. Adding a buffering BIO to the chain can speed up the process.

Calling BIO_set_mem_buf() on a BIO created with BIO_new_secmem() will give undefined results, including perhaps a program crash.

Switching the memory BIO from read write to read only is not supported and can give undefined results including a program crash. There are two notable exceptions to the rule. The first one is to assign a static memory buffer immediately after BIO creation and set the BIO as read only.

The other supported sequence is to start with read write BIO then temporarily switch it to read only and call BIO_reset() on the read only BIO immediately before switching it back to read write. Before the BIO is freed it must be switched back to the read write mode.

Calling BIO_get_mem_ptr() on read only BIO will return a BUF_MEM that contains only the remaining data to be read. If the close status of the BIO is set to BIO_NOCLOSE, before freeing the BUF_MEM the data pointer in it must be set to NULL as the data pointer does not point to an allocated memory.

Calling BIO_reset() on a read write memory BIO with BIO_FLAGS_NONCLEAR_RST flag set can have unexpected outcome when the reads and writes to the BIO are intertwined. As documented above the BIO will be reset to the state after the last completed write operation. The effects of reads preceding that write operation cannot be undone.

Calling BIO_get_mem_ptr() prior to a BIO_reset() call with BIO_FLAGS_NONCLEAR_RST set has the same effect as a write operation.

Calling BIO_set_close() with BIO_NOCLOSE orphans the BUF_MEM internal to the BIO, _not_ its actual data buffer. See the examples section for the proper method for claiming ownership of the data pointer for a deferred free operation.

"},{"location":"man3/BIO_s_mem/#bugs","title":"BUGS","text":"

There should be an option to set the maximum size of a memory BIO.

"},{"location":"man3/BIO_s_mem/#return-values","title":"RETURN VALUES","text":"

BIO_s_mem() and BIO_s_secmem() return a valid memory BIO_METHOD structure.

BIO_set_mem_eof_return(), BIO_set_mem_buf() and BIO_get_mem_ptr() return 1 on success or a value which is less than or equal to 0 if an error occurred.

BIO_get_mem_data() returns the total number of bytes available on success, 0 if b is NULL, or a negative value in case of other errors.

BIO_new_mem_buf() returns a valid BIO structure on success or NULL on error.

"},{"location":"man3/BIO_s_mem/#examples","title":"EXAMPLES","text":"

Create a memory BIO and write some data to it:

BIO *mem = BIO_new(BIO_s_mem());\n\nBIO_puts(mem, \"Hello World\\n\");\n

Create a read only memory BIO:

char data[] = \"Hello World\";\nBIO *mem = BIO_new_mem_buf(data, -1);\n

Extract the BUF_MEM structure from a memory BIO and then free up the BIO:

BUF_MEM *bptr;\n\nBIO_get_mem_ptr(mem, &bptr);\nBIO_set_close(mem, BIO_NOCLOSE); /* So BIO_free() leaves BUF_MEM alone */\nBIO_free(mem);\n

Extract the BUF_MEM ptr, claim ownership of the internal data and free the BIO and BUF_MEM structure:

BUF_MEM *bptr;\nchar *data;\n\nBIO_get_mem_data(bio, &data);\nBIO_get_mem_ptr(bio, &bptr);\nBIO_set_close(mem, BIO_NOCLOSE); /* So BIO_free orphans BUF_MEM */\nBIO_free(bio);\nbptr->data = NULL; /* Tell BUF_MEM to orphan data */\nBUF_MEM_free(bptr);\n...\nfree(data);\n
"},{"location":"man3/BIO_s_mem/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_null/","title":"BIO_s_null","text":""},{"location":"man3/BIO_s_null/#name","title":"NAME","text":"

BIO_s_null - null data sink

"},{"location":"man3/BIO_s_null/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_null(void);\n
"},{"location":"man3/BIO_s_null/#description","title":"DESCRIPTION","text":"

BIO_s_null() returns the null sink BIO method. Data written to the null sink is discarded, reads return EOF.

"},{"location":"man3/BIO_s_null/#notes","title":"NOTES","text":"

A null sink BIO behaves in a similar manner to the Unix /dev/null device.

A null bio can be placed on the end of a chain to discard any data passed through it.

A null sink is useful if, for example, an application wishes to digest some data by writing through a digest bio but not send the digested data anywhere. Since a BIO chain must normally include a source/sink BIO this can be achieved by adding a null sink BIO to the end of the chain

"},{"location":"man3/BIO_s_null/#return-values","title":"RETURN VALUES","text":"

BIO_s_null() returns the null sink BIO method.

"},{"location":"man3/BIO_s_null/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_s_socket/","title":"BIO_s_socket","text":""},{"location":"man3/BIO_s_socket/#name","title":"NAME","text":"

BIO_s_socket, BIO_new_socket - socket BIO

"},{"location":"man3/BIO_s_socket/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_socket(void);\n\nBIO *BIO_new_socket(int sock, int close_flag);\n
"},{"location":"man3/BIO_s_socket/#description","title":"DESCRIPTION","text":"

BIO_s_socket() returns the socket BIO method. This is a wrapper round the platform's socket routines.

BIO_read_ex() and BIO_write_ex() read or write the underlying socket. BIO_puts() is supported but BIO_gets() is not.

If the close flag is set then the socket is shut down and closed when the BIO is freed.

BIO_new_socket() returns a socket BIO using sock and close_flag.

"},{"location":"man3/BIO_s_socket/#notes","title":"NOTES","text":"

Socket BIOs also support any relevant functionality of file descriptor BIOs.

The reason for having separate file descriptor and socket BIOs is that on some platforms sockets are not file descriptors and use distinct I/O routines, Windows is one such platform. Any code mixing the two will not work on all platforms.

"},{"location":"man3/BIO_s_socket/#return-values","title":"RETURN VALUES","text":"

BIO_s_socket() returns the socket BIO method.

BIO_new_socket() returns the newly allocated BIO or NULL is an error occurred.

"},{"location":"man3/BIO_s_socket/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_set_callback/","title":"BIO_set_callback","text":""},{"location":"man3/BIO_set_callback/#name","title":"NAME","text":"

BIO_set_callback_ex, BIO_get_callback_ex, BIO_set_callback, BIO_get_callback, BIO_set_callback_arg, BIO_get_callback_arg, BIO_debug_callback, BIO_debug_callback_ex, BIO_callback_fn_ex, BIO_callback_fn - BIO callback functions

"},{"location":"man3/BIO_set_callback/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\ntypedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp,\n                                   size_t len, int argi,\n                                   long argl, int ret, size_t *processed);\n\nvoid BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback);\nBIO_callback_fn_ex BIO_get_callback_ex(const BIO *b);\n\nvoid BIO_set_callback_arg(BIO *b, char *arg);\nchar *BIO_get_callback_arg(const BIO *b);\n\nlong BIO_debug_callback_ex(BIO *bio, int oper, const char *argp, size_t len,\n                           int argi, long argl, int ret, size_t *processed);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi,\n                                long argl, long ret);\nvoid BIO_set_callback(BIO *b, BIO_callback_fn cb);\nBIO_callback_fn BIO_get_callback(const BIO *b);\nlong BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,\n                        long argl, long ret);\n
"},{"location":"man3/BIO_set_callback/#description","title":"DESCRIPTION","text":"

BIO_set_callback_ex() and BIO_get_callback_ex() set and retrieve the BIO callback. The callback is called during most high-level BIO operations. It can be used for debugging purposes to trace operations on a BIO or to modify its operation.

BIO_set_callback() and BIO_get_callback() set and retrieve the old format BIO callback. New code should not use these functions, but they are retained for backwards compatibility. Any callback set via BIO_set_callback_ex() will get called in preference to any set by BIO_set_callback().

BIO_set_callback_arg() and BIO_get_callback_arg() are macros which can be used to set and retrieve an argument for use in the callback.

BIO_debug_callback_ex() is a standard debugging callback which prints out information relating to each BIO operation. If the callback argument is set it is interpreted as a BIO to send the information to, otherwise stderr is used. The BIO_debug_callback() function is the deprecated version of the same callback for use with the old callback format BIO_set_callback() function.

BIO_callback_fn_ex is the type of the callback function and BIO_callback_fn is the type of the old format callback function. The meaning of each argument is described below:

  • b

    The BIO the callback is attached to is passed in b.

  • oper

    oper is set to the operation being performed. For some operations the callback is called twice, once before and once after the actual operation, the latter case has oper or'ed with BIO_CB_RETURN.

  • len

    The length of the data requested to be read or written. This is only useful if oper is BIO_CB_READ, BIO_CB_WRITE or BIO_CB_GETS.

  • argp argi argl

    The meaning of the arguments argp, argi and argl depends on the value of oper, that is the operation being performed.

  • processed

    processed is a pointer to a location which will be updated with the amount of data that was actually read or written. Only used for BIO_CB_READ, BIO_CB_WRITE, BIO_CB_GETS and BIO_CB_PUTS.

  • ret

    ret is the return value that would be returned to the application if no callback were present. The actual value returned is the return value of the callback itself. In the case of callbacks called before the actual BIO operation 1 is placed in ret, if the return value is not positive it will be immediately returned to the application and the BIO operation will not be performed.

The callback should normally simply return ret when it has finished processing, unless it specifically wishes to modify the value returned to the application.

"},{"location":"man3/BIO_set_callback/#callback-operations","title":"CALLBACK OPERATIONS","text":"

In the notes below, callback defers to the actual callback function that is called.

  • BIO_free(b)

    callback_ex(b, BIO_CB_FREE, NULL, 0, 0, 0L, 1L, NULL)\n

    or

    callback(b, BIO_CB_FREE, NULL, 0L, 0L, 1L)\n

    is called before the free operation.

  • BIO_read_ex(b, data, dlen, readbytes)

    callback_ex(b, BIO_CB_READ, data, dlen, 0, 0L, 1L, NULL)\n

    or

    callback(b, BIO_CB_READ, data, dlen, 0L, 1L)\n

    is called before the read and

    callback_ex(b, BIO_CB_READ | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue,\n            &readbytes)\n

    or

    callback(b, BIO_CB_READ|BIO_CB_RETURN, data, dlen, 0L, retvalue)\n

    after.

  • BIO_write(b, data, dlen, written)

    callback_ex(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L, NULL)\n

    or

    callback(b, BIO_CB_WRITE, datat, dlen, 0L, 1L)\n

    is called before the write and

    callback_ex(b, BIO_CB_WRITE | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue,\n            &written)\n

    or

    callback(b, BIO_CB_WRITE|BIO_CB_RETURN, data, dlen, 0L, retvalue)\n

    after.

  • BIO_gets(b, buf, size)

    callback_ex(b, BIO_CB_GETS, buf, size, 0, 0L, 1, NULL, NULL)\n

    or

    callback(b, BIO_CB_GETS, buf, size, 0L, 1L)\n

    is called before the operation and

    callback_ex(b, BIO_CB_GETS | BIO_CB_RETURN, buf, size, 0, 0L, retvalue,\n            &readbytes)\n

    or

    callback(b, BIO_CB_GETS|BIO_CB_RETURN, buf, size, 0L, retvalue)\n

    after.

  • BIO_puts(b, buf)

    callback_ex(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);\n

    or

    callback(b, BIO_CB_PUTS, buf, 0, 0L, 1L)\n

    is called before the operation and

    callback_ex(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0, 0L, retvalue, &written)\n

    or

    callback(b, BIO_CB_PUTS|BIO_CB_RETURN, buf, 0, 0L, retvalue)\n

    after.

  • BIO_ctrl(BIO *b, int cmd, long larg, void *parg)

    callback_ex(b, BIO_CB_CTRL, parg, 0, cmd, larg, 1L, NULL)\n

    or

    callback(b, BIO_CB_CTRL, parg, cmd, larg, 1L)\n

    is called before the call and

    callback_ex(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, 0, cmd, larg, ret, NULL)\n

    or

    callback(b, BIO_CB_CTRL|BIO_CB_RETURN, parg, cmd, larg, ret)\n

    after.

    Note: cmd == BIO_CTRL_SET_CALLBACK is special, because parg is not the argument of type BIO_info_cb itself. In this case parg is a pointer to the actual call parameter, see BIO_callback_ctrl.

"},{"location":"man3/BIO_set_callback/#return-values","title":"RETURN VALUES","text":"

BIO_get_callback_ex() and BIO_get_callback() return the callback function previously set by a call to BIO_set_callback_ex() and BIO_set_callback() respectively.

BIO_get_callback_arg() returns a char pointer to the value previously set via a call to BIO_set_callback_arg().

BIO_debug_callback() returns 1 or ret if it's called after specific BIO operations.

"},{"location":"man3/BIO_set_callback/#examples","title":"EXAMPLES","text":"

The BIO_debug_callback_ex() function is an example, its source is in crypto/bio/bio_cb.c

"},{"location":"man3/BIO_set_callback/#history","title":"HISTORY","text":"

The BIO_debug_callback_ex() function was added in OpenSSL 3.0.

BIO_set_callback(), BIO_get_callback(), and BIO_debug_callback() were deprecated in OpenSSL 3.0. Use the non-deprecated _ex functions instead.

"},{"location":"man3/BIO_set_callback/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_should_retry/","title":"BIO_should_retry","text":""},{"location":"man3/BIO_should_retry/#name","title":"NAME","text":"

BIO_should_read, BIO_should_write, BIO_should_io_special, BIO_retry_type, BIO_should_retry, BIO_get_retry_BIO, BIO_get_retry_reason, BIO_set_retry_reason - BIO retry functions

"},{"location":"man3/BIO_should_retry/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\nint BIO_should_read(BIO *b);\nint BIO_should_write(BIO *b);\nint BIO_should_io_special(iBIO *b);\nint BIO_retry_type(BIO *b);\nint BIO_should_retry(BIO *b);\n\nBIO *BIO_get_retry_BIO(BIO *bio, int *reason);\nint BIO_get_retry_reason(BIO *bio);\nvoid BIO_set_retry_reason(BIO *bio, int reason);\n
"},{"location":"man3/BIO_should_retry/#description","title":"DESCRIPTION","text":"

These functions determine why a BIO is not able to read or write data. They will typically be called after a failed BIO_read_ex() or BIO_write_ex() call.

BIO_should_retry() is true if the call that produced this condition should then be retried at a later time.

If BIO_should_retry() is false then the cause is an error condition.

BIO_should_read() is true if the cause of the condition is that the BIO has insufficient data to return. Check for readability and/or retry the last operation.

BIO_should_write() is true if the cause of the condition is that the BIO has pending data to write. Check for writability and/or retry the last operation.

BIO_should_io_special() is true if some \"special\" condition, that is a reason other than reading or writing is the cause of the condition.

BIO_retry_type() returns a mask of the cause of a retry condition consisting of the values BIO_FLAGS_READ, BIO_FLAGS_WRITE, BIO_FLAGS_IO_SPECIAL though current BIO types will only set one of these.

BIO_get_retry_BIO() determines the precise reason for the special condition, it returns the BIO that caused this condition and if reason is not NULL it contains the reason code. The meaning of the reason code and the action that should be taken depends on the type of BIO that resulted in this condition.

BIO_get_retry_reason() returns the reason for a special condition if passed the relevant BIO, for example as returned by BIO_get_retry_BIO().

BIO_set_retry_reason() sets the retry reason for a special condition for a given BIO. This would usually only be called by BIO implementations.

"},{"location":"man3/BIO_should_retry/#notes","title":"NOTES","text":"

BIO_should_read(), BIO_should_write(), BIO_should_io_special(), BIO_retry_type(), and BIO_should_retry(), are implemented as macros.

If BIO_should_retry() returns false then the precise \"error condition\" depends on the BIO type that caused it and the return code of the BIO operation. For example if a call to BIO_read_ex() on a socket BIO returns 0 and BIO_should_retry() is false then the cause will be that the connection closed. A similar condition on a file BIO will mean that it has reached EOF. Some BIO types may place additional information on the error queue. For more details see the individual BIO type manual pages.

If the underlying I/O structure is in a blocking mode almost all current BIO types will not request a retry, because the underlying I/O calls will not. If the application knows that the BIO type will never signal a retry then it need not call BIO_should_retry() after a failed BIO I/O call. This is typically done with file BIOs.

SSL BIOs are the only current exception to this rule: they can request a retry even if the underlying I/O structure is blocking, if a handshake occurs during a call to BIO_read(). An application can retry the failed call immediately or avoid this situation by setting SSL_MODE_AUTO_RETRY on the underlying SSL structure.

While an application may retry a failed non blocking call immediately this is likely to be very inefficient because the call will fail repeatedly until data can be processed or is available. An application will normally wait until the necessary condition is satisfied. How this is done depends on the underlying I/O structure.

For example if the cause is ultimately a socket and BIO_should_read() is true then a call to select() may be made to wait until data is available and then retry the BIO operation. By combining the retry conditions of several non blocking BIOs in a single select() call it is possible to service several BIOs in a single thread, though the performance may be poor if SSL BIOs are present because long delays can occur during the initial handshake process.

It is possible for a BIO to block indefinitely if the underlying I/O structure cannot process or return any data. This depends on the behaviour of the platforms I/O functions. This is often not desirable: one solution is to use non blocking I/O and use a timeout on the select() (or equivalent) call.

"},{"location":"man3/BIO_should_retry/#bugs","title":"BUGS","text":"

The OpenSSL ASN1 functions cannot gracefully deal with non blocking I/O: that is they cannot retry after a partial read or write. This is usually worked around by only passing the relevant data to ASN1 functions when the entire structure can be read or written.

"},{"location":"man3/BIO_should_retry/#return-values","title":"RETURN VALUES","text":"

BIO_should_read(), BIO_should_write(), BIO_should_io_special(), and BIO_should_retry() return either 1 or 0 based on the actual conditions of the BIO.

BIO_retry_type() returns a flag combination presenting the cause of a retry condition or false if there is no retry condition.

BIO_get_retry_BIO() returns a valid BIO structure.

BIO_get_retry_reason() returns the reason for a special condition.

"},{"location":"man3/BIO_should_retry/#see-also","title":"SEE ALSO","text":"

bio(7)

"},{"location":"man3/BIO_should_retry/#history","title":"HISTORY","text":"

The BIO_get_retry_reason() and BIO_set_retry_reason() functions were added in OpenSSL 1.1.0.

"},{"location":"man3/BIO_should_retry/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BIO_socket_wait/","title":"BIO_socket_wait","text":""},{"location":"man3/BIO_socket_wait/#name","title":"NAME","text":"

BIO_socket_wait, BIO_wait, BIO_do_connect_retry - BIO connection utility functions

"},{"location":"man3/BIO_socket_wait/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bio.h>\n\n#ifndef OPENSSL_NO_SOCK\nint BIO_socket_wait(int fd, int for_read, time_t max_time);\n#endif\nint BIO_wait(BIO *bio, time_t max_time, unsigned int nap_milliseconds);\nint BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds);\n
"},{"location":"man3/BIO_socket_wait/#description","title":"DESCRIPTION","text":"

BIO_socket_wait() waits on the socket fd for reading if for_read is not 0, else for writing, at most until max_time. It succeeds immediately if max_time == 0 (which means no timeout given).

BIO_wait() waits at most until max_time on the given (typically socket-based) bio, for reading if bio is supposed to read, else for writing. It is used by BIO_do_connect_retry() and can be used together BIO_read(3). It succeeds immediately if max_time == 0 (which means no timeout given). If sockets are not available it supports polling by succeeding after sleeping at most the given nap_milliseconds in order to avoid a tight busy loop. Via nap_milliseconds the caller determines the polling granularity.

BIO_do_connect_retry() connects via the given bio. It retries BIO_do_connect() as far as needed to reach a definite outcome, i.e., connection succeeded, timeout has been reached, or an error occurred. For nonblocking and potentially even non-socket BIOs it polls every nap_milliseconds and sleeps in between using BIO_wait(). If nap_milliseconds is < 0 then a default value of 100 ms is used. If the timeout parameter is > 0 this indicates the maximum number of seconds to wait until the connection is established or a definite error occurred. A value of 0 enables waiting indefinitely (i.e, no timeout), while a value < 0 means that BIO_do_connect() is tried only once. The function may, directly or indirectly, invoke ERR_clear_error().

"},{"location":"man3/BIO_socket_wait/#return-values","title":"RETURN VALUES","text":"

BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() return -1 on error, 0 on timeout, and 1 on success.

"},{"location":"man3/BIO_socket_wait/#see-also","title":"SEE ALSO","text":"

BIO_do_connect(3), BIO_read(3)

"},{"location":"man3/BIO_socket_wait/#history","title":"HISTORY","text":"

BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() were added in OpenSSL 3.0.

"},{"location":"man3/BIO_socket_wait/#copyright","title":"COPYRIGHT","text":"

Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_BLINDING_new/","title":"BN_BLINDING_new","text":""},{"location":"man3/BN_BLINDING_new/#name","title":"NAME","text":"

BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert, BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex, BN_BLINDING_is_current_thread, BN_BLINDING_set_current_thread, BN_BLINDING_lock, BN_BLINDING_unlock, BN_BLINDING_get_flags, BN_BLINDING_set_flags, BN_BLINDING_create_param - blinding related BIGNUM functions

"},{"location":"man3/BN_BLINDING_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nBN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai,\n                             BIGNUM *mod);\nvoid BN_BLINDING_free(BN_BLINDING *b);\nint BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b,\n                           BN_CTX *ctx);\nint BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,\n                          BN_CTX *ctx);\nint BN_BLINDING_is_current_thread(BN_BLINDING *b);\nvoid BN_BLINDING_set_current_thread(BN_BLINDING *b);\nint BN_BLINDING_lock(BN_BLINDING *b);\nint BN_BLINDING_unlock(BN_BLINDING *b);\nunsigned long BN_BLINDING_get_flags(const BN_BLINDING *b);\nvoid BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags);\nBN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,\n                                      const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,\n                                      int (*bn_mod_exp)(BIGNUM *r,\n                                                        const BIGNUM *a,\n                                                        const BIGNUM *p,\n                                                        const BIGNUM *m,\n                                                        BN_CTX *ctx,\n                                                        BN_MONT_CTX *m_ctx),\n                                      BN_MONT_CTX *m_ctx);\n
"},{"location":"man3/BN_BLINDING_new/#description","title":"DESCRIPTION","text":"

BN_BLINDING_new() allocates a new BN_BLINDING structure and copies the A and Ai values into the newly created BN_BLINDING object.

BN_BLINDING_free() frees the BN_BLINDING structure. If b is NULL, nothing is done.

BN_BLINDING_update() updates the BN_BLINDING parameters by squaring the A and Ai or, after specific number of uses and if the necessary parameters are set, by re-creating the blinding parameters.

BN_BLINDING_convert_ex() multiplies n with the blinding factor A. If r is not NULL a copy the inverse blinding factor Ai will be returned in r (this is useful if a RSA object is shared among several threads). BN_BLINDING_invert_ex() multiplies n with the inverse blinding factor Ai. If r is not NULL it will be used as the inverse blinding.

BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() with r set to NULL.

BN_BLINDING_is_current_thread() returns whether the BN_BLINDING structure is owned by the current thread. This is to help users provide proper locking if needed for multi-threaded use.

BN_BLINDING_set_current_thread() sets the current thread as the owner of the BN_BLINDING structure.

BN_BLINDING_lock() locks the BN_BLINDING structure.

BN_BLINDING_unlock() unlocks the BN_BLINDING structure.

BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently there are two supported flags: BN_BLINDING_NO_UPDATE and BN_BLINDING_NO_RECREATE. BN_BLINDING_NO_UPDATE inhibits the automatic update of the BN_BLINDING parameters after each use and BN_BLINDING_NO_RECREATE inhibits the automatic re-creation of the BN_BLINDING parameters after a fixed number of uses (currently 32). In newly allocated BN_BLINDING objects no flags are set. BN_BLINDING_set_flags() sets the BN_BLINDING parameters flags.

BN_BLINDING_create_param() creates new BN_BLINDING parameters using the exponent e and the modulus m. bn_mod_exp and m_ctx can be used to pass special functions for exponentiation (normally BN_mod_exp_mont() and BN_MONT_CTX).

"},{"location":"man3/BN_BLINDING_new/#return-values","title":"RETURN VALUES","text":"

BN_BLINDING_new() returns the newly allocated BN_BLINDING structure or NULL in case of an error.

BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(), BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on success and 0 if an error occurred.

BN_BLINDING_is_current_thread() returns 1 if the current thread owns the BN_BLINDING object, 0 otherwise.

BN_BLINDING_set_current_thread() doesn't return anything.

BN_BLINDING_lock(), BN_BLINDING_unlock() return 1 if the operation succeeded or 0 on error.

BN_BLINDING_get_flags() returns the currently set BN_BLINDING flags (a unsigned long value).

BN_BLINDING_create_param() returns the newly created BN_BLINDING parameters or NULL on error.

"},{"location":"man3/BN_BLINDING_new/#history","title":"HISTORY","text":"

BN_BLINDING_thread_id() was first introduced in OpenSSL 1.0.0, and it deprecates BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id().

"},{"location":"man3/BN_BLINDING_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_CTX_new/","title":"BN_CTX_new","text":""},{"location":"man3/BN_CTX_new/#name","title":"NAME","text":"

BN_CTX_new_ex, BN_CTX_new, BN_CTX_secure_new_ex, BN_CTX_secure_new, BN_CTX_free - allocate and free BN_CTX structures

"},{"location":"man3/BN_CTX_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nBN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx);\nBN_CTX *BN_CTX_new(void);\n\nBN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx);\nBN_CTX *BN_CTX_secure_new(void);\n\nvoid BN_CTX_free(BN_CTX *c);\n
"},{"location":"man3/BN_CTX_new/#description","title":"DESCRIPTION","text":"

A BN_CTX is a structure that holds BIGNUM temporary variables used by library functions. Since dynamic memory allocation to create BIGNUMs is rather expensive when used in conjunction with repeated subroutine calls, the BN_CTX structure is used.

BN_CTX_new_ex() allocates and initializes a BN_CTX structure for the given library context ctx. The <ctx> value may be NULL in which case the default library context will be used. BN_CTX_new() is the same as BN_CTX_new_ex() except that the default library context is always used.

BN_CTX_secure_new_ex() allocates and initializes a BN_CTX structure but uses the secure heap (see CRYPTO_secure_malloc(3)) to hold the BIGNUMs for the given library context ctx. The <ctx> value may be NULL in which case the default library context will be used. BN_CTX_secure_new() is the same as BN_CTX_secure_new_ex() except that the default library context is always used.

BN_CTX_free() frees the components of the BN_CTX and the structure itself. Since BN_CTX_start() is required in order to obtain BIGNUMs from the BN_CTX, in most cases BN_CTX_end() must be called before the BN_CTX may be freed by BN_CTX_free(). If c is NULL, nothing is done.

A given BN_CTX must only be used by a single thread of execution. No locking is performed, and the internal pool allocator will not properly handle multiple threads of execution.

"},{"location":"man3/BN_CTX_new/#return-values","title":"RETURN VALUES","text":"

BN_CTX_new() and BN_CTX_secure_new() return a pointer to the BN_CTX. If the allocation fails, they return NULL and sets an error code that can be obtained by ERR_get_error(3).

BN_CTX_free() has no return values.

"},{"location":"man3/BN_CTX_new/#removed-functionality","title":"REMOVED FUNCTIONALITY","text":"
void BN_CTX_init(BN_CTX *c);\n

BN_CTX_init() is no longer available as of OpenSSL 1.1.0. Applications should replace use of BN_CTX_init with BN_CTX_new instead:

BN_CTX *ctx;\nctx = BN_CTX_new();\nif (!ctx)\n    /* error */\n...\nBN_CTX_free(ctx);\n
"},{"location":"man3/BN_CTX_new/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_add(3), BN_CTX_start(3)

"},{"location":"man3/BN_CTX_new/#history","title":"HISTORY","text":"

BN_CTX_init() was removed in OpenSSL 1.1.0.

"},{"location":"man3/BN_CTX_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_CTX_start/","title":"BN_CTX_start","text":""},{"location":"man3/BN_CTX_start/#name","title":"NAME","text":"

BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables

"},{"location":"man3/BN_CTX_start/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nvoid BN_CTX_start(BN_CTX *ctx);\n\nBIGNUM *BN_CTX_get(BN_CTX *ctx);\n\nvoid BN_CTX_end(BN_CTX *ctx);\n
"},{"location":"man3/BN_CTX_start/#description","title":"DESCRIPTION","text":"

These functions are used to obtain temporary BIGNUM variables from a BN_CTX (which can been created by using BN_CTX_new(3)) in order to save the overhead of repeatedly creating and freeing BIGNUMs in functions that are called from inside a loop.

A function must call BN_CTX_start() first. Then, BN_CTX_get() may be called repeatedly to obtain temporary BIGNUMs. All BN_CTX_get() calls must be made before calling any other functions that use the ctx as an argument.

Finally, BN_CTX_end() must be called before returning from the function. If ctx is NULL, nothing is done. When BN_CTX_end() is called, the BIGNUM pointers obtained from BN_CTX_get() become invalid.

"},{"location":"man3/BN_CTX_start/#return-values","title":"RETURN VALUES","text":"

BN_CTX_start() and BN_CTX_end() return no values.

BN_CTX_get() returns a pointer to the BIGNUM, or NULL on error. Once BN_CTX_get() has failed, the subsequent calls will return NULL as well, so it is sufficient to check the return value of the last BN_CTX_get() call. In case of an error, an error code is set, which can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_CTX_start/#see-also","title":"SEE ALSO","text":"

BN_CTX_new(3)

"},{"location":"man3/BN_CTX_start/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_add/","title":"BN_add","text":""},{"location":"man3/BN_add/#name","title":"NAME","text":"

BN_add, BN_sub, BN_mul, BN_sqr, BN_div, BN_mod, BN_nnmod, BN_mod_add, BN_mod_sub, BN_mod_mul, BN_mod_sqr, BN_mod_sqrt, BN_exp, BN_mod_exp, BN_gcd - arithmetic operations on BIGNUMs

"},{"location":"man3/BN_add/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\n\nint BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\n\nint BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\n\nint BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx);\n\nint BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d,\n           BN_CTX *ctx);\n\nint BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\n\nint BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\n\nint BN_mod_add(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m,\n               BN_CTX *ctx);\n\nint BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m,\n               BN_CTX *ctx);\n\nint BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m,\n               BN_CTX *ctx);\n\nint BN_mod_sqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\n\nBIGNUM *BN_mod_sqrt(BIGNUM *in, BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\n\nint BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx);\n\nint BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p,\n               const BIGNUM *m, BN_CTX *ctx);\n\nint BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\n
"},{"location":"man3/BN_add/#description","title":"DESCRIPTION","text":"

BN_add() adds a and b and places the result in r (r=a+b). r may be the same BIGNUM as a or b.

BN_sub() subtracts b from a and places the result in r (r=a-b). r may be the same BIGNUM as a or b.

BN_mul() multiplies a and b and places the result in r (r=a*b). r may be the same BIGNUM as a or b. For multiplication by powers of 2, use BN_lshift(3).

BN_sqr() takes the square of a and places the result in r (r=a^2). r and a may be the same BIGNUM. This function is faster than BN_mul(r,a,a).

BN_div() divides a by d and places the result in dv and the remainder in rem (dv=a/d, rem=a%d). Either of dv and rem may be NULL, in which case the respective value is not returned. The result is rounded towards zero; thus if a is negative, the remainder will be zero or negative. For division by powers of 2, use BN_rshift(3).

BN_mod() corresponds to BN_div() with dv set to NULL.

BN_nnmod() reduces a modulo m and places the nonnegative remainder in r.

BN_mod_add() adds a to b modulo m and places the nonnegative result in r.

BN_mod_sub() subtracts b from a modulo m and places the nonnegative result in r.

BN_mod_mul() multiplies a by b and finds the nonnegative remainder respective to modulus m (r=(a*b) mod m). r may be the same BIGNUM as a or b. For more efficient algorithms for repeated computations using the same modulus, see BN_mod_mul_montgomery(3) and BN_mod_mul_reciprocal(3).

BN_mod_sqr() takes the square of a modulo m and places the result in r.

BN_mod_sqrt() returns the modular square root of a such that in^2 = a (mod p). The modulus p must be a prime, otherwise an error or an incorrect \"result\" will be returned. The result is stored into in which can be NULL. The result will be newly allocated in that case.

BN_exp() raises a to the p-th power and places the result in r (r=a^p). This function is faster than repeated applications of BN_mul().

BN_mod_exp() computes a to the p-th power modulo m (r=a^p % m). This function uses less time and space than BN_exp(). Do not call this function when m is even and any of the parameters have the BN_FLG_CONSTTIME flag set.

BN_gcd() computes the greatest common divisor of a and b and places the result in r. r may be the same BIGNUM as a or b.

For all functions, ctx is a previously allocated BN_CTX used for temporary variables; see BN_CTX_new(3).

Unless noted otherwise, the result BIGNUM must be different from the arguments.

"},{"location":"man3/BN_add/#notes","title":"NOTES","text":"

For modular operations such as BN_nnmod() or BN_mod_exp() it is an error to use the same BIGNUM object for the modulus as for the output.

"},{"location":"man3/BN_add/#return-values","title":"RETURN VALUES","text":"

The BN_mod_sqrt() returns the result (possibly incorrect if p is not a prime), or NULL.

For all remaining functions, 1 is returned for success, 0 on error. The return value should always be checked (e.g., if (!BN_add(r,a,b)) goto err;). The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_add/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_CTX_new(3), BN_add_word(3), BN_set_bit(3)

"},{"location":"man3/BN_add/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_add_word/","title":"BN_add_word","text":""},{"location":"man3/BN_add_word/#name","title":"NAME","text":"

BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic functions on BIGNUMs with integers

"},{"location":"man3/BN_add_word/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_add_word(BIGNUM *a, BN_ULONG w);\n\nint BN_sub_word(BIGNUM *a, BN_ULONG w);\n\nint BN_mul_word(BIGNUM *a, BN_ULONG w);\n\nBN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);\n\nBN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);\n
"},{"location":"man3/BN_add_word/#description","title":"DESCRIPTION","text":"

These functions perform arithmetic operations on BIGNUMs with unsigned integers. They are much more efficient than the normal BIGNUM arithmetic operations.

BN_add_word() adds w to a (a+=w).

BN_sub_word() subtracts w from a (a-=w).

BN_mul_word() multiplies a and w (a*=w).

BN_div_word() divides a by w (a/=w) and returns the remainder.

BN_mod_word() returns the remainder of a divided by w (a%w).

For BN_div_word() and BN_mod_word(), w must not be 0.

"},{"location":"man3/BN_add_word/#return-values","title":"RETURN VALUES","text":"

BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

BN_mod_word() and BN_div_word() return a%w on success and (BN_ULONG)-1 if an error occurred.

"},{"location":"man3/BN_add_word/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_add(3)

"},{"location":"man3/BN_add_word/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_bn2bin/","title":"BN_bn2bin","text":""},{"location":"man3/BN_bn2bin/#name","title":"NAME","text":"

BN_bn2binpad, BN_bn2bin, BN_bin2bn, BN_bn2lebinpad, BN_lebin2bn, BN_bn2nativepad, BN_native2bn, BN_bn2hex, BN_bn2dec, BN_hex2bn, BN_dec2bn, BN_print, BN_print_fp, BN_bn2mpi, BN_mpi2bn - format conversions

"},{"location":"man3/BN_bn2bin/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_bn2bin(const BIGNUM *a, unsigned char *to);\nint BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);\nBIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);\n\nint BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);\nBIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);\n\nint BN_bn2nativepad(const BIGNUM *a, unsigned char *to, int tolen);\nBIGNUM *BN_native2bn(const unsigned char *s, int len, BIGNUM *ret);\n\nchar *BN_bn2hex(const BIGNUM *a);\nchar *BN_bn2dec(const BIGNUM *a);\nint BN_hex2bn(BIGNUM **a, const char *str);\nint BN_dec2bn(BIGNUM **a, const char *str);\n\nint BN_print(BIO *fp, const BIGNUM *a);\nint BN_print_fp(FILE *fp, const BIGNUM *a);\n\nint BN_bn2mpi(const BIGNUM *a, unsigned char *to);\nBIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret);\n
"},{"location":"man3/BN_bn2bin/#description","title":"DESCRIPTION","text":"

BN_bn2bin() converts the absolute value of a into big-endian form and stores it at to. to must point to BN_num_bytes(a) bytes of memory.

BN_bn2binpad() also converts the absolute value of a into big-endian form and stores it at to. tolen indicates the length of the output buffer to. The result is padded with zeros if necessary. If tolen is less than BN_num_bytes(a) an error is returned.

BN_bin2bn() converts the positive integer in big-endian form of length len at s into a BIGNUM and places it in ret. If ret is NULL, a new BIGNUM is created.

BN_bn2lebinpad() and BN_lebin2bn() are identical to BN_bn2binpad() and BN_bin2bn() except the buffer is in little-endian format.

BN_bn2nativepad() and BN_native2bn() are identical to BN_bn2binpad() and BN_bin2bn() except the buffer is in native format, i.e. most significant byte first on big-endian platforms, and least significant byte first on little-endian platforms.

BN_bn2hex() and BN_bn2dec() return printable strings containing the hexadecimal and decimal encoding of a respectively. For negative numbers, the string is prefaced with a leading '-'. The string must be freed later using OPENSSL_free().

BN_hex2bn() takes as many characters as possible from the string str, including the leading character '-' which means negative, to form a valid hexadecimal number representation and converts them to a BIGNUM and stores it in **a. If *a is NULL, a new BIGNUM is created. If a is NULL, it only computes the length of valid representation. A \"negative zero\" is converted to zero. BN_dec2bn() is the same using the decimal system.

BN_print() and BN_print_fp() write the hexadecimal encoding of a, with a leading '-' for negative numbers, to the BIO or FILE fp.

BN_bn2mpi() and BN_mpi2bn() convert BIGNUMs from and to a format that consists of the number's length in bytes represented as a 4-byte big-endian number, and the number itself in big-endian format, where the most significant bit signals a negative number (the representation of numbers with the MSB set is prefixed with null byte).

BN_bn2mpi() stores the representation of a at to, where to must be large enough to hold the result. The size can be determined by calling BN_bn2mpi(a, NULL).

BN_mpi2bn() converts the len bytes long representation at s to a BIGNUM and stores it at ret, or in a newly allocated BIGNUM if ret is NULL.

"},{"location":"man3/BN_bn2bin/#return-values","title":"RETURN VALUES","text":"

BN_bn2bin() returns the length of the big-endian number placed at to. BN_bin2bn() returns the BIGNUM, NULL on error.

BN_bn2binpad(), BN_bn2lebinpad(), and BN_bn2nativepad() return the number of bytes written or -1 if the supplied buffer is too small.

BN_bn2hex() and BN_bn2dec() return a NUL-terminated string, or NULL on error. BN_hex2bn() and BN_dec2bn() return the number of characters used in parsing, or 0 on error, in which case no new BIGNUM will be created.

BN_print_fp() and BN_print() return 1 on success, 0 on write errors.

BN_bn2mpi() returns the length of the representation. BN_mpi2bn() returns the BIGNUM, and NULL on error.

The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_bn2bin/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_zero(3), ASN1_INTEGER_to_BN(3), BN_num_bytes(3)

"},{"location":"man3/BN_bn2bin/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_cmp/","title":"BN_cmp","text":""},{"location":"man3/BN_cmp/#name","title":"NAME","text":"

BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_abs_is_word, BN_is_odd, BN_are_coprime - BIGNUM comparison and test functions

"},{"location":"man3/BN_cmp/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_cmp(const BIGNUM *a, const BIGNUM *b);\nint BN_ucmp(const BIGNUM *a, const BIGNUM *b);\n\nint BN_is_zero(const BIGNUM *a);\nint BN_is_one(const BIGNUM *a);\nint BN_is_word(const BIGNUM *a, const BN_ULONG w);\nint BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);\nint BN_is_odd(const BIGNUM *a);\n\nint BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\n
"},{"location":"man3/BN_cmp/#description","title":"DESCRIPTION","text":"

BN_cmp() compares the numbers a and b. BN_ucmp() compares their absolute values.

BN_is_zero(), BN_is_one(), BN_is_word() and BN_abs_is_word() test if a equals 0, 1, w, or |w| respectively. BN_is_odd() tests if a is odd.

BN_are_coprime() determines if a and b are coprime. ctx is used internally for storing temporary variables. The values of a and b and ctx must not be NULL.

"},{"location":"man3/BN_cmp/#return-values","title":"RETURN VALUES","text":"

BN_cmp() returns -1 if a < b, 0 if a == b and 1 if a > b. BN_ucmp() is the same using the absolute values of a and b.

BN_is_zero(), BN_is_one() BN_is_word(), BN_abs_is_word() and BN_is_odd() return 1 if the condition is true, 0 otherwise.

BN_are_coprime() returns 1 if the BIGNUM's are coprime, otherwise it returns 0.

"},{"location":"man3/BN_cmp/#history","title":"HISTORY","text":"

Prior to OpenSSL 1.1.0, BN_is_zero(), BN_is_one(), BN_is_word(), BN_abs_is_word() and BN_is_odd() were macros.

The function BN_are_coprime() was added in OpenSSL 3.1.

"},{"location":"man3/BN_cmp/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_copy/","title":"BN_copy","text":""},{"location":"man3/BN_copy/#name","title":"NAME","text":"

BN_copy, BN_dup, BN_with_flags - copy BIGNUMs

"},{"location":"man3/BN_copy/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nBIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from);\n\nBIGNUM *BN_dup(const BIGNUM *from);\n\nvoid BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);\n
"},{"location":"man3/BN_copy/#description","title":"DESCRIPTION","text":"

BN_copy() copies from to to. BN_dup() creates a new BIGNUM containing the value from.

BN_with_flags creates a temporary shallow copy of b in dest. It places significant restrictions on the copied data. Applications that do no adhere to these restrictions may encounter unexpected side effects or crashes. For that reason use of this function is discouraged. Any flags provided in flags will be set in dest in addition to any flags already set in b. For example this might commonly be used to create a temporary copy of a BIGNUM with the BN_FLG_CONSTTIME flag set for constant time operations. The temporary copy in dest will share some internal state with b. For this reason the following restrictions apply to the use of dest:

  • dest should be a newly allocated BIGNUM obtained via a call to BN_new(). It should not have been used for other purposes or initialised in any way.
  • dest must only be used in \"read-only\" operations, i.e. typically those functions where the relevant parameter is declared \"const\".
  • dest must be used and freed before any further subsequent use of b
"},{"location":"man3/BN_copy/#return-values","title":"RETURN VALUES","text":"

BN_copy() returns to on success, NULL on error. BN_dup() returns the new BIGNUM, and NULL on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_copy/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/BN_copy/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_generate_prime/","title":"BN_generate_prime","text":""},{"location":"man3/BN_generate_prime/#name","title":"NAME","text":"

BN_generate_prime_ex2, BN_generate_prime_ex, BN_is_prime_ex, BN_check_prime, BN_is_prime_fasttest_ex, BN_GENCB_call, BN_GENCB_new, BN_GENCB_free, BN_GENCB_set_old, BN_GENCB_set, BN_GENCB_get_arg, BN_generate_prime, BN_is_prime, BN_is_prime_fasttest - generate primes and test for primality

"},{"location":"man3/BN_generate_prime/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe,\n                          const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb,\n                          BN_CTX *ctx);\n\nint BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,\n                         const BIGNUM *rem, BN_GENCB *cb);\n\nint BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb);\n\nint BN_GENCB_call(BN_GENCB *cb, int a, int b);\n\nBN_GENCB *BN_GENCB_new(void);\n\nvoid BN_GENCB_free(BN_GENCB *cb);\n\nvoid BN_GENCB_set_old(BN_GENCB *gencb,\n                      void (*callback)(int, int, void *), void *cb_arg);\n\nvoid BN_GENCB_set(BN_GENCB *gencb,\n                  int (*callback)(int, int, BN_GENCB *), void *cb_arg);\n\nvoid *BN_GENCB_get_arg(BN_GENCB *cb);\n

The following functions have been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

BIGNUM *BN_generate_prime(BIGNUM *ret, int num, int safe, BIGNUM *add,\n                          BIGNUM *rem, void (*callback)(int, int, void *),\n                          void *cb_arg);\n\nint BN_is_prime(const BIGNUM *p, int nchecks,\n                void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg);\n\nint BN_is_prime_fasttest(const BIGNUM *p, int nchecks,\n                         void (*callback)(int, int, void *), BN_CTX *ctx,\n                         void *cb_arg, int do_trial_division);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);\n\nint BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,\n                            int do_trial_division, BN_GENCB *cb);\n
"},{"location":"man3/BN_generate_prime/#description","title":"DESCRIPTION","text":"

BN_generate_prime_ex2() generates a pseudo-random prime number of at least bit length bits using the BN_CTX provided in ctx. The value of ctx must not be NULL.

The returned number is probably prime with a negligible error. The maximum error rate is 2^-128. It's 2^-287 for a 512 bit prime, 2^-435 for a 1024 bit prime, 2^-648 for a 2048 bit prime, and lower than 2^-882 for primes larger than 2048 bit.

If add is NULL the returned prime number will have exact bit length bits with the top most two bits set.

If ret is not NULL, it will be used to store the number.

If cb is not NULL, it is used as follows:

  • BN_GENCB_call(cb, 0, i) is called after generating the i-th potential prime number.
  • While the number is being tested for primality, BN_GENCB_call(cb, 1, j) is called as described below.
  • When a prime has been found, BN_GENCB_call(cb, 2, i) is called.
  • The callers of BN_generate_prime_ex() may call BN_GENCB_call(cb, i, j) with other values as described in their respective man pages; see \"SEE ALSO\".

The prime may have to fulfill additional requirements for use in Diffie-Hellman key exchange:

If add is not NULL, the prime will fulfill the condition p % add == rem (p % add == 1 if rem == NULL) in order to suit a given generator.

If safe is true, it will be a safe prime (i.e. a prime p so that (p-1)/2 is also prime). If safe is true, and rem == NULL the condition will be p % add == 3. It is recommended that add is a multiple of 4.

The random generator must be seeded prior to calling BN_generate_prime_ex(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail. The random number generator configured for the OSSL_LIB_CTX associated with ctx will be used.

BN_generate_prime_ex() is the same as BN_generate_prime_ex2() except that no ctx parameter is passed. In this case the random number generator associated with the default OSSL_LIB_CTX will be used.

BN_check_prime(), BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime() and BN_is_prime_fasttest() test if the number p is prime. The functions tests until one of the tests shows that p is composite, or all the tests passed. If p passes all these tests, it is considered a probable prime.

The test performed on p are trial division by a number of small primes and rounds of the of the Miller-Rabin probabilistic primality test.

The functions do at least 64 rounds of the Miller-Rabin test giving a maximum false positive rate of 2^-128. If the size of p is more than 2048 bits, they do at least 128 rounds giving a maximum false positive rate of 2^-256.

If nchecks is larger than the minimum above (64 or 128), nchecks rounds of the Miller-Rabin test will be done.

If do_trial_division set to 0, the trial division will be skipped. BN_is_prime_ex() and BN_is_prime() always skip the trial division.

BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime() and BN_is_prime_fasttest() are deprecated.

BN_is_prime_fasttest() and BN_is_prime() behave just like BN_is_prime_fasttest_ex() and BN_is_prime_ex() respectively, but with the old style call back.

ctx is a preallocated BN_CTX (to save the overhead of allocating and freeing the structure in a loop), or NULL.

If the trial division is done, and no divisors are found and cb is not NULL, BN_GENCB_call(cb, 1, -1) is called.

After each round of the Miller-Rabin probabilistic primality test, if cb is not NULL, BN_GENCB_call(cb, 1, j) is called with j the iteration (j = 0, 1, ...).

BN_GENCB_call() calls the callback function held in the BN_GENCB structure and passes the ints a and b as arguments. There are two types of BN_GENCB structure that are supported: \"new\" style and \"old\" style. New programs should prefer the \"new\" style, whilst the \"old\" style is provided for backwards compatibility purposes.

A BN_GENCB structure should be created through a call to BN_GENCB_new(), and freed through a call to BN_GENCB_free(). If the argument is NULL, nothing is done.

For \"new\" style callbacks a BN_GENCB structure should be initialised with a call to BN_GENCB_set(), where gencb is a BN_GENCB *, callback is of type int (*callback)(int, int, BN_GENCB *) and cb_arg is a void *. \"Old\" style callbacks are the same except they are initialised with a call to BN_GENCB_set_old() and callback is of type void (*callback)(int, int, void *).

A callback is invoked through a call to BN_GENCB_call. This will check the type of the callback and will invoke callback(a, b, gencb) for new style callbacks or callback(a, b, cb_arg) for old style.

It is possible to obtain the argument associated with a BN_GENCB structure (set via a call to BN_GENCB_set or BN_GENCB_set_old) using BN_GENCB_get_arg.

BN_generate_prime() (deprecated) works in the same way as BN_generate_prime_ex() but expects an old-style callback function directly in the callback parameter, and an argument to pass to it in the cb_arg. BN_is_prime() and BN_is_prime_fasttest() can similarly be compared to BN_is_prime_ex() and BN_is_prime_fasttest_ex(), respectively.

"},{"location":"man3/BN_generate_prime/#return-values","title":"RETURN VALUES","text":"

BN_generate_prime_ex() return 1 on success or 0 on error.

BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime(), BN_is_prime_fasttest() and BN_check_prime return 0 if the number is composite, 1 if it is prime with an error probability of less than 0.25^nchecks, and -1 on error.

BN_generate_prime() returns the prime number on success, NULL otherwise.

BN_GENCB_new returns a pointer to a BN_GENCB structure on success, or NULL otherwise.

BN_GENCB_get_arg returns the argument previously associated with a BN_GENCB structure.

Callback functions should return 1 on success or 0 on error.

The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_generate_prime/#removed-functionality","title":"REMOVED FUNCTIONALITY","text":"

As of OpenSSL 1.1.0 it is no longer possible to create a BN_GENCB structure directly, as in:

BN_GENCB callback;\n

Instead applications should create a BN_GENCB structure using BN_GENCB_new:

BN_GENCB *callback;\ncallback = BN_GENCB_new();\nif (!callback)\n    /* error */\n...\nBN_GENCB_free(callback);\n
"},{"location":"man3/BN_generate_prime/#see-also","title":"SEE ALSO","text":"

DH_generate_parameters(3), DSA_generate_parameters(3), RSA_generate_key(3), ERR_get_error(3), RAND_bytes(3), RAND(7)

"},{"location":"man3/BN_generate_prime/#history","title":"HISTORY","text":"

The BN_is_prime_ex() and BN_is_prime_fasttest_ex() functions were deprecated in OpenSSL 3.0.

The BN_GENCB_new(), BN_GENCB_free(), and BN_GENCB_get_arg() functions were added in OpenSSL 1.1.0.

BN_check_prime() was added in OpenSSL 3.0.

"},{"location":"man3/BN_generate_prime/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_mod_exp_mont/","title":"BN_mod_exp_mont","text":""},{"location":"man3/BN_mod_exp_mont/#name","title":"NAME","text":"

BN_mod_exp_mont, BN_mod_exp_mont_consttime, BN_mod_exp_mont_consttime_x2 - Montgomery exponentiation

"},{"location":"man3/BN_mod_exp_mont/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,\n                    const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);\n\nint BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,\n                              const BIGNUM *m, BN_CTX *ctx,\n                              BN_MONT_CTX *in_mont);\n\nint BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1,\n                                 const BIGNUM *p1, const BIGNUM *m1,\n                                 BN_MONT_CTX *in_mont1, BIGNUM *rr2,\n                                 const BIGNUM *a2, const BIGNUM *p2,\n                                 const BIGNUM *m2, BN_MONT_CTX *in_mont2,\n                                 BN_CTX *ctx);\n
"},{"location":"man3/BN_mod_exp_mont/#description","title":"DESCRIPTION","text":"

BN_mod_exp_mont() computes a to the p-th power modulo m (rr=a^p % m) using Montgomery multiplication. in_mont is a Montgomery context and can be NULL. In the case in_mont is NULL, it will be initialized within the function, so you can save time on initialization if you provide it in advance.

BN_mod_exp_mont_consttime() computes a to the p-th power modulo m (rr=a^p % m) using Montgomery multiplication. It is a variant of BN_mod_exp_mont(3) that uses fixed windows and the special precomputation memory layout to limit data-dependency to a minimum to protect secret exponents. It is called automatically when BN_mod_exp_mont(3) is called with parameters a, p, m, any of which have BN_FLG_CONSTTIME flag.

BN_mod_exp_mont_consttime_x2() computes two independent exponentiations a1 to the p1-th power modulo m1 (rr1=a1^p1 % m1) and a2 to the p2-th power modulo m2 (rr2=a2^p2 % m2) using Montgomery multiplication. For some fixed and equal modulus sizes m1 and m2 it uses optimizations that allow to speedup two exponentiations. In all other cases the function reduces to two calls of BN_mod_exp_mont_consttime(3).

"},{"location":"man3/BN_mod_exp_mont/#return-values","title":"RETURN VALUES","text":"

For all functions 1 is returned for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_mod_exp_mont/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_mod_exp_mont(3)

"},{"location":"man3/BN_mod_exp_mont/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_mod_inverse/","title":"BN_mod_inverse","text":""},{"location":"man3/BN_mod_inverse/#name","title":"NAME","text":"

BN_mod_inverse - compute inverse modulo n

"},{"location":"man3/BN_mod_inverse/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nBIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n,\n                       BN_CTX *ctx);\n
"},{"location":"man3/BN_mod_inverse/#description","title":"DESCRIPTION","text":"

BN_mod_inverse() computes the inverse of a modulo n places the result in r ((a*r)%n==1). If r is NULL, a new BIGNUM is created.

ctx is a previously allocated BN_CTX used for temporary variables. r may be the same BIGNUM as a.

"},{"location":"man3/BN_mod_inverse/#notes","title":"NOTES","text":"

It is an error to use the same BIGNUM as n.

"},{"location":"man3/BN_mod_inverse/#return-values","title":"RETURN VALUES","text":"

BN_mod_inverse() returns the BIGNUM containing the inverse, and NULL on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_mod_inverse/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_add(3)

"},{"location":"man3/BN_mod_inverse/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_mod_mul_montgomery/","title":"BN_mod_mul_montgomery","text":""},{"location":"man3/BN_mod_mul_montgomery/#name","title":"NAME","text":"

BN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy, BN_from_montgomery, BN_to_montgomery - Montgomery multiplication

"},{"location":"man3/BN_mod_mul_montgomery/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nBN_MONT_CTX *BN_MONT_CTX_new(void);\nvoid BN_MONT_CTX_free(BN_MONT_CTX *mont);\n\nint BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx);\nBN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);\n\nint BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,\n                          BN_MONT_CTX *mont, BN_CTX *ctx);\n\nint BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont,\n                       BN_CTX *ctx);\n\nint BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont,\n                     BN_CTX *ctx);\n
"},{"location":"man3/BN_mod_mul_montgomery/#description","title":"DESCRIPTION","text":"

These functions implement Montgomery multiplication. They are used automatically when BN_mod_exp(3) is called with suitable input, but they may be useful when several operations are to be performed using the same modulus.

BN_MONT_CTX_new() allocates and initializes a BN_MONT_CTX structure.

BN_MONT_CTX_set() sets up the mont structure from the modulus m by precomputing its inverse and a value R.

BN_MONT_CTX_copy() copies the BN_MONT_CTX from to to.

BN_MONT_CTX_free() frees the components of the BN_MONT_CTX, and, if it was created by BN_MONT_CTX_new(), also the structure itself. If mont is NULL, nothing is done.

BN_mod_mul_montgomery() computes Mont(a,b):=a*b*R^-1 and places the result in r.

BN_from_montgomery() performs the Montgomery reduction r = a*R^-1.

BN_to_montgomery() computes Mont(a,R^2), i.e. a*R. Note that a must be nonnegative and smaller than the modulus.

For all functions, ctx is a previously allocated BN_CTX used for temporary variables.

"},{"location":"man3/BN_mod_mul_montgomery/#return-values","title":"RETURN VALUES","text":"

BN_MONT_CTX_new() returns the newly allocated BN_MONT_CTX, and NULL on error.

BN_MONT_CTX_free() has no return value.

For the other functions, 1 is returned for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_mod_mul_montgomery/#warnings","title":"WARNINGS","text":"

The inputs must be reduced modulo m, otherwise the result will be outside the expected range.

"},{"location":"man3/BN_mod_mul_montgomery/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_add(3), BN_CTX_new(3)

"},{"location":"man3/BN_mod_mul_montgomery/#history","title":"HISTORY","text":"

BN_MONT_CTX_init() was removed in OpenSSL 1.1.0

"},{"location":"man3/BN_mod_mul_montgomery/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_mod_mul_reciprocal/","title":"BN_mod_mul_reciprocal","text":""},{"location":"man3/BN_mod_mul_reciprocal/#name","title":"NAME","text":"

BN_mod_mul_reciprocal, BN_div_recp, BN_RECP_CTX_new, BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using reciprocal

"},{"location":"man3/BN_mod_mul_reciprocal/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nBN_RECP_CTX *BN_RECP_CTX_new(void);\nvoid BN_RECP_CTX_free(BN_RECP_CTX *recp);\n\nint BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx);\n\nint BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, BN_RECP_CTX *recp,\n                BN_CTX *ctx);\n\nint BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n                          BN_RECP_CTX *recp, BN_CTX *ctx);\n
"},{"location":"man3/BN_mod_mul_reciprocal/#description","title":"DESCRIPTION","text":"

BN_mod_mul_reciprocal() can be used to perform an efficient BN_mod_mul(3) operation when the operation will be performed repeatedly with the same modulus. It computes r=(a*b)%m using recp=1/m, which is set as described below. ctx is a previously allocated BN_CTX used for temporary variables.

BN_RECP_CTX_new() allocates and initializes a BN_RECP structure.

BN_RECP_CTX_free() frees the components of the BN_RECP, and, if it was created by BN_RECP_CTX_new(), also the structure itself. If recp is NULL, nothing is done.

BN_RECP_CTX_set() stores m in recp and sets it up for computing 1/m and shifting it left by BN_num_bits(m)+1 to make it an integer. The result and the number of bits it was shifted left will later be stored in recp.

BN_div_recp() divides a by m using recp. It places the quotient in dv and the remainder in rem.

The BN_RECP_CTX structure cannot be shared between threads.

"},{"location":"man3/BN_mod_mul_reciprocal/#return-values","title":"RETURN VALUES","text":"

BN_RECP_CTX_new() returns the newly allocated BN_RECP_CTX, and NULL on error.

BN_RECP_CTX_free() has no return value.

For the other functions, 1 is returned for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_mod_mul_reciprocal/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), BN_add(3), BN_CTX_new(3)

"},{"location":"man3/BN_mod_mul_reciprocal/#history","title":"HISTORY","text":"

BN_RECP_CTX_init() was removed in OpenSSL 1.1.0

"},{"location":"man3/BN_mod_mul_reciprocal/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_new/","title":"BN_new","text":""},{"location":"man3/BN_new/#name","title":"NAME","text":"

BN_new, BN_secure_new, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs

"},{"location":"man3/BN_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nBIGNUM *BN_new(void);\n\nBIGNUM *BN_secure_new(void);\n\nvoid BN_clear(BIGNUM *a);\n\nvoid BN_free(BIGNUM *a);\n\nvoid BN_clear_free(BIGNUM *a);\n
"},{"location":"man3/BN_new/#description","title":"DESCRIPTION","text":"

BN_new() allocates and initializes a BIGNUM structure. BN_secure_new() does the same except that the secure heap OPENSSL_secure_malloc(3) is used to store the value.

BN_clear() is used to destroy sensitive data such as keys when they are no longer needed. It erases the memory used by a and sets it to the value 0. If a is NULL, nothing is done.

BN_free() frees the components of the BIGNUM, and if it was created by BN_new(), also the structure itself. BN_clear_free() additionally overwrites the data before the memory is returned to the system. If a is NULL, nothing is done.

"},{"location":"man3/BN_new/#return-values","title":"RETURN VALUES","text":"

BN_new() and BN_secure_new() return a pointer to the BIGNUM initialised to the value 0. If the allocation fails, they return NULL and set an error code that can be obtained by ERR_get_error(3).

BN_clear(), BN_free() and BN_clear_free() have no return values.

"},{"location":"man3/BN_new/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), OPENSSL_secure_malloc(3)

"},{"location":"man3/BN_new/#history","title":"HISTORY","text":"

BN_init() was removed in OpenSSL 1.1.0; use BN_new() instead.

"},{"location":"man3/BN_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_num_bytes/","title":"BN_num_bytes","text":""},{"location":"man3/BN_num_bytes/#name","title":"NAME","text":"

BN_num_bits, BN_num_bytes, BN_num_bits_word - get BIGNUM size

"},{"location":"man3/BN_num_bytes/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_num_bytes(const BIGNUM *a);\n\nint BN_num_bits(const BIGNUM *a);\n\nint BN_num_bits_word(BN_ULONG w);\n
"},{"location":"man3/BN_num_bytes/#description","title":"DESCRIPTION","text":"

BN_num_bytes() returns the size of a BIGNUM in bytes.

BN_num_bits_word() returns the number of significant bits in a word. If we take 0x00000432 as an example, it returns 11, not 16, not 32. Basically, except for a zero, it returns floor(log2(w))+1.

BN_num_bits() returns the number of significant bits in a BIGNUM, following the same principle as BN_num_bits_word().

BN_num_bytes() is a macro.

"},{"location":"man3/BN_num_bytes/#return-values","title":"RETURN VALUES","text":"

The size.

"},{"location":"man3/BN_num_bytes/#notes","title":"NOTES","text":"

Some have tried using BN_num_bits() on individual numbers in RSA keys, DH keys and DSA keys, and found that they don't always come up with the number of bits they expected (something like 512, 1024, 2048, ...). This is because generating a number with some specific number of bits doesn't always set the highest bits, thereby making the number of significant bits a little lower. If you want to know the \"key size\" of such a key, either use functions like RSA_size(), DH_size() and DSA_size(), or use BN_num_bytes() and multiply with 8 (although there's no real guarantee that will match the \"key size\", just a lot more probability).

"},{"location":"man3/BN_num_bytes/#see-also","title":"SEE ALSO","text":"

DH_size(3), DSA_size(3), RSA_size(3)

"},{"location":"man3/BN_num_bytes/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_rand/","title":"BN_rand","text":""},{"location":"man3/BN_rand/#name","title":"NAME","text":"

BN_rand_ex, BN_rand, BN_priv_rand_ex, BN_priv_rand, BN_pseudo_rand, BN_rand_range_ex, BN_rand_range, BN_priv_rand_range_ex, BN_priv_rand_range, BN_pseudo_rand_range - generate pseudo-random number

"},{"location":"man3/BN_rand/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,\n               unsigned int strength, BN_CTX *ctx);\nint BN_rand(BIGNUM *rnd, int bits, int top, int bottom);\n\nint BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,\n                    unsigned int strength, BN_CTX *ctx);\nint BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom);\n\nint BN_rand_range_ex(BIGNUM *rnd, const BIGNUM *range, unsigned int strength,\n                     BN_CTX *ctx);\nint BN_rand_range(BIGNUM *rnd, const BIGNUM *range);\n\nint BN_priv_rand_range_ex(BIGNUM *rnd, const BIGNUM *range, unsigned int strength,\n                          BN_CTX *ctx);\nint BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);\nint BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);\n
"},{"location":"man3/BN_rand/#description","title":"DESCRIPTION","text":"

BN_rand_ex() generates a cryptographically strong pseudo-random number of bits in length and security strength at least strength bits using the random number generator for the library context associated with ctx. The function stores the generated data in rnd. The parameter ctx may be NULL in which case the default library context is used. If bits is less than zero, or too small to accommodate the requirements specified by the top and bottom parameters, an error is returned. The top parameters specifies requirements on the most significant bit of the generated number. If it is BN_RAND_TOP_ANY, there is no constraint. If it is BN_RAND_TOP_ONE, the top bit must be one. If it is BN_RAND_TOP_TWO, the two most significant bits of the number will be set to 1, so that the product of two such random numbers will always have 2*bits length. If bottom is BN_RAND_BOTTOM_ODD, the number will be odd; if it is BN_RAND_BOTTOM_ANY it can be odd or even. If bits is 1 then top cannot also be BN_RAND_TOP_TWO.

BN_rand() is the same as BN_rand_ex() except that the default library context is always used.

BN_rand_range_ex() generates a cryptographically strong pseudo-random number rnd, of security strength at least strength bits, in the range 0 <= rnd < range using the random number generator for the library context associated with ctx. The parameter ctx may be NULL in which case the default library context is used.

BN_rand_range() is the same as BN_rand_range_ex() except that the default library context is always used.

BN_priv_rand_ex(), BN_priv_rand(), BN_priv_rand_rand_ex() and BN_priv_rand_range() have the same semantics as BN_rand_ex(), BN_rand(), BN_rand_range_ex() and BN_rand_range() respectively. They are intended to be used for generating values that should remain private, and mirror the same difference between RAND_bytes(3) and RAND_priv_bytes(3).

"},{"location":"man3/BN_rand/#notes","title":"NOTES","text":"

Always check the error return value of these functions and do not take randomness for granted: an error occurs if the CSPRNG has not been seeded with enough randomness to ensure an unpredictable byte sequence.

"},{"location":"man3/BN_rand/#return-values","title":"RETURN VALUES","text":"

The functions return 1 on success, 0 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_rand/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), RAND_add(3), RAND_bytes(3), RAND_priv_bytes(3), RAND(7), EVP_RAND(7)

"},{"location":"man3/BN_rand/#history","title":"HISTORY","text":"
  • Starting with OpenSSL release 1.1.0, BN_pseudo_rand() has been identical to BN_rand() and BN_pseudo_rand_range() has been identical to BN_rand_range(). The BN_pseudo_rand() and BN_pseudo_rand_range() functions were deprecated in OpenSSL 3.0.
  • The BN_priv_rand() and BN_priv_rand_range() functions were added in OpenSSL 1.1.1.
  • The BN_rand_ex(), BN_priv_rand_ex(), BN_rand_range_ex() and BN_priv_rand_range_ex() functions were added in OpenSSL 3.0.
"},{"location":"man3/BN_rand/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_security_bits/","title":"BN_security_bits","text":""},{"location":"man3/BN_security_bits/#name","title":"NAME","text":"

BN_security_bits - returns bits of security based on given numbers

"},{"location":"man3/BN_security_bits/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_security_bits(int L, int N);\n
"},{"location":"man3/BN_security_bits/#description","title":"DESCRIPTION","text":"

BN_security_bits() returns the number of bits of security provided by a specific algorithm and a particular key size. The bits of security is defined in NIST SP800-57. Currently, BN_security_bits() support two types of asymmetric algorithms: the FFC (Finite Field Cryptography) and IFC (Integer Factorization Cryptography). For FFC, e.g., DSA and DH, both parameters L and N are used to decide the bits of security, where L is the size of the public key and N is the size of the private key. For IFC, e.g., RSA, only L is used and it's commonly considered to be the key size (modulus).

"},{"location":"man3/BN_security_bits/#return-values","title":"RETURN VALUES","text":"

Number of security bits.

"},{"location":"man3/BN_security_bits/#notes","title":"NOTES","text":"

ECC (Elliptic Curve Cryptography) is not covered by the BN_security_bits() function. The symmetric algorithms are not covered neither.

"},{"location":"man3/BN_security_bits/#see-also","title":"SEE ALSO","text":"

DH_security_bits(3), DSA_security_bits(3), RSA_security_bits(3)

"},{"location":"man3/BN_security_bits/#history","title":"HISTORY","text":"

The BN_security_bits() function was added in OpenSSL 1.1.0.

"},{"location":"man3/BN_security_bits/#copyright","title":"COPYRIGHT","text":"

Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_set_bit/","title":"BN_set_bit","text":""},{"location":"man3/BN_set_bit/#name","title":"NAME","text":"

BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift, BN_lshift1, BN_rshift, BN_rshift1 - bit operations on BIGNUMs

"},{"location":"man3/BN_set_bit/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nint BN_set_bit(BIGNUM *a, int n);\nint BN_clear_bit(BIGNUM *a, int n);\n\nint BN_is_bit_set(const BIGNUM *a, int n);\n\nint BN_mask_bits(BIGNUM *a, int n);\n\nint BN_lshift(BIGNUM *r, const BIGNUM *a, int n);\nint BN_lshift1(BIGNUM *r, BIGNUM *a);\n\nint BN_rshift(BIGNUM *r, BIGNUM *a, int n);\nint BN_rshift1(BIGNUM *r, BIGNUM *a);\n
"},{"location":"man3/BN_set_bit/#description","title":"DESCRIPTION","text":"

BN_set_bit() sets bit n in a to 1 (a|=(1<<n)). The number is expanded if necessary.

BN_clear_bit() sets bit n in a to 0 (a&=~(1<<n)). An error occurs if a is shorter than n bits.

BN_is_bit_set() tests if bit n in a is set.

BN_mask_bits() truncates a to an n bit number (a&=~((~0)<<n)). An error occurs if n is negative. An error is also returned if the internal representation of a is already shorter than n bits. The internal representation depends on the platform's word size, and this error can be safely ignored. Use BN_num_bits(3) to determine the exact number of bits if needed.

BN_lshift() shifts a left by n bits and places the result in r (r=a*2^n). Note that n must be nonnegative. BN_lshift1() shifts a left by one and places the result in r (r=2*a).

BN_rshift() shifts a right by n bits and places the result in r (r=a/2^n). Note that n must be nonnegative. BN_rshift1() shifts a right by one and places the result in r (r=a/2).

For the shift functions, r and a may be the same variable.

"},{"location":"man3/BN_set_bit/#return-values","title":"RETURN VALUES","text":"

BN_is_bit_set() returns 1 if the bit is set, 0 otherwise.

All other functions return 1 for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/BN_set_bit/#see-also","title":"SEE ALSO","text":"

BN_num_bytes(3), BN_add(3)

"},{"location":"man3/BN_set_bit/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_swap/","title":"BN_swap","text":""},{"location":"man3/BN_swap/#name","title":"NAME","text":"

BN_swap - exchange BIGNUMs

"},{"location":"man3/BN_swap/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nvoid BN_swap(BIGNUM *a, BIGNUM *b);\n
"},{"location":"man3/BN_swap/#description","title":"DESCRIPTION","text":"

BN_swap() exchanges the values of a and b.

"},{"location":"man3/BN_swap/#return-values","title":"RETURN VALUES","text":"

BN_swap() does not return a value.

"},{"location":"man3/BN_swap/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BN_zero/","title":"BN_zero","text":""},{"location":"man3/BN_zero/#name","title":"NAME","text":"

BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word - BIGNUM assignment operations

"},{"location":"man3/BN_zero/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/bn.h>\n\nvoid BN_zero(BIGNUM *a);\nint BN_one(BIGNUM *a);\n\nconst BIGNUM *BN_value_one(void);\n\nint BN_set_word(BIGNUM *a, BN_ULONG w);\nunsigned BN_ULONG BN_get_word(BIGNUM *a);\n
"},{"location":"man3/BN_zero/#description","title":"DESCRIPTION","text":"

BN_ULONG is a macro that will be an unsigned integral type optimized for the most efficient implementation on the local platform.

BN_zero(), BN_one() and BN_set_word() set a to the values 0, 1 and w respectively. BN_zero() and BN_one() are macros.

BN_value_one() returns a BIGNUM constant of value 1. This constant is useful for use in comparisons and assignment.

BN_get_word() returns a, if it can be represented as a BN_ULONG.

"},{"location":"man3/BN_zero/#return-values","title":"RETURN VALUES","text":"

BN_get_word() returns the value a, or all-bits-set if a cannot be represented as a single integer.

BN_one() and BN_set_word() return 1 on success, 0 otherwise. BN_value_one() returns the constant. BN_zero() never fails and returns no value.

"},{"location":"man3/BN_zero/#bugs","title":"BUGS","text":"

If a BIGNUM is equal to the value of all-bits-set, it will collide with the error condition returned by BN_get_word() which uses that as an error value.

BN_ULONG should probably be a typedef.

"},{"location":"man3/BN_zero/#see-also","title":"SEE ALSO","text":"

BN_bn2bin(3)

"},{"location":"man3/BN_zero/#history","title":"HISTORY","text":"

In OpenSSL 0.9.8, BN_zero() was changed to not return a value; previous versions returned an int.

"},{"location":"man3/BN_zero/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/BUF_MEM_new/","title":"BUF_MEM_new","text":""},{"location":"man3/BUF_MEM_new/#name","title":"NAME","text":"

BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow, BUF_MEM_grow_clean, BUF_reverse - simple character array structure

"},{"location":"man3/BUF_MEM_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/buffer.h>\n\nBUF_MEM *BUF_MEM_new(void);\n\nBUF_MEM *BUF_MEM_new_ex(unsigned long flags);\n\nvoid BUF_MEM_free(BUF_MEM *a);\n\nint BUF_MEM_grow(BUF_MEM *str, int len);\nsize_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);\n\nvoid BUF_reverse(unsigned char *out, const unsigned char *in, size_t size);\n
"},{"location":"man3/BUF_MEM_new/#description","title":"DESCRIPTION","text":"

The buffer library handles simple character arrays. Buffers are used for various purposes in the library, most notably memory BIOs.

BUF_MEM_new() allocates a new buffer of zero size.

BUF_MEM_new_ex() allocates a buffer with the specified flags. The flag BUF_MEM_FLAG_SECURE specifies that the data pointer should be allocated on the secure heap; see CRYPTO_secure_malloc(3).

BUF_MEM_free() frees up an already existing buffer. The data is zeroed before freeing up in case the buffer contains sensitive data. If the argument is NULL, nothing is done.

BUF_MEM_grow() changes the size of an already existing buffer to len. Any data already in the buffer is preserved if it increases in size.

BUF_MEM_grow_clean() is similar to BUF_MEM_grow() but it sets any free'd or additionally-allocated memory to zero.

BUF_reverse() reverses size bytes at in into out. If in is NULL, the array is reversed in-place.

"},{"location":"man3/BUF_MEM_new/#return-values","title":"RETURN VALUES","text":"

BUF_MEM_new() returns the buffer or NULL on error.

BUF_MEM_free() has no return value.

BUF_MEM_grow() and BUF_MEM_grow_clean() return zero on error or the new size (i.e., len).

"},{"location":"man3/BUF_MEM_new/#see-also","title":"SEE ALSO","text":"

bio(7), CRYPTO_secure_malloc(3).

"},{"location":"man3/BUF_MEM_new/#history","title":"HISTORY","text":"

The BUF_MEM_new_ex() function was added in OpenSSL 1.1.0.

"},{"location":"man3/BUF_MEM_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_EncryptedData_decrypt/","title":"CMS_EncryptedData_decrypt","text":""},{"location":"man3/CMS_EncryptedData_decrypt/#name","title":"NAME","text":"

CMS_EncryptedData_decrypt - Decrypt CMS EncryptedData

"},{"location":"man3/CMS_EncryptedData_decrypt/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,\n                              const unsigned char *key, size_t keylen,\n                              BIO *dcont, BIO *out, unsigned int flags);\n
"},{"location":"man3/CMS_EncryptedData_decrypt/#description","title":"DESCRIPTION","text":"

CMS_EncryptedData_decrypt() decrypts a cms EncryptedData object using the symmetric key of size keylen bytes. out is a BIO to write the content to and flags is an optional set of flags. dcont is used in the rare case where the encrypted content is detached. It will normally be set to NULL.

The following flags can be passed in the flags parameter.

If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

"},{"location":"man3/CMS_EncryptedData_decrypt/#return-values","title":"RETURN VALUES","text":"

CMS_EncryptedData_decrypt() returns 0 if an error occurred otherwise it returns 1.

"},{"location":"man3/CMS_EncryptedData_decrypt/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_EncryptedData_encrypt(3)

"},{"location":"man3/CMS_EncryptedData_decrypt/#copyright","title":"COPYRIGHT","text":"

Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_EncryptedData_encrypt/","title":"CMS_EncryptedData_encrypt","text":""},{"location":"man3/CMS_EncryptedData_encrypt/#name","title":"NAME","text":"

CMS_EncryptedData_encrypt_ex, CMS_EncryptedData_encrypt - Create CMS EncryptedData

"},{"location":"man3/CMS_EncryptedData_encrypt/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in,\n                                              const EVP_CIPHER *cipher,\n                                              const unsigned char *key,\n                                              size_t keylen,\n                                              unsigned int flags,\n                                              OSSL_LIB_CTX *ctx,\n                                              const char *propq);\n\nCMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in,\n    const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen,\n    unsigned int flags);\n
"},{"location":"man3/CMS_EncryptedData_encrypt/#description","title":"DESCRIPTION","text":"

CMS_EncryptedData_encrypt_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_encrypted. in is a BIO containing the data to encrypt using cipher and the encryption key key of size keylen bytes. The library context libctx and the property query propq are used when retrieving algorithms from providers. flags is a set of optional flags.

The flags field supports the options CMS_DETACHED, CMS_STREAM and CMS_PARTIAL. Internally CMS_final() is called unless CMS_STREAM and/or CMS_PARTIAL is specified.

The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters.

The CMS_ContentInfo structure can be freed using CMS_ContentInfo_free(3).

CMS_EncryptedData_encrypt() is similar to CMS_EncryptedData_encrypt_ex() but uses default values of NULL for the library context libctx and the property query propq.

"},{"location":"man3/CMS_EncryptedData_encrypt/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, CMS_EncryptedData_encrypt_ex() and CMS_EncryptedData_encrypt() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

"},{"location":"man3/CMS_EncryptedData_encrypt/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_final(3), CMS_EncryptedData_decrypt(3)

"},{"location":"man3/CMS_EncryptedData_encrypt/#history","title":"HISTORY","text":"

The CMS_EncryptedData_encrypt_ex() method was added in OpenSSL 3.0.

"},{"location":"man3/CMS_EncryptedData_encrypt/#copyright","title":"COPYRIGHT","text":"

Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_EnvelopedData_create/","title":"CMS_EnvelopedData_create","text":""},{"location":"man3/CMS_EnvelopedData_create/#name","title":"NAME","text":"

CMS_EnvelopedData_create_ex, CMS_EnvelopedData_create, CMS_AuthEnvelopedData_create, CMS_AuthEnvelopedData_create_ex - Create CMS envelope

"},{"location":"man3/CMS_EnvelopedData_create/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *\nCMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,\n                            const char *propq);\nCMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);\n\nCMS_ContentInfo *\nCMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,\n                                const char *propq);\nCMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher);\n
"},{"location":"man3/CMS_EnvelopedData_create/#description","title":"DESCRIPTION","text":"

CMS_EnvelopedData_create_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_enveloped. cipher is the symmetric cipher to use. The library context libctx and the property query propq are used when retrieving algorithms from providers.

CMS_AuthEnvelopedData_create_ex() creates a CMS_ContentInfo structure with a type NID_id_smime_ct_authEnvelopedData. cipher is the symmetric AEAD cipher to use. Currently only AES variants with GCM mode are supported. The library context libctx and the property query propq are used when retrieving algorithms from providers.

The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters.

The recipients can be added later using CMS_add1_recipient_cert(3) or CMS_add0_recipient_key(3).

The CMS_ContentInfo structure needs to be finalized using CMS_final(3) and then freed using CMS_ContentInfo_free(3).

CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create are similar to CMS_EnvelopedData_create_ex() and CMS_AuthEnvelopedData_create_ex() but use default values of NULL for the library context libctx and the property query propq.

"},{"location":"man3/CMS_EnvelopedData_create/#notes","title":"NOTES","text":"

Although CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() allocate a new CMS_ContentInfo structure, they are not usually used in applications. The wrappers CMS_encrypt(3) and CMS_decrypt(3) are often used instead.

"},{"location":"man3/CMS_EnvelopedData_create/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

"},{"location":"man3/CMS_EnvelopedData_create/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_encrypt(3), CMS_decrypt(3), CMS_final(3)

"},{"location":"man3/CMS_EnvelopedData_create/#history","title":"HISTORY","text":"

The CMS_EnvelopedData_create_ex() method was added in OpenSSL 3.0.

"},{"location":"man3/CMS_EnvelopedData_create/#copyright","title":"COPYRIGHT","text":"

Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_add0_cert/","title":"CMS_add0_cert","text":""},{"location":"man3/CMS_add0_cert/#name","title":"NAME","text":"

CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_add1_crl, CMS_get1_crls - CMS certificate and CRL utility functions

"},{"location":"man3/CMS_add0_cert/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);\nint CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);\nSTACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);\n\nint CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);\nint CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);\nSTACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);\n
"},{"location":"man3/CMS_add0_cert/#description","title":"DESCRIPTION","text":"

CMS_add0_cert() and CMS_add1_cert() add certificate cert to cms. This is used by CMS_sign_ex(3) and CMS_sign(3) and may be used before calling CMS_verify(3) to help chain building in certificate validation. cms must be of type signed data or (authenticated) enveloped data. For signed data, such a certificate can be used when signing or verifying to fill in the signer certificate or to provide an extra CA certificate that may be needed for chain building in certificate validation.

CMS_get1_certs() returns all certificates in cms.

CMS_add0_crl() and CMS_add1_crl() add CRL crl to cms. cms must be of type signed data or (authenticated) enveloped data. For signed data, such a CRL may be used in certificate validation with CMS_verify(3). It may be given both for inclusion when signing a CMS message and when verifying a signed CMS message.

CMS_get1_crls() returns all CRLs in cms.

"},{"location":"man3/CMS_add0_cert/#notes","title":"NOTES","text":"

The CMS_ContentInfo structure cms must be of type signed data or enveloped data or an error will be returned.

For signed data certificates and CRLs are added to the certificates and crls fields of SignedData structure. For enveloped data they are added to OriginatorInfo.

As the 0 implies CMS_add0_cert() adds cert internally to cms and it must not be freed up after the call as opposed to CMS_add1_cert() where cert must be freed up.

The same certificate must not be added to the same cms structure more than once.

"},{"location":"man3/CMS_add0_cert/#return-values","title":"RETURN VALUES","text":"

CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return 1 for success and 0 for failure.

CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs or NULL if there are none or an error occurs. The only error which will occur in practice is if the cms type is invalid.

"},{"location":"man3/CMS_add0_cert/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_sign(3), CMS_sign_ex(3), CMS_verify(3), CMS_encrypt(3)

"},{"location":"man3/CMS_add0_cert/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_add1_recipient_cert/","title":"CMS_add1_recipient_cert","text":""},{"location":"man3/CMS_add1_recipient_cert/#name","title":"NAME","text":"

CMS_add1_recipient, CMS_add1_recipient_cert, CMS_add0_recipient_key - add recipients to a CMS enveloped data structure

"},{"location":"man3/CMS_add1_recipient_cert/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,\n                                      EVP_PKEY *originatorPrivKey,\n                                      X509 *originator, unsigned int flags);\n\nCMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,\n                                           X509 *recip, unsigned int flags);\n\nCMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,\n                                          unsigned char *key, size_t keylen,\n                                          unsigned char *id, size_t idlen,\n                                          ASN1_GENERALIZEDTIME *date,\n                                          ASN1_OBJECT *otherTypeId,\n                                          ASN1_TYPE *otherType);\n
"},{"location":"man3/CMS_add1_recipient_cert/#description","title":"DESCRIPTION","text":"

CMS_add1_recipient() adds recipient recip and provides the originator pkey originatorPrivKey and originator certificate originator to CMS_ContentInfo. The originator-related fields are relevant only in case when the keyAgreement method of providing of the shared key is in use.

CMS_add1_recipient_cert() adds recipient recip to CMS_ContentInfo enveloped data structure cms as a KeyTransRecipientInfo structure.

CMS_add0_recipient_key() adds symmetric key key of length keylen using wrapping algorithm nid, identifier id of length idlen and optional values date, otherTypeId and otherType to CMS_ContentInfo enveloped data structure cms as a KEKRecipientInfo structure.

The CMS_ContentInfo structure should be obtained from an initial call to CMS_encrypt() with the flag CMS_PARTIAL set.

"},{"location":"man3/CMS_add1_recipient_cert/#notes","title":"NOTES","text":"

The main purpose of this function is to provide finer control over a CMS enveloped data structure where the simpler CMS_encrypt() function defaults are not appropriate. For example if one or more KEKRecipientInfo structures need to be added. New attributes can also be added using the returned CMS_RecipientInfo structure and the CMS attribute utility functions.

OpenSSL will by default identify recipient certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if all recipient certificates do not have a subject key identifier extension.

Currently only AES based key wrapping algorithms are supported for nid, specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wrap. If nid is set to NID_undef then an AES wrap algorithm will be used consistent with keylen.

"},{"location":"man3/CMS_add1_recipient_cert/#return-values","title":"RETURN VALUES","text":"

CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal pointer to the CMS_RecipientInfo structure just added or NULL if an error occurs.

"},{"location":"man3/CMS_add1_recipient_cert/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_decrypt(3), CMS_final(3),

"},{"location":"man3/CMS_add1_recipient_cert/#history","title":"HISTORY","text":"

CMS_add1_recipient_cert and CMS_add0_recipient_key were added in OpenSSL 3.0.

"},{"location":"man3/CMS_add1_recipient_cert/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_add1_signer/","title":"CMS_add1_signer","text":""},{"location":"man3/CMS_add1_signer/#name","title":"NAME","text":"

CMS_add1_signer, CMS_SignerInfo_sign - add a signer to a CMS_ContentInfo signed data structure

"},{"location":"man3/CMS_add1_signer/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, X509 *signcert,\n                                EVP_PKEY *pkey, const EVP_MD *md,\n                                unsigned int flags);\n\nint CMS_SignerInfo_sign(CMS_SignerInfo *si);\n
"},{"location":"man3/CMS_add1_signer/#description","title":"DESCRIPTION","text":"

CMS_add1_signer() adds a signer with certificate signcert and private key pkey using message digest md to CMS_ContentInfo SignedData structure cms.

The CMS_ContentInfo structure should be obtained from an initial call to CMS_sign() with the flag CMS_PARTIAL set or in the case or re-signing a valid CMS_ContentInfo SignedData structure.

If the md parameter is NULL then the default digest for the public key algorithm will be used.

Unless the CMS_REUSE_DIGEST flag is set the returned CMS_ContentInfo structure is not complete and must be finalized either by streaming (if applicable) or a call to CMS_final().

The CMS_SignerInfo_sign() function explicitly signs a CMS_SignerInfo structure, its main use is when the CMS_REUSE_DIGEST and CMS_PARTIAL flags are both set.

"},{"location":"man3/CMS_add1_signer/#notes","title":"NOTES","text":"

The main purpose of CMS_add1_signer() is to provide finer control over a CMS signed data structure where the simpler CMS_sign() function defaults are not appropriate. For example if multiple signers or non default digest algorithms are needed. New attributes can also be added using the returned CMS_SignerInfo structure and the CMS attribute utility functions or the CMS signed receipt request functions.

Any of the following flags (ored together) can be passed in the flags parameter.

If CMS_REUSE_DIGEST is set then an attempt is made to copy the content digest value from the CMS_ContentInfo structure: to add a signer to an existing structure. An error occurs if a matching digest value cannot be found to copy. The returned CMS_ContentInfo structure will be valid and finalized when this flag is set.

If CMS_PARTIAL is set in addition to CMS_REUSE_DIGEST then the CMS_SignerInfo structure will not be finalized so additional attributes can be added. In this case an explicit call to CMS_SignerInfo_sign() is needed to finalize it.

If CMS_NOCERTS is set the signer's certificate will not be included in the CMS_ContentInfo structure, the signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signature if the signers certificate can be obtained by other means: for example a previously signed message.

The SignedData structure includes several CMS signedAttributes including the signing time, the CMS content type and the supported list of ciphers in an SMIMECapabilities attribute. If CMS_NOATTR is set then no signedAttributes will be used. If CMS_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

OpenSSL will by default identify signing certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if the signing certificate does not have a subject key identifier extension.

If present the SMIMECapabilities attribute indicates support for the following algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is not loaded.

CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo structure just added, this can be used to set additional attributes before it is finalized.

"},{"location":"man3/CMS_add1_signer/#return-values","title":"RETURN VALUES","text":"

CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo structure just added or NULL if an error occurs.

CMS_SignerInfo_sign() returns 1 on success, 0 on failure.

"},{"location":"man3/CMS_add1_signer/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_sign(3), CMS_final(3),

"},{"location":"man3/CMS_add1_signer/#copyright","title":"COPYRIGHT","text":"

Copyright 2014-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_compress/","title":"CMS_compress","text":""},{"location":"man3/CMS_compress/#name","title":"NAME","text":"

CMS_compress - create a CMS CompressedData structure

"},{"location":"man3/CMS_compress/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);\n
"},{"location":"man3/CMS_compress/#description","title":"DESCRIPTION","text":"

CMS_compress() creates and returns a CMS CompressedData structure. comp_nid is the compression algorithm to use or NID_undef to use the default algorithm (zlib compression). in is the content to be compressed. flags is an optional set of flags.

The only currently supported compression algorithm is zlib using the NID NID_zlib_compression.

If zlib support is not compiled into OpenSSL then CMS_compress() will return an error.

If the CMS_TEXT flag is set MIME headers for type text/plain are prepended to the data.

Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if CMS_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it. If CMS_BINARY is set then CMS_TEXT is ignored.

If the CMS_STREAM flag is set a partial CMS_ContentInfo structure is returned suitable for streaming I/O: no data is read from the BIO in.

The compressed data is included in the CMS_ContentInfo structure, unless CMS_DETACHED is set in which case it is omitted. This is rarely used in practice and is not supported by SMIME_write_CMS().

If the flag CMS_STREAM is set the returned CMS_ContentInfo structure is not complete and outputting its contents via a function that does not properly finalize the CMS_ContentInfo structure will give unpredictable results.

Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_CMS().

Additional compression parameters such as the zlib compression level cannot currently be set.

"},{"location":"man3/CMS_compress/#return-values","title":"RETURN VALUES","text":"

CMS_compress() returns either a CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

"},{"location":"man3/CMS_compress/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_uncompress(3)

"},{"location":"man3/CMS_compress/#history","title":"HISTORY","text":"

The CMS_STREAM flag was added in OpenSSL 1.0.0.

"},{"location":"man3/CMS_compress/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_data_create/","title":"CMS_data_create","text":""},{"location":"man3/CMS_data_create/#name","title":"NAME","text":"

CMS_data_create_ex, CMS_data_create - Create CMS Data object

"},{"location":"man3/CMS_data_create/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,\n                                    OSSL_LIB_CTX *libctx, const char *propq);\nCMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);\n
"},{"location":"man3/CMS_data_create/#description","title":"DESCRIPTION","text":"

CMS_data_create_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_data. The data is supplied via the in BIO. The library context libctx and the property query propq are used when retrieving algorithms from providers. The flags field supports the CMS_STREAM flag. Internally CMS_final() is called unless CMS_STREAM is specified.

The CMS_ContentInfo structure can be freed using CMS_ContentInfo_free(3).

CMS_data_create() is similar to CMS_data_create_ex() but uses default values of NULL for the library context libctx and the property query propq.

"},{"location":"man3/CMS_data_create/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, CMS_data_create_ex() and CMS_data_create() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

"},{"location":"man3/CMS_data_create/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_final(3)

"},{"location":"man3/CMS_data_create/#history","title":"HISTORY","text":"

The CMS_data_create_ex() method was added in OpenSSL 3.0.

"},{"location":"man3/CMS_data_create/#copyright","title":"COPYRIGHT","text":"

Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_decrypt/","title":"CMS_decrypt","text":""},{"location":"man3/CMS_decrypt/#name","title":"NAME","text":"

CMS_decrypt, CMS_decrypt_set1_pkey_and_peer, CMS_decrypt_set1_pkey, CMS_decrypt_set1_password - decrypt content from a CMS envelopedData structure

"},{"location":"man3/CMS_decrypt/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,\n                BIO *dcont, BIO *out, unsigned int flags);\nint CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms,\n                EVP_PKEY *pk, X509 *cert, X509 *peer);\nint CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);\nint CMS_decrypt_set1_password(CMS_ContentInfo *cms,\n                              unsigned char *pass, ossl_ssize_t passlen);\n
"},{"location":"man3/CMS_decrypt/#description","title":"DESCRIPTION","text":"

CMS_decrypt() extracts the decrypted content from a CMS EnvelopedData or AuthEnvelopedData structure. It uses CMS_decrypt_set1_pkey() to decrypt the content with the recipient private key pkey if pkey is not NULL. In this case, it is recommended to provide the associated certificate in cert - see the NOTES below. out is a BIO to write the content to and flags is an optional set of flags. If pkey is NULL the function assumes that decryption was already done (e.g., using CMS_decrypt_set1_pkey() or CMS_decrypt_set1_password()) and just provides the content unless cert, dcont, and out are NULL as well. The dcont parameter is used in the rare case where the encrypted content is detached. It will normally be set to NULL.

CMS_decrypt_set1_pkey_and_peer() decrypts the CMS_ContentInfo structure cms using the private key pkey, the corresponding certificate cert, which is recommended to be supplied but may be NULL, and the (optional) originator certificate peer. On success, it also records in cms the decryption key pkey, and this should be followed by CMS_decrypt(cms, NULL, NULL, dcont, out, flags). This call deallocates any decryption key stored in cms.

CMS_decrypt_set1_pkey() is the same as CMS_decrypt_set1_pkey_and_peer() with peer being NULL.

CMS_decrypt_set1_password() decrypts the CMS_ContentInfo structure cms using the secret pass of length passlen. On success, it also records in cms the decryption key used, and this should be followed by CMS_decrypt(cms, NULL, NULL, dcont, out, flags). This call deallocates any decryption key stored in cms.

"},{"location":"man3/CMS_decrypt/#notes","title":"NOTES","text":"

Although the recipients certificate is not needed to decrypt the data it is needed to locate the appropriate (of possible several) recipients in the CMS structure.

If cert is set to NULL all possible recipients are tried. This case however is problematic. To thwart the MMA attack (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all recipients are tried whether they succeed or not. If no recipient succeeds then a random symmetric key is used to decrypt the content: this will typically output garbage and may (but is not guaranteed to) ultimately return a padding error only. If CMS_decrypt() just returned an error when all recipient encrypted keys failed to decrypt an attacker could use this in a timing attack. If the special flag CMS_DEBUG_DECRYPT is set then the above behaviour is modified and an error is returned if no recipient encrypted key can be decrypted without generating a random content encryption key. Applications should use this flag with extreme caution especially in automated gateways as it can leave them open to attack.

It is possible to determine the correct recipient key by other means (for example looking them up in a database) and setting them in the CMS structure in advance using the CMS utility functions such as CMS_set1_pkey(), or use CMS_decrypt_set1_password() if the recipient has a symmetric key. In these cases both cert and pkey should be set to NULL.

To process KEKRecipientInfo types CMS_set1_key() or CMS_RecipientInfo_set0_key() and CMS_RecipientInfo_decrypt() should be called before CMS_decrypt() and cert and pkey set to NULL.

The following flags can be passed in the flags parameter.

If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

"},{"location":"man3/CMS_decrypt/#return-values","title":"RETURN VALUES","text":"

CMS_decrypt(), CMS_decrypt_set1_pkey_and_peer(), CMS_decrypt_set1_pkey(), and CMS_decrypt_set1_password() return either 1 for success or 0 for failure. The error can be obtained from ERR_get_error(3).

"},{"location":"man3/CMS_decrypt/#bugs","title":"BUGS","text":"

The set1_ part of these function names is misleading and should better read: with_.

The lack of single pass processing and the need to hold all data in memory as mentioned in CMS_verify() also applies to CMS_decrypt().

"},{"location":"man3/CMS_decrypt/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_encrypt(3)

"},{"location":"man3/CMS_decrypt/#history","title":"HISTORY","text":"

CMS_decrypt_set1_pkey_and_peer() and CMS_decrypt_set1_password() were added in OpenSSL 3.0.

"},{"location":"man3/CMS_decrypt/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_digest_create/","title":"CMS_digest_create","text":""},{"location":"man3/CMS_digest_create/#name","title":"NAME","text":"

CMS_digest_create_ex, CMS_digest_create - Create CMS DigestedData object

"},{"location":"man3/CMS_digest_create/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md,\n                                      unsigned int flags, OSSL_LIB_CTX *ctx,\n                                      const char *propq);\n\nCMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,\n                                   unsigned int flags);\n
"},{"location":"man3/CMS_digest_create/#description","title":"DESCRIPTION","text":"

CMS_digest_create_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_digest. The data supplied via the in BIO is digested using md. The library context libctx and the property query propq are used when retrieving algorithms from providers. The flags field supports the CMS_DETACHED and CMS_STREAM flags, Internally CMS_final() is called unless CMS_STREAM is specified.

The CMS_ContentInfo structure can be freed using CMS_ContentInfo_free(3).

CMS_digest_create() is similar to CMS_digest_create_ex() but uses default values of NULL for the library context libctx and the property query propq.

"},{"location":"man3/CMS_digest_create/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, CMS_digest_create_ex() and CMS_digest_create() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

"},{"location":"man3/CMS_digest_create/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_final(3)>

"},{"location":"man3/CMS_digest_create/#history","title":"HISTORY","text":"

The CMS_digest_create_ex() method was added in OpenSSL 3.0.

"},{"location":"man3/CMS_digest_create/#copyright","title":"COPYRIGHT","text":"

Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_encrypt/","title":"CMS_encrypt","text":""},{"location":"man3/CMS_encrypt/#name","title":"NAME","text":"

CMS_encrypt_ex, CMS_encrypt - create a CMS envelopedData structure

"},{"location":"man3/CMS_encrypt/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *in,\n                                const EVP_CIPHER *cipher, unsigned int flags,\n                                OSSL_LIB_CTX *libctx, const char *propq);\nCMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,\n                             const EVP_CIPHER *cipher, unsigned int flags);\n
"},{"location":"man3/CMS_encrypt/#description","title":"DESCRIPTION","text":"

CMS_encrypt_ex() creates and returns a CMS EnvelopedData or AuthEnvelopedData structure. certs is a list of recipient certificates. in is the content to be encrypted. cipher is the symmetric cipher to use. flags is an optional set of flags. The library context libctx and the property query propq are used internally when retrieving algorithms from providers.

Only certificates carrying RSA, Diffie-Hellman or EC keys are supported by this function.

EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use because most clients will support it.

The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters. If the cipher mode is GCM, then an AuthEnvelopedData structure containing MAC is used. Otherwise an EnvelopedData structure is used. Currently the AES variants with GCM mode are the only supported AEAD algorithms.

Many browsers implement a \"sign and encrypt\" option which is simply an S/MIME envelopedData containing an S/MIME signed message. This can be readily produced by storing the S/MIME signed message in a memory BIO and passing it to CMS_encrypt().

The following flags can be passed in the flags parameter.

If the CMS_TEXT flag is set MIME headers for type text/plain are prepended to the data.

Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if CMS_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it. If CMS_BINARY is set then CMS_TEXT is ignored.

OpenSSL will by default identify recipient certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if all recipient certificates do not have a subject key identifier extension.

If the CMS_STREAM flag is set a partial CMS_ContentInfo structure is returned suitable for streaming I/O: no data is read from the BIO in.

If the CMS_PARTIAL flag is set a partial CMS_ContentInfo structure is returned to which additional recipients and attributes can be added before finalization.

The data being encrypted is included in the CMS_ContentInfo structure, unless CMS_DETACHED is set in which case it is omitted. This is rarely used in practice and is not supported by SMIME_write_CMS().

If the flag CMS_STREAM is set the returned CMS_ContentInfo structure is not complete and outputting its contents via a function that does not properly finalize the CMS_ContentInfo structure will give unpredictable results.

Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_CMS().

The recipients specified in certs use a CMS KeyTransRecipientInfo info structure. KEKRecipientInfo is also supported using the flag CMS_PARTIAL and CMS_add0_recipient_key().

The parameter certs may be NULL if CMS_PARTIAL is set and recipients added later using CMS_add1_recipient_cert() or CMS_add0_recipient_key().

CMS_encrypt() is similar to CMS_encrypt_ex() but uses default values of NULL for the library context libctx and the property query propq.

"},{"location":"man3/CMS_encrypt/#return-values","title":"RETURN VALUES","text":"

CMS_encrypt_ex() and CMS_encrypt() return either a CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

"},{"location":"man3/CMS_encrypt/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_decrypt(3)

"},{"location":"man3/CMS_encrypt/#history","title":"HISTORY","text":"

The function CMS_encrypt_ex() was added in OpenSSL 3.0.

The CMS_STREAM flag was first supported in OpenSSL 1.0.0.

"},{"location":"man3/CMS_encrypt/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_final/","title":"CMS_final","text":""},{"location":"man3/CMS_final/#name","title":"NAME","text":"

CMS_final - finalise a CMS_ContentInfo structure

"},{"location":"man3/CMS_final/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);\n
"},{"location":"man3/CMS_final/#description","title":"DESCRIPTION","text":"

CMS_final() finalises the structure cms. Its purpose is to perform any operations necessary on cms (digest computation for example) and set the appropriate fields. The parameter data contains the content to be processed. The dcont parameter contains a BIO to write content to after processing: this is only used with detached data and will usually be set to NULL.

"},{"location":"man3/CMS_final/#notes","title":"NOTES","text":"

This function will normally be called when the CMS_PARTIAL flag is used. It should only be used when streaming is not performed because the streaming I/O functions perform finalisation operations internally.

"},{"location":"man3/CMS_final/#return-values","title":"RETURN VALUES","text":"

CMS_final() returns 1 for success or 0 for failure.

"},{"location":"man3/CMS_final/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_sign(3), CMS_encrypt(3)

"},{"location":"man3/CMS_final/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_get0_RecipientInfos/","title":"CMS_get0_RecipientInfos","text":""},{"location":"man3/CMS_get0_RecipientInfos/#name","title":"NAME","text":"

CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id, CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kari_set0_pkey_and_peer, CMS_RecipientInfo_kari_set0_pkey, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt, CMS_RecipientInfo_encrypt - CMS envelopedData RecipientInfo routines

"},{"location":"man3/CMS_get0_RecipientInfos/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nSTACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);\nint CMS_RecipientInfo_type(CMS_RecipientInfo *ri);\n\nint CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,\n                                          ASN1_OCTET_STRING **keyid,\n                                          X509_NAME **issuer,\n                                          ASN1_INTEGER **sno);\nint CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);\nint CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);\nint CMS_RecipientInfo_kari_set0_pkey_and_peer(CMS_RecipientInfo *ri,\n                                              EVP_PKEY *pk, X509 *peer);\nint CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);\nint CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg,\n                                    ASN1_OCTET_STRING **pid,\n                                    ASN1_GENERALIZEDTIME **pdate,\n                                    ASN1_OBJECT **potherid,\n                                    ASN1_TYPE **pothertype);\nint CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,\n                                   const unsigned char *id, size_t idlen);\nint CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,\n                               unsigned char *key, size_t keylen);\n\nint CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);\nint CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);\n
"},{"location":"man3/CMS_get0_RecipientInfos/#description","title":"DESCRIPTION","text":"

The function CMS_get0_RecipientInfos() returns all the CMS_RecipientInfo structures associated with a CMS EnvelopedData structure.

CMS_RecipientInfo_type() returns the type of CMS_RecipientInfo structure ri. It will currently return CMS_RECIPINFO_TRANS, CMS_RECIPINFO_AGREE, CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or CMS_RECIPINFO_OTHER.

CMS_RecipientInfo_ktri_get0_signer_id() retrieves the certificate recipient identifier associated with a specific CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_TRANS. Either the keyidentifier will be set in keyid or both issuer name and serial number in issuer and sno.

CMS_RecipientInfo_ktri_cert_cmp() compares the certificate cert against the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_TRANS. It returns zero if the comparison is successful and non zero if not.

CMS_RecipientInfo_set0_pkey() associates the private key pkey with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_TRANS.

CMS_RecipientInfo_kari_set0_pkey_and_peer() associates the private key pkey and peer certificate peer with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_AGREE.

CMS_RecipientInfo_kari_set0_pkey() associates the private key pkey with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_AGREE.

CMS_RecipientInfo_kekri_get0_id() retrieves the key information from the CMS_RecipientInfo structure ri which must be of type CMS_RECIPINFO_KEK. Any of the remaining parameters can be NULL if the application is not interested in the value of a field. Where a field is optional and absent NULL will be written to the corresponding parameter. The keyEncryptionAlgorithm field is written to palg, the keyIdentifier field is written to pid, the date field if present is written to pdate, if the other field is present the components keyAttrId and keyAttr are written to parameters potherid and pothertype.

CMS_RecipientInfo_kekri_id_cmp() compares the ID in the id and idlen parameters against the keyIdentifier CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_KEK. It returns zero if the comparison is successful and non zero if not.

CMS_RecipientInfo_set0_key() associates the symmetric key key of length keylen with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_KEK.

CMS_RecipientInfo_decrypt() attempts to decrypt CMS_RecipientInfo structure ri in structure cms. A key must have been associated with the structure first.

CMS_RecipientInfo_encrypt() attempts to encrypt CMS_RecipientInfo structure ri in structure cms. A key must have been associated with the structure first and the content encryption key must be available: for example by a previous call to CMS_RecipientInfo_decrypt().

"},{"location":"man3/CMS_get0_RecipientInfos/#notes","title":"NOTES","text":"

The main purpose of these functions is to enable an application to lookup recipient keys using any appropriate technique when the simpler method of CMS_decrypt() is not appropriate.

In typical usage and application will retrieve all CMS_RecipientInfo structures using CMS_get0_RecipientInfos() and check the type of each using CMS_RecipientInfo_type(). Depending on the type the CMS_RecipientInfo structure can be ignored or its key identifier data retrieved using an appropriate function. Then if the corresponding secret or private key can be obtained by any appropriate means it can then associated with the structure and CMS_RecipientInfo_decrypt() called. If successful CMS_decrypt() can be called with a NULL key to decrypt the enveloped content.

The CMS_RecipientInfo_encrypt() can be used to add a new recipient to an existing enveloped data structure. Typically an application will first decrypt an appropriate CMS_RecipientInfo structure to make the content encrypt key available, it will then add a new recipient using a function such as CMS_add1_recipient_cert() and finally encrypt the content encryption key using CMS_RecipientInfo_encrypt().

"},{"location":"man3/CMS_get0_RecipientInfos/#return-values","title":"RETURN VALUES","text":"

CMS_get0_RecipientInfos() returns all CMS_RecipientInfo structures, or NULL if an error occurs.

CMS_RecipientInfo_ktri_get0_signer_id(), CMS_RecipientInfo_set0_pkey(), CMS_RecipientInfo_kekri_get0_id(), CMS_RecipientInfo_set0_key() and CMS_RecipientInfo_decrypt() return 1 for success or 0 if an error occurs. CMS_RecipientInfo_encrypt() return 1 for success or 0 if an error occurs.

CMS_RecipientInfo_ktri_cert_cmp() and CMS_RecipientInfo_kekri_cmp() return 0 for a successful comparison and non zero otherwise.

Any error can be obtained from ERR_get_error(3).

"},{"location":"man3/CMS_get0_RecipientInfos/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_decrypt(3)

"},{"location":"man3/CMS_get0_RecipientInfos/#history","title":"HISTORY","text":"

CMS_RecipientInfo_kari_set0_pkey_and_peer and CMS_RecipientInfo_kari_set0_pkey were added in OpenSSL 3.0.

"},{"location":"man3/CMS_get0_RecipientInfos/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_get0_SignerInfos/","title":"CMS_get0_SignerInfos","text":""},{"location":"man3/CMS_get0_SignerInfos/#name","title":"NAME","text":"

CMS_SignerInfo_set1_signer_cert, CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_get0_signature, CMS_SignerInfo_cert_cmp - CMS signedData signer functions

"},{"location":"man3/CMS_get0_SignerInfos/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nSTACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);\n\nint CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid,\n                                  X509_NAME **issuer, ASN1_INTEGER **sno);\nASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);\nint CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);\nvoid CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);\n
"},{"location":"man3/CMS_get0_SignerInfos/#description","title":"DESCRIPTION","text":"

The function CMS_get0_SignerInfos() returns all the CMS_SignerInfo structures associated with a CMS signedData structure.

CMS_SignerInfo_get0_signer_id() retrieves the certificate signer identifier associated with a specific CMS_SignerInfo structure si. Either the keyidentifier will be set in keyid or both issuer name and serial number in issuer and sno.

CMS_SignerInfo_get0_signature() retrieves the signature associated with si in a pointer to an ASN1_OCTET_STRING structure. This pointer returned corresponds to the internal signature value if si so it may be read or modified.

CMS_SignerInfo_cert_cmp() compares the certificate cert against the signer identifier si. It returns zero if the comparison is successful and non zero if not.

CMS_SignerInfo_set1_signer_cert() sets the signers certificate of si to signer.

"},{"location":"man3/CMS_get0_SignerInfos/#notes","title":"NOTES","text":"

The main purpose of these functions is to enable an application to lookup signers certificates using any appropriate technique when the simpler method of CMS_verify() is not appropriate.

In typical usage and application will retrieve all CMS_SignerInfo structures using CMS_get0_SignerInfo() and retrieve the identifier information using CMS. It will then obtain the signer certificate by some unspecified means (or return and error if it cannot be found) and set it using CMS_SignerInfo_set1_signer_cert().

Once all signer certificates have been set CMS_verify() can be used.

Although CMS_get0_SignerInfos() can return NULL if an error occurs or if there are no signers this is not a problem in practice because the only error which can occur is if the cms structure is not of type signedData due to application error.

"},{"location":"man3/CMS_get0_SignerInfos/#return-values","title":"RETURN VALUES","text":"

CMS_get0_SignerInfos() returns all CMS_SignerInfo structures, or NULL there are no signers or an error occurs.

CMS_SignerInfo_get0_signer_id() returns 1 for success and 0 for failure.

CMS_SignerInfo_cert_cmp() returns 0 for a successful comparison and non zero otherwise.

CMS_SignerInfo_set1_signer_cert() does not return a value.

Any error can be obtained from ERR_get_error(3)

"},{"location":"man3/CMS_get0_SignerInfos/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_verify(3)

"},{"location":"man3/CMS_get0_SignerInfos/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2018 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_get0_type/","title":"CMS_get0_type","text":""},{"location":"man3/CMS_get0_type/#name","title":"NAME","text":"

CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType, CMS_get0_content - get and set CMS content types and content

"},{"location":"man3/CMS_get0_type/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nconst ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);\nint CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);\nconst ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);\nASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);\n
"},{"location":"man3/CMS_get0_type/#description","title":"DESCRIPTION","text":"

CMS_get0_type() returns the content type of a CMS_ContentInfo structure as an ASN1_OBJECT pointer. An application can then decide how to process the CMS_ContentInfo structure based on this value.

CMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo structure. It should be called with CMS functions (such as CMS_sign(3), CMS_encrypt(3)) with the CMS_PARTIAL flag and before the structure is finalised, otherwise the results are undefined.

ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded content type.

CMS_get0_content() returns a pointer to the ASN1_OCTET_STRING pointer containing the embedded content.

"},{"location":"man3/CMS_get0_type/#notes","title":"NOTES","text":"

As the 0 implies CMS_get0_type(), CMS_get0_eContentType() and CMS_get0_content() return internal pointers which should not be freed up. CMS_set1_eContentType() copies the supplied OID and it should be freed up after use.

The ASN1_OBJECT values returned can be converted to an integer NID value using OBJ_obj2nid(). For the currently supported content types the following values are returned:

NID_pkcs7_data\nNID_pkcs7_signed\nNID_pkcs7_digest\nNID_id_smime_ct_compressedData:\nNID_pkcs7_encrypted\nNID_pkcs7_enveloped\n

The return value of CMS_get0_content() is a pointer to the ASN1_OCTET_STRING content pointer. That means that for example:

ASN1_OCTET_STRING **pconf = CMS_get0_content(cms);\n

*pconf could be NULL if there is no embedded content. Applications can access, modify or create the embedded content in a CMS_ContentInfo structure using this function. Applications usually will not need to modify the embedded content as it is normally set by higher level functions.

"},{"location":"man3/CMS_get0_type/#return-values","title":"RETURN VALUES","text":"

CMS_get0_type() and CMS_get0_eContentType() return an ASN1_OBJECT structure.

CMS_set1_eContentType() returns 1 for success or 0 if an error occurred. The error can be obtained from ERR_get_error(3).

"},{"location":"man3/CMS_get0_type/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/CMS_get0_type/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_get1_ReceiptRequest/","title":"CMS_get1_ReceiptRequest","text":""},{"location":"man3/CMS_get1_ReceiptRequest/#name","title":"NAME","text":"

CMS_ReceiptRequest_create0_ex, CMS_ReceiptRequest_create0, CMS_add1_ReceiptRequest, CMS_get1_ReceiptRequest, CMS_ReceiptRequest_get0_values - CMS signed receipt request functions

"},{"location":"man3/CMS_get1_ReceiptRequest/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(\n    unsigned char *id, int idlen, int allorfirst,\n    STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo,\n    OSSL_LIB_CTX *libctx);\nCMS_ReceiptRequest *CMS_ReceiptRequest_create0(\n    unsigned char *id, int idlen, int allorfirst,\n    STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo);\nint CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);\nint CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);\nvoid CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING **pcid,\n                                    int *pallorfirst,\n                                    STACK_OF(GENERAL_NAMES) **plist,\n                                    STACK_OF(GENERAL_NAMES) **prto);\n
"},{"location":"man3/CMS_get1_ReceiptRequest/#description","title":"DESCRIPTION","text":"

CMS_ReceiptRequest_create0_ex() creates a signed receipt request structure. The signedContentIdentifier field is set using id and idlen, or it is set to 32 bytes of pseudo random data if id is NULL. If receiptList is NULL the allOrFirstTier option in receiptsFrom is used and set to the value of the allorfirst parameter. If receiptList is not NULL the receiptList option in receiptsFrom is used. The receiptsTo parameter specifies the receiptsTo field value. The library context libctx is used to find the public random generator.

CMS_ReceiptRequest_create0() is similar to CMS_ReceiptRequest_create0_ex() but uses default values of NULL for the library context libctx.

The CMS_add1_ReceiptRequest() function adds a signed receipt request rr to SignerInfo structure si.

int CMS_get1_ReceiptRequest() looks for a signed receipt request in si, if any is found it is decoded and written to prr.

CMS_ReceiptRequest_get0_values() retrieves the values of a receipt request. The signedContentIdentifier is copied to pcid. If the allOrFirstTier option of receiptsFrom is used its value is copied to pallorfirst otherwise the receiptList field is copied to plist. The receiptsTo parameter is copied to prto.

"},{"location":"man3/CMS_get1_ReceiptRequest/#notes","title":"NOTES","text":"

For more details of the meaning of the fields see RFC2634.

The contents of a signed receipt should only be considered meaningful if the corresponding CMS_ContentInfo structure can be successfully verified using CMS_verify().

"},{"location":"man3/CMS_get1_ReceiptRequest/#return-values","title":"RETURN VALUES","text":"

CMS_ReceiptRequest_create0_ex() and CMS_ReceiptRequest_create0() return a signed receipt request structure or NULL if an error occurred.

CMS_add1_ReceiptRequest() returns 1 for success or 0 if an error occurred.

CMS_get1_ReceiptRequest() returns 1 is a signed receipt request is found and decoded. It returns 0 if a signed receipt request is not present and -1 if it is present but malformed.

"},{"location":"man3/CMS_get1_ReceiptRequest/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_sign(3), CMS_sign_receipt(3), CMS_verify(3) CMS_verify_receipt(3)

"},{"location":"man3/CMS_get1_ReceiptRequest/#history","title":"HISTORY","text":"

The function CMS_ReceiptRequest_create0_ex() was added in OpenSSL 3.0.

"},{"location":"man3/CMS_get1_ReceiptRequest/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_sign/","title":"CMS_sign","text":""},{"location":"man3/CMS_sign/#name","title":"NAME","text":"

CMS_sign, CMS_sign_ex - create a CMS SignedData structure

"},{"location":"man3/CMS_sign/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,\n                             STACK_OF(X509) *certs, BIO *data,\n                             unsigned int flags, OSSL_LIB_CTX *ctx,\n                             const char *propq);\nCMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                          BIO *data, unsigned int flags);\n
"},{"location":"man3/CMS_sign/#description","title":"DESCRIPTION","text":"

CMS_sign_ex() creates and returns a CMS SignedData structure. signcert is the certificate to sign with, pkey is the corresponding private key. certs is an optional additional set of certificates to include in the CMS structure (for example any intermediate CAs in the chain). The library context libctx and the property query propq are used when retrieving algorithms from providers. Any or all of these parameters can be NULL, see NOTES below.

The data to be signed is read from BIO data.

flags is an optional set of flags.

CMS_sign() is similar to CMS_sign_ex() but uses default values of NULL for the library context libctx and the property query propq.

"},{"location":"man3/CMS_sign/#notes","title":"NOTES","text":"

Any of the following flags (ored together) can be passed in the flags parameter.

Many S/MIME clients expect the signed content to include valid MIME headers. If the CMS_TEXT flag is set MIME headers for type text/plain are prepended to the data.

If CMS_NOCERTS is set the signer's certificate will not be included in the CMS_ContentInfo structure, the signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signature if the signers certificate can be obtained by other means: for example a previously signed message.

The data being signed is included in the CMS_ContentInfo structure, unless CMS_DETACHED is set in which case it is omitted. This is used for CMS_ContentInfo detached signatures which are used in S/MIME plaintext signed messages for example.

Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if CMS_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it.

The SignedData structure includes several CMS signedAttributes including the signing time, the CMS content type and the supported list of ciphers in an SMIMECapabilities attribute. If CMS_NOATTR is set then no signedAttributes will be used. If CMS_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

If present the SMIMECapabilities attribute indicates support for the following algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is not loaded.

OpenSSL will by default identify signing certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if the signing certificate does not have a subject key identifier extension.

If the flags CMS_STREAM is set then the returned CMS_ContentInfo structure is just initialized ready to perform the signing operation. The signing is however not performed and the data to be signed is not read from the data parameter. Signing is deferred until after the data has been written. In this way data can be signed in a single pass.

If the CMS_PARTIAL flag is set a partial CMS_ContentInfo structure is output to which additional signers and capabilities can be added before finalization.

If the flag CMS_STREAM is set the returned CMS_ContentInfo structure is not complete and outputting its contents via a function that does not properly finalize the CMS_ContentInfo structure will give unpredictable results.

Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_CMS().

If a signer is specified it will use the default digest for the signing algorithm. This is SHA1 for both RSA and DSA keys.

If signcert and pkey are NULL then a certificates only CMS structure is output.

The function CMS_sign() is a basic CMS signing function whose output will be suitable for many purposes. For finer control of the output format the certs, signcert and pkey parameters can all be NULL and the CMS_PARTIAL flag set. Then one or more signers can be added using the function CMS_add1_signer(), non default digests can be used and custom attributes added. CMS_final() must then be called to finalize the structure if streaming is not enabled.

"},{"location":"man3/CMS_sign/#bugs","title":"BUGS","text":"

Some attributes such as counter signatures are not supported.

"},{"location":"man3/CMS_sign/#return-values","title":"RETURN VALUES","text":"

CMS_sign_ex() and CMS_sign() return either a valid CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

"},{"location":"man3/CMS_sign/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_verify(3)

"},{"location":"man3/CMS_sign/#history","title":"HISTORY","text":"

The CMS_STREAM flag is only supported for detached data in OpenSSL 0.9.8, it is supported for embedded data in OpenSSL 1.0.0 and later.

The CMS_sign_ex() method was added in OpenSSL 3.0.

"},{"location":"man3/CMS_sign/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_sign_receipt/","title":"CMS_sign_receipt","text":""},{"location":"man3/CMS_sign_receipt/#name","title":"NAME","text":"

CMS_sign_receipt - create a CMS signed receipt

"},{"location":"man3/CMS_sign_receipt/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert,\n                                  EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                                  unsigned int flags);\n
"},{"location":"man3/CMS_sign_receipt/#description","title":"DESCRIPTION","text":"

CMS_sign_receipt() creates and returns a CMS signed receipt structure. si is the CMS_SignerInfo structure containing the signed receipt request. signcert is the certificate to sign with, pkey is the corresponding private key. certs is an optional additional set of certificates to include in the CMS structure (for example any intermediate CAs in the chain).

flags is an optional set of flags.

"},{"location":"man3/CMS_sign_receipt/#notes","title":"NOTES","text":"

This functions behaves in a similar way to CMS_sign() except the flag values CMS_DETACHED, CMS_BINARY, CMS_NOATTR, CMS_TEXT and CMS_STREAM are not supported since they do not make sense in the context of signed receipts.

"},{"location":"man3/CMS_sign_receipt/#return-values","title":"RETURN VALUES","text":"

CMS_sign_receipt() returns either a valid CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

"},{"location":"man3/CMS_sign_receipt/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_verify_receipt(3), CMS_sign(3)

"},{"location":"man3/CMS_sign_receipt/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_signed_get_attr/","title":"CMS_signed_get_attr","text":""},{"location":"man3/CMS_signed_get_attr/#name","title":"NAME","text":"

CMS_signed_get_attr_count, CMS_signed_get_attr_by_NID, CMS_signed_get_attr_by_OBJ, CMS_signed_get_attr, CMS_signed_delete_attr, CMS_signed_add1_attr, CMS_signed_add1_attr_by_OBJ, CMS_signed_add1_attr_by_NID, CMS_signed_add1_attr_by_txt, CMS_signed_get0_data_by_OBJ, CMS_unsigned_get_attr_count, CMS_unsigned_get_attr_by_NID, CMS_unsigned_get_attr_by_OBJ, CMS_unsigned_get_attr, CMS_unsigned_delete_attr, CMS_unsigned_add1_attr, CMS_unsigned_add1_attr_by_OBJ, CMS_unsigned_add1_attr_by_NID, CMS_unsigned_add1_attr_by_txt, CMS_unsigned_get0_data_by_OBJ - CMS signed and unsigned attribute functions

"},{"location":"man3/CMS_signed_get_attr/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_signed_get_attr_count(const CMS_SignerInfo *si);\nint CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,\n                               int lastpos);\nint CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,\n                               int lastpos);\nX509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);\nX509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);\nint CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);\nint CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,\n                                const ASN1_OBJECT *obj, int type,\n                                const void *bytes, int len);\nint CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,\n                                int nid, int type,\n                                const void *bytes, int len);\nint CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,\n                                const char *attrname, int type,\n                                const void *bytes, int len);\nvoid *CMS_signed_get0_data_by_OBJ(const CMS_SignerInfo *si,\n                                  const ASN1_OBJECT *oid,\n                                  int lastpos, int type);\n\nint CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);\nint CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,\n                                 int lastpos);\nint CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,\n                                 const ASN1_OBJECT *obj, int lastpos);\nX509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);\nX509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);\nint CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);\nint CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,\n                                  const ASN1_OBJECT *obj, int type,\n                                  const void *bytes, int len);\nint CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,\n                                  int nid, int type,\n                                  const void *bytes, int len);\nint CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,\n                                  const char *attrname, int type,\n                                  const void *bytes, int len);\nvoid *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,\n                                    int lastpos, int type);\n
"},{"location":"man3/CMS_signed_get_attr/#description","title":"DESCRIPTION","text":"

CMS_signerInfo contains separate attribute lists for signed and unsigned attributes. Each CMS_signed_XXX() function is used for signed attributes, and each CMS_unsigned_XXX() function is used for unsigned attributes. Since the CMS_unsigned_XXX() functions work in the same way as the CMS_signed_XXX() equivalents, only the CMS_signed_XXX() functions are described below.

CMS_signed_get_attr_by_OBJ() finds the location of the first matching object obj in the SignerInfo's si signed attribute list. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to CMS_signed_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the signed attribute list.

CMS_signed_get_attr_by_NID() is similar to CMS_signed_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

CMS_signed_get_attr() returns the X509_ATTRIBUTE object at index loc in the si signed attribute list. loc should be in the range from 0 to CMS_signed_get_attr_count() - 1.

CMS_signed_delete_attr() removes the X509_ATTRIBUTE object at index loc in the si signed attribute list. An error occurs if the si attribute list is NULL.

CMS_signed_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE object to the si signed attribute list. A new signed attribute list is created if required. An error occurs if attr is NULL.

CMS_signed_add1_attr_by_OBJ() creates a new signed X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the key object's attribute list.

CMS_signed_add1_attr_by_NID() is similar to CMS_signed_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

CMS_signed_add1_attr_by_txt() is similar to CMS_signed_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

CMS_signed_get0_data_by_OBJ() finds the first attribute in a si signed attributes list that matches the obj starting at index lastpos and returns the data retrieved from the found attributes first ASN1_TYPE object. An error will occur if the attribute type type does not match the type of the ASN1_TYPE object OR if type is either V_ASN1_BOOLEAN or V_ASN1_NULL OR the attribute is not found. If lastpos is less than -1 then an error will occur if there are multiple objects in the signed attribute list that match obj. If lastpos is less than -2 then an error will occur if there is more than one ASN1_TYPE object in the found signed attribute.

Refer to X509_ATTRIBUTE(3) for information related to attributes.

"},{"location":"man3/CMS_signed_get_attr/#return-values","title":"RETURN VALUES","text":"

The CMS_unsigned_XXX() functions return values are similar to those of the equivalent CMS_signed_XXX() functions.

CMS_signed_get_attr_count() returns the number of signed attributes in the SignerInfo si, or -1 if the signed attribute list is NULL.

CMS_signed_get_attr_by_OBJ() returns -1 if either the signed attribute list of si is empty OR if obj is not found, otherwise it returns the location of the obj in the SignerInfo's si signed attribute list.

CMS_signed_get_attr_by_NID() is similar to CMS_signed_get_attr_by_OBJ() except that it returns -2 if the nid is not known by OpenSSL.

CMS_signed_get_attr() returns either a signed X509_ATTRIBUTE or NULL on error.

CMS_signed_delete_attr() returns either the removed signed X509_ATTRIBUTE or NULL if there is a error.

CMS_signed_add1_attr(), CMS_signed_add1_attr_by_OBJ(), CMS_signed_add1_attr_by_NID(), CMS_signed_add1_attr_by_txt(), return 1 on success or 0 on error.

CMS_signed_get0_data_by_OBJ() returns the data retrieved from the found signed attributes first ASN1_TYPE object, or NULL if an error occurs.

"},{"location":"man3/CMS_signed_get_attr/#notes","title":"NOTES","text":"

Some attributes are added automatically during the signing process.

Calling CMS_SignerInfo_sign() adds the NID_pkcs9_signingTime signed attribute.

Calling CMS_final(), CMS_final_digest() or CMS_dataFinal() adds the NID_pkcs9_messageDigest signed attribute.

The NID_pkcs9_contentType signed attribute is always added if the NID_pkcs9_signingTime attribute is added.

Calling CMS_sign_ex(), CMS_sign_receipt() or CMS_add1_signer() may add attributes depending on the flags parameter. See CMS_add1_signer(3) for more information.

OpenSSL applies special rules for the following attribute NIDs:

  • CMS Signed Attributes

    NID_pkcs9_contentType NID_pkcs9_messageDigest NID_pkcs9_signingTime

  • ESS Signed Attributes

    NID_id_smime_aa_signingCertificate NID_id_smime_aa_signingCertificateV2 NID_id_smime_aa_receiptRequest

  • CMS Unsigned Attributes

    NID_pkcs9_countersignature

CMS_signed_add1_attr(), CMS_signed_add1_attr_by_OBJ(), CMS_signed_add1_attr_by_NID(), CMS_signed_add1_attr_by_txt() and the equivalent CMS_unsigned_add1_attrXXX() functions allow duplicate attributes to be added. The attribute rules are not checked during these function calls, and are deferred until the sign or verify process (i.e. during calls to any of CMS_sign_ex(), CMS_sign(), CMS_sign_receipt(), CMS_add1_signer(), CMS_Final(), CMS_dataFinal(), CMS_final_digest(), CMS_verify(), CMS_verify_receipt() or CMS_SignedData_verify()).

For CMS attribute rules see RFC 5652 Section 11. For ESS attribute rules see RFC 2634 Section 1.3.4 and RFC 5035 Section 5.4.

"},{"location":"man3/CMS_signed_get_attr/#see-also","title":"SEE ALSO","text":"

X509_ATTRIBUTE(3)

"},{"location":"man3/CMS_signed_get_attr/#copyright","title":"COPYRIGHT","text":"

Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_uncompress/","title":"CMS_uncompress","text":""},{"location":"man3/CMS_uncompress/#name","title":"NAME","text":"

CMS_uncompress - uncompress a CMS CompressedData structure

"},{"location":"man3/CMS_uncompress/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags);\n
"},{"location":"man3/CMS_uncompress/#description","title":"DESCRIPTION","text":"

CMS_uncompress() extracts and uncompresses the content from a CMS CompressedData structure cms. data is a BIO to write the content to and flags is an optional set of flags.

The dcont parameter is used in the rare case where the compressed content is detached. It will normally be set to NULL.

"},{"location":"man3/CMS_uncompress/#notes","title":"NOTES","text":"

The only currently supported compression algorithm is zlib: if the structure indicates the use of any other algorithm an error is returned.

If zlib support is not compiled into OpenSSL then CMS_uncompress() will always return an error.

The following flags can be passed in the flags parameter.

If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

"},{"location":"man3/CMS_uncompress/#return-values","title":"RETURN VALUES","text":"

CMS_uncompress() returns either 1 for success or 0 for failure. The error can be obtained from ERR_get_error(3)

"},{"location":"man3/CMS_uncompress/#bugs","title":"BUGS","text":"

The lack of single pass processing and the need to hold all data in memory as mentioned in CMS_verify() also applies to CMS_decompress().

"},{"location":"man3/CMS_uncompress/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_compress(3)

"},{"location":"man3/CMS_uncompress/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_verify/","title":"CMS_verify","text":""},{"location":"man3/CMS_verify/#name","title":"NAME","text":"

CMS_verify, CMS_get0_signers - verify a CMS SignedData structure

"},{"location":"man3/CMS_verify/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store,\n               BIO *indata, BIO *out, unsigned int flags);\n\nSTACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);\n
"},{"location":"man3/CMS_verify/#description","title":"DESCRIPTION","text":"

CMS_verify() is very similar to PKCS7_verify(3). It verifies a CMS SignedData structure contained in a structure of type CMS_ContentInfo. cms points to the CMS_ContentInfo structure to verify. The optional certs parameter refers to a set of certificates in which to search for signing certificates. cms may contain extra untrusted CA certificates that may be used for chain building as well as CRLs that may be used for certificate validation. store may be NULL or point to the trusted certificate store to use for chain verification. indata refers to the signed data if the content is detached from cms. Otherwise indata should be NULL and the signed data must be in cms. The content is written to the BIO out unless it is NULL. flags is an optional set of flags, which can be used to modify the operation.

CMS_get0_signers() retrieves the signing certificate(s) from cms, it may only be called after a successful CMS_verify() operation.

"},{"location":"man3/CMS_verify/#verify-process","title":"VERIFY PROCESS","text":"

Normally the verify process proceeds as follows.

Initially some sanity checks are performed on cms. The type of cms must be SignedData. There must be at least one signature on the data and if the content is detached indata cannot be NULL.

An attempt is made to locate all the signing certificate(s), first looking in the certs parameter (if it is not NULL) and then looking in any certificates contained in the cms structure unless CMS_NOINTERN is set. If any signing certificate cannot be located the operation fails.

Each signing certificate is chain verified using the smimesign purpose and using the trusted certificate store store if supplied. Any internal certificates in the message, which may have been added using CMS_add1_cert(3), are used as untrusted CAs. If CRL checking is enabled in store and CMS_NOCRL is not set, any internal CRLs, which may have been added using CMS_add1_crl(3), are used in addition to attempting to look them up in store. If store is not NULL and any chain verify fails an error code is returned.

Finally the signed content is read (and written to out unless it is NULL) and the signature is checked.

If all signatures verify correctly then the function is successful.

Any of the following flags (ored together) can be passed in the flags parameter to change the default verify behaviour.

If CMS_NOINTERN is set the certificates in the message itself are not searched when locating the signing certificate(s). This means that all the signing certificates must be in the certs parameter.

If CMS_NOCRL is set and CRL checking is enabled in store then any CRLs in the message itself are ignored.

If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

If CMS_NO_SIGNER_CERT_VERIFY is set the signing certificates are not chain verified, unless CMS_CADES flag is also set.

If CMS_NO_ATTR_VERIFY is set the signed attributes signature is not verified, unless CMS_CADES flag is also set.

If CMS_CADES is set, each signer certificate is checked against the ESS signingCertificate or ESS signingCertificateV2 extension that is required in the signed attributes of the signature.

If CMS_NO_CONTENT_VERIFY is set then the content digest is not checked.

"},{"location":"man3/CMS_verify/#notes","title":"NOTES","text":"

One application of CMS_NOINTERN is to only accept messages signed by a small number of certificates. The acceptable certificates would be passed in the certs parameter. In this case if the signer certificate is not one of the certificates supplied in certs then the verify will fail because the signer cannot be found.

In some cases the standard techniques for looking up and validating certificates are not appropriate: for example an application may wish to lookup certificates in a database or perform customised verification. This can be achieved by setting and verifying the signer certificates manually using the signed data utility functions.

Care should be taken when modifying the default verify behaviour, for example setting CMS_NO_CONTENT_VERIFY will totally disable all content verification and any modified content will be considered valid. This combination is however useful if one merely wishes to write the content to out and its validity is not considered important.

Chain verification should arguably be performed using the signing time rather than the current time. However, since the signing time is supplied by the signer it cannot be trusted without additional evidence (such as a trusted timestamp).

"},{"location":"man3/CMS_verify/#return-values","title":"RETURN VALUES","text":"

CMS_verify() returns 1 for a successful verification and 0 if an error occurred.

CMS_get0_signers() returns all signers or NULL if an error occurred.

The error can be obtained from ERR_get_error(3)

"},{"location":"man3/CMS_verify/#bugs","title":"BUGS","text":"

The trusted certificate store is not searched for the signing certificate. This is primarily due to the inadequacies of the current X509_STORE functionality.

The lack of single pass processing means that the signed content must all be held in memory if it is not detached.

"},{"location":"man3/CMS_verify/#see-also","title":"SEE ALSO","text":"

PKCS7_verify(3), CMS_add1_cert(3), CMS_add1_crl(3), OSSL_ESS_check_signing_certs(3), ERR_get_error(3), CMS_sign(3)

"},{"location":"man3/CMS_verify/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CMS_verify_receipt/","title":"CMS_verify_receipt","text":""},{"location":"man3/CMS_verify_receipt/#name","title":"NAME","text":"

CMS_verify_receipt - verify a CMS signed receipt

"},{"location":"man3/CMS_verify_receipt/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/cms.h>\n\nint CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,\n                       STACK_OF(X509) *certs, X509_STORE *store,\n                       unsigned int flags);\n
"},{"location":"man3/CMS_verify_receipt/#description","title":"DESCRIPTION","text":"

CMS_verify_receipt() verifies a CMS signed receipt. rcms is the signed receipt to verify. ocms is the original SignedData structure containing the receipt request. certs is a set of certificates in which to search for the signing certificate. store is a trusted certificate store (used for chain verification).

flags is an optional set of flags, which can be used to modify the verify operation.

"},{"location":"man3/CMS_verify_receipt/#notes","title":"NOTES","text":"

This functions behaves in a similar way to CMS_verify() except the flag values CMS_DETACHED, CMS_BINARY, CMS_TEXT and CMS_STREAM are not supported since they do not make sense in the context of signed receipts.

"},{"location":"man3/CMS_verify_receipt/#return-values","title":"RETURN VALUES","text":"

CMS_verify_receipt() returns 1 for a successful verification and zero if an error occurred.

The error can be obtained from ERR_get_error(3)

"},{"location":"man3/CMS_verify_receipt/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), CMS_sign_receipt(3), CMS_verify(3),

"},{"location":"man3/CMS_verify_receipt/#copyright","title":"COPYRIGHT","text":"

Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CONF_modules_free/","title":"CONF_modules_free","text":""},{"location":"man3/CONF_modules_free/#name","title":"NAME","text":"

CONF_modules_free, CONF_modules_finish, CONF_modules_unload - OpenSSL configuration cleanup functions

"},{"location":"man3/CONF_modules_free/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/conf.h>\n\nvoid CONF_modules_finish(void);\nvoid CONF_modules_unload(int all);\n

The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void CONF_modules_free(void);\n
"},{"location":"man3/CONF_modules_free/#description","title":"DESCRIPTION","text":"

CONF_modules_free() closes down and frees up all memory allocated by all configuration modules. Normally, in versions of OpenSSL prior to 1.1.0, applications called CONF_modules_free() at exit to tidy up any configuration performed.

CONF_modules_finish() calls each configuration modules finish handler to free up any configuration that module may have performed.

CONF_modules_unload() finishes and unloads configuration modules. If all is set to 0 only modules loaded from DSOs will be unloads. If all is 1 all modules, including built-in modules will be unloaded.

"},{"location":"man3/CONF_modules_free/#return-values","title":"RETURN VALUES","text":"

None of the functions return a value.

"},{"location":"man3/CONF_modules_free/#see-also","title":"SEE ALSO","text":"

config(5), OPENSSL_config(3), CONF_modules_load_file_ex(3)

"},{"location":"man3/CONF_modules_free/#history","title":"HISTORY","text":"

CONF_modules_free() was deprecated in OpenSSL 1.1.0; do not use it. For more information see OPENSSL_init_crypto(3).

"},{"location":"man3/CONF_modules_free/#copyright","title":"COPYRIGHT","text":"

Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CONF_modules_load_file/","title":"CONF_modules_load_file","text":""},{"location":"man3/CONF_modules_load_file/#name","title":"NAME","text":"

CONF_get1_default_config_file, CONF_modules_load_file_ex, CONF_modules_load_file, CONF_modules_load - OpenSSL configuration functions

"},{"location":"man3/CONF_modules_load_file/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/conf.h>\n\nchar *CONF_get1_default_config_file(void);\nint CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,\n                              const char *appname, unsigned long flags);\nint CONF_modules_load_file(const char *filename, const char *appname,\n                           unsigned long flags);\nint CONF_modules_load(const CONF *cnf, const char *appname,\n                      unsigned long flags);\n
"},{"location":"man3/CONF_modules_load_file/#description","title":"DESCRIPTION","text":"

The function CONF_get1_default_config_file() determines the default configuration file pathname as follows. If the OPENSSL_CONF environment variable is set its value is returned. Else the function returns the path obtained using X509_get_default_cert_area(3) with the filename \"openssl.cnf\" appended. The caller is responsible for freeing any string returned.

The function CONF_modules_load_file_ex() configures OpenSSL using library context libctx file filename and application name appname. If filename is NULL the standard OpenSSL configuration file is used as determined by calling CONF_get1_default_config_file(). If appname is NULL the standard OpenSSL application name openssl_conf is used. The behaviour can be customized using flags. Note that, the error suppressing can be overridden by config_diagnostics as described in config(5).

CONF_modules_load_file() is the same as CONF_modules_load_file_ex() but has a NULL library context.

CONF_modules_load() is identical to CONF_modules_load_file() except it reads configuration information from cnf.

"},{"location":"man3/CONF_modules_load_file/#notes","title":"NOTES","text":"

The following flags are currently recognized:

If CONF_MFLAGS_IGNORE_ERRORS is set errors returned by individual configuration modules are ignored. If not set the first module error is considered fatal and no further modules are loaded.

Normally any modules errors will add error information to the error queue. If CONF_MFLAGS_SILENT is set no error information is added.

If CONF_MFLAGS_IGNORE_RETURN_CODES is set the function unconditionally returns success. This is used by default in OPENSSL_init_crypto(3) to ignore any errors in the default system-wide configuration file, as having all OpenSSL applications fail to start when there are potentially minor issues in the file is too risky. Applications calling CONF_modules_load_file_ex explicitly should not generally set this flag.

If CONF_MFLAGS_NO_DSO is set configuration module loading from DSOs is disabled.

CONF_MFLAGS_IGNORE_MISSING_FILE if set will make CONF_load_modules_file() ignore missing configuration files. Normally a missing configuration file return an error.

CONF_MFLAGS_DEFAULT_SECTION if set and appname is not NULL will use the default section pointed to by openssl_conf if appname does not exist.

By using CONF_modules_load_file_ex() with appropriate flags an application can customise application configuration to best suit its needs. In some cases the use of a configuration file is optional and its absence is not an error: in this case CONF_MFLAGS_IGNORE_MISSING_FILE would be set.

Errors during configuration may also be handled differently by different applications. For example in some cases an error may simply print out a warning message and the application continue. In other cases an application might consider a configuration file error as fatal and exit immediately.

Applications can use the CONF_modules_load() function if they wish to load a configuration file themselves and have finer control over how errors are treated.

"},{"location":"man3/CONF_modules_load_file/#return-values","title":"RETURN VALUES","text":"

These functions return 1 for success and a zero or negative value for failure. If module errors are not ignored the return code will reflect the return value of the failing module (this will always be zero or negative).

"},{"location":"man3/CONF_modules_load_file/#examples","title":"EXAMPLES","text":"

Load a configuration file and print out any errors and exit (missing file considered fatal):

if (CONF_modules_load_file_ex(libctx, NULL, NULL, 0) <= 0) {\n    fprintf(stderr, \"FATAL: error loading configuration file\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n

Load default configuration file using the section indicated by \"myapp\", tolerate missing files, but exit on other errors:

if (CONF_modules_load_file_ex(NULL, NULL, \"myapp\",\n                              CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {\n    fprintf(stderr, \"FATAL: error loading configuration file\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n

Load custom configuration file and section, only print warnings on error, missing configuration file ignored:

if (CONF_modules_load_file_ex(NULL, \"/something/app.cnf\", \"myapp\",\n                              CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {\n    fprintf(stderr, \"WARNING: error loading configuration file\\n\");\n    ERR_print_errors_fp(stderr);\n}\n

Load and parse configuration file manually, custom error handling:

FILE *fp;\nCONF *cnf = NULL;\nlong eline;\n\nfp = fopen(\"/somepath/app.cnf\", \"r\");\nif (fp == NULL) {\n    fprintf(stderr, \"Error opening configuration file\\n\");\n    /* Other missing configuration file behaviour */\n} else {\n    cnf = NCONF_new_ex(libctx, NULL);\n    if (NCONF_load_fp(cnf, fp, &eline) == 0) {\n        fprintf(stderr, \"Error on line %ld of configuration file\\n\", eline);\n        ERR_print_errors_fp(stderr);\n        /* Other malformed configuration file behaviour */\n    } else if (CONF_modules_load(cnf, \"appname\", 0) <= 0) {\n        fprintf(stderr, \"Error configuring application\\n\");\n        ERR_print_errors_fp(stderr);\n        /* Other configuration error behaviour */\n    }\n    fclose(fp);\n    NCONF_free(cnf);\n}\n
"},{"location":"man3/CONF_modules_load_file/#see-also","title":"SEE ALSO","text":"

config(5), OPENSSL_config(3), NCONF_new_ex(3)

"},{"location":"man3/CONF_modules_load_file/#copyright","title":"COPYRIGHT","text":"

Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CRYPTO_THREAD_run_once/","title":"CRYPTO_THREAD_run_once","text":""},{"location":"man3/CRYPTO_THREAD_run_once/#name","title":"NAME","text":"

CRYPTO_THREAD_run_once, CRYPTO_THREAD_lock_new, CRYPTO_THREAD_read_lock, CRYPTO_THREAD_write_lock, CRYPTO_THREAD_unlock, CRYPTO_THREAD_lock_free, CRYPTO_atomic_add, CRYPTO_atomic_or, CRYPTO_atomic_load - OpenSSL thread support

"},{"location":"man3/CRYPTO_THREAD_run_once/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/crypto.h>\n\nCRYPTO_ONCE CRYPTO_ONCE_STATIC_INIT;\nint CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));\n\nCRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);\nint CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);\nint CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);\nint CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);\nvoid CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);\n\nint CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);\nint CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret,\n                     CRYPTO_RWLOCK *lock);\nint CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock);\n
"},{"location":"man3/CRYPTO_THREAD_run_once/#description","title":"DESCRIPTION","text":"

OpenSSL can be safely used in multi-threaded applications provided that support for the underlying OS threading API is built-in. Currently, OpenSSL supports the pthread and Windows APIs. OpenSSL can also be built without any multi-threading support, for example on platforms that don't provide any threading support or that provide a threading API that is not yet supported by OpenSSL.

The following multi-threading function are provided:

  • CRYPTO_THREAD_run_once() can be used to perform one-time initialization. The once argument must be a pointer to a static object of type CRYPTO_ONCE that was statically initialized to the value CRYPTO_ONCE_STATIC_INIT. The init argument is a pointer to a function that performs the desired exactly once initialization. In particular, this can be used to allocate locks in a thread-safe manner, which can then be used with the locking functions below.
  • CRYPTO_THREAD_lock_new() allocates, initializes and returns a new read/write lock.
  • CRYPTO_THREAD_read_lock() locks the provided lock for reading.
  • CRYPTO_THREAD_write_lock() locks the provided lock for writing.
  • CRYPTO_THREAD_unlock() unlocks the previously locked lock.
  • CRYPTO_THREAD_lock_free() frees the provided lock. If the argument is NULL, nothing is done.
  • CRYPTO_atomic_add() atomically adds amount to *val and returns the result of the operation in *ret. lock will be locked, unless atomic operations are supported on the specific platform. Because of this, if a variable is modified by CRYPTO_atomic_add() then CRYPTO_atomic_add() must be the only way that the variable is modified. If atomic operations are not supported and lock is NULL, then the function will fail.
  • CRYPTO_atomic_or() performs an atomic bitwise or of op and *val and stores the result back in *val. It also returns the result of the operation in *ret. lock will be locked, unless atomic operations are supported on the specific platform. Because of this, if a variable is modified by CRYPTO_atomic_or() or read by CRYPTO_atomic_load() then CRYPTO_atomic_or() must be the only way that the variable is modified. If atomic operations are not supported and lock is NULL, then the function will fail.
  • CRYPTO_atomic_load() atomically loads the contents of *val into *ret. lock will be locked, unless atomic operations are supported on the specific platform. Because of this, if a variable is modified by CRYPTO_atomic_or() or read by CRYPTO_atomic_load() then CRYPTO_atomic_load() must be the only way that the variable is read. If atomic operations are not supported and lock is NULL, then the function will fail.
"},{"location":"man3/CRYPTO_THREAD_run_once/#return-values","title":"RETURN VALUES","text":"

CRYPTO_THREAD_run_once() returns 1 on success, or 0 on error.

CRYPTO_THREAD_lock_new() returns the allocated lock, or NULL on error.

CRYPTO_THREAD_lock_free() returns no value.

The other functions return 1 on success, or 0 on error.

"},{"location":"man3/CRYPTO_THREAD_run_once/#notes","title":"NOTES","text":"

On Windows platforms the CRYPTO_THREAD_* types and functions in the <openssl/crypto.h> header are dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/crypto.h> where use of CRYPTO_THREAD_* types and functions is required.

"},{"location":"man3/CRYPTO_THREAD_run_once/#examples","title":"EXAMPLES","text":"

You can find out if OpenSSL was configured with thread support:

#include <openssl/opensslconf.h>\n#if defined(OPENSSL_THREADS)\n    /* thread support enabled */\n#else\n    /* no thread support */\n#endif\n

This example safely initializes and uses a lock.

#ifdef _WIN32\n

# # include #endif #include

static CRYPTO_ONCE once = CRYPTO_ONCE_STATIC_INIT;\nstatic CRYPTO_RWLOCK *lock;\n\nstatic void myinit(void)\n{\n    lock = CRYPTO_THREAD_lock_new();\n}\n\nstatic int mylock(void)\n{\n    if (!CRYPTO_THREAD_run_once(&once, void init) || lock == NULL)\n        return 0;\n    return CRYPTO_THREAD_write_lock(lock);\n}\n\nstatic int myunlock(void)\n{\n    return CRYPTO_THREAD_unlock(lock);\n}\n\nint serialized(void)\n{\n    int ret = 0;\n\n    if (!mylock()) {\n       /* Do not unlock unless the lock was successfully acquired. */\n       return 0;\n    }\n\n    /* Your code here, do not return without releasing the lock! */\n    ret = ... ;\n    myunlock();\n    return ret;\n}\n

Finalization of locks is an advanced topic, not covered in this example. This can only be done at process exit or when a dynamically loaded library is no longer in use and is unloaded. The simplest solution is to just \"leak\" the lock in applications and not repeatedly load/unload shared libraries that allocate locks.

"},{"location":"man3/CRYPTO_THREAD_run_once/#see-also","title":"SEE ALSO","text":"

crypto(7), openssl-threads(7).

"},{"location":"man3/CRYPTO_THREAD_run_once/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CRYPTO_get_ex_new_index/","title":"CRYPTO_get_ex_new_index","text":""},{"location":"man3/CRYPTO_get_ex_new_index/#name","title":"NAME","text":"

CRYPTO_EX_new, CRYPTO_EX_free, CRYPTO_EX_dup, CRYPTO_free_ex_index, CRYPTO_get_ex_new_index, CRYPTO_alloc_ex_data, CRYPTO_set_ex_data, CRYPTO_get_ex_data, CRYPTO_free_ex_data, CRYPTO_new_ex_data - functions supporting application-specific data

"},{"location":"man3/CRYPTO_get_ex_new_index/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/crypto.h>\n\nint CRYPTO_get_ex_new_index(int class_index,\n                            long argl, void *argp,\n                            CRYPTO_EX_new *new_func,\n                            CRYPTO_EX_dup *dup_func,\n                            CRYPTO_EX_free *free_func);\n\ntypedef void CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n                           int idx, long argl, void *argp);\ntypedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n                            int idx, long argl, void *argp);\ntypedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,\n                          void **from_d, int idx, long argl, void *argp);\n\nint CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);\n\nint CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,\n                         int idx);\n\nint CRYPTO_set_ex_data(CRYPTO_EX_DATA *r, int idx, void *arg);\n\nvoid *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *r, int idx);\n\nvoid CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *r);\n\nint CRYPTO_free_ex_index(int class_index, int idx);\n
"},{"location":"man3/CRYPTO_get_ex_new_index/#description","title":"DESCRIPTION","text":"

Several OpenSSL structures can have application-specific data attached to them, known as \"exdata.\" The specific structures are:

BIO\nDH\nDSA\nEC_KEY\nENGINE\nEVP_PKEY\nRSA\nSSL\nSSL_CTX\nSSL_SESSION\nUI\nUI_METHOD\nX509\nX509_STORE\nX509_STORE_CTX\n

In addition, the APP name is reserved for use by application code.

Each is identified by an CRYPTO_EX_INDEX_xxx define in the header file <openssl/crypto.h>. In addition, CRYPTO_EX_INDEX_APP is reserved for applications to use this facility for their own structures.

The API described here is used by OpenSSL to manipulate exdata for specific structures. Since the application data can be anything at all it is passed and retrieved as a void * type.

The CRYPTO_EX_DATA type is opaque. To initialize the exdata part of a structure, call CRYPTO_new_ex_data(). This is only necessary for CRYPTO_EX_INDEX_APP objects.

Exdata types are identified by an index, an integer guaranteed to be unique within structures for the lifetime of the program. Applications using exdata typically call CRYPTO_get_ex_new_index at startup, and store the result in a global variable, or write a wrapper function to provide lazy evaluation. The class_index should be one of the CRYPTO_EX_INDEX_xxx values. The argl and argp parameters are saved to be passed to the callbacks but are otherwise not used. In order to transparently manipulate exdata, three callbacks must be provided. The semantics of those callbacks are described below.

When copying or releasing objects with exdata, the callback functions are called in increasing order of their index value.

If a dynamic library can be unloaded, it should call CRYPTO_free_ex_index() when this is done. This will replace the callbacks with no-ops so that applications don't crash. Any existing exdata will be leaked.

To set or get the exdata on an object, the appropriate type-specific routine must be used. This is because the containing structure is opaque and the CRYPTO_EX_DATA field is not accessible. In both API's, the idx parameter should be an already-created index value.

When setting exdata, the pointer specified with a particular index is saved, and returned on a subsequent \"get\" call. If the application is going to release the data, it must make sure to set a NULL value at the index, to avoid likely double-free crashes.

The function CRYPTO_free_ex_data is used to free all exdata attached to a structure. The appropriate type-specific routine must be used. The class_index identifies the structure type, the obj is a pointer to the actual structure, and r is a pointer to the structure's exdata field.

"},{"location":"man3/CRYPTO_get_ex_new_index/#callback-functions","title":"Callback Functions","text":"

This section describes how the callback functions are used. Applications that are defining their own exdata using CYPRTO_EX_INDEX_APP must call them as described here.

When a structure is initially allocated (such as RSA_new()) then the new_func() is called for every defined index. There is no requirement that the entire parent, or containing, structure has been set up. The new_func() is typically used only to allocate memory to store the exdata, and perhaps an \"initialized\" flag within that memory. The exdata value may be allocated later on with CRYPTO_alloc_ex_data(), or may be set by calling CRYPTO_set_ex_data().

When a structure is free'd (such as SSL_CTX_free()) then the free_func() is called for every defined index. Again, the state of the parent structure is not guaranteed. The free_func() may be called with a NULL pointer.

Both new_func() and free_func() take the same parameters. The parent is the pointer to the structure that contains the exdata. The ptr is the current exdata item; for new_func() this will typically be NULL. The r parameter is a pointer to the exdata field of the object. The idx is the index and is the value returned when the callbacks were initially registered via CRYPTO_get_ex_new_index() and can be used if the same callback handles different types of exdata.

dup_func() is called when a structure is being copied. This is only done for SSL, SSL_SESSION, EC_KEY objects and BIO chains via BIO_dup_chain(). The to and from parameters are pointers to the destination and source CRYPTO_EX_DATA structures, respectively. The *from_d parameter is a pointer to the source exdata. When the dup_func() returns, the value in *from_d is copied to the destination ex_data. If the pointer contained in *pptr is not modified by the dup_func(), then both to and from will point to the same data. The idx, argl and argp parameters are as described for the other two callbacks. If the dup_func() returns 0 the whole CRYPTO_dup_ex_data() will fail.

"},{"location":"man3/CRYPTO_get_ex_new_index/#return-values","title":"RETURN VALUES","text":"

CRYPTO_get_ex_new_index() returns a new index or -1 on failure.

CRYPTO_free_ex_index(), CRYPTO_alloc_ex_data() and CRYPTO_set_ex_data() return 1 on success or 0 on failure.

CRYPTO_get_ex_data() returns the application data or NULL on failure; note that NULL may be a valid value.

dup_func() should return 0 for failure and 1 for success.

"},{"location":"man3/CRYPTO_get_ex_new_index/#history","title":"HISTORY","text":"

CRYPTO_alloc_ex_data() was added in OpenSSL 3.0.

The signature of the dup_func() callback was changed in OpenSSL 3.0 to use the type void ** for from_d. Previously this parameter was of type void *.

Support for ENGINE \"exdata\" was deprecated in OpenSSL 3.0.

"},{"location":"man3/CRYPTO_get_ex_new_index/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CRYPTO_memcmp/","title":"CRYPTO_memcmp","text":""},{"location":"man3/CRYPTO_memcmp/#name","title":"NAME","text":"

CRYPTO_memcmp - Constant time memory comparison

"},{"location":"man3/CRYPTO_memcmp/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/crypto.h>\n\nint CRYPTO_memcmp(const void *a, const void *b, size_t len);\n
"},{"location":"man3/CRYPTO_memcmp/#description","title":"DESCRIPTION","text":"

The CRYPTO_memcmp function compares the len bytes pointed to by a and b for equality. It takes an amount of time dependent on len, but independent of the contents of the memory regions pointed to by a and b.

"},{"location":"man3/CRYPTO_memcmp/#return-values","title":"RETURN VALUES","text":"

CRYPTO_memcmp() returns 0 if the memory regions are equal and nonzero otherwise.

"},{"location":"man3/CRYPTO_memcmp/#notes","title":"NOTES","text":"

Unlike memcmp(2), this function cannot be used to order the two memory regions as the return value when they differ is undefined, other than being nonzero.

"},{"location":"man3/CRYPTO_memcmp/#copyright","title":"COPYRIGHT","text":"

Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CTLOG_STORE_get0_log_by_id/","title":"CTLOG_STORE_get0_log_by_id","text":""},{"location":"man3/CTLOG_STORE_get0_log_by_id/#name","title":"NAME","text":"

CTLOG_STORE_get0_log_by_id - Get a Certificate Transparency log from a CTLOG_STORE

"},{"location":"man3/CTLOG_STORE_get0_log_by_id/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ct.h>\n\nconst CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,\n                                        const uint8_t *log_id,\n                                        size_t log_id_len);\n
"},{"location":"man3/CTLOG_STORE_get0_log_by_id/#description","title":"DESCRIPTION","text":"

A Signed Certificate Timestamp (SCT) identifies the Certificate Transparency (CT) log that issued it using the log's LogID (see RFC 6962, Section 3.2). Therefore, it is useful to be able to look up more information about a log (e.g. its public key) using this LogID.

CTLOG_STORE_get0_log_by_id() provides a way to do this. It will find a CTLOG in a CTLOG_STORE that has a given LogID.

"},{"location":"man3/CTLOG_STORE_get0_log_by_id/#return-values","title":"RETURN VALUES","text":"

CTLOG_STORE_get0_log_by_id returns a CTLOG with the given LogID, if it exists in the given CTLOG_STORE, otherwise it returns NULL.

"},{"location":"man3/CTLOG_STORE_get0_log_by_id/#see-also","title":"SEE ALSO","text":"

ct(7), CTLOG_STORE_new(3)

"},{"location":"man3/CTLOG_STORE_get0_log_by_id/#history","title":"HISTORY","text":"

The CTLOG_STORE_get0_log_by_id() function was added in OpenSSL 1.1.0.

"},{"location":"man3/CTLOG_STORE_get0_log_by_id/#copyright","title":"COPYRIGHT","text":"

Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CTLOG_STORE_new/","title":"CTLOG_STORE_new","text":""},{"location":"man3/CTLOG_STORE_new/#name","title":"NAME","text":"

CTLOG_STORE_new_ex, CTLOG_STORE_new, CTLOG_STORE_free, CTLOG_STORE_load_default_file, CTLOG_STORE_load_file - Create and populate a Certificate Transparency log list

"},{"location":"man3/CTLOG_STORE_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ct.h>\n\nCTLOG_STORE *CTLOG_STORE_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nCTLOG_STORE *CTLOG_STORE_new(void);\nvoid CTLOG_STORE_free(CTLOG_STORE *store);\n\nint CTLOG_STORE_load_default_file(CTLOG_STORE *store);\nint CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);\n
"},{"location":"man3/CTLOG_STORE_new/#description","title":"DESCRIPTION","text":"

A CTLOG_STORE is a container for a list of CTLOGs (Certificate Transparency logs). The list can be loaded from one or more files and then searched by LogID (see RFC 6962, Section 3.2, for the definition of a LogID).

CTLOG_STORE_new_ex() creates an empty list of CT logs associated with the library context libctx and the property query string propq.

CTLOG_STORE_new() does the same thing as CTLOG_STORE_new_ex() but with the default library context and property query string.

The CTLOG_STORE is then populated by CTLOG_STORE_load_default_file() or CTLOG_STORE_load_file(). CTLOG_STORE_load_default_file() loads from the default file, which is named ct_log_list.cnf in OPENSSLDIR (see the output of openssl-version(1)). This can be overridden using an environment variable named CTLOG_FILE. CTLOG_STORE_load_file() loads from a caller-specified file path instead. Both of these functions append any loaded CT logs to the CTLOG_STORE.

The expected format of the file is:

enabled_logs=foo,bar\n\n[foo]\ndescription = Log 1\nkey = <base64-encoded DER SubjectPublicKeyInfo here>\n\n[bar]\ndescription = Log 2\nkey = <base64-encoded DER SubjectPublicKeyInfo here>\n

Once a CTLOG_STORE is no longer required, it should be passed to CTLOG_STORE_free(). This will delete all of the CTLOGs stored within, along with the CTLOG_STORE itself. If the argument is NULL, nothing is done.

"},{"location":"man3/CTLOG_STORE_new/#notes","title":"NOTES","text":"

If there are any invalid CT logs in a file, they are skipped and the remaining valid logs will still be added to the CTLOG_STORE. A CT log will be considered invalid if it is missing a \"key\" or \"description\" field.

"},{"location":"man3/CTLOG_STORE_new/#return-values","title":"RETURN VALUES","text":"

Both CTLOG_STORE_load_default_file and CTLOG_STORE_load_file return 1 if all CT logs in the file are successfully parsed and loaded, 0 otherwise.

"},{"location":"man3/CTLOG_STORE_new/#see-also","title":"SEE ALSO","text":"

ct(7), CTLOG_STORE_get0_log_by_id(3), SSL_CTX_set_ctlog_list_file(3)

"},{"location":"man3/CTLOG_STORE_new/#history","title":"HISTORY","text":"

CTLOG_STORE_new_ex was added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0.

"},{"location":"man3/CTLOG_STORE_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CTLOG_new/","title":"CTLOG_new","text":""},{"location":"man3/CTLOG_new/#name","title":"NAME","text":"

CTLOG_new_ex, CTLOG_new, CTLOG_new_from_base64, CTLOG_new_from_base64_ex, CTLOG_free, CTLOG_get0_name, CTLOG_get0_log_id, CTLOG_get0_public_key - encapsulates information about a Certificate Transparency log

"},{"location":"man3/CTLOG_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ct.h>\n\nCTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name,\n                    OSSL_LIB_CTX *libctx, const char *propq);\nCTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);\n\nint CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,\n                             const char *name, OSSL_LIB_CTX *libctx,\n                             const char *propq);\nint CTLOG_new_from_base64(CTLOG ** ct_log,\n                          const char *pkey_base64, const char *name);\nvoid CTLOG_free(CTLOG *log);\nconst char *CTLOG_get0_name(const CTLOG *log);\nvoid CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,\n                       size_t *log_id_len);\nEVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);\n
"},{"location":"man3/CTLOG_new/#description","title":"DESCRIPTION","text":"

CTLOG_new_ex() returns a new CTLOG that represents the Certificate Transparency (CT) log with the given public key and associates it with the library context libctx and property query string propq. A name must also be provided that can be used to help users identify this log. Ownership of the public key is transferred.

CTLOG_new() does the same thing as CTLOG_new_ex() but with the default library context and the default property query string.

CTLOG_new_from_base64_ex() also creates a new CTLOG, but takes the public key in base64-encoded DER form and sets the ct_log pointer to point to the new CTLOG. The base64 will be decoded and the public key parsed. The CTLOG will be associated with the given library context libctx and property query string propq.

CTLOG_new_from_base64() does the same thing as CTLOG_new_from_base64_ex() except that the default library context and property query string are used.

Regardless of whether CTLOG_new() or CTLOG_new_from_base64() is used, it is the caller's responsibility to pass the CTLOG to CTLOG_free() once it is no longer needed. This will delete it and, if created by CTLOG_new(), the EVP_PKEY that was passed to it. If the argument to CTLOG_free() is NULL, nothing is done.

CTLOG_get0_name() returns the name of the log, as provided when the CTLOG was created. Ownership of the string remains with the CTLOG.

CTLOG_get0_log_id() sets *log_id to point to a string containing that log's LogID (see RFC 6962). It sets *log_id_len to the length of that LogID. For a v1 CT log, the LogID will be a SHA-256 hash (i.e. 32 bytes long). Ownership of the string remains with the CTLOG.

CTLOG_get0_public_key() returns the public key of the CT log. Ownership of the EVP_PKEY remains with the CTLOG.

"},{"location":"man3/CTLOG_new/#return-values","title":"RETURN VALUES","text":"

CTLOG_new() will return NULL if an error occurs.

CTLOG_new_from_base64() will return 1 on success, 0 otherwise.

"},{"location":"man3/CTLOG_new/#see-also","title":"SEE ALSO","text":"

ct(7)

"},{"location":"man3/CTLOG_new/#history","title":"HISTORY","text":"

The functions CTLOG_new_ex() and CTLOG_new_from_base64_ex() were added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0.

"},{"location":"man3/CTLOG_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/CT_POLICY_EVAL_CTX_new/","title":"CT_POLICY_EVAL_CTX_new","text":""},{"location":"man3/CT_POLICY_EVAL_CTX_new/#name","title":"NAME","text":"

CT_POLICY_EVAL_CTX_new_ex, CT_POLICY_EVAL_CTX_new, CT_POLICY_EVAL_CTX_free, CT_POLICY_EVAL_CTX_get0_cert, CT_POLICY_EVAL_CTX_set1_cert, CT_POLICY_EVAL_CTX_get0_issuer, CT_POLICY_EVAL_CTX_set1_issuer, CT_POLICY_EVAL_CTX_get0_log_store, CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE, CT_POLICY_EVAL_CTX_get_time, CT_POLICY_EVAL_CTX_set_time - Encapsulates the data required to evaluate whether SCTs meet a Certificate Transparency policy

"},{"location":"man3/CT_POLICY_EVAL_CTX_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ct.h>\n\nCT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,\n                                              const char *propq);\nCT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);\nvoid CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);\nX509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);\nint CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);\nX509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);\nint CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);\nconst CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);\nvoid CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,\n                                               CTLOG_STORE *log_store);\nuint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);\nvoid CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);\n
"},{"location":"man3/CT_POLICY_EVAL_CTX_new/#description","title":"DESCRIPTION","text":"

A CT_POLICY_EVAL_CTX is used by functions that evaluate whether Signed Certificate Timestamps (SCTs) fulfil a Certificate Transparency (CT) policy. This policy may be, for example, that at least one valid SCT is available. To determine this, an SCT's timestamp and signature must be verified. This requires:

  • the public key of the log that issued the SCT
  • the certificate that the SCT was issued for
  • the issuer certificate (if the SCT was issued for a pre-certificate)
  • the current time

The above requirements are met using the setters described below.

CT_POLICY_EVAL_CTX_new_ex() creates an empty policy evaluation context and associates it with the given library context libctx and property query string propq.

CT_POLICY_EVAL_CTX_new() does the same thing as CT_POLICY_EVAL_CTX_new_ex() except that it uses the default library context and property query string.

The CT_POLICY_EVAL_CTX should then be populated using:

  • CT_POLICY_EVAL_CTX_set1_cert() to provide the certificate the SCTs were issued for

    Increments the reference count of the certificate.

  • CT_POLICY_EVAL_CTX_set1_issuer() to provide the issuer certificate

    Increments the reference count of the certificate.

  • CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE() to provide a list of logs that are trusted as sources of SCTs

    Holds a pointer to the CTLOG_STORE, so the CTLOG_STORE must outlive the CT_POLICY_EVAL_CTX.

  • CT_POLICY_EVAL_CTX_set_time() to set the time SCTs should be compared with to determine if they are valid

    The SCT timestamp will be compared to this time to check whether the SCT was issued in the future. RFC6962 states that \"TLS clients MUST reject SCTs whose timestamp is in the future\". By default, this will be set to 5 minutes in the future (e.g. (time() + 300) * 1000), to allow for clock drift.

    The time should be in milliseconds since the Unix Epoch.

Each setter has a matching getter for accessing the current value.

When no longer required, the CT_POLICY_EVAL_CTX should be passed to CT_POLICY_EVAL_CTX_free() to delete it. If the argument to CT_POLICY_EVAL_CTX_free() is NULL, nothing is done.

"},{"location":"man3/CT_POLICY_EVAL_CTX_new/#notes","title":"NOTES","text":"

The issuer certificate only needs to be provided if at least one of the SCTs was issued for a pre-certificate. This will be the case for SCTs embedded in a certificate (i.e. those in an X.509 extension), but may not be the case for SCTs found in the TLS SCT extension or OCSP response.

"},{"location":"man3/CT_POLICY_EVAL_CTX_new/#return-values","title":"RETURN VALUES","text":"

CT_POLICY_EVAL_CTX_new_ex() and CT_POLICY_EVAL_CTX_new() will return NULL if malloc fails.

"},{"location":"man3/CT_POLICY_EVAL_CTX_new/#see-also","title":"SEE ALSO","text":"

ct(7)

"},{"location":"man3/CT_POLICY_EVAL_CTX_new/#history","title":"HISTORY","text":"

CT_POLICY_EVAL_CTX_new_ex was added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0.

"},{"location":"man3/CT_POLICY_EVAL_CTX_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DEFINE_STACK_OF/","title":"DEFINE_STACK_OF","text":""},{"location":"man3/DEFINE_STACK_OF/#name","title":"NAME","text":"

DEFINE_STACK_OF, DEFINE_STACK_OF_CONST, DEFINE_SPECIAL_STACK_OF, DEFINE_SPECIAL_STACK_OF_CONST, sk_TYPE_num, sk_TYPE_value, sk_TYPE_new, sk_TYPE_new_null, sk_TYPE_reserve, sk_TYPE_free, sk_TYPE_zero, sk_TYPE_delete, sk_TYPE_delete_ptr, sk_TYPE_push, sk_TYPE_unshift, sk_TYPE_pop, sk_TYPE_shift, sk_TYPE_pop_free, sk_TYPE_insert, sk_TYPE_set, sk_TYPE_find, sk_TYPE_find_ex, sk_TYPE_find_all, sk_TYPE_sort, sk_TYPE_is_sorted, sk_TYPE_dup, sk_TYPE_deep_copy, sk_TYPE_set_cmp_func, sk_TYPE_new_reserve, OPENSSL_sk_deep_copy, OPENSSL_sk_delete, OPENSSL_sk_delete_ptr, OPENSSL_sk_dup, OPENSSL_sk_find, OPENSSL_sk_find_ex, OPENSSL_sk_find_all, OPENSSL_sk_free, OPENSSL_sk_insert, OPENSSL_sk_is_sorted, OPENSSL_sk_new, OPENSSL_sk_new_null, OPENSSL_sk_new_reserve, OPENSSL_sk_num, OPENSSL_sk_pop, OPENSSL_sk_pop_free, OPENSSL_sk_push, OPENSSL_sk_reserve, OPENSSL_sk_set, OPENSSL_sk_set_cmp_func, OPENSSL_sk_shift, OPENSSL_sk_sort, OPENSSL_sk_unshift, OPENSSL_sk_value, OPENSSL_sk_zero - stack container

"},{"location":"man3/DEFINE_STACK_OF/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/safestack.h>\n\nSTACK_OF(TYPE)\nDEFINE_STACK_OF(TYPE)\nDEFINE_STACK_OF_CONST(TYPE)\nDEFINE_SPECIAL_STACK_OF(FUNCTYPE, TYPE)\nDEFINE_SPECIAL_STACK_OF_CONST(FUNCTYPE, TYPE)\n\ntypedef int (*sk_TYPE_compfunc)(const TYPE *const *a, const TYPE *const *b);\ntypedef TYPE * (*sk_TYPE_copyfunc)(const TYPE *a);\ntypedef void (*sk_TYPE_freefunc)(TYPE *a);\n\nint sk_TYPE_num(const STACK_OF(TYPE) *sk);\nTYPE *sk_TYPE_value(const STACK_OF(TYPE) *sk, int idx);\nSTACK_OF(TYPE) *sk_TYPE_new(sk_TYPE_compfunc compare);\nSTACK_OF(TYPE) *sk_TYPE_new_null(void);\nint sk_TYPE_reserve(STACK_OF(TYPE) *sk, int n);\nvoid sk_TYPE_free(STACK_OF(TYPE) *sk);\nvoid sk_TYPE_zero(STACK_OF(TYPE) *sk);\nTYPE *sk_TYPE_delete(STACK_OF(TYPE) *sk, int i);\nTYPE *sk_TYPE_delete_ptr(STACK_OF(TYPE) *sk, TYPE *ptr);\nint sk_TYPE_push(STACK_OF(TYPE) *sk, const TYPE *ptr);\nint sk_TYPE_unshift(STACK_OF(TYPE) *sk, const TYPE *ptr);\nTYPE *sk_TYPE_pop(STACK_OF(TYPE) *sk);\nTYPE *sk_TYPE_shift(STACK_OF(TYPE) *sk);\nvoid sk_TYPE_pop_free(STACK_OF(TYPE) *sk, sk_TYPE_freefunc freefunc);\nint sk_TYPE_insert(STACK_OF(TYPE) *sk, TYPE *ptr, int idx);\nTYPE *sk_TYPE_set(STACK_OF(TYPE) *sk, int idx, const TYPE *ptr);\nint sk_TYPE_find(STACK_OF(TYPE) *sk, TYPE *ptr);\nint sk_TYPE_find_ex(STACK_OF(TYPE) *sk, TYPE *ptr);\nint sk_TYPE_find_all(STACK_OF(TYPE) *sk, TYPE *ptr, int *pnum);\nvoid sk_TYPE_sort(const STACK_OF(TYPE) *sk);\nint sk_TYPE_is_sorted(const STACK_OF(TYPE) *sk);\nSTACK_OF(TYPE) *sk_TYPE_dup(const STACK_OF(TYPE) *sk);\nSTACK_OF(TYPE) *sk_TYPE_deep_copy(const STACK_OF(TYPE) *sk,\n                                  sk_TYPE_copyfunc copyfunc,\n                                  sk_TYPE_freefunc freefunc);\nsk_TYPE_compfunc (*sk_TYPE_set_cmp_func(STACK_OF(TYPE) *sk,\n                                        sk_TYPE_compfunc compare));\nSTACK_OF(TYPE) *sk_TYPE_new_reserve(sk_TYPE_compfunc compare, int n);\n
"},{"location":"man3/DEFINE_STACK_OF/#description","title":"DESCRIPTION","text":"

Applications can create and use their own stacks by placing any of the macros described below in a header file. These macros define typesafe inline functions that wrap around the utility OPENSSL_sk_ API. In the description here, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509.

The STACK_OF() macro returns the name for a stack of the specified TYPE. This is an opaque pointer to a structure declaration. This can be used in every header file that references the stack. There are several DEFINE... macros that create static inline functions for all of the functions described on this page. This should normally be used in one source file, and the stack manipulation is wrapped with application-specific functions.

DEFINE_STACK_OF() creates set of functions for a stack of TYPE elements. The type is referenced by STACK_OF(TYPE) and each function name begins with sk_TYPE_. DEFINE_STACK_OF_CONST() is identical to DEFINE_STACK_OF() except each element is constant.

/* DEFINE_STACK_OF(TYPE) */\nTYPE *sk_TYPE_value(STACK_OF(TYPE) *sk, int idx);\n/* DEFINE_STACK_OF_CONST(TYPE) */\nconst TYPE *sk_TYPE_value(STACK_OF(TYPE) *sk, int idx);\n

DEFINE_SPECIAL_STACK_OF() and DEFINE_SPECIAL_STACK_OF_CONST() are similar except FUNCNAME is used in the function names:

/* DEFINE_SPECIAL_STACK_OF(TYPE, FUNCNAME) */\nTYPE *sk_FUNCNAME_value(STACK_OF(TYPE) *sk, int idx);\n/* DEFINE_SPECIAL_STACK_OF(TYPE, FUNCNAME) */\nconst TYPE *sk_FUNCNAME_value(STACK_OF(TYPE) *sk, int idx);\n

sk_TYPE_num() returns the number of elements in sk or -1 if sk is NULL.

sk_TYPE_value() returns element idx in sk, where idx starts at zero. If idx is out of range then NULL is returned.

sk_TYPE_new() allocates a new empty stack using comparison function compare. If compare is NULL then no comparison function is used. This function is equivalent to sk_TYPE_new_reserve(compare, 0).

sk_TYPE_new_null() allocates a new empty stack with no comparison function. This function is equivalent to sk_TYPE_new_reserve(NULL, 0).

sk_TYPE_reserve() allocates additional memory in the sk structure such that the next n calls to sk_TYPE_insert(), sk_TYPE_push() or sk_TYPE_unshift() will not fail or cause memory to be allocated or reallocated. If n is zero, any excess space allocated in the sk structure is freed. On error sk is unchanged.

sk_TYPE_new_reserve() allocates a new stack. The new stack will have additional memory allocated to hold n elements if n is positive. The next n calls to sk_TYPE_insert(), sk_TYPE_push() or sk_TYPE_unshift() will not fail or cause memory to be allocated or reallocated. If n is zero or less than zero, no memory is allocated. sk_TYPE_new_reserve() also sets the comparison function compare to the newly created stack. If compare is NULL then no comparison function is used.

sk_TYPE_set_cmp_func() sets the comparison function of sk to compare. The previous comparison function is returned or NULL if there was no previous comparison function.

sk_TYPE_free() frees up the sk structure. It does not free up any elements of sk. After this call sk is no longer valid.

sk_TYPE_zero() sets the number of elements in sk to zero. It does not free sk so after this call sk is still valid.

sk_TYPE_pop_free() frees up all elements of sk and sk itself. The free function freefunc() is called on each element to free it.

sk_TYPE_delete() deletes element i from sk. It returns the deleted element or NULL if i is out of range.

sk_TYPE_delete_ptr() deletes element matching ptr from sk. It returns the deleted element or NULL if no element matching ptr was found.

sk_TYPE_insert() inserts ptr into sk at position idx. Any existing elements at or after idx are moved downwards. If idx is out of range the new element is appended to sk. sk_TYPE_insert() either returns the number of elements in sk after the new element is inserted or zero if an error (such as memory allocation failure) occurred.

sk_TYPE_push() appends ptr to sk it is equivalent to:

sk_TYPE_insert(sk, ptr, -1);\n

sk_TYPE_unshift() inserts ptr at the start of sk it is equivalent to:

sk_TYPE_insert(sk, ptr, 0);\n

sk_TYPE_pop() returns and removes the last element from sk.

sk_TYPE_shift() returns and removes the first element from sk.

sk_TYPE_set() sets element idx of sk to ptr replacing the current element. The new element value is returned or NULL if an error occurred: this will only happen if sk is NULL or idx is out of range.

sk_TYPE_find() searches sk for the element ptr. In the case where no comparison function has been specified, the function performs a linear search for a pointer equal to ptr. The index of the first matching element is returned or -1 if there is no match. In the case where a comparison function has been specified, sk is sorted and sk_TYPE_find() returns the index of a matching element or -1 if there is no match. Note that, in this case the comparison function will usually compare the values pointed to rather than the pointers themselves and the order of elements in sk can change. Note that because the stack may be sorted as the result of a sk_TYPE_find() call, if a lock is being used to synchronise access to the stack across multiple threads, then that lock must be a \"write\" lock.

sk_TYPE_find_ex() operates like sk_TYPE_find() except when a comparison function has been specified and no matching element is found. Instead of returning -1, sk_TYPE_find_ex() returns the index of the element either before or after the location where ptr would be if it were present in sk. The function also does not guarantee that the first matching element in the sorted stack is returned.

sk_TYPE_find_all() operates like sk_TYPE_find() but it also sets the *pnum to number of matching elements in the stack. In case no comparison function has been specified the *pnum will be always set to 1 if matching element was found, 0 otherwise.

sk_TYPE_sort() sorts sk using the supplied comparison function.

sk_TYPE_is_sorted() returns 1 if sk is sorted and 0 otherwise.

sk_TYPE_dup() returns a shallow copy of sk or an empty stack if the passed stack is NULL. Note the pointers in the copy are identical to the original.

sk_TYPE_deep_copy() returns a new stack where each element has been copied or an empty stack if the passed stack is NULL. Copying is performed by the supplied copyfunc() and freeing by freefunc(). The function freefunc() is only called if an error occurs.

"},{"location":"man3/DEFINE_STACK_OF/#notes","title":"NOTES","text":"

Care should be taken when accessing stacks in multi-threaded environments. Any operation which increases the size of a stack such as sk_TYPE_insert() or sk_TYPE_push() can \"grow\" the size of an internal array and cause race conditions if the same stack is accessed in a different thread. Operations such as sk_TYPE_find() and sk_TYPE_sort() can also reorder the stack.

Any comparison function supplied should use a metric suitable for use in a binary search operation. That is it should return zero, a positive or negative value if a is equal to, greater than or less than b respectively.

Care should be taken when checking the return values of the functions sk_TYPE_find() and sk_TYPE_find_ex(). They return an index to the matching element. In particular 0 indicates a matching first element. A failed search is indicated by a -1 return value.

STACK_OF(), DEFINE_STACK_OF(), DEFINE_STACK_OF_CONST(), and DEFINE_SPECIAL_STACK_OF() are implemented as macros.

It is not an error to call sk_TYPE_num(), sk_TYPE_value(), sk_TYPE_free(), sk_TYPE_zero(), sk_TYPE_pop_free(), sk_TYPE_delete(), sk_TYPE_delete_ptr(), sk_TYPE_pop(), sk_TYPE_shift(), sk_TYPE_find(), sk_TYPE_find_ex(), and sk_TYPE_find_all() on a NULL stack, empty stack, or with an invalid index. An error is not raised in these conditions.

The underlying utility OPENSSL_sk_ API should not be used directly. It defines these functions: OPENSSL_sk_deep_copy(), OPENSSL_sk_delete(), OPENSSL_sk_delete_ptr(), OPENSSL_sk_dup(), OPENSSL_sk_find(), OPENSSL_sk_find_ex(), OPENSSL_sk_find_all(), OPENSSL_sk_free(), OPENSSL_sk_insert(), OPENSSL_sk_is_sorted(), OPENSSL_sk_new(), OPENSSL_sk_new_null(), OPENSSL_sk_new_reserve(), OPENSSL_sk_num(), OPENSSL_sk_pop(), OPENSSL_sk_pop_free(), OPENSSL_sk_push(), OPENSSL_sk_reserve(), OPENSSL_sk_set(), OPENSSL_sk_set_cmp_func(), OPENSSL_sk_shift(), OPENSSL_sk_sort(), OPENSSL_sk_unshift(), OPENSSL_sk_value(), OPENSSL_sk_zero().

"},{"location":"man3/DEFINE_STACK_OF/#return-values","title":"RETURN VALUES","text":"

sk_TYPE_num() returns the number of elements in the stack or -1 if the passed stack is NULL.

sk_TYPE_value() returns a pointer to a stack element or NULL if the index is out of range.

sk_TYPE_new(), sk_TYPE_new_null() and sk_TYPE_new_reserve() return an empty stack or NULL if an error occurs.

sk_TYPE_reserve() returns 1 on successful allocation of the required memory or 0 on error.

sk_TYPE_set_cmp_func() returns the old comparison function or NULL if there was no old comparison function.

sk_TYPE_free(), sk_TYPE_zero(), sk_TYPE_pop_free() and sk_TYPE_sort() do not return values.

sk_TYPE_pop(), sk_TYPE_shift(), sk_TYPE_delete() and sk_TYPE_delete_ptr() return a pointer to the deleted element or NULL on error.

sk_TYPE_insert(), sk_TYPE_push() and sk_TYPE_unshift() return the total number of elements in the stack and 0 if an error occurred. sk_TYPE_push() further returns -1 if sk is NULL.

sk_TYPE_set() returns a pointer to the replacement element or NULL on error.

sk_TYPE_find() and sk_TYPE_find_ex() return an index to the found element or -1 on error.

sk_TYPE_is_sorted() returns 1 if the stack is sorted and 0 if it is not.

sk_TYPE_dup() and sk_TYPE_deep_copy() return a pointer to the copy of the stack or NULL on error.

"},{"location":"man3/DEFINE_STACK_OF/#history","title":"HISTORY","text":"

Before OpenSSL 1.1.0, this was implemented via macros and not inline functions and was not a public API.

sk_TYPE_reserve() and sk_TYPE_new_reserve() were added in OpenSSL 1.1.1.

"},{"location":"man3/DEFINE_STACK_OF/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DES_random_key/","title":"DES_random_key","text":""},{"location":"man3/DES_random_key/#name","title":"NAME","text":"

DES_random_key, DES_set_key, DES_key_sched, DES_set_key_checked, DES_set_key_unchecked, DES_set_odd_parity, DES_is_weak_key, DES_ecb_encrypt, DES_ecb2_encrypt, DES_ecb3_encrypt, DES_ncbc_encrypt, DES_cfb_encrypt, DES_ofb_encrypt, DES_pcbc_encrypt, DES_cfb64_encrypt, DES_ofb64_encrypt, DES_xcbc_encrypt, DES_ede2_cbc_encrypt, DES_ede2_cfb64_encrypt, DES_ede2_ofb64_encrypt, DES_ede3_cbc_encrypt, DES_ede3_cfb64_encrypt, DES_ede3_ofb64_encrypt, DES_cbc_cksum, DES_quad_cksum, DES_string_to_key, DES_string_to_2keys, DES_fcrypt, DES_crypt - DES encryption

"},{"location":"man3/DES_random_key/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/des.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void DES_random_key(DES_cblock *ret);\n\nint DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);\nint DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);\nint DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);\nvoid DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);\n\nvoid DES_set_odd_parity(DES_cblock *key);\nint DES_is_weak_key(const_DES_cblock *key);\n\nvoid DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,\n                     DES_key_schedule *ks, int enc);\nvoid DES_ecb2_encrypt(const_DES_cblock *input, DES_cblock *output,\n                      DES_key_schedule *ks1, DES_key_schedule *ks2, int enc);\nvoid DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,\n                      DES_key_schedule *ks1, DES_key_schedule *ks2,\n                      DES_key_schedule *ks3, int enc);\n\nvoid DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,\n                      long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                      int enc);\nvoid DES_cfb_encrypt(const unsigned char *in, unsigned char *out,\n                     int numbits, long length, DES_key_schedule *schedule,\n                     DES_cblock *ivec, int enc);\nvoid DES_ofb_encrypt(const unsigned char *in, unsigned char *out,\n                     int numbits, long length, DES_key_schedule *schedule,\n                     DES_cblock *ivec);\nvoid DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,\n                      long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                      int enc);\nvoid DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                       long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                       int *num, int enc);\nvoid DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                       long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                       int *num);\n\nvoid DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,\n                      long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                      const_DES_cblock *inw, const_DES_cblock *outw, int enc);\n\nvoid DES_ede2_cbc_encrypt(const unsigned char *input, unsigned char *output,\n                          long length, DES_key_schedule *ks1,\n                          DES_key_schedule *ks2, DES_cblock *ivec, int enc);\nvoid DES_ede2_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_cblock *ivec,\n                            int *num, int enc);\nvoid DES_ede2_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_cblock *ivec, int *num);\n\nvoid DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,\n                          long length, DES_key_schedule *ks1,\n                          DES_key_schedule *ks2, DES_key_schedule *ks3,\n                          DES_cblock *ivec, int enc);\nvoid DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_key_schedule *ks3,\n                            DES_cblock *ivec, int *num, int enc);\nvoid DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_key_schedule *ks3,\n                            DES_cblock *ivec, int *num);\n\nDES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,\n                       long length, DES_key_schedule *schedule,\n                       const_DES_cblock *ivec);\nDES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],\n                        long length, int out_count, DES_cblock *seed);\nvoid DES_string_to_key(const char *str, DES_cblock *key);\nvoid DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);\n\nchar *DES_fcrypt(const char *buf, const char *salt, char *ret);\nchar *DES_crypt(const char *buf, const char *salt);\n
"},{"location":"man3/DES_random_key/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) or the equivalently named decrypt functions.

This library contains a fast implementation of the DES encryption algorithm.

There are two phases to the use of DES encryption. The first is the generation of a DES_key_schedule from a key, the second is the actual encryption. A DES key is of type DES_cblock. This type consists of 8 bytes with odd parity. The least significant bit in each byte is the parity bit. The key schedule is an expanded form of the key; it is used to speed the encryption process.

DES_random_key() generates a random key. The random generator must be seeded when calling this function. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail. If the function fails, 0 is returned.

Before a DES key can be used, it must be converted into the architecture dependent DES_key_schedule via the DES_set_key_checked() or DES_set_key_unchecked() function.

DES_set_key_checked() will check that the key passed is of odd parity and is not a weak or semi-weak key. If the parity is wrong, then -1 is returned. If the key is a weak key, then -2 is returned. If an error is returned, the key schedule is not generated.

DES_set_key() works like DES_set_key_checked() and remains for backward compatibility.

DES_set_odd_parity() sets the parity of the passed key to odd.

DES_is_weak_key() returns 1 if the passed key is a weak key, 0 if it is ok.

The following routines mostly operate on an input and output stream of _DES_cblock_s.

DES_ecb_encrypt() is the basic DES encryption routine that encrypts or decrypts a single 8-byte DES_cblock in electronic code book (ECB) mode. It always transforms the input data, pointed to by input, into the output data, pointed to by the output argument. If the encrypt argument is nonzero (DES_ENCRYPT), the input (cleartext) is encrypted in to the output (ciphertext) using the key_schedule specified by the schedule argument, previously set via DES_set_key. If encrypt is zero (DES_DECRYPT), the input (now ciphertext) is decrypted into the output (now cleartext). Input and output may overlap. DES_ecb_encrypt() does not return a value.

DES_ecb3_encrypt() encrypts/decrypts the input block by using three-key Triple-DES encryption in ECB mode. This involves encrypting the input with ks1, decrypting with the key schedule ks2, and then encrypting with ks3. This routine greatly reduces the chances of brute force breaking of DES and has the advantage of if ks1, ks2 and ks3 are the same, it is equivalent to just encryption using ECB mode and ks1 as the key.

The macro DES_ecb2_encrypt() is provided to perform two-key Triple-DES encryption by using ks1 for the final encryption.

DES_ncbc_encrypt() encrypts/decrypts using the cipher-block-chaining (CBC) mode of DES. If the encrypt argument is nonzero, the routine cipher-block-chain encrypts the cleartext data pointed to by the input argument into the ciphertext pointed to by the output argument, using the key schedule provided by the schedule argument, and initialization vector provided by the ivec argument. If the length argument is not an integral multiple of eight bytes, the last block is copied to a temporary area and zero filled. The output is always an integral multiple of eight bytes.

DES_xcbc_encrypt() is RSA's DESX mode of DES. It uses inw and outw to 'whiten' the encryption. inw and outw are secret (unlike the iv) and are as such, part of the key. So the key is sort of 24 bytes. This is much better than CBC DES.

DES_ede3_cbc_encrypt() implements outer triple CBC DES encryption with three keys. This means that each DES operation inside the CBC mode is C=E(ks3,D(ks2,E(ks1,M))). This mode is used by SSL.

The DES_ede2_cbc_encrypt() macro implements two-key Triple-DES by reusing ks1 for the final encryption. C=E(ks1,D(ks2,E(ks1,M))). This form of Triple-DES is used by the RSAREF library.

DES_pcbc_encrypt() encrypts/decrypts using the propagating cipher block chaining mode used by Kerberos v4. Its parameters are the same as DES_ncbc_encrypt().

DES_cfb_encrypt() encrypts/decrypts using cipher feedback mode. This method takes an array of characters as input and outputs an array of characters. It does not require any padding to 8 character groups. Note: the ivec variable is changed and the new changed value needs to be passed to the next call to this function. Since this function runs a complete DES ECB encryption per numbits, this function is only suggested for use when sending a small number of characters.

DES_cfb64_encrypt() implements CFB mode of DES with 64-bit feedback. Why is this useful you ask? Because this routine will allow you to encrypt an arbitrary number of bytes, without 8 byte padding. Each call to this routine will encrypt the input bytes to output and then update ivec and num. num contains 'how far' we are though ivec. If this does not make much sense, read more about CFB mode of DES.

DES_ede3_cfb64_encrypt() and DES_ede2_cfb64_encrypt() is the same as DES_cfb64_encrypt() except that Triple-DES is used.

DES_ofb_encrypt() encrypts using output feedback mode. This method takes an array of characters as input and outputs an array of characters. It does not require any padding to 8 character groups. Note: the ivec variable is changed and the new changed value needs to be passed to the next call to this function. Since this function runs a complete DES ECB encryption per numbits, this function is only suggested for use when sending a small number of characters.

DES_ofb64_encrypt() is the same as DES_cfb64_encrypt() using Output Feed Back mode.

DES_ede3_ofb64_encrypt() and DES_ede2_ofb64_encrypt() is the same as DES_ofb64_encrypt(), using Triple-DES.

The following functions are included in the DES library for compatibility with the MIT Kerberos library.

DES_cbc_cksum() produces an 8 byte checksum based on the input stream (via CBC encryption). The last 4 bytes of the checksum are returned and the complete 8 bytes are placed in output. This function is used by Kerberos v4. Other applications should use EVP_DigestInit(3) etc. instead.

DES_quad_cksum() is a Kerberos v4 function. It returns a 4 byte checksum from the input bytes. The algorithm can be iterated over the input, depending on out_count, 1, 2, 3 or 4 times. If output is non-NULL, the 8 bytes generated by each pass are written into output.

The following are DES-based transformations:

DES_fcrypt() is a fast version of the Unix crypt(3) function. This version takes only a small amount of space relative to other fast crypt() implementations. This is different to the normal crypt() in that the third parameter is the buffer that the return value is written into. It needs to be at least 14 bytes long. This function is thread safe, unlike the normal crypt().

DES_crypt() is a faster replacement for the normal system crypt(). This function calls DES_fcrypt() with a static array passed as the third parameter. This mostly emulates the normal non-thread-safe semantics of crypt(3). The salt must be two ASCII characters.

The values returned by DES_fcrypt() and DES_crypt() are terminated by NUL character.

DES_enc_write() writes len bytes to file descriptor fd from buffer buf. The data is encrypted via pcbc_encrypt (default) using sched for the key and iv as a starting vector. The actual data send down fd consists of 4 bytes (in network byte order) containing the length of the following encrypted data. The encrypted data then follows, padded with random data out to a multiple of 8 bytes.

"},{"location":"man3/DES_random_key/#bugs","title":"BUGS","text":"

DES_cbc_encrypt() does not modify ivec; use DES_ncbc_encrypt() instead.

DES_cfb_encrypt() and DES_ofb_encrypt() operates on input of 8 bits. What this means is that if you set numbits to 12, and length to 2, the first 12 bits will come from the 1st input byte and the low half of the second input byte. The second 12 bits will have the low 8 bits taken from the 3rd input byte and the top 4 bits taken from the 4th input byte. The same holds for output. This function has been implemented this way because most people will be using a multiple of 8 and because once you get into pulling bytes input bytes apart things get ugly!

DES_string_to_key() is available for backward compatibility with the MIT library. New applications should use a cryptographic hash function. The same applies for DES_string_to_2key().

"},{"location":"man3/DES_random_key/#notes","title":"NOTES","text":"

The des library was written to be source code compatible with the MIT Kerberos library.

Applications should use the higher level functions EVP_EncryptInit(3) etc. instead of calling these functions directly.

Single-key DES is insecure due to its short key size. ECB mode is not suitable for most applications; see des_modes(7).

"},{"location":"man3/DES_random_key/#return-values","title":"RETURN VALUES","text":"

DES_set_key(), DES_key_sched(), and DES_set_key_checked() return 0 on success or negative values on error.

DES_is_weak_key() returns 1 if the passed key is a weak key, 0 if it is ok.

DES_cbc_cksum() and DES_quad_cksum() return 4-byte integer representing the last 4 bytes of the checksum of the input.

DES_fcrypt() returns a pointer to the caller-provided buffer and DES_crypt() - to a static buffer on success; otherwise they return NULL.

"},{"location":"man3/DES_random_key/#see-also","title":"SEE ALSO","text":"

des_modes(7), EVP_EncryptInit(3)

"},{"location":"man3/DES_random_key/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

The requirement that the salt parameter to DES_crypt() and DES_fcrypt() be two ASCII characters was first enforced in OpenSSL 1.1.0. Previous versions tried to use the letter uppercase A if both character were not present, and could crash when given non-ASCII on some platforms.

"},{"location":"man3/DES_random_key/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_generate_key/","title":"DH_generate_key","text":""},{"location":"man3/DH_generate_key/#name","title":"NAME","text":"

DH_generate_key, DH_compute_key, DH_compute_key_padded - perform Diffie-Hellman key exchange

"},{"location":"man3/DH_generate_key/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DH_generate_key(DH *dh);\n\nint DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);\n\nint DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh);\n
"},{"location":"man3/DH_generate_key/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_derive_init(3) and EVP_PKEY_derive(3).

DH_generate_key() performs the first step of a Diffie-Hellman key exchange by generating private and public DH values. By calling DH_compute_key() or DH_compute_key_padded(), these are combined with the other party's public value to compute the shared key.

DH_generate_key() expects dh to contain the shared parameters dh->p and dh->g. It generates a random private DH value unless dh->priv_key is already set, and computes the corresponding public value dh->pub_key, which can then be published.

DH_compute_key() computes the shared secret from the private DH value in dh and the other party's public value in pub_key and stores it in key. key must point to DH_size(dh) bytes of memory. The padding style is RFC 5246 (8.1.2) that strips leading zero bytes. It is not constant time due to the leading zero bytes being stripped. The return value should be considered public.

DH_compute_key_padded() is similar but stores a fixed number of bytes. The padding style is NIST SP 800-56A (C.1) that retains leading zero bytes. It is constant time due to the leading zero bytes being retained. The return value should be considered public.

"},{"location":"man3/DH_generate_key/#return-values","title":"RETURN VALUES","text":"

DH_generate_key() returns 1 on success, 0 otherwise.

DH_compute_key() returns the size of the shared secret on success, -1 on error.

DH_compute_key_padded() returns DH_size(dh) on success, -1 on error.

The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/DH_generate_key/#see-also","title":"SEE ALSO","text":"

EVP_PKEY_derive(3), DH_new(3), ERR_get_error(3), RAND_bytes(3), DH_size(3)

"},{"location":"man3/DH_generate_key/#history","title":"HISTORY","text":"

DH_compute_key_padded() was added in OpenSSL 1.0.2.

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DH_generate_key/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_generate_parameters/","title":"DH_generate_parameters","text":""},{"location":"man3/DH_generate_parameters/#name","title":"NAME","text":"

DH_generate_parameters_ex, DH_generate_parameters, DH_check, DH_check_params, DH_check_ex, DH_check_params_ex, DH_check_pub_key_ex - generate and check Diffie-Hellman parameters

"},{"location":"man3/DH_generate_parameters/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb);\n\nint DH_check(DH *dh, int *codes);\nint DH_check_params(DH *dh, int *codes);\n\nint DH_check_ex(const DH *dh);\nint DH_check_params_ex(const DH *dh);\nint DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key);\n

The following functions have been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DH *DH_generate_parameters(int prime_len, int generator,\n                           void (*callback)(int, int, void *), void *cb_arg);\n
"},{"location":"man3/DH_generate_parameters/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_check(3), EVP_PKEY_public_check(3), EVP_PKEY_private_check(3) and EVP_PKEY_param_check(3).

DH_generate_parameters_ex() generates Diffie-Hellman parameters that can be shared among a group of users, and stores them in the provided DH structure. The pseudo-random number generator must be seeded before calling it. The parameters generated by DH_generate_parameters_ex() should not be used in signature schemes.

prime_len is the length in bits of the safe prime to be generated. generator is a small number > 1, typically 2 or 5.

A callback function may be used to provide feedback about the progress of the key generation. If cb is not NULL, it will be called as described in BN_generate_prime(3) while a random prime number is generated, and when a prime has been found, BN_GENCB_call(cb, 3, 0) is called. See BN_generate_prime_ex(3) for information on the BN_GENCB_call() function.

DH_generate_parameters() is similar to DH_generate_prime_ex() but expects an old-style callback function; see BN_generate_prime(3) for information on the old-style callback.

DH_check_params() confirms that the p and g are likely enough to be valid. This is a lightweight check, if a more thorough check is needed, use DH_check(). The value of *codes is updated with any problems found. If *codes is zero then no problems were found, otherwise the following bits may be set:

  • DH_CHECK_P_NOT_PRIME

    The parameter p has been determined to not being an odd prime. Note that the lack of this bit doesn't guarantee that p is a prime.

  • DH_NOT_SUITABLE_GENERATOR

    The generator g is not suitable. Note that the lack of this bit doesn't guarantee that g is suitable, unless p is known to be a strong prime.

  • DH_MODULUS_TOO_SMALL

    The modulus is too small.

  • DH_MODULUS_TOO_LARGE

    The modulus is too large.

DH_check() confirms that the Diffie-Hellman parameters dh are valid. The value of *codes is updated with any problems found. If *codes is zero then no problems were found, otherwise the following bits may be set:

  • DH_CHECK_P_NOT_PRIME

    The parameter p is not prime.

  • DH_CHECK_P_NOT_SAFE_PRIME

    The parameter p is not a safe prime and no q value is present.

  • DH_UNABLE_TO_CHECK_GENERATOR

    The generator g cannot be checked for suitability.

  • DH_NOT_SUITABLE_GENERATOR

    The generator g is not suitable.

  • DH_CHECK_Q_NOT_PRIME

    The parameter q is not prime.

  • DH_CHECK_INVALID_Q_VALUE

    The parameter q is invalid.

  • DH_CHECK_INVALID_J_VALUE

    The parameter j is invalid.

If 0 is returned or *codes is set to a nonzero value the supplied parameters should not be used for Diffie-Hellman operations otherwise the security properties of the key exchange are not guaranteed.

DH_check_ex(), DH_check_params() and DH_check_pub_key_ex() are similar to DH_check() and DH_check_params() respectively, but the error reasons are added to the thread's error queue instead of provided as return values from the function.

"},{"location":"man3/DH_generate_parameters/#return-values","title":"RETURN VALUES","text":"

DH_generate_parameters_ex(), DH_check() and DH_check_params() return 1 if the check could be performed, 0 otherwise.

DH_generate_parameters() returns a pointer to the DH structure or NULL if the parameter generation fails.

DH_check_ex(), DH_check_params() and DH_check_pub_key_ex() return 1 if the check is successful, 0 for failed.

The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/DH_generate_parameters/#see-also","title":"SEE ALSO","text":"

DH_new(3), ERR_get_error(3), RAND_bytes(3), DH_free(3)

"},{"location":"man3/DH_generate_parameters/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

DH_generate_parameters() was deprecated in OpenSSL 0.9.8; use DH_generate_parameters_ex() instead.

"},{"location":"man3/DH_generate_parameters/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_get0_pqg/","title":"DH_get0_pqg","text":""},{"location":"man3/DH_get0_pqg/#name","title":"NAME","text":"

DH_get0_pqg, DH_set0_pqg, DH_get0_key, DH_set0_key, DH_get0_p, DH_get0_q, DH_get0_g, DH_get0_priv_key, DH_get0_pub_key, DH_clear_flags, DH_test_flags, DH_set_flags, DH_get0_engine, DH_get_length, DH_set_length - Routines for getting and setting data in a DH object

"},{"location":"man3/DH_get0_pqg/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void DH_get0_pqg(const DH *dh,\n                 const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);\nint DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);\nvoid DH_get0_key(const DH *dh,\n                 const BIGNUM **pub_key, const BIGNUM **priv_key);\nint DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);\nconst BIGNUM *DH_get0_p(const DH *dh);\nconst BIGNUM *DH_get0_q(const DH *dh);\nconst BIGNUM *DH_get0_g(const DH *dh);\nconst BIGNUM *DH_get0_priv_key(const DH *dh);\nconst BIGNUM *DH_get0_pub_key(const DH *dh);\nvoid DH_clear_flags(DH *dh, int flags);\nint DH_test_flags(const DH *dh, int flags);\nvoid DH_set_flags(DH *dh, int flags);\n\nlong DH_get_length(const DH *dh);\nint DH_set_length(DH *dh, long length);\n\nENGINE *DH_get0_engine(DH *d);\n
"},{"location":"man3/DH_get0_pqg/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bn_param(3) for any methods that return a BIGNUM. Refer to EVP_PKEY-DH(7) for more information.

A DH object contains the parameters p, q and g. Note that the q parameter is optional. It also contains a public key (pub_key) and (optionally) a private key (priv_key).

The p, q and g parameters can be obtained by calling DH_get0_pqg(). If the parameters have not yet been set then *p, *q and *g will be set to NULL. Otherwise they are set to pointers to their respective values. These point directly to the internal representations of the values and therefore should not be freed directly. Any of the out parameters p, q, and g can be NULL, in which case no value will be returned for that parameter.

The p, q and g values can be set by calling DH_set0_pqg() and passing the new values for p, q and g as parameters to the function. Calling this function transfers the memory management of the values to the DH object, and therefore the values that have been passed in should not be freed directly after this function has been called. The q parameter may be NULL. DH_set0_pqg() also checks if the parameters associated with p and g and optionally q are associated with known safe prime groups. If it is a safe prime group then the value of q will be set to q = (p - 1) / 2 if q is NULL. The optional length parameter will be set to BN_num_bits(q) if q is not NULL.

To get the public and private key values use the DH_get0_key() function. A pointer to the public key will be stored in *pub_key, and a pointer to the private key will be stored in *priv_key. Either may be NULL if they have not been set yet, although if the private key has been set then the public key must be. The values point to the internal representation of the public key and private key values. This memory should not be freed directly. Any of the out parameters pub_key and priv_key can be NULL, in which case no value will be returned for that parameter.

The public and private key values can be set using DH_set0_key(). Either parameter may be NULL, which means the corresponding DH field is left untouched. As with DH_set0_pqg() this function transfers the memory management of the key values to the DH object, and therefore they should not be freed directly after this function has been called.

Any of the values p, q, g, priv_key, and pub_key can also be retrieved separately by the corresponding function DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_priv_key(), and DH_get0_pub_key(), respectively.

DH_set_flags() sets the flags in the flags parameter on the DH object. Multiple flags can be passed in one go (bitwise ORed together). Any flags that are already set are left set. DH_test_flags() tests to see whether the flags passed in the flags parameter are currently set in the DH object. Multiple flags can be tested in one go. All flags that are currently set are returned, or zero if none of the flags are set. DH_clear_flags() clears the specified flags within the DH object.

DH_get0_engine() returns a handle to the ENGINE that has been set for this DH object, or NULL if no such ENGINE has been set. This function is deprecated. All engines should be replaced by providers.

The DH_get_length() and DH_set_length() functions get and set the optional length parameter associated with this DH object. If the length is nonzero then it is used, otherwise it is ignored. The length parameter indicates the length of the secret exponent (private key) in bits. For safe prime groups the optional length parameter length can be set to a value greater or equal to 2 * maximum_target_security_strength(BN_num_bits(p)) as listed in SP800-56Ar3 Table(s) 25 & 26. These functions are deprecated and should be replaced with EVP_PKEY_CTX_set_params() and EVP_PKEY_get_int_param() using the parameter key OSSL_PKEY_PARAM_DH_PRIV_LEN as described in EVP_PKEY-DH(7).

"},{"location":"man3/DH_get0_pqg/#notes","title":"NOTES","text":"

Values retrieved with DH_get0_key() are owned by the DH object used in the call and may therefore not be passed to DH_set0_key(). If needed, duplicate the received value using BN_dup() and pass the duplicate. The same applies to DH_get0_pqg() and DH_set0_pqg().

"},{"location":"man3/DH_get0_pqg/#return-values","title":"RETURN VALUES","text":"

DH_set0_pqg() and DH_set0_key() return 1 on success or 0 on failure.

DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_priv_key(), and DH_get0_pub_key() return the respective value, or NULL if it is unset.

DH_test_flags() returns the current state of the flags in the DH object.

DH_get0_engine() returns the ENGINE set for the DH object or NULL if no ENGINE has been set.

DH_get_length() returns the length of the secret exponent (private key) in bits, or zero if no such length has been explicitly set.

"},{"location":"man3/DH_get0_pqg/#see-also","title":"SEE ALSO","text":"

DH_new(3), DH_new(3), DH_generate_parameters(3), DH_generate_key(3), DH_set_method(3), DH_size(3), DH_meth_new(3)

"},{"location":"man3/DH_get0_pqg/#history","title":"HISTORY","text":"

The functions described here were added in OpenSSL 1.1.0.

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DH_get0_pqg/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_get_1024_160/","title":"DH_get_1024_160","text":""},{"location":"man3/DH_get_1024_160/#name","title":"NAME","text":"

DH_get_1024_160, DH_get_2048_224, DH_get_2048_256, BN_get0_nist_prime_192, BN_get0_nist_prime_224, BN_get0_nist_prime_256, BN_get0_nist_prime_384, BN_get0_nist_prime_521, BN_get_rfc2409_prime_768, BN_get_rfc2409_prime_1024, BN_get_rfc3526_prime_1536, BN_get_rfc3526_prime_2048, BN_get_rfc3526_prime_3072, BN_get_rfc3526_prime_4096, BN_get_rfc3526_prime_6144, BN_get_rfc3526_prime_8192 - Create standardized public primes or DH pairs

"},{"location":"man3/DH_get_1024_160/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n\nconst BIGNUM *BN_get0_nist_prime_192(void);\nconst BIGNUM *BN_get0_nist_prime_224(void);\nconst BIGNUM *BN_get0_nist_prime_256(void);\nconst BIGNUM *BN_get0_nist_prime_384(void);\nconst BIGNUM *BN_get0_nist_prime_521(void);\n\nBIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);\nBIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

#include <openssl/dh.h>\n\nDH *DH_get_1024_160(void);\nDH *DH_get_2048_224(void);\nDH *DH_get_2048_256(void);\n
"},{"location":"man3/DH_get_1024_160/#description","title":"DESCRIPTION","text":"

DH_get_1024_160(), DH_get_2048_224(), and DH_get_2048_256() each return a DH object for the IETF RFC 5114 value. These functions are deprecated. Applications should instead use EVP_PKEY_CTX_set_dh_rfc5114() and EVP_PKEY_CTX_set_dhx_rfc5114() as described in EVP_PKEY_CTX_ctrl(3) or by setting the OSSL_PKEY_PARAM_GROUP_NAME as specified in \"DH parameters\" in EVP_PKEY-DH(7)) to one of \"dh_1024_160\", \"dh_2048_224\" or \"dh_2048_256\".

BN_get0_nist_prime_192(), BN_get0_nist_prime_224(), BN_get0_nist_prime_256(), BN_get0_nist_prime_384(), and BN_get0_nist_prime_521() functions return a BIGNUM for the specific NIST prime curve (e.g., P-256).

BN_get_rfc2409_prime_768(), BN_get_rfc2409_prime_1024(), BN_get_rfc3526_prime_1536(), BN_get_rfc3526_prime_2048(), BN_get_rfc3526_prime_3072(), BN_get_rfc3526_prime_4096(), BN_get_rfc3526_prime_6144(), and BN_get_rfc3526_prime_8192() functions return a BIGNUM for the specified size from IETF RFC 2409. If bn is not NULL, the BIGNUM will be set into that location as well.

"},{"location":"man3/DH_get_1024_160/#return-values","title":"RETURN VALUES","text":"

Defined above.

"},{"location":"man3/DH_get_1024_160/#history","title":"HISTORY","text":"

The functions DH_get_1024_160(), DH_get_2048_224() and DH_get_2048_256() were deprecated in OpenSSL 3.0.

"},{"location":"man3/DH_get_1024_160/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_meth_new/","title":"DH_meth_new","text":""},{"location":"man3/DH_meth_new/#name","title":"NAME","text":"

DH_meth_new, DH_meth_free, DH_meth_dup, DH_meth_get0_name, DH_meth_set1_name, DH_meth_get_flags, DH_meth_set_flags, DH_meth_get0_app_data, DH_meth_set0_app_data, DH_meth_get_generate_key, DH_meth_set_generate_key, DH_meth_get_compute_key, DH_meth_set_compute_key, DH_meth_get_bn_mod_exp, DH_meth_set_bn_mod_exp, DH_meth_get_init, DH_meth_set_init, DH_meth_get_finish, DH_meth_set_finish, DH_meth_get_generate_params, DH_meth_set_generate_params - Routines to build up DH methods

"},{"location":"man3/DH_meth_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DH_METHOD *DH_meth_new(const char *name, int flags);\n\nvoid DH_meth_free(DH_METHOD *dhm);\n\nDH_METHOD *DH_meth_dup(const DH_METHOD *dhm);\n\nconst char *DH_meth_get0_name(const DH_METHOD *dhm);\nint DH_meth_set1_name(DH_METHOD *dhm, const char *name);\n\nint DH_meth_get_flags(const DH_METHOD *dhm);\nint DH_meth_set_flags(DH_METHOD *dhm, int flags);\n\nvoid *DH_meth_get0_app_data(const DH_METHOD *dhm);\nint DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data);\n\nint (*DH_meth_get_generate_key(const DH_METHOD *dhm))(DH *);\nint DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key)(DH *));\n\nint (*DH_meth_get_compute_key(const DH_METHOD *dhm))\n    (unsigned char *key, const BIGNUM *pub_key, DH *dh);\nint DH_meth_set_compute_key(DH_METHOD *dhm,\n    int (*compute_key)(unsigned char *key, const BIGNUM *pub_key, DH *dh));\n\nint (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm))\n    (const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n     const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\nint DH_meth_set_bn_mod_exp(DH_METHOD *dhm,\n    int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,\n                      const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n                      BN_MONT_CTX *m_ctx));\n\nint (*DH_meth_get_init(const DH_METHOD *dhm))(DH *);\nint DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *));\n\nint (*DH_meth_get_finish(const DH_METHOD *dhm))(DH *);\nint DH_meth_set_finish(DH_METHOD *dhm, int (*finish)(DH *));\n\nint (*DH_meth_get_generate_params(const DH_METHOD *dhm))\n    (DH *, int, int, BN_GENCB *);\nint DH_meth_set_generate_params(DH_METHOD *dhm,\n    int (*generate_params)(DH *, int, int, BN_GENCB *));\n
"},{"location":"man3/DH_meth_new/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use the provider APIs.

The DH_METHOD type is a structure used for the provision of custom DH implementations. It provides a set of functions used by OpenSSL for the implementation of the various DH capabilities.

DH_meth_new() creates a new DH_METHOD structure. It should be given a unique name and a set of flags. The name should be a NULL terminated string, which will be duplicated and stored in the DH_METHOD object. It is the callers responsibility to free the original string. The flags will be used during the construction of a new DH object based on this DH_METHOD. Any new DH object will have those flags set by default.

DH_meth_dup() creates a duplicate copy of the DH_METHOD object passed as a parameter. This might be useful for creating a new DH_METHOD based on an existing one, but with some differences.

DH_meth_free() destroys a DH_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

DH_meth_get0_name() will return a pointer to the name of this DH_METHOD. This is a pointer to the internal name string and so should not be freed by the caller. DH_meth_set1_name() sets the name of the DH_METHOD to name. The string is duplicated and the copy is stored in the DH_METHOD structure, so the caller remains responsible for freeing the memory associated with the name.

DH_meth_get_flags() returns the current value of the flags associated with this DH_METHOD. DH_meth_set_flags() provides the ability to set these flags.

The functions DH_meth_get0_app_data() and DH_meth_set0_app_data() provide the ability to associate implementation specific data with the DH_METHOD. It is the application's responsibility to free this data before the DH_METHOD is freed via a call to DH_meth_free().

DH_meth_get_generate_key() and DH_meth_set_generate_key() get and set the function used for generating a new DH key pair respectively. This function will be called in response to the application calling DH_generate_key(). The parameter for the function has the same meaning as for DH_generate_key().

DH_meth_get_compute_key() and DH_meth_set_compute_key() get and set the function used for computing a new DH shared secret respectively. This function will be called in response to the application calling DH_compute_key(). The parameters for the function have the same meaning as for DH_compute_key().

DH_meth_get_bn_mod_exp() and DH_meth_set_bn_mod_exp() get and set the function used for computing the following value:

r = a ^ p mod m\n

This function will be called by the default OpenSSL function for DH_generate_key(). The result is stored in the r parameter. This function may be NULL unless using the default generate key function, in which case it must be present.

DH_meth_get_init() and DH_meth_set_init() get and set the function used for creating a new DH instance respectively. This function will be called in response to the application calling DH_new() (if the current default DH_METHOD is this one) or DH_new_method(). The DH_new() and DH_new_method() functions will allocate the memory for the new DH object, and a pointer to this newly allocated structure will be passed as a parameter to the function. This function may be NULL.

DH_meth_get_finish() and DH_meth_set_finish() get and set the function used for destroying an instance of a DH object respectively. This function will be called in response to the application calling DH_free(). A pointer to the DH to be destroyed is passed as a parameter. The destroy function should be used for DH implementation specific clean up. The memory for the DH itself should not be freed by this function. This function may be NULL.

DH_meth_get_generate_params() and DH_meth_set_generate_params() get and set the function used for generating DH parameters respectively. This function will be called in response to the application calling DH_generate_parameters_ex() (or DH_generate_parameters()). The parameters for the function have the same meaning as for DH_generate_parameters_ex(). This function may be NULL.

"},{"location":"man3/DH_meth_new/#return-values","title":"RETURN VALUES","text":"

DH_meth_new() and DH_meth_dup() return the newly allocated DH_METHOD object or NULL on failure.

DH_meth_get0_name() and DH_meth_get_flags() return the name and flags associated with the DH_METHOD respectively.

All other DH_meth_get_*() functions return the appropriate function pointer that has been set in the DH_METHOD, or NULL if no such pointer has yet been set.

DH_meth_set1_name() and all DH_meth_set_*() functions return 1 on success or 0 on failure.

"},{"location":"man3/DH_meth_new/#see-also","title":"SEE ALSO","text":"

DH_new(3), DH_new(3), DH_generate_parameters(3), DH_generate_key(3), DH_set_method(3), DH_size(3), DH_get0_pqg(3)

"},{"location":"man3/DH_meth_new/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

The functions described here were added in OpenSSL 1.1.0.

"},{"location":"man3/DH_meth_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_new/","title":"DH_new","text":""},{"location":"man3/DH_new/#name","title":"NAME","text":"

DH_new, DH_free - allocate and free DH objects

"},{"location":"man3/DH_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DH* DH_new(void);\n\nvoid DH_free(DH *dh);\n
"},{"location":"man3/DH_new/#description","title":"DESCRIPTION","text":"

DH_new() allocates and initializes a DH structure.

DH_free() frees the DH structure and its components. The values are erased before the memory is returned to the system. If dh is NULL nothing is done.

"},{"location":"man3/DH_new/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, DH_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

DH_free() returns no value.

"},{"location":"man3/DH_new/#see-also","title":"SEE ALSO","text":"

DH_new(3), ERR_get_error(3), DH_generate_parameters(3), DH_generate_key(3), EVP_PKEY-DH(7)

"},{"location":"man3/DH_new/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

For replacement see EVP_PKEY-DH(7).

"},{"location":"man3/DH_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_new_by_nid/","title":"DH_new_by_nid","text":""},{"location":"man3/DH_new_by_nid/#name","title":"NAME","text":"

DH_new_by_nid, DH_get_nid - create or get DH named parameters

"},{"location":"man3/DH_new_by_nid/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DH *DH_new_by_nid(int nid);\n\nint DH_get_nid(const DH *dh);\n
"},{"location":"man3/DH_new_by_nid/#description","title":"DESCRIPTION","text":"

DH_new_by_nid() creates and returns a DH structure containing named parameters nid. Currently nid must be NID_ffdhe2048, NID_ffdhe3072, NID_ffdhe4096, NID_ffdhe6144, NID_ffdhe8192, NID_modp_1536, NID_modp_2048, NID_modp_3072, NID_modp_4096, NID_modp_6144 or NID_modp_8192.

DH_get_nid() determines if the parameters contained in dh match any named safe prime group. It returns the NID corresponding to the matching parameters or NID_undef if there is no match. This function is deprecated.

"},{"location":"man3/DH_new_by_nid/#return-values","title":"RETURN VALUES","text":"

DH_new_by_nid() returns a set of DH parameters or NULL if an error occurred.

DH_get_nid() returns the NID of the matching set of parameters for p and g and optionally q, otherwise it returns NID_undef if there is no match.

"},{"location":"man3/DH_new_by_nid/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DH_new_by_nid/#copyright","title":"COPYRIGHT","text":"

Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_set_method/","title":"DH_set_method","text":""},{"location":"man3/DH_set_method/#name","title":"NAME","text":"

DH_set_default_method, DH_get_default_method, DH_set_method, DH_new_method, DH_OpenSSL - select DH method

"},{"location":"man3/DH_set_method/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void DH_set_default_method(const DH_METHOD *meth);\n\nconst DH_METHOD *DH_get_default_method(void);\n\nint DH_set_method(DH *dh, const DH_METHOD *meth);\n\nDH *DH_new_method(ENGINE *engine);\n\nconst DH_METHOD *DH_OpenSSL(void);\n
"},{"location":"man3/DH_set_method/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use the provider APIs.

A DH_METHOD specifies the functions that OpenSSL uses for Diffie-Hellman operations. By modifying the method, alternative implementations such as hardware accelerators may be used. IMPORTANT: See the NOTES section for important information about how these DH API functions are affected by the use of ENGINE API calls.

Initially, the default DH_METHOD is the OpenSSL internal implementation, as returned by DH_OpenSSL().

DH_set_default_method() makes meth the default method for all DH structures created later. NB: This is true only whilst no ENGINE has been set as a default for DH, so this function is no longer recommended. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

DH_get_default_method() returns a pointer to the current default DH_METHOD. However, the meaningfulness of this result is dependent on whether the ENGINE API is being used, so this function is no longer recommended.

DH_set_method() selects meth to perform all operations using the key dh. This will replace the DH_METHOD used by the DH key and if the previous method was supplied by an ENGINE, the handle to that ENGINE will be released during the change. It is possible to have DH keys that only work with certain DH_METHOD implementations (e.g. from an ENGINE module that supports embedded hardware-protected keys), and in such cases attempting to change the DH_METHOD for the key can have unexpected results.

DH_new_method() allocates and initializes a DH structure so that engine will be used for the DH operations. If engine is NULL, the default ENGINE for DH operations is used, and if no default ENGINE is set, the DH_METHOD controlled by DH_set_default_method() is used.

A new DH_METHOD object may be constructed using DH_meth_new() (see DH_meth_new(3)).

"},{"location":"man3/DH_set_method/#return-values","title":"RETURN VALUES","text":"

DH_OpenSSL() and DH_get_default_method() return pointers to the respective DH_METHODs.

DH_set_default_method() returns no value.

DH_set_method() returns nonzero if the provided meth was successfully set as the method for dh (including unloading the ENGINE handle if the previous method was supplied by an ENGINE).

DH_new_method() returns NULL and sets an error code that can be obtained by ERR_get_error(3) if the allocation fails. Otherwise it returns a pointer to the newly allocated structure.

"},{"location":"man3/DH_set_method/#see-also","title":"SEE ALSO","text":"

DH_new(3), DH_new(3), DH_meth_new(3)

"},{"location":"man3/DH_set_method/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DH_set_method/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DH_size/","title":"DH_size","text":""},{"location":"man3/DH_size/#name","title":"NAME","text":"

DH_size, DH_bits, DH_security_bits - get Diffie-Hellman prime size and security bits

"},{"location":"man3/DH_size/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dh.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DH_bits(const DH *dh);\n\nint DH_size(const DH *dh);\n\nint DH_security_bits(const DH *dh);\n
"},{"location":"man3/DH_size/#description","title":"DESCRIPTION","text":"

The functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

DH_bits() returns the number of significant bits.

dh and dh->p must not be NULL.

DH_size() returns the Diffie-Hellman prime size in bytes. It can be used to determine how much memory must be allocated for the shared secret computed by DH_compute_key(3).

DH_security_bits() returns the number of security bits of the given dh key. See BN_security_bits(3).

"},{"location":"man3/DH_size/#return-values","title":"RETURN VALUES","text":"

DH_bits() returns the number of bits in the key, or -1 if dh doesn't hold any key parameters.

DH_size() returns the prime size of Diffie-Hellman in bytes, or -1 if dh doesn't hold any key parameters.

DH_security_bits() returns the number of security bits, or -1 if dh doesn't hold any key parameters.

"},{"location":"man3/DH_size/#see-also","title":"SEE ALSO","text":"

EVP_PKEY_get_bits(3), DH_new(3), DH_generate_key(3), BN_num_bits(3)

"},{"location":"man3/DH_size/#history","title":"HISTORY","text":"

All functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DH_size/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_SIG_new/","title":"DSA_SIG_new","text":""},{"location":"man3/DSA_SIG_new/#name","title":"NAME","text":"

DSA_SIG_get0, DSA_SIG_set0, DSA_SIG_new, DSA_SIG_free - allocate and free DSA signature objects

"},{"location":"man3/DSA_SIG_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n\nDSA_SIG *DSA_SIG_new(void);\nvoid DSA_SIG_free(DSA_SIG *a);\nvoid DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);\nint DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);\n
"},{"location":"man3/DSA_SIG_new/#description","title":"DESCRIPTION","text":"

DSA_SIG_new() allocates an empty DSA_SIG structure.

DSA_SIG_free() frees the DSA_SIG structure and its components. The values are erased before the memory is returned to the system. If the argument is NULL, nothing is done.

DSA_SIG_get0() returns internal pointers to the r and s values contained in sig.

The r and s values can be set by calling DSA_SIG_set0() and passing the new values for r and s as parameters to the function. Calling this function transfers the memory management of the values to the DSA_SIG object, and therefore the values that have been passed in should not be freed directly after this function has been called.

"},{"location":"man3/DSA_SIG_new/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, DSA_SIG_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

DSA_SIG_free() returns no value.

DSA_SIG_set0() returns 1 on success or 0 on failure.

"},{"location":"man3/DSA_SIG_new/#see-also","title":"SEE ALSO","text":"

EVP_PKEY_new(3), EVP_PKEY_free(3), EVP_PKEY_get_bn_param(3), ERR_get_error(3)

"},{"location":"man3/DSA_SIG_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_do_sign/","title":"DSA_do_sign","text":""},{"location":"man3/DSA_do_sign/#name","title":"NAME","text":"

DSA_do_sign, DSA_do_verify - raw DSA signature operations

"},{"location":"man3/DSA_do_sign/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);\n\nint DSA_do_verify(const unsigned char *dgst, int dgst_len,\n                  DSA_SIG *sig, DSA *dsa);\n
"},{"location":"man3/DSA_do_sign/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

DSA_do_sign() computes a digital signature on the len byte message digest dgst using the private key dsa and returns it in a newly allocated DSA_SIG structure.

DSA_sign_setup(3) may be used to precompute part of the signing operation in case signature generation is time-critical.

DSA_do_verify() verifies that the signature sig matches a given message digest dgst of size len. dsa is the signer's public key.

"},{"location":"man3/DSA_do_sign/#return-values","title":"RETURN VALUES","text":"

DSA_do_sign() returns the signature, NULL on error. DSA_do_verify() returns 1 for a valid signature, 0 for an incorrect signature and -1 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/DSA_do_sign/#see-also","title":"SEE ALSO","text":"

DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_SIG_new(3), DSA_sign(3)

"},{"location":"man3/DSA_do_sign/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_do_sign/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_dup_DH/","title":"DSA_dup_DH","text":""},{"location":"man3/DSA_dup_DH/#name","title":"NAME","text":"

DSA_dup_DH - create a DH structure out of DSA structure

"},{"location":"man3/DSA_dup_DH/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DH *DSA_dup_DH(const DSA *r);\n
"},{"location":"man3/DSA_dup_DH/#description","title":"DESCRIPTION","text":"

The function described on this page is deprecated. There is no direct replacement, applications should use the EVP_PKEY APIs for Diffie-Hellman operations.

DSA_dup_DH() duplicates DSA parameters/keys as DH parameters/keys. q is lost during that conversion, but the resulting DH parameters contain its length.

"},{"location":"man3/DSA_dup_DH/#return-values","title":"RETURN VALUES","text":"

DSA_dup_DH() returns the new DH structure, and NULL on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/DSA_dup_DH/#note","title":"NOTE","text":"

Be careful to avoid small subgroup attacks when using this.

"},{"location":"man3/DSA_dup_DH/#see-also","title":"SEE ALSO","text":"

DH_new(3), DSA_new(3), ERR_get_error(3)

"},{"location":"man3/DSA_dup_DH/#history","title":"HISTORY","text":"

This function was deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_dup_DH/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_generate_key/","title":"DSA_generate_key","text":""},{"location":"man3/DSA_generate_key/#name","title":"NAME","text":"

DSA_generate_key - generate DSA key pair

"},{"location":"man3/DSA_generate_key/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DSA_generate_key(DSA *a);\n
"},{"location":"man3/DSA_generate_key/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3) as described in EVP_PKEY-DSA(7).

DSA_generate_key() expects a to contain DSA parameters. It generates a new key pair and stores it in a->pub_key and a->priv_key.

The random generator must be seeded prior to calling DSA_generate_key(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

"},{"location":"man3/DSA_generate_key/#return-values","title":"RETURN VALUES","text":"

DSA_generate_key() returns 1 on success, 0 otherwise. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/DSA_generate_key/#see-also","title":"SEE ALSO","text":"

DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_generate_parameters_ex(3)

"},{"location":"man3/DSA_generate_key/#history","title":"HISTORY","text":"

This function was deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_generate_key/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_generate_parameters/","title":"DSA_generate_parameters","text":""},{"location":"man3/DSA_generate_parameters/#name","title":"NAME","text":"

DSA_generate_parameters_ex, DSA_generate_parameters - generate DSA parameters

"},{"location":"man3/DSA_generate_parameters/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DSA_generate_parameters_ex(DSA *dsa, int bits,\n                               const unsigned char *seed, int seed_len,\n                               int *counter_ret, unsigned long *h_ret,\n                               BN_GENCB *cb);\n

The following functions have been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len,\n                             int *counter_ret, unsigned long *h_ret,\n                             void (*callback)(int, int, void *), void *cb_arg);\n
"},{"location":"man3/DSA_generate_parameters/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_paramgen_init(3) and EVP_PKEY_keygen(3) as described in EVP_PKEY-DSA(7).

DSA_generate_parameters_ex() generates primes p and q and a generator g for use in the DSA and stores the result in dsa.

bits is the length of the prime p to be generated. For lengths under 2048 bits, the length of q is 160 bits; for lengths greater than or equal to 2048 bits, the length of q is set to 256 bits.

If seed is NULL, the primes will be generated at random. If seed_len is less than the length of q, an error is returned.

DSA_generate_parameters_ex() places the iteration count in *counter_ret and a counter used for finding a generator in *h_ret, unless these are NULL.

A callback function may be used to provide feedback about the progress of the key generation. If cb is not NULL, it will be called as shown below. For information on the BN_GENCB structure and the BN_GENCB_call function discussed below, refer to BN_generate_prime(3).

DSA_generate_parameters() is similar to DSA_generate_parameters_ex() but expects an old-style callback function; see BN_generate_prime(3) for information on the old-style callback.

  • When a candidate for q is generated, BN_GENCB_call(cb, 0, m++) is called (m is 0 for the first candidate).
  • When a candidate for q has passed a test by trial division, BN_GENCB_call(cb, 1, -1) is called. While a candidate for q is tested by Miller-Rabin primality tests, BN_GENCB_call(cb, 1, i) is called in the outer loop (once for each witness that confirms that the candidate may be prime); i is the loop counter (starting at 0).
  • When a prime q has been found, BN_GENCB_call(cb, 2, 0) and BN_GENCB_call(cb, 3, 0) are called.
  • Before a candidate for p (other than the first) is generated and tested, BN_GENCB_call(cb, 0, counter) is called.
  • When a candidate for p has passed the test by trial division, BN_GENCB_call(cb, 1, -1) is called. While it is tested by the Miller-Rabin primality test, BN_GENCB_call(cb, 1, i) is called in the outer loop (once for each witness that confirms that the candidate may be prime). i is the loop counter (starting at 0).
  • When p has been found, BN_GENCB_call(cb, 2, 1) is called.
  • When the generator has been found, BN_GENCB_call(cb, 3, 1) is called.
"},{"location":"man3/DSA_generate_parameters/#return-values","title":"RETURN VALUES","text":"

DSA_generate_parameters_ex() returns a 1 on success, or 0 otherwise. The error codes can be obtained by ERR_get_error(3).

DSA_generate_parameters() returns a pointer to the DSA structure or NULL if the parameter generation fails.

"},{"location":"man3/DSA_generate_parameters/#bugs","title":"BUGS","text":"

Seed lengths greater than 20 are not supported.

"},{"location":"man3/DSA_generate_parameters/#see-also","title":"SEE ALSO","text":"

DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_free(3), BN_generate_prime(3)

"},{"location":"man3/DSA_generate_parameters/#history","title":"HISTORY","text":"

DSA_generate_parameters_ex() was deprecated in OpenSSL 3.0.

DSA_generate_parameters() was deprecated in OpenSSL 0.9.8; use DSA_generate_parameters_ex() instead.

"},{"location":"man3/DSA_generate_parameters/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_get0_pqg/","title":"DSA_get0_pqg","text":""},{"location":"man3/DSA_get0_pqg/#name","title":"NAME","text":"

DSA_get0_pqg, DSA_set0_pqg, DSA_get0_key, DSA_set0_key, DSA_get0_p, DSA_get0_q, DSA_get0_g, DSA_get0_pub_key, DSA_get0_priv_key, DSA_clear_flags, DSA_test_flags, DSA_set_flags, DSA_get0_engine - Routines for getting and setting data in a DSA object

"},{"location":"man3/DSA_get0_pqg/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void DSA_get0_pqg(const DSA *d,\n                  const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);\nint DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);\nvoid DSA_get0_key(const DSA *d,\n                  const BIGNUM **pub_key, const BIGNUM **priv_key);\nint DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);\nconst BIGNUM *DSA_get0_p(const DSA *d);\nconst BIGNUM *DSA_get0_q(const DSA *d);\nconst BIGNUM *DSA_get0_g(const DSA *d);\nconst BIGNUM *DSA_get0_pub_key(const DSA *d);\nconst BIGNUM *DSA_get0_priv_key(const DSA *d);\nvoid DSA_clear_flags(DSA *d, int flags);\nint DSA_test_flags(const DSA *d, int flags);\nvoid DSA_set_flags(DSA *d, int flags);\nENGINE *DSA_get0_engine(DSA *d);\n
"},{"location":"man3/DSA_get0_pqg/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bn_param(3).

A DSA object contains the parameters p, q and g. It also contains a public key (pub_key) and (optionally) a private key (priv_key).

The p, q and g parameters can be obtained by calling DSA_get0_pqg(). If the parameters have not yet been set then *p, *q and *g will be set to NULL. Otherwise they are set to pointers to their respective values. These point directly to the internal representations of the values and therefore should not be freed directly.

The p, q and g values can be set by calling DSA_set0_pqg() and passing the new values for p, q and g as parameters to the function. Calling this function transfers the memory management of the values to the DSA object, and therefore the values that have been passed in should not be freed directly after this function has been called.

To get the public and private key values use the DSA_get0_key() function. A pointer to the public key will be stored in *pub_key, and a pointer to the private key will be stored in *priv_key. Either may be NULL if they have not been set yet, although if the private key has been set then the public key must be. The values point to the internal representation of the public key and private key values. This memory should not be freed directly.

The public and private key values can be set using DSA_set0_key(). The public key must be non-NULL the first time this function is called on a given DSA object. The private key may be NULL. On subsequent calls, either may be NULL, which means the corresponding DSA field is left untouched. As for DSA_set0_pqg() this function transfers the memory management of the key values to the DSA object, and therefore they should not be freed directly after this function has been called.

Any of the values p, q, g, priv_key, and pub_key can also be retrieved separately by the corresponding function DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_priv_key(), and DSA_get0_pub_key(), respectively.

DSA_set_flags() sets the flags in the flags parameter on the DSA object. Multiple flags can be passed in one go (bitwise ORed together). Any flags that are already set are left set. DSA_test_flags() tests to see whether the flags passed in the flags parameter are currently set in the DSA object. Multiple flags can be tested in one go. All flags that are currently set are returned, or zero if none of the flags are set. DSA_clear_flags() clears the specified flags within the DSA object.

DSA_get0_engine() returns a handle to the ENGINE that has been set for this DSA object, or NULL if no such ENGINE has been set.

"},{"location":"man3/DSA_get0_pqg/#notes","title":"NOTES","text":"

Values retrieved with DSA_get0_key() are owned by the DSA object used in the call and may therefore not be passed to DSA_set0_key(). If needed, duplicate the received value using BN_dup() and pass the duplicate. The same applies to DSA_get0_pqg() and DSA_set0_pqg().

"},{"location":"man3/DSA_get0_pqg/#return-values","title":"RETURN VALUES","text":"

DSA_set0_pqg() and DSA_set0_key() return 1 on success or 0 on failure.

DSA_test_flags() returns the current state of the flags in the DSA object.

DSA_get0_engine() returns the ENGINE set for the DSA object or NULL if no ENGINE has been set.

"},{"location":"man3/DSA_get0_pqg/#see-also","title":"SEE ALSO","text":"

EVP_PKEY_get_bn_param(3), DSA_new(3), DSA_new(3), DSA_generate_parameters(3), DSA_generate_key(3), DSA_dup_DH(3), DSA_do_sign(3), DSA_set_method(3), DSA_SIG_new(3), DSA_sign(3), DSA_size(3), DSA_meth_new(3)

"},{"location":"man3/DSA_get0_pqg/#history","title":"HISTORY","text":"

The functions described here were added in OpenSSL 1.1.0 and deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_get0_pqg/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_meth_new/","title":"DSA_meth_new","text":""},{"location":"man3/DSA_meth_new/#name","title":"NAME","text":"

DSA_meth_new, DSA_meth_free, DSA_meth_dup, DSA_meth_get0_name, DSA_meth_set1_name, DSA_meth_get_flags, DSA_meth_set_flags, DSA_meth_get0_app_data, DSA_meth_set0_app_data, DSA_meth_get_sign, DSA_meth_set_sign, DSA_meth_get_sign_setup, DSA_meth_set_sign_setup, DSA_meth_get_verify, DSA_meth_set_verify, DSA_meth_get_mod_exp, DSA_meth_set_mod_exp, DSA_meth_get_bn_mod_exp, DSA_meth_set_bn_mod_exp, DSA_meth_get_init, DSA_meth_set_init, DSA_meth_get_finish, DSA_meth_set_finish, DSA_meth_get_paramgen, DSA_meth_set_paramgen, DSA_meth_get_keygen, DSA_meth_set_keygen - Routines to build up DSA methods

"},{"location":"man3/DSA_meth_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DSA_METHOD *DSA_meth_new(const char *name, int flags);\n\nvoid DSA_meth_free(DSA_METHOD *dsam);\n\nDSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);\n\nconst char *DSA_meth_get0_name(const DSA_METHOD *dsam);\nint DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);\n\nint DSA_meth_get_flags(const DSA_METHOD *dsam);\nint DSA_meth_set_flags(DSA_METHOD *dsam, int flags);\n\nvoid *DSA_meth_get0_app_data(const DSA_METHOD *dsam);\nint DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);\n\nDSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))(const unsigned char *,\n                                                      int, DSA *);\nint DSA_meth_set_sign(DSA_METHOD *dsam, DSA_SIG *(*sign)(const unsigned char *,\n                                                         int, DSA *));\n\nint (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))(DSA *, BN_CTX *,$\n                                                       BIGNUM **, BIGNUM **);\nint DSA_meth_set_sign_setup(DSA_METHOD *dsam, int (*sign_setup)(DSA *, BN_CTX *,\n                                                                BIGNUM **, BIGNUM **));\n\nint (*DSA_meth_get_verify(const DSA_METHOD *dsam))(const unsigned char *,\n                                                   int, DSA_SIG *, DSA *);\nint DSA_meth_set_verify(DSA_METHOD *dsam, int (*verify)(const unsigned char *,\n                                                        int, DSA_SIG *, DSA *));\n\nint (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n                                                    BIGNUM *p1, BIGNUM *a2, BIGNUM *p2,\n                                                    BIGNUM *m, BN_CTX *ctx,\n                                                    BN_MONT_CTX *in_mont);\nint DSA_meth_set_mod_exp(DSA_METHOD *dsam, int (*mod_exp)(DSA *dsa, BIGNUM *rr,\n                                                          BIGNUM *a1, BIGNUM *p1,\n                                                          BIGNUM *a2, BIGNUM *p2,\n                                                          BIGNUM *m, BN_CTX *ctx,\n                                                          BN_MONT_CTX *mont));\n\nint (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *r, BIGNUM *a,\n                                                       const BIGNUM *p, const BIGNUM *m,\n                                                       BN_CTX *ctx, BN_MONT_CTX *mont);\nint DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, int (*bn_mod_exp)(DSA *dsa,\n                                                                BIGNUM *r,\n                                                                BIGNUM *a,\n                                                                const BIGNUM *p,\n                                                                const BIGNUM *m,\n                                                                BN_CTX *ctx,\n                                                                BN_MONT_CTX *mont));\n\nint (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);\nint DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));\n\nint (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *);\nint DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish)(DSA *));\n\nint (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))(DSA *, int,\n                                                     const unsigned char *,\n                                                     int, int *, unsigned long *,\n                                                     BN_GENCB *);\nint DSA_meth_set_paramgen(DSA_METHOD *dsam,\n                          int (*paramgen)(DSA *, int, const unsigned char *,\n                                          int, int *, unsigned long *, BN_GENCB *));\n\nint (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *);\nint DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen)(DSA *));\n
"},{"location":"man3/DSA_meth_new/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications and extension implementations should instead use the OSSL_PROVIDER APIs.

The DSA_METHOD type is a structure used for the provision of custom DSA implementations. It provides a set of functions used by OpenSSL for the implementation of the various DSA capabilities.

DSA_meth_new() creates a new DSA_METHOD structure. It should be given a unique name and a set of flags. The name should be a NULL terminated string, which will be duplicated and stored in the DSA_METHOD object. It is the callers responsibility to free the original string. The flags will be used during the construction of a new DSA object based on this DSA_METHOD. Any new DSA object will have those flags set by default.

DSA_meth_dup() creates a duplicate copy of the DSA_METHOD object passed as a parameter. This might be useful for creating a new DSA_METHOD based on an existing one, but with some differences.

DSA_meth_free() destroys a DSA_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

DSA_meth_get0_name() will return a pointer to the name of this DSA_METHOD. This is a pointer to the internal name string and so should not be freed by the caller. DSA_meth_set1_name() sets the name of the DSA_METHOD to name. The string is duplicated and the copy is stored in the DSA_METHOD structure, so the caller remains responsible for freeing the memory associated with the name.

DSA_meth_get_flags() returns the current value of the flags associated with this DSA_METHOD. DSA_meth_set_flags() provides the ability to set these flags.

The functions DSA_meth_get0_app_data() and DSA_meth_set0_app_data() provide the ability to associate implementation specific data with the DSA_METHOD. It is the application's responsibility to free this data before the DSA_METHOD is freed via a call to DSA_meth_free().

DSA_meth_get_sign() and DSA_meth_set_sign() get and set the function used for creating a DSA signature respectively. This function will be called in response to the application calling DSA_do_sign() (or DSA_sign()). The parameters for the function have the same meaning as for DSA_do_sign().

DSA_meth_get_sign_setup() and DSA_meth_set_sign_setup() get and set the function used for precalculating the DSA signature values k^-1 and r. This function will be called in response to the application calling DSA_sign_setup(). The parameters for the function have the same meaning as for DSA_sign_setup().

DSA_meth_get_verify() and DSA_meth_set_verify() get and set the function used for verifying a DSA signature respectively. This function will be called in response to the application calling DSA_do_verify() (or DSA_verify()). The parameters for the function have the same meaning as for DSA_do_verify().

DSA_meth_get_mod_exp() and DSA_meth_set_mod_exp() get and set the function used for computing the following value:

rr = a1^p1 * a2^p2 mod m\n

This function will be called by the default OpenSSL method during verification of a DSA signature. The result is stored in the rr parameter. This function may be NULL.

DSA_meth_get_bn_mod_exp() and DSA_meth_set_bn_mod_exp() get and set the function used for computing the following value:

r = a ^ p mod m\n

This function will be called by the default OpenSSL function for DSA_sign_setup(). The result is stored in the r parameter. This function may be NULL.

DSA_meth_get_init() and DSA_meth_set_init() get and set the function used for creating a new DSA instance respectively. This function will be called in response to the application calling DSA_new() (if the current default DSA_METHOD is this one) or DSA_new_method(). The DSA_new() and DSA_new_method() functions will allocate the memory for the new DSA object, and a pointer to this newly allocated structure will be passed as a parameter to the function. This function may be NULL.

DSA_meth_get_finish() and DSA_meth_set_finish() get and set the function used for destroying an instance of a DSA object respectively. This function will be called in response to the application calling DSA_free(). A pointer to the DSA to be destroyed is passed as a parameter. The destroy function should be used for DSA implementation specific clean up. The memory for the DSA itself should not be freed by this function. This function may be NULL.

DSA_meth_get_paramgen() and DSA_meth_set_paramgen() get and set the function used for generating DSA parameters respectively. This function will be called in response to the application calling DSA_generate_parameters_ex() (or DSA_generate_parameters()). The parameters for the function have the same meaning as for DSA_generate_parameters_ex().

DSA_meth_get_keygen() and DSA_meth_set_keygen() get and set the function used for generating a new DSA key pair respectively. This function will be called in response to the application calling DSA_generate_key(). The parameter for the function has the same meaning as for DSA_generate_key().

"},{"location":"man3/DSA_meth_new/#return-values","title":"RETURN VALUES","text":"

DSA_meth_new() and DSA_meth_dup() return the newly allocated DSA_METHOD object or NULL on failure.

DSA_meth_get0_name() and DSA_meth_get_flags() return the name and flags associated with the DSA_METHOD respectively.

All other DSA_meth_get_*() functions return the appropriate function pointer that has been set in the DSA_METHOD, or NULL if no such pointer has yet been set.

DSA_meth_set1_name() and all DSA_meth_set_*() functions return 1 on success or 0 on failure.

"},{"location":"man3/DSA_meth_new/#see-also","title":"SEE ALSO","text":"

DSA_new(3), DSA_new(3), DSA_generate_parameters(3), DSA_generate_key(3), DSA_dup_DH(3), DSA_do_sign(3), DSA_set_method(3), DSA_SIG_new(3), DSA_sign(3), DSA_size(3), DSA_get0_pqg(3)

"},{"location":"man3/DSA_meth_new/#history","title":"HISTORY","text":"

The functions described here were deprecated in OpenSSL 3.0.

The functions described here were added in OpenSSL 1.1.0.

"},{"location":"man3/DSA_meth_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_new/","title":"DSA_new","text":""},{"location":"man3/DSA_new/#name","title":"NAME","text":"

DSA_new, DSA_free - allocate and free DSA objects

"},{"location":"man3/DSA_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

DSA* DSA_new(void);\n\nvoid DSA_free(DSA *dsa);\n
"},{"location":"man3/DSA_new/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_new(3) and EVP_PKEY_free(3).

DSA_new() allocates and initializes a DSA structure. It is equivalent to calling DSA_new_method(NULL).

DSA_free() frees the DSA structure and its components. The values are erased before the memory is returned to the system. If dsa is NULL nothing is done.

"},{"location":"man3/DSA_new/#return-values","title":"RETURN VALUES","text":"

If the allocation fails, DSA_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

DSA_free() returns no value.

"},{"location":"man3/DSA_new/#see-also","title":"SEE ALSO","text":"

EVP_PKEY_new(3), EVP_PKEY_free(3), DSA_new(3), ERR_get_error(3), DSA_generate_parameters(3), DSA_generate_key(3)

"},{"location":"man3/DSA_new/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_set_method/","title":"DSA_set_method","text":""},{"location":"man3/DSA_set_method/#name","title":"NAME","text":"

DSA_set_default_method, DSA_get_default_method, DSA_set_method, DSA_new_method, DSA_OpenSSL - select DSA method

"},{"location":"man3/DSA_set_method/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void DSA_set_default_method(const DSA_METHOD *meth);\n\nconst DSA_METHOD *DSA_get_default_method(void);\n\nint DSA_set_method(DSA *dsa, const DSA_METHOD *meth);\n\nDSA *DSA_new_method(ENGINE *engine);\n\nconst DSA_METHOD *DSA_OpenSSL(void);\n
"},{"location":"man3/DSA_set_method/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should providers instead of method overrides.

A DSA_METHOD specifies the functions that OpenSSL uses for DSA operations. By modifying the method, alternative implementations such as hardware accelerators may be used. IMPORTANT: See the NOTES section for important information about how these DSA API functions are affected by the use of ENGINE API calls.

Initially, the default DSA_METHOD is the OpenSSL internal implementation, as returned by DSA_OpenSSL().

DSA_set_default_method() makes meth the default method for all DSA structures created later. NB: This is true only whilst no ENGINE has been set as a default for DSA, so this function is no longer recommended. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

DSA_get_default_method() returns a pointer to the current default DSA_METHOD. However, the meaningfulness of this result is dependent on whether the ENGINE API is being used, so this function is no longer recommended.

DSA_set_method() selects meth to perform all operations using the key rsa. This will replace the DSA_METHOD used by the DSA key and if the previous method was supplied by an ENGINE, the handle to that ENGINE will be released during the change. It is possible to have DSA keys that only work with certain DSA_METHOD implementations (e.g. from an ENGINE module that supports embedded hardware-protected keys), and in such cases attempting to change the DSA_METHOD for the key can have unexpected results. See DSA_meth_new(3) for information on constructing custom DSA_METHOD objects;

DSA_new_method() allocates and initializes a DSA structure so that engine will be used for the DSA operations. If engine is NULL, the default engine for DSA operations is used, and if no default ENGINE is set, the DSA_METHOD controlled by DSA_set_default_method() is used.

"},{"location":"man3/DSA_set_method/#return-values","title":"RETURN VALUES","text":"

DSA_OpenSSL() and DSA_get_default_method() return pointers to the respective DSA_METHODs.

DSA_set_default_method() returns no value.

DSA_set_method() returns nonzero if the provided meth was successfully set as the method for dsa (including unloading the ENGINE handle if the previous method was supplied by an ENGINE).

DSA_new_method() returns NULL and sets an error code that can be obtained by ERR_get_error(3) if the allocation fails. Otherwise it returns a pointer to the newly allocated structure.

"},{"location":"man3/DSA_set_method/#see-also","title":"SEE ALSO","text":"

DSA_new(3), DSA_new(3), DSA_meth_new(3)

"},{"location":"man3/DSA_set_method/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_set_method/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_sign/","title":"DSA_sign","text":""},{"location":"man3/DSA_sign/#name","title":"NAME","text":"

DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures

"},{"location":"man3/DSA_sign/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DSA_sign(int type, const unsigned char *dgst, int len,\n             unsigned char *sigret, unsigned int *siglen, DSA *dsa);\n\nint DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);\n\nint DSA_verify(int type, const unsigned char *dgst, int len,\n               unsigned char *sigbuf, int siglen, DSA *dsa);\n
"},{"location":"man3/DSA_sign/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

DSA_sign() computes a digital signature on the len byte message digest dgst using the private key dsa and places its ASN.1 DER encoding at sigret. The length of the signature is places in *siglen. sigret must point to DSA_size(dsa) bytes of memory.

DSA_sign_setup() is defined only for backward binary compatibility and should not be used. Since OpenSSL 1.1.0 the DSA type is opaque and the output of DSA_sign_setup() cannot be used anyway: calling this function will only cause overhead, and does not affect the actual signature (pre-)computation.

DSA_verify() verifies that the signature sigbuf of size siglen matches a given message digest dgst of size len. dsa is the signer's public key.

The type parameter is ignored.

The random generator must be seeded when DSA_sign() (or DSA_sign_setup()) is called. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

"},{"location":"man3/DSA_sign/#return-values","title":"RETURN VALUES","text":"

DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error. DSA_verify() returns 1 for a valid signature, 0 for an incorrect signature and -1 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/DSA_sign/#conforming-to","title":"CONFORMING TO","text":"

US Federal Information Processing Standard FIPS186-4 (Digital Signature Standard, DSS), ANSI X9.30

"},{"location":"man3/DSA_sign/#see-also","title":"SEE ALSO","text":"

DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_do_sign(3), RAND(7)

"},{"location":"man3/DSA_sign/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_sign/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DSA_size/","title":"DSA_size","text":""},{"location":"man3/DSA_size/#name","title":"NAME","text":"

DSA_size, DSA_bits, DSA_security_bits - get DSA signature size, key bits or security bits

"},{"location":"man3/DSA_size/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/dsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int DSA_bits(const DSA *dsa);\n\nint DSA_size(const DSA *dsa);\n\nint DSA_security_bits(const DSA *dsa);\n
"},{"location":"man3/DSA_size/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

DSA_bits() returns the number of bits in key dsa: this is the number of bits in the p parameter.

DSA_size() returns the maximum size of an ASN.1 encoded DSA signature for key dsa in bytes. It can be used to determine how much memory must be allocated for a DSA signature.

DSA_security_bits() returns the number of security bits of the given dsa key. See BN_security_bits(3).

"},{"location":"man3/DSA_size/#return-values","title":"RETURN VALUES","text":"

DSA_security_bits() returns the number of security bits in the key, or -1 if dsa doesn't hold any key parameters.

DSA_bits() returns the number of bits in the key, or -1 if dsa doesn't hold any key parameters.

DSA_size() returns the signature size in bytes, or -1 if dsa doesn't hold any key parameters.

"},{"location":"man3/DSA_size/#see-also","title":"SEE ALSO","text":"

EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3), EVP_PKEY_get_size(3), DSA_new(3), DSA_sign(3)

"},{"location":"man3/DSA_size/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/DSA_size/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DTLS_get_data_mtu/","title":"DTLS_get_data_mtu","text":""},{"location":"man3/DTLS_get_data_mtu/#name","title":"NAME","text":"

DTLS_get_data_mtu - Get maximum data payload size

"},{"location":"man3/DTLS_get_data_mtu/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ssl.h>\n\nsize_t DTLS_get_data_mtu(const SSL *ssl);\n
"},{"location":"man3/DTLS_get_data_mtu/#description","title":"DESCRIPTION","text":"

This function obtains the maximum data payload size for the established DTLS connection ssl, based on the DTLS record MTU and the overhead of the DTLS record header, encryption and authentication currently in use.

"},{"location":"man3/DTLS_get_data_mtu/#return-values","title":"RETURN VALUES","text":"

Returns the maximum data payload size on success, or 0 on failure.

"},{"location":"man3/DTLS_get_data_mtu/#history","title":"HISTORY","text":"

The DTLS_get_data_mtu() function was added in OpenSSL 1.1.1.

"},{"location":"man3/DTLS_get_data_mtu/#copyright","title":"COPYRIGHT","text":"

Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DTLS_set_timer_cb/","title":"DTLS_set_timer_cb","text":""},{"location":"man3/DTLS_set_timer_cb/#name","title":"NAME","text":"

DTLS_timer_cb, DTLS_set_timer_cb - Set callback for controlling DTLS timer duration

"},{"location":"man3/DTLS_set_timer_cb/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ssl.h>\n\ntypedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us);\n\nvoid DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb);\n
"},{"location":"man3/DTLS_set_timer_cb/#description","title":"DESCRIPTION","text":"

This function sets an optional callback function for controlling the timeout interval on the DTLS protocol. The callback function will be called by DTLS for every new DTLS packet that is sent.

"},{"location":"man3/DTLS_set_timer_cb/#return-values","title":"RETURN VALUES","text":"

Returns void.

"},{"location":"man3/DTLS_set_timer_cb/#history","title":"HISTORY","text":"

The DTLS_set_timer_cb() function was added in OpenSSL 1.1.1.

"},{"location":"man3/DTLS_set_timer_cb/#copyright","title":"COPYRIGHT","text":"

Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/DTLSv1_listen/","title":"DTLSv1_listen","text":""},{"location":"man3/DTLSv1_listen/#name","title":"NAME","text":"

SSL_stateless, DTLSv1_listen - Statelessly listen for incoming connections

"},{"location":"man3/DTLSv1_listen/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ssl.h>\n\nint SSL_stateless(SSL *s);\nint DTLSv1_listen(SSL *ssl, BIO_ADDR *peer);\n
"},{"location":"man3/DTLSv1_listen/#description","title":"DESCRIPTION","text":"

SSL_stateless() statelessly listens for new incoming TLSv1.3 connections. DTLSv1_listen() statelessly listens for new incoming DTLS connections. If a ClientHello is received that does not contain a cookie, then they respond with a request for a new ClientHello that does contain a cookie. If a ClientHello is received with a cookie that is verified then the function returns in order to enable the handshake to be completed (for example by using SSL_accept()).

"},{"location":"man3/DTLSv1_listen/#notes","title":"NOTES","text":"

Some transport protocols (such as UDP) can be susceptible to amplification attacks. Unlike TCP there is no initial connection setup in UDP that validates that the client can actually receive messages on its advertised source address. An attacker could forge its source IP address and then send handshake initiation messages to the server. The server would then send its response to the forged source IP. If the response messages are larger than the original message then the amplification attack has succeeded.

If DTLS is used over UDP (or any datagram based protocol that does not validate the source IP) then it is susceptible to this type of attack. TLSv1.3 is designed to operate over a stream-based transport protocol (such as TCP). If TCP is being used then there is no need to use SSL_stateless(). However, some stream-based transport protocols (e.g. QUIC) may not validate the source address. In this case a TLSv1.3 application would be susceptible to this attack.

As a countermeasure to this issue TLSv1.3 and DTLS include a stateless cookie mechanism. The idea is that when a client attempts to connect to a server it sends a ClientHello message. The server responds with a HelloRetryRequest (in TLSv1.3) or a HelloVerifyRequest (in DTLS) which contains a unique cookie. The client then resends the ClientHello, but this time includes the cookie in the message thus proving that the client is capable of receiving messages sent to that address. All of this can be done by the server without allocating any state, and thus without consuming expensive resources.

OpenSSL implements this capability via the SSL_stateless() and DTLSv1_listen() functions. The ssl parameter should be a newly allocated SSL object with its read and write BIOs set, in the same way as might be done for a call to SSL_accept(). Typically, for DTLS, the read BIO will be in an \"unconnected\" state and thus capable of receiving messages from any peer.

When a ClientHello is received that contains a cookie that has been verified, then these functions will return with the ssl parameter updated into a state where the handshake can be continued by a call to (for example) SSL_accept(). Additionally, for DTLSv1_listen(), the BIO_ADDR pointed to by peer will be filled in with details of the peer that sent the ClientHello. If the underlying BIO is unable to obtain the BIO_ADDR of the peer (for example because the BIO does not support this), then *peer will be cleared and the family set to AF_UNSPEC. Typically user code is expected to \"connect\" the underlying socket to the peer and continue the handshake in a connected state.

Warning: It is essential that the calling code connects the underlying socket to the peer after making use of DTLSv1_listen(). In the typical case where BIO_s_datagram(3) is used, the peer address is updated when receiving a datagram on an unconnected socket. If the socket is not connected, it can receive datagrams from any host on the network, which will cause subsequent outgoing datagrams transmitted by DTLS to be transmitted to that host. In other words, failing to call BIO_connect() or a similar OS-specific function on a socket means that any host on the network can cause outgoing DTLS traffic to be redirected to it by sending a datagram to the socket in question. This does not break the cryptographic protections of DTLS but may facilitate a denial-of-service attack or allow unencrypted information in the DTLS handshake to be learned by an attacker. This is due to the historical design of BIO_s_datagram(3); see BIO_s_datagram(3) for details on this issue.

Once a socket has been connected, BIO_ctrl_set_connected(3) should be used to inform the BIO that the socket is to be used in connected mode.

Prior to calling DTLSv1_listen() user code must ensure that cookie generation and verification callbacks have been set up using SSL_CTX_set_cookie_generate_cb(3) and SSL_CTX_set_cookie_verify_cb(3) respectively. For SSL_stateless(), SSL_CTX_set_stateless_cookie_generate_cb(3) and SSL_CTX_set_stateless_cookie_verify_cb(3) must be used instead.

Since DTLSv1_listen() operates entirely statelessly whilst processing incoming ClientHellos it is unable to process fragmented messages (since this would require the allocation of state). An implication of this is that DTLSv1_listen() only supports ClientHellos that fit inside a single datagram.

For SSL_stateless() if an entire ClientHello message cannot be read without the \"read\" BIO becoming empty then the SSL_stateless() call will fail. It is the application's responsibility to ensure that data read from the \"read\" BIO during a single SSL_stateless() call is all from the same peer.

SSL_stateless() will fail (with a 0 return value) if some TLS version less than TLSv1.3 is used.

Both SSL_stateless() and DTLSv1_listen() will clear the error queue when they start.

"},{"location":"man3/DTLSv1_listen/#return-values","title":"RETURN VALUES","text":"

For SSL_stateless() a return value of 1 indicates success and the ssl object will be set up ready to continue the handshake. A return value of 0 or -1 indicates failure. If the value is 0 then a HelloRetryRequest was sent. A value of -1 indicates any other error. User code may retry the SSL_stateless() call.

For DTLSv1_listen() a return value of >= 1 indicates success. The ssl object will be set up ready to continue the handshake. the peer value will also be filled in.

A return value of 0 indicates a non-fatal error. This could (for example) be because of nonblocking IO, or some invalid message having been received from a peer. Errors may be placed on the OpenSSL error queue with further information if appropriate. Typically user code is expected to retry the call to DTLSv1_listen() in the event of a non-fatal error.

A return value of <0 indicates a fatal error. This could (for example) be because of a failure to allocate sufficient memory for the operation.

For DTLSv1_listen(), prior to OpenSSL 1.1.0, fatal and non-fatal errors both produce return codes <= 0 (in typical implementations user code treats all errors as non-fatal), whilst return codes >0 indicate success.

"},{"location":"man3/DTLSv1_listen/#see-also","title":"SEE ALSO","text":"

SSL_CTX_set_cookie_generate_cb(3), SSL_CTX_set_cookie_verify_cb(3), SSL_CTX_set_stateless_cookie_generate_cb(3), SSL_CTX_set_stateless_cookie_verify_cb(3), SSL_get_error(3), SSL_accept(3), ssl(7), bio(7)

"},{"location":"man3/DTLSv1_listen/#history","title":"HISTORY","text":"

The SSL_stateless() function was added in OpenSSL 1.1.1.

The DTLSv1_listen() return codes were clarified in OpenSSL 1.1.0. The type of \"peer\" also changed in OpenSSL 1.1.0.

"},{"location":"man3/DTLSv1_listen/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ECDSA_SIG_new/","title":"ECDSA_SIG_new","text":""},{"location":"man3/ECDSA_SIG_new/#name","title":"NAME","text":"

ECDSA_SIG_new, ECDSA_SIG_free, ECDSA_SIG_get0, ECDSA_SIG_get0_r, ECDSA_SIG_get0_s, ECDSA_SIG_set0 - Functions for creating, destroying and manipulating ECDSA_SIG objects

"},{"location":"man3/ECDSA_SIG_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ecdsa.h>\n\nECDSA_SIG *ECDSA_SIG_new(void);\nvoid ECDSA_SIG_free(ECDSA_SIG *sig);\nvoid ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);\nconst BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig);\nconst BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig);\nint ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);\n
"},{"location":"man3/ECDSA_SIG_new/#description","title":"DESCRIPTION","text":"

ECDSA_SIG is an opaque structure consisting of two BIGNUMs for the r and s value of an Elliptic Curve Digital Signature Algorithm (ECDSA) signature (see FIPS186-4 or X9.62). The ECDSA_SIG object was mainly used by the deprecated low level functions described in ECDSA_sign(3), it is still required in order to be able to set or get the values of r and s into or from a signature. This is mainly used for testing purposes as shown in the \"EXAMPLES\".

ECDSA_SIG_new() allocates an empty ECDSA_SIG structure. Note: before OpenSSL 1.1.0, the r and s components were initialised.

ECDSA_SIG_free() frees the ECDSA_SIG structure sig. If the argument is NULL, nothing is done.

ECDSA_SIG_get0() returns internal pointers the r and s values contained in sig and stores them in *pr and *ps, respectively. The pointer pr or ps can be NULL, in which case the corresponding value is not returned.

The values r, s can also be retrieved separately by the corresponding function ECDSA_SIG_get0_r() and ECDSA_SIG_get0_s(), respectively.

Non-NULL r and s values can be set on the sig by calling ECDSA_SIG_set0(). Calling this function transfers the memory management of the values to the ECDSA_SIG object, and therefore the values that have been passed in should not be freed by the caller.

See i2d_ECDSA_SIG(3) and d2i_ECDSA_SIG(3) for information about encoding and decoding ECDSA signatures to/from DER.

"},{"location":"man3/ECDSA_SIG_new/#return-values","title":"RETURN VALUES","text":"

ECDSA_SIG_new() returns NULL if the allocation fails.

ECDSA_SIG_set0() returns 1 on success or 0 on failure.

ECDSA_SIG_get0_r() and ECDSA_SIG_get0_s() return the corresponding value, or NULL if it is unset.

"},{"location":"man3/ECDSA_SIG_new/#examples","title":"EXAMPLES","text":"

Extract signature r and s values from a ECDSA signature of size signaturelen:

ECDSA_SIG *obj;\nconst BIGNUM *r, *s;\n\n/* Load a signature into the ECDSA_SIG object */\nobj = d2i_ECDSA_SIG(NULL, &signature, signaturelen);\nif (obj == NULL)\n    /* error */\n\nr = ECDSA_SIG_get0_r(obj);\ns = ECDSA_SIG_get0_s(obj);\nif (r == NULL || s == NULL)\n    /* error */\n\n/* Use BN_bn2binpad() here to convert to r and s into byte arrays */\n\n/*\n * Do not try to access I<r> or I<s> after calling ECDSA_SIG_free(),\n * as they are both freed by this call.\n */\nECDSA_SIG_free(obj);\n

Convert r and s byte arrays into an ECDSA_SIG signature of size signaturelen:

ECDSA_SIG *obj = NULL;\nunsigned char *signature = NULL;\nsize_t signaturelen;\nBIGNUM *rbn = NULL, *sbn = NULL;\n\nobj = ECDSA_SIG_new();\nif (obj == NULL)\n    /* error */\nrbn = BN_bin2bn(r, rlen, NULL);\nsbn = BN_bin2bn(s, slen, NULL);\nif (rbn == NULL || sbn == NULL)\n    /* error */\n\nif (!ECDSA_SIG_set0(obj, rbn, sbn))\n    /* error */\n/* Set these to NULL since they are now owned by obj */\nrbn = sbn = NULL;\n\nsignaturelen = i2d_ECDSA_SIG(obj, &signature);\nif (signaturelen <= 0)\n    /* error */\n\n/*\n * This signature could now be passed to L<EVP_DigestVerify(3)>\n * or L<EVP_DigestVerifyFinal(3)>\n */\n\nBN_free(rbn);\nBN_free(sbn);\nOPENSSL_free(signature);\nECDSA_SIG_free(obj);\n
"},{"location":"man3/ECDSA_SIG_new/#conforming-to","title":"CONFORMING TO","text":"

ANSI X9.62, US Federal Information Processing Standard FIPS186-4 (Digital Signature Standard, DSS)

"},{"location":"man3/ECDSA_SIG_new/#see-also","title":"SEE ALSO","text":"

EC_KEY_new(3), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3), EVP_PKEY_sign(3) i2d_ECDSA_SIG(3), d2i_ECDSA_SIG(3), ECDSA_sign(3)

"},{"location":"man3/ECDSA_SIG_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ECDSA_sign/","title":"ECDSA_sign","text":""},{"location":"man3/ECDSA_sign/#name","title":"NAME","text":"

ECDSA_size, ECDSA_sign, ECDSA_do_sign, ECDSA_verify, ECDSA_do_verify, ECDSA_sign_setup, ECDSA_sign_ex, ECDSA_do_sign_ex - deprecated low-level elliptic curve digital signature algorithm (ECDSA) functions

"},{"location":"man3/ECDSA_sign/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ecdsa.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int ECDSA_size(const EC_KEY *eckey);\n\nint ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,\n               unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);\nECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len,\n                         EC_KEY *eckey);\n\nint ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,\n                 const unsigned char *sig, int siglen, EC_KEY *eckey);\nint ECDSA_do_verify(const unsigned char *dgst, int dgst_len,\n                    const ECDSA_SIG *sig, EC_KEY* eckey);\n\nECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,\n                            const BIGNUM *kinv, const BIGNUM *rp,\n                            EC_KEY *eckey);\nint ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp);\nint ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,\n                  unsigned char *sig, unsigned int *siglen,\n                  const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);\n
"},{"location":"man3/ECDSA_sign/#description","title":"DESCRIPTION","text":"

See ECDSA_SIG_new(3) for a description of the ECDSA_SIG object.

See i2d_ECDSA_SIG(3) and d2i_ECDSA_SIG(3) for information about encoding and decoding ECDSA signatures to/from DER.

All of the functions described below are deprecated. Applications should use the higher level EVP interface such as EVP_DigestSignInit(3) or EVP_DigestVerifyInit(3) instead.

ECDSA_size() returns the maximum length of a DER encoded ECDSA signature created with the private EC key eckey. To obtain the actual signature size use EVP_PKEY_sign(3) with a NULL sig parameter.

ECDSA_sign() computes a digital signature of the dgstlen bytes hash value dgst using the private EC key eckey. The DER encoded signatures is stored in sig and its length is returned in sig_len. Note: sig must point to ECDSA_size(eckey) bytes of memory. The parameter type is currently ignored. ECDSA_sign() is wrapper function for ECDSA_sign_ex() with kinv and rp set to NULL.

ECDSA_do_sign() is similar to ECDSA_sign() except the signature is returned as a newly allocated ECDSA_SIG structure (or NULL on error). ECDSA_do_sign() is a wrapper function for ECDSA_do_sign_ex() with kinv and rp set to NULL.

ECDSA_verify() verifies that the signature in sig of size siglen is a valid ECDSA signature of the hash value dgst of size dgstlen using the public key eckey. The parameter type is ignored.

ECDSA_do_verify() is similar to ECDSA_verify() except the signature is presented in the form of a pointer to an ECDSA_SIG structure.

The remaining functions utilise the internal kinv and r values used during signature computation. Most applications will never need to call these and some external ECDSA ENGINE implementations may not support them at all if either kinv or r is not NULL.

ECDSA_sign_setup() may be used to precompute parts of the signing operation. eckey is the private EC key and ctx is a pointer to BN_CTX structure (or NULL). The precomputed values or returned in kinv and rp and can be used in a later call to ECDSA_sign_ex() or ECDSA_do_sign_ex().

ECDSA_sign_ex() computes a digital signature of the dgstlen bytes hash value dgst using the private EC key eckey and the optional pre-computed values kinv and rp. The DER encoded signature is stored in sig and its length is returned in sig_len. Note: sig must point to ECDSA_size(eckey) bytes of memory. The parameter type is ignored.

ECDSA_do_sign_ex() is similar to ECDSA_sign_ex() except the signature is returned as a newly allocated ECDSA_SIG structure (or NULL on error).

"},{"location":"man3/ECDSA_sign/#return-values","title":"RETURN VALUES","text":"

ECDSA_size() returns the maximum length signature or 0 on error.

ECDSA_sign(), ECDSA_sign_ex() and ECDSA_sign_setup() return 1 if successful or 0 on error.

ECDSA_do_sign() and ECDSA_do_sign_ex() return a pointer to an allocated ECDSA_SIG structure or NULL on error.

ECDSA_verify() and ECDSA_do_verify() return 1 for a valid signature, 0 for an invalid signature and -1 on error. The error codes can be obtained by ERR_get_error(3).

"},{"location":"man3/ECDSA_sign/#examples","title":"EXAMPLES","text":"

Creating an ECDSA signature of a given SHA-256 hash value using the named curve prime256v1 (aka P-256). This example uses deprecated functionality. See \"DESCRIPTION\".

First step: create an EC_KEY object (note: this part is not ECDSA specific)

int ret;\nECDSA_SIG *sig;\nEC_KEY *eckey;\n\neckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);\nif (eckey == NULL)\n    /* error */\nif (EC_KEY_generate_key(eckey) == 0)\n    /* error */\n

Second step: compute the ECDSA signature of a SHA-256 hash value using ECDSA_do_sign():

sig = ECDSA_do_sign(digest, 32, eckey);\nif (sig == NULL)\n    /* error */\n

or using ECDSA_sign():

unsigned char *buffer, *pp;\nint buf_len;\n\nbuf_len = ECDSA_size(eckey);\nbuffer = OPENSSL_malloc(buf_len);\npp = buffer;\nif (ECDSA_sign(0, dgst, dgstlen, pp, &buf_len, eckey) == 0)\n    /* error */\n

Third step: verify the created ECDSA signature using ECDSA_do_verify():

ret = ECDSA_do_verify(digest, 32, sig, eckey);\n

or using ECDSA_verify():

ret = ECDSA_verify(0, digest, 32, buffer, buf_len, eckey);\n

and finally evaluate the return value:

if (ret == 1)\n    /* signature ok */\nelse if (ret == 0)\n    /* incorrect signature */\nelse\n    /* error */\n
"},{"location":"man3/ECDSA_sign/#conforming-to","title":"CONFORMING TO","text":"

ANSI X9.62, US Federal Information Processing Standard FIPS186-2 (Digital Signature Standard, DSS)

"},{"location":"man3/ECDSA_sign/#see-also","title":"SEE ALSO","text":"

EC_KEY_new(3), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3), EVP_PKEY_sign(3) i2d_ECDSA_SIG(3), d2i_ECDSA_SIG(3)

"},{"location":"man3/ECDSA_sign/#history","title":"HISTORY","text":"

All functionality described here was deprecated in OpenSSL 3.0.

"},{"location":"man3/ECDSA_sign/#copyright","title":"COPYRIGHT","text":"

Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ECPKParameters_print/","title":"ECPKParameters_print","text":""},{"location":"man3/ECPKParameters_print/#name","title":"NAME","text":"

ECPKParameters_print, ECPKParameters_print_fp - Functions for decoding and encoding ASN1 representations of elliptic curve entities

"},{"location":"man3/ECPKParameters_print/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);\nint ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);\n
"},{"location":"man3/ECPKParameters_print/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_print_params(3)

The ECPKParameters represent the public parameters for an EC_GROUP structure, which represents a curve.

The ECPKParameters_print() and ECPKParameters_print_fp() functions print a human-readable output of the public parameters of the EC_GROUP to bp or fp. The output lines are indented by off spaces.

"},{"location":"man3/ECPKParameters_print/#return-values","title":"RETURN VALUES","text":"

ECPKParameters_print() and ECPKParameters_print_fp() return 1 for success and 0 if an error occurs.

"},{"location":"man3/ECPKParameters_print/#see-also","title":"SEE ALSO","text":"

crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3),

"},{"location":"man3/ECPKParameters_print/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

"},{"location":"man3/ECPKParameters_print/#copyright","title":"COPYRIGHT","text":"

Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EC_GFp_simple_method/","title":"EC_GFp_simple_method","text":""},{"location":"man3/EC_GFp_simple_method/#name","title":"NAME","text":"

EC_GFp_simple_method, EC_GFp_mont_method, EC_GFp_nist_method, EC_GFp_nistp224_method, EC_GFp_nistp256_method, EC_GFp_nistp521_method, EC_GF2m_simple_method, EC_METHOD_get_field_type - Functions for obtaining EC_METHOD objects

"},{"location":"man3/EC_GFp_simple_method/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

const EC_METHOD *EC_GFp_simple_method(void);\nconst EC_METHOD *EC_GFp_mont_method(void);\nconst EC_METHOD *EC_GFp_nist_method(void);\nconst EC_METHOD *EC_GFp_nistp224_method(void);\nconst EC_METHOD *EC_GFp_nistp256_method(void);\nconst EC_METHOD *EC_GFp_nistp521_method(void);\n\nconst EC_METHOD *EC_GF2m_simple_method(void);\n\nint EC_METHOD_get_field_type(const EC_METHOD *meth);\n
"},{"location":"man3/EC_GFp_simple_method/#description","title":"DESCRIPTION","text":"

All const EC_METHOD *EC_GF* functions were deprecated in OpenSSL 3.0, since EC_METHOD is no longer a public concept.

The Elliptic Curve library provides a number of different implementations through a single common interface. When constructing a curve using EC_GROUP_new (see EC_GROUP_new(3)) an implementation method must be provided. The functions described here all return a const pointer to an EC_METHOD structure that can be passed to EC_GROUP_NEW. It is important that the correct implementation type for the form of curve selected is used.

For F2^m curves there is only one implementation choice, i.e. EC_GF2_simple_method.

For Fp curves the lowest common denominator implementation is the EC_GFp_simple_method implementation. All other implementations are based on this one. EC_GFp_mont_method builds on EC_GFp_simple_method but adds the use of montgomery multiplication (see BN_mod_mul_montgomery(3)). EC_GFp_nist_method offers an implementation optimised for use with NIST recommended curves (NIST curves are available through EC_GROUP_new_by_curve_name as described in EC_GROUP_new(3)).

The functions EC_GFp_nistp224_method, EC_GFp_nistp256_method and EC_GFp_nistp521_method offer 64 bit optimised implementations for the NIST P224, P256 and P521 curves respectively. Note, however, that these implementations are not available on all platforms.

EC_METHOD_get_field_type() was deprecated in OpenSSL 3.0. Applications should use EC_GROUP_get_field_type() as a replacement (see EC_GROUP_copy(3)).

"},{"location":"man3/EC_GFp_simple_method/#return-values","title":"RETURN VALUES","text":"

All EC_GFp* functions and EC_GF2m_simple_method always return a const pointer to an EC_METHOD structure.

EC_METHOD_get_field_type returns an integer that identifies the type of field the EC_METHOD structure supports.

"},{"location":"man3/EC_GFp_simple_method/#see-also","title":"SEE ALSO","text":"

crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), d2i_ECPKParameters(3), BN_mod_mul_montgomery(3)

"},{"location":"man3/EC_GFp_simple_method/#history","title":"HISTORY","text":"

EC_GFp_simple_method(), EC_GFp_mont_method(void), EC_GFp_nist_method(), EC_GFp_nistp224_method(), EC_GFp_nistp256_method(), EC_GFp_nistp521_method(), EC_GF2m_simple_method(), and EC_METHOD_get_field_type() were deprecated in OpenSSL 3.0.

"},{"location":"man3/EC_GFp_simple_method/#copyright","title":"COPYRIGHT","text":"

Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EC_GROUP_copy/","title":"EC_GROUP_copy","text":""},{"location":"man3/EC_GROUP_copy/#name","title":"NAME","text":"

EC_GROUP_get0_order, EC_GROUP_order_bits, EC_GROUP_get0_cofactor, EC_GROUP_copy, EC_GROUP_dup, EC_GROUP_method_of, EC_GROUP_set_generator, EC_GROUP_get0_generator, EC_GROUP_get_order, EC_GROUP_get_cofactor, EC_GROUP_set_curve_name, EC_GROUP_get_curve_name, EC_GROUP_set_asn1_flag, EC_GROUP_get_asn1_flag, EC_GROUP_set_point_conversion_form, EC_GROUP_get_point_conversion_form, EC_GROUP_get0_seed, EC_GROUP_get_seed_len, EC_GROUP_set_seed, EC_GROUP_get_degree, EC_GROUP_check, EC_GROUP_check_named_curve, EC_GROUP_check_discriminant, EC_GROUP_cmp, EC_GROUP_get_basis_type, EC_GROUP_get_trinomial_basis, EC_GROUP_get_pentanomial_basis, EC_GROUP_get0_field, EC_GROUP_get_field_type - Functions for manipulating EC_GROUP objects

"},{"location":"man3/EC_GROUP_copy/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n\nint EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);\nEC_GROUP *EC_GROUP_dup(const EC_GROUP *src);\n\nint EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,\n                           const BIGNUM *order, const BIGNUM *cofactor);\nconst EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);\n\nint EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);\nconst BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group);\nint EC_GROUP_order_bits(const EC_GROUP *group);\nint EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx);\nconst BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group);\nconst BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group);\n\nvoid EC_GROUP_set_curve_name(EC_GROUP *group, int nid);\nint EC_GROUP_get_curve_name(const EC_GROUP *group);\n\nvoid EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);\nint EC_GROUP_get_asn1_flag(const EC_GROUP *group);\n\nvoid EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);\npoint_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *group);\n\nunsigned char *EC_GROUP_get0_seed(const EC_GROUP *group);\nsize_t EC_GROUP_get_seed_len(const EC_GROUP *group);\nsize_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *, size_t len);\n\nint EC_GROUP_get_degree(const EC_GROUP *group);\n\nint EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);\nint EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only,\n                               BN_CTX *ctx);\n\nint EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);\n\nint EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);\n\nint EC_GROUP_get_basis_type(const EC_GROUP *group);\nint EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k);\nint EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1,\n                                   unsigned int *k2, unsigned int *k3);\n\nint EC_GROUP_get_field_type(const EC_GROUP *group);\n

The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);\n
"},{"location":"man3/EC_GROUP_copy/#description","title":"DESCRIPTION","text":"

EC_GROUP_copy() copies the curve src into dst. Both src and dst must use the same EC_METHOD.

EC_GROUP_dup() creates a new EC_GROUP object and copies the content from src to the newly created EC_GROUP object.

EC_GROUP_method_of() obtains the EC_METHOD of group. This function was deprecated in OpenSSL 3.0, since EC_METHOD is no longer a public concept.

EC_GROUP_set_generator() sets curve parameters that must be agreed by all participants using the curve. These parameters include the generator, the order and the cofactor. The generator is a well defined point on the curve chosen for cryptographic operations. Integers used for point multiplications will be between 0 and n-1 where n is the order. The order multiplied by the cofactor gives the number of points on the curve.

EC_GROUP_get0_generator() returns the generator for the identified group.

EC_GROUP_get_order() retrieves the order of group and copies its value into order. It fails in case group is not fully initialized (i.e., its order is not set or set to zero).

EC_GROUP_get_cofactor() retrieves the cofactor of group and copies its value into cofactor. It fails in case group is not fully initialized or if the cofactor is not set (or set to zero).

The functions EC_GROUP_set_curve_name() and EC_GROUP_get_curve_name(), set and get the NID for the curve respectively (see EC_GROUP_new(3)). If a curve does not have a NID associated with it, then EC_GROUP_get_curve_name will return NID_undef.

The asn1_flag value is used to determine whether the curve encoding uses explicit parameters or a named curve using an ASN1 OID: many applications only support the latter form. If asn1_flag is OPENSSL_EC_NAMED_CURVE then the named curve form is used and the parameters must have a corresponding named curve NID set. If asn1_flags is OPENSSL_EC_EXPLICIT_CURVE the parameters are explicitly encoded. The functions EC_GROUP_get_asn1_flag() and EC_GROUP_set_asn1_flag() get and set the status of the asn1_flag for the curve. Note: OPENSSL_EC_EXPLICIT_CURVE was added in OpenSSL 1.1.0, for previous versions of OpenSSL the value 0 must be used instead. Before OpenSSL 1.1.0 the default form was to use explicit parameters (meaning that applications would have to explicitly set the named curve form) in OpenSSL 1.1.0 and later the named curve form is the default.

The point_conversion_form for a curve controls how EC_POINT data is encoded as ASN1 as defined in X9.62 (ECDSA). point_conversion_form_t is an enum defined as follows:

typedef enum {\n       /** the point is encoded as z||x, where the octet z specifies\n        *   which solution of the quadratic equation y is  */\n       POINT_CONVERSION_COMPRESSED = 2,\n       /** the point is encoded as z||x||y, where z is the octet 0x04  */\n       POINT_CONVERSION_UNCOMPRESSED = 4,\n       /** the point is encoded as z||x||y, where the octet z specifies\n        *  which solution of the quadratic equation y is  */\n       POINT_CONVERSION_HYBRID = 6\n} point_conversion_form_t;\n

For POINT_CONVERSION_UNCOMPRESSED the point is encoded as an octet signifying the UNCOMPRESSED form has been used followed by the octets for x, followed by the octets for y.

For any given x coordinate for a point on a curve it is possible to derive two possible y values. For POINT_CONVERSION_COMPRESSED the point is encoded as an octet signifying that the COMPRESSED form has been used AND which of the two possible solutions for y has been used, followed by the octets for x.

For POINT_CONVERSION_HYBRID the point is encoded as an octet signifying the HYBRID form has been used AND which of the two possible solutions for y has been used, followed by the octets for x, followed by the octets for y.

The functions EC_GROUP_set_point_conversion_form() and EC_GROUP_get_point_conversion_form(), set and get the point_conversion_form for the curve respectively.

ANSI X9.62 (ECDSA standard) defines a method of generating the curve parameter b from a random number. This provides advantages in that a parameter obtained in this way is highly unlikely to be susceptible to special purpose attacks, or have any trapdoors in it. If the seed is present for a curve then the b parameter was generated in a verifiable fashion using that seed. The OpenSSL EC library does not use this seed value but does enable you to inspect it using EC_GROUP_get0_seed(). This returns a pointer to a memory block containing the seed that was used. The length of the memory block can be obtained using EC_GROUP_get_seed_len(). A number of the built-in curves within the library provide seed values that can be obtained. It is also possible to set a custom seed using EC_GROUP_set_seed() and passing a pointer to a memory block, along with the length of the seed. Again, the EC library will not use this seed value, although it will be preserved in any ASN1 based communications.

EC_GROUP_get_degree() gets the degree of the field. For Fp fields this will be the number of bits in p. For F2^m fields this will be the value m.

EC_GROUP_get_field_type() identifies what type of field the EC_GROUP structure supports, which will be either F2^m or Fp.

The function EC_GROUP_check_discriminant() calculates the discriminant for the curve and verifies that it is valid. For a curve defined over Fp the discriminant is given by the formula 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is simply b. In either case for the curve to be valid the discriminant must be non zero.

The function EC_GROUP_check() behaves in the following way: For the OpenSSL default provider it performs a number of checks on a curve to verify that it is valid. Checks performed include verifying that the discriminant is non zero; that a generator has been defined; that the generator is on the curve and has the correct order. For the OpenSSL FIPS provider it uses EC_GROUP_check_named_curve() to conform to SP800-56Ar3.

The function EC_GROUP_check_named_curve() determines if the group's domain parameters match one of the built-in curves supported by the library. The curve name is returned as a NID if it matches. If the group's domain parameters have been modified then no match will be found. If the curve name of the given group is NID_undef (e.g. it has been created by using explicit parameters with no curve name), then this method can be used to lookup the name of the curve that matches the group domain parameters. The built-in curves contain aliases, so that multiple NID's can map to the same domain parameters. For such curves it is unspecified which of the aliases will be returned if the curve name of the given group is NID_undef. If nist_only is 1 it will only look for NIST approved curves, otherwise it searches all built-in curves. This function may be passed a BN_CTX object in the ctx parameter. The ctx parameter may be NULL.

EC_GROUP_cmp() compares a and b to determine whether they represent the same curve or not.

The functions EC_GROUP_get_basis_type(), EC_GROUP_get_trinomial_basis() and EC_GROUP_get_pentanomial_basis() should only be called for curves defined over an F2^m field. Addition and multiplication operations within an F2^m field are performed using an irreducible polynomial function f(x). This function is either a trinomial of the form:

f(x) = x^m + x^k + 1 with m > k >= 1

or a pentanomial of the form:

f(x) = x^m + x^k3 + x^k2 + x^k1 + 1 with m > k3 > k2 > k1 >= 1

The function EC_GROUP_get_basis_type() returns a NID identifying whether a trinomial or pentanomial is in use for the field. The function EC_GROUP_get_trinomial_basis() must only be called where f(x) is of the trinomial form, and returns the value of k. Similarly the function EC_GROUP_get_pentanomial_basis() must only be called where f(x) is of the pentanomial form, and returns the values of k1, k2 and k3 respectively.

"},{"location":"man3/EC_GROUP_copy/#return-values","title":"RETURN VALUES","text":"

The following functions return 1 on success or 0 on error: EC_GROUP_copy(), EC_GROUP_set_generator(), EC_GROUP_check(), EC_GROUP_check_discriminant(), EC_GROUP_get_trinomial_basis() and EC_GROUP_get_pentanomial_basis().

EC_GROUP_dup() returns a pointer to the duplicated curve, or NULL on error.

EC_GROUP_method_of() returns the EC_METHOD implementation in use for the given curve or NULL on error.

EC_GROUP_get0_generator() returns the generator for the given curve or NULL on error.

EC_GROUP_get_order() returns 0 if the order is not set (or set to zero) for group or if copying into order fails, 1 otherwise.

EC_GROUP_get_cofactor() returns 0 if the cofactor is not set (or is set to zero) for group or if copying into cofactor fails, 1 otherwise.

EC_GROUP_get_curve_name() returns the curve name (NID) for group or will return NID_undef if no curve name is associated.

EC_GROUP_get_asn1_flag() returns the ASN1 flag for the specified group .

EC_GROUP_get_point_conversion_form() returns the point_conversion_form for group.

EC_GROUP_get_degree() returns the degree for group or 0 if the operation is not supported by the underlying group implementation.

EC_GROUP_get_field_type() returns either NID_X9_62_prime_field for prime curves or NID_X9_62_characteristic_two_field for binary curves; these values are defined in the <openssl/obj_mac.h> header file.

EC_GROUP_check_named_curve() returns the nid of the matching named curve, otherwise it returns 0 for no match, or -1 on error.

EC_GROUP_get0_order() returns an internal pointer to the group order. EC_GROUP_order_bits() returns the number of bits in the group order. EC_GROUP_get0_cofactor() returns an internal pointer to the group cofactor. EC_GROUP_get0_field() returns an internal pointer to the group field. For curves over GF(p), this is the modulus; for curves over GF(2^m), this is the irreducible polynomial defining the field.

EC_GROUP_get0_seed() returns a pointer to the seed that was used to generate the parameter b, or NULL if the seed is not specified. EC_GROUP_get_seed_len() returns the length of the seed or 0 if the seed is not specified.

EC_GROUP_set_seed() returns the length of the seed that has been set. If the supplied seed is NULL, or the supplied seed length is 0, the return value will be 1. On error 0 is returned.

EC_GROUP_cmp() returns 0 if the curves are equal, 1 if they are not equal, or -1 on error.

EC_GROUP_get_basis_type() returns the values NID_X9_62_tpBasis or NID_X9_62_ppBasis (as defined in <openssl/obj_mac.h>) for a trinomial or pentanomial respectively. Alternatively in the event of an error a 0 is returned.

"},{"location":"man3/EC_GROUP_copy/#see-also","title":"SEE ALSO","text":"

crypto(7), EC_GROUP_new(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)

"},{"location":"man3/EC_GROUP_copy/#history","title":"HISTORY","text":"

EC_GROUP_method_of() was deprecated in OpenSSL 3.0. EC_GROUP_get0_field(), EC_GROUP_check_named_curve() and EC_GROUP_get_field_type() were added in OpenSSL 3.0. EC_GROUP_get0_order(), EC_GROUP_order_bits() and EC_GROUP_get0_cofactor() were added in OpenSSL 1.1.0.

"},{"location":"man3/EC_GROUP_copy/#copyright","title":"COPYRIGHT","text":"

Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EC_GROUP_new/","title":"EC_GROUP_new","text":""},{"location":"man3/EC_GROUP_new/#name","title":"NAME","text":"

EC_GROUP_get_ecparameters, EC_GROUP_get_ecpkparameters, EC_GROUP_new_from_params, EC_GROUP_new_from_ecparameters, EC_GROUP_new_from_ecpkparameters, EC_GROUP_new, EC_GROUP_free, EC_GROUP_clear_free, EC_GROUP_new_curve_GFp, EC_GROUP_new_curve_GF2m, EC_GROUP_new_by_curve_name_ex, EC_GROUP_new_by_curve_name, EC_GROUP_set_curve, EC_GROUP_get_curve, EC_GROUP_set_curve_GFp, EC_GROUP_get_curve_GFp, EC_GROUP_set_curve_GF2m, EC_GROUP_get_curve_GF2m, EC_get_builtin_curves, OSSL_EC_curve_nid2name - Functions for creating and destroying EC_GROUP objects

"},{"location":"man3/EC_GROUP_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n\nEC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[],\n                                   OSSL_LIB_CTX *libctx, const char *propq);\nEC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params);\nEC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params);\nvoid EC_GROUP_free(EC_GROUP *group);\n\nEC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,\n                                 const BIGNUM *b, BN_CTX *ctx);\nEC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,\n                                  const BIGNUM *b, BN_CTX *ctx);\nEC_GROUP *EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX *libctx, const char *propq,\n                                        int nid);\nEC_GROUP *EC_GROUP_new_by_curve_name(int nid);\n\nint EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,\n                       const BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,\n                       BN_CTX *ctx);\n\nECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group,\n                                        ECPARAMETERS *params);\nECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group,\n                                            ECPKPARAMETERS *params);\n\nsize_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);\nconst char *OSSL_EC_curve_nid2name(int nid);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);\nvoid EC_GROUP_clear_free(EC_GROUP *group);\n\nint EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p,\n                           const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p,\n                           BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p,\n                            const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p,\n                            BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\n
"},{"location":"man3/EC_GROUP_new/#description","title":"DESCRIPTION","text":"

Within the library there are two forms of elliptic curve that are of interest. The first form is those defined over the prime field Fp. The elements of Fp are the integers 0 to p-1, where p is a prime number. This gives us a revised elliptic curve equation as follows:

y^2 mod p = x^3 +ax + b mod p

The second form is those defined over a binary field F2^m where the elements of the field are integers of length at most m bits. For this form the elliptic curve equation is modified to:

y^2 + xy = x^3 + ax^2 + b (where b != 0)

Operations in a binary field are performed relative to an irreducible polynomial. All such curves with OpenSSL use a trinomial or a pentanomial for this parameter.

Although deprecated since OpenSSL 3.0 and should no longer be used, a new curve can be constructed by calling EC_GROUP_new(), using the implementation provided by meth (see EC_GFp_simple_method(3)) and associated with the library context ctx (see OSSL_LIB_CTX(3)). The ctx parameter may be NULL in which case the default library context is used. It is then necessary to call EC_GROUP_set_curve() to set the curve parameters. Applications should instead use one of the other EC_GROUP_new_* constructors.

EC_GROUP_new_from_params() creates a group with parameters specified by params. The library context libctx (see OSSL_LIB_CTX(3)) and property query string propq are used to fetch algorithms from providers. params may be either a list of explicit params or a named group, The values for ctx and propq may be NULL. The params that can be used are described in EVP_PKEY-EC(7).

EC_GROUP_new_from_ecparameters() will create a group from the specified params and EC_GROUP_new_from_ecpkparameters() will create a group from the specific PK params.

EC_GROUP_set_curve() sets the curve parameters p, a and b. For a curve over Fp p is the prime for the field. For a curve over F2^m p represents the irreducible polynomial - each bit represents a term in the polynomial. Therefore, there will either be three or five bits set dependent on whether the polynomial is a trinomial or a pentanomial. In either case, a and b represents the coefficients a and b from the relevant equation introduced above.

EC_group_get_curve() obtains the previously set curve parameters.

EC_GROUP_set_curve_GFp() and EC_GROUP_set_curve_GF2m() are synonyms for EC_GROUP_set_curve(). They are defined for backwards compatibility only and should not be used.

EC_GROUP_get_curve_GFp() and EC_GROUP_get_curve_GF2m() are synonyms for EC_GROUP_get_curve(). They are defined for backwards compatibility only and should not be used.

The functions EC_GROUP_new_curve_GFp() and EC_GROUP_new_curve_GF2m() are shortcuts for calling EC_GROUP_new() and then the EC_GROUP_set_curve() function. An appropriate default implementation method will be used.

Whilst the library can be used to create any curve using the functions described above, there are also a number of predefined curves that are available. In order to obtain a list of all of the predefined curves, call the function EC_get_builtin_curves(). The parameter r should be an array of EC_builtin_curve structures of size nitems. The function will populate the r array with information about the built-in curves. If nitems is less than the total number of curves available, then the first nitems curves will be returned. Otherwise the total number of curves will be provided. The return value is the total number of curves available (whether that number has been populated in r or not). Passing a NULL r, or setting nitems to 0 will do nothing other than return the total number of curves available. The EC_builtin_curve structure is defined as follows:

typedef struct {\n       int nid;\n       const char *comment;\n       } EC_builtin_curve;\n

Each EC_builtin_curve item has a unique integer id (nid), and a human readable comment string describing the curve.

In order to construct a built-in curve use the function EC_GROUP_new_by_curve_name_ex() and provide the nid of the curve to be constructed, the associated library context to be used in ctx (see OSSL_LIB_CTX(3)) and any property query string in propq. The ctx value may be NULL in which case the default library context is used. The propq value may also be NULL.

EC_GROUP_new_by_curve_name() is the same as EC_GROUP_new_by_curve_name_ex() except that the default library context is always used along with a NULL property query string.

EC_GROUP_free() frees the memory associated with the EC_GROUP. If group is NULL nothing is done.

EC_GROUP_clear_free() is deprecated: it was meant to destroy any sensitive data held within the EC_GROUP and then free its memory, but since all the data stored in the EC_GROUP is public anyway, this function is unnecessary. Its use can be safely replaced with EC_GROUP_free(). If group is NULL nothing is done.

OSSL_EC_curve_nid2name() converts a curve nid into the corresponding name.

"},{"location":"man3/EC_GROUP_new/#return-values","title":"RETURN VALUES","text":"

All EC_GROUP_new* functions return a pointer to the newly constructed group, or NULL on error.

EC_get_builtin_curves() returns the number of built-in curves that are available.

EC_GROUP_set_curve_GFp(), EC_GROUP_get_curve_GFp(), EC_GROUP_set_curve_GF2m(), EC_GROUP_get_curve_GF2m() return 1 on success or 0 on error.

OSSL_EC_curve_nid2name() returns a character string constant, or NULL on error.

"},{"location":"man3/EC_GROUP_new/#see-also","title":"SEE ALSO","text":"

crypto(7), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3), OSSL_LIB_CTX(3), EVP_PKEY-EC(7)

"},{"location":"man3/EC_GROUP_new/#history","title":"HISTORY","text":"
  • EC_GROUP_new() was deprecated in OpenSSL 3.0.

    EC_GROUP_new_by_curve_name_ex() and EC_GROUP_new_from_params() were added in OpenSSL 3.0.

  • EC_GROUP_clear_free() was deprecated in OpenSSL 3.0; use EC_GROUP_free() instead. -

    EC_GROUP_set_curve_GFp(), EC_GROUP_get_curve_GFp(),\nEC_GROUP_set_curve_GF2m() and EC_GROUP_get_curve_GF2m() were deprecated in\nOpenSSL 3.0; use EC_GROUP_set_curve() and EC_GROUP_get_curve() instead.\n
"},{"location":"man3/EC_GROUP_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EC_KEY_get_enc_flags/","title":"EC_KEY_get_enc_flags","text":""},{"location":"man3/EC_KEY_get_enc_flags/#name","title":"NAME","text":"

EC_KEY_get_enc_flags, EC_KEY_set_enc_flags - Get and set flags for encoding EC_KEY structures

"},{"location":"man3/EC_KEY_get_enc_flags/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n\nunsigned int EC_KEY_get_enc_flags(const EC_KEY *key);\nvoid EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);\n
"},{"location":"man3/EC_KEY_get_enc_flags/#description","title":"DESCRIPTION","text":"

The format of the external representation of the public key written by i2d_ECPrivateKey() (such as whether it is stored in a compressed form or not) is described by the point_conversion_form. See EC_GROUP_copy(3) for a description of point_conversion_form.

When reading a private key encoded without an associated public key (e.g. if EC_PKEY_NO_PUBKEY has been used - see below), then d2i_ECPrivateKey() generates the missing public key automatically. Private keys encoded without parameters (e.g. if EC_PKEY_NO_PARAMETERS has been used - see below) cannot be loaded using d2i_ECPrivateKey().

The functions EC_KEY_get_enc_flags() and EC_KEY_set_enc_flags() get and set the value of the encoding flags for the key. There are two encoding flags currently defined - EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These flags define the behaviour of how the key is converted into ASN1 in a call to i2d_ECPrivateKey(). If EC_PKEY_NO_PARAMETERS is set then the public parameters for the curve are not encoded along with the private key. If EC_PKEY_NO_PUBKEY is set then the public key is not encoded along with the private key.

"},{"location":"man3/EC_KEY_get_enc_flags/#return-values","title":"RETURN VALUES","text":"

EC_KEY_get_enc_flags() returns the value of the current encoding flags for the EC_KEY.

"},{"location":"man3/EC_KEY_get_enc_flags/#see-also","title":"SEE ALSO","text":"

crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3), d2i_ECPrivateKey(3)

"},{"location":"man3/EC_KEY_get_enc_flags/#copyright","title":"COPYRIGHT","text":"

Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EC_KEY_new/","title":"EC_KEY_new","text":""},{"location":"man3/EC_KEY_new/#name","title":"NAME","text":"

EVP_EC_gen, EC_KEY_get_method, EC_KEY_set_method, EC_KEY_new_ex, EC_KEY_new, EC_KEY_get_flags, EC_KEY_set_flags, EC_KEY_clear_flags, EC_KEY_new_by_curve_name_ex, EC_KEY_new_by_curve_name, EC_KEY_free, EC_KEY_copy, EC_KEY_dup, EC_KEY_up_ref, EC_KEY_get0_engine, EC_KEY_get0_group, EC_KEY_set_group, EC_KEY_get0_private_key, EC_KEY_set_private_key, EC_KEY_get0_public_key, EC_KEY_set_public_key, EC_KEY_get_conv_form, EC_KEY_set_conv_form, EC_KEY_set_asn1_flag, EC_KEY_decoded_from_explicit_params, EC_KEY_precompute_mult, EC_KEY_generate_key, EC_KEY_check_key, EC_KEY_set_public_key_affine_coordinates, EC_KEY_oct2key, EC_KEY_key2buf, EC_KEY_oct2priv, EC_KEY_priv2oct, EC_KEY_priv2buf - Functions for creating, destroying and manipulating EC_KEY objects

"},{"location":"man3/EC_KEY_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n\nEVP_PKEY *EVP_EC_gen(const char *curve);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq);\nEC_KEY *EC_KEY_new(void);\nint EC_KEY_get_flags(const EC_KEY *key);\nvoid EC_KEY_set_flags(EC_KEY *key, int flags);\nvoid EC_KEY_clear_flags(EC_KEY *key, int flags);\nEC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, const char *propq,\n                                    int nid);\nEC_KEY *EC_KEY_new_by_curve_name(int nid);\nvoid EC_KEY_free(EC_KEY *key);\nEC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);\nEC_KEY *EC_KEY_dup(const EC_KEY *src);\nint EC_KEY_up_ref(EC_KEY *key);\nENGINE *EC_KEY_get0_engine(const EC_KEY *eckey);\nconst EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);\nint EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);\nconst BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);\nint EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key);\nconst EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);\nint EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);\npoint_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);\nvoid EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);\nvoid EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);\nint EC_KEY_decoded_from_explicit_params(const EC_KEY *key);\nint EC_KEY_generate_key(EC_KEY *key);\nint EC_KEY_check_key(const EC_KEY *key);\nint EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y);\nconst EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key);\nint EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth);\n\nint EC_KEY_oct2key(EC_KEY *eckey, const unsigned char *buf, size_t len, BN_CTX *ctx);\nsize_t EC_KEY_key2buf(const EC_KEY *eckey, point_conversion_form_t form,\n                      unsigned char **pbuf, BN_CTX *ctx);\n\nint EC_KEY_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len);\nsize_t EC_KEY_priv2oct(const EC_KEY *eckey, unsigned char *buf, size_t len);\n\nsize_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf);\nint EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);\n
"},{"location":"man3/EC_KEY_new/#description","title":"DESCRIPTION","text":"

EVP_EC_gen() generates a new EC key pair on the given curve.

All of the functions described below are deprecated. Applications should instead use EVP_EC_gen(), EVP_PKEY_Q_keygen(3), or EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3).

An EC_KEY represents a public key and, optionally, the associated private key. A new EC_KEY with no associated curve can be constructed by calling EC_KEY_new_ex() and specifying the associated library context in ctx (see OSSL_LIB_CTX(3)) and property query string propq. The ctx parameter may be NULL in which case the default library context is used. The reference count for the newly created EC_KEY is initially set to 1. A curve can be associated with the EC_KEY by calling EC_KEY_set_group().

EC_KEY_new() is the same as EC_KEY_new_ex() except that the default library context is always used.

Alternatively a new EC_KEY can be constructed by calling EC_KEY_new_by_curve_name_ex() and supplying the nid of the associated curve, the library context to be used ctx (see OSSL_LIB_CTX(3)) and any property query string propq. The ctx parameter may be NULL in which case the default library context is used. The propq value may also be NULL. See EC_GROUP_new(3) for a description of curve names. This function simply wraps calls to EC_KEY_new_ex() and EC_GROUP_new_by_curve_name_ex().

EC_KEY_new_by_curve_name() is the same as EC_KEY_new_by_curve_name_ex() except that the default library context is always used and a NULL property query string.

Calling EC_KEY_free() decrements the reference count for the EC_KEY object, and if it has dropped to zero then frees the memory associated with it. If key is NULL nothing is done.

EC_KEY_copy() copies the contents of the EC_KEY in src into dest.

EC_KEY_dup() creates a new EC_KEY object and copies ec_key into it.

EC_KEY_up_ref() increments the reference count associated with the EC_KEY object.

EC_KEY_get0_engine() returns a handle to the ENGINE that has been set for this EC_KEY object.

EC_KEY_generate_key() generates a new public and private key for the supplied eckey object. eckey must have an EC_GROUP object associated with it before calling this function. The private key is a random integer (0 < priv_key < order, where order is the order of the EC_GROUP object). The public key is an EC_POINT on the curve calculated by multiplying the generator for the curve by the private key.

EC_KEY_check_key() performs various sanity checks on the EC_KEY object to confirm that it is valid.

EC_KEY_set_public_key_affine_coordinates() sets the public key for key based on its affine coordinates; i.e., it constructs an EC_POINT object based on the supplied x and y values and sets the public key to be this EC_POINT. It also performs certain sanity checks on the key to confirm that it is valid.

The functions EC_KEY_get0_group(), EC_KEY_set_group(), EC_KEY_get0_private_key(), EC_KEY_set_private_key(), EC_KEY_get0_public_key(), and EC_KEY_set_public_key() get and set the EC_GROUP object, the private key, and the EC_POINT public key for the key respectively. The function EC_KEY_set_private_key() accepts NULL as the priv_key argument to securely clear the private key component from the EC_KEY.

The functions EC_KEY_get_conv_form() and EC_KEY_set_conv_form() get and set the point_conversion_form for the key. For a description of point_conversion_forms please see EC_POINT_new(3).

EC_KEY_set_flags() sets the flags in the flags parameter on the EC_KEY object. Any flags that are already set are left set. The flags currently defined are EC_FLAG_NON_FIPS_ALLOW and EC_FLAG_FIPS_CHECKED. In addition there is the flag EC_FLAG_COFACTOR_ECDH which is specific to ECDH. EC_KEY_get_flags() returns the current flags that are set for this EC_KEY. EC_KEY_clear_flags() clears the flags indicated by the flags parameter; all other flags are left in their existing state.

EC_KEY_set_asn1_flag() sets the asn1_flag on the underlying EC_GROUP object (if set). Refer to EC_GROUP_copy(3) for further information on the asn1_flag.

EC_KEY_decoded_from_explicit_params() returns 1 if the group of the key was decoded from data with explicitly encoded group parameters, -1 if the key is NULL or the group parameters are missing, and 0 otherwise.

EC_KEY_precompute_mult() stores multiples of the underlying EC_GROUP generator for faster point multiplication. See also EC_POINT_add(3). Modern versions should instead switch to named curves which OpenSSL has hardcoded lookup tables for.

EC_KEY_oct2key() and EC_KEY_key2buf() are identical to the functions EC_POINT_oct2point() and EC_POINT_point2buf() except they use the public key EC_POINT in eckey.

EC_KEY_oct2priv() and EC_KEY_priv2oct() convert between the private key component of eckey and octet form. The octet form consists of the content octets of the privateKey OCTET STRING in an ECPrivateKey ASN.1 structure.

The function EC_KEY_priv2oct() must be supplied with a buffer long enough to store the octet form. The return value provides the number of octets stored. Calling the function with a NULL buffer will not perform the conversion but will just return the required buffer length.

The function EC_KEY_priv2buf() allocates a buffer of suitable length and writes an EC_KEY to it in octet format. The allocated buffer is written to *pbuf and its length is returned. The caller must free up the allocated buffer with a call to OPENSSL_free(). Since the allocated buffer value is written to *pbuf the pbuf parameter MUST NOT be NULL.

EC_KEY_priv2buf() converts an EC_KEY private key into an allocated buffer.

"},{"location":"man3/EC_KEY_new/#return-values","title":"RETURN VALUES","text":"

EC_KEY_new_ex(), EC_KEY_new(), EC_KEY_new_by_curve_name_ex(), EC_KEY_new_by_curve_name() and EC_KEY_dup() return a pointer to the newly created EC_KEY object, or NULL on error.

EC_KEY_get_flags() returns the flags associated with the EC_KEY object as an integer.

EC_KEY_copy() returns a pointer to the destination key, or NULL on error.

EC_KEY_get0_engine() returns a pointer to an ENGINE, or NULL if it wasn't set.

EC_KEY_up_ref(), EC_KEY_set_group(), EC_KEY_set_public_key(), EC_KEY_precompute_mult(), EC_KEY_generate_key(), EC_KEY_check_key(), EC_KEY_set_public_key_affine_coordinates(), EC_KEY_oct2key() and EC_KEY_oct2priv() return 1 on success or 0 on error.

EC_KEY_set_private_key() returns 1 on success or 0 on error except when the priv_key argument is NULL, in that case it returns 0, for legacy compatibility, and should not be treated as an error.

EC_KEY_get0_group() returns the EC_GROUP associated with the EC_KEY.

EC_KEY_get0_private_key() returns the private key associated with the EC_KEY.

EC_KEY_get_conv_form() return the point_conversion_form for the EC_KEY.

EC_KEY_key2buf(), EC_KEY_priv2oct() and EC_KEY_priv2buf() return the length of the buffer or 0 on error.

"},{"location":"man3/EC_KEY_new/#see-also","title":"SEE ALSO","text":"

EVP_PKEY_Q_keygen(3) crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3), OSSL_LIB_CTX(3)

"},{"location":"man3/EC_KEY_new/#history","title":"HISTORY","text":"

EVP_EC_gen() was added in OpenSSL 3.0. All other functions described here were deprecated in OpenSSL 3.0. For replacement see EVP_PKEY-EC(7).

"},{"location":"man3/EC_KEY_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EC_POINT_add/","title":"EC_POINT_add","text":""},{"location":"man3/EC_POINT_add/#name","title":"NAME","text":"

EC_POINT_add, EC_POINT_dbl, EC_POINT_invert, EC_POINT_is_at_infinity, EC_POINT_is_on_curve, EC_POINT_cmp, EC_POINT_make_affine, EC_POINTs_make_affine, EC_POINTs_mul, EC_POINT_mul, EC_GROUP_precompute_mult, EC_GROUP_have_precompute_mult - Functions for performing mathematical operations and tests on EC_POINT objects

"},{"location":"man3/EC_POINT_add/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n\nint EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,\n                 const EC_POINT *b, BN_CTX *ctx);\nint EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx);\nint EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);\nint EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);\nint EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx);\nint EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);\nint EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n,\n                 const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);\nint EC_POINTs_make_affine(const EC_GROUP *group, size_t num,\n                          EC_POINT *points[], BN_CTX *ctx);\nint EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num,\n                  const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);\nint EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);\nint EC_GROUP_have_precompute_mult(const EC_GROUP *group);\n
"},{"location":"man3/EC_POINT_add/#description","title":"DESCRIPTION","text":"

EC_POINT_add adds the two points a and b and places the result in r. Similarly EC_POINT_dbl doubles the point a and places the result in r. In both cases it is valid for r to be one of a or b.

EC_POINT_invert calculates the inverse of the supplied point a. The result is placed back in a.

The function EC_POINT_is_at_infinity tests whether the supplied point is at infinity or not.

EC_POINT_is_on_curve tests whether the supplied point is on the curve or not.

EC_POINT_cmp compares the two supplied points and tests whether or not they are equal.

The functions EC_POINT_make_affine and EC_POINTs_make_affine force the internal representation of the EC_POINT(s) into the affine coordinate system. In the case of EC_POINTs_make_affine the value num provides the number of points in the array points to be forced. These functions were deprecated in OpenSSL 3.0 and should no longer be used. Modern versions automatically perform this conversion when needed.

EC_POINT_mul calculates the value generator * n + q * m and stores the result in r. The value n may be NULL in which case the result is just q * m (variable point multiplication). Alternatively, both q and m may be NULL, and n non-NULL, in which case the result is just generator * n (fixed point multiplication). When performing a single fixed or variable point multiplication, the underlying implementation uses a constant time algorithm, when the input scalar (either n or m) is in the range [0, ec_group_order).

Although deprecated in OpenSSL 3.0 and should no longer be used, EC_POINTs_mul calculates the value generator * n + q[0] * m[0] + ... + q[num-1] * m[num-1]. As for EC_POINT_mul the value n may be NULL or num may be zero. When performing a fixed point multiplication (n is non-NULL and num is 0) or a variable point multiplication (n is NULL and num is 1), the underlying implementation uses a constant time algorithm, when the input scalar (either n or m[0]) is in the range [0, ec_group_order). Modern versions should instead use EC_POINT_mul(), combined (if needed) with EC_POINT_add() in such rare circumstances.

The function EC_GROUP_precompute_mult stores multiples of the generator for faster point multiplication, whilst EC_GROUP_have_precompute_mult tests whether precomputation has already been done. See EC_GROUP_copy(3) for information about the generator. Precomputation functionality was deprecated in OpenSSL 3.0. Users of EC_GROUP_precompute_mult() and EC_GROUP_have_precompute_mult() should switch to named curves which OpenSSL has hardcoded lookup tables for.

"},{"location":"man3/EC_POINT_add/#return-values","title":"RETURN VALUES","text":"

The following functions return 1 on success or 0 on error: EC_POINT_add, EC_POINT_dbl, EC_POINT_invert, EC_POINT_make_affine, EC_POINTs_make_affine, EC_POINTs_make_affine, EC_POINT_mul, EC_POINTs_mul and EC_GROUP_precompute_mult.

EC_POINT_is_at_infinity returns 1 if the point is at infinity, or 0 otherwise.

EC_POINT_is_on_curve returns 1 if the point is on the curve, 0 if not, or -1 on error.

EC_POINT_cmp returns 1 if the points are not equal, 0 if they are, or -1 on error.

EC_GROUP_have_precompute_mult return 1 if a precomputation has been done, or 0 if not.

"},{"location":"man3/EC_POINT_add/#see-also","title":"SEE ALSO","text":"

crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)

"},{"location":"man3/EC_POINT_add/#history","title":"HISTORY","text":"

EC_POINT_make_affine(), EC_POINTs_make_affine(), EC_POINTs_mul(), EC_GROUP_precompute_mult(), and EC_GROUP_have_precompute_mult() were deprecated in OpenSSL 3.0.

"},{"location":"man3/EC_POINT_add/#copyright","title":"COPYRIGHT","text":"

Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EC_POINT_new/","title":"EC_POINT_new","text":""},{"location":"man3/EC_POINT_new/#name","title":"NAME","text":"

EC_POINT_set_Jprojective_coordinates_GFp, EC_POINT_point2buf, EC_POINT_new, EC_POINT_free, EC_POINT_clear_free, EC_POINT_copy, EC_POINT_dup, EC_POINT_method_of, EC_POINT_set_to_infinity, EC_POINT_get_Jprojective_coordinates_GFp, EC_POINT_set_affine_coordinates, EC_POINT_get_affine_coordinates, EC_POINT_set_compressed_coordinates, EC_POINT_set_affine_coordinates_GFp, EC_POINT_get_affine_coordinates_GFp, EC_POINT_set_compressed_coordinates_GFp, EC_POINT_set_affine_coordinates_GF2m, EC_POINT_get_affine_coordinates_GF2m, EC_POINT_set_compressed_coordinates_GF2m, EC_POINT_point2oct, EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point, EC_POINT_point2hex, EC_POINT_hex2point - Functions for creating, destroying and manipulating EC_POINT objects

"},{"location":"man3/EC_POINT_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/ec.h>\n\nEC_POINT *EC_POINT_new(const EC_GROUP *group);\nvoid EC_POINT_free(EC_POINT *point);\nvoid EC_POINT_clear_free(EC_POINT *point);\nint EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);\nEC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);\nint EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);\nint EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,\n                                    const BIGNUM *x, const BIGNUM *y,\n                                    BN_CTX *ctx);\nint EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p,\n                                    BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\nint EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p,\n                                        const BIGNUM *x, int y_bit,\n                                        BN_CTX *ctx);\nsize_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,\n                          point_conversion_form_t form,\n                          unsigned char *buf, size_t len, BN_CTX *ctx);\nsize_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point,\n                          point_conversion_form_t form,\n                          unsigned char **pbuf, BN_CTX *ctx);\nint EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,\n                       const unsigned char *buf, size_t len, BN_CTX *ctx);\nchar *EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *p,\n                         point_conversion_form_t form, BN_CTX *ctx);\nEC_POINT *EC_POINT_hex2point(const EC_GROUP *group, const char *hex,\n                             EC_POINT *p, BN_CTX *ctx);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);\nint EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,\n                                             EC_POINT *p,\n                                             const BIGNUM *x, const BIGNUM *y,\n                                             const BIGNUM *z, BN_CTX *ctx);\nint EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,\n                                             const EC_POINT *p,\n                                             BIGNUM *x, BIGNUM *y, BIGNUM *z,\n                                             BN_CTX *ctx);\nint EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,\n                                        const BIGNUM *x, const BIGNUM *y,\n                                        BN_CTX *ctx);\nint EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,\n                                        const EC_POINT *p,\n                                        BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\nint EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,\n                                            EC_POINT *p,\n                                            const BIGNUM *x, int y_bit,\n                                            BN_CTX *ctx);\nint EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,\n                                         const BIGNUM *x, const BIGNUM *y,\n                                         BN_CTX *ctx);\nint EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,\n                                         const EC_POINT *p,\n                                         BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\nint EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,\n                                             EC_POINT *p,\n                                             const BIGNUM *x, int y_bit,\n                                             BN_CTX *ctx);\nBIGNUM *EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *p,\n                          point_conversion_form_t form, BIGNUM *bn,\n                          BN_CTX *ctx);\nEC_POINT *EC_POINT_bn2point(const EC_GROUP *group, const BIGNUM *bn,\n                            EC_POINT *p, BN_CTX *ctx);\n
"},{"location":"man3/EC_POINT_new/#description","title":"DESCRIPTION","text":"

An EC_POINT structure represents a point on a curve. A new point is constructed by calling the function EC_POINT_new() and providing the group object that the point relates to.

EC_POINT_free() frees the memory associated with the EC_POINT. if point is NULL nothing is done.

EC_POINT_clear_free() destroys any sensitive data held within the EC_POINT and then frees its memory. If point is NULL nothing is done.

EC_POINT_copy() copies the point src into dst. Both src and dst must use the same EC_METHOD.

EC_POINT_dup() creates a new EC_POINT object and copies the content from src to the newly created EC_POINT object.

EC_POINT_method_of() obtains the EC_METHOD associated with point. This function was deprecated in OpenSSL 3.0, since EC_METHOD is no longer a public concept.

A valid point on a curve is the special point at infinity. A point is set to be at infinity by calling EC_POINT_set_to_infinity().

The affine coordinates for a point describe a point in terms of its x and y position. The function EC_POINT_set_affine_coordinates() sets the x and y coordinates for the point p defined over the curve given in group. The function EC_POINT_get_affine_coordinates() sets x and y, either of which may be NULL, to the corresponding coordinates of p.

The functions EC_POINT_set_affine_coordinates_GFp() and EC_POINT_set_affine_coordinates_GF2m() are synonyms for EC_POINT_set_affine_coordinates(). They are defined for backwards compatibility only and should not be used.

The functions EC_POINT_get_affine_coordinates_GFp() and EC_POINT_get_affine_coordinates_GF2m() are synonyms for EC_POINT_get_affine_coordinates(). They are defined for backwards compatibility only and should not be used.

As well as the affine coordinates, a point can alternatively be described in terms of its Jacobian projective coordinates (for Fp curves only). Jacobian projective coordinates are expressed as three values x, y and z. Working in this coordinate system provides more efficient point multiplication operations. A mapping exists between Jacobian projective coordinates and affine coordinates. A Jacobian projective coordinate (x, y, z) can be written as an affine coordinate as (x/(z^2), y/(z^3)). Conversion to Jacobian projective from affine coordinates is simple. The coordinate (x, y) is mapped to (x, y, 1). Although deprecated in OpenSSL 3.0 and should no longer be used, to set or get the projective coordinates in older versions use EC_POINT_set_Jprojective_coordinates_GFp() and EC_POINT_get_Jprojective_coordinates_GFp() respectively. Modern versions should instead use EC_POINT_set_affine_coordinates() and EC_POINT_get_affine_coordinates(), performing the conversion manually using the above maps in such rare circumstances.

Points can also be described in terms of their compressed coordinates. For a point (x, y), for any given value for x such that the point is on the curve there will only ever be two possible values for y. Therefore, a point can be set using the EC_POINT_set_compressed_coordinates() function where x is the x coordinate and y_bit is a value 0 or 1 to identify which of the two possible values for y should be used.

The functions EC_POINT_set_compressed_coordinates_GFp() and EC_POINT_set_compressed_coordinates_GF2m() are synonyms for EC_POINT_set_compressed_coordinates(). They are defined for backwards compatibility only and should not be used.

In addition EC_POINT can be converted to and from various external representations. The octet form is the binary encoding of the ECPoint structure (as defined in RFC5480 and used in certificates and TLS records): only the content octets are present, the OCTET STRING tag and length are not included. BIGNUM form is the octet form interpreted as a big endian integer converted to a BIGNUM structure. Hexadecimal form is the octet form converted to a NULL terminated character string where each character is one of the printable values 0-9 or A-F (or a-f).

The functions EC_POINT_point2oct(), EC_POINT_oct2point(), EC_POINT_point2bn(), EC_POINT_bn2point(), EC_POINT_point2hex() and EC_POINT_hex2point() convert from and to EC_POINTs for the formats: octet, BIGNUM and hexadecimal respectively.

The function EC_POINT_point2oct() encodes the given curve point p as an octet string into the buffer buf of size len, using the specified conversion form form. The encoding conforms with Sec. 2.3.3 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. Similarly the function EC_POINT_oct2point() decodes a curve point into p from the octet string contained in the given buffer buf of size len, conforming to Sec. 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard.

The functions EC_POINT_point2hex() and EC_POINT_point2bn() convert a point p, respectively, to the hexadecimal or BIGNUM representation of the same encoding of the function EC_POINT_point2oct(). Vice versa, similarly to the function EC_POINT_oct2point(), the functions EC_POINT_hex2point() and EC_POINT_point2bn() decode the hexadecimal or BIGNUM representation into the EC_POINT p.

Notice that, according to the standard, the octet string encoding of the point at infinity for a given curve is fixed to a single octet of value zero and that, vice versa, a single octet of size zero is decoded as the point at infinity.

The function EC_POINT_point2oct() must be supplied with a buffer long enough to store the octet form. The return value provides the number of octets stored. Calling the function with a NULL buffer will not perform the conversion but will still return the required buffer length.

The function EC_POINT_point2buf() allocates a buffer of suitable length and writes an EC_POINT to it in octet format. The allocated buffer is written to *pbuf and its length is returned. The caller must free up the allocated buffer with a call to OPENSSL_free(). Since the allocated buffer value is written to *pbuf the pbuf parameter MUST NOT be NULL.

The function EC_POINT_point2hex() will allocate sufficient memory to store the hexadecimal string. It is the caller's responsibility to free this memory with a subsequent call to OPENSSL_free().

"},{"location":"man3/EC_POINT_new/#return-values","title":"RETURN VALUES","text":"

EC_POINT_new() and EC_POINT_dup() return the newly allocated EC_POINT or NULL on error.

The following functions return 1 on success or 0 on error: EC_POINT_copy(), EC_POINT_set_to_infinity(), EC_POINT_set_Jprojective_coordinates_GFp(), EC_POINT_get_Jprojective_coordinates_GFp(), EC_POINT_set_affine_coordinates_GFp(), EC_POINT_get_affine_coordinates_GFp(), EC_POINT_set_compressed_coordinates_GFp(), EC_POINT_set_affine_coordinates_GF2m(), EC_POINT_get_affine_coordinates_GF2m(), EC_POINT_set_compressed_coordinates_GF2m() and EC_POINT_oct2point().

EC_POINT_method_of returns the EC_METHOD associated with the supplied EC_POINT.

EC_POINT_point2oct() and EC_POINT_point2buf() return the length of the required buffer or 0 on error.

EC_POINT_point2bn() returns the pointer to the BIGNUM supplied, or NULL on error.

EC_POINT_bn2point() returns the pointer to the EC_POINT supplied, or NULL on error.

EC_POINT_point2hex() returns a pointer to the hex string, or NULL on error.

EC_POINT_hex2point() returns the pointer to the EC_POINT supplied, or NULL on error.

"},{"location":"man3/EC_POINT_new/#see-also","title":"SEE ALSO","text":"

crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)

"},{"location":"man3/EC_POINT_new/#history","title":"HISTORY","text":"

EC_POINT_method_of(), EC_POINT_set_Jprojective_coordinates_GFp(), EC_POINT_get_Jprojective_coordinates_GFp(), EC_POINT_set_affine_coordinates_GFp(), EC_POINT_get_affine_coordinates_GFp(), EC_POINT_set_compressed_coordinates_GFp(), EC_POINT_set_affine_coordinates_GF2m(), EC_POINT_get_affine_coordinates_GF2m(), EC_POINT_set_compressed_coordinates_GF2m(), EC_POINT_point2bn(), and EC_POINT_bn2point() were deprecated in OpenSSL 3.0.

EC_POINT_set_affine_coordinates, EC_POINT_get_affine_coordinates, and EC_POINT_set_compressed_coordinates were added in OpenSSL 1.1.1.

"},{"location":"man3/EC_POINT_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ENGINE_add/","title":"ENGINE_add","text":""},{"location":"man3/ENGINE_add/#name","title":"NAME","text":"

ENGINE_get_DH, ENGINE_get_DSA, ENGINE_by_id, ENGINE_get_cipher_engine, ENGINE_get_default_DH, ENGINE_get_default_DSA, ENGINE_get_default_RAND, ENGINE_get_default_RSA, ENGINE_get_digest_engine, ENGINE_get_first, ENGINE_get_last, ENGINE_get_next, ENGINE_get_prev, ENGINE_new, ENGINE_get_ciphers, ENGINE_get_ctrl_function, ENGINE_get_digests, ENGINE_get_destroy_function, ENGINE_get_finish_function, ENGINE_get_init_function, ENGINE_get_load_privkey_function, ENGINE_get_load_pubkey_function, ENGINE_load_private_key, ENGINE_load_public_key, ENGINE_get_RAND, ENGINE_get_RSA, ENGINE_get_id, ENGINE_get_name, ENGINE_get_cmd_defns, ENGINE_get_cipher, ENGINE_get_digest, ENGINE_add, ENGINE_cmd_is_executable, ENGINE_ctrl, ENGINE_ctrl_cmd, ENGINE_ctrl_cmd_string, ENGINE_finish, ENGINE_free, ENGINE_get_flags, ENGINE_init, ENGINE_register_DH, ENGINE_register_DSA, ENGINE_register_RAND, ENGINE_register_RSA, ENGINE_register_all_complete, ENGINE_register_ciphers, ENGINE_register_complete, ENGINE_register_digests, ENGINE_remove, ENGINE_set_DH, ENGINE_set_DSA, ENGINE_set_RAND, ENGINE_set_RSA, ENGINE_set_ciphers, ENGINE_set_cmd_defns, ENGINE_set_ctrl_function, ENGINE_set_default, ENGINE_set_default_DH, ENGINE_set_default_DSA, ENGINE_set_default_RAND, ENGINE_set_default_RSA, ENGINE_set_default_ciphers, ENGINE_set_default_digests, ENGINE_set_default_string, ENGINE_set_destroy_function, ENGINE_set_digests, ENGINE_set_finish_function, ENGINE_set_flags, ENGINE_set_id, ENGINE_set_init_function, ENGINE_set_load_privkey_function, ENGINE_set_load_pubkey_function, ENGINE_set_name, ENGINE_up_ref, ENGINE_get_table_flags, ENGINE_cleanup, ENGINE_load_builtin_engines, ENGINE_register_all_DH, ENGINE_register_all_DSA, ENGINE_register_all_RAND, ENGINE_register_all_RSA, ENGINE_register_all_ciphers, ENGINE_register_all_digests, ENGINE_set_table_flags, ENGINE_unregister_DH, ENGINE_unregister_DSA, ENGINE_unregister_RAND, ENGINE_unregister_RSA, ENGINE_unregister_ciphers, ENGINE_unregister_digests - ENGINE cryptographic module support

"},{"location":"man3/ENGINE_add/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/engine.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

ENGINE *ENGINE_get_first(void);\nENGINE *ENGINE_get_last(void);\nENGINE *ENGINE_get_next(ENGINE *e);\nENGINE *ENGINE_get_prev(ENGINE *e);\n\nint ENGINE_add(ENGINE *e);\nint ENGINE_remove(ENGINE *e);\n\nENGINE *ENGINE_by_id(const char *id);\n\nint ENGINE_init(ENGINE *e);\nint ENGINE_finish(ENGINE *e);\n\nvoid ENGINE_load_builtin_engines(void);\n\nENGINE *ENGINE_get_default_RSA(void);\nENGINE *ENGINE_get_default_DSA(void);\nENGINE *ENGINE_get_default_DH(void);\nENGINE *ENGINE_get_default_RAND(void);\nENGINE *ENGINE_get_cipher_engine(int nid);\nENGINE *ENGINE_get_digest_engine(int nid);\n\nint ENGINE_set_default_RSA(ENGINE *e);\nint ENGINE_set_default_DSA(ENGINE *e);\nint ENGINE_set_default_DH(ENGINE *e);\nint ENGINE_set_default_RAND(ENGINE *e);\nint ENGINE_set_default_ciphers(ENGINE *e);\nint ENGINE_set_default_digests(ENGINE *e);\nint ENGINE_set_default_string(ENGINE *e, const char *list);\n\nint ENGINE_set_default(ENGINE *e, unsigned int flags);\n\nunsigned int ENGINE_get_table_flags(void);\nvoid ENGINE_set_table_flags(unsigned int flags);\n\nint ENGINE_register_RSA(ENGINE *e);\nvoid ENGINE_unregister_RSA(ENGINE *e);\nvoid ENGINE_register_all_RSA(void);\nint ENGINE_register_DSA(ENGINE *e);\nvoid ENGINE_unregister_DSA(ENGINE *e);\nvoid ENGINE_register_all_DSA(void);\nint ENGINE_register_DH(ENGINE *e);\nvoid ENGINE_unregister_DH(ENGINE *e);\nvoid ENGINE_register_all_DH(void);\nint ENGINE_register_RAND(ENGINE *e);\nvoid ENGINE_unregister_RAND(ENGINE *e);\nvoid ENGINE_register_all_RAND(void);\nint ENGINE_register_ciphers(ENGINE *e);\nvoid ENGINE_unregister_ciphers(ENGINE *e);\nvoid ENGINE_register_all_ciphers(void);\nint ENGINE_register_digests(ENGINE *e);\nvoid ENGINE_unregister_digests(ENGINE *e);\nvoid ENGINE_register_all_digests(void);\nint ENGINE_register_complete(ENGINE *e);\nint ENGINE_register_all_complete(void);\n\nint ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));\nint ENGINE_cmd_is_executable(ENGINE *e, int cmd);\nint ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,\n                    long i, void *p, void (*f)(void), int cmd_optional);\nint ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,\n                           int cmd_optional);\n\nENGINE *ENGINE_new(void);\nint ENGINE_free(ENGINE *e);\nint ENGINE_up_ref(ENGINE *e);\n\nint ENGINE_set_id(ENGINE *e, const char *id);\nint ENGINE_set_name(ENGINE *e, const char *name);\nint ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);\nint ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);\nint ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);\nint ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);\nint ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);\nint ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);\nint ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);\nint ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);\nint ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);\nint ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);\nint ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);\nint ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);\nint ENGINE_set_flags(ENGINE *e, int flags);\nint ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);\n\nconst char *ENGINE_get_id(const ENGINE *e);\nconst char *ENGINE_get_name(const ENGINE *e);\nconst RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);\nconst DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);\nconst DH_METHOD *ENGINE_get_DH(const ENGINE *e);\nconst RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);\nENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);\nENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);\nENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);\nENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);\nENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);\nconst EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);\nconst EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);\nint ENGINE_get_flags(const ENGINE *e);\nconst ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);\n\nEVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,\n                                  UI_METHOD *ui_method, void *callback_data);\nEVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,\n                                 UI_METHOD *ui_method, void *callback_data);\n

The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void ENGINE_cleanup(void);\n
"},{"location":"man3/ENGINE_add/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use the provider APIs.

These functions create, manipulate, and use cryptographic modules in the form of ENGINE objects. These objects act as containers for implementations of cryptographic algorithms, and support a reference-counted mechanism to allow them to be dynamically loaded in and out of the running application.

The cryptographic functionality that can be provided by an ENGINE implementation includes the following abstractions;

RSA_METHOD - for providing alternative RSA implementations\nDSA_METHOD, DH_METHOD, RAND_METHOD, ECDH_METHOD, ECDSA_METHOD,\n      - similarly for other OpenSSL APIs\nEVP_CIPHER - potentially multiple cipher algorithms (indexed by 'nid')\nEVP_DIGEST - potentially multiple hash algorithms (indexed by 'nid')\nkey-loading - loading public and/or private EVP_PKEY keys\n
"},{"location":"man3/ENGINE_add/#reference-counting-and-handles","title":"Reference counting and handles","text":"

Due to the modular nature of the ENGINE API, pointers to ENGINEs need to be treated as handles - i.e. not only as pointers, but also as references to the underlying ENGINE object. Ie. one should obtain a new reference when making copies of an ENGINE pointer if the copies will be used (and released) independently.

ENGINE objects have two levels of reference-counting to match the way in which the objects are used. At the most basic level, each ENGINE pointer is inherently a structural reference - a structural reference is required to use the pointer value at all, as this kind of reference is a guarantee that the structure can not be deallocated until the reference is released.

However, a structural reference provides no guarantee that the ENGINE is initialised and able to use any of its cryptographic implementations. Indeed it's quite possible that most ENGINEs will not initialise at all in typical environments, as ENGINEs are typically used to support specialised hardware. To use an ENGINE's functionality, you need a functional reference. This kind of reference can be considered a specialised form of structural reference, because each functional reference implicitly contains a structural reference as well - however to avoid difficult-to-find programming bugs, it is recommended to treat the two kinds of reference independently. If you have a functional reference to an ENGINE, you have a guarantee that the ENGINE has been initialised and is ready to perform cryptographic operations, and will remain initialised until after you have released your reference.

Structural references

This basic type of reference is used for instantiating new ENGINEs, iterating across OpenSSL's internal linked-list of loaded ENGINEs, reading information about an ENGINE, etc. Essentially a structural reference is sufficient if you only need to query or manipulate the data of an ENGINE implementation rather than use its functionality.

The ENGINE_new() function returns a structural reference to a new (empty) ENGINE object. There are other ENGINE API functions that return structural references such as; ENGINE_by_id(), ENGINE_get_first(), ENGINE_get_last(), ENGINE_get_next(), ENGINE_get_prev(). All structural references should be released by a corresponding to call to the ENGINE_free() function - the ENGINE object itself will only actually be cleaned up and deallocated when the last structural reference is released. If the argument to ENGINE_free() is NULL, nothing is done.

It should also be noted that many ENGINE API function calls that accept a structural reference will internally obtain another reference - typically this happens whenever the supplied ENGINE will be needed by OpenSSL after the function has returned. Eg. the function to add a new ENGINE to OpenSSL's internal list is ENGINE_add() - if this function returns success, then OpenSSL will have stored a new structural reference internally so the caller is still responsible for freeing their own reference with ENGINE_free() when they are finished with it. In a similar way, some functions will automatically release the structural reference passed to it if part of the function's job is to do so. Eg. the ENGINE_get_next() and ENGINE_get_prev() functions are used for iterating across the internal ENGINE list - they will return a new structural reference to the next (or previous) ENGINE in the list or NULL if at the end (or beginning) of the list, but in either case the structural reference passed to the function is released on behalf of the caller.

To clarify a particular function's handling of references, one should always consult that function's documentation \"man\" page, or failing that the <openssl/engine.h> header file includes some hints.

Functional references

As mentioned, functional references exist when the cryptographic functionality of an ENGINE is required to be available. A functional reference can be obtained in one of two ways; from an existing structural reference to the required ENGINE, or by asking OpenSSL for the default operational ENGINE for a given cryptographic purpose.

To obtain a functional reference from an existing structural reference, call the ENGINE_init() function. This returns zero if the ENGINE was not already operational and couldn't be successfully initialised (e.g. lack of system drivers, no special hardware attached, etc), otherwise it will return nonzero to indicate that the ENGINE is now operational and will have allocated a new functional reference to the ENGINE. All functional references are released by calling ENGINE_finish() (which removes the implicit structural reference as well).

The second way to get a functional reference is by asking OpenSSL for a default implementation for a given task, e.g. by ENGINE_get_default_RSA(), ENGINE_get_default_cipher_engine(), etc. These are discussed in the next section, though they are not usually required by application programmers as they are used automatically when creating and using the relevant algorithm-specific types in OpenSSL, such as RSA, DSA, EVP_CIPHER_CTX, etc.

"},{"location":"man3/ENGINE_add/#default-implementations","title":"Default implementations","text":"

For each supported abstraction, the ENGINE code maintains an internal table of state to control which implementations are available for a given abstraction and which should be used by default. These implementations are registered in the tables and indexed by an 'nid' value, because abstractions like EVP_CIPHER and EVP_DIGEST support many distinct algorithms and modes, and ENGINEs can support arbitrarily many of them. In the case of other abstractions like RSA, DSA, etc, there is only one \"algorithm\" so all implementations implicitly register using the same 'nid' index.

When a default ENGINE is requested for a given abstraction/algorithm/mode, (e.g. when calling RSA_new_method(NULL)), a \"get_default\" call will be made to the ENGINE subsystem to process the corresponding state table and return a functional reference to an initialised ENGINE whose implementation should be used. If no ENGINE should (or can) be used, it will return NULL and the caller will operate with a NULL ENGINE handle - this usually equates to using the conventional software implementation. In the latter case, OpenSSL will from then on behave the way it used to before the ENGINE API existed.

Each state table has a flag to note whether it has processed this \"get_default\" query since the table was last modified, because to process this question it must iterate across all the registered ENGINEs in the table trying to initialise each of them in turn, in case one of them is operational. If it returns a functional reference to an ENGINE, it will also cache another reference to speed up processing future queries (without needing to iterate across the table). Likewise, it will cache a NULL response if no ENGINE was available so that future queries won't repeat the same iteration unless the state table changes. This behaviour can also be changed; if the ENGINE_TABLE_FLAG_NOINIT flag is set (using ENGINE_set_table_flags()), no attempted initialisations will take place, instead the only way for the state table to return a non-NULL ENGINE to the \"get_default\" query will be if one is expressly set in the table. Eg. ENGINE_set_default_RSA() does the same job as ENGINE_register_RSA() except that it also sets the state table's cached response for the \"get_default\" query. In the case of abstractions like EVP_CIPHER, where implementations are indexed by 'nid', these flags and cached-responses are distinct for each 'nid' value.

"},{"location":"man3/ENGINE_add/#application-requirements","title":"Application requirements","text":"

This section will explain the basic things an application programmer should support to make the most useful elements of the ENGINE functionality available to the user. The first thing to consider is whether the programmer wishes to make alternative ENGINE modules available to the application and user. OpenSSL maintains an internal linked list of \"visible\" ENGINEs from which it has to operate - at start-up, this list is empty and in fact if an application does not call any ENGINE API calls and it uses static linking against openssl, then the resulting application binary will not contain any alternative ENGINE code at all. So the first consideration is whether any/all available ENGINE implementations should be made visible to OpenSSL - this is controlled by calling the various \"load\" functions.

The fact that ENGINEs are made visible to OpenSSL (and thus are linked into the program and loaded into memory at run-time) does not mean they are \"registered\" or called into use by OpenSSL automatically - that behaviour is something for the application to control. Some applications will want to allow the user to specify exactly which ENGINE they want used if any is to be used at all. Others may prefer to load all support and have OpenSSL automatically use at run-time any ENGINE that is able to successfully initialise - i.e. to assume that this corresponds to acceleration hardware attached to the machine or some such thing. There are probably numerous other ways in which applications may prefer to handle things, so we will simply illustrate the consequences as they apply to a couple of simple cases and leave developers to consider these and the source code to openssl's built-in utilities as guides.

If no ENGINE API functions are called within an application, then OpenSSL will not allocate any internal resources. Prior to OpenSSL 1.1.0, however, if any ENGINEs are loaded, even if not registered or used, it was necessary to call ENGINE_cleanup() before the program exits.

Using a specific ENGINE implementation

Here we'll assume an application has been configured by its user or admin to want to use the \"ACME\" ENGINE if it is available in the version of OpenSSL the application was compiled with. If it is available, it should be used by default for all RSA, DSA, and symmetric cipher operations, otherwise OpenSSL should use its built-in software as per usual. The following code illustrates how to approach this;

ENGINE *e;\nconst char *engine_id = \"ACME\";\nENGINE_load_builtin_engines();\ne = ENGINE_by_id(engine_id);\nif (!e)\n    /* the engine isn't available */\n    return;\nif (!ENGINE_init(e)) {\n    /* the engine couldn't initialise, release 'e' */\n    ENGINE_free(e);\n    return;\n}\nif (!ENGINE_set_default_RSA(e))\n    /*\n     * This should only happen when 'e' can't initialise, but the previous\n     * statement suggests it did.\n     */\n    abort();\nENGINE_set_default_DSA(e);\nENGINE_set_default_ciphers(e);\n/* Release the functional reference from ENGINE_init() */\nENGINE_finish(e);\n/* Release the structural reference from ENGINE_by_id() */\nENGINE_free(e);\n

Automatically using built-in ENGINE implementations

Here we'll assume we want to load and register all ENGINE implementations bundled with OpenSSL, such that for any cryptographic algorithm required by OpenSSL - if there is an ENGINE that implements it and can be initialised, it should be used. The following code illustrates how this can work;

/* Load all bundled ENGINEs into memory and make them visible */\nENGINE_load_builtin_engines();\n/* Register all of them for every algorithm they collectively implement */\nENGINE_register_all_complete();\n

That's all that's required. Eg. the next time OpenSSL tries to set up an RSA key, any bundled ENGINEs that implement RSA_METHOD will be passed to ENGINE_init() and if any of those succeed, that ENGINE will be set as the default for RSA use from then on.

"},{"location":"man3/ENGINE_add/#advanced-configuration-support","title":"Advanced configuration support","text":"

There is a mechanism supported by the ENGINE framework that allows each ENGINE implementation to define an arbitrary set of configuration \"commands\" and expose them to OpenSSL and any applications based on OpenSSL. This mechanism is entirely based on the use of name-value pairs and assumes ASCII input (no unicode or UTF for now!), so it is ideal if applications want to provide a transparent way for users to provide arbitrary configuration \"directives\" directly to such ENGINEs. It is also possible for the application to dynamically interrogate the loaded ENGINE implementations for the names, descriptions, and input flags of their available \"control commands\", providing a more flexible configuration scheme. However, if the user is expected to know which ENGINE device he/she is using (in the case of specialised hardware, this goes without saying) then applications may not need to concern themselves with discovering the supported control commands and simply prefer to pass settings into ENGINEs exactly as they are provided by the user.

Before illustrating how control commands work, it is worth mentioning what they are typically used for. Broadly speaking there are two uses for control commands; the first is to provide the necessary details to the implementation (which may know nothing at all specific to the host system) so that it can be initialised for use. This could include the path to any driver or config files it needs to load, required network addresses, smart-card identifiers, passwords to initialise protected devices, logging information, etc etc. This class of commands typically needs to be passed to an ENGINE before attempting to initialise it, i.e. before calling ENGINE_init(). The other class of commands consist of settings or operations that tweak certain behaviour or cause certain operations to take place, and these commands may work either before or after ENGINE_init(), or in some cases both. ENGINE implementations should provide indications of this in the descriptions attached to built-in control commands and/or in external product documentation.

Issuing control commands to an ENGINE

Let's illustrate by example; a function for which the caller supplies the name of the ENGINE it wishes to use, a table of string-pairs for use before initialisation, and another table for use after initialisation. Note that the string-pairs used for control commands consist of a command \"name\" followed by the command \"parameter\" - the parameter could be NULL in some cases but the name can not. This function should initialise the ENGINE (issuing the \"pre\" commands beforehand and the \"post\" commands afterwards) and set it as the default for everything except RAND and then return a boolean success or failure.

int generic_load_engine_fn(const char *engine_id,\n                           const char **pre_cmds, int pre_num,\n                           const char **post_cmds, int post_num)\n{\n    ENGINE *e = ENGINE_by_id(engine_id);\n    if (!e) return 0;\n    while (pre_num--) {\n        if (!ENGINE_ctrl_cmd_string(e, pre_cmds[0], pre_cmds[1], 0)) {\n            fprintf(stderr, \"Failed command (%s - %s:%s)\\n\", engine_id,\n                    pre_cmds[0], pre_cmds[1] ? pre_cmds[1] : \"(NULL)\");\n            ENGINE_free(e);\n            return 0;\n        }\n        pre_cmds += 2;\n    }\n    if (!ENGINE_init(e)) {\n        fprintf(stderr, \"Failed initialisation\\n\");\n        ENGINE_free(e);\n        return 0;\n    }\n    /*\n     * ENGINE_init() returned a functional reference, so free the structural\n     * reference from ENGINE_by_id().\n     */\n    ENGINE_free(e);\n    while (post_num--) {\n        if (!ENGINE_ctrl_cmd_string(e, post_cmds[0], post_cmds[1], 0)) {\n            fprintf(stderr, \"Failed command (%s - %s:%s)\\n\", engine_id,\n                    post_cmds[0], post_cmds[1] ? post_cmds[1] : \"(NULL)\");\n            ENGINE_finish(e);\n            return 0;\n        }\n        post_cmds += 2;\n    }\n    ENGINE_set_default(e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND);\n    /* Success */\n    return 1;\n}\n

Note that ENGINE_ctrl_cmd_string() accepts a boolean argument that can relax the semantics of the function - if set nonzero it will only return failure if the ENGINE supported the given command name but failed while executing it, if the ENGINE doesn't support the command name it will simply return success without doing anything. In this case we assume the user is only supplying commands specific to the given ENGINE so we set this to FALSE.

Discovering supported control commands

It is possible to discover at run-time the names, numerical-ids, descriptions and input parameters of the control commands supported by an ENGINE using a structural reference. Note that some control commands are defined by OpenSSL itself and it will intercept and handle these control commands on behalf of the ENGINE, i.e. the ENGINE's ctrl() handler is not used for the control command. <openssl/engine.h> defines an index, ENGINE_CMD_BASE, that all control commands implemented by ENGINEs should be numbered from. Any command value lower than this symbol is considered a \"generic\" command is handled directly by the OpenSSL core routines.

It is using these \"core\" control commands that one can discover the control commands implemented by a given ENGINE, specifically the commands:

ENGINE_HAS_CTRL_FUNCTION\nENGINE_CTRL_GET_FIRST_CMD_TYPE\nENGINE_CTRL_GET_NEXT_CMD_TYPE\nENGINE_CTRL_GET_CMD_FROM_NAME\nENGINE_CTRL_GET_NAME_LEN_FROM_CMD\nENGINE_CTRL_GET_NAME_FROM_CMD\nENGINE_CTRL_GET_DESC_LEN_FROM_CMD\nENGINE_CTRL_GET_DESC_FROM_CMD\nENGINE_CTRL_GET_CMD_FLAGS\n

Whilst these commands are automatically processed by the OpenSSL framework code, they use various properties exposed by each ENGINE to process these queries. An ENGINE has 3 properties it exposes that can affect how this behaves; it can supply a ctrl() handler, it can specify ENGINE_FLAGS_MANUAL_CMD_CTRL in the ENGINE's flags, and it can expose an array of control command descriptions. If an ENGINE specifies the ENGINE_FLAGS_MANUAL_CMD_CTRL flag, then it will simply pass all these \"core\" control commands directly to the ENGINE's ctrl() handler (and thus, it must have supplied one), so it is up to the ENGINE to reply to these \"discovery\" commands itself. If that flag is not set, then the OpenSSL framework code will work with the following rules:

if no ctrl() handler supplied;\n    ENGINE_HAS_CTRL_FUNCTION returns FALSE (zero),\n    all other commands fail.\nif a ctrl() handler was supplied but no array of control commands;\n    ENGINE_HAS_CTRL_FUNCTION returns TRUE,\n    all other commands fail.\nif a ctrl() handler and array of control commands was supplied;\n    ENGINE_HAS_CTRL_FUNCTION returns TRUE,\n    all other commands proceed processing ...\n

If the ENGINE's array of control commands is empty then all other commands will fail, otherwise; ENGINE_CTRL_GET_FIRST_CMD_TYPE returns the identifier of the first command supported by the ENGINE, ENGINE_GET_NEXT_CMD_TYPE takes the identifier of a command supported by the ENGINE and returns the next command identifier or fails if there are no more, ENGINE_CMD_FROM_NAME takes a string name for a command and returns the corresponding identifier or fails if no such command name exists, and the remaining commands take a command identifier and return properties of the corresponding commands. All except ENGINE_CTRL_GET_FLAGS return the string length of a command name or description, or populate a supplied character buffer with a copy of the command name or description. ENGINE_CTRL_GET_FLAGS returns a bitwise-OR'd mask of the following possible values:

ENGINE_CMD_FLAG_NUMERIC\nENGINE_CMD_FLAG_STRING\nENGINE_CMD_FLAG_NO_INPUT\nENGINE_CMD_FLAG_INTERNAL\n

If the ENGINE_CMD_FLAG_INTERNAL flag is set, then any other flags are purely informational to the caller - this flag will prevent the command being usable for any higher-level ENGINE functions such as ENGINE_ctrl_cmd_string(). \"INTERNAL\" commands are not intended to be exposed to text-based configuration by applications, administrations, users, etc. These can support arbitrary operations via ENGINE_ctrl(), including passing to and/or from the control commands data of any arbitrary type. These commands are supported in the discovery mechanisms simply to allow applications to determine if an ENGINE supports certain specific commands it might want to use (e.g. application \"foo\" might query various ENGINEs to see if they implement \"FOO_GET_VENDOR_LOGO_GIF\" - and ENGINE could therefore decide whether or not to support this \"foo\"-specific extension).

"},{"location":"man3/ENGINE_add/#environment","title":"ENVIRONMENT","text":"
  • OPENSSL_ENGINES

    The path to the engines directory. Ignored in set-user-ID and set-group-ID programs.

"},{"location":"man3/ENGINE_add/#return-values","title":"RETURN VALUES","text":"

ENGINE_get_first(), ENGINE_get_last(), ENGINE_get_next() and ENGINE_get_prev() return a valid ENGINE structure or NULL if an error occurred.

ENGINE_add() and ENGINE_remove() return 1 on success or 0 on error.

ENGINE_by_id() returns a valid ENGINE structure or NULL if an error occurred.

ENGINE_init() and ENGINE_finish() return 1 on success or 0 on error.

All ENGINE_get_default_TYPE() functions, ENGINE_get_cipher_engine() and ENGINE_get_digest_engine() return a valid ENGINE structure on success or NULL if an error occurred.

All ENGINE_set_default_TYPE() functions return 1 on success or 0 on error.

ENGINE_set_default() returns 1 on success or 0 on error.

ENGINE_get_table_flags() returns an unsigned integer value representing the global table flags which are used to control the registration behaviour of ENGINE implementations.

All ENGINE_register_TYPE() functions return 1 on success or 0 on error.

ENGINE_register_complete() and ENGINE_register_all_complete() always return 1.

ENGINE_ctrl() returns a positive value on success or others on error.

ENGINE_cmd_is_executable() returns 1 if cmd is executable or 0 otherwise.

ENGINE_ctrl_cmd() and ENGINE_ctrl_cmd_string() return 1 on success or 0 on error.

ENGINE_new() returns a valid ENGINE structure on success or NULL if an error occurred.

ENGINE_free() always returns 1.

ENGINE_up_ref() returns 1 on success or 0 on error.

ENGINE_set_id() and ENGINE_set_name() return 1 on success or 0 on error.

All other ENGINE_set_* functions return 1 on success or 0 on error.

ENGINE_get_id() and ENGINE_get_name() return a string representing the identifier and the name of the ENGINE e respectively.

ENGINE_get_RSA(), ENGINE_get_DSA(), ENGINE_get_DH() and ENGINE_get_RAND() return corresponding method structures for each algorithms.

ENGINE_get_destroy_function(), ENGINE_get_init_function(), ENGINE_get_finish_function(), ENGINE_get_ctrl_function(), ENGINE_get_load_privkey_function(), ENGINE_get_load_pubkey_function(), ENGINE_get_ciphers() and ENGINE_get_digests() return corresponding function pointers of the callbacks.

ENGINE_get_cipher() returns a valid EVP_CIPHER structure on success or NULL if an error occurred.

ENGINE_get_digest() returns a valid EVP_MD structure on success or NULL if an error occurred.

ENGINE_get_flags() returns an integer representing the ENGINE flags which are used to control various behaviours of an ENGINE.

ENGINE_get_cmd_defns() returns an ENGINE_CMD_DEFN structure or NULL if it's not set.

ENGINE_load_private_key() and ENGINE_load_public_key() return a valid EVP_PKEY structure on success or NULL if an error occurred.

"},{"location":"man3/ENGINE_add/#see-also","title":"SEE ALSO","text":"

OPENSSL_init_crypto(3), RSA_new_method(3), DSA_new(3), DH_new(3), RAND_bytes(3), config(5)

"},{"location":"man3/ENGINE_add/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

ENGINE_cleanup() was deprecated in OpenSSL 1.1.0 by the automatic cleanup done by OPENSSL_cleanup() and should not be used.

"},{"location":"man3/ENGINE_add/#copyright","title":"COPYRIGHT","text":"

Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_GET_LIB/","title":"ERR_GET_LIB","text":""},{"location":"man3/ERR_GET_LIB/#name","title":"NAME","text":"

ERR_GET_LIB, ERR_GET_REASON, ERR_FATAL_ERROR - get information from error codes

"},{"location":"man3/ERR_GET_LIB/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nint ERR_GET_LIB(unsigned long e);\n\nint ERR_GET_REASON(unsigned long e);\n\nint ERR_FATAL_ERROR(unsigned long e);\n
"},{"location":"man3/ERR_GET_LIB/#description","title":"DESCRIPTION","text":"

The error code returned by ERR_get_error() consists of a library number and reason code. ERR_GET_LIB() and ERR_GET_REASON() can be used to extract these.

ERR_FATAL_ERROR() indicates whether a given error code is a fatal error.

The library number describes where the error occurred, the reason code is the information about what went wrong.

Each sub-library of OpenSSL has a unique library number; the reason code is unique within each sub-library. Note that different libraries may use the same value to signal different reasons.

ERR_R_... reason codes such as ERR_R_MALLOC_FAILURE are globally unique. However, when checking for sub-library specific reason codes, be sure to also compare the library number.

ERR_GET_LIB(), ERR_GET_REASON(), and ERR_FATAL_ERROR() are macros.

"},{"location":"man3/ERR_GET_LIB/#return-values","title":"RETURN VALUES","text":"

The library number, reason code, and whether the error is fatal, respectively. Starting with OpenSSL 3.0.0, the function code is always set to zero.

"},{"location":"man3/ERR_GET_LIB/#notes","title":"NOTES","text":"

Applications should not make control flow decisions based on specific error codes. Error codes are subject to change at any time (even in patch releases of OpenSSL). A particular error code can only be considered meaningful for control flow decisions if it is explicitly documented as such. New failure codes may still appear at any time.

"},{"location":"man3/ERR_GET_LIB/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ERR_GET_LIB/#history","title":"HISTORY","text":"

ERR_GET_LIB() and ERR_GET_REASON() are available in all versions of OpenSSL.

ERR_GET_FUNC() was removed in OpenSSL 3.0.

"},{"location":"man3/ERR_GET_LIB/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_clear_error/","title":"ERR_clear_error","text":""},{"location":"man3/ERR_clear_error/#name","title":"NAME","text":"

ERR_clear_error - clear the error queue

"},{"location":"man3/ERR_clear_error/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nvoid ERR_clear_error(void);\n
"},{"location":"man3/ERR_clear_error/#description","title":"DESCRIPTION","text":"

ERR_clear_error() empties the current thread's error queue.

"},{"location":"man3/ERR_clear_error/#return-values","title":"RETURN VALUES","text":"

ERR_clear_error() has no return value.

"},{"location":"man3/ERR_clear_error/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3)

"},{"location":"man3/ERR_clear_error/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_error_string/","title":"ERR_error_string","text":""},{"location":"man3/ERR_error_string/#name","title":"NAME","text":"

ERR_error_string, ERR_error_string_n, ERR_lib_error_string, ERR_func_error_string, ERR_reason_error_string - obtain human-readable error message

"},{"location":"man3/ERR_error_string/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nchar *ERR_error_string(unsigned long e, char *buf);\nvoid ERR_error_string_n(unsigned long e, char *buf, size_t len);\n\nconst char *ERR_lib_error_string(unsigned long e);\nconst char *ERR_reason_error_string(unsigned long e);\n

Deprecated in OpenSSL 3.0:

const char *ERR_func_error_string(unsigned long e);\n
"},{"location":"man3/ERR_error_string/#description","title":"DESCRIPTION","text":"

ERR_error_string() generates a human-readable string representing the error code e, and places it at buf. buf must be at least 256 bytes long. If buf is NULL, the error string is placed in a static buffer. Note that this function is not thread-safe and does no checks on the size of the buffer; use ERR_error_string_n() instead.

ERR_error_string_n() is a variant of ERR_error_string() that writes at most len characters (including the terminating 0) and truncates the string if necessary. For ERR_error_string_n(), buf may not be NULL.

The string will have the following format:

error:[error code]:[library name]::[reason string]\n

error code is an 8 digit hexadecimal number, library name and reason string are ASCII text.

ERR_lib_error_string() and ERR_reason_error_string() return the library name and reason string respectively.

If there is no text string registered for the given error code, the error string will contain the numeric code.

ERR_print_errors(3) can be used to print all error codes currently in the queue.

"},{"location":"man3/ERR_error_string/#return-values","title":"RETURN VALUES","text":"

ERR_error_string() returns a pointer to a static buffer containing the string if buf == NULL, buf otherwise.

ERR_lib_error_string() and ERR_reason_error_string() return the strings, and NULL if none is registered for the error code.

ERR_func_error_string() returns NULL.

"},{"location":"man3/ERR_error_string/#see-also","title":"SEE ALSO","text":"

ERR_get_error(3), ERR_print_errors(3)

"},{"location":"man3/ERR_error_string/#history","title":"HISTORY","text":"

ERR_func_error_string() became deprecated in OpenSSL 3.0.

"},{"location":"man3/ERR_error_string/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_get_error/","title":"ERR_get_error","text":""},{"location":"man3/ERR_get_error/#name","title":"NAME","text":"

ERR_get_error, ERR_peek_error, ERR_peek_last_error, ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, ERR_peek_error_func, ERR_peek_last_error_func, ERR_peek_error_data, ERR_peek_last_error_data, ERR_get_error_all, ERR_peek_error_all, ERR_peek_last_error_all, ERR_get_error_line_data, ERR_peek_error_line_data, ERR_peek_last_error_line_data - obtain error code and data

"},{"location":"man3/ERR_get_error/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nunsigned long ERR_get_error(void);\nunsigned long ERR_peek_error(void);\nunsigned long ERR_peek_last_error(void);\n\nunsigned long ERR_peek_error_line(const char **file, int *line);\nunsigned long ERR_peek_last_error_line(const char **file, int *line);\n\nunsigned long ERR_peek_error_func(const char **func);\nunsigned long ERR_peek_last_error_func(const char **func);\n\nunsigned long ERR_peek_error_data(const char **data, int *flags);\nunsigned long ERR_peek_last_error_data(const char **data, int *flags);\n\nunsigned long ERR_get_error_all(const char **file, int *line,\n                                const char **func,\n                                const char **data, int *flags);\nunsigned long ERR_peek_error_all(const char **file, int *line,\n                                 const char **func,\n                                 const char **data, int *flags);\nunsigned long ERR_peek_last_error_all(const char **file, int *line,\n                                      const char *func,\n                                      const char **data, int *flags);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

unsigned long ERR_get_error_line(const char **file, int *line);\nunsigned long ERR_get_error_line_data(const char **file, int *line,\n                                      const char **data, int *flags);\nunsigned long ERR_peek_error_line_data(const char **file, int *line,\n                                       const char **data, int *flags);\nunsigned long ERR_peek_last_error_line_data(const char **file, int *line,\n                                            const char **data, int *flags);\n
"},{"location":"man3/ERR_get_error/#description","title":"DESCRIPTION","text":"

ERR_get_error() returns the earliest error code from the thread's error queue and removes the entry. This function can be called repeatedly until there are no more error codes to return.

ERR_peek_error() returns the earliest error code from the thread's error queue without modifying it.

ERR_peek_last_error() returns the latest error code from the thread's error queue without modifying it.

See ERR_GET_LIB(3) for obtaining further specific information such as the reason of the error, and ERR_error_string(3) for human-readable error messages.

ERR_get_error_all() is the same as ERR_get_error(), but on success it additionally stores the filename, line number and function where the error occurred in *file, *line and *func, and also extra text and flags in *data, *flags. If any of those parameters are NULL, it will not be changed. An unset filename is indicated as \"\", i.e. an empty string. An unset line number is indicated as 0. An unset function name is indicated as \"\", i.e. an empty string.

A pointer returned this way by these functions and the ones below is valid until the respective entry is overwritten in the error queue.

ERR_peek_error_line() and ERR_peek_last_error_line() are the same as ERR_peek_error() and ERR_peek_last_error(), but on success they additionally store the filename and line number where the error occurred in *file and *line, as far as they are not NULL. An unset filename is indicated as \"\", i.e., an empty string. An unset line number is indicated as 0.

ERR_peek_error_func() and ERR_peek_last_error_func() are the same as ERR_peek_error() and ERR_peek_last_error(), but on success they additionally store the name of the function where the error occurred in *func, unless it is NULL. An unset function name is indicated as \"\".

ERR_peek_error_data() and ERR_peek_last_error_data() are the same as ERR_peek_error() and ERR_peek_last_error(), but on success they additionally store additional data and flags associated with the error code in *data and *flags, as far as they are not NULL. Unset data is indicated as \"\". In this case the value given for the flag is irrelevant (and equals 0). *data contains a string if *flags&ERR_TXT_STRING is true.

ERR_peek_error_all() and ERR_peek_last_error_all() are combinations of all of the above.

ERR_get_error_line(), ERR_get_error_line_data(), ERR_peek_error_line_data() and ERR_peek_last_error_line_data() are older variants of ERR_get_error_all(), ERR_peek_error_all() and ERR_peek_last_error_all(), and may give confusing results. They should no longer be used and are therefore deprecated.

An application MUST NOT free the *data pointer (or any other pointers returned by these functions) with OPENSSL_free() as freeing is handled automatically by the error library.

"},{"location":"man3/ERR_get_error/#return-values","title":"RETURN VALUES","text":"

The error code, or 0 if there is no error in the queue.

"},{"location":"man3/ERR_get_error/#see-also","title":"SEE ALSO","text":"

ERR_error_string(3), ERR_GET_LIB(3)

"},{"location":"man3/ERR_get_error/#history","title":"HISTORY","text":"

ERR_peek_error_func(), ERR_peek_last_error_func(), ERR_peek_error_data(), ERR_peek_last_error_data(), ERR_peek_error_all() and ERR_peek_last_error_all() were added in OpenSSL 3.0.

ERR_get_error_line(), ERR_get_error_line_data(), ERR_peek_error_line_data() and ERR_peek_last_error_line_data() became deprecated in OpenSSL 3.0.

"},{"location":"man3/ERR_get_error/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_load_crypto_strings/","title":"ERR_load_crypto_strings","text":""},{"location":"man3/ERR_load_crypto_strings/#name","title":"NAME","text":"

ERR_load_crypto_strings, SSL_load_error_strings, ERR_free_strings - load and free error strings

"},{"location":"man3/ERR_load_crypto_strings/#synopsis","title":"SYNOPSIS","text":"

The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

#include <openssl/err.h>\n\nvoid ERR_load_crypto_strings(void);\nvoid ERR_free_strings(void);\n\n#include <openssl/ssl.h>\n\nvoid SSL_load_error_strings(void);\n
"},{"location":"man3/ERR_load_crypto_strings/#description","title":"DESCRIPTION","text":"

ERR_load_crypto_strings() registers the error strings for all libcrypto functions. SSL_load_error_strings() does the same, but also registers the libssl error strings.

In versions prior to OpenSSL 1.1.0, ERR_free_strings() releases any resources created by the above functions.

"},{"location":"man3/ERR_load_crypto_strings/#return-values","title":"RETURN VALUES","text":"

ERR_load_crypto_strings(), SSL_load_error_strings() and ERR_free_strings() return no values.

"},{"location":"man3/ERR_load_crypto_strings/#see-also","title":"SEE ALSO","text":"

ERR_error_string(3)

"},{"location":"man3/ERR_load_crypto_strings/#history","title":"HISTORY","text":"

The ERR_load_crypto_strings(), SSL_load_error_strings(), and ERR_free_strings() functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto() and OPENSSL_init_ssl() and should not be used.

"},{"location":"man3/ERR_load_crypto_strings/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_load_strings/","title":"ERR_load_strings","text":""},{"location":"man3/ERR_load_strings/#name","title":"NAME","text":"

ERR_load_strings, ERR_PACK, ERR_get_next_error_library - load arbitrary error strings

"},{"location":"man3/ERR_load_strings/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nint ERR_load_strings(int lib, ERR_STRING_DATA *str);\n\nint ERR_get_next_error_library(void);\n\nunsigned long ERR_PACK(int lib, int func, int reason);\n
"},{"location":"man3/ERR_load_strings/#description","title":"DESCRIPTION","text":"

ERR_load_strings() registers error strings for library number lib.

str is an array of error string data:

typedef struct ERR_string_data_st\n{\n    unsigned long error;\n    char *string;\n} ERR_STRING_DATA;\n

The error code is generated from the library number and a function and reason code: error = ERR_PACK(lib, func, reason). ERR_PACK() is a macro.

The last entry in the array is {0,0}.

ERR_get_next_error_library() can be used to assign library numbers to user libraries at run time.

"},{"location":"man3/ERR_load_strings/#return-values","title":"RETURN VALUES","text":"

ERR_load_strings() returns 1 for success and 0 for failure. ERR_PACK() returns the error code. ERR_get_next_error_library() returns zero on failure, otherwise a new library number.

"},{"location":"man3/ERR_load_strings/#see-also","title":"SEE ALSO","text":"

ERR_load_strings(3)

"},{"location":"man3/ERR_load_strings/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_new/","title":"ERR_new","text":""},{"location":"man3/ERR_new/#name","title":"NAME","text":"

ERR_new, ERR_set_debug, ERR_set_error, ERR_vset_error - Error recording building blocks

"},{"location":"man3/ERR_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nvoid ERR_new(void);\nvoid ERR_set_debug(const char *file, int line, const char *func);\nvoid ERR_set_error(int lib, int reason, const char *fmt, ...);\nvoid ERR_vset_error(int lib, int reason, const char *fmt, va_list args);\n
"},{"location":"man3/ERR_new/#description","title":"DESCRIPTION","text":"

The functions described here are generally not used directly, but rather through macros such as ERR_raise(3). They can still be useful for anyone that wants to make their own macros.

ERR_new() allocates a new slot in the thread's error queue.

ERR_set_debug() sets the debug information related to the current error in the thread's error queue. The values that can be given are the filename file, line in the file line and the name of the function func where the error occurred. The names must be constant, this function will only save away the pointers, not copy the strings.

ERR_set_error() sets the error information, which are the library number lib and the reason code reason, and additional data as a format string fmt and an arbitrary number of arguments. The additional data is processed with BIO_snprintf(3) to form the additional data string, which is allocated and store in the error record.

ERR_vset_error() works like ERR_set_error(), but takes a va_list argument instead of a variable number of arguments.

"},{"location":"man3/ERR_new/#return-values","title":"RETURN VALUES","text":"

ERR_new, ERR_set_debug, ERR_set_error and ERR_vset_error do not return any values.

"},{"location":"man3/ERR_new/#notes","title":"NOTES","text":"

The library number is unique to each unit that records errors. OpenSSL has a number of preallocated ones for its own uses, but others may allocate their own library number dynamically with ERR_get_next_error_library(3).

Reason codes are unique within each library, and may have an associated set of strings as a short description of the reason. For dynamically allocated library numbers, reason strings are recorded with ERR_load_strings(3).

Provider authors are supplied with core versions of these functions, see provider-base(7).

"},{"location":"man3/ERR_new/#see-also","title":"SEE ALSO","text":"

ERR_raise(3), ERR_get_next_error_library(3), ERR_load_strings(3), BIO_snprintf(3), provider-base(7)

"},{"location":"man3/ERR_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_print_errors/","title":"ERR_print_errors","text":""},{"location":"man3/ERR_print_errors/#name","title":"NAME","text":"

ERR_print_errors, ERR_print_errors_fp, ERR_print_errors_cb - print error messages

"},{"location":"man3/ERR_print_errors/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nvoid ERR_print_errors(BIO *bp);\nvoid ERR_print_errors_fp(FILE *fp);\nvoid ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),\n                         void *u);\n
"},{"location":"man3/ERR_print_errors/#description","title":"DESCRIPTION","text":"

ERR_print_errors() is a convenience function that prints the error strings for all errors that OpenSSL has recorded to bp, thus emptying the error queue.

ERR_print_errors_fp() is the same, except that the output goes to a FILE.

ERR_print_errors_cb() is the same, except that the callback function, cb, is called for each error line with the string, length, and userdata u as the callback parameters.

The error strings will have the following format:

[pid]:error:[error code]:[library name]:[function name]:[reason string]:[filename]:[line]:[optional text message]\n

error code is an 8 digit hexadecimal number. library name, function name and reason string are ASCII text, as is optional text message if one was set for the respective error code.

If there is no text string registered for the given error code, the error string will contain the numeric code.

"},{"location":"man3/ERR_print_errors/#return-values","title":"RETURN VALUES","text":"

ERR_print_errors() and ERR_print_errors_fp() return no values.

"},{"location":"man3/ERR_print_errors/#see-also","title":"SEE ALSO","text":"

ERR_error_string(3), ERR_get_error(3)

"},{"location":"man3/ERR_print_errors/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_put_error/","title":"ERR_put_error","text":""},{"location":"man3/ERR_put_error/#name","title":"NAME","text":"

ERR_raise, ERR_raise_data, ERR_put_error, ERR_add_error_data, ERR_add_error_vdata, ERR_add_error_txt, ERR_add_error_mem_bio - record an error

"},{"location":"man3/ERR_put_error/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nvoid ERR_raise(int lib, int reason);\nvoid ERR_raise_data(int lib, int reason, const char *fmt, ...);\n\nvoid ERR_add_error_data(int num, ...);\nvoid ERR_add_error_vdata(int num, va_list arg);\nvoid ERR_add_error_txt(const char *sep, const char *txt);\nvoid ERR_add_error_mem_bio(const char *sep, BIO *bio);\n

The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void ERR_put_error(int lib, int func, int reason, const char *file, int line);\n
"},{"location":"man3/ERR_put_error/#description","title":"DESCRIPTION","text":"

ERR_raise() adds a new error to the thread's error queue. The error occurred in the library lib for the reason given by the reason code. Furthermore, the name of the file, the line, and name of the function where the error occurred is saved with the error record.

ERR_raise_data() does the same thing as ERR_raise(), but also lets the caller specify additional information as a format string fmt and an arbitrary number of values, which are processed with BIO_snprintf(3).

ERR_put_error() adds an error code to the thread's error queue. It signals that the error of reason code reason occurred in function func of library lib, in line number line of file. This function is usually called by a macro.

ERR_add_error_data() associates the concatenation of its num string arguments as additional data with the error code added last. ERR_add_error_vdata() is similar except the argument is a va_list. Multiple calls to these functions append to the current top of the error queue. The total length of the string data per error is limited to 4096 characters.

ERR_add_error_txt() appends the given text string as additional data to the last error queue entry, after inserting the optional separator string if it is not NULL and the top error entry does not yet have additional data. In case the separator is at the end of the text it is not appended to the data. The sep argument may be for instance \"\\n\" to insert a line break when needed. If the associated data would become more than 4096 characters long (which is the limit given above) it is split over sufficiently many new copies of the last error queue entry.

ERR_add_error_mem_bio() is the same as ERR_add_error_txt() except that the text string is taken from the given memory BIO. It appends '\\0' to the BIO contents if not already NUL-terminated.

ERR_load_strings(3) can be used to register error strings so that the application can a generate human-readable error messages for the error code.

"},{"location":"man3/ERR_put_error/#reporting-errors","title":"Reporting errors","text":""},{"location":"man3/ERR_put_error/#openssl-library-reports","title":"OpenSSL library reports","text":"

Each OpenSSL sub-library has library code ERR_LIB_XXX and has its own set of reason codes XXX_R_.... These are both passed in combination to ERR_raise() and ERR_raise_data(), and the combination ultimately produces the correct error text for the reported error.

All these macros and the numbers they have as values are specific to OpenSSL's libraries. OpenSSL reason codes normally consist of textual error descriptions. For example, the function ssl3_read_bytes() reports a \"handshake failure\" as follows:

ERR_raise(ERR_LIB_SSL, SSL_R_SSL_HANDSHAKE_FAILURE);\n

There are two exceptions:

  • ERR_LIB_SYS

    This \"library code\" indicates that a system error is being reported. In this case, the reason code given to ERR_raise() and ERR_raise_data() must be errno(3).

    ERR_raise(ERR_LIB_SYS, errno);\n
  • ERR_R_XXX

    This set of error codes is considered global, and may be used in combination with any sub-library code.

    ERR_raise(ERR_LIB_RSA, ERR_R_PASSED_INVALID_ARGUMENT);\n
"},{"location":"man3/ERR_put_error/#other-pieces-of-software","title":"Other pieces of software","text":"

Other pieces of software that may want to use OpenSSL's error reporting system, such as engines or applications, must normally get their own numbers.

  • To get a \"library\" code, call ERR_get_next_error_library(3); this gives the calling code a dynamic number, usable for the duration of the process.
  • Reason codes for each such \"library\" are determined or generated by the authors of that code. They must be numbers in the range 1 to 524287 (in other words, they must be nonzero unsigned 18 bit integers).

The exceptions mentioned in \"OpenSSL library reports\" above are valid for other pieces of software, i.e. they may use ERR_LIB_SYS to report system errors:

ERR_raise(ERR_LIB_SYS, errno);\n

... and they may use ERR_R_XXX macros together with their own \"library\" code.

int app_lib_code = ERR_get_next_error_library();\n\n/* ... */\n\nERR_raise(app_lib_code, ERR_R_PASSED_INVALID_ARGUMENT);\n
"},{"location":"man3/ERR_put_error/#return-values","title":"RETURN VALUES","text":"

ERR_raise(), ERR_raise_data(), ERR_put_error(), ERR_add_error_data(), ERR_add_error_vdata() ERR_add_error_txt(), and ERR_add_error_mem_bio() return no values.

"},{"location":"man3/ERR_put_error/#notes","title":"NOTES","text":"

ERR_raise(), ERR_raise() and ERR_put_error() are implemented as macros.

"},{"location":"man3/ERR_put_error/#see-also","title":"SEE ALSO","text":"

ERR_load_strings(3), ERR_get_next_error_library(3)

"},{"location":"man3/ERR_put_error/#history","title":"HISTORY","text":"

ERR_raise, ERR_raise_data, ERR_add_error_txt() and ERR_add_error_mem_bio() were added in OpenSSL 3.0.

"},{"location":"man3/ERR_put_error/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_remove_state/","title":"ERR_remove_state","text":""},{"location":"man3/ERR_remove_state/#name","title":"NAME","text":"

ERR_remove_thread_state, ERR_remove_state - DEPRECATED

"},{"location":"man3/ERR_remove_state/#synopsis","title":"SYNOPSIS","text":"

The following function has been deprecated since OpenSSL 1.0.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void ERR_remove_state(unsigned long tid);\n

The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

void ERR_remove_thread_state(void *tid);\n
"},{"location":"man3/ERR_remove_state/#description","title":"DESCRIPTION","text":"

ERR_remove_state() frees the error queue associated with the specified thread, identified by tid. ERR_remove_thread_state() does the same thing, except the identifier is an opaque pointer.

"},{"location":"man3/ERR_remove_state/#return-values","title":"RETURN VALUES","text":"

ERR_remove_state() and ERR_remove_thread_state() return no value.

"},{"location":"man3/ERR_remove_state/#see-also","title":"SEE ALSO","text":"

LOPENSSL_init_crypto(3)

"},{"location":"man3/ERR_remove_state/#history","title":"HISTORY","text":"

ERR_remove_state() was deprecated in OpenSSL 1.0.0 and ERR_remove_thread_state() was deprecated in OpenSSL 1.1.0; these functions and should not be used.

"},{"location":"man3/ERR_remove_state/#copyright","title":"COPYRIGHT","text":"

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/ERR_set_mark/","title":"ERR_set_mark","text":""},{"location":"man3/ERR_set_mark/#name","title":"NAME","text":"

ERR_set_mark, ERR_clear_last_mark, ERR_pop_to_mark - set mark, clear mark and pop errors until mark

"},{"location":"man3/ERR_set_mark/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/err.h>\n\nint ERR_set_mark(void);\nint ERR_pop_to_mark(void);\nint ERR_clear_last_mark(void);\n
"},{"location":"man3/ERR_set_mark/#description","title":"DESCRIPTION","text":"

ERR_set_mark() sets a mark on the current topmost error record if there is one.

ERR_pop_to_mark() will pop the top of the error stack until a mark is found. The mark is then removed. If there is no mark, the whole stack is removed.

ERR_clear_last_mark() removes the last mark added if there is one.

"},{"location":"man3/ERR_set_mark/#return-values","title":"RETURN VALUES","text":"

ERR_set_mark() returns 0 if the error stack is empty, otherwise 1.

ERR_clear_last_mark() and ERR_pop_to_mark() return 0 if there was no mark in the error stack, which implies that the stack became empty, otherwise 1.

"},{"location":"man3/ERR_set_mark/#copyright","title":"COPYRIGHT","text":"

Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EVP_ASYM_CIPHER_free/","title":"EVP_ASYM_CIPHER_free","text":""},{"location":"man3/EVP_ASYM_CIPHER_free/#name","title":"NAME","text":"

EVP_ASYM_CIPHER_fetch, EVP_ASYM_CIPHER_free, EVP_ASYM_CIPHER_up_ref, EVP_ASYM_CIPHER_is_a, EVP_ASYM_CIPHER_get0_provider, EVP_ASYM_CIPHER_do_all_provided, EVP_ASYM_CIPHER_names_do_all, EVP_ASYM_CIPHER_get0_name, EVP_ASYM_CIPHER_get0_description, EVP_ASYM_CIPHER_gettable_ctx_params, EVP_ASYM_CIPHER_settable_ctx_params - Functions to manage EVP_ASYM_CIPHER algorithm objects

"},{"location":"man3/EVP_ASYM_CIPHER_free/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/evp.h>\n\nEVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                                       const char *properties);\nvoid EVP_ASYM_CIPHER_free(EVP_ASYM_CIPHER *cipher);\nint EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher);\nconst char *EVP_ASYM_CIPHER_get0_name(const EVP_ASYM_CIPHER *cipher);\nint EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name);\nOSSL_PROVIDER *EVP_ASYM_CIPHER_get0_provider(const EVP_ASYM_CIPHER *cipher);\nvoid EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                     void (*fn)(EVP_ASYM_CIPHER *cipher,\n                                                void *arg),\n                                     void *arg);\nint EVP_ASYM_CIPHER_names_do_all(const EVP_ASYM_CIPHER *cipher,\n                                 void (*fn)(const char *name, void *data),\n                                 void *data);\nconst char *EVP_ASYM_CIPHER_get0_description(const EVP_ASYM_CIPHER *cipher);\nconst OSSL_PARAM *EVP_ASYM_CIPHER_gettable_ctx_params(const EVP_ASYM_CIPHER *cip);\nconst OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *cip);\n
"},{"location":"man3/EVP_ASYM_CIPHER_free/#description","title":"DESCRIPTION","text":"

EVP_ASYM_CIPHER_fetch() fetches the implementation for the given algorithm from any provider offering it, within the criteria given by the properties and in the scope of the given library context ctx (see OSSL_LIB_CTX(3)). The algorithm will be one offering functions for performing asymmetric cipher related tasks such as asymmetric encryption and decryption. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

The returned value must eventually be freed with EVP_ASYM_CIPHER_free().

EVP_ASYM_CIPHER_free() decrements the reference count for the EVP_ASYM_CIPHER structure. Typically this structure will have been obtained from an earlier call to EVP_ASYM_CIPHER_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

EVP_ASYM_CIPHER_up_ref() increments the reference count for an EVP_ASYM_CIPHER structure.

EVP_ASYM_CIPHER_is_a() returns 1 if cipher is an implementation of an algorithm that's identifiable with name, otherwise 0.

EVP_ASYM_CIPHER_get0_provider() returns the provider that cipher was fetched from.

EVP_ASYM_CIPHER_do_all_provided() traverses all EVP_ASYM_CIPHERs implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

EVP_ASYM_CIPHER_get0_name() returns the algorithm name from the provided implementation for the given cipher. Note that the cipher may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the cipher object and should not be freed by the caller.

EVP_ASYM_CIPHER_names_do_all() traverses all names for cipher, and calls fn with each name and data.

EVP_ASYM_CIPHER_get0_description() returns a description of the cipher, meant for display and human consumption. The description is at the discretion of the cipher implementation.

EVP_ASYM_CIPHER_gettable_ctx_params() and EVP_ASYM_CIPHER_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a key encryption algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

"},{"location":"man3/EVP_ASYM_CIPHER_free/#return-values","title":"RETURN VALUES","text":"

EVP_ASYM_CIPHER_fetch() returns a pointer to an EVP_ASYM_CIPHER for success or NULL for failure.

EVP_ASYM_CIPHER_up_ref() returns 1 for success or 0 otherwise.

EVP_ASYM_CIPHER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

EVP_ASYM_CIPHER_gettable_ctx_params() and EVP_ASYM_CIPHER_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

"},{"location":"man3/EVP_ASYM_CIPHER_free/#see-also","title":"SEE ALSO","text":"

\"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

"},{"location":"man3/EVP_ASYM_CIPHER_free/#history","title":"HISTORY","text":"

The functions described here were added in OpenSSL 3.0.

"},{"location":"man3/EVP_ASYM_CIPHER_free/#copyright","title":"COPYRIGHT","text":"

Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EVP_BytesToKey/","title":"EVP_BytesToKey","text":""},{"location":"man3/EVP_BytesToKey/#name","title":"NAME","text":"

EVP_BytesToKey - password based encryption routine

"},{"location":"man3/EVP_BytesToKey/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/evp.h>\n\nint EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,\n                   const unsigned char *salt,\n                   const unsigned char *data, int datal, int count,\n                   unsigned char *key, unsigned char *iv);\n
"},{"location":"man3/EVP_BytesToKey/#description","title":"DESCRIPTION","text":"

EVP_BytesToKey() derives a key and IV from various parameters. type is the cipher to derive the key and IV for. md is the message digest to use. The salt parameter is used as a salt in the derivation: it should point to an 8 byte buffer or NULL if no salt is used. data is a buffer containing datal bytes which is used to derive the keying data. count is the iteration count to use. The derived key and IV will be written to key and iv respectively.

"},{"location":"man3/EVP_BytesToKey/#notes","title":"NOTES","text":"

A typical application of this function is to derive keying material for an encryption algorithm from a password in the data parameter.

Increasing the count parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

If the total key and IV length is less than the digest length and MD5 is used then the derivation algorithm is compatible with PKCS#5 v1.5 otherwise a non standard extension is used to derive the extra data.

Newer applications should use a more modern algorithm such as PBKDF2 as defined in PKCS#5v2.1 and provided by PKCS5_PBKDF2_HMAC.

"},{"location":"man3/EVP_BytesToKey/#key-derivation-algorithm","title":"KEY DERIVATION ALGORITHM","text":"

The key and IV is derived by concatenating D_1, D_2, etc until enough data is available for the key and IV. D_i is defined as:

    D_i = HASH^count(D_(i-1) || data || salt)\n

where || denotes concatenation, D_0 is empty, HASH is the digest algorithm in use, HASH^1(data) is simply HASH(data), HASH^2(data) is HASH(HASH(data)) and so on.

The initial bytes are used for the key and the subsequent bytes for the IV.

"},{"location":"man3/EVP_BytesToKey/#return-values","title":"RETURN VALUES","text":"

If data is NULL, then EVP_BytesToKey() returns the number of bytes needed to store the derived key. Otherwise, EVP_BytesToKey() returns the size of the derived key in bytes, or 0 on error.

"},{"location":"man3/EVP_BytesToKey/#see-also","title":"SEE ALSO","text":"

evp(7), RAND_bytes(3), PKCS5_PBKDF2_HMAC(3), EVP_EncryptInit(3)

"},{"location":"man3/EVP_BytesToKey/#copyright","title":"COPYRIGHT","text":"

Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/","title":"EVP_CIPHER_CTX_get_cipher_data","text":""},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#name","title":"NAME","text":"

EVP_CIPHER_CTX_get_cipher_data, EVP_CIPHER_CTX_set_cipher_data - Routines to inspect and modify EVP_CIPHER_CTX objects

"},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/evp.h>\n\nvoid *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);\nvoid *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);\n
"},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#description","title":"DESCRIPTION","text":"

The EVP_CIPHER_CTX_get_cipher_data() function returns a pointer to the cipher data relevant to EVP_CIPHER_CTX. The contents of this data is specific to the particular implementation of the cipher. For example this data can be used by engines to store engine specific information. The data is automatically allocated and freed by OpenSSL, so applications and engines should not normally free this directly (but see below).

The EVP_CIPHER_CTX_set_cipher_data() function allows an application or engine to replace the cipher data with new data. A pointer to any existing cipher data is returned from this function. If the old data is no longer required then it should be freed through a call to OPENSSL_free().

"},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#return-values","title":"RETURN VALUES","text":"

The EVP_CIPHER_CTX_get_cipher_data() function returns a pointer to the current cipher data for the EVP_CIPHER_CTX.

The EVP_CIPHER_CTX_set_cipher_data() function returns a pointer to the old cipher data for the EVP_CIPHER_CTX.

"},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#history","title":"HISTORY","text":"

The EVP_CIPHER_CTX_get_cipher_data() and EVP_CIPHER_CTX_set_cipher_data() functions were added in OpenSSL 1.1.0.

"},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#copyright","title":"COPYRIGHT","text":"

Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/","title":"EVP_CIPHER_CTX_get_original_iv","text":""},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#name","title":"NAME","text":"

EVP_CIPHER_CTX_get_original_iv, EVP_CIPHER_CTX_get_updated_iv, EVP_CIPHER_CTX_iv, EVP_CIPHER_CTX_original_iv, EVP_CIPHER_CTX_iv_noconst - Routines to inspect EVP_CIPHER_CTX IV data

"},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/evp.h>\n\nint EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);\nint EVP_CIPHER_CTX_get_updated_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx);\nconst unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);\nunsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);\n
"},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#description","title":"DESCRIPTION","text":"

EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() copy initialization vector (IV) information from the EVP_CIPHER_CTX into the caller-supplied buffer. EVP_CIPHER_CTX_get_iv_length(3) can be used to determine an appropriate buffer size, and if the supplied buffer is too small, an error will be returned (and no data copied). EVP_CIPHER_CTX_get_original_iv() accesses the (\"original\") IV that was supplied when the EVP_CIPHER_CTX was initialized, and EVP_CIPHER_CTX_get_updated_iv() accesses the current \"IV state\" of the cipher, which is updated during cipher operation for certain cipher modes (e.g., CBC and OFB).

The functions EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst() are deprecated functions that provide similar (at a conceptual level) functionality. EVP_CIPHER_CTX_iv() returns a pointer to the beginning of the \"IV state\" as maintained internally in the EVP_CIPHER_CTX; EVP_CIPHER_CTX_original_iv() returns a pointer to the beginning of the (\"original\") IV, as maintained by the EVP_CIPHER_CTX, that was provided when the EVP_CIPHER_CTX was initialized; and EVP_CIPHER_CTX_get_iv_noconst() is the same as EVP_CIPHER_CTX_iv() but has a different return type for the pointer.

"},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#return-values","title":"RETURN VALUES","text":"

EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() return 1 on success and 0 on failure.

The functions EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst() return a pointer to an IV as an array of bytes on success, and NULL on failure.

"},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#history","title":"HISTORY","text":"

EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() were added in OpenSSL 3.0.0.

EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst() were added in OpenSSL 1.1.0, and were deprecated in OpenSSL 3.0.0.

"},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#copyright","title":"COPYRIGHT","text":"

Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EVP_CIPHER_meth_new/","title":"EVP_CIPHER_meth_new","text":""},{"location":"man3/EVP_CIPHER_meth_new/#name","title":"NAME","text":"

EVP_CIPHER_meth_new, EVP_CIPHER_meth_dup, EVP_CIPHER_meth_free, EVP_CIPHER_meth_set_iv_length, EVP_CIPHER_meth_set_flags, EVP_CIPHER_meth_set_impl_ctx_size, EVP_CIPHER_meth_set_init, EVP_CIPHER_meth_set_do_cipher, EVP_CIPHER_meth_set_cleanup, EVP_CIPHER_meth_set_set_asn1_params, EVP_CIPHER_meth_set_get_asn1_params, EVP_CIPHER_meth_set_ctrl, EVP_CIPHER_meth_get_init, EVP_CIPHER_meth_get_do_cipher, EVP_CIPHER_meth_get_cleanup, EVP_CIPHER_meth_get_set_asn1_params, EVP_CIPHER_meth_get_get_asn1_params, EVP_CIPHER_meth_get_ctrl - Routines to build up EVP_CIPHER methods

"},{"location":"man3/EVP_CIPHER_meth_new/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/evp.h>\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len);\nEVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher);\nvoid EVP_CIPHER_meth_free(EVP_CIPHER *cipher);\n\nint EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len);\nint EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags);\nint EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size);\nint EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,\n                             int (*init)(EVP_CIPHER_CTX *ctx,\n                                         const unsigned char *key,\n                                         const unsigned char *iv,\n                                         int enc));\nint EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,\n                                  int (*do_cipher)(EVP_CIPHER_CTX *ctx,\n                                                   unsigned char *out,\n                                                   const unsigned char *in,\n                                                   size_t inl));\nint EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,\n                                int (*cleanup)(EVP_CIPHER_CTX *));\nint EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher,\n                                        int (*set_asn1_parameters)(EVP_CIPHER_CTX *,\n                                                                   ASN1_TYPE *));\nint EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher,\n                                        int (*get_asn1_parameters)(EVP_CIPHER_CTX *,\n                                                                   ASN1_TYPE *));\nint EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher,\n                             int (*ctrl)(EVP_CIPHER_CTX *, int type,\n                                         int arg, void *ptr));\n\nint (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,\n                                                          const unsigned char *key,\n                                                          const unsigned char *iv,\n                                                          int enc);\nint (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,\n                                                               unsigned char *out,\n                                                               const unsigned char *in,\n                                                               size_t inl);\nint (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *);\nint (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,\n                                                                     ASN1_TYPE *);\nint (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,\n                                                                     ASN1_TYPE *);\nint (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,\n                                                          int type, int arg,\n                                                          void *ptr);\n
"},{"location":"man3/EVP_CIPHER_meth_new/#description","title":"DESCRIPTION","text":"

All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

The EVP_CIPHER type is a structure for symmetric cipher method implementation.

EVP_CIPHER_meth_new() creates a new EVP_CIPHER structure.

EVP_CIPHER_meth_dup() creates a copy of cipher.

EVP_CIPHER_meth_free() destroys a EVP_CIPHER structure. If the argument is NULL, nothing is done.

EVP_CIPHER_meth_set_iv_length() sets the length of the IV. This is only needed when the implemented cipher mode requires it.

EVP_CIPHER_meth_set_flags() sets the flags to describe optional behaviours in the particular cipher. With the exception of cipher modes, of which only one may be present, several flags can be or'd together. The available flags are:

  • EVP_CIPH_STREAM_CIPHER, EVP_CIPH_ECB_MODE EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE, EVP_CIPH_OFB_MODE, EVP_CIPH_CTR_MODE, EVP_CIPH_GCM_MODE, EVP_CIPH_CCM_MODE, EVP_CIPH_XTS_MODE, EVP_CIPH_WRAP_MODE, EVP_CIPH_OCB_MODE, EVP_CIPH_SIV_MODE

    The cipher mode.

  • EVP_CIPH_VARIABLE_LENGTH

    This cipher is of variable length.

  • EVP_CIPH_CUSTOM_IV

    Storing and initialising the IV is left entirely to the implementation.

  • EVP_CIPH_ALWAYS_CALL_INIT

    Set this if the implementation's init() function should be called even if key is NULL.

  • EVP_CIPH_CTRL_INIT

    Set this to have the implementation's ctrl() function called with command code EVP_CTRL_INIT early in its setup.

  • EVP_CIPH_CUSTOM_KEY_LENGTH

    Checking and setting the key length after creating the EVP_CIPHER is left to the implementation. Whenever someone uses EVP_CIPHER_CTX_set_key_length() on a EVP_CIPHER with this flag set, the implementation's ctrl() function will be called with the control code EVP_CTRL_SET_KEY_LENGTH and the key length in arg.

  • EVP_CIPH_NO_PADDING

    Don't use standard block padding.

  • EVP_CIPH_RAND_KEY

    Making a key with random content is left to the implementation. This is done by calling the implementation's ctrl() function with the control code EVP_CTRL_RAND_KEY and the pointer to the key memory storage in ptr.

  • EVP_CIPH_CUSTOM_COPY

    Set this to have the implementation's ctrl() function called with command code EVP_CTRL_COPY at the end of EVP_CIPHER_CTX_copy(). The intended use is for further things to deal with after the implementation specific data block has been copied. The destination EVP_CIPHER_CTX is passed to the control with the ptr parameter. The implementation specific data block is reached with EVP_CIPHER_CTX_get_cipher_data().

  • EVP_CIPH_FLAG_DEFAULT_ASN1

    Use the default EVP routines to pass IV to and from ASN.1.

  • EVP_CIPH_FLAG_LENGTH_BITS

    Signals that the length of the input buffer for encryption / decryption is to be understood as the number of bits instead of bytes for this implementation. This is only useful for CFB1 ciphers.

  • EVP_CIPH_FLAG_CTS

    Indicates that the cipher uses ciphertext stealing. This is currently used to indicate that the cipher is a one shot that only allows a single call to EVP_CipherUpdate().

  • EVP_CIPH_FLAG_CUSTOM_CIPHER

    This indicates that the implementation takes care of everything, including padding, buffering and finalization. The EVP routines will simply give them control and do nothing more.

  • EVP_CIPH_FLAG_AEAD_CIPHER

    This indicates that this is an AEAD cipher implementation.

  • EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK

    Allow interleaving of crypto blocks, a particular optimization only applicable to certain TLS ciphers.

EVP_CIPHER_meth_set_impl_ctx_size() sets the size of the EVP_CIPHER's implementation context so that it can be automatically allocated.

EVP_CIPHER_meth_set_init() sets the cipher init function for cipher. The cipher init function is called by EVP_CipherInit(), EVP_CipherInit_ex(), EVP_EncryptInit(), EVP_EncryptInit_ex(), EVP_DecryptInit(), EVP_DecryptInit_ex().

EVP_CIPHER_meth_set_do_cipher() sets the cipher function for cipher. The cipher function is called by EVP_CipherUpdate(), EVP_EncryptUpdate(), EVP_DecryptUpdate(), EVP_CipherFinal(), EVP_EncryptFinal(), EVP_EncryptFinal_ex(), EVP_DecryptFinal() and EVP_DecryptFinal_ex().

EVP_CIPHER_meth_set_cleanup() sets the function for cipher to do extra cleanup before the method's private data structure is cleaned out and freed. Note that the cleanup function is passed a EVP_CIPHER_CTX *, the private data structure is then available with EVP_CIPHER_CTX_get_cipher_data(). This cleanup function is called by EVP_CIPHER_CTX_reset() and EVP_CIPHER_CTX_free().

EVP_CIPHER_meth_set_set_asn1_params() sets the function for cipher to set the AlgorithmIdentifier \"parameter\" based on the passed cipher. This function is called by EVP_CIPHER_param_to_asn1(). EVP_CIPHER_meth_set_get_asn1_params() sets the function for cipher that sets the cipher parameters based on an ASN.1 AlgorithmIdentifier \"parameter\". Both these functions are needed when there is a need for custom data (more or other than the cipher IV). They are called by EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() respectively if defined.

EVP_CIPHER_meth_set_ctrl() sets the control function for cipher.

EVP_CIPHER_meth_get_init(), EVP_CIPHER_meth_get_do_cipher(), EVP_CIPHER_meth_get_cleanup(), EVP_CIPHER_meth_get_set_asn1_params(), EVP_CIPHER_meth_get_get_asn1_params() and EVP_CIPHER_meth_get_ctrl() are all used to retrieve the method data given with the EVP_CIPHER_meth_set_*() functions above.

"},{"location":"man3/EVP_CIPHER_meth_new/#return-values","title":"RETURN VALUES","text":"

EVP_CIPHER_meth_new() and EVP_CIPHER_meth_dup() return a pointer to a newly created EVP_CIPHER, or NULL on failure. All EVP_CIPHER_meth_set_*() functions return 1. All EVP_CIPHER_meth_get_*() functions return pointers to their respective cipher function.

"},{"location":"man3/EVP_CIPHER_meth_new/#see-also","title":"SEE ALSO","text":"

EVP_EncryptInit(3)

"},{"location":"man3/EVP_CIPHER_meth_new/#history","title":"HISTORY","text":"

All of these functions were deprecated in OpenSSL 3.0.

The functions described here were added in OpenSSL 1.1.0. The EVP_CIPHER structure created with these functions became reference counted in OpenSSL 3.0.

"},{"location":"man3/EVP_CIPHER_meth_new/#copyright","title":"COPYRIGHT","text":"

Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

"},{"location":"man3/EVP_DigestInit/","title":"EVP_DigestInit","text":""},{"location":"man3/EVP_DigestInit/#name","title":"NAME","text":"

EVP_MD_fetch, EVP_MD_up_ref, EVP_MD_free, EVP_MD_get_params, EVP_MD_gettable_params, EVP_MD_CTX_new, EVP_MD_CTX_reset, EVP_MD_CTX_free, EVP_MD_CTX_dup, EVP_MD_CTX_copy, EVP_MD_CTX_copy_ex, EVP_MD_CTX_ctrl, EVP_MD_CTX_set_params, EVP_MD_CTX_get_params, EVP_MD_settable_ctx_params, EVP_MD_gettable_ctx_params, EVP_MD_CTX_settable_params, EVP_MD_CTX_gettable_params, EVP_MD_CTX_set_flags, EVP_MD_CTX_clear_flags, EVP_MD_CTX_test_flags, EVP_Q_digest, EVP_Digest, EVP_DigestInit_ex2, EVP_DigestInit_ex, EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal_ex, EVP_DigestFinalXOF, EVP_DigestFinal, EVP_MD_is_a, EVP_MD_get0_name, EVP_MD_get0_description, EVP_MD_names_do_all, EVP_MD_get0_provider, EVP_MD_get_type, EVP_MD_get_pkey_type, EVP_MD_get_size, EVP_MD_get_block_size, EVP_MD_get_flags, EVP_MD_CTX_get0_name, EVP_MD_CTX_md, EVP_MD_CTX_get0_md, EVP_MD_CTX_get1_md, EVP_MD_CTX_get_type, EVP_MD_CTX_get_size, EVP_MD_CTX_get_block_size, EVP_MD_CTX_get0_md_data, EVP_MD_CTX_update_fn, EVP_MD_CTX_set_update_fn, EVP_md_null, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj, EVP_MD_CTX_get_pkey_ctx, EVP_MD_CTX_set_pkey_ctx, EVP_MD_do_all_provided, EVP_MD_type, EVP_MD_nid, EVP_MD_name, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, EVP_MD_flags, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_MD_CTX_pkey_ctx, EVP_MD_CTX_md_data - EVP digest routines

"},{"location":"man3/EVP_DigestInit/#synopsis","title":"SYNOPSIS","text":"
#include <openssl/evp.h>\n\nEVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                     const char *properties);\nint EVP_MD_up_ref(EVP_MD *md);\nvoid EVP_MD_free(EVP_MD *md);\nint EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest);\nEVP_MD_CTX *EVP_MD_CTX_new(void);\nint EVP_MD_CTX_reset(EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_free(EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void* p2);\nint EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]);\nint EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md);\nconst OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md);\nconst OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx);\nconst OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);\nvoid EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);\nint EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);\n\nint EVP_Q_digest(OSSL_LIB_CTX *libctx, const char *name, const char *propq,\n                 const void *data, size_t datalen,\n                 unsigned char *md, size_t *mdlen);\nint EVP_Digest(const void *data, size_t count, unsigned char *md,\n               unsigned int *size, const EVP_MD *type, ENGINE *impl);\nint EVP_DigestInit_ex2(EVP_MD_CTX *ctx, const EVP_MD *type,\n                       const OSSL_PARAM params[]);\nint EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\nint EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);\nint EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);\nint EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, size_t len);\n\nEVP_MD_CTX *EVP_MD_CTX_dup(const EVP_MD_CTX *in);\nint EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);\n\nint EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);\nint EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);\n\nint EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in);\n\nconst char *EVP_MD_get0_name(const EVP_MD *md);\nconst char *EVP_MD_get0_description(const EVP_MD *md);\nint EVP_MD_is_a(const EVP_MD *md, const char *name);\nint EVP_MD_names_do_all(const EVP_MD *md,\n                        void (*fn)(const char *name, void *data),\n                        void *data);\nconst OSSL_PROVIDER *EVP_MD_get0_provider(const EVP_MD *md);\nint EVP_MD_get_type(const EVP_MD *md);\nint EVP_MD_get_pkey_type(const EVP_MD *md);\nint EVP_MD_get_size(const EVP_MD *md);\nint EVP_MD_get_block_size(const EVP_MD *md);\nunsigned long EVP_MD_get_flags(const EVP_MD *md);\n\nconst EVP_MD *EVP_MD_CTX_get0_md(const EVP_MD_CTX *ctx);\nEVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx);\nconst char *EVP_MD_CTX_get0_name(const EVP_MD_CTX *ctx);\nint EVP_MD_CTX_get_size(const EVP_MD_CTX *ctx);\nint EVP_MD_CTX_get_block_size(const EVP_MD_CTX *ctx);\nint EVP_MD_CTX_get_type(const EVP_MD_CTX *ctx);\nvoid *EVP_MD_CTX_get0_md_data(const EVP_MD_CTX *ctx);\n\nconst EVP_MD *EVP_md_null(void);\n\nconst EVP_MD *EVP_get_digestbyname(const char *name);\nconst EVP_MD *EVP_get_digestbynid(int type);\nconst EVP_MD *EVP_get_digestbyobj(const ASN1_OBJECT *o);\n\nEVP_PKEY_CTX *EVP_MD_CTX_get_pkey_ctx(const EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx);\n\nvoid EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,\n                            void (*fn)(EVP_MD *mac, void *arg),\n                            void *arg);\n\n#define EVP_MD_type EVP_MD_get_type\n#define EVP_MD_nid EVP_MD_get_type\n#define EVP_MD_name EVP_MD_get0_name\n#define EVP_MD_pkey_type EVP_MD_get_pkey_type\n#define EVP_MD_size EVP_MD_get_size\n#define EVP_MD_block_size EVP_MD_get_block_size\n#define EVP_MD_flags EVP_MD_get_flags\n#define EVP_MD_CTX_size EVP_MD_CTX_get_size\n#define EVP_MD_CTX_block_size EVP_MD_CTX_get_block_size\n#define EVP_MD_CTX_type EVP_MD_CTX_get_type\n#define EVP_MD_CTX_pkey_ctx EVP_MD_CTX_get_pkey_ctx\n#define EVP_MD_CTX_md_data EVP_MD_CTX_get0_md_data\n

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);\n\nint (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,\n                                             const void *data, size_t count);\n\nvoid EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,\n                              int (*update)(EVP_MD_CTX *ctx,\n                                            const void *data, size_t count));\n
"},{"location":"man3/EVP_DigestInit/#description","title":"DESCRIPTION","text":"

The EVP digest routines are a high-level interface to message digests, and should be used instead of the digest-specific functions.

The EVP_MD type is a structure for digest method implementation.

  • EVP_MD_fetch()

    Fetches the digest implementation for the given algorithm from any provider offering it, within the criteria given by the properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

    The returned value must eventually be freed with EVP_MD_free().

    Fetched EVP_MD structures are reference counted.

  • EVP_MD_up_ref()

    Increments the reference count for an EVP_MD structure.

  • EVP_MD_free()

    Decrements the reference count for the fetched EVP_MD structure. If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

  • EVP_MD_CTX_new()

    Allocates and returns a digest context.

  • EVP_MD_CTX_reset()

    Resets the digest context ctx. This can be used to reuse an already existing context.

  • EVP_MD_CTX_free()

    Cleans up digest context ctx and frees up the space allocated to it. If the argument is NULL, nothing is done.

  • EVP_MD_CTX_ctrl()

    This is a legacy method. EVP_MD_CTX_set_params() and EVP_MD_CTX_get_params() is the mechanism that should be used to set and get parameters that are used by providers.

    Performs digest-specific control actions on context ctx. The control command is indicated in cmd and any additional arguments in p1 and p2. EVP_MD_CTX_ctrl() must be called after EVP_DigestInit_ex2(). Other restrictions may apply depending on the control type and digest implementation.

    If this function happens to be used with a fetched EVP_MD, it will translate the controls that are known to OpenSSL into OSSL_PARAM(3) parameters with keys defined by OpenSSL and call EVP_MD_CTX_get_params() or EVP_MD_CTX_set_params() as is appropriate for each control command.

    See \"CONTROLS\" below for more information, including what translations are being done.

  • EVP_MD_get_params()

    Retrieves the requested list of params from a MD md. See \"PARAMETERS\" below for more information.

  • EVP_MD_CTX_get_params()

    Retrieves the requested list of params from a MD context ctx. See \"PARAMETERS\" below for more information.

  • EVP_MD_CTX_set_params()

    Sets the list of params into a MD context ctx. See \"PARAMETERS\" below for more information.

  • EVP_MD_gettable_params()

    Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_MD_get_params().

  • EVP_MD_gettable_ctx_params(), EVP_MD_CTX_gettable_params()

    Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_MD_CTX_get_params(). EVP_MD_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_MD_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

  • EVP_MD_settable_ctx_params(), EVP_MD_CTX_settable_params()

    Get a constant OSSL_PARAM(3) array that describes the settable parameters that can be used with EVP_MD_CTX_set_params(). EVP_MD_settable_ctx_params() returns the parameters that can be set from the algorithm, whereas EVP_MD_CTX_settable_params() returns the parameters that can be set in the context's current state.

  • EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags(), EVP_MD_CTX_test_flags()

    Sets, clears and tests ctx flags. See \"FLAGS\" below for more information.

  • EVP_Q_digest() is a quick one-shot digest function.

    It hashes datalen bytes of data at data using the digest algorithm name, which is fetched using the optional libctx and propq parameters. The digest value is placed in md and its length is written at mdlen if the pointer is not NULL. At most EVP_MAX_MD_SIZE bytes will be written.

  • EVP_Digest()

    A wrapper around the Digest Init_ex, Update and Final_ex functions. Hashes count bytes of data at data using a digest type from ENGINE impl. The digest value is placed in md and its length is written at size if the pointer is not NULL. At most EVP_MAX_MD_SIZE bytes will be written. If impl is NULL the default implementation of digest type is used.

  • EVP_DigestInit_ex2()

    Sets up digest context ctx to use a digest type. type is typically supplied by a function such as EVP_sha1(), or a value explicitly fetched with EVP_MD_fetch().

    The parameters params are set on the context after initialisation.

    The type parameter can be NULL if ctx has been already initialized with another EVP_DigestInit_ex() call and has not been reset with EVP_MD_CTX_reset().

  • EVP_DigestInit_ex()

    Sets up digest context ctx to use a digest type. type is typically supplied by a function such as EVP_sha1(), or a value explicitly fetched with EVP_MD_fetch().

    If impl is non-NULL, its implementation of the digest type is used if there is one, and if not, the default implementation is used.

    The type parameter can be NULL if ctx has been already initialized with another EVP_DigestInit_ex() call and has not been reset with EVP_MD_CTX_reset().

  • EVP_DigestUpdate()

    Hashes cnt bytes of data at d into the digest context ctx. This function can be called several times on the same ctx to hash additional data.

  • EVP_DigestFinal_ex()

    Retrieves the digest value from ctx and places it in md. If the s parameter is not NULL then the number of bytes of data written (i.e. the length of the digest) will be written to the integer at s, at most EVP_MAX_MD_SIZE bytes will be written. After calling EVP_DigestFinal_ex() no additional calls to EVP_DigestUpdate() can be made, but EVP_DigestInit_ex2() can be called to initialize a new digest operation.

  • EVP_DigestFinalXOF()

    Interfaces to extendable-output functions, XOFs, such as SHAKE128 and SHAKE256. It retrieves the digest value from ctx and places it in len-sized md. After calling this function no additional calls to EVP_DigestUpdate() can be made, but EVP_DigestInit_ex2() can be called to initialize a new operation.

  • EVP_MD_CTX_dup()

    Can be used to duplicate the message digest state from in. This is useful to avoid multiple EVP_MD_fetch() calls or if large amounts of data are to be hashed which only differ in the last few bytes.

  • EVP_MD_CTX_copy_ex()

    Can be used to copy the message digest state from in to out. This is useful if large amounts of data are to be hashed which only differ in the last few bytes.

  • EVP_DigestInit()

    Behaves in the same way as EVP_DigestInit_ex2() except it doesn't set any parameters and calls EVP_MD_CTX_reset() so it cannot be used with an type of NULL.

  • EVP_DigestFinal()

    Similar to EVP_DigestFinal_ex() except after computing the digest the digest context ctx is automatically cleaned up with EVP_MD_CTX_reset().

  • EVP_MD_CTX_copy()

    Similar to EVP_MD_CTX_copy_ex() except the destination out does not have to be initialized.

  • EVP_MD_is_a()

    Returns 1 if md is an implementation of an algorithm that's identifiable with name, otherwise 0.

    If md is a legacy digest (it's the return value from the likes of EVP_sha256() rather than the result of an EVP_MD_fetch()), only cipher names registered with the default library context (see OSSL_LIB_CTX(3)) will be considered.

  • EVP_MD_get0_name(), EVP_MD_CTX_get0_name()

    Return the name of the given message digest. For fetched message digests with multiple names, only one of them is returned; it's recommended to use EVP_MD_names_do_all() instead.

  • EVP_MD_names_do_all()

    Traverses all names for the md, and calls fn with each name and data. This is only useful with fetched EVP_MDs.

  • EVP_MD_get0_description()

    Returns a description of the digest, meant for display and human consumption. The description is at the discretion of the digest implementation.

  • EVP_MD_get0_provider()

    Returns an OSSL_PROVIDER pointer to the provider that implements the given EVP_MD.

  • EVP_MD_get_size(), EVP_MD_CTX_get_size()

    Return the size of the message digest when passed an EVP_MD or an EVP_MD_CTX structure, i.e. the size of the hash.

  • EVP_MD_get_block_size(), EVP_MD_CTX_get_block_size()

    Return the block size of the message digest when passed an EVP_MD or an EVP_MD_CTX structure.

  • EVP_MD_get_type(), EVP_MD_CTX_get_type()

    Return the NID of the OBJECT IDENTIFIER representing the given message digest when passed an EVP_MD structure. For example, EVP_MD_get_type(EVP_sha1()) returns NID_sha1. This function is normally used when setting ASN1 OIDs.

  • EVP_MD_CTX_get0_md_data()

    Return the digest method private data for the passed EVP_MD_CTX. The space is allocated by OpenSSL and has the size originally set with EVP_MD_meth_set_app_datasize().

  • EVP_MD_CTX_get0_md(), EVP_MD_CTX_get1_md()

    EVP_MD_CTX_get0_md() returns the EVP_MD structure corresponding to the passed EVP_MD_CTX. This will be the same EVP_MD object originally passed to EVP_DigestInit_ex2() (or other similar function) when the EVP_MD_CTX was first initialised. Note that where explicit fetch is in use (see EVP_MD_fetch(3)) the value returned from this function will not have its reference count incremented and therefore it should not be used after the EVP_MD_CTX is freed. EVP_MD_CTX_get1_md() is the same except the ownership is passed to the caller and is from the passed EVP_MD_CTX.

  • EVP_MD_CTX_set_update_fn()

    Sets the update function for ctx to update. This is the function that is called by EVP_DigestUpdate(). If not set, the update function from the EVP_MD type specified at initialization is used.

  • EVP_MD_CTX_update_fn()

    Returns the update function for ctx.

  • EVP_MD_get_flags()

    Returns the md flags. Note that these are different from the EVP_MD_CTX ones. See EVP_MD_meth_set_flags(3) for more information.

  • EVP_MD_get_pkey_type()

    Returns the NID of the public key signing algorithm associated with this digest. For example EVP_sha1() is associated with RSA so this will return NID_sha1WithRSAEncryption. Since digests and signature algorithms are no longer linked this function is only retained for compatibility reasons.

  • EVP_md_null()

    A \"null\" message digest that does nothing: i.e. the hash it returns is of zero length.

  • EVP_get_digestbyname(), EVP_get_digestbynid(), EVP_get_digestbyobj()

    Returns an EVP_MD structure when passed a digest name, a digest NID or an ASN1_OBJECT structure respectively.

    The EVP_get_digestbyname() function is present for backwards compatibility with OpenSSL prior to version 3 and is different to the EVP_MD_fetch() function since it does not attempt to \"fetch\" an implementation of the cipher. Additionally, it only knows about digests that are built-in to OpenSSL and have an associated NID. Similarly EVP_get_digestbynid() and EVP_get_digestbyobj() also return objects without an associated implementation.

    When the digest objects returned by these functions are used (such as in a call to EVP_DigestInit_ex()) an implementation of the digest will be implicitly fetched from the loaded providers. This fetch could fail if no suitable implementation is available. Use EVP_MD_fetch() instead to explicitly fetch the algorithm and an associated implementation from a provider.

    See \"ALGORITHM FETCHING\" in crypto(7) for more information about fetching.

    The digest objects returned from these functions do not need to be freed with EVP_MD_free().

  • EVP_MD_CTX_get_pkey_ctx()

    Returns the EVP_PKEY_CTX assigned to ctx. The returned pointer should not be freed by the caller.

  • EVP_MD_CTX_set_pkey_ctx()

    Assigns an EVP_PKEY_CTX to EVP_MD_CTX. This is usually used to provide a customized EVP_PKEY_CTX to EVP_DigestSignInit(3) or EVP_DigestVerifyInit(3). The pctx passed to this function should be freed by the caller. A NULL pctx pointer is also allowed to clear the EVP_PKEY_CTX assigned to ctx. In such case, freeing the cleared EVP_PKEY_CTX or not depends on how the EVP_PKEY_CTX is created.

  • EVP_MD_do_all_provided()

    Traverses all messages digests implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

"},{"location":"man3/EVP_DigestInit/#parameters","title":"PARAMETERS","text":"

See OSSL_PARAM(3) for information about passing parameters.

EVP_MD_CTX_set_params() can be used with the following OSSL_PARAM keys:

  • \"xoflen\" (OSSL_DIGEST_PARAM_XOFLEN) <unsigned integer>

    Sets the digest length for extendable output functions. It is used by the SHAKE algorithm and should not exceed what can be given using a size_t.

  • \"pad-type\" (OSSL_DIGEST_PARAM_PAD_TYPE) <unsigned integer>

    Sets the padding type. It is used by the MDC2 algorithm.

EVP_MD_CTX_get_params() can be used with the following OSSL_PARAM keys:

  • \"micalg\" (OSSL_DIGEST_PARAM_MICALG) .

    Gets the digest Message Integrity Check algorithm string. This is used when creating S/MIME multipart/signed messages, as specified in RFC 3851. It may be used by external engines or providers.

    "},{"location":"man3/EVP_DigestInit/#controls","title":"CONTROLS","text":"

    EVP_MD_CTX_ctrl() can be used to send the following standard controls:

    • EVP_MD_CTRL_MICALG

      Gets the digest Message Integrity Check algorithm string. This is used when creating S/MIME multipart/signed messages, as specified in RFC 3851. The string value is written to p2.

      When used with a fetched EVP_MD, EVP_MD_CTX_get_params() gets called with an OSSL_PARAM(3) item with the key \"micalg\" (OSSL_DIGEST_PARAM_MICALG).

    • EVP_MD_CTRL_XOF_LEN

      This control sets the digest length for extendable output functions to p1. Sending this control directly should not be necessary, the use of EVP_DigestFinalXOF() is preferred. Currently used by SHAKE.

      When used with a fetched EVP_MD, EVP_MD_CTX_get_params() gets called with an OSSL_PARAM(3) item with the key \"xoflen\" (OSSL_DIGEST_PARAM_XOFLEN).

    "},{"location":"man3/EVP_DigestInit/#flags","title":"FLAGS","text":"

    EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags() and EVP_MD_CTX_test_flags() can be used the manipulate and test these EVP_MD_CTX flags:

    • EVP_MD_CTX_FLAG_ONESHOT

      This flag instructs the digest to optimize for one update only, if possible.

    • EVP_MD_CTX_FLAG_NO_INIT

      This flag instructs EVP_DigestInit() and similar not to initialise the implementation specific data.

    • EVP_MD_CTX_FLAG_FINALISE

      Some functions such as EVP_DigestSign only finalise copies of internal contexts so additional data can be included after the finalisation call. This is inefficient if this functionality is not required, and can be disabled with this flag.

    "},{"location":"man3/EVP_DigestInit/#return-values","title":"RETURN VALUES","text":"
    • EVP_MD_fetch()

      Returns a pointer to a EVP_MD for success or NULL for failure.

    • EVP_MD_up_ref()

      Returns 1 for success or 0 for failure.

    • EVP_Q_digest(), EVP_Digest(), EVP_DigestInit_ex2(), EVP_DigestInit_ex(), EVP_DigestInit(), EVP_DigestUpdate(), EVP_DigestFinal_ex(), EVP_DigestFinalXOF(), and EVP_DigestFinal()

      return 1 for success and 0 for failure.

    • EVP_MD_CTX_ctrl()

      Returns 1 if successful or 0 for failure.

    • EVP_MD_CTX_set_params(), EVP_MD_CTX_get_params()

      Returns 1 if successful or 0 for failure.

    • EVP_MD_CTX_settable_params(), EVP_MD_CTX_gettable_params()

      Return an array of constant OSSL_PARAM(3)s, or NULL if there is none to get.

    • EVP_MD_CTX_dup()

      Returns a new EVP_MD_CTX if successful or NULL on failure.

    • EVP_MD_CTX_copy_ex()

      Returns 1 if successful or 0 for failure.

    • EVP_MD_get_type(), EVP_MD_get_pkey_type()

      Returns the NID of the corresponding OBJECT IDENTIFIER or NID_undef if none exists.

    • EVP_MD_get_size(), EVP_MD_get_block_size(), EVP_MD_CTX_get_size(), EVP_MD_CTX_get_block_size()

      Returns the digest or block size in bytes or -1 for failure.

    • EVP_md_null()

      Returns a pointer to the EVP_MD structure of the \"null\" message digest.

    • EVP_get_digestbyname(), EVP_get_digestbynid(), EVP_get_digestbyobj()

      Returns either an EVP_MD structure or NULL if an error occurs.

    • EVP_MD_CTX_set_pkey_ctx()

      This function has no return value.

    • EVP_MD_names_do_all()

      Returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

    "},{"location":"man3/EVP_DigestInit/#notes","title":"NOTES","text":"

    The EVP interface to message digests should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the digest used and much more flexible.

    New applications should use the SHA-2 (such as EVP_sha256(3)) or the SHA-3 digest algorithms (such as EVP_sha3_512(3)). The other digest algorithms are still in common use.

    For most applications the impl parameter to EVP_DigestInit_ex() will be set to NULL to use the default digest implementation.

    Ignoring failure returns of EVP_DigestInit_ex(), EVP_DigestInit_ex2(), or EVP_DigestInit() can lead to undefined behavior on subsequent calls updating or finalizing the EVP_MD_CTX such as the EVP_DigestUpdate() or EVP_DigestFinal() functions. The only valid calls on the EVP_MD_CTX when initialization fails are calls that attempt another initialization of the context or release the context.

    The functions EVP_DigestInit(), EVP_DigestFinal() and EVP_MD_CTX_copy() are obsolete but are retained to maintain compatibility with existing code. New applications should use EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex() because they can efficiently reuse a digest context instead of initializing and cleaning it up on each call and allow non default implementations of digests to be specified.

    If digest contexts are not cleaned up after use, memory leaks will occur.

    EVP_MD_CTX_get0_name(), EVP_MD_CTX_get_size(), EVP_MD_CTX_get_block_size(), EVP_MD_CTX_get_type(), EVP_get_digestbynid() and EVP_get_digestbyobj() are defined as macros.

    EVP_MD_CTX_ctrl() sends commands to message digests for additional configuration or control.

    "},{"location":"man3/EVP_DigestInit/#examples","title":"EXAMPLES","text":"

    This example digests the data \"Test Message\\n\" and \"Hello World\\n\", using the digest name passed on the command line.

    #include <stdio.h>\n#include <string.h>\n#include <openssl/evp.h>\n\nint main(int argc, char *argv[])\n{\n    EVP_MD_CTX *mdctx;\n    const EVP_MD *md;\n    char mess1[] = \"Test Message\\n\";\n    char mess2[] = \"Hello World\\n\";\n    unsigned char md_value[EVP_MAX_MD_SIZE];\n    unsigned int md_len, i;\n\n    if (argv[1] == NULL) {\n        printf(\"Usage: mdtest digestname\\n\");\n        exit(1);\n    }\n\n    md = EVP_get_digestbyname(argv[1]);\n    if (md == NULL) {\n        printf(\"Unknown message digest %s\\n\", argv[1]);\n        exit(1);\n    }\n\n    mdctx = EVP_MD_CTX_new();\n    if (!EVP_DigestInit_ex2(mdctx, md, NULL)) {\n        printf(\"Message digest initialization failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    if (!EVP_DigestUpdate(mdctx, mess1, strlen(mess1))) {\n        printf(\"Message digest update failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    if (!EVP_DigestUpdate(mdctx, mess2, strlen(mess2))) {\n        printf(\"Message digest update failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    if (!EVP_DigestFinal_ex(mdctx, md_value, &md_len)) {\n        printf(\"Message digest finalization failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    EVP_MD_CTX_free(mdctx);\n\n    printf(\"Digest is: \");\n    for (i = 0; i < md_len; i++)\n        printf(\"%02x\", md_value[i]);\n    printf(\"\\n\");\n\n    exit(0);\n}\n
    "},{"location":"man3/EVP_DigestInit/#see-also","title":"SEE ALSO","text":"

    EVP_MD_meth_new(3), openssl-dgst(1), evp(7), OSSL_PROVIDER(3), OSSL_PARAM(3), property(7), \"ALGORITHM FETCHING\" in crypto(7), provider-digest(7), life_cycle-digest(7)

    The full list of digest algorithms are provided below.

    EVP_blake2b512(3), EVP_md2(3), EVP_md4(3), EVP_md5(3), EVP_mdc2(3), EVP_ripemd160(3), EVP_sha1(3), EVP_sha224(3), EVP_sha3_224(3), EVP_sm3(3), EVP_whirlpool(3)

    "},{"location":"man3/EVP_DigestInit/#history","title":"HISTORY","text":"

    The EVP_MD_CTX_create() and EVP_MD_CTX_destroy() functions were renamed to EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1.0, respectively.

    The link between digests and signing algorithms was fixed in OpenSSL 1.0 and later, so now EVP_sha1() can be used with RSA and DSA.

    The EVP_dss1() function was removed in OpenSSL 1.1.0.

    The EVP_MD_CTX_set_pkey_ctx() function was added in OpenSSL 1.1.1.

    The EVP_Q_digest(), EVP_DigestInit_ex2(), EVP_MD_fetch(), EVP_MD_free(), EVP_MD_up_ref(), EVP_MD_get_params(), EVP_MD_CTX_set_params(), EVP_MD_CTX_get_params(), EVP_MD_gettable_params(), EVP_MD_gettable_ctx_params(), EVP_MD_settable_ctx_params(), EVP_MD_CTX_settable_params() and EVP_MD_CTX_gettable_params() functions were added in OpenSSL 3.0.

    The EVP_MD_type(), EVP_MD_nid(), EVP_MD_name(), EVP_MD_pkey_type(), EVP_MD_size(), EVP_MD_block_size(), EVP_MD_flags(), EVP_MD_CTX_size(), EVP_MD_CTX_block_size(), EVP_MD_CTX_type(), and EVP_MD_CTX_md_data() functions were renamed to include get or get0 in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

    The EVP_MD_CTX_md() function was deprecated in OpenSSL 3.0; use EVP_MD_CTX_get0_md() instead. EVP_MD_CTX_update_fn() and EVP_MD_CTX_set_update_fn() were deprecated in OpenSSL 3.0.

    EVP_MD_CTX_dup() was added in OpenSSL 3.1.

    "},{"location":"man3/EVP_DigestInit/#copyright","title":"COPYRIGHT","text":"

    Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

    "},{"location":"man3/EVP_DigestSignInit/","title":"EVP_DigestSignInit","text":""},{"location":"man3/EVP_DigestSignInit/#name","title":"NAME","text":"

    EVP_DigestSignInit_ex, EVP_DigestSignInit, EVP_DigestSignUpdate, EVP_DigestSignFinal, EVP_DigestSign - EVP signing functions

    "},{"location":"man3/EVP_DigestSignInit/#synopsis","title":"SYNOPSIS","text":"
    #include <openssl/evp.h>\n\nint EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                          const char *mdname, OSSL_LIB_CTX *libctx,\n                          const char *props, EVP_PKEY *pkey,\n                          const OSSL_PARAM params[]);\nint EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                       const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);\nint EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);\nint EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen);\n\nint EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sig,\n                   size_t *siglen, const unsigned char *tbs,\n                   size_t tbslen);\n
    "},{"location":"man3/EVP_DigestSignInit/#description","title":"DESCRIPTION","text":"

    The EVP signature routines are a high-level interface to digital signatures. Input data is digested first before the signing takes place.

    EVP_DigestSignInit_ex() sets up signing context ctx to use a digest with the name mdname and private key pkey. The name of the digest to be used is passed to the provider of the signature algorithm in use. How that provider interprets the digest name is provider specific. The provider may implement that digest directly itself or it may (optionally) choose to fetch it (which could result in a digest from a different provider being selected). If the provider supports fetching the digest then it may use the props argument for the properties to be used during the fetch. Finally, the passed parameters params, if not NULL, are set on the context before returning.

    The pkey algorithm is used to fetch a EVP_SIGNATURE method implicitly, to be used for the actual signing. See \"Implicit fetch\" in provider(7) for more information about implicit fetches.

    The OpenSSL default and legacy providers support fetching digests and can fetch those digests from any available provider. The OpenSSL FIPS provider also supports fetching digests but will only fetch digests that are themselves implemented inside the FIPS provider.

    ctx must be created with EVP_MD_CTX_new() before calling this function. If pctx is not NULL, the EVP_PKEY_CTX of the signing operation will be written to *pctx: this can be used to set alternative signing options. Note that any existing value in *pctx is overwritten. The EVP_PKEY_CTX value returned must not be freed directly by the application if ctx is not assigned an EVP_PKEY_CTX value before being passed to EVP_DigestSignInit_ex() (which means the EVP_PKEY_CTX is created inside EVP_DigestSignInit_ex() and it will be freed automatically when the EVP_MD_CTX is freed). If the EVP_PKEY_CTX to be used is created by EVP_DigestSignInit_ex then it will use the OSSL_LIB_CTX specified in libctx and the property query string specified in props.

    The digest mdname may be NULL if the signing algorithm supports it. The props argument can always be NULL.

    No EVP_PKEY_CTX will be created by EVP_DigestSignInit_ex() if the passed ctx has already been assigned one via EVP_MD_CTX_set_pkey_ctx(3). See also SM2(7).

    Only EVP_PKEY types that support signing can be used with these functions. This includes MAC algorithms where the MAC generation is considered as a form of \"signing\". Built-in EVP_PKEY types supported by these functions are CMAC, Poly1305, DSA, ECDSA, HMAC, RSA, SipHash, Ed25519 and Ed448.

    Not all digests can be used for all key types. The following combinations apply.

    • DSA

      Supports SHA1, SHA224, SHA256, SHA384 and SHA512

    • ECDSA

      Supports SHA1, SHA224, SHA256, SHA384, SHA512 and SM3

    • RSA with no padding

      Supports no digests (the digest type must be NULL)

    • RSA with X931 padding

      Supports SHA1, SHA256, SHA384 and SHA512

    • All other RSA padding types

      Support SHA1, SHA224, SHA256, SHA384, SHA512, MD5, MD5_SHA1, MD2, MD4, MDC2, SHA3-224, SHA3-256, SHA3-384, SHA3-512

    • Ed25519 and Ed448

      Support no digests (the digest type must be NULL)

    • HMAC

      Supports any digest

    • CMAC, Poly1305 and SipHash

      Will ignore any digest provided.

    If RSA-PSS is used and restrictions apply then the digest must match.

    EVP_DigestSignInit() works in the same way as EVP_DigestSignInit_ex() except that the mdname parameter will be inferred from the supplied digest type, and props will be NULL. Where supplied the ENGINE e will be used for the signing and digest algorithm implementations. e may be NULL.

    EVP_DigestSignUpdate() hashes cnt bytes of data at d into the signature context ctx. This function can be called several times on the same ctx to include additional data.

    Unless sig is NULL EVP_DigestSignFinal() signs the data in ctx and places the signature in sig. Otherwise the maximum necessary size of the output buffer is written to the siglen parameter. If sig is not NULL then before the call the siglen parameter should contain the length of the sig buffer. If the call is successful the signature is written to sig and the amount of data written to siglen.

    EVP_DigestSign() signs tbslen bytes of data at tbs and places the signature in sig and its length in siglen in a similar way to EVP_DigestSignFinal(). In the event of a failure EVP_DigestSign() cannot be called again without reinitialising the EVP_MD_CTX. If sig is NULL before the call then siglen will be populated with the required size for the sig buffer. If sig is non-NULL before the call then siglen should contain the length of the sig buffer.

    "},{"location":"man3/EVP_DigestSignInit/#return-values","title":"RETURN VALUES","text":"

    EVP_DigestSignInit(), EVP_DigestSignUpdate(), EVP_DigestSignFinal() and EVP_DigestSign() return 1 for success and 0 for failure.

    The error codes can be obtained from ERR_get_error(3).

    "},{"location":"man3/EVP_DigestSignInit/#notes","title":"NOTES","text":"

    The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

    EVP_DigestSign() is a one shot operation which signs a single block of data in one function. For algorithms that support streaming it is equivalent to calling EVP_DigestSignUpdate() and EVP_DigestSignFinal(). For algorithms which do not support streaming (e.g. PureEdDSA) it is the only way to sign data.

    In previous versions of OpenSSL there was a link between message digest types and public key algorithms. This meant that \"clone\" digests such as EVP_dss1() needed to be used to sign using SHA1 and DSA. This is no longer necessary and the use of clone digest is now discouraged.

    For some key types and parameters the random number generator must be seeded. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

    The call to EVP_DigestSignFinal() internally finalizes a copy of the digest context. This means that calls to EVP_DigestSignUpdate() and EVP_DigestSignFinal() can be called later to digest and sign additional data.

    EVP_DigestSignInit() and EVP_DigestSignInit_ex() functions can be called multiple times on a context and the parameters set by previous calls should be preserved if the pkey parameter is NULL. The call then just resets the state of the ctx.

    Ignoring failure returns of EVP_DigestSignInit() and EVP_DigestSignInit_ex() functions can lead to subsequent undefined behavior when calling EVP_DigestSignUpdate(), EVP_DigestSignFinal(), or EVP_DigestSign().

    The use of EVP_PKEY_get_size() with these functions is discouraged because some signature operations may have a signature length which depends on the parameters set. As a result EVP_PKEY_get_size() would have to return a value which indicates the maximum possible signature for any set of parameters.

    "},{"location":"man3/EVP_DigestSignInit/#see-also","title":"SEE ALSO","text":"

    EVP_DigestVerifyInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1), RAND(7)

    "},{"location":"man3/EVP_DigestSignInit/#history","title":"HISTORY","text":"

    EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal() were added in OpenSSL 1.0.0.

    EVP_DigestSignInit_ex() was added in OpenSSL 3.0.

    EVP_DigestSignUpdate() was converted from a macro to a function in OpenSSL 3.0.

    "},{"location":"man3/EVP_DigestSignInit/#copyright","title":"COPYRIGHT","text":"

    Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.

    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

    "},{"location":"man3/EVP_DigestVerifyInit/","title":"EVP_DigestVerifyInit","text":""},{"location":"man3/EVP_DigestVerifyInit/#name","title":"NAME","text":"

    EVP_DigestVerifyInit_ex, EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal, EVP_DigestVerify - EVP signature verification functions

    "},{"location":"man3/EVP_DigestVerifyInit/#synopsis","title":"SYNOPSIS","text":"
    #include <openssl/evp.h>\n\nint EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                            const char *mdname, OSSL_LIB_CTX *libctx,\n                            const char *props, EVP_PKEY *pkey,\n                            const OSSL_PARAM params[]);\nint EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                         const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);\nint EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);\nint EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig,\n                          size_t siglen);\nint EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sig,\n                     size_t siglen, const unsigned char *tbs, size_t tbslen);\n
    "},{"location":"man3/EVP_DigestVerifyInit/#description","title":"DESCRIPTION","text":"

    The EVP signature routines are a high-level interface to digital signatures. Input data is digested first before the signature verification takes place.

    EVP_DigestVerifyInit_ex() sets up verification context ctx to use a digest with the name mdname and public key pkey. The name of the digest to be used is passed to the provider of the signature algorithm in use. How that provider interprets the digest name is provider specific. The provider may implement that digest directly itself or it may (optionally) choose to fetch it (which could result in a digest from a different provider being selected). If the provider supports fetching the digest then it may use the props argument for the properties to be used during the fetch. Finally, the passed parameters params, if not NULL, are set on the context before returning.

    The pkey algorithm is used to fetch a EVP_SIGNATURE method implicitly, to be used for the actual signing. See \"Implicit fetch\" in provider(7) for more information about implicit fetches.

    The OpenSSL default and legacy providers support fetching digests and can fetch those digests from any available provider. The OpenSSL FIPS provider also supports fetching digests but will only fetch digests that are themselves implemented inside the FIPS provider.

    ctx must be created with EVP_MD_CTX_new() before calling this function. If pctx is not NULL, the EVP_PKEY_CTX of the verification operation will be written to *pctx: this can be used to set alternative verification options. Note that any existing value in *pctx is overwritten. The EVP_PKEY_CTX value returned must not be freed directly by the application if ctx is not assigned an EVP_PKEY_CTX value before being passed to EVP_DigestVerifyInit_ex() (which means the EVP_PKEY_CTX is created inside EVP_DigestVerifyInit_ex() and it will be freed automatically when the EVP_MD_CTX is freed). If the EVP_PKEY_CTX to be used is created by EVP_DigestVerifyInit_ex then it will use the OSSL_LIB_CTX specified in libctx and the property query string specified in props.

    No EVP_PKEY_CTX will be created by EVP_DigestVerifyInit_ex() if the passed ctx has already been assigned one via EVP_MD_CTX_set_pkey_ctx(3). See also SM2(7).

    Not all digests can be used for all key types. The following combinations apply.

    • DSA

      Supports SHA1, SHA224, SHA256, SHA384 and SHA512

    • ECDSA

      Supports SHA1, SHA224, SHA256, SHA384, SHA512 and SM3

    • RSA with no padding

      Supports no digests (the digest type must be NULL)

    • RSA with X931 padding

      Supports SHA1, SHA256, SHA384 and SHA512

    • All other RSA padding types

      Support SHA1, SHA224, SHA256, SHA384, SHA512, MD5, MD5_SHA1, MD2, MD4, MDC2, SHA3-224, SHA3-256, SHA3-384, SHA3-512

    • Ed25519 and Ed448

      Support no digests (the digest type must be NULL)

    • HMAC

      Supports any digest

    • CMAC, Poly1305 and Siphash

      Will ignore any digest provided.

    If RSA-PSS is used and restrictions apply then the digest must match.

    EVP_DigestVerifyInit() works in the same way as EVP_DigestVerifyInit_ex() except that the mdname parameter will be inferred from the supplied digest type, and props will be NULL. Where supplied the ENGINE e will be used for the signature verification and digest algorithm implementations. e may be NULL.

    EVP_DigestVerifyUpdate() hashes cnt bytes of data at d into the verification context ctx. This function can be called several times on the same ctx to include additional data.

    EVP_DigestVerifyFinal() verifies the data in ctx against the signature in sig of length siglen.

    EVP_DigestVerify() verifies tbslen bytes at tbs against the signature in sig of length siglen.

    "},{"location":"man3/EVP_DigestVerifyInit/#return-values","title":"RETURN VALUES","text":"

    EVP_DigestVerifyInit() and EVP_DigestVerifyUpdate() return 1 for success and 0 for failure.

    EVP_DigestVerifyFinal() and EVP_DigestVerify() return 1 for success; any other value indicates failure. A return value of zero indicates that the signature did not verify successfully (that is, tbs did not match the original data or the signature had an invalid form), while other values indicate a more serious error (and sometimes also indicate an invalid signature form).

    The error codes can be obtained from ERR_get_error(3).

    "},{"location":"man3/EVP_DigestVerifyInit/#notes","title":"NOTES","text":"

    The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

    EVP_DigestVerify() is a one shot operation which verifies a single block of data in one function. For algorithms that support streaming it is equivalent to calling EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal(). For algorithms which do not support streaming (e.g. PureEdDSA) it is the only way to verify data.

    In previous versions of OpenSSL there was a link between message digest types and public key algorithms. This meant that \"clone\" digests such as EVP_dss1() needed to be used to sign using SHA1 and DSA. This is no longer necessary and the use of clone digest is now discouraged.

    For some key types and parameters the random number generator must be seeded. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

    The call to EVP_DigestVerifyFinal() internally finalizes a copy of the digest context. This means that EVP_VerifyUpdate() and EVP_VerifyFinal() can be called later to digest and verify additional data.

    EVP_DigestVerifyInit() and EVP_DigestVerifyInit_ex() functions can be called multiple times on a context and the parameters set by previous calls should be preserved if the pkey parameter is NULL. The call then just resets the state of the ctx.

    Ignoring failure returns of EVP_DigestVerifyInit() and EVP_DigestVerifyInit_ex() functions can lead to subsequent undefined behavior when calling EVP_DigestVerifyUpdate(), EVP_DigestVerifyFinal(), or EVP_DigestVerify().

    "},{"location":"man3/EVP_DigestVerifyInit/#see-also","title":"SEE ALSO","text":"

    EVP_DigestSignInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1), RAND(7)

    "},{"location":"man3/EVP_DigestVerifyInit/#history","title":"HISTORY","text":"

    EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal() were added in OpenSSL 1.0.0.

    EVP_DigestVerifyInit_ex() was added in OpenSSL 3.0.

    EVP_DigestVerifyUpdate() was converted from a macro to a function in OpenSSL 3.0.

    "},{"location":"man3/EVP_DigestVerifyInit/#copyright","title":"COPYRIGHT","text":"

    Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.

    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

    "},{"location":"man3/EVP_EncodeInit/","title":"EVP_EncodeInit","text":""},{"location":"man3/EVP_EncodeInit/#name","title":"NAME","text":"

    EVP_ENCODE_CTX_new, EVP_ENCODE_CTX_free, EVP_ENCODE_CTX_copy, EVP_ENCODE_CTX_num, EVP_EncodeInit, EVP_EncodeUpdate, EVP_EncodeFinal, EVP_EncodeBlock, EVP_DecodeInit, EVP_DecodeUpdate, EVP_DecodeFinal, EVP_DecodeBlock - EVP base 64 encode/decode routines

    "},{"location":"man3/EVP_EncodeInit/#synopsis","title":"SYNOPSIS","text":"
    #include <openssl/evp.h>\n\nEVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void);\nvoid EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx);\nint EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx);\nint EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx);\nvoid EVP_EncodeInit(EVP_ENCODE_CTX *ctx);\nint EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,\n                     const unsigned char *in, int inl);\nvoid EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);\nint EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);\n\nvoid EVP_DecodeInit(EVP_ENCODE_CTX *ctx);\nint EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,\n                     const unsigned char *in, int inl);\nint EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);\nint EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);\n
    "},{"location":"man3/EVP_EncodeInit/#description","title":"DESCRIPTION","text":"

    The EVP encode routines provide a high-level interface to base 64 encoding and decoding. Base 64 encoding converts binary data into a printable form that uses the characters A-Z, a-z, 0-9, \"+\" and \"/\" to represent the data. For every 3 bytes of binary data provided 4 bytes of base 64 encoded data will be produced plus some occasional newlines (see below). If the input data length is not a multiple of 3 then the output data will be padded at the end using the \"=\" character.

    EVP_ENCODE_CTX_new() allocates, initializes and returns a context to be used for the encode/decode functions.

    EVP_ENCODE_CTX_free() cleans up an encode/decode context ctx and frees up the space allocated to it. If the argument is NULL, nothing is done.

    Encoding of binary data is performed in blocks of 48 input bytes (or less for the final block). For each 48 byte input block encoded 64 bytes of base 64 data is output plus an additional newline character (i.e. 65 bytes in total). The final block (which may be less than 48 bytes) will output 4 bytes for every 3 bytes of input. If the data length is not divisible by 3 then a full 4 bytes is still output for the final 1 or 2 bytes of input. Similarly a newline character will also be output.

    EVP_EncodeInit() initialises ctx for the start of a new encoding operation.

    EVP_EncodeUpdate() encode inl bytes of data found in the buffer pointed to by in. The output is stored in the buffer out and the number of bytes output is stored in *outl. It is the caller's responsibility to ensure that the buffer at out is sufficiently large to accommodate the output data. Only full blocks of data (48 bytes) will be immediately processed and output by this function. Any remainder is held in the ctx object and will be processed by a subsequent call to EVP_EncodeUpdate() or EVP_EncodeFinal(). To calculate the required size of the output buffer add together the value of inl with the amount of unprocessed data held in ctx and divide the result by 48 (ignore any remainder). This gives the number of blocks of data that will be processed. Ensure the output buffer contains 65 bytes of storage for each block, plus an additional byte for a NUL terminator. EVP_EncodeUpdate() may be called repeatedly to process large amounts of input data. In the event of an error EVP_EncodeUpdate() will set *outl to 0 and return 0. On success 1 will be returned.

    EVP_EncodeFinal() must be called at the end of an encoding operation. It will process any partial block of data remaining in the ctx object. The output data will be stored in out and the length of the data written will be stored in *outl. It is the caller's responsibility to ensure that out is sufficiently large to accommodate the output data which will never be more than 65 bytes plus an additional NUL terminator (i.e. 66 bytes in total).

    EVP_ENCODE_CTX_copy() can be used to copy a context sctx to a context dctx. dctx must be initialized before calling this function.

    EVP_ENCODE_CTX_num() will return the number of as yet unprocessed bytes still to be encoded or decoded that are pending in the ctx object.

    EVP_EncodeBlock() encodes a full block of input data in f and of length n and stores it in t. For every 3 bytes of input provided 4 bytes of output data will be produced. If n is not divisible by 3 then the block is encoded as a final block of data and the output is padded such that it is always divisible by 4. Additionally a NUL terminator character will be added. For example if 16 bytes of input data is provided then 24 bytes of encoded data is created plus 1 byte for a NUL terminator (i.e. 25 bytes in total). The length of the data generated without the NUL terminator is returned from the function.

    EVP_DecodeInit() initialises ctx for the start of a new decoding operation.

    EVP_DecodeUpdate() decodes inl characters of data found in the buffer pointed to by in. The output is stored in the buffer out and the number of bytes output is stored in *outl. It is the caller's responsibility to ensure that the buffer at out is sufficiently large to accommodate the output data. This function will attempt to decode as much data as possible in 4 byte chunks. Any whitespace, newline or carriage return characters are ignored. Any partial chunk of unprocessed data (1, 2 or 3 bytes) that remains at the end will be held in the ctx object and processed by a subsequent call to EVP_DecodeUpdate(). If any illegal base 64 characters are encountered or if the base 64 padding character \"=\" is encountered in the middle of the data then the function returns -1 to indicate an error. A return value of 0 or 1 indicates successful processing of the data. A return value of 0 additionally indicates that the last input data characters processed included the base 64 padding character \"=\" and therefore no more non-padding character data is expected to be processed. For every 4 valid base 64 bytes processed (ignoring whitespace, carriage returns and line feeds), 3 bytes of binary output data will be produced (or less at the end of the data where the padding character \"=\" has been used).

    EVP_DecodeFinal() must be called at the end of a decoding operation. If there is any unprocessed data still in ctx then the input data must not have been a multiple of 4 and therefore an error has occurred. The function will return -1 in this case. Otherwise the function returns 1 on success.

    EVP_DecodeBlock() will decode the block of n characters of base 64 data contained in f and store the result in t. Any leading whitespace will be trimmed as will any trailing whitespace, newlines, carriage returns or EOF characters. After such trimming the length of the data in f must be divisible by 4. For every 4 input bytes exactly 3 output bytes will be produced. The output will be padded with 0 bits if necessary to ensure that the output is always 3 bytes for every 4 input bytes. This function will return the length of the data decoded or -1 on error.

    "},{"location":"man3/EVP_EncodeInit/#return-values","title":"RETURN VALUES","text":"

    EVP_ENCODE_CTX_new() returns a pointer to the newly allocated EVP_ENCODE_CTX object or NULL on error.

    EVP_ENCODE_CTX_num() returns the number of bytes pending encoding or decoding in ctx.

    EVP_EncodeUpdate() returns 0 on error or 1 on success.

    EVP_EncodeBlock() returns the number of bytes encoded excluding the NUL terminator.

    EVP_DecodeUpdate() returns -1 on error and 0 or 1 on success. If 0 is returned then no more non-padding base 64 characters are expected.

    EVP_DecodeFinal() returns -1 on error or 1 on success.

    EVP_DecodeBlock() returns the length of the data decoded or -1 on error.

    "},{"location":"man3/EVP_EncodeInit/#see-also","title":"SEE ALSO","text":"

    evp(7)

    "},{"location":"man3/EVP_EncodeInit/#copyright","title":"COPYRIGHT","text":"

    Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

    "},{"location":"man3/EVP_EncryptInit/","title":"EVP_EncryptInit","text":""},{"location":"man3/EVP_EncryptInit/#name","title":"NAME","text":"

    EVP_CIPHER_fetch, EVP_CIPHER_up_ref, EVP_CIPHER_free, EVP_CIPHER_CTX_new, EVP_CIPHER_CTX_reset, EVP_CIPHER_CTX_free, EVP_CIPHER_CTX_dup, EVP_CIPHER_CTX_copy, EVP_EncryptInit_ex, EVP_EncryptInit_ex2, EVP_EncryptUpdate, EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptInit_ex2, EVP_DecryptUpdate, EVP_DecryptFinal_ex, EVP_CipherInit_ex, EVP_CipherInit_ex2, EVP_CipherUpdate, EVP_CipherFinal_ex, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX_ctrl, EVP_EncryptInit, EVP_EncryptFinal, EVP_DecryptInit, EVP_DecryptFinal, EVP_CipherInit, EVP_CipherFinal, EVP_Cipher, EVP_get_cipherbyname, EVP_get_cipherbynid, EVP_get_cipherbyobj, EVP_CIPHER_is_a, EVP_CIPHER_get0_name, EVP_CIPHER_get0_description, EVP_CIPHER_names_do_all, EVP_CIPHER_get0_provider, EVP_CIPHER_get_nid, EVP_CIPHER_get_params, EVP_CIPHER_gettable_params, EVP_CIPHER_get_block_size, EVP_CIPHER_get_key_length, EVP_CIPHER_get_iv_length, EVP_CIPHER_get_flags, EVP_CIPHER_get_mode, EVP_CIPHER_get_type, EVP_CIPHER_CTX_cipher, EVP_CIPHER_CTX_get0_cipher, EVP_CIPHER_CTX_get1_cipher, EVP_CIPHER_CTX_get0_name, EVP_CIPHER_CTX_get_nid, EVP_CIPHER_CTX_get_params, EVP_CIPHER_gettable_ctx_params, EVP_CIPHER_CTX_gettable_params, EVP_CIPHER_CTX_set_params, EVP_CIPHER_settable_ctx_params, EVP_CIPHER_CTX_settable_params, EVP_CIPHER_CTX_get_block_size, EVP_CIPHER_CTX_get_key_length, EVP_CIPHER_CTX_get_iv_length, EVP_CIPHER_CTX_get_tag_length, EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_flags, EVP_CIPHER_CTX_set_flags, EVP_CIPHER_CTX_clear_flags, EVP_CIPHER_CTX_test_flags, EVP_CIPHER_CTX_get_type, EVP_CIPHER_CTX_get_mode, EVP_CIPHER_CTX_get_num, EVP_CIPHER_CTX_set_num, EVP_CIPHER_CTX_is_encrypting, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param, EVP_CIPHER_CTX_set_padding, EVP_enc_null, EVP_CIPHER_do_all_provided, EVP_CIPHER_nid, EVP_CIPHER_name, EVP_CIPHER_block_size, EVP_CIPHER_key_length, EVP_CIPHER_iv_length, EVP_CIPHER_flags, EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_encrypting, EVP_CIPHER_CTX_nid, EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, EVP_CIPHER_CTX_iv_length, EVP_CIPHER_CTX_tag_length, EVP_CIPHER_CTX_num, EVP_CIPHER_CTX_type, EVP_CIPHER_CTX_mode - EVP cipher routines

    "},{"location":"man3/EVP_EncryptInit/#synopsis","title":"SYNOPSIS","text":"
    #include <openssl/evp.h>\n\nEVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                             const char *properties);\nint EVP_CIPHER_up_ref(EVP_CIPHER *cipher);\nvoid EVP_CIPHER_free(EVP_CIPHER *cipher);\nEVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);\nint EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx);\nvoid EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx);\nEVP_CIPHER_CTX *EVP_CIPHER_CTX_dup(const EVP_CIPHER_CTX *in);\nint EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);\n\nint EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                       ENGINE *impl, const unsigned char *key, const unsigned char *iv);\nint EVP_EncryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                        const unsigned char *key, const unsigned char *iv,\n                        const OSSL_PARAM params[]);\nint EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                      int *outl, const unsigned char *in, int inl);\nint EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n\nint EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                       ENGINE *impl, const unsigned char *key, const unsigned char *iv);\nint EVP_DecryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                        const unsigned char *key, const unsigned char *iv,\n                        const OSSL_PARAM params[]);\nint EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                      int *outl, const unsigned char *in, int inl);\nint EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                      ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc);\nint EVP_CipherInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                       const unsigned char *key, const unsigned char *iv,\n                       int enc, const OSSL_PARAM params[]);\nint EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                     int *outl, const unsigned char *in, int inl);\nint EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                    const unsigned char *key, const unsigned char *iv);\nint EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n\nint EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                    const unsigned char *key, const unsigned char *iv);\nint EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                   const unsigned char *key, const unsigned char *iv, int enc);\nint EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,\n               const unsigned char *in, unsigned int inl);\n\nint EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding);\nint EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);\nint EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int cmd, int p1, void *p2);\nint EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);\nvoid EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);\nvoid EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);\nint EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags);\n\nconst EVP_CIPHER *EVP_get_cipherbyname(const char *name);\nconst EVP_CIPHER *EVP_get_cipherbynid(int nid);\nconst EVP_CIPHER *EVP_get_cipherbyobj(const ASN1_OBJECT *a);\n\nint EVP_CIPHER_get_nid(const EVP_CIPHER *e);\nint EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name);\nint EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher,\n                            void (*fn)(const char *name, void *data),\n                            void *data);\nconst char *EVP_CIPHER_get0_name(const EVP_CIPHER *cipher);\nconst char *EVP_CIPHER_get0_description(const EVP_CIPHER *cipher);\nconst OSSL_PROVIDER *EVP_CIPHER_get0_provider(const EVP_CIPHER *cipher);\nint EVP_CIPHER_get_block_size(const EVP_CIPHER *e);\nint EVP_CIPHER_get_key_length(const EVP_CIPHER *e);\nint EVP_CIPHER_get_iv_length(const EVP_CIPHER *e);\nunsigned long EVP_CIPHER_get_flags(const EVP_CIPHER *e);\nunsigned long EVP_CIPHER_get_mode(const EVP_CIPHER *e);\nint EVP_CIPHER_get_type(const EVP_CIPHER *cipher);\n\nconst EVP_CIPHER *EVP_CIPHER_CTX_get0_cipher(const EVP_CIPHER_CTX *ctx);\nEVP_CIPHER *EVP_CIPHER_CTX_get1_cipher(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_nid(const EVP_CIPHER_CTX *ctx);\nconst char *EVP_CIPHER_CTX_get0_name(const EVP_CIPHER_CTX *ctx);\n\nint EVP_CIPHER_get_params(EVP_CIPHER *cipher, OSSL_PARAM params[]);\nint EVP_CIPHER_CTX_set_params(EVP_CIPHER_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_CIPHER_CTX_get_params(EVP_CIPHER_CTX *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher);\nconst OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher);\nconst OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher);\nconst OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *ctx);\nconst OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_block_size(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_key_length(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_iv_length(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_tag_length(const EVP_CIPHER_CTX *ctx);\nvoid *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);\nvoid EVP_CIPHER_CTX_set_app_data(const EVP_CIPHER_CTX *ctx, void *data);\nint EVP_CIPHER_CTX_get_type(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_mode(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_num(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num);\nint EVP_CIPHER_CTX_is_encrypting(const EVP_CIPHER_CTX *ctx);\n\nint EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\nint EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\n\nvoid EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                void (*fn)(EVP_CIPHER *cipher, void *arg),\n                                void *arg);\n\n#define EVP_CIPHER_nid EVP_CIPHER_get_nid\n#define EVP_CIPHER_name EVP_CIPHER_get0_name\n#define EVP_CIPHER_block_size EVP_CIPHER_get_block_size\n#define EVP_CIPHER_key_length EVP_CIPHER_get_key_length\n#define EVP_CIPHER_iv_length EVP_CIPHER_get_iv_length\n#define EVP_CIPHER_flags EVP_CIPHER_get_flags\n#define EVP_CIPHER_mode EVP_CIPHER_get_mode\n#define EVP_CIPHER_type EVP_CIPHER_get_type\n#define EVP_CIPHER_CTX_encrypting EVP_CIPHER_CTX_is_encrypting\n#define EVP_CIPHER_CTX_nid EVP_CIPHER_CTX_get_nid\n#define EVP_CIPHER_CTX_block_size EVP_CIPHER_CTX_get_block_size\n#define EVP_CIPHER_CTX_key_length EVP_CIPHER_CTX_get_key_length\n#define EVP_CIPHER_CTX_iv_length EVP_CIPHER_CTX_get_iv_length\n#define EVP_CIPHER_CTX_tag_length EVP_CIPHER_CTX_get_tag_length\n#define EVP_CIPHER_CTX_num EVP_CIPHER_CTX_get_num\n#define EVP_CIPHER_CTX_type EVP_CIPHER_CTX_get_type\n#define EVP_CIPHER_CTX_mode EVP_CIPHER_CTX_get_mode\n

    The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

    const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);\n

    The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

    int EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);\n
    "},{"location":"man3/EVP_EncryptInit/#description","title":"DESCRIPTION","text":"

    The EVP cipher routines are a high-level interface to certain symmetric ciphers.

    The EVP_CIPHER type is a structure for cipher method implementation.

    • EVP_CIPHER_fetch()

      Fetches the cipher implementation for the given algorithm from any provider offering it, within the criteria given by the properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

      The returned value must eventually be freed with EVP_CIPHER_free().

      Fetched EVP_CIPHER structures are reference counted.

    • EVP_CIPHER_up_ref()

      Increments the reference count for an EVP_CIPHER structure.

    • EVP_CIPHER_free()

      Decrements the reference count for the fetched EVP_CIPHER structure. If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

    • EVP_CIPHER_CTX_new()

      Allocates and returns a cipher context.

    • EVP_CIPHER_CTX_free()

      Clears all information from a cipher context and frees any allocated memory associated with it, including ctx itself. This function should be called after all operations using a cipher are complete so sensitive information does not remain in memory. If the argument is NULL, nothing is done.

    • EVP_CIPHER_CTX_dup()

      Can be used to duplicate the cipher state from in. This is useful to avoid multiple EVP_CIPHER_fetch() calls or if large amounts of data are to be fed which only differ in the last few bytes.

    • EVP_CIPHER_CTX_copy()

      Can be used to copy the cipher state from in to out.

    • EVP_CIPHER_CTX_ctrl()

      This is a legacy method. EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() is the mechanism that should be used to set and get parameters that are used by providers.

      Performs cipher-specific control actions on context ctx. The control command is indicated in cmd and any additional arguments in p1 and p2. EVP_CIPHER_CTX_ctrl() must be called after EVP_CipherInit_ex2(). Other restrictions may apply depending on the control type and cipher implementation.

      If this function happens to be used with a fetched EVP_CIPHER, it will translate the controls that are known to OpenSSL into OSSL_PARAM(3) parameters with keys defined by OpenSSL and call EVP_CIPHER_CTX_get_params() or EVP_CIPHER_CTX_set_params() as is appropriate for each control command.

      See \"CONTROLS\" below for more information, including what translations are being done.

    • EVP_CIPHER_get_params()

      Retrieves the requested list of algorithm params from a CIPHER cipher. See \"PARAMETERS\" below for more information.

    • EVP_CIPHER_CTX_get_params()

      Retrieves the requested list of params from CIPHER context ctx. See \"PARAMETERS\" below for more information.

    • EVP_CIPHER_CTX_set_params()

      Sets the list of params into a CIPHER context ctx. See \"PARAMETERS\" below for more information.

    • EVP_CIPHER_gettable_params()

      Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_CIPHER_get_params().

    • EVP_CIPHER_gettable_ctx_params() and EVP_CIPHER_CTX_gettable_params()

      Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_CIPHER_CTX_get_params(). EVP_CIPHER_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_CIPHER_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

    • EVP_CIPHER_settable_ctx_params() and EVP_CIPHER_CTX_settable_params()

      Get a constant OSSL_PARAM(3) array that describes the settable parameters that can be used with EVP_CIPHER_CTX_set_params(). EVP_CIPHER_settable_ctx_params() returns the parameters that can be set from the algorithm, whereas EVP_CIPHER_CTX_settable_params() returns the parameters that can be set in the context's current state.

    • EVP_EncryptInit_ex2()

      Sets up cipher context ctx for encryption with cipher type. type is typically supplied by calling EVP_CIPHER_fetch(). type may also be set using legacy functions such as EVP_aes_256_cbc(), but this is not recommended for new applications. key is the symmetric key to use and iv is the IV to use (if necessary), the actual number of bytes used for the key and IV depends on the cipher. The parameters params will be set on the context after initialisation. It is possible to set all parameters to NULL except type in an initial call and supply the remaining parameters in subsequent calls, all of which have type set to NULL. This is done when the default cipher parameters are not appropriate. For EVP_CIPH_GCM_MODE the IV will be generated internally if it is not specified.

    • EVP_EncryptInit_ex()

      This legacy function is similar to EVP_EncryptInit_ex2() when impl is NULL. The implementation of the type from the impl engine will be used if it exists.

    • EVP_EncryptUpdate()

      Encrypts inl bytes from the buffer in and writes the encrypted version to out. The pointers out and in may point to the same location, in which case the encryption will be done in-place. If out and in point to different locations, the two buffers must be disjoint, otherwise the operation might fail or the outcome might be undefined.

      This function can be called multiple times to encrypt successive blocks of data. The amount of data written depends on the block alignment of the encrypted data. For most ciphers and modes, the amount of data written can be anything from zero bytes to (inl + cipher_block_size - 1) bytes. For wrap cipher modes, the amount of data written can be anything from zero bytes to (inl + cipher_block_size) bytes. For stream ciphers, the amount of data written can be anything from zero bytes to inl bytes. Thus, the buffer pointed to by out must contain sufficient room for the operation being performed. The actual number of bytes written is placed in outl.

      If padding is enabled (the default) then EVP_EncryptFinal_ex() encrypts the \"final\" data, that is any data that remains in a partial block. It uses standard block padding (aka PKCS padding) as described in the NOTES section, below. The encrypted final data is written to out which should have sufficient space for one cipher block. The number of bytes written is placed in outl. After this function is called the encryption operation is finished and no further calls to EVP_EncryptUpdate() should be made.

      If padding is disabled then EVP_EncryptFinal_ex() will not encrypt any more data and it will return an error if any data remains in a partial block: that is if the total data length is not a multiple of the block size.

    • EVP_DecryptInit_ex2(), EVP_DecryptInit_ex(), EVP_DecryptUpdate() and EVP_DecryptFinal_ex()

      These functions are the corresponding decryption operations. EVP_DecryptFinal() will return an error code if padding is enabled and the final block is not correctly formatted. The parameters and restrictions are identical to the encryption operations except that if padding is enabled the decrypted data buffer out passed to EVP_DecryptUpdate() should have sufficient room for (inl + cipher_block_size) bytes unless the cipher block size is 1 in which case inl bytes is sufficient.

    • EVP_CipherInit_ex2(), EVP_CipherInit_ex(), EVP_CipherUpdate() and EVP_CipherFinal_ex()

      These functions can be used for decryption or encryption. The operation performed depends on the value of the enc parameter. It should be set to 1 for encryption, 0 for decryption and -1 to leave the value unchanged (the actual value of 'enc' being supplied in a previous call).

    • EVP_CIPHER_CTX_reset()

      Clears all information from a cipher context and free up any allocated memory associated with it, except the ctx itself. This function should be called anytime ctx is reused by another EVP_CipherInit() / EVP_CipherUpdate() / EVP_CipherFinal() series of calls.

    • EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit()

      Behave in a similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex() and EVP_CipherInit_ex() except if the type is not a fetched cipher they use the default implementation of the type.

    • EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal()

      Identical to EVP_EncryptFinal_ex(), EVP_DecryptFinal_ex() and EVP_CipherFinal_ex(). In previous releases they also cleaned up the ctx, but this is no longer done and EVP_CIPHER_CTX_cleanup() must be called to free any context resources.

    • EVP_Cipher()

      Encrypts or decrypts a maximum inl amount of bytes from in and leaves the result in out.

      For legacy ciphers - If the cipher doesn't have the flag EVP_CIPH_FLAG_CUSTOM_CIPHER set, then inl must be a multiple of EVP_CIPHER_get_block_size(). If it isn't, the result is undefined. If the cipher has that flag set, then inl can be any size.

      Due to the constraints of the API contract of this function it shouldn't be used in applications, please consider using EVP_CipherUpdate() and EVP_CipherFinal_ex() instead.

    • EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj()

      Returns an EVP_CIPHER structure when passed a cipher name, a cipher NID or an ASN1_OBJECT structure respectively.

      EVP_get_cipherbyname() will return NULL for algorithms such as \"AES-128-SIV\", \"AES-128-CBC-CTS\" and \"CAMELLIA-128-CBC-CTS\" which were previously only accessible via low level interfaces.

      The EVP_get_cipherbyname() function is present for backwards compatibility with OpenSSL prior to version 3 and is different to the EVP_CIPHER_fetch() function since it does not attempt to \"fetch\" an implementation of the cipher. Additionally, it only knows about ciphers that are built-in to OpenSSL and have an associated NID. Similarly EVP_get_cipherbynid() and EVP_get_cipherbyobj() also return objects without an associated implementation.

      When the cipher objects returned by these functions are used (such as in a call to EVP_EncryptInit_ex()) an implementation of the cipher will be implicitly fetched from the loaded providers. This fetch could fail if no suitable implementation is available. Use EVP_CIPHER_fetch() instead to explicitly fetch the algorithm and an associated implementation from a provider.

      See \"ALGORITHM FETCHING\" in crypto(7) for more information about fetching.

      The cipher objects returned from these functions do not need to be freed with EVP_CIPHER_free().

    • EVP_CIPHER_get_nid() and EVP_CIPHER_CTX_get_nid()

      Return the NID of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX structure. The actual NID value is an internal value which may not have a corresponding OBJECT IDENTIFIER.

    • EVP_CIPHER_CTX_set_flags(), EVP_CIPHER_CTX_clear_flags() and EVP_CIPHER_CTX_test_flags()

      Sets, clears and tests ctx flags. See \"FLAGS\" below for more information.

      For provided ciphers EVP_CIPHER_CTX_set_flags() should be called only after the fetched cipher has been assigned to the ctx. It is recommended to use \"PARAMETERS\" instead.

    • EVP_CIPHER_CTX_set_padding()

      Enables or disables padding. This function should be called after the context is set up for encryption or decryption with EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() or EVP_CipherInit_ex2(). By default encryption operations are padded using standard block padding and the padding is checked and removed when decrypting. If the pad parameter is zero then no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of the block size or an error will occur.

    • EVP_CIPHER_get_key_length() and EVP_CIPHER_CTX_get_key_length()

      Return the key length of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX structure. The constant EVP_MAX_KEY_LENGTH is the maximum key length for all ciphers. Note: although EVP_CIPHER_get_key_length() is fixed for a given cipher, the value of EVP_CIPHER_CTX_get_key_length() may be different for variable key length ciphers.

    • EVP_CIPHER_CTX_set_key_length()

      Sets the key length of the cipher context. If the cipher is a fixed length cipher then attempting to set the key length to any value other than the fixed value is an error.

    • EVP_CIPHER_get_iv_length() and EVP_CIPHER_CTX_get_iv_length()

      Return the IV length of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX. It will return zero if the cipher does not use an IV. The constant EVP_MAX_IV_LENGTH is the maximum IV length for all ciphers.

    • EVP_CIPHER_CTX_get_tag_length()

      Returns the tag length of an AEAD cipher when passed a EVP_CIPHER_CTX. It will return zero if the cipher does not support a tag. It returns a default value if the tag length has not been set.

    • EVP_CIPHER_get_block_size() and EVP_CIPHER_CTX_get_block_size()

      Return the block size of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX structure. The constant EVP_MAX_BLOCK_LENGTH is also the maximum block length for all ciphers.

    • EVP_CIPHER_get_type() and EVP_CIPHER_CTX_get_type()

      Return the type of the passed cipher or context. This \"type\" is the actual NID of the cipher OBJECT IDENTIFIER and as such it ignores the cipher parameters (40 bit RC2 and 128 bit RC2 have the same NID). If the cipher does not have an object identifier or does not have ASN1 support this function will return NID_undef.

    • EVP_CIPHER_is_a()

      Returns 1 if cipher is an implementation of an algorithm that's identifiable with name, otherwise 0. If cipher is a legacy cipher (it's the return value from the likes of EVP_aes128() rather than the result of an EVP_CIPHER_fetch()), only cipher names registered with the default library context (see OSSL_LIB_CTX(3)) will be considered.

    • EVP_CIPHER_get0_name() and EVP_CIPHER_CTX_get0_name()

      Return the name of the passed cipher or context. For fetched ciphers with multiple names, only one of them is returned. See also EVP_CIPHER_names_do_all().

    • EVP_CIPHER_names_do_all()

      Traverses all names for the cipher, and calls fn with each name and data. This is only useful with fetched EVP_CIPHERs.

    • EVP_CIPHER_get0_description()

      Returns a description of the cipher, meant for display and human consumption. The description is at the discretion of the cipher implementation.

    • EVP_CIPHER_get0_provider()

      Returns an OSSL_PROVIDER pointer to the provider that implements the given EVP_CIPHER.

    • EVP_CIPHER_CTX_get0_cipher()

      Returns the EVP_CIPHER structure when passed an EVP_CIPHER_CTX structure. EVP_CIPHER_CTX_get1_cipher() is the same except the ownership is passed to the caller.

    • EVP_CIPHER_get_mode() and EVP_CIPHER_CTX_get_mode()

      Return the block cipher mode: EVP_CIPH_ECB_MODE, EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE, EVP_CIPH_OFB_MODE, EVP_CIPH_CTR_MODE, EVP_CIPH_GCM_MODE, EVP_CIPH_CCM_MODE, EVP_CIPH_XTS_MODE, EVP_CIPH_WRAP_MODE, EVP_CIPH_OCB_MODE or EVP_CIPH_SIV_MODE. If the cipher is a stream cipher then EVP_CIPH_STREAM_CIPHER is returned.

    • EVP_CIPHER_get_flags()

      Returns any flags associated with the cipher. See \"FLAGS\" for a list of currently defined flags.

    • EVP_CIPHER_CTX_get_num() and EVP_CIPHER_CTX_set_num()

      Gets or sets the cipher specific \"num\" parameter for the associated ctx. Built-in ciphers typically use this to track how much of the current underlying block has been \"used\" already.

    • EVP_CIPHER_CTX_is_encrypting()

      Reports whether the ctx is being used for encryption or decryption.

    • EVP_CIPHER_CTX_flags()

      A deprecated macro calling EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx)). Do not use.

    • EVP_CIPHER_param_to_asn1()

      Sets the AlgorithmIdentifier \"parameter\" based on the passed cipher. This will typically include any parameters and an IV. The cipher IV (if any) must be set when this call is made. This call should be made before the cipher is actually \"used\" (before any EVP_EncryptUpdate(), EVP_DecryptUpdate() calls for example). This function may fail if the cipher does not have any ASN1 support.

    • EVP_CIPHER_asn1_to_param()

      Sets the cipher parameters based on an ASN1 AlgorithmIdentifier \"parameter\". The precise effect depends on the cipher. In the case of RC2, for example, it will set the IV and effective key length. This function should be called after the base cipher type is set but before the key is set. For example EVP_CipherInit() will be called with the IV and key set to NULL, EVP_CIPHER_asn1_to_param() will be called and finally EVP_CipherInit() again with all parameters except the key set to NULL. It is possible for this function to fail if the cipher does not have any ASN1 support or the parameters cannot be set (for example the RC2 effective key length is not supported.

    • EVP_CIPHER_CTX_rand_key()

      Generates a random key of the appropriate length based on the cipher context. The EVP_CIPHER can provide its own random key generation routine to support keys of a specific form. key must point to a buffer at least as big as the value returned by EVP_CIPHER_CTX_get_key_length().

    • EVP_CIPHER_do_all_provided()

      Traverses all ciphers implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

    "},{"location":"man3/EVP_EncryptInit/#parameters","title":"PARAMETERS","text":"

    See OSSL_PARAM(3) for information about passing parameters.

    "},{"location":"man3/EVP_EncryptInit/#gettable-evp_cipher-parameters","title":"Gettable EVP_CIPHER parameters","text":"

    When EVP_CIPHER_fetch() is called it internally calls EVP_CIPHER_get_params() and caches the results.

    EVP_CIPHER_get_params() can be used with the following OSSL_PARAM(3) keys:

    • \"mode\" (OSSL_CIPHER_PARAM_MODE) <unsigned integer>

      Gets the mode for the associated cipher algorithm cipher. See \"EVP_CIPHER_get_mode() and EVP_CIPHER_CTX_get_mode()\" for a list of valid modes. Use EVP_CIPHER_get_mode() to retrieve the cached value.

    • \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN) <unsigned integer>

      Gets the key length for the associated cipher algorithm cipher. Use EVP_CIPHER_get_key_length() to retrieve the cached value.

    • \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN) <unsigned integer>

      Gets the IV length for the associated cipher algorithm cipher. Use EVP_CIPHER_get_iv_length() to retrieve the cached value.

    • \"blocksize\" (OSSL_CIPHER_PARAM_BLOCK_SIZE) <unsigned integer>

      Gets the block size for the associated cipher algorithm cipher. The block size should be 1 for stream ciphers. Note that the block size for a cipher may be different to the block size for the underlying encryption/decryption primitive. For example AES in CTR mode has a block size of 1 (because it operates like a stream cipher), even though AES has a block size of 16. Use EVP_CIPHER_get_block_size() to retrieve the cached value.

    • \"aead\" (OSSL_CIPHER_PARAM_AEAD) <integer>

      Gets 1 if this is an AEAD cipher algorithm, otherwise it gets 0. Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) to retrieve the cached value.

    • \"custom-iv\" (OSSL_CIPHER_PARAM_CUSTOM_IV) <integer>

      Gets 1 if the cipher algorithm cipher has a custom IV, otherwise it gets 0. Storing and initializing the IV is left entirely to the implementation, if a custom IV is used. Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_CUSTOM_IV) to retrieve the cached value.

    • \"cts\" (OSSL_CIPHER_PARAM_CTS) <integer>

      Gets 1 if the cipher algorithm cipher uses ciphertext stealing, otherwise it gets 0. This is currently used to indicate that the cipher is a one shot that only allows a single call to EVP_CipherUpdate(). Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_CTS) to retrieve the cached value.

    • \"tls-multi\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK) <integer>

      Gets 1 if the cipher algorithm cipher supports interleaving of crypto blocks, otherwise it gets 0. The interleaving is an optimization only applicable to certain TLS ciphers. Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK) to retrieve the cached value.

    • \"has-randkey\" (OSSL_CIPHER_PARAM_HAS_RANDKEY) <integer>

      Gets 1 if the cipher algorithm cipher supports the gettable EVP_CIPHER_CTX parameter OSSL_CIPHER_PARAM_RANDOM_KEY. Only DES and 3DES set this to 1, all other OpenSSL ciphers return 0.

    "},{"location":"man3/EVP_EncryptInit/#gettable-and-settable-evp_cipher_ctx-parameters","title":"Gettable and Settable EVP_CIPHER_CTX parameters","text":"

    The following OSSL_PARAM(3) keys can be used with both EVP_CIPHER_CTX_get_params() and EVP_CIPHER_CTX_set_params().

    • \"padding\" (OSSL_CIPHER_PARAM_PADDING) <unsigned integer>

      Gets or sets the padding mode for the cipher context ctx. Padding is enabled if the value is 1, and disabled if the value is 0. See also EVP_CIPHER_CTX_set_padding().

    • \"num\" (OSSL_CIPHER_PARAM_NUM) <unsigned integer>

      Gets or sets the cipher specific \"num\" parameter for the cipher context ctx. Built-in ciphers typically use this to track how much of the current underlying block has been \"used\" already. See also EVP_CIPHER_CTX_get_num() and EVP_CIPHER_CTX_set_num().

    • \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN) <unsigned integer>

      Gets or sets the key length for the cipher context ctx. The length of the \"keylen\" parameter should not exceed that of a size_t. See also EVP_CIPHER_CTX_get_key_length() and EVP_CIPHER_CTX_set_key_length().

    • \"tag\" (OSSL_CIPHER_PARAM_AEAD_TAG) <octet string>

      Gets or sets the AEAD tag for the associated cipher context ctx. See \"AEAD Interface\" in EVP_EncryptInit(3).

    • \"keybits\" (OSSL_CIPHER_PARAM_RC2_KEYBITS) <unsigned integer>

      Gets or sets the effective keybits used for a RC2 cipher. The length of the \"keybits\" parameter should not exceed that of a size_t.

    • \"rounds\" (OSSL_CIPHER_PARAM_ROUNDS) <unsigned integer>

      Gets or sets the number of rounds to be used for a cipher. This is used by the RC5 cipher.

    • \"alg_id_param\" (OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS) <octet string>

      Used to pass the DER encoded AlgorithmIdentifier parameter to or from the cipher implementation. Functions like EVP_CIPHER_param_to_asn1(3) and EVP_CIPHER_asn1_to_param(3) use this parameter for any implementation that has the flag EVP_CIPH_FLAG_CUSTOM_ASN1 set.

    • \"cts_mode\" (OSSL_CIPHER_PARAM_CTS_MODE)

      Gets or sets the cipher text stealing mode. For all modes the output size is the same as the input size. The input length must be greater than or equal to the block size. (The block size for AES and CAMELLIA is 16 bytes).

      Valid values for the mode are:

      • \"CS1\"

        The NIST variant of cipher text stealing. For input lengths that are multiples of the block size it is equivalent to using a \"AES-XXX-CBC\" or \"CAMELLIA-XXX-CBC\" cipher otherwise the second last cipher text block is a partial block.

      • \"CS2\"

        For input lengths that are multiples of the block size it is equivalent to using a \"AES-XXX-CBC\" or \"CAMELLIA-XXX-CBC\" cipher, otherwise it is the same as \"CS3\" mode.

      • \"CS3\"

        The Kerberos5 variant of cipher text stealing which always swaps the last cipher text block with the previous block (which may be a partial or full block depending on the input length). If the input length is exactly one full block then this is equivalent to using a \"AES-XXX-CBC\" or \"CAMELLIA-XXX-CBC\" cipher.

      The default is \"CS1\". This is only supported for \"AES-128-CBC-CTS\", \"AES-192-CBC-CTS\", \"AES-256-CBC-CTS\", \"CAMELLIA-128-CBC-CTS\", \"CAMELLIA-192-CBC-CTS\" and \"CAMELLIA-256-CBC-CTS\".

    • \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE) <unsigned integer>

      Sets or gets the number of records being sent in one go for a tls1 multiblock cipher operation (either 4 or 8 records).

    • "},{"location":"man3/EVP_EncryptInit/#gettable-evp_cipher_ctx-parameters","title":"Gettable EVP_CIPHER_CTX parameters","text":"

      The following OSSL_PARAM(3) keys can be used with EVP_CIPHER_CTX_get_params():

      • \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN and <OSSL_CIPHER_PARAM_AEAD_IVLEN) <unsigned integer>

        Gets the IV length for the cipher context ctx. The length of the \"ivlen\" parameter should not exceed that of a size_t. See also EVP_CIPHER_CTX_get_iv_length().

      • \"iv\" (OSSL_CIPHER_PARAM_IV) <octet string OR octet ptr>

        Gets the IV used to initialize the associated cipher context ctx. See also EVP_CIPHER_CTX_get_original_iv().

      • \"updated-iv\" (OSSL_CIPHER_PARAM_UPDATED_IV) <octet string OR octet ptr>

        Gets the updated pseudo-IV state for the associated cipher context, e.g., the previous ciphertext block for CBC mode or the iteratively encrypted IV value for OFB mode. Note that octet pointer access is deprecated and is provided only for backwards compatibility with historical libcrypto APIs. See also EVP_CIPHER_CTX_get_updated_iv().

      • \"randkey\" (OSSL_CIPHER_PARAM_RANDOM_KEY) <octet string>

        Gets an implementation specific randomly generated key for the associated cipher context ctx. This is currently only supported by DES and 3DES (which set the key to odd parity).

      • \"taglen\" (OSSL_CIPHER_PARAM_AEAD_TAGLEN) <unsigned integer>

        Gets the tag length to be used for an AEAD cipher for the associated cipher context ctx. It gets a default value if it has not been set. The length of the \"taglen\" parameter should not exceed that of a size_t. See also EVP_CIPHER_CTX_get_tag_length().

      • \"tlsaadpad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD) <unsigned integer>

        Gets the length of the tag that will be added to a TLS record for the AEAD tag for the associated cipher context ctx. The length of the \"tlsaadpad\" parameter should not exceed that of a size_t.

      • \"tlsivgen\" (OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN) <octet string>

        Gets the invocation field generated for encryption. Can only be called after \"tlsivfixed\" is set. This is only used for GCM mode.

      • \"tls1multi_enclen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN) <unsigned integer>

        Get the total length of the record returned from the \"tls1multi_enc\" operation.

      • \"tls1multi_maxbufsz\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE) <unsigned integer>

        Gets the maximum record length for a TLS1 multiblock cipher operation. The length of the \"tls1multi_maxbufsz\" parameter should not exceed that of a size_t.

      • \"tls1multi_aadpacklen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN) <unsigned integer>

        Gets the result of running the \"tls1multi_aad\" operation.

      • \"tls-mac\" (OSSL_CIPHER_PARAM_TLS_MAC) <octet ptr>

        Used to pass the TLS MAC data.

      "},{"location":"man3/EVP_EncryptInit/#settable-evp_cipher_ctx-parameters","title":"Settable EVP_CIPHER_CTX parameters","text":"

      The following OSSL_PARAM(3) keys can be used with EVP_CIPHER_CTX_set_params():

      • \"mackey\" (OSSL_CIPHER_PARAM_AEAD_MAC_KEY) <octet string>

        Sets the MAC key used by composite AEAD ciphers such as AES-CBC-HMAC-SHA256.

      • \"speed\" (OSSL_CIPHER_PARAM_SPEED) <unsigned integer>

        Sets the speed option for the associated cipher context. This is only supported by AES SIV ciphers which disallow multiple operations by default. Setting \"speed\" to 1 allows another encrypt or decrypt operation to be performed. This is used for performance testing.

      • \"use-bits\" (OSSL_CIPHER_PARAM_USE_BITS) <unsigned integer>

        Determines if the input length inl passed to EVP_EncryptUpdate(), EVP_DecryptUpdate() and EVP_CipherUpdate() is the number of bits or number of bytes. Setting \"use-bits\" to 1 uses bits. The default is in bytes. This is only used for CFB1 ciphers.

        This can be set using EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS).

      • \"tls-version\" (OSSL_CIPHER_PARAM_TLS_VERSION) <integer>

        Sets the TLS version.

      • \"tls-mac-size\" (OSSL_CIPHER_PARAM_TLS_MAC_SIZE) <unsigned integer>

        Set the TLS MAC size.

      • \"tlsaad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD) <octet string>

        Sets TLSv1.2 AAD information for the associated cipher context ctx. TLSv1.2 AAD information is always 13 bytes in length and is as defined for the \"additional_data\" field described in section 6.2.3.3 of RFC5246.

      • \"tlsivfixed\" (OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED) <octet string>

        Sets the fixed portion of an IV for an AEAD cipher used in a TLS record encryption/ decryption for the associated cipher context. TLS record encryption/decryption always occurs \"in place\" so that the input and output buffers are always the same memory location. AEAD IVs in TLSv1.2 consist of an implicit \"fixed\" part and an explicit part that varies with every record. Setting a TLS fixed IV changes a cipher to encrypt/decrypt TLS records. TLS records are encrypted/decrypted using a single OSSL_FUNC_cipher_cipher call per record. For a record decryption the first bytes of the input buffer will be the explicit part of the IV and the final bytes of the input buffer will be the AEAD tag. The length of the explicit part of the IV and the tag length will depend on the cipher in use and will be defined in the RFC for the relevant ciphersuite. In order to allow for \"in place\" decryption the plaintext output should be written to the same location in the output buffer that the ciphertext payload was read from, i.e. immediately after the explicit IV.

        When encrypting a record the first bytes of the input buffer should be empty to allow space for the explicit IV, as will the final bytes where the tag will be written. The length of the input buffer will include the length of the explicit IV, the payload, and the tag bytes. The cipher implementation should generate the explicit IV and write it to the beginning of the output buffer, do \"in place\" encryption of the payload and write that to the output buffer, and finally add the tag onto the end of the output buffer.

        Whether encrypting or decrypting the value written to *outl in the OSSL_FUNC_cipher_cipher call should be the length of the payload excluding the explicit IV length and the tag length.

      • \"tlsivinv\" (OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV) <octet string>

        Sets the invocation field used for decryption. Can only be called after \"tlsivfixed\" is set. This is only used for GCM mode.

      • \"tls1multi_enc\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC) <octet string>

        Triggers a multiblock TLS1 encrypt operation for a TLS1 aware cipher that supports sending 4 or 8 records in one go. The cipher performs both the MAC and encrypt stages and constructs the record headers itself. \"tls1multi_enc\" supplies the output buffer for the encrypt operation, \"tls1multi_encin\" & \"tls1multi_interleave\" must also be set in order to supply values to the encrypt operation.

      • \"tls1multi_encin\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN) <octet string>

        Supplies the data to encrypt for a TLS1 multiblock cipher operation.

      • \"tls1multi_maxsndfrag\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT) <unsigned integer>

        Sets the maximum send fragment size for a TLS1 multiblock cipher operation. It must be set before using \"tls1multi_maxbufsz\". The length of the \"tls1multi_maxsndfrag\" parameter should not exceed that of a size_t.

      • \"tls1multi_aad\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD) <octet string>

        Sets the authenticated additional data used by a TLS1 multiblock cipher operation. The supplied data consists of 13 bytes of record data containing: Bytes 0-7: The sequence number of the first record Byte 8: The record type Byte 9-10: The protocol version Byte 11-12: Input length (Always 0)

        \"tls1multi_interleave\" must also be set for this operation.

      "},{"location":"man3/EVP_EncryptInit/#controls","title":"CONTROLS","text":"

      The Mappings from EVP_CIPHER_CTX_ctrl() identifiers to PARAMETERS are listed in the following section. See the \"PARAMETERS\" section for more details.

      EVP_CIPHER_CTX_ctrl() can be used to send the following standard controls:

      • EVP_CTRL_AEAD_SET_IVLEN and EVP_CTRL_GET_IVLEN

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN).

      • EVP_CTRL_AEAD_SET_IV_FIXED

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"tlsivfixed\" (OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED).

      • EVP_CTRL_AEAD_SET_MAC_KEY

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"mackey\" (OSSL_CIPHER_PARAM_AEAD_MAC_KEY).

      • EVP_CTRL_AEAD_SET_TAG and EVP_CTRL_AEAD_GET_TAG

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"tag\" (OSSL_CIPHER_PARAM_AEAD_TAG).

      • EVP_CTRL_CCM_SET_L

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN) with a value of (15 - L)

      • EVP_CTRL_COPY

        There is no OSSL_PARAM mapping for this. Use EVP_CIPHER_CTX_copy() instead.

      • EVP_CTRL_GCM_SET_IV_INV

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"tlsivinv\" (OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV).

      • EVP_CTRL_RAND_KEY

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"randkey\" (OSSL_CIPHER_PARAM_RANDOM_KEY).

      • EVP_CTRL_SET_KEY_LENGTH

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN).

      • EVP_CTRL_SET_RC2_KEY_BITS and EVP_CTRL_GET_RC2_KEY_BITS

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"keybits\" (OSSL_CIPHER_PARAM_RC2_KEYBITS).

      • EVP_CTRL_SET_RC5_ROUNDS and EVP_CTRL_GET_RC5_ROUNDS

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"rounds\" (OSSL_CIPHER_PARAM_ROUNDS).

      • EVP_CTRL_SET_SPEED

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"speed\" (OSSL_CIPHER_PARAM_SPEED).

      • EVP_CTRL_GCM_IV_GEN

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_get_params() gets called with an OSSL_PARAM(3) item with the key \"tlsivgen\" (OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN).

      • EVP_CTRL_AEAD_TLS1_AAD

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() get called with an OSSL_PARAM(3) item with the key \"tlsaad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD) followed by EVP_CIPHER_CTX_get_params() with a key of \"tlsaadpad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD).

      • EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT followed by EVP_CIPHER_CTX_get_params() with a key of \"tls1multi_maxbufsz\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE).

      • EVP_CTRL_TLS1_1_MULTIBLOCK_AAD

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with OSSL_PARAM(3) items with the keys \"tls1multi_aad\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD) and \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE) followed by EVP_CIPHER_CTX_get_params() with keys of \"tls1multi_aadpacklen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN) and \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE).

      • EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT

        When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with OSSL_PARAM(3) items with the keys \"tls1multi_enc\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC), \"tls1multi_encin\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN) and \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE), followed by EVP_CIPHER_CTX_get_params() with a key of \"tls1multi_enclen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN).

      "},{"location":"man3/EVP_EncryptInit/#flags","title":"FLAGS","text":"

      EVP_CIPHER_CTX_set_flags(), EVP_CIPHER_CTX_clear_flags() and EVP_CIPHER_CTX_test_flags(). can be used to manipulate and test these EVP_CIPHER_CTX flags:

      • EVP_CIPH_NO_PADDING

        Used by EVP_CIPHER_CTX_set_padding().

        See also \"Gettable and Settable EVP_CIPHER_CTX parameters\" \"padding\"

      • EVP_CIPH_FLAG_LENGTH_BITS

        See \"Settable EVP_CIPHER_CTX parameters\" \"use-bits\".

      • EVP_CIPHER_CTX_FLAG_WRAP_ALLOW

        Used for Legacy purposes only. This flag needed to be set to indicate the cipher handled wrapping.

      EVP_CIPHER_flags() uses the following flags that have mappings to \"Gettable EVP_CIPHER parameters\":

      • EVP_CIPH_FLAG_AEAD_CIPHER

        See \"Gettable EVP_CIPHER parameters\" \"aead\".

      • EVP_CIPH_CUSTOM_IV

        See \"Gettable EVP_CIPHER parameters\" \"custom-iv\".

      • EVP_CIPH_FLAG_CTS

        See \"Gettable EVP_CIPHER parameters\" \"cts\".

      • EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK;

        See \"Gettable EVP_CIPHER parameters\" \"tls-multi\".

      • EVP_CIPH_RAND_KEY

        See \"Gettable EVP_CIPHER parameters\" \"has-randkey\".

      EVP_CIPHER_flags() uses the following flags for legacy purposes only:

      • EVP_CIPH_VARIABLE_LENGTH
      • EVP_CIPH_FLAG_CUSTOM_CIPHER
      • EVP_CIPH_ALWAYS_CALL_INIT
      • EVP_CIPH_CTRL_INIT
      • EVP_CIPH_CUSTOM_KEY_LENGTH
      • EVP_CIPH_CUSTOM_COPY
      • EVP_CIPH_FLAG_DEFAULT_ASN1

        See EVP_CIPHER_meth_set_flags(3) for further information related to the above flags.

      "},{"location":"man3/EVP_EncryptInit/#return-values","title":"RETURN VALUES","text":"

      EVP_CIPHER_fetch() returns a pointer to a EVP_CIPHER for success and NULL for failure.

      EVP_CIPHER_up_ref() returns 1 for success or 0 otherwise.

      EVP_CIPHER_CTX_new() returns a pointer to a newly created EVP_CIPHER_CTX for success and NULL for failure.

      EVP_CIPHER_CTX_dup() returns a new EVP_CIPHER_CTX if successful or NULL on failure.

      EVP_CIPHER_CTX_copy() returns 1 if successful or 0 for failure.

      EVP_EncryptInit_ex2(), EVP_EncryptUpdate() and EVP_EncryptFinal_ex() return 1 for success and 0 for failure.

      EVP_DecryptInit_ex2() and EVP_DecryptUpdate() return 1 for success and 0 for failure. EVP_DecryptFinal_ex() returns 0 if the decrypt failed or 1 for success.

      EVP_CipherInit_ex2() and EVP_CipherUpdate() return 1 for success and 0 for failure. EVP_CipherFinal_ex() returns 0 for a decryption failure or 1 for success.

      EVP_Cipher() returns 1 on success or 0 on failure, if the flag EVP_CIPH_FLAG_CUSTOM_CIPHER is not set for the cipher. EVP_Cipher() returns the number of bytes written to out for encryption / decryption, or the number of bytes authenticated in a call specifying AAD for an AEAD cipher, if the flag EVP_CIPH_FLAG_CUSTOM_CIPHER is set for the cipher.

      EVP_CIPHER_CTX_reset() returns 1 for success and 0 for failure.

      EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() return an EVP_CIPHER structure or NULL on error.

      EVP_CIPHER_get_nid() and EVP_CIPHER_CTX_get_nid() return a NID.

      EVP_CIPHER_get_block_size() and EVP_CIPHER_CTX_get_block_size() return the block size.

      EVP_CIPHER_get_key_length() and EVP_CIPHER_CTX_get_key_length() return the key length.

      EVP_CIPHER_CTX_set_padding() always returns 1.

      EVP_CIPHER_get_iv_length() and EVP_CIPHER_CTX_get_iv_length() return the IV length or zero if the cipher does not use an IV.

      EVP_CIPHER_CTX_get_tag_length() return the tag length or zero if the cipher does not use a tag.

      EVP_CIPHER_get_type() and EVP_CIPHER_CTX_get_type() return the NID of the cipher's OBJECT IDENTIFIER or NID_undef if it has no defined OBJECT IDENTIFIER.

      EVP_CIPHER_CTX_cipher() returns an EVP_CIPHER structure.

      EVP_CIPHER_CTX_get_num() returns a nonnegative num value or EVP_CTRL_RET_UNSUPPORTED if the implementation does not support the call or on any other error.

      EVP_CIPHER_CTX_set_num() returns 1 on success and 0 if the implementation does not support the call or on any other error.

      EVP_CIPHER_CTX_is_encrypting() returns 1 if the ctx is set up for encryption 0 otherwise.

      EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return greater than zero for success and zero or a negative number on failure.

      EVP_CIPHER_CTX_rand_key() returns 1 for success and zero or a negative number for failure.

      EVP_CIPHER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

      "},{"location":"man3/EVP_EncryptInit/#cipher-listing","title":"CIPHER LISTING","text":"

      All algorithms have a fixed key length unless otherwise stated.

      Refer to \"SEE ALSO\" for the full list of ciphers available through the EVP interface.

      • EVP_enc_null()

        Null cipher: does nothing.

      "},{"location":"man3/EVP_EncryptInit/#aead-interface","title":"AEAD INTERFACE","text":"

      The EVP interface for Authenticated Encryption with Associated Data (AEAD) modes are subtly altered and several additional ctrl operations are supported depending on the mode specified.

      To specify additional authenticated data (AAD), a call to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made with the output parameter out set to NULL. In this case, on success, the parameter outl is set to the number of bytes authenticated.

      When decrypting, the return value of EVP_DecryptFinal() or EVP_CipherFinal() indicates whether the operation was successful. If it does not indicate success, the authentication operation has failed and any output data MUST NOT be used as it is corrupted.

      "},{"location":"man3/EVP_EncryptInit/#gcm-and-ocb-modes","title":"GCM and OCB Modes","text":"

      The following _ctrl_s are supported in GCM and OCB modes.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, ivlen, NULL)

        Sets the IV length. This call can only be made before specifying an IV. If not called a default IV length is used.

        For GCM AES and OCB AES the default is 12 (i.e. 96 bits). For OCB mode the maximum is 15.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag)

        Writes taglen bytes of the tag value to the buffer indicated by tag. This call can only be made when encrypting data and after all data has been processed (e.g. after an EVP_EncryptFinal() call).

        For OCB, taglen must either be 16 or the value previously set via EVP_CTRL_AEAD_SET_TAG.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag)

        When decrypting, this call sets the expected tag to taglen bytes from tag. taglen must be between 1 and 16 inclusive. The tag must be set prior to any call to EVP_DecryptFinal() or EVP_DecryptFinal_ex().

        For GCM, this call is only valid when decrypting data.

        For OCB, this call is valid when decrypting data to set the expected tag, and when encrypting to set the desired tag length.

        In OCB mode, calling this when encrypting with tag set to NULL sets the tag length. The tag length can only be set before specifying an IV. If this is not called prior to setting the IV during encryption, then a default tag length is used.

        For OCB AES, the default tag length is 16 (i.e. 128 bits). It is also the maximum tag length for OCB.

      "},{"location":"man3/EVP_EncryptInit/#ccm-mode","title":"CCM Mode","text":"

      The EVP interface for CCM mode is similar to that of the GCM mode but with a few additional requirements and different ctrl values.

      For CCM mode, the total plaintext or ciphertext length MUST be passed to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() with the output and input parameters (in and out) set to NULL and the length passed in the inl parameter.

      The following _ctrl_s are supported in CCM mode.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag)

        This call is made to set the expected CCM tag value when decrypting or the length of the tag (with the tag parameter set to NULL) when encrypting. The tag length is often referred to as M. If not set a default value is used (12 for AES). When decrypting, the tag needs to be set before passing in data to be decrypted, but as in GCM and OCB mode, it can be set after passing additional authenticated data (see \"AEAD INTERFACE\").

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_L, ivlen, NULL)

        Sets the CCM L value. If not set a default is used (8 for AES).

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, ivlen, NULL)

        Sets the CCM nonce (IV) length. This call can only be made before specifying a nonce value. The nonce length is given by 15 - L so it is 7 by default for AES.

      "},{"location":"man3/EVP_EncryptInit/#siv-mode","title":"SIV Mode","text":"

      For SIV mode ciphers the behaviour of the EVP interface is subtly altered and several additional ctrl operations are supported.

      To specify any additional authenticated data (AAD) and/or a Nonce, a call to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made with the output parameter out set to NULL.

      RFC5297 states that the Nonce is the last piece of AAD before the actual encrypt/decrypt takes place. The API does not differentiate the Nonce from other AAD.

      When decrypting the return value of EVP_DecryptFinal() or EVP_CipherFinal() indicates if the operation was successful. If it does not indicate success the authentication operation has failed and any output data MUST NOT be used as it is corrupted.

      The API does not store the the SIV (Synthetic Initialization Vector) in the cipher text. Instead, it is stored as the tag within the EVP_CIPHER_CTX. The SIV must be retrieved from the context after encryption, and set into the context before decryption.

      This differs from RFC5297 in that the cipher output from encryption, and the cipher input to decryption, does not contain the SIV. This also means that the plain text and cipher text lengths are identical.

      The following ctrls are supported in SIV mode, and are used to get and set the Synthetic Initialization Vector:

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag);

        Writes taglen bytes of the tag value (the Synthetic Initialization Vector) to the buffer indicated by tag. This call can only be made when encrypting data and after all data has been processed (e.g. after an EVP_EncryptFinal() call). For SIV mode the taglen must be 16.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag);

        Sets the expected tag (the Synthetic Initialization Vector) to taglen bytes from tag. This call is only legal when decrypting data and must be made before any data is processed (e.g. before any EVP_DecryptUpdate() calls). For SIV mode the taglen must be 16.

      SIV mode makes two passes over the input data, thus, only one call to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made with out set to a non-NULL value. A call to EVP_DecryptFinal() or EVP_CipherFinal() is not required, but will indicate if the update operation succeeded.

      "},{"location":"man3/EVP_EncryptInit/#chacha20-poly1305","title":"ChaCha20-Poly1305","text":"

      The following _ctrl_s are supported for the ChaCha20-Poly1305 AEAD algorithm.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, ivlen, NULL)

        Sets the nonce length. This call is now redundant since the only valid value is the default length of 12 (i.e. 96 bits). Prior to OpenSSL 3.0 a nonce of less than 12 bytes could be used to automatically pad the iv with leading 0 bytes to make it 12 bytes in length.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag)

        Writes taglen bytes of the tag value to the buffer indicated by tag. This call can only be made when encrypting data and after all data has been processed (e.g. after an EVP_EncryptFinal() call).

        taglen specified here must be 16 (POLY1305_BLOCK_SIZE, i.e. 128-bits) or less.

      • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag)

        Sets the expected tag to taglen bytes from tag. The tag length can only be set before specifying an IV. taglen must be between 1 and 16 (POLY1305_BLOCK_SIZE) inclusive. This call is only valid when decrypting data.

      "},{"location":"man3/EVP_EncryptInit/#notes","title":"NOTES","text":"

      Where possible the EVP interface to symmetric ciphers should be used in preference to the low-level interfaces. This is because the code then becomes transparent to the cipher used and much more flexible. Additionally, the EVP interface will ensure the use of platform specific cryptographic acceleration such as AES-NI (the low-level interfaces do not provide the guarantee).

      PKCS padding works by adding n padding bytes of value n to make the total length of the encrypted data a multiple of the block size. Padding is always added so if the data is already a multiple of the block size n will equal the block size. For example if the block size is 8 and 11 bytes are to be encrypted then 5 padding bytes of value 5 will be added.

      When decrypting the final block is checked to see if it has the correct form.

      Although the decryption operation can produce an error if padding is enabled, it is not a strong test that the input data or key is correct. A random block has better than 1 in 256 chance of being of the correct format and problems with the input data earlier on will not produce a final decrypt error.

      If padding is disabled then the decryption operation will always succeed if the total amount of data decrypted is a multiple of the block size.

      The functions EVP_EncryptInit(), EVP_EncryptInit_ex(), EVP_EncryptFinal(), EVP_DecryptInit(), EVP_DecryptInit_ex(), EVP_CipherInit(), EVP_CipherInit_ex() and EVP_CipherFinal() are obsolete but are retained for compatibility with existing code. New code should use EVP_EncryptInit_ex2(), EVP_EncryptFinal_ex(), EVP_DecryptInit_ex2(), EVP_DecryptFinal_ex(), EVP_CipherInit_ex2() and EVP_CipherFinal_ex() because they can reuse an existing context without allocating and freeing it up on each call.

      There are some differences between functions EVP_CipherInit() and EVP_CipherInit_ex(), significant in some circumstances. EVP_CipherInit() fills the passed context object with zeros. As a consequence, EVP_CipherInit() does not allow step-by-step initialization of the ctx when the key and iv are passed in separate calls. It also means that the flags set for the CTX are removed, and it is especially important for the EVP_CIPHER_CTX_FLAG_WRAP_ALLOW flag treated specially in EVP_CipherInit_ex().

      Ignoring failure returns of the EVP_CIPHER_CTX initialization functions can lead to subsequent undefined behavior when calling the functions that update or finalize the context. The only valid calls on the EVP_CIPHER_CTX when initialization fails are calls that attempt another initialization of the context or release the context.

      EVP_get_cipherbynid(), and EVP_get_cipherbyobj() are implemented as macros.

      "},{"location":"man3/EVP_EncryptInit/#bugs","title":"BUGS","text":"

      EVP_MAX_KEY_LENGTH and EVP_MAX_IV_LENGTH only refer to the internal ciphers with default key lengths. If custom ciphers exceed these values the results are unpredictable. This is because it has become standard practice to define a generic key as a fixed unsigned char array containing EVP_MAX_KEY_LENGTH bytes.

      The ASN1 code is incomplete (and sometimes inaccurate) it has only been tested for certain common S/MIME ciphers (RC2, DES, triple DES) in CBC mode.

      "},{"location":"man3/EVP_EncryptInit/#examples","title":"EXAMPLES","text":"

      Encrypt a string using IDEA:

      int do_crypt(char *outfile)\n{\n    unsigned char outbuf[1024];\n    int outlen, tmplen;\n    /*\n     * Bogus key and IV: we'd normally set these from\n     * another source.\n     */\n    unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};\n    unsigned char iv[] = {1,2,3,4,5,6,7,8};\n    char intext[] = \"Some Crypto Text\";\n    EVP_CIPHER_CTX *ctx;\n    FILE *out;\n\n    ctx = EVP_CIPHER_CTX_new();\n    if (!EVP_EncryptInit_ex2(ctx, EVP_idea_cbc(), key, iv, NULL)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n\n    if (!EVP_EncryptUpdate(ctx, outbuf, &outlen, intext, strlen(intext))) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    /*\n     * Buffer passed to EVP_EncryptFinal() must be after data just\n     * encrypted to avoid overwriting it.\n     */\n    if (!EVP_EncryptFinal_ex(ctx, outbuf + outlen, &tmplen)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    outlen += tmplen;\n    EVP_CIPHER_CTX_free(ctx);\n    /*\n     * Need binary mode for fopen because encrypted data is\n     * binary data. Also cannot use strlen() on it because\n     * it won't be NUL terminated and may contain embedded\n     * NULs.\n     */\n    out = fopen(outfile, \"wb\");\n    if (out == NULL) {\n        /* Error */\n        return 0;\n    }\n    fwrite(outbuf, 1, outlen, out);\n    fclose(out);\n    return 1;\n}\n

      The ciphertext from the above example can be decrypted using the openssl utility with the command line (shown on two lines for clarity):

      openssl idea -d \\\n    -K 000102030405060708090A0B0C0D0E0F -iv 0102030405060708 <filename\n

      General encryption and decryption function example using FILE I/O and AES128 with a 128-bit key:

      int do_crypt(FILE *in, FILE *out, int do_encrypt)\n{\n    /* Allow enough space in output buffer for additional block */\n    unsigned char inbuf[1024], outbuf[1024 + EVP_MAX_BLOCK_LENGTH];\n    int inlen, outlen;\n    EVP_CIPHER_CTX *ctx;\n    /*\n     * Bogus key and IV: we'd normally set these from\n     * another source.\n     */\n    unsigned char key[] = \"0123456789abcdeF\";\n    unsigned char iv[] = \"1234567887654321\";\n\n    /* Don't set key or IV right away; we want to check lengths */\n    ctx = EVP_CIPHER_CTX_new();\n    if (!EVP_CipherInit_ex2(ctx, EVP_aes_128_cbc(), NULL, NULL,\n                            do_encrypt, NULL)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    OPENSSL_assert(EVP_CIPHER_CTX_get_key_length(ctx) == 16);\n    OPENSSL_assert(EVP_CIPHER_CTX_get_iv_length(ctx) == 16);\n\n    /* Now we can set key and IV */\n    if (!EVP_CipherInit_ex2(ctx, NULL, key, iv, do_encrypt, NULL)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n\n    for (;;) {\n        inlen = fread(inbuf, 1, 1024, in);\n        if (inlen <= 0)\n            break;\n        if (!EVP_CipherUpdate(ctx, outbuf, &outlen, inbuf, inlen)) {\n            /* Error */\n            EVP_CIPHER_CTX_free(ctx);\n            return 0;\n        }\n        fwrite(outbuf, 1, outlen, out);\n    }\n    if (!EVP_CipherFinal_ex(ctx, outbuf, &outlen)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    fwrite(outbuf, 1, outlen, out);\n\n    EVP_CIPHER_CTX_free(ctx);\n    return 1;\n}\n

      Encryption using AES-CBC with a 256-bit key with \"CS1\" ciphertext stealing.

      int encrypt(const unsigned char *key, const unsigned char *iv,\n            const unsigned char *msg, size_t msg_len, unsigned char *out)\n{\n   /*\n    * This assumes that key size is 32 bytes and the iv is 16 bytes.\n    * For ciphertext stealing mode the length of the ciphertext \"out\" will be\n    * the same size as the plaintext size \"msg_len\".\n    * The \"msg_len\" can be any size >= 16.\n    */\n    int ret = 0, encrypt = 1, outlen, len;\n    EVP_CIPHER_CTX *ctx = NULL;\n    EVP_CIPHER *cipher = NULL;\n    OSSL_PARAM params[2];\n\n    ctx = EVP_CIPHER_CTX_new();\n    cipher = EVP_CIPHER_fetch(NULL, \"AES-256-CBC-CTS\", NULL);\n    if (ctx == NULL || cipher == NULL)\n        goto err;\n\n    /*\n     * The default is \"CS1\" so this is not really needed,\n     * but would be needed to set either \"CS2\" or \"CS3\".\n     */\n    params[0] = OSSL_PARAM_construct_utf8_string(OSSL_CIPHER_PARAM_CTS_MODE,\n                                                 \"CS1\", 0);\n    params[1] = OSSL_PARAM_construct_end();\n\n    if (!EVP_CipherInit_ex2(ctx, cipher, key, iv, encrypt, params))\n        goto err;\n\n    /* NOTE: CTS mode does not support multiple calls to EVP_CipherUpdate() */\n    if (!EVP_CipherUpdate(ctx, out, &outlen, msg, msg_len))\n        goto err;\n     if (!EVP_CipherFinal_ex(ctx, out + outlen, &len))\n        goto err;\n    ret = 1;\nerr:\n    EVP_CIPHER_free(cipher);\n    EVP_CIPHER_CTX_free(ctx);\n    return ret;\n}\n
      "},{"location":"man3/EVP_EncryptInit/#see-also","title":"SEE ALSO","text":"

      evp(7), property(7), \"ALGORITHM FETCHING\" in crypto(7), provider-cipher(7), life_cycle-cipher(7)

      Supported ciphers are listed in:

      EVP_aes_128_gcm(3), EVP_aria_128_gcm(3), EVP_bf_cbc(3), EVP_camellia_128_ecb(3), EVP_cast5_cbc(3), EVP_chacha20(3), EVP_des_cbc(3), EVP_desx_cbc(3), EVP_idea_cbc(3), EVP_rc2_cbc(3), EVP_rc4(3), EVP_rc5_32_12_16_cbc(3), EVP_seed_cbc(3), EVP_sm4_cbc(3),

      "},{"location":"man3/EVP_EncryptInit/#history","title":"HISTORY","text":"

      Support for OCB mode was added in OpenSSL 1.1.0.

      EVP_CIPHER_CTX was made opaque in OpenSSL 1.1.0. As a result, EVP_CIPHER_CTX_reset() appeared and EVP_CIPHER_CTX_cleanup() disappeared. EVP_CIPHER_CTX_init() remains as an alias for EVP_CIPHER_CTX_reset().

      The EVP_CIPHER_CTX_cipher() function was deprecated in OpenSSL 3.0; use EVP_CIPHER_CTX_get0_cipher() instead.

      The EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2(), EVP_CipherInit_ex2(), EVP_CIPHER_fetch(), EVP_CIPHER_free(), EVP_CIPHER_up_ref(), EVP_CIPHER_CTX_get0_cipher(), EVP_CIPHER_CTX_get1_cipher(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(), EVP_CIPHER_CTX_get_params(), EVP_CIPHER_gettable_params(), EVP_CIPHER_settable_ctx_params(), EVP_CIPHER_gettable_ctx_params(), EVP_CIPHER_CTX_settable_params() and EVP_CIPHER_CTX_gettable_params() functions were added in 3.0.

      The EVP_CIPHER_nid(), EVP_CIPHER_name(), EVP_CIPHER_block_size(), EVP_CIPHER_key_length(), EVP_CIPHER_iv_length(), EVP_CIPHER_flags(), EVP_CIPHER_mode(), EVP_CIPHER_type(), EVP_CIPHER_CTX_nid(), EVP_CIPHER_CTX_block_size(), EVP_CIPHER_CTX_key_length(), EVP_CIPHER_CTX_iv_length(), EVP_CIPHER_CTX_tag_length(), EVP_CIPHER_CTX_num(), EVP_CIPHER_CTX_type(), and EVP_CIPHER_CTX_mode() functions were renamed to include get or get0 in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

      The EVP_CIPHER_CTX_encrypting() function was renamed to EVP_CIPHER_CTX_is_encrypting() in OpenSSL 3.0. The old name is kept as non-deprecated alias macro.

      The EVP_CIPHER_CTX_flags() macro was deprecated in OpenSSL 1.1.0.

      EVP_CIPHER_CTX_dup() was added in OpenSSL 3.1.

      "},{"location":"man3/EVP_EncryptInit/#copyright","title":"COPYRIGHT","text":"

      Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

      "},{"location":"man3/EVP_KDF/","title":"EVP_KDF","text":""},{"location":"man3/EVP_KDF/#name","title":"NAME","text":"

      EVP_KDF, EVP_KDF_fetch, EVP_KDF_free, EVP_KDF_up_ref, EVP_KDF_CTX, EVP_KDF_CTX_new, EVP_KDF_CTX_free, EVP_KDF_CTX_dup, EVP_KDF_CTX_reset, EVP_KDF_derive, EVP_KDF_CTX_get_kdf_size, EVP_KDF_get0_provider, EVP_KDF_CTX_kdf, EVP_KDF_is_a, EVP_KDF_get0_name, EVP_KDF_names_do_all, EVP_KDF_get0_description, EVP_KDF_CTX_get_params, EVP_KDF_CTX_set_params, EVP_KDF_do_all_provided, EVP_KDF_get_params, EVP_KDF_gettable_params, EVP_KDF_gettable_ctx_params, EVP_KDF_settable_ctx_params, EVP_KDF_CTX_gettable_params, EVP_KDF_CTX_settable_params - EVP KDF routines

      "},{"location":"man3/EVP_KDF/#synopsis","title":"SYNOPSIS","text":"
      #include <openssl/kdf.h>\n\ntypedef struct evp_kdf_st EVP_KDF;\ntypedef struct evp_kdf_ctx_st EVP_KDF_CTX;\n\nEVP_KDF_CTX *EVP_KDF_CTX_new(EVP_KDF *kdf);\nconst EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx);\nvoid EVP_KDF_CTX_free(EVP_KDF_CTX *ctx);\nEVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src);\nvoid EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx);\nsize_t EVP_KDF_CTX_get_kdf_size(EVP_KDF_CTX *ctx);\nint EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen,\n                   const OSSL_PARAM params[]);\nint EVP_KDF_up_ref(EVP_KDF *kdf);\nvoid EVP_KDF_free(EVP_KDF *kdf);\nEVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,\n                       const char *properties);\nint EVP_KDF_is_a(const EVP_KDF *kdf, const char *name);\nconst char *EVP_KDF_get0_name(const EVP_KDF *kdf);\nconst char *EVP_KDF_get0_description(const EVP_KDF *kdf);\nconst OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);\nvoid EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx,\n                             void (*fn)(EVP_KDF *kdf, void *arg),\n                             void *arg);\nint EVP_KDF_names_do_all(const EVP_KDF *kdf,\n                         void (*fn)(const char *name, void *data),\n                         void *data);\nint EVP_KDF_get_params(EVP_KDF *kdf, OSSL_PARAM params[]);\nint EVP_KDF_CTX_get_params(EVP_KDF_CTX *ctx, OSSL_PARAM params[]);\nint EVP_KDF_CTX_set_params(EVP_KDF_CTX *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_KDF_gettable_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_gettable_ctx_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_CTX_gettable_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_CTX_settable_params(const EVP_KDF *kdf);\nconst OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);\n
      "},{"location":"man3/EVP_KDF/#description","title":"DESCRIPTION","text":"

      The EVP KDF routines are a high-level interface to Key Derivation Function algorithms and should be used instead of algorithm-specific functions.

      After creating a EVP_KDF_CTX for the required algorithm using EVP_KDF_CTX_new(), inputs to the algorithm are supplied either by passing them as part of the EVP_KDF_derive() call or using calls to EVP_KDF_CTX_set_params() before calling EVP_KDF_derive() to derive the key.

      "},{"location":"man3/EVP_KDF/#types","title":"Types","text":"

      EVP_KDF is a type that holds the implementation of a KDF.

      EVP_KDF_CTX is a context type that holds the algorithm inputs.

      "},{"location":"man3/EVP_KDF/#algorithm-implementation-fetching","title":"Algorithm implementation fetching","text":"

      EVP_KDF_fetch() fetches an implementation of a KDF algorithm, given a library context libctx and a set of properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

      See \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-default(7) for the lists of algorithms supported by the default provider.

      The returned value must eventually be freed with EVP_KDF_free(3).

      EVP_KDF_up_ref() increments the reference count of an already fetched KDF.

      EVP_KDF_free() frees a fetched algorithm. NULL is a valid parameter, for which this function is a no-op.

      "},{"location":"man3/EVP_KDF/#context-manipulation-functions","title":"Context manipulation functions","text":"

      EVP_KDF_CTX_new() creates a new context for the KDF implementation kdf.

      EVP_KDF_CTX_free() frees up the context ctx. If ctx is NULL, nothing is done.

      EVP_KDF_CTX_kdf() returns the EVP_KDF associated with the context ctx.

      "},{"location":"man3/EVP_KDF/#computing-functions","title":"Computing functions","text":"

      EVP_KDF_CTX_reset() resets the context to the default state as if the context had just been created.

      EVP_KDF_derive() processes any parameters in Params and then derives keylen bytes of key material and places it in the key buffer. If the algorithm produces a fixed amount of output then an error will occur unless the keylen parameter is equal to that output size, as returned by EVP_KDF_CTX_get_kdf_size().

      EVP_KDF_get_params() retrieves details about the implementation kdf. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

      EVP_KDF_CTX_get_params() retrieves chosen parameters, given the context ctx and its underlying context. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

      EVP_KDF_CTX_set_params() passes chosen parameters to the underlying context, given a context ctx. The set of parameters given with params determine exactly what parameters are passed down. Note that a parameter that is unknown in the underlying context is simply ignored. Also, what happens when a needed parameter isn't passed down is defined by the implementation.

      EVP_KDF_gettable_params() returns an OSSL_PARAM(3) array that describes the retrievable and settable parameters. EVP_KDF_gettable_params() returns parameters that can be used with EVP_KDF_get_params().

      EVP_KDF_gettable_ctx_params() and EVP_KDF_CTX_gettable_params() return constant OSSL_PARAM(3) arrays that describe the retrievable parameters that can be used with EVP_KDF_CTX_get_params(). EVP_KDF_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_KDF_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

      EVP_KDF_settable_ctx_params() and EVP_KDF_CTX_settable_params() return constant OSSL_PARAM(3) arrays that describe the settable parameters that can be used with EVP_KDF_CTX_set_params(). EVP_KDF_settable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_KDF_CTX_settable_params() returns the parameters that can be retrieved in the context's current state.

      "},{"location":"man3/EVP_KDF/#information-functions","title":"Information functions","text":"

      EVP_KDF_CTX_get_kdf_size() returns the output size if the algorithm produces a fixed amount of output and SIZE_MAX otherwise. If an error occurs then 0 is returned. For some algorithms an error may result if input parameters necessary to calculate a fixed output size have not yet been supplied.

      EVP_KDF_is_a() returns 1 if kdf is an implementation of an algorithm that's identifiable with name, otherwise 0.

      EVP_KDF_get0_provider() returns the provider that holds the implementation of the given kdf.

      EVP_KDF_do_all_provided() traverses all KDF implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

      EVP_KDF_get0_name() return the name of the given KDF. For fetched KDFs with multiple names, only one of them is returned; it's recommended to use EVP_KDF_names_do_all() instead.

      EVP_KDF_names_do_all() traverses all names for kdf, and calls fn with each name and data.

      EVP_KDF_get0_description() returns a description of the kdf, meant for display and human consumption. The description is at the discretion of the kdf implementation.

      "},{"location":"man3/EVP_KDF/#parameters","title":"PARAMETERS","text":"

      The standard parameter names are:

      • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>

        Some KDF implementations require a password. For those KDF implementations that support it, this parameter sets the password.

      • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

        Some KDF implementations can take a non-secret unique cryptographic salt. For those KDF implementations that support it, this parameter sets the salt.

        The default value, if any, is implementation dependent.

      • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

        Some KDF implementations require an iteration count. For those KDF implementations that support it, this parameter sets the iteration count.

        The default value, if any, is implementation dependent.

      • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

      • \"mac\" (OSSL_KDF_PARAM_MAC)
      • \"digest\" (OSSL_KDF_PARAM_DIGEST)
      • \"cipher\" (OSSL_KDF_PARAM_CIPHER)

        For KDF implementations that use an underlying computation MAC, digest or cipher, these parameters set what the algorithm should be.

        The value is always the name of the intended algorithm, or the properties.

        Note that not all algorithms may support all possible underlying implementations.

      • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

        Some KDF implementations require a key. For those KDF implementations that support it, this octet string parameter sets the key.

      • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

        Some KDF implementations, such as EVP_KDF-HKDF(7), take an 'info' parameter for binding the derived key material to application- and context-specific information. This parameter sets the info, fixed info, other info or shared info argument. You can specify this parameter multiple times, and each instance will be concatenated to form the final value.

      • \"maclen\" (OSSL_KDF_PARAM_MAC_SIZE) <unsigned integer>

        Used by implementations that use a MAC with a variable output size (KMAC). For those KDF implementations that support it, this parameter sets the MAC output size.

        The default value, if any, is implementation dependent. The length must never exceed what can be given with a size_t.

      • \"maxmem_bytes\" (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>

        Memory-hard password-based KDF algorithms, such as scrypt, use an amount of memory that depends on the load factors provided as input. For those KDF implementations that support it, this uint64_t parameter sets an upper limit on the amount of memory that may be consumed while performing a key derivation. If this memory usage limit is exceeded because the load factors are chosen too high, the key derivation will fail.

        The default value is implementation dependent. The memory size must never exceed what can be given with a size_t.

      • "},{"location":"man3/EVP_KDF/#return-values","title":"RETURN VALUES","text":"

        EVP_KDF_fetch() returns a pointer to a newly fetched EVP_KDF, or NULL if allocation failed.

        EVP_KDF_get0_provider() returns a pointer to the provider for the KDF, or NULL on error.

        EVP_KDF_up_ref() returns 1 on success, 0 on error.

        EVP_KDF_CTX_new() returns either the newly allocated EVP_KDF_CTX structure or NULL if an error occurred.

        EVP_KDF_CTX_free() and EVP_KDF_CTX_reset() do not return a value.

        EVP_KDF_CTX_get_kdf_size() returns the output size. SIZE_MAX is returned to indicate that the algorithm produces a variable amount of output; 0 to indicate failure.

        EVP_KDF_get0_name() returns the name of the KDF, or NULL on error.

        EVP_KDF_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

        The remaining functions return 1 for success and 0 or a negative value for failure. In particular, a return value of -2 indicates the operation is not supported by the KDF algorithm.

        "},{"location":"man3/EVP_KDF/#notes","title":"NOTES","text":"

        The KDF life-cycle is described in life_cycle-kdf(7). In the future, the transitions described there will be enforced. When this is done, it will not be considered a breaking change to the API.

        "},{"location":"man3/EVP_KDF/#see-also","title":"SEE ALSO","text":"

        \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-default(7), life_cycle-kdf(7).

        "},{"location":"man3/EVP_KDF/#history","title":"HISTORY","text":"

        This functionality was added in OpenSSL 3.0.

        "},{"location":"man3/EVP_KDF/#copyright","title":"COPYRIGHT","text":"

        Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.

        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

        "},{"location":"man3/EVP_KEM_free/","title":"EVP_KEM_free","text":""},{"location":"man3/EVP_KEM_free/#name","title":"NAME","text":"

        EVP_KEM_fetch, EVP_KEM_free, EVP_KEM_up_ref, EVP_KEM_get0_name, EVP_KEM_is_a, EVP_KEM_get0_provider, EVP_KEM_do_all_provided, EVP_KEM_names_do_all, EVP_KEM_get0_description, EVP_KEM_gettable_ctx_params, EVP_KEM_settable_ctx_params - Functions to manage EVP_KEM algorithm objects

        "},{"location":"man3/EVP_KEM_free/#synopsis","title":"SYNOPSIS","text":"
        #include <openssl/evp.h>\n\nEVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                       const char *properties);\nvoid EVP_KEM_free(EVP_KEM *kem);\nint EVP_KEM_up_ref(EVP_KEM *kem);\nconst char *EVP_KEM_get0_name(const EVP_KEM *kem);\nint EVP_KEM_is_a(const EVP_KEM *kem, const char *name);\nOSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *kem);\nvoid EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,\n                             void (*fn)(EVP_KEM *kem, void *arg), void *arg);\nint EVP_KEM_names_do_all(const EVP_KEM *kem,\n                         void (*fn)(const char *name, void *data), void *data);\nconst char *EVP_KEM_get0_description(const EVP_KEM *kem);\nconst OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);\nconst OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);\n
        "},{"location":"man3/EVP_KEM_free/#description","title":"DESCRIPTION","text":"

        EVP_KEM_fetch() fetches the implementation for the given algorithm from any provider offering it, within the criteria given by the properties and in the scope of the given library context ctx (see OSSL_LIB_CTX(3)). The algorithm will be one offering functions for performing asymmetric kem related tasks such as key encapsulation and decapsulation. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

        The returned value must eventually be freed with EVP_KEM_free().

        EVP_KEM_free() decrements the reference count for the EVP_KEM structure. Typically this structure will have been obtained from an earlier call to EVP_KEM_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

        EVP_KEM_up_ref() increments the reference count for an EVP_KEM structure.

        EVP_KEM_is_a() returns 1 if kem is an implementation of an algorithm that's identifiable with name, otherwise 0.

        EVP_KEM_get0_provider() returns the provider that kem was fetched from.

        EVP_KEM_do_all_provided() traverses all EVP_KEMs implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

        EVP_KEM_get0_name() returns the algorithm name from the provided implementation for the given kem. Note that the kem may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the kem object and should not be freed by the caller.

        EVP_KEM_names_do_all() traverses all names for kem, and calls fn with each name and data.

        EVP_KEM_get0_description() returns a description of the kem, meant for display and human consumption. The description is at the discretion of the kem implementation.

        EVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a key encapsulation algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

        "},{"location":"man3/EVP_KEM_free/#return-values","title":"RETURN VALUES","text":"

        EVP_KEM_fetch() returns a pointer to an EVP_KEM for success or NULL for failure.

        EVP_KEM_up_ref() returns 1 for success or 0 otherwise.

        EVP_KEM_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

        EVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

        "},{"location":"man3/EVP_KEM_free/#see-also","title":"SEE ALSO","text":"

        \"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

        "},{"location":"man3/EVP_KEM_free/#history","title":"HISTORY","text":"

        The functions described here were added in OpenSSL 3.0.

        "},{"location":"man3/EVP_KEM_free/#copyright","title":"COPYRIGHT","text":"

        Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

        "},{"location":"man3/EVP_KEYEXCH_free/","title":"EVP_KEYEXCH_free","text":""},{"location":"man3/EVP_KEYEXCH_free/#name","title":"NAME","text":"

        EVP_KEYEXCH_fetch, EVP_KEYEXCH_free, EVP_KEYEXCH_up_ref, EVP_KEYEXCH_get0_provider, EVP_KEYEXCH_is_a, EVP_KEYEXCH_do_all_provided, EVP_KEYEXCH_names_do_all, EVP_KEYEXCH_get0_name, EVP_KEYEXCH_get0_description, EVP_KEYEXCH_gettable_ctx_params, EVP_KEYEXCH_settable_ctx_params - Functions to manage EVP_KEYEXCH algorithm objects

        "},{"location":"man3/EVP_KEYEXCH_free/#synopsis","title":"SYNOPSIS","text":"
        #include <openssl/evp.h>\n\nEVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                               const char *properties);\nvoid EVP_KEYEXCH_free(EVP_KEYEXCH *exchange);\nint EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange);\nOSSL_PROVIDER *EVP_KEYEXCH_get0_provider(const EVP_KEYEXCH *exchange);\nint EVP_KEYEXCH_is_a(const EVP_KEYEXCH *exchange, const char *name);\nconst char *EVP_KEYEXCH_get0_name(const EVP_KEYEXCH *exchange);\nvoid EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx,\n                                 void (*fn)(EVP_KEYEXCH *exchange, void *arg),\n                                 void *arg);\nint EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *exchange,\n                             void (*fn)(const char *name, void *data),\n                             void *data);\nconst char *EVP_KEYEXCH_get0_description(const EVP_KEYEXCH *keyexch);\nconst OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch);\nconst OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch);\n
        "},{"location":"man3/EVP_KEYEXCH_free/#description","title":"DESCRIPTION","text":"

        EVP_KEYEXCH_fetch() fetches the key exchange implementation for the given algorithm from any provider offering it, within the criteria given by the properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

        The returned value must eventually be freed with EVP_KEYEXCH_free().

        EVP_KEYEXCH_free() decrements the reference count for the EVP_KEYEXCH structure. Typically this structure will have been obtained from an earlier call to EVP_KEYEXCH_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

        EVP_KEYEXCH_up_ref() increments the reference count for an EVP_KEYEXCH structure.

        EVP_KEYEXCH_get0_provider() returns the provider that exchange was fetched from.

        EVP_KEYEXCH_is_a() checks if exchange is an implementation of an algorithm that's identifiable with name.

        EVP_KEYEXCH_get0_name() returns the algorithm name from the provided implementation for the given exchange. Note that the exchange may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the exchange object and should not be freed by the caller.

        EVP_KEYEXCH_names_do_all() traverses all names for the exchange, and calls fn with each name and data.

        EVP_KEYEXCH_get0_description() returns a description of the keyexch, meant for display and human consumption. The description is at the discretion of the keyexch implementation.

        EVP_KEYEXCH_do_all_provided() traverses all key exchange implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and data as arguments.

        EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a key exchange algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

        "},{"location":"man3/EVP_KEYEXCH_free/#return-values","title":"RETURN VALUES","text":"

        EVP_KEYEXCH_fetch() returns a pointer to a EVP_KEYEXCH for success or NULL for failure.

        EVP_KEYEXCH_up_ref() returns 1 for success or 0 otherwise.

        EVP_KEYEXCH_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

        EVP_KEYEXCH_is_a() returns 1 of exchange was identifiable, otherwise 0.

        EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

        "},{"location":"man3/EVP_KEYEXCH_free/#see-also","title":"SEE ALSO","text":"

        \"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

        "},{"location":"man3/EVP_KEYEXCH_free/#history","title":"HISTORY","text":"

        The functions described here were added in OpenSSL 3.0.

        "},{"location":"man3/EVP_KEYEXCH_free/#copyright","title":"COPYRIGHT","text":"

        Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

        "},{"location":"man3/EVP_KEYMGMT/","title":"EVP_KEYMGMT","text":""},{"location":"man3/EVP_KEYMGMT/#name","title":"NAME","text":"

        EVP_KEYMGMT, EVP_KEYMGMT_fetch, EVP_KEYMGMT_up_ref, EVP_KEYMGMT_free, EVP_KEYMGMT_get0_provider, EVP_KEYMGMT_is_a, EVP_KEYMGMT_get0_description, EVP_KEYMGMT_get0_name, EVP_KEYMGMT_do_all_provided, EVP_KEYMGMT_names_do_all, EVP_KEYMGMT_gettable_params, EVP_KEYMGMT_settable_params, EVP_KEYMGMT_gen_settable_params - EVP key management routines

        "},{"location":"man3/EVP_KEYMGMT/#synopsis","title":"SYNOPSIS","text":"
        #include <openssl/evp.h>\n\ntypedef struct evp_keymgmt_st EVP_KEYMGMT;\n\nEVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                               const char *properties);\nint EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);\nvoid EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);\nconst OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt);\nint EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);\nconst char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt);\nconst char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt);\n\nvoid EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,\n                                 void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),\n                                 void *arg);\nint EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,\n                             void (*fn)(const char *name, void *data),\n                             void *data);\nconst OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);\nconst OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);\nconst OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);\n
        "},{"location":"man3/EVP_KEYMGMT/#description","title":"DESCRIPTION","text":"

        EVP_KEYMGMT is a method object that represents key management implementations for different cryptographic algorithms. This method object provides functionality to have providers import key material from the outside, as well as export key material to the outside. Most of the functionality can only be used internally and has no public interface, this object is simply passed into other functions when needed.

        EVP_KEYMGMT_fetch() looks for an algorithm within the provider that has been loaded into the OSSL_LIB_CTX given by ctx, having the name given by algorithm and the properties given by properties.

        EVP_KEYMGMT_up_ref() increments the reference count for the given EVP_KEYMGMT keymgmt.

        EVP_KEYMGMT_free() decrements the reference count for the given EVP_KEYMGMT keymgmt, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

        EVP_KEYMGMT_get0_provider() returns the provider that has this particular implementation.

        EVP_KEYMGMT_is_a() checks if keymgmt is an implementation of an algorithm that's identifiable with name.

        EVP_KEYMGMT_get0_name() returns the algorithm name from the provided implementation for the given keymgmt. Note that the keymgmt may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the keymgmt object and should not be freed by the caller.

        EVP_KEYMGMT_names_do_all() traverses all names for the keymgmt, and calls fn with each name and data.

        EVP_KEYMGMT_get0_description() returns a description of the keymgmt, meant for display and human consumption. The description is at the discretion of the keymgmt implementation.

        EVP_KEYMGMT_do_all_provided() traverses all key keymgmt implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and data as arguments.

        EVP_KEYMGMT_gettable_params() and EVP_KEYMGMT_settable_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set. EVP_KEYMGMT_gettable_params() is used by EVP_PKEY_gettable_params(3).

        EVP_KEYMGMT_gen_settable_params() returns a constant OSSL_PARAM(3) array that describes the names and types of key generation parameters that can be set via EVP_PKEY_CTX_set_params(3).

        "},{"location":"man3/EVP_KEYMGMT/#notes","title":"NOTES","text":"

        EVP_KEYMGMT_fetch() may be called implicitly by other fetching functions, using the same library context and properties. Any other API that uses keys will typically do this.

        "},{"location":"man3/EVP_KEYMGMT/#return-values","title":"RETURN VALUES","text":"

        EVP_KEYMGMT_fetch() returns a pointer to the key management implementation represented by an EVP_KEYMGMT object, or NULL on error.

        EVP_KEYMGMT_up_ref() returns 1 on success, or 0 on error.

        EVP_KEYMGMT_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

        EVP_KEYMGMT_free() doesn't return any value.

        EVP_KEYMGMT_get0_provider() returns a pointer to a provider object, or NULL on error.

        EVP_KEYMGMT_is_a() returns 1 of keymgmt was identifiable, otherwise 0.

        EVP_KEYMGMT_get0_name() returns the algorithm name, or NULL on error.

        EVP_KEYMGMT_get0_description() returns a pointer to a description, or NULL if there isn't one.

        EVP_KEYMGMT_gettable_params(), EVP_KEYMGMT_settable_params() and EVP_KEYMGMT_gen_settable_params() return a constant OSSL_PARAM(3) array or NULL on error.

        "},{"location":"man3/EVP_KEYMGMT/#see-also","title":"SEE ALSO","text":"

        EVP_MD_fetch(3), OSSL_LIB_CTX(3)

        "},{"location":"man3/EVP_KEYMGMT/#history","title":"HISTORY","text":"

        The functions described here were added in OpenSSL 3.0.

        "},{"location":"man3/EVP_KEYMGMT/#copyright","title":"COPYRIGHT","text":"

        Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

        "},{"location":"man3/EVP_MAC/","title":"EVP_MAC","text":""},{"location":"man3/EVP_MAC/#name","title":"NAME","text":"

        EVP_MAC, EVP_MAC_fetch, EVP_MAC_up_ref, EVP_MAC_free, EVP_MAC_is_a, EVP_MAC_get0_name, EVP_MAC_names_do_all, EVP_MAC_get0_description, EVP_MAC_get0_provider, EVP_MAC_get_params, EVP_MAC_gettable_params, EVP_MAC_CTX, EVP_MAC_CTX_new, EVP_MAC_CTX_free, EVP_MAC_CTX_dup, EVP_MAC_CTX_get0_mac, EVP_MAC_CTX_get_params, EVP_MAC_CTX_set_params, EVP_MAC_CTX_get_mac_size, EVP_MAC_CTX_get_block_size, EVP_Q_mac, EVP_MAC_init, EVP_MAC_update, EVP_MAC_final, EVP_MAC_finalXOF, EVP_MAC_gettable_ctx_params, EVP_MAC_settable_ctx_params, EVP_MAC_CTX_gettable_params, EVP_MAC_CTX_settable_params, EVP_MAC_do_all_provided - EVP MAC routines

        "},{"location":"man3/EVP_MAC/#synopsis","title":"SYNOPSIS","text":"
        #include <openssl/evp.h>\n\ntypedef struct evp_mac_st EVP_MAC;\ntypedef struct evp_mac_ctx_st EVP_MAC_CTX;\n\nEVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,\n                       const char *properties);\nint EVP_MAC_up_ref(EVP_MAC *mac);\nvoid EVP_MAC_free(EVP_MAC *mac);\nint EVP_MAC_is_a(const EVP_MAC *mac, const char *name);\nconst char *EVP_MAC_get0_name(const EVP_MAC *mac);\nint EVP_MAC_names_do_all(const EVP_MAC *mac,\n                         void (*fn)(const char *name, void *data),\n                         void *data);\nconst char *EVP_MAC_get0_description(const EVP_MAC *mac);\nconst OSSL_PROVIDER *EVP_MAC_get0_provider(const EVP_MAC *mac);\nint EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]);\n\nEVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac);\nvoid EVP_MAC_CTX_free(EVP_MAC_CTX *ctx);\nEVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src);\nEVP_MAC *EVP_MAC_CTX_get0_mac(EVP_MAC_CTX *ctx);\nint EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);\nint EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);\n\nsize_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx);\nsize_t EVP_MAC_CTX_get_block_size(EVP_MAC_CTX *ctx);\nunsigned char *EVP_Q_mac(OSSL_LIB_CTX *libctx, const char *name, const char *propq,\n                         const char *subalg, const OSSL_PARAM *params,\n                         const void *key, size_t keylen,\n                         const unsigned char *data, size_t datalen,\n                         unsigned char *out, size_t outsize, size_t *outlen);\nint EVP_MAC_init(EVP_MAC_CTX *ctx, const unsigned char *key, size_t keylen,\n                 const OSSL_PARAM params[]);\nint EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen);\nint EVP_MAC_final(EVP_MAC_CTX *ctx,\n                  unsigned char *out, size_t *outl, size_t outsize);\nint EVP_MAC_finalXOF(EVP_MAC_CTX *ctx, unsigned char *out, size_t outsize);\n\nconst OSSL_PARAM *EVP_MAC_gettable_params(const EVP_MAC *mac);\nconst OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac);\nconst OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac);\nconst OSSL_PARAM *EVP_MAC_CTX_gettable_params(EVP_MAC_CTX *ctx);\nconst OSSL_PARAM *EVP_MAC_CTX_settable_params(EVP_MAC_CTX *ctx);\n\nvoid EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx,\n                             void (*fn)(EVP_MAC *mac, void *arg),\n                             void *arg);\n
        "},{"location":"man3/EVP_MAC/#description","title":"DESCRIPTION","text":"

        These types and functions help the application to calculate MACs of different types and with different underlying algorithms if there are any.

        MACs are a bit complex insofar that some of them use other algorithms for actual computation. HMAC uses a digest, and CMAC uses a cipher. Therefore, there are sometimes two contexts to keep track of, one for the MAC algorithm itself and one for the underlying computation algorithm if there is one.

        To make things less ambiguous, this manual talks about a \"context\" or \"MAC context\", which is to denote the MAC level context, and about a \"underlying context\", or \"computation context\", which is to denote the context for the underlying computation algorithm if there is one.

        "},{"location":"man3/EVP_MAC/#types","title":"Types","text":"

        EVP_MAC is a type that holds the implementation of a MAC.

        EVP_MAC_CTX is a context type that holds internal MAC information as well as a reference to a computation context, for those MACs that rely on an underlying computation algorithm.

        "},{"location":"man3/EVP_MAC/#algorithm-implementation-fetching","title":"Algorithm implementation fetching","text":"

        EVP_MAC_fetch() fetches an implementation of a MAC algorithm, given a library context libctx and a set of properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

        See \"Message Authentication Code (MAC)\" in OSSL_PROVIDER-default(7) for the list of algorithms supported by the default provider.

        The returned value must eventually be freed with EVP_MAC_free(3).

        EVP_MAC_up_ref() increments the reference count of an already fetched MAC.

        EVP_MAC_free() frees a fetched algorithm. NULL is a valid parameter, for which this function is a no-op.

        "},{"location":"man3/EVP_MAC/#context-manipulation-functions","title":"Context manipulation functions","text":"

        EVP_MAC_CTX_new() creates a new context for the MAC type mac. The created context can then be used with most other functions described here.

        EVP_MAC_CTX_free() frees the contents of the context, including an underlying context if there is one, as well as the context itself. NULL is a valid parameter, for which this function is a no-op.

        EVP_MAC_CTX_dup() duplicates the src context and returns a newly allocated context.

        EVP_MAC_CTX_get0_mac() returns the EVP_MAC associated with the context ctx.

        "},{"location":"man3/EVP_MAC/#computing-functions","title":"Computing functions","text":"

        EVP_Q_mac() computes the message authentication code of data with length datalen using the MAC algorithm name and the key key with length keylen. The MAC algorithm is fetched using any given libctx and property query string propq. It takes parameters subalg and further params, both of which may be NULL if not needed. If out is not NULL, it places the result in the memory pointed at by out, but only if outsize is sufficient (otherwise no computation is made). If out is NULL, it allocates and uses a buffer of suitable length, which will be returned on success and must be freed by the caller. In either case, also on error, it assigns the number of bytes written to *outlen unless outlen is NULL.

        EVP_MAC_init() sets up the underlying context ctx with information given via the key and params arguments. The MAC key has a length of keylen and the parameters in params are processed before setting the key. If key is NULL, the key must be set via params either as part of this call or separately using EVP_MAC_CTX_set_params(). Providing non-NULL params to this function is equivalent to calling EVP_MAC_CTX_set_params() with those params for the same ctx beforehand. Note: There are additional requirements for some MAC algorithms during re-initalization (i.e. calling EVP_MAC_init() on an EVP_MAC after EVP_MAC_final() has been called on the same object). See the NOTES section below.

        EVP_MAC_init() should be called before EVP_MAC_update() and EVP_MAC_final().

        EVP_MAC_update() adds datalen bytes from data to the MAC input.

        EVP_MAC_final() does the final computation and stores the result in the memory pointed at by out of size outsize, and sets the number of bytes written in *outl at. If out is NULL or outsize is too small, then no computation is made. To figure out what the output length will be and allocate space for it dynamically, simply call with out being NULL and outl pointing at a valid location, then allocate space and make a second call with out pointing at the allocated space.

        EVP_MAC_finalXOF() does the final computation for an XOF based MAC and stores the result in the memory pointed at by out of size outsize.

        EVP_MAC_get_params() retrieves details about the implementation mac. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

        EVP_MAC_CTX_get_params() retrieves chosen parameters, given the context ctx and its underlying context. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

        EVP_MAC_CTX_set_params() passes chosen parameters to the underlying context, given a context ctx. The set of parameters given with params determine exactly what parameters are passed down. If params are NULL, the underlying context should do nothing and return 1. Note that a parameter that is unknown in the underlying context is simply ignored. Also, what happens when a needed parameter isn't passed down is defined by the implementation.

        EVP_MAC_gettable_params() returns an OSSL_PARAM(3) array that describes the retrievable and settable parameters. EVP_MAC_gettable_params() returns parameters that can be used with EVP_MAC_get_params().

        EVP_MAC_gettable_ctx_params() and EVP_MAC_CTX_gettable_params() return constant OSSL_PARAM(3) arrays that describe the retrievable parameters that can be used with EVP_MAC_CTX_get_params(). EVP_MAC_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_MAC_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

        EVP_MAC_settable_ctx_params() and EVP_MAC_CTX_settable_params() return constant OSSL_PARAM(3) arrays that describe the settable parameters that can be used with EVP_MAC_CTX_set_params(). EVP_MAC_settable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_MAC_CTX_settable_params() returns the parameters that can be retrieved in the context's current state.

        "},{"location":"man3/EVP_MAC/#information-functions","title":"Information functions","text":"

        EVP_MAC_CTX_get_mac_size() returns the MAC output size for the given context.

        EVP_MAC_CTX_get_block_size() returns the MAC block size for the given context. Not all MAC algorithms support this.

        EVP_MAC_is_a() checks if the given mac is an implementation of an algorithm that's identifiable with name.

        EVP_MAC_get0_provider() returns the provider that holds the implementation of the given mac.

        EVP_MAC_do_all_provided() traverses all MAC implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

        EVP_MAC_get0_name() return the name of the given MAC. For fetched MACs with multiple names, only one of them is returned; it's recommended to use EVP_MAC_names_do_all() instead.

        EVP_MAC_names_do_all() traverses all names for mac, and calls fn with each name and data.

        EVP_MAC_get0_description() returns a description of the mac, meant for display and human consumption. The description is at the discretion of the mac implementation.

        "},{"location":"man3/EVP_MAC/#parameters","title":"PARAMETERS","text":"

        Parameters are identified by name as strings, and have an expected data type and maximum size. OpenSSL has a set of macros for parameter names it expects to see in its own MAC implementations. Here, we show all three, the OpenSSL macro for the parameter name, the name in string form, and a type description.

        The standard parameter names are:

        • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

          Its value is the MAC key as an array of bytes.

          For MACs that use an underlying computation algorithm, the algorithm must be set first, see parameter names \"algorithm\" below.

        • \"iv\" (OSSL_MAC_PARAM_IV) <octet string>

          Some MAC implementations (GMAC) require an IV, this parameter sets the IV.

        • \"custom\" (OSSL_MAC_PARAM_CUSTOM) <octet string>

          Some MAC implementations (KMAC, BLAKE2) accept a Customization String, this parameter sets the Customization String. The default value is the empty string.

        • \"salt\" (OSSL_MAC_PARAM_SALT) <octet string>

          This option is used by BLAKE2 MAC.

        • \"xof\" (OSSL_MAC_PARAM_XOF) <integer>

          It's a simple flag, the value 0 or 1 are expected.

          This option is used by KMAC.

        • \"digest-noinit\" (OSSL_MAC_PARAM_DIGEST_NOINIT) <integer>

          A simple flag to set the MAC digest to not initialise the implementation specific data. The value 0 or 1 is expected.

          This option is used by HMAC.

        • \"digest-oneshot\" (OSSL_MAC_PARAM_DIGEST_ONESHOT) <integer>

          A simple flag to set the MAC digest to be a oneshot operation. The value 0 or 1 is expected.

          This option is used by HMAC.

        • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

        • \"digest\" (OSSL_MAC_PARAM_DIGEST)
        • \"cipher\" (OSSL_MAC_PARAM_CIPHER)

          For MAC implementations that use an underlying computation cipher or digest, these parameters set what the algorithm should be.

          The value is always the name of the intended algorithm, or the properties.

          Note that not all algorithms may support all digests. HMAC does not support variable output length digests such as SHAKE128 or SHAKE256.

        • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

          For MAC implementations that support it, set the output size that EVP_MAC_final() should produce. The allowed sizes vary between MAC implementations, but must never exceed what can be given with a size_t.

        • \"tls-data-size\" (OSSL_MAC_PARAM_TLS_DATA_SIZE) <unsigned integer>

          This parameter is only supported by HMAC. If set then special handling is activated for calculating the MAC of a received mac-then-encrypt TLS record where variable length record padding has been used (as in the case of CBC mode ciphersuites). The value represents the total length of the record that is having the MAC calculated including the received MAC and the record padding.

          When used EVP_MAC_update must be called precisely twice. The first time with the 13 bytes of TLS \"header\" data, and the second time with the entire record including the MAC itself and any padding. The entire record length must equal the value passed in the \"tls-data-size\" parameter. The length passed in the datalen parameter to EVP_MAC_update() should be equal to the length of the record after the MAC and any padding has been removed.

        • All these parameters should be used before the calls to any of EVP_MAC_init(), EVP_MAC_update() and EVP_MAC_final() for a full computation. Anything else may give undefined results.

          "},{"location":"man3/EVP_MAC/#notes","title":"NOTES","text":"

          The MAC life-cycle is described in life_cycle-mac(7). In the future, the transitions described there will be enforced. When this is done, it will not be considered a breaking change to the API.

          The usage of the parameter names \"custom\", \"iv\" and \"salt\" correspond to the names used in the standard where the algorithm was defined.

          Some MAC algorithms store internal state that cannot be extracted during re-initalization. For example GMAC cannot extract an IV from the underlying CIPHER context, and so calling EVP_MAC_init() on an EVP_MAC object after EVP_MAC_final() has been called cannot reset its cipher state to what it was when the IV was initially generated. For such instances, an OSSL_MAC_PARAM_IV parameter must be passed with each call to EVP_MAC_init().

          "},{"location":"man3/EVP_MAC/#return-values","title":"RETURN VALUES","text":"

          EVP_MAC_fetch() returns a pointer to a newly fetched EVP_MAC, or NULL if allocation failed.

          EVP_MAC_up_ref() returns 1 on success, 0 on error.

          EVP_MAC_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

          EVP_MAC_free() returns nothing at all.

          EVP_MAC_is_a() returns 1 if the given method can be identified with the given name, otherwise 0.

          EVP_MAC_get0_name() returns a name of the MAC, or NULL on error.

          EVP_MAC_get0_provider() returns a pointer to the provider for the MAC, or NULL on error.

          EVP_MAC_CTX_new() and EVP_MAC_CTX_dup() return a pointer to a newly created EVP_MAC_CTX, or NULL if allocation failed.

          EVP_MAC_CTX_free() returns nothing at all.

          EVP_MAC_CTX_get_params() and EVP_MAC_CTX_set_params() return 1 on success, 0 on error.

          EVP_Q_mac() returns a pointer to the computed MAC value, or NULL on error.

          EVP_MAC_init(), EVP_MAC_update(), EVP_MAC_final(), and EVP_MAC_finalXOF() return 1 on success, 0 on error.

          EVP_MAC_CTX_get_mac_size() returns the expected output size, or 0 if it isn't set. If it isn't set, a call to EVP_MAC_init() will set it.

          EVP_MAC_CTX_get_block_size() returns the block size, or 0 if it isn't set. If it isn't set, a call to EVP_MAC_init() will set it.

          EVP_MAC_do_all_provided() returns nothing at all.

          "},{"location":"man3/EVP_MAC/#examples","title":"EXAMPLES","text":"
          #include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdarg.h>\n#include <unistd.h>\n\n#include <openssl/evp.h>\n#include <openssl/err.h>\n#include <openssl/params.h>\n\nint main() {\n    EVP_MAC *mac = EVP_MAC_fetch(NULL, getenv(\"MY_MAC\"), NULL);\n    const char *cipher = getenv(\"MY_MAC_CIPHER\");\n    const char *digest = getenv(\"MY_MAC_DIGEST\");\n    const char *key = getenv(\"MY_KEY\");\n    EVP_MAC_CTX *ctx = NULL;\n\n    unsigned char buf[4096];\n    size_t read_l;\n    size_t final_l;\n\n    size_t i;\n\n    OSSL_PARAM params[3];\n    size_t params_n = 0;\n\n    if (cipher != NULL)\n        params[params_n++] =\n            OSSL_PARAM_construct_utf8_string(\"cipher\", (char*)cipher, 0);\n    if (digest != NULL)\n        params[params_n++] =\n            OSSL_PARAM_construct_utf8_string(\"digest\", (char*)digest, 0);\n    params[params_n] = OSSL_PARAM_construct_end();\n\n    if (mac == NULL\n        || key == NULL\n        || (ctx = EVP_MAC_CTX_new(mac)) == NULL\n        || !EVP_MAC_init(ctx, (const unsigned char *)key, strlen(key),\n                         params))\n        goto err;\n\n    while ( (read_l = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {\n        if (!EVP_MAC_update(ctx, buf, read_l))\n            goto err;\n    }\n\n    if (!EVP_MAC_final(ctx, buf, &final_l, sizeof(buf)))\n        goto err;\n\n    printf(\"Result: \");\n    for (i = 0; i < final_l; i++)\n        printf(\"%02X\", buf[i]);\n    printf(\"\\n\");\n\n    EVP_MAC_CTX_free(ctx);\n    EVP_MAC_free(mac);\n    exit(0);\n\n err:\n    EVP_MAC_CTX_free(ctx);\n    EVP_MAC_free(mac);\n    fprintf(stderr, \"Something went wrong\\n\");\n    ERR_print_errors_fp(stderr);\n    exit (1);\n}\n

          A run of this program, called with correct environment variables, can look like this:

          $ MY_MAC=cmac MY_KEY=secret0123456789 MY_MAC_CIPHER=aes-128-cbc \\\n  LD_LIBRARY_PATH=. ./foo < foo.c\nResult: C5C06683CD9DDEF904D754505C560A4E\n

          (in this example, that program was stored in foo.c and compiled to ./foo)

          "},{"location":"man3/EVP_MAC/#see-also","title":"SEE ALSO","text":"

          property(7) OSSL_PARAM(3), EVP_MAC-BLAKE2(7), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-HMAC(7), EVP_MAC-KMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7), provider-mac(7), life_cycle-mac(7)

          "},{"location":"man3/EVP_MAC/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_MAC/#copyright","title":"COPYRIGHT","text":"

          Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_MD_meth_new/","title":"EVP_MD_meth_new","text":""},{"location":"man3/EVP_MD_meth_new/#name","title":"NAME","text":"

          EVP_MD_meth_new, EVP_MD_meth_dup, EVP_MD_meth_free, EVP_MD_meth_set_input_blocksize, EVP_MD_meth_set_result_size, EVP_MD_meth_set_app_datasize, EVP_MD_meth_set_flags, EVP_MD_meth_set_init, EVP_MD_meth_set_update, EVP_MD_meth_set_final, EVP_MD_meth_set_copy, EVP_MD_meth_set_cleanup, EVP_MD_meth_set_ctrl, EVP_MD_meth_get_input_blocksize, EVP_MD_meth_get_result_size, EVP_MD_meth_get_app_datasize, EVP_MD_meth_get_flags, EVP_MD_meth_get_init, EVP_MD_meth_get_update, EVP_MD_meth_get_final, EVP_MD_meth_get_copy, EVP_MD_meth_get_cleanup, EVP_MD_meth_get_ctrl - Routines to build up legacy EVP_MD methods

          "},{"location":"man3/EVP_MD_meth_new/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n

          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);\nvoid EVP_MD_meth_free(EVP_MD *md);\nEVP_MD *EVP_MD_meth_dup(const EVP_MD *md);\n\nint EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);\nint EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);\nint EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);\nint EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);\nint EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));\nint EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,\n                                                     const void *data,\n                                                     size_t count));\nint EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,\n                                                   unsigned char *md));\nint EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,\n                                                 const EVP_MD_CTX *from));\nint EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));\nint EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,\n                                                 int p1, void *p2));\n\nint EVP_MD_meth_get_input_blocksize(const EVP_MD *md);\nint EVP_MD_meth_get_result_size(const EVP_MD *md);\nint EVP_MD_meth_get_app_datasize(const EVP_MD *md);\nunsigned long EVP_MD_meth_get_flags(const EVP_MD *md);\nint (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);\nint (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,\n                                                const void *data,\n                                                size_t count);\nint (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,\n                                               unsigned char *md);\nint (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,\n                                              const EVP_MD_CTX *from);\nint (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);\nint (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,\n                                              int p1, void *p2);\n
          "},{"location":"man3/EVP_MD_meth_new/#description","title":"DESCRIPTION","text":"

          All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

          The EVP_MD type is a structure for digest method implementation. It can also have associated public/private key signing and verifying routines.

          EVP_MD_meth_new() creates a new EVP_MD structure. These EVP_MD structures are reference counted.

          EVP_MD_meth_dup() creates a copy of md.

          EVP_MD_meth_free() decrements the reference count for the EVP_MD structure. If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

          EVP_MD_meth_set_input_blocksize() sets the internal input block size for the method md to blocksize bytes.

          EVP_MD_meth_set_result_size() sets the size of the result that the digest method in md is expected to produce to resultsize bytes.

          The digest method may have its own private data, which OpenSSL will allocate for it. EVP_MD_meth_set_app_datasize() should be used to set the size for it to datasize.

          EVP_MD_meth_set_flags() sets the flags to describe optional behaviours in the particular md. Several flags can be or'd together. The available flags are:

          • EVP_MD_FLAG_ONESHOT

            This digest method can only handle one block of input.

          • EVP_MD_FLAG_XOF

            This digest method is an extensible-output function (XOF) and supports the EVP_MD_CTRL_XOF_LEN control.

          • EVP_MD_FLAG_DIGALGID_NULL

            When setting up a DigestAlgorithmIdentifier, this flag will have the parameter set to NULL by default. Use this for PKCS#1. Note: if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override.

          • EVP_MD_FLAG_DIGALGID_ABSENT

            When setting up a DigestAlgorithmIdentifier, this flag will have the parameter be left absent by default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.

          • EVP_MD_FLAG_DIGALGID_CUSTOM

            Custom DigestAlgorithmIdentifier handling via ctrl, with EVP_MD_FLAG_DIGALGID_ABSENT as default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. Currently unused.

          • EVP_MD_FLAG_FIPS

            This digest method is suitable for use in FIPS mode. Currently unused.

          EVP_MD_meth_set_init() sets the digest init function for md. The digest init function is called by EVP_Digest(), EVP_DigestInit(), EVP_DigestInit_ex(), EVP_SignInit, EVP_SignInit_ex(), EVP_VerifyInit() and EVP_VerifyInit_ex().

          EVP_MD_meth_set_update() sets the digest update function for md. The digest update function is called by EVP_Digest(), EVP_DigestUpdate() and EVP_SignUpdate().

          EVP_MD_meth_set_final() sets the digest final function for md. The digest final function is called by EVP_Digest(), EVP_DigestFinal(), EVP_DigestFinal_ex(), EVP_SignFinal() and EVP_VerifyFinal().

          EVP_MD_meth_set_copy() sets the function for md to do extra computations after the method's private data structure has been copied from one EVP_MD_CTX to another. If all that's needed is to copy the data, there is no need for this copy function. Note that the copy function is passed two EVP_MD_CTX *, the private data structure is then available with EVP_MD_CTX_get0_md_data(). This copy function is called by EVP_MD_CTX_copy() and EVP_MD_CTX_copy_ex().

          EVP_MD_meth_set_cleanup() sets the function for md to do extra cleanup before the method's private data structure is cleaned out and freed. Note that the cleanup function is passed a EVP_MD_CTX *, the private data structure is then available with EVP_MD_CTX_get0_md_data(). This cleanup function is called by EVP_MD_CTX_reset() and EVP_MD_CTX_free().

          EVP_MD_meth_set_ctrl() sets the control function for md. See EVP_MD_CTX_ctrl(3) for the available controls.

          EVP_MD_meth_get_input_blocksize(), EVP_MD_meth_get_result_size(), EVP_MD_meth_get_app_datasize(), EVP_MD_meth_get_flags(), EVP_MD_meth_get_init(), EVP_MD_meth_get_update(), EVP_MD_meth_get_final(), EVP_MD_meth_get_copy(), EVP_MD_meth_get_cleanup() and EVP_MD_meth_get_ctrl() are all used to retrieve the method data given with the EVP_MD_meth_set_*() functions above.

          "},{"location":"man3/EVP_MD_meth_new/#return-values","title":"RETURN VALUES","text":"

          EVP_MD_meth_new() and EVP_MD_meth_dup() return a pointer to a newly created EVP_MD, or NULL on failure. All EVP_MD_meth_set_*() functions return 1. EVP_MD_get_input_blocksize(), EVP_MD_meth_get_result_size(), EVP_MD_meth_get_app_datasize() and EVP_MD_meth_get_flags() return the indicated sizes or flags. All other EVP_CIPHER_meth_get_*() functions return pointers to their respective md function.

          "},{"location":"man3/EVP_MD_meth_new/#see-also","title":"SEE ALSO","text":"

          EVP_DigestInit(3), EVP_SignInit(3), EVP_VerifyInit(3)

          "},{"location":"man3/EVP_MD_meth_new/#history","title":"HISTORY","text":"

          All of these functions were deprecated in OpenSSL 3.0.

          The EVP_MD structure was openly available in OpenSSL before version 1.1. The functions described here were added in OpenSSL 1.1. The EVP_MD structure created with these functions became reference counted in OpenSSL 3.0.

          "},{"location":"man3/EVP_MD_meth_new/#copyright","title":"COPYRIGHT","text":"

          Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_OpenInit/","title":"EVP_OpenInit","text":""},{"location":"man3/EVP_OpenInit/#name","title":"NAME","text":"

          EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption

          "},{"location":"man3/EVP_OpenInit/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,\n                 int ekl, unsigned char *iv, EVP_PKEY *priv);\nint EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                   int *outl, unsigned char *in, int inl);\nint EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n
          "},{"location":"man3/EVP_OpenInit/#description","title":"DESCRIPTION","text":"

          The EVP envelope routines are a high-level interface to envelope decryption. They decrypt a public key encrypted symmetric key and then decrypt data using it.

          EVP_OpenInit() initializes a cipher context ctx for decryption with cipher type. It decrypts the encrypted symmetric key of length ekl bytes passed in the ek parameter using the private key priv. The IV is supplied in the iv parameter.

          EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as documented on the EVP_EncryptInit(3) manual page.

          "},{"location":"man3/EVP_OpenInit/#notes","title":"NOTES","text":"

          It is possible to call EVP_OpenInit() twice in the same way as EVP_DecryptInit(). The first call should have priv set to NULL and (after setting any cipher parameters) it should be called again with type set to NULL.

          If the cipher passed in the type parameter is a variable length cipher then the key length will be set to the value of the recovered key length. If the cipher is a fixed length cipher then the recovered key length must match the fixed cipher length.

          "},{"location":"man3/EVP_OpenInit/#return-values","title":"RETURN VALUES","text":"

          EVP_OpenInit() returns 0 on error or a non zero integer (actually the recovered secret key size) if successful.

          EVP_OpenUpdate() returns 1 for success or 0 for failure.

          EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success.

          "},{"location":"man3/EVP_OpenInit/#see-also","title":"SEE ALSO","text":"

          evp(7), RAND_bytes(3), EVP_EncryptInit(3), EVP_SealInit(3)

          "},{"location":"man3/EVP_OpenInit/#copyright","title":"COPYRIGHT","text":"

          Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PBE_CipherInit/","title":"EVP_PBE_CipherInit","text":""},{"location":"man3/EVP_PBE_CipherInit/#name","title":"NAME","text":"

          EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex, EVP_PBE_find, EVP_PBE_find_ex, EVP_PBE_alg_add_type, EVP_PBE_alg_add - Password based encryption routines

          "},{"location":"man3/EVP_PBE_CipherInit/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,\n                       ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);\nint EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,\n                          ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de,\n                          OSSL_LIB_CTX *libctx, const char *propq);\n\nint EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,\n                 EVP_PBE_KEYGEN **pkeygen);\nint EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,\n                    EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex);\n\nint EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,\n                         int md_nid, EVP_PBE_KEYGEN *keygen);\nint EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,\n                    EVP_PBE_KEYGEN *keygen);\n
          "},{"location":"man3/EVP_PBE_CipherInit/#description","title":"DESCRIPTION","text":""},{"location":"man3/EVP_PBE_CipherInit/#pbe-operations","title":"PBE operations","text":"

          EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() initialise an EVP_CIPHER_CTX ctx for encryption (en_de=1) or decryption (en_de=0) using the password pass of length passlen. The PBE algorithm type and parameters are extracted from an OID pbe_obj and parameters param.

          EVP_PBE_CipherInit_ex() also allows the application to specify a library context libctx and property query propq to select appropriate algorithm implementations.

          "},{"location":"man3/EVP_PBE_CipherInit/#pbe-algorithm-search","title":"PBE algorithm search","text":"

          EVP_PBE_find() and EVP_PBE_find_ex() search for a matching algorithm using two parameters:

          1. An algorithm type type which can be:

          • EVP_PBE_TYPE_OUTER - A PBE algorithm
          • EVP_PBE_TYPE_PRF - A pseudo-random function
          • EVP_PBE_TYPE_KDF - A key derivation function

          2. A pbe_nid which can represent the algorithm identifier with parameters e.g. NID_pbeWithSHA1AndRC2_CBC or an algorithm class e.g. NID_pbes2.

          They return the algorithm's cipher ID pcnid, digest ID pmnid and a key generation function for the algorithm pkeygen. EVP_PBE_CipherInit_ex() also returns an extended key generation function keygen_ex which takes a library context and property query.

          If a NULL is supplied for any of pcnid, pmnid, pkeygen or pkeygen_ex then this parameter is not returned.

          "},{"location":"man3/EVP_PBE_CipherInit/#pbe-algorithm-add","title":"PBE algorithm add","text":"

          EVP_PBE_alg_add_type() and EVP_PBE_alg_add() add an algorithm to the list of known algorithms. Their parameters have the same meaning as for EVP_PBE_find() and EVP_PBE_find_ex() functions.

          "},{"location":"man3/EVP_PBE_CipherInit/#notes","title":"NOTES","text":"

          The arguments pbe_obj and param to EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() together form an X509_ALGOR and can often be extracted directly from this structure.

          "},{"location":"man3/EVP_PBE_CipherInit/#return-values","title":"RETURN VALUES","text":"

          Return value is 1 for success and 0 if an error occurred.

          "},{"location":"man3/EVP_PBE_CipherInit/#see-also","title":"SEE ALSO","text":"

          PKCS5_PBE_keyivgen(3), PKCS12_PBE_keyivgen_ex(3), PKCS5_v2_PBE_keyivgen_ex(3), PKCS12_pbe_crypt_ex(3), PKCS12_create_ex(3)

          "},{"location":"man3/EVP_PBE_CipherInit/#history","title":"HISTORY","text":"

          EVP_PBE_CipherInit_ex() and EVP_PBE_find_ex() were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PBE_CipherInit/#copyright","title":"COPYRIGHT","text":"

          Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY2PKCS8/","title":"EVP_PKEY2PKCS8","text":""},{"location":"man3/EVP_PKEY2PKCS8/#name","title":"NAME","text":"

          EVP_PKEY2PKCS8, EVP_PKCS82PKEY_ex, EVP_PKCS82PKEY - Convert a private key to/from PKCS8

          "},{"location":"man3/EVP_PKEY2PKCS8/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/x509.h>\n\nPKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(const EVP_PKEY *pkey);\nEVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8);\nEVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx,\n                            const char *propq);\n
          "},{"location":"man3/EVP_PKEY2PKCS8/#description","title":"DESCRIPTION","text":"

          EVP_PKEY2PKCS8() converts a private key pkey into a returned PKCS8 object.

          EVP_PKCS82PKEY_ex() converts a PKCS8 object p8 into a returned private key. It uses libctx and propq when fetching algorithms.

          EVP_PKCS82PKEY() is similar to EVP_PKCS82PKEY_ex() but uses default values of NULL for the libctx and propq.

          "},{"location":"man3/EVP_PKEY2PKCS8/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY2PKCS8() returns a PKCS8 object on success. EVP_PKCS82PKEY() and EVP_PKCS82PKEY_ex() return a private key on success.

          All functions return NULL if the operation fails.

          "},{"location":"man3/EVP_PKEY2PKCS8/#see-also","title":"SEE ALSO","text":"

          PKCS8_pkey_add1_attr(3),

          "},{"location":"man3/EVP_PKEY2PKCS8/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/","title":"EVP_PKEY_ASN1_METHOD","text":""},{"location":"man3/EVP_PKEY_ASN1_METHOD/#name","title":"NAME","text":"

          EVP_PKEY_ASN1_METHOD, EVP_PKEY_asn1_new, EVP_PKEY_asn1_copy, EVP_PKEY_asn1_free, EVP_PKEY_asn1_add0, EVP_PKEY_asn1_add_alias, EVP_PKEY_asn1_set_public, EVP_PKEY_asn1_set_private, EVP_PKEY_asn1_set_param, EVP_PKEY_asn1_set_free, EVP_PKEY_asn1_set_ctrl, EVP_PKEY_asn1_set_item, EVP_PKEY_asn1_set_siginf, EVP_PKEY_asn1_set_check, EVP_PKEY_asn1_set_public_check, EVP_PKEY_asn1_set_param_check, EVP_PKEY_asn1_set_security_bits, EVP_PKEY_asn1_set_set_priv_key, EVP_PKEY_asn1_set_set_pub_key, EVP_PKEY_asn1_set_get_priv_key, EVP_PKEY_asn1_set_get_pub_key, EVP_PKEY_get0_asn1 - manipulating and registering EVP_PKEY_ASN1_METHOD structure

          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\ntypedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;\n\nEVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,\n                                        const char *pem_str,\n                                        const char *info);\nvoid EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,\n                        const EVP_PKEY_ASN1_METHOD *src);\nvoid EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);\nint EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);\nint EVP_PKEY_asn1_add_alias(int to, int from);\n\nvoid EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,\n                              int (*pub_decode) (EVP_PKEY *pk,\n                                                 const X509_PUBKEY *pub),\n                              int (*pub_encode) (X509_PUBKEY *pub,\n                                                 const EVP_PKEY *pk),\n                              int (*pub_cmp) (const EVP_PKEY *a,\n                                              const EVP_PKEY *b),\n                              int (*pub_print) (BIO *out,\n                                                const EVP_PKEY *pkey,\n                                                int indent, ASN1_PCTX *pctx),\n                              int (*pkey_size) (const EVP_PKEY *pk),\n                              int (*pkey_bits) (const EVP_PKEY *pk));\nvoid EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,\n                               int (*priv_decode) (EVP_PKEY *pk,\n                                                   const PKCS8_PRIV_KEY_INFO\n                                                   *p8inf),\n                               int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8,\n                                                   const EVP_PKEY *pk),\n                               int (*priv_print) (BIO *out,\n                                                  const EVP_PKEY *pkey,\n                                                  int indent,\n                                                  ASN1_PCTX *pctx));\nvoid EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,\n                             int (*param_decode) (EVP_PKEY *pkey,\n                                                  const unsigned char **pder,\n                                                  int derlen),\n                             int (*param_encode) (const EVP_PKEY *pkey,\n                                                  unsigned char **pder),\n                             int (*param_missing) (const EVP_PKEY *pk),\n                             int (*param_copy) (EVP_PKEY *to,\n                                                const EVP_PKEY *from),\n                             int (*param_cmp) (const EVP_PKEY *a,\n                                               const EVP_PKEY *b),\n                             int (*param_print) (BIO *out,\n                                                 const EVP_PKEY *pkey,\n                                                 int indent,\n                                                 ASN1_PCTX *pctx));\n\nvoid EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,\n                            void (*pkey_free) (EVP_PKEY *pkey));\nvoid EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,\n                            int (*pkey_ctrl) (EVP_PKEY *pkey, int op,\n                                              long arg1, void *arg2));\nvoid EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth,\n                            int (*item_verify) (EVP_MD_CTX *ctx,\n                                                const ASN1_ITEM *it,\n                                                void *asn,\n                                                X509_ALGOR *a,\n                                                ASN1_BIT_STRING *sig,\n                                                EVP_PKEY *pkey),\n                            int (*item_sign) (EVP_MD_CTX *ctx,\n                                              const ASN1_ITEM *it,\n                                              void *asn,\n                                              X509_ALGOR *alg1,\n                                              X509_ALGOR *alg2,\n                                              ASN1_BIT_STRING *sig));\n\nvoid EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth,\n                              int (*siginf_set) (X509_SIG_INFO *siginf,\n                                                 const X509_ALGOR *alg,\n                                                 const ASN1_STRING *sig));\n\nvoid EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,\n                             int (*pkey_check) (const EVP_PKEY *pk));\n\nvoid EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,\n                                    int (*pkey_pub_check) (const EVP_PKEY *pk));\n\nvoid EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,\n                                   int (*pkey_param_check) (const EVP_PKEY *pk));\n\nvoid EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,\n                                     int (*pkey_security_bits) (const EVP_PKEY\n                                                                *pk));\n\nvoid EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                    int (*set_priv_key) (EVP_PKEY *pk,\n                                                         const unsigned char\n                                                            *priv,\n                                                         size_t len));\n\nvoid EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                   int (*set_pub_key) (EVP_PKEY *pk,\n                                                       const unsigned char *pub,\n                                                       size_t len));\n\nvoid EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                    int (*get_priv_key) (const EVP_PKEY *pk,\n                                                         unsigned char *priv,\n                                                         size_t *len));\n\nvoid EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                   int (*get_pub_key) (const EVP_PKEY *pk,\n                                                       unsigned char *pub,\n                                                       size_t *len));\n\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey);\n
          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_ASN1_METHOD is a structure which holds a set of ASN.1 conversion, printing and information methods for a specific public key algorithm.

          There are two places where the EVP_PKEY_ASN1_METHOD objects are stored: one is a built-in array representing the standard methods for different algorithms, and the other one is a stack of user-defined application-specific methods, which can be manipulated by using EVP_PKEY_asn1_add0(3).

          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#methods","title":"Methods","text":"

          The methods are the underlying implementations of a particular public key algorithm present by the EVP_PKEY object.

          int (*pub_decode) (EVP_PKEY *pk, const X509_PUBKEY *pub);\nint (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk);\nint (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);\nint (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent,\n                  ASN1_PCTX *pctx);\n

          The pub_decode() and pub_encode() methods are called to decode / encode X509_PUBKEY ASN.1 parameters to / from pk. They MUST return 0 on error, 1 on success. They're called by X509_PUBKEY_get0(3) and X509_PUBKEY_set(3).

          The pub_cmp() method is called when two public keys are to be compared. It MUST return 1 when the keys are equal, 0 otherwise. It's called by EVP_PKEY_eq(3).

          The pub_print() method is called to print a public key in humanly readable text to out, indented indent spaces. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_print_public(3).

          int (*priv_decode) (EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);\nint (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);\nint (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent,\n                   ASN1_PCTX *pctx);\n

          The priv_decode() and priv_encode() methods are called to decode / encode PKCS8_PRIV_KEY_INFO form private key to / from pk. They MUST return 0 on error, 1 on success. They're called by EVP_PKCS82PKEY(3) and EVP_PKEY2PKCS8(3).

          The priv_print() method is called to print a private key in humanly readable text to out, indented indent spaces. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_print_private(3).

          int (*pkey_size) (const EVP_PKEY *pk);\nint (*pkey_bits) (const EVP_PKEY *pk);\nint (*pkey_security_bits) (const EVP_PKEY *pk);\n

          The pkey_size() method returns the key size in bytes. It's called by EVP_PKEY_get_size(3).

          The pkey_bits() method returns the key size in bits. It's called by EVP_PKEY_get_bits(3).

          int (*param_decode) (EVP_PKEY *pkey,\n                     const unsigned char **pder, int derlen);\nint (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder);\nint (*param_missing) (const EVP_PKEY *pk);\nint (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from);\nint (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);\nint (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent,\n                    ASN1_PCTX *pctx);\n

          The param_decode() and param_encode() methods are called to decode / encode DER formatted parameters to / from pk. They MUST return 0 on error, 1 on success. They're called by PEM_read_bio_Parameters(3) and the file: OSSL_STORE_LOADER(3).

          The param_missing() method returns 0 if a key parameter is missing, otherwise 1. It's called by EVP_PKEY_missing_parameters(3).

          The param_copy() method copies key parameters from from to to. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_copy_parameters(3).

          The param_cmp() method compares the parameters of keys a and b. It MUST return 1 when the keys are equal, 0 when not equal, or a negative number on error. It's called by EVP_PKEY_parameters_eq(3).

          The param_print() method prints the private key parameters in humanly readable text to out, indented indent spaces. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_print_params(3).

          int (*sig_print) (BIO *out,\n                  const X509_ALGOR *sigalg, const ASN1_STRING *sig,\n                  int indent, ASN1_PCTX *pctx);\n

          The sig_print() method prints a signature in humanly readable text to out, indented indent spaces. sigalg contains the exact signature algorithm. If the signature in sig doesn't correspond to what this method expects, X509_signature_dump() must be used as a last resort. It MUST return 0 on error, 1 on success. It's called by X509_signature_print(3).

          void (*pkey_free) (EVP_PKEY *pkey);\n

          The pkey_free() method helps freeing the internals of pkey. It's called by EVP_PKEY_free(3), EVP_PKEY_set_type(3), EVP_PKEY_set_type_str(3), and EVP_PKEY_assign(3).

          int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2);\n

          The pkey_ctrl() method adds extra algorithm specific control. It's called by EVP_PKEY_get_default_digest_nid(3), EVP_PKEY_set1_encoded_public_key(3), EVP_PKEY_get1_encoded_public_key(3), PKCS7_SIGNER_INFO_set(3), PKCS7_RECIP_INFO_set(3), ...

          int (*old_priv_decode) (EVP_PKEY *pkey,\n                        const unsigned char **pder, int derlen);\nint (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder);\n

          The old_priv_decode() and old_priv_encode() methods decode / encode they private key pkey from / to a DER formatted array. These are exclusively used to help decoding / encoding older (pre PKCS#8) PEM formatted encrypted private keys. old_priv_decode() MUST return 0 on error, 1 on success. old_priv_encode() MUST the return same kind of values as i2d_PrivateKey(). They're called by d2i_PrivateKey(3) and i2d_PrivateKey(3).

          int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,\n                    X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);\nint (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,\n                  X509_ALGOR *alg1, X509_ALGOR *alg2,\n                  ASN1_BIT_STRING *sig);\n

          The item_sign() and item_verify() methods make it possible to have algorithm specific signatures and verification of them.

          item_sign() MUST return one of:

          • <=0

            error

          • 1

            item_sign() did everything, OpenSSL internals just needs to pass the signature length back.

          • 2

            item_sign() did nothing, OpenSSL internal standard routines are expected to continue with the default signature production.

          • 3

            item_sign() set the algorithm identifier algor1 and algor2, OpenSSL internals should just sign using those algorithms.

          item_verify() MUST return one of:

          • <=0

            error

          • 1

            item_sign() did everything, OpenSSL internals just needs to pass the signature length back.

          • 2

            item_sign() did nothing, OpenSSL internal standard routines are expected to continue with the default signature production.

          item_verify() and item_sign() are called by ASN1_item_verify(3) and ASN1_item_sign(3), and by extension, X509_verify(3), X509_REQ_verify(3), X509_sign(3), X509_REQ_sign(3), ...

          int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg,\n                   const ASN1_STRING *sig);\n

          The siginf_set() method is used to set custom X509_SIG_INFO parameters. It MUST return 0 on error, or 1 on success. It's called as part of X509_check_purpose(3), X509_check_ca(3) and X509_check_issued(3).

          int (*pkey_check) (const EVP_PKEY *pk);\nint (*pkey_public_check) (const EVP_PKEY *pk);\nint (*pkey_param_check) (const EVP_PKEY *pk);\n

          The pkey_check(), pkey_public_check() and pkey_param_check() methods are used to check the validity of pk for key-pair, public component and parameters, respectively. They MUST return 0 for an invalid key, or 1 for a valid key. They are called by EVP_PKEY_check(3), EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) respectively.

          int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len);\nint (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len);\n

          The set_priv_key() and set_pub_key() methods are used to set the raw private and public key data for an EVP_PKEY. They MUST return 0 on error, or 1 on success. They are called by EVP_PKEY_new_raw_private_key(3), and EVP_PKEY_new_raw_public_key(3) respectively.

          size_t (*dirty) (const EVP_PKEY *pk);\nvoid *(*export_to) (const EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);\n

          dirty_cnt() returns the internal key's dirty count. This can be used to synchronise different copies of the same keys.

          The export_to() method exports the key material from the given key to a provider, through the EVP_KEYMGMT(3) interface, if that provider supports importing key material.

          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#functions","title":"Functions","text":"

          EVP_PKEY_asn1_new() creates and returns a new EVP_PKEY_ASN1_METHOD object, and associates the given id, flags, pem_str and info. id is a NID, pem_str is the PEM type string, info is a descriptive string. The following flags are supported:

          ASN1_PKEY_SIGPARAM_NULL\n

          If ASN1_PKEY_SIGPARAM_NULL is set, then the signature algorithm parameters are given the type V_ASN1_NULL by default, otherwise they will be given the type V_ASN1_UNDEF (i.e. the parameter is omitted). See X509_ALGOR_set0(3) for more information.

          EVP_PKEY_asn1_copy() copies an EVP_PKEY_ASN1_METHOD object from src to dst. This function is not thread safe, it's recommended to only use this when initializing the application.

          EVP_PKEY_asn1_free() frees an existing EVP_PKEY_ASN1_METHOD pointed by ameth. If the argument is NULL, nothing is done.

          EVP_PKEY_asn1_add0() adds ameth to the user defined stack of methods unless another EVP_PKEY_ASN1_METHOD with the same NID is already there. This function is not thread safe, it's recommended to only use this when initializing the application.

          EVP_PKEY_asn1_add_alias() creates an alias with the NID to for the EVP_PKEY_ASN1_METHOD with NID from unless another EVP_PKEY_ASN1_METHOD with the same NID is already added. This function is not thread safe, it's recommended to only use this when initializing the application.

          EVP_PKEY_asn1_set_public(), EVP_PKEY_asn1_set_private(), EVP_PKEY_asn1_set_param(), EVP_PKEY_asn1_set_free(), EVP_PKEY_asn1_set_ctrl(), EVP_PKEY_asn1_set_item(), EVP_PKEY_asn1_set_siginf(), EVP_PKEY_asn1_set_check(), EVP_PKEY_asn1_set_public_check(), EVP_PKEY_asn1_set_param_check(), EVP_PKEY_asn1_set_security_bits(), EVP_PKEY_asn1_set_set_priv_key(), EVP_PKEY_asn1_set_set_pub_key(), EVP_PKEY_asn1_set_get_priv_key() and EVP_PKEY_asn1_set_get_pub_key() set the diverse methods of the given EVP_PKEY_ASN1_METHOD object.

          EVP_PKEY_get0_asn1() finds the EVP_PKEY_ASN1_METHOD associated with the key pkey.

          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_asn1_new() returns NULL on error, or a pointer to an EVP_PKEY_ASN1_METHOD object otherwise.

          EVP_PKEY_asn1_add0() and EVP_PKEY_asn1_add_alias() return 0 on error, or 1 on success.

          EVP_PKEY_get0_asn1() returns NULL on error, or a pointer to a constant EVP_PKEY_ASN1_METHOD object otherwise.

          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#history","title":"HISTORY","text":"

          The signature of the pub_decode functional argument of EVP_PKEY_asn1_set_public() has changed in OpenSSL 3.0 so its pub parameter is now constified.

          "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#copyright","title":"COPYRIGHT","text":"

          Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/","title":"EVP_PKEY_CTX_ctrl","text":""},{"location":"man3/EVP_PKEY_CTX_ctrl/#name","title":"NAME","text":"

          EVP_PKEY_CTX_ctrl, EVP_PKEY_CTX_ctrl_str, EVP_PKEY_CTX_ctrl_uint64, EVP_PKEY_CTX_md, EVP_PKEY_CTX_set_signature_md, EVP_PKEY_CTX_get_signature_md, EVP_PKEY_CTX_set_mac_key, EVP_PKEY_CTX_set_group_name, EVP_PKEY_CTX_get_group_name, EVP_PKEY_CTX_set_rsa_padding, EVP_PKEY_CTX_get_rsa_padding, EVP_PKEY_CTX_set_rsa_pss_saltlen, EVP_PKEY_CTX_get_rsa_pss_saltlen, EVP_PKEY_CTX_set_rsa_keygen_bits, EVP_PKEY_CTX_set_rsa_keygen_pubexp, EVP_PKEY_CTX_set1_rsa_keygen_pubexp, EVP_PKEY_CTX_set_rsa_keygen_primes, EVP_PKEY_CTX_set_rsa_mgf1_md_name, EVP_PKEY_CTX_set_rsa_mgf1_md, EVP_PKEY_CTX_get_rsa_mgf1_md, EVP_PKEY_CTX_get_rsa_mgf1_md_name, EVP_PKEY_CTX_set_rsa_oaep_md_name, EVP_PKEY_CTX_set_rsa_oaep_md, EVP_PKEY_CTX_get_rsa_oaep_md, EVP_PKEY_CTX_get_rsa_oaep_md_name, EVP_PKEY_CTX_set0_rsa_oaep_label, EVP_PKEY_CTX_get0_rsa_oaep_label, EVP_PKEY_CTX_set_dsa_paramgen_bits, EVP_PKEY_CTX_set_dsa_paramgen_q_bits, EVP_PKEY_CTX_set_dsa_paramgen_md, EVP_PKEY_CTX_set_dsa_paramgen_md_props, EVP_PKEY_CTX_set_dsa_paramgen_gindex, EVP_PKEY_CTX_set_dsa_paramgen_type, EVP_PKEY_CTX_set_dsa_paramgen_seed, EVP_PKEY_CTX_set_dh_paramgen_prime_len, EVP_PKEY_CTX_set_dh_paramgen_subprime_len, EVP_PKEY_CTX_set_dh_paramgen_generator, EVP_PKEY_CTX_set_dh_paramgen_type, EVP_PKEY_CTX_set_dh_paramgen_gindex, EVP_PKEY_CTX_set_dh_paramgen_seed, EVP_PKEY_CTX_set_dh_rfc5114, EVP_PKEY_CTX_set_dhx_rfc5114, EVP_PKEY_CTX_set_dh_pad, EVP_PKEY_CTX_set_dh_nid, EVP_PKEY_CTX_set_dh_kdf_type, EVP_PKEY_CTX_get_dh_kdf_type, EVP_PKEY_CTX_set0_dh_kdf_oid, EVP_PKEY_CTX_get0_dh_kdf_oid, EVP_PKEY_CTX_set_dh_kdf_md, EVP_PKEY_CTX_get_dh_kdf_md, EVP_PKEY_CTX_set_dh_kdf_outlen, EVP_PKEY_CTX_get_dh_kdf_outlen, EVP_PKEY_CTX_set0_dh_kdf_ukm, EVP_PKEY_CTX_get0_dh_kdf_ukm, EVP_PKEY_CTX_set_ec_paramgen_curve_nid, EVP_PKEY_CTX_set_ec_param_enc, EVP_PKEY_CTX_set_ecdh_cofactor_mode, EVP_PKEY_CTX_get_ecdh_cofactor_mode, EVP_PKEY_CTX_set_ecdh_kdf_type, EVP_PKEY_CTX_get_ecdh_kdf_type, EVP_PKEY_CTX_set_ecdh_kdf_md, EVP_PKEY_CTX_get_ecdh_kdf_md, EVP_PKEY_CTX_set_ecdh_kdf_outlen, EVP_PKEY_CTX_get_ecdh_kdf_outlen, EVP_PKEY_CTX_set0_ecdh_kdf_ukm, EVP_PKEY_CTX_get0_ecdh_kdf_ukm, EVP_PKEY_CTX_set1_id, EVP_PKEY_CTX_get1_id, EVP_PKEY_CTX_get1_id_len, EVP_PKEY_CTX_set_kem_op - algorithm specific control operations

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,\n                      int cmd, int p1, void *p2);\nint EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype,\n                             int cmd, uint64_t value);\nint EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,\n                          const char *value);\n\nint EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md);\n\nint EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **pmd);\n\nint EVP_PKEY_CTX_set_mac_key(EVP_PKEY_CTX *ctx, const unsigned char *key,\n                             int len);\nint EVP_PKEY_CTX_set_group_name(EVP_PKEY_CTX *ctx, const char *name);\nint EVP_PKEY_CTX_get_group_name(EVP_PKEY_CTX *ctx, char *name, size_t namelen);\n\nint EVP_PKEY_CTX_set_kem_op(EVP_PKEY_CTX *ctx, const char *op);\n\n#include <openssl/rsa.h>\n\nint EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad);\nint EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx, int *pad);\nint EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int saltlen);\nint EVP_PKEY_CTX_get_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int *saltlen);\nint EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits);\nint EVP_PKEY_CTX_set1_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);\nint EVP_PKEY_CTX_set_rsa_keygen_primes(EVP_PKEY_CTX *ctx, int primes);\nint EVP_PKEY_CTX_set_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, const char *mdname,\n                                    const char *mdprops);\nint EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_get_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, char *name,\n                                      size_t namelen);\nint EVP_PKEY_CTX_set_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, const char *mdname,\n                                      const char *mdprops);\nint EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_get_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, char *name,\n                                      size_t namelen);\nint EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, void *label,\n                                     int len);\nint EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char **label);\n\n#include <openssl/dsa.h>\n\nint EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);\nint EVP_PKEY_CTX_set_dsa_paramgen_q_bits(EVP_PKEY_CTX *ctx, int qbits);\nint EVP_PKEY_CTX_set_dsa_paramgen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_set_dsa_paramgen_md_props(EVP_PKEY_CTX *ctx,\n                                           const char *md_name,\n                                           const char *md_properties);\nint EVP_PKEY_CTX_set_dsa_paramgen_type(EVP_PKEY_CTX *ctx, const char *name);\nint EVP_PKEY_CTX_set_dsa_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex);\nint EVP_PKEY_CTX_set_dsa_paramgen_seed(EVP_PKEY_CTX *ctx,\n                                       const unsigned char *seed,\n                                       size_t seedlen);\n\n#include <openssl/dh.h>\n\nint EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_set_dh_paramgen_subprime_len(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);\nint EVP_PKEY_CTX_set_dh_paramgen_type(EVP_PKEY_CTX *ctx, int type);\nint EVP_PKEY_CTX_set_dh_pad(EVP_PKEY_CTX *ctx, int pad);\nint EVP_PKEY_CTX_set_dh_nid(EVP_PKEY_CTX *ctx, int nid);\nint EVP_PKEY_CTX_set_dh_rfc5114(EVP_PKEY_CTX *ctx, int rfc5114);\nint EVP_PKEY_CTX_set_dhx_rfc5114(EVP_PKEY_CTX *ctx, int rfc5114);\nint EVP_PKEY_CTX_set_dh_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex);\nint EVP_PKEY_CTX_set_dh_paramgen_seed(EVP_PKEY_CTX *ctx,\n                                       const unsigned char *seed,\n                                       size_t seedlen);\nint EVP_PKEY_CTX_set_dh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);\nint EVP_PKEY_CTX_get_dh_kdf_type(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_set0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT *oid);\nint EVP_PKEY_CTX_get0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT **oid);\nint EVP_PKEY_CTX_set_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_set_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_get_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);\nint EVP_PKEY_CTX_set0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len);\n\n#include <openssl/ec.h>\n\nint EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);\nint EVP_PKEY_CTX_set_ec_param_enc(EVP_PKEY_CTX *ctx, int param_enc);\nint EVP_PKEY_CTX_set_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx, int cofactor_mode);\nint EVP_PKEY_CTX_get_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_set_ecdh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);\nint EVP_PKEY_CTX_get_ecdh_kdf_type(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_set_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_set_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_get_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);\nint EVP_PKEY_CTX_set0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len);\n\nint EVP_PKEY_CTX_set1_id(EVP_PKEY_CTX *ctx, void *id, size_t id_len);\nint EVP_PKEY_CTX_get1_id(EVP_PKEY_CTX *ctx, void *id);\nint EVP_PKEY_CTX_get1_id_len(EVP_PKEY_CTX *ctx, size_t *id_len);\n

          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          #include <openssl/rsa.h>\n\nint EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);\n\n#include <openssl/dh.h>\n\nint EVP_PKEY_CTX_get0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);\n\n#include <openssl/ec.h>\n\nint EVP_PKEY_CTX_get0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);\n
          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_CTX_ctrl() sends a control operation to the context ctx. The key type used must match keytype if it is not -1. The parameter optype is a mask indicating which operations the control can be applied to. The control command is indicated in cmd and any additional arguments in p1 and p2.

          For cmd = EVP_PKEY_CTRL_SET_MAC_KEY, p1 is the length of the MAC key, and p2 is the MAC key. This is used by Poly1305, SipHash, HMAC and CMAC.

          Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will instead call one of the algorithm specific functions below.

          EVP_PKEY_CTX_ctrl_uint64() is a wrapper that directly passes a uint64 value as p2 to EVP_PKEY_CTX_ctrl().

          EVP_PKEY_CTX_ctrl_str() allows an application to send an algorithm specific control operation to a context ctx in string form. This is intended to be used for options specified on the command line or in text files. The commands supported are documented in the openssl utility command line pages for the option -pkeyopt which is supported by the pkeyutl, genpkey and req commands.

          EVP_PKEY_CTX_md() sends a message digest control operation to the context ctx. The message digest is specified by its name md.

          EVP_PKEY_CTX_set_signature_md() sets the message digest type used in a signature. It can be used in the RSA, DSA and ECDSA algorithms.

          EVP_PKEY_CTX_get_signature_md()gets the message digest type used in a signature. It can be used in the RSA, DSA and ECDSA algorithms.

          Key generation typically involves setting up parameters to be used and generating the private and public key data. Some algorithm implementations allow private key data to be set explicitly using EVP_PKEY_CTX_set_mac_key(). In this case key generation is simply the process of setting up the parameters for the key and then setting the raw key data to the value explicitly. Normally applications would call EVP_PKEY_new_raw_private_key(3) or similar functions instead.

          EVP_PKEY_CTX_set_mac_key() can be used with any of the algorithms supported by the EVP_PKEY_new_raw_private_key(3) function.

          EVP_PKEY_CTX_set_group_name() sets the group name to name for parameter and key generation. For example for EC keys this will set the curve name and for DH keys it will set the name of the finite field group.

          EVP_PKEY_CTX_get_group_name() finds the group name that's currently set with ctx, and writes it to the location that name points at, as long as its size namelen is large enough to store that name, including a terminating NUL byte.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#rsa-parameters","title":"RSA parameters","text":"

          EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for ctx. The pad parameter can take the value RSA_PKCS1_PADDING for PKCS#1 padding, RSA_NO_PADDING for no padding, RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt only), RSA_X931_PADDING for X9.31 padding (signature operations only), RSA_PKCS1_PSS_PADDING (sign and verify only) and RSA_PKCS1_WITH_TLS_PADDING for TLS RSA ClientKeyExchange message padding (decryption only).

          Two RSA padding modes behave differently if EVP_PKEY_CTX_set_signature_md() is used. If this function is called for PKCS#1 padding the plaintext buffer is an actual digest value and is encapsulated in a DigestInfo structure according to PKCS#1 when signing and this structure is expected (and stripped off) when verifying. If this control is not used with RSA and PKCS#1 padding then the supplied data is used directly and not encapsulated. In the case of X9.31 padding for RSA the algorithm identifier byte is added or checked and removed if this control is called. If it is not called then the first byte of the plaintext buffer is expected to be the algorithm identifier byte.

          EVP_PKEY_CTX_get_rsa_padding() gets the RSA padding mode for ctx.

          EVP_PKEY_CTX_set_rsa_pss_saltlen() sets the RSA PSS salt length to saltlen. As its name implies it is only supported for PSS padding. If this function is not called then the salt length is maximized up to the digest length when signing and auto detection when verifying. Four special values are supported:

          • RSA_PSS_SALTLEN_DIGEST

            sets the salt length to the digest length.

          • RSA_PSS_SALTLEN_MAX

            sets the salt length to the maximum permissible value.

          • RSA_PSS_SALTLEN_AUTO

            causes the salt length to be automatically determined based on the PSS block structure when verifying. When signing, it has the same meaning as RSA_PSS_SALTLEN_MAX.

          • RSA_PSS_SALTLEN_AUTO_DIGEST_MAX

            causes the salt length to be automatically determined based on the PSS block structure when verifying, like RSA_PSS_SALTLEN_AUTO. When signing, the salt length is maximized up to a maximum of the digest length to comply with FIPS 186-4 section 5.5.

          EVP_PKEY_CTX_get_rsa_pss_saltlen() gets the RSA PSS salt length for ctx. The padding mode must already have been set to RSA_PKCS1_PSS_PADDING.

          EVP_PKEY_CTX_set_rsa_keygen_bits() sets the RSA key length for RSA key generation to bits. If not specified 2048 bits is used.

          EVP_PKEY_CTX_set1_rsa_keygen_pubexp() sets the public exponent value for RSA key generation to the value stored in pubexp. Currently it should be an odd integer. In accordance with the OpenSSL naming convention, the pubexp pointer must be freed independently of the EVP_PKEY_CTX (ie, it is internally copied). If not specified 65537 is used.

          EVP_PKEY_CTX_set_rsa_keygen_pubexp() does the same as EVP_PKEY_CTX_set1_rsa_keygen_pubexp() except that there is no internal copy and therefore pubexp should not be modified or freed after the call.

          EVP_PKEY_CTX_set_rsa_keygen_primes() sets the number of primes for RSA key generation to primes. If not specified 2 is used.

          EVP_PKEY_CTX_set_rsa_mgf1_md_name() sets the MGF1 digest for RSA padding schemes to the digest named mdname. If the RSA algorithm implementation for the selected provider supports it then the digest will be fetched using the properties mdprops. If not explicitly set the signing digest is used. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING or RSA_PKCS1_PSS_PADDING.

          EVP_PKEY_CTX_set_rsa_mgf1_md() does the same as EVP_PKEY_CTX_set_rsa_mgf1_md_name() except that the name of the digest is inferred from the supplied md and it is not possible to specify any properties.

          EVP_PKEY_CTX_get_rsa_mgf1_md_name() gets the name of the MGF1 digest algorithm for ctx. If not explicitly set the signing digest is used. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING or RSA_PKCS1_PSS_PADDING.

          EVP_PKEY_CTX_get_rsa_mgf1_md() does the same as EVP_PKEY_CTX_get_rsa_mgf1_md_name() except that it returns a pointer to an EVP_MD object instead. Note that only known, built-in EVP_MD objects will be returned. The EVP_MD object may be NULL if the digest is not one of these (such as a digest only implemented in a third party provider).

          EVP_PKEY_CTX_set_rsa_oaep_md_name() sets the message digest type used in RSA OAEP to the digest named mdname. If the RSA algorithm implementation for the selected provider supports it then the digest will be fetched using the properties mdprops. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING.

          EVP_PKEY_CTX_set_rsa_oaep_md() does the same as EVP_PKEY_CTX_set_rsa_oaep_md_name() except that the name of the digest is inferred from the supplied md and it is not possible to specify any properties.

          EVP_PKEY_CTX_get_rsa_oaep_md_name() gets the message digest algorithm name used in RSA OAEP and stores it in the buffer name which is of size namelen. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING. The buffer should be sufficiently large for any expected digest algorithm names or the function will fail.

          EVP_PKEY_CTX_get_rsa_oaep_md() does the same as EVP_PKEY_CTX_get_rsa_oaep_md_name() except that it returns a pointer to an EVP_MD object instead. Note that only known, built-in EVP_MD objects will be returned. The EVP_MD object may be NULL if the digest is not one of these (such as a digest only implemented in a third party provider).

          EVP_PKEY_CTX_set0_rsa_oaep_label() sets the RSA OAEP label to binary data label and its length in bytes to len. If label is NULL or len is 0, the label is cleared. The library takes ownership of the label so the caller should not free the original memory pointed to by label. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING.

          EVP_PKEY_CTX_get0_rsa_oaep_label() gets the RSA OAEP label to label. The return value is the label length. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING. The resulting pointer is owned by the library and should not be freed by the caller.

          RSA_PKCS1_WITH_TLS_PADDING is used when decrypting an RSA encrypted TLS pre-master secret in a TLS ClientKeyExchange message. It is the same as RSA_PKCS1_PADDING except that it additionally verifies that the result is the correct length and the first two bytes are the protocol version initially requested by the client. If the encrypted content is publicly invalid then the decryption will fail. However, if the padding checks fail then decryption will still appear to succeed but a random TLS premaster secret will be returned instead. This padding mode accepts two parameters which can be set using the EVP_PKEY_CTX_set_params(3) function. These are OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION and OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION, both of which are expected to be unsigned integers. Normally only the first of these will be set and represents the TLS protocol version that was first requested by the client (e.g. 0x0303 for TLSv1.2, 0x0302 for TLSv1.1 etc). Historically some buggy clients would use the negotiated protocol version instead of the protocol version first requested. If this behaviour should be tolerated then OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION should be set to the actual negotiated protocol version. Otherwise it should be left unset.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#dsa-parameters","title":"DSA parameters","text":"

          EVP_PKEY_CTX_set_dsa_paramgen_bits() sets the number of bits used for DSA parameter generation to nbits. If not specified, 2048 is used.

          EVP_PKEY_CTX_set_dsa_paramgen_q_bits() sets the number of bits in the subprime parameter q for DSA parameter generation to qbits. If not specified, 224 is used. If a digest function is specified below, this parameter is ignored and instead, the number of bits in q matches the size of the digest.

          EVP_PKEY_CTX_set_dsa_paramgen_md() sets the digest function used for DSA parameter generation to md. If not specified, one of SHA-1, SHA-224, or SHA-256 is selected to match the bit length of q above.

          EVP_PKEY_CTX_set_dsa_paramgen_md_props() sets the digest function used for DSA parameter generation using md_name and md_properties to retrieve the digest from a provider. If not specified, md_name will be set to one of SHA-1, SHA-224, or SHA-256 depending on the bit length of q above. md_properties is a property query string that has a default value of '' if not specified.

          EVP_PKEY_CTX_set_dsa_paramgen_gindex() sets the gindex used by the generator G. The default value is -1 which uses unverifiable g, otherwise a positive value uses verifiable g. This value must be saved if key validation of g is required, since it is not part of a persisted key.

          EVP_PKEY_CTX_set_dsa_paramgen_seed() sets the seed to use for generation rather than using a randomly generated value for the seed. This is useful for testing purposes only and can fail if the seed does not produce primes for both p & q on its first iteration. This value must be saved if key validation of p, q, and verifiable g are required, since it is not part of a persisted key.

          EVP_PKEY_CTX_set_dsa_paramgen_type() sets the generation type to use FIPS186-4 generation if name is \"fips186_4\", or FIPS186-2 generation if name is \"fips186_2\". The default value for the default provider is \"fips186_2\". The default value for the FIPS provider is \"fips186_4\".

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#dh-parameters","title":"DH parameters","text":"

          EVP_PKEY_CTX_set_dh_paramgen_prime_len() sets the length of the DH prime parameter p for DH parameter generation. If this function is not called then 2048 is used. Only accepts lengths greater than or equal to 256.

          EVP_PKEY_CTX_set_dh_paramgen_subprime_len() sets the length of the DH optional subprime parameter q for DH parameter generation. The default is 256 if the prime is at least 2048 bits long or 160 otherwise. The DH paramgen type must have been set to \"fips186_4\".

          EVP_PKEY_CTX_set_dh_paramgen_generator() sets DH generator to gen for DH parameter generation. If not specified 2 is used.

          EVP_PKEY_CTX_set_dh_paramgen_type() sets the key type for DH parameter generation. The supported parameters are:

          • DH_PARAMGEN_TYPE_GROUP

            Use a named group. If only the safe prime parameter p is set this can be used to select a ffdhe safe prime group of the correct size.

          • DH_PARAMGEN_TYPE_FIPS_186_4

            FIPS186-4 FFC parameter generator.

          • DH_PARAMGEN_TYPE_FIPS_186_2

            FIPS186-2 FFC parameter generator (X9.42 DH).

          • DH_PARAMGEN_TYPE_GENERATOR

            Uses a safe prime generator g (PKCS#3 format).

          The default in the default provider is DH_PARAMGEN_TYPE_GENERATOR for the \"DH\" keytype, and DH_PARAMGEN_TYPE_FIPS_186_2 for the \"DHX\" keytype. In the FIPS provider the default value is DH_PARAMGEN_TYPE_GROUP for the \"DH\" keytype and <DH_PARAMGEN_TYPE_FIPS_186_4 for the \"DHX\" keytype.

          EVP_PKEY_CTX_set_dh_paramgen_gindex() sets the gindex used by the generator G. The default value is -1 which uses unverifiable g, otherwise a positive value uses verifiable g. This value must be saved if key validation of g is required, since it is not part of a persisted key.

          EVP_PKEY_CTX_set_dh_paramgen_seed() sets the seed to use for generation rather than using a randomly generated value for the seed. This is useful for testing purposes only and can fail if the seed does not produce primes for both p & q on its first iteration. This value must be saved if key validation of p, q, and verifiable g are required, since it is not part of a persisted key.

          EVP_PKEY_CTX_set_dh_pad() sets the DH padding mode. If pad is 1 the shared secret is padded with zeros up to the size of the DH prime p. If pad is zero (the default) then no padding is performed.

          EVP_PKEY_CTX_set_dh_nid() sets the DH parameters to values corresponding to nid as defined in RFC7919 or RFC3526. The nid parameter must be NID_ffdhe2048, NID_ffdhe3072, NID_ffdhe4096, NID_ffdhe6144, NID_ffdhe8192, NID_modp_1536, NID_modp_2048, NID_modp_3072, NID_modp_4096, NID_modp_6144, NID_modp_8192 or NID_undef to clear the stored value. This function can be called during parameter or key generation. The nid parameter and the rfc5114 parameter are mutually exclusive.

          EVP_PKEY_CTX_set_dh_rfc5114() and EVP_PKEY_CTX_set_dhx_rfc5114() both set the DH parameters to the values defined in RFC5114. The rfc5114 parameter must be 1, 2 or 3 corresponding to RFC5114 sections 2.1, 2.2 and 2.3. or 0 to clear the stored value. This macro can be called during parameter generation. The ctx must have a key type of EVP_PKEY_DHX. The rfc5114 parameter and the nid parameter are mutually exclusive.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#dh-key-derivation-function-parameters","title":"DH key derivation function parameters","text":"

          Note that all of the following functions require that the ctx parameter has a private key type of EVP_PKEY_DHX. When using key derivation, the output of EVP_PKEY_derive() is the output of the KDF instead of the DH shared secret. The KDF output is typically used as a Key Encryption Key (KEK) that in turn encrypts a Content Encryption Key (CEK).

          EVP_PKEY_CTX_set_dh_kdf_type() sets the key derivation function type to kdf for DH key derivation. Possible values are EVP_PKEY_DH_KDF_NONE and EVP_PKEY_DH_KDF_X9_42 which uses the key derivation specified in RFC2631 (based on the keying algorithm described in X9.42). When using key derivation, the kdf_oid, kdf_md and kdf_outlen parameters must also be specified.

          EVP_PKEY_CTX_get_dh_kdf_type() gets the key derivation function type for ctx used for DH key derivation. Possible values are EVP_PKEY_DH_KDF_NONE and EVP_PKEY_DH_KDF_X9_42.

          EVP_PKEY_CTX_set0_dh_kdf_oid() sets the key derivation function object identifier to oid for DH key derivation. This OID should identify the algorithm to be used with the Content Encryption Key. The library takes ownership of the object identifier so the caller should not free the original memory pointed to by oid.

          EVP_PKEY_CTX_get0_dh_kdf_oid() gets the key derivation function oid for ctx used for DH key derivation. The resulting pointer is owned by the library and should not be freed by the caller.

          EVP_PKEY_CTX_set_dh_kdf_md() sets the key derivation function message digest to md for DH key derivation. Note that RFC2631 specifies that this digest should be SHA1 but OpenSSL tolerates other digests.

          EVP_PKEY_CTX_get_dh_kdf_md() gets the key derivation function message digest for ctx used for DH key derivation.

          EVP_PKEY_CTX_set_dh_kdf_outlen() sets the key derivation function output length to len for DH key derivation.

          EVP_PKEY_CTX_get_dh_kdf_outlen() gets the key derivation function output length for ctx used for DH key derivation.

          EVP_PKEY_CTX_set0_dh_kdf_ukm() sets the user key material to ukm and its length to len for DH key derivation. This parameter is optional and corresponds to the partyAInfo field in RFC2631 terms. The specification requires that it is 512 bits long but this is not enforced by OpenSSL. The library takes ownership of the user key material so the caller should not free the original memory pointed to by ukm.

          EVP_PKEY_CTX_get0_dh_kdf_ukm() gets the user key material for ctx. The return value is the user key material length. The resulting pointer is owned by the library and should not be freed by the caller.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#ec-parameters","title":"EC parameters","text":"

          Use EVP_PKEY_CTX_set_group_name() (described above) to set the curve name to name for parameter and key generation.

          EVP_PKEY_CTX_set_ec_paramgen_curve_nid() does the same as EVP_PKEY_CTX_set_group_name(), but is specific to EC and uses a nid rather than a name string.

          For EC parameter generation, one of EVP_PKEY_CTX_set_group_name() or EVP_PKEY_CTX_set_ec_paramgen_curve_nid() must be called or an error occurs because there is no default curve. These function can also be called to set the curve explicitly when generating an EC key.

          EVP_PKEY_CTX_get_group_name() (described above) can be used to obtain the curve name that's currently set with ctx.

          EVP_PKEY_CTX_set_ec_param_enc() sets the EC parameter encoding to param_enc when generating EC parameters or an EC key. The encoding can be OPENSSL_EC_EXPLICIT_CURVE for explicit parameters (the default in versions of OpenSSL before 1.1.0) or OPENSSL_EC_NAMED_CURVE to use named curve form. For maximum compatibility the named curve form should be used. Note: the OPENSSL_EC_NAMED_CURVE value was added in OpenSSL 1.1.0; previous versions should use 0 instead.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#ecdh-parameters","title":"ECDH parameters","text":"

          EVP_PKEY_CTX_set_ecdh_cofactor_mode() sets the cofactor mode to cofactor_mode for ECDH key derivation. Possible values are 1 to enable cofactor key derivation, 0 to disable it and -1 to clear the stored cofactor mode and fallback to the private key cofactor mode.

          EVP_PKEY_CTX_get_ecdh_cofactor_mode() returns the cofactor mode for ctx used for ECDH key derivation. Possible values are 1 when cofactor key derivation is enabled and 0 otherwise.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#ecdh-key-derivation-function-parameters","title":"ECDH key derivation function parameters","text":"

          EVP_PKEY_CTX_set_ecdh_kdf_type() sets the key derivation function type to kdf for ECDH key derivation. Possible values are EVP_PKEY_ECDH_KDF_NONE and EVP_PKEY_ECDH_KDF_X9_63 which uses the key derivation specified in X9.63. When using key derivation, the kdf_md and kdf_outlen parameters must also be specified.

          EVP_PKEY_CTX_get_ecdh_kdf_type() returns the key derivation function type for ctx used for ECDH key derivation. Possible values are EVP_PKEY_ECDH_KDF_NONE and EVP_PKEY_ECDH_KDF_X9_63.

          EVP_PKEY_CTX_set_ecdh_kdf_md() sets the key derivation function message digest to md for ECDH key derivation. Note that X9.63 specifies that this digest should be SHA1 but OpenSSL tolerates other digests.

          EVP_PKEY_CTX_get_ecdh_kdf_md() gets the key derivation function message digest for ctx used for ECDH key derivation.

          EVP_PKEY_CTX_set_ecdh_kdf_outlen() sets the key derivation function output length to len for ECDH key derivation.

          EVP_PKEY_CTX_get_ecdh_kdf_outlen() gets the key derivation function output length for ctx used for ECDH key derivation.

          EVP_PKEY_CTX_set0_ecdh_kdf_ukm() sets the user key material to ukm for ECDH key derivation. This parameter is optional and corresponds to the shared info in X9.63 terms. The library takes ownership of the user key material so the caller should not free the original memory pointed to by ukm.

          EVP_PKEY_CTX_get0_ecdh_kdf_ukm() gets the user key material for ctx. The return value is the user key material length. The resulting pointer is owned by the library and should not be freed by the caller.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#other-parameters","title":"Other parameters","text":"

          EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id() and EVP_PKEY_CTX_get1_id_len() are used to manipulate the special identifier field for specific signature algorithms such as SM2. The EVP_PKEY_CTX_set1_id() sets an ID pointed by id with the length id_len to the library. The library takes a copy of the id so that the caller can safely free the original memory pointed to by id. EVP_PKEY_CTX_get1_id_len() returns the length of the ID set via a previous call to EVP_PKEY_CTX_set1_id(). The length is usually used to allocate adequate memory for further calls to EVP_PKEY_CTX_get1_id(). EVP_PKEY_CTX_get1_id() returns the previously set ID value to caller in id. The caller should allocate adequate memory space for the id before calling EVP_PKEY_CTX_get1_id().

          EVP_PKEY_CTX_set_kem_op() sets the KEM operation to run. This can be set after EVP_PKEY_encapsulate_init() or EVP_PKEY_decapsulate_init() to select the kem operation. RSA is the only key type that supports encapsulation currently, and as there is no default operation for the RSA type, this function must be called before EVP_PKEY_encapsulate() or EVP_PKEY_decapsulate().

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#return-values","title":"RETURN VALUES","text":"

          All other functions described on this page return a positive value for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_set_params(3), EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3), EVP_PKEY_keygen(3) EVP_PKEY_encapsulate(3) EVP_PKEY_decapsulate(3)

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#history","title":"HISTORY","text":"

          EVP_PKEY_CTX_get_rsa_oaep_md_name(), EVP_PKEY_CTX_get_rsa_mgf1_md_name(), EVP_PKEY_CTX_set_rsa_mgf1_md_name(), EVP_PKEY_CTX_set_rsa_oaep_md_name(), EVP_PKEY_CTX_set_dsa_paramgen_md_props(), EVP_PKEY_CTX_set_dsa_paramgen_gindex(), EVP_PKEY_CTX_set_dsa_paramgen_type(), EVP_PKEY_CTX_set_dsa_paramgen_seed(), EVP_PKEY_CTX_set_group_name() and EVP_PKEY_CTX_get_group_name() were added in OpenSSL 3.0.

          The EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id() and EVP_PKEY_CTX_get1_id_len() macros were added in 1.1.1, other functions were added in OpenSSL 1.0.0.

          In OpenSSL 1.1.1 and below the functions were mostly macros. From OpenSSL 3.0 they are all functions.

          EVP_PKEY_CTX_set_rsa_keygen_pubexp(), EVP_PKEY_CTX_get0_dh_kdf_ukm(), and EVP_PKEY_CTX_get0_ecdh_kdf_ukm() were deprecated in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_ctrl/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/","title":"EVP_PKEY_CTX_get0_libctx","text":""},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#name","title":"NAME","text":"

          EVP_PKEY_CTX_get0_libctx, EVP_PKEY_CTX_get0_propq, EVP_PKEY_CTX_get0_provider - functions for getting diverse information from an EVP_PKEY_CTX

          "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nOSSL_LIB_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx);\nconst char *EVP_PKEY_CTX_get0_propq(const EVP_PKEY_CTX *ctx);\nconst OSSL_PROVIDER *EVP_PKEY_CTX_get0_provider(const EVP_PKEY_CTX *ctx);\n
          "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_CTX_get0_libctx() and EVP_PKEY_CTX_get0_propq() obtain the OSSL_LIB_CTX and property query string values respectively that were associated with the EVP_PKEY_CTX when it was constructed.

          EVP_PKEY_CTX_get0_provider() returns the provider associated with the ongoing EVP_PKEY_CTX operation. If the operation is performed by en ENGINE, this function returns NULL.

          "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_CTX_get0_libctx() and EVP_PKEY_CTX_get0_propq() functions return the OSSL_LIB_CTX and property query string associated with the EVP_PKEY_CTX or NULL if they are not set. The returned values should not be freed by the caller.

          EVP_PKEY_CTX_get0_provider() returns a provider if an operation performed by a provider is ongoing, otherwise NULL.

          "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3)

          "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#history","title":"HISTORY","text":"

          All functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/","title":"EVP_PKEY_CTX_get0_pkey","text":""},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#name","title":"NAME","text":"

          EVP_PKEY_CTX_get0_pkey, EVP_PKEY_CTX_get0_peerkey - functions for accessing the EVP_PKEY associated with an EVP_PKEY_CTX

          "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nEVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);\nEVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);\n
          "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_CTX_get0_pkey() is used to access the EVP_PKEY associated with the given EVP_PKEY_CTX ctx. The EVP_PKEY obtained is the one used for creating the EVP_PKEY_CTX using either EVP_PKEY_CTX_new(3) or EVP_PKEY_CTX_new_from_pkey(3).

          EVP_PKEY_CTX_get0_peerkey() is used to access the peer EVP_PKEY associated with the given EVP_PKEY_CTX ctx. The peer EVP_PKEY obtained is the one set using either EVP_PKEY_derive_set_peer(3) or EVP_PKEY_derive_set_peer_ex(3).

          "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_CTX_get0_pkey() returns the EVP_PKEY associated with the EVP_PKEY_CTX or NULL if it is not set.

          EVP_PKEY_CTX_get0_peerkey() returns the peer EVP_PKEY associated with the EVP_PKEY_CTX or NULL if it is not set.

          The returned EVP_PKEY objects are owned by the EVP_PKEY_CTX, and therefore should not explicitly be freed by the caller.

          These functions do not affect the EVP_PKEY reference count. They merely act as getter functions, and should be treated as such.

          "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_new_from_pkey(3), EVP_PKEY_derive_set_peer(3), EVP_PKEY_derive_set_peer_ex(3)

          "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#copyright","title":"COPYRIGHT","text":"

          Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_new/","title":"EVP_PKEY_CTX_new","text":""},{"location":"man3/EVP_PKEY_CTX_new/#name","title":"NAME","text":"

          EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_new_from_name, EVP_PKEY_CTX_new_from_pkey, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free, EVP_PKEY_CTX_is_a - public key algorithm context functions

          "},{"location":"man3/EVP_PKEY_CTX_new/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nEVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);\nEVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);\nEVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OSSL_LIB_CTX *libctx,\n                                         const char *name,\n                                         const char *propquery);\nEVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OSSL_LIB_CTX *libctx,\n                                         EVP_PKEY *pkey,\n                                         const char *propquery);\nEVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx);\nvoid EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_is_a(EVP_PKEY_CTX *ctx, const char *keytype);\n
          "},{"location":"man3/EVP_PKEY_CTX_new/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_CTX_new() function allocates public key algorithm context using the pkey key type and ENGINE e.

          The EVP_PKEY_CTX_new_id() function allocates public key algorithm context using the key type specified by id and ENGINE e.

          The EVP_PKEY_CTX_new_from_name() function allocates a public key algorithm context using the library context libctx (see OSSL_LIB_CTX(3)), the key type specified by name and the property query propquery. None of the arguments are duplicated, so they must remain unchanged for the lifetime of the returned EVP_PKEY_CTX or of any of its duplicates. Read further about the possible names in \"NOTES\" below.

          The EVP_PKEY_CTX_new_from_pkey() function allocates a public key algorithm context using the library context libctx (see OSSL_LIB_CTX(3)) and the algorithm specified by pkey and the property query propquery. None of the arguments are duplicated, so they must remain unchanged for the lifetime of the returned EVP_PKEY_CTX or any of its duplicates.

          EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_new_from_name() are normally used when no EVP_PKEY structure is associated with the operations, for example during parameter generation or key generation for some algorithms.

          EVP_PKEY_CTX_dup() duplicates the context ctx. It is not supported for a keygen operation.

          EVP_PKEY_CTX_free() frees up the context ctx. If ctx is NULL, nothing is done.

          EVP_PKEY_is_a() checks if the key type associated with ctx is keytype.

          "},{"location":"man3/EVP_PKEY_CTX_new/#notes","title":"NOTES","text":""},{"location":"man3/EVP_PKEY_CTX_new/#on-evp_pkey_ctx","title":"On EVP_PKEY_CTX","text":"

          The EVP_PKEY_CTX structure is an opaque public key algorithm context used by the OpenSSL high-level public key API. Contexts MUST NOT be shared between threads: that is it is not permissible to use the same context simultaneously in two threads.

          "},{"location":"man3/EVP_PKEY_CTX_new/#on-key-types","title":"On Key Types","text":"

          We mention \"key type\" in this manual, which is the same as \"algorithm\" in most cases, allowing either term to be used interchangeably. There are algorithms where the key type and the algorithm of the operations that use the keys are not the same, such as EC keys being used for ECDSA and ECDH operations.

          Key types are given in two different manners:

          • Legacy NID or EVP_PKEY type

            This is the id used with EVP_PKEY_CTX_new_id().

            These are EVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA, EVP_PKEY_DH, EVP_PKEY_EC, EVP_PKEY_SM2, EVP_PKEY_X25519, EVP_PKEY_X448, and are used by legacy methods.

          • Name strings

            This is the name used with EVP_PKEY_CTX_new_from_name().

            These are names like \"RSA\", \"DSA\", and what's available depends on what providers are currently accessible.

            The OpenSSL providers offer a set of key types available this way, please see OSSL_PROVIDER-FIPS(7) and OSSL_PROVIDER-default(7) and related documentation for more information.

          "},{"location":"man3/EVP_PKEY_CTX_new/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_dup() return either the newly allocated EVP_PKEY_CTX structure or NULL if an error occurred.

          EVP_PKEY_CTX_free() does not return a value.

          EVP_PKEY_CTX_is_a() returns 1 for true and 0 for false.

          "},{"location":"man3/EVP_PKEY_CTX_new/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_new(3)

          "},{"location":"man3/EVP_PKEY_CTX_new/#history","title":"HISTORY","text":"

          The EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() and EVP_PKEY_CTX_free() functions were added in OpenSSL 1.0.0.

          The EVP_PKEY_CTX_new_from_name() and EVP_PKEY_CTX_new_from_pkey() functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_new/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/","title":"EVP_PKEY_CTX_set1_pbe_pass","text":""},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#name","title":"NAME","text":"

          EVP_PKEY_CTX_set1_pbe_pass - generic KDF support functions

          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set1_pbe_pass(EVP_PKEY_CTX *pctx, unsigned char *pass,\n                               int passlen);\n
          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#description","title":"DESCRIPTION","text":"

          These functions are generic support functions for all KDF algorithms.

          EVP_PKEY_CTX_set1_pbe_pass() sets the password to the passlen first bytes from pass.

          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#string-ctrls","title":"STRING CTRLS","text":"

          There is also support for string based control operations via EVP_PKEY_CTX_ctrl_str(3). The password can be directly specified using the type parameter \"pass\" or given in hex encoding using the \"hexpass\" parameter.

          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#return-values","title":"RETURN VALUES","text":"

          All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#history","title":"HISTORY","text":"

          EVP_PKEY_CTX_set1_pbe_pass() was converted from a macro to a function in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#copyright","title":"COPYRIGHT","text":"

          Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/","title":"EVP_PKEY_CTX_set_hkdf_md","text":""},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#name","title":"NAME","text":"

          EVP_PKEY_CTX_set_hkdf_md, EVP_PKEY_CTX_set1_hkdf_salt, EVP_PKEY_CTX_set1_hkdf_key, EVP_PKEY_CTX_add1_hkdf_info, EVP_PKEY_CTX_set_hkdf_mode - HMAC-based Extract-and-Expand key derivation algorithm

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set_hkdf_mode(EVP_PKEY_CTX *pctx, int mode);\n\nint EVP_PKEY_CTX_set_hkdf_md(EVP_PKEY_CTX *pctx, const EVP_MD *md);\n\nint EVP_PKEY_CTX_set1_hkdf_salt(EVP_PKEY_CTX *pctx, unsigned char *salt,\n                                int saltlen);\n\nint EVP_PKEY_CTX_set1_hkdf_key(EVP_PKEY_CTX *pctx, unsigned char *key,\n                               int keylen);\n\nint EVP_PKEY_CTX_add1_hkdf_info(EVP_PKEY_CTX *pctx, unsigned char *info,\n                                int infolen);\n
          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_HKDF algorithm implements the HKDF key derivation function. HKDF follows the \"extract-then-expand\" paradigm, where the KDF logically consists of two modules. The first stage takes the input keying material and \"extracts\" from it a fixed-length pseudorandom key K. The second stage \"expands\" the key K into several additional pseudorandom keys (the output of the KDF).

          EVP_PKEY_CTX_set_hkdf_mode() sets the mode for the HKDF operation. There are three modes that are currently defined:

          • EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND

            This is the default mode. Calling EVP_PKEY_derive(3) on an EVP_PKEY_CTX set up for HKDF will perform an extract followed by an expand operation in one go. The derived key returned will be the result after the expand operation. The intermediate fixed-length pseudorandom key K is not returned.

            In this mode the digest, key, salt and info values must be set before a key is derived or an error occurs.

          • EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY

            In this mode calling EVP_PKEY_derive(3) will just perform the extract operation. The value returned will be the intermediate fixed-length pseudorandom key K.

            The digest, key and salt values must be set before a key is derived or an error occurs.

          • EVP_PKEY_HKDEF_MODE_EXPAND_ONLY

            In this mode calling EVP_PKEY_derive(3) will just perform the expand operation. The input key should be set to the intermediate fixed-length pseudorandom key K returned from a previous extract operation.

            The digest, key and info values must be set before a key is derived or an error occurs.

          EVP_PKEY_CTX_set_hkdf_md() sets the message digest associated with the HKDF.

          EVP_PKEY_CTX_set1_hkdf_salt() sets the salt to saltlen bytes of the buffer salt. Any existing value is replaced.

          EVP_PKEY_CTX_set1_hkdf_key() sets the key to keylen bytes of the buffer key. Any existing value is replaced.

          EVP_PKEY_CTX_add1_hkdf_info() sets the info value to infolen bytes of the buffer info. If a value is already set, it is appended to the existing value.

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#string-ctrls","title":"STRING CTRLS","text":"

          HKDF also supports string based control operations via EVP_PKEY_CTX_ctrl_str(3). The type parameter \"md\" uses the supplied value as the name of the digest algorithm to use. The type parameter \"mode\" uses the values \"EXTRACT_AND_EXPAND\", \"EXTRACT_ONLY\" and \"EXPAND_ONLY\" to determine the mode to use. The type parameters \"salt\", \"key\" and \"info\" use the supplied value parameter as a seed, key or info value. The names \"hexsalt\", \"hexkey\" and \"hexinfo\" are similar except they take a hex string which is converted to binary.

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#notes","title":"NOTES","text":"

          A context for HKDF can be obtained by calling:

          EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);\n

          The total length of the info buffer cannot exceed 2048 bytes in length: this should be more than enough for any normal use of HKDF.

          The output length of an HKDF expand operation is specified via the length parameter to the EVP_PKEY_derive(3) function. Since the HKDF output length is variable, passing a NULL buffer as a means to obtain the requisite length is not meaningful with HKDF in any mode that performs an expand operation. Instead, the caller must allocate a buffer of the desired length, and pass that buffer to EVP_PKEY_derive(3) along with (a pointer initialized to) the desired length. Passing a NULL buffer to obtain the length is allowed when using EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY.

          Optimised versions of HKDF can be implemented in an ENGINE.

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#return-values","title":"RETURN VALUES","text":"

          All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#examples","title":"EXAMPLES","text":"

          This example derives 10 bytes using SHA-256 with the secret key \"secret\", salt value \"salt\" and info value \"label\":

          EVP_PKEY_CTX *pctx;\nunsigned char out[10];\nsize_t outlen = sizeof(out);\npctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);\n\nif (EVP_PKEY_derive_init(pctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set1_hkdf_salt(pctx, \"salt\", 4) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set1_hkdf_key(pctx, \"secret\", 6) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_add1_hkdf_info(pctx, \"label\", 5) <= 0)\n    /* Error */\nif (EVP_PKEY_derive(pctx, out, &outlen) <= 0)\n    /* Error */\n
          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#conforming-to","title":"CONFORMING TO","text":"

          RFC 5869

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#history","title":"HISTORY","text":"

          All of the functions described here were converted from macros to functions in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#copyright","title":"COPYRIGHT","text":"

          Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_set_params/","title":"EVP_PKEY_CTX_set_params","text":""},{"location":"man3/EVP_PKEY_CTX_set_params/#name","title":"NAME","text":"

          EVP_PKEY_CTX_set_params, EVP_PKEY_CTX_settable_params, EVP_PKEY_CTX_get_params, EVP_PKEY_CTX_gettable_params - provider parameter passing operations

          "},{"location":"man3/EVP_PKEY_CTX_set_params/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_CTX_set_params(EVP_PKEY_CTX *ctx, const OSSL_PARAM *params);\nconst OSSL_PARAM *EVP_PKEY_CTX_settable_params(const EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_get_params(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);\nconst OSSL_PARAM *EVP_PKEY_CTX_gettable_params(const EVP_PKEY_CTX *ctx);\n
          "},{"location":"man3/EVP_PKEY_CTX_set_params/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_CTX_get_params() and EVP_PKEY_CTX_set_params() functions allow transfer of arbitrary key parameters to and from providers. Not all parameters may be supported by all providers. See OSSL_PROVIDER(3) for more information on providers. The params field is a pointer to a list of OSSL_PARAM structures, terminated with a OSSL_PARAM_END(3) struct. See OSSL_PARAM(3) for information about passing parameters. These functions must only be called after the EVP_PKEY_CTX has been initialised for use in an operation. These methods replace the EVP_PKEY_CTX_ctrl() mechanism. (EVP_PKEY_CTX_ctrl now calls these methods internally to interact with providers).

          EVP_PKEY_CTX_gettable_params() and EVP_PKEY_CTX_settable_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters for the current algorithm implementation, i.e. parameters that can be used with EVP_PKEY_CTX_get_params() and EVP_PKEY_CTX_set_params() respectively. These functions must only be called after the EVP_PKEY_CTX has been initialised for use in an operation.

          "},{"location":"man3/EVP_PKEY_CTX_set_params/#parameters","title":"Parameters","text":"

          Examples of EVP_PKEY parameters include the following:

          \"Common parameters\" in provider-keymgmt(7) \"Key Exchange parameters\" in provider-keyexch(7) \"Signature parameters\" in provider-signature(7)

          \"Common RSA parameters\" in EVP_PKEY-RSA(7) \"RSA key generation parameters\" in EVP_PKEY-RSA(7) \"FFC parameters\" in EVP_PKEY-FFC(7) \"FFC key generation parameters\" in EVP_PKEY-FFC(7) \"DSA parameters\" in EVP_PKEY-DSA(7) \"DSA key generation parameters\" in EVP_PKEY-DSA(7) \"DH parameters\" in EVP_PKEY-DH(7) \"DH key generation parameters\" in EVP_PKEY-DH(7) \"Common EC parameters\" in EVP_PKEY-EC(7) \"Common X25519, X448, ED25519 and ED448 parameters\" in EVP_PKEY-X25519(7)

          "},{"location":"man3/EVP_PKEY_CTX_set_params/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_CTX_set_params() returns 1 for success or 0 otherwise. EVP_PKEY_CTX_settable_params() returns an OSSL_PARAM array on success or NULL on error. It may also return NULL if there are no settable parameters available.

          All other functions and macros described on this page return a positive value for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_CTX_set_params/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3), EVP_PKEY_keygen(3)

          "},{"location":"man3/EVP_PKEY_CTX_set_params/#history","title":"HISTORY","text":"

          All functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_set_params/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/","title":"EVP_PKEY_CTX_set_rsa_pss_keygen_md","text":""},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#name","title":"NAME","text":"

          EVP_PKEY_CTX_set_rsa_pss_keygen_md, EVP_PKEY_CTX_set_rsa_pss_keygen_md_name, EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md, EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name, EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen - EVP_PKEY RSA-PSS algorithm support functions

          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/rsa.h>\n\nint EVP_PKEY_CTX_set_rsa_pss_keygen_md(EVP_PKEY_CTX *pctx,\n                                       const EVP_MD *md);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_md_name(EVP_PKEY_CTX *ctx,\n                                            const char *mdname,\n                                            const char *mdprops);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(EVP_PKEY_CTX *pctx,\n                                            const EVP_MD *md);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name(EVP_PKEY_CTX *pctx,\n                                                 const char *mdname);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(EVP_PKEY_CTX *pctx,\n                                            int saltlen);\n
          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#description","title":"DESCRIPTION","text":"

          These are the functions that implement RSA-PSS(7).

          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#signing-and-verification","title":"Signing and Verification","text":"

          The macro EVP_PKEY_CTX_set_rsa_padding() is supported but an error is returned if an attempt is made to set the padding mode to anything other than PSS. It is otherwise similar to the RSA version.

          The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro is used to set the salt length. If the key has usage restrictions then an error is returned if an attempt is made to set the salt length below the minimum value. It is otherwise similar to the RSA operation except detection of the salt length (using RSA_PSS_SALTLEN_AUTO) is not supported for verification if the key has usage restrictions.

          The EVP_PKEY_CTX_set_signature_md(3) and EVP_PKEY_CTX_set_rsa_mgf1_md(3) functions are used to set the digest and MGF1 algorithms respectively. If the key has usage restrictions then an error is returned if an attempt is made to set the digest to anything other than the restricted value. Otherwise these are similar to the RSA versions.

          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#key-generation","title":"Key Generation","text":"

          As with RSA key generation the EVP_PKEY_CTX_set_rsa_keygen_bits() and EVP_PKEY_CTX_set_rsa_keygen_pubexp() macros are supported for RSA-PSS: they have exactly the same meaning as for the RSA algorithm.

          Optional parameter restrictions can be specified when generating a PSS key. If any restrictions are set (using the macros described below) then all parameters are restricted. For example, setting a minimum salt length also restricts the digest and MGF1 algorithms. If any restrictions are in place then they are reflected in the corresponding parameters of the public key when (for example) a certificate request is signed.

          EVP_PKEY_CTX_set_rsa_pss_keygen_md() restricts the digest algorithm the generated key can use to md. EVP_PKEY_CTX_set_rsa_pss_keygen_md_name() does the same thing, but passes the algorithm by name rather than by EVP_MD.

          EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md() restricts the MGF1 algorithm the generated key can use to md. EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name() does the same thing, but passes the algorithm by name rather than by EVP_MD.

          EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen() restricts the minimum salt length to saltlen.

          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#notes","title":"NOTES","text":"

          A context for the RSA-PSS algorithm can be obtained by calling:

          EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA_PSS, NULL);\n
          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#return-values","title":"RETURN VALUES","text":"

          All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#see-also","title":"SEE ALSO","text":"

          RSA-PSS(7), EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#copyright","title":"COPYRIGHT","text":"

          Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/","title":"EVP_PKEY_CTX_set_scrypt_N","text":""},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#name","title":"NAME","text":"

          EVP_PKEY_CTX_set1_scrypt_salt, EVP_PKEY_CTX_set_scrypt_N, EVP_PKEY_CTX_set_scrypt_r, EVP_PKEY_CTX_set_scrypt_p, EVP_PKEY_CTX_set_scrypt_maxmem_bytes - EVP_PKEY scrypt KDF support functions

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set1_scrypt_salt(EVP_PKEY_CTX *pctx, unsigned char *salt,\n                                  int saltlen);\n\nint EVP_PKEY_CTX_set_scrypt_N(EVP_PKEY_CTX *pctx, uint64_t N);\n\nint EVP_PKEY_CTX_set_scrypt_r(EVP_PKEY_CTX *pctx, uint64_t r);\n\nint EVP_PKEY_CTX_set_scrypt_p(EVP_PKEY_CTX *pctx, uint64_t p);\n\nint EVP_PKEY_CTX_set_scrypt_maxmem_bytes(EVP_PKEY_CTX *pctx,\n                                         uint64_t maxmem);\n
          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#description","title":"DESCRIPTION","text":"

          These functions are used to set up the necessary data to use the scrypt KDF. For more information on scrypt, see EVP_KDF-SCRYPT(7).

          EVP_PKEY_CTX_set1_scrypt_salt() sets the saltlen bytes long salt value.

          EVP_PKEY_CTX_set_scrypt_N(), EVP_PKEY_CTX_set_scrypt_r() and EVP_PKEY_CTX_set_scrypt_p() configure the work factors N, r and p.

          EVP_PKEY_CTX_set_scrypt_maxmem_bytes() sets how much RAM key derivation may maximally use, given in bytes. If RAM is exceeded because the load factors are chosen too high, the key derivation will fail.

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#string-ctrls","title":"STRING CTRLS","text":"

          scrypt also supports string based control operations via EVP_PKEY_CTX_ctrl_str(3). Similarly, the salt can either be specified using the type parameter \"salt\" or in hex encoding by using the \"hexsalt\" parameter. The work factors N, r and p as well as maxmem_bytes can be set by using the parameters \"N\", \"r\", \"p\" and \"maxmem_bytes\", respectively.

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#notes","title":"NOTES","text":"

          There is a newer generic API for KDFs, EVP_KDF(3), which is preferred over the EVP_PKEY method.

          The scrypt KDF also uses EVP_PKEY_CTX_set1_pbe_pass() as well as the value from the string controls \"pass\" and \"hexpass\". See EVP_PKEY_CTX_set1_pbe_pass(3).

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#return-values","title":"RETURN VALUES","text":"

          All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#see-also","title":"SEE ALSO","text":"

          EVP_KDF(3) EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#history","title":"HISTORY","text":"

          All of the functions described here were converted from macros to functions in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#copyright","title":"COPYRIGHT","text":"

          Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/","title":"EVP_PKEY_CTX_set_tls1_prf_md","text":""},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#name","title":"NAME","text":"

          EVP_PKEY_CTX_set_tls1_prf_md, EVP_PKEY_CTX_set1_tls1_prf_secret, EVP_PKEY_CTX_add1_tls1_prf_seed - TLS PRF key derivation algorithm

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set_tls1_prf_md(EVP_PKEY_CTX *pctx, const EVP_MD *md);\nint EVP_PKEY_CTX_set1_tls1_prf_secret(EVP_PKEY_CTX *pctx,\n                                      unsigned char *sec, int seclen);\nint EVP_PKEY_CTX_add1_tls1_prf_seed(EVP_PKEY_CTX *pctx,\n                                    unsigned char *seed, int seedlen);\n
          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_TLS1_PRF algorithm implements the PRF key derivation function for TLS. It has no associated private key and only implements key derivation using EVP_PKEY_derive(3).

          EVP_PKEY_set_tls1_prf_md() sets the message digest associated with the TLS PRF. EVP_md5_sha1() is treated as a special case which uses the PRF algorithm using both MD5 and SHA1 as used in TLS 1.0 and 1.1.

          EVP_PKEY_CTX_set_tls1_prf_secret() sets the secret value of the TLS PRF to seclen bytes of the buffer sec. Any existing secret value is replaced and any seed is reset.

          EVP_PKEY_CTX_add1_tls1_prf_seed() sets the seed to seedlen bytes of seed. If a seed is already set it is appended to the existing value.

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#string-ctrls","title":"STRING CTRLS","text":"

          The TLS PRF also supports string based control operations using EVP_PKEY_CTX_ctrl_str(3). The type parameter \"md\" uses the supplied value as the name of the digest algorithm to use. The type parameters \"secret\" and \"seed\" use the supplied value parameter as a secret or seed value. The names \"hexsecret\" and \"hexseed\" are similar except they take a hex string which is converted to binary.

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#notes","title":"NOTES","text":"

          A context for the TLS PRF can be obtained by calling:

          EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_TLS1_PRF, NULL);\n

          The digest, secret value and seed must be set before a key is derived or an error occurs.

          The total length of all seeds cannot exceed 1024 bytes in length: this should be more than enough for any normal use of the TLS PRF.

          The output length of the PRF is specified by the length parameter in the EVP_PKEY_derive() function. Since the output length is variable, setting the buffer to NULL is not meaningful for the TLS PRF.

          Optimised versions of the TLS PRF can be implemented in an ENGINE.

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#return-values","title":"RETURN VALUES","text":"

          All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#examples","title":"EXAMPLES","text":"

          This example derives 10 bytes using SHA-256 with the secret key \"secret\" and seed value \"seed\":

          EVP_PKEY_CTX *pctx;\nunsigned char out[10];\nsize_t outlen = sizeof(out);\n\npctx = EVP_PKEY_CTX_new_id(EVP_PKEY_TLS1_PRF, NULL);\nif (EVP_PKEY_derive_init(pctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_tls1_prf_md(pctx, EVP_sha256()) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, \"secret\", 6) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, \"seed\", 4) <= 0)\n    /* Error */\nif (EVP_PKEY_derive(pctx, out, &outlen) <= 0)\n    /* Error */\n
          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#history","title":"HISTORY","text":"

          All of the functions described here were converted from macros to functions in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#copyright","title":"COPYRIGHT","text":"

          Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_asn1_get_count/","title":"EVP_PKEY_asn1_get_count","text":""},{"location":"man3/EVP_PKEY_asn1_get_count/#name","title":"NAME","text":"

          EVP_PKEY_asn1_find, EVP_PKEY_asn1_find_str, EVP_PKEY_asn1_get_count, EVP_PKEY_asn1_get0, EVP_PKEY_asn1_get0_info - enumerate public key ASN.1 methods

          "},{"location":"man3/EVP_PKEY_asn1_get_count/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_asn1_get_count(void);\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,\n                                                   const char *str, int len);\nint EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id,\n                            int *ppkey_flags, const char **pinfo,\n                            const char **ppem_str,\n                            const EVP_PKEY_ASN1_METHOD *ameth);\n
          "},{"location":"man3/EVP_PKEY_asn1_get_count/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_asn1_count() returns a count of the number of public key ASN.1 methods available: it includes standard methods and any methods added by the application.

          EVP_PKEY_asn1_get0() returns the public key ASN.1 method idx. The value of idx must be between zero and EVP_PKEY_asn1_get_count() - 1.

          EVP_PKEY_asn1_find() looks up the EVP_PKEY_ASN1_METHOD with NID type. If pe isn't NULL, then it will look up an engine implementing a EVP_PKEY_ASN1_METHOD for the NID type and return that instead, and also set *pe to point at the engine that implements it.

          EVP_PKEY_asn1_find_str() looks up the EVP_PKEY_ASN1_METHOD with PEM type string str. Just like EVP_PKEY_asn1_find(), if pe isn't NULL, then it will look up an engine implementing a EVP_PKEY_ASN1_METHOD for the NID type and return that instead, and also set *pe to point at the engine that implements it.

          EVP_PKEY_asn1_get0_info() returns the public key ID, base public key ID (both NIDs), any flags, the method description and PEM type string associated with the public key ASN.1 method *ameth.

          EVP_PKEY_asn1_count(), EVP_PKEY_asn1_get0(), EVP_PKEY_asn1_find() and EVP_PKEY_asn1_find_str() are not thread safe, but as long as all EVP_PKEY_ASN1_METHOD objects are added before the application gets threaded, using them is safe. See EVP_PKEY_asn1_add0(3).

          "},{"location":"man3/EVP_PKEY_asn1_get_count/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_asn1_count() returns the number of available public key methods.

          EVP_PKEY_asn1_get0() return a public key method or NULL if idx is out of range.

          EVP_PKEY_asn1_get0_info() returns 0 on failure, 1 on success.

          "},{"location":"man3/EVP_PKEY_asn1_get_count/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_asn1_new(3), EVP_PKEY_asn1_add0(3)

          "},{"location":"man3/EVP_PKEY_asn1_get_count/#copyright","title":"COPYRIGHT","text":"

          Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_check/","title":"EVP_PKEY_check","text":""},{"location":"man3/EVP_PKEY_check/#name","title":"NAME","text":"

          EVP_PKEY_check, EVP_PKEY_param_check, EVP_PKEY_param_check_quick, EVP_PKEY_public_check, EVP_PKEY_public_check_quick, EVP_PKEY_private_check, EVP_PKEY_pairwise_check - key and parameter validation functions

          "},{"location":"man3/EVP_PKEY_check/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_param_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_param_check_quick(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_public_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_public_check_quick(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_private_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx);\n
          "},{"location":"man3/EVP_PKEY_check/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_param_check() validates the parameters component of the key given by ctx. This check will always succeed for key types that do not have parameters.

          EVP_PKEY_param_check_quick() validates the parameters component of the key given by ctx like EVP_PKEY_param_check() does. However some algorithm implementations may offer a quicker form of validation that omits some checks in order to perform a lightweight sanity check of the key. If a quicker form is not provided then this function call does the same thing as EVP_PKEY_param_check().

          EVP_PKEY_public_check() validates the public component of the key given by ctx.

          EVP_PKEY_public_check_quick() validates the public component of the key given by ctx like EVP_PKEY_public_check() does. However some algorithm implementations may offer a quicker form of validation that omits some checks in order to perform a lightweight sanity check of the key. If a quicker form is not provided then this function call does the same thing as EVP_PKEY_public_check().

          EVP_PKEY_private_check() validates the private component of the key given by ctx.

          EVP_PKEY_pairwise_check() validates that the public and private components have the correct mathematical relationship to each other for the key given by ctx.

          EVP_PKEY_check() is an alias for the EVP_PKEY_pairwise_check() function.

          "},{"location":"man3/EVP_PKEY_check/#notes","title":"NOTES","text":"

          Key validation used by the OpenSSL FIPS provider complies with the rules within SP800-56A and SP800-56B. For backwards compatibility reasons the OpenSSL default provider may use checks that are not as restrictive for certain key types. For further information see \"DSA key validation\" in EVP_PKEY-DSA(7), \"DH key validation\" in EVP_PKEY-DH(7), \"EC key validation\" in EVP_PKEY-EC(7) and \"RSA key validation\" in EVP_PKEY-RSA(7).

          Refer to SP800-56A and SP800-56B for rules relating to when these functions should be called during key establishment. It is not necessary to call these functions after locally calling an approved key generation method, but may be required for assurance purposes when receiving keys from a third party.

          The EVP_PKEY_pairwise_check() and EVP_PKEY_private_check() might not be bounded by any key size limits as private keys are not expected to be supplied by attackers. For that reason they might take an unbounded time if run on arbitrarily large keys.

          "},{"location":"man3/EVP_PKEY_check/#return-values","title":"RETURN VALUES","text":"

          All functions return 1 for success or others for failure. They return -2 if the operation is not supported for the specific algorithm.

          "},{"location":"man3/EVP_PKEY_check/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_fromdata(3), EVP_PKEY-DH(7), EVP_PKEY-FFC(7), EVP_PKEY-DSA(7), EVP_PKEY-EC(7), EVP_PKEY-RSA(7),

          "},{"location":"man3/EVP_PKEY_check/#history","title":"HISTORY","text":"

          EVP_PKEY_check(), EVP_PKEY_public_check() and EVP_PKEY_param_check() were added in OpenSSL 1.1.1.

          EVP_PKEY_param_check_quick(), EVP_PKEY_public_check_quick(), EVP_PKEY_private_check() and EVP_PKEY_pairwise_check() were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_check/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_copy_parameters/","title":"EVP_PKEY_copy_parameters","text":""},{"location":"man3/EVP_PKEY_copy_parameters/#name","title":"NAME","text":"

          EVP_PKEY_missing_parameters, EVP_PKEY_copy_parameters, EVP_PKEY_parameters_eq, EVP_PKEY_cmp_parameters, EVP_PKEY_eq, EVP_PKEY_cmp - public key parameter and comparison functions

          "},{"location":"man3/EVP_PKEY_copy_parameters/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);\nint EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);\n\nint EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b);\nint EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b);\n

          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);\nint EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);\n
          "},{"location":"man3/EVP_PKEY_copy_parameters/#description","title":"DESCRIPTION","text":"

          The function EVP_PKEY_missing_parameters() returns 1 if the public key parameters of pkey are missing and 0 if they are present or the algorithm doesn't use parameters.

          The function EVP_PKEY_copy_parameters() copies the parameters from key from to key to. An error is returned if the parameters are missing in from or present in both from and to and mismatch. If the parameters in from and to are both present and match this function has no effect.

          The function EVP_PKEY_parameters_eq() checks the parameters of keys a and b for equality.

          The function EVP_PKEY_eq() checks the keys a and b for equality, including their parameters if they are available.

          "},{"location":"man3/EVP_PKEY_copy_parameters/#notes","title":"NOTES","text":"

          The main purpose of the functions EVP_PKEY_missing_parameters() and EVP_PKEY_copy_parameters() is to handle public keys in certificates where the parameters are sometimes omitted from a public key if they are inherited from the CA that signed it.

          The deprecated functions EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() differ in their return values compared to other _cmp() functions. They are aliases for EVP_PKEY_eq() and EVP_PKEY_parameters_eq().

          The function EVP_PKEY_cmp() previously only checked the key parameters (if there are any) and the public key, assuming that there always was a public key and that private key equality could be derived from that. Because it's no longer assumed that the private key in an EVP_PKEY(3) is always accompanied by a public key, the comparison can not rely on public key comparison alone.

          Instead, EVP_PKEY_eq() (and therefore also EVP_PKEY_cmp()) now compares:

          1. the key parameters (if there are any)
          2. the public keys or the private keys of the two EVP_PKEYs, depending on what they both contain.
          "},{"location":"man3/EVP_PKEY_copy_parameters/#return-values","title":"RETURN VALUES","text":"

          The function EVP_PKEY_missing_parameters() returns 1 if the public key parameters of pkey are missing and 0 if they are present or the algorithm doesn't use parameters.

          These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for failure.

          The functions EVP_PKEY_cmp_parameters(), EVP_PKEY_parameters_eq(), EVP_PKEY_cmp() and EVP_PKEY_eq() return 1 if their inputs match, 0 if they don't match, -1 if the key types are different and -2 if the operation is not supported.

          "},{"location":"man3/EVP_PKEY_copy_parameters/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_keygen(3)

          "},{"location":"man3/EVP_PKEY_copy_parameters/#history","title":"HISTORY","text":"

          The EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() functions were deprecated in OpenSSL 3.0.

          The EVP_PKEY_eq() and EVP_PKEY_parameters_eq() were added in OpenSSL 3.0 to replace EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters().

          "},{"location":"man3/EVP_PKEY_copy_parameters/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_decapsulate/","title":"EVP_PKEY_decapsulate","text":""},{"location":"man3/EVP_PKEY_decapsulate/#name","title":"NAME","text":"

          EVP_PKEY_decapsulate_init, EVP_PKEY_decapsulate - Key decapsulation using a KEM algorithm with a private key

          "},{"location":"man3/EVP_PKEY_decapsulate/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_decapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_decapsulate(EVP_PKEY_CTX *ctx,\n                         unsigned char *unwrapped, size_t *unwrappedlen,\n                         const unsigned char *wrapped, size_t wrappedlen);\n
          "},{"location":"man3/EVP_PKEY_decapsulate/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_decapsulate_init() function initializes a private key algorithm context ctx for a decapsulation operation and then sets the params on the context in the same way as calling EVP_PKEY_CTX_set_params(3). Note that ctx usually is produced using EVP_PKEY_CTX_new_from_pkey(3), specifying the private key to use.

          The EVP_PKEY_decapsulate() function performs a private key decapsulation operation using ctx. The data to be decapsulated is specified using the wrapped and wrappedlen parameters. If unwrapped is NULL then the maximum size of the output secret buffer is written to *unwrappedlen. If unwrapped is not NULL and the call is successful then the decapsulated secret data is written to unwrapped and the amount of data written to *unwrappedlen.

          "},{"location":"man3/EVP_PKEY_decapsulate/#notes","title":"NOTES","text":"

          After the call to EVP_PKEY_decapsulate_init() algorithm-specific parameters for the operation may be set or modified using EVP_PKEY_CTX_set_params(3).

          "},{"location":"man3/EVP_PKEY_decapsulate/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_decapsulate_init() and EVP_PKEY_decapsulate() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the private key algorithm.

          "},{"location":"man3/EVP_PKEY_decapsulate/#examples","title":"EXAMPLES","text":"

          Decapsulate data using RSA:

          #include <openssl/evp.h>\n\n/*\n * NB: assumes rsa_priv_key is an RSA private key,\n * and that in, inlen are already set up to contain encapsulated data.\n */\n\nEVP_PKEY_CTX *ctx = NULL;\nsize_t secretlen = 0;\nunsigned char *secret = NULL;;\n\nctx = EVP_PKEY_CTX_new_from_pkey(libctx, rsa_priv_key, NULL);\nif (ctx = NULL)\n    /* Error */\nif (EVP_PKEY_decapsulate_init(ctx, NULL) <= 0)\n    /* Error */\n\n/* Set the mode - only 'RSASVE' is currently supported */\nif (EVP_PKEY_CTX_set_kem_op(ctx, \"RSASVE\") <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_decapsulate(ctx, NULL, &secretlen, in, inlen) <= 0)\n    /* Error */\n\nsecret = OPENSSL_malloc(secretlen);\nif (secret == NULL)\n    /* malloc failure */\n\n/* Decapsulated secret data is secretlen bytes long */\nif (EVP_PKEY_decapsulaterctx, secret, &secretlen, in, inlen) <= 0)\n    /* Error */\n
          "},{"location":"man3/EVP_PKEY_decapsulate/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new_from_pkey(3), EVP_PKEY_encapsulate(3), EVP_KEM-RSA(7),

          "},{"location":"man3/EVP_PKEY_decapsulate/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_decapsulate/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_decrypt/","title":"EVP_PKEY_decrypt","text":""},{"location":"man3/EVP_PKEY_decrypt/#name","title":"NAME","text":"

          EVP_PKEY_decrypt_init, EVP_PKEY_decrypt_init_ex, EVP_PKEY_decrypt - decrypt using a public key algorithm

          "},{"location":"man3/EVP_PKEY_decrypt/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_decrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,\n                     unsigned char *out, size_t *outlen,\n                     const unsigned char *in, size_t inlen);\n
          "},{"location":"man3/EVP_PKEY_decrypt/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_decrypt_init() function initializes a public key algorithm context using key pkey for a decryption operation.

          The EVP_PKEY_decrypt_init_ex() function initializes a public key algorithm context using key pkey for a decryption operation and sets the algorithm specific params.

          The EVP_PKEY_decrypt() function performs a public key decryption operation using ctx. The data to be decrypted is specified using the in and inlen parameters. If out is NULL then the minimum required size of the output buffer is written to the *outlen parameter.

          If out is not NULL then before the call the *outlen parameter must contain the length of the out buffer. If the call is successful the decrypted data is written to out and the amount of the decrypted data written to *outlen, otherwise an error is returned.

          "},{"location":"man3/EVP_PKEY_decrypt/#notes","title":"NOTES","text":"

          After the call to EVP_PKEY_decrypt_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation. These operations can be included in the EVP_PKEY_decrypt_init_ex() call.

          The function EVP_PKEY_decrypt() can be called more than once on the same context if several operations are performed using the same parameters.

          "},{"location":"man3/EVP_PKEY_decrypt/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_decrypt_init(), EVP_PKEY_decrypt_init_ex() and EVP_PKEY_decrypt() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_decrypt/#examples","title":"EXAMPLES","text":"

          Decrypt data using OAEP (for RSA keys):

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nunsigned char *out, *in;\nsize_t outlen, inlen;\nEVP_PKEY *key;\n\n/*\n * NB: assumes key, eng, in, inlen are already set up\n * and that key is an RSA private key\n */\nctx = EVP_PKEY_CTX_new(key, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_decrypt_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0)\n    /* Error */\n\nout = OPENSSL_malloc(outlen);\n\nif (!out)\n    /* malloc failure */\n\nif (EVP_PKEY_decrypt(ctx, out, &outlen, in, inlen) <= 0)\n    /* Error */\n\n/* Decrypted data is outlen bytes written to buffer out */\n
          "},{"location":"man3/EVP_PKEY_decrypt/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_decrypt/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 1.0.0.

          "},{"location":"man3/EVP_PKEY_decrypt/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_derive/","title":"EVP_PKEY_derive","text":""},{"location":"man3/EVP_PKEY_derive/#name","title":"NAME","text":"

          EVP_PKEY_derive_init, EVP_PKEY_derive_init_ex, EVP_PKEY_derive_set_peer_ex, EVP_PKEY_derive_set_peer, EVP_PKEY_derive - derive public key algorithm shared secret

          "},{"location":"man3/EVP_PKEY_derive/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_derive_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_derive_set_peer_ex(EVP_PKEY_CTX *ctx, EVP_PKEY *peer,\n                                int validate_peer);\nint EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);\nint EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);\n
          "},{"location":"man3/EVP_PKEY_derive/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_derive_init() initializes a public key algorithm context ctx for shared secret derivation using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_KEYEXCH method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

          EVP_PKEY_derive_init_ex() is the same as EVP_PKEY_derive_init() but additionally sets the passed parameters params on the context before returning.

          EVP_PKEY_derive_set_peer_ex() sets the peer key: this will normally be a public key. The validate_peer will validate the public key if this value is non zero.

          EVP_PKEY_derive_set_peer() is similar to EVP_PKEY_derive_set_peer_ex() with validate_peer set to 1.

          EVP_PKEY_derive() derives a shared secret using ctx. If key is NULL then the maximum size of the output buffer is written to the keylen parameter. If key is not NULL then before the call the keylen parameter should contain the length of the key buffer, if the call is successful the shared secret is written to key and the amount of data written to keylen.

          "},{"location":"man3/EVP_PKEY_derive/#notes","title":"NOTES","text":"

          After the call to EVP_PKEY_derive_init(), algorithm specific control operations can be performed to set any appropriate parameters for the operation.

          The function EVP_PKEY_derive() can be called more than once on the same context if several operations are performed using the same parameters.

          "},{"location":"man3/EVP_PKEY_derive/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_derive_init() and EVP_PKEY_derive() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_derive/#examples","title":"EXAMPLES","text":"

          Derive shared secret (for example DH or EC keys):

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nunsigned char *skey;\nsize_t skeylen;\nEVP_PKEY *pkey, *peerkey;\n/* NB: assumes pkey, eng, peerkey have been already set up */\n\nctx = EVP_PKEY_CTX_new(pkey, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_derive_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0)\n    /* Error */\n\nskey = OPENSSL_malloc(skeylen);\n\nif (!skey)\n    /* malloc failure */\n\nif (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0)\n    /* Error */\n\n/* Shared secret is skey bytes written to buffer skey */\n
          "},{"location":"man3/EVP_PKEY_derive/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_KEYEXCH_fetch(3)

          "},{"location":"man3/EVP_PKEY_derive/#history","title":"HISTORY","text":"

          The EVP_PKEY_derive_init(), EVP_PKEY_derive_set_peer() and EVP_PKEY_derive() functions were originally added in OpenSSL 1.0.0.

          The EVP_PKEY_derive_init_ex() and EVP_PKEY_derive_set_peer_ex() functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_derive/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/","title":"EVP_PKEY_digestsign_supports_digest","text":""},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#name","title":"NAME","text":"

          EVP_PKEY_digestsign_supports_digest - indicate support for signature digest

          "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\nint EVP_PKEY_digestsign_supports_digest(EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,\n                                        const char *name, const char *propq);\n
          "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_digestsign_supports_digest() function queries whether the message digest name is supported for public key signature operations associated with key pkey. The query is done within an optional library context libctx and with an optional property query propq.

          "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#return-values","title":"RETURN VALUES","text":"

          The EVP_PKEY_digestsign_supports_digest() function returns 1 if the message digest algorithm identified by name can be used for public key signature operations associated with key pkey and 0 if it cannot be used. It returns a negative value for failure.

          "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#see-also","title":"SEE ALSO","text":"

          EVP_DigestSignInit_ex(3),

          "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#history","title":"HISTORY","text":"

          The EVP_PKEY_digestsign_supports_digest() function was added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#copyright","title":"COPYRIGHT","text":"

          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_encapsulate/","title":"EVP_PKEY_encapsulate","text":""},{"location":"man3/EVP_PKEY_encapsulate/#name","title":"NAME","text":"

          EVP_PKEY_encapsulate_init, EVP_PKEY_encapsulate - Key encapsulation using a KEM algorithm with a public key

          "},{"location":"man3/EVP_PKEY_encapsulate/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_encapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_encapsulate(EVP_PKEY_CTX *ctx,\n                         unsigned char *wrappedkey, size_t *wrappedkeylen,\n                         unsigned char *genkey, size_t *genkeylen);\n
          "},{"location":"man3/EVP_PKEY_encapsulate/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_encapsulate_init() function initializes a public key algorithm context ctx for an encapsulation operation and then sets the params on the context in the same way as calling EVP_PKEY_CTX_set_params(3). Note that ctx is usually is produced using EVP_PKEY_CTX_new_from_pkey(3), specifying the public key to use.

          The EVP_PKEY_encapsulate() function performs a public key encapsulation operation using ctx. The symmetric secret generated in genkey can be used as key material. The ciphertext in wrappedkey is its encapsulated form, which can be sent to another party, who can use EVP_PKEY_decapsulate(3) to retrieve it using their private key. If wrappedkey is NULL then the maximum size of the output buffer is written to the *wrappedkeylen parameter unless wrappedkeylen is NULL and the maximum size of the generated key buffer is written to *genkeylen unless genkeylen is NULL. If wrappedkey is not NULL and the call is successful then the internally generated key is written to genkey and its size is written to *genkeylen. The encapsulated version of the generated key is written to wrappedkey and its size is written to *wrappedkeylen.

          "},{"location":"man3/EVP_PKEY_encapsulate/#notes","title":"NOTES","text":"

          After the call to EVP_PKEY_encapsulate_init() algorithm-specific parameters for the operation may be set or modified using EVP_PKEY_CTX_set_params(3).

          "},{"location":"man3/EVP_PKEY_encapsulate/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_encapsulate_init() and EVP_PKEY_encapsulate() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_encapsulate/#examples","title":"EXAMPLES","text":"

          Encapsulate an RSASVE key (for RSA keys).

          #include <openssl/evp.h>\n\n/*\n * NB: assumes rsa_pub_key is an public key of another party.\n */\n\nEVP_PKEY_CTX *ctx = NULL;\nsize_t secretlen = 0, outlen = 0;\nunsigned char *out = NULL, *secret = NULL;\n\nctx = EVP_PKEY_CTX_new_from_pkey(libctx, rsa_pub_key, NULL);\nif (ctx = NULL)\n    /* Error */\nif (EVP_PKEY_encapsulate_init(ctx, NULL) <= 0)\n    /* Error */\n\n/* Set the mode - only 'RSASVE' is currently supported */\n if (EVP_PKEY_CTX_set_kem_op(ctx, \"RSASVE\") <= 0)\n    /* Error */\n/* Determine buffer length */\nif (EVP_PKEY_encapsulate(ctx, NULL, &outlen, NULL, &secretlen) <= 0)\n    /* Error */\n\nout = OPENSSL_malloc(outlen);\nsecret = OPENSSL_malloc(secretlen);\nif (out == NULL || secret == NULL)\n    /* malloc failure */\n\n/*\n * The generated 'secret' can be used as key material.\n * The encapsulated 'out' can be sent to another party who can\n * decapsulate it using their private key to retrieve the 'secret'.\n */\nif (EVP_PKEY_encapsulate(ctx, out, &outlen, secret, &secretlen) <= 0)\n    /* Error */\n
          "},{"location":"man3/EVP_PKEY_encapsulate/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new_from_pkey(3), EVP_PKEY_decapsulate(3), EVP_KEM-RSA(7),

          "},{"location":"man3/EVP_PKEY_encapsulate/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_encapsulate/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_encrypt/","title":"EVP_PKEY_encrypt","text":""},{"location":"man3/EVP_PKEY_encrypt/#name","title":"NAME","text":"

          EVP_PKEY_encrypt_init_ex, EVP_PKEY_encrypt_init, EVP_PKEY_encrypt - encrypt using a public key algorithm

          "},{"location":"man3/EVP_PKEY_encrypt/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_encrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,\n                     unsigned char *out, size_t *outlen,\n                     const unsigned char *in, size_t inlen);\n
          "},{"location":"man3/EVP_PKEY_encrypt/#description","title":"DESCRIPTION","text":"

          The EVP_PKEY_encrypt_init() function initializes a public key algorithm context using key pkey for an encryption operation.

          The EVP_PKEY_encrypt_init_ex() function initializes a public key algorithm context using key pkey for an encryption operation and sets the algorithm specific params.

          The EVP_PKEY_encrypt() function performs a public key encryption operation using ctx. The data to be encrypted is specified using the in and inlen parameters. If out is NULL then the maximum size of the output buffer is written to the outlen parameter. If out is not NULL then before the call the outlen parameter should contain the length of the out buffer, if the call is successful the encrypted data is written to out and the amount of data written to outlen.

          "},{"location":"man3/EVP_PKEY_encrypt/#notes","title":"NOTES","text":"

          After the call to EVP_PKEY_encrypt_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation. These operations can be included in the EVP_PKEY_encrypt_init_ex() call.

          The function EVP_PKEY_encrypt() can be called more than once on the same context if several operations are performed using the same parameters.

          "},{"location":"man3/EVP_PKEY_encrypt/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_encrypt_init(), EVP_PKEY_encrypt_init_ex() and EVP_PKEY_encrypt() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_encrypt/#examples","title":"EXAMPLES","text":"

          Encrypt data using OAEP (for RSA keys). See also PEM_read_PUBKEY(3) or d2i_X509(3) for means to load a public key. You may also simply set 'eng = NULL;' to start with the default OpenSSL RSA implementation:

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n#include <openssl/engine.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nunsigned char *out, *in;\nsize_t outlen, inlen;\nEVP_PKEY *key;\n\n/*\n * NB: assumes eng, key, in, inlen are already set up,\n * and that key is an RSA public key\n */\nctx = EVP_PKEY_CTX_new(key, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_encrypt_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0)\n    /* Error */\n\nout = OPENSSL_malloc(outlen);\n\nif (!out)\n    /* malloc failure */\n\nif (EVP_PKEY_encrypt(ctx, out, &outlen, in, inlen) <= 0)\n    /* Error */\n\n/* Encrypted data is outlen bytes written to buffer out */\n
          "},{"location":"man3/EVP_PKEY_encrypt/#see-also","title":"SEE ALSO","text":"

          d2i_X509(3), ENGINE_by_id(3), EVP_PKEY_CTX_new(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_encrypt/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 1.0.0.

          "},{"location":"man3/EVP_PKEY_encrypt/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_fromdata/","title":"EVP_PKEY_fromdata","text":""},{"location":"man3/EVP_PKEY_fromdata/#name","title":"NAME","text":"

          EVP_PKEY_fromdata_init, EVP_PKEY_fromdata, EVP_PKEY_fromdata_settable - functions to create keys and key parameters from user data

          "},{"location":"man3/EVP_PKEY_fromdata/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_fromdata_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_fromdata(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey, int selection,\n                      OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_PKEY_fromdata_settable(EVP_PKEY_CTX *ctx, int selection);\n
          "},{"location":"man3/EVP_PKEY_fromdata/#description","title":"DESCRIPTION","text":"

          The functions described here are used to create new keys from user provided key data, such as n, e and d for a minimal RSA keypair.

          These functions use an EVP_PKEY_CTX context, which should primarily be created with EVP_PKEY_CTX_new_from_name(3) or EVP_PKEY_CTX_new_id(3).

          The exact key data that the user can pass depends on the key type. These are passed as an OSSL_PARAM(3) array.

          EVP_PKEY_fromdata_init() initializes a public key algorithm context for creating a key or key parameters from user data.

          EVP_PKEY_fromdata() creates the structure to store a key or key parameters, given data from params, selection and a context that's been initialized with EVP_PKEY_fromdata_init(). The result is written to *ppkey. selection is described in \"Selections\". The parameters that can be used for various types of key are as described by the diverse \"Common parameters\" sections of the EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-ED448(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), and EVP_PKEY-ED25519(7) pages.

          EVP_PKEY_fromdata_settable() gets a constant OSSL_PARAM(3) array that describes the settable parameters that can be used with EVP_PKEY_fromdata(). selection is described in \"Selections\".

          Parameters in the params array that are not among the settable parameters for the given selection are ignored.

          "},{"location":"man3/EVP_PKEY_fromdata/#selections","title":"Selections","text":"

          The following constants can be used for selection:

          • EVP_PKEY_KEY_PARAMETERS

            Only key parameters will be selected.

          • EVP_PKEY_PUBLIC_KEY

            Only public key components will be selected. This includes optional key parameters.

          • EVP_PKEY_KEYPAIR

            Any keypair components will be selected. This includes the private key, public key and key parameters.

          "},{"location":"man3/EVP_PKEY_fromdata/#notes","title":"NOTES","text":"

          These functions only work with key management methods coming from a provider. This is the mirror function to EVP_PKEY_todata(3).

          "},{"location":"man3/EVP_PKEY_fromdata/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_fromdata_init() and EVP_PKEY_fromdata() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_fromdata/#examples","title":"EXAMPLES","text":"

          These examples are very terse for the sake of staying on topic, which is the EVP_PKEY_fromdata() set of functions. In real applications, BIGNUMs would be handled and converted to byte arrays with BN_bn2nativepad(), but that's off topic here.

          "},{"location":"man3/EVP_PKEY_fromdata/#creating-an-rsa-keypair-using-raw-key-data","title":"Creating an RSA keypair using raw key data","text":"
          #include <openssl/evp.h>\n\n/*\n * These are extremely small to make this example simple.  A real\n * and secure application will not use such small numbers.  A real\n * and secure application is expected to use BIGNUMs, and to build\n * this array dynamically.\n */\nunsigned long rsa_n = 0xbc747fc5;\nunsigned long rsa_e = 0x10001;\nunsigned long rsa_d = 0x7b133399;\nOSSL_PARAM params[] = {\n    OSSL_PARAM_ulong(\"n\", &rsa_n),\n    OSSL_PARAM_ulong(\"e\", &rsa_e),\n    OSSL_PARAM_ulong(\"d\", &rsa_d),\n    OSSL_PARAM_END\n};\n\nint main()\n{\n    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n    EVP_PKEY *pkey = NULL;\n\n    if (ctx == NULL\n        || EVP_PKEY_fromdata_init(ctx) <= 0\n        || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params) <= 0)\n        exit(1);\n\n    /* Do what you want with |pkey| */\n}\n
          "},{"location":"man3/EVP_PKEY_fromdata/#creating-an-ecc-keypair-using-raw-key-data","title":"Creating an ECC keypair using raw key data","text":"
          #include <openssl/evp.h>\n#include <openssl/param_build.h>\n#include <openssl/ec.h>\n\n/*\n * Fixed data to represent the private and public key.\n */\nconst unsigned char priv_data[] = {\n    0xb9, 0x2f, 0x3c, 0xe6, 0x2f, 0xfb, 0x45, 0x68,\n    0x39, 0x96, 0xf0, 0x2a, 0xaf, 0x6c, 0xda, 0xf2,\n    0x89, 0x8a, 0x27, 0xbf, 0x39, 0x9b, 0x7e, 0x54,\n    0x21, 0xc2, 0xa1, 0xe5, 0x36, 0x12, 0x48, 0x5d\n};\n/* UNCOMPRESSED FORMAT */\nconst unsigned char pub_data[] = {\n    POINT_CONVERSION_UNCOMPRESSED,\n    0xcf, 0x20, 0xfb, 0x9a, 0x1d, 0x11, 0x6c, 0x5e,\n    0x9f, 0xec, 0x38, 0x87, 0x6c, 0x1d, 0x2f, 0x58,\n    0x47, 0xab, 0xa3, 0x9b, 0x79, 0x23, 0xe6, 0xeb,\n    0x94, 0x6f, 0x97, 0xdb, 0xa3, 0x7d, 0xbd, 0xe5,\n    0x26, 0xca, 0x07, 0x17, 0x8d, 0x26, 0x75, 0xff,\n    0xcb, 0x8e, 0xb6, 0x84, 0xd0, 0x24, 0x02, 0x25,\n    0x8f, 0xb9, 0x33, 0x6e, 0xcf, 0x12, 0x16, 0x2f,\n    0x5c, 0xcd, 0x86, 0x71, 0xa8, 0xbf, 0x1a, 0x47\n};\n\nint main()\n{\n    EVP_PKEY_CTX *ctx;\n    EVP_PKEY *pkey = NULL;\n    BIGNUM *priv;\n    OSSL_PARAM_BLD *param_bld;\n    OSSL_PARAM *params = NULL;\n    int exitcode = 0;\n\n    priv = BN_bin2bn(priv_data, sizeof(priv_data), NULL);\n\n    param_bld = OSSL_PARAM_BLD_new();\n    if (priv != NULL && param_bld != NULL\n        && OSSL_PARAM_BLD_push_utf8_string(param_bld, \"group\",\n                                           \"prime256v1\", 0)\n        && OSSL_PARAM_BLD_push_BN(param_bld, \"priv\", priv)\n        && OSSL_PARAM_BLD_push_octet_string(param_bld, \"pub\",\n                                            pub_data, sizeof(pub_data)))\n        params = OSSL_PARAM_BLD_to_param(param_bld);\n\n    ctx = EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n    if (ctx == NULL\n        || params == NULL\n        || EVP_PKEY_fromdata_init(ctx) <= 0\n        || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params) <= 0) {\n        exitcode = 1;\n    } else {\n        /* Do what you want with |pkey| */\n    }\n\n    EVP_PKEY_free(pkey);\n    EVP_PKEY_CTX_free(ctx);\n    OSSL_PARAM_free(params);\n    OSSL_PARAM_BLD_free(param_bld);\n    BN_free(priv);\n\n    exit(exitcode);\n}\n
          "},{"location":"man3/EVP_PKEY_fromdata/#finding-out-params-for-an-unknown-key-type","title":"Finding out params for an unknown key type","text":"
          #include <openssl/evp.h>\n#include <openssl/core.h>\n\n/* Program expects a key type as first argument */\nint main(int argc, char *argv[])\n{\n    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_name(NULL, argv[1], NULL);\n    const OSSL_PARAM *settable_params = NULL;\n\n    if (ctx == NULL)\n       exit(1);\n   settable_params = EVP_PKEY_fromdata_settable(ctx, EVP_PKEY_KEYPAIR);\n   if (settable_params == NULL)\n        exit(1);\n\n    for (; settable_params->key != NULL; settable_params++) {\n        const char *datatype = NULL;\n\n        switch (settable_params->data_type) {\n        case OSSL_PARAM_INTEGER:\n            datatype = \"integer\";\n            break;\n        case OSSL_PARAM_UNSIGNED_INTEGER:\n            datatype = \"unsigned integer\";\n            break;\n        case OSSL_PARAM_UTF8_STRING:\n            datatype = \"printable string (utf-8 encoding expected)\";\n            break;\n        case OSSL_PARAM_UTF8_PTR:\n            datatype = \"printable string pointer (utf-8 encoding expected)\";\n            break;\n        case OSSL_PARAM_OCTET_STRING:\n            datatype = \"octet string\";\n            break;\n        case OSSL_PARAM_OCTET_PTR:\n            datatype = \"octet string pointer\";\n            break;\n        }\n        printf(\"%s : %s \", settable_params->key, datatype);\n        if (settable_params->data_size == 0)\n            printf(\"(unlimited size)\\n\");\n        else\n            printf(\"(maximum size %zu)\\n\", settable_params->data_size);\n    }\n}\n

          The descriptor OSSL_PARAM(3) returned by EVP_PKEY_fromdata_settable() may also be used programmatically, for example with OSSL_PARAM_allocate_from_text(3).

          "},{"location":"man3/EVP_PKEY_fromdata/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), provider(7), EVP_PKEY_gettable_params(3), OSSL_PARAM(3), EVP_PKEY_todata(3), EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-ED448(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), EVP_PKEY-ED25519(7)

          "},{"location":"man3/EVP_PKEY_fromdata/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_fromdata/#copyright","title":"COPYRIGHT","text":"

          Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_get_attr/","title":"EVP_PKEY_get_attr","text":""},{"location":"man3/EVP_PKEY_get_attr/#name","title":"NAME","text":"

          EVP_PKEY_get_attr, EVP_PKEY_get_attr_count, EVP_PKEY_get_attr_by_NID, EVP_PKEY_get_attr_by_OBJ, EVP_PKEY_delete_attr, EVP_PKEY_add1_attr, EVP_PKEY_add1_attr_by_OBJ, EVP_PKEY_add1_attr_by_NID, EVP_PKEY_add1_attr_by_txt - EVP_PKEY X509_ATTRIBUTE functions

          "},{"location":"man3/EVP_PKEY_get_attr/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/x509.h>\n\nint EVP_PKEY_get_attr_count(const EVP_PKEY *key);\nint EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos);\nint EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj,\n                             int lastpos);\nX509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);\nX509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);\nint EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);\nint EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,\n                              const ASN1_OBJECT *obj, int type,\n                              const unsigned char *bytes, int len);\nint EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,\n                              int nid, int type,\n                              const unsigned char *bytes, int len);\nint EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,\n                              const char *attrname, int type,\n                              const unsigned char *bytes, int len);\n
          "},{"location":"man3/EVP_PKEY_get_attr/#description","title":"DESCRIPTION","text":"

          These functions are used by PKCS12.

          EVP_PKEY_get_attr_by_OBJ() finds the location of the first matching object obj in the key attribute list. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to EVP_PKEY_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the attribute list.

          EVP_PKEY_get_attr_by_NID() is similar to EVP_PKEY_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

          EVP_PKEY_get_attr() returns the X509_ATTRIBUTE object at index loc in the key attribute list. loc should be in the range from 0 to EVP_PKEY_get_attr_count() - 1.

          EVP_PKEY_delete_attr() removes the X509_ATTRIBUTE object at index loc in the key attribute list.

          EVP_PKEY_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE object to the key attribute list. A new key attribute list is created if required. An error occurs if either attr is NULL, or the attribute already exists.

          EVP_PKEY_add1_attr_by_OBJ() creates a new X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the key object's attribute list. If obj already exists in the attribute list then an error occurs.

          EVP_PKEY_add1_attr_by_NID() is similar to EVP_PKEY_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

          EVP_PKEY_add1_attr_by_txt() is similar to EVP_PKEY_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

          "},{"location":"man3/EVP_PKEY_get_attr/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_get_attr_count() returns the number of attributes in the key object attribute list or -1 if the attribute list is NULL.

          EVP_PKEY_get_attr_by_OBJ() returns -1 if either the list is empty OR the object is not found, otherwise it returns the location of the object in the list.

          EVP_PKEY_get_attr_by_NID() is similar to EVP_PKEY_get_attr_by_OBJ(), except that it returns -2 if the nid is not known by OpenSSL.

          EVP_PKEY_get_attr() returns either a X509_ATTRIBUTE or NULL if there is a error.

          EVP_PKEY_delete_attr() returns either the removed X509_ATTRIBUTE or NULL if there is a error.

          EVP_PKEY_add1_attr(), EVP_PKEY_add1_attr_by_OBJ(), EVP_PKEY_add1_attr_by_NID() and EVP_PKEY_add1_attr_by_txt() return 1 on success or 0 otherwise.

          "},{"location":"man3/EVP_PKEY_get_attr/#notes","title":"NOTES","text":"

          A EVP_PKEY object's attribute list is initially NULL. All the above functions listed will return an error unless EVP_PKEY_add1_attr() is called. All functions listed assume that the key is not NULL.

          "},{"location":"man3/EVP_PKEY_get_attr/#see-also","title":"SEE ALSO","text":"

          X509_ATTRIBUTE(3)

          "},{"location":"man3/EVP_PKEY_get_attr/#copyright","title":"COPYRIGHT","text":"

          Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/","title":"EVP_PKEY_get_default_digest_nid","text":""},{"location":"man3/EVP_PKEY_get_default_digest_nid/#name","title":"NAME","text":"

          EVP_PKEY_get_default_digest_nid, EVP_PKEY_get_default_digest_name - get default signature digest

          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_get_default_digest_name(EVP_PKEY *pkey,\n                                     char *mdname, size_t mdname_sz);\nint EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);\n
          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_get_default_digest_name() fills in the default message digest name for the public key signature operations associated with key pkey into mdname, up to at most mdname_sz bytes including the ending NUL byte. The name could be \"UNDEF\", signifying that a digest must (for return value 2) or may (for return value 1) be left unspecified.

          EVP_PKEY_get_default_digest_nid() sets pnid to the default message digest NID for the public key signature operations associated with key pkey. Note that some signature algorithms (i.e. Ed25519 and Ed448) do not use a digest during signing. In this case pnid will be set to NID_undef. This function is only reliable for legacy keys, which are keys with a EVP_PKEY_ASN1_METHOD; these keys have typically been loaded from engines, or created with EVP_PKEY_assign_RSA(3) or similar.

          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#notes","title":"NOTES","text":"

          For all current standard OpenSSL public key algorithms SHA256 is returned.

          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_get_default_digest_name() and EVP_PKEY_get_default_digest_nid() both return 1 if the message digest is advisory (that is other digests can be used) and 2 if it is mandatory (other digests can not be used). They return 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_sign(3), EVP_PKEY_digestsign_supports_digest(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3),

          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#history","title":"HISTORY","text":"

          This function was added in OpenSSL 1.0.0.

          "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_get_field_type/","title":"EVP_PKEY_get_field_type","text":""},{"location":"man3/EVP_PKEY_get_field_type/#name","title":"NAME","text":"

          EVP_PKEY_get_field_type, EVP_PKEY_get_ec_point_conv_form - get field type or point conversion form of a key

          "},{"location":"man3/EVP_PKEY_get_field_type/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_get_field_type(const EVP_PKEY *pkey);\nint EVP_PKEY_get_ec_point_conv_form(const EVP_PKEY *pkey);\n
          "},{"location":"man3/EVP_PKEY_get_field_type/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_get_field_type() returns the field type NID of the pkey, if pkey's key type supports it. The types currently supported by the built-in OpenSSL providers are either NID_X9_62_prime_field for prime curves or NID_X9_62_characteristic_two_field for binary curves; these values are defined in the <openssl/obj_mac.h> header file.

          EVP_PKEY_get_ec_point_conv_form() returns the point conversion format of the pkey, if pkey's key type supports it.

          "},{"location":"man3/EVP_PKEY_get_field_type/#notes","title":"NOTES","text":"

          Among the standard OpenSSL key types, this is only supported for EC and SM2 keys. Other providers may support this for additional key types.

          "},{"location":"man3/EVP_PKEY_get_field_type/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_get_field_type() returns the field type NID or 0 on error.

          EVP_PKEY_get_ec_point_conv_form() returns the point conversion format number (see EC_GROUP_copy(3)) or 0 on error.

          "},{"location":"man3/EVP_PKEY_get_field_type/#see-also","title":"SEE ALSO","text":"

          EC_GROUP_copy(3)

          "},{"location":"man3/EVP_PKEY_get_field_type/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_get_field_type/#copyright","title":"COPYRIGHT","text":"

          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_get_group_name/","title":"EVP_PKEY_get_group_name","text":""},{"location":"man3/EVP_PKEY_get_group_name/#name","title":"NAME","text":"

          EVP_PKEY_get_group_name - get group name of a key

          "},{"location":"man3/EVP_PKEY_get_group_name/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_get_group_name(EVP_PKEY *pkey, char *gname, size_t gname_sz,\n                            size_t *gname_len);\n
          "},{"location":"man3/EVP_PKEY_get_group_name/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_get_group_name() fills in the group name of the pkey into gname, up to at most gname_sz bytes including the ending NUL byte and assigns *gname_len the actual length of the name not including the NUL byte, if pkey's key type supports it. gname as well as gname_len may individually be NULL, and won't be filled in or assigned in that case.

          "},{"location":"man3/EVP_PKEY_get_group_name/#notes","title":"NOTES","text":"

          Among the standard OpenSSL key types, this is only supported for DH, EC and SM2 keys. Other providers may support this for additional key types.

          "},{"location":"man3/EVP_PKEY_get_group_name/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_get_group_name() returns 1 if the group name could be filled in, otherwise 0.

          "},{"location":"man3/EVP_PKEY_get_group_name/#history","title":"HISTORY","text":"

          This function was added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_get_group_name/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_get_size/","title":"EVP_PKEY_get_size","text":""},{"location":"man3/EVP_PKEY_get_size/#name","title":"NAME","text":"

          EVP_PKEY_get_size, EVP_PKEY_get_bits, EVP_PKEY_get_security_bits, EVP_PKEY_bits, EVP_PKEY_security_bits, EVP_PKEY_size - EVP_PKEY information functions

          "},{"location":"man3/EVP_PKEY_get_size/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_get_size(const EVP_PKEY *pkey);\nint EVP_PKEY_get_bits(const EVP_PKEY *pkey);\nint EVP_PKEY_get_security_bits(const EVP_PKEY *pkey);\n\n#define EVP_PKEY_bits EVP_PKEY_get_bits\n#define EVP_PKEY_security_bits EVP_PKEY_get_security_bits\n#define EVP_PKEY_size EVP_PKEY_get_size\n
          "},{"location":"man3/EVP_PKEY_get_size/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_get_size() returns the maximum suitable size for the output buffers for almost all operations that can be done with pkey. The primary documented use is with EVP_SignFinal(3) and EVP_SealInit(3), but it isn't limited there. The returned size is also large enough for the output buffer of EVP_PKEY_sign(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_derive(3).

          It must be stressed that, unless the documentation for the operation that's being performed says otherwise, the size returned by EVP_PKEY_get_size() is only preliminary and not exact, so the final contents of the target buffer may be smaller. It is therefore crucial to take note of the size given back by the function that performs the operation, such as EVP_PKEY_sign(3) (the siglen argument will receive that length), to avoid bugs.

          EVP_PKEY_get_bits() returns the cryptographic length of the cryptosystem to which the key in pkey belongs, in bits. Note that the definition of cryptographic length is specific to the key cryptosystem.

          EVP_PKEY_get_security_bits() returns the number of security bits of the given pkey, bits of security is defined in NIST SP800-57.

          "},{"location":"man3/EVP_PKEY_get_size/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_get_size(), EVP_PKEY_get_bits() and EVP_PKEY_get_security_bits() return a positive number, or 0 if this size isn't available.

          "},{"location":"man3/EVP_PKEY_get_size/#notes","title":"NOTES","text":"

          Most functions that have an output buffer and are mentioned with EVP_PKEY_get_size() have a functionality where you can pass NULL for the buffer and still pass a pointer to an integer and get the exact size that this function call delivers in the context that it's called in. This allows those functions to be called twice, once to find out the exact buffer size, then allocate the buffer in between, and call that function again actually output the data. For those functions, it isn't strictly necessary to call EVP_PKEY_get_size() to find out the buffer size, but may be useful in cases where it's desirable to know the upper limit in advance.

          It should also be especially noted that EVP_PKEY_get_size() shouldn't be used to get the output size for EVP_DigestSignFinal(), according to \"NOTES\" in EVP_DigestSignFinal(3).

          "},{"location":"man3/EVP_PKEY_get_size/#see-also","title":"SEE ALSO","text":"

          EVP_SignFinal(3), EVP_SealInit(3), EVP_PKEY_sign(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_get_size/#history","title":"HISTORY","text":"

          The EVP_PKEY_bits(), EVP_PKEY_security_bits(), and EVP_PKEY_size() functions were renamed to include get in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

          "},{"location":"man3/EVP_PKEY_get_size/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_gettable_params/","title":"EVP_PKEY_gettable_params","text":""},{"location":"man3/EVP_PKEY_gettable_params/#name","title":"NAME","text":"

          EVP_PKEY_gettable_params, EVP_PKEY_get_params, EVP_PKEY_get_int_param, EVP_PKEY_get_size_t_param, EVP_PKEY_get_bn_param, EVP_PKEY_get_utf8_string_param, EVP_PKEY_get_octet_string_param - retrieve key parameters from a key

          "},{"location":"man3/EVP_PKEY_gettable_params/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nconst OSSL_PARAM *EVP_PKEY_gettable_params(EVP_PKEY *pkey);\nint EVP_PKEY_get_params(const EVP_PKEY *pkey, OSSL_PARAM params[]);\nint EVP_PKEY_get_int_param(const EVP_PKEY *pkey, const char *key_name,\n                           int *out);\nint EVP_PKEY_get_size_t_param(const EVP_PKEY *pkey, const char *key_name,\n                              size_t *out);\nint EVP_PKEY_get_bn_param(const EVP_PKEY *pkey, const char *key_name,\n                          BIGNUM **bn);\nint EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey, const char *key_name,\n                                   char *str, size_t max_buf_sz,\n                                   size_t *out_len);\nint EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey, const char *key_name,\n                                    unsigned char *buf, size_t max_buf_sz,\n                                    size_t *out_len);\n
          "},{"location":"man3/EVP_PKEY_gettable_params/#description","title":"DESCRIPTION","text":"

          See OSSL_PARAM(3) for information about parameters.

          EVP_PKEY_get_params() retrieves parameters from the key pkey, according to the contents of params.

          EVP_PKEY_gettable_params() returns a constant list of params indicating the names and types of key parameters that can be retrieved.

          An OSSL_PARAM(3) of type OSSL_PARAM_INTEGER or OSSL_PARAM_UNSIGNED_INTEGER is of arbitrary length. Such a parameter can be obtained using any of the functions EVP_PKEY_get_int_param(), EVP_PKEY_get_size_t_param() or EVP_PKEY_get_bn_param(). Attempting to obtain an integer value that does not fit into a native C int type will cause EVP_PKEY_get_int_param() to fail. Similarly attempting to obtain an integer value that is negative or does not fit into a native C size_t type using EVP_PKEY_get_size_t_param() will also fail.

          EVP_PKEY_get_int_param() retrieves a key pkey integer value *out associated with a name of key_name if it fits into int type. For parameters that do not fit into int use EVP_PKEY_get_bn_param().

          EVP_PKEY_get_size_t_param() retrieves a key pkey size_t value *out associated with a name of key_name if it fits into size_t type. For parameters that do not fit into size_t use EVP_PKEY_get_bn_param().

          EVP_PKEY_get_bn_param() retrieves a key pkey BIGNUM value **bn associated with a name of key_name. If *bn is NULL then the BIGNUM is allocated by the method.

          EVP_PKEY_get_utf8_string_param() get a key pkey UTF8 string value into a buffer str of maximum size max_buf_sz associated with a name of key_name. The maximum size must be large enough to accommodate the string value including a terminating NUL byte, or this function will fail. If out_len is not NULL, *out_len is set to the length of the string not including the terminating NUL byte. The required buffer size not including the terminating NUL byte can be obtained from *out_len by calling the function with str set to NULL.

          EVP_PKEY_get_octet_string_param() get a key pkey's octet string value into a buffer buf of maximum size max_buf_sz associated with a name of key_name. If out_len is not NULL, *out_len is set to the length of the contents. The required buffer size can be obtained from *out_len by calling the function with buf set to NULL.

          "},{"location":"man3/EVP_PKEY_gettable_params/#notes","title":"NOTES","text":"

          These functions only work for EVP_PKEYs that contain a provider side key.

          "},{"location":"man3/EVP_PKEY_gettable_params/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_gettable_params() returns NULL on error or if it is not supported.

          All other methods return 1 if a value associated with the key's key_name was successfully returned, or 0 if there was an error. An error may be returned by methods EVP_PKEY_get_utf8_string_param() and EVP_PKEY_get_octet_string_param() if max_buf_sz is not big enough to hold the value. If out_len is not NULL, *out_len will be assigned the required buffer size to hold the value.

          "},{"location":"man3/EVP_PKEY_gettable_params/#examples","title":"EXAMPLES","text":"
          #include <openssl/evp.h>\n\nchar curve_name[64];\nunsigned char pub[256];\nBIGNUM *bn_priv = NULL;\n\n/*\n * NB: assumes 'key' is set up before the next step. In this example the key\n * is an EC key.\n */\n\nif (!EVP_PKEY_get_utf8_string_param(key, OSSL_PKEY_PARAM_GROUP_NAME,\n                                    curve_name, sizeof(curve_name), &len)) {\n  /* Error */\n}\nif (!EVP_PKEY_get_octet_string_param(key, OSSL_PKEY_PARAM_PUB_KEY,\n                                     pub, sizeof(pub), &len)) {\n    /* Error */\n}\nif (!EVP_PKEY_get_bn_param(key, OSSL_PKEY_PARAM_PRIV_KEY, &bn_priv)) {\n    /* Error */\n}\n\nBN_clear_free(bn_priv);\n
          "},{"location":"man3/EVP_PKEY_gettable_params/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), provider-keymgmt(7), OSSL_PARAM(3)

          "},{"location":"man3/EVP_PKEY_gettable_params/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_gettable_params/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_is_a/","title":"EVP_PKEY_is_a","text":""},{"location":"man3/EVP_PKEY_is_a/#name","title":"NAME","text":"

          EVP_PKEY_is_a, EVP_PKEY_can_sign, EVP_PKEY_type_names_do_all, EVP_PKEY_get0_type_name, EVP_PKEY_get0_description, EVP_PKEY_get0_provider - key type and capabilities functions

          "},{"location":"man3/EVP_PKEY_is_a/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_is_a(const EVP_PKEY *pkey, const char *name);\nint EVP_PKEY_can_sign(const EVP_PKEY *pkey);\nint EVP_PKEY_type_names_do_all(const EVP_PKEY *pkey,\n                               void (*fn)(const char *name, void *data),\n                               void *data);\nconst char *EVP_PKEY_get0_type_name(const EVP_PKEY *key);\nconst char *EVP_PKEY_get0_description(const EVP_PKEY *key);\nconst OSSL_PROVIDER *EVP_PKEY_get0_provider(const EVP_PKEY *key);\n
          "},{"location":"man3/EVP_PKEY_is_a/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_is_a() checks if the key type of pkey is name.

          EVP_PKEY_can_sign() checks if the functionality for the key type of pkey supports signing. No other check is done, such as whether pkey contains a private key.

          EVP_PKEY_type_names_do_all() traverses all names for pkey's key type, and calls fn with each name and data. For example, an RSA EVP_PKEY may be named both RSA and rsaEncryption. The order of the names depends on the provider implementation that holds the key.

          EVP_PKEY_get0_type_name() returns the first key type name that is found for the given pkey. Note that the pkey may have multiple synonyms associated with it. In this case it depends on the provider implementation that holds the key which one will be returned. Ownership of the returned string is retained by the pkey object and should not be freed by the caller.

          EVP_PKEY_get0_description() returns a description of the type of EVP_PKEY, meant for display and human consumption. The description is at the discretion of the key type implementation.

          EVP_PKEY_get0_provider() returns the provider of the EVP_PKEY's EVP_KEYMGMT(3).

          "},{"location":"man3/EVP_PKEY_is_a/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_is_a() returns 1 if pkey has the key type name, otherwise 0.

          EVP_PKEY_can_sign() returns 1 if the pkey key type functionality supports signing, otherwise 0.

          EVP_PKEY_get0_type_name() returns the name that is found or NULL on error.

          EVP_PKEY_get0_description() returns the description if found or NULL if not.

          EVP_PKEY_get0_provider() returns the provider if found or NULL if not.

          EVP_PKEY_type_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

          "},{"location":"man3/EVP_PKEY_is_a/#examples","title":"EXAMPLES","text":""},{"location":"man3/EVP_PKEY_is_a/#evp_pkey_is_a_1","title":"EVP_PKEY_is_a()","text":"

          The loaded providers and what key types they support will ultimately determine what name is possible to use with EVP_PKEY_is_a(). We do know that the default provider supports RSA, DH, DSA and EC keys, so we can use this as an crude example:

          #include <openssl/evp.h>\n\n...\n    /* |pkey| is an EVP_PKEY* */\n    if (EVP_PKEY_is_a(pkey, \"RSA\")) {\n        BIGNUM *modulus = NULL;\n        if (EVP_PKEY_get_bn_param(pkey, \"n\", &modulus))\n            /* do whatever with the modulus */\n        BN_free(modulus);\n    }\n
          "},{"location":"man3/EVP_PKEY_is_a/#evp_pkey_can_sign","title":"EVP_PKEY_can_sign()","text":"
          #include <openssl/evp.h>\n\n...\n    /* |pkey| is an EVP_PKEY* */\n    if (!EVP_PKEY_can_sign(pkey)) {\n        fprintf(stderr, \"Not a signing key!\");\n        exit(1);\n    }\n    /* Sign something... */\n
          "},{"location":"man3/EVP_PKEY_is_a/#history","title":"HISTORY","text":"

          The functions described here were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_is_a/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_keygen/","title":"EVP_PKEY_keygen","text":""},{"location":"man3/EVP_PKEY_keygen/#name","title":"NAME","text":"

          EVP_PKEY_Q_keygen, EVP_PKEY_keygen_init, EVP_PKEY_paramgen_init, EVP_PKEY_generate, EVP_PKEY_CTX_set_cb, EVP_PKEY_CTX_get_cb, EVP_PKEY_CTX_get_keygen_info, EVP_PKEY_CTX_set_app_data, EVP_PKEY_CTX_get_app_data, EVP_PKEY_gen_cb, EVP_PKEY_paramgen, EVP_PKEY_keygen - key and parameter generation and check functions

          "},{"location":"man3/EVP_PKEY_keygen/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nEVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq,\n                            const char *type, ...);\n\nint EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_generate(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\nint EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\nint EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\n\ntypedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);\n\nvoid EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);\nEVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);\n\nint EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);\n\nvoid EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);\nvoid *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);\n
          "},{"location":"man3/EVP_PKEY_keygen/#description","title":"DESCRIPTION","text":"

          Generating keys is sometimes straight forward, just generate the key's numbers and be done with it. However, there are certain key types that need key parameters, often called domain parameters but not necessarily limited to that, that also need to be generated. In addition to this, the caller may want to set user provided generation parameters that further affect key parameter or key generation, such as the desired key size.

          To flexibly allow all that's just been described, key parameter and key generation is divided into an initialization of a key algorithm context, functions to set user provided parameters, and finally the key parameter or key generation function itself.

          The key algorithm context must be created using EVP_PKEY_CTX_new(3) or variants thereof, see that manual for details.

          EVP_PKEY_keygen_init() initializes a public key algorithm context ctx for a key generation operation.

          EVP_PKEY_paramgen_init() is similar to EVP_PKEY_keygen_init() except key parameters are generated.

          After initialization, generation parameters may be provided with EVP_PKEY_CTX_ctrl(3) or EVP_PKEY_CTX_set_params(3), or any other function described in those manuals.

          EVP_PKEY_generate() performs the generation operation, the resulting key parameters or key are written to *ppkey. If *ppkey is NULL when this function is called, it will be allocated, and should be freed by the caller when no longer useful, using EVP_PKEY_free(3).

          EVP_PKEY_paramgen() and EVP_PKEY_keygen() do exactly the same thing as EVP_PKEY_generate(), after checking that the corresponding EVP_PKEY_paramgen_init() or EVP_PKEY_keygen_init() was used to initialize ctx. These are older functions that are kept for backward compatibility. It is safe to use EVP_PKEY_generate() instead.

          The function EVP_PKEY_set_cb() sets the key or parameter generation callback to cb. The function EVP_PKEY_CTX_get_cb() returns the key or parameter generation callback.

          The function EVP_PKEY_CTX_get_keygen_info() returns parameters associated with the generation operation. If idx is -1 the total number of parameters available is returned. Any non negative value returns the value of that parameter. EVP_PKEY_CTX_gen_keygen_info() with a nonnegative value for idx should only be called within the generation callback.

          If the callback returns 0 then the key generation operation is aborted and an error occurs. This might occur during a time consuming operation where a user clicks on a \"cancel\" button.

          The functions EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() set and retrieve an opaque pointer. This can be used to set some application defined value which can be retrieved in the callback: for example a handle which is used to update a \"progress dialog\".

          EVP_PKEY_Q_keygen() abstracts from the explicit use of EVP_PKEY_CTX while providing a 'quick' but limited way of generating a new asymmetric key pair. It provides shorthands for simple and common cases of key generation. As usual, the library context libctx and property query propq can be given for fetching algorithms from providers. If type is RSA, a size_t parameter must be given to specify the size of the RSA key. If type is EC, a string parameter must be given to specify the name of the EC curve. If type is X25519, X448, ED25519, ED448, or SM2 no further parameter is needed.

          "},{"location":"man3/EVP_PKEY_keygen/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_keygen_init(), EVP_PKEY_paramgen_init(), EVP_PKEY_keygen() and EVP_PKEY_paramgen() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          EVP_PKEY_Q_keygen() returns an EVP_PKEY, or NULL on failure.

          "},{"location":"man3/EVP_PKEY_keygen/#notes","title":"NOTES","text":"

          After the call to EVP_PKEY_keygen_init() or EVP_PKEY_paramgen_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation.

          The functions EVP_PKEY_keygen() and EVP_PKEY_paramgen() can be called more than once on the same context if several operations are performed using the same parameters.

          The meaning of the parameters passed to the callback will depend on the algorithm and the specific implementation of the algorithm. Some might not give any useful information at all during key or parameter generation. Others might not even call the callback.

          The operation performed by key or parameter generation depends on the algorithm used. In some cases (e.g. EC with a supplied named curve) the \"generation\" option merely sets the appropriate fields in an EVP_PKEY structure.

          In OpenSSL an EVP_PKEY structure containing a private key also contains the public key components and parameters (if any). An OpenSSL private key is equivalent to what some libraries call a \"key pair\". A private key can be used in functions which require the use of a public key or parameters.

          "},{"location":"man3/EVP_PKEY_keygen/#examples","title":"EXAMPLES","text":"

          Generate a 2048 bit RSA key:

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nEVP_PKEY *pkey = NULL;\n\nctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_keygen_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <= 0)\n    /* Error */\n\n/* Generate key */\nif (EVP_PKEY_keygen(ctx, &pkey) <= 0)\n    /* Error */\n

          Generate a key from a set of parameters:

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nEVP_PKEY *pkey = NULL, *param;\n\n/* Assumed param, eng are set up already */\nctx = EVP_PKEY_CTX_new(param, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_keygen_init(ctx) <= 0)\n    /* Error */\n\n/* Generate key */\nif (EVP_PKEY_keygen(ctx, &pkey) <= 0)\n    /* Error */\n

          Example of generation callback for OpenSSL public key implementations:

          /* Application data is a BIO to output status to */\n\nEVP_PKEY_CTX_set_app_data(ctx, status_bio);\n\nstatic int genpkey_cb(EVP_PKEY_CTX *ctx)\n{\n    char c = '*';\n    BIO *b = EVP_PKEY_CTX_get_app_data(ctx);\n    int p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);\n\n    if (p == 0)\n        c = '.';\n    if (p == 1)\n        c = '+';\n    if (p == 2)\n        c = '*';\n    if (p == 3)\n        c = '\\n';\n    BIO_write(b, &c, 1);\n    (void)BIO_flush(b);\n    return 1;\n}\n
          "},{"location":"man3/EVP_PKEY_keygen/#see-also","title":"SEE ALSO","text":"

          EVP_RSA_gen(3), EVP_EC_gen(3), EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_keygen/#history","title":"HISTORY","text":"

          EVP_PKEY_keygen_init(), int EVP_PKEY_paramgen_init(), EVP_PKEY_keygen(), EVP_PKEY_paramgen(), EVP_PKEY_gen_cb(), EVP_PKEY_CTX_set_cb(), EVP_PKEY_CTX_get_cb(), EVP_PKEY_CTX_get_keygen_info(), EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() were added in OpenSSL 1.0.0.

          EVP_PKEY_Q_keygen() and EVP_PKEY_generate() were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_keygen/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_meth_get_count/","title":"EVP_PKEY_meth_get_count","text":""},{"location":"man3/EVP_PKEY_meth_get_count/#name","title":"NAME","text":"

          EVP_PKEY_meth_get_count, EVP_PKEY_meth_get0, EVP_PKEY_meth_get0_info - enumerate public key methods

          "},{"location":"man3/EVP_PKEY_meth_get_count/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n

          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          size_t EVP_PKEY_meth_get_count(void);\nconst EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx);\nvoid EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,\n                             const EVP_PKEY_METHOD *meth);\n
          "},{"location":"man3/EVP_PKEY_meth_get_count/#description","title":"DESCRIPTION","text":"

          All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

          EVP_PKEY_meth_count() returns a count of the number of public key methods available: it includes standard methods and any methods added by the application.

          EVP_PKEY_meth_get0() returns the public key method idx. The value of idx must be between zero and EVP_PKEY_meth_get_count() - 1.

          EVP_PKEY_meth_get0_info() returns the public key ID (a NID) and any flags associated with the public key method *meth.

          "},{"location":"man3/EVP_PKEY_meth_get_count/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_meth_count() returns the number of available public key methods.

          EVP_PKEY_meth_get0() return a public key method or NULL if idx is out of range.

          EVP_PKEY_meth_get0_info() does not return a value.

          "},{"location":"man3/EVP_PKEY_meth_get_count/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_new(3)

          "},{"location":"man3/EVP_PKEY_meth_get_count/#history","title":"HISTORY","text":"

          All of these functions were deprecated in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_meth_get_count/#copyright","title":"COPYRIGHT","text":"

          Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_meth_new/","title":"EVP_PKEY_meth_new","text":""},{"location":"man3/EVP_PKEY_meth_new/#name","title":"NAME","text":"

          EVP_PKEY_meth_new, EVP_PKEY_meth_free, EVP_PKEY_meth_copy, EVP_PKEY_meth_find, EVP_PKEY_meth_add0, EVP_PKEY_METHOD, EVP_PKEY_meth_set_init, EVP_PKEY_meth_set_copy, EVP_PKEY_meth_set_cleanup, EVP_PKEY_meth_set_paramgen, EVP_PKEY_meth_set_keygen, EVP_PKEY_meth_set_sign, EVP_PKEY_meth_set_verify, EVP_PKEY_meth_set_verify_recover, EVP_PKEY_meth_set_signctx, EVP_PKEY_meth_set_verifyctx, EVP_PKEY_meth_set_encrypt, EVP_PKEY_meth_set_decrypt, EVP_PKEY_meth_set_derive, EVP_PKEY_meth_set_ctrl, EVP_PKEY_meth_set_digestsign, EVP_PKEY_meth_set_digestverify, EVP_PKEY_meth_set_check, EVP_PKEY_meth_set_public_check, EVP_PKEY_meth_set_param_check, EVP_PKEY_meth_set_digest_custom, EVP_PKEY_meth_get_init, EVP_PKEY_meth_get_copy, EVP_PKEY_meth_get_cleanup, EVP_PKEY_meth_get_paramgen, EVP_PKEY_meth_get_keygen, EVP_PKEY_meth_get_sign, EVP_PKEY_meth_get_verify, EVP_PKEY_meth_get_verify_recover, EVP_PKEY_meth_get_signctx, EVP_PKEY_meth_get_verifyctx, EVP_PKEY_meth_get_encrypt, EVP_PKEY_meth_get_decrypt, EVP_PKEY_meth_get_derive, EVP_PKEY_meth_get_ctrl, EVP_PKEY_meth_get_digestsign, EVP_PKEY_meth_get_digestverify, EVP_PKEY_meth_get_check, EVP_PKEY_meth_get_public_check, EVP_PKEY_meth_get_param_check, EVP_PKEY_meth_get_digest_custom, EVP_PKEY_meth_remove - manipulating EVP_PKEY_METHOD structure

          "},{"location":"man3/EVP_PKEY_meth_new/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n

          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          typedef struct evp_pkey_method_st EVP_PKEY_METHOD;\n\nEVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);\nvoid EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);\nvoid EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);\nconst EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);\nint EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);\nint EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth);\n\nvoid EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,\n                            int (*init) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,\n                            int (*copy) (EVP_PKEY_CTX *dst,\n                                         const EVP_PKEY_CTX *src));\nvoid EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,\n                               void (*cleanup) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,\n                                int (*paramgen_init) (EVP_PKEY_CTX *ctx),\n                                int (*paramgen) (EVP_PKEY_CTX *ctx,\n                                                 EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,\n                              int (*keygen_init) (EVP_PKEY_CTX *ctx),\n                              int (*keygen) (EVP_PKEY_CTX *ctx,\n                                             EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,\n                            int (*sign_init) (EVP_PKEY_CTX *ctx),\n                            int (*sign) (EVP_PKEY_CTX *ctx,\n                                         unsigned char *sig, size_t *siglen,\n                                         const unsigned char *tbs,\n                                         size_t tbslen));\nvoid EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,\n                              int (*verify_init) (EVP_PKEY_CTX *ctx),\n                              int (*verify) (EVP_PKEY_CTX *ctx,\n                                             const unsigned char *sig,\n                                             size_t siglen,\n                                             const unsigned char *tbs,\n                                             size_t tbslen));\nvoid EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,\n                                      int (*verify_recover_init) (EVP_PKEY_CTX\n                                                                  *ctx),\n                                      int (*verify_recover) (EVP_PKEY_CTX\n                                                             *ctx,\n                                                             unsigned char\n                                                             *sig,\n                                                             size_t *siglen,\n                                                             const unsigned\n                                                             char *tbs,\n                                                             size_t tbslen));\nvoid EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,\n                               int (*signctx_init) (EVP_PKEY_CTX *ctx,\n                                                    EVP_MD_CTX *mctx),\n                               int (*signctx) (EVP_PKEY_CTX *ctx,\n                                               unsigned char *sig,\n                                               size_t *siglen,\n                                               EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,\n                                 int (*verifyctx_init) (EVP_PKEY_CTX *ctx,\n                                                        EVP_MD_CTX *mctx),\n                                 int (*verifyctx) (EVP_PKEY_CTX *ctx,\n                                                   const unsigned char *sig,\n                                                   int siglen,\n                                                   EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,\n                               int (*encrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (*encryptfn) (EVP_PKEY_CTX *ctx,\n                                                 unsigned char *out,\n                                                 size_t *outlen,\n                                                 const unsigned char *in,\n                                                 size_t inlen));\nvoid EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,\n                               int (*decrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (*decrypt) (EVP_PKEY_CTX *ctx,\n                                               unsigned char *out,\n                                               size_t *outlen,\n                                               const unsigned char *in,\n                                               size_t inlen));\nvoid EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,\n                              int (*derive_init) (EVP_PKEY_CTX *ctx),\n                              int (*derive) (EVP_PKEY_CTX *ctx,\n                                             unsigned char *key,\n                                             size_t *keylen));\nvoid EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,\n                            int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,\n                                         void *p2),\n                            int (*ctrl_str) (EVP_PKEY_CTX *ctx,\n                                             const char *type,\n                                             const char *value));\nvoid EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth,\n                                  int (*digestsign) (EVP_MD_CTX *ctx,\n                                                     unsigned char *sig,\n                                                     size_t *siglen,\n                                                     const unsigned char *tbs,\n                                                     size_t tbslen));\nvoid EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth,\n                                    int (*digestverify) (EVP_MD_CTX *ctx,\n                                                         const unsigned char *sig,\n                                                         size_t siglen,\n                                                         const unsigned char *tbs,\n                                                         size_t tbslen));\nvoid EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth,\n                             int (*check) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth,\n                                    int (*check) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth,\n                                   int (*check) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth,\n                                    int (*digest_custom) (EVP_PKEY_CTX *ctx,\n                                                          EVP_MD_CTX *mctx));\n\nvoid EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth,\n                            int (**pinit) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth,\n                            int (**pcopy) (EVP_PKEY_CTX *dst,\n                                           EVP_PKEY_CTX *src));\nvoid EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth,\n                               void (**pcleanup) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth,\n                                int (**pparamgen_init) (EVP_PKEY_CTX *ctx),\n                                int (**pparamgen) (EVP_PKEY_CTX *ctx,\n                                                   EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth,\n                              int (**pkeygen_init) (EVP_PKEY_CTX *ctx),\n                              int (**pkeygen) (EVP_PKEY_CTX *ctx,\n                                               EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth,\n                            int (**psign_init) (EVP_PKEY_CTX *ctx),\n                            int (**psign) (EVP_PKEY_CTX *ctx,\n                                           unsigned char *sig, size_t *siglen,\n                                           const unsigned char *tbs,\n                                           size_t tbslen));\nvoid EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth,\n                              int (**pverify_init) (EVP_PKEY_CTX *ctx),\n                              int (**pverify) (EVP_PKEY_CTX *ctx,\n                                               const unsigned char *sig,\n                                               size_t siglen,\n                                               const unsigned char *tbs,\n                                               size_t tbslen));\nvoid EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth,\n                                      int (**pverify_recover_init) (EVP_PKEY_CTX\n                                                                    *ctx),\n                                      int (**pverify_recover) (EVP_PKEY_CTX\n                                                               *ctx,\n                                                               unsigned char\n                                                               *sig,\n                                                               size_t *siglen,\n                                                               const unsigned\n                                                               char *tbs,\n                                                               size_t tbslen));\nvoid EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth,\n                               int (**psignctx_init) (EVP_PKEY_CTX *ctx,\n                                                      EVP_MD_CTX *mctx),\n                               int (**psignctx) (EVP_PKEY_CTX *ctx,\n                                                 unsigned char *sig,\n                                                 size_t *siglen,\n                                                 EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth,\n                                 int (**pverifyctx_init) (EVP_PKEY_CTX *ctx,\n                                                          EVP_MD_CTX *mctx),\n                                 int (**pverifyctx) (EVP_PKEY_CTX *ctx,\n                                                     const unsigned char *sig,\n                                                     int siglen,\n                                                     EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth,\n                               int (**pencrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (**pencryptfn) (EVP_PKEY_CTX *ctx,\n                                                   unsigned char *out,\n                                                   size_t *outlen,\n                                                   const unsigned char *in,\n                                                   size_t inlen));\nvoid EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth,\n                               int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (**pdecrypt) (EVP_PKEY_CTX *ctx,\n                                                 unsigned char *out,\n                                                 size_t *outlen,\n                                                 const unsigned char *in,\n                                                 size_t inlen));\nvoid EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth,\n                              int (**pderive_init) (EVP_PKEY_CTX *ctx),\n                              int (**pderive) (EVP_PKEY_CTX *ctx,\n                                               unsigned char *key,\n                                               size_t *keylen));\nvoid EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth,\n                            int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1,\n                                           void *p2),\n                            int (**pctrl_str) (EVP_PKEY_CTX *ctx,\n                                               const char *type,\n                                               const char *value));\nvoid EVP_PKEY_meth_get_digestsign(const EVP_PKEY_METHOD *pmeth,\n                                  int (**digestsign) (EVP_MD_CTX *ctx,\n                                                      unsigned char *sig,\n                                                      size_t *siglen,\n                                                      const unsigned char *tbs,\n                                                      size_t tbslen));\nvoid EVP_PKEY_meth_get_digestverify(const EVP_PKEY_METHOD *pmeth,\n                                    int (**digestverify) (EVP_MD_CTX *ctx,\n                                                          const unsigned char *sig,\n                                                          size_t siglen,\n                                                          const unsigned char *tbs,\n                                                          size_t tbslen));\nvoid EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth,\n                             int (**pcheck) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth,\n                                    int (**pcheck) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth,\n                                   int (**pcheck) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_digest_custom(const EVP_PKEY_METHOD *pmeth,\n                                    int (**pdigest_custom) (EVP_PKEY_CTX *ctx,\n                                                            EVP_MD_CTX *mctx));\n
          "},{"location":"man3/EVP_PKEY_meth_new/#description","title":"DESCRIPTION","text":"

          All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

          EVP_PKEY_METHOD is a structure which holds a set of methods for a specific public key cryptographic algorithm. Those methods are usually used to perform different jobs, such as generating a key, signing or verifying, encrypting or decrypting, etc.

          There are two places where the EVP_PKEY_METHOD objects are stored: one is a built-in static array representing the standard methods for different algorithms, and the other one is a stack of user-defined application-specific methods, which can be manipulated by using EVP_PKEY_meth_add0(3).

          The EVP_PKEY_METHOD objects are usually referenced by EVP_PKEY_CTX objects.

          "},{"location":"man3/EVP_PKEY_meth_new/#methods","title":"Methods","text":"

          The methods are the underlying implementations of a particular public key algorithm present by the EVP_PKEY_CTX object.

          int (*init) (EVP_PKEY_CTX *ctx);\nint (*copy) (EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src);\nvoid (*cleanup) (EVP_PKEY_CTX *ctx);\n

          The init() method is called to initialize algorithm-specific data when a new EVP_PKEY_CTX is created. As opposed to init(), the cleanup() method is called when an EVP_PKEY_CTX is freed. The copy() method is called when an EVP_PKEY_CTX is being duplicated. Refer to EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_new_id(3), EVP_PKEY_CTX_free(3) and EVP_PKEY_CTX_dup(3).

          int (*paramgen_init) (EVP_PKEY_CTX *ctx);\nint (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);\n

          The paramgen_init() and paramgen() methods deal with key parameter generation. They are called by EVP_PKEY_paramgen_init(3) and EVP_PKEY_paramgen(3) to handle the parameter generation process.

          int (*keygen_init) (EVP_PKEY_CTX *ctx);\nint (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);\n

          The keygen_init() and keygen() methods are used to generate the actual key for the specified algorithm. They are called by EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3).

          int (*sign_init) (EVP_PKEY_CTX *ctx);\nint (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\n             const unsigned char *tbs, size_t tbslen);\n

          The sign_init() and sign() methods are used to generate the signature of a piece of data using a private key. They are called by EVP_PKEY_sign_init(3) and EVP_PKEY_sign(3).

          int (*verify_init) (EVP_PKEY_CTX *ctx);\nint (*verify) (EVP_PKEY_CTX *ctx,\n               const unsigned char *sig, size_t siglen,\n               const unsigned char *tbs, size_t tbslen);\n

          The verify_init() and verify() methods are used to verify whether a signature is valid. They are called by EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

          int (*verify_recover_init) (EVP_PKEY_CTX *ctx);\nint (*verify_recover) (EVP_PKEY_CTX *ctx,\n                       unsigned char *rout, size_t *routlen,\n                       const unsigned char *sig, size_t siglen);\n

          The verify_recover_init() and verify_recover() methods are used to verify a signature and then recover the digest from the signature (for instance, a signature that was generated by RSA signing algorithm). They are called by EVP_PKEY_verify_recover_init(3) and EVP_PKEY_verify_recover(3).

          int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);\nint (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\n                EVP_MD_CTX *mctx);\n

          The signctx_init() and signctx() methods are used to sign a digest present by a EVP_MD_CTX object. They are called by the EVP_DigestSign functions. See EVP_DigestSignInit(3) for details.

          int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);\nint (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,\n                  EVP_MD_CTX *mctx);\n

          The verifyctx_init() and verifyctx() methods are used to verify a signature against the data in a EVP_MD_CTX object. They are called by the various EVP_DigestVerify functions. See EVP_DigestVerifyInit(3) for details.

          int (*encrypt_init) (EVP_PKEY_CTX *ctx);\nint (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,\n                const unsigned char *in, size_t inlen);\n

          The encrypt_init() and encrypt() methods are used to encrypt a piece of data. They are called by EVP_PKEY_encrypt_init(3) and EVP_PKEY_encrypt(3).

          int (*decrypt_init) (EVP_PKEY_CTX *ctx);\nint (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,\n                const unsigned char *in, size_t inlen);\n

          The decrypt_init() and decrypt() methods are used to decrypt a piece of data. They are called by EVP_PKEY_decrypt_init(3) and EVP_PKEY_decrypt(3).

          int (*derive_init) (EVP_PKEY_CTX *ctx);\nint (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);\n

          The derive_init() and derive() methods are used to derive the shared secret from a public key algorithm (for instance, the DH algorithm). They are called by EVP_PKEY_derive_init(3) and EVP_PKEY_derive(3).

          int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);\nint (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);\n

          The ctrl() and ctrl_str() methods are used to adjust algorithm-specific settings. See EVP_PKEY_CTX_ctrl(3) and related functions for details.

          int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,\n                   const unsigned char *tbs, size_t tbslen);\nint (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,\n                     size_t siglen, const unsigned char *tbs,\n                     size_t tbslen);\n

          The digestsign() and digestverify() methods are used to generate or verify a signature in a one-shot mode. They could be called by EVP_DigestSign(3) and EVP_DigestVerify(3).

          int (*check) (EVP_PKEY *pkey);\nint (*public_check) (EVP_PKEY *pkey);\nint (*param_check) (EVP_PKEY *pkey);\n

          The check(), public_check() and param_check() methods are used to validate a key-pair, the public component and parameters respectively for a given pkey. They could be called by EVP_PKEY_check(3), EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) respectively.

          int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);\n

          The digest_custom() method is used to generate customized digest content before the real message is passed to functions like EVP_DigestSignUpdate(3) or EVP_DigestVerifyInit(3). This is usually required by some public key signature algorithms like SM2 which requires a hashed prefix to the message to be signed. The digest_custom() function will be called by EVP_DigestSignInit(3) and EVP_DigestVerifyInit(3).

          "},{"location":"man3/EVP_PKEY_meth_new/#functions","title":"Functions","text":"

          EVP_PKEY_meth_new() creates and returns a new EVP_PKEY_METHOD object, and associates the given id and flags. The following flags are supported:

          EVP_PKEY_FLAG_AUTOARGLEN\nEVP_PKEY_FLAG_SIGCTX_CUSTOM\n

          If an EVP_PKEY_METHOD is set with the EVP_PKEY_FLAG_AUTOARGLEN flag, the maximum size of the output buffer will be automatically calculated or checked in corresponding EVP methods by the EVP framework. Thus the implementations of these methods don't need to care about handling the case of returning output buffer size by themselves. For details on the output buffer size, refer to EVP_PKEY_sign(3).

          The EVP_PKEY_FLAG_SIGCTX_CUSTOM is used to indicate the signctx() method of an EVP_PKEY_METHOD is always called by the EVP framework while doing a digest signing operation by calling EVP_DigestSignFinal(3).

          EVP_PKEY_meth_free() frees an existing EVP_PKEY_METHOD pointed by pmeth. If the argument is NULL, nothing is done.

          EVP_PKEY_meth_copy() copies an EVP_PKEY_METHOD object from src to dst.

          EVP_PKEY_meth_find() finds an EVP_PKEY_METHOD object with the id. This function first searches through the user-defined method objects and then the built-in objects.

          EVP_PKEY_meth_add0() adds pmeth to the user defined stack of methods.

          EVP_PKEY_meth_remove() removes an EVP_PKEY_METHOD object added by EVP_PKEY_meth_add0().

          The EVP_PKEY_meth_set functions set the corresponding fields of EVP_PKEY_METHOD structure with the arguments passed.

          The EVP_PKEY_meth_get functions get the corresponding fields of EVP_PKEY_METHOD structure to the arguments provided.

          "},{"location":"man3/EVP_PKEY_meth_new/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_meth_new() returns a pointer to a new EVP_PKEY_METHOD object or returns NULL on error.

          EVP_PKEY_meth_free() and EVP_PKEY_meth_copy() do not return values.

          EVP_PKEY_meth_find() returns a pointer to the found EVP_PKEY_METHOD object or returns NULL if not found.

          EVP_PKEY_meth_add0() returns 1 if method is added successfully or 0 if an error occurred.

          EVP_PKEY_meth_remove() returns 1 if method is removed successfully or 0 if an error occurred.

          All EVP_PKEY_meth_set and EVP_PKEY_meth_get functions have no return values. For the 'get' functions, function pointers are returned by arguments.

          "},{"location":"man3/EVP_PKEY_meth_new/#history","title":"HISTORY","text":"

          All of these functions were deprecated in OpenSSL 3.0.

          The signature of the copy functional argument of EVP_PKEY_meth_set_copy() has changed in OpenSSL 3.0 so its src parameter is now constified.

          "},{"location":"man3/EVP_PKEY_meth_new/#copyright","title":"COPYRIGHT","text":"

          Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_new/","title":"EVP_PKEY_new","text":""},{"location":"man3/EVP_PKEY_new/#name","title":"NAME","text":"

          EVP_PKEY, EVP_PKEY_new, EVP_PKEY_up_ref, EVP_PKEY_dup, EVP_PKEY_free, EVP_PKEY_new_raw_private_key_ex, EVP_PKEY_new_raw_private_key, EVP_PKEY_new_raw_public_key_ex, EVP_PKEY_new_raw_public_key, EVP_PKEY_new_CMAC_key, EVP_PKEY_new_mac_key, EVP_PKEY_get_raw_private_key, EVP_PKEY_get_raw_public_key - public/private key allocation and raw key handling functions

          "},{"location":"man3/EVP_PKEY_new/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\ntypedef evp_pkey_st EVP_PKEY;\n\nEVP_PKEY *EVP_PKEY_new(void);\nint EVP_PKEY_up_ref(EVP_PKEY *key);\nEVP_PKEY *EVP_PKEY_dup(EVP_PKEY *key);\nvoid EVP_PKEY_free(EVP_PKEY *key);\n\nEVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OSSL_LIB_CTX *libctx,\n                                          const char *keytype,\n                                          const char *propq,\n                                          const unsigned char *key,\n                                          size_t keylen);\nEVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e,\n                                       const unsigned char *key, size_t keylen);\nEVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OSSL_LIB_CTX *libctx,\n                                         const char *keytype,\n                                         const char *propq,\n                                         const unsigned char *key,\n                                         size_t keylen);\nEVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e,\n                                      const unsigned char *key, size_t keylen);\nEVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, const unsigned char *key,\n                               int keylen);\n\nint EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv,\n                                 size_t *len);\nint EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub,\n                                size_t *len);\n

          The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,\n                                size_t len, const EVP_CIPHER *cipher);\n
          "},{"location":"man3/EVP_PKEY_new/#description","title":"DESCRIPTION","text":"

          EVP_PKEY is a generic structure to hold diverse types of asymmetric keys (also known as \"key pairs\"), and can be used for diverse operations, like signing, verifying signatures, key derivation, etc. The asymmetric keys themselves are often referred to as the \"internal key\", and are handled by backends, such as providers (through EVP_KEYMGMT(3)) or ENGINEs.

          Conceptually, an EVP_PKEY internal key may hold a private key, a public key, or both (a keypair), and along with those, key parameters if the key type requires them. The presence of these components determine what operations can be made; for example, signing normally requires the presence of a private key, and verifying normally requires the presence of a public key.

          EVP_PKEY has also been used for MAC algorithm that were conceived as producing signatures, although not being public key algorithms; \"POLY1305\", \"SIPHASH\", \"HMAC\", \"CMAC\". This usage is considered legacy and is discouraged in favor of the EVP_MAC(3) API.

          The EVP_PKEY_new() function allocates an empty EVP_PKEY structure which is used by OpenSSL to store public and private keys. The reference count is set to 1.

          EVP_PKEY_up_ref() increments the reference count of key.

          EVP_PKEY_dup() duplicates the key. The key must not be ENGINE based or a raw key, otherwise the duplication will fail.

          EVP_PKEY_free() decrements the reference count of key and, if the reference count is zero, frees it up. If key is NULL, nothing is done.

          EVP_PKEY_new_raw_private_key_ex() allocates a new EVP_PKEY. Unless an engine should be used for the key type, a provider for the key is found using the library context libctx and the property query string propq. The keytype argument indicates what kind of key this is. The value should be a string for a public key algorithm that supports raw private keys, i.e one of \"X25519\", \"ED25519\", \"X448\" or \"ED448\". key points to the raw private key data for this EVP_PKEY which should be of length keylen. The length should be appropriate for the type of the key. The public key data will be automatically derived from the given private key data (if appropriate for the algorithm type).

          EVP_PKEY_new_raw_private_key() does the same as EVP_PKEY_new_raw_private_key_ex() except that the default library context and default property query are used instead. If e is non-NULL then the new EVP_PKEY structure is associated with the engine e. The type argument indicates what kind of key this is. The value should be a NID for a public key algorithm that supports raw private keys, i.e. one of EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

          EVP_PKEY_new_raw_private_key_ex() and EVP_PKEY_new_raw_private_key() may also be used with most MACs implemented as public key algorithms, so key types such as \"HMAC\", \"POLY1305\", \"SIPHASH\", or their NID form EVP_PKEY_POLY1305, EVP_PKEY_SIPHASH, EVP_PKEY_HMAC are also accepted. This usage is, as mentioned above, discouraged in favor of the EVP_MAC(3) API.

          EVP_PKEY_new_raw_public_key_ex() works in the same way as EVP_PKEY_new_raw_private_key_ex() except that key points to the raw public key data. The EVP_PKEY structure will be initialised without any private key information. Algorithm types that support raw public keys are \"X25519\", \"ED25519\", \"X448\" or \"ED448\".

          EVP_PKEY_new_raw_public_key() works in the same way as EVP_PKEY_new_raw_private_key() except that key points to the raw public key data. The EVP_PKEY structure will be initialised without any private key information. Algorithm types that support raw public keys are EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

          EVP_PKEY_new_mac_key() works in the same way as EVP_PKEY_new_raw_private_key(). New applications should use EVP_PKEY_new_raw_private_key() instead.

          EVP_PKEY_get_raw_private_key() fills the buffer provided by priv with raw private key data. The size of the priv buffer should be in *len on entry to the function, and on exit *len is updated with the number of bytes actually written. If the buffer priv is NULL then *len is populated with the number of bytes required to hold the key. The calling application is responsible for ensuring that the buffer is large enough to receive the private key data. This function only works for algorithms that support raw private keys. Currently this is: EVP_PKEY_HMAC, EVP_PKEY_POLY1305, EVP_PKEY_SIPHASH, EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

          EVP_PKEY_get_raw_public_key() fills the buffer provided by pub with raw public key data. The size of the pub buffer should be in *len on entry to the function, and on exit *len is updated with the number of bytes actually written. If the buffer pub is NULL then *len is populated with the number of bytes required to hold the key. The calling application is responsible for ensuring that the buffer is large enough to receive the public key data. This function only works for algorithms that support raw public keys. Currently this is: EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

          EVP_PKEY_new_CMAC_key() works in the same way as EVP_PKEY_new_raw_private_key() except it is only for the EVP_PKEY_CMAC algorithm type. In addition to the raw private key data, it also takes a cipher algorithm to be used during creation of a CMAC in the cipher argument. The cipher should be a standard encryption-only cipher. For example AEAD and XTS ciphers should not be used.

          Applications should use the EVP_MAC(3) API instead and set the OSSL_MAC_PARAM_CIPHER parameter on the EVP_MAC_CTX object with the name of the cipher being used.

          "},{"location":"man3/EVP_PKEY_new/#notes","title":"NOTES","text":"

          The EVP_PKEY structure is used by various OpenSSL functions which require a general private key without reference to any particular algorithm.

          The structure returned by EVP_PKEY_new() is empty. To add a private or public key to this empty structure use the appropriate functions described in EVP_PKEY_set1_RSA(3), EVP_PKEY_set1_DSA(3), EVP_PKEY_set1_DH(3) or EVP_PKEY_set1_EC_KEY(3).

          "},{"location":"man3/EVP_PKEY_new/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_new(), EVP_PKEY_new_raw_private_key(), EVP_PKEY_new_raw_public_key(), EVP_PKEY_new_CMAC_key() and EVP_PKEY_new_mac_key() return either the newly allocated EVP_PKEY structure or NULL if an error occurred.

          EVP_PKEY_dup() returns the key duplicate or NULL if an error occurred.

          EVP_PKEY_up_ref(), EVP_PKEY_get_raw_private_key() and EVP_PKEY_get_raw_public_key() return 1 for success and 0 for failure.

          "},{"location":"man3/EVP_PKEY_new/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_set1_RSA(3), EVP_PKEY_set1_DSA(3), EVP_PKEY_set1_DH(3) or EVP_PKEY_set1_EC_KEY(3)

          "},{"location":"man3/EVP_PKEY_new/#history","title":"HISTORY","text":"

          The EVP_PKEY_new() and EVP_PKEY_free() functions exist in all versions of OpenSSL.

          The EVP_PKEY_up_ref() function was added in OpenSSL 1.1.0.

          The EVP_PKEY_new_raw_private_key(), EVP_PKEY_new_raw_public_key(), EVP_PKEY_new_CMAC_key(), EVP_PKEY_new_raw_private_key() and EVP_PKEY_get_raw_public_key() functions were added in OpenSSL 1.1.1.

          The EVP_PKEY_dup(), EVP_PKEY_new_raw_private_key_ex(), and EVP_PKEY_new_raw_public_key_ex() functions were added in OpenSSL 3.0.

          The EVP_PKEY_new_CMAC_key() was deprecated in OpenSSL 3.0.

          The documentation of EVP_PKEY was amended in OpenSSL 3.0 to allow there to be the private part of the keypair without the public part, where this was previously implied to be disallowed.

          "},{"location":"man3/EVP_PKEY_new/#copyright","title":"COPYRIGHT","text":"

          Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_print_private/","title":"EVP_PKEY_print_private","text":""},{"location":"man3/EVP_PKEY_print_private/#name","title":"NAME","text":"

          EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params, EVP_PKEY_print_public_fp, EVP_PKEY_print_private_fp, EVP_PKEY_print_params_fp - public key algorithm printing routines

          "},{"location":"man3/EVP_PKEY_print_private/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,\n                          int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_public_fp(FILE *fp, const EVP_PKEY *pkey,\n                             int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,\n                           int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_private_fp(FILE *fp, const EVP_PKEY *pkey,\n                              int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,\n                          int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_params_fp(FILE *fp, const EVP_PKEY *pkey,\n                             int indent, ASN1_PCTX *pctx);\n
          "},{"location":"man3/EVP_PKEY_print_private/#description","title":"DESCRIPTION","text":"

          The functions EVP_PKEY_print_public(), EVP_PKEY_print_private() and EVP_PKEY_print_params() print out the public, private or parameter components of key pkey respectively. The key is sent to BIO out in human readable form. The parameter indent indicates how far the printout should be indented.

          The pctx parameter allows the print output to be finely tuned by using ASN1 printing options. If pctx is set to NULL then default values will be used.

          The functions EVP_PKEY_print_public_fp(), EVP_PKEY_print_private_fp() and EVP_PKEY_print_params_fp() do the same as the BIO based functions but use FILE fp instead.

          "},{"location":"man3/EVP_PKEY_print_private/#notes","title":"NOTES","text":"

          Currently no public key algorithms include any options in the pctx parameter.

          If the key does not include all the components indicated by the function then only those contained in the key will be printed. For example passing a public key to EVP_PKEY_print_private() will only print the public components.

          "},{"location":"man3/EVP_PKEY_print_private/#return-values","title":"RETURN VALUES","text":"

          These functions all return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_print_private/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_keygen(3)

          "},{"location":"man3/EVP_PKEY_print_private/#history","title":"HISTORY","text":"

          The functions EVP_PKEY_print_public(), EVP_PKEY_print_private(), and EVP_PKEY_print_params() were added in OpenSSL 1.0.0.

          The functions EVP_PKEY_print_public_fp(), EVP_PKEY_print_private_fp(), and EVP_PKEY_print_params_fp() were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_print_private/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_set1_RSA/","title":"EVP_PKEY_set1_RSA","text":""},{"location":"man3/EVP_PKEY_set1_RSA/#name","title":"NAME","text":"

          EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY, EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY, EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY, EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY, EVP_PKEY_assign_POLY1305, EVP_PKEY_assign_SIPHASH, EVP_PKEY_get0_hmac, EVP_PKEY_get0_poly1305, EVP_PKEY_get0_siphash, EVP_PKEY_get0, EVP_PKEY_type, EVP_PKEY_get_id, EVP_PKEY_get_base_id, EVP_PKEY_set1_engine, EVP_PKEY_get0_engine, EVP_PKEY_id, EVP_PKEY_base_id - EVP_PKEY assignment functions

          "},{"location":"man3/EVP_PKEY_set1_RSA/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_get_id(const EVP_PKEY *pkey);\nint EVP_PKEY_get_base_id(const EVP_PKEY *pkey);\nint EVP_PKEY_type(int type);\n\n#define EVP_PKEY_id EVP_PKEY_get_id\n#define EVP_PKEY_base_id EVP_PKEY_get_base_id\n

          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key);\nint EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key);\nint EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key);\nint EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);\n\nRSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);\nDSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);\nDH *EVP_PKEY_get1_DH(EVP_PKEY *pkey);\nEC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);\n\nconst unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len);\nconst unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len);\nconst unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len);\nconst RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);\nconst DSA *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey);\nconst DH *EVP_PKEY_get0_DH(const EVP_PKEY *pkey);\nconst EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey);\nvoid *EVP_PKEY_get0(const EVP_PKEY *pkey);\n\nint EVP_PKEY_assign_RSA(EVP_PKEY *pkey, RSA *key);\nint EVP_PKEY_assign_DSA(EVP_PKEY *pkey, DSA *key);\nint EVP_PKEY_assign_DH(EVP_PKEY *pkey, DH *key);\nint EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);\nint EVP_PKEY_assign_POLY1305(EVP_PKEY *pkey, ASN1_OCTET_STRING *key);\nint EVP_PKEY_assign_SIPHASH(EVP_PKEY *pkey, ASN1_OCTET_STRING *key);\n\nENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey);\nint EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *engine);\n
          "},{"location":"man3/EVP_PKEY_set1_RSA/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_get_base_id() returns the type of pkey. For example an RSA key will return EVP_PKEY_RSA.

          EVP_PKEY_get_id() returns the actual NID associated with pkey only if the pkey type isn't implemented just in a provider(7). Historically keys using the same algorithm could use different NIDs. For example an RSA key could use the NIDs corresponding to the NIDs NID_rsaEncryption (equivalent to EVP_PKEY_RSA) or NID_rsa (equivalent to EVP_PKEY_RSA2). The use of alternative non-standard NIDs is now rare so EVP_PKEY_RSA2 et al are not often seen in practice. EVP_PKEY_get_id() returns -1 (EVP_PKEY_KEYMGMT) if the pkey is only implemented in a provider(7).

          EVP_PKEY_type() returns the underlying type of the NID type. For example EVP_PKEY_type(EVP_PKEY_RSA2) will return EVP_PKEY_RSA.

          EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and EVP_PKEY_set1_EC_KEY() set the key referenced by pkey to key. These functions are deprecated. Applications should instead use EVP_PKEY_fromdata(3).

          EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), EVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() set the referenced key to key however these use the supplied key internally and so key will be freed when the parent pkey is freed. These macros are deprecated. Applications should instead read an EVP_PKEY directly using the OSSL_DECODER APIs (see OSSL_DECODER_CTX_new_for_pkey(3)), or construct an EVP_PKEY from data using EVP_PKEY_fromdata(3).

          EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() return the referenced key in pkey or NULL if the key is not of the correct type. The returned key must be freed after use. These functions are deprecated. Applications should instead use the EVP_PKEY directly where possible. If access to the low level key parameters is required then applications should use EVP_PKEY_get_params(3) and other similar functions. To write an EVP_PKEY out use the OSSL_ENCODER APIs (see OSSL_ENCODER_CTX_new_for_pkey(3)).

          EVP_PKEY_get0_hmac(), EVP_PKEY_get0_poly1305(), EVP_PKEY_get0_siphash(), EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() and EVP_PKEY_get0_EC_KEY() return the referenced key in pkey or NULL if the key is not of the correct type. The reference count of the returned key is not incremented and so the key must not be freed after use. These functions are deprecated. Applications should instead use the EVP_PKEY directly where possible. If access to the low level key parameters is required then applications should use EVP_PKEY_get_params(3) and other similar functions. To write an EVP_PKEY out use the OSSL_ENCODER APIs (see OSSL_ENCODER_CTX_new_for_pkey(3)). EVP_PKEY_get0() returns a pointer to the legacy key or NULL if the key is not legacy.

          Note that if an EVP_PKEY was not constructed using one of the deprecated functions such as EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() or EVP_PKEY_set1_EC_KEY(), or via the similarly named EVP_PKEY_assign macros described above then the internal key will be managed by a provider (see provider(7)). In that case the key returned by EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH(), EVP_PKEY_get1_EC_KEY(), EVP_PKEY_get0_hmac(), EVP_PKEY_get0_poly1305(), EVP_PKEY_get0_siphash(), EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() or EVP_PKEY_get0_EC_KEY() will be a cached copy of the provider's key. Subsequent updates to the provider's key will not be reflected back in the cached copy, and updates made by an application to the returned key will not be reflected back in the provider's key. Subsequent calls to EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() will always return the cached copy returned by the first call.

          EVP_PKEY_get0_engine() returns a reference to the ENGINE handling pkey. This function is deprecated. Applications should use providers instead of engines (see provider(7) for details).

          EVP_PKEY_set1_engine() sets the ENGINE handling pkey to engine. It must be called after the key algorithm and components are set up. If engine does not include an EVP_PKEY_METHOD for pkey an error occurs. This function is deprecated. Applications should use providers instead of engines (see provider(7) for details).

          "},{"location":"man3/EVP_PKEY_set1_RSA/#warnings","title":"WARNINGS","text":"

          The following functions are only reliable with EVP_PKEYs that have been assigned an internal key with EVP_PKEY_assign_*():

          EVP_PKEY_get_id(), EVP_PKEY_get_base_id(), EVP_PKEY_type()

          For EVP_PKEY key type checking purposes, EVP_PKEY_is_a(3) is more generic.

          For purposes of retrieving the name of the EVP_PKEY the function EVP_PKEY_get0_type_name(3) is more generally useful.

          The keys returned from the functions EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() and EVP_PKEY_get0_EC_KEY() were changed to have a \"const\" return type in OpenSSL 3.0. As described above the keys returned may be cached copies of the key held in a provider. Due to this, and unlike in earlier versions of OpenSSL, they should be considered read-only copies of the key. Updates to these keys will not be reflected back in the provider side key. The EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() functions were not changed to have a \"const\" return type in order that applications can \"free\" the return value. However applications should still consider them as read-only copies.

          "},{"location":"man3/EVP_PKEY_set1_RSA/#notes","title":"NOTES","text":"

          In accordance with the OpenSSL naming convention the key obtained from or assigned to the pkey using the 1 functions must be freed as well as pkey.

          EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), EVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() are implemented as macros.

          EVP_PKEY_assign_EC_KEY() looks at the curve name id to determine if the passed EC_KEY is an SM2(7) key, and will set the EVP_PKEY type to EVP_PKEY_SM2 in that case, instead of EVP_PKEY_EC.

          Most applications wishing to know a key type will simply call EVP_PKEY_get_base_id() and will not care about the actual type: which will be identical in almost all cases.

          Previous versions of this document suggested using EVP_PKEY_type(pkey->type) to determine the type of a key. Since EVP_PKEY is now opaque this is no longer possible: the equivalent is EVP_PKEY_get_base_id(pkey).

          EVP_PKEY_set1_engine() is typically used by an ENGINE returning an HSM key as part of its routine to load a private key.

          "},{"location":"man3/EVP_PKEY_set1_RSA/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and EVP_PKEY_set1_EC_KEY() return 1 for success or 0 for failure.

          EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() return the referenced key or NULL if an error occurred.

          EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), EVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() return 1 for success and 0 for failure.

          EVP_PKEY_get_base_id(), EVP_PKEY_get_id() and EVP_PKEY_type() return a key type or NID_undef (equivalently EVP_PKEY_NONE) on error.

          EVP_PKEY_set1_engine() returns 1 for success and 0 for failure.

          "},{"location":"man3/EVP_PKEY_set1_RSA/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_new(3), SM2(7)

          "},{"location":"man3/EVP_PKEY_set1_RSA/#history","title":"HISTORY","text":"

          The EVP_PKEY_id() and EVP_PKEY_base_id() functions were renamed to include get in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

          EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY, EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY, EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY, EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY, EVP_PKEY_assign_POLY1305, EVP_PKEY_assign_SIPHASH, EVP_PKEY_get0_hmac, EVP_PKEY_get0_poly1305, EVP_PKEY_get0_siphash, EVP_PKEY_set1_engine and EVP_PKEY_get0_engine were deprecated in OpenSSL 3.0.

          The return value from EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY were made const in OpenSSL 3.0.

          The function EVP_PKEY_set_alias_type() was previously documented on this page. It was removed in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_set1_RSA/#copyright","title":"COPYRIGHT","text":"

          Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/","title":"EVP_PKEY_set1_encoded_public_key","text":""},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#name","title":"NAME","text":"

          EVP_PKEY_set1_encoded_public_key, EVP_PKEY_get1_encoded_public_key, EVP_PKEY_set1_tls_encodedpoint, EVP_PKEY_get1_tls_encodedpoint - functions to set and get public key data within an EVP_PKEY

          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_set1_encoded_public_key(EVP_PKEY *pkey,\n                                     const unsigned char *pub, size_t publen);\n\nsize_t EVP_PKEY_get1_encoded_public_key(EVP_PKEY *pkey, unsigned char **ppub);\n

          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

          int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey,\n                                   const unsigned char *pt, size_t ptlen);\n\nsize_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt);\n
          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_set1_encoded_public_key() can be used to set the public key value within an existing EVP_PKEY object. For the built-in OpenSSL algorithms this currently only works for those that support key exchange. Parameters are not set as part of this operation, so typically an application will create an EVP_PKEY first, set the parameters on it, and then call this function. For example setting the parameters might be done using EVP_PKEY_copy_parameters(3).

          The format for the encoded public key will depend on the algorithm in use. For DH it should be encoded as a positive integer in big-endian form. For EC is should be a point conforming to Sec. 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. For X25519 and X448 it should be encoded in a format as defined by RFC7748.

          The key to be updated is supplied in pkey. The buffer containing the encoded key is pointed to be pub. The length of the buffer is supplied in publen.

          EVP_PKEY_get1_encoded_public_key() does the equivalent operation except that the encoded public key is returned to the application. The key containing the public key data is supplied in pkey. A buffer containing the encoded key will be allocated and stored in *ppub. The length of the encoded public key is returned by the function. The application is responsible for freeing the allocated buffer.

          The macro EVP_PKEY_set1_tls_encodedpoint() is deprecated and simply calls EVP_PKEY_set1_encoded_public_key() with all the same arguments. New applications should use EVP_PKEY_set1_encoded_public_key() instead.

          The macro EVP_PKEY_get1_tls_encodedpoint() is deprecated and simply calls EVP_PKEY_get1_encoded_public_key() with all the same arguments. New applications should use EVP_PKEY_get1_encoded_public_key() instead.

          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_set1_encoded_public_key() returns 1 for success and 0 or a negative value for failure.

          EVP_PKEY_get1_encoded_public_key() returns the length of the encoded key or 0 for failure.

          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#examples","title":"EXAMPLES","text":"

          See EVP_PKEY_derive_init(3) and EVP_PKEY_derive(3) for information about performing a key exchange operation.

          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#set-up-a-peers-evp_pkey-ready-for-a-key-exchange-operation","title":"Set up a peer's EVP_PKEY ready for a key exchange operation","text":"
          #include <openssl/evp.h>\n\nint exchange(EVP_PKEY *ourkey, unsigned char *peer_pub, size_t peer_pub_len)\n{\n    EVP_PKEY *peerkey = EVP_PKEY_new();\n\n    if (peerkey == NULL || EVP_PKEY_copy_parameters(peerkey, ourkey) <= 0)\n        return 0;\n\n    if (EVP_PKEY_set1_encoded_public_key(peerkey, peer_pub,\n                                         peer_pub_len) <= 0)\n        return 0;\n\n    /* Do the key exchange here */\n\n    EVP_PKEY_free(peerkey);\n\n    return 1;\n}\n
          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#get-an-encoded-public-key-to-send-to-a-peer","title":"Get an encoded public key to send to a peer","text":"
          #include <openssl/evp.h>\n\nint get_encoded_pub_key(EVP_PKEY *ourkey)\n{\n    unsigned char *pubkey;\n    size_t pubkey_len;\n\n   pubkey_len = EVP_PKEY_get1_encoded_public_key(ourkey, &pubkey);\n   if (pubkey_len == 0)\n       return 0;\n\n   /*\n    * Send the encoded public key stored in the buffer at \"pubkey\" and of\n    * length pubkey_len, to the peer.\n    */\n\n   OPENSSL_free(pubkey);\n   return 1;\n}\n
          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_new(3), EVP_PKEY_copy_parameters(3), EVP_PKEY_derive_init(3), EVP_PKEY_derive(3), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7)

          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#history","title":"HISTORY","text":"

          EVP_PKEY_set1_encoded_public_key() and EVP_PKEY_get1_encoded_public_key() were added in OpenSSL 3.0.

          EVP_PKEY_set1_tls_encodedpoint() and EVP_PKEY_get1_tls_encodedpoint() were deprecated in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_set_type/","title":"EVP_PKEY_set_type","text":""},{"location":"man3/EVP_PKEY_set_type/#name","title":"NAME","text":"

          EVP_PKEY_set_type, EVP_PKEY_set_type_str, EVP_PKEY_set_type_by_keymgmt - functions to change the EVP_PKEY type

          "},{"location":"man3/EVP_PKEY_set_type/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_set_type(EVP_PKEY *pkey, int type);\nint EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);\nint EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt);\n
          "},{"location":"man3/EVP_PKEY_set_type/#description","title":"DESCRIPTION","text":"

          All the functions described here behave the same in so far that they clear all the previous key data and methods from pkey, and reset it to be of the type of key given by the different arguments. If pkey is NULL, these functions will still return the same return values as if it wasn't.

          EVP_PKEY_set_type() initialises pkey to contain an internal legacy key. When doing this, it finds a EVP_PKEY_ASN1_METHOD(3) corresponding to type, and associates pkey with the findings. It is an error if no EVP_PKEY_ASN1_METHOD(3) could be found for type.

          EVP_PKEY_set_type_str() initialises pkey to contain an internal legacy key. When doing this, it finds a EVP_PKEY_ASN1_METHOD(3) corresponding to str that has then length len, and associates pkey with the findings. It is an error if no EVP_PKEY_ASN1_METHOD(3) could be found for type.

          For both EVP_PKEY_set_type() and EVP_PKEY_set_type_str(), pkey gets a numeric type, which can be retrieved with EVP_PKEY_get_id(3). This numeric type is taken from the EVP_PKEY_ASN1_METHOD(3) that was found, and is equal to or closely related to type in the case of EVP_PKEY_set_type(), or related to str in the case of EVP_PKEY_set_type_str().

          EVP_PKEY_set_type_by_keymgmt() initialises pkey to contain an internal provider side key. When doing this, it associates pkey with keymgmt. For keys initialised like this, the numeric type retrieved with EVP_PKEY_get_id(3) will always be EVP_PKEY_NONE.

          "},{"location":"man3/EVP_PKEY_set_type/#return-values","title":"RETURN VALUES","text":"

          All functions described here return 1 if successful, or 0 on error.

          "},{"location":"man3/EVP_PKEY_set_type/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_assign(3), EVP_PKEY_get_id(3), EVP_PKEY_get0_RSA(3), EVP_PKEY_copy_parameters(3), EVP_PKEY_ASN1_METHOD(3), EVP_KEYMGMT(3)

          "},{"location":"man3/EVP_PKEY_set_type/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_settable_params/","title":"EVP_PKEY_settable_params","text":""},{"location":"man3/EVP_PKEY_settable_params/#name","title":"NAME","text":"

          EVP_PKEY_settable_params, EVP_PKEY_set_params, EVP_PKEY_set_int_param, EVP_PKEY_set_size_t_param, EVP_PKEY_set_bn_param, EVP_PKEY_set_utf8_string_param, EVP_PKEY_set_octet_string_param - set key parameters into a key

          "},{"location":"man3/EVP_PKEY_settable_params/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nconst OSSL_PARAM *EVP_PKEY_settable_params(const EVP_PKEY *pkey);\nint EVP_PKEY_set_params(EVP_PKEY *pkey, OSSL_PARAM params[]);\nint EVP_PKEY_set_int_param(EVP_PKEY *pkey, const char *key_name, int in);\nint EVP_PKEY_set_size_t_param(EVP_PKEY *pkey, const char *key_name, size_t in);\nint EVP_PKEY_set_bn_param(EVP_PKEY *pkey, const char *key_name,\n                          const BIGNUM *bn);\nint EVP_PKEY_set_utf8_string_param(EVP_PKEY *pkey, const char *key_name,\n                                   const char *str);\nint EVP_PKEY_set_octet_string_param(EVP_PKEY *pkey, const char *key_name,\n                                    const unsigned char *buf, size_t bsize);\n
          "},{"location":"man3/EVP_PKEY_settable_params/#description","title":"DESCRIPTION","text":"

          These functions can be used to set additional parameters into an existing EVP_PKEY.

          EVP_PKEY_set_params() sets one or more params into a pkey. See OSSL_PARAM(3) for information about parameters.

          EVP_PKEY_settable_params() returns a constant list of params indicating the names and types of key parameters that can be set. See OSSL_PARAM(3) for information about parameters.

          EVP_PKEY_set_int_param() sets an integer value in into a key pkey for the associated field key_name.

          EVP_PKEY_set_size_t_param() sets an size_t value in into a key pkey for the associated field key_name.

          EVP_PKEY_set_bn_param() sets the BIGNUM value bn into a key pkey for the associated field key_name.

          EVP_PKEY_set_utf8_string_param() sets the UTF8 string str into a key pkey for the associated field key_name.

          EVP_PKEY_set_octet_string_param() sets the octet string value buf with a size bsize into a key pkey for the associated field key_name.

          "},{"location":"man3/EVP_PKEY_settable_params/#notes","title":"NOTES","text":"

          These functions only work for EVP_PKEYs that contain a provider side key.

          "},{"location":"man3/EVP_PKEY_settable_params/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_settable_params() returns NULL on error or if it is not supported,

          All other methods return 1 if a value was successfully set, or 0 if there was an error.

          "},{"location":"man3/EVP_PKEY_settable_params/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_gettable_params(3), EVP_PKEY_CTX_new(3), provider-keymgmt(7), OSSL_PARAM(3),

          "},{"location":"man3/EVP_PKEY_settable_params/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_settable_params/#copyright","title":"COPYRIGHT","text":"

          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_sign/","title":"EVP_PKEY_sign","text":""},{"location":"man3/EVP_PKEY_sign/#name","title":"NAME","text":"

          EVP_PKEY_sign_init, EVP_PKEY_sign_init_ex, EVP_PKEY_sign - sign using a public key algorithm

          "},{"location":"man3/EVP_PKEY_sign/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_sign_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_sign(EVP_PKEY_CTX *ctx,\n                  unsigned char *sig, size_t *siglen,\n                  const unsigned char *tbs, size_t tbslen);\n
          "},{"location":"man3/EVP_PKEY_sign/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_sign_init() initializes a public key algorithm context ctx for signing using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_SIGNATURE method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

          EVP_PKEY_sign_init_ex() is the same as EVP_PKEY_sign_init() but additionally sets the passed parameters params on the context before returning.

          The EVP_PKEY_sign() function performs a public key signing operation using ctx. The data to be signed is specified using the tbs and tbslen parameters. If sig is NULL then the maximum size of the output buffer is written to the siglen parameter. If sig is not NULL then before the call the siglen parameter should contain the length of the sig buffer, if the call is successful the signature is written to sig and the amount of data written to siglen.

          "},{"location":"man3/EVP_PKEY_sign/#notes","title":"NOTES","text":"

          EVP_PKEY_sign() does not hash the data to be signed, and therefore is normally used to sign digests. For signing arbitrary messages, see the EVP_DigestSignInit(3) and EVP_SignInit(3) signing interfaces instead.

          After the call to EVP_PKEY_sign_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation (see EVP_PKEY_CTX_ctrl(3)).

          The function EVP_PKEY_sign() can be called more than once on the same context if several operations are performed using the same parameters.

          "},{"location":"man3/EVP_PKEY_sign/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_sign_init() and EVP_PKEY_sign() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_sign/#examples","title":"EXAMPLES","text":"

          Sign data using RSA with PKCS#1 padding and SHA256 digest:

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\n/* md is a SHA-256 digest in this example. */\nunsigned char *md, *sig;\nsize_t mdlen = 32, siglen;\nEVP_PKEY *signing_key;\n\n/*\n * NB: assumes signing_key and md are set up before the next\n * step. signing_key must be an RSA private key and md must\n * point to the SHA-256 digest to be signed.\n */\nctx = EVP_PKEY_CTX_new(signing_key, NULL /* no engine */);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_sign_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0)\n    /* Error */\n\nsig = OPENSSL_malloc(siglen);\n\nif (!sig)\n    /* malloc failure */\n\nif (EVP_PKEY_sign(ctx, sig, &siglen, md, mdlen) <= 0)\n    /* Error */\n\n/* Signature is siglen bytes written to buffer sig */\n
          "},{"location":"man3/EVP_PKEY_sign/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_sign/#history","title":"HISTORY","text":"

          The EVP_PKEY_sign_init() and EVP_PKEY_sign() functions were added in OpenSSL 1.0.0.

          The EVP_PKEY_sign_init_ex() function was added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_sign/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_todata/","title":"EVP_PKEY_todata","text":""},{"location":"man3/EVP_PKEY_todata/#name","title":"NAME","text":"

          EVP_PKEY_todata, EVP_PKEY_export - functions to return keys as an array of key parameters

          "},{"location":"man3/EVP_PKEY_todata/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_todata(const EVP_PKEY *pkey, int selection, OSSL_PARAM **params);\nint EVP_PKEY_export(const EVP_PKEY *pkey, int selection,\n                    OSSL_CALLBACK *export_cb, void *export_cbarg);\n
          "},{"location":"man3/EVP_PKEY_todata/#description","title":"DESCRIPTION","text":"

          The functions described here are used to extract EVP_PKEY key values as an array of OSSL_PARAM(3).

          EVP_PKEY_todata() extracts values from a key pkey using the selection. selection is described in \"Selections\" in EVP_PKEY_fromdata(3). OSSL_PARAM_free(3) should be used to free the returned parameters in *params.

          EVP_PKEY_export() is similar to EVP_PKEY_todata() but uses a callback export_cb that gets passed the value of export_cbarg. See openssl-core.h(7) for more information about the callback. Note that the OSSL_PARAM(3) array that is passed to the callback is not persistent after the callback returns. The user must preserve the items of interest, or use EVP_PKEY_todata() if persistence is required.

          "},{"location":"man3/EVP_PKEY_todata/#notes","title":"NOTES","text":"

          These functions only work with key management methods coming from a provider. This is the mirror function to EVP_PKEY_fromdata(3).

          "},{"location":"man3/EVP_PKEY_todata/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_todata() and EVP_PKEY_export() return 1 for success and 0 for failure.

          "},{"location":"man3/EVP_PKEY_todata/#see-also","title":"SEE ALSO","text":"

          OSSL_PARAM(3), openssl-core.h(7), EVP_PKEY_fromdata(3), EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-ED448(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), EVP_PKEY-ED25519(7)

          "},{"location":"man3/EVP_PKEY_todata/#history","title":"HISTORY","text":"

          These functions were added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_todata/#copyright","title":"COPYRIGHT","text":"

          Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_verify/","title":"EVP_PKEY_verify","text":""},{"location":"man3/EVP_PKEY_verify/#name","title":"NAME","text":"

          EVP_PKEY_verify_init, EVP_PKEY_verify_init_ex, EVP_PKEY_verify - signature verification using a public key algorithm

          "},{"location":"man3/EVP_PKEY_verify/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_verify_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_verify(EVP_PKEY_CTX *ctx,\n                    const unsigned char *sig, size_t siglen,\n                    const unsigned char *tbs, size_t tbslen);\n
          "},{"location":"man3/EVP_PKEY_verify/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_verify_init() initializes a public key algorithm context ctx for signing using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_SIGNATURE method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

          EVP_PKEY_verify_init_ex() is the same as EVP_PKEY_verify_init() but additionally sets the passed parameters params on the context before returning.

          The EVP_PKEY_verify() function performs a public key verification operation using ctx. The signature is specified using the sig and siglen parameters. The verified data (i.e. the data believed originally signed) is specified using the tbs and tbslen parameters.

          "},{"location":"man3/EVP_PKEY_verify/#notes","title":"NOTES","text":"

          After the call to EVP_PKEY_verify_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation.

          The function EVP_PKEY_verify() can be called more than once on the same context if several operations are performed using the same parameters.

          "},{"location":"man3/EVP_PKEY_verify/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_verify_init() and EVP_PKEY_verify() return 1 if the verification was successful and 0 if it failed. Unlike other functions the return value 0 from EVP_PKEY_verify() only indicates that the signature did not verify successfully (that is tbs did not match the original data or the signature was of invalid form) it is not an indication of a more serious error.

          A negative value indicates an error other that signature verification failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_verify/#examples","title":"EXAMPLES","text":"

          Verify signature using PKCS#1 and SHA256 digest:

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nunsigned char *md, *sig;\nsize_t mdlen, siglen;\nEVP_PKEY *verify_key;\n\n/*\n * NB: assumes verify_key, sig, siglen md and mdlen are already set up\n * and that verify_key is an RSA public key\n */\nctx = EVP_PKEY_CTX_new(verify_key, NULL /* no engine */);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_verify_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)\n    /* Error */\n\n/* Perform operation */\nret = EVP_PKEY_verify(ctx, sig, siglen, md, mdlen);\n\n/*\n * ret == 1 indicates success, 0 verify failure and < 0 for some\n * other error.\n */\n
          "},{"location":"man3/EVP_PKEY_verify/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_verify/#history","title":"HISTORY","text":"

          The EVP_PKEY_verify_init() and EVP_PKEY_verify() functions were added in OpenSSL 1.0.0.

          The EVP_PKEY_verify_init_ex() function was added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_verify/#copyright","title":"COPYRIGHT","text":"

          Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_PKEY_verify_recover/","title":"EVP_PKEY_verify_recover","text":""},{"location":"man3/EVP_PKEY_verify_recover/#name","title":"NAME","text":"

          EVP_PKEY_verify_recover_init, EVP_PKEY_verify_recover_init_ex, EVP_PKEY_verify_recover - recover signature using a public key algorithm

          "},{"location":"man3/EVP_PKEY_verify_recover/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\nint EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_verify_recover_init_ex(EVP_PKEY_CTX *ctx,\n                                    const OSSL_PARAM params[]);\nint EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,\n                            unsigned char *rout, size_t *routlen,\n                            const unsigned char *sig, size_t siglen);\n
          "},{"location":"man3/EVP_PKEY_verify_recover/#description","title":"DESCRIPTION","text":"

          EVP_PKEY_verify_recover_init() initializes a public key algorithm context ctx for signing using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_SIGNATURE method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

          EVP_PKEY_verify_recover_init_ex() is the same as EVP_PKEY_verify_recover_init() but additionally sets the passed parameters params on the context before returning.

          The EVP_PKEY_verify_recover() function recovers signed data using ctx. The signature is specified using the sig and siglen parameters. If rout is NULL then the maximum size of the output buffer is written to the routlen parameter. If rout is not NULL then before the call the routlen parameter should contain the length of the rout buffer, if the call is successful recovered data is written to rout and the amount of data written to routlen.

          "},{"location":"man3/EVP_PKEY_verify_recover/#notes","title":"NOTES","text":"

          Normally an application is only interested in whether a signature verification 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 signing operation. Only certain public key algorithms can recover a signature in this way (for example RSA in PKCS padding mode).

          After the call to EVP_PKEY_verify_recover_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation.

          The function EVP_PKEY_verify_recover() can be called more than once on the same context if several operations are performed using the same parameters.

          "},{"location":"man3/EVP_PKEY_verify_recover/#return-values","title":"RETURN VALUES","text":"

          EVP_PKEY_verify_recover_init() and EVP_PKEY_verify_recover() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

          "},{"location":"man3/EVP_PKEY_verify_recover/#examples","title":"EXAMPLES","text":"

          Recover digest originally signed using PKCS#1 and SHA256 digest:

          #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nunsigned char *rout, *sig;\nsize_t routlen, siglen;\nEVP_PKEY *verify_key;\n\n/*\n * NB: assumes verify_key, sig and siglen are already set up\n * and that verify_key is an RSA public key\n */\nctx = EVP_PKEY_CTX_new(verify_key, NULL /* no engine */);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_verify_recover_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0)\n    /* Error */\n\nrout = OPENSSL_malloc(routlen);\n\nif (!rout)\n    /* malloc failure */\n\nif (EVP_PKEY_verify_recover(ctx, rout, &routlen, sig, siglen) <= 0)\n    /* Error */\n\n/* Recovered data is routlen bytes written to buffer rout */\n
          "},{"location":"man3/EVP_PKEY_verify_recover/#see-also","title":"SEE ALSO","text":"

          EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_derive(3)

          "},{"location":"man3/EVP_PKEY_verify_recover/#history","title":"HISTORY","text":"

          The EVP_PKEY_verify_recover_init() and EVP_PKEY_verify_recover() functions were added in OpenSSL 1.0.0.

          The EVP_PKEY_verify_recover_init_ex() function was added in OpenSSL 3.0.

          "},{"location":"man3/EVP_PKEY_verify_recover/#copyright","title":"COPYRIGHT","text":"

          Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

          "},{"location":"man3/EVP_RAND/","title":"EVP_RAND","text":""},{"location":"man3/EVP_RAND/#name","title":"NAME","text":"

          EVP_RAND, EVP_RAND_fetch, EVP_RAND_free, EVP_RAND_up_ref, EVP_RAND_CTX, EVP_RAND_CTX_new, EVP_RAND_CTX_free, EVP_RAND_CTX_up_ref, EVP_RAND_instantiate, EVP_RAND_uninstantiate, EVP_RAND_generate, EVP_RAND_reseed, EVP_RAND_nonce, EVP_RAND_enable_locking, EVP_RAND_verify_zeroization, EVP_RAND_get_strength, EVP_RAND_get_state, EVP_RAND_get0_provider, EVP_RAND_CTX_get0_rand, EVP_RAND_is_a, EVP_RAND_get0_name, EVP_RAND_names_do_all, EVP_RAND_get0_description, EVP_RAND_CTX_get_params, EVP_RAND_CTX_set_params, EVP_RAND_do_all_provided, EVP_RAND_get_params, EVP_RAND_gettable_ctx_params, EVP_RAND_settable_ctx_params, EVP_RAND_CTX_gettable_params, EVP_RAND_CTX_settable_params, EVP_RAND_gettable_params, EVP_RAND_STATE_UNINITIALISED, EVP_RAND_STATE_READY, EVP_RAND_STATE_ERROR - EVP RAND routines

          "},{"location":"man3/EVP_RAND/#synopsis","title":"SYNOPSIS","text":"
          #include <openssl/evp.h>\n\ntypedef struct evp_rand_st EVP_RAND;\ntypedef struct evp_rand_ctx_st EVP_RAND_CTX;\n\nEVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,\n                       const char *properties);\nint EVP_RAND_up_ref(EVP_RAND *rand);\nvoid EVP_RAND_free(EVP_RAND *rand);\nEVP_RAND_CTX *EVP_RAND_CTX_new(EVP_RAND *rand, EVP_RAND_CTX *parent);\nvoid EVP_RAND_CTX_free(EVP_RAND_CTX *ctx);\nint EVP_RAND_CTX_up_ref(EVP_RAND_CTX *ctx);\nEVP_RAND *EVP_RAND_CTX_get0_rand(EVP_RAND_CTX *ctx);\nint EVP_RAND_get_params(EVP_RAND *rand, OSSL_PARAM params[]);\nint EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);\nint EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand);\nconst OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand);\nconst OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand);\nconst OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx);\nconst OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx);\nconst char *EVP_RAND_get0_name(const EVP_RAND *rand);\nconst char *EVP_RAND_get0_description(const EVP_RAND *rand);\nint EVP_RAND_is_a(const EVP_RAND *rand, const char *name);\nconst OSSL_PROVIDER *EVP_RAND_get0_provider(const EVP_RAND *rand);\nvoid EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,\n                              void (*fn)(EVP_RAND *rand, void *arg),\n                              void *arg);\nint EVP_RAND_names_do_all(const EVP_RAND *rand,\n                          void (*fn)(const char *name, void *data),\n                          void *data);\n\nint EVP_RAND_instantiate(EVP_RAND_CTX *ctx, unsigned int strength,\n                         int prediction_resistance,\n                         const unsigned char *pstr, size_t pstr_len,\n                         const OSSL_PARAM params[]);\nint EVP_RAND_uninstantiate(EVP_RAND_CTX *ctx);\nint EVP_RAND_generate(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen,\n                      unsigned int strength, int prediction_resistance,\n                      const unsigned char *addin, size_t addin_len);\nint EVP_RAND_reseed(EVP_RAND_CTX *ctx, int prediction_resistance,\n                    const unsigned char *ent, size_t ent_len,\n                    const unsigned char *addin, size_t addin_len);\nint EVP_RAND_nonce(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen);\nint EVP_RAND_enable_locking(EVP_RAND_CTX *ctx);\nint EVP_RAND_verify_zeroization(EVP_RAND_CTX *ctx);\nunsigned int EVP_RAND_get_strength(EVP_RAND_CTX *ctx);\nint EVP_RAND_get_state(EVP_RAND_CTX *ctx);\n\n#define EVP_RAND_STATE_UNINITIALISED    0\n#define EVP_RAND_STATE_READY            1\n#define EVP_RAND_STATE_ERROR            2\n
          "},{"location":"man3/EVP_RAND/#description","title":"DESCRIPTION","text":"

          The EVP RAND routines are a high-level interface to random number generators both deterministic and not. If you just want to generate random bytes then you don't need to use these functions: just call RAND_bytes() or RAND_priv_bytes(). If you want to do more, these calls should be used instead of the older RAND and RAND_DRBG functions.

          After creating a EVP_RAND_CTX for the required algorithm using EVP_RAND_CTX_new(), inputs to the algorithm are supplied either by passing them as part of the EVP_RAND_instantiate() call or using calls to EVP_RAND_CTX_set_params() before calling EVP_RAND_instantiate(). Finally, call EVP_RAND_generate() to produce cryptographically secure random bytes.

          "},{"location":"man3/EVP_RAND/#types","title":"Types","text":"

          EVP_RAND is a type that holds the implementation of a RAND.

          EVP_RAND_CTX is a context type that holds the algorithm inputs. EVP_RAND_CTX structures are reference counted.

          "},{"location":"man3/EVP_RAND/#algorithm-implementation-fetching","title":"Algorithm implementation fetching","text":"

          EVP_RAND_fetch() fetches an implementation of a RAND algorithm, given a library context libctx and a set of properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

          The returned value must eventually be freed with EVP_RAND_free(3).

          EVP_RAND_up_ref() increments the reference count of an already fetched RAND.

          EVP_RAND_free() frees a fetched algorithm. NULL is a valid parameter, for which this function is a no-op.

          "},{"location":"man3/EVP_RAND/#context-manipulation-functions","title":"Context manipulation functions","text":"

          EVP_RAND_CTX_new() creates a new context for the RAND implementation rand. If not NULL, parent specifies the seed source for this implementation. Not all random number generators need to have a seed source specified. If a parent is required, a NULL parent will utilise the operating system entropy sources. It is recommended to minimise the number of random number generators that rely on the operating system for their randomness because this is often scarce.

          EVP_RAND_CTX_free() frees up the context ctx. If ctx is NULL, nothing is done.

          EVP_RAND_CTX_get0_rand() returns the EVP_RAND associated with the context ctx.

          "},{"location":"man3/EVP_RAND/#random-number-generator-functions","title":"Random Number Generator Functions","text":"

          EVP_RAND_instantiate() processes any parameters in params and then instantiates the RAND ctx with a minimum security strength of <strength> and personalisation string pstr of length <pstr_len>. If prediction_resistance is specified, fresh entropy from a live source will be sought. This call operates as per NIST SP 800-90A and SP 800-90C.

          EVP_RAND_uninstantiate() uninstantiates the RAND ctx as per NIST SP 800-90A and SP 800-90C. Subsequent to this call, the RAND cannot be used to generate bytes. It can only be freed or instantiated again.

          EVP_RAND_generate() produces random bytes from the RAND ctx with the additional input addin of length addin_len. The bytes produced will meet the security strength. If prediction_resistance is specified, fresh entropy from a live source will be sought. This call operates as per NIST SP 800-90A and SP 800-90C.

          EVP_RAND_reseed() reseeds the RAND with new entropy. Entropy ent of length ent_len bytes can be supplied as can additional input addin of length addin_len bytes. In the FIPS provider, both are treated as additional input as per NIST SP-800-90Ar1, Sections 9.1 and 9.2. Additional seed material is also drawn from the RAND's parent or the operating system. If prediction_resistance is specified, fresh entropy from a live source will be sought. This call operates as per NIST SP 800-90A and SP 800-90C.

          EVP_RAND_nonce() creates a nonce in out of maximum length outlen bytes from the RAND ctx. The function returns the length of the generated nonce. If out is NULL, the length is still returned but no generation takes place. This allows a caller to dynamically allocate a buffer of the appropriate size.

          EVP_RAND_enable_locking() enables locking for the RAND ctx and all of its parents. After this ctx will operate in a thread safe manner, albeit more slowly. This function is not itself thread safe if called with the same ctx from multiple threads. Typically locking should be enabled before a ctx is shared across multiple threads.

          EVP_RAND_get_params() retrieves details about the implementation rand. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

          EVP_RAND_CTX_get_params() retrieves chosen parameters, given the context ctx and its underlying context. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

          EVP_RAND_CTX_set_params() passes chosen parameters to the underlying context, given a context ctx. The set of parameters given with params determine exactly what parameters are passed down. Note that a parameter that is unknown in the underlying context is simply ignored. Also, what happens when a needed parameter isn't passed down is defined by the implementation.

          EVP_RAND_gettable_params() returns an OSSL_PARAM(3) array that describes the retrievable and settable parameters. EVP_RAND_gettable_params() returns parameters that can be used with EVP_RAND_get_params().

          EVP_RAND_gettable_ctx_params() and EVP_RAND_CTX_gettable_params() return constant OSSL_PARAM(3) arrays that describe the retrievable parameters that can be used with EVP_RAND_CTX_get_params(). EVP_RAND_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_RAND_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

          EVP_RAND_settable_ctx_params() and EVP_RAND_CTX_settable_params() return constant OSSL_PARAM(3) arrays that describe the settable parameters that can be used with EVP_RAND_CTX_set_params(). EVP_RAND_settable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_RAND_CTX_settable_params() returns the parameters that can be retrieved in the context's current state.

          "},{"location":"man3/EVP_RAND/#information-functions","title":"Information functions","text":"

          EVP_RAND_get_strength() returns the security strength of the RAND ctx.

          EVP_RAND_get_state() returns the current state of the RAND ctx. States defined by the OpenSSL RNGs are:

          • EVP_RAND_STATE_UNINITIALISED: this RNG is currently uninitialised. The instantiate call will change this to the ready state.
          • EVP_RAND_STATE_READY: this RNG is currently ready to generate output.
          • EVP_RAND_STATE_ERROR: this RNG is in an error state.

          EVP_RAND_is_a() returns 1 if rand is an implementation of an algorithm that's identifiable with name, otherwise 0.

          EVP_RAND_get0_provider() returns the provider that holds the implementation of the given rand.

          EVP_RAND_do_all_provided() traverses all RAND implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

          EVP_RAND_get0_name() returns the canonical name of rand.

          EVP_RAND_names_do_all() traverses all names for rand, and calls fn with each name and data.

          EVP_RAND_get0_description() returns a description of the rand, meant for display and human consumption. The description is at the discretion of the rand implementation.

          EVP_RAND_verify_zeroization() confirms if the internal DRBG state is currently zeroed. This is used by the FIPS provider to support the mandatory self tests.

          "},{"location":"man3/EVP_RAND/#parameters","title":"PARAMETERS","text":"

          The standard parameter names are:

          • \"state\" (OSSL_RAND_PARAM_STATE) <integer>

            Returns the state of the random number generator.

          • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>

            Returns the bit strength of the random number generator.

          For rands that are also deterministic random bit generators (DRBGs), these additional parameters are recognised. Not all parameters are relevant to, or are understood by all DRBG rands:

          • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

            Reads or set the number of generate requests before reseeding the associated RAND ctx.

          • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>

            Reads or set the number of elapsed seconds before reseeding the associated RAND ctx.

          • \"max_request\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

            Specifies the maximum number of bytes that can be generated in a single call to OSSL_FUNC_rand_generate.

          • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>

          • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>

            Specify the minimum and maximum number of bytes of random material that can be used to seed the DRBG.

          • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>

          • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>

            Specify the minimum and maximum number of bytes of nonce that can be used to seed the DRBG.

          • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>

          • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>

            Specify the minimum and maximum number of bytes of personalisation string that can be used with the DRBG.

          • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>

            Specifies the number of times the DRBG has been seeded or reseeded.

          • \"properties\" (OSSL_RAND_PARAM_PROPERTIES)

          • \"mac\" (OSSL_RAND_PARAM_MAC)
          • \"digest\" (OSSL_RAND_PARAM_DIGEST)
          • \"cipher\" (OSSL_RAND_PARAM_CIPHER)

            For RAND implementations that use an underlying computation MAC, digest or cipher, these parameters set what the algorithm should be.

            The value is always the name of the intended algorithm, or the properties in the case of OSSL_RAND_PARAM_PROPERTIES.

            "},{"location":"man3/EVP_RAND/#notes","title":"NOTES","text":"

            The use of a nonzero value for the prediction_resistance argument to EVP_RAND_instantiate(), EVP_RAND_generate() or EVP_RAND_reseed() should be used sparingly. In the default setup, this will cause all public and private DRBGs to be reseeded on next use. Since, by default, public and private DRBGs are allocated on a per thread basis, this can result in significant overhead for highly multi-threaded applications. For normal use-cases, the default \"reseed_requests\" and \"reseed_time_interval\" thresholds ensure sufficient prediction resistance over time and you can reduce those values if you think they are too high. Explicitly requesting prediction resistance is intended for more special use-cases like generating long-term secrets.

            An EVP_RAND_CTX needs to have locking enabled if it acts as the parent of more than one child and the children can be accessed concurrently. This must be done by explicitly calling EVP_RAND_enable_locking().

            The RAND life-cycle is described in life_cycle-rand(7). In the future, the transitions described there will be enforced. When this is done, it will not be considered a breaking change to the API.

            "},{"location":"man3/EVP_RAND/#return-values","title":"RETURN VALUES","text":"

            EVP_RAND_fetch() returns a pointer to a newly fetched EVP_RAND, or NULL if allocation failed.

            EVP_RAND_get0_provider() returns a pointer to the provider for the RAND, or NULL on error.

            EVP_RAND_CTX_get0_rand() returns a pointer to the EVP_RAND associated with the context.

            EVP_RAND_get0_name() returns the name of the random number generation algorithm.

            EVP_RAND_up_ref() returns 1 on success, 0 on error.

            EVP_RAND_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

            EVP_RAND_CTX_new() returns either the newly allocated EVP_RAND_CTX structure or NULL if an error occurred.

            EVP_RAND_CTX_free() does not return a value.

            EVP_RAND_CTX_up_ref() returns 1 on success, 0 on error.

            EVP_RAND_nonce() returns the length of the nonce.

            EVP_RAND_get_strength() returns the strength of the random number generator in bits.

            EVP_RAND_gettable_params(), EVP_RAND_gettable_ctx_params() and EVP_RAND_settable_ctx_params() return an array of OSSL_PARAMs.

            EVP_RAND_verify_zeroization() returns 1 if the internal DRBG state is currently zeroed, and 0 if not.

            The remaining functions return 1 for success and 0 or a negative value for failure.

            "},{"location":"man3/EVP_RAND/#see-also","title":"SEE ALSO","text":"

            RAND_bytes(3), EVP_RAND-CTR-DRBG(7), EVP_RAND-HASH-DRBG(7), EVP_RAND-HMAC-DRBG(7), EVP_RAND-TEST-RAND(7), provider-rand(7), life_cycle-rand(7)

            "},{"location":"man3/EVP_RAND/#history","title":"HISTORY","text":"

            This functionality was added to OpenSSL 3.0.

            "},{"location":"man3/EVP_RAND/#copyright","title":"COPYRIGHT","text":"

            Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_SIGNATURE/","title":"EVP_SIGNATURE","text":""},{"location":"man3/EVP_SIGNATURE/#name","title":"NAME","text":"

            EVP_SIGNATURE, EVP_SIGNATURE_fetch, EVP_SIGNATURE_free, EVP_SIGNATURE_up_ref, EVP_SIGNATURE_is_a, EVP_SIGNATURE_get0_provider, EVP_SIGNATURE_do_all_provided, EVP_SIGNATURE_names_do_all, EVP_SIGNATURE_get0_name, EVP_SIGNATURE_get0_description, EVP_SIGNATURE_gettable_ctx_params, EVP_SIGNATURE_settable_ctx_params - Functions to manage EVP_SIGNATURE algorithm objects

            "},{"location":"man3/EVP_SIGNATURE/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\ntypedef struct evp_signature_st EVP_SIGNATURE;\n\nEVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                                   const char *properties);\nvoid EVP_SIGNATURE_free(EVP_SIGNATURE *signature);\nint EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature);\nconst char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature);\nint EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name);\nOSSL_PROVIDER *EVP_SIGNATURE_get0_provider(const EVP_SIGNATURE *signature);\nvoid EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx,\n                                   void (*fn)(EVP_SIGNATURE *signature,\n                                              void *arg),\n                                   void *arg);\nint EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,\n                               void (*fn)(const char *name, void *data),\n                               void *data);\nconst char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature);\nconst char *EVP_SIGNATURE_get0_description(const EVP_SIGNATURE *signature);\nconst OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig);\nconst OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig);\n
            "},{"location":"man3/EVP_SIGNATURE/#description","title":"DESCRIPTION","text":"

            EVP_SIGNATURE_fetch() fetches the implementation for the given algorithm from any provider offering it, within the criteria given by the properties. The algorithm will be one offering functions for performing signature related tasks such as signing and verifying. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

            The returned value must eventually be freed with EVP_SIGNATURE_free().

            EVP_SIGNATURE_free() decrements the reference count for the EVP_SIGNATURE structure. Typically this structure will have been obtained from an earlier call to EVP_SIGNATURE_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

            EVP_SIGNATURE_up_ref() increments the reference count for an EVP_SIGNATURE structure.

            EVP_SIGNATURE_is_a() returns 1 if signature is an implementation of an algorithm that's identifiable with name, otherwise 0.

            EVP_SIGNATURE_get0_provider() returns the provider that signature was fetched from.

            EVP_SIGNATURE_do_all_provided() traverses all SIGNATURE implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

            EVP_SIGNATURE_get0_name() returns the algorithm name from the provided implementation for the given signature. Note that the signature may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the signature object and should not be freed by the caller.

            EVP_SIGNATURE_names_do_all() traverses all names for signature, and calls fn with each name and data.

            EVP_SIGNATURE_get0_description() returns a description of the signature, meant for display and human consumption. The description is at the discretion of the signature implementation.

            EVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a signature algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

            "},{"location":"man3/EVP_SIGNATURE/#return-values","title":"RETURN VALUES","text":"

            EVP_SIGNATURE_fetch() returns a pointer to an EVP_SIGNATURE for success or NULL for failure.

            EVP_SIGNATURE_up_ref() returns 1 for success or 0 otherwise.

            EVP_SIGNATURE_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

            EVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

            "},{"location":"man3/EVP_SIGNATURE/#see-also","title":"SEE ALSO","text":"

            \"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

            "},{"location":"man3/EVP_SIGNATURE/#history","title":"HISTORY","text":"

            The functions described here were added in OpenSSL 3.0.

            "},{"location":"man3/EVP_SIGNATURE/#copyright","title":"COPYRIGHT","text":"

            Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_SealInit/","title":"EVP_SealInit","text":""},{"location":"man3/EVP_SealInit/#name","title":"NAME","text":"

            EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption

            "},{"location":"man3/EVP_SealInit/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nint EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                 unsigned char **ek, int *ekl, unsigned char *iv,\n                 EVP_PKEY **pubk, int npubk);\nint EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                   int *outl, unsigned char *in, int inl);\nint EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n
            "},{"location":"man3/EVP_SealInit/#description","title":"DESCRIPTION","text":"

            The EVP envelope routines are a high-level interface to envelope encryption. They generate a random key and IV (if required) then \"envelope\" it by using public key encryption. Data can then be encrypted using this key.

            EVP_SealInit() initializes a cipher context ctx for encryption with cipher type using a random secret key and IV. type is normally supplied by a function such as EVP_aes_256_cbc(). The secret key is encrypted using one or more public keys, this allows the same encrypted data to be decrypted using any of the corresponding private keys. ek is an array of buffers where the public key encrypted secret key will be written, each buffer must contain enough room for the corresponding encrypted key: that is ek[i] must have room for EVP_PKEY_get_size(pubk[i]) bytes. The actual size of each encrypted secret key is written to the array ekl. pubk is an array of npubk public keys.

            The iv parameter is a buffer where the generated IV is written to. It must contain enough room for the corresponding cipher's IV, as determined by (for example) EVP_CIPHER_get_iv_length(type).

            If the cipher does not require an IV then the iv parameter is ignored and can be NULL.

            EVP_SealUpdate() and EVP_SealFinal() have exactly the same properties as the EVP_EncryptUpdate() and EVP_EncryptFinal() routines, as documented on the EVP_EncryptInit(3) manual page.

            "},{"location":"man3/EVP_SealInit/#return-values","title":"RETURN VALUES","text":"

            EVP_SealInit() returns 0 on error or npubk if successful.

            EVP_SealUpdate() and EVP_SealFinal() return 1 for success and 0 for failure.

            "},{"location":"man3/EVP_SealInit/#notes","title":"NOTES","text":"

            Because a random secret key is generated the random number generator must be seeded when EVP_SealInit() is called. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

            The public key must be RSA because it is the only OpenSSL public key algorithm that supports key transport.

            Envelope encryption is the usual method of using public key encryption on large amounts of data, this is because public key encryption is slow but symmetric encryption is fast. So symmetric encryption is used for bulk encryption and the small random symmetric key used is transferred using public key encryption.

            It is possible to call EVP_SealInit() twice in the same way as EVP_EncryptInit(). The first call should have npubk set to 0 and (after setting any cipher parameters) it should be called again with type set to NULL.

            "},{"location":"man3/EVP_SealInit/#see-also","title":"SEE ALSO","text":"

            evp(7), RAND_bytes(3), EVP_EncryptInit(3), EVP_OpenInit(3), RAND(7)

            "},{"location":"man3/EVP_SealInit/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_SignInit/","title":"EVP_SignInit","text":""},{"location":"man3/EVP_SignInit/#name","title":"NAME","text":"

            EVP_SignInit, EVP_SignInit_ex, EVP_SignUpdate, EVP_SignFinal_ex, EVP_SignFinal - EVP signing functions

            "},{"location":"man3/EVP_SignInit/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nint EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\nint EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);\nint EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,\n                     EVP_PKEY *pkey, OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sig, unsigned int *s,\n                  EVP_PKEY *pkey);\n\nvoid EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type);\n
            "},{"location":"man3/EVP_SignInit/#description","title":"DESCRIPTION","text":"

            The EVP signature routines are a high-level interface to digital signatures.

            EVP_SignInit_ex() sets up signing context ctx to use digest type from ENGINE impl. ctx must be created with EVP_MD_CTX_new() before calling this function.

            EVP_SignUpdate() hashes cnt bytes of data at d into the signature context ctx. This function can be called several times on the same ctx to include additional data.

            EVP_SignFinal_ex() signs the data in ctx using the private key pkey and places the signature in sig. The library context libctx and property query propq are used when creating a context to use with the key pkey. sig must be at least EVP_PKEY_get_size(pkey) bytes in size. s is an OUT parameter, and not used as an IN parameter. The number of bytes of data written (i.e. the length of the signature) will be written to the integer at s, at most EVP_PKEY_get_size(pkey) bytes will be written.

            EVP_SignFinal() is similar to EVP_SignFinal_ex() but uses default values of NULL for the library context libctx and the property query propq.

            EVP_SignInit() initializes a signing context ctx to use the default implementation of digest type.

            "},{"location":"man3/EVP_SignInit/#return-values","title":"RETURN VALUES","text":"

            EVP_SignInit_ex(), EVP_SignUpdate(), EVP_SignFinal_ex() and EVP_SignFinal() return 1 for success and 0 for failure.

            The error codes can be obtained by ERR_get_error(3).

            "},{"location":"man3/EVP_SignInit/#notes","title":"NOTES","text":"

            The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

            When signing with some private key types the random number generator must be seeded. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

            The call to EVP_SignFinal() internally finalizes a copy of the digest context. This means that calls to EVP_SignUpdate() and EVP_SignFinal() can be called later to digest and sign additional data.

            Since only a copy of the digest context is ever finalized the context must be cleaned up after use by calling EVP_MD_CTX_free() or a memory leak will occur.

            "},{"location":"man3/EVP_SignInit/#bugs","title":"BUGS","text":"

            Older versions of this documentation wrongly stated that calls to EVP_SignUpdate() could not be made after calling EVP_SignFinal().

            Since the private key is passed in the call to EVP_SignFinal() any error relating to the private key (for example an unsuitable key and digest combination) will not be indicated until after potentially large amounts of data have been passed through EVP_SignUpdate().

            It is not possible to change the signing parameters using these function.

            The previous two bugs are fixed in the newer EVP_DigestSign*() functions.

            "},{"location":"man3/EVP_SignInit/#see-also","title":"SEE ALSO","text":"

            EVP_PKEY_get_size(3), EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3), EVP_VerifyInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1)

            "},{"location":"man3/EVP_SignInit/#history","title":"HISTORY","text":"

            The function EVP_SignFinal_ex() was added in OpenSSL 3.0.

            "},{"location":"man3/EVP_SignInit/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_VerifyInit/","title":"EVP_VerifyInit","text":""},{"location":"man3/EVP_VerifyInit/#name","title":"NAME","text":"

            EVP_VerifyInit_ex, EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal_ex, EVP_VerifyFinal - EVP signature verification functions

            "},{"location":"man3/EVP_VerifyInit/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nint EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\nint EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);\nint EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,\n                       unsigned int siglen, EVP_PKEY *pkey,\n                       OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen,\n                    EVP_PKEY *pkey);\n\nint EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);\n
            "},{"location":"man3/EVP_VerifyInit/#description","title":"DESCRIPTION","text":"

            The EVP signature verification routines are a high-level interface to digital signatures.

            EVP_VerifyInit_ex() sets up verification context ctx to use digest type from ENGINE impl. ctx must be created by calling EVP_MD_CTX_new() before calling this function.

            EVP_VerifyUpdate() hashes cnt bytes of data at d into the verification context ctx. This function can be called several times on the same ctx to include additional data.

            EVP_VerifyFinal_ex() verifies the data in ctx using the public key pkey and siglen bytes in sigbuf. The library context libctx and property query propq are used when creating a context to use with the key pkey.

            EVP_VerifyFinal() is similar to EVP_VerifyFinal_ex() but uses default values of NULL for the library context libctx and the property query propq.

            EVP_VerifyInit() initializes verification context ctx to use the default implementation of digest type.

            "},{"location":"man3/EVP_VerifyInit/#return-values","title":"RETURN VALUES","text":"

            EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for failure.

            EVP_VerifyFinal_ex() and EVP_VerifyFinal() return 1 for a correct signature, 0 for failure and a negative value if some other error occurred.

            The error codes can be obtained by ERR_get_error(3).

            "},{"location":"man3/EVP_VerifyInit/#notes","title":"NOTES","text":"

            The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

            The call to EVP_VerifyFinal() internally finalizes a copy of the digest context. This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called later to digest and verify additional data.

            Since only a copy of the digest context is ever finalized the context must be cleaned up after use by calling EVP_MD_CTX_free() or a memory leak will occur.

            "},{"location":"man3/EVP_VerifyInit/#bugs","title":"BUGS","text":"

            Older versions of this documentation wrongly stated that calls to EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal().

            Since the public key is passed in the call to EVP_SignFinal() any error relating to the private key (for example an unsuitable key and digest combination) will not be indicated until after potentially large amounts of data have been passed through EVP_SignUpdate().

            It is not possible to change the signing parameters using these function.

            The previous two bugs are fixed in the newer EVP_DigestVerify*() function.

            "},{"location":"man3/EVP_VerifyInit/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_SignInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1)

            "},{"location":"man3/EVP_VerifyInit/#history","title":"HISTORY","text":"

            The function EVP_VerifyFinal_ex() was added in OpenSSL 3.0.

            "},{"location":"man3/EVP_VerifyInit/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_aes_128_gcm/","title":"EVP_aes_128_gcm","text":""},{"location":"man3/EVP_aes_128_gcm/#name","title":"NAME","text":"

            EVP_aes_128_cbc, EVP_aes_192_cbc, EVP_aes_256_cbc, EVP_aes_128_cfb, EVP_aes_192_cfb, EVP_aes_256_cfb, EVP_aes_128_cfb1, EVP_aes_192_cfb1, EVP_aes_256_cfb1, EVP_aes_128_cfb8, EVP_aes_192_cfb8, EVP_aes_256_cfb8, EVP_aes_128_cfb128, EVP_aes_192_cfb128, EVP_aes_256_cfb128, EVP_aes_128_ctr, EVP_aes_192_ctr, EVP_aes_256_ctr, EVP_aes_128_ecb, EVP_aes_192_ecb, EVP_aes_256_ecb, EVP_aes_128_ofb, EVP_aes_192_ofb, EVP_aes_256_ofb, EVP_aes_128_cbc_hmac_sha1, EVP_aes_256_cbc_hmac_sha1, EVP_aes_128_cbc_hmac_sha256, EVP_aes_256_cbc_hmac_sha256, EVP_aes_128_ccm, EVP_aes_192_ccm, EVP_aes_256_ccm, EVP_aes_128_gcm, EVP_aes_192_gcm, EVP_aes_256_gcm, EVP_aes_128_ocb, EVP_aes_192_ocb, EVP_aes_256_ocb, EVP_aes_128_wrap, EVP_aes_192_wrap, EVP_aes_256_wrap, EVP_aes_128_wrap_pad, EVP_aes_192_wrap_pad, EVP_aes_256_wrap_pad, EVP_aes_128_xts, EVP_aes_256_xts - EVP AES cipher

            "},{"location":"man3/EVP_aes_128_gcm/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

            EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_aes_128_cbc.

            "},{"location":"man3/EVP_aes_128_gcm/#description","title":"DESCRIPTION","text":"

            The AES encryption algorithm for EVP.

            • EVP_aes_128_cbc(), EVP_aes_192_cbc(), EVP_aes_256_cbc(), EVP_aes_128_cfb(), EVP_aes_192_cfb(), EVP_aes_256_cfb(), EVP_aes_128_cfb1(), EVP_aes_192_cfb1(), EVP_aes_256_cfb1(), EVP_aes_128_cfb8(), EVP_aes_192_cfb8(), EVP_aes_256_cfb8(), EVP_aes_128_cfb128(), EVP_aes_192_cfb128(), EVP_aes_256_cfb128(), EVP_aes_128_ctr(), EVP_aes_192_ctr(), EVP_aes_256_ctr(), EVP_aes_128_ecb(), EVP_aes_192_ecb(), EVP_aes_256_ecb(), EVP_aes_128_ofb(), EVP_aes_192_ofb(), EVP_aes_256_ofb()

              AES for 128, 192 and 256 bit keys in the following modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB, and OFB.

            • EVP_aes_128_cbc_hmac_sha1(), EVP_aes_256_cbc_hmac_sha1()

              Authenticated encryption with AES in CBC mode using SHA-1 as HMAC, with keys of 128 and 256 bits length respectively. The authentication tag is 160 bits long.

              WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

            • EVP_aes_128_cbc_hmac_sha256(), EVP_aes_256_cbc_hmac_sha256()

              Authenticated encryption with AES in CBC mode using SHA256 (SHA-2, 256-bits) as HMAC, with keys of 128 and 256 bits length respectively. The authentication tag is 256 bits long.

              WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

            • EVP_aes_128_ccm(), EVP_aes_192_ccm(), EVP_aes_256_ccm(), EVP_aes_128_gcm(), EVP_aes_192_gcm(), EVP_aes_256_gcm(), EVP_aes_128_ocb(), EVP_aes_192_ocb(), EVP_aes_256_ocb()

              AES for 128, 192 and 256 bit keys in CBC-MAC Mode (CCM), Galois Counter Mode (GCM) and OCB Mode respectively. These ciphers require additional control operations to function correctly, see the \"AEAD Interface\" in EVP_EncryptInit(3) section for details.

            • EVP_aes_128_wrap(), EVP_aes_192_wrap(), EVP_aes_256_wrap(), EVP_aes_128_wrap_pad(), EVP_aes_192_wrap_pad(), EVP_aes_256_wrap_pad()

              AES key wrap with 128, 192 and 256 bit keys, as according to RFC 3394 section 2.2.1 (\"wrap\") and RFC 5649 section 4.1 (\"wrap with padding\") respectively.

            • EVP_aes_128_xts(), EVP_aes_256_xts()

              AES XTS mode (XTS-AES) is standardized in IEEE Std. 1619-2007 and described in NIST SP 800-38E. The XTS (XEX-based tweaked-codebook mode with ciphertext stealing) mode was designed by Prof. Phillip Rogaway of University of California, Davis, intended for encrypting data on a storage device.

              XTS-AES provides confidentiality but not authentication of data. It also requires a key of double-length for protection of a certain key size. In particular, XTS-AES-128 (EVP_aes_128_xts) takes input of a 256-bit key to achieve AES 128-bit security, and XTS-AES-256 (EVP_aes_256_xts) takes input of a 512-bit key to achieve AES 256-bit security.

              The XTS implementation in OpenSSL does not support streaming. That is there must only be one EVP_EncryptUpdate(3) call per EVP_EncryptInit_ex(3) call (and similarly with the \"Decrypt\" functions).

              The iv parameter to EVP_EncryptInit_ex(3) or EVP_DecryptInit_ex(3) is the XTS \"tweak\" value.

            "},{"location":"man3/EVP_aes_128_gcm/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-AES(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_aes_128_gcm/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_aes_128_gcm/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_aes_128_gcm/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_aria_128_gcm/","title":"EVP_aria_128_gcm","text":""},{"location":"man3/EVP_aria_128_gcm/#name","title":"NAME","text":"

            EVP_aria_128_cbc, EVP_aria_192_cbc, EVP_aria_256_cbc, EVP_aria_128_cfb, EVP_aria_192_cfb, EVP_aria_256_cfb, EVP_aria_128_cfb1, EVP_aria_192_cfb1, EVP_aria_256_cfb1, EVP_aria_128_cfb8, EVP_aria_192_cfb8, EVP_aria_256_cfb8, EVP_aria_128_cfb128, EVP_aria_192_cfb128, EVP_aria_256_cfb128, EVP_aria_128_ctr, EVP_aria_192_ctr, EVP_aria_256_ctr, EVP_aria_128_ecb, EVP_aria_192_ecb, EVP_aria_256_ecb, EVP_aria_128_ofb, EVP_aria_192_ofb, EVP_aria_256_ofb, EVP_aria_128_ccm, EVP_aria_192_ccm, EVP_aria_256_ccm, EVP_aria_128_gcm, EVP_aria_192_gcm, EVP_aria_256_gcm, - EVP ARIA cipher

            "},{"location":"man3/EVP_aria_128_gcm/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

            EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_aria_128_cbc.

            "},{"location":"man3/EVP_aria_128_gcm/#description","title":"DESCRIPTION","text":"

            The ARIA encryption algorithm for EVP.

            • EVP_aria_128_cbc(), EVP_aria_192_cbc(), EVP_aria_256_cbc(), EVP_aria_128_cfb(), EVP_aria_192_cfb(), EVP_aria_256_cfb(), EVP_aria_128_cfb1(), EVP_aria_192_cfb1(), EVP_aria_256_cfb1(), EVP_aria_128_cfb8(), EVP_aria_192_cfb8(), EVP_aria_256_cfb8(), EVP_aria_128_cfb128(), EVP_aria_192_cfb128(), EVP_aria_256_cfb128(), EVP_aria_128_ctr(), EVP_aria_192_ctr(), EVP_aria_256_ctr(), EVP_aria_128_ecb(), EVP_aria_192_ecb(), EVP_aria_256_ecb(), EVP_aria_128_ofb(), EVP_aria_192_ofb(), EVP_aria_256_ofb()

              ARIA for 128, 192 and 256 bit keys in the following modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB and OFB.

            • EVP_aria_128_ccm(), EVP_aria_192_ccm(), EVP_aria_256_ccm(), EVP_aria_128_gcm(), EVP_aria_192_gcm(), EVP_aria_256_gcm(),

              ARIA for 128, 192 and 256 bit keys in CBC-MAC Mode (CCM) and Galois Counter Mode (GCM). These ciphers require additional control operations to function correctly, see the \"AEAD Interface\" in EVP_EncryptInit(3) section for details.

            "},{"location":"man3/EVP_aria_128_gcm/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-ARIA(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_aria_128_gcm/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_aria_128_gcm/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_aria_128_gcm/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_bf_cbc/","title":"EVP_bf_cbc","text":""},{"location":"man3/EVP_bf_cbc/#name","title":"NAME","text":"

            EVP_bf_cbc, EVP_bf_cfb, EVP_bf_cfb64, EVP_bf_ecb, EVP_bf_ofb - EVP Blowfish cipher

            "},{"location":"man3/EVP_bf_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_bf_cbc(void);\nconst EVP_CIPHER *EVP_bf_cfb(void);\nconst EVP_CIPHER *EVP_bf_cfb64(void);\nconst EVP_CIPHER *EVP_bf_ecb(void);\nconst EVP_CIPHER *EVP_bf_ofb(void);\n
            "},{"location":"man3/EVP_bf_cbc/#description","title":"DESCRIPTION","text":"

            The Blowfish encryption algorithm for EVP.

            This is a variable key length cipher.

            • EVP_bf_cbc(), EVP_bf_cfb(), EVP_bf_cfb64(), EVP_bf_ecb(), EVP_bf_ofb()

              Blowfish encryption algorithm in CBC, CFB, ECB and OFB modes respectively.

            "},{"location":"man3/EVP_bf_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-BLOWFISH(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_bf_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_bf_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_bf_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_blake2b512/","title":"EVP_blake2b512","text":""},{"location":"man3/EVP_blake2b512/#name","title":"NAME","text":"

            EVP_blake2b512, EVP_blake2s256 - BLAKE2 For EVP

            "},{"location":"man3/EVP_blake2b512/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_blake2b512(void);\nconst EVP_MD *EVP_blake2s256(void);\n
            "},{"location":"man3/EVP_blake2b512/#description","title":"DESCRIPTION","text":"

            BLAKE2 is an improved version of BLAKE, which was submitted to the NIST SHA-3 algorithm competition. The BLAKE2s and BLAKE2b algorithms are described in RFC 7693.

            • EVP_blake2s256()

              The BLAKE2s algorithm that produces a 256-bit output from a given input.

            • EVP_blake2b512()

              The BLAKE2b algorithm that produces a 512-bit output from a given input.

            "},{"location":"man3/EVP_blake2b512/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-BLAKE2(7) instead. See \"Performance\" in crypto(7) for further information.

            While the BLAKE2b and BLAKE2s algorithms supports a variable length digest, this implementation outputs a digest of a fixed length (the maximum length supported), which is 512-bits for BLAKE2b and 256-bits for BLAKE2s.

            "},{"location":"man3/EVP_blake2b512/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_blake2b512/#conforming-to","title":"CONFORMING TO","text":"

            RFC 7693.

            "},{"location":"man3/EVP_blake2b512/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_blake2b512/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_camellia_128_ecb/","title":"EVP_camellia_128_ecb","text":""},{"location":"man3/EVP_camellia_128_ecb/#name","title":"NAME","text":"

            EVP_camellia_128_cbc, EVP_camellia_192_cbc, EVP_camellia_256_cbc, EVP_camellia_128_cfb, EVP_camellia_192_cfb, EVP_camellia_256_cfb, EVP_camellia_128_cfb1, EVP_camellia_192_cfb1, EVP_camellia_256_cfb1, EVP_camellia_128_cfb8, EVP_camellia_192_cfb8, EVP_camellia_256_cfb8, EVP_camellia_128_cfb128, EVP_camellia_192_cfb128, EVP_camellia_256_cfb128, EVP_camellia_128_ctr, EVP_camellia_192_ctr, EVP_camellia_256_ctr, EVP_camellia_128_ecb, EVP_camellia_192_ecb, EVP_camellia_256_ecb, EVP_camellia_128_ofb, EVP_camellia_192_ofb, EVP_camellia_256_ofb - EVP Camellia cipher

            "},{"location":"man3/EVP_camellia_128_ecb/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

            EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_camellia_128_cbc.

            "},{"location":"man3/EVP_camellia_128_ecb/#description","title":"DESCRIPTION","text":"

            The Camellia encryption algorithm for EVP.

            • EVP_camellia_128_cbc(), EVP_camellia_192_cbc(), EVP_camellia_256_cbc(), EVP_camellia_128_cfb(), EVP_camellia_192_cfb(), EVP_camellia_256_cfb(), EVP_camellia_128_cfb1(), EVP_camellia_192_cfb1(), EVP_camellia_256_cfb1(), EVP_camellia_128_cfb8(), EVP_camellia_192_cfb8(), EVP_camellia_256_cfb8(), EVP_camellia_128_cfb128(), EVP_camellia_192_cfb128(), EVP_camellia_256_cfb128(), EVP_camellia_128_ctr(), EVP_camellia_192_ctr(), EVP_camellia_256_ctr(), EVP_camellia_128_ecb(), EVP_camellia_192_ecb(), EVP_camellia_256_ecb(), EVP_camellia_128_ofb(), EVP_camellia_192_ofb(), EVP_camellia_256_ofb()

              Camellia for 128, 192 and 256 bit keys in the following modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB and OFB.

            "},{"location":"man3/EVP_camellia_128_ecb/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-CAMELLIA(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_camellia_128_ecb/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_camellia_128_ecb/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_camellia_128_ecb/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_cast5_cbc/","title":"EVP_cast5_cbc","text":""},{"location":"man3/EVP_cast5_cbc/#name","title":"NAME","text":"

            EVP_cast5_cbc, EVP_cast5_cfb, EVP_cast5_cfb64, EVP_cast5_ecb, EVP_cast5_ofb - EVP CAST cipher

            "},{"location":"man3/EVP_cast5_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_cast5_cbc(void);\nconst EVP_CIPHER *EVP_cast5_cfb(void);\nconst EVP_CIPHER *EVP_cast5_cfb64(void);\nconst EVP_CIPHER *EVP_cast5_ecb(void);\nconst EVP_CIPHER *EVP_cast5_ofb(void);\n
            "},{"location":"man3/EVP_cast5_cbc/#description","title":"DESCRIPTION","text":"

            The CAST encryption algorithm for EVP.

            This is a variable key length cipher.

            • EVP_cast5_cbc(), EVP_cast5_ecb(), EVP_cast5_cfb(), EVP_cast5_cfb64(), EVP_cast5_ofb()

              CAST encryption algorithm in CBC, ECB, CFB and OFB modes respectively.

            "},{"location":"man3/EVP_cast5_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-CAST(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_cast5_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_cast5_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_cast5_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_chacha20/","title":"EVP_chacha20","text":""},{"location":"man3/EVP_chacha20/#name","title":"NAME","text":"

            EVP_chacha20, EVP_chacha20_poly1305 - EVP ChaCha20 stream cipher

            "},{"location":"man3/EVP_chacha20/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_chacha20(void);\nconst EVP_CIPHER *EVP_chacha20_poly1305(void);\n
            "},{"location":"man3/EVP_chacha20/#description","title":"DESCRIPTION","text":"

            The ChaCha20 stream cipher for EVP.

            • EVP_chacha20()

              The ChaCha20 stream cipher. The key length is 256 bits, the IV is 128 bits long. The first 64 bits consists of a counter in little-endian order followed by a 64 bit nonce. For example a nonce of:

              0000000000000002

              With an initial counter of 42 (2a in hex) would be expressed as:

              2a000000000000000000000000000002

            • EVP_chacha20_poly1305()

              Authenticated encryption with ChaCha20-Poly1305. Like EVP_chacha20(), the key is 256 bits and the IV is 96 bits. This supports additional authenticated data (AAD) and produces a 128-bit authentication tag. See the \"AEAD Interface\" in EVP_EncryptInit(3) section for more information.

            "},{"location":"man3/EVP_chacha20/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-CHACHA(7) instead. See \"Performance\" in crypto(7) for further information.

            RFC 7539 uses a 32 bit counter and a 96 bit nonce for the IV.

            "},{"location":"man3/EVP_chacha20/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_chacha20/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_chacha20/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_des_cbc/","title":"EVP_des_cbc","text":""},{"location":"man3/EVP_des_cbc/#name","title":"NAME","text":"

            EVP_des_cbc, EVP_des_cfb, EVP_des_cfb1, EVP_des_cfb8, EVP_des_cfb64, EVP_des_ecb, EVP_des_ofb, EVP_des_ede, EVP_des_ede_cbc, EVP_des_ede_cfb, EVP_des_ede_cfb64, EVP_des_ede_ecb, EVP_des_ede_ofb, EVP_des_ede3, EVP_des_ede3_cbc, EVP_des_ede3_cfb, EVP_des_ede3_cfb1, EVP_des_ede3_cfb8, EVP_des_ede3_cfb64, EVP_des_ede3_ecb, EVP_des_ede3_ofb, EVP_des_ede3_wrap - EVP DES cipher

            "},{"location":"man3/EVP_des_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

            EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_des_cbc.

            "},{"location":"man3/EVP_des_cbc/#description","title":"DESCRIPTION","text":"

            The DES encryption algorithm for EVP.

            • EVP_des_cbc(), EVP_des_ecb(), EVP_des_cfb(), EVP_des_cfb1(), EVP_des_cfb8(), EVP_des_cfb64(), EVP_des_ofb()

              DES in CBC, ECB, CFB with 64-bit shift, CFB with 1-bit shift, CFB with 8-bit shift and OFB modes.

              None of these algorithms are provided by the OpenSSL default provider. To use them it is necessary to load either the OpenSSL legacy provider or another implementation.

            • EVP_des_ede(), EVP_des_ede_cbc(), EVP_des_ede_cfb(), EVP_des_ede_cfb64(), EVP_des_ede_ecb(), EVP_des_ede_ofb()

              Two key triple DES in ECB, CBC, CFB with 64-bit shift and OFB modes.

            • EVP_des_ede3(), EVP_des_ede3_cbc(), EVP_des_ede3_cfb(), EVP_des_ede3_cfb1(), EVP_des_ede3_cfb8(), EVP_des_ede3_cfb64(), EVP_des_ede3_ecb(), EVP_des_ede3_ofb()

              Three-key triple DES in ECB, CBC, CFB with 64-bit shift, CFB with 1-bit shift, CFB with 8-bit shift and OFB modes.

            • EVP_des_ede3_wrap()

              Triple-DES key wrap according to RFC 3217 Section 3.

            "},{"location":"man3/EVP_des_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-DES(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_des_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_des_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_des_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_desx_cbc/","title":"EVP_desx_cbc","text":""},{"location":"man3/EVP_desx_cbc/#name","title":"NAME","text":"

            EVP_desx_cbc - EVP DES-X cipher

            "},{"location":"man3/EVP_desx_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_desx_cbc(void);\n
            "},{"location":"man3/EVP_desx_cbc/#description","title":"DESCRIPTION","text":"

            The DES-X encryption algorithm for EVP.

            All modes below use a key length of 128 bits and acts on blocks of 128-bits.

            • EVP_desx_cbc()

              The DES-X algorithm in CBC mode.

              This algorithm is not provided by the OpenSSL default provider. To use it is necessary to load either the OpenSSL legacy provider or another implementation.

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-DES(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_desx_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_desx_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_desx_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_idea_cbc/","title":"EVP_idea_cbc","text":""},{"location":"man3/EVP_idea_cbc/#name","title":"NAME","text":"

            EVP_idea_cbc, EVP_idea_cfb, EVP_idea_cfb64, EVP_idea_ecb, EVP_idea_ofb - EVP IDEA cipher

            "},{"location":"man3/EVP_idea_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_idea_cbc(void);\nconst EVP_CIPHER *EVP_idea_cfb(void);\nconst EVP_CIPHER *EVP_idea_cfb64(void);\nconst EVP_CIPHER *EVP_idea_ecb(void);\nconst EVP_CIPHER *EVP_idea_ofb(void);\n
            "},{"location":"man3/EVP_idea_cbc/#description","title":"DESCRIPTION","text":"

            The IDEA encryption algorithm for EVP.

            • EVP_idea_cbc(), EVP_idea_cfb(), EVP_idea_cfb64(), EVP_idea_ecb(), EVP_idea_ofb()

              The IDEA encryption algorithm in CBC, CFB, ECB and OFB modes respectively.

            "},{"location":"man3/EVP_idea_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-IDEA(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_idea_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_idea_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_idea_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_md2/","title":"EVP_md2","text":""},{"location":"man3/EVP_md2/#name","title":"NAME","text":"

            EVP_md2 - MD2 For EVP

            "},{"location":"man3/EVP_md2/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_md2(void);\n
            "},{"location":"man3/EVP_md2/#description","title":"DESCRIPTION","text":"

            MD2 is a cryptographic hash function standardized in RFC 1319 and designed by Ronald Rivest. This implementation is only available with the legacy provider.

            • EVP_md2()

              The MD2 algorithm which produces a 128-bit output from a given input.

            "},{"location":"man3/EVP_md2/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MD2(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_md2/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_md2/#conforming-to","title":"CONFORMING TO","text":"

            IETF RFC 1319.

            "},{"location":"man3/EVP_md2/#see-also","title":"SEE ALSO","text":"

            evp(7), provider(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_md2/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_md4/","title":"EVP_md4","text":""},{"location":"man3/EVP_md4/#name","title":"NAME","text":"

            EVP_md4 - MD4 For EVP

            "},{"location":"man3/EVP_md4/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_md4(void);\n
            "},{"location":"man3/EVP_md4/#description","title":"DESCRIPTION","text":"

            MD4 is a cryptographic hash function standardized in RFC 1320 and designed by Ronald Rivest, first published in 1990. This implementation is only available with the legacy provider.

            • EVP_md4()

              The MD4 algorithm which produces a 128-bit output from a given input.

            "},{"location":"man3/EVP_md4/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MD4(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_md4/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_md4/#conforming-to","title":"CONFORMING TO","text":"

            IETF RFC 1320.

            "},{"location":"man3/EVP_md4/#see-also","title":"SEE ALSO","text":"

            evp(7), provider(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_md4/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_md5/","title":"EVP_md5","text":""},{"location":"man3/EVP_md5/#name","title":"NAME","text":"

            EVP_md5, EVP_md5_sha1 - MD5 For EVP

            "},{"location":"man3/EVP_md5/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_md5(void);\nconst EVP_MD *EVP_md5_sha1(void);\n
            "},{"location":"man3/EVP_md5/#description","title":"DESCRIPTION","text":"

            MD5 is a cryptographic hash function standardized in RFC 1321 and designed by Ronald Rivest.

            The CMU Software Engineering Institute considers MD5 unsuitable for further use since its security has been severely compromised.

            • EVP_md5()

              The MD5 algorithm which produces a 128-bit output from a given input.

            • EVP_md5_sha1()

              A hash algorithm of SSL v3 that combines MD5 with SHA-1 as described in RFC 6101.

              WARNING: this algorithm is not intended for non-SSL usage.

            "},{"location":"man3/EVP_md5/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MD5(7) or EVP_MD-MD5-SHA1(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_md5/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_md5/#conforming-to","title":"CONFORMING TO","text":"

            IETF RFC 1321.

            "},{"location":"man3/EVP_md5/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_md5/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_mdc2/","title":"EVP_mdc2","text":""},{"location":"man3/EVP_mdc2/#name","title":"NAME","text":"

            EVP_mdc2 - MDC-2 For EVP

            "},{"location":"man3/EVP_mdc2/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_mdc2(void);\n
            "},{"location":"man3/EVP_mdc2/#description","title":"DESCRIPTION","text":"

            MDC-2 (Modification Detection Code 2 or Meyer-Schilling) is a cryptographic hash function based on a block cipher. This implementation is only available with the legacy provider.

            • EVP_mdc2()

              The MDC-2DES algorithm of using MDC-2 with the DES block cipher. It produces a 128-bit output from a given input.

            "},{"location":"man3/EVP_mdc2/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MDC2(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_mdc2/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_mdc2/#conforming-to","title":"CONFORMING TO","text":"

            ISO/IEC 10118-2:2000 Hash-Function 2, with DES as the underlying block cipher.

            "},{"location":"man3/EVP_mdc2/#see-also","title":"SEE ALSO","text":"

            evp(7), provider(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_mdc2/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_rc2_cbc/","title":"EVP_rc2_cbc","text":""},{"location":"man3/EVP_rc2_cbc/#name","title":"NAME","text":"

            EVP_rc2_cbc, EVP_rc2_cfb, EVP_rc2_cfb64, EVP_rc2_ecb, EVP_rc2_ofb, EVP_rc2_40_cbc, EVP_rc2_64_cbc - EVP RC2 cipher

            "},{"location":"man3/EVP_rc2_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_rc2_cbc(void);\nconst EVP_CIPHER *EVP_rc2_cfb(void);\nconst EVP_CIPHER *EVP_rc2_cfb64(void);\nconst EVP_CIPHER *EVP_rc2_ecb(void);\nconst EVP_CIPHER *EVP_rc2_ofb(void);\nconst EVP_CIPHER *EVP_rc2_40_cbc(void);\nconst EVP_CIPHER *EVP_rc2_64_cbc(void);\n
            "},{"location":"man3/EVP_rc2_cbc/#description","title":"DESCRIPTION","text":"

            The RC2 encryption algorithm for EVP.

            • EVP_rc2_cbc(), EVP_rc2_cfb(), EVP_rc2_cfb64(), EVP_rc2_ecb(), EVP_rc2_ofb()

              RC2 encryption algorithm in CBC, CFB, ECB and OFB modes respectively. This is a variable key length cipher with an additional parameter called \"effective key bits\" or \"effective key length\". By default both are set to 128 bits.

            • EVP_rc2_40_cbc(), EVP_rc2_64_cbc()

              RC2 algorithm in CBC mode with a default key length and effective key length of 40 and 64 bits.

              WARNING: these functions are obsolete. Their usage should be replaced with the EVP_rc2_cbc(), EVP_CIPHER_CTX_set_key_length() and EVP_CIPHER_CTX_ctrl() functions to set the key length and effective key length.

            "},{"location":"man3/EVP_rc2_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-RC2(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_rc2_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_rc2_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_rc2_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_rc4/","title":"EVP_rc4","text":""},{"location":"man3/EVP_rc4/#name","title":"NAME","text":"

            EVP_rc4, EVP_rc4_40, EVP_rc4_hmac_md5 - EVP RC4 stream cipher

            "},{"location":"man3/EVP_rc4/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_rc4(void);\nconst EVP_CIPHER *EVP_rc4_40(void);\nconst EVP_CIPHER *EVP_rc4_hmac_md5(void);\n
            "},{"location":"man3/EVP_rc4/#description","title":"DESCRIPTION","text":"

            The RC4 stream cipher for EVP.

            • EVP_rc4()

              RC4 stream cipher. This is a variable key length cipher with a default key length of 128 bits.

            • EVP_rc4_40()

              RC4 stream cipher with 40 bit key length.

              WARNING: this function is obsolete. Its usage should be replaced with the EVP_rc4() and the EVP_CIPHER_CTX_set_key_length() functions.

            • EVP_rc4_hmac_md5()

              Authenticated encryption with the RC4 stream cipher with MD5 as HMAC.

              WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

            "},{"location":"man3/EVP_rc4/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-RC4(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_rc4/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_rc4/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_rc4/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_rc5_32_12_16_cbc/","title":"EVP_rc5_32_12_16_cbc","text":""},{"location":"man3/EVP_rc5_32_12_16_cbc/#name","title":"NAME","text":"

            EVP_rc5_32_12_16_cbc, EVP_rc5_32_12_16_cfb, EVP_rc5_32_12_16_cfb64, EVP_rc5_32_12_16_ecb, EVP_rc5_32_12_16_ofb - EVP RC5 cipher

            "},{"location":"man3/EVP_rc5_32_12_16_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_cfb(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);\n
            "},{"location":"man3/EVP_rc5_32_12_16_cbc/#description","title":"DESCRIPTION","text":"

            The RC5 encryption algorithm for EVP.

            • EVP_rc5_32_12_16_cbc(), EVP_rc5_32_12_16_cfb(), EVP_rc5_32_12_16_cfb64(), EVP_rc5_32_12_16_ecb(), EVP_rc5_32_12_16_ofb()

              RC5 encryption algorithm in CBC, CFB, ECB and OFB modes respectively. This is a variable key length cipher with an additional \"number of rounds\" parameter. By default the key length is set to 128 bits and 12 rounds. Alternative key lengths can be set using EVP_CIPHER_CTX_set_key_length(3). The maximum key length is 2040 bits.

              The following rc5 specific _ctrl_s are supported (see EVP_CIPHER_CTX_ctrl(3)).

              • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, rounds, NULL)

                Sets the number of rounds to rounds. This must be one of RC5_8_ROUNDS, RC5_12_ROUNDS or RC5_16_ROUNDS.

              • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &rounds)

                Stores the number of rounds currently configured in *rounds where *rounds is an int.

            "},{"location":"man3/EVP_rc5_32_12_16_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-RC5(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_rc5_32_12_16_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_rc5_32_12_16_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_rc5_32_12_16_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_ripemd160/","title":"EVP_ripemd160","text":""},{"location":"man3/EVP_ripemd160/#name","title":"NAME","text":"

            EVP_ripemd160 - RIPEMD160 For EVP

            "},{"location":"man3/EVP_ripemd160/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_ripemd160(void);\n
            "},{"location":"man3/EVP_ripemd160/#description","title":"DESCRIPTION","text":"

            RIPEMD-160 is a cryptographic hash function first published in 1996 belonging to the RIPEMD family (RACE Integrity Primitives Evaluation Message Digest). This implementation is only available with the legacy provider.

            • EVP_ripemd160()

              The RIPEMD-160 algorithm which produces a 160-bit output from a given input.

            "},{"location":"man3/EVP_ripemd160/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-RIPEMD160(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_ripemd160/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_ripemd160/#conforming-to","title":"CONFORMING TO","text":"

            ISO/IEC 10118-3:2016 Dedicated Hash-Function 1 (RIPEMD-160).

            "},{"location":"man3/EVP_ripemd160/#see-also","title":"SEE ALSO","text":"

            evp(7), provider(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_ripemd160/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_seed_cbc/","title":"EVP_seed_cbc","text":""},{"location":"man3/EVP_seed_cbc/#name","title":"NAME","text":"

            EVP_seed_cbc, EVP_seed_cfb, EVP_seed_cfb128, EVP_seed_ecb, EVP_seed_ofb - EVP SEED cipher

            "},{"location":"man3/EVP_seed_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_seed_cbc(void);\nconst EVP_CIPHER *EVP_seed_cfb(void);\nconst EVP_CIPHER *EVP_seed_cfb128(void);\nconst EVP_CIPHER *EVP_seed_ecb(void);\nconst EVP_CIPHER *EVP_seed_ofb(void);\n
            "},{"location":"man3/EVP_seed_cbc/#description","title":"DESCRIPTION","text":"

            The SEED encryption algorithm for EVP.

            All modes below use a key length of 128 bits and acts on blocks of 128-bits.

            • EVP_seed_cbc(), EVP_seed_cfb(), EVP_seed_cfb128(), EVP_seed_ecb(), EVP_seed_ofb()

              The SEED encryption algorithm in CBC, CFB, ECB and OFB modes respectively.

            "},{"location":"man3/EVP_seed_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-SEED(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_seed_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_seed_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_seed_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_set_default_properties/","title":"EVP_set_default_properties","text":""},{"location":"man3/EVP_set_default_properties/#name","title":"NAME","text":"

            EVP_set_default_properties, EVP_default_properties_enable_fips, EVP_default_properties_is_fips_enabled - Set default properties for future algorithm fetches

            "},{"location":"man3/EVP_set_default_properties/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nint EVP_set_default_properties(OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable);\nint EVP_default_properties_is_fips_enabled(OSSL_LIB_CTX *libctx);\n
            "},{"location":"man3/EVP_set_default_properties/#description","title":"DESCRIPTION","text":"

            EVP_set_default_properties() sets the default properties for all future EVP algorithm fetches, implicit as well as explicit. See \"ALGORITHM FETCHING\" in crypto(7) for information about implicit and explicit fetching.

            EVP_set_default_properties stores the properties given with the string propq among the EVP data that's been stored in the library context given with libctx (NULL signifies the default library context).

            Any previous default property for the specified library context will be dropped.

            EVP_default_properties_enable_fips() sets the 'fips=yes' to be a default property if enable is non zero, otherwise it clears 'fips' from the default property query for the given libctx. It merges the fips default property query with any existing query strings that have been set via EVP_set_default_properties().

            EVP_default_properties_is_fips_enabled() indicates if 'fips=yes' is a default property for the given libctx.

            "},{"location":"man3/EVP_set_default_properties/#notes","title":"NOTES","text":"

            EVP_set_default_properties() and EVP_default_properties_enable_fips() are not thread safe. They are intended to be called only during the initialisation phase of a libctx.

            "},{"location":"man3/EVP_set_default_properties/#return-values","title":"RETURN VALUES","text":"

            EVP_set_default_properties() and EVP_default_properties_enable_fips() return 1 on success, or 0 on failure. An error is placed on the error stack if a failure occurs.

            EVP_default_properties_is_fips_enabled() returns 1 if the 'fips=yes' default property is set for the given libctx, otherwise it returns 0.

            "},{"location":"man3/EVP_set_default_properties/#see-also","title":"SEE ALSO","text":"

            EVP_MD_fetch(3)

            "},{"location":"man3/EVP_set_default_properties/#history","title":"HISTORY","text":"

            The functions described here were added in OpenSSL 3.0.

            "},{"location":"man3/EVP_set_default_properties/#copyright","title":"COPYRIGHT","text":"

            Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_sha1/","title":"EVP_sha1","text":""},{"location":"man3/EVP_sha1/#name","title":"NAME","text":"

            EVP_sha1 - SHA-1 For EVP

            "},{"location":"man3/EVP_sha1/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sha1(void);\n
            "},{"location":"man3/EVP_sha1/#description","title":"DESCRIPTION","text":"

            SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function standardized in NIST FIPS 180-4. The algorithm was designed by the United States National Security Agency and initially published in 1995.

            • EVP_sha1()

              The SHA-1 algorithm which produces a 160-bit output from a given input.

            "},{"location":"man3/EVP_sha1/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SHA1(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_sha1/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_sha1/#conforming-to","title":"CONFORMING TO","text":"

            NIST FIPS 180-4.

            "},{"location":"man3/EVP_sha1/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_sha1/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_sha224/","title":"EVP_sha224","text":""},{"location":"man3/EVP_sha224/#name","title":"NAME","text":"

            EVP_sha224, EVP_sha256, EVP_sha512_224, EVP_sha512_256, EVP_sha384, EVP_sha512 - SHA-2 For EVP

            "},{"location":"man3/EVP_sha224/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sha224(void);\nconst EVP_MD *EVP_sha256(void);\nconst EVP_MD *EVP_sha512_224(void);\nconst EVP_MD *EVP_sha512_256(void);\nconst EVP_MD *EVP_sha384(void);\nconst EVP_MD *EVP_sha512(void);\n
            "},{"location":"man3/EVP_sha224/#description","title":"DESCRIPTION","text":"

            SHA-2 (Secure Hash Algorithm 2) is a family of cryptographic hash functions standardized in NIST FIPS 180-4, first published in 2001.

            • EVP_sha224(), EVP_sha256(), EVP_sha512_224, EVP_sha512_256, EVP_sha384(), EVP_sha512()

              The SHA-2 SHA-224, SHA-256, SHA-512/224, SHA512/256, SHA-384 and SHA-512 algorithms, which generate 224, 256, 224, 256, 384 and 512 bits respectively of output from a given input.

              The two algorithms: SHA-512/224 and SHA512/256 are truncated forms of the SHA-512 algorithm. They are distinct from SHA-224 and SHA-256 even though their outputs are of the same size.

            "},{"location":"man3/EVP_sha224/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SHA2(7)instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_sha224/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_sha224/#conforming-to","title":"CONFORMING TO","text":"

            NIST FIPS 180-4.

            "},{"location":"man3/EVP_sha224/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_sha224/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_sha3_224/","title":"EVP_sha3_224","text":""},{"location":"man3/EVP_sha3_224/#name","title":"NAME","text":"

            EVP_sha3_224, EVP_sha3_256, EVP_sha3_384, EVP_sha3_512, EVP_shake128, EVP_shake256 - SHA-3 For EVP

            "},{"location":"man3/EVP_sha3_224/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sha3_224(void);\nconst EVP_MD *EVP_sha3_256(void);\nconst EVP_MD *EVP_sha3_384(void);\nconst EVP_MD *EVP_sha3_512(void);\n\nconst EVP_MD *EVP_shake128(void);\nconst EVP_MD *EVP_shake256(void);\n
            "},{"location":"man3/EVP_sha3_224/#description","title":"DESCRIPTION","text":"

            SHA-3 (Secure Hash Algorithm 3) is a family of cryptographic hash functions standardized in NIST FIPS 202, first published in 2015. It is based on the Keccak algorithm.

            • EVP_sha3_224(), EVP_sha3_256(), EVP_sha3_384(), EVP_sha3_512()

              The SHA-3 SHA-3-224, SHA-3-256, SHA-3-384, and SHA-3-512 algorithms respectively. They produce 224, 256, 384 and 512 bits of output from a given input.

            • EVP_shake128(), EVP_shake256()

              The SHAKE-128 and SHAKE-256 Extendable Output Functions (XOF) that can generate a variable hash length.

              Specifically, EVP_shake128 provides an overall security of 128 bits, while EVP_shake256 provides that of 256 bits.

            "},{"location":"man3/EVP_sha3_224/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SHA3(7) or EVP_MD-SHAKE(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_sha3_224/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_sha3_224/#conforming-to","title":"CONFORMING TO","text":"

            NIST FIPS 202.

            "},{"location":"man3/EVP_sha3_224/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_sha3_224/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_sm3/","title":"EVP_sm3","text":""},{"location":"man3/EVP_sm3/#name","title":"NAME","text":"

            EVP_sm3 - SM3 for EVP

            "},{"location":"man3/EVP_sm3/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sm3(void);\n
            "},{"location":"man3/EVP_sm3/#description","title":"DESCRIPTION","text":"

            SM3 is a cryptographic hash function with a 256-bit output, defined in GB/T 32905-2016.

            • EVP_sm3()

              The SM3 hash function.

            "},{"location":"man3/EVP_sm3/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SM3(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_sm3/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_sm3/#conforming-to","title":"CONFORMING TO","text":"

            GB/T 32905-2016 and GM/T 0004-2012.

            "},{"location":"man3/EVP_sm3/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_sm3/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved. Copyright 2017 Ribose Inc. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_sm4_cbc/","title":"EVP_sm4_cbc","text":""},{"location":"man3/EVP_sm4_cbc/#name","title":"NAME","text":"

            EVP_sm4_cbc, EVP_sm4_ecb, EVP_sm4_cfb, EVP_sm4_cfb128, EVP_sm4_ofb, EVP_sm4_ctr - EVP SM4 cipher

            "},{"location":"man3/EVP_sm4_cbc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_sm4_cbc(void);\nconst EVP_CIPHER *EVP_sm4_ecb(void);\nconst EVP_CIPHER *EVP_sm4_cfb(void);\nconst EVP_CIPHER *EVP_sm4_cfb128(void);\nconst EVP_CIPHER *EVP_sm4_ofb(void);\nconst EVP_CIPHER *EVP_sm4_ctr(void);\n
            "},{"location":"man3/EVP_sm4_cbc/#description","title":"DESCRIPTION","text":"

            The SM4 blockcipher (GB/T 32907-2016) for EVP.

            All modes below use a key length of 128 bits and acts on blocks of 128 bits.

            • EVP_sm4_cbc(), EVP_sm4_ecb(), EVP_sm4_cfb(), EVP_sm4_cfb128(), EVP_sm4_ofb(), EVP_sm4_ctr()

              The SM4 blockcipher with a 128-bit key in CBC, ECB, CFB, OFB and CTR modes respectively.

            "},{"location":"man3/EVP_sm4_cbc/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-SM4(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_sm4_cbc/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

            "},{"location":"man3/EVP_sm4_cbc/#see-also","title":"SEE ALSO","text":"

            evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

            "},{"location":"man3/EVP_sm4_cbc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved. Copyright 2017 Ribose Inc. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/EVP_whirlpool/","title":"EVP_whirlpool","text":""},{"location":"man3/EVP_whirlpool/#name","title":"NAME","text":"

            EVP_whirlpool - WHIRLPOOL For EVP

            "},{"location":"man3/EVP_whirlpool/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/evp.h>\n\nconst EVP_MD *EVP_whirlpool(void);\n
            "},{"location":"man3/EVP_whirlpool/#description","title":"DESCRIPTION","text":"

            WHIRLPOOL is a cryptographic hash function standardized in ISO/IEC 10118-3:2004 designed by Vincent Rijmen and Paulo S. L. M. Barreto. This implementation is only available with the legacy provider.

            • EVP_whirlpool()

              The WHIRLPOOL algorithm that produces a message digest of 512-bits from a given input.

            "},{"location":"man3/EVP_whirlpool/#notes","title":"NOTES","text":"

            Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-WHIRLPOOL(7) instead. See \"Performance\" in crypto(7) for further information.

            "},{"location":"man3/EVP_whirlpool/#return-values","title":"RETURN VALUES","text":"

            These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

            "},{"location":"man3/EVP_whirlpool/#conforming-to","title":"CONFORMING TO","text":"

            ISO/IEC 10118-3:2004.

            "},{"location":"man3/EVP_whirlpool/#see-also","title":"SEE ALSO","text":"

            evp(7), provider(7), EVP_DigestInit(3)

            "},{"location":"man3/EVP_whirlpool/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/HMAC/","title":"HMAC","text":""},{"location":"man3/HMAC/#name","title":"NAME","text":"

            HMAC, HMAC_CTX_new, HMAC_CTX_reset, HMAC_CTX_free, HMAC_Init, HMAC_Init_ex, HMAC_Update, HMAC_Final, HMAC_CTX_copy, HMAC_CTX_set_flags, HMAC_CTX_get_md, HMAC_size - HMAC message authentication code

            "},{"location":"man3/HMAC/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/hmac.h>\n\nunsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,\n                    const unsigned char *data, size_t data_len,\n                    unsigned char *md, unsigned int *md_len);\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            HMAC_CTX *HMAC_CTX_new(void);\nint HMAC_CTX_reset(HMAC_CTX *ctx);\n\nint HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len,\n                 const EVP_MD *md, ENGINE *impl);\nint HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);\nint HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);\n\nvoid HMAC_CTX_free(HMAC_CTX *ctx);\n\nint HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);\nvoid HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);\nconst EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx);\n\nsize_t HMAC_size(const HMAC_CTX *e);\n

            The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,\n              const EVP_MD *md);\n
            "},{"location":"man3/HMAC/#description","title":"DESCRIPTION","text":"

            HMAC is a MAC (message authentication code), i.e. a keyed hash function used for message authentication, which is based on a hash function.

            HMAC() computes the message authentication code of the data_len bytes at data using the hash function evp_md and the key key which is key_len bytes long. The key may also be NULL with key_len being 0.

            It places the result in md (which must have space for the output of the hash function, which is no more than EVP_MAX_MD_SIZE bytes). If md is NULL, the digest is placed in a static array. The size of the output is placed in md_len, unless it is NULL. Note: passing a NULL value for md to use the static array is not thread safe.

            evp_md is a message digest such as EVP_sha1(), EVP_ripemd160() etc. HMAC does not support variable output length digests such as EVP_shake128() and EVP_shake256().

            HMAC() uses the default OSSL_LIB_CTX. Use EVP_Q_mac(3) instead if a library context is required.

            All of the functions described below are deprecated. Applications should instead use EVP_MAC_CTX_new(3), EVP_MAC_CTX_free(3), EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3) or the 'quick' single-shot MAC function EVP_Q_mac(3).

            HMAC_CTX_new() creates a new HMAC_CTX in heap memory.

            HMAC_CTX_reset() clears an existing HMAC_CTX and associated resources, making it suitable for new computations as if it was newly created with HMAC_CTX_new().

            HMAC_CTX_free() erases the key and other data from the HMAC_CTX, releases any associated resources and finally frees the HMAC_CTX itself. If the argument is NULL, nothing is done.

            The following functions may be used if the message is not completely stored in memory:

            HMAC_Init_ex() initializes or reuses a HMAC_CTX structure to use the hash function evp_md and key key. If both are NULL, or if key is NULL and evp_md is the same as the previous call, then the existing key is reused. ctx must have been created with HMAC_CTX_new() before the first use of an HMAC_CTX in this function.

            If HMAC_Init_ex() is called with key NULL and evp_md is not the same as the previous digest used by ctx then an error is returned because reuse of an existing key with a different digest is not supported.

            HMAC_Init() initializes a HMAC_CTX structure to use the hash function evp_md and the key key which is key_len bytes long.

            HMAC_Update() can be called repeatedly with chunks of the message to be authenticated (len bytes at data).

            HMAC_Final() places the message authentication code in md, which must have space for the hash function output.

            HMAC_CTX_copy() copies all of the internal state from sctx into dctx.

            HMAC_CTX_set_flags() applies the specified flags to the internal EVP_MD_CTXs. These flags have the same meaning as for EVP_MD_CTX_set_flags(3).

            HMAC_CTX_get_md() returns the EVP_MD that has previously been set for the supplied HMAC_CTX.

            HMAC_size() returns the length in bytes of the underlying hash function output.

            "},{"location":"man3/HMAC/#return-values","title":"RETURN VALUES","text":"

            HMAC() returns a pointer to the message authentication code or NULL if an error occurred.

            HMAC_CTX_new() returns a pointer to a new HMAC_CTX on success or NULL if an error occurred.

            HMAC_CTX_reset(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and HMAC_CTX_copy() return 1 for success or 0 if an error occurred.

            HMAC_CTX_get_md() return the EVP_MD previously set for the supplied HMAC_CTX or NULL if no EVP_MD has been set.

            HMAC_size() returns the length in bytes of the underlying hash function output or zero on error.

            "},{"location":"man3/HMAC/#conforming-to","title":"CONFORMING TO","text":"

            RFC 2104

            "},{"location":"man3/HMAC/#see-also","title":"SEE ALSO","text":"

            SHA1(3), EVP_Q_mac(3), evp(7)

            "},{"location":"man3/HMAC/#history","title":"HISTORY","text":"

            All functions except for HMAC() were deprecated in OpenSSL 3.0.

            HMAC_CTX_init() was replaced with HMAC_CTX_reset() in OpenSSL 1.1.0.

            HMAC_CTX_cleanup() existed in OpenSSL before version 1.1.0.

            HMAC_CTX_new(), HMAC_CTX_free() and HMAC_CTX_get_md() are new in OpenSSL 1.1.0.

            HMAC_Init_ex(), HMAC_Update() and HMAC_Final() did not return values in OpenSSL before version 1.0.0.

            "},{"location":"man3/HMAC/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/MD5/","title":"MD5","text":""},{"location":"man3/MD5/#name","title":"NAME","text":"

            MD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update, MD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions

            "},{"location":"man3/MD5/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/md2.h>\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md);\n\nint MD2_Init(MD2_CTX *c);\nint MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);\nint MD2_Final(unsigned char *md, MD2_CTX *c);\n\n\n#include <openssl/md4.h>\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md);\n\nint MD4_Init(MD4_CTX *c);\nint MD4_Update(MD4_CTX *c, const void *data, unsigned long len);\nint MD4_Final(unsigned char *md, MD4_CTX *c);\n\n\n#include <openssl/md5.h>\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\n\nint MD5_Init(MD5_CTX *c);\nint MD5_Update(MD5_CTX *c, const void *data, unsigned long len);\nint MD5_Final(unsigned char *md, MD5_CTX *c);\n
            "},{"location":"man3/MD5/#description","title":"DESCRIPTION","text":"

            All of the functions described on this page are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3).

            MD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output.

            MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest of the n bytes at d and place it in md (which must have space for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 bytes of output). If md is NULL, the digest is placed in a static array.

            The following functions may be used if the message is not completely stored in memory:

            MD2_Init() initializes a MD2_CTX structure.

            MD2_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

            MD2_Final() places the message digest in md, which must have space for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the MD2_CTX.

            MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() are analogous using an MD4_CTX and MD5_CTX structure.

            Applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling the hash functions directly.

            "},{"location":"man3/MD5/#note","title":"NOTE","text":"

            MD2, MD4, and MD5 are recommended only for compatibility with existing applications. In new applications, hashes from the SHA-2 or SHA-3 family should be preferred.

            "},{"location":"man3/MD5/#return-values","title":"RETURN VALUES","text":"

            MD2(), MD4(), and MD5() return pointers to the hash value.

            MD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() return 1 for success, 0 otherwise.

            "},{"location":"man3/MD5/#conforming-to","title":"CONFORMING TO","text":"

            RFC 1319, RFC 1320, RFC 1321

            "},{"location":"man3/MD5/#see-also","title":"SEE ALSO","text":"

            EVP_DigestInit(3), EVP_MD-SHA2(7), EVP_MD-SHA3(7)

            "},{"location":"man3/MD5/#history","title":"HISTORY","text":"

            All of these functions were deprecated in OpenSSL 3.0.

            "},{"location":"man3/MD5/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/MDC2_Init/","title":"MDC2_Init","text":""},{"location":"man3/MDC2_Init/#name","title":"NAME","text":"

            MDC2, MDC2_Init, MDC2_Update, MDC2_Final - MDC2 hash function

            "},{"location":"man3/MDC2_Init/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/mdc2.h>\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            unsigned char *MDC2(const unsigned char *d, unsigned long n,\n                    unsigned char *md);\n\nint MDC2_Init(MDC2_CTX *c);\nint MDC2_Update(MDC2_CTX *c, const unsigned char *data,\n                unsigned long len);\nint MDC2_Final(unsigned char *md, MDC2_CTX *c);\n
            "},{"location":"man3/MDC2_Init/#description","title":"DESCRIPTION","text":"

            All of the functions described on this page are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3).

            MDC2 is a method to construct hash functions with 128 bit output from block ciphers. These functions are an implementation of MDC2 with DES.

            MDC2() computes the MDC2 message digest of the n bytes at d and places it in md (which must have space for MDC2_DIGEST_LENGTH == 16 bytes of output). If md is NULL, the digest is placed in a static array.

            The following functions may be used if the message is not completely stored in memory:

            MDC2_Init() initializes a MDC2_CTX structure.

            MDC2_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

            MDC2_Final() places the message digest in md, which must have space for MDC2_DIGEST_LENGTH == 16 bytes of output, and erases the MDC2_CTX.

            Applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling the hash functions directly.

            "},{"location":"man3/MDC2_Init/#return-values","title":"RETURN VALUES","text":"

            MDC2() returns a pointer to the hash value.

            MDC2_Init(), MDC2_Update() and MDC2_Final() return 1 for success, 0 otherwise.

            "},{"location":"man3/MDC2_Init/#conforming-to","title":"CONFORMING TO","text":"

            ISO/IEC 10118-2:2000 Hash-Function 2, with DES as the underlying block cipher.

            "},{"location":"man3/MDC2_Init/#see-also","title":"SEE ALSO","text":"

            EVP_DigestInit(3)

            "},{"location":"man3/MDC2_Init/#history","title":"HISTORY","text":"

            All of these functions were deprecated in OpenSSL 3.0.

            "},{"location":"man3/MDC2_Init/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/NCONF_new_ex/","title":"NCONF_new_ex","text":""},{"location":"man3/NCONF_new_ex/#name","title":"NAME","text":"

            NCONF_new_ex, NCONF_new, NCONF_free, NCONF_default, NCONF_load, NCONF_get0_libctx, NCONF_get_section, NCONF_get_section_names - functionality to Load and parse configuration files manually

            "},{"location":"man3/NCONF_new_ex/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/conf.h>\n\ntypedef struct {\n    char *section;\n    char *name;\n    char *value;\n} CONF_VALUE;\n\nCONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);\nCONF *NCONF_new(CONF_METHOD *meth);\nvoid NCONF_free(CONF *conf);\nCONF_METHOD *NCONF_default(void);\nint NCONF_load(CONF *conf, const char *file, long *eline);\nOSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);\n\nSTACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *name);\nSTACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);\n
            "},{"location":"man3/NCONF_new_ex/#description","title":"DESCRIPTION","text":"

            NCONF_new_ex() creates a new CONF object in heap memory and assigns to it a context libctx that can be used during loading. If the method table meth is set to NULL then the default value of NCONF_default() is used.

            NCONF_new() is similar to NCONF_new_ex() but sets the libctx to NULL.

            NCONF_free() frees the data associated with conf and then frees the conf object. If the argument is NULL, nothing is done.

            NCONF_load() parses the file named filename and adds the values found to conf. If an error occurs file and eline list the file and line that the load failed on if they are not NULL.

            NCONF_default() gets the default method table for processing a configuration file.

            NCONF_get0_libctx() gets the library context associated with the conf parameter.

            NCONF_get_section_names() gets the names of the sections associated with the conf as STACK_OF(OPENSSL_CSTRING) strings. The individual strings are associated with the conf and will be invalid after conf is freed. The returned stack must be freed with sk_OPENSSL_CSTRING_free().

            NCONF_get_section() gets the config values associated with the conf from the config section name as STACK_OF(CONF_VALUE) structures. The returned stack is associated with the conf and will be invalid after conf is freed. It must not be freed by the caller.

            "},{"location":"man3/NCONF_new_ex/#return-values","title":"RETURN VALUES","text":"

            NCONF_load() returns 1 on success or 0 on error.

            NCONF_new_ex() and NCONF_new() return a newly created CONF object or NULL if an error occurs.

            "},{"location":"man3/NCONF_new_ex/#see-also","title":"SEE ALSO","text":"

            CONF_modules_load_file(3),

            "},{"location":"man3/NCONF_new_ex/#history","title":"HISTORY","text":"

            NCONF_new_ex(), NCONF_get0_libctx(), and NCONF_get_section_names() were added in OpenSSL 3.0.

            "},{"location":"man3/NCONF_new_ex/#copyright","title":"COPYRIGHT","text":"

            Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OBJ_nid2obj/","title":"OBJ_nid2obj","text":""},{"location":"man3/OBJ_nid2obj/#name","title":"NAME","text":"

            i2t_ASN1_OBJECT, OBJ_length, OBJ_get0_data, OBJ_nid2obj, OBJ_nid2ln, OBJ_nid2sn, OBJ_obj2nid, OBJ_txt2nid, OBJ_ln2nid, OBJ_sn2nid, OBJ_cmp, OBJ_dup, OBJ_txt2obj, OBJ_obj2txt, OBJ_create, OBJ_cleanup, OBJ_add_sigid - ASN1 object utility functions

            "},{"location":"man3/OBJ_nid2obj/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/objects.h>\n\nASN1_OBJECT *OBJ_nid2obj(int n);\nconst char *OBJ_nid2ln(int n);\nconst char *OBJ_nid2sn(int n);\n\nint OBJ_obj2nid(const ASN1_OBJECT *o);\nint OBJ_ln2nid(const char *ln);\nint OBJ_sn2nid(const char *sn);\n\nint OBJ_txt2nid(const char *s);\n\nASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name);\nint OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);\n\nint i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);\n\nint OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b);\nASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o);\n\nint OBJ_create(const char *oid, const char *sn, const char *ln);\n\nsize_t OBJ_length(const ASN1_OBJECT *obj);\nconst unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj);\n\nint OBJ_add_sigid(int signid, int dig_id, int pkey_id);\n

            The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            void OBJ_cleanup(void);\n
            "},{"location":"man3/OBJ_nid2obj/#description","title":"DESCRIPTION","text":"

            The ASN1 object utility functions process ASN1_OBJECT structures which are a representation of the ASN1 OBJECT IDENTIFIER (OID) type. For convenience, OIDs are usually represented in source code as numeric identifiers, or NIDs. OpenSSL has an internal table of OIDs that are generated when the library is built, and their corresponding NIDs are available as defined constants. For the functions below, application code should treat all returned values -- OIDs, NIDs, or names -- as constants.

            OBJ_nid2obj(), OBJ_nid2ln() and OBJ_nid2sn() convert the NID n to an ASN1_OBJECT structure, its long name and its short name respectively, or NULL if an error occurred.

            OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() return the corresponding NID for the object o, the long name ln or the short name sn respectively or NID_undef if an error occurred.

            OBJ_txt2nid() returns NID corresponding to text string s. s can be a long name, a short name or the numerical representation of an object.

            OBJ_txt2obj() converts the text string s into an ASN1_OBJECT structure. If no_name is 0 then long names and short names will be interpreted as well as numerical forms. If no_name is 1 only the numerical form is acceptable.

            OBJ_obj2txt() converts the ASN1_OBJECT a into a textual representation. Unless buf is NULL, the representation is written as a NUL-terminated string to buf, where at most buf_len bytes are written, truncating the result if necessary. In any case it returns the total string length, excluding the NUL character, required for non-truncated representation, or -1 on error. If no_name is 0 then if the object has a long or short name then that will be used, otherwise the numerical form will be used. If no_name is 1 then the numerical form will always be used.

            i2t_ASN1_OBJECT() is the same as OBJ_obj2txt() with the no_name set to zero.

            OBJ_cmp() compares a to b. If the two are identical 0 is returned.

            OBJ_dup() returns a copy of o.

            OBJ_create() adds a new object to the internal table. oid is the numerical form of the object, sn the short name and ln the long name. A new NID is returned for the created object in case of success and NID_undef in case of failure.

            OBJ_length() returns the size of the content octets of obj.

            OBJ_get0_data() returns a pointer to the content octets of obj. The returned pointer is an internal pointer which must not be freed.

            OBJ_add_sigid() creates a new composite \"Signature Algorithm\" that associates a given NID with two other NIDs - one representing the underlying signature algorithm and the other representing a digest algorithm to be used in conjunction with it. signid represents the NID for the composite \"Signature Algorithm\", dig_id is the NID for the digest algorithm and pkey_id is the NID for the underlying signature algorithm. As there are signature algorithms that do not require a digest, NID_undef is a valid dig_id.

            OBJ_cleanup() releases any resources allocated by creating new objects.

            "},{"location":"man3/OBJ_nid2obj/#notes","title":"NOTES","text":"

            Objects in OpenSSL can have a short name, a long name and a numerical identifier (NID) associated with them. A standard set of objects is represented in an internal table. The appropriate values are defined in the header file objects.h.

            For example the OID for commonName has the following definitions:

            #define SN_commonName                   \"CN\"\n#define LN_commonName                   \"commonName\"\n#define NID_commonName                  13\n

            New objects can be added by calling OBJ_create().

            Table objects have certain advantages over other objects: for example their NIDs can be used in a C language switch statement. They are also static constant structures which are shared: that is there is only a single constant structure for each table object.

            Objects which are not in the table have the NID value NID_undef.

            Objects do not need to be in the internal tables to be processed, the functions OBJ_txt2obj() and OBJ_obj2txt() can process the numerical form of an OID.

            Some objects are used to represent algorithms which do not have a corresponding ASN.1 OBJECT IDENTIFIER encoding (for example no OID currently exists for a particular algorithm). As a result they cannot be encoded or decoded as part of ASN.1 structures. Applications can determine if there is a corresponding OBJECT IDENTIFIER by checking OBJ_length() is not zero.

            These functions cannot return const because an ASN1_OBJECT can represent both an internal, constant, OID and a dynamically-created one. The latter cannot be constant because it needs to be freed after use.

            These functions were not thread safe in OpenSSL 3.0 and before.

            "},{"location":"man3/OBJ_nid2obj/#return-values","title":"RETURN VALUES","text":"

            OBJ_nid2obj() returns an ASN1_OBJECT structure or NULL is an error occurred.

            OBJ_nid2ln() and OBJ_nid2sn() returns a valid string or NULL on error.

            OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() and OBJ_txt2nid() return a NID or NID_undef on error.

            OBJ_add_sigid() returns 1 on success or 0 on error.

            i2t_ASN1_OBJECT() an OBJ_obj2txt() return -1 on error. On success, they return the length of the string written to buf if buf is not NULL and buf_len is big enough, otherwise the total string length. Note that this does not count the trailing NUL character.

            "},{"location":"man3/OBJ_nid2obj/#examples","title":"EXAMPLES","text":"

            Create an object for commonName:

            ASN1_OBJECT *o = OBJ_nid2obj(NID_commonName);\n

            Check if an object is commonName

            if (OBJ_obj2nid(obj) == NID_commonName)\n    /* Do something */\n

            Create a new NID and initialize an object from it:

            int new_nid = OBJ_create(\"1.2.3.4\", \"NewOID\", \"New Object Identifier\");\nASN1_OBJECT *obj = OBJ_nid2obj(new_nid);\n

            Create a new object directly:

            obj = OBJ_txt2obj(\"1.2.3.4\", 1);\n
            "},{"location":"man3/OBJ_nid2obj/#see-also","title":"SEE ALSO","text":"

            ERR_get_error(3)

            "},{"location":"man3/OBJ_nid2obj/#history","title":"HISTORY","text":"

            OBJ_cleanup() was deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto(3) and should not be used.

            "},{"location":"man3/OBJ_nid2obj/#copyright","title":"COPYRIGHT","text":"

            Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OCSP_REQUEST_new/","title":"OCSP_REQUEST_new","text":""},{"location":"man3/OCSP_REQUEST_new/#name","title":"NAME","text":"

            OCSP_REQUEST_new, OCSP_REQUEST_free, OCSP_request_add0_id, OCSP_request_sign, OCSP_request_add1_cert, OCSP_request_onereq_count, OCSP_request_onereq_get0 - OCSP request functions

            "},{"location":"man3/OCSP_REQUEST_new/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/ocsp.h>\n\nOCSP_REQUEST *OCSP_REQUEST_new(void);\nvoid OCSP_REQUEST_free(OCSP_REQUEST *req);\n\nOCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);\n\nint OCSP_request_sign(OCSP_REQUEST *req,\n                      X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,\n                      STACK_OF(X509) *certs, unsigned long flags);\n\nint OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);\n\nint OCSP_request_onereq_count(OCSP_REQUEST *req);\nOCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);\n
            "},{"location":"man3/OCSP_REQUEST_new/#description","title":"DESCRIPTION","text":"

            OCSP_REQUEST_new() allocates and returns an empty OCSP_REQUEST structure.

            OCSP_REQUEST_free() frees up the request structure req. If the argument is NULL, nothing is done.

            OCSP_request_add0_id() adds certificate ID cid to req. It returns the OCSP_ONEREQ structure added so an application can add additional extensions to the request. The id parameter MUST NOT be freed up after the operation.

            OCSP_request_sign() signs OCSP request req using certificate signer, private key key, digest dgst and additional certificates certs. If the flags option OCSP_NOCERTS is set then no certificates will be included in the request.

            OCSP_request_add1_cert() adds certificate cert to request req. The application is responsible for freeing up cert after use.

            OCSP_request_onereq_count() returns the total number of OCSP_ONEREQ structures in req.

            OCSP_request_onereq_get0() returns an internal pointer to the OCSP_ONEREQ contained in req of index i. The index value i runs from 0 to OCSP_request_onereq_count(req) - 1.

            "},{"location":"man3/OCSP_REQUEST_new/#return-values","title":"RETURN VALUES","text":"

            OCSP_REQUEST_new() returns an empty OCSP_REQUEST structure or NULL if an error occurred.

            OCSP_request_add0_id() returns the OCSP_ONEREQ structure containing cid or NULL if an error occurred.

            OCSP_request_sign() and OCSP_request_add1_cert() return 1 for success and 0 for failure.

            OCSP_request_onereq_count() returns the total number of OCSP_ONEREQ structures in req and -1 on error.

            OCSP_request_onereq_get0() returns a pointer to an OCSP_ONEREQ structure or NULL if the index value is out or range.

            "},{"location":"man3/OCSP_REQUEST_new/#notes","title":"NOTES","text":"

            An OCSP request structure contains one or more OCSP_ONEREQ structures corresponding to each certificate.

            OCSP_request_onereq_count() and OCSP_request_onereq_get0() are mainly used by OCSP responders.

            "},{"location":"man3/OCSP_REQUEST_new/#examples","title":"EXAMPLES","text":"

            Create an OCSP_REQUEST structure for certificate cert with issuer issuer:

            OCSP_REQUEST *req;\nOCSP_ID *cid;\n\nreq = OCSP_REQUEST_new();\nif (req == NULL)\n   /* error */\ncid = OCSP_cert_to_id(EVP_sha1(), cert, issuer);\nif (cid == NULL)\n   /* error */\n\nif (OCSP_REQUEST_add0_id(req, cid) == NULL)\n   /* error */\n\n/* Do something with req, e.g. query responder */\n\nOCSP_REQUEST_free(req);\n
            "},{"location":"man3/OCSP_REQUEST_new/#see-also","title":"SEE ALSO","text":"

            crypto(7), OCSP_cert_to_id(3), OCSP_request_add1_nonce(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)

            "},{"location":"man3/OCSP_REQUEST_new/#copyright","title":"COPYRIGHT","text":"

            Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OCSP_cert_to_id/","title":"OCSP_cert_to_id","text":""},{"location":"man3/OCSP_cert_to_id/#name","title":"NAME","text":"

            OCSP_cert_to_id, OCSP_cert_id_new, OCSP_CERTID_free, OCSP_id_issuer_cmp, OCSP_id_cmp, OCSP_id_get0_info - OCSP certificate ID utility functions

            "},{"location":"man3/OCSP_cert_to_id/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/ocsp.h>\n\nOCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst,\n                             X509 *subject, X509 *issuer);\n\nOCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,\n                              X509_NAME *issuerName,\n                              ASN1_BIT_STRING *issuerKey,\n                              ASN1_INTEGER *serialNumber);\n\nvoid OCSP_CERTID_free(OCSP_CERTID *id);\n\nint OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);\nint OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);\n\nint OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,\n                      ASN1_OCTET_STRING **pikeyHash,\n                      ASN1_INTEGER **pserial, OCSP_CERTID *cid);\n
            "},{"location":"man3/OCSP_cert_to_id/#description","title":"DESCRIPTION","text":"

            OCSP_cert_to_id() creates and returns a new OCSP_CERTID structure using message digest dgst for certificate subject with issuer issuer. If dgst is NULL then SHA1 is used.

            OCSP_cert_id_new() creates and returns a new OCSP_CERTID using dgst and issuer name issuerName, issuer key hash issuerKey and serial number serialNumber.

            OCSP_CERTID_free() frees up id. If the argument is NULL, nothing is done.

            OCSP_id_cmp() compares OCSP_CERTID a and b.

            OCSP_id_issuer_cmp() compares only the issuer name of OCSP_CERTID a and b.

            OCSP_id_get0_info() returns the issuer name hash, hash OID, issuer key hash and serial number contained in cid. If any of the values are not required the corresponding parameter can be set to NULL.

            "},{"location":"man3/OCSP_cert_to_id/#return-values","title":"RETURN VALUES","text":"

            OCSP_cert_to_id() and OCSP_cert_id_new() return either a pointer to a valid OCSP_CERTID structure or NULL if an error occurred.

            OCSP_id_cmp() and OCSP_id_issuer_cmp() returns zero for a match and nonzero otherwise.

            OCSP_CERTID_free() does not return a value.

            OCSP_id_get0_info() returns 1 for success and 0 for failure.

            "},{"location":"man3/OCSP_cert_to_id/#notes","title":"NOTES","text":"

            OCSP clients will typically only use OCSP_cert_to_id() or OCSP_cert_id_new(): the other functions are used by responder applications.

            The values returned by OCSP_id_get0_info() are internal pointers and MUST NOT be freed up by an application: they will be freed when the corresponding OCSP_CERTID structure is freed.

            "},{"location":"man3/OCSP_cert_to_id/#see-also","title":"SEE ALSO","text":"

            crypto(7), OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)

            "},{"location":"man3/OCSP_cert_to_id/#copyright","title":"COPYRIGHT","text":"

            Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OCSP_request_add1_nonce/","title":"OCSP_request_add1_nonce","text":""},{"location":"man3/OCSP_request_add1_nonce/#name","title":"NAME","text":"

            OCSP_request_add1_nonce, OCSP_basic_add1_nonce, OCSP_check_nonce, OCSP_copy_nonce - OCSP nonce functions

            "},{"location":"man3/OCSP_request_add1_nonce/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/ocsp.h>\n\nint OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);\nint OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);\nint OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);\nint OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *resp);\n
            "},{"location":"man3/OCSP_request_add1_nonce/#description","title":"DESCRIPTION","text":"

            OCSP_request_add1_nonce() adds a nonce of value val and length len to OCSP request req. If val is NULL a random nonce is used. If len is zero or negative a default length will be used (currently 16 bytes).

            OCSP_basic_add1_nonce() is identical to OCSP_request_add1_nonce() except it adds a nonce to OCSP basic response resp.

            OCSP_check_nonce() compares the nonce value in req and resp.

            OCSP_copy_nonce() copies any nonce value present in req to resp.

            "},{"location":"man3/OCSP_request_add1_nonce/#return-values","title":"RETURN VALUES","text":"

            OCSP_request_add1_nonce() and OCSP_basic_add1_nonce() return 1 for success and 0 for failure.

            OCSP_copy_nonce() returns 1 if a nonce was successfully copied, 2 if no nonce was present in req and 0 if an error occurred.

            OCSP_check_nonce() returns the result of the nonce comparison between req and resp. The return value indicates the result of the comparison. If nonces are present and equal 1 is returned. If the nonces are absent 2 is returned. If a nonce is present in the response only 3 is returned. If nonces are present and unequal 0 is returned. If the nonce is present in the request only then -1 is returned.

            "},{"location":"man3/OCSP_request_add1_nonce/#notes","title":"NOTES","text":"

            For most purposes the nonce value in a request is set to a random value so the val parameter in OCSP_request_add1_nonce() is usually NULL.

            An OCSP nonce is typically added to an OCSP request to thwart replay attacks by checking the same nonce value appears in the response.

            Some responders may include a nonce in all responses even if one is not supplied.

            Some responders cache OCSP responses and do not sign each response for performance reasons. As a result they do not support nonces.

            The return values of OCSP_check_nonce() can be checked to cover each case. A positive return value effectively indicates success: nonces are both present and match, both absent or present in the response only. A nonzero return additionally covers the case where the nonce is present in the request only: this will happen if the responder doesn't support nonces. A zero return value indicates present and mismatched nonces: this should be treated as an error condition.

            "},{"location":"man3/OCSP_request_add1_nonce/#see-also","title":"SEE ALSO","text":"

            crypto(7), OCSP_cert_to_id(3), OCSP_REQUEST_new(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)

            "},{"location":"man3/OCSP_request_add1_nonce/#copyright","title":"COPYRIGHT","text":"

            Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OCSP_resp_find_status/","title":"OCSP_resp_find_status","text":""},{"location":"man3/OCSP_resp_find_status/#name","title":"NAME","text":"

            OCSP_resp_find_status, OCSP_resp_count, OCSP_resp_get0, OCSP_resp_find, OCSP_single_get0_status, OCSP_resp_get0_produced_at, OCSP_resp_get0_signature, OCSP_resp_get0_tbs_sigalg, OCSP_resp_get0_respdata, OCSP_resp_get0_certs, OCSP_resp_get0_signer, OCSP_resp_get0_id, OCSP_resp_get1_id, OCSP_check_validity, OCSP_basic_verify - OCSP response utility functions

            "},{"location":"man3/OCSP_resp_find_status/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/ocsp.h>\n\nint OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,\n                          int *reason,\n                          ASN1_GENERALIZEDTIME **revtime,\n                          ASN1_GENERALIZEDTIME **thisupd,\n                          ASN1_GENERALIZEDTIME **nextupd);\n\nint OCSP_resp_count(OCSP_BASICRESP *bs);\nOCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);\nint OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);\nint OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,\n                            ASN1_GENERALIZEDTIME **revtime,\n                            ASN1_GENERALIZEDTIME **thisupd,\n                            ASN1_GENERALIZEDTIME **nextupd);\n\nconst ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(\n                            const OCSP_BASICRESP* single);\n\nconst ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs);\nconst X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs);\nconst OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs);\nconst STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);\n\nint OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer,\n                          STACK_OF(X509) *extra_certs);\n\nint OCSP_resp_get0_id(const OCSP_BASICRESP *bs,\n                      const ASN1_OCTET_STRING **pid,\n                      const X509_NAME **pname);\nint OCSP_resp_get1_id(const OCSP_BASICRESP *bs,\n                      ASN1_OCTET_STRING **pid,\n                      X509_NAME **pname);\n\nint OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,\n                        ASN1_GENERALIZEDTIME *nextupd,\n                        long sec, long maxsec);\n\nint OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,\n                     X509_STORE *st, unsigned long flags);\n
            "},{"location":"man3/OCSP_resp_find_status/#description","title":"DESCRIPTION","text":"

            OCSP_resp_find_status() searches bs for an OCSP response for id. If it is successful the fields of the response are returned in *status, *reason, *revtime, *thisupd and *nextupd. The *status value will be one of V_OCSP_CERTSTATUS_GOOD, V_OCSP_CERTSTATUS_REVOKED or V_OCSP_CERTSTATUS_UNKNOWN. The *reason and *revtime fields are only set if the status is V_OCSP_CERTSTATUS_REVOKED. If set the *reason field will be set to the revocation reason which will be one of OCSP_REVOKED_STATUS_NOSTATUS, OCSP_REVOKED_STATUS_UNSPECIFIED, OCSP_REVOKED_STATUS_KEYCOMPROMISE, OCSP_REVOKED_STATUS_CACOMPROMISE, OCSP_REVOKED_STATUS_AFFILIATIONCHANGED, OCSP_REVOKED_STATUS_SUPERSEDED, OCSP_REVOKED_STATUS_CESSATIONOFOPERATION, OCSP_REVOKED_STATUS_CERTIFICATEHOLD or OCSP_REVOKED_STATUS_REMOVEFROMCRL.

            OCSP_resp_count() returns the number of OCSP_SINGLERESP structures in bs.

            OCSP_resp_get0() returns the OCSP_SINGLERESP structure in bs corresponding to index idx, where idx runs from 0 to OCSP_resp_count(bs) - 1.

            OCSP_resp_find() searches bs for id and returns the index of the first matching entry after last or starting from the beginning if last is -1.

            OCSP_single_get0_status() extracts the fields of single in *reason, *revtime, *thisupd and *nextupd.

            OCSP_resp_get0_produced_at() extracts the producedAt field from the single response bs.

            OCSP_resp_get0_signature() returns the signature from bs.

            OCSP_resp_get0_tbs_sigalg() returns the signatureAlgorithm from bs.

            OCSP_resp_get0_respdata() returns the tbsResponseData from bs.

            OCSP_resp_get0_certs() returns any certificates included in bs.

            OCSP_resp_get0_signer() attempts to retrieve the certificate that directly signed bs. The OCSP protocol does not require that this certificate is included in the certs field of the response, so additional certificates can be supplied via the extra_certs if the certificates that may have signed the response are known via some out-of-band mechanism.

            OCSP_resp_get0_id() gets the responder id of bs. If the responder ID is a name then <*pname> is set to the name and *pid is set to NULL. If the responder ID is by key ID then *pid is set to the key ID and *pname is set to NULL.

            OCSP_resp_get1_id() is the same as OCSP_resp_get0_id() but leaves ownership of *pid and *pname with the caller, who is responsible for freeing them unless the function returns 0.

            OCSP_check_validity() checks the validity of its thisupd and nextupd arguments, which will be typically obtained from OCSP_resp_find_status() or OCSP_single_get0_status(). If sec is nonzero it indicates how many seconds leeway should be allowed in the check. If maxsec is positive it indicates the maximum age of thisupd in seconds.

            OCSP_basic_verify() checks that the basic response message bs is correctly signed and that the signer certificate can be validated. It takes st as the trusted store and certs as a set of untrusted intermediate certificates. The function first tries to find the signer certificate of the response in certs. It then searches the certificates the responder may have included in bs unless flags contains OCSP_NOINTERN. It fails if the signer certificate cannot be found. Next, unless flags contains OCSP_NOSIGS, the function checks the signature of bs and fails on error. Then the function already returns success if flags contains OCSP_NOVERIFY or if the signer certificate was found in certs and flags contains OCSP_TRUSTOTHER. Otherwise the function continues by validating the signer certificate. If flags contains OCSP_PARTIAL_CHAIN it takes intermediate CA certificates in st as trust anchors. For more details, see the description of X509_V_FLAG_PARTIAL_CHAIN in \"VERIFICATION FLAGS\" in X509_VERIFY_PARAM_set_flags(3). If flags contains OCSP_NOCHAIN it ignores all certificates in certs and in bs, else it takes them as untrusted intermediate CA certificates and uses them for constructing the validation path for the signer certificate. Certificate revocation status checks using CRLs is disabled during path validation if the signer certificate contains the id-pkix-ocsp-no-check extension. After successful path validation the function returns success if the OCSP_NOCHECKS flag is set. Otherwise it verifies that the signer certificate meets the OCSP issuer criteria including potential delegation. If this does not succeed and the OCSP_NOEXPLICIT flag is not set the function checks for explicit trust for OCSP signing in the root CA certificate.

            "},{"location":"man3/OCSP_resp_find_status/#return-values","title":"RETURN VALUES","text":"

            OCSP_resp_find_status() returns 1 if id is found in bs and 0 otherwise.

            OCSP_resp_count() returns the total number of OCSP_SINGLERESP fields in bs or -1 on error.

            OCSP_resp_get0() returns a pointer to an OCSP_SINGLERESP structure or NULL on error, such as idx being out of range.

            OCSP_resp_find() returns the index of id in bs (which may be 0) or -1 on error, such as when id was not found.

            OCSP_single_get0_status() returns the status of single or -1 if an error occurred.

            OCSP_resp_get0_produced_at() returns the producedAt field from bs.

            OCSP_resp_get0_signature() returns the signature from bs.

            OCSP_resp_get0_tbs_sigalg() returns the signatureAlgorithm field from bs.

            OCSP_resp_get0_respdata() returns the tbsResponseData field from bs.

            OCSP_resp_get0_certs() returns any certificates included in bs.

            OCSP_resp_get0_signer() returns 1 if the signing certificate was located, or 0 if not found or on error.

            OCSP_resp_get0_id() and OCSP_resp_get1_id() return 1 on success, 0 on failure.

            OCSP_check_validity() returns 1 if thisupd and nextupd are valid time values and the current time + sec is not before thisupd and, if maxsec >= 0, the current time - maxsec is not past nextupd. Otherwise it returns 0 to indicate an error.

            OCSP_basic_verify() returns 1 on success, 0 on verification not successful, or -1 on a fatal error such as malloc failure.

            "},{"location":"man3/OCSP_resp_find_status/#notes","title":"NOTES","text":"

            Applications will typically call OCSP_resp_find_status() using the certificate ID of interest and then check its validity using OCSP_check_validity(). They can then take appropriate action based on the status of the certificate.

            An OCSP response for a certificate contains thisUpdate and nextUpdate fields. Normally the current time should be between these two values. To account for clock skew the maxsec field can be set to nonzero in OCSP_check_validity(). Some responders do not set the nextUpdate field, this would otherwise mean an ancient response would be considered valid: the maxsec parameter to OCSP_check_validity() can be used to limit the permitted age of responses.

            The values written to *revtime, *thisupd and *nextupd by OCSP_resp_find_status() and OCSP_single_get0_status() are internal pointers which MUST NOT be freed up by the calling application. Any or all of these parameters can be set to NULL if their value is not required.

            "},{"location":"man3/OCSP_resp_find_status/#see-also","title":"SEE ALSO","text":"

            crypto(7), OCSP_cert_to_id(3), OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3), OCSP_response_status(3), OCSP_sendreq_new(3), X509_VERIFY_PARAM_set_flags(3)

            "},{"location":"man3/OCSP_resp_find_status/#copyright","title":"COPYRIGHT","text":"

            Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OCSP_response_status/","title":"OCSP_response_status","text":""},{"location":"man3/OCSP_response_status/#name","title":"NAME","text":"

            OCSP_response_status, OCSP_response_get1_basic, OCSP_response_create, OCSP_RESPONSE_free, OCSP_RESPID_set_by_name, OCSP_RESPID_set_by_key_ex, OCSP_RESPID_set_by_key, OCSP_RESPID_match_ex, OCSP_RESPID_match, OCSP_basic_sign, OCSP_basic_sign_ctx - OCSP response functions

            "},{"location":"man3/OCSP_response_status/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/ocsp.h>\n\nint OCSP_response_status(OCSP_RESPONSE *resp);\nOCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);\nOCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);\nvoid OCSP_RESPONSE_free(OCSP_RESPONSE *resp);\n\nint OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert);\nint OCSP_RESPID_set_by_key_ex(OCSP_RESPID *respid, X509 *cert,\n                              OSSL_LIB_CTX *libctx, const char *propq);\nint OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert);\nint OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OSSL_LIB_CTX *libctx,\n                         const char *propq);\nint OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert);\n\nint OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key,\n                    const EVP_MD *dgst, STACK_OF(X509) *certs,\n                    unsigned long flags);\nint OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, X509 *signer, EVP_MD_CTX *ctx,\n                        STACK_OF(X509) *certs, unsigned long flags);\n
            "},{"location":"man3/OCSP_response_status/#description","title":"DESCRIPTION","text":"

            OCSP_response_status() returns the OCSP response status of resp. It returns one of the values: OCSP_RESPONSE_STATUS_SUCCESSFUL, OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, OCSP_RESPONSE_STATUS_INTERNALERROR, OCSP_RESPONSE_STATUS_TRYLATER OCSP_RESPONSE_STATUS_SIGREQUIRED, or OCSP_RESPONSE_STATUS_UNAUTHORIZED.

            OCSP_response_get1_basic() decodes and returns the OCSP_BASICRESP structure contained in resp.

            OCSP_response_create() creates and returns an OCSP_RESPONSE structure for status and optionally including basic response bs.

            OCSP_RESPONSE_free() frees up OCSP response resp. If the argument is NULL, nothing is done.

            OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the same as the subject name in the supplied X509 certificate cert for the OCSP responder.

            OCSP_RESPID_set_by_key_ex() sets the key of the OCSP_RESPID to be the same as the key in the supplied X509 certificate cert for the OCSP responder. The key is stored as a SHA1 hash. To calculate the hash the SHA1 algorithm is fetched using the library ctx libctx and the property query string propq (see \"ALGORITHM FETCHING\" in crypto(7) for further information).

            OCSP_RESPID_set_by_key() does the same as OCSP_RESPID_set_by_key_ex() except that the default library context is used with an empty property query string.

            Note that an OCSP_RESPID can only have one of the name, or the key set. Calling OCSP_RESPID_set_by_name() or OCSP_RESPID_set_by_key() will clear any existing setting.

            OCSP_RESPID_match_ex() tests whether the OCSP_RESPID given in respid matches with the X509 certificate cert based on the SHA1 hash. To calculate the hash the SHA1 algorithm is fetched using the library ctx libctx and the property query string propq (see \"ALGORITHM FETCHING\" in crypto(7) for further information).

            OCSP_RESPID_match() does the same as OCSP_RESPID_match_ex() except that the default library context is used with an empty property query string.

            OCSP_basic_sign() signs OCSP response brsp using certificate signer, private key key, digest dgst and additional certificates certs. If the flags option OCSP_NOCERTS is set then no certificates will be included in the response. If the flags option OCSP_RESPID_KEY is set then the responder is identified by key ID rather than by name. OCSP_basic_sign_ctx() also signs OCSP response brsp but uses the parameters contained in digest context ctx.

            "},{"location":"man3/OCSP_response_status/#return-values","title":"RETURN VALUES","text":"

            OCSP_RESPONSE_status() returns a status value.

            OCSP_response_get1_basic() returns an OCSP_BASICRESP structure pointer or NULL if an error occurred.

            OCSP_response_create() returns an OCSP_RESPONSE structure pointer or NULL if an error occurred.

            OCSP_RESPONSE_free() does not return a value.

            OCSP_RESPID_set_by_name(), OCSP_RESPID_set_by_key(), OCSP_basic_sign(), and OCSP_basic_sign_ctx() return 1 on success or 0 on failure.

            OCSP_RESPID_match() returns 1 if the OCSP_RESPID and the X509 certificate match or 0 otherwise.

            "},{"location":"man3/OCSP_response_status/#notes","title":"NOTES","text":"

            OCSP_response_get1_basic() is only called if the status of a response is OCSP_RESPONSE_STATUS_SUCCESSFUL.

            "},{"location":"man3/OCSP_response_status/#see-also","title":"SEE ALSO","text":"

            crypto(7) OCSP_cert_to_id(3) OCSP_request_add1_nonce(3) OCSP_REQUEST_new(3) OCSP_resp_find_status(3) OCSP_sendreq_new(3) OCSP_RESPID_new(3) OCSP_RESPID_free(3)

            "},{"location":"man3/OCSP_response_status/#history","title":"HISTORY","text":"

            The OCSP_RESPID_set_by_name(), OCSP_RESPID_set_by_key() and OCSP_RESPID_match() functions were added in OpenSSL 1.1.0a.

            The OCSP_basic_sign_ctx() function was added in OpenSSL 1.1.1.

            "},{"location":"man3/OCSP_response_status/#copyright","title":"COPYRIGHT","text":"

            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OCSP_sendreq_new/","title":"OCSP_sendreq_new","text":""},{"location":"man3/OCSP_sendreq_new/#name","title":"NAME","text":"

            OCSP_REQ_CTX, OCSP_sendreq_new, OCSP_sendreq_nbio, OCSP_sendreq_bio, OCSP_REQ_CTX_i2d, OCSP_REQ_CTX_add1_header, OCSP_REQ_CTX_free, OCSP_set_max_response_length, OCSP_REQ_CTX_set1_req - OCSP responder query functions

            "},{"location":"man3/OCSP_sendreq_new/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/ocsp.h>\n\nOSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,\n                                    const OCSP_REQUEST *req, int buf_size);\nOCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX;\nint OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx);\nint OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req);\nint OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx,\n                             const char *name, const char *value);\nvoid OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);\nvoid OCSP_set_max_response_length(OCSP_REQ_CT *rctx, unsigned long len);\nint OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req);\n
            "},{"location":"man3/OCSP_sendreq_new/#description","title":"DESCRIPTION","text":"

            These functions perform an OCSP POST request / response transfer over HTTP, using the HTTP request functions described in OSSL_HTTP_REQ_CTX(3).

            The function OCSP_sendreq_new() builds a complete OSSL_HTTP_REQ_CTX structure with the BIO io to be used for requests and response, the URL path path, optionally the OCSP request req, and a response header maximum line length of buf_size. If buf_size is zero a default value of 4KiB is used. The req may be set to NULL and provided later using OCSP_REQ_CTX_set1_req() or OSSL_HTTP_REQ_CTX_set1_req(3). The io and path arguments to OCSP_sendreq_new() correspond to the components of the URL. For example if the responder URL is http://example.com/ocspreq the BIO io should haven been connected to host example.com on port 80 and path should be set to /ocspreq.

            OCSP_sendreq_nbio() attempts to send the request prepared in rctx and to gather the response via HTTP, using the BIO io and path that were given when calling OCSP_sendreq_new(). If the operation gets completed it assigns the response, a pointer to a OCSP_RESPONSE structure, in *presp. The function may need to be called again if its result is -1, which indicates BIO_should_retry(3). In such a case it is advisable to sleep a little in between, using BIO_wait(3) on the read BIO to prevent a busy loop.

            OCSP_sendreq_bio() combines OCSP_sendreq_new() with as many calls of OCSP_sendreq_nbio() as needed and then OCSP_REQ_CTX_free(), with a response header maximum line length 4k. It waits indefinitely on a response. It does not support setting a timeout or adding headers and is retained for compatibility; use OSSL_HTTP_transfer(3) instead.

            OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following:

            OSSL_HTTP_REQ_CTX_set1_req(rctx, \"application/ocsp-request\", it, req)\n

            OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:

            OSSL_HTTP_REQ_CTX_set1_req(rctx, \"application/ocsp-request\",\n                           ASN1_ITEM_rptr(OCSP_REQUEST),\n                           (const ASN1_VALUE *)req)\n

            The deprecated type and the remaining deprecated functions have been superseded by the following equivalents: OCSP_REQ_CTX by OSSL_HTTP_REQ_CTX(3), OCSP_REQ_CTX_add1_header() by OSSL_HTTP_REQ_CTX_add1_header(3), OCSP_REQ_CTX_free() by OSSL_HTTP_REQ_CTX_free(3), and OCSP_set_max_response_length() by OSSL_HTTP_REQ_CTX_set_max_response_length(3).

            "},{"location":"man3/OCSP_sendreq_new/#return-values","title":"RETURN VALUES","text":"

            OCSP_sendreq_new() returns a valid OSSL_HTTP_REQ_CTX structure or NULL if an error occurred.

            OCSP_sendreq_nbio() returns 1 for success, 0 on error, -1 if retry is needed.

            OCSP_sendreq_bio() returns the OCSP_RESPONSE structure sent by the responder or NULL if an error occurred.

            "},{"location":"man3/OCSP_sendreq_new/#see-also","title":"SEE ALSO","text":"

            OSSL_HTTP_REQ_CTX(3), OSSL_HTTP_transfer(3), OCSP_cert_to_id(3), OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3), OCSP_resp_find_status(3), OCSP_response_status(3)

            "},{"location":"man3/OCSP_sendreq_new/#history","title":"HISTORY","text":"

            OCSP_REQ_CTX, OCSP_REQ_CTX_i2d(), OCSP_REQ_CTX_add1_header(), OCSP_REQ_CTX_free(), OCSP_set_max_response_length(), and OCSP_REQ_CTX_set1_req() were deprecated in OpenSSL 3.0.

            "},{"location":"man3/OCSP_sendreq_new/#copyright","title":"COPYRIGHT","text":"

            Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_Applink/","title":"OPENSSL_Applink","text":""},{"location":"man3/OPENSSL_Applink/#name","title":"NAME","text":"

            OPENSSL_Applink - glue between OpenSSL BIO and Win32 compiler run-time

            "},{"location":"man3/OPENSSL_Applink/#synopsis","title":"SYNOPSIS","text":"
            __declspec(dllexport) void **OPENSSL_Applink();\n
            "},{"location":"man3/OPENSSL_Applink/#description","title":"DESCRIPTION","text":"

            OPENSSL_Applink is application-side interface which provides a glue between OpenSSL BIO layer and Win32 compiler run-time environment. Even though it appears at application side, it's essentially OpenSSL private interface. For this reason application developers are not expected to implement it, but to compile provided module with compiler of their choice and link it into the target application. The referred module is available as applink.c, located alongside the public header files (only on the platforms where applicable).

            "},{"location":"man3/OPENSSL_Applink/#return-values","title":"RETURN VALUES","text":"

            Not available.

            "},{"location":"man3/OPENSSL_Applink/#copyright","title":"COPYRIGHT","text":"

            Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_FILE/","title":"OPENSSL_FILE","text":""},{"location":"man3/OPENSSL_FILE/#name","title":"NAME","text":"

            OPENSSL_FILE, OPENSSL_LINE, OPENSSL_FUNC, OPENSSL_MSTR, OPENSSL_MSTR_HELPER - generic C programming utility macros

            "},{"location":"man3/OPENSSL_FILE/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/macros.h>\n\n#define OPENSSL_FILE /* typically: __FILE__ */\n#define OPENSSL_LINE /* typically: __LINE__ */\n#define OPENSSL_FUNC /* typically: __func__ */\n\n#define OPENSSL_MSTR_HELPER(x) #x\n#define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x)\n
            "},{"location":"man3/OPENSSL_FILE/#description","title":"DESCRIPTION","text":"

            The macros OPENSSL_FILE and OPENSSL_LINE typically yield the current filename and line number during C compilation. When OPENSSL_NO_FILENAMES is defined they yield \"\" and 0, respectively.

            The macro OPENSSL_FUNC attempts to yield the name of the C function currently being compiled, as far as language and compiler versions allow. Otherwise, it yields \"(unknown function)\".

            The macro OPENSSL_MSTR yields the expansion of the macro given as argument, which is useful for concatenation with string constants. The macro OPENSSL_MSTR_HELPER is an auxiliary macro for this purpose.

            "},{"location":"man3/OPENSSL_FILE/#return-values","title":"RETURN VALUES","text":"

            see above

            "},{"location":"man3/OPENSSL_FILE/#see-also","title":"SEE ALSO","text":"

            crypto(7)

            "},{"location":"man3/OPENSSL_FILE/#history","title":"HISTORY","text":"

            OPENSSL_FUNC, OPENSSL_MSTR, and OPENSSL_MSTR_HELPER were added in OpenSSL 3.0.

            "},{"location":"man3/OPENSSL_FILE/#copyright","title":"COPYRIGHT","text":"

            Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/","title":"OPENSSL_LH_COMPFUNC","text":""},{"location":"man3/OPENSSL_LH_COMPFUNC/#name","title":"NAME","text":"

            LHASH, LHASH_OF, DEFINE_LHASH_OF_EX, DEFINE_LHASH_OF, OPENSSL_LH_COMPFUNC, OPENSSL_LH_HASHFUNC, OPENSSL_LH_DOALL_FUNC, LHASH_DOALL_ARG_FN_TYPE, IMPLEMENT_LHASH_HASH_FN, IMPLEMENT_LHASH_COMP_FN, lh_TYPE_new, lh_TYPE_free, lh_TYPE_flush, lh_TYPE_insert, lh_TYPE_delete, lh_TYPE_retrieve, lh_TYPE_doall, lh_TYPE_doall_arg, lh_TYPE_num_items, lh_TYPE_get_down_load, lh_TYPE_set_down_load, lh_TYPE_error, OPENSSL_LH_new, OPENSSL_LH_free, OPENSSL_LH_flush, OPENSSL_LH_insert, OPENSSL_LH_delete, OPENSSL_LH_retrieve, OPENSSL_LH_doall, OPENSSL_LH_doall_arg, OPENSSL_LH_num_items, OPENSSL_LH_get_down_load, OPENSSL_LH_set_down_load, OPENSSL_LH_error - dynamic hash table

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/lhash.h>\n\nLHASH_OF(TYPE)\n\nDEFINE_LHASH_OF_EX(TYPE);\n\nLHASH_OF(TYPE) *lh_TYPE_new(OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC compare);\nvoid lh_TYPE_free(LHASH_OF(TYPE) *table);\nvoid lh_TYPE_flush(LHASH_OF(TYPE) *table);\n\nTYPE *lh_TYPE_insert(LHASH_OF(TYPE) *table, TYPE *data);\nTYPE *lh_TYPE_delete(LHASH_OF(TYPE) *table, TYPE *data);\nTYPE *lh_TYPE_retrieve(LHASH_OF(TYPE) *table, TYPE *data);\n\nvoid lh_TYPE_doall(LHASH_OF(TYPE) *table, OPENSSL_LH_DOALL_FUNC func);\nvoid lh_TYPE_doall_arg(LHASH_OF(TYPE) *table, OPENSSL_LH_DOALL_FUNCARG func,\n                       TYPE *arg);\n\nunsigned long lh_TYPE_num_items(OPENSSL_LHASH *lh);\nunsigned long lh_TYPE_get_down_load(OPENSSL_LHASH *lh);\nvoid lh_TYPE_set_down_load(OPENSSL_LHASH *lh, unsigned long dl);\n\nint lh_TYPE_error(LHASH_OF(TYPE) *table);\n\ntypedef int (*OPENSSL_LH_COMPFUNC)(const void *, const void *);\ntypedef unsigned long (*OPENSSL_LH_HASHFUNC)(const void *);\ntypedef void (*OPENSSL_LH_DOALL_FUNC)(const void *);\ntypedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *);\n\nOPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c);\nvoid OPENSSL_LH_free(OPENSSL_LHASH *lh);\nvoid OPENSSL_LH_flush(OPENSSL_LHASH *lh);\n\nvoid *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data);\nvoid *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data);\nvoid *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data);\n\nvoid OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func);\nvoid OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg);\n\nunsigned long OPENSSL_LH_num_items(OPENSSL_LHASH *lh);\nunsigned long OPENSSL_LH_get_down_load(OPENSSL_LHASH *lh);\nvoid OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long dl);\n\nint OPENSSL_LH_error(OPENSSL_LHASH *lh);\n\n#define LH_LOAD_MULT   /* integer constant */\n

            The following macro is deprecated:

            DEFINE_LHASH_OF(TYPE);\n
            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#description","title":"DESCRIPTION","text":"

            This library implements type-checked dynamic hash tables. The hash table entries can be arbitrary structures. Usually they consist of key and value fields. In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes, such as SSL_SESSION.

            To define a new type-checked dynamic hash table, use DEFINE_LHASH_OF_EX(). DEFINE_LHASH_OF() was previously used for this purpose, but is now deprecated. The DEFINE_LHASH_OF_EX() macro provides all functionality of DEFINE_LHASH_OF() except for certain deprecated statistics functions (see OPENSSL_LH_stats(3)).

            lh_TYPE_new() creates a new LHASH_OF(TYPE) structure to store arbitrary data entries, and specifies the 'hash' and 'compare' callbacks to be used in organising the table's entries. The hash callback takes a pointer to a table entry as its argument and returns an unsigned long hash value for its key field. The hash value is normally truncated to a power of 2, so make sure that your hash function returns well mixed low order bits. The compare callback takes two arguments (pointers to two hash table entries), and returns 0 if their keys are equal, nonzero otherwise.

            If your hash table will contain items of some particular type and the hash and compare callbacks hash/compare these types, then the IMPLEMENT_LHASH_HASH_FN and IMPLEMENT_LHASH_COMP_FN macros can be used to create callback wrappers of the prototypes required by lh_TYPE_new() as shown in this example:

            /*\n * Implement the hash and compare functions; \"stuff\" can be any word.\n */\nstatic unsigned long stuff_hash(const TYPE *a)\n{\n    ...\n}\nstatic int stuff_cmp(const TYPE *a, const TYPE *b)\n{\n    ...\n}\n\n/*\n * Implement the wrapper functions.\n */\nstatic IMPLEMENT_LHASH_HASH_FN(stuff, TYPE)\nstatic IMPLEMENT_LHASH_COMP_FN(stuff, TYPE)\n

            If the type is going to be used in several places, the following macros can be used in a common header file to declare the function wrappers:

            DECLARE_LHASH_HASH_FN(stuff, TYPE)\nDECLARE_LHASH_COMP_FN(stuff, TYPE)\n

            Then a hash table of TYPE objects can be created using this:

            LHASH_OF(TYPE) *htable;\n\nhtable = B<lh_I<TYPE>_new>(LHASH_HASH_FN(stuff), LHASH_COMP_FN(stuff));\n

            lh_TYPE_free() frees the LHASH_OF(TYPE) structure table. Allocated hash table entries will not be freed; consider using lh_TYPE_doall() to deallocate any remaining entries in the hash table (see below). If the argument is NULL, nothing is done.

            lh_TYPE_flush() empties the LHASH_OF(TYPE) structure table. New entries can be added to the flushed table. Allocated hash table entries will not be freed; consider using lh_TYPE_doall() to deallocate any remaining entries in the hash table (see below).

            lh_TYPE_insert() inserts the structure pointed to by data into table. If there already is an entry with the same key, the old value is replaced. Note that lh_TYPE_insert() stores pointers, the data are not copied.

            lh_TYPE_delete() deletes an entry from table.

            lh_TYPE_retrieve() looks up an entry in table. Normally, data is a structure with the key field(s) set; the function will return a pointer to a fully populated structure.

            lh_TYPE_doall() will, for every entry in the hash table, call func with the data item as its parameter. For example:

            /* Cleans up resources belonging to 'a' (this is implemented elsewhere) */\nvoid TYPE_cleanup_doall(TYPE *a);\n\n/* Implement a prototype-compatible wrapper for \"TYPE_cleanup\" */\nIMPLEMENT_LHASH_DOALL_FN(TYPE_cleanup, TYPE)\n\n/* Call \"TYPE_cleanup\" against all items in a hash table. */\nlh_TYPE_doall(hashtable, LHASH_DOALL_FN(TYPE_cleanup));\n\n/* Then the hash table itself can be deallocated */\nlh_TYPE_free(hashtable);\n

            lh_TYPE_doall_arg() is the same as lh_TYPE_doall() except that func will be called with arg as the second argument and func should be of type LHASH_DOALL_ARG_FN(TYPE) (a callback prototype that is passed both the table entry and an extra argument). As with lh_doall(), you can instead choose to declare your callback with a prototype matching the types you are dealing with and use the declare/implement macros to create compatible wrappers that cast variables before calling your type-specific callbacks. An example of this is demonstrated here (printing all hash table entries to a BIO that is provided by the caller):

            /* Prints item 'a' to 'output_bio' (this is implemented elsewhere) */\nvoid TYPE_print_doall_arg(const TYPE *a, BIO *output_bio);\n\n/* Implement a prototype-compatible wrapper for \"TYPE_print\" */\nstatic IMPLEMENT_LHASH_DOALL_ARG_FN(TYPE, const TYPE, BIO)\n\n/* Print out the entire hashtable to a particular BIO */\nlh_TYPE_doall_arg(hashtable, LHASH_DOALL_ARG_FN(TYPE_print), BIO,\n                  logging_bio);\n

            Note that it is by default not safe to use lh_TYPE_delete() inside a callback passed to lh_TYPE_doall() or lh_TYPE_doall_arg(). The reason for this is that deleting an item from the hash table may result in the hash table being contracted to a smaller size and rehashed. lh_TYPE_doall() and lh_TYPE_doall_arg() are unsafe and will exhibit undefined behaviour under these conditions, as these functions assume the hash table size and bucket pointers do not change during the call.

            If it is desired to use lh_TYPE_doall() or lh_TYPE_doall_arg() with lh_TYPE_delete(), it is essential that you call lh_TYPE_set_down_load() with a down_load argument of 0 first. This disables hash table contraction and guarantees that it will be safe to delete items from a hash table during a call to lh_TYPE_doall() or lh_TYPE_doall_arg().

            It is never safe to call lh_TYPE_insert() during a call to lh_TYPE_doall() or lh_TYPE_doall_arg().

            lh_TYPE_error() can be used to determine if an error occurred in the last operation.

            lh_TYPE_num_items() returns the number of items in the hash table.

            lh_TYPE_get_down_load() and lh_TYPE_set_down_load() get and set the factor used to determine when the hash table is contracted. The factor is the load factor at or below which hash table contraction will occur, multiplied by LH_LOAD_MULT, where the load factor is the number of items divided by the number of nodes. Setting this value to 0 disables hash table contraction.

            OPENSSL_LH_new() is the same as the lh_TYPE_new() except that it is not type specific. So instead of returning an LHASH_OF(TYPE) value it returns a void *. In the same way the functions OPENSSL_LH_free(), OPENSSL_LH_flush(), OPENSSL_LH_insert(), OPENSSL_LH_delete(), OPENSSL_LH_retrieve(), OPENSSL_LH_doall(), OPENSSL_LH_doall_arg(), OPENSSL_LH_num_items(), OPENSSL_LH_get_down_load(), OPENSSL_LH_set_down_load() and OPENSSL_LH_error() are equivalent to the similarly named lh_TYPE functions except that they return or use a void * where the equivalent lh_TYPE function returns or uses a TYPE * or LHASH_OF(TYPE) *. lh_TYPE functions are implemented as type checked wrappers around the OPENSSL_LH functions. Most applications should not call the OPENSSL_LH functions directly.

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#return-values","title":"RETURN VALUES","text":"

            lh_TYPE_new() and OPENSSL_LH_new() return NULL on error, otherwise a pointer to the new LHASH structure.

            When a hash table entry is replaced, lh_TYPE_insert() or OPENSSL_LH_insert() return the value being replaced. NULL is returned on normal operation and on error.

            lh_TYPE_delete() and OPENSSL_LH_delete() return the entry being deleted. NULL is returned if there is no such value in the hash table.

            lh_TYPE_retrieve() and OPENSSL_LH_retrieve() return the hash table entry if it has been found, NULL otherwise.

            lh_TYPE_error() and OPENSSL_LH_error() return 1 if an error occurred in the last operation, 0 otherwise. It's meaningful only after non-retrieve operations.

            lh_TYPE_free(), OPENSSL_LH_free(), lh_TYPE_flush(), OPENSSL_LH_flush(), lh_TYPE_doall() OPENSSL_LH_doall(), lh_TYPE_doall_arg() and OPENSSL_LH_doall_arg() return no values.

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#note","title":"NOTE","text":"

            The LHASH code is not thread safe. All updating operations, as well as lh_TYPE_error() or OPENSSL_LH_error() calls must be performed under a write lock. All retrieve operations should be performed under a read lock, unless accurate usage statistics are desired. In which case, a write lock should be used for retrieve operations as well. For output of the usage statistics, using the functions from OPENSSL_LH_stats(3), a read lock suffices.

            The LHASH code regards table entries as constant data. As such, it internally represents lh_insert()'d items with a \"const void *\" pointer type. This is why callbacks such as those used by lh_doall() and lh_doall_arg() declare their prototypes with \"const\", even for the parameters that pass back the table items' data pointers - for consistency, user-provided data is \"const\" at all times as far as the LHASH code is concerned. However, as callers are themselves providing these pointers, they can choose whether they too should be treating all such parameters as constant.

            As an example, a hash table may be maintained by code that, for reasons of encapsulation, has only \"const\" access to the data being indexed in the hash table (i.e. it is returned as \"const\" from elsewhere in their code) - in this case the LHASH prototypes are appropriate as-is. Conversely, if the caller is responsible for the life-time of the data in question, then they may well wish to make modifications to table item passed back in the lh_doall() or lh_doall_arg() callbacks (see the \"TYPE_cleanup\" example above). If so, the caller can either cast the \"const\" away (if they're providing the raw callbacks themselves) or use the macros to declare/implement the wrapper functions without \"const\" types.

            Callers that only have \"const\" access to data they're indexing in a table, yet declare callbacks without constant types (or cast the \"const\" away themselves), are therefore creating their own risks/bugs without being encouraged to do so by the API. On a related note, those auditing code should pay special attention to any instances of DECLARE/IMPLEMENT_LHASH_DOALL_[ARG_]_FN macros that provide types without any \"const\" qualifiers.

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#bugs","title":"BUGS","text":"

            lh_TYPE_insert() and OPENSSL_LH_insert() return NULL both for success and error.

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#see-also","title":"SEE ALSO","text":"

            OPENSSL_LH_stats(3)

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#history","title":"HISTORY","text":"

            In OpenSSL 1.0.0, the lhash interface was revamped for better type checking.

            In OpenSSL 3.1, DEFINE_LHASH_OF_EX() was introduced and DEFINE_LHASH_OF() was deprecated.

            "},{"location":"man3/OPENSSL_LH_COMPFUNC/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_LH_stats/","title":"OPENSSL_LH_stats","text":""},{"location":"man3/OPENSSL_LH_stats/#name","title":"NAME","text":"

            OPENSSL_LH_stats, OPENSSL_LH_node_stats, OPENSSL_LH_node_usage_stats, OPENSSL_LH_stats_bio, OPENSSL_LH_node_stats_bio, OPENSSL_LH_node_usage_stats_bio - LHASH statistics

            "},{"location":"man3/OPENSSL_LH_stats/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/lhash.h>\n

            The following functions have been deprecated since OpenSSL 3.1, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            void OPENSSL_LH_node_stats(LHASH *table, FILE *out);\nvoid OPENSSL_LH_node_usage_stats(LHASH *table, FILE *out);\n\nvoid OPENSSL_LH_node_stats_bio(LHASH *table, BIO *out);\nvoid OPENSSL_LH_node_usage_stats_bio(LHASH *table, BIO *out);\n\nvoid OPENSSL_LH_stats(LHASH *table, FILE *out);\nvoid OPENSSL_LH_stats_bio(LHASH *table, BIO *out);\n
            "},{"location":"man3/OPENSSL_LH_stats/#description","title":"DESCRIPTION","text":"

            The LHASH structure records statistics about most aspects of accessing the hash table.

            OPENSSL_LH_stats() prints out statistics on the size of the hash table and how many entries are in it. For historical reasons, this function also outputs a number of additional statistics, but the tracking of these statistics is no longer supported and these statistics are always reported as zero.

            OPENSSL_LH_node_stats() prints the number of entries for each 'bucket' in the hash table.

            OPENSSL_LH_node_usage_stats() prints out a short summary of the state of the hash table. It prints the 'load' and the 'actual load'. The load is the average number of data items per 'bucket' in the hash table. The 'actual load' is the average number of items per 'bucket', but only for buckets which contain entries. So the 'actual load' is the average number of searches that will need to find an item in the hash table, while the 'load' is the average number that will be done to record a miss.

            OPENSSL_LH_stats_bio(), OPENSSL_LH_node_stats_bio() and OPENSSL_LH_node_usage_stats_bio() are the same as the above, except that the output goes to a BIO.

            These functions are deprecated and should no longer be used.

            "},{"location":"man3/OPENSSL_LH_stats/#return-values","title":"RETURN VALUES","text":"

            These functions do not return values.

            "},{"location":"man3/OPENSSL_LH_stats/#note","title":"NOTE","text":"

            These calls should be made under a read lock. Refer to \"NOTE\" in OPENSSL_LH_COMPFUNC(3) for more details about the locks required when using the LHASH data structure.

            "},{"location":"man3/OPENSSL_LH_stats/#see-also","title":"SEE ALSO","text":"

            bio(7), OPENSSL_LH_COMPFUNC(3)

            "},{"location":"man3/OPENSSL_LH_stats/#history","title":"HISTORY","text":"

            These functions were deprecated in version 3.1.

            "},{"location":"man3/OPENSSL_LH_stats/#copyright","title":"COPYRIGHT","text":"

            Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_config/","title":"OPENSSL_config","text":""},{"location":"man3/OPENSSL_config/#name","title":"NAME","text":"

            OPENSSL_config, OPENSSL_no_config - simple OpenSSL configuration functions

            "},{"location":"man3/OPENSSL_config/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/conf.h>\n

            The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            void OPENSSL_config(const char *appname);\nvoid OPENSSL_no_config(void);\n
            "},{"location":"man3/OPENSSL_config/#description","title":"DESCRIPTION","text":"

            OPENSSL_config() configures OpenSSL using the standard openssl.cnf and reads from the application section appname. If appname is NULL then the default section, openssl_conf, will be used. Errors are silently ignored. Multiple calls have no effect.

            OPENSSL_no_config() disables configuration. If called before OPENSSL_config() no configuration takes place.

            If the application is built with OPENSSL_LOAD_CONF defined, then a call to OpenSSL_add_all_algorithms() will implicitly call OPENSSL_config() first.

            "},{"location":"man3/OPENSSL_config/#notes","title":"NOTES","text":"

            The OPENSSL_config() function is designed to be a very simple \"call it and forget it\" function. It is however much better than nothing. Applications which need finer control over their configuration functionality should use the configuration functions such as CONF_modules_load() directly. This function is deprecated and its use should be avoided. Applications should instead call CONF_modules_load() during initialization (that is before starting any threads).

            There are several reasons why calling the OpenSSL configuration routines is advisable. For example, to load dynamic ENGINEs from shared libraries (DSOs). However, very few applications currently support the control interface and so very few can load and use dynamic ENGINEs. Equally in future more sophisticated ENGINEs will require certain control operations to customize them. If an application calls OPENSSL_config() it doesn't need to know or care about ENGINE control operations because they can be performed by editing a configuration file.

            "},{"location":"man3/OPENSSL_config/#environment","title":"ENVIRONMENT","text":"
            • OPENSSL_CONF

              The path to the config file. Ignored in set-user-ID and set-group-ID programs.

            "},{"location":"man3/OPENSSL_config/#return-values","title":"RETURN VALUES","text":"

            Neither OPENSSL_config() nor OPENSSL_no_config() return a value.

            "},{"location":"man3/OPENSSL_config/#see-also","title":"SEE ALSO","text":"

            config(5), CONF_modules_load_file(3)

            "},{"location":"man3/OPENSSL_config/#history","title":"HISTORY","text":"

            The OPENSSL_no_config() and OPENSSL_config() functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto().

            "},{"location":"man3/OPENSSL_config/#copyright","title":"COPYRIGHT","text":"

            Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_fork_prepare/","title":"OPENSSL_fork_prepare","text":""},{"location":"man3/OPENSSL_fork_prepare/#name","title":"NAME","text":"

            OPENSSL_fork_prepare, OPENSSL_fork_parent, OPENSSL_fork_child - OpenSSL fork handlers

            "},{"location":"man3/OPENSSL_fork_prepare/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/crypto.h>\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            void OPENSSL_fork_prepare(void);\nvoid OPENSSL_fork_parent(void);\nvoid OPENSSL_fork_child(void);\n
            "},{"location":"man3/OPENSSL_fork_prepare/#description","title":"DESCRIPTION","text":"

            These methods are currently unused, and as such, no replacement methods are required or planned.

            OpenSSL has state that should be reset when a process forks. For example, the entropy pool used to generate random numbers (and therefore encryption keys) should not be shared across multiple programs. The OPENSSL_fork_prepare(), OPENSSL_fork_parent(), and OPENSSL_fork_child() functions are used to reset this internal state.

            Platforms without fork(2) will probably not need to use these functions. Platforms with fork(2) but without pthread_atfork(3) will probably need to call them manually, as described in the following paragraph. Platforms such as Linux that have both functions will normally not need to call these functions as the OpenSSL library will do so automatically.

            OPENSSL_init_crypto(3) will register these functions with the appropriate handler, when the OPENSSL_INIT_ATFORK flag is used. For other applications, these functions can be called directly. They should be used according to the calling sequence described by the pthread_atfork(3) documentation, which is summarized here. OPENSSL_fork_prepare() should be called before a fork() is done. After the fork() returns, the parent process should call OPENSSL_fork_parent() and the child process should call OPENSSL_fork_child().

            "},{"location":"man3/OPENSSL_fork_prepare/#return-values","title":"RETURN VALUES","text":"

            OPENSSL_fork_prepare(), OPENSSL_fork_parent() and OPENSSL_fork_child() do not return values.

            "},{"location":"man3/OPENSSL_fork_prepare/#see-also","title":"SEE ALSO","text":"

            OPENSSL_init_crypto(3)

            "},{"location":"man3/OPENSSL_fork_prepare/#history","title":"HISTORY","text":"

            These functions were added in OpenSSL 1.1.1.

            "},{"location":"man3/OPENSSL_fork_prepare/#copyright","title":"COPYRIGHT","text":"

            Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_gmtime/","title":"OPENSSL_gmtime","text":""},{"location":"man3/OPENSSL_gmtime/#name","title":"NAME","text":"

            OPENSSL_gmtime, OPENSSL_gmtime_adj, OPENSSL_gmtime_diff - platform-agnostic OpenSSL time routines

            "},{"location":"man3/OPENSSL_gmtime/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/crypto.h>\n\nstruct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);\nint OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);\nint OPENSSL_gmtime_diff(int *pday, int *psec,\n                       const struct tm *from, const struct tm *to);\n
            "},{"location":"man3/OPENSSL_gmtime/#description","title":"DESCRIPTION","text":"

            OPENSSL_gmtime() returns the UTC time specified by timer into the provided result argument.

            OPENSSL_gmtime_adj() adds the offsets in offset_day and offset_sec to tm.

            OPENSSL_gmtime_diff() calculates the difference between from and to.

            "},{"location":"man3/OPENSSL_gmtime/#notes","title":"NOTES","text":"

            It is an error to call OPENSSL_gmtime() with result equal to NULL. The contents of the time_t given by timer are stored into the result. Calling with timer equal to NULL means use the current time.

            OPENSSL_gmtime_adj() converts tm into a days and seconds value, adds the offsets, then converts back into a struct tm specified by tm. Leap seconds are not considered.

            OPENSSL_gmtime_diff() calculates the difference between the two struct tm structures from and to. The difference in days is placed into *pday, the remaining seconds are placed to *psec. The value in *psec will be less than the number of seconds per day (3600). Leap seconds are not considered.

            "},{"location":"man3/OPENSSL_gmtime/#return-values","title":"RETURN VALUES","text":"

            OPENSSL_gmtime() returns NULL on error, or result on success.

            OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() return 0 on error, and 1 on success.

            "},{"location":"man3/OPENSSL_gmtime/#history","title":"HISTORY","text":"

            OPENSSL_gmtime(), OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() have been in OpenSSL since 1.0.0.

            "},{"location":"man3/OPENSSL_gmtime/#copyright","title":"COPYRIGHT","text":"

            Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_hexchar2int/","title":"OPENSSL_hexchar2int","text":""},{"location":"man3/OPENSSL_hexchar2int/#name","title":"NAME","text":"

            OPENSSL_hexchar2int, OPENSSL_hexstr2buf_ex, OPENSSL_hexstr2buf, OPENSSL_buf2hexstr_ex, OPENSSL_buf2hexstr - Hex encoding and decoding functions

            "},{"location":"man3/OPENSSL_hexchar2int/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/crypto.h>\n\nint OPENSSL_hexchar2int(unsigned char c);\nint OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, long *buflen,\n                          const char *str, const char sep);\nunsigned char *OPENSSL_hexstr2buf(const char *str, long *len);\nint OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength,\n                          const unsigned char *buf, long buflen,\n                          const char sep);\nchar *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);\n
            "},{"location":"man3/OPENSSL_hexchar2int/#description","title":"DESCRIPTION","text":"

            OPENSSL_hexchar2int() converts a hexadecimal character to its numeric equivalent.

            OPENSSL_hexstr2buf_ex() decodes the hex string str and places the resulting string of bytes in the given buf. The character sep is the separator between the bytes, setting this to '\\0' means that there is no separator. buf_n gives the size of the buffer. If buflen is not NULL, it is filled in with the result length. To find out how large the result will be, call this function with NULL for buf. Colons between two-character hex \"bytes\" are accepted and ignored. An odd number of hex digits is an error.

            OPENSSL_hexstr2buf() does the same thing as OPENSSL_hexstr2buf_ex(), but allocates the space for the result, and returns the result. It uses a default separator of ':'. The memory is allocated by calling OPENSSL_malloc() and should be released by calling OPENSSL_free().

            OPENSSL_buf2hexstr_ex() encodes the contents of the given buf with length buflen and places the resulting hexadecimal character string in the given str. The character sep is the separator between the bytes, setting this to '\\0' means that there is no separator. str_n gives the size of the of the string buffer. If strlength is not NULL, it is filled in with the result length. To find out how large the result will be, call this function with NULL for str.

            OPENSSL_buf2hexstr() does the same thing as OPENSSL_buf2hexstr_ex(), but allocates the space for the result, and returns the result. It uses a default separator of ':'. The memory is allocated by calling OPENSSL_malloc() and should be released by calling OPENSSL_free().

            "},{"location":"man3/OPENSSL_hexchar2int/#return-values","title":"RETURN VALUES","text":"

            OPENSSL_hexchar2int returns the value of a decoded hex character, or -1 on error.

            OPENSSL_buf2hexstr() and OPENSSL_hexstr2buf() return a pointer to allocated memory, or NULL on error.

            OPENSSL_buf2hexstr_ex() and OPENSSL_hexstr2buf_ex() return 1 on success, or 0 on error.

            "},{"location":"man3/OPENSSL_hexchar2int/#copyright","title":"COPYRIGHT","text":"

            Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_ia32cap/","title":"OPENSSL_ia32cap","text":""},{"location":"man3/OPENSSL_ia32cap/#name","title":"NAME","text":"

            OPENSSL_ia32cap - the x86[_64] processor capabilities vector

            "},{"location":"man3/OPENSSL_ia32cap/#synopsis","title":"SYNOPSIS","text":"
            env OPENSSL_ia32cap=... <application>\n
            "},{"location":"man3/OPENSSL_ia32cap/#description","title":"DESCRIPTION","text":"

            OpenSSL supports a range of x86[_64] instruction set extensions. These extensions are denoted by individual bits in capability vector returned by processor in EDX:ECX register pair after executing CPUID instruction with EAX=1 input value (see Intel Application Note #241618). This vector is copied to memory upon toolkit initialization and used to choose between different code paths to provide optimal performance across wide range of processors. For the moment of this writing following bits are significant:

            • bit #4 denoting presence of Time-Stamp Counter.
            • bit #19 denoting availability of CLFLUSH instruction;
            • bit #20, reserved by Intel, is used to choose among RC4 code paths;
            • bit #23 denoting MMX support;
            • bit #24, FXSR bit, denoting availability of XMM registers;
            • bit #25 denoting SSE support;
            • bit #26 denoting SSE2 support;
            • bit #28 denoting Hyperthreading, which is used to distinguish cores with shared cache;
            • bit #30, reserved by Intel, denotes specifically Intel CPUs;
            • bit #33 denoting availability of PCLMULQDQ instruction;
            • bit #41 denoting SSSE3, Supplemental SSE3, support;
            • bit #43 denoting AMD XOP support (forced to zero on non-AMD CPUs);
            • bit #54 denoting availability of MOVBE instruction;
            • bit #57 denoting AES-NI instruction set extension;
            • bit #58, XSAVE bit, lack of which in combination with MOVBE is used to identify Atom Silvermont core;
            • bit #59, OSXSAVE bit, denoting availability of YMM registers;
            • bit #60 denoting AVX extension;
            • bit #62 denoting availability of RDRAND instruction;

            For example, in 32-bit application context clearing bit #26 at run-time disables high-performance SSE2 code present in the crypto library, while clearing bit #24 disables SSE2 code operating on 128-bit XMM register bank. You might have to do the latter if target OpenSSL application is executed on SSE2 capable CPU, but under control of OS that does not enable XMM registers. Historically address of the capability vector copy was exposed to application through OPENSSL_ia32cap_loc(), but not anymore. Now the only way to affect the capability detection is to set OPENSSL_ia32cap environment variable prior target application start. To give a specific example, on Intel P4 processor env OPENSSL_ia32cap=0x16980010 apps/openssl, or better yet env OPENSSL_ia32cap=~0x1000000 apps/openssl would achieve the desired effect. Alternatively you can reconfigure the toolkit with no-sse2 option and recompile.

            Less intuitive is clearing bit #28, or ~0x10000000 in the \"environment variable\" terms. The truth is that it's not copied from CPUID output verbatim, but is adjusted to reflect whether or not the data cache is actually shared between logical cores. This in turn affects the decision on whether or not expensive countermeasures against cache-timing attacks are applied, most notably in AES assembler module.

            The capability vector is further extended with EBX value returned by CPUID with EAX=7 and ECX=0 as input. Following bits are significant:

            • bit #64+3 denoting availability of BMI1 instructions, e.g. ANDN;
            • bit #64+5 denoting availability of AVX2 instructions;
            • bit #64+8 denoting availability of BMI2 instructions, e.g. MULX and RORX;
            • bit #64+16 denoting availability of AVX512F extension;
            • bit #64+17 denoting availability of AVX512DQ extension;
            • bit #64+18 denoting availability of RDSEED instruction;
            • bit #64+19 denoting availability of ADCX and ADOX instructions;
            • bit #64+21 denoting availability of VPMADD52[LH]UQ instructions, aka AVX512IFMA extension;
            • bit #64+29 denoting availability of SHA extension;
            • bit #64+30 denoting availability of AVX512BW extension;
            • bit #64+31 denoting availability of AVX512VL extension;
            • bit #64+41 denoting availability of VAES extension;
            • bit #64+42 denoting availability of VPCLMULQDQ extension;

            To control this extended capability word use : as delimiter when setting up OPENSSL_ia32cap environment variable. For example assigning :~0x20 would disable AVX2 code paths, and :0 - all post-AVX extensions.

            "},{"location":"man3/OPENSSL_ia32cap/#return-values","title":"RETURN VALUES","text":"

            Not available.

            "},{"location":"man3/OPENSSL_ia32cap/#copyright","title":"COPYRIGHT","text":"

            Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_init_crypto/","title":"OPENSSL_init_crypto","text":""},{"location":"man3/OPENSSL_init_crypto/#name","title":"NAME","text":"

            OPENSSL_INIT_new, OPENSSL_INIT_set_config_filename, OPENSSL_INIT_set_config_appname, OPENSSL_INIT_set_config_file_flags, OPENSSL_INIT_free, OPENSSL_init_crypto, OPENSSL_cleanup, OPENSSL_atexit, OPENSSL_thread_stop_ex, OPENSSL_thread_stop - OpenSSL initialisation and deinitialisation functions

            "},{"location":"man3/OPENSSL_init_crypto/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/crypto.h>\n\nvoid OPENSSL_cleanup(void);\nint OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);\nint OPENSSL_atexit(void (*handler)(void));\nvoid OPENSSL_thread_stop_ex(OSSL_LIB_CTX *ctx);\nvoid OPENSSL_thread_stop(void);\n\nOPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);\nint OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *init,\n                                     const char* filename);\nint OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *init,\n                                       unsigned long flags);\nint OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *init,\n                                    const char* name);\nvoid OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *init);\n
            "},{"location":"man3/OPENSSL_init_crypto/#description","title":"DESCRIPTION","text":"

            During normal operation OpenSSL (libcrypto) will allocate various resources at start up that must, subsequently, be freed on close down of the library. Additionally some resources are allocated on a per thread basis (if the application is multi-threaded), and these resources must be freed prior to the thread closing.

            As of version 1.1.0 OpenSSL will automatically allocate all resources that it needs so no explicit initialisation is required. Similarly it will also automatically deinitialise as required.

            However, there may be situations when explicit initialisation is desirable or needed, for example when some nondefault initialisation is required. The function OPENSSL_init_crypto() can be used for this purpose for libcrypto (see also OPENSSL_init_ssl(3) for the libssl equivalent).

            Numerous internal OpenSSL functions call OPENSSL_init_crypto(). Therefore, in order to perform nondefault initialisation, OPENSSL_init_crypto() MUST be called by application code prior to any other OpenSSL function calls.

            The opts parameter specifies which aspects of libcrypto should be initialised. Valid options are:

            • OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS

              Suppress automatic loading of the libcrypto error strings. This option is not a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_LOAD_CRYPTO_STRINGS will be ignored.

            • OPENSSL_INIT_LOAD_CRYPTO_STRINGS

              Automatic loading of the libcrypto error strings. With this option the library will automatically load the libcrypto error strings. This option is a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS will be ignored.

            • OPENSSL_INIT_ADD_ALL_CIPHERS

              With this option the library will automatically load and make available all libcrypto ciphers. This option is a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_NO_ADD_ALL_CIPHERS will be ignored.

            • OPENSSL_INIT_ADD_ALL_DIGESTS

              With this option the library will automatically load and make available all libcrypto digests. This option is a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_NO_ADD_ALL_DIGESTS will be ignored.

            • OPENSSL_INIT_NO_ADD_ALL_CIPHERS

              With this option the library will suppress automatic loading of libcrypto ciphers. This option is not a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_ADD_ALL_CIPHERS will be ignored.

            • OPENSSL_INIT_NO_ADD_ALL_DIGESTS

              With this option the library will suppress automatic loading of libcrypto digests. This option is not a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_ADD_ALL_DIGESTS will be ignored.

            • OPENSSL_INIT_LOAD_CONFIG

              With this option an OpenSSL configuration file will be automatically loaded and used by calling OPENSSL_config(). This is a default option. Note that in OpenSSL 1.1.1 this was the default for libssl but not for libcrypto (see OPENSSL_init_ssl(3) for further details about libssl initialisation). In OpenSSL 1.1.0 this was a nondefault option for both libssl and libcrypto. See the description of OPENSSL_INIT_new(), below.

            • OPENSSL_INIT_NO_LOAD_CONFIG

              With this option the loading of OpenSSL configuration files will be suppressed. It is the equivalent of calling OPENSSL_no_config(). This is not a default option.

            • OPENSSL_INIT_ASYNC

              With this option the library with automatically initialise the libcrypto async sub-library (see ASYNC_start_job(3)). This is a default option.

            • OPENSSL_INIT_ENGINE_RDRAND

              With this option the library will automatically load and initialise the RDRAND engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ENGINE_DYNAMIC

              With this option the library will automatically load and initialise the dynamic engine. This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ENGINE_OPENSSL

              With this option the library will automatically load and initialise the openssl engine. This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ENGINE_CRYPTODEV

              With this option the library will automatically load and initialise the cryptodev engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ENGINE_CAPI

              With this option the library will automatically load and initialise the CAPI engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ENGINE_PADLOCK

              With this option the library will automatically load and initialise the padlock engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ENGINE_AFALG

              With this option the library will automatically load and initialise the AFALG engine. This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ENGINE_ALL_BUILTIN

              With this option the library will automatically load and initialise all the built in engines listed above with the exception of the openssl and afalg engines. This not a default option and is deprecated in OpenSSL 3.0.

            • OPENSSL_INIT_ATFORK

              With this option the library will register its fork handlers. See OPENSSL_fork_prepare(3) for details.

            • OPENSSL_INIT_NO_ATEXIT

              By default OpenSSL will attempt to clean itself up when the process exits via an \"atexit\" handler. Using this option suppresses that behaviour. This means that the application will have to clean up OpenSSL explicitly using OPENSSL_cleanup().

            Multiple options may be combined together in a single call to OPENSSL_init_crypto(). For example:

            OPENSSL_init_crypto(OPENSSL_INIT_NO_ADD_ALL_CIPHERS\n                    | OPENSSL_INIT_NO_ADD_ALL_DIGESTS, NULL);\n

            The OPENSSL_cleanup() function deinitialises OpenSSL (both libcrypto and libssl). All resources allocated by OpenSSL are freed. Typically there should be no need to call this function directly as it is initiated automatically on application exit. This is done via the standard C library atexit() function. In the event that the application will close in a manner that will not call the registered atexit() handlers then the application should call OPENSSL_cleanup() directly. Developers of libraries using OpenSSL are discouraged from calling this function and should instead, typically, rely on auto-deinitialisation. This is to avoid error conditions where both an application and a library it depends on both use OpenSSL, and the library deinitialises it before the application has finished using it.

            Once OPENSSL_cleanup() has been called the library cannot be reinitialised. Attempts to call OPENSSL_init_crypto() will fail and an ERR_R_INIT_FAIL error will be added to the error stack. Note that because initialisation has failed OpenSSL error strings will not be available, only an error code. This code can be put through the openssl errstr command line application to produce a human readable error (see openssl-errstr(1)).

            The OPENSSL_atexit() function enables the registration of a function to be called during OPENSSL_cleanup(). Stop handlers are called after deinitialisation of resources local to a thread, but before other process wide resources are freed. In the event that multiple stop handlers are registered, no guarantees are made about the order of execution.

            The OPENSSL_thread_stop_ex() function deallocates resources associated with the current thread for the given OSSL_LIB_CTX ctx. The ctx parameter can be NULL in which case the default OSSL_LIB_CTX is used.

            Typically, this function will be called automatically by the library when the thread exits as long as the OSSL_LIB_CTX has not been freed before the thread exits. If OSSL_LIB_CTX_free() is called OPENSSL_thread_stop_ex will be called automatically for the current thread (but not any other threads that may have used this OSSL_LIB_CTX).

            OPENSSL_thread_stop_ex should be called on all threads that will exit after the OSSL_LIB_CTX is freed. Typically this is not necessary for the default OSSL_LIB_CTX (because all resources are cleaned up on library exit) except if thread local resources should be freed before library exit, or under the circumstances described in the NOTES section below.

            OPENSSL_thread_stop() is the same as OPENSSL_thread_stop_ex() except that the default OSSL_LIB_CTX is always used.

            The OPENSSL_INIT_LOAD_CONFIG flag will load a configuration file, as with CONF_modules_load_file(3) with NULL filename and application name and the CONF_MFLAGS_IGNORE_MISSING_FILE, CONF_MFLAGS_IGNORE_RETURN_CODES and CONF_MFLAGS_DEFAULT_SECTION flags. The filename, application name, and flags can be customized by providing a non-null OPENSSL_INIT_SETTINGS object. The object can be allocated via OPENSSL_INIT_new(). The OPENSSL_INIT_set_config_filename() function can be used to specify a nondefault filename, which is copied and need not refer to persistent storage. Similarly, OPENSSL_INIT_set_config_appname() can be used to specify a nondefault application name. Finally, OPENSSL_INIT_set_file_flags can be used to specify nondefault flags. If the CONF_MFLAGS_IGNORE_RETURN_CODES flag is not included, any errors in the configuration file will cause an error return from OPENSSL_init_crypto or indirectly OPENSSL_init_ssl(3). The object can be released with OPENSSL_INIT_free() when done. If the argument to OPENSSL_INIT_free() is NULL, nothing is done.

            "},{"location":"man3/OPENSSL_init_crypto/#notes","title":"NOTES","text":"

            Resources local to a thread are deallocated automatically when the thread exits (e.g. in a pthreads environment, when pthread_exit() is called). On Windows platforms this is done in response to a DLL_THREAD_DETACH message being sent to the libcrypto32.dll entry point. Some windows functions may cause threads to exit without sending this message (for example ExitProcess()). If the application uses such functions, then the application must free up OpenSSL resources directly via a call to OPENSSL_thread_stop() on each thread. Similarly this message will also not be sent if OpenSSL is linked statically, and therefore applications using static linking should also call OPENSSL_thread_stop() on each thread. Additionally if OpenSSL is loaded dynamically via LoadLibrary() and the threads are not destroyed until after FreeLibrary() is called then each thread should call OPENSSL_thread_stop() prior to the FreeLibrary() call.

            On Linux/Unix where OpenSSL has been loaded via dlopen() and the application is multi-threaded and if dlclose() is subsequently called prior to the threads being destroyed then OpenSSL will not be able to deallocate resources associated with those threads. The application should either call OPENSSL_thread_stop() on each thread prior to the dlclose() call, or alternatively the original dlopen() call should use the RTLD_NODELETE flag (where available on the platform).

            "},{"location":"man3/OPENSSL_init_crypto/#return-values","title":"RETURN VALUES","text":"

            The functions OPENSSL_init_crypto, OPENSSL_atexit() and OPENSSL_INIT_set_config_appname() return 1 on success or 0 on error.

            "},{"location":"man3/OPENSSL_init_crypto/#see-also","title":"SEE ALSO","text":"

            OPENSSL_init_ssl(3)

            "},{"location":"man3/OPENSSL_init_crypto/#history","title":"HISTORY","text":"

            The OPENSSL_init_crypto(), OPENSSL_cleanup(), OPENSSL_atexit(), OPENSSL_thread_stop(), OPENSSL_INIT_new(), OPENSSL_INIT_set_config_appname() and OPENSSL_INIT_free() functions were added in OpenSSL 1.1.0.

            "},{"location":"man3/OPENSSL_init_crypto/#copyright","title":"COPYRIGHT","text":"

            Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_init_ssl/","title":"OPENSSL_init_ssl","text":""},{"location":"man3/OPENSSL_init_ssl/#name","title":"NAME","text":"

            OPENSSL_init_ssl - OpenSSL (libssl and libcrypto) initialisation

            "},{"location":"man3/OPENSSL_init_ssl/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/ssl.h>\n\nint OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);\n
            "},{"location":"man3/OPENSSL_init_ssl/#description","title":"DESCRIPTION","text":"

            During normal operation OpenSSL (libssl and libcrypto) will allocate various resources at start up that must, subsequently, be freed on close down of the library. Additionally some resources are allocated on a per thread basis (if the application is multi-threaded), and these resources must be freed prior to the thread closing.

            As of version 1.1.0 OpenSSL will automatically allocate all resources that it needs so no explicit initialisation is required. Similarly it will also automatically deinitialise as required.

            However, there may be situations when explicit initialisation is desirable or needed, for example when some nondefault initialisation is required. The function OPENSSL_init_ssl() can be used for this purpose. Calling this function will explicitly initialise BOTH libcrypto and libssl. To explicitly initialise ONLY libcrypto see the OPENSSL_init_crypto(3) function.

            Numerous internal OpenSSL functions call OPENSSL_init_ssl(). Therefore, in order to perform nondefault initialisation, OPENSSL_init_ssl() MUST be called by application code prior to any other OpenSSL function calls.

            The opts parameter specifies which aspects of libssl and libcrypto should be initialised. Valid options for libcrypto are described on the OPENSSL_init_crypto(3) page. In addition to any libcrypto specific option the following libssl options can also be used:

            • OPENSSL_INIT_NO_LOAD_SSL_STRINGS

              Suppress automatic loading of the libssl error strings. This option is not a default option. Once selected subsequent calls to OPENSSL_init_ssl() with the option OPENSSL_INIT_LOAD_SSL_STRINGS will be ignored.

            • OPENSSL_INIT_LOAD_SSL_STRINGS

              Automatic loading of the libssl error strings. This option is a default option. Once selected subsequent calls to OPENSSL_init_ssl() with the option OPENSSL_INIT_LOAD_SSL_STRINGS will be ignored.

            OPENSSL_init_ssl() takes a settings parameter which can be used to set parameter values. See OPENSSL_init_crypto(3) for details.

            "},{"location":"man3/OPENSSL_init_ssl/#return-values","title":"RETURN VALUES","text":"

            The function OPENSSL_init_ssl() returns 1 on success or 0 on error.

            "},{"location":"man3/OPENSSL_init_ssl/#see-also","title":"SEE ALSO","text":"

            OPENSSL_init_crypto(3)

            "},{"location":"man3/OPENSSL_init_ssl/#history","title":"HISTORY","text":"

            The OPENSSL_init_ssl() function was added in OpenSSL 1.1.0.

            "},{"location":"man3/OPENSSL_init_ssl/#copyright","title":"COPYRIGHT","text":"

            Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_instrument_bus/","title":"OPENSSL_instrument_bus","text":""},{"location":"man3/OPENSSL_instrument_bus/#name","title":"NAME","text":"

            OPENSSL_instrument_bus, OPENSSL_instrument_bus2 - instrument references to memory bus

            "},{"location":"man3/OPENSSL_instrument_bus/#synopsis","title":"SYNOPSIS","text":"
            #ifdef OPENSSL_CPUID_OBJ\nsize_t OPENSSL_instrument_bus(unsigned int *vector, size_t num);\nsize_t OPENSSL_instrument_bus2(unsigned int *vector, size_t num, size_t max);\n#endif\n
            "},{"location":"man3/OPENSSL_instrument_bus/#description","title":"DESCRIPTION","text":"

            It was empirically found that timings of references to primary memory are subject to irregular, apparently non-deterministic variations. The subroutines in question instrument these references for purposes of gathering randomness for random number generator. In order to make it bus-bound a 'flush cache line' instruction is used between probes. In addition probes are added to vector elements in atomic or interlocked manner, which should contribute additional noise on multi-processor systems. This also means that vector[num] should be zeroed upon invocation (if you want to retrieve actual probe values).

            OPENSSL_instrument_bus() performs num probes and records the number of oscillator cycles every probe took.

            OPENSSL_instrument_bus2() on the other hand accumulates consecutive probes with the same value, i.e. in a way it records duration of periods when probe values appeared deterministic. The subroutine performs at most max probes in attempt to fill the vector[num], with max value of 0 meaning \"as many as it takes.\"

            "},{"location":"man3/OPENSSL_instrument_bus/#return-values","title":"RETURN VALUES","text":"

            Return value of 0 indicates that CPU is not capable of performing the benchmark, either because oscillator counter or 'flush cache line' is not available on current platform. For reference, on x86 'flush cache line' was introduced with the SSE2 extensions.

            Otherwise number of recorded values is returned.

            "},{"location":"man3/OPENSSL_instrument_bus/#copyright","title":"COPYRIGHT","text":"

            Copyright 2011-2021 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_load_builtin_modules/","title":"OPENSSL_load_builtin_modules","text":""},{"location":"man3/OPENSSL_load_builtin_modules/#name","title":"NAME","text":"

            OPENSSL_load_builtin_modules, ASN1_add_oid_module, ENGINE_add_conf_module - add standard configuration modules

            "},{"location":"man3/OPENSSL_load_builtin_modules/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/conf.h>\n\nvoid OPENSSL_load_builtin_modules(void);\nvoid ASN1_add_oid_module(void);\nvoid ENGINE_add_conf_module(void);\n
            "},{"location":"man3/OPENSSL_load_builtin_modules/#description","title":"DESCRIPTION","text":"

            The function OPENSSL_load_builtin_modules() adds all the standard OpenSSL configuration modules to the internal list. They can then be used by the OpenSSL configuration code.

            ASN1_add_oid_module() adds just the ASN1 OBJECT module.

            ENGINE_add_conf_module() adds just the ENGINE configuration module.

            "},{"location":"man3/OPENSSL_load_builtin_modules/#notes","title":"NOTES","text":"

            If the simple configuration function OPENSSL_config() is called then OPENSSL_load_builtin_modules() is called automatically.

            Applications which use the configuration functions directly will need to call OPENSSL_load_builtin_modules() themselves before any other configuration code.

            Applications should call OPENSSL_load_builtin_modules() to load all configuration modules instead of adding modules selectively: otherwise functionality may be missing from the application if an when new modules are added.

            "},{"location":"man3/OPENSSL_load_builtin_modules/#return-values","title":"RETURN VALUES","text":"

            None of the functions return a value.

            "},{"location":"man3/OPENSSL_load_builtin_modules/#see-also","title":"SEE ALSO","text":"

            config(5), OPENSSL_config(3)

            "},{"location":"man3/OPENSSL_load_builtin_modules/#history","title":"HISTORY","text":"

            ENGINE_add_conf_module() was deprecated in OpenSSL 3.0.

            "},{"location":"man3/OPENSSL_load_builtin_modules/#copyright","title":"COPYRIGHT","text":"

            Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_malloc/","title":"OPENSSL_malloc","text":""},{"location":"man3/OPENSSL_malloc/#name","title":"NAME","text":"

            OPENSSL_malloc_init, OPENSSL_malloc, OPENSSL_zalloc, OPENSSL_realloc, OPENSSL_free, OPENSSL_clear_realloc, OPENSSL_clear_free, OPENSSL_cleanse, CRYPTO_malloc, CRYPTO_zalloc, CRYPTO_realloc, CRYPTO_free, OPENSSL_strdup, OPENSSL_strndup, OPENSSL_memdup, OPENSSL_strlcpy, OPENSSL_strlcat, CRYPTO_strdup, CRYPTO_strndup, OPENSSL_mem_debug_push, OPENSSL_mem_debug_pop, CRYPTO_mem_debug_push, CRYPTO_mem_debug_pop, CRYPTO_clear_realloc, CRYPTO_clear_free, CRYPTO_malloc_fn, CRYPTO_realloc_fn, CRYPTO_free_fn, CRYPTO_get_mem_functions, CRYPTO_set_mem_functions, CRYPTO_get_alloc_counts, CRYPTO_set_mem_debug, CRYPTO_mem_ctrl, CRYPTO_mem_leaks, CRYPTO_mem_leaks_fp, CRYPTO_mem_leaks_cb, OPENSSL_MALLOC_FAILURES, OPENSSL_MALLOC_FD - Memory allocation functions

            "},{"location":"man3/OPENSSL_malloc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/crypto.h>\n\nint OPENSSL_malloc_init(void);\n\nvoid *OPENSSL_malloc(size_t num);\nvoid *OPENSSL_zalloc(size_t num);\nvoid *OPENSSL_realloc(void *addr, size_t num);\nvoid OPENSSL_free(void *addr);\nchar *OPENSSL_strdup(const char *str);\nchar *OPENSSL_strndup(const char *str, size_t s);\nsize_t OPENSSL_strlcat(char *dst, const char *src, size_t size);\nsize_t OPENSSL_strlcpy(char *dst, const char *src, size_t size);\nvoid *OPENSSL_memdup(void *data, size_t s);\nvoid *OPENSSL_clear_realloc(void *p, size_t old_len, size_t num);\nvoid OPENSSL_clear_free(void *str, size_t num);\nvoid OPENSSL_cleanse(void *ptr, size_t len);\n\nvoid *CRYPTO_malloc(size_t num, const char *file, int line);\nvoid *CRYPTO_zalloc(size_t num, const char *file, int line);\nvoid *CRYPTO_realloc(void *p, size_t num, const char *file, int line);\nvoid CRYPTO_free(void *str, const char *, int);\nchar *CRYPTO_strdup(const char *p, const char *file, int line);\nchar *CRYPTO_strndup(const char *p, size_t num, const char *file, int line);\nvoid *CRYPTO_clear_realloc(void *p, size_t old_len, size_t num,\n                           const char *file, int line);\nvoid CRYPTO_clear_free(void *str, size_t num, const char *, int);\n\ntypedef void *(*CRYPTO_malloc_fn)(size_t num, const char *file, int line);\ntypedef void *(*CRYPTO_realloc_fn)(void *addr, size_t num, const char *file,\n                                   int line);\ntypedef void (*CRYPTO_free_fn)(void *addr, const char *file, int line);\nvoid CRYPTO_get_mem_functions(CRYPTO_malloc_fn *malloc_fn,\n                              CRYPTO_realloc_fn *realloc_fn,\n                              CRYPTO_free_fn *free_fn);\nint CRYPTO_set_mem_functions(CRYPTO_malloc_fn malloc_fn,\n                             CRYPTO_realloc_fn realloc_fn,\n                             CRYPTO_free_fn free_fn);\n\nvoid CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount);\n\nenv OPENSSL_MALLOC_FAILURES=... <application>\nenv OPENSSL_MALLOC_FD=... <application>\n

            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

            int CRYPTO_mem_leaks(BIO *b);\nint CRYPTO_mem_leaks_fp(FILE *fp);\nint CRYPTO_mem_leaks_cb(int (*cb)(const char *str, size_t len, void *u),\n                        void *u);\n\nint CRYPTO_set_mem_debug(int onoff);\nint CRYPTO_mem_ctrl(int mode);\nint OPENSSL_mem_debug_push(const char *info);\nint OPENSSL_mem_debug_pop(void);\nint CRYPTO_mem_debug_push(const char *info, const char *file, int line);\nint CRYPTO_mem_debug_pop(void);\n
            "},{"location":"man3/OPENSSL_malloc/#description","title":"DESCRIPTION","text":"

            OpenSSL memory allocation is handled by the OPENSSL_xxx API. These are generally macro's that add the standard C __FILE__ and __LINE__ parameters and call a lower-level CRYPTO_xxx API. Some functions do not add those parameters, but exist for consistency.

            OPENSSL_malloc_init() does nothing and does not need to be called. It is included for compatibility with older versions of OpenSSL.

            OPENSSL_malloc(), OPENSSL_realloc(), and OPENSSL_free() are like the C malloc(), realloc(), and free() functions. OPENSSL_zalloc() calls memset() to zero the memory before returning.

            OPENSSL_clear_realloc() and OPENSSL_clear_free() should be used when the buffer at addr holds sensitive information. The old buffer is filled with zero's by calling OPENSSL_cleanse() before ultimately calling OPENSSL_free(). If the argument to OPENSSL_free() is NULL, nothing is done.

            OPENSSL_cleanse() fills ptr of size len with a string of 0's. Use OPENSSL_cleanse() with care if the memory is a mapping of a file. If the storage controller uses write compression, then it's possible that sensitive tail bytes will survive zeroization because the block of zeros will be compressed. If the storage controller uses wear leveling, then the old sensitive data will not be overwritten; rather, a block of 0's will be written at a new physical location.

            OPENSSL_strdup(), OPENSSL_strndup() and OPENSSL_memdup() are like the equivalent C functions, except that memory is allocated by calling the OPENSSL_malloc() and should be released by calling OPENSSL_free().

            OPENSSL_strlcpy(), OPENSSL_strlcat() and OPENSSL_strnlen() are equivalents of the common C library functions and are provided for portability.

            If no allocations have been done, it is possible to \"swap out\" the default implementations for OPENSSL_malloc(), OPENSSL_realloc() and OPENSSL_free() and replace them with alternate versions. CRYPTO_get_mem_functions() function fills in the given arguments with the function pointers for the current implementations. With CRYPTO_set_mem_functions(), you can specify a different set of functions. If any of malloc_fn, realloc_fn, or free_fn are NULL, then the function is not changed. While it's permitted to swap out only a few and not all the functions with CRYPTO_set_mem_functions(), it's recommended to swap them all out at once.

            If the library is built with the crypto-mdebug option, then one function, CRYPTO_get_alloc_counts(), and two additional environment variables, OPENSSL_MALLOC_FAILURES and OPENSSL_MALLOC_FD, are available.

            The function CRYPTO_get_alloc_counts() fills in the number of times each of CRYPTO_malloc(), CRYPTO_realloc(), and CRYPTO_free() have been called, into the values pointed to by mcount, rcount, and fcount, respectively. If a pointer is NULL, then the corresponding count is not stored.

            The variable OPENSSL_MALLOC_FAILURES controls how often allocations should fail. It is a set of fields separated by semicolons, which each field is a count (defaulting to zero) and an optional atsign and percentage (defaulting to 100). If the count is zero, then it lasts forever. For example, 100;@25 or 100@0;0@25 means the first 100 allocations pass, then all other allocations (until the program exits or crashes) have a 25% chance of failing.

            If the variable OPENSSL_MALLOC_FD is parsed as a positive integer, then it is taken as an open file descriptor. This is used in conjunction with OPENSSL_MALLOC_FAILURES described above. For every allocation it will log details about how many allocations there have been so far, what percentage chance there is for this allocation failing, and whether it has actually failed. The following example in classic shell syntax shows how to use this (will not work on all platforms):

            OPENSSL_MALLOC_FAILURES='200;@10'\nexport OPENSSL_MALLOC_FAILURES\nOPENSSL_MALLOC_FD=3\nexport OPENSSL_MALLOC_FD\n...app invocation... 3>/tmp/log$$\n
            "},{"location":"man3/OPENSSL_malloc/#return-values","title":"RETURN VALUES","text":"

            OPENSSL_malloc_init(), OPENSSL_free(), OPENSSL_clear_free() CRYPTO_free(), CRYPTO_clear_free() and CRYPTO_get_mem_functions() return no value.

            OPENSSL_malloc(), OPENSSL_zalloc(), OPENSSL_realloc(), OPENSSL_clear_realloc(), CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_realloc(), CRYPTO_clear_realloc(), OPENSSL_strdup(), and OPENSSL_strndup() return a pointer to allocated memory or NULL on error.

            CRYPTO_set_mem_functions() returns 1 on success or 0 on failure (almost always because allocations have already happened).

            CRYPTO_mem_leaks(), CRYPTO_mem_leaks_fp(), CRYPTO_mem_leaks_cb(), CRYPTO_set_mem_debug(), and CRYPTO_mem_ctrl() are deprecated and are no-ops that always return -1. OPENSSL_mem_debug_push(), OPENSSL_mem_debug_pop(), CRYPTO_mem_debug_push(), and CRYPTO_mem_debug_pop() are deprecated and are no-ops that always return 0.

            "},{"location":"man3/OPENSSL_malloc/#history","title":"HISTORY","text":"

            OPENSSL_mem_debug_push(), OPENSSL_mem_debug_pop(), CRYPTO_mem_debug_push(), CRYPTO_mem_debug_pop(), CRYPTO_mem_leaks(), CRYPTO_mem_leaks_fp(), CRYPTO_mem_leaks_cb(), CRYPTO_set_mem_debug(), CRYPTO_mem_ctrl() were deprecated in OpenSSL 3.0. The memory-leak checking has been deprecated in OpenSSL 3.0 in favor of clang's memory and leak sanitizer.

            "},{"location":"man3/OPENSSL_malloc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_s390xcap/","title":"OPENSSL_s390xcap","text":""},{"location":"man3/OPENSSL_s390xcap/#name","title":"NAME","text":"

            OPENSSL_s390xcap - the IBM z processor capabilities vector

            "},{"location":"man3/OPENSSL_s390xcap/#synopsis","title":"SYNOPSIS","text":"
            env OPENSSL_s390xcap=... <application>\n
            "},{"location":"man3/OPENSSL_s390xcap/#description","title":"DESCRIPTION","text":"

            libcrypto supports z/Architecture instruction set extensions. These extensions are denoted by individual bits in the capabilities vector. When libcrypto is initialized, the bits returned by the STFLE instruction and by the QUERY functions are stored in the vector.

            To change the set of instructions available to an application, you can set the OPENSSL_s390xcap environment variable before you start the application. After initialization, the capability vector is ANDed bitwise with a mask which is derived from the environment variable.

            The environment variable is a semicolon-separated list of tokens which is processed from left to right (whitespace is ignored):

            OPENSSL_s390xcap=\"<tok1>;<tok2>;...\"\n

            There are three types of tokens:

            • <string>

              The name of a processor generation. A bit in the environment variable's mask is set to one if and only if the specified processor generation implements the corresponding instruction set extension. Possible values are z900, z990, z9, z10, z196, zEC12, z13, z14, z15, and z16.

            • <string>:<mask>:<mask>

              The name of an instruction followed by two 64-bit masks. The part of the environment variable's mask corresponding to the specified instruction is set to the specified 128-bit mask. Possible values are kimd, klmd, km, kmc, kmac, kmctr, kmo, kmf, prno, kma, pcc and kdsa.

            • stfle:<mask>:<mask>:<mask>

              Store-facility-list-extended (stfle) followed by three 64-bit masks. The part of the environment variable's mask corresponding to the stfle instruction is set to the specified 192-bit mask.

            The 64-bit masks are specified in hexadecimal notation. The 0x prefix is optional. Prefix a mask with a tilde, ~, to denote a bitwise NOT operation.

            The following is a list of significant bits for each instruction. Colon rows separate the individual 64-bit masks. The bit numbers in the first column are consistent with [1], that is, 0 denotes the leftmost bit and the numbering is continuous across 64-bit mask boundaries.

                 Bit     Mask     Facility/Function\n\nstfle:\n  #   # 17    1<<46    message-security assist\n  #   # 25    1<<38    store-clock-fast facility\n     :\n  #   # 76    1<<51    message-security assist extension 3\n  #   # 77    1<<50    message-security assist extension 4\n     :\n     #129    1<<62    vector facility\n     #134    1<<57    vector packed decimal facility\n     #135    1<<56    vector enhancements facility 1\n     #146    1<<45    message-security assist extension 8\n     #155    1<<36    message-security assist extension 9\n\nkimd :\n  #   #  1    1<<62    KIMD-SHA-1\n  #   #  2    1<<61    KIMD-SHA-256\n  #   #  3    1<<60    KIMD-SHA-512\n  #   # 32    1<<31    KIMD-SHA3-224\n  #   # 33    1<<30    KIMD-SHA3-256\n  #   # 34    1<<29    KIMD-SHA3-384\n  #   # 35    1<<28    KIMD-SHA3-512\n  #   # 36    1<<27    KIMD-SHAKE-128\n  #   # 37    1<<26    KIMD-SHAKE-256\n     :\n  #   # 65    1<<62    KIMD-GHASH\n\nklmd :\n  #   # 32    1<<31    KLMD-SHA3-224\n  #   # 33    1<<30    KLMD-SHA3-256\n  #   # 34    1<<29    KLMD-SHA3-384\n  #   # 35    1<<28    KLMD-SHA3-512\n  #   # 36    1<<27    KLMD-SHAKE-128\n  #   # 37    1<<26    KLMD-SHAKE-256\n     :\n\nkm   :\n  #   # 18    1<<45    KM-AES-128\n  #   # 19    1<<44    KM-AES-192\n  #   # 20    1<<43    KM-AES-256\n  #   # 50    1<<13    KM-XTS-AES-128\n  #   # 52    1<<11    KM-XTS-AES-256\n     :\n\nkmc  :\n  #   # 18    1<<45    KMC-AES-128\n  #   # 19    1<<44    KMC-AES-192\n  #   # 20    1<<43    KMC-AES-256\n     :\n\nkmac :\n  #   # 18    1<<45    KMAC-AES-128\n  #   # 19    1<<44    KMAC-AES-192\n  #   # 20    1<<43    KMAC-AES-256\n     :\n\nkmctr:\n     :\n\nkmo  :\n  #   # 18    1<<45    KMO-AES-128\n  #   # 19    1<<44    KMO-AES-192\n  #   # 20    1<<43    KMO-AES-256\n     :\n\nkmf  :\n  #   # 18    1<<45    KMF-AES-128\n  #   # 19    1<<44    KMF-AES-192\n  #   # 20    1<<43    KMF-AES-256\n     :\n\nprno :\n     :\n\nkma  :\n  #   # 18    1<<45    KMA-GCM-AES-128\n  #   # 19    1<<44    KMA-GCM-AES-192\n  #   # 20    1<<43    KMA-GCM-AES-256\n     :\n\npcc  :\n     :\n  #   # 64    1<<63    PCC-Scalar-Multiply-P256\n  #   # 65    1<<62    PCC-Scalar-Multiply-P384\n  #   # 66    1<<61    PCC-Scalar-Multiply-P521\n  #   # 72    1<<55    PCC-Scalar-Multiply-Ed25519\n  #   # 73    1<<54    PCC-Scalar-Multiply-Ed448\n  #   # 80    1<<47    PCC-Scalar-Multiply-X25519\n  #   # 81    1<<46    PCC-Scalar-Multiply-X448\n\nkdsa :\n  #   #  1    1<<62    KDSA-ECDSA-Verify-P256\n  #   #  2    1<<61    KDSA-ECDSA-Verify-P384\n  #   #  3    1<<60    KDSA-ECDSA-Verify-P521\n  #   #  9    1<<54    KDSA-ECDSA-Sign-P256\n  #   # 10    1<<53    KDSA-ECDSA-Sign-P384\n  #   # 11    1<<52    KDSA-ECDSA-Sign-P521\n  #   # 32    1<<31    KDSA-EdDSA-Verify-Ed25519\n  #   # 36    1<<27    KDSA-EdDSA-Verify-Ed448\n  #   # 40    1<<23    KDSA-EdDSA-Sign-Ed25519\n  #   # 44    1<<19    KDSA-EdDSA-Sign-Ed448\n     :\n
            "},{"location":"man3/OPENSSL_s390xcap/#return-values","title":"RETURN VALUES","text":"

            Not available.

            "},{"location":"man3/OPENSSL_s390xcap/#examples","title":"EXAMPLES","text":"

            Disables all instruction set extensions which the z196 processor does not implement:

            OPENSSL_s390xcap=\"z196\"\n

            Disables the vector facility:

            OPENSSL_s390xcap=\"stfle:~0:~0:~0x4000000000000000\"\n

            Disables the KM-XTS-AES and the KIMD-SHAKE function codes:

            OPENSSL_s390xcap=\"km:~0x2800:~0;kimd:~0xc000000:~0\"\n
            "},{"location":"man3/OPENSSL_s390xcap/#see-also","title":"SEE ALSO","text":"

            [1] z/Architecture Principles of Operation, SA22-7832-12

            "},{"location":"man3/OPENSSL_s390xcap/#copyright","title":"COPYRIGHT","text":"

            Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_secure_malloc/","title":"OPENSSL_secure_malloc","text":""},{"location":"man3/OPENSSL_secure_malloc/#name","title":"NAME","text":"

            CRYPTO_secure_malloc_init, CRYPTO_secure_malloc_initialized, CRYPTO_secure_malloc_done, OPENSSL_secure_malloc, CRYPTO_secure_malloc, OPENSSL_secure_zalloc, CRYPTO_secure_zalloc, OPENSSL_secure_free, CRYPTO_secure_free, OPENSSL_secure_clear_free, CRYPTO_secure_clear_free, OPENSSL_secure_actual_size, CRYPTO_secure_allocated, CRYPTO_secure_used - secure heap storage

            "},{"location":"man3/OPENSSL_secure_malloc/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/crypto.h>\n\nint CRYPTO_secure_malloc_init(size_t size, size_t minsize);\n\nint CRYPTO_secure_malloc_initialized();\n\nint CRYPTO_secure_malloc_done();\n\nvoid *OPENSSL_secure_malloc(size_t num);\nvoid *CRYPTO_secure_malloc(size_t num, const char *file, int line);\n\nvoid *OPENSSL_secure_zalloc(size_t num);\nvoid *CRYPTO_secure_zalloc(size_t num, const char *file, int line);\n\nvoid OPENSSL_secure_free(void* ptr);\nvoid CRYPTO_secure_free(void *ptr, const char *, int);\n\nvoid OPENSSL_secure_clear_free(void* ptr, size_t num);\nvoid CRYPTO_secure_clear_free(void *ptr, size_t num, const char *, int);\n\nsize_t OPENSSL_secure_actual_size(const void *ptr);\n\nint CRYPTO_secure_allocated(const void *ptr);\nsize_t CRYPTO_secure_used();\n
            "},{"location":"man3/OPENSSL_secure_malloc/#description","title":"DESCRIPTION","text":"

            In order to help protect applications (particularly long-running servers) from pointer overruns or underruns that could return arbitrary data from the program's dynamic memory area, where keys and other sensitive information might be stored, OpenSSL supports the concept of a \"secure heap.\" The level and type of security guarantees depend on the operating system. It is a good idea to review the code and see if it addresses your threat model and concerns.

            If a secure heap is used, then private key BIGNUM values are stored there. This protects long-term storage of private keys, but will not necessarily put all intermediate values and computations there.

            CRYPTO_secure_malloc_init() creates the secure heap, with the specified size in bytes. The minsize parameter is the minimum size to allocate from the heap or zero to use a reasonable default value. Both size and, if specified, minsize must be a power of two and minsize should generally be small, for example 16 or 32. minsize must be less than a quarter of size in any case.

            CRYPTO_secure_malloc_initialized() indicates whether or not the secure heap as been initialized and is available.

            CRYPTO_secure_malloc_done() releases the heap and makes the memory unavailable to the process if all secure memory has been freed. It can take noticeably long to complete.

            OPENSSL_secure_malloc() allocates num bytes from the heap. If CRYPTO_secure_malloc_init() is not called, this is equivalent to calling OPENSSL_malloc(). It is a macro that expands to CRYPTO_secure_malloc() and adds the __FILE__ and __LINE__ parameters.

            OPENSSL_secure_zalloc() and CRYPTO_secure_zalloc() are like OPENSSL_secure_malloc() and CRYPTO_secure_malloc(), respectively, except that they call memset() to zero the memory before returning.

            OPENSSL_secure_free() releases the memory at ptr back to the heap. It must be called with a value previously obtained from OPENSSL_secure_malloc(). If CRYPTO_secure_malloc_init() is not called, this is equivalent to calling OPENSSL_free(). It exists for consistency with OPENSSL_secure_malloc() , and is a macro that expands to CRYPTO_secure_free() and adds the __FILE__ and __LINE__ parameters.. If the argument to OPENSSL_secure_free() is NULL, nothing is done.

            OPENSSL_secure_clear_free() is similar to OPENSSL_secure_free() except that it has an additional num parameter which is used to clear the memory if it was not allocated from the secure heap. If CRYPTO_secure_malloc_init() is not called, this is equivalent to calling OPENSSL_clear_free(). If the argument to OPENSSL_secure_clear_free() is NULL, nothing is done.

            OPENSSL_secure_actual_size() tells the actual size allocated to the pointer; implementations may allocate more space than initially requested, in order to \"round up\" and reduce secure heap fragmentation.

            OPENSSL_secure_allocated() tells if a pointer is allocated in the secure heap.

            CRYPTO_secure_used() returns the number of bytes allocated in the secure heap.

            "},{"location":"man3/OPENSSL_secure_malloc/#return-values","title":"RETURN VALUES","text":"

            CRYPTO_secure_malloc_init() returns 0 on failure, 1 if successful, and 2 if successful but the heap could not be protected by memory mapping.

            CRYPTO_secure_malloc_initialized() returns 1 if the secure heap is available (that is, if CRYPTO_secure_malloc_init() has been called, but CRYPTO_secure_malloc_done() has not been called or failed) or 0 if not.

            OPENSSL_secure_malloc() and OPENSSL_secure_zalloc() return a pointer into the secure heap of the requested size, or NULL if memory could not be allocated.

            CRYPTO_secure_allocated() returns 1 if the pointer is in the secure heap, or 0 if not.

            CRYPTO_secure_malloc_done() returns 1 if the secure memory area is released, or 0 if not.

            OPENSSL_secure_free() and OPENSSL_secure_clear_free() return no values.

            "},{"location":"man3/OPENSSL_secure_malloc/#see-also","title":"SEE ALSO","text":"

            OPENSSL_malloc(3), BN_new(3)

            "},{"location":"man3/OPENSSL_secure_malloc/#history","title":"HISTORY","text":"

            The OPENSSL_secure_clear_free() function was added in OpenSSL 1.1.0g.

            The second argument to CRYPTO_secure_malloc_init() was changed from an int to a size_t in OpenSSL 3.0.

            "},{"location":"man3/OPENSSL_secure_malloc/#copyright","title":"COPYRIGHT","text":"

            Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OPENSSL_strcasecmp/","title":"OPENSSL_strcasecmp","text":""},{"location":"man3/OPENSSL_strcasecmp/#name","title":"NAME","text":"

            OPENSSL_strcasecmp, OPENSSL_strncasecmp - compare two strings ignoring case

            "},{"location":"man3/OPENSSL_strcasecmp/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/crypto.h>\n\nint OPENSSL_strcasecmp(const char *s1, const char *s2);\nint OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);\n
            "},{"location":"man3/OPENSSL_strcasecmp/#description","title":"DESCRIPTION","text":"

            The OPENSSL_strcasecmp function performs a byte-by-byte comparison of the strings s1 and s2, ignoring the case of the characters.

            The OPENSSL_strncasecmp function is similar, except that it compares no more than n bytes of s1 and s2.

            In POSIX-compatible system and on Windows these functions use \"C\" locale for case insensitive. Otherwise the comparison is done in current locale.

            "},{"location":"man3/OPENSSL_strcasecmp/#return-values","title":"RETURN VALUES","text":"

            Both functions return an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.

            "},{"location":"man3/OPENSSL_strcasecmp/#notes","title":"NOTES","text":"

            OpenSSL extensively uses case insensitive comparison of ASCII strings. Though OpenSSL itself is locale-agnostic, the applications using OpenSSL libraries may unpredictably suffer when they use localization (e.g. Turkish locale is well-known with a specific I/i cases). These functions use C locale for string comparison.

            "},{"location":"man3/OPENSSL_strcasecmp/#copyright","title":"COPYRIGHT","text":"

            Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OSSL_ALGORITHM/","title":"OSSL_ALGORITHM","text":""},{"location":"man3/OSSL_ALGORITHM/#name","title":"NAME","text":"

            OSSL_ALGORITHM - OpenSSL Core type to define a fetchable algorithm

            "},{"location":"man3/OSSL_ALGORITHM/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/core.h>\n\ntypedef struct ossl_algorithm_st OSSL_ALGORITHM;\nstruct ossl_algorithm_st {\n    const char *algorithm_names;     /* key */\n    const char *property_definition; /* key */\n    const OSSL_DISPATCH *implementation;\n    const char *algorithm_description;\n};\n
            "},{"location":"man3/OSSL_ALGORITHM/#description","title":"DESCRIPTION","text":"

            The OSSL_ALGORITHM type is a public structure that describes an algorithm that a provider(7) provides. Arrays of this type are returned by providers on demand from the OpenSSL libraries to describe what algorithms the providers provide implementations of, and with what properties.

            Arrays of this type must be terminated with a tuple where algorithm_names is NULL.

            This type of array is typically returned by the provider's operation querying function, further described in \"Provider Functions\" in provider-base(7).

            "},{"location":"man3/OSSL_ALGORITHM/#ossl_algorithm-fields","title":"OSSL_ALGORITHM fields","text":"
            • algorithm_names

              This string is a colon separated set of names / identities, and is used by the appropriate fetching functionality (such as EVP_CIPHER_fetch(3), EVP_MD_fetch(3), etc) to find the desired algorithm.

              Multiple names / identities allow a specific algorithm implementation to be fetched multiple ways. For example, the RSA algorithm has the following known identities:

              • RSA
              • rsaEncryption

                This is the name of the algorithm's OBJECT IDENTIFIER (OID), as given by the PKCS#1 RFC's ASN.1 module

              • 1.2.840.113549.1.1.1

                This is the OID itself for rsaEncryption, in canonical decimal text form.

              The resulting algorithm_names string would look like this:

              \"RSA:rsaEncryption:1.2.840.113549.1.1.1\"\n

              The OpenSSL libraries use the first of the algorithm names as the main or canonical name, on a per algorithm implementation basis.

              See the notes \"On the subject of algorithm names\" below for a more in depth discussion on algorithm_names and how that may interact with applications and libraries, including OpenSSL's.

            • property_definition

              This string defines a set of properties associated with a particular algorithm implementation, and is used by the appropriate fetching functionality (such as EVP_CIPHER_fetch(3), EVP_MD_fetch(3), etc) for a finer grained lookup of an algorithm implementation, which is useful in case multiple implementations of the same algorithm are available.

              See property(7) for a further description of the contents of this string.

            • implementation

              Pointer to an OSSL_DISPATCH(3) array, containing pointers to the functions of a particular algorithm implementation.

            • algorithm_description

              A string with a short human-readable description of the algorithm.

            "},{"location":"man3/OSSL_ALGORITHM/#notes","title":"NOTES","text":""},{"location":"man3/OSSL_ALGORITHM/#on-the-subject-of-algorithm-names","title":"On the subject of algorithm names","text":"

            Providers may find the need to register ASN.1 OIDs for algorithms using OBJ_create(3) (via the core_obj_create upcall described in provider-base(7), because some application or library -- possibly still the OpenSSL libraries, even -- use NIDs to look up algorithms.

            In that scenario, you must make sure that the corresponding OSSL_ALGORITHM's algorithm_names includes both the short and the long name.

            Most of the time, registering ASN.1 OIDs like this shouldn't be necessary, and applications and libraries are encouraged to use OBJ_obj2txt(3) to get a text representation of the OID, which may be a long or short name for OIDs that are registered, or the OID itself in canonical decimal text form if not (or if OBJ_obj2txt(3) is called with no_name = 1).

            It's recommended to make sure that the corresponding OSSL_ALGORITHM's algorithm_names include known names as well as the OID itself in canonical decimal text form. That should cover all scenarios.

            "},{"location":"man3/OSSL_ALGORITHM/#see-also","title":"SEE ALSO","text":"

            crypto(7), provider-base(7), openssl-core.h(7), openssl-core_dispatch.h(7), OSSL_DISPATCH(3)

            "},{"location":"man3/OSSL_ALGORITHM/#history","title":"HISTORY","text":"

            OSSL_ALGORITHM was added in OpenSSL 3.0

            "},{"location":"man3/OSSL_ALGORITHM/#copyright","title":"COPYRIGHT","text":"

            Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OSSL_CALLBACK/","title":"OSSL_CALLBACK","text":""},{"location":"man3/OSSL_CALLBACK/#name","title":"NAME","text":"

            OSSL_CALLBACK, OSSL_PASSPHRASE_CALLBACK - OpenSSL Core type to define callbacks

            "},{"location":"man3/OSSL_CALLBACK/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/core.h>\ntypedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);\ntypedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,\n                                       size_t *pass_len,\n                                       const OSSL_PARAM params[],\n                                       void *arg);\n
            "},{"location":"man3/OSSL_CALLBACK/#description","title":"DESCRIPTION","text":"

            For certain events or activities, provider functionality may need help from the application or the calling OpenSSL libraries themselves. For example, user input or direct (possibly optional) user output could be implemented this way.

            Callback functions themselves are always provided by or through the calling OpenSSL libraries, along with a generic pointer to data arg. As far as the function receiving the pointer to the function pointer and arg is concerned, the data that arg points at is opaque, and the pointer should simply be passed back to the callback function when it's called.

            • OSSL_CALLBACK

              This is a generic callback function. When calling this callback function, the caller is expected to build an OSSL_PARAM(3) array of data it wants or is expected to pass back, and pass that as params, as well as the opaque data pointer it received, as arg.

            • OSSL_PASSPHRASE_CALLBACK

              This is a specialised callback function, used specifically to prompt the user for a passphrase. When calling this callback function, a buffer to store the pass phrase needs to be given with pass, and its size with pass_size. The length of the prompted pass phrase will be given back in *pass_len.

              Additional parameters can be passed with the OSSL_PARAM(3) array params,

            "},{"location":"man3/OSSL_CALLBACK/#see-also","title":"SEE ALSO","text":"

            openssl-core.h(7)

            "},{"location":"man3/OSSL_CALLBACK/#history","title":"HISTORY","text":"

            The types described here were added in OpenSSL 3.0.

            "},{"location":"man3/OSSL_CALLBACK/#copyright","title":"COPYRIGHT","text":"

            Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

            "},{"location":"man3/OSSL_CMP_CTX_new/","title":"OSSL_CMP_CTX_new","text":""},{"location":"man3/OSSL_CMP_CTX_new/#name","title":"NAME","text":"

            OSSL_CMP_CTX_new, OSSL_CMP_CTX_free, OSSL_CMP_CTX_reinit, OSSL_CMP_CTX_set_option, OSSL_CMP_CTX_get_option, OSSL_CMP_CTX_set_log_cb, OSSL_CMP_CTX_set_log_verbosity, OSSL_CMP_CTX_print_errors, OSSL_CMP_CTX_set1_serverPath, OSSL_CMP_CTX_set1_server, OSSL_CMP_CTX_set_serverPort, OSSL_CMP_CTX_set1_proxy, OSSL_CMP_CTX_set1_no_proxy, OSSL_CMP_CTX_set_http_cb, OSSL_CMP_CTX_set_http_cb_arg, OSSL_CMP_CTX_get_http_cb_arg, OSSL_CMP_transfer_cb_t, OSSL_CMP_CTX_set_transfer_cb, OSSL_CMP_CTX_set_transfer_cb_arg, OSSL_CMP_CTX_get_transfer_cb_arg, OSSL_CMP_CTX_set1_srvCert, OSSL_CMP_CTX_set1_expected_sender, OSSL_CMP_CTX_set0_trustedStore, OSSL_CMP_CTX_get0_trustedStore, OSSL_CMP_CTX_set1_untrusted, OSSL_CMP_CTX_get0_untrusted, OSSL_CMP_CTX_set1_cert, OSSL_CMP_CTX_build_cert_chain, OSSL_CMP_CTX_set1_pkey, OSSL_CMP_CTX_set1_referenceValue, OSSL_CMP_CTX_set1_secretValue, OSSL_CMP_CTX_set1_recipient, OSSL_CMP_CTX_push0_geninfo_ITAV, OSSL_CMP_CTX_reset_geninfo_ITAVs, OSSL_CMP_CTX_set1_extraCertsOut, OSSL_CMP_CTX_set0_newPkey, OSSL_CMP_CTX_get0_newPkey, OSSL_CMP_CTX_set1_issuer, OSSL_CMP_CTX_set1_subjectName, OSSL_CMP_CTX_push1_subjectAltName, OSSL_CMP_CTX_set0_reqExtensions, OSSL_CMP_CTX_reqExtensions_have_SAN, OSSL_CMP_CTX_push0_policy, OSSL_CMP_CTX_set1_oldCert, OSSL_CMP_CTX_set1_p10CSR, OSSL_CMP_CTX_push0_genm_ITAV, OSSL_CMP_certConf_cb_t, OSSL_CMP_certConf_cb, OSSL_CMP_CTX_set_certConf_cb, OSSL_CMP_CTX_set_certConf_cb_arg, OSSL_CMP_CTX_get_certConf_cb_arg, OSSL_CMP_CTX_get_status, OSSL_CMP_CTX_get0_statusString, OSSL_CMP_CTX_get_failInfoCode, OSSL_CMP_CTX_get0_newCert, OSSL_CMP_CTX_get1_newChain, OSSL_CMP_CTX_get1_caPubs, OSSL_CMP_CTX_get1_extraCertsIn, OSSL_CMP_CTX_set1_transactionID, OSSL_CMP_CTX_set1_senderNonce - functions for managing the CMP client context data structure

            "},{"location":"man3/OSSL_CMP_CTX_new/#synopsis","title":"SYNOPSIS","text":"
            #include <openssl/cmp.h>\n\nOSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);\nvoid OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val);\nint OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt);\n\n/* logging and error reporting: */\nint OSSL_CMP_CTX_set_log_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_log_cb_t cb);\n#define OSSL_CMP_CTX_set_log_verbosity(ctx, level)\nvoid OSSL_CMP_CTX_print_errors(const OSSL_CMP_CTX *ctx);\n\n/* message transfer: */\nint OSSL_CMP_CTX_set1_serverPath(OSSL_CMP_CTX *ctx, const char *path);\nint OSSL_CMP_CTX_set1_server(OSSL_CMP_CTX *ctx, const char *address);\nint OSSL_CMP_CTX_set_serverPort(OSSL_CMP_CTX *ctx, int port);\nint OSSL_CMP_CTX_set1_proxy(OSSL_CMP_CTX *ctx, const char *name);\nint OSSL_CMP_CTX_set1_no_proxy(OSSL_CMP_CTX *ctx, const char *names);\nint OSSL_CMP_CTX_set_http_cb(OSSL_CMP_CTX *ctx, HTTP_bio_cb_t cb);\nint OSSL_CMP_CTX_set_http_cb_arg(OSSL_CMP_CTX *ctx, void *arg);\nvoid *OSSL_CMP_CTX_get_http_cb_arg(const OSSL_CMP_CTX *ctx);\ntypedef OSSL_CMP_MSG *(*OSSL_CMP_transfer_cb_t)(OSSL_CMP_CTX *ctx,\n                                                const OSSL_CMP_MSG *req);\nint OSSL_CMP_CTX_set_transfer_cb(OSSL_CMP_CTX *ctx,\n                                 OSSL_CMP_transfer_cb_t cb);\nint OSSL_CMP_CTX_set_transfer_cb_arg(OSSL_CMP_CTX *ctx, void *arg);\nvoid *OSSL_CMP_CTX_get_transfer_cb_arg(const OSSL_CMP_CTX *ctx);\n\n/* server authentication: */\nint OSSL_CMP_CTX_set1_srvCert(OSSL_CMP_CTX *ctx, X509 *cert);\nint OSSL_CMP_CTX_set1_expected_sender(OSSL_CMP_CTX *ctx,\n                                     const X509_NAME *name);\nint OSSL_CMP_CTX_set0_trustedStore(OSSL_CMP_CTX *ctx, X509_STORE *store);\nX509_STORE *OSSL_CMP_CTX_get0_trustedStore(const OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_set1_untrusted(OSSL_CMP_CTX *ctx, STACK_OF(X509) *certs);\nSTACK_OF(X509) *OSSL_CMP_CTX_get0_untrusted(const OSSL_CMP_CTX *ctx);\n\n/* client authentication: */\nint OSSL_CMP_CTX_set1_cert(OSSL_CMP_CTX *ctx, X509 *cert);\nint OSSL_CMP_CTX_build_cert_chain(OSSL_CMP_CTX *ctx, X509_STORE *own_trusted,\n                                  STACK_OF(X509) *candidates);\nint OSSL_CMP_CTX_set1_pkey(OSSL_CMP_CTX *ctx, EVP_PKEY *pkey);\nint OSSL_CMP_CTX_set1_referenceValue(OSSL_CMP_CTX *ctx,\n                                     const unsigned char *ref, int len);\nint OSSL_CMP_CTX_set1_secretValue(OSSL_CMP_CTX *ctx,\n                                  const unsigned char *sec, int len);\n\n/* CMP message header and extra certificates: */\nint OSSL_CMP_CTX_set1_recipient(OSSL_CMP_CTX *ctx, const X509_NAME *name);\nint OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);\nint OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_set1_extraCertsOut(OSSL_CMP_CTX *ctx,\n                                    STACK_OF(X509) *extraCertsOut);\n\n/* certificate template: */\nint OSSL_CMP_CTX_set0_newPkey(OSSL_CMP_CTX *ctx, int priv, EVP_PKEY *pkey);\nEVP_PKEY *OSSL_CMP_CTX_get0_newPkey(const OSSL_CMP_CTX *ctx, int priv);\nint OSSL_CMP_CTX_set1_issuer(OSSL_CMP_CTX *ctx, const X509_NAME *name);\nint OSSL_CMP_CTX_set1_subjectName(OSSL_CMP_CTX *ctx, const X509_NAME *name);\nint OSSL_CMP_CTX_push1_subjectAltName(OSSL_CMP_CTX *ctx,\n                                      const GENERAL_NAME *name);\nint OSSL_CMP_CTX_set0_reqExtensions(OSSL_CMP_CTX *ctx, X509_EXTENSIONS *exts);\nint OSSL_CMP_CTX_reqExtensions_have_SAN(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_push0_policy(OSSL_CMP_CTX *ctx, POLICYINFO *pinfo);\nint OSSL_CMP_CTX_set1_oldCert(OSSL_CMP_CTX *ctx, X509 *cert);\nint OSSL_CMP_CTX_set1_p10CSR(OSSL_CMP_CTX *ctx, const X509_REQ *csr);\n\n/* misc body contents: */\nint OSSL_CMP_CTX_push0_genm_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);\n\n/* certificate confirmation: */\ntypedef int (*OSSL_CMP_certConf_cb_t)(OSSL_CMP_CTX *ctx, X509 *cert,\n                                      int fail_info, const char **txt);\nint OSSL_CMP_certConf_cb(OSSL_CMP_CTX *ctx, X509 *cert, int fail_info,\n                         const char **text);\nint OSSL_CMP_CTX_set_certConf_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_certConf_cb_t cb);\nint OSSL_CMP_CTX_set_certConf_cb_arg(OSSL_CMP_CTX *ctx, void *arg);\nvoid *OSSL_CMP_CTX_get_certConf_cb_arg(const OSSL_CMP_CTX *ctx);\n\n/* result fetching: */\nint OSSL_CMP_CTX_get_status(const OSSL_CMP_CTX *ctx);\nOSSL_CMP_PKIFREETEXT *OSSL_CMP_CTX_get0_statusString(const OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_get_failInfoCode(const OSSL_CMP_CTX *ctx);\n\nX509 *OSSL_CMP_CTX_get0_newCert(const OSSL_CMP_CTX *ctx);\nSTACK_OF(X509) *OSSL_CMP_CTX_get1_newChain(const OSSL_CMP_CTX *ctx);\nSTACK_OF(X509) *OSSL_CMP_CTX_get1_caPubs(const OSSL_CMP_CTX *ctx);\nSTACK_OF(X509) *OSSL_CMP_CTX_get1_extraCertsIn(const OSSL_CMP_CTX *ctx);\n\n/* for testing and debugging purposes: */\nint OSSL_CMP_CTX_set1_transactionID(OSSL_CMP_CTX *ctx,\n                                    const ASN1_OCTET_STRING *id);\nint OSSL_CMP_CTX_set1_senderNonce(OSSL_CMP_CTX *ctx,\n                                  const ASN1_OCTET_STRING *nonce);\n
            "},{"location":"man3/OSSL_CMP_CTX_new/#description","title":"DESCRIPTION","text":"

            This is the context API for using CMP (Certificate Management Protocol) with OpenSSL.

            OSSL_CMP_CTX_new() allocates an OSSL_CMP_CTX structure associated with the library context libctx and property query string propq, both of which may be NULL to select the defaults. It initializes the remaining fields to their default values - for instance, the logging verbosity is set to OSSL_CMP_LOG_INFO, the message timeout is set to 120 seconds, and the proof-of-possession method is set to OSSL_CRMF_POPO_SIGNATURE.

            OSSL_CMP_CTX_free() deallocates an OSSL_CMP_CTX structure. If the argument is NULL, nothing is done.

            OSSL_CMP_CTX_reinit() prepares the given ctx for a further transaction by clearing the internal CMP transaction (aka session) status, PKIStatusInfo, and any previous results (newCert, newChain, caPubs, and extraCertsIn) from the last executed transaction. It also clears any ITAVs that were added by OSSL_CMP_CTX_push0_genm_ITAV(). All other field values (i.e., CMP options) are retained for potential reuse.

            OSSL_CMP_CTX_set_option() sets the given value for the given option (e.g., OSSL_CMP_OPT_IMPLICIT_CONFIRM) in the given OSSL_CMP_CTX structure.

            The following options can be set:

            • OSSL_CMP_OPT_LOG_VERBOSITY

                  The level of severity needed for actually outputting log messages\n    due to errors, warnings, general info, debugging, etc.\n    Default is OSSL_CMP_LOG_INFO. See also L<OSSL_CMP_log_open(3)>.\n
            • OSSL_CMP_OPT_KEEP_ALIVE

                  If the given value is 0 then HTTP connections are not kept open\n    after receiving a response, which is the default behavior for HTTP 1.0.\n    If the value is 1 or 2 then persistent connections are requested.\n    If the value is 2 then persistent connections are required,\n    i.e., in case the server does not grant them an error occurs.\n    The default value is 1: prefer to keep the connection open.\n
            • OSSL_CMP_OPT_MSG_TIMEOUT

                  Number of seconds a CMP request-response message round trip\n    is allowed to take before a timeout error is returned.\n    A value <= 0 means no limitation (waiting indefinitely).\n    Default is to use the B<OSSL_CMP_OPT_TOTAL_TIMEOUT> setting.\n
            • OSSL_CMP_OPT_TOTAL_TIMEOUT

                  Maximum total number of seconds a transaction may take,\n    including polling etc.\n    A value <= 0 means no limitation (waiting indefinitely).\n    Default is 0.\n
            • OSSL_CMP_OPT_VALIDITY_DAYS

                  Number of days new certificates are asked to be valid for.\n
            • OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT

                  Do not take default Subject Alternative Names\n    from the reference certificate.\n
            • OSSL_CMP_OPT_SUBJECTALTNAME_CRITICAL

                  Demand that the given Subject Alternative Names are flagged as critical.\n
            • OSSL_CMP_OPT_POLICIES_CRITICAL

                  Demand that the given policies are flagged as critical.\n
            • OSSL_CMP_OPT_POPO_METHOD

                  Select the proof of possession method to use. Possible values are:\n\n        OSSL_CRMF_POPO_NONE       - ProofOfPossession field omitted\n        OSSL_CRMF_POPO_RAVERIFIED - assert that the RA has already\n                                    verified the PoPo\n        OSSL_CRMF_POPO_SIGNATURE  - sign a value with private key,\n                                    which is the default.\n        OSSL_CRMF_POPO_KEYENC     - decrypt the encrypted certificate\n                                    (\"indirect method\")\n\n    Note that a signature-based POPO can only be produced if a private key\n    is provided as the newPkey or client's pkey component of the CMP context.\n
            • OSSL_CMP_OPT_DIGEST_ALGNID

                  The NID of the digest algorithm to be used in RFC 4210's MSG_SIG_ALG\n    for signature-based message protection and Proof-of-Possession (POPO).\n    Default is SHA256.\n
            • OSSL_CMP_OPT_OWF_ALGNID The NID of the digest algorithm to be used as one-way function (OWF) for MAC-based message protection with password-based MAC (PBM). See RFC 4210 section 5.1.3.1 for details. Default is SHA256.

            • OSSL_CMP_OPT_MAC_ALGNID The NID of the MAC algorithm to be used for message protection with PBM. Default is HMAC-SHA1 as per RFC 4210.
            • OSSL_CMP_OPT_REVOCATION_REASON

                  The reason code to be included in a Revocation Request (RR);\n    values: 0..10 (RFC 5210, 5.3.1) or -1 for none, which is the default.\n
            • OSSL_CMP_OPT_IMPLICIT_CONFIRM

                  Request server to enable implicit confirm mode, where the client\n    does not need to send confirmation upon receiving the\n    certificate. If the server does not enable implicit confirmation\n    in the return message, then confirmation is sent anyway.\n
            • OSSL_CMP_OPT_DISABLE_CONFIRM

                  Do not confirm enrolled certificates, to cope with broken servers\n    not supporting implicit confirmation correctly.\n

              B This setting leads to unspecified behavior and it is meant exclusively to allow interoperability with server implementations violating RFC 4210.

            • OSSL_CMP_OPT_UNPROTECTED_SEND

                  Send request or response messages without CMP-level protection.\n
            • OSSL_CMP_OPT_UNPROTECTED_ERRORS

                  Accept unprotected error responses which are either explicitly\n    unprotected or where protection verification failed. Applies to regular\n    error messages as well as certificate responses (IP/CP/KUP) and\n    revocation responses (RP) with rejection.\n

              B This setting leads to unspecified behavior and it is meant exclusively to allow interoperability with server implementations violating RFC 4210.

            • OSSL_CMP_OPT_IGNORE_KEYUSAGE

                  Ignore key usage restrictions in the signer's certificate when\n    validating signature-based protection in received CMP messages.\n    Else, 'digitalSignature' must be allowed by CMP signer certificates.\n
            • OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR

                  Allow retrieving a trust anchor from extraCerts and using that\n    to validate the certificate chain of an IP message.\n
            • OSSL_CMP_CTX_get_option() reads the current value of the given option (e.g., OSSL_CMP_OPT_IMPLICIT_CONFIRM) from the given OSSL_CMP_CTX structure.

              OSSL_CMP_CTX_set_log_cb() sets in ctx the callback function cb for handling error queue entries and logging messages. When cb is NULL errors are printed to STDERR (if available, else ignored) any log messages are ignored. Alternatively, OSSL_CMP_log_open(3) may be used to direct logging to STDOUT.

              OSSL_CMP_CTX_set_log_verbosity() is a macro setting the OSSL_CMP_OPT_LOG_VERBOSITY context option to the given level.

              OSSL_CMP_CTX_print_errors() outputs any entries in the OpenSSL error queue. It is similar to ERR_print_errors_cb(3) but uses the CMP log callback function if set in the ctx for uniformity with CMP logging if given. Otherwise it uses ERR_print_errors(3) to print to STDERR (unless OPENSSL_NO_STDIO is defined).

              OSSL_CMP_CTX_set1_serverPath() sets the HTTP path of the CMP server on the host, also known as \"CMP alias\". The default is /.

              OSSL_CMP_CTX_set1_server() sets the given server address (which may be a hostname or IP address or NULL) in the given ctx.

              OSSL_CMP_CTX_set_serverPort() sets the port of the CMP server to connect to. If not used or the port argument is 0 the default port applies, which is 80 for HTTP and 443 for HTTPS.

              OSSL_CMP_CTX_set1_proxy() sets the HTTP proxy to be used for connecting to the given CMP server unless overruled by any \"no_proxy\" settings (see below). If TLS is not used this defaults to the value of the environment variable http_proxy if set, else HTTP_PROXY. Otherwise defaults to the value of https_proxy if set, else HTTPS_PROXY. An empty proxy string specifies not to use a proxy. Else the format is [http[s]://]address[:port][/path], where any path given is ignored. The default port number is 80, or 443 in case https: is given.

              OSSL_CMP_CTX_set1_no_proxy() sets the list of server hostnames not to use an HTTP proxy for. The names may be separated by commas and/or whitespace. Defaults to the environment variable no_proxy if set, else NO_PROXY.

              OSSL_CMP_CTX_set_http_cb() sets the optional BIO connect/disconnect callback function, which has the prototype

              typedef BIO *(*HTTP_bio_cb_t) (BIO *bio, void *ctx, int connect, int detail);\n

              The callback may modify the bio provided by OSSL_CMP_MSG_http_perform(3), whereby it may make use of a custom defined argument ctx stored in the OSSL_CMP_CTX by means of OSSL_CMP_CTX_set_http_cb_arg(). During connection establishment, just after calling BIO_do_connect_retry(), the function is invoked with the connect argument being 1 and the detail argument being 1 if HTTPS is requested, i.e., SSL/TLS should be enabled. On disconnect connect is 0 and detail is 1 in case no error occurred, else 0. For instance, on connect the function may prepend a TLS BIO to implement HTTPS; after disconnect it may do some diagnostic output and/or specific cleanup. The function should return NULL to indicate failure. After disconnect the modified BIO will be deallocated using BIO_free_all().

              OSSL_CMP_CTX_set_http_cb_arg() sets an argument, respectively a pointer to a structure containing arguments, optionally to be used by the http connect/disconnect callback function. arg is not consumed, and it must therefore explicitly be freed when not needed any more. arg may be NULL to clear the entry.

              OSSL_CMP_CTX_get_http_cb_arg() gets the argument, respectively the pointer to a structure containing arguments, previously set by OSSL_CMP_CTX_set_http_cb_arg() or NULL if unset.

              OSSL_CMP_CTX_set_transfer_cb() sets the message transfer callback function, which has the type

              typedef OSSL_CMP_MSG *(*OSSL_CMP_transfer_cb_t) (OSSL_CMP_CTX *ctx,\n                                                 const OSSL_CMP_MSG *req);\n

              Returns 1 on success, 0 on error.

              Default is NULL, which implies the use of OSSL_CMP_MSG_http_perform(3). The callback should send the CMP request message it obtains via the req parameter and on success return the response, else it must return NULL. The transfer callback may make use of a custom defined argument stored in the ctx by means of OSSL_CMP_CTX_set_transfer_cb_arg(), which may be retrieved again through OSSL_CMP_CTX_get_transfer_cb_arg().

              OSSL_CMP_CTX_set_transfer_cb_arg() sets an argument, respectively a pointer to a structure containing arguments, optionally to be used by the transfer callback. arg is not consumed, and it must therefore explicitly be freed when not needed any more. arg may be NULL to clear the entry.

              OSSL_CMP_CTX_get_transfer_cb_arg() gets the argument, respectively the pointer to a structure containing arguments, previously set by OSSL_CMP_CTX_set_transfer_cb_arg() or NULL if unset.

              OSSL_CMP_CTX_set1_srvCert() sets the expected server cert in ctx and trusts it directly (even if it is expired) when verifying signed response messages. This pins the accepted CMP server and results in ignoring whatever may be set using OSSL_CMP_CTX_set0_trustedStore(). Any previously set value is freed. The cert argument may be NULL to clear the entry. If set, the subject of the certificate is also used as default value for the recipient of CMP requests and as default value for the expected sender of CMP responses.

              OSSL_CMP_CTX_set1_expected_sender() sets the Distinguished Name (DN) expected in the sender field of incoming CMP messages. Defaults to the subject of the pinned server certificate, if any. This can be used to make sure that only a particular entity is accepted as CMP message signer, and attackers are not able to use arbitrary certificates of a trusted PKI hierarchy to fraudulently pose as CMP server. Note that this gives slightly more freedom than OSSL_CMP_CTX_set1_srvCert(), which pins the server to the holder of a particular certificate, while the expected sender name will continue to match after updates of the server cert.

              OSSL_CMP_CTX_set0_trustedStore() sets in the CMP context ctx the certificate store of type X509_STORE containing trusted certificates, typically of root CAs. This is ignored when a certificate is pinned using OSSL_CMP_CTX_set1_srvCert(). The store may also hold CRLs and a certificate verification callback function used for signature-based peer authentication. Any store entry already set before is freed. When given a NULL parameter the entry is cleared.

              OSSL_CMP_CTX_get0_trustedStore() extracts from the CMP context ctx the pointer to the currently set certificate store containing trust anchors etc., or an empty store if unset.

              OSSL_CMP_CTX_set1_untrusted() sets up a list of non-trusted certificates of intermediate CAs that may be useful for path construction for the own CMP signer certificate, for the own TLS certificate (if any), when verifying peer CMP protection certificates, and when verifying newly enrolled certificates. The reference counts of those certificates handled successfully are increased.

              OSSL_CMP_CTX_get0_untrusted(OSSL_CMP_CTX *ctx) returns a pointer to the list of untrusted certs, which may be empty if unset.

              OSSL_CMP_CTX_set1_cert() sets the CMP signer certificate, also called protection certificate, related to the private key for signature-based message protection. Therefore the public key of this cert must correspond to the private key set before or thereafter via OSSL_CMP_CTX_set1_pkey(). When using signature-based protection of CMP request messages this CMP signer certificate will be included first in the extraCerts field. It serves as fallback reference certificate, see OSSL_CMP_CTX_set1_oldCert(). The subject of this cert will be used as the sender field of outgoing messages, while the subject of any cert set via OSSL_CMP_CTX_set1_oldCert() and any value set via OSSL_CMP_CTX_set1_subjectName() are used as fallback.

              The cert argument may be NULL to clear the entry.

              OSSL_CMP_CTX_build_cert_chain() builds a certificate chain for the CMP signer certificate previously set in the ctx. It adds the optional candidates, a list of intermediate CA certs that may already constitute the targeted chain, to the untrusted certs that may already exist in the ctx. Then the function uses this augmented set of certs for chain construction. If own_trusted is NULL it builds the chain as far down as possible and ignores any verification errors. Else the CMP signer certificate must be verifiable where the chain reaches a trust anchor contained in own_trusted. On success the function stores the resulting chain in ctx for inclusion in the extraCerts field of signature-protected messages. Calling this function is optional; by default a chain construction is performed on demand that is equivalent to calling this function with the candidates and own_trusted arguments being NULL.

              OSSL_CMP_CTX_set1_pkey() sets the client's private key corresponding to the CMP signer certificate set via OSSL_CMP_CTX_set1_cert(). This key is used create signature-based protection (protectionAlg = MSG_SIG_ALG) of outgoing messages unless a symmetric secret has been set via OSSL_CMP_CTX_set1_secretValue(). The pkey argument may be NULL to clear the entry.

              OSSL_CMP_CTX_set1_secretValue() sets in ctx the byte string sec of length len to use as pre-shared secret, or clears it if the sec argument is NULL. If present, this secret is used to create MAC-based authentication and integrity protection (rather than applying signature-based protection) of outgoing messages and to verify authenticity and integrity of incoming messages that have MAC-based protection (protectionAlg = MSG_MAC_ALG).

              OSSL_CMP_CTX_set1_referenceValue() sets the given referenceValue ref with length len in the given ctx or clears it if the ref argument is NULL. According to RFC 4210 section 5.1.1, if no value for the sender field in CMP message headers can be determined (i.e., no CMP signer certificate and no subject DN is set via OSSL_CMP_CTX_set1_subjectName() then the sender field will contain the NULL-DN and the senderKID field of the CMP message header must be set. When signature-based protection is used the senderKID will be set to the subjectKeyIdentifier of the CMP signer certificate as far as present. If not present or when MAC-based protection is used the ref value is taken as the fallback value for the senderKID.

              OSSL_CMP_CTX_set1_recipient() sets the recipient name that will be used in the PKIHeader of CMP request messages, i.e. the X509 name of the (CA) server.

              The recipient field in the header of a CMP message is mandatory. If not given explicitly the recipient is determined in the following order: the subject of the CMP server certificate set using OSSL_CMP_CTX_set1_srvCert(), the value set using OSSL_CMP_CTX_set1_issuer(), the issuer of the certificate set using OSSL_CMP_CTX_set1_oldCert(), the issuer of the CMP signer certificate, as far as any of those is present, else the NULL-DN as last resort.

              OSSL_CMP_CTX_push0_geninfo_ITAV() adds itav to the stack in the ctx to be added to the GeneralInfo field of the CMP PKIMessage header of a request message sent with this context.

              OSSL_CMP_CTX_reset_geninfo_ITAVs() clears any ITAVs that were added by OSSL_CMP_CTX_push0_geninfo_ITAV().

              OSSL_CMP_CTX_set1_extraCertsOut() sets the stack of extraCerts that will be sent to remote.

              OSSL_CMP_CTX_set0_newPkey() can be used to explicitly set the given EVP_PKEY structure as the private or public key to be certified in the CMP context. The priv parameter must be 0 if and only if the given key is a public key.

              OSSL_CMP_CTX_get0_newPkey() gives the key to use for certificate enrollment dependent on fields of the CMP context structure: the newPkey (which may be a private or public key) if present, else the public key in the p10CSR if present, else the client's private key. If the priv parameter is not 0 and the selected key does not have a private component then NULL is returned.

              OSSL_CMP_CTX_set1_issuer() sets the name of the intended issuer that will be set in the CertTemplate, i.e., the X509 name of the CA server.

              OSSL_CMP_CTX_set1_subjectName() sets the subject DN that will be used in the CertTemplate structure when requesting a new cert. For Key Update Requests (KUR), it defaults to the subject DN of the reference certificate, see OSSL_CMP_CTX_set1_oldCert(). This default is used for Initialization Requests (IR) and Certification Requests (CR) only if no SANs are set. The subjectName is also used as fallback for the sender field of outgoing CMP messages if no reference certificate is available.

              OSSL_CMP_CTX_push1_subjectAltName() adds the given X509 name to the list of alternate names on the certificate template request. This cannot be used if any Subject Alternative Name extension is set via OSSL_CMP_CTX_set0_reqExtensions(). By default, unless OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT has been set, the Subject Alternative Names are copied from the reference certificate, see OSSL_CMP_CTX_set1_oldCert(). If set and the subject DN is not set with OSSL_CMP_CTX_set1_subjectName() then the certificate template of an IR and CR will not be filled with the default subject DN from the reference certificate. If a subject DN is desired it needs to be set explicitly with OSSL_CMP_CTX_set1_subjectName().

              OSSL_CMP_CTX_set0_reqExtensions() sets the X.509v3 extensions to be used in IR/CR/KUR.

              OSSL_CMP_CTX_reqExtensions_have_SAN() returns 1 if the context contains a Subject Alternative Name extension, else 0 or -1 on error.

              OSSL_CMP_CTX_push0_policy() adds the certificate policy info object to the X509_EXTENSIONS of the requested certificate template.

              OSSL_CMP_CTX_set1_oldCert() sets the old certificate to be updated in Key Update Requests (KUR) or to be revoked in Revocation Requests (RR). It must be given for RR, else it defaults to the CMP signer certificate. The reference certificate determined in this way, if any, is also used for deriving default subject DN, public key, Subject Alternative Names, and the default issuer entry in the requested certificate template of IR/CR/KUR. The subject of the reference certificate is used as the sender field value in CMP message headers. Its issuer is used as default recipient in CMP message headers.

              OSSL_CMP_CTX_set1_p10CSR() sets the PKCS#10 CSR to use in P10CR messages. If such a CSR is provided, its subject, public key, and extension fields are also used as fallback values for the certificate template of IR/CR/KUR messages.

              OSSL_CMP_CTX_push0_genm_ITAV() adds itav to the stack in the ctx which will be the body of a General Message sent with this context.

              OSSL_CMP_certConf_cb() is the default certificate confirmation callback function. If the callback argument is not NULL it must point to a trust store. In this case the function checks that the newly enrolled certificate can be verified using this trust store and untrusted certificates from the ctx, which have been augmented by the list of extraCerts received. During this verification, any certificate status checking is disabled. If the callback argument is NULL the function tries building an approximate chain as far as possible using the same untrusted certificates from the ctx, and if this fails it takes the received extraCerts as fallback. The resulting cert chain can be retrieved using OSSL_CMP_CTX_get1_newChain().

              OSSL_CMP_CTX_set_certConf_cb() sets the callback used for evaluating the newly enrolled certificate before the library sends, depending on its result, a positive or negative certConf message to the server. The callback has type

              typedef int (*OSSL_CMP_certConf_cb_t) (OSSL_CMP_CTX *ctx, X509 *cert,\n                                       int fail_info, const char **txt);\n

              and should inspect the certificate it obtains via the cert parameter and may overrule the pre-decision given in the fail_info and *txt parameters. If it accepts the certificate it must return 0, indicating success. Else it must return a bit field reflecting PKIFailureInfo with at least one failure bit and may set the *txt output parameter to point to a string constant with more detail. The transfer callback may make use of a custom defined argument stored in the ctx by means of OSSL_CMP_CTX_set_certConf_cb_arg(), which may be retrieved again through OSSL_CMP_CTX_get_certConf_cb_arg(). Typically, the callback will check at least that the certificate can be verified using a set of trusted certificates. It also could compare the subject DN and other fields of the newly enrolled certificate with the certificate template of the request.

              OSSL_CMP_CTX_set_certConf_cb_arg() sets an argument, respectively a pointer to a structure containing arguments, optionally to be used by the certConf callback. arg is not consumed, and it must therefore explicitly be freed when not needed any more. arg may be NULL to clear the entry.

              OSSL_CMP_CTX_get_certConf_cb_arg() gets the argument, respectively the pointer to a structure containing arguments, previously set by OSSL_CMP_CTX_set_certConf_cb_arg(), or NULL if unset.

              OSSL_CMP_CTX_get_status() returns for client contexts the PKIstatus from the last received CertRepMessage or Revocation Response or error message: =item OSSL_CMP_PKISTATUS_accepted on successful receipt of a GENP message:

              • OSSL_CMP_PKISTATUS_request

                if an IR/CR/KUR/RR/GENM request message could not be produced,

              • OSSL_CMP_PKISTATUS_trans

                on a transmission error or transaction error for this type of request, and

              • OSSL_CMP_PKISTATUS_unspecified

                if no such request was attempted or OSSL_CMP_CTX_reinit() has been called.

              For server contexts it returns OSSL_CMP_PKISTATUS_trans if a transaction is open, otherwise OSSL_CMP_PKISTATUS_unspecified.

              OSSL_CMP_CTX_get0_statusString() returns the statusString from the last received CertRepMessage or Revocation Response or error message, or NULL if unset.

              OSSL_CMP_CTX_get_failInfoCode() returns the error code from the failInfo field of the last received CertRepMessage or Revocation Response or error message, or -1 if no such response was received or OSSL_CMP_CTX_reinit() has been called. This is a bit field and the flags for it are specified in the header file <openssl/cmp.h>. The flags start with OSSL_CMP_CTX_FAILINFO, for example: OSSL_CMP_CTX_FAILINFO_badAlg. Returns -1 if the failInfoCode field is unset.

              OSSL_CMP_CTX_get0_newCert() returns the pointer to the newly obtained certificate in case it is available, else NULL.

              OSSL_CMP_CTX_get1_newChain() returns a pointer to a duplicate of the stack of X.509 certificates computed by OSSL_CMP_certConf_cb() (if this function has been called) on the last received certificate response message IP/CP/KUP.

              OSSL_CMP_CTX_get1_caPubs() returns a pointer to a duplicate of the list of X.509 certificates in the caPubs field of the last received certificate response message (of type IP, CP, or KUP), or an empty stack if no caPubs have been received in the current transaction.

              OSSL_CMP_CTX_get1_extraCertsIn() returns a pointer to a duplicate of the list of X.509 certificates contained in the extraCerts field of the last received response message (except for pollRep and PKIConf), or an empty stack if no extraCerts have been received in the current transaction.

              OSSL_CMP_CTX_set1_transactionID() sets the given transaction ID in the given OSSL_CMP_CTX structure.

              OSSL_CMP_CTX_set1_senderNonce() stores the last sent sender nonce in the ctx. This will be used to validate the recipNonce in incoming messages.

              "},{"location":"man3/OSSL_CMP_CTX_new/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210 (and CRMF in RFC 4211).

              "},{"location":"man3/OSSL_CMP_CTX_new/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_CTX_free() and OSSL_CMP_CTX_print_errors() do not return anything.

              OSSL_CMP_CTX_new(), OSSL_CMP_CTX_get_http_cb_arg(), OSSL_CMP_CTX_get_transfer_cb_arg(), OSSL_CMP_CTX_get0_trustedStore(), OSSL_CMP_CTX_get0_untrusted(), OSSL_CMP_CTX_get0_newPkey(), OSSL_CMP_CTX_get_certConf_cb_arg(), OSSL_CMP_CTX_get0_statusString(), OSSL_CMP_CTX_get0_newCert(), OSSL_CMP_CTX_get0_newChain(), OSSL_CMP_CTX_get1_caPubs(), and OSSL_CMP_CTX_get1_extraCertsIn() return the intended pointer value as described above or NULL on error.

              OSSL_CMP_CTX_get_option(), OSSL_CMP_CTX_reqExtensions_have_SAN(), OSSL_CMP_CTX_get_status(), and OSSL_CMP_CTX_get_failInfoCode() return the intended value as described above or -1 on error.

              OSSL_CMP_certConf_cb() returns fail_info if it is not equal to 0, else 0 on successful validation, or else a bit field with the OSSL_CMP_PKIFAILUREINFO_incorrectData bit set.

              All other functions, including OSSL_CMP_CTX_reinit() and OSSL_CMP_CTX_reset_geninfo_ITAVs(), return 1 on success, 0 on error.

              "},{"location":"man3/OSSL_CMP_CTX_new/#examples","title":"EXAMPLES","text":"

              The following code omits error handling.

              Set up a CMP client context for sending requests and verifying responses:

              cmp_ctx = OSSL_CMP_CTX_new();\nOSSL_CMP_CTX_set1_server(cmp_ctx, name_or_address);\nOSSL_CMP_CTX_set1_serverPort(cmp_ctx, port_string);\nOSSL_CMP_CTX_set1_serverPath(cmp_ctx, path_or_alias);\nOSSL_CMP_CTX_set0_trustedStore(cmp_ctx, ts);\n

              Set up symmetric credentials for MAC-based message protection such as PBM:

              OSSL_CMP_CTX_set1_referenceValue(cmp_ctx, ref, ref_len);\nOSSL_CMP_CTX_set1_secretValue(cmp_ctx, sec, sec_len);\n

              Set up the details for certificate requests:

              OSSL_CMP_CTX_set1_subjectName(cmp_ctx, name);\nOSSL_CMP_CTX_set0_newPkey(cmp_ctx, 1, initialKey);\n

              Perform an Initialization Request transaction:

              initialCert = OSSL_CMP_exec_IR_ses(cmp_ctx);\n

              Reset the transaction state of the CMP context and the credentials:

              OSSL_CMP_CTX_reinit(cmp_ctx);\nOSSL_CMP_CTX_set1_referenceValue(cmp_ctx, NULL, 0);\nOSSL_CMP_CTX_set1_secretValue(cmp_ctx, NULL, 0);\n

              Perform a Certification Request transaction, making use of the new credentials:

              OSSL_CMP_CTX_set1_cert(cmp_ctx, initialCert);\nOSSL_CMP_CTX_set1_pkey(cmp_ctx, initialKey);\nOSSL_CMP_CTX_set0_newPkey(cmp_ctx, 1, curentKey);\ncurrentCert = OSSL_CMP_exec_CR_ses(cmp_ctx);\n

              Perform a Key Update Request, signed using the cert (and key) to be updated:

              OSSL_CMP_CTX_reinit(cmp_ctx);\nOSSL_CMP_CTX_set1_cert(cmp_ctx, currentCert);\nOSSL_CMP_CTX_set1_pkey(cmp_ctx, currentKey);\nOSSL_CMP_CTX_set0_newPkey(cmp_ctx, 1, updatedKey);\ncurrentCert = OSSL_CMP_exec_KUR_ses(cmp_ctx);\ncurrentKey = updatedKey;\n

              Perform a General Message transaction including, as an example, the id-it-signKeyPairTypes OID and prints info on the General Response contents:

              OSSL_CMP_CTX_reinit(cmp_ctx);\n\nASN1_OBJECT *type = OBJ_txt2obj(\"1.3.6.1.5.5.7.4.2\", 1);\nOSSL_CMP_ITAV *itav = OSSL_CMP_ITAV_create(type, NULL);\nOSSL_CMP_CTX_push0_genm_ITAV(cmp_ctx, itav);\n\nSTACK_OF(OSSL_CMP_ITAV) *itavs;\nitavs = OSSL_CMP_exec_GENM_ses(cmp_ctx);\nprint_itavs(itavs);\nsk_OSSL_CMP_ITAV_pop_free(itavs, OSSL_CMP_ITAV_free);\n
              "},{"location":"man3/OSSL_CMP_CTX_new/#see-also","title":"SEE ALSO","text":"

              OSSL_CMP_exec_IR_ses(3), OSSL_CMP_exec_CR_ses(3), OSSL_CMP_exec_KUR_ses(3), OSSL_CMP_exec_GENM_ses(3), OSSL_CMP_exec_certreq(3), OSSL_CMP_MSG_http_perform(3), ERR_print_errors_cb(3)

              "},{"location":"man3/OSSL_CMP_CTX_new/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              OSSL_CMP_CTX_reset_geninfo_ITAVs() was added in OpenSSL 3.0.8.

              "},{"location":"man3/OSSL_CMP_CTX_new/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/","title":"OSSL_CMP_HDR_get0_transactionID","text":""},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#name","title":"NAME","text":"

              OSSL_CMP_HDR_get0_transactionID, OSSL_CMP_HDR_get0_recipNonce - functions manipulating CMP message headers

              "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\n\nASN1_OCTET_STRING *OSSL_CMP_HDR_get0_transactionID(const\n                                                   OSSL_CMP_PKIHEADER *hdr);\nASN1_OCTET_STRING *OSSL_CMP_HDR_get0_recipNonce(const\n                                                OSSL_CMP_PKIHEADER *hdr);\n
              "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#description","title":"DESCRIPTION","text":"

              OSSL_CMP_HDR_get0_transactionID returns the transaction ID of the given PKIHeader.

              OSSL_CMP_HDR_get0_recipNonce returns the recipient nonce of the given PKIHeader.

              "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210.

              "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#return-values","title":"RETURN VALUES","text":"

              The functions return the intended pointer value as described above or NULL if the respective entry does not exist and on error.

              "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_ITAV_set0/","title":"OSSL_CMP_ITAV_set0","text":""},{"location":"man3/OSSL_CMP_ITAV_set0/#name","title":"NAME","text":"

              OSSL_CMP_ITAV_create, OSSL_CMP_ITAV_set0, OSSL_CMP_ITAV_get0_type, OSSL_CMP_ITAV_get0_value, OSSL_CMP_ITAV_push0_stack_item - OSSL_CMP_ITAV utility functions

              "},{"location":"man3/OSSL_CMP_ITAV_set0/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\nOSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);\nvoid OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type,\n                        ASN1_TYPE *value);\nASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav);\nASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav);\n\nint OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **itav_sk_p,\n                                   OSSL_CMP_ITAV *itav);\n
              "},{"location":"man3/OSSL_CMP_ITAV_set0/#description","title":"DESCRIPTION","text":"

              Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL

              ITAV is short for InfoTypeAndValue. This type is defined in RFC 4210 section 5.3.19 and Appendix F. It is used at various places in CMP messages, e.g., in the generalInfo PKIHeader field, to hold a key-value pair.

              OSSL_CMP_ITAV_create() creates a new OSSL_CMP_ITAV structure and fills it in. It combines OSSL_CMP_ITAV_new() and OSSL_CMP_ITAV_set0().

              OSSL_CMP_ITAV_set0() sets the itav with an infoType of type and an infoValue of value. This function uses the pointers type and value internally, so they must not be freed up after the call.

              OSSL_CMP_ITAV_get0_type() returns a direct pointer to the infoType in the itav.

              OSSL_CMP_ITAV_get0_value() returns a direct pointer to the infoValue in the itav as generic ASN1_TYPE pointer.

              OSSL_CMP_ITAV_push0_stack_item() pushes itav to the stack pointed to by *itav_sk_p. It creates a new stack if *itav_sk_p points to NULL.

              "},{"location":"man3/OSSL_CMP_ITAV_set0/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210 (and CRMF in RFC 4211).

              "},{"location":"man3/OSSL_CMP_ITAV_set0/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_ITAV_create() returns a pointer to the ITAV structure on success, or NULL on error.

              OSSL_CMP_ITAV_set0() does not return a value.

              OSSL_CMP_ITAV_get0_type() and OSSL_CMP_ITAV_get0_value() return the respective pointer or NULL if their input is NULL.

              OSSL_CMP_ITAV_push0_stack_item() returns 1 on success, 0 on error.

              "},{"location":"man3/OSSL_CMP_ITAV_set0/#examples","title":"EXAMPLES","text":"

              The following code creates and sets a structure representing a generic InfoTypeAndValue sequence, using an OID created from text as type, and an integer as value. Afterwards, it is pushed to the OSSL_CMP_CTX to be later included in the requests' PKIHeader's genInfo field.

              ASN1_OBJECT *type = OBJ_txt2obj(\"1.2.3.4.5\", 1);\nif (type == NULL) ...\n\nASN1_INTEGER *asn1int = ASN1_INTEGER_new();\nif (asn1int == NULL || !ASN1_INTEGER_set(asn1int, 12345)) ...\n\nASN1_TYPE *val = ASN1_TYPE_new();\nif (val == NULL) ...\nASN1_TYPE_set(val, V_ASN1_INTEGER, asn1int);\n\nOSSL_CMP_ITAV *itav = OSSL_CMP_ITAV_create(type, val);\nif (itav == NULL) ...\n\nOSSL_CMP_CTX *ctx = OSSL_CMP_CTX_new();\nif (ctx == NULL || !OSSL_CMP_CTX_geninfo_push0_ITAV(ctx, itav)) {\n    OSSL_CMP_ITAV_free(itav); /* also frees type and val */\n    goto err;\n}\n\n...\n\nOSSL_CMP_CTX_free(ctx); /* also frees itav */\n
              "},{"location":"man3/OSSL_CMP_ITAV_set0/#see-also","title":"SEE ALSO","text":"

              OSSL_CMP_CTX_new(3), OSSL_CMP_CTX_free(3), ASN1_TYPE_set(3)

              "},{"location":"man3/OSSL_CMP_ITAV_set0/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_ITAV_set0/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_MSG_get0_header/","title":"OSSL_CMP_MSG_get0_header","text":""},{"location":"man3/OSSL_CMP_MSG_get0_header/#name","title":"NAME","text":"

              OSSL_CMP_MSG_get0_header, OSSL_CMP_MSG_get_bodytype, OSSL_CMP_MSG_update_transactionID, OSSL_CMP_MSG_update_recipNonce, OSSL_CMP_CTX_setup_CRM, OSSL_CMP_MSG_read, OSSL_CMP_MSG_write, d2i_OSSL_CMP_MSG_bio, i2d_OSSL_CMP_MSG_bio - function(s) manipulating CMP messages

              "},{"location":"man3/OSSL_CMP_MSG_get0_header/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\n\nOSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg);\nint OSSL_CMP_MSG_get_bodytype(const OSSL_CMP_MSG *msg);\nint OSSL_CMP_MSG_update_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);\nint OSSL_CMP_MSG_update_recipNonce(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);\nOSSL_CRMF_MSG *OSSL_CMP_CTX_setup_CRM(OSSL_CMP_CTX *ctx, int for_KUR, int rid);\nOSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx, const char *propq);\nint OSSL_CMP_MSG_write(const char *file, const OSSL_CMP_MSG *msg);\nOSSL_CMP_MSG *d2i_OSSL_CMP_MSG_bio(BIO *bio, OSSL_CMP_MSG **msg);\nint i2d_OSSL_CMP_MSG_bio(BIO *bio, const OSSL_CMP_MSG *msg);\n
              "},{"location":"man3/OSSL_CMP_MSG_get0_header/#description","title":"DESCRIPTION","text":"

              OSSL_CMP_MSG_get0_header() returns the header of the given CMP message.

              OSSL_CMP_MSG_get_bodytype() returns the body type of the given CMP message.

              OSSL_CMP_MSG_update_transactionID() updates the transactionID field in the header of the given message according to the CMP_CTX. If ctx does not contain a transaction ID, a fresh one is created before. The message gets re-protected (if protecting requests is required).

              OSSL_CMP_MSG_update_recipNonce() updates the recipNonce field in the header of the given message according to the CMP_CTX. The message gets re-protected (if protecting requests is required).

              OSSL_CMP_CTX_setup_CRM() creates a CRMF certificate request message from various information provided in the CMP context argument ctx for inclusion in a CMP request message based on details contained in ctx. The rid argument defines the request identifier to use, which typically is 0.

              The subject DN included in the certificate template is the first available value of these:

              • any subject name in ctx set via OSSL_CMP_CTX_set1_subjectName(3) - if it is the NULL-DN (i.e., any empty sequence of RDNs), no subject is included,
              • the subject field of any PKCS#10 CSR set in ctx via OSSL_CMP_CTX_set1_p10CSR(3),
              • the subject field of any reference certificate given in ctx (see OSSL_CMP_CTX_set1_oldCert(3)), but only if for_KUR is nonzero or the ctx does not include a Subject Alternative Name.

              The public key included is the first available value of these:

              • the public key derived from any key set via OSSL_CMP_CTX_set0_newPkey(3),
              • the public key of any PKCS#10 CSR given in ctx,
              • the public key of any reference certificate given in ctx (see OSSL_CMP_CTX_set1_oldCert(3)),
              • the public key derived from any client's private key set via OSSL_CMP_CTX_set1_pkey(3).

              The set of X.509 extensions to include is computed as follows. If a PKCS#10 CSR is present in ctx, default extensions are taken from there, otherwise the empty set is taken as the initial value. If there is a reference certificate in ctx and contains Subject Alternative Names (SANs) and OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT is not set, these override any SANs from the PKCS#10 CSR. The extensions are further augmented or overridden by any extensions with the same OIDs included in the ctx via OSSL_CMP_CTX_set0_reqExtensions(3). The SANs are further overridden by any SANs included in ctx via OSSL_CMP_CTX_push1_subjectAltName(3). Finally, policies are overridden by any policies included in ctx via OSSL_CMP_CTX_push0_policy(3).

              OSSL_CMP_CTX_setup_CRM() also sets the sets the regToken control oldCertID for KUR messages using the issuer name and serial number of the reference certificate, if present.

              OSSL_CMP_MSG_read() loads a DER-encoded OSSL_CMP_MSG from file.

              OSSL_CMP_MSG_write() stores the given OSSL_CMP_MSG to file in DER encoding.

              d2i_OSSL_CMP_MSG_bio() parses an ASN.1-encoded OSSL_CMP_MSG from the BIO bio. It assigns a pointer to the new structure to *msg if msg is not NULL.

              i2d_OSSL_CMP_MSG_bio() writes the OSSL_CMP_MSG msg in ASN.1 encoding to BIO bio.

              "},{"location":"man3/OSSL_CMP_MSG_get0_header/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210.

              "},{"location":"man3/OSSL_CMP_MSG_get0_header/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_MSG_get0_header() returns the intended pointer value as described above or NULL if the respective entry does not exist and on error.

              OSSL_CMP_MSG_get_bodytype() returns the body type or -1 on error.

              OSSL_CMP_CTX_setup_CRM() returns a pointer to a OSSL_CRMF_MSG on success, NULL on error.

              d2i_OSSL_CMP_MSG_bio() returns the parsed message or NULL on error.

              OSSL_CMP_MSG_read() and d2i_OSSL_CMP_MSG_bio() return the parsed CMP message or NULL on error.

              OSSL_CMP_MSG_write() returns the number of bytes successfully encoded or a negative value if an error occurs.

              i2d_OSSL_CMP_MSG_bio(), OSSL_CMP_MSG_update_transactionID(), and OSSL_CMP_MSG_update_recipNonce() return 1 on success, 0 on error.

              "},{"location":"man3/OSSL_CMP_MSG_get0_header/#see-also","title":"SEE ALSO","text":"

              OSSL_CMP_CTX_set1_subjectName(3), OSSL_CMP_CTX_set1_p10CSR(3), OSSL_CMP_CTX_set1_oldCert(3), OSSL_CMP_CTX_set0_newPkey(3), OSSL_CMP_CTX_set1_pkey(3), OSSL_CMP_CTX_set0_reqExtensions(3), OSSL_CMP_CTX_push1_subjectAltName(3), OSSL_CMP_CTX_push0_policy(3)

              "},{"location":"man3/OSSL_CMP_MSG_get0_header/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              OSSL_CMP_MSG_update_recipNonce() was added in OpenSSL 3.0.9.

              "},{"location":"man3/OSSL_CMP_MSG_get0_header/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_MSG_http_perform/","title":"OSSL_CMP_MSG_http_perform","text":""},{"location":"man3/OSSL_CMP_MSG_http_perform/#name","title":"NAME","text":"

              OSSL_CMP_MSG_http_perform - client-side HTTP(S) transfer of a CMP request-response pair

              "},{"location":"man3/OSSL_CMP_MSG_http_perform/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\n\nOSSL_CMP_MSG *OSSL_CMP_MSG_http_perform(OSSL_CMP_CTX *ctx,\n                                        const OSSL_CMP_MSG *req);\n
              "},{"location":"man3/OSSL_CMP_MSG_http_perform/#description","title":"DESCRIPTION","text":"

              OSSL_CMP_MSG_http_perform() sends the given PKIMessage req to the CMP server specified in ctx via OSSL_CMP_CTX_set1_server(3) and optionally OSSL_CMP_CTX_set_serverPort(3), using any \"CMP alias\" optionally specified via OSSL_CMP_CTX_set1_serverPath(3). The default port is 80 for HTTP and 443 for HTTPS; the default path is \"/\". On success the function returns the server's response PKIMessage.

              The function makes use of any HTTP callback function set via OSSL_CMP_CTX_set_http_cb(3). It respects any timeout value set via OSSL_CMP_CTX_set_option(3) with an OSSL_CMP_OPT_MSG_TIMEOUT argument. It also respects any HTTP(S) proxy options set via OSSL_CMP_CTX_set1_proxy(3) and OSSL_CMP_CTX_set1_no_proxy(3) and the respective environment variables. Proxying plain HTTP is supported directly, while using a proxy for HTTPS connections requires a suitable callback function such as OSSL_HTTP_proxy_connect(3).

              "},{"location":"man3/OSSL_CMP_MSG_http_perform/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210. HTTP transfer for CMP is defined in RFC 6712.

              "},{"location":"man3/OSSL_CMP_MSG_http_perform/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_MSG_http_perform() returns a CMP message on success, else NULL.

              "},{"location":"man3/OSSL_CMP_MSG_http_perform/#see-also","title":"SEE ALSO","text":"

              OSSL_CMP_CTX_new(3), OSSL_HTTP_proxy_connect(3).

              "},{"location":"man3/OSSL_CMP_MSG_http_perform/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_MSG_http_perform/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_SRV_CTX_new/","title":"OSSL_CMP_SRV_CTX_new","text":""},{"location":"man3/OSSL_CMP_SRV_CTX_new/#name","title":"NAME","text":"

              OSSL_CMP_SRV_process_request, OSSL_CMP_CTX_server_perform, OSSL_CMP_SRV_CTX_new, OSSL_CMP_SRV_CTX_free, OSSL_CMP_SRV_cert_request_cb_t, OSSL_CMP_SRV_rr_cb_t, OSSL_CMP_SRV_certConf_cb_t, OSSL_CMP_SRV_genm_cb_t, OSSL_CMP_SRV_error_cb_t, OSSL_CMP_SRV_pollReq_cb_t, OSSL_CMP_SRV_CTX_init, OSSL_CMP_SRV_CTX_get0_cmp_ctx, OSSL_CMP_SRV_CTX_get0_custom_ctx, OSSL_CMP_SRV_CTX_set_send_unprotected_errors, OSSL_CMP_SRV_CTX_set_accept_unprotected, OSSL_CMP_SRV_CTX_set_accept_raverified, OSSL_CMP_SRV_CTX_set_grant_implicit_confirm - generic functions to set up and control a CMP server

              "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\n\nOSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx,\n                                           const OSSL_CMP_MSG *req);\nOSSL_CMP_MSG *OSSL_CMP_CTX_server_perform(OSSL_CMP_CTX *client_ctx,\n                                          const OSSL_CMP_MSG *req);\nOSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);\nvoid OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx);\n\ntypedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_cert_request_cb_t)(\n                                                OSSL_CMP_SRV_CTX *srv_ctx,\n                                                const OSSL_CMP_MSG *req,\n                                                int certReqId,\n                                                const OSSL_CRMF_MSG *crm,\n                                                const X509_REQ *p10cr,\n                                                X509 **certOut,\n                                                STACK_OF(X509) **chainOut,\n                                                STACK_OF(X509) **caPubs);\ntypedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_rr_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                                const OSSL_CMP_MSG *req,\n                                                const X509_NAME *issuer,\n                                                const ASN1_INTEGER *serial);\ntypedef int (*OSSL_CMP_SRV_genm_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                      const OSSL_CMP_MSG *req,\n                                      STACK_OF(OSSL_CMP_ITAV) *in,\n                                      STACK_OF(OSSL_CMP_ITAV) **out);\ntypedef void (*OSSL_CMP_SRV_error_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                        const OSSL_CMP_MSG *req,\n                                        const OSSL_CMP_PKISI *statusInfo,\n                                        const ASN1_INTEGER *errorCode,\n                                        const OSSL_CMP_PKIFREETEXT *errorDetails);\ntypedef int (*OSSL_CMP_SRV_certConf_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                          const OSSL_CMP_MSG *req,\n                                          int certReqId,\n                                          const ASN1_OCTET_STRING *certHash,\n                                          const OSSL_CMP_PKISI *si);\ntypedef int (*OSSL_CMP_SRV_pollReq_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                         const OSSL_CMP_MSG *req,\n                                         int certReqId,\n                                         OSSL_CMP_MSG **certReq,\n                                         int64_t *check_after);\nint OSSL_CMP_SRV_CTX_init(OSSL_CMP_SRV_CTX *srv_ctx, void *custom_ctx,\n                          OSSL_CMP_SRV_cert_request_cb_t process_cert_request,\n                          OSSL_CMP_SRV_rr_cb_t process_rr,\n                          OSSL_CMP_SRV_genm_cb_t process_genm,\n                          OSSL_CMP_SRV_error_cb_t process_error,\n                          OSSL_CMP_SRV_certConf_cb_t process_certConf,\n                          OSSL_CMP_SRV_pollReq_cb_t process_pollReq);\n\nOSSL_CMP_CTX *OSSL_CMP_SRV_CTX_get0_cmp_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);\nvoid *OSSL_CMP_SRV_CTX_get0_custom_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);\n\nint OSSL_CMP_SRV_CTX_set_send_unprotected_errors(OSSL_CMP_SRV_CTX *srv_ctx,\n                                                 int val);\nint OSSL_CMP_SRV_CTX_set_accept_unprotected(OSSL_CMP_SRV_CTX *srv_ctx, int val);\nint OSSL_CMP_SRV_CTX_set_accept_raverified(OSSL_CMP_SRV_CTX *srv_ctx, int val);\nint OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(OSSL_CMP_SRV_CTX *srv_ctx,\n                                                int val);\n
              "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#description","title":"DESCRIPTION","text":"

              OSSL_CMP_SRV_process_request() implements the generic aspects of a CMP server. Its arguments are the OSSL_CMP_SRV_CTX srv_ctx and the CMP request message req. It does the typical generic checks on req, calls the respective callback function (if present) for more specific processing, and then assembles a result message, which may be a CMP error message. If after return of the function the expression OSSL_CMP_CTX_get_status(OSSL_CMP_SRV_CTX_get0_cmp_ctx(srv_ctx)) yields -1 then the function has closed the current transaction, which may be due to normal successful end of the transaction or due to an error.

              OSSL_CMP_CTX_server_perform() is an interface to OSSL_CMP_SRV_process_request() that can be used by a CMP client in the same way as OSSL_CMP_MSG_http_perform(3). The OSSL_CMP_SRV_CTX must be set as transfer_cb_arg of client_ctx.

              OSSL_CMP_SRV_CTX_new() creates and initializes an OSSL_CMP_SRV_CTX structure associated with the library context libctx and property query string propq, both of which may be NULL to select the defaults.

              OSSL_CMP_SRV_CTX_free() deletes the given srv_ctx. If the argument is NULL, nothing is done.

              OSSL_CMP_SRV_CTX_init() sets in the given srv_ctx a custom server context pointer as well as callback functions performing the specific processing of CMP certificate requests, revocation requests, certificate confirmation requests, general messages, error messages, and poll requests. All arguments except srv_ctx may be NULL. If a callback for some message type is not given this means that the respective type of CMP message is not supported by the server.

              OSSL_CMP_SRV_CTX_get0_cmp_ctx() returns the OSSL_CMP_CTX from the srv_ctx.

              OSSL_CMP_SRV_CTX_get0_custom_ctx() returns the custom server context from srv_ctx that has been set using OSSL_CMP_SRV_CTX_init().

              OSSL_CMP_SRV_CTX_set_send_unprotected_errors() enables sending error messages and other forms of negative responses unprotected.

              OSSL_CMP_SRV_CTX_set_accept_unprotected() enables acceptance of requests without protection of with invalid protection.

              OSSL_CMP_SRV_CTX_set_accept_raverified() enables acceptance of ir/cr/kur messages with POPO 'RAVerified'.

              OSSL_CMP_SRV_CTX_set_grant_implicit_confirm() enables granting implicit confirmation of newly enrolled certificates if requested.

              "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210 (and CRMF in RFC 4211).

              So far the CMP server implementation is limited to one request per CMP message (and consequently to at most one response component per CMP message).

              "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_SRV_CTX_new() returns a OSSL_CMP_SRV_CTX structure on success, NULL on error.

              OSSL_CMP_SRV_CTX_free() does not return a value.

              OSSL_CMP_SRV_CTX_get0_cmp_ctx() returns a OSSL_CMP_CTX structure on success, NULL on error.

              OSSL_CMP_SRV_CTX_get0_custom_ctx() returns the custom server context that has been set using OSSL_CMP_SRV_CTX_init().

              All other functions return 1 on success, 0 on error.

              "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_STATUSINFO_new/","title":"OSSL_CMP_STATUSINFO_new","text":""},{"location":"man3/OSSL_CMP_STATUSINFO_new/#name","title":"NAME","text":"

              OSSL_CMP_STATUSINFO_new, OSSL_CMP_snprint_PKIStatusInfo, OSSL_CMP_CTX_snprint_PKIStatus - function(s) for managing the CMP PKIStatus

              "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\n\nOSSL_CMP_PKISI *OSSL_CMP_STATUSINFO_new(int status, int fail_info,\n                                        const char *text);\nchar *OSSL_CMP_snprint_PKIStatusInfo(const OSSL_CMP_PKISI *statusInfo,\n                                     char *buf, size_t bufsize);\nchar *OSSL_CMP_CTX_snprint_PKIStatus(const OSSL_CMP_CTX *ctx, char *buf,\n                                     size_t bufsize);\n
              "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#description","title":"DESCRIPTION","text":"

              This is the PKIStatus API for using CMP (Certificate Management Protocol) with OpenSSL.

              OSSL_CMP_STATUSINFO_new() creates a new PKIStatusInfo structure and fills in the given values. It sets the status field to status, copies text (unless it is NULL) to statusString, and interprets fail_info as bit pattern for the failInfo field.

              OSSL_CMP_snprint_PKIStatusInfo() places a human-readable string representing the given statusInfo in the given buffer, with the given maximal length.

              OSSL_CMP_CTX_snprint_PKIStatus() places a human-readable string representing the PKIStatusInfo components of the CMP context ctx in the given buffer, with the given maximal length.

              "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210 (and CRMF in RFC 4211).

              "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_STATUSINFO_new() returns a pointer to the structure on success, or NULL on error.

              OSSL_CMP_snprint_PKIStatusInfo() and OSSL_CMP_CTX_snprint_PKIStatus() return a copy of the buffer pointer containing the string or NULL on error.

              "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_exec_certreq/","title":"OSSL_CMP_exec_certreq","text":""},{"location":"man3/OSSL_CMP_exec_certreq/#name","title":"NAME","text":"

              OSSL_CMP_exec_certreq, OSSL_CMP_exec_IR_ses, OSSL_CMP_exec_CR_ses, OSSL_CMP_exec_P10CR_ses, OSSL_CMP_exec_KUR_ses, OSSL_CMP_IR, OSSL_CMP_CR, OSSL_CMP_P10CR, OSSL_CMP_KUR, OSSL_CMP_try_certreq, OSSL_CMP_exec_RR_ses, OSSL_CMP_exec_GENM_ses - functions implementing CMP client transactions

              "},{"location":"man3/OSSL_CMP_exec_certreq/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\n\nX509 *OSSL_CMP_exec_certreq(OSSL_CMP_CTX *ctx, int req_type,\n                            const OSSL_CRMF_MSG *crm);\nX509 *OSSL_CMP_exec_IR_ses(OSSL_CMP_CTX *ctx);\nX509 *OSSL_CMP_exec_CR_ses(OSSL_CMP_CTX *ctx);\nX509 *OSSL_CMP_exec_P10CR_ses(OSSL_CMP_CTX *ctx);\nX509 *OSSL_CMP_exec_KUR_ses(OSSL_CMP_CTX *ctx);\n#define OSSL_CMP_IR\n#define OSSL_CMP_CR\n#define OSSL_CMP_P10CR\n#define OSSL_CMP_KUR\nint OSSL_CMP_try_certreq(OSSL_CMP_CTX *ctx, int req_type,\n                         const OSSL_CRMF_MSG *crm, int *checkAfter);\nint OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx);\nSTACK_OF(OSSL_CMP_ITAV) *OSSL_CMP_exec_GENM_ses(OSSL_CMP_CTX *ctx);\n
              "},{"location":"man3/OSSL_CMP_exec_certreq/#description","title":"DESCRIPTION","text":"

              This is the OpenSSL API for doing CMP (Certificate Management Protocol) client-server transactions, i.e., sequences of CMP requests and responses.

              All functions take a populated OSSL_CMP_CTX structure as their first argument. Usually the server name, port, and path (\"CMP alias\") need to be set, as well as credentials the client can use for authenticating itself to the server. In order to authenticate the server the client typically needs a trust store. The functions return their respective main results directly, while there are also accessor functions for retrieving various results and status information from the ctx. See OSSL_CMP_CTX_new(3) etc. for details.

              The default conveying protocol is HTTP. Timeout values may be given per request-response pair and per transaction. See OSSL_CMP_MSG_http_perform(3) for details.

              OSSL_CMP_exec_IR_ses() requests an initial certificate from the given PKI.

              OSSL_CMP_exec_CR_ses() requests an additional certificate.

              OSSL_CMP_exec_P10CR_ses() conveys a legacy PKCS#10 CSR requesting a certificate.

              OSSL_CMP_exec_KUR_ses() obtains an updated certificate.

              These four types of certificate enrollment are implemented as macros calling OSSL_CMP_exec_certreq().

              OSSL_CMP_exec_certreq() performs a certificate request of the type specified by the req_type parameter, which may be IR, CR, P10CR, or KUR. For IR, CR, and KUR, the certificate template to be used in the request may be supplied via the crm parameter pointing to a CRMF structure. Typically crm is NULL, then the template ingredients are taken from ctx and need to be filled in using OSSL_CMP_CTX_set1_subjectName(3), OSSL_CMP_CTX_set0_newPkey(3), OSSL_CMP_CTX_set1_oldCert(3), etc. For P10CR, OSSL_CMP_CTX_set1_p10CSR(3) needs to be used instead. The enrollment session may be blocked by sleeping until the addressed CA (or an intermediate PKI component) can fully process and answer the request.

              OSSL_CMP_try_certreq() is an alternative to the above functions that is more flexible regarding what to do after receiving a checkAfter value. When called for the first time (with no certificate request in progress for the given ctx) it starts a new transaction by sending a certificate request constructed as stated above using the req_type and optional crm parameter. Otherwise (when according to ctx a 'waiting' status has been received before) it continues polling for the pending request unless the req_type argument is < 0, which aborts the request. If the requested certificate is available the function returns 1 and the caller can use OSSL_CMP_CTX_get0_newCert(3) to retrieve the new certificate. If no error occurred but no certificate is available yet then OSSL_CMP_try_certreq() remembers in the CMP context that it should be retried and returns -1 after assigning the received checkAfter value via the output pointer argument (unless it is NULL). The checkAfter value indicates the number of seconds the caller should let pass before trying again. The caller is free to sleep for the given number of seconds or for some other time and/or to do anything else before retrying by calling OSSL_CMP_try_certreq() again with the same parameter values as before. OSSL_CMP_try_certreq() then polls to see whether meanwhile the requested certificate is available. If the caller decides to abort the pending certificate request and provides a negative value as the req_type argument then OSSL_CMP_try_certreq() aborts the CMP transaction by sending an error message to the server.

              OSSL_CMP_exec_RR_ses() requests the revocation of the certificate specified in the ctx using OSSL_CMP_CTX_set1_oldCert(3). RFC 4210 is vague in which PKIStatus should be returned by the server. We take \"accepted\" and \"grantedWithMods\" as clear success and handle \"revocationWarning\" and \"revocationNotification\" just as warnings because CAs typically return them as an indication that the certificate was already revoked. \"rejection\" is a clear error. The values \"waiting\" and \"keyUpdateWarning\" make no sense for revocation and thus are treated as an error as well.

              OSSL_CMP_exec_GENM_ses() sends a general message containing the sequence of infoType and infoValue pairs (InfoTypeAndValue; short: ITAV) optionally provided in the ctx using OSSL_CMP_CTX_push0_genm_ITAV(3). On success it records in ctx the status OSSL_CMP_PKISTATUS_accepted and returns the list of ITAVs received in the GENP message. This can be used, for instance, to poll for CRLs or CA Key Updates. See RFC 4210 section 5.3.19 and appendix E.5 for details.

              "},{"location":"man3/OSSL_CMP_exec_certreq/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210 (and CRMF in RFC 4211).

              The CMP client implementation is limited to one request per CMP message (and consequently to at most one response component per CMP message).

              When a client obtains from a CMP server CA certificates that it is going to trust, for instance via the caPubs field of a certificate response, authentication of the CMP server is particularly critical. So special care must be taken setting up server authentication in ctx using functions such as OSSL_CMP_CTX_set0_trustedStore(3) (for certificate-based authentication) or OSSL_CMP_CTX_set1_secretValue(3) (for MAC-based protection).

              "},{"location":"man3/OSSL_CMP_exec_certreq/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_exec_certreq(), OSSL_CMP_exec_IR_ses(), OSSL_CMP_exec_CR_ses(), OSSL_CMP_exec_P10CR_ses(), and OSSL_CMP_exec_KUR_ses() return a pointer to the newly obtained X509 certificate on success, NULL on error. This pointer will be freed implicitly by OSSL_CMP_CTX_free() or CSSL_CMP_CTX_reinit().

              OSSL_CMP_try_certreq() returns 1 if the requested certificate is available via OSSL_CMP_CTX_get0_newCert(3) or on successfully aborting a pending certificate request, 0 on error, and -1 in case a 'waiting' status has been received and checkAfter value is available. In the latter case OSSL_CMP_CTX_get0_newCert(3) yields NULL and the output parameter checkAfter has been used to assign the received value unless checkAfter is NULL.

              OSSL_CMP_exec_RR_ses() returns 1 on success, 0 on error.

              OSSL_CMP_exec_GENM_ses() returns NULL on error, otherwise a pointer to the sequence of ITAV received, which may be empty. This pointer must be freed by the caller.

              "},{"location":"man3/OSSL_CMP_exec_certreq/#examples","title":"EXAMPLES","text":"

              See OSSL_CMP_CTX for examples on how to prepare the context for these functions.

              "},{"location":"man3/OSSL_CMP_exec_certreq/#see-also","title":"SEE ALSO","text":"

              OSSL_CMP_CTX_new(3), OSSL_CMP_CTX_free(3), OSSL_CMP_CTX_set1_subjectName(3), OSSL_CMP_CTX_set0_newPkey(3), OSSL_CMP_CTX_set1_p10CSR(3), OSSL_CMP_CTX_set1_oldCert(3), OSSL_CMP_CTX_get0_newCert(3), OSSL_CMP_CTX_push0_genm_ITAV(3), OSSL_CMP_MSG_http_perform(3)

              "},{"location":"man3/OSSL_CMP_exec_certreq/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_exec_certreq/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_log_open/","title":"OSSL_CMP_log_open","text":""},{"location":"man3/OSSL_CMP_log_open/#name","title":"NAME","text":"

              OSSL_CMP_log_open, OSSL_CMP_log_close, OSSL_CMP_severity, OSSL_CMP_LOG_EMERG, OSSL_CMP_LOG_ALERT, OSSL_CMP_LOG_CRIT, OSSL_CMP_LOG_ERR, OSSL_CMP_LOG_WARNING, OSSL_CMP_LOG_NOTICE, OSSL_CMP_LOG_INFO, OSSL_CMP_LOG_DEBUG, OSSL_CMP_LOG_TRACE,

              OSSL_CMP_log_cb_t, OSSL_CMP_print_to_bio, OSSL_CMP_print_errors_cb - functions for logging and error reporting

              "},{"location":"man3/OSSL_CMP_log_open/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp_util.h>\n\nint  OSSL_CMP_log_open(void);\nvoid OSSL_CMP_log_close(void);\n\n/* severity level declarations resemble those from syslog.h */\ntypedef int OSSL_CMP_severity;\n#define OSSL_CMP_LOG_EMERG   0\n#define OSSL_CMP_LOG_ALERT   1\n#define OSSL_CMP_LOG_CRIT    2\n#define OSSL_CMP_LOG_ERR     3\n#define OSSL_CMP_LOG_WARNING 4\n#define OSSL_CMP_LOG_NOTICE  5\n#define OSSL_CMP_LOG_INFO    6\n#define OSSL_CMP_LOG_DEBUG   7\n#define OSSL_CMP_LOG_TRACE   8\n\ntypedef int (*OSSL_CMP_log_cb_t)(const char *component,\n                                 const char *file, int line,\n                                 OSSL_CMP_severity level, const char *msg);\nint OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file,\n                          int line, OSSL_CMP_severity level, const char *msg);\nvoid OSSL_CMP_print_errors_cb(OSSL_CMP_log_cb_t log_fn);\n
              "},{"location":"man3/OSSL_CMP_log_open/#description","title":"DESCRIPTION","text":"

              The logging and error reporting facility described here contains convenience functions for CMP-specific logging, including a string prefix mirroring the severity levels of syslog.h, and enhancements of the error queue mechanism needed for large diagnostic messages produced by the CMP library in case of certificate validation failures.

              When an interesting activity is performed or an error occurs, some detail should be provided for user information, debugging, and auditing purposes. A CMP application can obtain this information by providing a callback function with the following type:

              typedef int (*OSSL_CMP_log_cb_t)(const char *component,\n                                 const char *file, int line,\n                                 OSSL_CMP_severity level, const char *msg);\n

              The parameters may provide some component info (which may be a module name and/or function name) or NULL, a file pathname or NULL, a line number or 0 indicating the source code location, a severity level, and a message string describing the nature of the event, terminated by '\\n'.

              Even when an activity is successful some warnings may be useful and some degree of auditing may be required. Therefore, the logging facility supports a severity level and the callback function has a level parameter indicating such a level, such that error, warning, info, debug, etc. can be treated differently. The callback is activated only when the severity level is sufficient according to the current level of verbosity, which by default is OSSL_CMP_LOG_INFO.

              The callback function may itself do non-trivial tasks like writing to a log file or remote stream, which in turn may fail. Therefore, the function should return 1 on success and 0 on failure.

              OSSL_CMP_log_open() initializes the CMP-specific logging facility to output everything to STDOUT. It fails if the integrated tracing is disabled or STDIO is not available. It may be called during application startup. Alternatively, OSSL_CMP_CTX_set_log_cb(3) can be used for more flexibility. As long as neither if the two is used any logging output is ignored.

              OSSL_CMP_log_close() may be called when all activities are finished to flush any pending CMP-specific log output and deallocate related resources. It may be called multiple times. It does get called at OpenSSL shutdown.

              OSSL_CMP_print_to_bio() prints the given component info, filename, line number, severity level, and log message or error queue message to the given bio. component usually is a function or module name. If it is NULL, empty, or \"(unknown function)\" then \"CMP\" is used as fallback.

              OSSL_CMP_print_errors_cb() outputs any entries in the OpenSSL error queue. It is similar to ERR_print_errors_cb(3) but uses the CMP log callback function log_fn for uniformity with CMP logging if not NULL. Otherwise it prints to STDERR using OSSL_CMP_print_to_bio(3) (unless OPENSSL_NO_STDIO is defined).

              "},{"location":"man3/OSSL_CMP_log_open/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_log_close() and OSSL_CMP_print_errors_cb() do not return anything.

              All other functions return 1 on success, 0 on error.

              "},{"location":"man3/OSSL_CMP_log_open/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_log_open/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CMP_validate_msg/","title":"OSSL_CMP_validate_msg","text":""},{"location":"man3/OSSL_CMP_validate_msg/#name","title":"NAME","text":"

              OSSL_CMP_validate_msg, OSSL_CMP_validate_cert_path - functions for verifying CMP message protection

              "},{"location":"man3/OSSL_CMP_validate_msg/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/cmp.h>\nint OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);\nint OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx,\n                                X509_STORE *trusted_store, X509 *cert);\n
              "},{"location":"man3/OSSL_CMP_validate_msg/#description","title":"DESCRIPTION","text":"

              This is the API for validating the protection of CMP messages, which includes validating CMP message sender certificates and their paths while optionally checking the revocation status of the certificates(s).

              OSSL_CMP_validate_msg() validates the protection of the given msg, which must be signature-based or using password-based MAC (PBM). In the former case a suitable trust anchor must be given in the CMP context ctx, and in the latter case the matching secret must have been set there using OSSL_CMP_CTX_set1_secretValue(3).

              In case of signature algorithm, the certificate to use for the signature check is preferably the one provided by a call to OSSL_CMP_CTX_set1_srvCert(3). If no such sender cert has been pinned then candidate sender certificates are taken from the list of certificates received in the msg extraCerts, then any certificates provided before via OSSL_CMP_CTX_set1_untrusted(3), and then all trusted certificates provided via OSSL_CMP_CTX_set0_trustedStore(3), where a candidate is acceptable only if has not expired, its subject DN matches the msg sender DN (as far as present), and its subject key identifier is present and matches the senderKID (as far as the latter present). Each acceptable cert is tried in the given order to see if the message signature check succeeds and the cert and its path can be verified using any trust store set via OSSL_CMP_CTX_set0_trustedStore(3).

              If the option OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR was set by calling OSSL_CMP_CTX_set_option(3), for an Initialization Response (IP) message any self-issued certificate from the msg extraCerts field may also be used as trust anchor for the path verification of an acceptable cert if it can be used also to validate the issued certificate returned in the IP message. This is according to TS 33.310 [Network Domain Security (NDS); Authentication Framework (AF)] document specified by the The 3rd Generation Partnership Project (3GPP).

              Any cert that has been found as described above is cached and tried first when validating the signatures of subsequent messages in the same transaction.

              OSSL_CMP_validate_cert_path() attempts to validate the given certificate and its path using the given store of trusted certs (possibly including CRLs and a cert verification callback) and non-trusted intermediate certs from the ctx.

              "},{"location":"man3/OSSL_CMP_validate_msg/#notes","title":"NOTES","text":"

              CMP is defined in RFC 4210 (and CRMF in RFC 4211).

              "},{"location":"man3/OSSL_CMP_validate_msg/#return-values","title":"RETURN VALUES","text":"

              OSSL_CMP_validate_msg() and OSSL_CMP_validate_cert_path() return 1 on success, 0 on error or validation failed.

              "},{"location":"man3/OSSL_CMP_validate_msg/#see-also","title":"SEE ALSO","text":"

              OSSL_CMP_CTX_new(3), OSSL_CMP_exec_certreq(3), OSSL_CMP_CTX_set1_secretValue(3), OSSL_CMP_CTX_set1_srvCert(3), OSSL_CMP_CTX_set1_untrusted(3), OSSL_CMP_CTX_set0_trustedStore(3)

              "},{"location":"man3/OSSL_CMP_validate_msg/#history","title":"HISTORY","text":"

              The OpenSSL CMP support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CMP_validate_msg/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CORE_MAKE_FUNC/","title":"OSSL_CORE_MAKE_FUNC","text":""},{"location":"man3/OSSL_CORE_MAKE_FUNC/#name","title":"NAME","text":"

              OSSL_CORE_MAKE_FUNC, SSL_OP_BIT, EXT_UTF8STRING - OpenSSL reserved symbols

              "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/core_dispatch.h>\n\n#define OSSL_CORE_MAKE_FUNC(type,name,args)\n#define SSL_OP_BIT(n)\n#define EXT_UTF8STRING(nid)\n
              "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#description","title":"DESCRIPTION","text":"

              There are certain macros that may appear in OpenSSL header files that are reserved for internal use. They should not be used by applications or assumed to exist.

              All the macros listed in the synopsis above are reserved.

              "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#return-values","title":"RETURN VALUES","text":"

              Not applicable.

              "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#history","title":"HISTORY","text":"

              The macros described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#copyright","title":"COPYRIGHT","text":"

              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/","title":"OSSL_CRMF_MSG_get0_tmpl","text":""},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#name","title":"NAME","text":"

              OSSL_CRMF_MSG_get0_tmpl, OSSL_CRMF_CERTTEMPLATE_get0_serialNumber, OSSL_CRMF_CERTTEMPLATE_get0_subject, OSSL_CRMF_CERTTEMPLATE_get0_issuer, OSSL_CRMF_CERTTEMPLATE_get0_extensions, OSSL_CRMF_CERTID_get0_serialNumber, OSSL_CRMF_CERTID_get0_issuer, OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert, OSSL_CRMF_MSG_get_certReqId - functions reading from CRMF CertReqMsg structures

              "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/crmf.h>\n\nOSSL_CRMF_CERTTEMPLATE *OSSL_CRMF_MSG_get0_tmpl(const OSSL_CRMF_MSG *crm);\nconst ASN1_INTEGER\n*OSSL_CRMF_CERTTEMPLATE_get0_serialNumber(const OSSL_CRMF_CERTTEMPLATE *tmpl);\nconst X509_NAME\n*OSSL_CRMF_CERTTEMPLATE_get0_subject(const OSSL_CRMF_CERTTEMPLATE *tmpl);\nconst X509_NAME\n*OSSL_CRMF_CERTTEMPLATE_get0_issuer(const OSSL_CRMF_CERTTEMPLATE *tmpl);\nX509_EXTENSIONS\n*OSSL_CRMF_CERTTEMPLATE_get0_extensions(const OSSL_CRMF_CERTTEMPLATE *tmpl);\n\nconst ASN1_INTEGER\n*OSSL_CRMF_CERTID_get0_serialNumber(const OSSL_CRMF_CERTID *cid);\nconst X509_NAME *OSSL_CRMF_CERTID_get0_issuer(const OSSL_CRMF_CERTID *cid);\n\nX509\n*OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert,\n                                       OSSL_LIB_CTX *libctx, const char *propq,\n                                       EVP_PKEY *pkey);\n\nint OSSL_CRMF_MSG_get_certReqId(const OSSL_CRMF_MSG *crm);\n
              "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#description","title":"DESCRIPTION","text":"

              OSSL_CRMF_MSG_get0_tmpl() retrieves the certificate template of crm.

              OSSL_CRMF_CERTTEMPLATE_get0_serialNumber() retrieves the serialNumber of the given certificate template tmpl.

              OSSL_CRMF_CERTTEMPLATE_get0_subject() retrieves the subject name of the given certificate template tmpl.

              OSSL_CRMF_CERTTEMPLATE_get0_issuer() retrieves the issuer name of the given certificate template tmpl.

              OSSL_CRMF_CERTTEMPLATE_get0_extensions() retrieves the X.509 extensions of the given certificate template tmpl, or NULL if not present.

              OSSL_CRMF_CERTID_get0_serialNumber retrieves the serialNumber of the given CertId cid.

              OSSL_CRMF_CERTID_get0_issuer retrieves the issuer name of the given CertId cid, which must be of ASN.1 type GEN_DIRNAME.

              OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert() decrypts the certificate in the given encryptedValue ecert, using the private key pkey, library context libctx and property query string propq (see OSSL_LIB_CTX(3)). This is needed for the indirect POPO method as in RFC 4210 section 5.2.8.2. The function returns the decrypted certificate as a copy, leaving its ownership with the caller, who is responsible for freeing it.

              OSSL_CRMF_MSG_get_certReqId() retrieves the certReqId of crm.

              "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#return-values","title":"RETURN VALUES","text":"

              OSSL_CRMF_MSG_get_certReqId() returns the certificate request ID as a nonnegative integer or -1 on error.

              All other functions return a pointer with the intended result or NULL on error.

              "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#see-also","title":"SEE ALSO","text":"

              RFC 4211

              "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#history","title":"HISTORY","text":"

              The OpenSSL CRMF support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/","title":"OSSL_CRMF_MSG_set0_validity","text":""},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#name","title":"NAME","text":"

              OSSL_CRMF_MSG_set0_validity, OSSL_CRMF_MSG_set_certReqId, OSSL_CRMF_CERTTEMPLATE_fill, OSSL_CRMF_MSG_set0_extensions, OSSL_CRMF_MSG_push0_extension, OSSL_CRMF_MSG_create_popo, OSSL_CRMF_MSGS_verify_popo - functions populating and verifying CRMF CertReqMsg structures

              "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/crmf.h>\n\nint OSSL_CRMF_MSG_set0_validity(OSSL_CRMF_MSG *crm,\n                                ASN1_TIME *notBefore, ASN1_TIME *notAfter);\n\nint OSSL_CRMF_MSG_set_certReqId(OSSL_CRMF_MSG *crm, int rid);\n\nint OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_CERTTEMPLATE *tmpl,\n                                EVP_PKEY *pubkey,\n                                const X509_NAME *subject,\n                                const X509_NAME *issuer,\n                                const ASN1_INTEGER *serial);\n\nint OSSL_CRMF_MSG_set0_extensions(OSSL_CRMF_MSG *crm, X509_EXTENSIONS *exts);\n\nint OSSL_CRMF_MSG_push0_extension(OSSL_CRMF_MSG *crm, X509_EXTENSION *ext);\n\nint OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,\n                              EVP_PKEY *pkey, const EVP_MD *digest,\n                              OSSL_LIB_CTX *libctx, const char *propq);\n\nint OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs,\n                               int rid, int acceptRAVerified,\n                               OSSL_LIB_CTX *libctx, const char *propq);\n
              "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#description","title":"DESCRIPTION","text":"

              OSSL_CRMF_MSG_set0_validity() sets the notBefore and notAfter fields as validity constraints in the certTemplate of crm. Any of the notBefore and notAfter parameters may be NULL, which means no constraint for the respective field. On success ownership of notBefore and notAfter is transferred to crm.

              OSSL_CRMF_MSG_set_certReqId() sets rid as the certReqId of crm.

              OSSL_CRMF_CERTTEMPLATE_fill() sets those fields of the certTemplate tmpl for which non-NULL values are provided: pubkey, subject, issuer, and/or serial. X.509 extensions may be set using OSSL_CRMF_MSG_set0_extensions(). On success the reference counter of the pubkey (if given) is incremented, while the subject, issuer, and serial structures (if given) are copied.

              OSSL_CRMF_MSG_set0_extensions() sets exts as the extensions in the certTemplate of crm. Frees any pre-existing ones and consumes exts.

              OSSL_CRMF_MSG_push0_extension() pushes the X509 extension ext to the extensions in the certTemplate of crm. Consumes ext.

              OSSL_CRMF_MSG_create_popo() creates and sets the Proof-of-Possession (POPO) according to the method meth in crm. The library context libctx and property query string propq, may be NULL to select the defaults. In case the method is OSSL_CRMF_POPO_SIGNATURE the POPO is calculated using the private key pkey and the digest method digest, where the digest argument is ignored if pkey is of a type (such as Ed25519 and Ed448) that is implicitly associated with a digest algorithm.

              meth can be one of the following:

              • OSSL_CRMF_POPO_NONE - RFC 4211, section 4, POP field omitted. CA/RA uses out-of-band method to verify POP. Note that servers may fail in this case, resulting for instance in HTTP error code 500 (Internal error).
              • OSSL_CRMF_POPO_RAVERIFIED - RFC 4211, section 4, explicit indication that the RA has already verified the POP.
              • OSSL_CRMF_POPO_SIGNATURE - RFC 4211, section 4.1, only case 3 supported so far.
              • OSSL_CRMF_POPO_KEYENC - RFC 4211, section 4.2, only indirect method (subsequentMessage/enccert) supported, challenge-response exchange (challengeResp) not yet supported.
              • OSSL_CRMF_POPO_KEYAGREE - RFC 4211, section 4.3, not yet supported.

              OSSL_CRMF_MSGS_verify_popo verifies the Proof-of-Possession of the request with the given rid in the list of reqs. Optionally accepts RAVerified. It can make use of the library context libctx and property query string propq.

              "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#return-values","title":"RETURN VALUES","text":"

              All functions return 1 on success, 0 on error.

              "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#see-also","title":"SEE ALSO","text":"

              RFC 4211

              "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#history","title":"HISTORY","text":"

              The OpenSSL CRMF support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/","title":"OSSL_CRMF_MSG_set1_regCtrl_regToken","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#name","title":"NAME","text":"

              OSSL_CRMF_MSG_get0_regCtrl_regToken, OSSL_CRMF_MSG_set1_regCtrl_regToken, OSSL_CRMF_MSG_get0_regCtrl_authenticator, OSSL_CRMF_MSG_set1_regCtrl_authenticator, OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo, OSSL_CRMF_MSG_set0_SinglePubInfo, OSSL_CRMF_MSG_set_PKIPublicationInfo_action, OSSL_CRMF_MSG_get0_regCtrl_pkiPublicationInfo, OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo, OSSL_CRMF_MSG_get0_regCtrl_protocolEncrKey, OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey, OSSL_CRMF_MSG_get0_regCtrl_oldCertID, OSSL_CRMF_MSG_set1_regCtrl_oldCertID, OSSL_CRMF_CERTID_gen - functions getting or setting CRMF Registration Controls

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/crmf.h>\n\nASN1_UTF8STRING\n   *OSSL_CRMF_MSG_get0_regCtrl_regToken(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_regToken(OSSL_CRMF_MSG *msg,\n                                        const ASN1_UTF8STRING *tok);\nASN1_UTF8STRING\n   *OSSL_CRMF_MSG_get0_regCtrl_authenticator(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_authenticator(OSSL_CRMF_MSG *msg,\n                                             const ASN1_UTF8STRING *auth);\nint OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo(\n                                 OSSL_CRMF_PKIPUBLICATIONINFO *pi,\n                                 OSSL_CRMF_SINGLEPUBINFO *spi);\nint OSSL_CRMF_MSG_set0_SinglePubInfo(OSSL_CRMF_SINGLEPUBINFO *spi,\n                                     int method, GENERAL_NAME *nm);\nint OSSL_CRMF_MSG_set_PKIPublicationInfo_action(\n                                 OSSL_CRMF_PKIPUBLICATIONINFO *pi, int action);\nOSSL_CRMF_PKIPUBLICATIONINFO\n   *OSSL_CRMF_MSG_get0_regCtrl_pkiPublicationInfo(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo(OSSL_CRMF_MSG *msg,\n                                       const OSSL_CRMF_PKIPUBLICATIONINFO *pi);\nX509_PUBKEY\n   *OSSL_CRMF_MSG_get0_regCtrl_protocolEncrKey(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey(OSSL_CRMF_MSG *msg,\n                                               const X509_PUBKEY *pubkey);\nOSSL_CRMF_CERTID\n   *OSSL_CRMF_MSG_get0_regCtrl_oldCertID(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_oldCertID(OSSL_CRMF_MSG *msg,\n                                         const OSSL_CRMF_CERTID *cid);\nOSSL_CRMF_CERTID *OSSL_CRMF_CERTID_gen(const X509_NAME *issuer,\n                                       const ASN1_INTEGER *serial);\n
              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#description","title":"DESCRIPTION","text":"

              Each of the OSSL_CRMF_MSG_get0_regCtrl_X() functions returns the respective control X in the given msg, if present.

              OSSL_CRMF_MSG_set1_regCtrl_regToken() sets the regToken control in the given msg copying the given tok as value. See RFC 4211, section 6.1.

              OSSL_CRMF_MSG_set1_regCtrl_authenticator() sets the authenticator control in the given msg copying the given auth as value. See RFC 4211, section 6.2.

              OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo() pushes the given spi to si. Consumes the spi pointer.

              OSSL_CRMF_MSG_set0_SinglePubInfo() sets in the given SinglePubInfo spi the method and publication location, in the form of a GeneralName, nm. The publication location is optional, and therefore nm may be NULL. The function consumes the nm pointer if present. Available methods are:

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_dontcare-0","title":"# define OSSL_CRMF_PUB_METHOD_DONTCARE 0","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_x500-1","title":"# define OSSL_CRMF_PUB_METHOD_X500 1","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_web-2","title":"# define OSSL_CRMF_PUB_METHOD_WEB 2","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_ldap-3","title":"# define OSSL_CRMF_PUB_METHOD_LDAP 3","text":"

              OSSL_CRMF_MSG_set_PKIPublicationInfo_action() sets the action in the given pi using the given action as value. See RFC 4211, section 6.3. Available actions are:

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_action_dontpublish-0","title":"# define OSSL_CRMF_PUB_ACTION_DONTPUBLISH 0","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_action_pleasepublish-1","title":"# define OSSL_CRMF_PUB_ACTION_PLEASEPUBLISH 1","text":"

              OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo() sets the pkiPublicationInfo control in the given msg copying the given tok as value. See RFC 4211, section 6.3.

              OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey() sets the protocolEncrKey control in the given msg copying the given pubkey as value. See RFC 4211 section 6.6.

              OSSL_CRMF_MSG_set1_regCtrl_oldCertID() sets the oldCertID regToken control in the given msg copying the given cid as value. See RFC 4211, section 6.5.

              OSSL_CRMF_CERTID_gen produces an OSSL_CRMF_CERTID_gen structure copying the given issuer name and serial number.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#return-values","title":"RETURN VALUES","text":"

              All OSSL_CRMF_MSG_get0_*() functions return the respective pointer value or NULL if not present and on error.

              All OSSL_CRMF_MSG_set1_*() functions return 1 on success, 0 on error.

              OSSL_CRMF_CERTID_gen() returns a pointer to the resulting structure or NULL on error.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#notes","title":"NOTES","text":"

              A function OSSL_CRMF_MSG_set1_regCtrl_pkiArchiveOptions() for setting an Archive Options Control is not yet implemented due to missing features to create the needed OSSL_CRMF_PKIARCHIVEOPTINS content.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#see-also","title":"SEE ALSO","text":"

              RFC 4211

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#history","title":"HISTORY","text":"

              The OpenSSL CRMF support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/","title":"OSSL_CRMF_MSG_set1_regInfo_certReq","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#name","title":"NAME","text":"

              OSSL_CRMF_MSG_get0_regInfo_utf8Pairs, OSSL_CRMF_MSG_set1_regInfo_utf8Pairs, OSSL_CRMF_MSG_get0_regInfo_certReq, OSSL_CRMF_MSG_set1_regInfo_certReq - functions getting or setting CRMF Registration Info

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/crmf.h>\n\nASN1_UTF8STRING\n    *OSSL_CRMF_MSG_get0_regInfo_utf8Pairs(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regInfo_utf8Pairs(OSSL_CRMF_MSG *msg,\n                                         const ASN1_UTF8STRING *utf8pairs);\nOSSL_CRMF_CERTREQUEST\n    *OSSL_CRMF_MSG_get0_regInfo_certReq(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regInfo_certReq(OSSL_CRMF_MSG *msg,\n                                       const OSSL_CRMF_CERTREQUEST *cr);\n
              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#description","title":"DESCRIPTION","text":"

              OSSL_CRMF_MSG_get0_regInfo_utf8Pairs() returns the first utf8Pairs regInfo in the given msg, if present.

              OSSL_CRMF_MSG_set1_regInfo_utf8Pairs() adds a copy of the given utf8pairs value as utf8Pairs regInfo to the given msg. See RFC 4211 section 7.1.

              OSSL_CRMF_MSG_get0_regInfo_certReq() returns the first certReq regInfo in the given msg, if present.

              OSSL_CRMF_MSG_set1_regInfo_certReq() adds a copy of the given cr value as certReq regInfo to the given msg. See RFC 4211 section 7.2.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#return-values","title":"RETURN VALUES","text":"

              All get0_*() functions return the respective pointer value, NULL if not present.

              All set1_*() functions return 1 on success, 0 on error.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#notes","title":"NOTES","text":"

              Calling the set1_*() functions multiple times adds multiple instances of the respective control to the regInfo structure of the given msg. While RFC 4211 expects multiple utf8Pairs in one regInfo structure, it does not allow multiple certReq.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#see-also","title":"SEE ALSO","text":"

              RFC 4211

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#history","title":"HISTORY","text":"

              The OpenSSL CRMF support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_CRMF_pbmp_new/","title":"OSSL_CRMF_pbmp_new","text":""},{"location":"man3/OSSL_CRMF_pbmp_new/#name","title":"NAME","text":"

              OSSL_CRMF_pbm_new, OSSL_CRMF_pbmp_new - functions for producing Password-Based MAC (PBM)

              "},{"location":"man3/OSSL_CRMF_pbmp_new/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/crmf.h>\n\nint OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,\n                      const OSSL_CRMF_PBMPARAMETER *pbmp,\n                      const unsigned char *msg, size_t msglen,\n                      const unsigned char *sec, size_t seclen,\n                      unsigned char **mac, size_t *maclen);\n\nOSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OSSL_LIB_CTX *libctx, size_t saltlen,\n                                           int owfnid, size_t itercnt,\n                                           int macnid);\n
              "},{"location":"man3/OSSL_CRMF_pbmp_new/#description","title":"DESCRIPTION","text":"

              OSSL_CRMF_pbm_new() generates a PBM (Password-Based MAC) based on given PBM parameters pbmp, message msg, and secret sec, along with the respective lengths msglen and seclen. The optional library context libctx and propq parameters may be used to influence the selection of the MAC algorithm referenced in the pbmp; see \"ALGORITHM FETCHING\" in crypto(7) for further information. On success writes the address of the newly allocated MAC via the mac reference parameter and writes the length via the maclen reference parameter unless it its NULL.

              OSSL_CRMF_pbmp_new() initializes and returns a new PBMParameter structure with a new random salt of given length saltlen, OWF (one-way function) NID owfnid, OWF iteration count itercnt, and MAC NID macnid. The library context libctx parameter may be used to select the provider for the random number generation (DRBG) and may be NULL for the default.

              "},{"location":"man3/OSSL_CRMF_pbmp_new/#notes","title":"NOTES","text":"

              The algorithms for the OWF (one-way function) and for the MAC (message authentication code) may be any with a NID defined in <openssl/objects.h>. As specified by RFC 4210, these should include NID_hmac_sha1.

              RFC 4210 recommends that the salt SHOULD be at least 8 bytes (64 bits) long, where 16 bytes is common.

              The iteration count must be at least 100, as stipulated by RFC 4211, and is limited to at most 100000 to avoid DoS through manipulated or otherwise malformed input.

              "},{"location":"man3/OSSL_CRMF_pbmp_new/#return-values","title":"RETURN VALUES","text":"

              OSSL_CRMF_pbm_new() returns 1 on success, 0 on error.

              OSSL_CRMF_pbmp_new() returns a new and initialized OSSL_CRMF_PBMPARAMETER structure, or NULL on error.

              "},{"location":"man3/OSSL_CRMF_pbmp_new/#examples","title":"EXAMPLES","text":"
              OSSL_CRMF_PBMPARAMETER *pbm = NULL;\nunsigned char *msg = \"Hello\";\nunsigned char *sec = \"SeCrEt\";\nunsigned char *mac = NULL;\nsize_t maclen;\n\nif ((pbm = OSSL_CRMF_pbmp_new(16, NID_sha256, 500, NID_hmac_sha1) == NULL))\n    goto err;\nif (!OSSL_CRMF_pbm_new(pbm, msg, 5, sec, 6, &mac, &maclen))\n    goto err;\n
              "},{"location":"man3/OSSL_CRMF_pbmp_new/#see-also","title":"SEE ALSO","text":"

              RFC 4211 section 4.4

              "},{"location":"man3/OSSL_CRMF_pbmp_new/#history","title":"HISTORY","text":"

              The OpenSSL CRMF support was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_CRMF_pbmp_new/#copyright","title":"COPYRIGHT","text":"

              Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_DECODER/","title":"OSSL_DECODER","text":""},{"location":"man3/OSSL_DECODER/#name","title":"NAME","text":"

              OSSL_DECODER, OSSL_DECODER_fetch, OSSL_DECODER_up_ref, OSSL_DECODER_free, OSSL_DECODER_get0_provider, OSSL_DECODER_get0_properties, OSSL_DECODER_is_a, OSSL_DECODER_get0_name, OSSL_DECODER_get0_description, OSSL_DECODER_do_all_provided, OSSL_DECODER_names_do_all, OSSL_DECODER_gettable_params, OSSL_DECODER_get_params - Decoder method routines

              "},{"location":"man3/OSSL_DECODER/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/decoder.h>\n\ntypedef struct ossl_decoder_st OSSL_DECODER;\n\nOSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *ctx, const char *name,\n                                 const char *properties);\nint OSSL_DECODER_up_ref(OSSL_DECODER *decoder);\nvoid OSSL_DECODER_free(OSSL_DECODER *decoder);\nconst OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *decoder);\nconst char *OSSL_DECODER_get0_properties(const OSSL_DECODER *decoder);\nint OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name);\nconst char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder);\nconst char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder);\nvoid OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                  void (*fn)(OSSL_DECODER *decoder, void *arg),\n                                  void *arg);\nint OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,\n                              void (*fn)(const char *name, void *data),\n                              void *data);\nconst OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);\nint OSSL_DECODER_get_params(OSSL_DECODER_CTX *ctx, const OSSL_PARAM params[]);\n
              "},{"location":"man3/OSSL_DECODER/#description","title":"DESCRIPTION","text":"

              OSSL_DECODER is a method for decoders, which know how to decode encoded data into an object of some type that the rest of OpenSSL knows how to handle.

              OSSL_DECODER_fetch() looks for an algorithm within the provider that has been loaded into the OSSL_LIB_CTX given by ctx, having the name given by name and the properties given by properties. The name determines what type of object the fetched decoder method is expected to be able to decode, and the properties are used to determine the expected output type. For known properties and the values they may have, please have a look in \"Names and properties\" in provider-encoder(7).

              OSSL_DECODER_up_ref() increments the reference count for the given decoder.

              OSSL_DECODER_free() decrements the reference count for the given decoder, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

              OSSL_DECODER_get0_provider() returns the provider of the given decoder.

              OSSL_DECODER_get0_properties() returns the property definition associated with the given decoder.

              OSSL_DECODER_is_a() checks if decoder is an implementation of an algorithm that's identifiable with name.

              OSSL_DECODER_get0_name() returns the name used to fetch the given decoder.

              OSSL_DECODER_get0_description() returns a description of the decoder, meant for display and human consumption. The description is at the discretion of the decoder implementation.

              OSSL_DECODER_names_do_all() traverses all names for the given decoder, and calls fn with each name and data as arguments.

              OSSL_DECODER_do_all_provided() traverses all decoder implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and arg as arguments.

              OSSL_DECODER_gettable_params() returns an OSSL_PARAM(3) array of parameter descriptors.

              OSSL_DECODER_get_params() attempts to get parameters specified with an OSSL_PARAM(3) array params. Parameters that the implementation doesn't recognise should be ignored.

              "},{"location":"man3/OSSL_DECODER/#return-values","title":"RETURN VALUES","text":"

              OSSL_DECODER_fetch() returns a pointer to an OSSL_DECODER object, or NULL on error.

              OSSL_DECODER_up_ref() returns 1 on success, or 0 on error.

              OSSL_DECODER_free() doesn't return any value.

              OSSL_DECODER_get0_provider() returns a pointer to a provider object, or NULL on error.

              OSSL_DECODER_get0_properties() returns a pointer to a property definition string, or NULL on error.

              OSSL_DECODER_is_a() returns 1 if decoder was identifiable, otherwise 0.

              OSSL_DECODER_get0_name() returns the algorithm name from the provided implementation for the given decoder. Note that the decoder may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the decoder object and should not be freed by the caller.

              OSSL_DECODER_get0_description() returns a pointer to a description, or NULL if there isn't one.

              OSSL_DECODER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

              "},{"location":"man3/OSSL_DECODER/#notes","title":"NOTES","text":"

              OSSL_DECODER_fetch() may be called implicitly by other fetching functions, using the same library context and properties. Any other API that uses keys will typically do this.

              "},{"location":"man3/OSSL_DECODER/#examples","title":"EXAMPLES","text":"

              To list all decoders in a provider to a bio_out:

              static void collect_decoders(OSSL_DECODER *decoder, void *stack)\n{\n    STACK_OF(OSSL_DECODER) *decoder_stack = stack;\n\n    sk_OSSL_DECODER_push(decoder_stack, decoder);\n    OSSL_DECODER_up_ref(decoder);\n}\n\nvoid print_name(const char *name, void *vdata)\n{\n    BIO *bio = vdata;\n\n    BIO_printf(bio, \"%s \", name);\n}\n\n\nSTACK_OF(OSSL_DECODER) *decoders;\nint i;\n\ndecoders = sk_OSSL_DECODER_new_null();\n\nBIO_printf(bio_out, \"DECODERs provided by %s:\\n\", provider);\nOSSL_DECODER_do_all_provided(NULL, collect_decoders,\n                             decoders);\n\nfor (i = 0; i < sk_OSSL_DECODER_num(decoders); i++) {\n    OSSL_DECODER *decoder = sk_OSSL_DECODER_value(decoders, i);\n\n    if (strcmp(OSSL_PROVIDER_get0_name(OSSL_DECODER_get0_provider(decoder)),\n               provider) != 0)\n        continue;\n\n    if (OSSL_DECODER_names_do_all(decoder, print_name, bio_out))\n           BIO_printf(bio_out, \"\\n\");\n}\nsk_OSSL_DECODER_pop_free(decoders, OSSL_DECODER_free);\n
              "},{"location":"man3/OSSL_DECODER/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_DECODER_CTX(3), OSSL_DECODER_from_bio(3), OSSL_DECODER_CTX_new_for_pkey(3), OSSL_LIB_CTX(3)

              "},{"location":"man3/OSSL_DECODER/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_DECODER/#copyright","title":"COPYRIGHT","text":"

              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_DECODER_CTX/","title":"OSSL_DECODER_CTX","text":""},{"location":"man3/OSSL_DECODER_CTX/#name","title":"NAME","text":"

              OSSL_DECODER_CTX, OSSL_DECODER_CTX_new, OSSL_DECODER_settable_ctx_params, OSSL_DECODER_CTX_set_params, OSSL_DECODER_CTX_free, OSSL_DECODER_CTX_set_selection, OSSL_DECODER_CTX_set_input_type, OSSL_DECODER_CTX_set_input_structure, OSSL_DECODER_CTX_add_decoder, OSSL_DECODER_CTX_add_extra, OSSL_DECODER_CTX_get_num_decoders, OSSL_DECODER_INSTANCE, OSSL_DECODER_CONSTRUCT, OSSL_DECODER_CLEANUP, OSSL_DECODER_CTX_set_construct, OSSL_DECODER_CTX_set_construct_data, OSSL_DECODER_CTX_set_cleanup, OSSL_DECODER_CTX_get_construct, OSSL_DECODER_CTX_get_construct_data, OSSL_DECODER_CTX_get_cleanup, OSSL_DECODER_export, OSSL_DECODER_INSTANCE_get_decoder, OSSL_DECODER_INSTANCE_get_decoder_ctx, OSSL_DECODER_INSTANCE_get_input_type, OSSL_DECODER_INSTANCE_get_input_structure - Decoder context routines

              "},{"location":"man3/OSSL_DECODER_CTX/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/decoder.h>\n\ntypedef struct ossl_decoder_ctx_st OSSL_DECODER_CTX;\n\nOSSL_DECODER_CTX *OSSL_DECODER_CTX_new(void);\nconst OSSL_PARAM *OSSL_DECODER_settable_ctx_params(OSSL_DECODER *decoder);\nint OSSL_DECODER_CTX_set_params(OSSL_DECODER_CTX *ctx,\n                                const OSSL_PARAM params[]);\nvoid OSSL_DECODER_CTX_free(OSSL_DECODER_CTX *ctx);\n\nint OSSL_DECODER_CTX_set_selection(OSSL_DECODER_CTX *ctx, int selection);\nint OSSL_DECODER_CTX_set_input_type(OSSL_DECODER_CTX *ctx,\n                                    const char *input_type);\nint OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx,\n                                         const char *input_structure);\nint OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder);\nint OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx, \n                               OSSL_LIB_CTX *libctx, \n                               const char *propq);\nint OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx);\n\ntypedef struct ossl_decoder_instance_st OSSL_DECODER_INSTANCE;\nOSSL_DECODER *\nOSSL_DECODER_INSTANCE_get_decoder(OSSL_DECODER_INSTANCE *decoder_inst);\nvoid *\nOSSL_DECODER_INSTANCE_get_decoder_ctx(OSSL_DECODER_INSTANCE *decoder_inst);\nconst char *\nOSSL_DECODER_INSTANCE_get_input_type(OSSL_DECODER_INSTANCE *decoder_inst);\nOSSL_DECODER_INSTANCE_get_input_structure(OSSL_DECODER_INSTANCE *decoder_inst,\n                                          int *was_set);\n\ntypedef int OSSL_DECODER_CONSTRUCT(OSSL_DECODER_INSTANCE *decoder_inst,\n                                   const OSSL_PARAM *object,\n                                   void *construct_data);\ntypedef void OSSL_DECODER_CLEANUP(void *construct_data);\n\nint OSSL_DECODER_CTX_set_construct(OSSL_DECODER_CTX *ctx,\n                                   OSSL_DECODER_CONSTRUCT *construct);\nint OSSL_DECODER_CTX_set_construct_data(OSSL_DECODER_CTX *ctx,\n                                        void *construct_data);\nint OSSL_DECODER_CTX_set_cleanup(OSSL_DECODER_CTX *ctx,\n                                 OSSL_DECODER_CLEANUP *cleanup);\nOSSL_DECODER_CONSTRUCT *OSSL_DECODER_CTX_get_construct(OSSL_DECODER_CTX *ctx);\nvoid *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx);\nOSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx);\n\nint OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst,\n                        void *reference, size_t reference_sz,\n                        OSSL_CALLBACK *export_cb, void *export_cbarg);\n
              "},{"location":"man3/OSSL_DECODER_CTX/#description","title":"DESCRIPTION","text":"

              The OSSL_DECODER_CTX holds data about multiple decoders, as needed to figure out what the input data is and to attempt to unpack it into one of several possible related results. This also includes chaining decoders, so the output from one can become the input for another. This allows having generic format decoders such as PEM to DER, as well as more specialized decoders like DER to RSA.

              The chains may be limited by specifying an input type, which is considered a starting point. This is both considered by OSSL_DECODER_CTX_add_extra(), which will stop adding one more decoder implementations when it has already added those that take the specified input type, and functions like OSSL_DECODER_from_bio(3), which will only start the decoding process with the decoder implementations that take that input type. For example, if the input type is set to DER, a PEM to DER decoder will be ignored.

              The input type can also be NULL, which means that the caller doesn't know what type of input they have. In this case, OSSL_DECODER_from_bio() will simply try with one decoder implementation after the other, and thereby discover what kind of input the caller gave it.

              For every decoding done, even an intermediary one, a constructor provided by the caller is called to attempt to construct an appropriate type / structure that the caller knows how to handle from the current decoding result. The constructor is set with OSSL_DECODER_CTX_set_construct().

              OSSL_DECODER_INSTANCE is an opaque structure that contains data about the decoder that was just used, and that may be useful for the constructor. There are some functions to extract data from this type, described further down.

              "},{"location":"man3/OSSL_DECODER_CTX/#functions","title":"Functions","text":"

              OSSL_DECODER_CTX_new() creates a new empty OSSL_DECODER_CTX.

              OSSL_DECODER_settable_ctx_params() returns an OSSL_PARAM(3) array of parameter descriptors.

              OSSL_DECODER_CTX_set_params() attempts to set parameters specified with an OSSL_PARAM(3) array params. These parameters are passed to all decoders that have been added to the ctx so far. Parameters that an implementation doesn't recognise should be ignored by it.

              OSSL_DECODER_CTX_free() frees the given context ctx. If the argument is NULL, nothing is done.

              OSSL_DECODER_CTX_add_decoder() populates the OSSL_DECODER_CTX ctx with a decoder, to be used to attempt to decode some encoded input.

              OSSL_DECODER_CTX_add_extra() finds decoders that generate input for already added decoders, and adds them as well. This is used to build decoder chains.

              OSSL_DECODER_CTX_set_input_type() sets the starting input type. This limits the decoder chains to be considered, as explained in the general description above.

              OSSL_DECODER_CTX_set_input_structure() sets the name of the structure that the input is expected to have. This may be used to determines what decoder implementations may be used. NULL is a valid input structure, when it's not relevant, or when the decoder implementations are expected to figure it out.

              OSSL_DECODER_CTX_get_num_decoders() gets the number of decoders currently added to the context ctx.

              OSSL_DECODER_CTX_set_construct() sets the constructor construct.

              OSSL_DECODER_CTX_set_construct_data() sets the constructor data that is passed to the constructor every time it's called.

              OSSL_DECODER_CTX_set_cleanup() sets the constructor data cleanup function. This is called by OSSL_DECODER_CTX_free(3).

              OSSL_DECODER_CTX_get_construct(), OSSL_DECODER_CTX_get_construct_data() and OSSL_DECODER_CTX_get_cleanup() return the values that have been set by OSSL_DECODER_CTX_set_construct(), OSSL_DECODER_CTX_set_construct_data() and OSSL_DECODER_CTX_set_cleanup() respectively.

              OSSL_DECODER_export() is a fallback function for constructors that cannot use the data they get directly for diverse reasons. It takes the same decode instance decoder_inst that the constructor got and an object reference, unpacks the object which it refers to, and exports it by creating an OSSL_PARAM(3) array that it then passes to export_cb, along with export_arg.

              "},{"location":"man3/OSSL_DECODER_CTX/#constructor","title":"Constructor","text":"

              A OSSL_DECODER_CONSTRUCT gets the following arguments:

              • decoder_inst

                The OSSL_DECODER_INSTANCE for the decoder from which the constructor gets its data.

              • object

                A provider-native object abstraction produced by the decoder. Further information on the provider-native object abstraction can be found in provider-object(7).

              • construct_data

                The pointer that was set with OSSL_DECODE_CTX_set_construct_data().

              The constructor is expected to return 1 when the data it receives can be constructed, otherwise 0.

              These utility functions may be used by a constructor:

              OSSL_DECODER_INSTANCE_get_decoder() can be used to get the decoder implementation from a decoder instance decoder_inst.

              OSSL_DECODER_INSTANCE_get_decoder_ctx() can be used to get the decoder implementation's provider context from a decoder instance decoder_inst.

              OSSL_DECODER_INSTANCE_get_input_type() can be used to get the decoder implementation's input type from a decoder instance decoder_inst.

              OSSL_DECODER_INSTANCE_get_input_structure() can be used to get the input structure for the decoder implementation from a decoder instance decoder_inst. This may be NULL.

              "},{"location":"man3/OSSL_DECODER_CTX/#return-values","title":"RETURN VALUES","text":"

              OSSL_DECODER_CTX_new() returns a pointer to a OSSL_DECODER_CTX, or NULL if the context structure couldn't be allocated.

              OSSL_DECODER_settable_ctx_params() returns an OSSL_PARAM(3) array, or NULL if none is available.

              OSSL_DECODER_CTX_set_params() returns 1 if all recognised parameters were valid, or 0 if one of them was invalid or caused some other failure in the implementation.

              OSSL_DECODER_CTX_add_decoder(), OSSL_DECODER_CTX_add_extra(), OSSL_DECODER_CTX_set_construct(), OSSL_DECODER_CTX_set_construct_data() and OSSL_DECODER_CTX_set_cleanup() return 1 on success, or 0 on failure.

              OSSL_DECODER_CTX_get_construct(), OSSL_DECODER_CTX_get_construct_data() and OSSL_DECODER_CTX_get_cleanup() return the current pointers to the constructor, the constructor data and the cleanup functions, respectively.

              OSSL_DECODER_CTX_num_decoders() returns the current number of decoders. It returns 0 if ctx is NULL.

              OSSL_DECODER_export() returns 1 on success, or 0 on failure.

              OSSL_DECODER_INSTANCE_decoder() returns an OSSL_DECODER pointer on success, or NULL on failure.

              OSSL_DECODER_INSTANCE_decoder_ctx() returns a provider context pointer on success, or NULL on failure.

              "},{"location":"man3/OSSL_DECODER_CTX/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_DECODER(3), OSSL_DECODER_from_bio(3)

              "},{"location":"man3/OSSL_DECODER_CTX/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_DECODER_CTX/#copyright","title":"COPYRIGHT","text":"

              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/","title":"OSSL_DECODER_CTX_new_for_pkey","text":""},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#name","title":"NAME","text":"

              OSSL_DECODER_CTX_new_for_pkey, OSSL_DECODER_CTX_set_passphrase, OSSL_DECODER_CTX_set_pem_password_cb, OSSL_DECODER_CTX_set_passphrase_ui, OSSL_DECODER_CTX_set_passphrase_cb - Decoder routines to decode EVP_PKEYs

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/decoder.h>\n\nOSSL_DECODER_CTX *\nOSSL_DECODER_CTX_new_for_pkey(EVP_PKEY **pkey,\n                              const char *input_type,\n                              const char *input_struct,\n                              const char *keytype, int selection,\n                              OSSL_LIB_CTX *libctx, const char *propquery);\n\nint OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx,\n                                    const unsigned char *kstr,\n                                    size_t klen);\nint OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx,\n                                         pem_password_cb *cb,\n                                         void *cbarg);\nint OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx,\n                                       const UI_METHOD *ui_method,\n                                       void *ui_data);\nint OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,\n                                       OSSL_PASSPHRASE_CALLBACK *cb,\n                                       void *cbarg);\n
              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#description","title":"DESCRIPTION","text":"

              OSSL_DECODER_CTX_new_for_pkey() is a utility function that creates a OSSL_DECODER_CTX, finds all applicable decoder implementations and sets them up, so all the caller has to do next is call functions like OSSL_DECODER_from_bio(3). The caller may use the optional input_type, input_struct, keytype and selection to specify what the input is expected to contain. The pkey must reference an EVP_PKEY * variable that will be set to the newly created EVP_PKEY on successful decoding. The referenced variable must be initialized to NULL before calling the function.

              Internally OSSL_DECODER_CTX_new_for_pkey() searches for all available EVP_KEYMGMT(3) implementations, and then builds a list of all potential decoder implementations that may be able to process the encoded input into data suitable for EVP_PKEYs. All these implementations are implicitly fetched using libctx and propquery.

              The search of decoder implementations can be limited with input_type and input_struct which specifies a starting input type and input structure. NULL is valid for both of them and signifies that the decoder implementations will find out the input type on their own. They are set with OSSL_DECODER_CTX_set_input_type(3) and OSSL_DECODER_CTX_set_input_structure(3). See \"Input Types\" and \"Input Structures\" below for further information.

              The search of decoder implementations can also be limited with keytype and selection, which specifies the expected resulting keytype and contents. NULL and zero are valid and signify that the decoder implementations will find out the keytype and key contents on their own from the input they get.

              If no suitable decoder implementation is found, OSSL_DECODER_CTX_new_for_pkey() still creates a OSSL_DECODER_CTX, but with no associated decoder (OSSL_DECODER_CTX_get_num_decoders(3) returns zero). This helps the caller to distinguish between an error when creating the OSSL_ENCODER_CTX and missing encoder implementation, and allows it to act accordingly.

              OSSL_DECODER_CTX_set_passphrase() gives the implementation a pass phrase to use when decrypting the encoded private key. Alternatively, a pass phrase callback may be specified with the following functions.

              OSSL_DECODER_CTX_set_pem_password_cb(), OSSL_DECODER_CTX_set_passphrase_ui() and OSSL_DECODER_CTX_set_passphrase_cb() set up a callback method that the implementation can use to prompt for a pass phrase, giving the caller the choice of preferred pass phrase callback form. These are called indirectly, through an internal OSSL_PASSPHRASE_CALLBACK(3) function.

              The internal OSSL_PASSPHRASE_CALLBACK(3) function caches the pass phrase, to be re-used in all decodings that are performed in the same decoding run (for example, within one OSSL_DECODER_from_bio(3) call).

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#input-types","title":"Input Types","text":"

              Available input types depend on the implementations that available providers offer, and provider documentation should have the details.

              Among the known input types that OpenSSL decoder implementations offer for EVP_PKEYs are DER, PEM, MSBLOB and PVK. See openssl-glossary(7) for further information on what these input types mean.

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#input-structures","title":"Input Structures","text":"

              Available input structures depend on the implementations that available providers offer, and provider documentation should have the details.

              Among the known input structures that OpenSSL decoder implementations offer for EVP_PKEYs are pkcs8 and SubjectPublicKeyInfo.

              OpenSSL decoder implementations also support the input structure type-specific. This is the structure used for keys encoded according to key type specific specifications. For example, RSA keys encoded according to PKCS#1.

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#selections","title":"Selections","text":"

              selection can be any one of the values described in \"Selections\" in EVP_PKEY_fromdata(3). Additionally selection can also be set to 0 to indicate that the code will auto detect the selection.

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#return-values","title":"RETURN VALUES","text":"

              OSSL_DECODER_CTX_new_for_pkey() returns a pointer to a OSSL_DECODER_CTX, or NULL if it couldn't be created.

              OSSL_DECODER_CTX_set_passphrase(), OSSL_DECODER_CTX_set_pem_password_cb(), OSSL_DECODER_CTX_set_passphrase_ui() and OSSL_DECODER_CTX_set_passphrase_cb() all return 1 on success, or 0 on failure.

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_DECODER(3), OSSL_DECODER_CTX(3)

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#copyright","title":"COPYRIGHT","text":"

              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_DECODER_from_bio/","title":"OSSL_DECODER_from_bio","text":""},{"location":"man3/OSSL_DECODER_from_bio/#name","title":"NAME","text":"

              OSSL_DECODER_from_data, OSSL_DECODER_from_bio, OSSL_DECODER_from_fp - Routines to perform a decoding

              "},{"location":"man3/OSSL_DECODER_from_bio/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/decoder.h>\n\nint OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in);\nint OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *fp);\nint OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata,\n                           size_t *pdata_len);\n

              Feature availability macros:

              • OSSL_DECODER_from_fp() is only available when OPENSSL_NO_STDIO is undefined.
              "},{"location":"man3/OSSL_DECODER_from_bio/#description","title":"DESCRIPTION","text":"

              OSSL_DECODER_from_data() runs the decoding process for the context ctx, with input coming from *pdata, *pdata_len bytes long. Both *pdata and *pdata_len must be non-NULL. When OSSL_DECODER_from_data() returns, *pdata is updated to point at the location after what has been decoded, and *pdata_len to have the number of remaining bytes.

              OSSL_DECODER_from_bio() runs the decoding process for the context ctx, with the input coming from the BIO in. Should it make a difference, it's recommended to have the BIO set in binary mode rather than text mode.

              OSSL_DECODER_from_fp() does the same thing as OSSL_DECODER_from_bio(), except that the input is coming from the FILE fp.

              "},{"location":"man3/OSSL_DECODER_from_bio/#return-values","title":"RETURN VALUES","text":"

              OSSL_DECODER_from_bio(), OSSL_DECODER_from_data() and OSSL_DECODER_from_fp() return 1 on success, or 0 on failure.

              "},{"location":"man3/OSSL_DECODER_from_bio/#examples","title":"EXAMPLES","text":"

              To decode an RSA key encoded with PEM from a bio:

              OSSL_DECODER_CTX *dctx;\nEVP_PKEY *pkey = NULL;\nconst char *format = \"PEM\";   /* NULL for any format */\nconst char *structure = NULL; /* any structure */\nconst char *keytype = \"RSA\";  /* NULL for any key */\nconst unsigned char *pass = \"my password\";\n\ndctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, format, structure,\n                                     keytype,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR,\n                                     NULL, NULL);\nif (dctx == NULL) {\n    /* error: no suitable potential decoders found */\n}\nif (pass != NULL)\n    OSSL_DECODER_CTX_set_passphrase(dctx, pass, strlen(pass));\nif (OSSL_DECODER_from_bio(dctx, bio)) {\n    /* pkey is created with the decoded data from the bio */\n} else {\n    /* decoding failure */\n}\nOSSL_DECODER_CTX_free(dctx);\n

              To decode an EC key encoded with DER from a buffer:

              OSSL_DECODER_CTX *dctx;\nEVP_PKEY *pkey = NULL;\nconst char *format = \"DER\";   /* NULL for any format */\nconst char *structure = NULL; /* any structure */\nconst char *keytype = \"EC\";   /* NULL for any key */\nconst unsigned char *pass = NULL\nconst unsigned char *data = buffer;\nsize_t datalen = sizeof(buffer);\n\ndctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, format, structure,\n                                     keytype,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR\n                                     | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                                     NULL, NULL);\nif (dctx == NULL) {\n    /* error: no suitable potential decoders found */\n}\nif (pass != NULL)\n    OSSL_DECODER_CTX_set_passphrase(dctx, pass, strlen(pass));\nif (OSSL_DECODER_from_data(dctx, &data, &datalen)) {\n    /* pkey is created with the decoded data from the buffer */\n} else {\n    /* decoding failure */\n}\nOSSL_DECODER_CTX_free(dctx);\n
              "},{"location":"man3/OSSL_DECODER_from_bio/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_DECODER_CTX(3)

              "},{"location":"man3/OSSL_DECODER_from_bio/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_DECODER_from_bio/#copyright","title":"COPYRIGHT","text":"

              Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_DISPATCH/","title":"OSSL_DISPATCH","text":""},{"location":"man3/OSSL_DISPATCH/#name","title":"NAME","text":"

              OSSL_DISPATCH - OpenSSL Core type to define a dispatchable function table

              "},{"location":"man3/OSSL_DISPATCH/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/core.h>\n\ntypedef struct ossl_dispatch_st OSSL_DISPATCH;\nstruct ossl_dispatch_st {\n    int function_id;\n    void (*function)(void);\n};\n
              "},{"location":"man3/OSSL_DISPATCH/#description","title":"DESCRIPTION","text":"

              This type is a tuple of function identity and function pointer. Arrays of this type are passed between the OpenSSL libraries and the providers to describe what functionality one side provides to the other.

              Arrays of this type must be terminated with a tuple having function identity zero and function pointer NULL.

              "},{"location":"man3/OSSL_DISPATCH/#ossl_dispatch-fields","title":"OSSL_DISPATCH fields","text":"
              • function_id

                OpenSSL defined function identity of the implemented function.

              • function

                Pointer to the implemented function itself. Despite the generic definition of this field, the implemented function it points to must have a function signature that corresponds to the function_id

              Available function identities and corresponding function signatures are defined in openssl-core_dispatch.h(7). Furthermore, the chosen function identities and associated function signature must be chosen specifically for the operation that it's intended for, as determined by the intended OSSL_ALGORITHM(3) array.

              Any function identity not recognised by the recipient of this type will be ignored. This ensures that providers built with one OpenSSL version in mind will work together with any other OpenSSL version that supports this mechanism.

              "},{"location":"man3/OSSL_DISPATCH/#see-also","title":"SEE ALSO","text":"

              crypto(7), openssl-core_dispatch.h(7), OSSL_ALGORITHM(3)

              "},{"location":"man3/OSSL_DISPATCH/#history","title":"HISTORY","text":"

              OSSL_DISPATCH was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_DISPATCH/#copyright","title":"COPYRIGHT","text":"

              Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_ENCODER/","title":"OSSL_ENCODER","text":""},{"location":"man3/OSSL_ENCODER/#name","title":"NAME","text":"

              OSSL_ENCODER, OSSL_ENCODER_fetch, OSSL_ENCODER_up_ref, OSSL_ENCODER_free, OSSL_ENCODER_get0_provider, OSSL_ENCODER_get0_properties, OSSL_ENCODER_is_a, OSSL_ENCODER_get0_name, OSSL_ENCODER_get0_description, OSSL_ENCODER_do_all_provided, OSSL_ENCODER_names_do_all, OSSL_ENCODER_gettable_params, OSSL_ENCODER_get_params - Encoder method routines

              "},{"location":"man3/OSSL_ENCODER/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/encoder.h>\n\ntypedef struct ossl_encoder_st OSSL_ENCODER;\n\nOSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name,\n                                 const char *properties);\nint OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);\nvoid OSSL_ENCODER_free(OSSL_ENCODER *encoder);\nconst OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder);\nconst char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder);\nint OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);\nconst char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *encoder);\nconst char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *encoder);\nvoid OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                  void (*fn)(OSSL_ENCODER *encoder, void *arg),\n                                  void *arg);\nint OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,\n                              void (*fn)(const char *name, void *data),\n                              void *data);\nconst OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);\nint OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]);\n
              "},{"location":"man3/OSSL_ENCODER/#description","title":"DESCRIPTION","text":"

              OSSL_ENCODER is a method for encoders, which know how to encode an object of some kind to a encoded form, such as PEM, DER, or even human readable text.

              OSSL_ENCODER_fetch() looks for an algorithm within the provider that has been loaded into the OSSL_LIB_CTX given by ctx, having the name given by name and the properties given by properties. The name determines what type of object the fetched encoder method is expected to be able to encode, and the properties are used to determine the expected output type. For known properties and the values they may have, please have a look in \"Names and properties\" in provider-encoder(7).

              OSSL_ENCODER_up_ref() increments the reference count for the given encoder.

              OSSL_ENCODER_free() decrements the reference count for the given encoder, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

              OSSL_ENCODER_get0_provider() returns the provider of the given encoder.

              OSSL_ENCODER_get0_properties() returns the property definition associated with the given encoder.

              OSSL_ENCODER_is_a() checks if encoder is an implementation of an algorithm that's identifiable with name.

              OSSL_ENCODER_get0_name() returns the name used to fetch the given encoder.

              OSSL_ENCODER_get0_description() returns a description of the loader, meant for display and human consumption. The description is at the discretion of the loader implementation.

              OSSL_ENCODER_names_do_all() traverses all names for the given encoder, and calls fn with each name and data as arguments.

              OSSL_ENCODER_do_all_provided() traverses all encoder implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and arg as arguments.

              OSSL_ENCODER_gettable_params() returns an OSSL_PARAM(3) array of parameter descriptors.

              OSSL_ENCODER_get_params() attempts to get parameters specified with an OSSL_PARAM(3) array params. Parameters that the implementation doesn't recognise should be ignored.

              "},{"location":"man3/OSSL_ENCODER/#return-values","title":"RETURN VALUES","text":"

              OSSL_ENCODER_fetch() returns a pointer to the key management implementation represented by an OSSL_ENCODER object, or NULL on error.

              OSSL_ENCODER_up_ref() returns 1 on success, or 0 on error.

              OSSL_ENCODER_free() doesn't return any value.

              OSSL_ENCODER_get0_provider() returns a pointer to a provider object, or NULL on error.

              OSSL_ENCODER_get0_properties() returns a pointer to a property definition string, or NULL on error.

              OSSL_ENCODER_is_a() returns 1 of encoder was identifiable, otherwise 0.

              OSSL_ENCODER_get0_name() returns the algorithm name from the provided implementation for the given encoder. Note that the encoder may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the encoder object and should not be freed by the caller.

              OSSL_ENCODER_get0_description() returns a pointer to a description, or NULL if there isn't one.

              OSSL_ENCODER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

              "},{"location":"man3/OSSL_ENCODER/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_ENCODER_CTX(3), OSSL_ENCODER_to_bio(3), OSSL_ENCODER_CTX_new_for_pkey(3), OSSL_LIB_CTX(3)

              "},{"location":"man3/OSSL_ENCODER/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_ENCODER/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_ENCODER_CTX/","title":"OSSL_ENCODER_CTX","text":""},{"location":"man3/OSSL_ENCODER_CTX/#name","title":"NAME","text":"

              OSSL_ENCODER_CTX, OSSL_ENCODER_CTX_new, OSSL_ENCODER_settable_ctx_params, OSSL_ENCODER_CTX_set_params, OSSL_ENCODER_CTX_free, OSSL_ENCODER_CTX_set_selection, OSSL_ENCODER_CTX_set_output_type, OSSL_ENCODER_CTX_set_output_structure, OSSL_ENCODER_CTX_add_encoder, OSSL_ENCODER_CTX_add_extra, OSSL_ENCODER_CTX_get_num_encoders, OSSL_ENCODER_INSTANCE, OSSL_ENCODER_INSTANCE_get_encoder, OSSL_ENCODER_INSTANCE_get_encoder_ctx, OSSL_ENCODER_INSTANCE_get_output_type, OSSL_ENCODER_INSTANCE_get_output_structure, OSSL_ENCODER_CONSTRUCT, OSSL_ENCODER_CLEANUP, OSSL_ENCODER_CTX_set_construct, OSSL_ENCODER_CTX_set_construct_data, OSSL_ENCODER_CTX_set_cleanup - Encoder context routines

              "},{"location":"man3/OSSL_ENCODER_CTX/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/encoder.h>\n\ntypedef struct ossl_encoder_ctx_st OSSL_ENCODER_CTX;\n\nOSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new();\nconst OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder);\nint OSSL_ENCODER_CTX_set_params(OSSL_ENCODER_CTX *ctx,\n                                const OSSL_PARAM params[]);\nvoid OSSL_ENCODER_CTX_free(OSSL_ENCODER_CTX *ctx);\n\nint OSSL_ENCODER_CTX_set_selection(OSSL_ENCODER_CTX *ctx, int selection);\nint OSSL_ENCODER_CTX_set_output_type(OSSL_ENCODER_CTX *ctx,\n                                     const char *output_type);\nint OSSL_ENCODER_CTX_set_output_structure(OSSL_ENCODER_CTX *ctx,\n                                          const char *output_structure);\n\nint OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder);\nint OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx,\n                               OSSL_LIB_CTX *libctx, const char *propq);\nint OSSL_ENCODER_CTX_get_num_encoders(OSSL_ENCODER_CTX *ctx);\n\ntypedef struct ossl_encoder_instance_st OSSL_ENCODER_INSTANCE;\nOSSL_ENCODER *\nOSSL_ENCODER_INSTANCE_get_encoder(OSSL_ENCODER_INSTANCE *encoder_inst);\nvoid *\nOSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst);\nconst char *\nOSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst);\nconst char *\nOSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst);\n\ntypedef const void *OSSL_ENCODER_CONSTRUCT(OSSL_ENCODER_INSTANCE *encoder_inst,\n                                           void *construct_data);\ntypedef void OSSL_ENCODER_CLEANUP(void *construct_data);\n\nint OSSL_ENCODER_CTX_set_construct(OSSL_ENCODER_CTX *ctx,\n                                   OSSL_ENCODER_CONSTRUCT *construct);\nint OSSL_ENCODER_CTX_set_construct_data(OSSL_ENCODER_CTX *ctx,\n                                        void *construct_data);\nint OSSL_ENCODER_CTX_set_cleanup(OSSL_ENCODER_CTX *ctx,\n                                 OSSL_ENCODER_CLEANUP *cleanup);\n
              "},{"location":"man3/OSSL_ENCODER_CTX/#description","title":"DESCRIPTION","text":"

              Encoding an input object to the desired encoding may be done with a chain of encoder implementations, which means that the output from one encoder may be the input for the next in the chain. The OSSL_ENCODER_CTX holds all the data about these encoders. This allows having generic format encoders such as DER to PEM, as well as more specialized encoders like RSA to DER.

              The final output type must be given, and a chain of encoders must end with an implementation that produces that output type.

              At the beginning of the encoding process, a constructor provided by the caller is called to ensure that there is an appropriate provider-side object to start with. The constructor is set with OSSL_ENCODER_CTX_set_construct().

              OSSL_ENCODER_INSTANCE is an opaque structure that contains data about the encoder that is going to be used, and that may be useful for the constructor. There are some functions to extract data from this type, described in \"Constructor\" below.

              "},{"location":"man3/OSSL_ENCODER_CTX/#functions","title":"Functions","text":"

              OSSL_ENCODER_CTX_new() creates a OSSL_ENCODER_CTX.

              OSSL_ENCODER_settable_ctx_params() returns an OSSL_PARAM(3) array of parameter descriptors.

              OSSL_ENCODER_CTX_set_params() attempts to set parameters specified with an OSSL_PARAM(3) array params. Parameters that the implementation doesn't recognise should be ignored.

              OSSL_ENCODER_CTX_free() frees the given context ctx. If the argument is NULL, nothing is done.

              OSSL_ENCODER_CTX_add_encoder() populates the OSSL_ENCODER_CTX ctx with a encoder, to be used to encode an input object.

              OSSL_ENCODER_CTX_add_extra() finds encoders that further encodes output from already added encoders, and adds them as well. This is used to build encoder chains.

              OSSL_ENCODER_CTX_set_output_type() sets the ending output type. This must be specified, and determines if a complete encoder chain is available.

              OSSL_ENCODER_CTX_set_output_structure() sets the desired output structure. This may be used to determines what encoder implementations may be used. Depending on the type of object being encoded, the output structure may not be relevant.

              OSSL_ENCODER_CTX_get_num_encoders() gets the number of encoders currently added to the context ctx.

              OSSL_ENCODER_CTX_set_construct() sets the constructor construct.

              OSSL_ENCODER_CTX_set_construct_data() sets the constructor data that is passed to the constructor every time it's called.

              OSSL_ENCODER_CTX_set_cleanup() sets the constructor data cleanup function. This is called by OSSL_ENCODER_CTX_free(3).

              "},{"location":"man3/OSSL_ENCODER_CTX/#constructor","title":"Constructor","text":"

              A OSSL_ENCODER_CONSTRUCT gets the following arguments:

              • encoder_inst

                The OSSL_ENCODER_INSTANCE for the encoder from which the constructor gets its data.

              • construct_data

                The pointer that was set with OSSL_ENCODE_CTX_set_construct_data().

              The constructor is expected to return a valid (non-NULL) pointer to a provider-native object that can be used as first input of an encoding chain, or NULL to indicate that an error has occurred.

              These utility functions may be used by a constructor:

              OSSL_ENCODER_INSTANCE_get_encoder() can be used to get the encoder implementation of the encoder instance encoder_inst.

              OSSL_ENCODER_INSTANCE_get_encoder_ctx() can be used to get the encoder implementation's provider context of the encoder instance encoder_inst.

              OSSL_ENCODER_INSTANCE_get_output_type() can be used to get the output type for the encoder implementation of the encoder instance encoder_inst. This will never be NULL.

              OSSL_ENCODER_INSTANCE_get_output_structure() can be used to get the output structure for the encoder implementation of the encoder instance encoder_inst. This may be NULL.

              "},{"location":"man3/OSSL_ENCODER_CTX/#return-values","title":"RETURN VALUES","text":"

              OSSL_ENCODER_CTX_new() returns a pointer to a OSSL_ENCODER_CTX, or NULL if the context structure couldn't be allocated.

              OSSL_ENCODER_settable_ctx_params() returns an OSSL_PARAM(3) array, or NULL if none is available.

              OSSL_ENCODER_CTX_set_params() returns 1 if all recognised parameters were valid, or 0 if one of them was invalid or caused some other failure in the implementation.

              OSSL_ENCODER_CTX_add_encoder(), OSSL_ENCODER_CTX_add_extra(), OSSL_ENCODER_CTX_set_construct(), OSSL_ENCODER_CTX_set_construct_data() and OSSL_ENCODER_CTX_set_cleanup() return 1 on success, or 0 on failure.

              OSSL_ENCODER_CTX_get_num_encoders() returns the current number of encoders. It returns 0 if ctx is NULL.

              OSSL_ENCODER_INSTANCE_get_encoder() returns an OSSL_ENCODER pointer on success, or NULL on failure.

              OSSL_ENCODER_INSTANCE_get_encoder_ctx() returns a provider context pointer on success, or NULL on failure.

              OSSL_ENCODER_INSTANCE_get_output_type() returns a string with the name of the input type, if relevant. NULL is a valid returned value.

              OSSL_ENCODER_INSTANCE_get_output_type() returns a string with the name of the output type.

              OSSL_ENCODER_INSTANCE_get_output_structure() returns a string with the name of the output structure.

              "},{"location":"man3/OSSL_ENCODER_CTX/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_ENCODER(3)

              "},{"location":"man3/OSSL_ENCODER_CTX/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_ENCODER_CTX/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/","title":"OSSL_ENCODER_CTX_new_for_pkey","text":""},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#name","title":"NAME","text":"

              OSSL_ENCODER_CTX_new_for_pkey, OSSL_ENCODER_CTX_set_cipher, OSSL_ENCODER_CTX_set_passphrase, OSSL_ENCODER_CTX_set_pem_password_cb, OSSL_ENCODER_CTX_set_passphrase_cb, OSSL_ENCODER_CTX_set_passphrase_ui - Encoder routines to encode EVP_PKEYs

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/encoder.h>\n\nOSSL_ENCODER_CTX *\nOSSL_ENCODER_CTX_new_for_pkey(const EVP_PKEY *pkey, int selection,\n                              const char *output_type,\n                              const char *output_structure,\n                              const char *propquery);\n\nint OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx,\n                                const char *cipher_name,\n                                const char *propquery);\nint OSSL_ENCODER_CTX_set_passphrase(OSSL_ENCODER_CTX *ctx,\n                                    const unsigned char *kstr,\n                                    size_t klen);\nint OSSL_ENCODER_CTX_set_pem_password_cb(OSSL_ENCODER_CTX *ctx,\n                                         pem_password_cb *cb, void *cbarg);\nint OSSL_ENCODER_CTX_set_passphrase_ui(OSSL_ENCODER_CTX *ctx,\n                                       const UI_METHOD *ui_method,\n                                       void *ui_data);\nint OSSL_ENCODER_CTX_set_passphrase_cb(OSSL_ENCODER_CTX *ctx,\n                                       OSSL_PASSPHRASE_CALLBACK *cb,\n                                       void *cbarg);\n
              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#description","title":"DESCRIPTION","text":"

              OSSL_ENCODER_CTX_new_for_pkey() is a utility function that creates a OSSL_ENCODER_CTX, finds all applicable encoder implementations and sets them up, so almost all the caller has to do next is call functions like OSSL_ENCODER_to_bio(3). output_type determines the final output encoding, and selection can be used to select what parts of the pkey should be included in the output. output_type is further discussed in \"Output types\" below, and selection is further described in \"Selections\".

              Internally, OSSL_ENCODER_CTX_new_for_pkey() uses the names from the EVP_KEYMGMT(3) implementation associated with pkey to build a list of applicable encoder implementations that are used to process the pkey into the encoding named by output_type, with the outermost structure named by output_structure if that's relevant. All these implementations are implicitly fetched, with propquery for finer selection.

              If no suitable encoder implementation is found, OSSL_ENCODER_CTX_new_for_pkey() still creates a OSSL_ENCODER_CTX, but with no associated encoder (OSSL_ENCODER_CTX_get_num_encoders(3) returns zero). This helps the caller to distinguish between an error when creating the OSSL_ENCODER_CTX and missing encoder implementation, and allows it to act accordingly.

              OSSL_ENCODER_CTX_set_cipher() tells the implementation what cipher should be used to encrypt encoded keys. The cipher is given by name cipher_name. The interpretation of that cipher_name is implementation dependent. The implementation may implement the cipher directly itself or by other implementations, or it may choose to fetch it. If the implementation supports fetching the cipher, then it may use propquery as properties to be queried for when fetching. cipher_name may also be NULL, which will result in unencrypted encoding.

              OSSL_ENCODER_CTX_set_passphrase() gives the implementation a pass phrase to use when encrypting the encoded private key. Alternatively, a pass phrase callback may be specified with the following functions.

              OSSL_ENCODER_CTX_set_pem_password_cb(), OSSL_ENCODER_CTX_set_passphrase_ui() and OSSL_ENCODER_CTX_set_passphrase_cb() sets up a callback method that the implementation can use to prompt for a pass phrase, giving the caller the choice of preferred pass phrase callback form. These are called indirectly, through an internal OSSL_PASSPHRASE_CALLBACK(3) function.

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#output-types","title":"Output types","text":"

              The possible EVP_PKEY output types depends on the available implementations.

              OpenSSL has built in implementations for the following output types:

              • TEXT

                The output is a human readable description of the key. EVP_PKEY_print_private(3), EVP_PKEY_print_public(3) and EVP_PKEY_print_params(3) use this for their output.

              • DER

                The output is the DER encoding of the selection of the pkey.

              • PEM

                The output is the selection of the pkey in PEM format.

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#selections","title":"Selections","text":"

              selection can be any one of the values described in \"Selections\" in EVP_PKEY_fromdata(3).

              These are only 'hints' since the encoder implementations are free to determine what makes sense to include in the output, and this may depend on the desired output. For example, an EC key in a PKCS#8 structure doesn't usually include the public key.

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#return-values","title":"RETURN VALUES","text":"

              OSSL_ENCODER_CTX_new_for_pkey() returns a pointer to an OSSL_ENCODER_CTX, or NULL if it couldn't be created.

              OSSL_ENCODER_CTX_set_cipher(), OSSL_ENCODER_CTX_set_passphrase(), OSSL_ENCODER_CTX_set_pem_password_cb(), OSSL_ENCODER_CTX_set_passphrase_ui() and OSSL_ENCODER_CTX_set_passphrase_cb() all return 1 on success, or 0 on failure.

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_ENCODER(3), OSSL_ENCODER_CTX(3)

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_ENCODER_to_bio/","title":"OSSL_ENCODER_to_bio","text":""},{"location":"man3/OSSL_ENCODER_to_bio/#name","title":"NAME","text":"

              OSSL_ENCODER_to_data, OSSL_ENCODER_to_bio, OSSL_ENCODER_to_fp - Routines to perform an encoding

              "},{"location":"man3/OSSL_ENCODER_to_bio/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/encoder.h>\n\nint OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,\n                         size_t *pdata_len);\nint OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);\nint OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);\n

              Feature availability macros:

              • OSSL_ENCODER_to_fp() is only available when OPENSSL_NO_STDIO is undefined.
              "},{"location":"man3/OSSL_ENCODER_to_bio/#description","title":"DESCRIPTION","text":"

              OSSL_ENCODER_to_data() runs the encoding process for the context ctx, with the output going to the *pdata and *pdata_len. If *pdata is NULL when OSSL_ENCODER_to_data() is called, a buffer will be allocated using OPENSSL_zalloc(3), and *pdata will be set to point at the start of that buffer, and *pdata_len will be assigned its length when OSSL_ENCODER_to_data() returns. If *pdata is non-NULL when OSSL_ENCODER_to_data() is called, *pdata_len is assumed to have its size. In this case, *pdata will be set to point after the encoded bytes, and *pdata_len will be assigned the number of remaining bytes.

              OSSL_ENCODER_to_bio() runs the encoding process for the context ctx, with the output going to the BIO out.

              OSSL_ENCODER_to_fp() does the same thing as OSSL_ENCODER_to_bio(), except that the output is going to the FILE fp.

              For OSSL_ENCODER_to_bio() and OSSL_ENCODER_to_fp(), the application is required to set up the BIO or FILE properly, for example to have it in text or binary mode as is appropriate for the encoder output type.

              "},{"location":"man3/OSSL_ENCODER_to_bio/#return-values","title":"RETURN VALUES","text":"

              OSSL_ENCODER_to_bio(), OSSL_ENCODER_to_fp() and OSSL_ENCODER_to_data() return 1 on success, or 0 on failure.

              "},{"location":"man3/OSSL_ENCODER_to_bio/#examples","title":"EXAMPLES","text":"

              To encode a pkey as PKCS#8 with PEM format into a bio:

              OSSL_ENCODER_CTX *ectx;\nconst char *format = \"PEM\";\nconst char *structure = \"PrivateKeyInfo\"; /* PKCS#8 structure */\nconst unsigned char *pass = \"my password\";\n\nectx = OSSL_ENCODER_CTX_new_for_pkey(pkey,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR\n                                     | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                                     format, structure,\n                                     NULL);\nif (ectx == NULL) {\n    /* error: no suitable potential encoders found */\n}\nif (pass != NULL)\n    OSSL_ENCODER_CTX_set_passphrase(ectx, pass, strlen(pass));\nif (OSSL_ENCODER_to_bio(ectx, bio)) {\n    /* pkey was successfully encoded into the bio */\n} else {\n    /* encoding failure */\n}\nOSSL_ENCODER_CTX_free(ectx);\n

              To encode a pkey as PKCS#8 with DER format encrypted with AES-256-CBC into a buffer:

              OSSL_ENCODER_CTX *ectx;\nconst char *format = \"DER\";\nconst char *structure = \"PrivateKeyInfo\"; /* PKCS#8 structure */\nconst unsigned char *pass = \"my password\";\nunsigned char *data = NULL;\nsize_t datalen;\n\nectx = OSSL_ENCODER_CTX_new_for_pkey(pkey,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR\n                                     | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                                     format, structure,\n                                     NULL);\nif (ectx == NULL) {\n    /* error: no suitable potential encoders found */\n}\nif (pass != NULL) {\n    OSSL_ENCODER_CTX_set_passphrase(ectx, pass, strlen(pass));\n    OSSL_ENCODER_CTX_set_cipher(ctx, \"AES-256-CBC\", NULL);\n}\nif (OSSL_ENCODER_to_data(ectx, &data, &datalen)) {\n    /*\n     * pkey was successfully encoded into a newly allocated\n     * data buffer\n     */\n} else {\n    /* encoding failure */\n}\nOSSL_ENCODER_CTX_free(ectx);\n
              "},{"location":"man3/OSSL_ENCODER_to_bio/#see-also","title":"SEE ALSO","text":"

              provider(7), OSSL_ENCODER_CTX(3)

              "},{"location":"man3/OSSL_ENCODER_to_bio/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_ENCODER_to_bio/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_ESS_check_signing_certs/","title":"OSSL_ESS_check_signing_certs","text":""},{"location":"man3/OSSL_ESS_check_signing_certs/#name","title":"NAME","text":"

              OSSL_ESS_signing_cert_new_init, OSSL_ESS_signing_cert_v2_new_init, OSSL_ESS_check_signing_certs - Enhanced Security Services (ESS) functions

              "},{"location":"man3/OSSL_ESS_check_signing_certs/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/ess.h>\n\nESS_SIGNING_CERT *OSSL_ESS_signing_cert_new_init(const X509 *signcert,\n                                                 const STACK_OF(X509) *certs,\n                                                 int set_issuer_serial);\nESS_SIGNING_CERT_V2 *OSSL_ESS_signing_cert_v2_new_init(const EVP_MD *hash_alg,\n                                                       const X509 *signcert,\n                                                       const\n                                                       STACK_OF(X509) *certs,\n                                                       int set_issuer_serial);\nint OSSL_ESS_check_signing_certs(const ESS_SIGNING_CERT *ss,\n                                 const ESS_SIGNING_CERT_V2 *ssv2,\n                                 const STACK_OF(X509) *chain,\n                                 int require_signing_cert);\n
              "},{"location":"man3/OSSL_ESS_check_signing_certs/#description","title":"DESCRIPTION","text":"

              OSSL_ESS_signing_cert_new_init() generates a new ESS_SIGNING_CERT structure referencing the given signcert and any given further certs using their SHA-1 fingerprints. If set_issuer_serial is nonzero then also the issuer and serial number of signcert are included in the ESS_CERT_ID as the issuerSerial field. For all members of certs the issuerSerial field is always included.

              OSSL_ESS_signing_cert_v2_new_init() is the same as OSSL_ESS_signing_cert_new_init() except that it uses the given hash_alg and generates a ESS_SIGNING_CERT_V2 structure with ESS_CERT_ID_V2 elements.

              OSSL_ESS_check_signing_certs() checks if the validation chain chain contains the certificates required by the identifiers given in ss and/or ssv2. If require_signing_cert is nonzero, ss or ssv2 must not be NULL. If both ss and ssv2 are not NULL, they are evaluated independently. The list of certificate identifiers in ss is of type ESS_CERT_ID, while the list contained in ssv2 is of type ESS_CERT_ID_V2. As far as these lists are present, they must be nonempty. The certificate identified by their first entry must be the first element of chain, i.e. the signer certificate. Any further certificates referenced in the list must also be found in chain. The matching is done using the given certificate hash algorithm and value. In addition to the checks required by RFCs 2624 and 5035, if the issuerSerial field is included in an ESSCertID or ESSCertIDv2 it must match the certificate issuer and serial number attributes.

              "},{"location":"man3/OSSL_ESS_check_signing_certs/#notes","title":"NOTES","text":"

              ESS has been defined in RFC 2634, which has been updated in RFC 5035 (ESS version 2) to support hash algorithms other than SHA-1. This is used for TSP (RFC 3161) and CAdES-BES (informational RFC 5126).

              "},{"location":"man3/OSSL_ESS_check_signing_certs/#return-values","title":"RETURN VALUES","text":"

              OSSL_ESS_signing_cert_new_init() and OSSL_ESS_signing_cert_v2_new_init() return a pointer to the new structure or NULL on malloc failure.

              OSSL_ESS_check_signing_certs() returns 1 on success, 0 if a required certificate cannot be found, -1 on other error.

              "},{"location":"man3/OSSL_ESS_check_signing_certs/#see-also","title":"SEE ALSO","text":"

              TS_VERIFY_CTX_set_certs(3), CMS_verify(3)

              "},{"location":"man3/OSSL_ESS_check_signing_certs/#history","title":"HISTORY","text":"

              OSSL_ESS_signing_cert_new_init(), OSSL_ESS_signing_cert_v2_new_init(), and OSSL_ESS_check_signing_certs() were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_ESS_check_signing_certs/#copyright","title":"COPYRIGHT","text":"

              Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/","title":"OSSL_HTTP_REQ_CTX","text":""},{"location":"man3/OSSL_HTTP_REQ_CTX/#name","title":"NAME","text":"

              OSSL_HTTP_REQ_CTX, OSSL_HTTP_REQ_CTX_new, OSSL_HTTP_REQ_CTX_free, OSSL_HTTP_REQ_CTX_set_request_line, OSSL_HTTP_REQ_CTX_add1_header, OSSL_HTTP_REQ_CTX_set_expected, OSSL_HTTP_REQ_CTX_set1_req, OSSL_HTTP_REQ_CTX_nbio, OSSL_HTTP_REQ_CTX_nbio_d2i, OSSL_HTTP_REQ_CTX_exchange, OSSL_HTTP_REQ_CTX_get0_mem_bio, OSSL_HTTP_REQ_CTX_get_resp_len, OSSL_HTTP_REQ_CTX_set_max_response_length, OSSL_HTTP_is_alive - HTTP client low-level functions

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/http.h>\n\ntypedef struct ossl_http_req_ctx_st OSSL_HTTP_REQ_CTX;\n\nOSSL_HTTP_REQ_CTX *OSSL_HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int buf_size);\nvoid OSSL_HTTP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx);\n\nint OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, int method_POST,\n                                       const char *server, const char *port,\n                                       const char *path);\nint OSSL_HTTP_REQ_CTX_add1_header(OSSL_HTTP_REQ_CTX *rctx,\n                                  const char *name, const char *value);\n\nint OSSL_HTTP_REQ_CTX_set_expected(OSSL_HTTP_REQ_CTX *rctx,\n                                   const char *content_type, int asn1,\n                                   int timeout, int keep_alive);\nint OSSL_HTTP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const char *content_type,\n                               const ASN1_ITEM *it, const ASN1_VALUE *req);\nint OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx);\nint OSSL_HTTP_REQ_CTX_nbio_d2i(OSSL_HTTP_REQ_CTX *rctx,\n                               ASN1_VALUE **pval, const ASN1_ITEM *it);\nBIO *OSSL_HTTP_REQ_CTX_exchange(OSSL_HTTP_REQ_CTX *rctx);\n\nBIO *OSSL_HTTP_REQ_CTX_get0_mem_bio(const OSSL_HTTP_REQ_CTX *rctx);\nsize_t OSSL_HTTP_REQ_CTX_get_resp_len(const OSSL_HTTP_REQ_CTX *rctx);\nvoid OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx,\n                                               unsigned long len);\n\nint OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx);\n
              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#description","title":"DESCRIPTION","text":"

              OSSL_HTTP_REQ_CTX is a context structure for an HTTP request and response, used to collect all the necessary data to perform that request.

              This file documents low-level HTTP functions rarely used directly. High-level HTTP client functions like OSSL_HTTP_get(3) and OSSL_HTTP_transfer(3) should be preferred.

              OSSL_HTTP_REQ_CTX_new() allocates a new HTTP request context structure, which gets populated with the BIO to write/send the request to (wbio), the BIO to read/receive the response from (rbio, which may be equal to wbio), and the maximum expected response header line length buf_size. A value <= 0 indicates that the OSSL_HTTP_DEFAULT_MAX_LINE_LEN of 4KiB should be used. buf_size is also used as the number of content bytes that are read at a time. The allocated context structure includes an internal memory BIO, which collects the HTTP request header lines.

              OSSL_HTTP_REQ_CTX_free() frees up the HTTP request context rctx. The rbio is not free'd, wbio will be free'd if free_wbio is set. If the argument is NULL, nothing is done.

              OSSL_HTTP_REQ_CTX_set_request_line() adds the 1st HTTP request line to rctx. The HTTP method is determined by method_POST, which should be 1 to indicate POST or 0 to indicate GET. server and port may be set to give the server and the optional port that an HTTP proxy shall forward the request to, otherwise they must be left NULL. path provides the HTTP request path; if left NULL, / is used. For backward compatibility, path may begin with http:// and thus convey an absoluteURI. In this case it indicates HTTP proxy use and provides also the server (and optionally the port) that the proxy shall forward the request to. In this case the server and port arguments must be NULL.

              OSSL_HTTP_REQ_CTX_add1_header() adds header name with value value to the context rctx. It can be called more than once to add multiple header lines. For example, to add a Host header for example.com you would call:

              OSSL_HTTP_REQ_CTX_add1_header(ctx, \"Host\", \"example.com\");\n

              OSSL_HTTP_REQ_CTX_set_expected() optionally sets in rctx some expectations of the HTTP client on the response. Due to the structure of an HTTP request, if the keep_alive argument is nonzero the function must be used before calling OSSL_HTTP_REQ_CTX_set1_req(). If the content_type parameter is not NULL then the client will check that the given content type string is included in the HTTP header of the response and return an error if not. If the asn1 parameter is nonzero a structure in ASN.1 encoding will be expected as the response content and input streaming is disabled. This means that an ASN.1 sequence header is required, its length field is checked, and OSSL_HTTP_REQ_CTX_get0_mem_bio() should be used to get the buffered response. Otherwise (by default) any input format is allowed without length checks. In this case the BIO given as rbio argument to OSSL_HTTP_REQ_CTX_new() should be used directly to read the response contents, which may support streaming. If the timeout parameter is > 0 this indicates the maximum number of seconds the subsequent HTTP transfer (sending the request and receiving a response) is allowed to take. timeout == 0 enables waiting indefinitely, i.e., no timeout can occur. This is the default. timeout < 0 takes over any value set via the overall_timeout argument of OSSL_HTTP_open(3) with the default being 0, which means no timeout. If the keep_alive parameter is 0, which is the default, the connection is not kept open after receiving a response. This is the default behavior for HTTP 1.0. If the value is 1 or 2 then a persistent connection is requested. If the value is 2 then a persistent connection is required, i.e., an error occurs in case the server does not grant it.

              OSSL_HTTP_REQ_CTX_set1_req() finalizes the HTTP request context. It is needed if the method_POST parameter in the OSSL_HTTP_REQ_CTX_set_request_line() call was 1 and an ASN.1-encoded request should be sent. It must also be used when requesting \"keep-alive\", even if a GET request is going to be sent, in which case req must be NULL. Unless req is NULL, the function adds the DER encoding of req using the ASN.1 template it to do the encoding (which does not support streaming). The HTTP header Content-Length is filled out with the length of the request. content_type must be NULL if req is NULL. If content_type isn't NULL, the HTTP header Content-Type is also added with the given string value. The header lines are added to the internal memory BIO for the request header.

              OSSL_HTTP_REQ_CTX_nbio() attempts to send the request prepared in rctx and to gather the response via HTTP, using the wbio and rbio that were given when calling OSSL_HTTP_REQ_CTX_new(). The function may need to be called again if its result is -1, which indicates BIO_should_retry(3). In such a case it is advisable to sleep a little in between, using BIO_wait(3) on the read BIO to prevent a busy loop.

              OSSL_HTTP_REQ_CTX_nbio_d2i() is like OSSL_HTTP_REQ_CTX_nbio() but on success in addition parses the response, which must be a DER-encoded ASN.1 structure, using the ASN.1 template it and places the result in *pval.

              OSSL_HTTP_REQ_CTX_exchange() calls OSSL_HTTP_REQ_CTX_nbio() as often as needed in order to exchange a request and response or until a timeout is reached. On success it returns a pointer to the BIO that can be used to read the result. If an ASN.1-encoded response was expected, this is the BIO returned by OSSL_HTTP_REQ_CTX_get0_mem_bio() when called after the exchange. This memory BIO does not support streaming. Otherwise the returned BIO is the rbio given to OSSL_HTTP_REQ_CTX_new(), which may support streaming. When this BIO is returned, it has been read past the end of the response header, such that the actual response body can be read from it. The returned BIO pointer MUST NOT be freed by the caller.

              OSSL_HTTP_REQ_CTX_get0_mem_bio() returns the internal memory BIO. Before the HTTP request is sent, this could be used to adapt its header lines. Use with caution! After receiving a response via HTTP, the BIO represents the current state of reading the response header. If the response was expected to be ASN.1 encoded, its contents can be read via this BIO, which does not support streaming. The returned BIO pointer must not be freed by the caller.

              OSSL_HTTP_REQ_CTX_get_resp_len() returns the size of the response contents in rctx if provided by the server as header field, else 0.

              OSSL_HTTP_REQ_CTX_set_max_response_length() sets the maximum allowed response content length for rctx to len. If not set or len is 0 then the OSSL_HTTP_DEFAULT_MAX_RESP_LEN is used, which currently is 100 KiB. If the Content-Length header is present and exceeds this value or the content is an ASN.1 encoded structure with a length exceeding this value or both length indications are present but disagree then an error occurs.

              OSSL_HTTP_is_alive() can be used to query if the HTTP connection given by rctx is still alive, i.e., has not been closed. It returns 0 if rctx is NULL.

              If the client application requested or required a persistent connection and this was granted by the server, it can keep rctx as long as it wants to send further requests and OSSL_HTTP_is_alive() returns nonzero, else it should call OSSL_HTTP_REQ_CTX_free(rctx) or OSSL_HTTP_close(3). In case the client application keeps rctx but the connection then dies for any reason at the server side, it will notice this obtaining an I/O error when trying to send the next request via rctx.

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#warnings","title":"WARNINGS","text":"

              The server's response may be unexpected if the hostname that was used to create the wbio, any Host header, and the host specified in the request URL do not match.

              Many of these functions must be called in a certain order.

              First, the HTTP request context must be allocated: OSSL_HTTP_REQ_CTX_new().

              Then, the HTTP request must be prepared with request data:

              1. Calling OSSL_HTTP_REQ_CTX_set_request_line().
              2. Adding extra header lines with OSSL_HTTP_REQ_CTX_add1_header(). This is optional and may be done multiple times with different names.
              3. Finalize the request using OSSL_HTTP_REQ_CTX_set1_req(). This may be omitted if the GET method is used and \"keep-alive\" is not requested.

              When the request context is fully prepared, the HTTP exchange may be performed with OSSL_HTTP_REQ_CTX_nbio() or OSSL_HTTP_REQ_CTX_exchange().

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#notes","title":"NOTES","text":"

              When built with tracing enabled, OSSL_HTTP_REQ_CTX_nbio() and all functions using it, such as OSSL_HTTP_REQ_CTX_exchange() and OSSL_HTTP_transfer(3), may be traced using OSSL_TRACE_CATEGORY_HTTP. See also OSSL_trace_enabled(3) and \"ENVIRONMENT\" in openssl(1).

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#return-values","title":"RETURN VALUES","text":"

              OSSL_HTTP_REQ_CTX_new() returns a pointer to a OSSL_HTTP_REQ_CTX, or NULL on error.

              OSSL_HTTP_REQ_CTX_free() and OSSL_HTTP_REQ_CTX_set_max_response_length() do not return values.

              OSSL_HTTP_REQ_CTX_set_request_line(), OSSL_HTTP_REQ_CTX_add1_header(), OSSL_HTTP_REQ_CTX_set1_req(), and OSSL_HTTP_REQ_CTX_set_expected() return 1 for success and 0 for failure.

              OSSL_HTTP_REQ_CTX_nbio() and OSSL_HTTP_REQ_CTX_nbio_d2i() return 1 for success, 0 on error or redirection, -1 if retry is needed.

              OSSL_HTTP_REQ_CTX_exchange() and OSSL_HTTP_REQ_CTX_get0_mem_bio() return a pointer to a BIO on success as described above or NULL on failure. The returned BIO must not be freed by the caller.

              OSSL_HTTP_REQ_CTX_get_resp_len() returns the size of the response contents or 0 if not available or an error occurred.

              OSSL_HTTP_is_alive() returns 1 if its argument is non-NULL and the client requested a persistent connection and the server did not disagree on keeping the connection open, else 0.

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#see-also","title":"SEE ALSO","text":"

              BIO_should_retry(3), BIO_wait(3), ASN1_item_d2i_bio(3), ASN1_item_i2d_mem_bio(3), OSSL_HTTP_open(3), OSSL_HTTP_get(3), OSSL_HTTP_transfer(3), OSSL_HTTP_close(3), OSSL_trace_enabled(3)

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#history","title":"HISTORY","text":"

              The functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_HTTP_REQ_CTX/#copyright","title":"COPYRIGHT","text":"

              Copyright 2015-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_HTTP_parse_url/","title":"OSSL_HTTP_parse_url","text":""},{"location":"man3/OSSL_HTTP_parse_url/#name","title":"NAME","text":"

              OSSL_HTTP_adapt_proxy, OSSL_parse_url, OSSL_HTTP_parse_url, OCSP_parse_url - http utility functions

              "},{"location":"man3/OSSL_HTTP_parse_url/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/http.h>\n\nconst char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy,\n                                  const char *server, int use_ssl);\n\nint OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost,\n                   char **pport, int *pport_num,\n                   char **ppath, char **pquery, char **pfrag);\nint OSSL_HTTP_parse_url(const char *url,\n                        int *pssl, char **puser, char **phost,\n                        char **pport, int *pport_num,\n                        char **ppath, char **pquery, char **pfrag);\n

              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

              int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath,\n                   int *pssl);\n
              "},{"location":"man3/OSSL_HTTP_parse_url/#description","title":"DESCRIPTION","text":"

              OSSL_HTTP_adapt_proxy() takes an optional proxy hostname proxy and returns it transformed according to the optional no_proxy parameter, server, use_ssl, and the applicable environment variable, as follows. If proxy is NULL, take any default value from the http_proxy environment variable, or from https_proxy if use_ssl is nonzero. If this still does not yield a proxy hostname, take any further default value from the HTTP_PROXY environment variable, or from HTTPS_PROXY if use_ssl is nonzero. If no_proxy is NULL, take any default exclusion value from the no_proxy environment variable, or else from NO_PROXY. Return the determined proxy hostname unless the exclusion contains server. Otherwise return NULL.

              OSSL_parse_url() parses its input string url as a URL of the form [scheme://][userinfo@]host[:port][/path][?query][#fragment] and splits it up into scheme, userinfo, host, port, path, query, and fragment components. The host (or server) component may be a DNS name or an IP address where IPv6 addresses should be enclosed in square brackets [ and ]. The port component is optional and defaults to 0. If given, it must be in decimal form. If the pport_num argument is not NULL the integer value of the port number is assigned to *pport_num on success. The path component is also optional and defaults to /. Each non-NULL result pointer argument pscheme, puser, phost, pport, ppath, pquery, and pfrag, is assigned the respective url component. On success, they are guaranteed to contain non-NULL string pointers, else NULL. It is the responsibility of the caller to free them using OPENSSL_free(3). If pquery is NULL, any given query component is handled as part of the path. A string returned via *ppath is guaranteed to begin with a / character. For absent scheme, userinfo, port, query, and fragment components an empty string is provided.

              OSSL_HTTP_parse_url() is a special form of OSSL_parse_url() where the scheme, if given, must be http or https. If pssl is not NULL, *pssl is assigned 1 in case parsing was successful and the scheme is https, else 0. The port component is optional and defaults to 443 if the scheme is https, else 80. Note that relative paths must be given with a leading /, otherwise the first path element is interpreted as the hostname.

              Calling the deprecated function OCSP_parse_url(url, host, port, path, ssl) is equivalent to OSSL_HTTP_parse_url(url, ssl, NULL, host, port, NULL, path, NULL, NULL).

              "},{"location":"man3/OSSL_HTTP_parse_url/#return-values","title":"RETURN VALUES","text":"

              OSSL_HTTP_adapt_proxy() returns NULL if no proxy is to be used, otherwise a constant proxy hostname string, which is either the proxy name handed in or an environment variable value.

              OSSL_parse_url(), OSSL_HTTP_parse_url(), and OCSP_parse_url() return 1 on success, 0 on error.

              "},{"location":"man3/OSSL_HTTP_parse_url/#see-also","title":"SEE ALSO","text":"

              OSSL_HTTP_transfer(3)

              "},{"location":"man3/OSSL_HTTP_parse_url/#history","title":"HISTORY","text":"

              OSSL_HTTP_adapt_proxy(), OSSL_parse_url() and OSSL_HTTP_parse_url() were added in OpenSSL 3.0. OCSP_parse_url() was deprecated in OpenSSL 3.0.

              "},{"location":"man3/OSSL_HTTP_parse_url/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_HTTP_transfer/","title":"OSSL_HTTP_transfer","text":""},{"location":"man3/OSSL_HTTP_transfer/#name","title":"NAME","text":"

              OSSL_HTTP_open, OSSL_HTTP_bio_cb_t, OSSL_HTTP_proxy_connect, OSSL_HTTP_set1_request, OSSL_HTTP_exchange, OSSL_HTTP_get, OSSL_HTTP_transfer, OSSL_HTTP_close - HTTP client high-level functions

              "},{"location":"man3/OSSL_HTTP_transfer/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/http.h>\n\ntypedef BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg,\n                                   int connect, int detail);\nOSSL_HTTP_REQ_CTX *OSSL_HTTP_open(const char *server, const char *port,\n                                  const char *proxy, const char *no_proxy,\n                                  int use_ssl, BIO *bio, BIO *rbio,\n                                  OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,\n                                  int buf_size, int overall_timeout);\nint OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,\n                            const char *proxyuser, const char *proxypass,\n                            int timeout, BIO *bio_err, const char *prog);\nint OSSL_HTTP_set1_request(OSSL_HTTP_REQ_CTX *rctx, const char *path,\n                           const STACK_OF(CONF_VALUE) *headers,\n                           const char *content_type, BIO *req,\n                           const char *expected_content_type, int expect_asn1,\n                           size_t max_resp_len, int timeout, int keep_alive);\nBIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url);\nBIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy,\n                   BIO *bio, BIO *rbio,\n                   OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,\n                   int buf_size, const STACK_OF(CONF_VALUE) *headers,\n                   const char *expected_content_type, int expect_asn1,\n                   size_t max_resp_len, int timeout);\nBIO *OSSL_HTTP_transfer(OSSL_HTTP_REQ_CTX **prctx,\n                        const char *server, const char *port,\n                        const char *path, int use_ssl,\n                        const char *proxy, const char *no_proxy,\n                        BIO *bio, BIO *rbio,\n                        OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,\n                        int buf_size, const STACK_OF(CONF_VALUE) *headers,\n                        const char *content_type, BIO *req,\n                        const char *expected_content_type, int expect_asn1,\n                        size_t max_resp_len, int timeout, int keep_alive);\nint OSSL_HTTP_close(OSSL_HTTP_REQ_CTX *rctx, int ok);\n
              "},{"location":"man3/OSSL_HTTP_transfer/#description","title":"DESCRIPTION","text":"

              OSSL_HTTP_open() initiates an HTTP session using the bio argument if not NULL, else by connecting to a given server optionally via a proxy.

              Typically the OpenSSL build supports sockets and the bio parameter is NULL. In this case rbio must be NULL as well and the server must be non-NULL. The function creates a network BIO internally using BIO_new_connect(3) for connecting to the given server and the optionally given port, defaulting to 80 for HTTP or 443 for HTTPS. Then this internal BIO is used for setting up a connection and for exchanging one or more request and response. If bio is given and rbio is NULL then this bio is used instead. If both bio and rbio are given (which may be memory BIOs for instance) then no explicit connection is set up, but bio is used for writing requests and rbio for reading responses. As soon as the client has flushed bio the server must be ready to provide a response or indicate a waiting condition via rbio.

              If bio is given, it is an error to provide proxy or no_proxy arguments, while server and port arguments may be given to support diagnostic output. If bio is NULL the optional proxy parameter can be used to set an HTTP(S) proxy to use (unless overridden by \"no_proxy\" settings). If TLS is not used this defaults to the environment variable http_proxy if set, else HTTP_PROXY. If use_ssl != 0 it defaults to https_proxy if set, else HTTPS_PROXY. An empty proxy string \"\" forbids using a proxy. Else the format is [http[s]://][userinfo@]host[:port][/path][?query][#fragment], where any userinfo, path, query, and fragment given is ignored. The default proxy port number is 80, or 443 in case \"https:\" is given. The HTTP client functions connect via the given proxy unless the server is found in the optional list no_proxy of proxy hostnames (if not NULL; default is the environment variable no_proxy if set, else NO_PROXY). Proxying plain HTTP is supported directly, while using a proxy for HTTPS connections requires a suitable callback function such as OSSL_HTTP_proxy_connect(), described below.

              If use_ssl is nonzero a TLS connection is requested and the bio_update_fn parameter must be provided.

              The parameter bio_update_fn, which is optional if use_ssl is 0, may be used to modify the connection BIO used by the HTTP client, but cannot be used when both bio and rbio are given. bio_update_fn is a BIO connect/disconnect callback function with prototype

              BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg, int connect, int detail)\n

              The callback function may modify the BIO provided in the bio argument, whereby it may make use of a custom defined argument arg, which may for instance point to an SSL_CTX structure. During connection establishment, just after calling BIO_do_connect_retry(), the callback function is invoked with the connect argument being 1 and detail being 1 if use_ssl is nonzero (i.e., HTTPS is requested), else 0. On disconnect connect is 0 and detail is 1 if no error occurred, else 0. For instance, on connect the callback may push an SSL BIO to implement HTTPS; after disconnect it may do some diagnostic output and pop and free the SSL BIO.

              The callback function must return either the potentially modified BIO bio. or NULL to indicate failure, in which case it should not modify the BIO.

              Here is a simple example that supports TLS connections (but not via a proxy):

              BIO *http_tls_cb(BIO *bio, void *arg, int connect, int detail)\n{\n    if (connect && detail) { /* connecting with TLS */\n        SSL_CTX *ctx = (SSL_CTX *)arg;\n        BIO *sbio = BIO_new_ssl(ctx, 1);\n\n        bio = sbio != NULL ? BIO_push(sbio, bio) : NULL;\n    } else if (!connect) { /* disconnecting */\n        BIO *hbio;\n\n        if (!detail) { /* an error has occurred */\n            /* optionally add diagnostics here */\n        }\n        BIO_ssl_shutdown(bio);\n        hbio = BIO_pop(bio);\n        BIO_free(bio); /* SSL BIO */\n        bio = hbio;\n    }\n    return bio;\n}\n

              After disconnect the modified BIO will be deallocated using BIO_free_all().

              The buf_size parameter specifies the response header maximum line length. A value <= 0 means that the OSSL_HTTP_DEFAULT_MAX_LINE_LEN (4KiB) is used. buf_size is also used as the number of content bytes that are read at a time.

              If the overall_timeout parameter is > 0 this indicates the maximum number of seconds the overall HTTP transfer (i.e., connection setup if needed, sending requests, and receiving responses) is allowed to take until completion. A value <= 0 enables waiting indefinitely, i.e., no timeout.

              OSSL_HTTP_proxy_connect() may be used by an above BIO connect callback function to set up an SSL/TLS connection via an HTTPS proxy. It promotes the given BIO bio representing a connection pre-established with a TLS proxy using the HTTP CONNECT method, optionally using proxy client credentials proxyuser and proxypass, to connect with TLS protection ultimately to server and port. If the port argument is NULL or the empty string it defaults to \"443\". If the timeout parameter is > 0 this indicates the maximum number of seconds the connection setup is allowed to take. A value <= 0 enables waiting indefinitely, i.e., no timeout. Since this function is typically called by applications such as openssl-s_client(1) it uses the bio_err and prog parameters (unless NULL) to print additional diagnostic information in a user-oriented way.

              OSSL_HTTP_set1_request() sets up in rctx the request header and content data and expectations on the response using the following parameters. If <rctx> indicates using a proxy for HTTP (but not HTTPS), the server host (and optionally port) needs to be placed in the header; thus it must be present in rctx. For backward compatibility, the server (and optional port) may also be given in the path argument beginning with http:// (thus giving an absoluteURI). If path is NULL it defaults to \"/\". If req is NULL the HTTP GET method will be used to send the request else HTTP POST with the contents of req and optional content_type, where the length of the data in req does not need to be determined in advance: the BIO will be read on-the-fly while sending the request, which supports streaming. The optional list headers may contain additional custom HTTP header lines. If the parameter expected_content_type is not NULL then the client will check that the given content type string is included in the HTTP header of the response and return an error if not. If the expect_asn1 parameter is nonzero, a structure in ASN.1 encoding will be expected as response content. The max_resp_len parameter specifies the maximum allowed response content length, where the value 0 indicates no limit. If the timeout parameter is > 0 this indicates the maximum number of seconds the subsequent HTTP transfer (sending the request and receiving a response) is allowed to take. A value of 0 enables waiting indefinitely, i.e., no timeout. A value < 0 indicates that the overall_timeout parameter value given when opening the HTTP transfer will be used instead. If keep_alive is 0 the connection is not kept open after receiving a response, which is the default behavior for HTTP 1.0. If the value is 1 or 2 then a persistent connection is requested. If the value is 2 then a persistent connection is required, i.e., an error occurs in case the server does not grant it.

              OSSL_HTTP_exchange() exchanges any form of HTTP request and response as specified by rctx, which must include both connection and request data, typically set up using OSSL_HTTP_open() and OSSL_HTTP_set1_request(). It implements the core of the functions described below. If the HTTP method is GET and redirection_url is not NULL the latter pointer is used to provide any new location that the server may return with HTTP code 301 (MOVED_PERMANENTLY) or 302 (FOUND). In this case the function returns NULL and the caller is responsible for deallocating the URL with OPENSSL_free(3). If the response header contains one or more \"Content-Length\" header lines and/or an ASN.1-encoded response is expected, which should include a total length, the length indications received are checked for consistency and for not exceeding any given maximum response length. If an ASN.1-encoded response is expected, the function returns on success the contents buffered in a memory BIO, which does not support streaming. Otherwise it returns directly the read BIO that holds the response contents, which allows a response of indefinite length and may support streaming. The caller is responsible for freeing the BIO pointer obtained.

              OSSL_HTTP_get() uses HTTP GET to obtain data from bio if non-NULL, else from the server contained in the url, and returns it as a BIO. It supports redirection via HTTP status code 301 or 302. It is meant for transfers with a single round trip, so does not support persistent connections. If bio is non-NULL, any host and port components in the url are not used for connecting but the hostname is used, as usual, for the Host header. Any userinfo and fragment components in the url are ignored. Any query component is handled as part of the path component. If the scheme component of the url is https a TLS connection is requested and the bio_update_fn, as described for OSSL_HTTP_open(), must be provided. Also the remaining parameters are interpreted as described for OSSL_HTTP_open() and OSSL_HTTP_set1_request(), respectively. The caller is responsible for freeing the BIO pointer obtained.

              OSSL_HTTP_transfer() exchanges an HTTP request and response over a connection managed via prctx without supporting redirection. It combines OSSL_HTTP_open(), OSSL_HTTP_set1_request(), OSSL_HTTP_exchange(), and OSSL_HTTP_close(). If prctx is not NULL it reuses any open connection represented by a non-NULL *prctx. It keeps the connection open if a persistent connection is requested or required and this was granted by the server, else it closes the connection and assigns NULL to *prctx. The remaining parameters are interpreted as described for OSSL_HTTP_open() and OSSL_HTTP_set1_request(), respectively. The caller is responsible for freeing the BIO pointer obtained.

              OSSL_HTTP_close() closes the connection and releases rctx. The ok parameter is passed to any BIO update function given during setup as described above for OSSL_HTTP_open(). It must be 1 if no error occurred during the HTTP transfer and 0 otherwise.

              "},{"location":"man3/OSSL_HTTP_transfer/#notes","title":"NOTES","text":"

              The names of the environment variables used by this implementation: http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, no_proxy, and NO_PROXY, have been chosen for maximal compatibility with other HTTP client implementations such as wget, curl, and git.

              When built with tracing enabled, OSSL_HTTP_transfer() and all functions using it may be traced using OSSL_TRACE_CATEGORY_HTTP. See also OSSL_trace_enabled(3) and \"ENVIRONMENT\" in openssl(1).

              "},{"location":"man3/OSSL_HTTP_transfer/#return-values","title":"RETURN VALUES","text":"

              OSSL_HTTP_open() returns on success a OSSL_HTTP_REQ_CTX, else NULL.

              OSSL_HTTP_proxy_connect() and OSSL_HTTP_set1_request() return 1 on success, 0 on error.

              On success, OSSL_HTTP_exchange(), OSSL_HTTP_get(), and OSSL_HTTP_transfer() return a memory BIO that buffers all the data received if an ASN.1-encoded response is expected, otherwise a BIO that may support streaming. The BIO must be freed by the caller. On failure, they return NULL. Failure conditions include connection/transfer timeout, parse errors, etc. The caller is responsible for freeing the BIO pointer obtained.

              OSSL_HTTP_close() returns 0 if anything went wrong while disconnecting, else 1.

              "},{"location":"man3/OSSL_HTTP_transfer/#see-also","title":"SEE ALSO","text":"

              OSSL_HTTP_parse_url(3), BIO_new_connect(3), ASN1_item_i2d_mem_bio(3), ASN1_item_d2i_bio(3), OSSL_HTTP_is_alive(3), OSSL_trace_enabled(3)

              "},{"location":"man3/OSSL_HTTP_transfer/#history","title":"HISTORY","text":"

              All the functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_HTTP_transfer/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_ITEM/","title":"OSSL_ITEM","text":""},{"location":"man3/OSSL_ITEM/#name","title":"NAME","text":"

              OSSL_ITEM - OpenSSL Core type for generic itemized data

              "},{"location":"man3/OSSL_ITEM/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/core.h>\n\ntypedef struct ossl_item_st OSSL_ITEM;\nstruct ossl_item_st {\n    unsigned int id;\n    void *ptr;\n};\n
              "},{"location":"man3/OSSL_ITEM/#description","title":"DESCRIPTION","text":"

              This type is a tuple of integer and pointer. It's a generic type used as a generic descriptor, its exact meaning being defined by how it's used. Arrays of this type are passed between the OpenSSL libraries and the providers, and must be terminated with a tuple where the integer is zero and the pointer NULL.

              This is currently mainly used for the return value of the provider's error reason strings array, see \"Provider Functions\" in provider-base(7).

              "},{"location":"man3/OSSL_ITEM/#see-also","title":"SEE ALSO","text":"

              crypto(7), provider-base(7), openssl-core.h(7)

              "},{"location":"man3/OSSL_ITEM/#history","title":"HISTORY","text":"

              OSSL_ITEM was added in OpenSSL 3.0

              "},{"location":"man3/OSSL_ITEM/#copyright","title":"COPYRIGHT","text":"

              Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_LIB_CTX/","title":"OSSL_LIB_CTX","text":""},{"location":"man3/OSSL_LIB_CTX/#name","title":"NAME","text":"

              OSSL_LIB_CTX, OSSL_LIB_CTX_new, OSSL_LIB_CTX_new_from_dispatch, OSSL_LIB_CTX_new_child, OSSL_LIB_CTX_free, OSSL_LIB_CTX_load_config, OSSL_LIB_CTX_get0_global_default, OSSL_LIB_CTX_set0_default - OpenSSL library context

              "},{"location":"man3/OSSL_LIB_CTX/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/crypto.h>\n\ntypedef struct ossl_lib_ctx_st OSSL_LIB_CTX;\n\nOSSL_LIB_CTX *OSSL_LIB_CTX_new(void);\nOSSL_LIB_CTX *OSSL_LIB_CTX_new_from_dispatch(const OSSL_CORE_HANDLE *handle,\n                                             const OSSL_DISPATCH *in);\nOSSL_LIB_CTX *OSSL_LIB_CTX_new_child(const OSSL_CORE_HANDLE *handle,\n                                     const OSSL_DISPATCH *in);\nint OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file);\nvoid OSSL_LIB_CTX_free(OSSL_LIB_CTX *ctx);\nOSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void);\nOSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *ctx);\n
              "},{"location":"man3/OSSL_LIB_CTX/#description","title":"DESCRIPTION","text":"

              OSSL_LIB_CTX is an internal OpenSSL library context type. Applications may allocate their own, but may also use NULL to use a default context with functions that take an OSSL_LIB_CTX argument.

              When a non default library context is in use care should be taken with multi-threaded applications to properly clean up thread local resources before the OSSL_LIB_CTX is freed. See OPENSSL_thread_stop_ex(3) for more information.

              OSSL_LIB_CTX_new() creates a new OpenSSL library context.

              OSSL_LIB_CTX_new_from_dispatch() creates a new OpenSSL library context initialised to use callbacks from the OSSL_DISPATCH structure. This is primarily useful for provider authors. The handle and dispatch structure arguments passed should be the same ones as passed to a provider's OSSL_provider_init function. Some OpenSSL functions, such as BIO_new_from_core_bio(3), require the library context to be created in this way in order to work.

              OSSL_LIB_CTX_new_child() is only useful to provider authors and does the same thing as OSSL_LIB_CTX_new_from_dispatch() except that it additionally links the new library context to the application library context. The new library context is a full library context in its own right, but will have all the same providers available to it that are available in the application library context (without having to reload them). If the application loads or unloads providers from the application library context then this will be automatically mirrored in the child library context.

              In addition providers that are not loaded in the parent library context can be explicitly loaded into the child library context independently from the parent library context. Providers loaded independently in this way will not be mirrored in the parent library context and will not be affected if the parent library context subsequently loads the same provider.

              A provider may call the function OSSL_PROVIDER_load(3) with the child library context as required. If the provider already exists due to it being mirrored from the parent library context then it will remain available and its reference count will be increased. If OSSL_PROVIDER_load(3) is called in this way then OSSL_PROVIDER_unload(3) should be subsequently called to decrement the reference count. OSSL_PROVIDER_unload(3) must not be called for a provider in the child library context that did not have an earlier OSSL_PROVIDER_load(3) call for that provider in that child library context.

              In addition to providers, a child library context will also mirror the default properties (set via EVP_set_default_properties(3)) from the parent library context. If EVP_set_default_properties(3) is called directly on a child library context then the new properties will override anything from the parent library context and mirroring of the properties will stop.

              When OSSL_LIB_CTX_new_child() is called from within the scope of a provider's OSSL_provider_init function the currently initialising provider is not yet available in the application's library context and therefore will similarly not yet be available in the newly constructed child library context. As soon as the OSSL_provider_init function returns then the new provider is available in the application's library context and will be similarly mirrored in the child library context.

              OSSL_LIB_CTX_load_config() loads a configuration file using the given ctx. This can be used to associate a library context with providers that are loaded from a configuration.

              OSSL_LIB_CTX_free() frees the given ctx, unless it happens to be the default OpenSSL library context. If the argument is NULL, nothing is done.

              OSSL_LIB_CTX_get0_global_default() returns a concrete (non NULL) reference to the global default library context.

              OSSL_LIB_CTX_set0_default() sets the default OpenSSL library context to be ctx in the current thread. The previous default library context is returned. Care should be taken by the caller to restore the previous default library context with a subsequent call of this function. If ctx is NULL then no change is made to the default library context, but a pointer to the current library context is still returned. On a successful call of this function the returned value will always be a concrete (non NULL) library context.

              Care should be taken when changing the default library context and starting async jobs (see ASYNC_start_job(3)), as the default library context when the job is started will be used throughout the lifetime of an async job, no matter how the calling thread makes further default library context changes in the mean time. This means that the calling thread must not free the library context that was the default at the start of the async job before that job has finished.

              "},{"location":"man3/OSSL_LIB_CTX/#return-values","title":"RETURN VALUES","text":"

              OSSL_LIB_CTX_new(), OSSL_LIB_CTX_get0_global_default() and OSSL_LIB_CTX_set0_default() return a library context pointer on success, or NULL on error.

              OSSL_LIB_CTX_free() doesn't return any value.

              OSSL_LIB_CTX_load_config() returns 1 on success, 0 on error.

              "},{"location":"man3/OSSL_LIB_CTX/#history","title":"HISTORY","text":"

              All of the functions described on this page were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_LIB_CTX/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_PARAM/","title":"OSSL_PARAM","text":""},{"location":"man3/OSSL_PARAM/#name","title":"NAME","text":"

              OSSL_PARAM - a structure to pass or request object parameters

              "},{"location":"man3/OSSL_PARAM/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/core.h>\n\ntypedef struct ossl_param_st OSSL_PARAM;\nstruct ossl_param_st {\n    const char *key;             /* the name of the parameter */\n    unsigned char data_type;     /* declare what kind of content is in data */\n    void *data;                  /* value being passed in or out */\n    size_t data_size;            /* data size */\n    size_t return_size;          /* returned size */\n};\n
              "},{"location":"man3/OSSL_PARAM/#description","title":"DESCRIPTION","text":"

              OSSL_PARAM is a type that allows passing arbitrary data for some object between two parties that have no or very little shared knowledge about their respective internal structures for that object.

              A typical usage example could be an application that wants to set some parameters for an object, or wants to find out some parameters of an object.

              Arrays of this type can be used for the following purposes:

              • Setting parameters for some object

                The caller sets up the OSSL_PARAM array and calls some function (the setter) that has intimate knowledge about the object that can take the data from the OSSL_PARAM array and assign them in a suitable form for the internal structure of the object.

              • Request parameters of some object

                The caller (the requester) sets up the OSSL_PARAM array and calls some function (the responder) that has intimate knowledge about the object, which can take the internal data of the object and copy (possibly convert) that to the memory prepared by the requester and pointed at with the OSSL_PARAM data.

              • Request parameter descriptors

                The caller gets an array of constant OSSL_PARAM, which describe available parameters and some of their properties; name, data type and expected data size. For a detailed description of each field for this use, see the field descriptions below.

                The caller may then use the information from this descriptor array to build up its own OSSL_PARAM array to pass down to a setter or responder.

              Normally, the order of the an OSSL_PARAM array is not relevant. However, if the responder can handle multiple elements with the same key, those elements must be handled in the order they are in.

              An OSSL_PARAM array must have a terminating element, where key is NULL. The usual full terminating template is:

              { NULL, 0, NULL, 0, 0 }\n

              This can also be specified using OSSL_PARAM_END(3).

              "},{"location":"man3/OSSL_PARAM/#functional-support","title":"Functional support","text":"

              Libcrypto offers a limited set of helper functions to handle OSSL_PARAM items and arrays, please see OSSL_PARAM_get_int(3). Developers are free to extend or replace those as they see fit.

              "},{"location":"man3/OSSL_PARAM/#ossl_param-fields","title":"OSSL_PARAM fields","text":"
              • key

                The identity of the parameter in the form of a string.

                In an OSSL_PARAM array, an item with this field set to NULL is considered a terminating item.

              • data_type

                The data_type is a value that describes the type and organization of the data. See \"Supported types\" below for a description of the types.

              • data

              • data_size

                data is a pointer to the memory where the parameter data is (when setting parameters) or shall (when requesting parameters) be stored, and data_size is its size in bytes. The organization of the data depends on the parameter type and flag.

                The data_size needs special attention with the parameter type OSSL_PARAM_UTF8_STRING in relation to C strings. When setting parameters, the size should be set to the length of the string, not counting the terminating NUL byte. When requesting parameters, the size should be set to the size of the buffer to be populated, which should accommodate enough space for a terminating NUL byte.

                When requesting parameters, it's acceptable for data to be NULL. This can be used by the requester to figure out dynamically exactly how much buffer space is needed to store the parameter data. In this case, data_size is ignored.

                When the OSSL_PARAM is used as a parameter descriptor, data should be ignored. If data_size is zero, it means that an arbitrary data size is accepted, otherwise it specifies the maximum size allowed.

              • return_size

                When an array of OSSL_PARAM is used to request data, the responder must set this field to indicate size of the parameter data, including padding as the case may be. In case the data_size is an unsuitable size for the data, the responder must still set this field to indicate the minimum data size required. (further notes on this in \"NOTES\" below).

                When the OSSL_PARAM is used as a parameter descriptor, return_size should be ignored.

              NOTE:

              The key names and associated types are defined by the entity that offers these parameters, i.e. names for parameters provided by the OpenSSL libraries are defined by the libraries, and names for parameters provided by providers are defined by those providers, except for the pointer form of strings (see data type descriptions below). Entities that want to set or request parameters need to know what those keys are and of what type, any functionality between those two entities should remain oblivious and just pass the OSSL_PARAM array along.

              "},{"location":"man3/OSSL_PARAM/#supported-types","title":"Supported types","text":"

              The data_type field can be one of the following types:

              • OSSL_PARAM_INTEGER
              • OSSL_PARAM_UNSIGNED_INTEGER

                The parameter data is an integer (signed or unsigned) of arbitrary length, organized in native form, i.e. most significant byte first on Big-Endian systems, and least significant byte first on Little-Endian systems.

              • OSSL_PARAM_REAL

                The parameter data is a floating point value in native form.

              • OSSL_PARAM_UTF8_STRING

                The parameter data is a printable string.

              • OSSL_PARAM_OCTET_STRING

                The parameter data is an arbitrary string of bytes.

              • OSSL_PARAM_UTF8_PTR

                The parameter data is a pointer to a printable string.

                The difference between this and OSSL_PARAM_UTF8_STRING is that data doesn't point directly at the data, but to a pointer that points to the data.

                If there is any uncertainty about which to use, OSSL_PARAM_UTF8_STRING is almost certainly the correct choice.

                This is used to indicate that constant data is or will be passed, and there is therefore no need to copy the data that is passed, just the pointer to it.

                data_size must be set to the size of the data, not the size of the pointer to the data. If this is used in a parameter request, data_size is not relevant. However, the responder will set return_size to the size of the data.

                Note that the use of this type is fragile and can only be safely used for data that remains constant and in a constant location for a long enough duration (such as the life-time of the entity that offers these parameters).

              • OSSL_PARAM_OCTET_PTR

                The parameter data is a pointer to an arbitrary string of bytes.

                The difference between this and OSSL_PARAM_OCTET_STRING is that data doesn't point directly at the data, but to a pointer that points to the data.

                If there is any uncertainty about which to use, OSSL_PARAM_OCTET_STRING is almost certainly the correct choice.

                This is used to indicate that constant data is or will be passed, and there is therefore no need to copy the data that is passed, just the pointer to it.

                data_size must be set to the size of the data, not the size of the pointer to the data. If this is used in a parameter request, data_size is not relevant. However, the responder will set return_size to the size of the data.

                Note that the use of this type is fragile and can only be safely used for data that remains constant and in a constant location for a long enough duration (such as the life-time of the entity that offers these parameters).

              "},{"location":"man3/OSSL_PARAM/#notes","title":"NOTES","text":"

              Both when setting and requesting parameters, the functions that are called will have to decide what is and what is not an error. The recommended behaviour is:

              • Keys that a setter or responder doesn't recognise should simply be ignored. That in itself isn't an error.
              • If the keys that a called setter recognises form a consistent enough set of data, that call should succeed.
              • Apart from the return_size, a responder must never change the fields of an OSSL_PARAM. To return a value, it should change the contents of the memory that data points at.
              • If the data type for a key that it's associated with is incorrect, the called function may return an error.

                The called function may also try to convert the data to a suitable form (for example, it's plausible to pass a large number as an octet string, so even though a given key is defined as an OSSL_PARAM_UNSIGNED_INTEGER, is plausible to pass the value as an OSSL_PARAM_OCTET_STRING), but this is in no way mandatory.

              • If data for a OSSL_PARAM_OCTET_STRING or a OSSL_PARAM_UTF8_STRING is NULL, the responder should set return_size to the size of the item to be returned and return success. Later the responder will be called again with data pointing at the place for the value to be put.

              • If a responder finds that some data sizes are too small for the requested data, it must set return_size for each such OSSL_PARAM item to the minimum required size, and eventually return an error.
              • For the integer type parameters (OSSL_PARAM_UNSIGNED_INTEGER and OSSL_PARAM_INTEGER), a responder may choose to return an error if the data_size isn't a suitable size (even if data_size is bigger than needed). If the responder finds the size suitable, it must fill all data_size bytes and ensure correct padding for the native endianness, and set return_size to the same value as data_size.
              "},{"location":"man3/OSSL_PARAM/#examples","title":"EXAMPLES","text":"

              A couple of examples to just show how OSSL_PARAM arrays could be set up.

              "},{"location":"man3/OSSL_PARAM/#example-1","title":"Example 1","text":"

              This example is for setting parameters on some object:

              #include <openssl/core.h>\n\nconst char *foo = \"some string\";\nsize_t foo_l = strlen(foo);\nconst char bar[] = \"some other string\";\nOSSL_PARAM set[] = {\n    { \"foo\", OSSL_PARAM_UTF8_PTR, &foo, foo_l, 0 },\n    { \"bar\", OSSL_PARAM_UTF8_STRING, (void *)&bar, sizeof(bar) - 1, 0 },\n    { NULL, 0, NULL, 0, 0 }\n};\n
              "},{"location":"man3/OSSL_PARAM/#example-2","title":"Example 2","text":"

              This example is for requesting parameters on some object:

              const char *foo = NULL;\nsize_t foo_l;\nchar bar[1024];\nsize_t bar_l;\nOSSL_PARAM request[] = {\n    { \"foo\", OSSL_PARAM_UTF8_PTR, &foo, 0 /*irrelevant*/, 0 },\n    { \"bar\", OSSL_PARAM_UTF8_STRING, &bar, sizeof(bar), 0 },\n    { NULL, 0, NULL, 0, 0 }\n};\n

              A responder that receives this array (as params in this example) could fill in the parameters like this:

              /* OSSL_PARAM *params */\n\nint i;\n\nfor (i = 0; params[i].key != NULL; i++) {\n    if (strcmp(params[i].key, \"foo\") == 0) {\n        *(char **)params[i].data = \"foo value\";\n        params[i].return_size = 9; /* length of \"foo value\" string */\n    } else if (strcmp(params[i].key, \"bar\") == 0) {\n        memcpy(params[i].data, \"bar value\", 10);\n        params[i].return_size = 9; /* length of \"bar value\" string */\n    }\n    /* Ignore stuff we don't know */\n}\n
              "},{"location":"man3/OSSL_PARAM/#see-also","title":"SEE ALSO","text":"

              openssl-core.h(7), OSSL_PARAM_get_int(3), OSSL_PARAM_dup(3)

              "},{"location":"man3/OSSL_PARAM/#history","title":"HISTORY","text":"

              OSSL_PARAM was added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_PARAM/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_PARAM_BLD/","title":"OSSL_PARAM_BLD","text":""},{"location":"man3/OSSL_PARAM_BLD/#name","title":"NAME","text":"

              OSSL_PARAM_BLD, OSSL_PARAM_BLD_new, OSSL_PARAM_BLD_to_param, OSSL_PARAM_BLD_free, OSSL_PARAM_BLD_push_int, OSSL_PARAM_BLD_push_uint, OSSL_PARAM_BLD_push_long, OSSL_PARAM_BLD_push_ulong, OSSL_PARAM_BLD_push_int32, OSSL_PARAM_BLD_push_uint32, OSSL_PARAM_BLD_push_int64, OSSL_PARAM_BLD_push_uint64, OSSL_PARAM_BLD_push_size_t, OSSL_PARAM_BLD_push_time_t, OSSL_PARAM_BLD_push_double, OSSL_PARAM_BLD_push_BN, OSSL_PARAM_BLD_push_BN_pad, OSSL_PARAM_BLD_push_utf8_string, OSSL_PARAM_BLD_push_utf8_ptr, OSSL_PARAM_BLD_push_octet_string, OSSL_PARAM_BLD_push_octet_ptr - functions to assist in the creation of OSSL_PARAM arrays

              "},{"location":"man3/OSSL_PARAM_BLD/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/param_build.h>\n\ntypedef struct OSSL_PARAM_BLD;\n\nOSSL_PARAM_BLD *OSSL_PARAM_BLD_new(void);\nOSSL_PARAM *OSSL_PARAM_BLD_to_param(OSSL_PARAM_BLD *bld);\nvoid OSSL_PARAM_BLD_free(OSSL_PARAM_BLD *bld);\n\nint OSSL_PARAM_BLD_push_TYPE(OSSL_PARAM_BLD *bld, const char *key, TYPE val);\n\nint OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key,\n                           const BIGNUM *bn);\nint OSSL_PARAM_BLD_push_BN_pad(OSSL_PARAM_BLD *bld, const char *key,\n                               const BIGNUM *bn, size_t sz);\n\nint OSSL_PARAM_BLD_push_utf8_string(OSSL_PARAM_BLD *bld, const char *key,\n                                    const char *buf, size_t bsize);\nint OSSL_PARAM_BLD_push_utf8_ptr(OSSL_PARAM_BLD *bld, const char *key,\n                                 char *buf, size_t bsize);\nint OSSL_PARAM_BLD_push_octet_string(OSSL_PARAM_BLD *bld, const char *key,\n                                     const void *buf, size_t bsize);\nint OSSL_PARAM_BLD_push_octet_ptr(OSSL_PARAM_BLD *bld, const char *key,\n                                  void *buf, size_t bsize);\n
              "},{"location":"man3/OSSL_PARAM_BLD/#description","title":"DESCRIPTION","text":"

              A collection of utility functions that simplify the creation of OSSL_PARAM arrays. The TYPE names are as per OSSL_PARAM_int(3).

              OSSL_PARAM_BLD_new() allocates and initialises a new OSSL_PARAM_BLD structure so that values can be added. Any existing values are cleared.

              OSSL_PARAM_BLD_free() deallocates the memory allocates by OSSL_PARAM_BLD_new(). If the argument is NULL, nothing is done.

              OSSL_PARAM_BLD_to_param() converts a built up OSSL_PARAM_BLD structure bld into an allocated OSSL_PARAM array. The OSSL_PARAM array and all associated storage must be freed by calling OSSL_PARAM_free() with the functions return value. OSSL_PARAM_BLD_free() can safely be called any time after this function is.

              OSSL_PARAM_BLD_push_TYPE() are a series of functions which will create OSSL_PARAM objects of the specified size and correct type for the val argument. val is stored by value and an expression or auto variable can be used.

              OSSL_PARAM_BLD_push_BN() is a function that will create an OSSL_PARAM object that holds the specified BIGNUM bn. If bn is marked as being securely allocated, its OSSL_PARAM representation will also be securely allocated. The bn argument is stored by reference and the underlying BIGNUM object must exist until after OSSL_PARAM_BLD_to_param() has been called.

              OSSL_PARAM_BLD_push_BN_pad() is a function that will create an OSSL_PARAM object that holds the specified BIGNUM bn. The object will be padded to occupy exactly sz bytes, if insufficient space is specified an error results. If bn is marked as being securely allocated, its OSSL_PARAM representation will also be securely allocated. The bn argument is stored by reference and the underlying BIGNUM object must exist until after OSSL_PARAM_BLD_to_param() has been called.

              OSSL_PARAM_BLD_push_utf8_string() is a function that will create an OSSL_PARAM object that references the UTF8 string specified by buf. The length of the string bsize should not include the terminating NUL byte. If it is zero then it will be calculated. The string that buf points to is stored by reference and must remain in scope until after OSSL_PARAM_BLD_to_param() has been called.

              OSSL_PARAM_BLD_push_octet_string() is a function that will create an OSSL_PARAM object that references the octet string specified by buf and <bsize>. The memory that buf points to is stored by reference and must remain in scope until after OSSL_PARAM_BLD_to_param() has been called.

              OSSL_PARAM_BLD_push_utf8_ptr() is a function that will create an OSSL_PARAM object that references the UTF8 string specified by buf. The length of the string bsize should not include the terminating NUL byte. If it is zero then it will be calculated. The string buf points to is stored by reference and must remain in scope until the OSSL_PARAM array is freed.

              OSSL_PARAM_BLD_push_octet_ptr() is a function that will create an OSSL_PARAM object that references the octet string specified by buf. The memory buf points to is stored by reference and must remain in scope until the OSSL_PARAM array is freed.

              "},{"location":"man3/OSSL_PARAM_BLD/#return-values","title":"RETURN VALUES","text":"

              OSSL_PARAM_BLD_new() returns the allocated OSSL_PARAM_BLD structure, or NULL on error.

              OSSL_PARAM_BLD_to_param() returns the allocated OSSL_PARAM array, or NULL on error.

              All of the OSSL_PARAM_BLD_push_TYPE functions return 1 on success and 0 on error.

              "},{"location":"man3/OSSL_PARAM_BLD/#notes","title":"NOTES","text":"

              OSSL_PARAM_BLD_push_BN() and OSSL_PARAM_BLD_push_BN_pad() currently only support nonnegative BIGNUMs. They return an error on negative BIGNUMs.

              "},{"location":"man3/OSSL_PARAM_BLD/#examples","title":"EXAMPLES","text":"

              Both examples creating an OSSL_PARAM array that contains an RSA key. For both, the predefined key variables are:

              BIGNUM *n;           /* modulus */\nunsigned int e;      /* public exponent */\nBIGNUM *d;           /* private exponent */\nBIGNUM *p, *q;       /* first two prime factors */\nBIGNUM *dmp1, *dmq1; /* first two CRT exponents */\nBIGNUM *iqmp;        /* first CRT coefficient */\n
              "},{"location":"man3/OSSL_PARAM_BLD/#example-1","title":"Example 1","text":"

              This example shows how to create an OSSL_PARAM array that contains an RSA private key.

              OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();\nOSSL_PARAM *params = NULL;\n\nif (bld == NULL\n    || !OSSL_PARAM_BLD_push_BN(bld, \"n\", n)\n    || !OSSL_PARAM_BLD_push_uint(bld, \"e\", e)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"d\", d)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-factor1\", p)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-factor2\", q)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-exponent1\", dmp1)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-exponent2\", dmq1)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-coefficient1\", iqmp)\n    || (params = OSSL_PARAM_BLD_to_param(bld)) == NULL)\n    goto err;\nOSSL_PARAM_BLD_free(bld);\n/* Use params */\n...\nOSSL_PARAM_free(params);\n
              "},{"location":"man3/OSSL_PARAM_BLD/#example-2","title":"Example 2","text":"

              This example shows how to create an OSSL_PARAM array that contains an RSA public key.

              OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();\nOSSL_PARAM *params = NULL;\n\nif (nld == NULL\n    || !OSSL_PARAM_BLD_push_BN(bld, \"n\", n)\n    || !OSSL_PARAM_BLD_push_uint(bld, \"e\", e)\n    || (params = OSSL_PARAM_BLD_to_param(bld)) == NULL)\n    goto err;\nOSSL_PARAM_BLD_free(bld);\n/* Use params */\n...\nOSSL_PARAM_free(params);\n
              "},{"location":"man3/OSSL_PARAM_BLD/#see-also","title":"SEE ALSO","text":"

              OSSL_PARAM_int(3), OSSL_PARAM(3), OSSL_PARAM_free(3)

              "},{"location":"man3/OSSL_PARAM_BLD/#history","title":"HISTORY","text":"

              The functions described here were all added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_PARAM_BLD/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_PARAM_allocate_from_text/","title":"OSSL_PARAM_allocate_from_text","text":""},{"location":"man3/OSSL_PARAM_allocate_from_text/#name","title":"NAME","text":"

              OSSL_PARAM_allocate_from_text - OSSL_PARAM construction utilities

              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/params.h>\n\nint OSSL_PARAM_allocate_from_text(OSSL_PARAM *to,\n                                  const OSSL_PARAM *paramdefs,\n                                  const char *key, const char *value,\n                                  size_t value_n,\n                                  int *found);\n
              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#description","title":"DESCRIPTION","text":"

              With OpenSSL before version 3.0, parameters were passed down to or retrieved from algorithm implementations via control functions. Some of these control functions existed in variants that took string parameters, for example EVP_PKEY_CTX_ctrl_str(3).

              OpenSSL 3.0 introduces a new mechanism to do the same thing with an array of parameters that contain name, value, value type and value size (see OSSL_PARAM(3) for more information).

              OSSL_PARAM_allocate_from_text() uses key to look up an item in paramdefs. If an item was found, it converts value to something suitable for that item's data_type, and stores the result in to->data as well as its size in to->data_size. to->key and to->data_type are assigned the corresponding values from the item that was found, and to->return_size is set to zero.

              to->data is always allocated using OPENSSL_zalloc(3) and needs to be freed by the caller when it's not useful any more, using OPENSSL_free(3).

              If found is not NULL, *found is set to 1 if key could be located in paramdefs, and to 0 otherwise.

              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#the-use-of-key-and-value-in-detail","title":"The use of key and value in detail","text":"

              OSSL_PARAM_allocate_from_text() takes note if key starts with \"hex\", and will only use the rest of key to look up an item in paramdefs in that case. As an example, if key is \"hexid\", \"id\" will be looked up in paramdefs.

              When an item in paramdefs has been found, value is converted depending on that item's data_type, as follows:

              • OSSL_PARAM_INTEGER and OSSL_PARAM_UNSIGNED_INTEGER

                If key didn't start with \"hex\", value is assumed to contain value_n decimal characters, which are decoded, and the resulting bytes become the number stored in the to->data storage.

                If value starts with \"0x\", it is assumed to contain value_n hexadecimal characters.

                If key started with \"hex\", value is assumed to contain value_n hexadecimal characters without the \"0x\" prefix.

                If value contains characters that couldn't be decoded as hexadecimal or decimal characters, OSSL_PARAM_allocate_from_text() considers that an error.

              • OSSL_PARAM_UTF8_STRING

                If key started with \"hex\", OSSL_PARAM_allocate_from_text() considers that an error.

                Otherwise, value is considered a C string and is copied to the to->data storage. On systems where the native character encoding is EBCDIC, the bytes in to->data are converted to ASCII.

              • OSSL_PARAM_OCTET_STRING

                If key started with \"hex\", value is assumed to contain value_n hexadecimal characters, which are decoded, and the resulting bytes are stored in the to->data storage. If value contains characters that couldn't be decoded as hexadecimal or decimal characters, OSSL_PARAM_allocate_from_text() considers that an error.

                If key didn't start with \"hex\", value_n bytes from value are copied to the to->data storage.

              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#return-values","title":"RETURN VALUES","text":"

              OSSL_PARAM_allocate_from_text() returns 1 if key was found in paramdefs and there was no other failure, otherwise 0.

              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#notes","title":"NOTES","text":"

              The parameter descriptor array comes from functions dedicated to return them. The following OSSL_PARAM(3) attributes are used:

              • key
              • data_type
              • data_size

              All other attributes are ignored.

              The data_size attribute can be zero, meaning that the parameter it describes expects arbitrary length data.

              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#examples","title":"EXAMPLES","text":"

              Code that looked like this:

              int mac_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)\n{\n    int rv;\n    char *stmp, *vtmp = NULL;\n\n    stmp = OPENSSL_strdup(value);\n    if (stmp == NULL)\n        return -1;\n    vtmp = strchr(stmp, ':');\n    if (vtmp != NULL)\n        *vtmp++ = '\\0';\n    rv = EVP_MAC_ctrl_str(ctx, stmp, vtmp);\n    OPENSSL_free(stmp);\n    return rv;\n}\n\n...\n\n\nfor (i = 0; i < sk_OPENSSL_STRING_num(macopts); i++) {\n    char *macopt = sk_OPENSSL_STRING_value(macopts, i);\n\n    if (pkey_ctrl_string(mac_ctx, macopt) <= 0) {\n        BIO_printf(bio_err,\n                   \"MAC parameter error \\\"%s\\\"\\n\", macopt);\n        ERR_print_errors(bio_err);\n        goto mac_end;\n    }\n}\n

              Can be written like this instead:

               OSSL_PARAM *params =\n     OPENSSL_zalloc(sizeof(*params)\n                    * (sk_OPENSSL_STRING_num(opts) + 1));\n const OSSL_PARAM *paramdefs = EVP_MAC_settable_ctx_params(mac);\n size_t params_n;\n char *opt = \"<unknown>\";\n\n for (params_n = 0; params_n < (size_t)sk_OPENSSL_STRING_num(opts);\n      params_n++) {\n     char *stmp, *vtmp = NULL;\n\n     opt = sk_OPENSSL_STRING_value(opts, (int)params_n);\n     if ((stmp = OPENSSL_strdup(opt)) == NULL\n             || (vtmp = strchr(stmp, ':')) == NULL)\n         goto err;\n\n     *vtmp++ = '\\0';\n     if (!OSSL_PARAM_allocate_from_text(&params[params_n],\n                                        paramdefs, stmp,\n                                        vtmp, strlen(vtmp), NULL))\n         goto err;\n }\n params[params_n] = OSSL_PARAM_construct_end();\n if (!EVP_MAC_CTX_set_params(ctx, params))\n     goto err;\n while (params_n-- > 0)\n     OPENSSL_free(params[params_n].data);\n OPENSSL_free(params);\n /* ... */\n return;\n\nerr:\n BIO_printf(bio_err, \"MAC parameter error '%s'\\n\", opt);\n ERR_print_errors(bio_err);\n
              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#see-also","title":"SEE ALSO","text":"

              OSSL_PARAM(3), OSSL_PARAM_int(3)

              "},{"location":"man3/OSSL_PARAM_allocate_from_text/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_PARAM_dup/","title":"OSSL_PARAM_dup","text":""},{"location":"man3/OSSL_PARAM_dup/#name","title":"NAME","text":"

              OSSL_PARAM_dup, OSSL_PARAM_merge, OSSL_PARAM_free - OSSL_PARAM array copy functions

              "},{"location":"man3/OSSL_PARAM_dup/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/params.h>\n\nOSSL_PARAM *OSSL_PARAM_dup(const OSSL_PARAM *params);\nOSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *params, const OSSL_PARAM *params1);\nvoid OSSL_PARAM_free(OSSL_PARAM *params);\n
              "},{"location":"man3/OSSL_PARAM_dup/#description","title":"DESCRIPTION","text":"

              Algorithm parameters can be exported/imported from/to providers using arrays of OSSL_PARAM(3). The following utility functions allow the parameters to be duplicated and merged with other OSSL_PARAM(3) to assist in this process.

              OSSL_PARAM_dup() duplicates the parameter array params. This function does a deep copy of the data.

              OSSL_PARAM_merge() merges the parameter arrays params and params1 into a new parameter array. If params and params1 contain values with the same 'key' then the value from params1 will replace the param value. This function does a shallow copy of the parameters. Either params or params1 may be NULL. The behaviour of the merge is unpredictable if params and params1 contain the same key, and there are multiple entries within either array that have the same key.

              OSSL_PARAM_free() frees the parameter array params that was created using OSSL_PARAM_dup(), OSSL_PARAM_merge() or OSSL_PARAM_BLD_to_param(). If the argument to OSSL_PARAM_free() is NULL, nothing is done.

              "},{"location":"man3/OSSL_PARAM_dup/#return-values","title":"RETURN VALUES","text":"

              The functions OSSL_PARAM_dup() and OSSL_PARAM_merge() return a newly allocated OSSL_PARAM(3) array, or NULL if there was an error. If both parameters are NULL then NULL is returned.

              "},{"location":"man3/OSSL_PARAM_dup/#see-also","title":"SEE ALSO","text":"

              OSSL_PARAM(3), OSSL_PARAM_BLD(3)

              "},{"location":"man3/OSSL_PARAM_dup/#history","title":"HISTORY","text":"

              The functions were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_PARAM_dup/#copyright","title":"COPYRIGHT","text":"

              Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_PARAM_int/","title":"OSSL_PARAM_int","text":""},{"location":"man3/OSSL_PARAM_int/#name","title":"NAME","text":"

              OSSL_PARAM_double, OSSL_PARAM_int, OSSL_PARAM_int32, OSSL_PARAM_int64, OSSL_PARAM_long, OSSL_PARAM_size_t, OSSL_PARAM_time_t, OSSL_PARAM_uint, OSSL_PARAM_uint32, OSSL_PARAM_uint64, OSSL_PARAM_ulong, OSSL_PARAM_BN, OSSL_PARAM_utf8_string, OSSL_PARAM_octet_string, OSSL_PARAM_utf8_ptr, OSSL_PARAM_octet_ptr, OSSL_PARAM_END, OSSL_PARAM_DEFN, OSSL_PARAM_construct_double, OSSL_PARAM_construct_int, OSSL_PARAM_construct_int32, OSSL_PARAM_construct_int64, OSSL_PARAM_construct_long, OSSL_PARAM_construct_size_t, OSSL_PARAM_construct_time_t, OSSL_PARAM_construct_uint, OSSL_PARAM_construct_uint32, OSSL_PARAM_construct_uint64, OSSL_PARAM_construct_ulong, OSSL_PARAM_construct_BN, OSSL_PARAM_construct_utf8_string, OSSL_PARAM_construct_utf8_ptr, OSSL_PARAM_construct_octet_string, OSSL_PARAM_construct_octet_ptr, OSSL_PARAM_construct_end, OSSL_PARAM_locate, OSSL_PARAM_locate_const, OSSL_PARAM_get_double, OSSL_PARAM_get_int, OSSL_PARAM_get_int32, OSSL_PARAM_get_int64, OSSL_PARAM_get_long, OSSL_PARAM_get_size_t, OSSL_PARAM_get_time_t, OSSL_PARAM_get_uint, OSSL_PARAM_get_uint32, OSSL_PARAM_get_uint64, OSSL_PARAM_get_ulong, OSSL_PARAM_get_BN, OSSL_PARAM_get_utf8_string, OSSL_PARAM_get_octet_string, OSSL_PARAM_get_utf8_ptr, OSSL_PARAM_get_octet_ptr, OSSL_PARAM_get_utf8_string_ptr, OSSL_PARAM_get_octet_string_ptr, OSSL_PARAM_set_double, OSSL_PARAM_set_int, OSSL_PARAM_set_int32, OSSL_PARAM_set_int64, OSSL_PARAM_set_long, OSSL_PARAM_set_size_t, OSSL_PARAM_set_time_t, OSSL_PARAM_set_uint, OSSL_PARAM_set_uint32, OSSL_PARAM_set_uint64, OSSL_PARAM_set_ulong, OSSL_PARAM_set_BN, OSSL_PARAM_set_utf8_string, OSSL_PARAM_set_octet_string, OSSL_PARAM_set_utf8_ptr, OSSL_PARAM_set_octet_ptr, OSSL_PARAM_UNMODIFIED, OSSL_PARAM_modified, OSSL_PARAM_set_all_unmodified - OSSL_PARAM helpers

              "},{"location":"man3/OSSL_PARAM_int/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/params.h>\n\n/*\n * TYPE in function names is one of:\n * double, int, int32, int64, long, size_t, time_t, uint, uint32, uint64, ulong\n * Corresponding TYPE in function arguments is one of:\n * double, int, int32_t, int64_t, long, size_t, time_t, unsigned int, uint32_t,\n * uint64_t, unsigned long\n */\n\n#define OSSL_PARAM_TYPE(key, address)\n#define OSSL_PARAM_BN(key, address, size)\n#define OSSL_PARAM_utf8_string(key, address, size)\n#define OSSL_PARAM_octet_string(key, address, size)\n#define OSSL_PARAM_utf8_ptr(key, address, size)\n#define OSSL_PARAM_octet_ptr(key, address, size)\n#define OSSL_PARAM_END\n\n#define OSSL_PARAM_UNMODIFIED\n\n#define OSSL_PARAM_DEFN(key, type, addr, sz)    \\\n   { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }\n\nOSSL_PARAM OSSL_PARAM_construct_TYPE(const char *key, TYPE *buf);\nOSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf,\n                                   size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf,\n                                            size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf,\n                                             size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf,\n                                         size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf,\n                                          size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_end(void);\n\nOSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *array, const char *key);\nconst OSSL_PARAM *OSSL_PARAM_locate_const(const OSSL_PARAM *array,\n                                          const char *key);\n\nint OSSL_PARAM_get_TYPE(const OSSL_PARAM *p, TYPE *val);\nint OSSL_PARAM_set_TYPE(OSSL_PARAM *p, TYPE val);\n\nint OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val);\nint OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val);\n\nint OSSL_PARAM_get_utf8_string(const OSSL_PARAM *p, char **val,\n                               size_t max_len);\nint OSSL_PARAM_set_utf8_string(OSSL_PARAM *p, const char *val);\n\nint OSSL_PARAM_get_octet_string(const OSSL_PARAM *p, void **val,\n                                size_t max_len, size_t *used_len);\nint OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val, size_t len);\n\nint OSSL_PARAM_get_utf8_ptr(const OSSL_PARAM *p, const char **val);\nint OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val);\n\nint OSSL_PARAM_get_octet_ptr(const OSSL_PARAM *p, const void **val,\n                             size_t *used_len);\nint OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val,\n                             size_t used_len);\n\nint OSSL_PARAM_get_utf8_string_ptr(const OSSL_PARAM *p, const char **val);\nint OSSL_PARAM_get_octet_string_ptr(const OSSL_PARAM *p, const void **val,\n                                    size_t *used_len);\n\nint OSSL_PARAM_modified(const OSSL_PARAM *param);\nvoid OSSL_PARAM_set_all_unmodified(OSSL_PARAM *params);\n
              "},{"location":"man3/OSSL_PARAM_int/#description","title":"DESCRIPTION","text":"

              A collection of utility functions that simplify and add type safety to the OSSL_PARAM(3) arrays. The following TYPE names are supported:

              • double
              • int
              • int32 (int32_t)
              • int64 (int64_t)
              • long int (long)
              • time_t
              • size_t
              • uint32 (uint32_t)
              • uint64 (uint64_t)
              • unsigned int (uint)
              • unsigned long int (ulong)

              OSSL_PARAM_TYPE() are a series of macros designed to assist initialising an array of OSSL_PARAM(3) structures. Each of these macros defines a parameter of the specified TYPE with the provided key and parameter variable address.

              OSSL_PARAM_utf8_string(), OSSL_PARAM_octet_string(), OSSL_PARAM_utf8_ptr(), OSSL_PARAM_octet_ptr(), OSSL_PARAM_BN() are macros that provide support for defining UTF8 strings, OCTET strings and big numbers. A parameter with name key is defined. The storage for this parameter is at address and is of size bytes.

              OSSL_PARAM_END provides an end of parameter list marker. This should terminate all OSSL_PARAM(3) arrays.

              The OSSL_PARAM_DEFN() macro provides the ability to construct a single OSSL_PARAM(3) (typically used in the construction of OSSL_PARAM arrays). The key, type, addr and sz arguments correspond to the key, data_type, data and data_size fields of the OSSL_PARAM(3) structure as described on the OSSL_PARAM(3) page.

              OSSL_PARAM_construct_TYPE() are a series of functions that create OSSL_PARAM(3) records dynamically. A parameter with name key is created. The parameter will use storage pointed to by buf and return size of ret.

              OSSL_PARAM_construct_BN() is a function that constructs a large integer OSSL_PARAM(3) structure. A parameter with name key, storage buf, size bsize and return size rsize is created.

              OSSL_PARAM_construct_utf8_string() is a function that constructs a UTF8 string OSSL_PARAM(3) structure. A parameter with name key, storage buf and size bsize is created. If bsize is zero, the string length is determined using strlen(3). Generally pass zero for bsize instead of calling strlen(3) yourself.

              OSSL_PARAM_construct_octet_string() is a function that constructs an OCTET string OSSL_PARAM(3) structure. A parameter with name key, storage buf and size bsize is created.

              OSSL_PARAM_construct_utf8_ptr() is a function that constructs a UTF8 string pointer OSSL_PARAM(3) structure. A parameter with name key, storage pointer *buf and size bsize is created.

              OSSL_PARAM_construct_octet_ptr() is a function that constructs an OCTET string pointer OSSL_PARAM(3) structure. A parameter with name key, storage pointer *buf and size bsize is created.

              OSSL_PARAM_construct_end() is a function that constructs the terminating OSSL_PARAM(3) structure.

              OSSL_PARAM_locate() is a function that searches an array of parameters for the one matching the key name.

              OSSL_PARAM_locate_const() behaves exactly like OSSL_PARAM_locate() except for the presence of const for the array argument and its return value.

              OSSL_PARAM_get_TYPE() retrieves a value of type TYPE from the parameter p. The value is copied to the address val. Type coercion takes place as discussed in the NOTES section.

              OSSL_PARAM_set_TYPE() stores a value val of type TYPE into the parameter p. If the parameter's data field is NULL, then only its return_size field will be assigned the size the parameter's data buffer should have. Type coercion takes place as discussed in the NOTES section.

              OSSL_PARAM_get_BN() retrieves a BIGNUM from the parameter pointed to by p. The BIGNUM referenced by val is updated and is allocated if *val is NULL.

              OSSL_PARAM_set_BN() stores the BIGNUM val into the parameter p. If the parameter's data field is NULL, then only its return_size field will be assigned the size the parameter's data buffer should have.

              OSSL_PARAM_get_utf8_string() retrieves a UTF8 string from the parameter pointed to by p. The string is stored into *val with a size limit of max_len, which must be large enough to accommodate a terminating NUL byte, otherwise this function will fail. If *val is NULL, memory is allocated for the string (including the terminating NUL byte) and max_len is ignored. If memory is allocated by this function, it must be freed by the caller.

              OSSL_PARAM_set_utf8_string() sets a UTF8 string from the parameter pointed to by p to the value referenced by val. If the parameter's data field isn't NULL, its data_size must indicate that the buffer is large enough to accommodate the string that val points at, not including the terminating NUL byte, or this function will fail. A terminating NUL byte is added only if the parameter's data_size indicates the buffer is longer than the string length, otherwise the string will not be NUL terminated. If the parameter's data field is NULL, then only its return_size field will be assigned the minimum size the parameter's data buffer should have to accommodate the string, not including a terminating NUL byte.

              OSSL_PARAM_get_octet_string() retrieves an OCTET string from the parameter pointed to by p. The OCTETs are either stored into *val with a length limit of max_len or, in the case when *val is NULL, memory is allocated and max_len is ignored. *used_len is populated with the number of OCTETs stored. If val is NULL then the OCTETS are not stored, but *used_len is still populated. If memory is allocated by this function, it must be freed by the caller.

              OSSL_PARAM_set_octet_string() sets an OCTET string from the parameter pointed to by p to the value referenced by val. If the parameter's data field is NULL, then only its return_size field will be assigned the size the parameter's data buffer should have.

              OSSL_PARAM_get_utf8_ptr() retrieves the UTF8 string pointer from the parameter referenced by p and stores it in *val.

              OSSL_PARAM_set_utf8_ptr() sets the UTF8 string pointer in the parameter referenced by p to the values val.

              OSSL_PARAM_get_octet_ptr() retrieves the OCTET string pointer from the parameter referenced by p and stores it in *val. The length of the OCTET string is stored in *used_len.

              OSSL_PARAM_set_octet_ptr() sets the OCTET string pointer in the parameter referenced by p to the values val. The length of the OCTET string is provided by used_len.

              OSSL_PARAM_get_utf8_string_ptr() retrieves the pointer to a UTF8 string from the parameter pointed to by p, and stores that pointer in *val. This is different from OSSL_PARAM_get_utf8_string(), which copies the string.

              OSSL_PARAM_get_octet_string_ptr() retrieves the pointer to a octet string from the parameter pointed to by p, and stores that pointer in *val, along with the string's length in *used_len. This is different from OSSL_PARAM_get_octet_string(), which copies the string.

              The OSSL_PARAM_UNMODIFIED macro is used to detect if a parameter was set. On creation, via either the macros or construct calls, the return_size field is set to this. If the parameter is set using the calls defined herein, the return_size field is changed.

              OSSL_PARAM_modified() queries if the parameter param has been set or not using the calls defined herein.

              OSSL_PARAM_set_all_unmodified() resets the unused indicator for all parameters in the array params.

              "},{"location":"man3/OSSL_PARAM_int/#return-values","title":"RETURN VALUES","text":"

              OSSL_PARAM_construct_TYPE(), OSSL_PARAM_construct_BN(), OSSL_PARAM_construct_utf8_string(), OSSL_PARAM_construct_octet_string(), OSSL_PARAM_construct_utf8_ptr() and OSSL_PARAM_construct_octet_ptr() return a populated OSSL_PARAM(3) structure.

              OSSL_PARAM_locate() and OSSL_PARAM_locate_const() return a pointer to the matching OSSL_PARAM(3) object. They return NULL on error or when no object matching key exists in the array.

              OSSL_PARAM_modified() returns 1 if the parameter was set and 0 otherwise.

              All other functions return 1 on success and 0 on failure.

              "},{"location":"man3/OSSL_PARAM_int/#notes","title":"NOTES","text":"

              Native types will be converted as required only if the value is exactly representable by the target type or parameter. Apart from that, the functions must be used appropriately for the expected type of the parameter.

              OSSL_PARAM_get_BN() and OSSL_PARAM_set_BN() currently only support nonnegative BIGNUMs, and by consequence, only OSSL_PARAM_UNSIGNED_INTEGER. OSSL_PARAM_construct_BN() currently constructs an OSSL_PARAM(3) structure with the data type OSSL_PARAM_UNSIGNED_INTEGER.

              For OSSL_PARAM_construct_utf8_ptr() and OSSL_PARAM_consstruct_octet_ptr(), bsize is not relevant if the purpose is to send the OSSL_PARAM(3) array to a responder, i.e. to get parameter data back. In that case, bsize can safely be given zero. See \"DESCRIPTION\" in OSSL_PARAM(3) for further information on the possible purposes.

              "},{"location":"man3/OSSL_PARAM_int/#examples","title":"EXAMPLES","text":"

              Reusing the examples from OSSL_PARAM(3) to just show how OSSL_PARAM(3) arrays can be handled using the macros and functions defined herein.

              "},{"location":"man3/OSSL_PARAM_int/#example-1","title":"Example 1","text":"

              This example is for setting parameters on some object:

              #include <openssl/core.h>\n\nconst char *foo = \"some string\";\nsize_t foo_l = strlen(foo);\nconst char bar[] = \"some other string\";\nconst OSSL_PARAM set[] = {\n    OSSL_PARAM_utf8_ptr(\"foo\", &foo, foo_l),\n    OSSL_PARAM_utf8_string(\"bar\", bar, sizeof(bar) - 1),\n    OSSL_PARAM_END\n};\n
              "},{"location":"man3/OSSL_PARAM_int/#example-2","title":"Example 2","text":"

              This example is for requesting parameters on some object, and also demonstrates that the requester isn't obligated to request all available parameters:

              const char *foo = NULL;\nchar bar[1024];\nOSSL_PARAM request[] = {\n    OSSL_PARAM_utf8_ptr(\"foo\", &foo, 0),\n    OSSL_PARAM_utf8_string(\"bar\", bar, sizeof(bar)),\n    OSSL_PARAM_END\n};\n

              A responder that receives this array (as params in this example) could fill in the parameters like this:

              /* OSSL_PARAM *params */\n\nOSSL_PARAM *p;\n\nif ((p = OSSL_PARAM_locate(params, \"foo\")) != NULL)\n    OSSL_PARAM_set_utf8_ptr(p, \"foo value\");\nif ((p = OSSL_PARAM_locate(params, \"bar\")) != NULL)\n    OSSL_PARAM_set_utf8_string(p, \"bar value\");\nif ((p = OSSL_PARAM_locate(params, \"cookie\")) != NULL)\n    OSSL_PARAM_set_utf8_ptr(p, \"cookie value\");\n
              "},{"location":"man3/OSSL_PARAM_int/#see-also","title":"SEE ALSO","text":"

              openssl-core.h(7), OSSL_PARAM(3)

              "},{"location":"man3/OSSL_PARAM_int/#history","title":"HISTORY","text":"

              These APIs were introduced in OpenSSL 3.0.

              "},{"location":"man3/OSSL_PARAM_int/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_PROVIDER/","title":"OSSL_PROVIDER","text":""},{"location":"man3/OSSL_PROVIDER/#name","title":"NAME","text":"

              OSSL_PROVIDER_set_default_search_path, OSSL_PROVIDER, OSSL_PROVIDER_load, OSSL_PROVIDER_try_load, OSSL_PROVIDER_unload, OSSL_PROVIDER_available, OSSL_PROVIDER_do_all, OSSL_PROVIDER_gettable_params, OSSL_PROVIDER_get_params, OSSL_PROVIDER_query_operation, OSSL_PROVIDER_unquery_operation, OSSL_PROVIDER_get0_provider_ctx, OSSL_PROVIDER_get0_dispatch, OSSL_PROVIDER_add_builtin, OSSL_PROVIDER_get0_name, OSSL_PROVIDER_get_capabilities, OSSL_PROVIDER_self_test - provider routines

              "},{"location":"man3/OSSL_PROVIDER/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/provider.h>\n\ntypedef struct ossl_provider_st OSSL_PROVIDER;\n\nint OSSL_PROVIDER_set_default_search_path(OSSL_LIB_CTX *libctx,\n                                          const char *path);\n\nOSSL_PROVIDER *OSSL_PROVIDER_load(OSSL_LIB_CTX *libctx, const char *name);\nOSSL_PROVIDER *OSSL_PROVIDER_try_load(OSSL_LIB_CTX *libctx, const char *name,\n                                      int retain_fallbacks);\nint OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);\nint OSSL_PROVIDER_available(OSSL_LIB_CTX *libctx, const char *name);\nint OSSL_PROVIDER_do_all(OSSL_LIB_CTX *ctx,\n                         int (*cb)(OSSL_PROVIDER *provider, void *cbdata),\n                         void *cbdata);\n\nconst OSSL_PARAM *OSSL_PROVIDER_gettable_params(OSSL_PROVIDER *prov);\nint OSSL_PROVIDER_get_params(OSSL_PROVIDER *prov, OSSL_PARAM params[]);\n\nconst OSSL_ALGORITHM *OSSL_PROVIDER_query_operation(const OSSL_PROVIDER *prov,\n                                                    int operation_id,\n                                                    int *no_cache);\nvoid OSSL_PROVIDER_unquery_operation(const OSSL_PROVIDER *prov,\n                                     int operation_id,\n                                     const OSSL_ALGORITHM *algs);\nvoid *OSSL_PROVIDER_get0_provider_ctx(const OSSL_PROVIDER *prov);\nconst OSSL_DISPATCH *OSSL_PROVIDER_get0_dispatch(const OSSL_PROVIDER *prov);\n\nint OSSL_PROVIDER_add_builtin(OSSL_LIB_CTX *libctx, const char *name,\n                              ossl_provider_init_fn *init_fn);\n\nconst char *OSSL_PROVIDER_get0_name(const OSSL_PROVIDER *prov);\n\nint OSSL_PROVIDER_get_capabilities(const OSSL_PROVIDER *prov,\n                                   const char *capability,\n                                   OSSL_CALLBACK *cb,\n                                   void *arg);\nint OSSL_PROVIDER_self_test(const OSSL_PROVIDER *prov);\n
              "},{"location":"man3/OSSL_PROVIDER/#description","title":"DESCRIPTION","text":"

              OSSL_PROVIDER is a type that holds internal information about implementation providers (see provider(7) for information on what a provider is). A provider can be built in to the application or the OpenSSL libraries, or can be a loadable module. The functions described here handle both forms.

              Some of these functions operate within a library context, please see OSSL_LIB_CTX(3) for further details.

              "},{"location":"man3/OSSL_PROVIDER/#functions","title":"Functions","text":"

              OSSL_PROVIDER_set_default_search_path() specifies the default search path that is to be used for looking for providers in the specified libctx. If left unspecified, an environment variable and a fall back default value will be used instead.

              OSSL_PROVIDER_add_builtin() is used to add a built in provider to OSSL_PROVIDER store in the given library context, by associating a provider name with a provider initialization function. This name can then be used with OSSL_PROVIDER_load().

              OSSL_PROVIDER_load() loads and initializes a provider. This may simply initialize a provider that was previously added with OSSL_PROVIDER_add_builtin() and run its given initialization function, or load a provider module with the given name and run its provider entry point, OSSL_provider_init. The name can be a path to a provider module, in that case the provider name as returned by OSSL_PROVIDER_get0_name() will be the path. Interpretation of relative paths is platform dependent and they are relative to the configured \"MODULESDIR\" directory or the path set in the environment variable OPENSSL_MODULES if set.

              OSSL_PROVIDER_try_load() functions like OSSL_PROVIDER_load(), except that it does not disable the fallback providers if the provider cannot be loaded and initialized or if retain_fallbacks is nonzero. If the provider loads successfully and retain_fallbacks is zero, the fallback providers are disabled.

              OSSL_PROVIDER_unload() unloads the given provider. For a provider added with OSSL_PROVIDER_add_builtin(), this simply runs its teardown function.

              OSSL_PROVIDER_available() checks if a named provider is available for use.

              OSSL_PROVIDER_do_all() iterates over all loaded providers, calling cb for each one, with the current provider in provider and the cbdata that comes from the caller. If no other provider has been loaded before calling this function, the default provider is still available as fallback. See OSSL_PROVIDER-default(7) for more information on this fallback behaviour.

              OSSL_PROVIDER_gettable_params() is used to get a provider parameter descriptor set as a constant OSSL_PARAM(3) array.

              OSSL_PROVIDER_get_params() is used to get provider parameter values. The caller must prepare the OSSL_PARAM(3) array before calling this function, and the variables acting as buffers for this parameter array should be filled with data when it returns successfully.

              OSSL_PROVIDER_self_test() is used to run a provider's self tests on demand. If the self tests fail then the provider will fail to provide any further services and algorithms. OSSL_SELF_TEST_set_callback(3) may be called beforehand in order to display diagnostics for the running self tests.

              OSSL_PROVIDER_query_operation() calls the provider's query_operation function (see provider(7)), if the provider has one. It returns an array of OSSL_ALGORITHM for the given operation_id terminated by an all NULL OSSL_ALGORITHM entry. This is considered a low-level function that most applications should not need to call.

              OSSL_PROVIDER_unquery_operation() calls the provider's unquery_operation function (see provider(7)), if the provider has one. This is considered a low-level function that most applications should not need to call.

              OSSL_PROVIDER_get0_provider_ctx() returns the provider context for the given provider. The provider context is an opaque handle set by the provider itself and is passed back to the provider by libcrypto in various function calls.

              OSSL_PROVIDER_get0_dispatch() returns the provider's dispatch table as it was returned in the out parameter from the provider's init function. See provider-base(7).

              If it is permissible to cache references to this array then *no_store is set to 0 or 1 otherwise. If the array is not cacheable then it is assumed to have a short lifetime.

              OSSL_PROVIDER_get0_name() returns the name of the given provider.

              OSSL_PROVIDER_get_capabilities() provides information about the capabilities supported by the provider specified in prov with the capability name capability. For each capability of that name supported by the provider it will call the callback cb and supply a set of OSSL_PARAM(3)s describing the capability. It will also pass back the argument arg. For more details about capabilities and what they can be used for please see \"CAPABILTIIES\" in provider-base(7).

              "},{"location":"man3/OSSL_PROVIDER/#return-values","title":"RETURN VALUES","text":"

              OSSL_PROVIDER_set_default_search_path(), OSSL_PROVIDER_add(), OSSL_PROVIDER_unload(), OSSL_PROVIDER_get_params() and OSSL_PROVIDER_get_capabilities() return 1 on success, or 0 on error.

              OSSL_PROVIDER_load() and OSSL_PROVIDER_try_load() return a pointer to a provider object on success, or NULL on error.

              OSSL_PROVIDER_do_all() returns 1 if the callback cb returns 1 for every provider it is called with, or 0 if any provider callback invocation returns 0; callback processing stops at the first callback invocation on a provider that returns 0.

              OSSL_PROVIDER_available() returns 1 if the named provider is available, otherwise 0.

              OSSL_PROVIDER_gettable_params() returns a pointer to an array of constant OSSL_PARAM(3), or NULL if none is provided.

              OSSL_PROVIDER_get_params() and returns 1 on success, or 0 on error.

              OSSL_PROVIDER_query_operation() returns an array of OSSL_ALGORITHM or NULL on error.

              OSSL_PROVIDER_self_test() returns 1 if the self tests pass, or 0 on error.

              "},{"location":"man3/OSSL_PROVIDER/#examples","title":"EXAMPLES","text":"

              This demonstrates how to load the provider module \"foo\" and ask for its build information.

              #include <openssl/params.h>\n#include <openssl/provider.h>\n#include <openssl/err.h>\n\nOSSL_PROVIDER *prov = NULL;\nconst char *build = NULL;\nOSSL_PARAM request[] = {\n    { \"buildinfo\", OSSL_PARAM_UTF8_PTR, &build, 0, 0 },\n    { NULL, 0, NULL, 0, 0 }\n};\n\nif ((prov = OSSL_PROVIDER_load(NULL, \"foo\")) != NULL\n    && OSSL_PROVIDER_get_params(prov, request))\n    printf(\"Provider 'foo' buildinfo: %s\\n\", build);\nelse\n    ERR_print_errors_fp(stderr);\n
              "},{"location":"man3/OSSL_PROVIDER/#see-also","title":"SEE ALSO","text":"

              openssl-core.h(7), OSSL_LIB_CTX(3), provider(7)

              "},{"location":"man3/OSSL_PROVIDER/#history","title":"HISTORY","text":"

              The type and functions described here were added in OpenSSL 3.0.

              "},{"location":"man3/OSSL_PROVIDER/#copyright","title":"COPYRIGHT","text":"

              Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

              "},{"location":"man3/OSSL_SELF_TEST_new/","title":"OSSL_SELF_TEST_new","text":""},{"location":"man3/OSSL_SELF_TEST_new/#name","title":"NAME","text":"

              OSSL_SELF_TEST_new, OSSL_SELF_TEST_free, OSSL_SELF_TEST_onbegin, OSSL_SELF_TEST_oncorrupt_byte, OSSL_SELF_TEST_onend - functionality to trigger a callback during a self test

              "},{"location":"man3/OSSL_SELF_TEST_new/#synopsis","title":"SYNOPSIS","text":"
              #include <openssl/self_test.h>\n\nOSSL_SELF_TEST *OSSL_SELF_TEST_new(OSSL_CALLBACK *cb, void *cbarg);\nvoid OSSL_SELF_TEST_free(OSSL_SELF_TEST *st);\n\nvoid OSSL_SELF_TEST_onbegin(OSSL_SELF_TEST *st, const char *type,\n                            const char *desc);\nint OSSL_SELF_TEST_oncorrupt_byte(OSSL_SELF_TEST *st, unsigned char *bytes);\nvoid OSSL_SELF_TEST_onend(OSSL_SELF_TEST *st, int ret);\n
              "},{"location":"man3/OSSL_SELF_TEST_new/#description","title":"DESCRIPTION","text":"

              These methods are intended for use by provider implementers, to display diagnostic information during self testing.

              OSSL_SELF_TEST_new() allocates an opaque OSSL_SELF_TEST object that has a callback and callback argument associated with it.

              The callback cb may be triggered multiple times by a self test to indicate different phases.

              OSSL_SELF_TEST_free() frees the space allocated by OSSL_SELF_TEST_new(). If the argument is NULL, nothing is done.

              OSSL_SELF_TEST_onbegin() may be inserted at the start of a block of self test code. It can be used for diagnostic purposes. If this method is called the callback cb will receive the following OSSL_PARAM(3) object.

              • \"st-phase\" (OSSL_PROV_PARAM_SELF_TEST_PHASE)

                The value is the string \"Start\"

                OSSL_SELF_TEST_oncorrupt_byte() may be inserted just after the known answer is calculated, but before the self test compares the result. The first byte in the passed in array of bytes will be corrupted if the callback returns 0, otherwise it leaves the array unaltered. It can be used for failure testing. The type and desc can be used to identify an individual self test to target for failure testing. If this method is called the callback cb will receive the following OSSL_PARAM(3) object.

                • \"st-phase\" (OSSL_PROV_PARAM_SELF_TEST_PHASE)

                  The value is the string \"Corrupt\"

                  OSSL_SELF_TEST_onend() may be inserted at the end of a block of self test code just before cleanup to indicate if the test passed or failed. It can be used for diagnostic purposes. If this method is called the callback cb will receive the following OSSL_PARAM(3) object.

                  • \"st-phase\" (OSSL_PROV_PARAM_SELF_TEST_PHASE)

                    The value of the string is \"Pass\" if ret is non zero, otherwise it has the value \"Fail\".

                    After the callback cb has been called the values that were set by OSSL_SELF_TEST_onbegin() for type and desc are set to the value \"None\".

                    If OSSL_SELF_TEST_onbegin(), OSSL_SELF_TEST_oncorrupt_byte() or OSSL_SELF_TEST_onend() is called the following additional OSSL_PARAM(3) are passed to the callback.

                    • \"st-type\" (OSSL_PROV_PARAM_SELF_TEST_TYPE)

                      The value is setup by the type passed to OSSL_SELF_TEST_onbegin(). This allows the callback to identify the type of test being run.

                    • \"st-desc\" (OSSL_PROV_PARAM_SELF_TEST_DESC)

                      The value is setup by the type passed to OSSL_SELF_TEST_onbegin(). This allows the callback to identify the sub category of the test being run.

                      "},{"location":"man3/OSSL_SELF_TEST_new/#return-values","title":"RETURN VALUES","text":"

                      OSSL_SELF_TEST_new() returns the allocated OSSL_SELF_TEST object, or NULL if it fails.

                      OSSL_SELF_TEST_oncorrupt_byte() returns 1 if corruption occurs, otherwise it returns 0.

                      "},{"location":"man3/OSSL_SELF_TEST_new/#examples","title":"EXAMPLES","text":"

                      A single self test could be set up in the following way:

                        OSSL_SELF_TEST *st = NULL;\n  OSSL_CALLBACK *cb;\n  void *cbarg;\n  int ok = 0;\n  unsigned char out[EVP_MAX_MD_SIZE];\n  unsigned int out_len = 0;\n  EVP_MD_CTX *ctx = EVP_MD_CTX_new();\n  EVP_MD *md = EVP_MD_fetch(libctx, t->algorithm, NULL);\n\n  /*\n   * Retrieve the callback - will be NULL if not set by the application via\n   * OSSL_SELF_TEST_set_callback().\n   */\n  OSSL_SELF_TEST_get_callback(libctx, &cb, &cbarg);\n\n  st = OSSL_SELF_TEST_new(cb, cb_arg);\n\n  /* Trigger the optional callback */\n  OSSL_SELF_TEST_onbegin(st, OSSL_SELF_TEST_TYPE_KAT_DIGEST,\n                         OSSL_SELF_TEST_DESC_MD_SHA2);\n\n  if (!EVP_DigestInit_ex(ctx, md, NULL)\n      || !EVP_DigestUpdate(ctx, pt, pt_len)\n      || !EVP_DigestFinal(ctx, out, &out_len))\n      goto err;\n\n  /* Optional corruption - If the application callback returns 0 */\n  OSSL_SELF_TEST_oncorrupt_byte(st, out);\n\n  if (out_len != t->expected_len\n      || memcmp(out, t->expected, out_len) != 0)\n      goto err;\n  ok = 1;\nerr:\n  OSSL_SELF_TEST_onend(st, ok);\n  EVP_MD_free(md);\n  EVP_MD_CTX_free(ctx);\n

                      Multiple self test's can be set up in a similar way by repeating the pattern of OSSL_SELF_TEST_onbegin(), OSSL_SELF_TEST_oncorrupt_byte(), OSSL_SELF_TEST_onend() for each test.

                      "},{"location":"man3/OSSL_SELF_TEST_new/#see-also","title":"SEE ALSO","text":"

                      OSSL_SELF_TEST_set_callback(3), openssl-core.h(7), OSSL_PROVIDER-FIPS(7)

                      "},{"location":"man3/OSSL_SELF_TEST_new/#history","title":"HISTORY","text":"

                      The functions described here were added in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_SELF_TEST_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_SELF_TEST_set_callback/","title":"OSSL_SELF_TEST_set_callback","text":""},{"location":"man3/OSSL_SELF_TEST_set_callback/#name","title":"NAME","text":"

                      OSSL_SELF_TEST_set_callback, OSSL_SELF_TEST_get_callback - specify a callback for processing self tests

                      "},{"location":"man3/OSSL_SELF_TEST_set_callback/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/self_test.h>\n\nvoid OSSL_SELF_TEST_set_callback(OSSL_LIB_CTX *ctx, OSSL_CALLBACK *cb, void *cbarg);\nvoid OSSL_SELF_TEST_get_callback(OSSL_LIB_CTX *ctx, OSSL_CALLBACK **cb, void **cbarg);\n
                      "},{"location":"man3/OSSL_SELF_TEST_set_callback/#description","title":"DESCRIPTION","text":"

                      Set or gets the optional application callback (and the callback argument) that is called during self testing. The application callback OSSL_CALLBACK(3) is associated with a OSSL_LIB_CTX. The application callback function receives information about a running self test, and may return a result to the calling self test. See openssl-core.h(7) for further information on the callback.

                      "},{"location":"man3/OSSL_SELF_TEST_set_callback/#return-values","title":"RETURN VALUES","text":"

                      OSSL_SELF_TEST_get_callback() returns the callback and callback argument that has been set via OSSL_SELF_TEST_set_callback() for the given library context ctx. These returned parameters will be NULL if OSSL_SELF_TEST_set_callback() has not been called.

                      "},{"location":"man3/OSSL_SELF_TEST_set_callback/#see-also","title":"SEE ALSO","text":"

                      openssl-core.h(7), OSSL_PROVIDER-FIPS(7) OSSL_SELF_TEST_new(3) OSSL_LIB_CTX(3)

                      "},{"location":"man3/OSSL_SELF_TEST_set_callback/#history","title":"HISTORY","text":"

                      The functions described here were added in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_SELF_TEST_set_callback/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_STORE_INFO/","title":"OSSL_STORE_INFO","text":""},{"location":"man3/OSSL_STORE_INFO/#name","title":"NAME","text":"

                      OSSL_STORE_INFO, OSSL_STORE_INFO_get_type, OSSL_STORE_INFO_get0_NAME, OSSL_STORE_INFO_get0_NAME_description, OSSL_STORE_INFO_get0_PARAMS, OSSL_STORE_INFO_get0_PUBKEY, OSSL_STORE_INFO_get0_PKEY, OSSL_STORE_INFO_get0_CERT, OSSL_STORE_INFO_get0_CRL, OSSL_STORE_INFO_get1_NAME, OSSL_STORE_INFO_get1_NAME_description, OSSL_STORE_INFO_get1_PARAMS, OSSL_STORE_INFO_get1_PUBKEY, OSSL_STORE_INFO_get1_PKEY, OSSL_STORE_INFO_get1_CERT, OSSL_STORE_INFO_get1_CRL, OSSL_STORE_INFO_type_string, OSSL_STORE_INFO_free, OSSL_STORE_INFO_new_NAME, OSSL_STORE_INFO_set0_NAME_description, OSSL_STORE_INFO_new_PARAMS, OSSL_STORE_INFO_new_PUBKEY, OSSL_STORE_INFO_new_PKEY, OSSL_STORE_INFO_new_CERT, OSSL_STORE_INFO_new_CRL, OSSL_STORE_INFO_new, OSSL_STORE_INFO_get0_data - Functions to manipulate OSSL_STORE_INFO objects

                      "},{"location":"man3/OSSL_STORE_INFO/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/store.h>\n\ntypedef struct ossl_store_info_st OSSL_STORE_INFO;\n\nint OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *store_info);\nconst char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *store_info);\nchar *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *store_info);\nconst char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO\n                                                  *store_info);\nchar *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get0_PUBKEY(const OSSL_STORE_INFO *info);\nEVP_PKEY *OSSL_STORE_INFO_get1_PUBKEY(const OSSL_STORE_INFO *info);\nEVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *store_info);\nX509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *store_info);\nX509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *store_info);\nX509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *store_info);\nX509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *store_info);\n\nconst char *OSSL_STORE_INFO_type_string(int type);\n\nvoid OSSL_STORE_INFO_free(OSSL_STORE_INFO *store_info);\n\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name);\nint OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(DSA *dsa_params);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_PUBKEY(EVP_PKEY *pubkey);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl);\n\nOSSL_STORE_INFO *OSSL_STORE_INFO_new(int type, void *data);\nvoid *OSSL_STORE_INFO_get0_data(int type, const OSSL_STORE_INFO *info);\n
                      "},{"location":"man3/OSSL_STORE_INFO/#description","title":"DESCRIPTION","text":"

                      These functions are primarily useful for applications to retrieve supported objects from OSSL_STORE_INFO objects and for scheme specific loaders to create OSSL_STORE_INFO holders.

                      "},{"location":"man3/OSSL_STORE_INFO/#types","title":"Types","text":"

                      OSSL_STORE_INFO is an opaque type that's just an intermediary holder for the objects that have been retrieved by OSSL_STORE_load() and similar functions. Supported OpenSSL type object can be extracted using one of STORE_INFO_get0_() where can be NAME, PARAMS, PKEY, CERT, or CRL. The life time of this extracted object is as long as the life time of the OSSL_STORE_INFO it was extracted from, so care should be taken not to free the latter too early. As an alternative, STORE_INFO_get1_() extracts a duplicate (or the same object with its reference count increased), which can be used after the containing OSSL_STORE_INFO has been freed. The object returned by STORE_INFO_get1_() must be freed separately by the caller. See \"SUPPORTED OBJECTS\" for more information on the types that are supported."},{"location":"man3/OSSL_STORE_INFO/#functions","title":"Functions","text":"

                      OSSL_STORE_INFO_get_type() takes a OSSL_STORE_INFO and returns the STORE type number for the object inside.

                      STORE_INFO_get_type_string() takes a STORE type number and returns a short string describing it.

                      OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(), OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PUBKEY(), OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), OSSL_STORE_INFO_get0_CRL() all take a OSSL_STORE_INFO and return the object it holds if the OSSL_STORE_INFO type (as returned by OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL.

                      OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(), OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PUBKEY(), OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all take a OSSL_STORE_INFO and return a duplicate the object it holds if the OSSL_STORE_INFO type (as returned by OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL.

                      OSSL_STORE_INFO_free() frees a OSSL_STORE_INFO and its contained type. If the argument is NULL, nothing is done.

                      OSSL_STORE_INFO_new_NAME() , OSSL_STORE_INFO_new_PARAMS(), , OSSL_STORE_INFO_new_PUBKEY(), OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and OSSL_STORE_INFO_new_CRL() create a OSSL_STORE_INFO object to hold the given input object. On success the input object is consumed.

                      Additionally, for OSSL_STORE_INFO_NAME objects, OSSL_STORE_INFO_set0_NAME_description() can be used to add an extra description. This description is meant to be human readable and should be used for information printout.

                      OSSL_STORE_INFO_new() creates a OSSL_STORE_INFO with an arbitrary type number and data structure. It's the responsibility of the caller to define type numbers other than the ones defined by <openssl/store.h>, and to handle freeing the associated data structure on their own. Using type numbers that are defined by <openssl/store.h> may cause undefined behaviours, including crashes.

                      OSSL_STORE_INFO_get0_data() returns the data pointer that was passed to OSSL_STORE_INFO_new() if type matches the type number in info.

                      OSSL_STORE_INFO_new() and OSSL_STORE_INFO_get0_data() may be useful for applications that define their own STORE data, but must be used with care.

                      "},{"location":"man3/OSSL_STORE_INFO/#supported-objects","title":"SUPPORTED OBJECTS","text":"

                      Currently supported object types are:

                      • OSSL_STORE_INFO_NAME

                        A name is exactly that, a name. It's like a name in a directory, but formatted as a complete URI. For example, the path in URI file:/foo/bar/ could include a file named cookie.pem, and in that case, the returned OSSL_STORE_INFO_NAME object would have the URI file:/foo/bar/cookie.pem, which can be used by the application to get the objects in that file. This can be applied to all schemes that can somehow support a listing of object URIs.

                        For file: URIs that are used without the explicit scheme, the returned name will be the path of each object, so if /foo/bar was given and that path has the file cookie.pem, the name /foo/bar/cookie.pem will be returned.

                        The returned URI is considered canonical and must be unique and permanent for the storage where the object (or collection of objects) resides. Each loader is responsible for ensuring that it only returns canonical URIs. However, it's possible that certain schemes allow an object (or collection thereof) to be reached with alternative URIs; just because one URI is canonical doesn't mean that other variants can't be used.

                        At the discretion of the loader that was used to get these names, an extra description may be attached as well.

                      • OSSL_STORE_INFO_PARAMS

                        Key parameters.

                      • OSSL_STORE_INFO_PKEY

                        A keypair or just a private key (possibly with key parameters).

                      • OSSL_STORE_INFO_PUBKEY

                        A public key (possibly with key parameters).

                      • OSSL_STORE_INFO_CERT

                        An X.509 certificate.

                      • OSSL_STORE_INFO_CRL

                        A X.509 certificate revocation list.

                      "},{"location":"man3/OSSL_STORE_INFO/#return-values","title":"RETURN VALUES","text":"

                      OSSL_STORE_INFO_get_type() returns the STORE type number of the given OSSL_STORE_INFO. There is no error value.

                      OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(), OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT() and OSSL_STORE_INFO_get0_CRL() all return a pointer to the OpenSSL object on success, NULL otherwise.

                      OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(), OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all return a pointer to a duplicate of the OpenSSL object on success, NULL otherwise.

                      OSSL_STORE_INFO_type_string() returns a string on success, or NULL on failure.

                      OSSL_STORE_INFO_new_NAME(), OSSL_STORE_INFO_new_PARAMS(), OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and OSSL_STORE_INFO_new_CRL() return a OSSL_STORE_INFO pointer on success, or NULL on failure.

                      OSSL_STORE_INFO_set0_NAME_description() returns 1 on success, or 0 on failure.

                      "},{"location":"man3/OSSL_STORE_INFO/#see-also","title":"SEE ALSO","text":"

                      ossl_store(7), OSSL_STORE_open(3), OSSL_STORE_register_loader(3)

                      "},{"location":"man3/OSSL_STORE_INFO/#history","title":"HISTORY","text":"

                      The OSSL_STORE API was added in OpenSSL 1.1.1.

                      The OSSL_STORE_INFO_PUBKEY object type was added in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_STORE_INFO/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_STORE_LOADER/","title":"OSSL_STORE_LOADER","text":""},{"location":"man3/OSSL_STORE_LOADER/#name","title":"NAME","text":"

                      OSSL_STORE_LOADER, OSSL_STORE_LOADER_fetch, OSSL_STORE_LOADER_up_ref, OSSL_STORE_LOADER_free, OSSL_STORE_LOADER_get0_provider, OSSL_STORE_LOADER_get0_properties, OSSL_STORE_LOADER_is_a, OSSL_STORE_LOADER_get0_description, OSSL_STORE_LOADER_do_all_provided, OSSL_STORE_LOADER_names_do_all, OSSL_STORE_LOADER_CTX, OSSL_STORE_LOADER_new, OSSL_STORE_LOADER_get0_engine, OSSL_STORE_LOADER_get0_scheme, OSSL_STORE_LOADER_set_open, OSSL_STORE_LOADER_set_open_ex, OSSL_STORE_LOADER_set_attach, OSSL_STORE_LOADER_set_ctrl, OSSL_STORE_LOADER_set_expect, OSSL_STORE_LOADER_set_find, OSSL_STORE_LOADER_set_load, OSSL_STORE_LOADER_set_eof, OSSL_STORE_LOADER_set_error, OSSL_STORE_LOADER_set_close, OSSL_STORE_register_loader, OSSL_STORE_unregister_loader, OSSL_STORE_open_fn, OSSL_STORE_open_ex_fn, OSSL_STORE_attach_fn, OSSL_STORE_ctrl_fn, OSSL_STORE_expect_fn, OSSL_STORE_find_fn, OSSL_STORE_load_fn, OSSL_STORE_eof_fn, OSSL_STORE_error_fn, OSSL_STORE_close_fn - Types and functions to manipulate, register and unregister STORE loaders for different URI schemes

                      "},{"location":"man3/OSSL_STORE_LOADER/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/store.h>\n\ntypedef struct ossl_store_loader_st OSSL_STORE_LOADER;\n\nOSSL_STORE_LOADER *OSSL_STORE_LOADER_fetch(OSSL_LIB_CTX *libctx,\n                                           const char *scheme,\n                                           const char *properties);\nint OSSL_STORE_LOADER_up_ref(OSSL_STORE_LOADER *loader);\nvoid OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader);\nconst OSSL_PROVIDER *OSSL_STORE_LOADER_get0_provider(const OSSL_STORE_LOADER *\n                                                loader);\nconst char *OSSL_STORE_LOADER_get0_properties(const OSSL_STORE_LOADER *loader);\nconst char *OSSL_STORE_LOADER_get0_description(const OSSL_STORE_LOADER *loader);\nint OSSL_STORE_LOADER_is_a(const OSSL_STORE_LOADER *loader,\n                           const char *scheme);\nvoid OSSL_STORE_LOADER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                       void (*user_fn)(OSSL_STORE_LOADER *loader,\n                                                  void *arg),\n                                       void *user_arg);\nint OSSL_STORE_LOADER_names_do_all(const OSSL_STORE_LOADER *loader,\n                                   void (*fn)(const char *name, void *data),\n                                   void *data);\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme);\nconst ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER\n                                            *store_loader);\nconst char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER\n                                          *store_loader);\n\n/* struct ossl_store_loader_ctx_st is defined differently by each loader */\ntypedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX;\n\ntypedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(\n    const char *uri, const UI_METHOD *ui_method, void *ui_data);\nint OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *store_loader,\n                               OSSL_STORE_open_fn store_open_function);\ntypedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_ex_fn)(\n    const char *uri, const UI_METHOD *ui_method, void *ui_data);\nint OSSL_STORE_LOADER_set_open_ex\n    (OSSL_STORE_LOADER *store_loader,\n     OSSL_STORE_open_ex_fn store_open_ex_function);\ntypedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_attach_fn)\n    (const OSSL_STORE_LOADER *loader, BIO *bio,\n     OSSL_LIB_CTX *libctx, const char *propq,\n     const UI_METHOD *ui_method, void *ui_data);\nint OSSL_STORE_LOADER_set_attach(OSSL_STORE_LOADER *loader,\n                                 OSSL_STORE_attach_fn attach_function);\ntypedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd,\n                                  va_list args);\nint OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *store_loader,\n                               OSSL_STORE_ctrl_fn store_ctrl_function);\ntypedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected);\nint OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader,\n                                 OSSL_STORE_expect_fn expect_function);\ntypedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx,\n                                  OSSL_STORE_SEARCH *criteria);\nint OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader,\n                               OSSL_STORE_find_fn find_function);\ntypedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx,\n                                               UI_METHOD *ui_method,\n                                               void *ui_data);\nint OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *store_loader,\n                               OSSL_STORE_load_fn store_load_function);\ntypedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx);\nint OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *store_loader,\n                              OSSL_STORE_eof_fn store_eof_function);\ntypedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx);\nint OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *store_loader,\n                                OSSL_STORE_error_fn store_error_function);\ntypedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx);\nint OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *store_loader,\n                                OSSL_STORE_close_fn store_close_function);\n\nint OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader);\nOSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme);\n
                      "},{"location":"man3/OSSL_STORE_LOADER/#description","title":"DESCRIPTION","text":"

                      OSSL_STORE_LOADER is a method for OSSL_STORE loaders, which implement OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof(), OSSL_STORE_error() and OSSL_STORE_close() for specific storage schemes.

                      OSSL_STORE_LOADER_fetch() looks for an implementation for a storage scheme within the providers that has been loaded into the OSSL_LIB_CTX given by libctx, and with the properties given by properties.

                      OSSL_STORE_LOADER_up_ref() increments the reference count for the given loader.

                      OSSL_STORE_LOADER_free() decrements the reference count for the given loader, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

                      OSSL_STORE_LOADER_get0_provider() returns the provider of the given loader.

                      OSSL_STORE_LOADER_get0_properties() returns the property definition associated with the given loader.

                      OSSL_STORE_LOADER_is_a() checks if loader is an implementation of an algorithm that's identifiable with scheme.

                      OSSL_STORE_LOADER_get0_description() returns a description of the loader, meant for display and human consumption. The description is at the discretion of the loader implementation.

                      OSSL_STORE_LOADER_do_all_provided() traverses all store implementations by all activated providers in the library context libctx, and for each of the implementations, calls user_fn with the implementation method and user_arg as arguments.

                      OSSL_STORE_LOADER_names_do_all() traverses all names for the given loader, and calls fn with each name and data.

                      "},{"location":"man3/OSSL_STORE_LOADER/#legacy-types-and-functions-deprecated","title":"Legacy Types and Functions (deprecated)","text":"

                      These functions help applications and engines to create loaders for schemes they support. These are all deprecated and discouraged in favour of provider implementations, see provider-storemgmt(7).

                      OSSL_STORE_LOADER_CTX is a type template, to be defined by each loader using struct ossl_store_loader_ctx_st { ... }.

                      OSSL_STORE_open_fn, OSSL_STORE_open_ex_fn, OSSL_STORE_ctrl_fn, OSSL_STORE_expect_fn, OSSL_STORE_find_fn, OSSL_STORE_load_fn, OSSL_STORE_eof_fn, and OSSL_STORE_close_fn are the function pointer types used within a STORE loader. The functions pointed at define the functionality of the given loader.

                      • OSSL_STORE_open_fn and OSSL_STORE_open_ex_fn

                        OSSL_STORE_open_ex_fn takes a URI and is expected to interpret it in the best manner possible according to the scheme the loader implements. It also takes a UI_METHOD and associated data, to be used any time something needs to be prompted for, as well as a library context libctx with an associated property query propq, to be used when fetching necessary algorithms to perform the loads. Furthermore, this function is expected to initialize what needs to be initialized, to create a private data store (OSSL_STORE_LOADER_CTX, see above), and to return it. If something goes wrong, this function is expected to return NULL.

                        OSSL_STORE_open_fn does the same thing as OSSL_STORE_open_ex_fn but uses NULL for the library context libctx and property query propq.

                      • OSSL_STORE_attach_fn

                        This function takes a BIO, otherwise works like OSSL_STORE_open_ex_fn.

                      • OSSL_STORE_ctrl_fn

                        This function takes a OSSL_STORE_LOADER_CTX pointer, a command number cmd and a va_list args and is used to manipulate loader specific parameters.

                        Loader specific command numbers must begin at OSSL_STORE_C_CUSTOM_START. Any number below that is reserved for future globally known command numbers.

                        This function is expected to return 1 on success, 0 on error.

                      • OSSL_STORE_expect_fn

                        This function takes a OSSL_STORE_LOADER_CTX pointer and a OSSL_STORE_INFO identity expected, and is used to tell the loader what object type is expected. expected may be zero to signify that no specific object type is expected.

                        This function is expected to return 1 on success, 0 on error.

                      • OSSL_STORE_find_fn

                        This function takes a OSSL_STORE_LOADER_CTX pointer and a OSSL_STORE_SEARCH search criterion, and is used to tell the loader what to search for.

                        When called with the loader context being NULL, this function is expected to return 1 if the loader supports the criterion, otherwise 0.

                        When called with the loader context being something other than NULL, this function is expected to return 1 on success, 0 on error.

                      • OSSL_STORE_load_fn

                        This function takes a OSSL_STORE_LOADER_CTX pointer and a UI_METHOD with associated data. It's expected to load the next available data, mold it into a data structure that can be wrapped in a OSSL_STORE_INFO using one of the OSSL_STORE_INFO(3) functions. If no more data is available or an error occurs, this function is expected to return NULL. The OSSL_STORE_eof_fn and OSSL_STORE_error_fn functions must indicate if it was in fact the end of data or if an error occurred.

                        Note that this function retrieves one data item only.

                      • OSSL_STORE_eof_fn

                        This function takes a OSSL_STORE_LOADER_CTX pointer and is expected to return 1 to indicate that the end of available data has been reached. It is otherwise expected to return 0.

                      • OSSL_STORE_error_fn

                        This function takes a OSSL_STORE_LOADER_CTX pointer and is expected to return 1 to indicate that an error occurred in a previous call to the OSSL_STORE_load_fn function. It is otherwise expected to return 0.

                      • OSSL_STORE_close_fn

                        This function takes a OSSL_STORE_LOADER_CTX pointer and is expected to close or shut down what needs to be closed, and finally free the contents of the OSSL_STORE_LOADER_CTX pointer. It returns 1 on success and 0 on error.

                      OSSL_STORE_LOADER_new() creates a new OSSL_STORE_LOADER. It takes an ENGINE e and a string scheme. scheme must always be set. Both e and scheme are used as is and must therefore be alive as long as the created loader is.

                      OSSL_STORE_LOADER_get0_engine() returns the engine of the store_loader. OSSL_STORE_LOADER_get0_scheme() returns the scheme of the store_loader.

                      OSSL_STORE_LOADER_set_open() sets the opener function for the store_loader.

                      OSSL_STORE_LOADER_set_open_ex() sets the opener with library context function for the store_loader.

                      OSSL_STORE_LOADER_set_attach() sets the attacher function for the store_loader.

                      OSSL_STORE_LOADER_set_ctrl() sets the control function for the store_loader.

                      OSSL_STORE_LOADER_set_expect() sets the expect function for the store_loader.

                      OSSL_STORE_LOADER_set_load() sets the loader function for the store_loader.

                      OSSL_STORE_LOADER_set_eof() sets the end of file checker function for the store_loader.

                      OSSL_STORE_LOADER_set_close() sets the closing function for the store_loader.

                      OSSL_STORE_LOADER_free() frees the given store_loader. If the argument is NULL, nothing is done.

                      OSSL_STORE_register_loader() register the given store_loader and thereby makes it available for use with OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close().

                      OSSL_STORE_unregister_loader() unregister the store loader for the given scheme.

                      "},{"location":"man3/OSSL_STORE_LOADER/#return-values","title":"RETURN VALUES","text":"

                      OSSL_STORE_LOADER_fetch() returns a pointer to an OSSL_STORE_LOADER object, or NULL on error.

                      OSSL_STORE_LOADER_up_ref() returns 1 on success, or 0 on error.

                      OSSL_STORE_LOADER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                      OSSL_STORE_LOADER_free() doesn't return any value.

                      OSSL_STORE_LOADER_get0_provider() returns a pointer to a provider object, or NULL on error.

                      OSSL_STORE_LOADER_get0_properties() returns a pointer to a property definition string, or NULL on error.

                      OSSL_STORE_LOADER_is_a() returns 1 if loader was identifiable, otherwise 0.

                      OSSL_STORE_LOADER_get0_description() returns a pointer to a description, or NULL if there isn't one.

                      The functions with the types OSSL_STORE_open_fn, OSSL_STORE_open_ex_fn, OSSL_STORE_ctrl_fn, OSSL_STORE_expect_fn, OSSL_STORE_load_fn, OSSL_STORE_eof_fn and OSSL_STORE_close_fn have the same return values as OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_ctrl(), OSSL_STORE_expect(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close(), respectively.

                      OSSL_STORE_LOADER_new() returns a pointer to a OSSL_STORE_LOADER on success, or NULL on failure.

                      OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_eof() and OSSL_STORE_LOADER_set_close() return 1 on success, or 0 on failure.

                      OSSL_STORE_register_loader() returns 1 on success, or 0 on failure.

                      OSSL_STORE_unregister_loader() returns the unregistered loader on success, or NULL on failure.

                      "},{"location":"man3/OSSL_STORE_LOADER/#see-also","title":"SEE ALSO","text":"

                      ossl_store(7), OSSL_STORE_open(3), OSSL_LIB_CTX(3), provider-storemgmt(7)

                      "},{"location":"man3/OSSL_STORE_LOADER/#history","title":"HISTORY","text":"

                      OSSL_STORE_LOADER_fetch(), OSSL_STORE_LOADER_up_ref(), OSSL_STORE_LOADER_get0_provider(), OSSL_STORE_LOADER_get0_properties(), OSSL_STORE_LOADER_get0_description(), OSSL_STORE_LOADER_is_a(), OSSL_STORE_LOADER_do_all_provided() and OSSL_STORE_LOADER_names_do_all() were added in OpenSSL 3.0.

                      OSSL_STORE_LOADER and OSSL_STORE_LOADER_free() were added in OpenSSL 1.1.1.

                      OSSL_STORE_LOADER_set_open_ex() and OSSL_STORE_open_ex_fn() were added in OpenSSL 3.0, and are deprecated.

                      OSSL_STORE_LOADER_CTX, OSSL_STORE_LOADER_new(), OSSL_STORE_LOADER_set0_scheme(), OSSL_STORE_LOADER_get0_scheme(), OSSL_STORE_LOADER_get0_engine(), OSSL_STORE_LOADER_set_expect(), OSSL_STORE_LOADER_set_find(), OSSL_STORE_LOADER_set_attach(), OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_eof(), OSSL_STORE_LOADER_set_close(), OSSL_STORE_register_loader(), OSSL_STORE_LOADER_set_error(), OSSL_STORE_unregister_loader(), OSSL_STORE_open_fn(), OSSL_STORE_ctrl_fn(), OSSL_STORE_load_fn(), OSSL_STORE_eof_fn() and OSSL_STORE_close_fn() were added in OpenSSL 1.1.1, and became deprecated in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_STORE_LOADER/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_STORE_SEARCH/","title":"OSSL_STORE_SEARCH","text":""},{"location":"man3/OSSL_STORE_SEARCH/#name","title":"NAME","text":"

                      OSSL_STORE_SEARCH, OSSL_STORE_SEARCH_by_name, OSSL_STORE_SEARCH_by_issuer_serial, OSSL_STORE_SEARCH_by_key_fingerprint, OSSL_STORE_SEARCH_by_alias, OSSL_STORE_SEARCH_free, OSSL_STORE_SEARCH_get_type, OSSL_STORE_SEARCH_get0_name, OSSL_STORE_SEARCH_get0_serial, OSSL_STORE_SEARCH_get0_bytes, OSSL_STORE_SEARCH_get0_string, OSSL_STORE_SEARCH_get0_digest - Type and functions to create OSSL_STORE search criteria

                      "},{"location":"man3/OSSL_STORE_SEARCH/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/store.h>\n\ntypedef struct ossl_store_search_st OSSL_STORE_SEARCH;\n\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name);\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name,\n                                                      const ASN1_INTEGER\n                                                      *serial);\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest,\n                                                        const unsigned char\n                                                        *bytes, int len);\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias);\n\nvoid OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search);\n\nint OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion);\nX509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion);\nconst ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH\n                                                  *criterion);\nconst unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH\n                                                  *criterion, size_t *length);\nconst char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion);\nconst EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH\n                                            *criterion);\n
                      "},{"location":"man3/OSSL_STORE_SEARCH/#description","title":"DESCRIPTION","text":"

                      These functions are used to specify search criteria to help search for specific objects through other names than just the URI that's given to OSSL_STORE_open(). For example, this can be useful for an application that has received a URI and then wants to add on search criteria in a uniform and supported manner.

                      "},{"location":"man3/OSSL_STORE_SEARCH/#types","title":"Types","text":"

                      OSSL_STORE_SEARCH is an opaque type that holds the constructed search criterion, and that can be given to an OSSL_STORE context with OSSL_STORE_find().

                      The calling application owns the allocation of an OSSL_STORE_SEARCH at all times, and should therefore be careful not to deallocate it before OSSL_STORE_close() has been called for the OSSL_STORE context it was given to.

                      "},{"location":"man3/OSSL_STORE_SEARCH/#application-functions","title":"Application Functions","text":"

                      OSSL_STORE_SEARCH_by_name(), OSSL_STORE_SEARCH_by_issuer_serial(), OSSL_STORE_SEARCH_by_key_fingerprint(), and OSSL_STORE_SEARCH_by_alias() are used to create an OSSL_STORE_SEARCH from a subject name, an issuer name and serial number pair, a key fingerprint, and an alias (for example a friendly name). The parameters that are provided are not copied, only referred to in a criterion, so they must have at least the same life time as the created OSSL_STORE_SEARCH.

                      OSSL_STORE_SEARCH_free() is used to free the OSSL_STORE_SEARCH. If the argument is NULL, nothing is done.

                      "},{"location":"man3/OSSL_STORE_SEARCH/#loader-functions","title":"Loader Functions","text":"

                      OSSL_STORE_SEARCH_get_type() returns the criterion type for the given OSSL_STORE_SEARCH.

                      OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(), OSSL_STORE_SEARCH_get0_bytes(), OSSL_STORE_SEARCH_get0_string(), and OSSL_STORE_SEARCH_get0_digest() are used to retrieve different data from a OSSL_STORE_SEARCH, as available for each type. For more information, see \"SUPPORTED CRITERION TYPES\" below.

                      "},{"location":"man3/OSSL_STORE_SEARCH/#supported-criterion-types","title":"SUPPORTED CRITERION TYPES","text":"

                      Currently supported criterion types are:

                      • OSSL_STORE_SEARCH_BY_NAME

                        This criterion supports a search by exact match of subject name. The subject name itself is a X509_NAME pointer. A criterion of this type is created with OSSL_STORE_SEARCH_by_name(), and the actual subject name is retrieved with OSSL_STORE_SEARCH_get0_name().

                      • OSSL_STORE_SEARCH_BY_ISSUER_SERIAL

                        This criterion supports a search by exact match of both issuer name and serial number. The issuer name itself is a X509_NAME pointer, and the serial number is a ASN1_INTEGER pointer. A criterion of this type is created with OSSL_STORE_SEARCH_by_issuer_serial() and the actual issuer name and serial number are retrieved with OSSL_STORE_SEARCH_get0_name() and OSSL_STORE_SEARCH_get0_serial().

                      • OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT

                        This criterion supports a search by exact match of key fingerprint. The key fingerprint in itself is a string of bytes and its length, as well as the algorithm that was used to compute the fingerprint. The digest may be left unspecified (NULL), and in that case, the loader has to decide on a default digest and compare fingerprints accordingly. A criterion of this type is created with OSSL_STORE_SEARCH_by_key_fingerprint() and the actual fingerprint and its length can be retrieved with OSSL_STORE_SEARCH_get0_bytes(). The digest can be retrieved with OSSL_STORE_SEARCH_get0_digest().

                      • OSSL_STORE_SEARCH_BY_ALIAS

                        This criterion supports a search by match of an alias of some kind. The alias in itself is a simple C string. A criterion of this type is created with OSSL_STORE_SEARCH_by_alias() and the actual alias is retrieved with OSSL_STORE_SEARCH_get0_string().

                      "},{"location":"man3/OSSL_STORE_SEARCH/#return-values","title":"RETURN VALUES","text":"

                      OSSL_STORE_SEARCH_by_name(), OSSL_STORE_SEARCH_by_issuer_serial(), OSSL_STORE_SEARCH_by_key_fingerprint(), and OSSL_STORE_SEARCH_by_alias() return a OSSL_STORE_SEARCH pointer on success, or NULL on failure.

                      OSSL_STORE_SEARCH_get_type() returns the criterion type of the given OSSL_STORE_SEARCH. There is no error value.

                      OSSL_STORE_SEARCH_get0_name() returns a X509_NAME pointer on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                      OSSL_STORE_SEARCH_get0_serial() returns a ASN1_INTEGER pointer on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                      OSSL_STORE_SEARCH_get0_bytes() returns a const unsigned char pointer and sets *length to the strings length on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                      OSSL_STORE_SEARCH_get0_string() returns a const char pointer on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                      OSSL_STORE_SEARCH_get0_digest() returns a const EVP_MD pointer. NULL is a valid value and means that the store loader default will be used when applicable.

                      "},{"location":"man3/OSSL_STORE_SEARCH/#see-also","title":"SEE ALSO","text":"

                      ossl_store(7), OSSL_STORE_supports_search(3), OSSL_STORE_find(3)

                      "},{"location":"man3/OSSL_STORE_SEARCH/#history","title":"HISTORY","text":"

                      OSSL_STORE_SEARCH, OSSL_STORE_SEARCH_by_name(), OSSL_STORE_SEARCH_by_issuer_serial(), OSSL_STORE_SEARCH_by_key_fingerprint(), OSSL_STORE_SEARCH_by_alias(), OSSL_STORE_SEARCH_free(), OSSL_STORE_SEARCH_get_type(), OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(), OSSL_STORE_SEARCH_get0_bytes(), and OSSL_STORE_SEARCH_get0_string() were added in OpenSSL 1.1.1.

                      "},{"location":"man3/OSSL_STORE_SEARCH/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_STORE_attach/","title":"OSSL_STORE_attach","text":""},{"location":"man3/OSSL_STORE_attach/#name","title":"NAME","text":"

                      OSSL_STORE_attach - Functions to read objects from a BIO

                      "},{"location":"man3/OSSL_STORE_attach/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/store.h>\n\nOSSL_STORE_CTX *OSSL_STORE_attach(BIO *bio, const char *scheme,\n                                  OSSL_LIB_CTX *libctx, const char *propq,\n                                  const UI_METHOD *ui_method, void *ui_data,\n                                  const OSSL_PARAM params[],\n                                  OSSL_STORE_post_process_info_fn post_process,\n                                  void *post_process_data);\n
                      "},{"location":"man3/OSSL_STORE_attach/#description","title":"DESCRIPTION","text":"

                      OSSL_STORE_attach() works like OSSL_STORE_open(3), except it takes a BIO bio instead of a uri, along with a scheme to determine what loader should be used to process the data. The reference count of the BIO object is increased by 1 if the call is successful.

                      "},{"location":"man3/OSSL_STORE_attach/#return-values","title":"RETURN VALUES","text":"

                      OSSL_STORE_attach() returns a pointer to a OSSL_STORE_CTX on success, or NULL on failure.

                      "},{"location":"man3/OSSL_STORE_attach/#see-also","title":"SEE ALSO","text":"

                      ossl_store(7), OSSL_STORE_open(3)

                      "},{"location":"man3/OSSL_STORE_attach/#history","title":"HISTORY","text":"

                      OSSL_STORE_attach() was added in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_STORE_attach/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_STORE_expect/","title":"OSSL_STORE_expect","text":""},{"location":"man3/OSSL_STORE_expect/#name","title":"NAME","text":"

                      OSSL_STORE_expect, OSSL_STORE_supports_search, OSSL_STORE_find - Specify what object type is expected

                      "},{"location":"man3/OSSL_STORE_expect/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/store.h>\n\nint OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type);\n\nint OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int criterion_type);\n\nint OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search);\n
                      "},{"location":"man3/OSSL_STORE_expect/#description","title":"DESCRIPTION","text":"

                      OSSL_STORE_expect() helps applications filter what OSSL_STORE_load() returns by specifying a OSSL_STORE_INFO type. By default, no expectations on the types of objects to be loaded are made. expected_type may be 0 to indicate explicitly that no expectation is made, or it may be any of the known object types (see \"SUPPORTED OBJECTS\" in OSSL_STORE_INFO(3)) except for OSSL_STORE_INFO_NAME. For example, if file:/foo/bar/store.pem contains several objects of different type and only certificates are interesting, the application can simply say that it expects the type OSSL_STORE_INFO_CERT.

                      OSSL_STORE_find() helps applications specify a criterion for a more fine grained search of objects.

                      OSSL_STORE_supports_search() checks if the loader of the given OSSL_STORE context supports the given search type. See \"SUPPORTED CRITERION TYPES\" in OSSL_STORE_SEARCH(3) for information on the supported search criterion types.

                      OSSL_STORE_expect() and OSSL_STORE_find must be called before the first OSSL_STORE_load() of a given session, or they will fail.

                      "},{"location":"man3/OSSL_STORE_expect/#notes","title":"NOTES","text":"

                      If a more elaborate filter is required by the application, a better choice would be to use a post-processing function. See OSSL_STORE_open(3) for more information.

                      However, some loaders may take advantage of the knowledge of an expected type to make object retrieval more efficient, so if a single type is expected, this method is usually preferable.

                      "},{"location":"man3/OSSL_STORE_expect/#return-values","title":"RETURN VALUES","text":"

                      OSSL_STORE_expect() returns 1 on success, or 0 on failure.

                      OSSL_STORE_supports_search() returns 1 if the criterion is supported, or 0 otherwise.

                      OSSL_STORE_find() returns 1 on success, or 0 on failure.

                      "},{"location":"man3/OSSL_STORE_expect/#see-also","title":"SEE ALSO","text":"

                      ossl_store(7), OSSL_STORE_INFO(3), OSSL_STORE_SEARCH(3), OSSL_STORE_load(3)

                      "},{"location":"man3/OSSL_STORE_expect/#history","title":"HISTORY","text":"

                      OSSL_STORE_expect(), OSSL_STORE_supports_search() and OSSL_STORE_find() were added in OpenSSL 1.1.1.

                      "},{"location":"man3/OSSL_STORE_expect/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_STORE_open/","title":"OSSL_STORE_open","text":""},{"location":"man3/OSSL_STORE_open/#name","title":"NAME","text":"

                      OSSL_STORE_CTX, OSSL_STORE_post_process_info_fn, OSSL_STORE_open, OSSL_STORE_open_ex, OSSL_STORE_ctrl, OSSL_STORE_load, OSSL_STORE_eof, OSSL_STORE_error, OSSL_STORE_close - Types and functions to read objects from a URI

                      "},{"location":"man3/OSSL_STORE_open/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/store.h>\n\ntypedef struct ossl_store_ctx_st OSSL_STORE_CTX;\n\ntypedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *,\n                                                            void *);\n\nOSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method,\n                                void *ui_data,\n                                OSSL_STORE_post_process_info_fn post_process,\n                                void *post_process_data);\nOSSL_STORE_CTX *\nOSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq,\n                   const UI_METHOD *ui_method, void *ui_data,\n                   const OSSL_PARAM params[],\n                   OSSL_STORE_post_process_info_fn post_process,\n                   void *post_process_data);\n\nOSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx);\nint OSSL_STORE_eof(OSSL_STORE_CTX *ctx);\nint OSSL_STORE_error(OSSL_STORE_CTX *ctx);\nint OSSL_STORE_close(OSSL_STORE_CTX *ctx);\n

                      The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */);\n
                      "},{"location":"man3/OSSL_STORE_open/#description","title":"DESCRIPTION","text":"

                      These functions help the application to fetch supported objects (see \"SUPPORTED OBJECTS\" in OSSL_STORE_INFO(3) for information on which those are) from a given URI. The general method to do so is to \"open\" the URI using OSSL_STORE_open(), read each available and supported object using OSSL_STORE_load() as long as OSSL_STORE_eof() hasn't been reached, and finish it off with OSSL_STORE_close().

                      The retrieved information is stored in a OSSL_STORE_INFO, which is further described in OSSL_STORE_INFO(3).

                      "},{"location":"man3/OSSL_STORE_open/#types","title":"Types","text":"

                      OSSL_STORE_CTX is a context variable that holds all the internal information for OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close() to work together.

                      "},{"location":"man3/OSSL_STORE_open/#functions","title":"Functions","text":"

                      OSSL_STORE_open_ex() takes a uri or path uri, password UI method ui_method with associated data ui_data, and post processing callback post_process with associated data post_process_data, a library context libctx with an associated property query propq, and opens a channel to the data located at the URI and returns a OSSL_STORE_CTX with all necessary internal information. The given ui_method and ui_data will be reused by all functions that use OSSL_STORE_CTX when interaction is needed, for instance to provide a password. The auxiliary OSSL_PARAM(3) parameters in params can be set to further modify the store operation. The given post_process and post_process_data will be reused by OSSL_STORE_load() to manipulate or drop the value to be returned. The post_process function drops values by returning NULL, which will cause OSSL_STORE_load() to start its process over with loading the next object, until post_process returns something other than NULL, or the end of data is reached as indicated by OSSL_STORE_eof().

                      OSSL_STORE_open() is similar to OSSL_STORE_open_ex() but uses NULL for the params, the library context libctx and property query propq.

                      OSSL_STORE_ctrl() takes a OSSL_STORE_CTX, and command number cmd and more arguments not specified here. The available loader specific command numbers and arguments they each take depends on the loader that's used and is documented together with that loader.

                      There are also global controls available:

                      • OSSL_STORE_C_USE_SECMEM

                        Controls if the loader should attempt to use secure memory for any allocated OSSL_STORE_INFO and its contents. This control expects one argument, a pointer to an int that is expected to have the value 1 (yes) or 0 (no). Any other value is an error.

                      OSSL_STORE_load() takes a OSSL_STORE_CTX and tries to load the next available object and return it wrapped with OSSL_STORE_INFO.

                      OSSL_STORE_eof() takes a OSSL_STORE_CTX and checks if we've reached the end of data.

                      OSSL_STORE_error() takes a OSSL_STORE_CTX and checks if an error occurred in the last OSSL_STORE_load() call. Note that it may still be meaningful to try and load more objects, unless OSSL_STORE_eof() shows that the end of data has been reached.

                      OSSL_STORE_close() takes a OSSL_STORE_CTX, closes the channel that was opened by OSSL_STORE_open() and frees all other information that was stored in the OSSL_STORE_CTX, as well as the OSSL_STORE_CTX itself. If ctx is NULL it does nothing.

                      "},{"location":"man3/OSSL_STORE_open/#notes","title":"NOTES","text":"

                      A string without a scheme prefix (that is, a non-URI string) is implicitly interpreted as using the file: scheme.

                      There are some tools that can be used together with OSSL_STORE_open() to determine if any failure is caused by an unparsable URI, or if it's a different error (such as memory allocation failures); if the URI was parsable but the scheme unregistered, the top error will have the reason OSSL_STORE_R_UNREGISTERED_SCHEME.

                      These functions make no direct assumption regarding the pass phrase received from the password callback. The loaders may make assumptions, however. For example, the file: scheme loader inherits the assumptions made by OpenSSL functionality that handles the different file types; this is mostly relevant for PKCS#12 objects. See passphrase-encoding(7) for further information.

                      "},{"location":"man3/OSSL_STORE_open/#return-values","title":"RETURN VALUES","text":"

                      OSSL_STORE_open() returns a pointer to a OSSL_STORE_CTX on success, or NULL on failure.

                      OSSL_STORE_load() returns a pointer to a OSSL_STORE_INFO on success, or NULL on error or when end of data is reached. Use OSSL_STORE_error() and OSSL_STORE_eof() to determine the meaning of a returned NULL.

                      OSSL_STORE_eof() returns 1 if the end of data has been reached or an error occurred, 0 otherwise.

                      OSSL_STORE_error() returns 1 if an error occurred in an OSSL_STORE_load() call, otherwise 0.

                      OSSL_STORE_ctrl() and OSSL_STORE_close() returns 1 on success, or 0 on failure.

                      "},{"location":"man3/OSSL_STORE_open/#see-also","title":"SEE ALSO","text":"

                      ossl_store(7), OSSL_STORE_INFO(3), OSSL_STORE_register_loader(3), passphrase-encoding(7)

                      "},{"location":"man3/OSSL_STORE_open/#history","title":"HISTORY","text":"

                      OSSL_STORE_open_ex() was added in OpenSSL 3.0.

                      OSSL_STORE_CTX, OSSL_STORE_post_process_info_fn(), OSSL_STORE_open(), OSSL_STORE_ctrl(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close() were added in OpenSSL 1.1.1.

                      Handling of NULL ctx argument for OSSL_STORE_close() was introduced in OpenSSL 1.1.1h.

                      OSSL_STORE_open_ex() was added in OpenSSL 3.0.

                      OSSL_STORE_ctrl() and OSSL_STORE_vctrl() were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_STORE_open/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_trace_enabled/","title":"OSSL_trace_enabled","text":""},{"location":"man3/OSSL_trace_enabled/#name","title":"NAME","text":"

                      OSSL_trace_enabled, OSSL_trace_begin, OSSL_trace_end, OSSL_TRACE_BEGIN, OSSL_TRACE_END, OSSL_TRACE_CANCEL, OSSL_TRACE, OSSL_TRACE1, OSSL_TRACE2, OSSL_TRACE3, OSSL_TRACE4, OSSL_TRACE5, OSSL_TRACE6, OSSL_TRACE7, OSSL_TRACE8, OSSL_TRACE9, OSSL_TRACEV, OSSL_TRACE_ENABLED - OpenSSL Tracing API

                      "},{"location":"man3/OSSL_trace_enabled/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/trace.h>\n\nint OSSL_trace_enabled(int category);\n\nBIO *OSSL_trace_begin(int category);\nvoid OSSL_trace_end(int category, BIO *channel);\n\n/* trace group macros */\nOSSL_TRACE_BEGIN(category) {\n    ...\n    if (some_error) {\n        /* Leave trace group prematurely in case of an error */\n        OSSL_TRACE_CANCEL(category);\n        goto err;\n    }\n    ...\n} OSSL_TRACE_END(category);\n\n/* one-shot trace macros */\nOSSL_TRACE1(category, format, arg1)\nOSSL_TRACE2(category, format, arg1, arg2)\n...\nOSSL_TRACE9(category, format, arg1, ..., arg9)\n\n/* check whether a trace category is enabled */\nif (OSSL_TRACE_ENABLED(category)) {\n    ...\n}\n
                      "},{"location":"man3/OSSL_trace_enabled/#description","title":"DESCRIPTION","text":"

                      The functions described here are mainly interesting for those who provide OpenSSL functionality, either in OpenSSL itself or in engine modules or similar.

                      If the tracing facility is enabled (see \"Configure Tracing\" below), these functions are used to generate free text tracing output.

                      The tracing output is divided into types which are enabled individually by the application. The tracing types are described in detail in \"Trace types\" in OSSL_trace_set_callback(3). The fallback type OSSL_TRACE_CATEGORY_ALL should not be used with the functions described here.

                      Tracing for a specific category is enabled at run-time if a so-called trace channel is attached to it. A trace channel is simply a BIO object to which the application can write its trace output.

                      The application has two different ways of registering a trace channel, either by directly providing a BIO object using OSSL_trace_set_channel(3), or by providing a callback routine using OSSL_trace_set_callback(3). The latter is wrapped internally by a dedicated BIO object, so for the tracing code both channel types are effectively indistinguishable. We call them a simple trace channel and a callback trace channel, respectively.

                      To produce trace output, it is necessary to obtain a pointer to the trace channel (i.e., the BIO object) using OSSL_trace_begin(), write to it using arbitrary BIO output routines, and finally releases the channel using OSSL_trace_end(). The OSSL_trace_begin()/OSSL_trace_end() calls surrounding the trace output create a group, which acts as a critical section (guarded by a mutex) to ensure that the trace output of different threads does not get mixed up.

                      The tracing code normally does not call OSSL_trace_{begin,end}() directly, but rather uses a set of convenience macros, see the \"Macros\" section below.

                      "},{"location":"man3/OSSL_trace_enabled/#functions","title":"Functions","text":"

                      OSSL_trace_enabled() can be used to check if tracing for the given category is enabled, i.e., if the tracing facility has been statically enabled (see \"Configure Tracing\" below) and a trace channel has been registered using OSSL_trace_set_channel(3) or OSSL_trace_set_callback(3).

                      OSSL_trace_begin() is used to starts a tracing section, and get the channel for the given category in form of a BIO. This BIO can only be used for output.

                      OSSL_trace_end() is used to end a tracing section.

                      Using OSSL_trace_begin() and OSSL_trace_end() to wrap tracing sections is mandatory. The result of trying to produce tracing output outside of such sections is undefined.

                      "},{"location":"man3/OSSL_trace_enabled/#macros","title":"Macros","text":"

                      There are a number of convenience macros defined, to make tracing easy and consistent.

                      OSSL_TRACE_BEGIN() and OSSL_TRACE_END() reserve the BIO trc_out and are used as follows to wrap a trace section:

                      OSSL_TRACE_BEGIN(TLS) {\n\n    BIO_printf(trc_out, ... );\n\n} OSSL_TRACE_END(TLS);\n

                      This will normally expand to:

                      do {\n    BIO *trc_out = OSSL_trace_begin(OSSL_TRACE_CATEGORY_TLS);\n    if (trc_out != NULL) {\n        ...\n        BIO_printf(trc_out, ...);\n    }\n    OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out);\n} while (0);\n

                      OSSL_TRACE_CANCEL() must be used before returning from or jumping out of a trace section:

                      OSSL_TRACE_BEGIN(TLS) {\n\n    if (some_error) {\n        OSSL_TRACE_CANCEL(TLS);\n        goto err;\n    }\n    BIO_printf(trc_out, ... );\n\n} OSSL_TRACE_END(TLS);\n

                      This will normally expand to:

                      do {\n    BIO *trc_out = OSSL_trace_begin(OSSL_TRACE_CATEGORY_TLS);\n    if (trc_out != NULL) {\n        if (some_error) {\n            OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out);\n            goto err;\n        }\n        BIO_printf(trc_out, ... );\n    }\n    OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out);\n} while (0);\n

                      OSSL_TRACE() and OSSL_TRACE1(), OSSL_TRACE2(), ... OSSL_TRACE9() are so-called one-shot macros:

                      The macro call OSSL_TRACE(category, text), produces literal text trace output.

                      The macro call OSSL_TRACEn(category, format, arg1, ..., argn) produces printf-style trace output with n format field arguments (n=1,...,9). It expands to:

                      OSSL_TRACE_BEGIN(category) {\n    BIO_printf(trc_out, format, arg1, ..., argN)\n} OSSL_TRACE_END(category)\n

                      Internally, all one-shot macros are implemented using a generic OSSL_TRACEV() macro, since C90 does not support variadic macros. This helper macro has a rather weird synopsis and should not be used directly.

                      The OSSL_TRACE_ENABLED() macro can be used to conditionally execute some code only if a specific trace category is enabled. In some situations this is simpler than entering a trace section using OSSL_TRACE_BEGIN() and OSSL_TRACE_END(). For example, the code

                      if (OSSL_TRACE_ENABLED(TLS)) {\n    ...\n}\n

                      expands to

                      if (OSSL_trace_enabled(OSSL_TRACE_CATEGORY_TLS) {\n    ...\n}\n
                      "},{"location":"man3/OSSL_trace_enabled/#notes","title":"NOTES","text":"

                      If producing the trace output requires carrying out auxiliary calculations, this auxiliary code should be placed inside a conditional block which is executed only if the trace category is enabled.

                      The most natural way to do this is to place the code inside the trace section itself because it already introduces such a conditional block.

                      OSSL_TRACE_BEGIN(TLS) {\n    int var = do_some_auxiliary_calculation();\n\n    BIO_printf(trc_out, \"var = %d\\n\", var);\n\n} OSSL_TRACE_END(TLS);\n

                      In some cases it is more advantageous to use a simple conditional group instead of a trace section. This is the case if calculations and tracing happen in different locations of the code, or if the calculations are so time consuming that placing them inside a (critical) trace section would create too much contention.

                      if (OSSL_TRACE_ENABLED(TLS)) {\n    int var = do_some_auxiliary_calculation();\n\n    OSSL_TRACE1(\"var = %d\\n\", var);\n}\n

                      Note however that premature optimization of tracing code is in general futile and it's better to keep the tracing code as simple as possible. Because most often the limiting factor for the application's speed is the time it takes to print the trace output, not to calculate it.

                      "},{"location":"man3/OSSL_trace_enabled/#configure-tracing","title":"Configure Tracing","text":"

                      By default, the OpenSSL library is built with tracing disabled. To use the tracing functionality documented here, it is therefore necessary to configure and build OpenSSL with the 'enable-trace' option.

                      When the library is built with tracing disabled:

                      • The macro OPENSSL_NO_TRACE is defined in <openssl/opensslconf.h>.
                      • all functions are still present, but OSSL_trace_enabled() will always report the categories as disabled, and all other functions will do nothing.
                      • the convenience macros are defined to produce dead code. For example, take this example from \"Macros\" section above:

                        OSSL_TRACE_BEGIN(TLS) {\n\n    if (condition) {\n        OSSL_TRACE_CANCEL(TLS);\n        goto err;\n    }\n    BIO_printf(trc_out, ... );\n\n} OSSL_TRACE_END(TLS);\n

                        When the tracing API isn't operational, that will expand to:

                        do {\n    BIO *trc_out = NULL;\n    if (0) {\n        if (condition) {\n            ((void)0);\n            goto err;\n        }\n        BIO_printf(trc_out, ... );\n    }\n} while (0);\n
                      "},{"location":"man3/OSSL_trace_enabled/#return-values","title":"RETURN VALUES","text":"

                      OSSL_trace_enabled() returns 1 if tracing for the given type is operational and enabled, otherwise 0.

                      OSSL_trace_begin() returns a BIO pointer if the given type is enabled, otherwise NULL.

                      "},{"location":"man3/OSSL_trace_enabled/#see-also","title":"SEE ALSO","text":"

                      OSSL_trace_set_channel(3), OSSL_trace_set_callback(3)

                      "},{"location":"man3/OSSL_trace_enabled/#history","title":"HISTORY","text":"

                      The OpenSSL Tracing API was added in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_trace_enabled/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_trace_get_category_num/","title":"OSSL_trace_get_category_num","text":""},{"location":"man3/OSSL_trace_get_category_num/#name","title":"NAME","text":"

                      OSSL_trace_get_category_num, OSSL_trace_get_category_name - OpenSSL tracing information functions

                      "},{"location":"man3/OSSL_trace_get_category_num/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/trace.h>\n\nint OSSL_trace_get_category_num(const char *name);\nconst char *OSSL_trace_get_category_name(int num);\n
                      "},{"location":"man3/OSSL_trace_get_category_num/#description","title":"DESCRIPTION","text":"

                      OSSL_trace_get_category_num() gives the category number corresponding to the given name.

                      OSSL_trace_get_category_name() gives the category name corresponding to the given num.

                      "},{"location":"man3/OSSL_trace_get_category_num/#return-values","title":"RETURN VALUES","text":"

                      OSSL_trace_get_category_num() returns the category number if the given name is a recognised category name, otherwise -1.

                      OSSL_trace_get_category_name() returns the category name if the given num is a recognised category number, otherwise NULL.

                      "},{"location":"man3/OSSL_trace_get_category_num/#history","title":"HISTORY","text":"

                      The OpenSSL Tracing API was added ino OpenSSL 3.0.

                      "},{"location":"man3/OSSL_trace_get_category_num/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OSSL_trace_set_channel/","title":"OSSL_trace_set_channel","text":""},{"location":"man3/OSSL_trace_set_channel/#name","title":"NAME","text":"

                      OSSL_trace_set_channel, OSSL_trace_set_prefix, OSSL_trace_set_suffix, OSSL_trace_set_callback, OSSL_trace_cb - Enabling trace output

                      "},{"location":"man3/OSSL_trace_set_channel/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/trace.h>\n\ntypedef size_t (*OSSL_trace_cb)(const char *buf, size_t cnt,\n                                int category, int cmd, void *data);\n\nvoid OSSL_trace_set_channel(int category, BIO *bio);\nvoid OSSL_trace_set_prefix(int category, const char *prefix);\nvoid OSSL_trace_set_suffix(int category, const char *suffix);\nvoid OSSL_trace_set_callback(int category, OSSL_trace_cb cb, void  *data);\n
                      "},{"location":"man3/OSSL_trace_set_channel/#description","title":"DESCRIPTION","text":"

                      If available (see \"Configure Tracing\" below), the application can request internal trace output. This output comes in form of free text for humans to read.

                      The trace output is divided into categories which can be enabled individually. Every category can be enabled individually by attaching a so-called trace channel to it, which in the simplest case is just a BIO object to which the application can write the tracing output for this category. Alternatively, the application can provide a tracer callback in order to get more finegrained trace information. This callback will be wrapped internally by a dedicated BIO object.

                      For the tracing code, both trace channel types are indistinguishable. These are called a simple trace channel and a callback trace channel, respectively.

                      OSSL_TRACE_ENABLED(3) can be used to check whether tracing is currently enabled for the given category. Functions like OSSL_TRACE1(3) and macros like OSSL_TRACE_BEGIN(3) can be used for producing free-text trace output.

                      "},{"location":"man3/OSSL_trace_set_channel/#functions","title":"Functions","text":"

                      OSSL_trace_set_channel() is used to enable the given trace category by attaching the BIO bio object as (simple) trace channel. On success the ownership of the BIO is transferred to the channel, so the caller must not free it directly.

                      OSSL_trace_set_prefix() and OSSL_trace_set_suffix() can be used to add an extra line for each channel, to be output before and after group of tracing output. What constitutes an output group is decided by the code that produces the output. The lines given here are considered immutable; for more dynamic tracing prefixes, consider setting a callback with OSSL_trace_set_callback() instead.

                      OSSL_trace_set_callback() is used to enable the given trace category by giving it the tracer callback cb with the associated data data, which will simply be passed through to cb whenever it's called. The callback function is internally wrapped by a dedicated BIO object, the so-called callback trace channel. This should be used when it's desirable to do form the trace output to something suitable for application needs where a prefix and suffix line aren't enough.

                      OSSL_trace_set_channel() and OSSL_trace_set_callback() are mutually exclusive, calling one of them will clear whatever was set by the previous call.

                      Calling OSSL_trace_set_channel() with NULL for channel or OSSL_trace_set_callback() with NULL for cb disables tracing for the given category.

                      "},{"location":"man3/OSSL_trace_set_channel/#trace-callback","title":"Trace callback","text":"

                      The tracer callback must return a size_t, which must be zero on error and otherwise return the number of bytes that were output. It receives a text buffer buf with cnt bytes of text, as well as the category, a control number cmd, and the data that was passed to OSSL_trace_set_callback().

                      The possible control numbers are:

                      • OSSL_TRACE_CTRL_BEGIN

                        The callback is called from OSSL_trace_begin(), which gives the callback the possibility to output a dynamic starting line, or set a prefix that should be output at the beginning of each line, or something other.

                      • OSSL_TRACE_CTRL_WRITE

                        This callback is called whenever data is written to the BIO by some regular BIO output routine. An arbitrary number of OSSL_TRACE_CTRL_WRITE callbacks can occur inside a group marked by a pair of OSSL_TRACE_CTRL_BEGIN and OSSL_TRACE_CTRL_END calls, but never outside such a group.

                      • OSSL_TRACE_CTRL_END

                        The callback is called from OSSL_trace_end(), which gives the callback the possibility to output a dynamic ending line, or reset the line prefix that was set with OSSL_TRACE_CTRL_BEGIN, or something other.

                      "},{"location":"man3/OSSL_trace_set_channel/#trace-categories","title":"Trace categories","text":"

                      The trace categories are simple numbers available through macros.

                      • OSSL_TRACE_CATEGORY_TRACE

                        Traces the OpenSSL trace API itself.

                        More precisely, this will generate trace output any time a new trace hook is set.

                      • OSSL_TRACE_CATEGORY_INIT

                        Traces OpenSSL library initialization and cleanup.

                        This needs special care, as OpenSSL will do automatic cleanup after exit from main(), and any tracing output done during this cleanup will be lost if the tracing channel or callback were cleaned away prematurely. A suggestion is to make such cleanup part of a function that's registered very early with atexit(3).

                      • OSSL_TRACE_CATEGORY_TLS

                        Traces the TLS/SSL protocol.

                      • OSSL_TRACE_CATEGORY_TLS_CIPHER

                        Traces the ciphers used by the TLS/SSL protocol.

                      • OSSL_TRACE_CATEGORY_CONF

                        Traces details about the provider and engine configuration.

                      • OSSL_TRACE_CATEGORY_ENGINE_TABLE

                        Traces the ENGINE algorithm table selection.

                        More precisely, functions like ENGINE_get_pkey_asn1_meth_engine(), ENGINE_get_pkey_meth_engine(), ENGINE_get_cipher_engine(), ENGINE_get_digest_engine(), will generate trace summaries of the handling of internal tables.

                      • OSSL_TRACE_CATEGORY_ENGINE_REF_COUNT

                        Traces the ENGINE reference counting.

                        More precisely, both reference counts in the ENGINE structure will be monitored with a line of trace output generated for each change.

                      • OSSL_TRACE_CATEGORY_PKCS5V2

                        Traces PKCS#5 v2 key generation.

                      • OSSL_TRACE_CATEGORY_PKCS12_KEYGEN

                        Traces PKCS#12 key generation.

                      • OSSL_TRACE_CATEGORY_PKCS12_DECRYPT

                        Traces PKCS#12 decryption.

                      • OSSL_TRACE_CATEGORY_X509V3_POLICY

                        Traces X509v3 policy processing.

                        More precisely, this generates the complete policy tree at various point during evaluation.

                      • OSSL_TRACE_CATEGORY_BN_CTX

                        Traces BIGNUM context operations.

                      • OSSL_TRACE_CATEGORY_CMP

                        Traces CMP client and server activity.

                      • OSSL_TRACE_CATEGORY_STORE

                        Traces STORE operations.

                      • OSSL_TRACE_CATEGORY_DECODER

                        Traces decoder operations.

                      • OSSL_TRACE_CATEGORY_ENCODER

                        Traces encoder operations.

                      • OSSL_TRACE_CATEGORY_REF_COUNT

                        Traces decrementing certain ASN.1 structure references.

                      There is also OSSL_TRACE_CATEGORY_ALL, which works as a fallback and can be used to get all trace output.

                      Note, however, that in this case all trace output will effectively be associated with the 'ALL' category, which is undesirable if the application intends to include the category name in the trace output. In this case it is better to register separate channels for each trace category instead.

                      "},{"location":"man3/OSSL_trace_set_channel/#return-values","title":"RETURN VALUES","text":"

                      OSSL_trace_set_channel(), OSSL_trace_set_prefix(), OSSL_trace_set_suffix(), and OSSL_trace_set_callback() return 1 on success, or 0 on failure.

                      "},{"location":"man3/OSSL_trace_set_channel/#examples","title":"EXAMPLES","text":"

                      In all examples below, the trace producing code is assumed to be the following:

                      int foo = 42;\nconst char bar[] = { 0,  1,  2,  3,  4,  5,  6,  7,\n                     8,  9, 10, 11, 12, 13, 14, 15 };\n\nOSSL_TRACE_BEGIN(TLS) {\n    BIO_puts(trc_out, \"foo: \");\n    BIO_printf(trc_out, \"%d\\n\", foo);\n    BIO_dump(trc_out, bar, sizeof(bar));\n} OSSL_TRACE_END(TLS);\n
                      "},{"location":"man3/OSSL_trace_set_channel/#simple-example","title":"Simple example","text":"

                      An example with just a channel and constant prefix / suffix.

                      int main(int argc, char *argv[])\n{\n    BIO *err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);\n    OSSL_trace_set_channel(OSSL_TRACE_CATEGORY_SSL, err);\n    OSSL_trace_set_prefix(OSSL_TRACE_CATEGORY_SSL, \"BEGIN TRACE[TLS]\");\n    OSSL_trace_set_suffix(OSSL_TRACE_CATEGORY_SSL, \"END TRACE[TLS]\");\n\n    /* ... work ... */\n}\n

                      When the trace producing code above is performed, this will be output on standard error:

                      BEGIN TRACE[TLS]\nfoo: 42\n0000 - 00 01 02 03 04 05 06 07-08 09 0a 0b 0c 0d 0e 0f   ................\nEND TRACE[TLS]\n
                      "},{"location":"man3/OSSL_trace_set_channel/#advanced-example","title":"Advanced example","text":"

                      This example uses the callback, and depends on pthreads functionality.

                      static size_t cb(const char *buf, size_t cnt,\n                int category, int cmd, void *vdata)\n{\n    BIO *bio = vdata;\n    const char *label = NULL;\n\n    switch (cmd) {\n    case OSSL_TRACE_CTRL_BEGIN:\n        label = \"BEGIN\";\n        break;\n    case OSSL_TRACE_CTRL_END:\n        label = \"END\";\n        break;\n    }\n\n    if (label != NULL) {\n        union {\n            pthread_t tid;\n            unsigned long ltid;\n        } tid;\n\n        tid.tid = pthread_self();\n        BIO_printf(bio, \"%s TRACE[%s]:%lx\\n\",\n                   label, OSSL_trace_get_category_name(category), tid.ltid);\n    }\n    return (size_t)BIO_puts(bio, buf);\n}\n\nint main(int argc, char *argv[])\n{\n    BIO *err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);\n    OSSL_trace_set_callback(OSSL_TRACE_CATEGORY_SSL, cb, err);\n\n    /* ... work ... */\n}\n

                      The output is almost the same as for the simple example above.

                      BEGIN TRACE[TLS]:7f9eb0193b80\nfoo: 42\n0000 - 00 01 02 03 04 05 06 07-08 09 0a 0b 0c 0d 0e 0f   ................\nEND TRACE[TLS]:7f9eb0193b80\n
                      "},{"location":"man3/OSSL_trace_set_channel/#notes","title":"NOTES","text":""},{"location":"man3/OSSL_trace_set_channel/#configure-tracing","title":"Configure Tracing","text":"

                      By default, the OpenSSL library is built with tracing disabled. To use the tracing functionality documented here, it is therefore necessary to configure and build OpenSSL with the 'enable-trace' option.

                      When the library is built with tracing disabled, the macro OPENSSL_NO_TRACE is defined in <openssl/opensslconf.h> and all functions described here are inoperational, i.e. will do nothing.

                      "},{"location":"man3/OSSL_trace_set_channel/#see-also","title":"SEE ALSO","text":"

                      OSSL_TRACE_ENABLED(3), OSSL_TRACE_BEGIN(3), OSSL_TRACE1(3), atexit(3)

                      "},{"location":"man3/OSSL_trace_set_channel/#history","title":"HISTORY","text":"

                      OSSL_trace_set_channel(), OSSL_trace_set_prefix(), OSSL_trace_set_suffix(), and OSSL_trace_set_callback() were all added in OpenSSL 3.0.

                      "},{"location":"man3/OSSL_trace_set_channel/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OpenSSL_add_all_algorithms/","title":"OpenSSL_add_all_algorithms","text":""},{"location":"man3/OpenSSL_add_all_algorithms/#name","title":"NAME","text":"

                      OpenSSL_add_all_algorithms, OpenSSL_add_all_ciphers, OpenSSL_add_all_digests, EVP_cleanup - add algorithms to internal table

                      "},{"location":"man3/OpenSSL_add_all_algorithms/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/evp.h>\n

                      The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      void OpenSSL_add_all_algorithms(void);\nvoid OpenSSL_add_all_ciphers(void);\nvoid OpenSSL_add_all_digests(void);\n\nvoid EVP_cleanup(void);\n
                      "},{"location":"man3/OpenSSL_add_all_algorithms/#description","title":"DESCRIPTION","text":"

                      OpenSSL keeps an internal table of digest algorithms and ciphers. It uses this table to lookup ciphers via functions such as EVP_get_cipher_byname().

                      OpenSSL_add_all_digests() adds all digest algorithms to the table.

                      OpenSSL_add_all_algorithms() adds all algorithms to the table (digests and ciphers).

                      OpenSSL_add_all_ciphers() adds all encryption algorithms to the table including password based encryption algorithms.

                      In versions prior to 1.1.0 EVP_cleanup() removed all ciphers and digests from the table. It no longer has any effect in OpenSSL 1.1.0.

                      "},{"location":"man3/OpenSSL_add_all_algorithms/#return-values","title":"RETURN VALUES","text":"

                      None of the functions return a value.

                      "},{"location":"man3/OpenSSL_add_all_algorithms/#see-also","title":"SEE ALSO","text":"

                      evp(7), EVP_DigestInit(3), EVP_EncryptInit(3)

                      "},{"location":"man3/OpenSSL_add_all_algorithms/#history","title":"HISTORY","text":"

                      The OpenSSL_add_all_algorithms(), OpenSSL_add_all_ciphers(), OpenSSL_add_all_digests(), and EVP_cleanup(), functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto() and should not be used.

                      "},{"location":"man3/OpenSSL_add_all_algorithms/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/OpenSSL_version/","title":"OpenSSL_version","text":""},{"location":"man3/OpenSSL_version/#name","title":"NAME","text":"

                      OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA, OPENSSL_VERSION_TEXT, OPENSSL_VERSION_PREREQ, OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch, OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version, OPENSSL_VERSION_NUMBER, OpenSSL_version_num, OPENSSL_info - get OpenSSL version number and other information

                      "},{"location":"man3/OpenSSL_version/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/opensslv.h>\n\n#define OPENSSL_VERSION_MAJOR  x\n#define OPENSSL_VERSION_MINOR  y\n#define OPENSSL_VERSION_PATCH  z\n\n/* The definitions here are typical release values */\n#define OPENSSL_VERSION_PRE_RELEASE \"\"\n#define OPENSSL_VERSION_BUILD_METADATA \"\"\n\n#define OPENSSL_VERSION_TEXT \"OpenSSL x.y.z xx XXX xxxx\"\n\n#define OPENSSL_VERSION_PREREQ(maj,min)\n\n#include <openssl/crypto.h>\n\nunsigned int OPENSSL_version_major(void);\nunsigned int OPENSSL_version_minor(void);\nunsigned int OPENSSL_version_patch(void);\nconst char *OPENSSL_version_pre_release(void);\nconst char *OPENSSL_version_build_metadata(void);\n\nconst char *OpenSSL_version(int t);\n\nconst char *OPENSSL_info(int t);\n\n/* from openssl/opensslv.h */\n#define OPENSSL_VERSION_NUMBER 0xnnnnnnnnL\n\n/* from openssl/crypto.h */\nunsigned long OpenSSL_version_num();\n
                      "},{"location":"man3/OpenSSL_version/#description","title":"DESCRIPTION","text":""},{"location":"man3/OpenSSL_version/#macros","title":"Macros","text":"

                      The three macros OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR and OPENSSL_VERSION_PATCH represent the three parts of a version identifier, MAJOR.MINOR.PATCH.

                      The macro OPENSSL_VERSION_PRE_RELEASE is an added bit of text that indicates that this is a pre-release version, such as \"-dev\" for an ongoing development snapshot or \"-alpha3\" for an alpha release. The value must be a string.

                      The macro OPENSSL_VERSION_BUILD_METADATA is extra information, reserved for other parties, such as \"+fips\", or \"+vendor.1\"). The OpenSSL project will not touch this macro (will leave it an empty string). The value must be a string.

                      OPENSSL_VERSION_STR is a convenience macro to get the short version identifier string, \"_MAJOR_._MINOR_._PATCH_\".

                      OPENSSL_FULL_VERSION_STR is a convenience macro to get the longer version identifier string, which combines OPENSSL_VERSION_STR, OPENSSL_VERSION_PRE_RELEASE and OPENSSL_VERSION_BUILD_METADATA.

                      OPENSSL_VERSION_TEXT is a convenience macro to get a full descriptive version text, which includes OPENSSL_FULL_VERSION_STR and the release date.

                      OPENSSL_VERSION_PREREQ is a useful macro for checking whether the OpenSSL version for the headers in use is at least at the given pre-requisite major (maj) and minor (min) number or not. It will evaluate to true if the header version number (OPENSSL_VERSION_MAJOR.OPENSSL_VERSION_MINOR) is greater than or equal to maj.min.

                      OPENSSL_VERSION_NUMBER is a combination of the major, minor and patch version into a single integer 0xMNN00PP0L, where:

                      • M

                        is the number from OPENSSL_VERSION_MAJOR, in hexadecimal notation

                      • NN

                        is the number from OPENSSL_VERSION_MINOR, in hexadecimal notation

                      • PP

                        is the number from OPENSSL_VERSION_PATCH, in hexadecimal notation

                      "},{"location":"man3/OpenSSL_version/#functions","title":"Functions","text":"

                      OPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(), OPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return the values of the macros above for the build of the library, respectively.

                      OpenSSL_version() returns different strings depending on t:

                      • OPENSSL_VERSION

                        The value of OPENSSL_VERSION_TEXT

                      • OPENSSL_VERSION_STRING

                        The value of OPENSSL_VERSION_STR

                      • OPENSSL_FULL_VERSION_STRING

                        The value of OPENSSL_FULL_VERSION_STR

                      • OPENSSL_CFLAGS

                        The compiler flags set for the compilation process in the form compiler: ... if available, or compiler: information not available otherwise.

                      • OPENSSL_BUILT_ON

                        The date of the build process in the form built on: ... if available or built on: date not available otherwise. The date would not be available in a reproducible build, for example.

                      • OPENSSL_PLATFORM

                        The \"Configure\" target of the library build in the form platform: ... if available, or platform: information not available otherwise.

                      • OPENSSL_DIR

                        The OPENSSLDIR setting of the library build in the form OPENSSLDIR: \"...\" if available, or OPENSSLDIR: N/A otherwise.

                      • OPENSSL_ENGINES_DIR

                        The ENGINESDIR setting of the library build in the form ENGINESDIR: \"...\" if available, or ENGINESDIR: N/A otherwise. This option is deprecated in OpenSSL 3.0.

                      • OPENSSL_MODULES_DIR

                        The MODULESDIR setting of the library build in the form MODULESDIR: \"...\" if available, or MODULESDIR: N/A otherwise.

                      • OPENSSL_CPU_INFO

                        The current OpenSSL cpu settings. This is the current setting of the cpu capability flags. It is usually automatically configured but may be set via an environment variable. The value has the same syntax as the environment variable. For x86 the string looks like CPUINFO: OPENSSL_ia32cap=0x123:0x456 or CPUINFO: N/A if not available.

                      For an unknown t, the text not available is returned.

                      OPENSSL_info() also returns different strings depending on t:

                      • OPENSSL_INFO_CONFIG_DIR

                        The configured OPENSSLDIR, which is the default location for OpenSSL configuration files.

                      • OPENSSL_INFO_ENGINES_DIR

                        The configured ENGINESDIR, which is the default location for OpenSSL engines.

                      • OPENSSL_INFO_MODULES_DIR

                        The configured MODULESDIR, which is the default location for dynamically loadable OpenSSL modules other than engines.

                      • OPENSSL_INFO_DSO_EXTENSION

                        The configured dynamically loadable module extension.

                      • OPENSSL_INFO_DIR_FILENAME_SEPARATOR

                        The separator between a directory specification and a filename. Note that on some operating systems, this is not the same as the separator between directory elements.

                      • OPENSSL_INFO_LIST_SEPARATOR

                        The OpenSSL list separator. This is typically used in strings that are lists of items, such as the value of the environment variable $PATH on Unix (where the separator is :) or %PATH% on Windows (where the separator is ;).

                      • OPENSSL_INFO_CPU_SETTINGS

                        The current OpenSSL cpu settings. This is the current setting of the cpu capability flags. It is usually automatically configured but may be set via an environment variable. The value has the same syntax as the environment variable. For x86 the string looks like OPENSSL_ia32cap=0x123:0x456.

                      For an unknown t, NULL is returned.

                      OpenSSL_version_num() returns the value of OPENSSL_VERSION_NUMBER.

                      "},{"location":"man3/OpenSSL_version/#return-values","title":"RETURN VALUES","text":"

                      OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch() return the version number parts as integers.

                      OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return the values of OPENSSL_VERSION_PRE_RELEASE and OPENSSL_VERSION_BUILD_METADATA respectively as constant strings. For any of them that is undefined, the empty string is returned.

                      OpenSSL_version() returns constant strings.

                      "},{"location":"man3/OpenSSL_version/#see-also","title":"SEE ALSO","text":"

                      crypto(7)

                      "},{"location":"man3/OpenSSL_version/#history","title":"HISTORY","text":"

                      The macros and functions described here were added in OpenSSL 3.0, except for OPENSSL_VERSION_NUMBER and OpenSSL_version_num().

                      "},{"location":"man3/OpenSSL_version/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_X509_INFO_read_bio_ex/","title":"PEM_X509_INFO_read_bio_ex","text":""},{"location":"man3/PEM_X509_INFO_read_bio_ex/#name","title":"NAME","text":"

                      PEM_X509_INFO_read_ex, PEM_X509_INFO_read, PEM_X509_INFO_read_bio_ex, PEM_X509_INFO_read_bio - read PEM-encoded data structures into one or more X509_INFO objects

                      "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pem.h>\n\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read_ex(FILE *fp, STACK_OF(X509_INFO) *sk,\n                                           pem_password_cb *cb, void *u,\n                                           OSSL_LIB_CTX *libctx,\n                                           const char *propq);\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,\n                                        pem_password_cb *cb, void *u);\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bio,\n                                               STACK_OF(X509_INFO) *sk,\n                                               pem_password_cb *cb, void *u,\n                                               OSSL_LIB_CTX *libctx,\n                                               const char *propq);\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,\n                                            pem_password_cb *cb, void *u);\n
                      "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#description","title":"DESCRIPTION","text":"

                      PEM_X509_INFO_read_ex() loads the X509_INFO objects from a file fp.

                      PEM_X509_INFO_read() is similar to PEM_X509_INFO_read_ex() but uses the default (NULL) library context libctx and empty property query propq.

                      PEM_X509_INFO_read_bio_ex() loads the X509_INFO objects using a bio bp.

                      PEM_X509_INFO_read_bio() is similar to PEM_X509_INFO_read_bio_ex() but uses the default (NULL) library context libctx and empty property query propq.

                      Each of the loaded X509_INFO objects can contain a CRL, a certificate, and/or a private key. The elements are read sequentially, and as far as they are of different type than the elements read before, they are combined into the same X509_INFO object. The idea behind this is that if, for instance, a certificate is followed by a private key, the private key is supposed to correspond to the certificate.

                      If the input stack sk is NULL a new stack is allocated, else the given stack is extended.

                      The optional cb and u parameters can be used for providing a pass phrase needed for decrypting encrypted PEM structures (normally only private keys). See PEM_read_bio_PrivateKey(3) and passphrase-encoding(7) for details.

                      The library context libctx and property query propq are used for fetching algorithms from providers.

                      "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#return-values","title":"RETURN VALUES","text":"

                      PEM_X509_INFO_read_ex(), PEM_X509_INFO_read(), PEM_X509_INFO_read_bio_ex() and PEM_X509_INFO_read_bio() return a stack of X509_INFO objects or NULL on failure.

                      "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#see-also","title":"SEE ALSO","text":"

                      PEM_read_bio_ex(3), PEM_read_bio_PrivateKey(3), passphrase-encoding(7)

                      "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#history","title":"HISTORY","text":"

                      The functions PEM_X509_INFO_read_ex() and PEM_X509_INFO_read_bio_ex() were added in OpenSSL 3.0.

                      "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_bytes_read_bio/","title":"PEM_bytes_read_bio","text":""},{"location":"man3/PEM_bytes_read_bio/#name","title":"NAME","text":"

                      PEM_bytes_read_bio, PEM_bytes_read_bio_secmem - read a PEM-encoded data structure from a BIO

                      "},{"location":"man3/PEM_bytes_read_bio/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pem.h>\n\nint PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,\n                       const char *name, BIO *bp, pem_password_cb *cb,\n                       void *u);\nint PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm,\n                              const char *name, BIO *bp, pem_password_cb *cb,\n                              void *u);\n
                      "},{"location":"man3/PEM_bytes_read_bio/#description","title":"DESCRIPTION","text":"

                      PEM_bytes_read_bio() reads PEM-formatted (IETF RFC 1421 and IETF RFC 7468) data from the BIO bp for the data type given in name (RSA PRIVATE KEY, CERTIFICATE, etc.). If multiple PEM-encoded data structures are present in the same stream, PEM_bytes_read_bio() will skip non-matching data types and continue reading. Non-PEM data present in the stream may cause an error.

                      The PEM header may indicate that the following data is encrypted; if so, the data will be decrypted, waiting on user input to supply a passphrase if needed. The password callback cb and rock u are used to obtain the decryption passphrase, if applicable.

                      Some data types have compatibility aliases, such as a file containing X509 CERTIFICATE matching a request for the deprecated type CERTIFICATE. The actual type indicated by the file is returned in *pnm if pnm is non-NULL. The caller must free the storage pointed to by *pnm.

                      The returned data is the DER-encoded form of the requested type, in *pdata with length *plen. The caller must free the storage pointed to by *pdata.

                      PEM_bytes_read_bio_secmem() is similar to PEM_bytes_read_bio(), but uses memory from the secure heap for its temporary buffers and the storage returned in *pdata and *pnm. Accordingly, the caller must use OPENSSL_secure_free() to free that storage.

                      "},{"location":"man3/PEM_bytes_read_bio/#notes","title":"NOTES","text":"

                      PEM_bytes_read_bio_secmem() only enforces that the secure heap is used for storage allocated within the PEM processing stack. The BIO stack from which input is read may also use temporary buffers, which are not necessarily allocated from the secure heap. In cases where it is desirable to ensure that the contents of the PEM file only appears in memory from the secure heap, care is needed in generating the BIO passed as bp. In particular, the use of BIO_s_file() indicates the use of the operating system stdio functionality, which includes buffering as a feature; BIO_s_fd() is likely to be more appropriate in such cases.

                      These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                      "},{"location":"man3/PEM_bytes_read_bio/#return-values","title":"RETURN VALUES","text":"

                      PEM_bytes_read_bio() and PEM_bytes_read_bio_secmem() return 1 for success or 0 for failure.

                      "},{"location":"man3/PEM_bytes_read_bio/#see-also","title":"SEE ALSO","text":"

                      PEM_read_bio_ex(3), passphrase-encoding(7)

                      "},{"location":"man3/PEM_bytes_read_bio/#history","title":"HISTORY","text":"

                      PEM_bytes_read_bio_secmem() was introduced in OpenSSL 1.1.1

                      "},{"location":"man3/PEM_bytes_read_bio/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_read/","title":"PEM_read","text":""},{"location":"man3/PEM_read/#name","title":"NAME","text":"

                      PEM_write, PEM_write_bio, PEM_read, PEM_read_bio, PEM_do_header, PEM_get_EVP_CIPHER_INFO - PEM encoding routines

                      "},{"location":"man3/PEM_read/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pem.h>\n\nint PEM_write(FILE *fp, const char *name, const char *header,\n              const unsigned char *data, long len);\nint PEM_write_bio(BIO *bp, const char *name, const char *header,\n                  const unsigned char *data, long len);\n\nint PEM_read(FILE *fp, char **name, char **header,\n             unsigned char **data, long *len);\nint PEM_read_bio(BIO *bp, char **name, char **header,\n                 unsigned char **data, long *len);\n\nint PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cinfo);\nint PEM_do_header(EVP_CIPHER_INFO *cinfo, unsigned char *data, long *len,\n                  pem_password_cb *cb, void *u);\n
                      "},{"location":"man3/PEM_read/#description","title":"DESCRIPTION","text":"

                      These functions read and write PEM-encoded objects, using the PEM type name, any additional header information, and the raw data of length len.

                      PEM is the term used for binary content encoding first defined in IETF RFC 1421. The content is a series of base64-encoded lines, surrounded by begin/end markers each on their own line. For example:

                      -----BEGIN PRIVATE KEY-----\nMIICdg....\n... bhTQ==\n-----END PRIVATE KEY-----\n

                      Optional header line(s) may appear after the begin line, and their existence depends on the type of object being written or read.

                      PEM_write() writes to the file fp, while PEM_write_bio() writes to the BIO bp. The name is the name to use in the marker, the header is the header value or NULL, and data and len specify the data and its length.

                      The final data buffer is typically an ASN.1 object which can be decoded with the d2i function appropriate to the type name; see d2i_X509(3) for examples.

                      PEM_read() reads from the file fp, while PEM_read_bio() reads from the BIO bp. Both skip any non-PEM data that precedes the start of the next PEM object. When an object is successfully retrieved, the type name from the \"----BEGIN <type>-----\" is returned via the name argument, any encapsulation headers are returned in header and the base64-decoded content and its length are returned via data and len respectively. The name, header and data pointers are allocated via OPENSSL_malloc() and should be freed by the caller via OPENSSL_free() when no longer needed.

                      PEM_get_EVP_CIPHER_INFO() can be used to determine the data returned by PEM_read() or PEM_read_bio() is encrypted and to retrieve the associated cipher and IV. The caller passes a pointer to structure of type EVP_CIPHER_INFO via the cinfo argument and the header returned via PEM_read() or PEM_read_bio(). If the call is successful 1 is returned and the cipher and IV are stored at the address pointed to by cinfo. When the header is malformed, or not supported or when the cipher is unknown or some internal error happens 0 is returned. This function is deprecated, see NOTES below.

                      PEM_do_header() can then be used to decrypt the data if the header indicates encryption. The cinfo argument is a pointer to the structure initialized by the previous call to PEM_get_EVP_CIPHER_INFO(). The data and len arguments are those returned by the previous call to PEM_read() or PEM_read_bio(). The cb and u arguments make it possible to override the default password prompt function as described in PEM_read_PrivateKey(3). On successful completion the data is decrypted in place, and len is updated to indicate the plaintext length. This function is deprecated, see NOTES below.

                      If the data is a priori known to not be encrypted, then neither PEM_do_header() nor PEM_get_EVP_CIPHER_INFO() need be called.

                      "},{"location":"man3/PEM_read/#return-values","title":"RETURN VALUES","text":"

                      PEM_read() and PEM_read_bio() return 1 on success and 0 on failure, the latter includes the case when no more PEM objects remain in the input file. To distinguish end of file from more serious errors the caller must peek at the error stack and check for PEM_R_NO_START_LINE, which indicates that no more PEM objects were found. See ERR_peek_last_error(3), ERR_GET_REASON(3).

                      PEM_get_EVP_CIPHER_INFO() and PEM_do_header() return 1 on success, and 0 on failure. The data is likely meaningless if these functions fail.

                      "},{"location":"man3/PEM_read/#notes","title":"NOTES","text":"

                      The PEM_get_EVP_CIPHER_INFO() and PEM_do_header() functions are deprecated. This is because the underlying PEM encryption format is obsolete, and should be avoided. It uses an encryption format with an OpenSSL-specific key-derivation function, which employs MD5 with an iteration count of 1! Instead, private keys should be stored in PKCS#8 form, with a strong PKCS#5 v2.0 PBE. See PEM_write_PrivateKey(3) and d2i_PKCS8PrivateKey_bio(3).

                      PEM_do_header() makes no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                      "},{"location":"man3/PEM_read/#see-also","title":"SEE ALSO","text":"

                      ERR_peek_last_error(3), ERR_GET_LIB(3), d2i_PKCS8PrivateKey_bio(3), passphrase-encoding(7)

                      "},{"location":"man3/PEM_read/#copyright","title":"COPYRIGHT","text":"

                      Copyright 1998-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_read_CMS/","title":"PEM_read_CMS","text":""},{"location":"man3/PEM_read_CMS/#name","title":"NAME","text":"

                      DECLARE_PEM_rw, PEM_read_CMS, PEM_read_bio_CMS, PEM_write_CMS, PEM_write_bio_CMS, PEM_write_DHxparams, PEM_write_bio_DHxparams, PEM_read_ECPKParameters, PEM_read_bio_ECPKParameters, PEM_write_ECPKParameters, PEM_write_bio_ECPKParameters, PEM_read_ECPrivateKey, PEM_write_ECPrivateKey, PEM_write_bio_ECPrivateKey, PEM_read_EC_PUBKEY, PEM_read_bio_EC_PUBKEY, PEM_write_EC_PUBKEY, PEM_write_bio_EC_PUBKEY, PEM_read_NETSCAPE_CERT_SEQUENCE, PEM_read_bio_NETSCAPE_CERT_SEQUENCE, PEM_write_NETSCAPE_CERT_SEQUENCE, PEM_write_bio_NETSCAPE_CERT_SEQUENCE, PEM_read_PKCS8, PEM_read_bio_PKCS8, PEM_write_PKCS8, PEM_write_bio_PKCS8, PEM_write_PKCS8_PRIV_KEY_INFO, PEM_read_bio_PKCS8_PRIV_KEY_INFO, PEM_read_PKCS8_PRIV_KEY_INFO, PEM_write_bio_PKCS8_PRIV_KEY_INFO, PEM_read_SSL_SESSION, PEM_read_bio_SSL_SESSION, PEM_write_SSL_SESSION, PEM_write_bio_SSL_SESSION, PEM_read_X509_PUBKEY, PEM_read_bio_X509_PUBKEY, PEM_write_X509_PUBKEY, PEM_write_bio_X509_PUBKEY - PEM object encoding routines

                      "},{"location":"man3/PEM_read_CMS/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pem.h>\n\nDECLARE_PEM_rw(name, TYPE)\n\nTYPE *PEM_read_TYPE(FILE *fp, TYPE **a, pem_password_cb *cb, void *u);\nTYPE *PEM_read_bio_TYPE(BIO *bp, TYPE **a, pem_password_cb *cb, void *u);\nint PEM_write_TYPE(FILE *fp, const TYPE *a);\nint PEM_write_bio_TYPE(BIO *bp, const TYPE *a);\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      #include <openssl/pem.h>\n\nint PEM_write_DHxparams(FILE *out, const DH *dh);\nint PEM_write_bio_DHxparams(BIO *out, const DH *dh);\nEC_GROUP *PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u);\nEC_GROUP *PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u);\nint PEM_write_ECPKParameters(FILE *out, const EC_GROUP *x);\nint PEM_write_bio_ECPKParameters(BIO *out, const EC_GROUP *x),\n\nEC_KEY *PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u);\nEC_KEY *PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u);\nint PEM_write_EC_PUBKEY(FILE *out, const EC_KEY *x);\nint PEM_write_bio_EC_PUBKEY(BIO *out, const EC_KEY *x);\n\nEC_KEY *PEM_read_ECPrivateKey(FILE *out, EC_KEY **x, pem_password_cb *cb, void *u);\nEC_KEY *PEM_read_bio_ECPrivateKey(BIO *out, EC_KEY **x, pem_password_cb *cb, void *u);\nint PEM_write_ECPrivateKey(FILE *out, const EC_KEY *x, const EVP_CIPHER *enc,\n                           const unsigned char *kstr, int klen,\n                           pem_password_cb *cb, void *u);\nint PEM_write_bio_ECPrivateKey(BIO *out, const EC_KEY *x, const EVP_CIPHER *enc,\n                               const unsigned char *kstr, int klen,\n                               pem_password_cb *cb, void *u);\n
                      "},{"location":"man3/PEM_read_CMS/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should use OSSL_ENCODER_to_bio() and OSSL_DECODER_from_bio() instead.

                      In the description below, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509. The macro DECLARE_PEM_rw expands to the set of declarations shown in the next four lines of the synopsis.

                      These routines convert between local instances of ASN1 datatypes and the PEM encoding. For more information on the templates, see ASN1_ITEM(3). For more information on the lower-level routines used by the functions here, see PEM_read(3).

                      PEM_read_TYPE() reads a PEM-encoded object of TYPE from the file fp and returns it. The cb and u parameters are as described in pem_password_cb(3).

                      PEM_read_bio_TYPE() is similar to PEM_read_TYPE() but reads from the BIO bp.

                      PEM_write_TYPE() writes the PEM encoding of the object a to the file fp.

                      PEM_write_bio_TYPE() similarly writes to the BIO bp.

                      "},{"location":"man3/PEM_read_CMS/#notes","title":"NOTES","text":"

                      These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                      "},{"location":"man3/PEM_read_CMS/#return-values","title":"RETURN VALUES","text":"

                      PEM_read_TYPE() and PEM_read_bio_TYPE() return a pointer to an allocated object, which should be released by calling TYPE_free(), or NULL on error.

                      PEM_write_TYPE() and PEM_write_bio_TYPE() return 1 for success or 0 for failure.

                      "},{"location":"man3/PEM_read_CMS/#see-also","title":"SEE ALSO","text":"

                      PEM_read(3), passphrase-encoding(7)

                      "},{"location":"man3/PEM_read_CMS/#history","title":"HISTORY","text":"

                      The functions PEM_write_DHxparams(), PEM_write_bio_DHxparams(), PEM_read_ECPKParameters(), PEM_read_bio_ECPKParameters(), PEM_write_ECPKParameters(), PEM_write_bio_ECPKParameters(), PEM_read_EC_PUBKEY(), PEM_read_bio_EC_PUBKEY(), PEM_write_EC_PUBKEY(), PEM_write_bio_EC_PUBKEY(), PEM_read_ECPrivateKey(), PEM_read_bio_ECPrivateKey(), PEM_write_ECPrivateKey() and PEM_write_bio_ECPrivateKey() were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/PEM_read_CMS/#copyright","title":"COPYRIGHT","text":"

                      Copyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_read_bio_PrivateKey/","title":"PEM_read_bio_PrivateKey","text":""},{"location":"man3/PEM_read_bio_PrivateKey/#name","title":"NAME","text":"

                      pem_password_cb, PEM_read_bio_PrivateKey_ex, PEM_read_bio_PrivateKey, PEM_read_PrivateKey_ex, PEM_read_PrivateKey, PEM_write_bio_PrivateKey_ex, PEM_write_bio_PrivateKey, PEM_write_bio_PrivateKey_traditional, PEM_write_PrivateKey_ex, PEM_write_PrivateKey, PEM_write_bio_PKCS8PrivateKey, PEM_write_PKCS8PrivateKey, PEM_write_bio_PKCS8PrivateKey_nid, PEM_write_PKCS8PrivateKey_nid, PEM_read_bio_PUBKEY_ex, PEM_read_bio_PUBKEY, PEM_read_PUBKEY_ex, PEM_read_PUBKEY, PEM_write_bio_PUBKEY_ex, PEM_write_bio_PUBKEY, PEM_write_PUBKEY_ex, PEM_write_PUBKEY, PEM_read_bio_RSAPrivateKey, PEM_read_RSAPrivateKey, PEM_write_bio_RSAPrivateKey, PEM_write_RSAPrivateKey, PEM_read_bio_RSAPublicKey, PEM_read_RSAPublicKey, PEM_write_bio_RSAPublicKey, PEM_write_RSAPublicKey, PEM_read_bio_RSA_PUBKEY, PEM_read_RSA_PUBKEY, PEM_write_bio_RSA_PUBKEY, PEM_write_RSA_PUBKEY, PEM_read_bio_DSAPrivateKey, PEM_read_DSAPrivateKey, PEM_write_bio_DSAPrivateKey, PEM_write_DSAPrivateKey, PEM_read_bio_DSA_PUBKEY, PEM_read_DSA_PUBKEY, PEM_write_bio_DSA_PUBKEY, PEM_write_DSA_PUBKEY, PEM_read_bio_Parameters_ex, PEM_read_bio_Parameters, PEM_write_bio_Parameters, PEM_read_bio_DSAparams, PEM_read_DSAparams, PEM_write_bio_DSAparams, PEM_write_DSAparams, PEM_read_bio_DHparams, PEM_read_DHparams, PEM_write_bio_DHparams, PEM_write_DHparams, PEM_read_bio_X509, PEM_read_X509, PEM_write_bio_X509, PEM_write_X509, PEM_read_bio_X509_AUX, PEM_read_X509_AUX, PEM_write_bio_X509_AUX, PEM_write_X509_AUX, PEM_read_bio_X509_REQ, PEM_read_X509_REQ, PEM_write_bio_X509_REQ, PEM_write_X509_REQ, PEM_write_bio_X509_REQ_NEW, PEM_write_X509_REQ_NEW, PEM_read_bio_X509_CRL, PEM_read_X509_CRL, PEM_write_bio_X509_CRL, PEM_write_X509_CRL, PEM_read_bio_PKCS7, PEM_read_PKCS7, PEM_write_bio_PKCS7, PEM_write_PKCS7 - PEM routines

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pem.h>\n\ntypedef int pem_password_cb(char *buf, int size, int rwflag, void *u);\n\nEVP_PKEY *PEM_read_bio_PrivateKey_ex(BIO *bp, EVP_PKEY **x,\n                                     pem_password_cb *cb, void *u,\n                                     OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x,\n                                  pem_password_cb *cb, void *u);\nEVP_PKEY *PEM_read_PrivateKey_ex(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,\n                                 void *u, OSSL_LIB_CTX *libctx,\n                                 const char *propq);\nEVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x,\n                              pem_password_cb *cb, void *u);\nint PEM_write_bio_PrivateKey_ex(BIO *bp, const EVP_PKEY *x,\n                                const EVP_CIPHER *enc,\n                                unsigned char *kstr, int klen,\n                                pem_password_cb *cb, void *u,\n                                OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_bio_PrivateKey(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc,\n                             unsigned char *kstr, int klen,\n                             pem_password_cb *cb, void *u);\nint PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x,\n                                         const EVP_CIPHER *enc,\n                                         unsigned char *kstr, int klen,\n                                         pem_password_cb *cb, void *u);\nint PEM_write_PrivateKey_ex(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                            unsigned char *kstr, int klen,\n                            pem_password_cb *cb, void *u,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                         unsigned char *kstr, int klen,\n                         pem_password_cb *cb, void *u);\nint PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                                  char *kstr, int klen,\n                                  pem_password_cb *cb, void *u);\nint PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                              char *kstr, int klen,\n                              pem_password_cb *cb, void *u);\nint PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, const EVP_PKEY *x, int nid,\n                                      char *kstr, int klen,\n                                      pem_password_cb *cb, void *u);\nint PEM_write_PKCS8PrivateKey_nid(FILE *fp, const EVP_PKEY *x, int nid,\n                                  char *kstr, int klen,\n                                  pem_password_cb *cb, void *u);\n\nEVP_PKEY *PEM_read_bio_PUBKEY_ex(BIO *bp, EVP_PKEY **x,\n                                 pem_password_cb *cb, void *u,\n                                 OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x,\n                              pem_password_cb *cb, void *u);\nEVP_PKEY *PEM_read_PUBKEY_ex(FILE *fp, EVP_PKEY **x,\n                             pem_password_cb *cb, void *u,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x,\n                          pem_password_cb *cb, void *u);\nint PEM_write_bio_PUBKEY_ex(BIO *bp, EVP_PKEY *x,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x);\nint PEM_write_PUBKEY_ex(FILE *fp, EVP_PKEY *x,\n                        OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x);\n\nEVP_PKEY *PEM_read_bio_Parameters_ex(BIO *bp, EVP_PKEY **x,\n                                     OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);\nint PEM_write_bio_Parameters(BIO *bp, const EVP_PKEY *x);\n\nX509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u);\nX509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_X509(BIO *bp, X509 *x);\nint PEM_write_X509(FILE *fp, X509 *x);\n\nX509 *PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u);\nX509 *PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_X509_AUX(BIO *bp, X509 *x);\nint PEM_write_X509_AUX(FILE *fp, X509 *x);\n\nX509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x,\n                                pem_password_cb *cb, void *u);\nX509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x);\nint PEM_write_X509_REQ(FILE *fp, X509_REQ *x);\nint PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x);\nint PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x);\n\nX509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x,\n                                pem_password_cb *cb, void *u);\nX509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x);\nint PEM_write_X509_CRL(FILE *fp, X509_CRL *x);\n\nPKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u);\nPKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x);\nint PEM_write_PKCS7(FILE *fp, PKCS7 *x);\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x,\n                                pem_password_cb *cb, void *u);\nRSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,\n                                unsigned char *kstr, int klen,\n                                pem_password_cb *cb, void *u);\nint PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc,\n                            unsigned char *kstr, int klen,\n                            pem_password_cb *cb, void *u);\n\nRSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x,\n                               pem_password_cb *cb, void *u);\nRSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x,\n                           pem_password_cb *cb, void *u);\nint PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x);\nint PEM_write_RSAPublicKey(FILE *fp, RSA *x);\n\nRSA *PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x,\n                             pem_password_cb *cb, void *u);\nRSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x,\n                         pem_password_cb *cb, void *u);\nint PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x);\nint PEM_write_RSA_PUBKEY(FILE *fp, RSA *x);\n\nDSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x,\n                                pem_password_cb *cb, void *u);\nDSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc,\n                                unsigned char *kstr, int klen,\n                                pem_password_cb *cb, void *u);\nint PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc,\n                            unsigned char *kstr, int klen,\n                            pem_password_cb *cb, void *u);\n\nDSA *PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x,\n                             pem_password_cb *cb, void *u);\nDSA *PEM_read_DSA_PUBKEY(FILE *fp, DSA **x,\n                         pem_password_cb *cb, void *u);\nint PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x);\nint PEM_write_DSA_PUBKEY(FILE *fp, DSA *x);\nDSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u);\nDSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_DSAparams(BIO *bp, DSA *x);\nint PEM_write_DSAparams(FILE *fp, DSA *x);\n\nDH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u);\nDH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_DHparams(BIO *bp, DH *x);\nint PEM_write_DHparams(FILE *fp, DH *x);\n
                      "},{"location":"man3/PEM_read_bio_PrivateKey/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page that have a TYPE of DH, DSA and RSA are deprecated. Applications should use OSSL_ENCODER_to_bio(3) and OSSL_DECODER_from_bio(3) instead.

                      The PEM functions read or write structures in PEM format. In this sense PEM format is simply base64 encoded data surrounded by header lines.

                      For more details about the meaning of arguments see the PEM FUNCTION ARGUMENTS section.

                      Each operation has four functions associated with it. For brevity the term \"TYPE functions\" will be used below to collectively refer to the PEM_read_bio_TYPE(), PEM_read_TYPE(), PEM_write_bio_TYPE(), and PEM_write_TYPE() functions.

                      Some operations have additional variants that take a library context libctx and a property query string propq. The X509, X509_REQ and X509_CRL objects may have an associated library context or property query string but there are no variants of these functions that take a library context or property query string parameter. In this case it is possible to set the appropriate library context or property query string by creating an empty X509, X509_REQ or X509_CRL object using X509_new_ex(3), X509_REQ_new_ex(3) or X509_CRL_new_ex(3) respectively. Then pass the empty object as a parameter to the relevant PEM function. See the \"EXAMPLES\" section below.

                      The PrivateKey functions read or write a private key in PEM format using an EVP_PKEY structure. The write routines use PKCS#8 private key format and are equivalent to PEM_write_bio_PKCS8PrivateKey(). The read functions transparently handle traditional and PKCS#8 format encrypted and unencrypted keys.

                      PEM_write_bio_PrivateKey_traditional() writes out a private key in the \"traditional\" format with a simple private key marker and should only be used for compatibility with legacy programs.

                      PEM_write_bio_PKCS8PrivateKey() and PEM_write_PKCS8PrivateKey() write a private key in an EVP_PKEY structure in PKCS#8 EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption algorithms. The cipher argument specifies the encryption algorithm to use: unlike some other PEM routines the encryption is applied at the PKCS#8 level and not in the PEM headers. If cipher is NULL then no encryption is used and a PKCS#8 PrivateKeyInfo structure is used instead.

                      PEM_write_bio_PKCS8PrivateKey_nid() and PEM_write_PKCS8PrivateKey_nid() also write out a private key as a PKCS#8 EncryptedPrivateKeyInfo however it uses PKCS#5 v1.5 or PKCS#12 encryption algorithms instead. The algorithm to use is specified in the nid parameter and should be the NID of the corresponding OBJECT IDENTIFIER (see NOTES section).

                      The PUBKEY functions process a public key using an EVP_PKEY structure. The public key is encoded as a SubjectPublicKeyInfo structure.

                      The RSAPrivateKey functions process an RSA private key using an RSA structure. The write routines uses traditional format. The read routines handles the same formats as the PrivateKey functions but an error occurs if the private key is not RSA.

                      The RSAPublicKey functions process an RSA public key using an RSA structure. The public key is encoded using a PKCS#1 RSAPublicKey structure.

                      The RSA_PUBKEY functions also process an RSA public key using an RSA structure. However, the public key is encoded using a SubjectPublicKeyInfo structure and an error occurs if the public key is not RSA.

                      The DSAPrivateKey functions process a DSA private key using a DSA structure. The write routines uses traditional format. The read routines handles the same formats as the PrivateKey functions but an error occurs if the private key is not DSA.

                      The DSA_PUBKEY functions process a DSA public key using a DSA structure. The public key is encoded using a SubjectPublicKeyInfo structure and an error occurs if the public key is not DSA.

                      The Parameters functions read or write key parameters in PEM format using an EVP_PKEY structure. The encoding depends on the type of key; for DSA key parameters, it will be a Dss-Parms structure as defined in RFC2459, and for DH key parameters, it will be a PKCS#3 DHparameter structure. These functions only exist for the BIO type.

                      The DSAparams functions process DSA parameters using a DSA structure. The parameters are encoded using a Dss-Parms structure as defined in RFC2459.

                      The DHparams functions process DH parameters using a DH structure. The parameters are encoded using a PKCS#3 DHparameter structure.

                      The X509 functions process an X509 certificate using an X509 structure. They will also process a trusted X509 certificate but any trust settings are discarded.

                      The X509_AUX functions process a trusted X509 certificate using an X509 structure.

                      The X509_REQ and X509_REQ_NEW functions process a PKCS#10 certificate request using an X509_REQ structure. The X509_REQ write functions use CERTIFICATE REQUEST in the header whereas the X509_REQ_NEW functions use NEW CERTIFICATE REQUEST (as required by some CAs). The X509_REQ read functions will handle either form so there are no X509_REQ_NEW read functions.

                      The X509_CRL functions process an X509 CRL using an X509_CRL structure.

                      The PKCS7 functions process a PKCS#7 ContentInfo using a PKCS7 structure.

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#pem-function-arguments","title":"PEM FUNCTION ARGUMENTS","text":"

                      The PEM functions have many common arguments.

                      The bp BIO parameter (if present) specifies the BIO to read from or write to.

                      The fp FILE parameter (if present) specifies the FILE pointer to read from or write to.

                      The PEM read functions all take an argument TYPE **x and return a TYPE * pointer. Where TYPE is whatever structure the function uses. If x is NULL then the parameter is ignored. If x is not NULL but *x is NULL then the structure returned will be written to *x. If neither x nor *x is NULL then an attempt is made to reuse the structure at *x (but see BUGS and EXAMPLES sections). Irrespective of the value of x a pointer to the structure is always returned (or NULL if an error occurred). The caller retains ownership of the returned object and needs to free it when it is no longer needed, e.g. using X509_free() for X509 objects or EVP_PKEY_free() for EVP_PKEY objects.

                      The PEM functions which write private keys take an enc parameter which specifies the encryption algorithm to use, encryption is done at the PEM level. If this parameter is set to NULL then the private key is written in unencrypted form.

                      The cb argument is the callback to use when querying for the pass phrase used for encrypted PEM structures (normally only private keys).

                      For the PEM write routines if the kstr parameter is not NULL then klen bytes at kstr are used as the passphrase and cb is ignored.

                      If the cb parameters is set to NULL and the u parameter is not NULL then the u parameter is interpreted as a NUL terminated string to use as the passphrase. If both cb and u are NULL then the default callback routine is used which will typically prompt for the passphrase on the current terminal with echoing turned off.

                      The default passphrase callback is sometimes inappropriate (for example in a GUI application) so an alternative can be supplied. The callback routine has the following form:

                      int cb(char *buf, int size, int rwflag, void *u);\n

                      buf is the buffer to write the passphrase to. size is the maximum length of the passphrase (i.e. the size of buf). rwflag is a flag which is set to 0 when reading and 1 when writing. A typical routine will ask the user to verify the passphrase (for example by prompting for it twice) if rwflag is 1. The u parameter has the same value as the u parameter passed to the PEM routine. It allows arbitrary data to be passed to the callback by the application (for example a window handle in a GUI application). The callback must return the number of characters in the passphrase or -1 if an error occurred. The passphrase can be arbitrary data; in the case where it is a string, it is not NUL terminated. See the \"EXAMPLES\" section below.

                      Some implementations may need to use cryptographic algorithms during their operation. If this is the case and libctx and propq parameters have been passed then any algorithm fetches will use that library context and property query string. Otherwise the default library context and property query string will be used.

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#notes","title":"NOTES","text":"

                      The PEM reading functions will skip any extraneous content or PEM data of a different type than they expect. This allows for example having a certificate (or multiple certificates) and a key in the PEM format in a single file.

                      The old PrivateKey write routines are retained for compatibility. New applications should write private keys using the PEM_write_bio_PKCS8PrivateKey() or PEM_write_PKCS8PrivateKey() routines because they are more secure (they use an iteration count of 2048 whereas the traditional routines use a count of 1) unless compatibility with older versions of OpenSSL is important.

                      The PrivateKey read routines can be used in all applications because they handle all formats transparently.

                      A frequent cause of problems is attempting to use the PEM routines like this:

                      X509 *x;\n\nPEM_read_bio_X509(bp, &x, 0, NULL);\n

                      this is a bug because an attempt will be made to reuse the data at x which is an uninitialised pointer.

                      These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#pem-encryption-format","title":"PEM ENCRYPTION FORMAT","text":"

                      These old PrivateKey routines use a non standard technique for encryption.

                      The private key (or other data) takes the following form:

                      -----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED\nDEK-Info: DES-EDE3-CBC,3F17F5316E2BAC89\n\n...base64 encoded data...\n-----END RSA PRIVATE KEY-----\n

                      The line beginning with Proc-Type contains the version and the protection on the encapsulated data. The line beginning DEK-Info contains two comma separated values: the encryption algorithm name as used by EVP_get_cipherbyname() and an initialization vector used by the cipher encoded as a set of hexadecimal digits. After those two lines is the base64-encoded encrypted data.

                      The encryption key is derived using EVP_BytesToKey(). The cipher's initialization vector is passed to EVP_BytesToKey() as the salt parameter. Internally, PKCS5_SALT_LEN bytes of the salt are used (regardless of the size of the initialization vector). The user's password is passed to EVP_BytesToKey() using the data and datal parameters. Finally, the library uses an iteration count of 1 for EVP_BytesToKey().

                      The key derived by EVP_BytesToKey() along with the original initialization vector is then used to decrypt the encrypted data. The iv produced by EVP_BytesToKey() is not utilized or needed, and NULL should be passed to the function.

                      The pseudo code to derive the key would look similar to:

                      EVP_CIPHER* cipher = EVP_des_ede3_cbc();\nEVP_MD* md = EVP_md5();\n\nunsigned int nkey = EVP_CIPHER_get_key_length(cipher);\nunsigned int niv = EVP_CIPHER_get_iv_length(cipher);\nunsigned char key[nkey];\nunsigned char iv[niv];\n\nmemcpy(iv, HexToBin(\"3F17F5316E2BAC89\"), niv);\nrc = EVP_BytesToKey(cipher, md, iv /*salt*/, pword, plen, 1, key, NULL /*iv*/);\nif (rc != nkey)\n    /* Error */\n\n/* On success, use key and iv to initialize the cipher */\n
                      "},{"location":"man3/PEM_read_bio_PrivateKey/#bugs","title":"BUGS","text":"

                      The PEM read routines in some versions of OpenSSL will not correctly reuse an existing structure. Therefore, the following:

                      PEM_read_bio_X509(bp, &x, 0, NULL);\n

                      where x already contains a valid certificate, may not work, whereas:

                      X509_free(x);\nx = PEM_read_bio_X509(bp, NULL, 0, NULL);\n

                      is guaranteed to work. It is always acceptable for x to contain a newly allocated, empty X509 object (for example allocated via X509_new_ex(3)).

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#return-values","title":"RETURN VALUES","text":"

                      The read routines return either a pointer to the structure read or NULL if an error occurred.

                      The write routines return 1 for success or 0 for failure.

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#examples","title":"EXAMPLES","text":"

                      Although the PEM routines take several arguments in almost all applications most of them are set to 0 or NULL.

                      To read a certificate with a library context in PEM format from a BIO:

                      X509 *x = X509_new_ex(libctx, NULL);\n\nif (x == NULL)\n    /* Error */\n\nif (PEM_read_bio_X509(bp, &x, 0, NULL) == NULL)\n    /* Error */\n

                      Read a certificate in PEM format from a BIO:

                      X509 *x;\n\nx = PEM_read_bio_X509(bp, NULL, 0, NULL);\nif (x == NULL)\n    /* Error */\n

                      Alternative method:

                      X509 *x = NULL;\n\nif (!PEM_read_bio_X509(bp, &x, 0, NULL))\n    /* Error */\n

                      Write a certificate to a BIO:

                      if (!PEM_write_bio_X509(bp, x))\n    /* Error */\n

                      Write a private key (using traditional format) to a BIO using triple DES encryption, the pass phrase is prompted for:

                      if (!PEM_write_bio_PrivateKey(bp, key, EVP_des_ede3_cbc(), NULL, 0, 0, NULL))\n    /* Error */\n

                      Write a private key (using PKCS#8 format) to a BIO using triple DES encryption, using the pass phrase \"hello\":

                      if (!PEM_write_bio_PKCS8PrivateKey(bp, key, EVP_des_ede3_cbc(),\n                                   NULL, 0, 0, \"hello\"))\n    /* Error */\n

                      Read a private key from a BIO using a pass phrase callback:

                      key = PEM_read_bio_PrivateKey(bp, NULL, pass_cb, \"My Private Key\");\nif (key == NULL)\n    /* Error */\n

                      Skeleton pass phrase callback:

                      int pass_cb(char *buf, int size, int rwflag, void *u)\n{\n\n    /* We'd probably do something else if 'rwflag' is 1 */\n    printf(\"Enter pass phrase for \\\"%s\\\"\\n\", (char *)u);\n\n    /* get pass phrase, length 'len' into 'tmp' */\n    char *tmp = \"hello\";\n    if (tmp == NULL) /* An error occurred */\n        return -1;\n\n    size_t len = strlen(tmp);\n\n    if (len > size)\n        len = size;\n    memcpy(buf, tmp, len);\n    return len;\n}\n
                      "},{"location":"man3/PEM_read_bio_PrivateKey/#see-also","title":"SEE ALSO","text":"

                      EVP_EncryptInit(3), EVP_BytesToKey(3), passphrase-encoding(7)

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#history","title":"HISTORY","text":"

                      The old Netscape certificate sequences were no longer documented in OpenSSL 1.1.0; applications should use the PKCS7 standard instead as they will be formally deprecated in a future releases.

                      PEM_read_bio_PrivateKey_ex(), PEM_read_PrivateKey_ex(), PEM_read_bio_PUBKEY_ex(), PEM_read_PUBKEY_ex() and PEM_read_bio_Parameters_ex() were introduced in OpenSSL 3.0.

                      The functions PEM_read_bio_RSAPrivateKey(), PEM_read_RSAPrivateKey(), PEM_write_bio_RSAPrivateKey(), PEM_write_RSAPrivateKey(), PEM_read_bio_RSAPublicKey(), PEM_read_RSAPublicKey(), PEM_write_bio_RSAPublicKey(), PEM_write_RSAPublicKey(), PEM_read_bio_RSA_PUBKEY(), PEM_read_RSA_PUBKEY(), PEM_write_bio_RSA_PUBKEY(), PEM_write_RSA_PUBKEY(), PEM_read_bio_DSAPrivateKey(), PEM_read_DSAPrivateKey(), PEM_write_bio_DSAPrivateKey(), PEM_write_DSAPrivateKey(), PEM_read_bio_DSA_PUBKEY(), PEM_read_DSA_PUBKEY(), PEM_write_bio_DSA_PUBKEY(), PEM_write_DSA_PUBKEY(); PEM_read_bio_DSAparams(), PEM_read_DSAparams(), PEM_write_bio_DSAparams(), PEM_write_DSAparams(), PEM_read_bio_DHparams(), PEM_read_DHparams(), PEM_write_bio_DHparams() and PEM_write_DHparams() were deprecated in 3.0.

                      "},{"location":"man3/PEM_read_bio_PrivateKey/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_read_bio_ex/","title":"PEM_read_bio_ex","text":""},{"location":"man3/PEM_read_bio_ex/#name","title":"NAME","text":"

                      PEM_read_bio_ex, PEM_FLAG_SECURE, PEM_FLAG_EAY_COMPATIBLE, PEM_FLAG_ONLY_B64 - read PEM format files with custom processing

                      "},{"location":"man3/PEM_read_bio_ex/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pem.h>\n\n#define PEM_FLAG_SECURE             0x1\n#define PEM_FLAG_EAY_COMPATIBLE     0x2\n#define PEM_FLAG_ONLY_B64           0x4\nint PEM_read_bio_ex(BIO *in, char **name, char **header,\n                    unsigned char **data, long *len, unsigned int flags);\n
                      "},{"location":"man3/PEM_read_bio_ex/#description","title":"DESCRIPTION","text":"

                      PEM_read_bio_ex() reads in PEM formatted data from an input BIO, outputting the name of the type of contained data, the header information regarding the possibly encrypted data, and the binary data payload (after base64 decoding). It should generally only be used to implement PEM_read_bio_-family functions for specific data types or other usage, but is exposed to allow greater flexibility over how processing is performed, if needed.

                      If PEM_FLAG_SECURE is set, the intermediate buffers used to read in lines of input are allocated from the secure heap.

                      If PEM_FLAG_EAY_COMPATIBLE is set, a simple algorithm is used to remove whitespace and control characters from the end of each line, so as to be compatible with the historical behavior of PEM_read_bio().

                      If PEM_FLAG_ONLY_B64 is set, all characters are required to be valid base64 characters (or newlines); non-base64 characters are treated as end of input.

                      If neither PEM_FLAG_EAY_COMPATIBLE or PEM_FLAG_ONLY_B64 is set, control characters are ignored.

                      If both PEM_FLAG_EAY_COMPATIBLE and PEM_FLAG_ONLY_B64 are set, an error is returned; these options are not compatible with each other.

                      "},{"location":"man3/PEM_read_bio_ex/#notes","title":"NOTES","text":"

                      The caller must release the storage allocated for *name, *header, and *data. If PEM_FLAG_SECURE was set, use OPENSSL_secure_free(); otherwise, OPENSSL_free() is used.

                      "},{"location":"man3/PEM_read_bio_ex/#return-values","title":"RETURN VALUES","text":"

                      PEM_read_bio_ex() returns 1 for success or 0 for failure.

                      "},{"location":"man3/PEM_read_bio_ex/#see-also","title":"SEE ALSO","text":"

                      PEM_bytes_read_bio(3)

                      "},{"location":"man3/PEM_read_bio_ex/#history","title":"HISTORY","text":"

                      The PEM_read_bio_ex() function was added in OpenSSL 1.1.1.

                      "},{"location":"man3/PEM_read_bio_ex/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_write_bio_CMS_stream/","title":"PEM_write_bio_CMS_stream","text":""},{"location":"man3/PEM_write_bio_CMS_stream/#name","title":"NAME","text":"

                      PEM_write_bio_CMS_stream - output CMS_ContentInfo structure in PEM format

                      "},{"location":"man3/PEM_write_bio_CMS_stream/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/cms.h>\n\nint PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);\n
                      "},{"location":"man3/PEM_write_bio_CMS_stream/#description","title":"DESCRIPTION","text":"

                      PEM_write_bio_CMS_stream() outputs a CMS_ContentInfo structure in PEM format.

                      It is otherwise identical to the function SMIME_write_CMS().

                      "},{"location":"man3/PEM_write_bio_CMS_stream/#notes","title":"NOTES","text":"

                      This function is effectively a version of the PEM_write_bio_CMS() supporting streaming.

                      "},{"location":"man3/PEM_write_bio_CMS_stream/#return-values","title":"RETURN VALUES","text":"

                      PEM_write_bio_CMS_stream() returns 1 for success or 0 for failure.

                      "},{"location":"man3/PEM_write_bio_CMS_stream/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3) CMS_decrypt(3), PEM_write(3), SMIME_write_CMS(3), i2d_CMS_bio_stream(3)

                      "},{"location":"man3/PEM_write_bio_CMS_stream/#history","title":"HISTORY","text":"

                      The PEM_write_bio_CMS_stream() function was added in OpenSSL 1.0.0.

                      "},{"location":"man3/PEM_write_bio_CMS_stream/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/","title":"PEM_write_bio_PKCS7_stream","text":""},{"location":"man3/PEM_write_bio_PKCS7_stream/#name","title":"NAME","text":"

                      PEM_write_bio_PKCS7_stream - output PKCS7 structure in PEM format

                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nint PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);\n
                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/#description","title":"DESCRIPTION","text":"

                      PEM_write_bio_PKCS7_stream() outputs a PKCS7 structure in PEM format.

                      It is otherwise identical to the function SMIME_write_PKCS7().

                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/#notes","title":"NOTES","text":"

                      This function is effectively a version of the PEM_write_bio_PKCS7() supporting streaming.

                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/#return-values","title":"RETURN VALUES","text":"

                      PEM_write_bio_PKCS7_stream() returns 1 for success or 0 for failure.

                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3), SMIME_write_PKCS7(3), i2d_PKCS7_bio_stream(3)

                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/#history","title":"HISTORY","text":"

                      The PEM_write_bio_PKCS7_stream() function was added in OpenSSL 1.0.0.

                      "},{"location":"man3/PEM_write_bio_PKCS7_stream/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_PBE_keyivgen/","title":"PKCS12_PBE_keyivgen","text":""},{"location":"man3/PKCS12_PBE_keyivgen/#name","title":"NAME","text":"

                      PKCS12_PBE_keyivgen, PKCS12_PBE_keyivgen_ex, PKCS12_pbe_crypt, PKCS12_pbe_crypt_ex - PKCS#12 Password based encryption

                      "},{"location":"man3/PKCS12_PBE_keyivgen/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/evp.h>\n\nint PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                        ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                        const EVP_MD *md_type, int en_de);\nint PKCS12_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                           ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                           const EVP_MD *md_type, int en_de,\n                           OSSL_LIB_CTX *libctx, const char *propq);\nunsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor,\n                                const char *pass, int passlen,\n                                const unsigned char *in, int inlen,\n                                unsigned char **data, int *datalen,\n                                int en_de);\nunsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor,\n                                   const char *pass, int passlen,\n                                   const unsigned char *in, int inlen,\n                                   unsigned char **data, int *datalen,\n                                   int en_de, OSSL_LIB_CTX *libctx,\n                                   const char *propq);\n
                      "},{"location":"man3/PKCS12_PBE_keyivgen/#description","title":"DESCRIPTION","text":"

                      PKCS12_PBE_keyivgen() and PKCS12_PBE_keyivgen_ex() take a password pass of length passlen, parameters param and a message digest function md_type and perform a key derivation according to PKCS#12. The resulting key is then used to initialise the cipher context ctx with a cipher cipher for encryption (en_de=1) or decryption (en_de=0).

                      PKCS12_PBE_keyivgen_ex() also allows the application to specify a library context libctx and property query propq to select appropriate algorithm implementations.

                      PKCS12_pbe_crypt() and PKCS12_pbe_crypt_ex() will encrypt or decrypt a buffer based on the algorithm in algor and password pass of length passlen. The input is from in of length inlen and output is into a malloc'd buffer returned in *data of length datalen. The operation is determined by en_de, encryption (en_de=1) or decryption (en_de=0).

                      PKCS12_pbe_crypt_ex() allows the application to specify a library context libctx and property query propq to select appropriate algorithm implementations.

                      pass is the password used in the derivation of length passlen. pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                      salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                      iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter less than 1 is treated as a single iteration.

                      digest is the message digest function used in the derivation.

                      Functions ending in _ex() take optional parameters libctx and propq which are used to select appropriate algorithm implementations.

                      "},{"location":"man3/PKCS12_PBE_keyivgen/#notes","title":"NOTES","text":"

                      The functions are typically used in PKCS#12 to encrypt objects.

                      These functions make no assumption regarding the given password. It will simply be treated as a byte sequence.

                      "},{"location":"man3/PKCS12_PBE_keyivgen/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_PBE_keyivgen(), PKCS12_PBE_keyivgen_ex() return 1 on success or 0 on error.

                      PKCS12_pbe_crypt() and PKCS12_pbe_crypt_ex() return a buffer containing the output or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_PBE_keyivgen/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_PBE_keyivgen/#see-also","title":"SEE ALSO","text":"

                      EVP_PBE_CipherInit_ex(3), PKCS8_encrypt_ex(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS12_PBE_keyivgen/#history","title":"HISTORY","text":"

                      PKCS12_PBE_keyivgen_ex() and PKCS12_pbe_crypt_ex() were added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_PBE_keyivgen/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/","title":"PKCS12_SAFEBAG_create_cert","text":""},{"location":"man3/PKCS12_SAFEBAG_create_cert/#name","title":"NAME","text":"

                      PKCS12_SAFEBAG_create_cert, PKCS12_SAFEBAG_create_crl, PKCS12_SAFEBAG_create_secret, PKCS12_SAFEBAG_create0_p8inf, PKCS12_SAFEBAG_create0_pkcs8, PKCS12_SAFEBAG_create_pkcs8_encrypt, PKCS12_SAFEBAG_create_pkcs8_encrypt_ex - Create PKCS#12 safeBag objects

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype,\n                                             const unsigned char* value,\n                                             int len);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,\n                                                    const char *pass,\n                                                    int passlen,\n                                                    unsigned char *salt,\n                                                    int saltlen, int iter,\n                                                    PKCS8_PRIV_KEY_INFO *p8inf);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid,\n                                                       const char *pass,\n                                                       int passlen,\n                                                       unsigned char *salt,\n                                                       int saltlen, int iter,\n                                                       PKCS8_PRIV_KEY_INFO *p8inf,\n                                                       OSSL_LIB_CTX *ctx,\n                                                       const char *propq);\n
                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#description","title":"DESCRIPTION","text":"

                      PKCS12_SAFEBAG_create_cert() creates a new PKCS12_SAFEBAG of type NID_certBag containing the supplied certificate.

                      PKCS12_SAFEBAG_create_crl() creates a new PKCS12_SAFEBAG of type NID_crlBag containing the supplied crl.

                      PKCS12_SAFEBAG_create_secret() creates a new PKCS12_SAFEBAG of type corresponding to a PKCS#12 secretBag. The secretBag contents are tagged as type with an ASN1 value of type vtype constructed using the bytes in value of length len.

                      PKCS12_SAFEBAG_create0_p8inf() creates a new PKCS12_SAFEBAG of type NID_keyBag containing the supplied PKCS8 structure.

                      PKCS12_SAFEBAG_create0_pkcs8() creates a new PKCS12_SAFEBAG of type NID_pkcs8ShroudedKeyBag containing the supplied PKCS8 structure.

                      PKCS12_SAFEBAG_create_pkcs8_encrypt() creates a new PKCS12_SAFEBAG of type NID_pkcs8ShroudedKeyBag by encrypting the supplied PKCS8 p8inf. If pbe_nid is 0, a default encryption algorithm is used. pass is the passphrase and iter is the iteration count. If iter is zero then a default value of 2048 is used. If salt is NULL then a salt is generated randomly.

                      PKCS12_SAFEBAG_create_pkcs8_encrypt_ex() is identical to PKCS12_SAFEBAG_create_pkcs8_encrypt() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#notes","title":"NOTES","text":"

                      PKCS12_SAFEBAG_create_pkcs8_encrypt() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                      PKCS12_SAFEBAG_create_secret() was added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#return-values","title":"RETURN VALUES","text":"

                      All of these functions return a valid PKCS12_SAFEBAG structure or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#see-also","title":"SEE ALSO","text":"

                      PKCS12_create(3), PKCS12_add_safe(3), PKCS12_add_safes(3)

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#history","title":"HISTORY","text":"

                      PKCS12_SAFEBAG_create_pkcs8_encrypt_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/","title":"PKCS12_SAFEBAG_get0_attrs","text":""},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#name","title":"NAME","text":"

                      PKCS12_SAFEBAG_get0_attrs, PKCS12_get_attr_gen - Retrieve attributes from a PKCS#12 safeBag

                      "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nconst STACK_OF(X509_ATTRIBUTE) *PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag);\n\nASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs,\n                               int attr_nid);\n
                      "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#description","title":"DESCRIPTION","text":"

                      PKCS12_SAFEBAG_get0_attrs() retrieves the stack of X509_ATTRIBUTEs from a PKCS#12 safeBag. bag is the PKCS12_SAFEBAG to retrieve the attributes from.

                      PKCS12_get_attr_gen() retrieves an attribute by NID from a stack of X509_ATTRIBUTEs. attr_nid is the NID of the attribute to retrieve.

                      "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_SAFEBAG_get0_attrs() returns the stack of X509_ATTRIBUTEs from a PKCS#12 safeBag, which could be empty.

                      PKCS12_get_attr_gen() returns an ASN1_TYPE object containing the attribute, or NULL if the attribute was either not present or an error occurred.

                      PKCS12_get_attr_gen() does not allocate a new attribute. The returned attribute is still owned by the PKCS12_SAFEBAG in which it resides.

                      "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#see-also","title":"SEE ALSO","text":"

                      PKCS12_get_friendlyname(3), PKCS12_add_friendlyname_asc(3)

                      "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/","title":"PKCS12_SAFEBAG_get1_cert","text":""},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#name","title":"NAME","text":"

                      PKCS12_SAFEBAG_get0_attr, PKCS12_SAFEBAG_get0_type, PKCS12_SAFEBAG_get_nid, PKCS12_SAFEBAG_get_bag_nid, PKCS12_SAFEBAG_get0_bag_obj, PKCS12_SAFEBAG_get0_bag_type, PKCS12_SAFEBAG_get1_cert, PKCS12_SAFEBAG_get1_crl, PKCS12_SAFEBAG_get0_safes, PKCS12_SAFEBAG_get0_p8inf, PKCS12_SAFEBAG_get0_pkcs8 - Get objects from a PKCS#12 safeBag

                      "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nconst ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag,\n                                          int attr_nid);\nconst ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag);\nint PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag);\nint PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag);\nconst ASN1_TYPE *PKCS12_SAFEBAG_get0_bag_obj(const PKCS12_SAFEBAG *bag);\nconst ASN1_OBJECT *PKCS12_SAFEBAG_get0_bag_type(const PKCS12_SAFEBAG *bag);\nX509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag);\nX509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag);\nconst STACK_OF(PKCS12_SAFEBAG) *PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag);\nconst PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag);\nconst X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag);\n
                      "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#description","title":"DESCRIPTION","text":"

                      PKCS12_SAFEBAG_get0_attr() gets the attribute value corresponding to the attr_nid.

                      PKCS12_SAFEBAG_get0_type() gets the safeBag type as an OID, whereas PKCS12_SAFEBAG_get_nid() gets the safeBag type as an NID, which could be NID_certBag, NID_crlBag, NID_keyBag, NID_secretBag, NID_safeContentsBag or NID_pkcs8ShroudedKeyBag.

                      PKCS12_SAFEBAG_get_bag_nid() gets the type of the object contained within the PKCS12_SAFEBAG. This corresponds to the bag type for most bags, but can be arbitrary for secretBags. PKCS12_SAFEBAG_get0_bag_type() gets this type as an OID.

                      PKCS12_SAFEBAG_get0_bag_obj() retrieves the object contained within the safeBag.

                      PKCS12_SAFEBAG_get1_cert() and PKCS12_SAFEBAG_get1_crl() return new X509 or X509_CRL objects from the item in the safeBag.

                      PKCS12_SAFEBAG_get0_p8inf() and PKCS12_SAFEBAG_get0_pkcs8() return the PKCS8 object from a PKCS8shroudedKeyBag or a keyBag.

                      PKCS12_SAFEBAG_get0_safes() retrieves the set of safeBags contained within a safeContentsBag.

                      "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_SAFEBAG_get_nid() and PKCS12_SAFEBAG_get_bag_nid() return the NID of the safeBag or bag object, or -1 if there is no corresponding NID. Other functions return a valid object of the specified type or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#see-also","title":"SEE ALSO","text":"

                      PKCS12_create(3), PKCS12_add_safe(3), PKCS12_add_safes(3)

                      "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_add1_attr_by_NID/","title":"PKCS12_add1_attr_by_NID","text":""},{"location":"man3/PKCS12_add1_attr_by_NID/#name","title":"NAME","text":"

                      PKCS12_add1_attr_by_NID, PKCS12_add1_attr_by_txt - Add an attribute to a PKCS#12 safeBag structure

                      "},{"location":"man3/PKCS12_add1_attr_by_NID/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_add1_attr_by_NID(PKCS12_SAFEBAG *bag, int nid, int type,\n                            const unsigned char *bytes, int len);\nint PKCS12_add1_attr_by_txt(PKCS12_SAFEBAG *bag, const char *attrname, int type,\n                            const unsigned char *bytes, int len);\n
                      "},{"location":"man3/PKCS12_add1_attr_by_NID/#description","title":"DESCRIPTION","text":"

                      These functions add a PKCS#12 Attribute to the Attribute Set of the bag.

                      PKCS12_add1_attr_by_NID() adds an attribute of type nid with a value of ASN1 type type constructed using len bytes from bytes.

                      PKCS12_add1_attr_by_txt() adds an attribute of type attrname with a value of ASN1 type type constructed using len bytes from bytes.

                      "},{"location":"man3/PKCS12_add1_attr_by_NID/#notes","title":"NOTES","text":"

                      These functions do not check whether an existing attribute of the same type is present. There can be multiple attributes with the same type assigned to a safeBag.

                      Both functions were added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_add1_attr_by_NID/#return-values","title":"RETURN VALUES","text":"

                      A return value of 1 indicates success, 0 indicates failure.

                      "},{"location":"man3/PKCS12_add1_attr_by_NID/#see-also","title":"SEE ALSO","text":"

                      PKCS12_create(3)

                      "},{"location":"man3/PKCS12_add1_attr_by_NID/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_add_CSPName_asc/","title":"PKCS12_add_CSPName_asc","text":""},{"location":"man3/PKCS12_add_CSPName_asc/#name","title":"NAME","text":"

                      PKCS12_add_CSPName_asc - Add a Microsoft CSP Name attribute to a PKCS#12 safeBag

                      "},{"location":"man3/PKCS12_add_CSPName_asc/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, int namelen);\n
                      "},{"location":"man3/PKCS12_add_CSPName_asc/#description","title":"DESCRIPTION","text":"

                      PKCS12_add_CSPName_asc() adds an ASCII string representation of the Microsoft CSP Name attribute to a PKCS#12 safeBag.

                      bag is the PKCS12_SAFEBAG to add the attribute to.

                      "},{"location":"man3/PKCS12_add_CSPName_asc/#return-values","title":"RETURN VALUES","text":"

                      Returns 1 for success or 0 for failure.

                      "},{"location":"man3/PKCS12_add_CSPName_asc/#see-also","title":"SEE ALSO","text":"

                      PKCS12_add_friendlyname_asc(3)

                      "},{"location":"man3/PKCS12_add_CSPName_asc/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_add_cert/","title":"PKCS12_add_cert","text":""},{"location":"man3/PKCS12_add_cert/#name","title":"NAME","text":"

                      PKCS12_add_cert, PKCS12_add_key, PKCS12_add_key_ex, PKCS12_add_secret - Add an object to a set of PKCS#12 safeBags

                      "},{"location":"man3/PKCS12_add_cert/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nPKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);\nPKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags,\n                              EVP_PKEY *key, int key_usage, int iter,\n                              int key_nid, const char *pass);\nPKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags,\n                                  EVP_PKEY *key, int key_usage, int iter,\n                                  int key_nid, const char *pass,\n                                  OSSL_LIB_CTX *ctx, const char *propq);\n\nPKCS12_SAFEBAG *PKCS12_add_secret(STACK_OF(PKCS12_SAFEBAG) **pbags,\n                                 int nid_type, const unsigned char *value, int len);\n
                      "},{"location":"man3/PKCS12_add_cert/#description","title":"DESCRIPTION","text":"

                      These functions create a new PKCS12_SAFEBAG and add it to the set of safeBags in pbags.

                      PKCS12_add_cert() creates a PKCS#12 certBag containing the supplied certificate and adds this to the set of PKCS#12 safeBags.

                      PKCS12_add_key() creates a PKCS#12 keyBag (unencrypted) or a pkcs8shroudedKeyBag (encrypted) containing the supplied EVP_PKEY and adds this to the set of PKCS#12 safeBags. If key_nid is not -1 then the key is encrypted with the supplied algorithm, using pass as the passphrase and iter as the iteration count. If iter is zero then a default value for iteration count of 2048 is used.

                      PKCS12_add_key_ex() is identical to PKCS12_add_key() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                      PKCS12_add_secret() creates a PKCS#12 secretBag with an OID corresponding to the supplied nid_type containing the supplied value as an ASN1 octet string. This is then added to the set of PKCS#12 safeBags.

                      "},{"location":"man3/PKCS12_add_cert/#notes","title":"NOTES","text":"

                      If a certificate contains an alias or a keyid then this will be used for the corresponding friendlyName or localKeyID in the PKCS12 structure.

                      PKCS12_add_key() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                      "},{"location":"man3/PKCS12_add_cert/#return-values","title":"RETURN VALUES","text":"

                      A valid PKCS12_SAFEBAG structure or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_add_cert/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_add_cert/#see-also","title":"SEE ALSO","text":"

                      PKCS12_create(3)

                      "},{"location":"man3/PKCS12_add_cert/#history","title":"HISTORY","text":"

                      PKCS12_add_secret() and PKCS12_add_key_ex() were added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_add_cert/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_add_friendlyname_asc/","title":"PKCS12_add_friendlyname_asc","text":""},{"location":"man3/PKCS12_add_friendlyname_asc/#name","title":"NAME","text":"

                      PKCS12_add_friendlyname_asc, PKCS12_add_friendlyname_utf8, PKCS12_add_friendlyname_uni - Functions to add the friendlyname attribute to a PKCS#12 safeBag

                      "},{"location":"man3/PKCS12_add_friendlyname_asc/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,\n                                int namelen);\n\nint PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name,\n                                int namelen);\n\nint PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag,\n                                const unsigned char *name, int namelen);\n
                      "},{"location":"man3/PKCS12_add_friendlyname_asc/#description","title":"DESCRIPTION","text":"

                      PKCS12_add_friendlyname_asc() adds an ASCII string representation of the PKCS#9 friendlyName attribute to a PKCS#12 safeBag.

                      PKCS12_add_friendlyname_utf8() adds a UTF-8 string representation of the PKCS#9 friendlyName attribute to a PKCS#12 safeBag.

                      PKCS12_add_friendlyname_uni() adds a Unicode string representation of the PKCS#9 friendlyName attribute to a PKCS#12 safeBag.

                      bag is the PKCS12_SAFEBAG to add the attribute to.

                      "},{"location":"man3/PKCS12_add_friendlyname_asc/#return-values","title":"RETURN VALUES","text":"

                      Returns 1 for success or 0 for failure.

                      "},{"location":"man3/PKCS12_add_friendlyname_asc/#see-also","title":"SEE ALSO","text":"

                      PKCS12_get_friendlyname(3)

                      "},{"location":"man3/PKCS12_add_friendlyname_asc/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_add_localkeyid/","title":"PKCS12_add_localkeyid","text":""},{"location":"man3/PKCS12_add_localkeyid/#name","title":"NAME","text":"

                      PKCS12_add_localkeyid - Add the localKeyId attribute to a PKCS#12 safeBag

                      "},{"location":"man3/PKCS12_add_localkeyid/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, const char *name,\n                          int namelen);\n
                      "},{"location":"man3/PKCS12_add_localkeyid/#description","title":"DESCRIPTION","text":"

                      PKCS12_add_localkeyid() adds an octet string representation of the PKCS#9 localKeyId attribute to a PKCS#12 safeBag.

                      bag is the PKCS12_SAFEBAG to add the attribute to.

                      "},{"location":"man3/PKCS12_add_localkeyid/#return-values","title":"RETURN VALUES","text":"

                      Returns 1 for success or 0 for failure.

                      "},{"location":"man3/PKCS12_add_localkeyid/#see-also","title":"SEE ALSO","text":"

                      PKCS12_add_friendlyname_asc(3)

                      "},{"location":"man3/PKCS12_add_localkeyid/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_add_safe/","title":"PKCS12_add_safe","text":""},{"location":"man3/PKCS12_add_safe/#name","title":"NAME","text":"

                      PKCS12_add_safe, PKCS12_add_safe_ex, PKCS12_add_safes, PKCS12_add_safes_ex - Create and add objects to a PKCS#12 structure

                      "},{"location":"man3/PKCS12_add_safe/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,\n                   int safe_nid, int iter, const char *pass);\nint PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,\n                       int safe_nid, int iter, const char *pass,\n                       OSSL_LIB_CTX *ctx, const char *propq);\n\nPKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);\nPKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid,\n                            OSSL_LIB_CTX *ctx, const char *propq);\n
                      "},{"location":"man3/PKCS12_add_safe/#description","title":"DESCRIPTION","text":"

                      PKCS12_add_safe() creates a new PKCS7 contentInfo containing the supplied PKCS12_SAFEBAGs and adds this to a set of PKCS7 contentInfos. Its type depends on the value of safe_nid:

                      • If safe_nid is -1, a plain PKCS7 data contentInfo is created.
                      • If safe_nid is a valid PBE algorithm NID, a PKCS7 encryptedData contentInfo is created. The algorithm uses pass as the passphrase and iter as the iteration count. If iter is zero then a default value for iteration count of 2048 is used.
                      • If safe_nid is 0, a PKCS7 encryptedData contentInfo is created using a default encryption algorithm, currently NID_pbe_WithSHA1And3_Key_TripleDES_CBC.

                      PKCS12_add_safe_ex() is identical to PKCS12_add_safe() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                      PKCS12_add_safes() creates a PKCS12 structure containing the supplied set of PKCS7 contentInfos. The safes are enclosed first within a PKCS7 contentInfo of type p7_nid. Currently the only supported type is NID_pkcs7_data.

                      PKCS12_add_safes_ex() is identical to PKCS12_add_safes() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                      "},{"location":"man3/PKCS12_add_safe/#notes","title":"NOTES","text":"

                      PKCS12_add_safe() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                      "},{"location":"man3/PKCS12_add_safe/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_add_safe() returns a value of 1 indicating success or 0 for failure.

                      PKCS12_add_safes() returns a valid PKCS12 structure or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_add_safe/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_add_safe/#see-also","title":"SEE ALSO","text":"

                      PKCS12_create(3)

                      "},{"location":"man3/PKCS12_add_safe/#history","title":"HISTORY","text":"

                      PKCS12_add_safe_ex() and PKCS12_add_safes_ex() were added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_add_safe/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_create/","title":"PKCS12_create","text":""},{"location":"man3/PKCS12_create/#name","title":"NAME","text":"

                      PKCS12_create, PKCS12_create_ex - create a PKCS#12 structure

                      "},{"location":"man3/PKCS12_create/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nPKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey,\n                      X509 *cert, STACK_OF(X509) *ca,\n                      int nid_key, int nid_cert, int iter, int mac_iter, int keytype);\nPKCS12 *PKCS12_create_ex(const char *pass, const char *name, EVP_PKEY *pkey,\n                         X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert,\n                         int iter, int mac_iter, int keytype,\n                         OSSL_LIB_CTX *ctx, const char *propq);\n
                      "},{"location":"man3/PKCS12_create/#description","title":"DESCRIPTION","text":"

                      PKCS12_create() creates a PKCS#12 structure.

                      pass is the passphrase to use. name is the friendlyName to use for the supplied certificate and key. pkey is the private key to include in the structure and cert its corresponding certificates. ca, if not NULL is an optional set of certificates to also include in the structure.

                      nid_key and nid_cert are the encryption algorithms that should be used for the key and certificate respectively. The modes GCM, CCM, XTS, and OCB are unsupported. iter is the encryption algorithm iteration count to use and mac_iter is the MAC iteration count to use. keytype is the type of key.

                      PKCS12_create_ex() is identical to PKCS12_create() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                      "},{"location":"man3/PKCS12_create/#notes","title":"NOTES","text":"

                      The parameters nid_key, nid_cert, iter, mac_iter and keytype can all be set to zero and sensible defaults will be used.

                      These defaults are: AES password based encryption (PBES2 with PBKDF2 and AES-256-CBC) for private keys and certificates, the PBKDF2 and MAC key derivation iteration count of PKCS12_DEFAULT_ITER (currently 2048), and MAC algorithm HMAC with SHA2-256. The MAC key derivation algorithm used for the outer PKCS#12 structure is PKCS12KDF.

                      The default MAC iteration count is 1 in order to retain compatibility with old software which did not interpret MAC iteration counts. If such compatibility is not required then mac_iter should be set to PKCS12_DEFAULT_ITER.

                      keytype adds a flag to the store private key. This is a non standard extension that is only currently interpreted by MSIE. If set to zero the flag is omitted, if set to KEY_SIG the key can be used for signing only, if set to KEY_EX it can be used for signing and encryption. This option was useful for old export grade software which could use signing only keys of arbitrary size but had restrictions on the permissible sizes of keys which could be used for encryption.

                      If name is NULL and cert contains an alias then this will be used for the corresponding friendlyName in the PKCS12 structure instead. Similarly, if pkey is NULL and cert contains a keyid then this will be used for the corresponding localKeyID in the PKCS12 structure instead of the id calculated from the pkey.

                      For all certificates in ca then if a certificate contains an alias or keyid then this will be used for the corresponding friendlyName or localKeyID in the PKCS12 structure.

                      Either pkey, cert or both can be NULL to indicate that no key or certificate is required. In previous versions both had to be present or a fatal error is returned.

                      nid_key or nid_cert can be set to -1 indicating that no encryption should be used.

                      mac_iter can be set to -1 and the MAC will then be omitted entirely. This can be useful when running with the FIPS provider as the PKCS12KDF is not a FIPS approvable algorithm.

                      PKCS12_create() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                      "},{"location":"man3/PKCS12_create/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_create() returns a valid PKCS12 structure or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_create/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_create/#see-also","title":"SEE ALSO","text":"

                      EVP_KDF-PKCS12KDF(7), d2i_PKCS12(3), OSSL_PROVIDER-FIPS(7), passphrase-encoding(7)

                      "},{"location":"man3/PKCS12_create/#history","title":"HISTORY","text":"

                      PKCS12_create_ex() was added in OpenSSL 3.0.

                      The defaults for encryption algorithms, MAC algorithm, and the MAC key derivation iteration count were changed in OpenSSL 3.0 to more modern standards.

                      "},{"location":"man3/PKCS12_create/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_decrypt_skey/","title":"PKCS12_decrypt_skey","text":""},{"location":"man3/PKCS12_decrypt_skey/#name","title":"NAME","text":"

                      PKCS12_decrypt_skey, PKCS12_decrypt_skey_ex - PKCS12 shrouded keyBag decrypt functions

                      "},{"location":"man3/PKCS12_decrypt_skey/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nPKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag,\n                                         const char *pass, int passlen);\nPKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey_ex(const PKCS12_SAFEBAG *bag,\n                                            const char *pass, int passlen,\n                                            OSSL_LIB_CTX *ctx,\n                                            const char *propq);\n
                      "},{"location":"man3/PKCS12_decrypt_skey/#description","title":"DESCRIPTION","text":"

                      PKCS12_decrypt_skey() Decrypt the PKCS#8 shrouded keybag contained within bag using the supplied password pass of length passlen.

                      PKCS12_decrypt_skey_ex() is similar to the above but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                      "},{"location":"man3/PKCS12_decrypt_skey/#return-values","title":"RETURN VALUES","text":"

                      Both functions will return the decrypted key or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_decrypt_skey/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_decrypt_skey/#see-also","title":"SEE ALSO","text":"

                      PKCS8_decrypt_ex(3), PKCS8_encrypt_ex(3), PKCS12_add_key_ex(3), PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(3)

                      "},{"location":"man3/PKCS12_decrypt_skey/#history","title":"HISTORY","text":"

                      PKCS12_decrypt_skey_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_decrypt_skey/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_gen_mac/","title":"PKCS12_gen_mac","text":""},{"location":"man3/PKCS12_gen_mac/#name","title":"NAME","text":"

                      PKCS12_gen_mac, PKCS12_setup_mac, PKCS12_set_mac, PKCS12_verify_mac - Functions to create and manipulate a PKCS#12 structure

                      "},{"location":"man3/PKCS12_gen_mac/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,\n                   unsigned char *mac, unsigned int *maclen);\nint PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);\nint PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,\n                   unsigned char *salt, int saltlen, int iter,\n                   const EVP_MD *md_type);\nint PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,\n                     int saltlen, const EVP_MD *md_type);\n
                      "},{"location":"man3/PKCS12_gen_mac/#description","title":"DESCRIPTION","text":"

                      PKCS12_gen_mac() generates an HMAC over the entire PKCS#12 object using the supplied password along with a set of already configured parameters. The default key generation mechanism used is PKCS12KDF.

                      PKCS12_verify_mac() verifies the PKCS#12 object's HMAC using the supplied password.

                      PKCS12_setup_mac() sets the MAC part of the PKCS#12 structure with the supplied parameters.

                      PKCS12_set_mac() sets the MAC and MAC parameters into the PKCS#12 object.

                      pass is the passphrase to use in the HMAC. salt is the salt value to use, iter is the iteration count and md_type is the message digest function to use.

                      "},{"location":"man3/PKCS12_gen_mac/#notes","title":"NOTES","text":"

                      If salt is NULL then a suitable salt will be generated and used.

                      If iter is 1 then an iteration count will be omitted from the PKCS#12 structure.

                      PKCS12_gen_mac(), PKCS12_verify_mac() and PKCS12_set_mac() make assumptions regarding the encoding of the given passphrase. See passphrase-encoding(7) for more information.

                      "},{"location":"man3/PKCS12_gen_mac/#return-values","title":"RETURN VALUES","text":"

                      All functions return 1 on success and 0 if an error occurred.

                      "},{"location":"man3/PKCS12_gen_mac/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_gen_mac/#see-also","title":"SEE ALSO","text":"

                      d2i_PKCS12(3), EVP_KDF-PKCS12KDF(7), PKCS12_create(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS12_gen_mac/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_get_friendlyname/","title":"PKCS12_get_friendlyname","text":""},{"location":"man3/PKCS12_get_friendlyname/#name","title":"NAME","text":"

                      PKCS12_get_friendlyname - Retrieve the friendlyname attribute from a PKCS#12 safeBag

                      "},{"location":"man3/PKCS12_get_friendlyname/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nchar *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);\n
                      "},{"location":"man3/PKCS12_get_friendlyname/#description","title":"DESCRIPTION","text":"

                      PKCS12_get_friendlyname() retrieves a UTF-8 string representation of the PKCS#9 friendlyName attribute for a PKCS#12 safeBag item.

                      bag is the PKCS12_SAFEBAG to retrieve the attribute from.

                      "},{"location":"man3/PKCS12_get_friendlyname/#return-values","title":"RETURN VALUES","text":"

                      A UTF-8 string, or NULL if the attribute was either not present or an error occurred.

                      The returned string is allocated by OpenSSL and should be freed by the user.

                      "},{"location":"man3/PKCS12_get_friendlyname/#see-also","title":"SEE ALSO","text":"

                      PKCS12_add_friendlyname_asc(3)

                      "},{"location":"man3/PKCS12_get_friendlyname/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_init/","title":"PKCS12_init","text":""},{"location":"man3/PKCS12_init/#name","title":"NAME","text":"

                      PKCS12_init, PKCS12_init_ex - Create a new empty PKCS#12 structure

                      "},{"location":"man3/PKCS12_init/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nPKCS12 *PKCS12_init(int mode);\nPKCS12 *PKCS12_init_ex(int mode, OSSL_LIB_CTX *ctx, const char *propq);\n
                      "},{"location":"man3/PKCS12_init/#description","title":"DESCRIPTION","text":"

                      PKCS12_init() creates an empty PKCS#12 structure. Any PKCS#7 authSafes added to this structure are enclosed first within a single PKCS#7 contentInfo of type mode. Currently the only supported type is NID_pkcs7_data.

                      PKCS12_init_ex() creates an empty PKCS#12 structure and assigns the supplied ctx and propq to be used to select algorithm implementations for operations performed on the PKCS12 object.

                      "},{"location":"man3/PKCS12_init/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_init() and PKCS12_init_ex() return a valid PKCS12 structure or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_init/#see-also","title":"SEE ALSO","text":"

                      d2i_PKCS12(3), PKCS12_create(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS12_init/#history","title":"HISTORY","text":"

                      PKCS12_init_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_init/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_item_decrypt_d2i/","title":"PKCS12_item_decrypt_d2i","text":""},{"location":"man3/PKCS12_item_decrypt_d2i/#name","title":"NAME","text":"

                      PKCS12_item_decrypt_d2i, PKCS12_item_decrypt_d2i_ex, PKCS12_item_i2d_encrypt, PKCS12_item_i2d_encrypt_ex - PKCS12 item encrypt/decrypt functions

                      "},{"location":"man3/PKCS12_item_decrypt_d2i/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nvoid *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it,\n                              const char *pass, int passlen,\n                              const ASN1_OCTET_STRING *oct, int zbuf);\nvoid *PKCS12_item_decrypt_d2i_ex(const X509_ALGOR *algor, const ASN1_ITEM *it,\n                                 const char *pass, int passlen,\n                                 const ASN1_OCTET_STRING *oct, int zbuf,\n                                 OSSL_LIB_CTX *libctx,\n                                 const char *propq);\nASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor,\n                                           const ASN1_ITEM *it,\n                                           const char *pass, int passlen,\n                                           void *obj, int zbuf);\nASN1_OCTET_STRING *PKCS12_item_i2d_encrypt_ex(X509_ALGOR *algor,\n                                              const ASN1_ITEM *it,\n                                              const char *pass, int passlen,\n                                              void *obj, int zbuf,\n                                              OSSL_LIB_CTX *ctx,\n                                              const char *propq);\n
                      "},{"location":"man3/PKCS12_item_decrypt_d2i/#description","title":"DESCRIPTION","text":"

                      PKCS12_item_decrypt_d2i() and PKCS12_item_decrypt_d2i_ex() decrypt an octet string containing an ASN.1 encoded object using the algorithm algor and password pass of length passlen. If zbuf is nonzero then the output buffer will zeroed after the decrypt.

                      PKCS12_item_i2d_encrypt() and PKCS12_item_i2d_encrypt_ex() encrypt an ASN.1 object it using the algorithm algor and password pass of length passlen, returning an encoded object in obj. If zbuf is nonzero then the buffer containing the input encoding will be zeroed after the encrypt.

                      Functions ending in _ex() allow for a library context ctx and property query propq to be used to select algorithm implementations.

                      "},{"location":"man3/PKCS12_item_decrypt_d2i/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_item_decrypt_d2i() and PKCS12_item_decrypt_d2i_ex() return the decrypted object or NULL if an error occurred.

                      PKCS12_item_i2d_encrypt() and PKCS12_item_i2d_encrypt_ex() return the encrypted data as an ASN.1 Octet String or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_item_decrypt_d2i/#see-also","title":"SEE ALSO","text":"

                      PKCS12_pbe_crypt_ex(3), PKCS8_encrypt_ex(3)

                      "},{"location":"man3/PKCS12_item_decrypt_d2i/#history","title":"HISTORY","text":"

                      PKCS12_item_decrypt_d2i_ex() and PKCS12_item_i2d_encrypt_ex() were added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_item_decrypt_d2i/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/","title":"PKCS12_key_gen_utf8_ex","text":""},{"location":"man3/PKCS12_key_gen_utf8_ex/#name","title":"NAME","text":"

                      PKCS12_key_gen_asc, PKCS12_key_gen_asc_ex, PKCS12_key_gen_uni, PKCS12_key_gen_uni_ex, PKCS12_key_gen_utf8, PKCS12_key_gen_utf8_ex - PKCS#12 Password based key derivation

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,\n                       int saltlen, int id, int iter, int n,\n                       unsigned char *out, const EVP_MD *md_type);\nint PKCS12_key_gen_asc_ex(const char *pass, int passlen, unsigned char *salt,\n                          int saltlen, int id, int iter, int n,\n                          unsigned char *out, const EVP_MD *md_type,\n                          OSSL_LIB_CTX *ctx, const char *propq);\nint PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,\n                       int saltlen, int id, int iter, int n,\n                       unsigned char *out, const EVP_MD *md_type);\nint PKCS12_key_gen_uni_ex(unsigned char *pass, int passlen, unsigned char *salt,\n                          int saltlen, int id, int iter, int n,\n                          unsigned char *out, const EVP_MD *md_type,\n                          OSSL_LIB_CTX *ctx, const char *propq);\nint PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt,\n                        int saltlen, int id, int iter, int n,\n                        unsigned char *out, const EVP_MD *md_type);\nint PKCS12_key_gen_utf8_ex(const char *pass, int passlen, unsigned char *salt,\n                           int saltlen, int id, int iter, int n,\n                           unsigned char *out, const EVP_MD *md_type,\n                           OSSL_LIB_CTX *ctx, const char *propq);\n
                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#description","title":"DESCRIPTION","text":"

                      These methods perform a key derivation according to PKCS#12 (RFC7292) with an input password pass of length passlen, a salt salt of length saltlen, an iteration count iter and a digest algorithm md_type. The ID byte id determines how the resulting key is intended to be used:

                      • If ID=1, then the pseudorandom bits being produced are to be used as key material for performing encryption or decryption.
                      • If ID=2, then the pseudorandom bits being produced are to be used as an IV (Initial Value) for encryption or decryption.
                      • If ID=3, then the pseudorandom bits being produced are to be used as an integrity key for MACing.

                      The intended format of the supplied password is determined by the method chosen:

                      • PKCS12_key_gen_asc() and PKCS12_key_gen_asc_ex() expect an ASCII-formatted password.
                      • PKCS12_key_gen_uni() and PKCS12_key_gen_uni_ex() expect a Unicode-formatted password.
                      • PKCS12_key_gen_utf8() and PKCS12_key_gen_utf8_ex() expect a UTF-8 encoded password.

                      pass is the password used in the derivation of length passlen. pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                      salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                      iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter less than 1 is treated as a single iteration.

                      digest is the message digest function used in the derivation.

                      The derived key will be written to out. The size of the out buffer is specified via n.

                      Functions ending in _ex() allow for a library context ctx and property query propq to be used to select algorithm implementations.

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#notes","title":"NOTES","text":"

                      A typical application of this function is to derive keying material for an encryption algorithm from a password in the pass, a salt in salt, and an iteration count.

                      Increasing the iter parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#return-values","title":"RETURN VALUES","text":"

                      Returns 1 on success or 0 on error.

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#see-also","title":"SEE ALSO","text":"

                      PKCS12_create_ex(3), PKCS12_pbe_crypt_ex(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#history","title":"HISTORY","text":"

                      PKCS12_key_gen_asc_ex(), PKCS12_key_gen_uni_ex() and PKCS12_key_gen_utf8_ex() were added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_key_gen_utf8_ex/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_newpass/","title":"PKCS12_newpass","text":""},{"location":"man3/PKCS12_newpass/#name","title":"NAME","text":"

                      PKCS12_newpass - change the password of a PKCS12 structure

                      "},{"location":"man3/PKCS12_newpass/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);\n
                      "},{"location":"man3/PKCS12_newpass/#description","title":"DESCRIPTION","text":"

                      PKCS12_newpass() changes the password of a PKCS12 structure.

                      p12 is a pointer to a PKCS12 structure. oldpass is the existing password and newpass is the new password.

                      Each of oldpass and newpass is independently interpreted as a string in the UTF-8 encoding. If it is not valid UTF-8, it is assumed to be ISO8859-1 instead.

                      In particular, this means that passwords in the locale character set (or code page on Windows) must potentially be converted to UTF-8 before use. This may include passwords from local text files, or input from the terminal or command line. Refer to the documentation of UI_OpenSSL(3), for example.

                      If the PKCS#12 structure does not have a password, then you must use the empty string \"\" for oldpass. Using NULL for oldpass will result in a PKCS12_newpass() failure.

                      If the wrong password is used for oldpass then the function will fail, with a MAC verification error. In rare cases the PKCS12 structure does not contain a MAC: in this case it will usually fail with a decryption padding error.

                      "},{"location":"man3/PKCS12_newpass/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_newpass() returns 1 on success or 0 on failure. Applications can retrieve the most recent error from PKCS12_newpass() with ERR_get_error().

                      "},{"location":"man3/PKCS12_newpass/#examples","title":"EXAMPLES","text":"

                      This example loads a PKCS#12 file, changes its password and writes out the result to a new file.

                      #include <stdio.h>\n#include <stdlib.h>\n#include <openssl/pem.h>\n#include <openssl/err.h>\n#include <openssl/pkcs12.h>\n\nint main(int argc, char **argv)\n{\n    FILE *fp;\n    PKCS12 *p12;\n\n    if (argc != 5) {\n        fprintf(stderr, \"Usage: pkread p12file password newpass opfile\\n\");\n        return 1;\n    }\n    if ((fp = fopen(argv[1], \"rb\")) == NULL) {\n        fprintf(stderr, \"Error opening file %s\\n\", argv[1]);\n        return 1;\n    }\n    p12 = d2i_PKCS12_fp(fp, NULL);\n    fclose(fp);\n    if (p12 == NULL) {\n        fprintf(stderr, \"Error reading PKCS#12 file\\n\");\n        ERR_print_errors_fp(stderr);\n        return 1;\n    }\n    if (PKCS12_newpass(p12, argv[2], argv[3]) == 0) {\n        fprintf(stderr, \"Error changing password\\n\");\n        ERR_print_errors_fp(stderr);\n        PKCS12_free(p12);\n        return 1;\n    }\n    if ((fp = fopen(argv[4], \"wb\")) == NULL) {\n        fprintf(stderr, \"Error opening file %s\\n\", argv[4]);\n        PKCS12_free(p12);\n        return 1;\n    }\n    i2d_PKCS12_fp(fp, p12);\n    PKCS12_free(p12);\n    fclose(fp);\n    return 0;\n}\n
                      "},{"location":"man3/PKCS12_newpass/#bugs","title":"BUGS","text":"

                      The password format is a NULL terminated ASCII string which is converted to Unicode form internally. As a result some passwords cannot be supplied to this function.

                      "},{"location":"man3/PKCS12_newpass/#see-also","title":"SEE ALSO","text":"

                      PKCS12_create(3), ERR_get_error(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS12_newpass/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_pack_p7encdata/","title":"PKCS12_pack_p7encdata","text":""},{"location":"man3/PKCS12_pack_p7encdata/#name","title":"NAME","text":"

                      PKCS12_pack_p7encdata, PKCS12_pack_p7encdata_ex - Pack a set of PKCS#12 safeBags into a PKCS#7 encrypted data object

                      "},{"location":"man3/PKCS12_pack_p7encdata/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nPKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,\n                             unsigned char *salt, int saltlen, int iter,\n                             STACK_OF(PKCS12_SAFEBAG) *bags);\nPKCS7 *PKCS12_pack_p7encdata_ex(int pbe_nid, const char *pass, int passlen,\n                                unsigned char *salt, int saltlen, int iter,\n                                STACK_OF(PKCS12_SAFEBAG) *bags,\n                                OSSL_LIB_CTX *ctx, const char *propq);\n
                      "},{"location":"man3/PKCS12_pack_p7encdata/#description","title":"DESCRIPTION","text":"

                      PKCS12_pack_p7encdata() generates a PKCS#7 ContentInfo object of encrypted-data type from the set of safeBags bags. The algorithm ID in pbe_nid can be a PKCS#12 or PKCS#5 password based encryption algorithm, or a cipher algorithm. If a cipher algorithm is passed, the PKCS#5 PBES2 algorithm will be used with this cipher as a parameter. The password pass of length passlen, salt salt of length saltlen and iteration count iter are inputs into the encryption operation.

                      PKCS12_pack_p7encdata_ex() operates similar to the above but allows for a library context ctx and property query propq to be used to select the algorithm implementation.

                      "},{"location":"man3/PKCS12_pack_p7encdata/#return-values","title":"RETURN VALUES","text":"

                      A PKCS7 object if successful, or NULL if an error occurred.

                      "},{"location":"man3/PKCS12_pack_p7encdata/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 2315 (https://tools.ietf.org/html/rfc2315)

                      "},{"location":"man3/PKCS12_pack_p7encdata/#see-also","title":"SEE ALSO","text":"

                      PKCS12_pbe_crypt_ex(3)

                      "},{"location":"man3/PKCS12_pack_p7encdata/#history","title":"HISTORY","text":"

                      PKCS12_pack_p7encdata_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS12_pack_p7encdata/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS12_parse/","title":"PKCS12_parse","text":""},{"location":"man3/PKCS12_parse/#name","title":"NAME","text":"

                      PKCS12_parse - parse a PKCS#12 structure

                      "},{"location":"man3/PKCS12_parse/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs12.h>\n\nint PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,\n                 STACK_OF(X509) **ca);\n
                      "},{"location":"man3/PKCS12_parse/#description","title":"DESCRIPTION","text":"

                      PKCS12_parse() parses a PKCS12 structure.

                      p12 is the PKCS12 structure to parse. pass is the passphrase to use. If successful the private key will be written to *pkey, the corresponding certificate to *cert and any additional certificates to *ca.

                      "},{"location":"man3/PKCS12_parse/#notes","title":"NOTES","text":"

                      Each of the parameters pkey, cert, and ca can be NULL in which case the private key, the corresponding certificate, or the additional certificates, respectively, will be discarded. If any of pkey and cert is non-NULL the variable it points to is initialized. If ca is non-NULL and *ca is NULL a new STACK will be allocated. If ca is non-NULL and *ca is a valid STACK then additional certificates are appended in the given order to *ca.

                      The friendlyName and localKeyID attributes (if present) on each certificate will be stored in the alias and keyid attributes of the X509 structure.

                      The parameter pass is interpreted as a string in the UTF-8 encoding. If it is not valid UTF-8, then it is assumed to be ISO8859-1 instead.

                      In particular, this means that passwords in the locale character set (or code page on Windows) must potentially be converted to UTF-8 before use. This may include passwords from local text files, or input from the terminal or command line. Refer to the documentation of UI_OpenSSL(3), for example.

                      "},{"location":"man3/PKCS12_parse/#return-values","title":"RETURN VALUES","text":"

                      PKCS12_parse() returns 1 for success and zero if an error occurred.

                      The error can be obtained from ERR_get_error(3)

                      "},{"location":"man3/PKCS12_parse/#bugs","title":"BUGS","text":"

                      Only a single private key and corresponding certificate is returned by this function. More complex PKCS#12 files with multiple private keys will only return the first match.

                      Only friendlyName and localKeyID attributes are currently stored in certificates. Other attributes are discarded.

                      Attributes currently cannot be stored in the private key EVP_PKEY structure.

                      "},{"location":"man3/PKCS12_parse/#see-also","title":"SEE ALSO","text":"

                      d2i_PKCS12(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS12_parse/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS5_PBE_keyivgen/","title":"PKCS5_PBE_keyivgen","text":""},{"location":"man3/PKCS5_PBE_keyivgen/#name","title":"NAME","text":"

                      PKCS5_PBE_keyivgen, PKCS5_PBE_keyivgen_ex, PKCS5_pbe2_set, PKCS5_pbe2_set_iv, PKCS5_pbe2_set_iv_ex, PKCS5_pbe_set, PKCS5_pbe_set_ex, PKCS5_pbe2_set_scrypt, PKCS5_pbe_set0_algor, PKCS5_pbe_set0_algor_ex, PKCS5_v2_PBE_keyivgen, PKCS5_v2_PBE_keyivgen_ex, PKCS5_v2_scrypt_keyivgen, PKCS5_v2_scrypt_keyivgen_ex, PKCS5_pbkdf2_set, PKCS5_pbkdf2_set_ex, EVP_PBE_scrypt, EVP_PBE_scrypt_ex - PKCS#5 Password based encryption routines

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/evp.h>\n\nint PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                       ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                       const EVP_MD *md, int en_de);\nint PKCS5_PBE_keyivgen_ex(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,\n                          ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                          const EVP_MD *md, int en_de, OSSL_LIB_CTX *libctx,\n                          const char *propq);\nint PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                          ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                          const EVP_MD *md, int en_de);\nint PKCS5_v2_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                             ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                             const EVP_MD *md, int en_de,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_PBE_scrypt(const char *pass, size_t passlen,\n                   const unsigned char *salt, size_t saltlen,\n                   uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,\n                   unsigned char *key, size_t keylen);\nint EVP_PBE_scrypt_ex(const char *pass, size_t passlen,\n                      const unsigned char *salt, size_t saltlen,\n                      uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,\n                      unsigned char *key, size_t keylen,\n                      OSSL_LIB_CTX *ctx, const char *propq);\nint PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,\n                             int passlen, ASN1_TYPE *param,\n                             const EVP_CIPHER *c, const EVP_MD *md, int en_de);\nint PKCS5_v2_scrypt_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass,\n                                int passlen, ASN1_TYPE *param,\n                                const EVP_CIPHER *c, const EVP_MD *md, int en_de,\n                                OSSL_LIB_CTX *libctx, const char *propq);\n\n#include <openssl/x509.h>\n\nint PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,\n                         const unsigned char *salt, int saltlen);\nint PKCS5_pbe_set0_algor_ex(X509_ALGOR *algor, int alg, int iter,\n                            const unsigned char *salt, int saltlen,\n                            OSSL_LIB_CTX *libctx);\n\nX509_ALGOR *PKCS5_pbe_set(int alg, int iter,\n                          const unsigned char *salt, int saltlen);\nX509_ALGOR *PKCS5_pbe_set_ex(int alg, int iter,\n                             const unsigned char *salt, int saltlen,\n                             OSSL_LIB_CTX *libctx);\n\nX509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,\n                           unsigned char *salt, int saltlen);\nX509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,\n                              unsigned char *salt, int saltlen,\n                              unsigned char *aiv, int prf_nid);\nX509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter,\n                                 unsigned char *salt, int saltlen,\n                                 unsigned char *aiv, int prf_nid,\n                                 OSSL_LIB_CTX *libctx);\nX509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher,\n                                  const unsigned char *salt, int saltlen,\n                                  unsigned char *aiv, uint64_t N, uint64_t r,\n                                  uint64_t p);\n\nX509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,\n                             int prf_nid, int keylen);\nX509_ALGOR *PKCS5_pbkdf2_set_ex(int iter, unsigned char *salt, int saltlen,\n                                int prf_nid, int keylen,\n                                OSSL_LIB_CTX *libctx);\n
                      "},{"location":"man3/PKCS5_PBE_keyivgen/#description","title":"DESCRIPTION","text":""},{"location":"man3/PKCS5_PBE_keyivgen/#key-derivation","title":"Key Derivation","text":"

                      PKCS5_PBE_keyivgen() and PKCS5_PBE_keyivgen_ex() take a password pass of length passlen, parameters param and a message digest function md_type and performs a key derivation according to PKCS#5 PBES1. The resulting key is then used to initialise the cipher context ctx with a cipher cipher for encryption (en_de=1) or decryption (en_de=0).

                      pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                      PKCS5_v2_PBE_keyivgen() and PKCS5_v2_PBE_keyivgen_ex() are similar to the above but instead use PKCS#5 PBES2 as the encryption algorithm using the supplied parameters.

                      PKCS5_v2_scrypt_keyivgen() and PKCS5_v2_scrypt_keyivgen_ex() use SCRYPT as the key derivation part of the encryption algorithm.

                      salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                      iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter less than 1 is treated as a single iteration.

                      digest is the message digest function used in the derivation.

                      Functions ending in _ex() take optional parameters libctx and propq which are used to select appropriate algorithm implementations.

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#algorithm-identifier-creation","title":"Algorithm Identifier Creation","text":"

                      PKCS5_pbe_set(), PKCS5_pbe_set_ex(), PKCS5_pbe2_set(), PKCS5_pbe2_set_iv(), PKCS5_pbe2_set_iv_ex() and PKCS5_pbe2_set_scrypt() generate an X509_ALGOR object which represents an AlgorithmIdentifier containing the algorithm OID and associated parameters for the PBE algorithm.

                      PKCS5_pbkdf2_set() and PKCS5_pbkdf2_set_ex() generate an X509_ALGOR object which represents an AlgorithmIdentifier containing the algorithm OID and associated parameters for the PBKDF2 algorithm.

                      PKCS5_pbe_set0_algor() and PKCS5_pbe_set0_algor_ex() set the PBE algorithm OID and parameters into the supplied X509_ALGOR.

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#notes","title":"NOTES","text":"

                      The *_keyivgen() functions are typically used in PKCS#12 to encrypt objects.

                      These functions make no assumption regarding the given password. It will simply be treated as a byte sequence.

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#return-values","title":"RETURN VALUES","text":"

                      PKCS5_PBE_keyivgen(), PKCS5_v2_PBE_keyivgen(), PKCS5_v2_PBE_keyivgen_ex(), PKCS5_v2_scrypt_keyivgen(), PKCS5_v2_scrypt_keyivgen_ex(), PKCS5_pbe_set0_algor() and PKCS5_pbe_set0_algor_ex() return 1 for success and 0 if an error occurs.

                      PKCS5_pbe_set(), PKCS5_pbe_set_ex(), PKCS5_pbe2_set(), PKCS5_pbe2_set_iv(), PKCS5_pbe2_set_iv_ex(), PKCS5_pbe2_set_scrypt(), PKCS5_pbkdf2_set() and PKCS5_pbkdf2_set_ex() return an X509_ALGOR object or NULL if an error occurs.

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 8018 (https://tools.ietf.org/html/rfc8018)

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#see-also","title":"SEE ALSO","text":"

                      EVP_PBE_CipherInit_ex(3), PKCS12_pbe_crypt_ex(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#history","title":"HISTORY","text":"

                      PKCS5_v2_PBE_keyivgen_ex(), EVP_PBE_scrypt_ex(), PKCS5_v2_scrypt_keyivgen_ex(), PKCS5_pbe_set0_algor_ex(), PKCS5_pbe_set_ex(), PKCS5_pbe2_set_iv_ex() and PKCS5_pbkdf2_set_ex() were added in OpenSSL 3.0.

                      From OpenSSL 3.0 the PBKDF1 algorithm used in PKCS5_PBE_keyivgen() and PKCS5_PBE_keyivgen_ex() has been moved to the legacy provider as an EVP_KDF.

                      "},{"location":"man3/PKCS5_PBE_keyivgen/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS5_PBKDF2_HMAC/","title":"PKCS5_PBKDF2_HMAC","text":""},{"location":"man3/PKCS5_PBKDF2_HMAC/#name","title":"NAME","text":"

                      PKCS5_PBKDF2_HMAC, PKCS5_PBKDF2_HMAC_SHA1 - password based derivation routines with salt and iteration count

                      "},{"location":"man3/PKCS5_PBKDF2_HMAC/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/evp.h>\n\nint PKCS5_PBKDF2_HMAC(const char *pass, int passlen,\n                      const unsigned char *salt, int saltlen, int iter,\n                      const EVP_MD *digest,\n                      int keylen, unsigned char *out);\n\nint PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,\n                           const unsigned char *salt, int saltlen, int iter,\n                           int keylen, unsigned char *out);\n
                      "},{"location":"man3/PKCS5_PBKDF2_HMAC/#description","title":"DESCRIPTION","text":"

                      PKCS5_PBKDF2_HMAC() derives a key from a password using a salt and iteration count as specified in RFC 2898.

                      pass is the password used in the derivation of length passlen. pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                      salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                      iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter value less than 1 is invalid; such values will result in failure and raise the PROV_R_INVALID_ITERATION_COUNT error.

                      digest is the message digest function used in the derivation. PKCS5_PBKDF2_HMAC_SHA1() calls PKCS5_PBKDF2_HMAC() with EVP_sha1().

                      The derived key will be written to out. The size of the out buffer is specified via keylen.

                      "},{"location":"man3/PKCS5_PBKDF2_HMAC/#notes","title":"NOTES","text":"

                      A typical application of this function is to derive keying material for an encryption algorithm from a password in the pass, a salt in salt, and an iteration count.

                      Increasing the iter parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                      These functions make no assumption regarding the given password. It will simply be treated as a byte sequence.

                      "},{"location":"man3/PKCS5_PBKDF2_HMAC/#return-values","title":"RETURN VALUES","text":"

                      PKCS5_PBKDF2_HMAC() and PBKCS5_PBKDF2_HMAC_SHA1() return 1 on success or 0 on error.

                      "},{"location":"man3/PKCS5_PBKDF2_HMAC/#see-also","title":"SEE ALSO","text":"

                      evp(7), RAND_bytes(3), EVP_BytesToKey(3), passphrase-encoding(7)

                      "},{"location":"man3/PKCS5_PBKDF2_HMAC/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2014-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS7_decrypt/","title":"PKCS7_decrypt","text":""},{"location":"man3/PKCS7_decrypt/#name","title":"NAME","text":"

                      PKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure

                      "},{"location":"man3/PKCS7_decrypt/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nint PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);\n
                      "},{"location":"man3/PKCS7_decrypt/#description","title":"DESCRIPTION","text":"

                      PKCS7_decrypt() extracts and decrypts the content from a PKCS#7 envelopedData structure. pkey is the private key of the recipient, cert is the recipients certificate, data is a BIO to write the content to and flags is an optional set of flags.

                      "},{"location":"man3/PKCS7_decrypt/#notes","title":"NOTES","text":"

                      Although the recipients certificate is not needed to decrypt the data it is needed to locate the appropriate (of possible several) recipients in the PKCS#7 structure.

                      The following flags can be passed in the flags parameter.

                      If the PKCS7_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                      "},{"location":"man3/PKCS7_decrypt/#return-values","title":"RETURN VALUES","text":"

                      PKCS7_decrypt() returns either 1 for success or 0 for failure. The error can be obtained from ERR_get_error(3)

                      "},{"location":"man3/PKCS7_decrypt/#bugs","title":"BUGS","text":"

                      PKCS7_decrypt() must be passed the correct recipient key and certificate. It would be better if it could look up the correct key and certificate from a database.

                      The lack of single pass processing and need to hold all data in memory as mentioned in PKCS7_sign() also applies to PKCS7_verify().

                      "},{"location":"man3/PKCS7_decrypt/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), PKCS7_encrypt(3)

                      "},{"location":"man3/PKCS7_decrypt/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS7_encrypt/","title":"PKCS7_encrypt","text":""},{"location":"man3/PKCS7_encrypt/#name","title":"NAME","text":"

                      PKCS7_encrypt_ex, PKCS7_encrypt - create a PKCS#7 envelopedData structure

                      "},{"location":"man3/PKCS7_encrypt/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nPKCS7 *PKCS7_encrypt_ex(STACK_OF(X509) *certs, BIO *in,\n                        const EVP_CIPHER *cipher, int flags,\n                        OSSL_LIB_CTX *libctx, const char *propq);\nPKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,\n                     int flags);\n
                      "},{"location":"man3/PKCS7_encrypt/#description","title":"DESCRIPTION","text":"

                      PKCS7_encrypt_ex() creates and returns a PKCS#7 envelopedData structure. certs is a list of recipient certificates. in is the content to be encrypted. cipher is the symmetric cipher to use. flags is an optional set of flags. The library context libctx and the property query propq are used when retrieving algorithms from providers.

                      Only RSA keys are supported in PKCS#7 and envelopedData so the recipient certificates supplied to this function must all contain RSA public keys, though they do not have to be signed using the RSA algorithm.

                      EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use because most clients will support it.

                      Some old \"export grade\" clients may only support weak encryption using 40 or 64 bit RC2. These can be used by passing EVP_rc2_40_cbc() and EVP_rc2_64_cbc() respectively.

                      The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters.

                      Many browsers implement a \"sign and encrypt\" option which is simply an S/MIME envelopedData containing an S/MIME signed message. This can be readily produced by storing the S/MIME signed message in a memory BIO and passing it to PKCS7_encrypt().

                      The following flags can be passed in the flags parameter.

                      If the PKCS7_TEXT flag is set MIME headers for type text/plain are prepended to the data.

                      Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if PKCS7_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it. If PKCS7_BINARY is set then PKCS7_TEXT is ignored.

                      If the PKCS7_STREAM flag is set a partial PKCS7 structure is output suitable for streaming I/O: no data is read from the BIO in.

                      If the flag PKCS7_STREAM is set the returned PKCS7 structure is not complete and outputting its contents via a function that does not properly finalize the PKCS7 structure will give unpredictable results.

                      Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(), PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_PKCS7().

                      PKCS7_encrypt() is similar to PKCS7_encrypt_ex() but uses default values of NULL for the library context libctx and the property query propq.

                      "},{"location":"man3/PKCS7_encrypt/#return-values","title":"RETURN VALUES","text":"

                      PKCS7_encrypt_ex() and PKCS7_encrypt() return either a PKCS7 structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                      "},{"location":"man3/PKCS7_encrypt/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), PKCS7_decrypt(3)

                      "},{"location":"man3/PKCS7_encrypt/#history","title":"HISTORY","text":"

                      The function PKCS7_encrypt_ex() was added in OpenSSL 3.0.

                      The PKCS7_STREAM flag was added in OpenSSL 1.0.0.

                      "},{"location":"man3/PKCS7_encrypt/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS7_get_octet_string/","title":"PKCS7_get_octet_string","text":""},{"location":"man3/PKCS7_get_octet_string/#name","title":"NAME","text":"

                      PKCS7_get_octet_string - return octet string from a PKCS#7 envelopedData structure

                      "},{"location":"man3/PKCS7_get_octet_string/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nASN1_OCTET_STRING *PKCS7_get_octet_string(PKCS7 *p7);\n
                      "},{"location":"man3/PKCS7_get_octet_string/#description","title":"DESCRIPTION","text":"

                      PKCS7_get_octet_string() returns a pointer to an ASN1 octet string from a PKCS#7 envelopedData structure or NULL if the structure cannot be parsed.

                      "},{"location":"man3/PKCS7_get_octet_string/#notes","title":"NOTES","text":"

                      As the 0 implies, PKCS7_get_octet_string() returns internal pointers which should not be freed by the caller.

                      "},{"location":"man3/PKCS7_get_octet_string/#return-values","title":"RETURN VALUES","text":"

                      PKCS7_get_octet_string() returns an ASN1_OCTET_STRING pointer.

                      "},{"location":"man3/PKCS7_get_octet_string/#see-also","title":"SEE ALSO","text":"

                      PKCS7_type_is_data(3)

                      "},{"location":"man3/PKCS7_get_octet_string/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS7_sign/","title":"PKCS7_sign","text":""},{"location":"man3/PKCS7_sign/#name","title":"NAME","text":"

                      PKCS7_sign_ex, PKCS7_sign - create a PKCS#7 signedData structure

                      "},{"location":"man3/PKCS7_sign/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nPKCS7 *PKCS7_sign_ex(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                     BIO *data, int flags, OSSL_LIB_CTX *libctx,\n                     const char *propq);\nPKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                  BIO *data, int flags);\n
                      "},{"location":"man3/PKCS7_sign/#description","title":"DESCRIPTION","text":"

                      PKCS7_sign_ex() creates and returns a PKCS#7 signedData structure. signcert is the certificate to sign with, pkey is the corresponding private key. certs is an optional set of extra certificates to include in the PKCS#7 structure (for example any intermediate CAs in the chain). The library context libctx and property query propq are used when retrieving algorithms from providers.

                      The data to be signed is read from BIO data.

                      flags is an optional set of flags.

                      Any of the following flags (ored together) can be passed in the flags parameter.

                      Many S/MIME clients expect the signed content to include valid MIME headers. If the PKCS7_TEXT flag is set MIME headers for type text/plain are prepended to the data.

                      If PKCS7_NOCERTS is set the signer's certificate and the extra certs will not be included in the PKCS7 structure. The signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signatures if the signer's certificates can be obtained by other means: for example a previously signed message.

                      The data being signed is included in the PKCS7 structure, unless PKCS7_DETACHED is set in which case it is omitted. This is used for PKCS7 detached signatures which are used in S/MIME plaintext signed messages for example.

                      Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if PKCS7_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it.

                      The signedData structure includes several PKCS#7 authenticatedAttributes including the signing time, the PKCS#7 content type and the supported list of ciphers in an SMIMECapabilities attribute. If PKCS7_NOATTR is set then no authenticatedAttributes will be used. If PKCS7_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

                      If present the SMIMECapabilities attribute indicates support for the following algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is disabled then it will not be included.

                      If the flags PKCS7_STREAM is set then the returned PKCS7 structure is just initialized ready to perform the signing operation. The signing is however not performed and the data to be signed is not read from the data parameter. Signing is deferred until after the data has been written. In this way data can be signed in a single pass.

                      If the PKCS7_PARTIAL flag is set a partial PKCS7 structure is output to which additional signers and capabilities can be added before finalization.

                      If the flag PKCS7_STREAM is set the returned PKCS7 structure is not complete and outputting its contents via a function that does not properly finalize the PKCS7 structure will give unpredictable results.

                      Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(), PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_PKCS7().

                      If a signer is specified it will use the default digest for the signing algorithm. This is SHA1 for both RSA and DSA keys.

                      The certs, signcert and pkey parameters can all be NULL if the PKCS7_PARTIAL flag is set. One or more signers can be added using the function PKCS7_sign_add_signer(). PKCS7_final() must also be called to finalize the structure if streaming is not enabled. Alternative signing digests can also be specified using this method.

                      If signcert and pkey are NULL then a certificates only PKCS#7 structure is output.

                      In versions of OpenSSL before 1.0.0 the signcert and pkey parameters must not be NULL.

                      PKCS7_sign() is like PKCS7_sign_ex() except that it uses default values of NULL for the library context libctx and the property query propq. This is retained for API backward compatibility.

                      "},{"location":"man3/PKCS7_sign/#bugs","title":"BUGS","text":"

                      Some advanced attributes such as counter signatures are not supported.

                      "},{"location":"man3/PKCS7_sign/#return-values","title":"RETURN VALUES","text":"

                      PKCS7_sign_ex() and PKCS7_sign() return either a valid PKCS7 structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                      "},{"location":"man3/PKCS7_sign/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), PKCS7_verify(3)

                      "},{"location":"man3/PKCS7_sign/#history","title":"HISTORY","text":"

                      The function PKCS7_sign_ex() was added in OpenSSL 3.0.

                      The PKCS7_PARTIAL flag, and the ability for certs, signcert, and pkey parameters to be NULL were added in OpenSSL 1.0.0.

                      The PKCS7_STREAM flag was added in OpenSSL 1.0.0.

                      "},{"location":"man3/PKCS7_sign/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS7_sign_add_signer/","title":"PKCS7_sign_add_signer","text":""},{"location":"man3/PKCS7_sign_add_signer/#name","title":"NAME","text":"

                      PKCS7_sign_add_signer, PKCS7_add_certificate, PKCS7_add_crl - add information to PKCS7 structure

                      "},{"location":"man3/PKCS7_sign_add_signer/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nPKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert,\n                                         EVP_PKEY *pkey, const EVP_MD *md, int flags);\nint PKCS7_add_certificate(PKCS7 *p7, X509 *cert);\nint PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl);\n
                      "},{"location":"man3/PKCS7_sign_add_signer/#description","title":"DESCRIPTION","text":"

                      PKCS7_sign_add_signer() adds a signer with certificate signcert and private key pkey using message digest md to a PKCS7 signed data structure p7.

                      The PKCS7 structure should be obtained from an initial call to PKCS7_sign() with the flag PKCS7_PARTIAL set or in the case or re-signing a valid PKCS#7 signed data structure.

                      If the md parameter is NULL then the default digest for the public key algorithm will be used.

                      Unless the PKCS7_REUSE_DIGEST flag is set the returned PKCS7 structure is not complete and must be finalized either by streaming (if applicable) or a call to PKCS7_final().

                      "},{"location":"man3/PKCS7_sign_add_signer/#notes","title":"NOTES","text":"

                      The main purpose of this function is to provide finer control over a PKCS#7 signed data structure where the simpler PKCS7_sign() function defaults are not appropriate. For example if multiple signers or non default digest algorithms are needed.

                      Any of the following flags (ored together) can be passed in the flags parameter.

                      If PKCS7_REUSE_DIGEST is set then an attempt is made to copy the content digest value from the PKCS7 structure: to add a signer to an existing structure. An error occurs if a matching digest value cannot be found to copy. The returned PKCS7 structure will be valid and finalized when this flag is set.

                      If PKCS7_PARTIAL is set in addition to PKCS7_REUSE_DIGEST then the PKCS7_SIGNER_INO structure will not be finalized so additional attributes can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is needed to finalize it.

                      If PKCS7_NOCERTS is set the signer's certificate will not be included in the PKCS7 structure, the signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signature if the signers certificate can be obtained by other means: for example a previously signed message.

                      The signedData structure includes several PKCS#7 authenticatedAttributes including the signing time, the PKCS#7 content type and the supported list of ciphers in an SMIMECapabilities attribute. If PKCS7_NOATTR is set then no authenticatedAttributes will be used. If PKCS7_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

                      If present the SMIMECapabilities attribute indicates support for the following algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is disabled then it will not be included.

                      PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO structure just added, which can be used to set additional attributes before it is finalized.

                      PKCS7_add_certificate() adds to the PKCS7 structure p7 the certificate cert, which may be an end-entity (signer) certificate or a CA certificate useful for chain building. This is done internally by PKCS7_sign_ex(3) and similar signing functions. It may have to be used before calling PKCS7_verify(3) in order to provide any missing certificate(s) needed for verification.

                      PKCS7_add_crl() adds the CRL crl to the PKCS7 structure p7. This may be called to provide certificate status information to be included when signing or to use when verifying the PKCS7 structure.

                      "},{"location":"man3/PKCS7_sign_add_signer/#return-values","title":"RETURN VALUES","text":"

                      PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO structure just added or NULL if an error occurs.

                      PKCS7_add_certificate() and PKCS7_add_crl() return 1 on success, 0 on error.

                      "},{"location":"man3/PKCS7_sign_add_signer/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), PKCS7_sign_ex(3), PKCS7_final(3), PKCS7_verify(3)

                      "},{"location":"man3/PKCS7_sign_add_signer/#history","title":"HISTORY","text":"

                      The PPKCS7_sign_add_signer() function was added in OpenSSL 1.0.0.

                      "},{"location":"man3/PKCS7_sign_add_signer/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS7_type_is_other/","title":"PKCS7_type_is_other","text":""},{"location":"man3/PKCS7_type_is_other/#name","title":"NAME","text":"

                      PKCS7_type_is_other - determine content type of PKCS#7 envelopedData structure

                      "},{"location":"man3/PKCS7_type_is_other/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nint PKCS7_type_is_other(PKCS7 *p7);\n
                      "},{"location":"man3/PKCS7_type_is_other/#description","title":"DESCRIPTION","text":"

                      PKCS7_type_is_other() returns the whether the content type of a PKCS#7 envelopedData structure is one of the following content types:

                      NID_pkcs7_data NID_pkcs7_signed NID_pkcs7_enveloped NID_pkcs7_signedAndEnveloped NID_pkcs7_digest NID_pkcs7_encrypted

                      "},{"location":"man3/PKCS7_type_is_other/#return-values","title":"RETURN VALUES","text":"

                      PKCS7_type_is_other() returns either 0 if the content type is matched or 1 otherwise.

                      "},{"location":"man3/PKCS7_type_is_other/#see-also","title":"SEE ALSO","text":"

                      PKCS7_type_is_data(3), PKCS7_get_octet_string(3)

                      "},{"location":"man3/PKCS7_type_is_other/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS7_verify/","title":"PKCS7_verify","text":""},{"location":"man3/PKCS7_verify/#name","title":"NAME","text":"

                      PKCS7_verify, PKCS7_get0_signers - verify a PKCS#7 signedData structure

                      "},{"location":"man3/PKCS7_verify/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nint PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,\n                 BIO *indata, BIO *out, int flags);\n\nSTACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);\n
                      "},{"location":"man3/PKCS7_verify/#description","title":"DESCRIPTION","text":"

                      PKCS7_verify() is very similar to CMS_verify(3). It verifies a PKCS#7 signedData structure given in p7. The optional certs parameter refers to a set of certificates in which to search for signer's certificates. p7 may contain extra untrusted CA certificates that may be used for chain building as well as CRLs that may be used for certificate validation. store may be NULL or point to the trusted certificate store to use for chain verification. indata refers to the signed data if the content is detached from p7. Otherwise indata should be NULL, and then the signed data must be in p7. The content is written to the BIO out unless it is NULL. flags is an optional set of flags, which can be used to modify the operation.

                      PKCS7_get0_signers() retrieves the signer's certificates from p7, it does not check their validity or whether any signatures are valid. The certs and flags parameters have the same meanings as in PKCS7_verify().

                      "},{"location":"man3/PKCS7_verify/#verify-process","title":"VERIFY PROCESS","text":"

                      Normally the verify process proceeds as follows.

                      Initially some sanity checks are performed on p7. The type of p7 must be SignedData. There must be at least one signature on the data and if the content is detached indata cannot be NULL. If the content is not detached and indata is not NULL then the structure has both embedded and external content. To treat this as an error, use the flag PKCS7_NO_DUAL_CONTENT. The default behavior allows this, for compatibility with older versions of OpenSSL.

                      An attempt is made to locate all the signer's certificates, first looking in the certs parameter (if it is not NULL). Then they are looked up in any certificates contained in the p7 structure unless PKCS7_NOINTERN is set. If any signer's certificates cannot be located the operation fails.

                      Each signer's certificate is chain verified using the smimesign purpose and using the trusted certificate store store if supplied. Any internal certificates in the message, which may have been added using PKCS7_add_certificate(3), are used as untrusted CAs unless PKCS7_NOCHAIN is set. If CRL checking is enabled in store and PKCS7_NOCRL is not set, any internal CRLs, which may have been added using PKCS7_add_crl(3), are used in addition to attempting to look them up in store. If store is not NULL and any chain verify fails an error code is returned.

                      Finally the signed content is read (and written to out unless it is NULL) and the signature is checked.

                      If all signatures verify correctly then the function is successful.

                      Any of the following flags (ored together) can be passed in the flags parameter to change the default verify behaviour. Only the flag PKCS7_NOINTERN is meaningful to PKCS7_get0_signers().

                      If PKCS7_NOINTERN is set the certificates in the message itself are not searched when locating the signer's certificates. This means that all the signer's certificates must be in the certs parameter.

                      If PKCS7_NOCRL is set and CRL checking is enabled in store then any CRLs in the message itself are ignored.

                      If the PKCS7_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                      If PKCS7_NOVERIFY is set the signer's certificates are not chain verified.

                      If PKCS7_NOCHAIN is set then the certificates contained in the message are not used as untrusted CAs. This means that the whole verify chain (apart from the signer's certificates) must be contained in the trusted store.

                      If PKCS7_NOSIGS is set then the signatures on the data are not checked.

                      "},{"location":"man3/PKCS7_verify/#notes","title":"NOTES","text":"

                      One application of PKCS7_NOINTERN is to only accept messages signed by a small number of certificates. The acceptable certificates would be passed in the certs parameter. In this case if the signer's certificate is not one of the certificates supplied in certs then the verify will fail because the signer cannot be found.

                      Care should be taken when modifying the default verify behaviour, for example setting PKCS7_NOVERIFY|PKCS7_NOSIGS will totally disable all verification and any signed message will be considered valid. This combination is however useful if one merely wishes to write the content to out and its validity is not considered important.

                      Chain verification should arguably be performed using the signing time rather than the current time. However, since the signing time is supplied by the signer it cannot be trusted without additional evidence (such as a trusted timestamp).

                      "},{"location":"man3/PKCS7_verify/#return-values","title":"RETURN VALUES","text":"

                      PKCS7_verify() returns 1 for a successful verification and 0 if an error occurs.

                      PKCS7_get0_signers() returns all signers or NULL if an error occurred.

                      The error can be obtained from ERR_get_error(3).

                      "},{"location":"man3/PKCS7_verify/#bugs","title":"BUGS","text":"

                      The trusted certificate store is not searched for the signer's certificates. This is primarily due to the inadequacies of the current X509_STORE functionality.

                      The lack of single pass processing means that the signed content must all be held in memory if it is not detached.

                      "},{"location":"man3/PKCS7_verify/#see-also","title":"SEE ALSO","text":"

                      CMS_verify(3), PKCS7_add_certificate(3), PKCS7_add_crl(3), ERR_get_error(3), PKCS7_sign(3)

                      "},{"location":"man3/PKCS7_verify/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS8_encrypt/","title":"PKCS8_encrypt","text":""},{"location":"man3/PKCS8_encrypt/#name","title":"NAME","text":"

                      PKCS8_decrypt, PKCS8_decrypt_ex, PKCS8_encrypt, PKCS8_encrypt_ex, PKCS8_set0_pbe, PKCS8_set0_pbe_ex - PKCS8 encrypt/decrypt functions

                      "},{"location":"man3/PKCS8_encrypt/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/x509.h>\n\nPKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass,\n                                   int passlen);\nPKCS8_PRIV_KEY_INFO *PKCS8_decrypt_ex(const X509_SIG *p8, const char *pass,\n                                      int passlen, OSSL_LIB_CTX *ctx,\n                                      const char *propq);\nX509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,\n                        const char *pass, int passlen, unsigned char *salt,\n                        int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8);\nX509_SIG *PKCS8_encrypt_ex(int pbe_nid, const EVP_CIPHER *cipher,\n                           const char *pass, int passlen, unsigned char *salt,\n                           int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8,\n                           OSSL_LIB_CTX *ctx, const char *propq);\nX509_SIG *PKCS8_set0_pbe(const char *pass, int passlen,\n                        PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe);\nX509_SIG *PKCS8_set0_pbe_ex(const char *pass, int passlen,\n                            PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe,\n                            OSSL_LIB_CTX *ctx);\n
                      "},{"location":"man3/PKCS8_encrypt/#description","title":"DESCRIPTION","text":"

                      PKCS8_encrypt() and PKCS8_encrypt_ex() perform encryption of an object p8 using the password pass of length passlen, salt salt of length saltlen and iteration count iter. The resulting X509_SIG contains the encoded algorithm parameters and encrypted key.

                      PKCS8_decrypt() and PKCS8_decrypt_ex() perform decryption of an X509_SIG in p8 using the password pass of length passlen along with algorithm parameters obtained from the p8.

                      PKCS8_set0_pbe() and PKCS8_set0_pbe_ex() perform encryption of the p8inf using the password pass of length passlen and parameters pbe.

                      Functions ending in _ex() allow for a library context ctx and property query propq to be used to select algorithm implementations.

                      "},{"location":"man3/PKCS8_encrypt/#return-values","title":"RETURN VALUES","text":"

                      PKCS8_encrypt(), PKCS8_encrypt_ex(), PKCS8_set0_pbe() and PKCS8_set0_pbe_ex() return an encrypted key in a X509_SIG structure or NULL if an error occurs.

                      PKCS8_decrypt() and PKCS8_decrypt_ex() return a PKCS8_PRIV_KEY_INFO or NULL if an error occurs.

                      "},{"location":"man3/PKCS8_encrypt/#conforming-to","title":"CONFORMING TO","text":"

                      IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                      "},{"location":"man3/PKCS8_encrypt/#see-also","title":"SEE ALSO","text":"

                      crypto(7)

                      "},{"location":"man3/PKCS8_encrypt/#history","title":"HISTORY","text":"

                      PKCS8_decrypt_ex(), PKCS8_encrypt_ex() and PKCS8_set0_pbe_ex() were added in OpenSSL 3.0.

                      "},{"location":"man3/PKCS8_encrypt/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/PKCS8_pkey_add1_attr/","title":"PKCS8_pkey_add1_attr","text":""},{"location":"man3/PKCS8_pkey_add1_attr/#name","title":"NAME","text":"

                      PKCS8_pkey_get0_attrs, PKCS8_pkey_add1_attr, PKCS8_pkey_add1_attr_by_NID, PKCS8_pkey_add1_attr_by_OBJ - PKCS8 attribute functions

                      "},{"location":"man3/PKCS8_pkey_add1_attr/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/x509.h>\n\nconst STACK_OF(X509_ATTRIBUTE) *\nPKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8);\nint PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr);\nint PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type,\n                                const unsigned char *bytes, int len);\nint PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj,\n                               int type, const unsigned char *bytes, int len);\n
                      "},{"location":"man3/PKCS8_pkey_add1_attr/#description","title":"DESCRIPTION","text":"

                      PKCS8_pkey_get0_attrs() returns a const STACK of X509_ATTRIBUTE present in the passed const PKCS8_PRIV_KEY_INFO structure p8.

                      PKCS8_pkey_add1_attr() adds a constructed X509_ATTRIBUTE attr to the existing PKCS8_PRIV_KEY_INFO structure p8.

                      PKCS8_pkey_add1_attr_by_NID() and PKCS8_pkey_add1_attr_by_OBJ() construct a new X509_ATTRIBUTE from the passed arguments and add it to the existing PKCS8_PRIV_KEY_INFO structure p8.

                      "},{"location":"man3/PKCS8_pkey_add1_attr/#return-values","title":"RETURN VALUES","text":"

                      PKCS8_pkey_add1_attr(), PKCS8_pkey_add1_attr_by_NID(), and PKCS8_pkey_add1_attr_by_OBJ() return 1 for success and 0 for failure.

                      "},{"location":"man3/PKCS8_pkey_add1_attr/#notes","title":"NOTES","text":"

                      STACK of X509_ATTRIBUTE is present in many X509-related structures and some of them have the corresponding set of similar functions.

                      "},{"location":"man3/PKCS8_pkey_add1_attr/#see-also","title":"SEE ALSO","text":"

                      crypto(7)

                      "},{"location":"man3/PKCS8_pkey_add1_attr/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_add/","title":"RAND_add","text":""},{"location":"man3/RAND_add/#name","title":"NAME","text":"

                      RAND_add, RAND_poll, RAND_seed, RAND_status, RAND_event, RAND_screen, RAND_keep_random_devices_open - add randomness to the PRNG or get its status

                      "},{"location":"man3/RAND_add/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n\nint RAND_status(void);\nint RAND_poll();\n\nvoid RAND_add(const void *buf, int num, double randomness);\nvoid RAND_seed(const void *buf, int num);\n\nvoid RAND_keep_random_devices_open(int keep);\n

                      The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);\nvoid RAND_screen(void);\n
                      "},{"location":"man3/RAND_add/#description","title":"DESCRIPTION","text":"

                      These functions can be used to seed the random generator and to check its seeded state. In general, manual (re-)seeding of the default OpenSSL random generator (RAND_OpenSSL(3)) is not necessary (but allowed), since it does (re-)seed itself automatically using trusted system entropy sources. This holds unless the default RAND_METHOD has been replaced or OpenSSL was built with automatic reseeding disabled, see RAND(7) for more details.

                      RAND_status() indicates whether or not the random generator has been sufficiently seeded. If not, functions such as RAND_bytes(3) will fail.

                      RAND_poll() uses the system's capabilities to seed the random generator using random input obtained from polling various trusted entropy sources. The default choice of the entropy source can be modified at build time, see RAND(7) for more details.

                      RAND_add() mixes the num bytes at buf into the internal state of the random generator. This function will not normally be needed, as mentioned above. The randomness argument is an estimate of how much randomness is contained in buf, in bytes, and should be a number between zero and num. Details about sources of randomness and how to estimate their randomness can be found in the literature; for example [NIST SP 800-90B]. The content of buf cannot be recovered from subsequent random generator output. Applications that intend to save and restore random state in an external file should consider using RAND_load_file(3) instead.

                      NOTE: In FIPS mode, random data provided by the application is not considered to be a trusted entropy source. It is mixed into the internal state of the RNG as additional data only and this does not count as a full reseed. For more details, see EVP_RAND(7).

                      RAND_seed() is equivalent to RAND_add() with randomness set to num.

                      RAND_keep_random_devices_open() is used to control file descriptor usage by the random seed sources. Some seed sources maintain open file descriptors by default, which allows such sources to operate in a chroot(2) jail without the associated device nodes being available. When the keep argument is zero, this call disables the retention of file descriptors. Conversely, a nonzero argument enables the retention of file descriptors. This function is usually called during initialization and it takes effect immediately. This capability only applies to the default provider.

                      RAND_event() and RAND_screen() are equivalent to RAND_poll() and exist for compatibility reasons only. See HISTORY section below.

                      "},{"location":"man3/RAND_add/#return-values","title":"RETURN VALUES","text":"

                      RAND_status() returns 1 if the random generator has been seeded with enough data, 0 otherwise.

                      RAND_poll() returns 1 if it generated seed data, 0 otherwise.

                      RAND_event() returns RAND_status().

                      The other functions do not return values.

                      "},{"location":"man3/RAND_add/#see-also","title":"SEE ALSO","text":"

                      RAND_bytes(3), RAND_egd(3), RAND_load_file(3), RAND(7) EVP_RAND(7)

                      "},{"location":"man3/RAND_add/#history","title":"HISTORY","text":"

                      RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should not be used.

                      "},{"location":"man3/RAND_add/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_bytes/","title":"RAND_bytes","text":""},{"location":"man3/RAND_bytes/#name","title":"NAME","text":"

                      RAND_bytes, RAND_priv_bytes, RAND_bytes_ex, RAND_priv_bytes_ex, RAND_pseudo_bytes - generate random data

                      "},{"location":"man3/RAND_bytes/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n\nint RAND_bytes(unsigned char *buf, int num);\nint RAND_priv_bytes(unsigned char *buf, int num);\n\nint RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,\n                  unsigned int strength);\nint RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,\n                       unsigned int strength);\n

                      The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RAND_pseudo_bytes(unsigned char *buf, int num);\n
                      "},{"location":"man3/RAND_bytes/#description","title":"DESCRIPTION","text":"

                      RAND_bytes() generates num random bytes using a cryptographically secure pseudo random generator (CSPRNG) and stores them in buf.

                      RAND_priv_bytes() has the same semantics as RAND_bytes(). It is intended to be used for generating values that should remain private. If using the default RAND_METHOD, this function uses a separate \"private\" PRNG instance so that a compromise of the \"public\" PRNG instance will not affect the secrecy of these private values, as described in RAND(7) and EVP_RAND(7).

                      RAND_bytes_ex() and RAND_priv_bytes_ex() are the same as RAND_bytes() and RAND_priv_bytes() except that they both take additional strength and ctx parameters. The bytes generated will have a security strength of at least strength bits. The DRBG used for the operation is the public or private DRBG associated with the specified ctx. The parameter can be NULL, in which case the default library context is used (see OSSL_LIB_CTX(3). If the default RAND_METHOD has been changed then for compatibility reasons the RAND_METHOD will be used in preference and the DRBG of the library context ignored.

                      "},{"location":"man3/RAND_bytes/#notes","title":"NOTES","text":"

                      By default, the OpenSSL CSPRNG supports a security level of 256 bits, provided it was able to seed itself from a trusted entropy source. On all major platforms supported by OpenSSL (including the Unix-like platforms and Windows), OpenSSL is configured to automatically seed the CSPRNG on first use using the operating systems's random generator.

                      If the entropy source fails or is not available, the CSPRNG will enter an error state and refuse to generate random bytes. For that reason, it is important to always check the error return value of RAND_bytes() and RAND_priv_bytes() and not take randomness for granted.

                      On other platforms, there might not be a trusted entropy source available or OpenSSL might have been explicitly configured to use different entropy sources. If you are in doubt about the quality of the entropy source, don't hesitate to ask your operating system vendor or post a question on GitHub or the openssl-users mailing list.

                      "},{"location":"man3/RAND_bytes/#return-values","title":"RETURN VALUES","text":"

                      RAND_bytes() and RAND_priv_bytes() return 1 on success, -1 if not supported by the current RAND method, or 0 on other failure. The error code can be obtained by ERR_get_error(3).

                      "},{"location":"man3/RAND_bytes/#see-also","title":"SEE ALSO","text":"

                      RAND_add(3), RAND_bytes(3), RAND_priv_bytes(3), ERR_get_error(3), RAND(7), EVP_RAND(7)

                      "},{"location":"man3/RAND_bytes/#history","title":"HISTORY","text":"
                      • RAND_pseudo_bytes() was deprecated in OpenSSL 1.1.0; use RAND_bytes() instead.
                      • The RAND_priv_bytes() function was added in OpenSSL 1.1.1.
                      • The RAND_bytes_ex() and RAND_priv_bytes_ex() functions were added in OpenSSL 3.0
                      "},{"location":"man3/RAND_bytes/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_cleanup/","title":"RAND_cleanup","text":""},{"location":"man3/RAND_cleanup/#name","title":"NAME","text":"

                      RAND_cleanup - erase the PRNG state

                      "},{"location":"man3/RAND_cleanup/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n

                      The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      void RAND_cleanup(void);\n
                      "},{"location":"man3/RAND_cleanup/#description","title":"DESCRIPTION","text":"

                      Prior to OpenSSL 1.1.0, RAND_cleanup() released all resources used by the PRNG. As of version 1.1.0, it does nothing and should not be called, since no explicit initialisation or de-initialisation is necessary. See OPENSSL_init_crypto(3).

                      "},{"location":"man3/RAND_cleanup/#return-values","title":"RETURN VALUES","text":"

                      RAND_cleanup() returns no value.

                      "},{"location":"man3/RAND_cleanup/#see-also","title":"SEE ALSO","text":"

                      RAND(7)

                      "},{"location":"man3/RAND_cleanup/#history","title":"HISTORY","text":"

                      RAND_cleanup() was deprecated in OpenSSL 1.1.0; do not use it. See OPENSSL_init_crypto(3)

                      "},{"location":"man3/RAND_cleanup/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_egd/","title":"RAND_egd","text":""},{"location":"man3/RAND_egd/#name","title":"NAME","text":"

                      RAND_egd, RAND_egd_bytes, RAND_query_egd_bytes - query entropy gathering daemon

                      "},{"location":"man3/RAND_egd/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n\nint RAND_egd_bytes(const char *path, int num);\nint RAND_egd(const char *path);\n\nint RAND_query_egd_bytes(const char *path, unsigned char *buf, int num);\n
                      "},{"location":"man3/RAND_egd/#description","title":"DESCRIPTION","text":"

                      On older platforms without a good source of randomness such as /dev/urandom, it is possible to query an Entropy Gathering Daemon (EGD) over a local socket to obtain randomness and seed the OpenSSL RNG. The protocol used is defined by the EGDs available at http://egd.sourceforge.net/ or http://prngd.sourceforge.net.

                      RAND_egd_bytes() requests num bytes of randomness from an EGD at the specified socket path, and passes the data it receives into RAND_add(). RAND_egd() is equivalent to RAND_egd_bytes() with num set to 255.

                      RAND_query_egd_bytes() requests num bytes of randomness from an EGD at the specified socket path, where num must be less than 256. If buf is NULL, it is equivalent to RAND_egd_bytes(). If buf is not NULL, then the data is copied to the buffer and RAND_add() is not called.

                      OpenSSL can be configured at build time to try to use the EGD for seeding automatically.

                      "},{"location":"man3/RAND_egd/#return-values","title":"RETURN VALUES","text":"

                      RAND_egd() and RAND_egd_bytes() return the number of bytes read from the daemon on success, or -1 if the connection failed or the daemon did not return enough data to fully seed the PRNG.

                      RAND_query_egd_bytes() returns the number of bytes read from the daemon on success, or -1 if the connection failed.

                      "},{"location":"man3/RAND_egd/#see-also","title":"SEE ALSO","text":"

                      RAND_add(3), RAND_bytes(3), RAND(7)

                      "},{"location":"man3/RAND_egd/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_get0_primary/","title":"RAND_get0_primary","text":""},{"location":"man3/RAND_get0_primary/#name","title":"NAME","text":"

                      RAND_get0_primary, RAND_get0_public, RAND_get0_private, RAND_set0_public, RAND_set0_private - get access to the global EVP_RAND_CTX instances

                      "},{"location":"man3/RAND_get0_primary/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n\nEVP_RAND_CTX *RAND_get0_primary(OSSL_LIB_CTX *ctx);\nEVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx);\nEVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx);\nint RAND_set0_public(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand);\nint RAND_set0_private(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand);\n
                      "},{"location":"man3/RAND_get0_primary/#description","title":"DESCRIPTION","text":"

                      The default RAND API implementation (RAND_OpenSSL()) utilizes three shared DRBG instances which are accessed via the RAND API:

                      The public and private DRBG are thread-local instances, which are used by RAND_bytes() and RAND_priv_bytes(), respectively. The primary DRBG is a global instance, which is not intended to be used directly, but is used internally to reseed the other two instances.

                      The three get functions provide access to the shared DRBG instances.

                      The two set functions allow the public and private DRBG instances to be replaced by another random number generator.

                      "},{"location":"man3/RAND_get0_primary/#return-values","title":"RETURN VALUES","text":"

                      RAND_get0_primary() returns a pointer to the primary DRBG instance for the given OSSL_LIB_CTX ctx.

                      RAND_get0_public() returns a pointer to the public DRBG instance for the given OSSL_LIB_CTX ctx.

                      RAND_get0_private() returns a pointer to the private DRBG instance for the given OSSL_LIB_CTX ctx.

                      RAND_set0_public() and RAND_set0_private() return 1 on success and 0 on error.

                      "},{"location":"man3/RAND_get0_primary/#notes","title":"NOTES","text":"

                      It is not thread-safe to access the primary DRBG instance. The public and private DRBG instance can be accessed safely, because they are thread-local. Note however, that changes to these two instances apply only to the current thread.

                      For that reason it is recommended not to change the settings of these three instances directly. Instead, an application should change the default settings for new DRBG instances at initialization time, before creating additional threads.

                      During initialization, it is possible to change the reseed interval and reseed time interval. It is also possible to exchange the reseeding callbacks entirely.

                      To set the type of DRBG that will be instantiated, use the RAND_set_DRBG_type(3) call before accessing the random number generation infrastructure.

                      The two set functions, operate on the the current thread. If you want to use the same random number generator across all threads, each thread must individually call the set functions.

                      "},{"location":"man3/RAND_get0_primary/#see-also","title":"SEE ALSO","text":"

                      EVP_RAND(3), RAND_set_DRBG_type(3)

                      "},{"location":"man3/RAND_get0_primary/#history","title":"HISTORY","text":"

                      RAND_set0_public() and RAND_set0_private() were added in OpenSSL 3.1.

                      The remaining functions were added in OpenSSL 3.0.

                      "},{"location":"man3/RAND_get0_primary/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_load_file/","title":"RAND_load_file","text":""},{"location":"man3/RAND_load_file/#name","title":"NAME","text":"

                      RAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file

                      "},{"location":"man3/RAND_load_file/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n\nint RAND_load_file(const char *filename, long max_bytes);\n\nint RAND_write_file(const char *filename);\n\nconst char *RAND_file_name(char *buf, size_t num);\n
                      "},{"location":"man3/RAND_load_file/#description","title":"DESCRIPTION","text":"

                      RAND_load_file() reads a number of bytes from file filename and adds them to the PRNG. If max_bytes is nonnegative, up to max_bytes are read; if max_bytes is -1, the complete file is read. Do not load the same file multiple times unless its contents have been updated by RAND_write_file() between reads. Also, note that filename should be adequately protected so that an attacker cannot replace or examine the contents. If filename is not a regular file, then user is considered to be responsible for any side effects, e.g. non-anticipated blocking or capture of controlling terminal.

                      RAND_write_file() writes a number of random bytes (currently 128) to file filename which can be used to initialize the PRNG by calling RAND_load_file() in a later session.

                      RAND_file_name() generates a default path for the random seed file. buf points to a buffer of size num in which to store the filename.

                      On all systems, if the environment variable RANDFILE is set, its value will be used as the seed filename. Otherwise, the file is called .rnd, found in platform dependent locations:

                      • On Windows (in order of preference)

                        %HOME%, %USERPROFILE%, %SYSTEMROOT%, C:\\\n
                      • On VMS

                        SYS$LOGIN:\n
                      • On all other systems

                        $HOME\n

                      If $HOME (on non-Windows and non-VMS system) is not set either, or num is too small for the pathname, an error occurs.

                      "},{"location":"man3/RAND_load_file/#return-values","title":"RETURN VALUES","text":"

                      RAND_load_file() returns the number of bytes read or -1 on error.

                      RAND_write_file() returns the number of bytes written, or -1 if the bytes written were generated without appropriate seeding.

                      RAND_file_name() returns a pointer to buf on success, and NULL on error.

                      "},{"location":"man3/RAND_load_file/#see-also","title":"SEE ALSO","text":"

                      RAND_add(3), RAND_bytes(3), RAND(7)

                      "},{"location":"man3/RAND_load_file/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_set_DRBG_type/","title":"RAND_set_DRBG_type","text":""},{"location":"man3/RAND_set_DRBG_type/#name","title":"NAME","text":"

                      RAND_set_DRBG_type, RAND_set_seed_source_type - specify the global random number generator types

                      "},{"location":"man3/RAND_set_DRBG_type/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n\nint RAND_set_DRBG_type(OSSL_LIB_CTX *ctx, const char *drbg, const char *propq,\n                       const char *cipher, const char *digest);\nint RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed,\n                              const char *propq);\n
                      "},{"location":"man3/RAND_set_DRBG_type/#description","title":"DESCRIPTION","text":"

                      RAND_set_DRBG_type() specifies the random bit generator that will be used within the library context ctx. A generator of name drbg with properties propq will be fetched. It will be instantiated with either cipher or digest as its underlying cryptographic algorithm. This specifies the type that will be used for the primary, public and private random instances.

                      RAND_set_seed_source_type() specifies the seed source that will be used within the library context ctx. The seed source of name seed with properties propq will be fetched and used to seed the primary random big generator.

                      "},{"location":"man3/RAND_set_DRBG_type/#return-values","title":"RETURN VALUES","text":"

                      These function return 1 on success and 0 on failure.

                      "},{"location":"man3/RAND_set_DRBG_type/#notes","title":"NOTES","text":"

                      These functions must be called before the random bit generators are first created in the library context. They will return an error if the call is made too late.

                      The default DRBG is \"CTR-DRBG\" using the \"AES-256-CTR\" cipher.

                      The default seed source is \"SEED-SRC\".

                      "},{"location":"man3/RAND_set_DRBG_type/#see-also","title":"SEE ALSO","text":"

                      EVP_RAND(3), RAND_get0_primary(3)

                      "},{"location":"man3/RAND_set_DRBG_type/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 3.0.

                      "},{"location":"man3/RAND_set_DRBG_type/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RAND_set_rand_method/","title":"RAND_set_rand_method","text":""},{"location":"man3/RAND_set_rand_method/#name","title":"NAME","text":"

                      RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method

                      "},{"location":"man3/RAND_set_rand_method/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rand.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      RAND_METHOD *RAND_OpenSSL(void);\n\nint RAND_set_rand_method(const RAND_METHOD *meth);\n\nconst RAND_METHOD *RAND_get_rand_method(void);\n
                      "},{"location":"man3/RAND_set_rand_method/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use RAND_set_DRBG_type(3), EVP_RAND(3) and EVP_RAND(7).

                      A RAND_METHOD specifies the functions that OpenSSL uses for random number generation.

                      RAND_OpenSSL() returns the default RAND_METHOD implementation by OpenSSL. This implementation ensures that the PRNG state is unique for each thread.

                      If an ENGINE is loaded that provides the RAND API, however, it will be used instead of the method returned by RAND_OpenSSL(). This is deprecated in OpenSSL 3.0.

                      RAND_set_rand_method() makes meth the method for PRNG use. If an ENGINE was providing the method, it will be released first.

                      RAND_get_rand_method() returns a pointer to the current RAND_METHOD.

                      "},{"location":"man3/RAND_set_rand_method/#the-rand_method-structure","title":"THE RAND_METHOD STRUCTURE","text":"
                      typedef struct rand_meth_st {\n    int (*seed)(const void *buf, int num);\n    int (*bytes)(unsigned char *buf, int num);\n    void (*cleanup)(void);\n    int (*add)(const void *buf, int num, double entropy);\n    int (*pseudorand)(unsigned char *buf, int num);\n    int (*status)(void);\n} RAND_METHOD;\n

                      The fields point to functions that are used by, in order, RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand() and RAND_status(). Each pointer may be NULL if the function is not implemented.

                      "},{"location":"man3/RAND_set_rand_method/#return-values","title":"RETURN VALUES","text":"

                      RAND_set_rand_method() returns 1 on success and 0 on failure. RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective methods.

                      "},{"location":"man3/RAND_set_rand_method/#see-also","title":"SEE ALSO","text":"

                      EVP_RAND(3), RAND_set_DRBG_type(3), RAND_bytes(3), ENGINE_by_id(3), EVP_RAND(7), RAND(7)

                      "},{"location":"man3/RAND_set_rand_method/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RAND_set_rand_method/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RC4_set_key/","title":"RC4_set_key","text":""},{"location":"man3/RC4_set_key/#name","title":"NAME","text":"

                      RC4_set_key, RC4 - RC4 encryption

                      "},{"location":"man3/RC4_set_key/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rc4.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);\n\nvoid RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,\n         unsigned char *outdata);\n
                      "},{"location":"man3/RC4_set_key/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) or the equivalently named decrypt functions.

                      This library implements the Alleged RC4 cipher, which is described for example in Applied Cryptography. It is believed to be compatible with RC4[TM], a proprietary cipher of RSA Security Inc.

                      RC4 is a stream cipher with variable key length. Typically, 128 bit (16 byte) keys are used for strong encryption, but shorter insecure key sizes have been widely used due to export restrictions.

                      RC4 consists of a key setup phase and the actual encryption or decryption phase.

                      RC4_set_key() sets up the RC4_KEY key using the len bytes long key at data.

                      RC4() encrypts or decrypts the len bytes of data at indata using key and places the result at outdata. Repeated RC4() calls with the same key yield a continuous key stream.

                      Since RC4 is a stream cipher (the input is XORed with a pseudo-random key stream to produce the output), decryption uses the same function calls as encryption.

                      "},{"location":"man3/RC4_set_key/#return-values","title":"RETURN VALUES","text":"

                      RC4_set_key() and RC4() do not return values.

                      "},{"location":"man3/RC4_set_key/#note","title":"NOTE","text":"

                      Applications should use the higher level functions EVP_EncryptInit(3) etc. instead of calling these functions directly.

                      It is difficult to securely use stream ciphers. For example, do not perform multiple encryptions using the same key stream.

                      "},{"location":"man3/RC4_set_key/#see-also","title":"SEE ALSO","text":"

                      EVP_EncryptInit(3)

                      "},{"location":"man3/RC4_set_key/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RC4_set_key/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RIPEMD160_Init/","title":"RIPEMD160_Init","text":""},{"location":"man3/RIPEMD160_Init/#name","title":"NAME","text":"

                      RIPEMD160, RIPEMD160_Init, RIPEMD160_Update, RIPEMD160_Final - RIPEMD-160 hash function

                      "},{"location":"man3/RIPEMD160_Init/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ripemd.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,\n                         unsigned char *md);\n\nint RIPEMD160_Init(RIPEMD160_CTX *c);\nint RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len);\nint RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);\n
                      "},{"location":"man3/RIPEMD160_Init/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3).

                      RIPEMD-160 is a cryptographic hash function with a 160 bit output.

                      RIPEMD160() computes the RIPEMD-160 message digest of the n bytes at d and places it in md (which must have space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array.

                      The following functions may be used if the message is not completely stored in memory:

                      RIPEMD160_Init() initializes a RIPEMD160_CTX structure.

                      RIPEMD160_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

                      RIPEMD160_Final() places the message digest in md, which must have space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output, and erases the RIPEMD160_CTX.

                      "},{"location":"man3/RIPEMD160_Init/#return-values","title":"RETURN VALUES","text":"

                      RIPEMD160() returns a pointer to the hash value.

                      RIPEMD160_Init(), RIPEMD160_Update() and RIPEMD160_Final() return 1 for success, 0 otherwise.

                      "},{"location":"man3/RIPEMD160_Init/#note","title":"NOTE","text":"

                      Applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling these functions directly.

                      "},{"location":"man3/RIPEMD160_Init/#conforming-to","title":"CONFORMING TO","text":"

                      ISO/IEC 10118-3:2016 Dedicated Hash-Function 1 (RIPEMD-160).

                      "},{"location":"man3/RIPEMD160_Init/#see-also","title":"SEE ALSO","text":"

                      EVP_DigestInit(3)

                      "},{"location":"man3/RIPEMD160_Init/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RIPEMD160_Init/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_blinding_on/","title":"RSA_blinding_on","text":""},{"location":"man3/RSA_blinding_on/#name","title":"NAME","text":"

                      RSA_blinding_on, RSA_blinding_off - protect the RSA operation from timing attacks

                      "},{"location":"man3/RSA_blinding_on/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);\n\nvoid RSA_blinding_off(RSA *rsa);\n
                      "},{"location":"man3/RSA_blinding_on/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated.

                      RSA is vulnerable to timing attacks. In a setup where attackers can measure the time of RSA decryption or signature operations, blinding must be used to protect the RSA operation from that attack.

                      RSA_blinding_on() turns blinding on for key rsa and generates a random blinding factor. ctx is NULL or a preallocated and initialized BN_CTX.

                      RSA_blinding_off() turns blinding off and frees the memory used for the blinding factor.

                      "},{"location":"man3/RSA_blinding_on/#return-values","title":"RETURN VALUES","text":"

                      RSA_blinding_on() returns 1 on success, and 0 if an error occurred.

                      RSA_blinding_off() returns no value.

                      "},{"location":"man3/RSA_blinding_on/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_blinding_on/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_check_key/","title":"RSA_check_key","text":""},{"location":"man3/RSA_check_key/#name","title":"NAME","text":"

                      RSA_check_key_ex, RSA_check_key - validate private RSA keys

                      "},{"location":"man3/RSA_check_key/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_check_key_ex(const RSA *rsa, BN_GENCB *cb);\n\nint RSA_check_key(const RSA *rsa);\n
                      "},{"location":"man3/RSA_check_key/#description","title":"DESCRIPTION","text":"

                      Both of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_public_check(3), EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3).

                      RSA_check_key_ex() function validates RSA keys. It checks that p and q are in fact prime, and that n = p*q.

                      It does not work on RSA public keys that have only the modulus and public exponent elements populated. It also checks that d*e = 1 mod (p-1*q-1), and that dmp1, dmq1 and iqmp are set correctly or are NULL. It performs integrity checks on all the RSA key material, so the RSA key structure must contain all the private key data too. Therefore, it cannot be used with any arbitrary RSA key object, even if it is otherwise fit for regular RSA operation.

                      The cb parameter is a callback that will be invoked in the same manner as BN_is_prime_ex(3).

                      RSA_check_key() is equivalent to RSA_check_key_ex() with a NULL cb.

                      "},{"location":"man3/RSA_check_key/#return-values","title":"RETURN VALUES","text":"

                      RSA_check_key_ex() and RSA_check_key() return 1 if rsa is a valid RSA key, and 0 otherwise. They return -1 if an error occurs while checking the key.

                      If the key is invalid or an error occurred, the reason code can be obtained using ERR_get_error(3).

                      "},{"location":"man3/RSA_check_key/#notes","title":"NOTES","text":"

                      Unlike most other RSA functions, this function does not work transparently with any underlying ENGINE implementation because it uses the key data in the RSA structure directly. An ENGINE implementation can override the way key data is stored and handled, and can even provide support for HSM keys - in which case the RSA structure may contain no key data at all! If the ENGINE in question is only being used for acceleration or analysis purposes, then in all likelihood the RSA key data is complete and untouched, but this can't be assumed in the general case.

                      "},{"location":"man3/RSA_check_key/#bugs","title":"BUGS","text":"

                      A method of verifying the RSA key using opaque RSA API functions might need to be considered. Right now RSA_check_key() simply uses the RSA structure elements directly, bypassing the RSA_METHOD table altogether (and completely violating encapsulation and object-orientation in the process). The best fix will probably be to introduce a \"check_key()\" handler to the RSA_METHOD function table so that alternative implementations can also provide their own verifiers.

                      "},{"location":"man3/RSA_check_key/#see-also","title":"SEE ALSO","text":"

                      BN_is_prime_ex(3), ERR_get_error(3)

                      "},{"location":"man3/RSA_check_key/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      RSA_check_key_ex() appeared after OpenSSL 1.0.2.

                      "},{"location":"man3/RSA_check_key/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_generate_key/","title":"RSA_generate_key","text":""},{"location":"man3/RSA_generate_key/#name","title":"NAME","text":"

                      EVP_RSA_gen, RSA_generate_key_ex, RSA_generate_key, RSA_generate_multi_prime_key - generate RSA key pair

                      "},{"location":"man3/RSA_generate_key/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n\nEVP_PKEY *EVP_RSA_gen(unsigned int bits);\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\nint RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb);\n

                      The following function has been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      RSA *RSA_generate_key(int bits, unsigned long e,\n                      void (*callback)(int, int, void *), void *cb_arg);\n
                      "},{"location":"man3/RSA_generate_key/#description","title":"DESCRIPTION","text":"

                      EVP_RSA_gen() generates a new RSA key pair with modulus size bits.

                      All of the functions described below are deprecated. Applications should instead use EVP_RSA_gen(), EVP_PKEY_Q_keygen(3), or EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3).

                      RSA_generate_key_ex() generates a 2-prime RSA key pair and stores it in the RSA structure provided in rsa.

                      RSA_generate_multi_prime_key() generates a multi-prime RSA key pair and stores it in the RSA structure provided in rsa. The number of primes is given by the primes parameter. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                      The modulus size will be of length bits, the number of primes to form the modulus will be primes, and the public exponent will be e. Key sizes with num < 1024 should be considered insecure. The exponent is an odd number, typically 3, 17 or 65537.

                      In order to maintain adequate security level, the maximum number of permitted primes depends on modulus bit length:

                      <1024 | >=1024 | >=4096 | >=8192\n------+--------+--------+-------\n  2   |   3    |   4    |   5\n

                      A callback function may be used to provide feedback about the progress of the key generation. If cb is not NULL, it will be called as follows using the BN_GENCB_call() function described on the BN_generate_prime(3) page.

                      RSA_generate_key() is similar to RSA_generate_key_ex() but expects an old-style callback function; see BN_generate_prime(3) for information on the old-style callback.

                      • While a random prime number is generated, it is called as described in BN_generate_prime(3).
                      • When the n-th randomly generated prime is rejected as not suitable for the key, BN_GENCB_call(cb, 2, n) is called.
                      • When a random p has been found with p-1 relatively prime to e, it is called as BN_GENCB_call(cb, 3, 0).

                      The process is then repeated for prime q and other primes (if any) with BN_GENCB_call(cb, 3, i) where i indicates the i-th prime.

                      "},{"location":"man3/RSA_generate_key/#return-values","title":"RETURN VALUES","text":"

                      EVP_RSA_gen() returns an EVP_PKEY or NULL on failure.

                      RSA_generate_multi_prime_key() returns 1 on success or 0 on error. RSA_generate_key_ex() returns 1 on success or 0 on error. The error codes can be obtained by ERR_get_error(3).

                      RSA_generate_key() returns a pointer to the RSA structure or NULL if the key generation fails.

                      "},{"location":"man3/RSA_generate_key/#bugs","title":"BUGS","text":"

                      BN_GENCB_call(cb, 2, x) is used with two different meanings.

                      "},{"location":"man3/RSA_generate_key/#see-also","title":"SEE ALSO","text":"

                      EVP_PKEY_Q_keygen(3) BN_generate_prime(3), ERR_get_error(3), RAND_bytes(3), RAND(7)

                      "},{"location":"man3/RSA_generate_key/#history","title":"HISTORY","text":"

                      EVP_RSA_gen() was added in OpenSSL 3.0. All other functions described here were deprecated in OpenSSL 3.0. For replacement see EVP_PKEY-RSA(7).

                      "},{"location":"man3/RSA_generate_key/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_get0_key/","title":"RSA_get0_key","text":""},{"location":"man3/RSA_get0_key/#name","title":"NAME","text":"

                      RSA_set0_key, RSA_set0_factors, RSA_set0_crt_params, RSA_get0_key, RSA_get0_factors, RSA_get0_crt_params, RSA_get0_n, RSA_get0_e, RSA_get0_d, RSA_get0_p, RSA_get0_q, RSA_get0_dmp1, RSA_get0_dmq1, RSA_get0_iqmp, RSA_get0_pss_params, RSA_clear_flags, RSA_test_flags, RSA_set_flags, RSA_get0_engine, RSA_get_multi_prime_extra_count, RSA_get0_multi_prime_factors, RSA_get0_multi_prime_crt_params, RSA_set0_multi_prime_params, RSA_get_version - Routines for getting and setting data in an RSA object

                      "},{"location":"man3/RSA_get0_key/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);\nint RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);\nint RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);\nvoid RSA_get0_key(const RSA *r,\n                  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);\nvoid RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);\nvoid RSA_get0_crt_params(const RSA *r,\n                         const BIGNUM **dmp1, const BIGNUM **dmq1,\n                         const BIGNUM **iqmp);\nconst BIGNUM *RSA_get0_n(const RSA *d);\nconst BIGNUM *RSA_get0_e(const RSA *d);\nconst BIGNUM *RSA_get0_d(const RSA *d);\nconst BIGNUM *RSA_get0_p(const RSA *d);\nconst BIGNUM *RSA_get0_q(const RSA *d);\nconst BIGNUM *RSA_get0_dmp1(const RSA *r);\nconst BIGNUM *RSA_get0_dmq1(const RSA *r);\nconst BIGNUM *RSA_get0_iqmp(const RSA *r);\nconst RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r);\nvoid RSA_clear_flags(RSA *r, int flags);\nint RSA_test_flags(const RSA *r, int flags);\nvoid RSA_set_flags(RSA *r, int flags);\nENGINE *RSA_get0_engine(RSA *r);\nint RSA_get_multi_prime_extra_count(const RSA *r);\nint RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]);\nint RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[],\n                                    const BIGNUM *coeffs[]);\nint RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[],\n                               BIGNUM *coeffs[], int pnum);\nint RSA_get_version(RSA *r);\n
                      "},{"location":"man3/RSA_get0_key/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bn_param(3) for any methods that return a BIGNUM. Refer to EVP_PKEY-DH(7) for more information.

                      An RSA object contains the components for the public and private key, n, e, d, p, q, dmp1, dmq1 and iqmp. n is the modulus common to both public and private key, e is the public exponent and d is the private exponent. p, q, dmp1, dmq1 and iqmp are the factors for the second representation of a private key (see PKCS#1 section 3 Key Types), where p and q are the first and second factor of n and dmp1, dmq1 and iqmp are the exponents and coefficient for CRT calculations.

                      For multi-prime RSA (defined in RFC 8017), there are also one or more 'triplet' in an RSA object. A triplet contains three members, r, d and t. r is the additional prime besides p and q. d and t are the exponent and coefficient for CRT calculations.

                      The n, e and d parameters can be obtained by calling RSA_get0_key(). If they have not been set yet, then *n, *e and *d will be set to NULL. Otherwise, they are set to pointers to their respective values. These point directly to the internal representations of the values and therefore should not be freed by the caller.

                      The n, e and d parameter values can be set by calling RSA_set0_key() and passing the new values for n, e and d as parameters to the function. The values n and e must be non-NULL the first time this function is called on a given RSA object. The value d may be NULL. On subsequent calls any of these values may be NULL which means the corresponding RSA field is left untouched. Calling this function transfers the memory management of the values to the RSA object, and therefore the values that have been passed in should not be freed by the caller after this function has been called.

                      In a similar fashion, the p and q parameters can be obtained and set with RSA_get0_factors() and RSA_set0_factors(), and the dmp1, dmq1 and iqmp parameters can be obtained and set with RSA_get0_crt_params() and RSA_set0_crt_params().

                      For RSA_get0_key(), RSA_get0_factors(), and RSA_get0_crt_params(), NULL value BIGNUM ** output parameters are permitted. The functions ignore NULL parameters but return values for other, non-NULL, parameters.

                      For multi-prime RSA, RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_params() can be used to obtain other primes and related CRT parameters. The return values are stored in an array of BIGNUM *. RSA_set0_multi_prime_params() sets a collect of multi-prime 'triplet' members (prime, exponent and coefficient) into an RSA object.

                      Any of the values n, e, d, p, q, dmp1, dmq1, and iqmp can also be retrieved separately by the corresponding function RSA_get0_n(), RSA_get0_e(), RSA_get0_d(), RSA_get0_p(), RSA_get0_q(), RSA_get0_dmp1(), RSA_get0_dmq1(), and RSA_get0_iqmp(), respectively.

                      RSA_get0_pss_params() is used to retrieve the RSA-PSS parameters.

                      RSA_set_flags() sets the flags in the flags parameter on the RSA object. Multiple flags can be passed in one go (bitwise ORed together). Any flags that are already set are left set. RSA_test_flags() tests to see whether the flags passed in the flags parameter are currently set in the RSA object. Multiple flags can be tested in one go. All flags that are currently set are returned, or zero if none of the flags are set. RSA_clear_flags() clears the specified flags within the RSA object.

                      RSA_get0_engine() returns a handle to the ENGINE that has been set for this RSA object, or NULL if no such ENGINE has been set.

                      RSA_get_version() returns the version of an RSA object r.

                      "},{"location":"man3/RSA_get0_key/#notes","title":"NOTES","text":"

                      Values retrieved with RSA_get0_key() are owned by the RSA object used in the call and may therefore not be passed to RSA_set0_key(). If needed, duplicate the received value using BN_dup() and pass the duplicate. The same applies to RSA_get0_factors() and RSA_set0_factors() as well as RSA_get0_crt_params() and RSA_set0_crt_params().

                      The caller should obtain the size by calling RSA_get_multi_prime_extra_count() in advance and allocate sufficient buffer to store the return values before calling RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_params().

                      RSA_set0_multi_prime_params() always clears the original multi-prime triplets in RSA object r and assign the new set of triplets into it.

                      "},{"location":"man3/RSA_get0_key/#return-values","title":"RETURN VALUES","text":"

                      RSA_set0_key(), RSA_set0_factors(), RSA_set0_crt_params() and RSA_set0_multi_prime_params() return 1 on success or 0 on failure.

                      RSA_get0_n(), RSA_get0_e(), RSA_get0_d(), RSA_get0_p(), RSA_get0_q(), RSA_get0_dmp1(), RSA_get0_dmq1(), and RSA_get0_iqmp() return the respective value.

                      RSA_get0_pss_params() returns a RSA_PSS_PARAMS pointer, or NULL if there is none.

                      RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_crt_params() return 1 on success or 0 on failure.

                      RSA_get_multi_prime_extra_count() returns two less than the number of primes in use, which is 0 for traditional RSA and the number of extra primes for multi-prime RSA.

                      RSA_get_version() returns RSA_ASN1_VERSION_MULTI for multi-prime RSA and RSA_ASN1_VERSION_DEFAULT for normal two-prime RSA, as defined in RFC 8017.

                      RSA_test_flags() returns the current state of the flags in the RSA object.

                      RSA_get0_engine() returns the ENGINE set for the RSA object or NULL if no ENGINE has been set.

                      "},{"location":"man3/RSA_get0_key/#see-also","title":"SEE ALSO","text":"

                      RSA_new(3), RSA_size(3)

                      "},{"location":"man3/RSA_get0_key/#history","title":"HISTORY","text":"

                      The RSA_get0_pss_params() function was added in OpenSSL 1.1.1e.

                      The RSA_get_multi_prime_extra_count(), RSA_get0_multi_prime_factors(), RSA_get0_multi_prime_crt_params(), RSA_set0_multi_prime_params(), and RSA_get_version() functions were added in OpenSSL 1.1.1.

                      Other functions described here were added in OpenSSL 1.1.0.

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_get0_key/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_meth_new/","title":"RSA_meth_new","text":""},{"location":"man3/RSA_meth_new/#name","title":"NAME","text":"

                      RSA_meth_get0_app_data, RSA_meth_set0_app_data, RSA_meth_new, RSA_meth_free, RSA_meth_dup, RSA_meth_get0_name, RSA_meth_set1_name, RSA_meth_get_flags, RSA_meth_set_flags, RSA_meth_get_pub_enc, RSA_meth_set_pub_enc, RSA_meth_get_pub_dec, RSA_meth_set_pub_dec, RSA_meth_get_priv_enc, RSA_meth_set_priv_enc, RSA_meth_get_priv_dec, RSA_meth_set_priv_dec, RSA_meth_get_mod_exp, RSA_meth_set_mod_exp, RSA_meth_get_bn_mod_exp, RSA_meth_set_bn_mod_exp, RSA_meth_get_init, RSA_meth_set_init, RSA_meth_get_finish, RSA_meth_set_finish, RSA_meth_get_sign, RSA_meth_set_sign, RSA_meth_get_verify, RSA_meth_set_verify, RSA_meth_get_keygen, RSA_meth_set_keygen, RSA_meth_get_multi_prime_keygen, RSA_meth_set_multi_prime_keygen - Routines to build up RSA methods

                      "},{"location":"man3/RSA_meth_new/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      RSA_METHOD *RSA_meth_new(const char *name, int flags);\nvoid RSA_meth_free(RSA_METHOD *meth);\n\nRSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth);\n\nconst char *RSA_meth_get0_name(const RSA_METHOD *meth);\nint RSA_meth_set1_name(RSA_METHOD *meth, const char *name);\n\nint RSA_meth_get_flags(const RSA_METHOD *meth);\nint RSA_meth_set_flags(RSA_METHOD *meth, int flags);\n\nvoid *RSA_meth_get0_app_data(const RSA_METHOD *meth);\nint RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data);\n\nint (*RSA_meth_get_pub_enc(const RSA_METHOD *meth))(int flen, const unsigned char *from,\n                                                    unsigned char *to, RSA *rsa, int padding);\nint RSA_meth_set_pub_enc(RSA_METHOD *rsa,\n                         int (*pub_enc)(int flen, const unsigned char *from,\n                                        unsigned char *to, RSA *rsa,\n                                        int padding));\n\nint (*RSA_meth_get_pub_dec(const RSA_METHOD *meth))\n    (int flen, const unsigned char *from,\n     unsigned char *to, RSA *rsa, int padding);\nint RSA_meth_set_pub_dec(RSA_METHOD *rsa,\n                         int (*pub_dec)(int flen, const unsigned char *from,\n                                        unsigned char *to, RSA *rsa,\n                                        int padding));\n\nint (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(int flen, const unsigned char *from,\n                                                     unsigned char *to, RSA *rsa,\n                                                     int padding);\nint RSA_meth_set_priv_enc(RSA_METHOD *rsa,\n                          int (*priv_enc)(int flen, const unsigned char *from,\n                                          unsigned char *to, RSA *rsa, int padding));\n\nint (*RSA_meth_get_priv_dec(const RSA_METHOD *meth))(int flen, const unsigned char *from,\n                                                     unsigned char *to, RSA *rsa,\n                                                     int padding);\nint RSA_meth_set_priv_dec(RSA_METHOD *rsa,\n                          int (*priv_dec)(int flen, const unsigned char *from,\n                                          unsigned char *to, RSA *rsa, int padding));\n\n/* Can be null */\nint (*RSA_meth_get_mod_exp(const RSA_METHOD *meth))(BIGNUM *r0, const BIGNUM *i,\n                                                    RSA *rsa, BN_CTX *ctx);\nint RSA_meth_set_mod_exp(RSA_METHOD *rsa,\n                         int (*mod_exp)(BIGNUM *r0, const BIGNUM *i, RSA *rsa,\n                                        BN_CTX *ctx));\n\n/* Can be null */\nint (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth))(BIGNUM *r, const BIGNUM *a,\n                                                       const BIGNUM *p, const BIGNUM *m,\n                                                       BN_CTX *ctx, BN_MONT_CTX *m_ctx);\nint RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa,\n                            int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a,\n                                              const BIGNUM *p, const BIGNUM *m,\n                                              BN_CTX *ctx, BN_MONT_CTX *m_ctx));\n\n/* called at new */\nint (*RSA_meth_get_init(const RSA_METHOD *meth) (RSA *rsa);\nint RSA_meth_set_init(RSA_METHOD *rsa, int (*init (RSA *rsa));\n\n/* called at free */\nint (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa);\nint RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish)(RSA *rsa));\n\nint (*RSA_meth_get_sign(const RSA_METHOD *meth))(int type, const unsigned char *m,\n                                                 unsigned int m_length,\n                                                 unsigned char *sigret,\n                                                 unsigned int *siglen, const RSA *rsa);\nint RSA_meth_set_sign(RSA_METHOD *rsa,\n                      int (*sign)(int type, const unsigned char *m,\n                                  unsigned int m_length, unsigned char *sigret,\n                                  unsigned int *siglen, const RSA *rsa));\n\nint (*RSA_meth_get_verify(const RSA_METHOD *meth))(int dtype, const unsigned char *m,\n                                                   unsigned int m_length,\n                                                   const unsigned char *sigbuf,\n                                                   unsigned int siglen, const RSA *rsa);\nint RSA_meth_set_verify(RSA_METHOD *rsa,\n                        int (*verify)(int dtype, const unsigned char *m,\n                                      unsigned int m_length,\n                                      const unsigned char *sigbuf,\n                                      unsigned int siglen, const RSA *rsa));\n\nint (*RSA_meth_get_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits, BIGNUM *e,\n                                                   BN_GENCB *cb);\nint RSA_meth_set_keygen(RSA_METHOD *rsa,\n                        int (*keygen)(RSA *rsa, int bits, BIGNUM *e,\n                                      BN_GENCB *cb));\n\nint (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits,\n                                                               int primes, BIGNUM *e,\n                                                               BN_GENCB *cb);\n\nint RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth,\n                                    int (*keygen) (RSA *rsa, int bits,\n                                                   int primes, BIGNUM *e,\n                                                   BN_GENCB *cb));\n
                      "},{"location":"man3/RSA_meth_new/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                      The RSA_METHOD type is a structure used for the provision of custom RSA implementations. It provides a set of functions used by OpenSSL for the implementation of the various RSA capabilities.

                      RSA_meth_new() creates a new RSA_METHOD structure. It should be given a unique name and a set of flags. The name should be a NULL terminated string, which will be duplicated and stored in the RSA_METHOD object. It is the callers responsibility to free the original string. The flags will be used during the construction of a new RSA object based on this RSA_METHOD. Any new RSA object will have those flags set by default.

                      RSA_meth_dup() creates a duplicate copy of the RSA_METHOD object passed as a parameter. This might be useful for creating a new RSA_METHOD based on an existing one, but with some differences.

                      RSA_meth_free() destroys an RSA_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

                      RSA_meth_get0_name() will return a pointer to the name of this RSA_METHOD. This is a pointer to the internal name string and so should not be freed by the caller. RSA_meth_set1_name() sets the name of the RSA_METHOD to name. The string is duplicated and the copy is stored in the RSA_METHOD structure, so the caller remains responsible for freeing the memory associated with the name.

                      RSA_meth_get_flags() returns the current value of the flags associated with this RSA_METHOD. RSA_meth_set_flags() provides the ability to set these flags.

                      The functions RSA_meth_get0_app_data() and RSA_meth_set0_app_data() provide the ability to associate implementation specific data with the RSA_METHOD. It is the application's responsibility to free this data before the RSA_METHOD is freed via a call to RSA_meth_free().

                      RSA_meth_get_sign() and RSA_meth_set_sign() get and set the function used for creating an RSA signature respectively. This function will be called in response to the application calling RSA_sign(). The parameters for the function have the same meaning as for RSA_sign().

                      RSA_meth_get_verify() and RSA_meth_set_verify() get and set the function used for verifying an RSA signature respectively. This function will be called in response to the application calling RSA_verify(). The parameters for the function have the same meaning as for RSA_verify().

                      RSA_meth_get_mod_exp() and RSA_meth_set_mod_exp() get and set the function used for CRT computations.

                      RSA_meth_get_bn_mod_exp() and RSA_meth_set_bn_mod_exp() get and set the function used for CRT computations, specifically the following value:

                      r = a ^ p mod m\n

                      Both the mod_exp() and bn_mod_exp() functions are called by the default OpenSSL method during encryption, decryption, signing and verification.

                      RSA_meth_get_init() and RSA_meth_set_init() get and set the function used for creating a new RSA instance respectively. This function will be called in response to the application calling RSA_new() (if the current default RSA_METHOD is this one) or RSA_new_method(). The RSA_new() and RSA_new_method() functions will allocate the memory for the new RSA object, and a pointer to this newly allocated structure will be passed as a parameter to the function. This function may be NULL.

                      RSA_meth_get_finish() and RSA_meth_set_finish() get and set the function used for destroying an instance of an RSA object respectively. This function will be called in response to the application calling RSA_free(). A pointer to the RSA to be destroyed is passed as a parameter. The destroy function should be used for RSA implementation specific clean up. The memory for the RSA itself should not be freed by this function. This function may be NULL.

                      RSA_meth_get_keygen() and RSA_meth_set_keygen() get and set the function used for generating a new RSA key pair respectively. This function will be called in response to the application calling RSA_generate_key_ex(). The parameter for the function has the same meaning as for RSA_generate_key_ex().

                      RSA_meth_get_multi_prime_keygen() and RSA_meth_set_multi_prime_keygen() get and set the function used for generating a new multi-prime RSA key pair respectively. This function will be called in response to the application calling RSA_generate_multi_prime_key(). The parameter for the function has the same meaning as for RSA_generate_multi_prime_key().

                      RSA_meth_get_pub_enc(), RSA_meth_set_pub_enc(), RSA_meth_get_pub_dec(), RSA_meth_set_pub_dec(), RSA_meth_get_priv_enc(), RSA_meth_set_priv_enc(), RSA_meth_get_priv_dec(), RSA_meth_set_priv_dec() get and set the functions used for public and private key encryption and decryption. These functions will be called in response to the application calling RSA_public_encrypt(), RSA_private_decrypt(), RSA_private_encrypt() and RSA_public_decrypt() and take the same parameters as those.

                      "},{"location":"man3/RSA_meth_new/#return-values","title":"RETURN VALUES","text":"

                      RSA_meth_new() and RSA_meth_dup() return the newly allocated RSA_METHOD object or NULL on failure.

                      RSA_meth_get0_name() and RSA_meth_get_flags() return the name and flags associated with the RSA_METHOD respectively.

                      All other RSA_meth_get_*() functions return the appropriate function pointer that has been set in the RSA_METHOD, or NULL if no such pointer has yet been set.

                      RSA_meth_set1_name and all RSA_meth_set_*() functions return 1 on success or 0 on failure.

                      "},{"location":"man3/RSA_meth_new/#see-also","title":"SEE ALSO","text":"

                      RSA_new(3), RSA_generate_key_ex(3), RSA_sign(3), RSA_set_method(3), RSA_size(3), RSA_get0_key(3), RSA_generate_multi_prime_key(3)

                      "},{"location":"man3/RSA_meth_new/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      RSA_meth_get_multi_prime_keygen() and RSA_meth_set_multi_prime_keygen() were added in OpenSSL 1.1.1.

                      Other functions described here were added in OpenSSL 1.1.0.

                      "},{"location":"man3/RSA_meth_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_new/","title":"RSA_new","text":""},{"location":"man3/RSA_new/#name","title":"NAME","text":"

                      RSA_new, RSA_free - allocate and free RSA objects

                      "},{"location":"man3/RSA_new/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      RSA *RSA_new(void);\n\nvoid RSA_free(RSA *rsa);\n
                      "},{"location":"man3/RSA_new/#description","title":"DESCRIPTION","text":"

                      RSA_new() allocates and initializes an RSA structure. It is equivalent to calling RSA_new_method(NULL).

                      RSA_free() frees the RSA structure and its components. The key is erased before the memory is returned to the system. If rsa is NULL nothing is done.

                      "},{"location":"man3/RSA_new/#return-values","title":"RETURN VALUES","text":"

                      If the allocation fails, RSA_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                      RSA_free() returns no value.

                      "},{"location":"man3/RSA_new/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), RSA_generate_key(3), RSA_new_method(3)

                      "},{"location":"man3/RSA_new/#history","title":"HISTORY","text":"

                      All functions described here were deprecated in OpenSSL 3.0. For replacement see EVP_PKEY-RSA(7).

                      "},{"location":"man3/RSA_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/","title":"RSA_padding_add_PKCS1_type_1","text":""},{"location":"man3/RSA_padding_add_PKCS1_type_1/#name","title":"NAME","text":"

                      RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1, RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2, RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP, RSA_padding_add_PKCS1_OAEP_mgf1, RSA_padding_check_PKCS1_OAEP_mgf1, RSA_padding_add_none, RSA_padding_check_none - asymmetric encryption padding

                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,\n                                 const unsigned char *f, int fl);\n\nint RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,\n                                   const unsigned char *f, int fl, int rsa_len);\n\nint RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,\n                                 const unsigned char *f, int fl);\n\nint RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,\n                                   const unsigned char *f, int fl, int rsa_len);\n\nint RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,\n                               const unsigned char *f, int fl,\n                               const unsigned char *p, int pl);\n\nint RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,\n                                 const unsigned char *f, int fl, int rsa_len,\n                                 const unsigned char *p, int pl);\n\nint RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,\n                                    const unsigned char *f, int fl,\n                                    const unsigned char *p, int pl,\n                                    const EVP_MD *md, const EVP_MD *mgf1md);\n\nint RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,\n                                      const unsigned char *f, int fl, int rsa_len,\n                                      const unsigned char *p, int pl,\n                                      const EVP_MD *md, const EVP_MD *mgf1md);\n\nint RSA_padding_add_none(unsigned char *to, int tlen,\n                         const unsigned char *f, int fl);\n\nint RSA_padding_check_none(unsigned char *to, int tlen,\n                           const unsigned char *f, int fl, int rsa_len);\n
                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use the EVP PKEY APIs.

                      The RSA_padding_xxx_xxx() functions are called from the RSA encrypt, decrypt, sign and verify functions. Normally they should not be called from application programs.

                      However, they can also be called directly to implement padding for other asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() may be used in an application combined with RSA_NO_PADDING in order to implement OAEP with an encoding parameter.

                      RSA_padding_add_xxx() encodes fl bytes from f so as to fit into tlen bytes and stores the result at to. An error occurs if fl does not meet the size requirements of the encoding method.

                      The following encoding methods are implemented:

                      • PKCS1_type_1

                        PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for signatures

                      • PKCS1_type_2

                        PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2)

                      • PKCS1_OAEP

                        PKCS #1 v2.0 EME-OAEP

                      • none

                        simply copy the data

                      The random number generator must be seeded prior to calling RSA_padding_add_xxx(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                      RSA_padding_check_xxx() verifies that the fl bytes at f contain a valid encoding for a rsa_len byte RSA key in the respective encoding method and stores the recovered data of at most tlen bytes (for RSA_NO_PADDING: of size tlen) at to.

                      For RSA_padding_xxx_OAEP(), p points to the encoding parameter of length pl. p may be NULL if pl is 0.

                      For RSA_padding_xxx_OAEP_mgf1(), md points to the md hash, if md is NULL that means md=sha1, and mgf1md points to the mgf1 hash, if mgf1md is NULL that means mgf1md=md.

                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#return-values","title":"RETURN VALUES","text":"

                      The RSA_padding_add_xxx() functions return 1 on success, 0 on error. The RSA_padding_check_xxx() functions return the length of the recovered data, -1 on error. Error codes can be obtained by calling ERR_get_error(3).

                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#warnings","title":"WARNINGS","text":"

                      The result of RSA_padding_check_PKCS1_type_2() is a very sensitive information which can potentially be used to mount a Bleichenbacher padding oracle attack. This is an inherent weakness in the PKCS #1 v1.5 padding design. Prefer PKCS1_OAEP padding. If that is not possible, the result of RSA_padding_check_PKCS1_type_2() should be checked in constant time if it matches the expected length of the plaintext and additionally some application specific consistency checks on the plaintext need to be performed in constant time. If the plaintext is rejected it must be kept secret which of the checks caused the application to reject the message. Do not remove the zero-padding from the decrypted raw RSA data which was computed by RSA_private_decrypt() with RSA_NO_PADDING, as this would create a small timing side channel which could be used to mount a Bleichenbacher attack against any padding mode including PKCS1_OAEP.

                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#see-also","title":"SEE ALSO","text":"

                      RSA_public_encrypt(3), RSA_private_decrypt(3), RSA_sign(3), RSA_verify(3), RAND(7)

                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_print/","title":"RSA_print","text":""},{"location":"man3/RSA_print/#name","title":"NAME","text":"

                      RSA_print, RSA_print_fp, DSAparams_print, DSAparams_print_fp, DSA_print, DSA_print_fp, DHparams_print, DHparams_print_fp - print cryptographic parameters

                      "},{"location":"man3/RSA_print/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_print(BIO *bp, const RSA *x, int offset);\nint RSA_print_fp(FILE *fp, const RSA *x, int offset);\n\n#include <openssl/dsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int DSAparams_print(BIO *bp, const DSA *x);\nint DSAparams_print_fp(FILE *fp, const DSA *x);\nint DSA_print(BIO *bp, const DSA *x, int offset);\nint DSA_print_fp(FILE *fp, const DSA *x, int offset);\n\n#include <openssl/dh.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int DHparams_print(BIO *bp, DH *x);\nint DHparams_print_fp(FILE *fp, const DH *x);\n
                      "},{"location":"man3/RSA_print/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_print_params(3) and EVP_PKEY_print_private(3).

                      A human-readable hexadecimal output of the components of the RSA key, DSA parameters or key or DH parameters is printed to bp or fp.

                      The output lines are indented by offset spaces.

                      "},{"location":"man3/RSA_print/#return-values","title":"RETURN VALUES","text":"

                      DSAparams_print(), DSAparams_print_fp(), DSA_print(), and DSA_print_fp() return 1 for success and 0 or a negative value for failure.

                      DHparams_print() and DHparams_print_fp() return 1 on success, 0 on error.

                      "},{"location":"man3/RSA_print/#see-also","title":"SEE ALSO","text":"
                      L<EVP_PKEY_print_params(3)>,\nL<EVP_PKEY_print_private(3)>,\nL<BN_bn2bin(3)>\n
                      "},{"location":"man3/RSA_print/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_print/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_private_encrypt/","title":"RSA_private_encrypt","text":""},{"location":"man3/RSA_private_encrypt/#name","title":"NAME","text":"

                      RSA_private_encrypt, RSA_public_decrypt - low-level signature operations

                      "},{"location":"man3/RSA_private_encrypt/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_private_encrypt(int flen, unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n\nint RSA_public_decrypt(int flen, unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n
                      "},{"location":"man3/RSA_private_encrypt/#description","title":"DESCRIPTION","text":"

                      Both of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init_ex(3), EVP_PKEY_sign(3), EVP_PKEY_verify_recover_init(3), and EVP_PKEY_verify_recover(3).

                      These functions handle RSA signatures at a low-level.

                      RSA_private_encrypt() signs the flen bytes at from (usually a message digest with an algorithm identifier) using the private key rsa and stores the signature in to. to must point to RSA_size(rsa) bytes of memory.

                      padding denotes one of the following modes:

                      • RSA_PKCS1_PADDING

                        PKCS #1 v1.5 padding. This function does not handle the algorithmIdentifier specified in PKCS #1. When generating or verifying PKCS #1 signatures, RSA_sign(3) and RSA_verify(3) should be used.

                      • RSA_NO_PADDING

                        Raw RSA signature. This mode should only be used to implement cryptographically sound padding modes in the application code. Signing user data directly with RSA is insecure.

                      RSA_public_decrypt() recovers the message digest from the flen bytes long signature at from using the signer's public key rsa. to must point to a memory section large enough to hold the message digest (which is smaller than RSA_size(rsa) - 11). padding is the padding mode that was used to sign the data.

                      "},{"location":"man3/RSA_private_encrypt/#return-values","title":"RETURN VALUES","text":"

                      RSA_private_encrypt() returns the size of the signature (i.e., RSA_size(rsa)). RSA_public_decrypt() returns the size of the recovered message digest.

                      On error, -1 is returned; the error codes can be obtained by ERR_get_error(3).

                      "},{"location":"man3/RSA_private_encrypt/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), RSA_sign(3), RSA_verify(3), EVP_PKEY_sign(3), EVP_PKEY_verify_recover(3)

                      "},{"location":"man3/RSA_private_encrypt/#history","title":"HISTORY","text":"

                      Both of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_private_encrypt/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_public_encrypt/","title":"RSA_public_encrypt","text":""},{"location":"man3/RSA_public_encrypt/#name","title":"NAME","text":"

                      RSA_public_encrypt, RSA_private_decrypt - RSA public key cryptography

                      "},{"location":"man3/RSA_public_encrypt/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_public_encrypt(int flen, const unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n\nint RSA_private_decrypt(int flen, const unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n
                      "},{"location":"man3/RSA_public_encrypt/#description","title":"DESCRIPTION","text":"

                      Both of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_encrypt_init_ex(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt_init_ex(3) and EVP_PKEY_decrypt(3).

                      RSA_public_encrypt() encrypts the flen bytes at from (usually a session key) using the public key rsa and stores the ciphertext in to. to must point to RSA_size(rsa) bytes of memory.

                      padding denotes one of the following modes:

                      • RSA_PKCS1_PADDING

                        PKCS #1 v1.5 padding. This currently is the most widely used mode. However, it is highly recommended to use RSA_PKCS1_OAEP_PADDING in new applications. SEE WARNING BELOW.

                      • RSA_PKCS1_OAEP_PADDING

                        EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty encoding parameter. This mode is recommended for all new applications.

                      • RSA_NO_PADDING

                        Raw RSA encryption. This mode should only be used to implement cryptographically sound padding modes in the application code. Encrypting user data directly with RSA is insecure.

                      flen must not be more than RSA_size(rsa) - 11 for the PKCS #1 v1.5 based padding modes, not more than RSA_size(rsa) - 42 for RSA_PKCS1_OAEP_PADDING and exactly RSA_size(rsa) for RSA_NO_PADDING. When a padding mode other than RSA_NO_PADDING is in use, then RSA_public_encrypt() will include some random bytes into the ciphertext and therefore the ciphertext will be different each time, even if the plaintext and the public key are exactly identical. The returned ciphertext in to will always be zero padded to exactly RSA_size(rsa) bytes. to and from may overlap.

                      RSA_private_decrypt() decrypts the flen bytes at from using the private key rsa and stores the plaintext in to. flen should be equal to RSA_size(rsa) but may be smaller, when leading zero bytes are in the ciphertext. Those are not important and may be removed, but RSA_public_encrypt() does not do that. to must point to a memory section large enough to hold the maximal possible decrypted data (which is equal to RSA_size(rsa) for RSA_NO_PADDING, RSA_size(rsa) - 11 for the PKCS #1 v1.5 based padding modes and RSA_size(rsa) - 42 for RSA_PKCS1_OAEP_PADDING). padding is the padding mode that was used to encrypt the data. to and from may overlap.

                      "},{"location":"man3/RSA_public_encrypt/#return-values","title":"RETURN VALUES","text":"

                      RSA_public_encrypt() returns the size of the encrypted data (i.e., RSA_size(rsa)). RSA_private_decrypt() returns the size of the recovered plaintext. A return value of 0 is not an error and means only that the plaintext was empty.

                      On error, -1 is returned; the error codes can be obtained by ERR_get_error(3).

                      "},{"location":"man3/RSA_public_encrypt/#warnings","title":"WARNINGS","text":"

                      Decryption failures in the RSA_PKCS1_PADDING mode leak information which can potentially be used to mount a Bleichenbacher padding oracle attack. This is an inherent weakness in the PKCS #1 v1.5 padding design. Prefer RSA_PKCS1_OAEP_PADDING.

                      "},{"location":"man3/RSA_public_encrypt/#conforming-to","title":"CONFORMING TO","text":"

                      SSL, PKCS #1 v2.0

                      "},{"location":"man3/RSA_public_encrypt/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), RAND_bytes(3), RSA_size(3)

                      "},{"location":"man3/RSA_public_encrypt/#history","title":"HISTORY","text":"

                      Both of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_public_encrypt/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_set_method/","title":"RSA_set_method","text":""},{"location":"man3/RSA_set_method/#name","title":"NAME","text":"

                      RSA_set_default_method, RSA_get_default_method, RSA_set_method, RSA_get_method, RSA_PKCS1_OpenSSL, RSA_flags, RSA_new_method - select RSA method

                      "},{"location":"man3/RSA_set_method/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      void RSA_set_default_method(const RSA_METHOD *meth);\n\nconst RSA_METHOD *RSA_get_default_method(void);\n\nint RSA_set_method(RSA *rsa, const RSA_METHOD *meth);\n\nconst RSA_METHOD *RSA_get_method(const RSA *rsa);\n\nconst RSA_METHOD *RSA_PKCS1_OpenSSL(void);\n\nint RSA_flags(const RSA *rsa);\n\nRSA *RSA_new_method(ENGINE *engine);\n
                      "},{"location":"man3/RSA_set_method/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                      An RSA_METHOD specifies the functions that OpenSSL uses for RSA operations. By modifying the method, alternative implementations such as hardware accelerators may be used. IMPORTANT: See the NOTES section for important information about how these RSA API functions are affected by the use of ENGINE API calls.

                      Initially, the default RSA_METHOD is the OpenSSL internal implementation, as returned by RSA_PKCS1_OpenSSL().

                      RSA_set_default_method() makes meth the default method for all RSA structures created later. NB: This is true only whilst no ENGINE has been set as a default for RSA, so this function is no longer recommended. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

                      RSA_get_default_method() returns a pointer to the current default RSA_METHOD. However, the meaningfulness of this result is dependent on whether the ENGINE API is being used, so this function is no longer recommended.

                      RSA_set_method() selects meth to perform all operations using the key rsa. This will replace the RSA_METHOD used by the RSA key and if the previous method was supplied by an ENGINE, the handle to that ENGINE will be released during the change. It is possible to have RSA keys that only work with certain RSA_METHOD implementations (e.g. from an ENGINE module that supports embedded hardware-protected keys), and in such cases attempting to change the RSA_METHOD for the key can have unexpected results.

                      RSA_get_method() returns a pointer to the RSA_METHOD being used by rsa. This method may or may not be supplied by an ENGINE implementation, but if it is, the return value can only be guaranteed to be valid as long as the RSA key itself is valid and does not have its implementation changed by RSA_set_method().

                      RSA_flags() returns the flags that are set for rsa's current RSA_METHOD. See the BUGS section.

                      RSA_new_method() allocates and initializes an RSA structure so that engine will be used for the RSA operations. If engine is NULL, the default ENGINE for RSA operations is used, and if no default ENGINE is set, the RSA_METHOD controlled by RSA_set_default_method() is used.

                      RSA_flags() returns the flags that are set for rsa's current method.

                      RSA_new_method() allocates and initializes an RSA structure so that method will be used for the RSA operations. If method is NULL, the default method is used.

                      "},{"location":"man3/RSA_set_method/#the-rsa_method-structure","title":"THE RSA_METHOD STRUCTURE","text":"
                      typedef struct rsa_meth_st\n{\n    /* name of the implementation */\n    const char *name;\n\n    /* encrypt */\n    int (*rsa_pub_enc)(int flen, unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n\n    /* verify arbitrary data */\n    int (*rsa_pub_dec)(int flen, unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n\n    /* sign arbitrary data */\n    int (*rsa_priv_enc)(int flen, unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n\n    /* decrypt */\n    int (*rsa_priv_dec)(int flen, unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n\n    /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some implementations) */\n    int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa);\n\n    /* compute r = a ^ p mod m (May be NULL for some implementations) */\n    int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p,\n                      const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\n\n    /* called at RSA_new */\n    int (*init)(RSA *rsa);\n\n    /* called at RSA_free */\n    int (*finish)(RSA *rsa);\n\n    /*\n     * RSA_FLAG_EXT_PKEY        - rsa_mod_exp is called for private key\n     *                            operations, even if p,q,dmp1,dmq1,iqmp\n     *                            are NULL\n     * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match\n     */\n    int flags;\n\n    char *app_data; /* ?? */\n\n    int (*rsa_sign)(int type,\n                    const unsigned char *m, unsigned int m_length,\n                    unsigned char *sigret, unsigned int *siglen, const RSA *rsa);\n    int (*rsa_verify)(int dtype,\n                      const unsigned char *m, unsigned int m_length,\n                      const unsigned char *sigbuf, unsigned int siglen,\n                      const RSA *rsa);\n    /* keygen. If NULL built-in RSA key generation will be used */\n    int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\n\n} RSA_METHOD;\n
                      "},{"location":"man3/RSA_set_method/#return-values","title":"RETURN VALUES","text":"

                      RSA_PKCS1_OpenSSL(), RSA_PKCS1_null_method(), RSA_get_default_method() and RSA_get_method() return pointers to the respective RSA_METHODs.

                      RSA_set_default_method() returns no value.

                      RSA_set_method() returns a pointer to the old RSA_METHOD implementation that was replaced. However, this return value should probably be ignored because if it was supplied by an ENGINE, the pointer could be invalidated at any time if the ENGINE is unloaded (in fact it could be unloaded as a result of the RSA_set_method() function releasing its handle to the ENGINE). For this reason, the return type may be replaced with a void declaration in a future release.

                      RSA_new_method() returns NULL and sets an error code that can be obtained by ERR_get_error(3) if the allocation fails. Otherwise it returns a pointer to the newly allocated structure.

                      "},{"location":"man3/RSA_set_method/#bugs","title":"BUGS","text":"

                      The behaviour of RSA_flags() is a mis-feature that is left as-is for now to avoid creating compatibility problems. RSA functionality, such as the encryption functions, are controlled by the flags value in the RSA key itself, not by the flags value in the RSA_METHOD attached to the RSA key (which is what this function returns). If the flags element of an RSA key is changed, the changes will be honoured by RSA functionality but will not be reflected in the return value of the RSA_flags() function - in effect RSA_flags() behaves more like an RSA_default_flags() function (which does not currently exist).

                      "},{"location":"man3/RSA_set_method/#see-also","title":"SEE ALSO","text":"

                      RSA_new(3)

                      "},{"location":"man3/RSA_set_method/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      The RSA_null_method(), which was a partial attempt to avoid patent issues, was replaced to always return NULL in OpenSSL 1.1.1.

                      "},{"location":"man3/RSA_set_method/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_sign/","title":"RSA_sign","text":""},{"location":"man3/RSA_sign/#name","title":"NAME","text":"

                      RSA_sign, RSA_verify - RSA signatures

                      "},{"location":"man3/RSA_sign/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_sign(int type, const unsigned char *m, unsigned int m_len,\n             unsigned char *sigret, unsigned int *siglen, RSA *rsa);\n\nint RSA_verify(int type, const unsigned char *m, unsigned int m_len,\n               unsigned char *sigbuf, unsigned int siglen, RSA *rsa);\n
                      "},{"location":"man3/RSA_sign/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

                      RSA_sign() signs the message digest m of size m_len using the private key rsa using RSASSA-PKCS1-v1_5 as specified in RFC 3447. It stores the signature in sigret and the signature size in siglen. sigret must point to RSA_size(rsa) bytes of memory. Note that PKCS #1 adds meta-data, placing limits on the size of the key that can be used. See RSA_private_encrypt(3) for lower-level operations.

                      type denotes the message digest algorithm that was used to generate m. If type is NID_md5_sha1, an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding and no algorithm identifier) is created.

                      RSA_verify() verifies that the signature sigbuf of size siglen matches a given message digest m of size m_len. type denotes the message digest algorithm that was used to generate the signature. rsa is the signer's public key.

                      "},{"location":"man3/RSA_sign/#return-values","title":"RETURN VALUES","text":"

                      RSA_sign() returns 1 on success and 0 for failure. RSA_verify() returns 1 on successful verification and 0 for failure.

                      The error codes can be obtained by ERR_get_error(3).

                      "},{"location":"man3/RSA_sign/#conforming-to","title":"CONFORMING TO","text":"

                      SSL, PKCS #1 v2.0

                      "},{"location":"man3/RSA_sign/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), RSA_private_encrypt(3), RSA_public_decrypt(3)

                      "},{"location":"man3/RSA_sign/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_sign/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/","title":"RSA_sign_ASN1_OCTET_STRING","text":""},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#name","title":"NAME","text":"

                      RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING - RSA signatures

                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_sign_ASN1_OCTET_STRING(int dummy, unsigned char *m,\n                               unsigned int m_len, unsigned char *sigret,\n                               unsigned int *siglen, RSA *rsa);\n\nint RSA_verify_ASN1_OCTET_STRING(int dummy, unsigned char *m,\n                                 unsigned int m_len, unsigned char *sigbuf,\n                                 unsigned int siglen, RSA *rsa);\n
                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. Applications should instead use EVP PKEY APIs.

                      RSA_sign_ASN1_OCTET_STRING() signs the octet string m of size m_len using the private key rsa represented in DER using PKCS #1 padding. It stores the signature in sigret and the signature size in siglen. sigret must point to RSA_size(rsa) bytes of memory.

                      dummy is ignored.

                      The random number generator must be seeded when calling RSA_sign_ASN1_OCTET_STRING(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                      RSA_verify_ASN1_OCTET_STRING() verifies that the signature sigbuf of size siglen is the DER representation of a given octet string m of size m_len. dummy is ignored. rsa is the signer's public key.

                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#return-values","title":"RETURN VALUES","text":"

                      RSA_sign_ASN1_OCTET_STRING() returns 1 on success, 0 otherwise. RSA_verify_ASN1_OCTET_STRING() returns 1 on successful verification, 0 otherwise.

                      The error codes can be obtained by ERR_get_error(3).

                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#bugs","title":"BUGS","text":"

                      These functions serve no recognizable purpose.

                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), RAND_bytes(3), RSA_sign(3), RSA_verify(3), RAND(7)

                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#history","title":"HISTORY","text":"

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/RSA_size/","title":"RSA_size","text":""},{"location":"man3/RSA_size/#name","title":"NAME","text":"

                      RSA_size, RSA_bits, RSA_security_bits - get RSA modulus size or security bits

                      "},{"location":"man3/RSA_size/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/rsa.h>\n\nint RSA_bits(const RSA *rsa);\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int RSA_size(const RSA *rsa);\n\nint RSA_security_bits(const RSA *rsa);\n
                      "},{"location":"man3/RSA_size/#description","title":"DESCRIPTION","text":"

                      RSA_bits() returns the number of significant bits.

                      rsa and rsa->n must not be NULL.

                      The remaining functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_size(3), EVP_PKEY_get_bits(3) and EVP_PKEY_get_security_bits(3).

                      RSA_size() returns the RSA modulus size in bytes. It can be used to determine how much memory must be allocated for an RSA encrypted value.

                      RSA_security_bits() returns the number of security bits of the given rsa key. See BN_security_bits(3).

                      "},{"location":"man3/RSA_size/#return-values","title":"RETURN VALUES","text":"

                      RSA_bits() returns the number of bits in the key.

                      RSA_size() returns the size of modulus in bytes.

                      RSA_security_bits() returns the number of security bits.

                      "},{"location":"man3/RSA_size/#see-also","title":"SEE ALSO","text":"

                      BN_num_bits(3)

                      "},{"location":"man3/RSA_size/#history","title":"HISTORY","text":"

                      The RSA_size() and RSA_security_bits() functions were deprecated in OpenSSL 3.0.

                      The RSA_bits() function was added in OpenSSL 1.1.0.

                      "},{"location":"man3/RSA_size/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SCT_new/","title":"SCT_new","text":""},{"location":"man3/SCT_new/#name","title":"NAME","text":"

                      SCT_new, SCT_new_from_base64, SCT_free, SCT_LIST_free, SCT_get_version, SCT_set_version, SCT_get_log_entry_type, SCT_set_log_entry_type, SCT_get0_log_id, SCT_set0_log_id, SCT_set1_log_id, SCT_get_timestamp, SCT_set_timestamp, SCT_get_signature_nid, SCT_set_signature_nid, SCT_get0_signature, SCT_set0_signature, SCT_set1_signature, SCT_get0_extensions, SCT_set0_extensions, SCT_set1_extensions, SCT_get_source, SCT_set_source - A Certificate Transparency Signed Certificate Timestamp

                      "},{"location":"man3/SCT_new/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ct.h>\n\ntypedef enum {\n    CT_LOG_ENTRY_TYPE_NOT_SET = -1,\n    CT_LOG_ENTRY_TYPE_X509 = 0,\n    CT_LOG_ENTRY_TYPE_PRECERT = 1\n} ct_log_entry_type_t;\n\ntypedef enum {\n    SCT_VERSION_NOT_SET = -1,\n    SCT_VERSION_V1 = 0\n} sct_version_t;\n\ntypedef enum {\n    SCT_SOURCE_UNKNOWN,\n    SCT_SOURCE_TLS_EXTENSION,\n    SCT_SOURCE_X509V3_EXTENSION,\n    SCT_SOURCE_OCSP_STAPLED_RESPONSE\n} sct_source_t;\n\nSCT *SCT_new(void);\nSCT *SCT_new_from_base64(unsigned char version,\n                         const char *logid_base64,\n                         ct_log_entry_type_t entry_type,\n                         uint64_t timestamp,\n                         const char *extensions_base64,\n                         const char *signature_base64);\n\nvoid SCT_free(SCT *sct);\nvoid SCT_LIST_free(STACK_OF(SCT) *a);\n\nsct_version_t SCT_get_version(const SCT *sct);\nint SCT_set_version(SCT *sct, sct_version_t version);\n\nct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);\nint SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);\n\nsize_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);\nint SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);\nint SCT_set1_log_id(SCT *sct, const unsigned char *log_id, size_t log_id_len);\n\nuint64_t SCT_get_timestamp(const SCT *sct);\nvoid SCT_set_timestamp(SCT *sct, uint64_t timestamp);\n\nint SCT_get_signature_nid(const SCT *sct);\nint SCT_set_signature_nid(SCT *sct, int nid);\n\nsize_t SCT_get0_signature(const SCT *sct, unsigned char **sig);\nvoid SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);\nint SCT_set1_signature(SCT *sct, const unsigned char *sig, size_t sig_len);\n\nsize_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);\nvoid SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);\nint SCT_set1_extensions(SCT *sct, const unsigned char *ext, size_t ext_len);\n\nsct_source_t SCT_get_source(const SCT *sct);\nint SCT_set_source(SCT *sct, sct_source_t source);\n
                      "},{"location":"man3/SCT_new/#description","title":"DESCRIPTION","text":"

                      Signed Certificate Timestamps (SCTs) are defined by RFC 6962, Section 3.2. They constitute a promise by a Certificate Transparency (CT) log to publicly record a certificate. By cryptographically verifying that a log did indeed issue an SCT, some confidence can be gained that the certificate is publicly known.

                      An internal representation of an SCT can be created in one of two ways. The first option is to create a blank SCT, using SCT_new(), and then populate it using:

                      • SCT_set_version() to set the SCT version.

                        Only SCT_VERSION_V1 is currently supported.

                      • SCT_set_log_entry_type() to set the type of certificate the SCT was issued for:

                        CT_LOG_ENTRY_TYPE_X509 for a normal certificate. CT_LOG_ENTRY_TYPE_PRECERT for a pre-certificate.

                      • SCT_set0_log_id() or SCT_set1_log_id() to set the LogID of the CT log that the SCT came from.

                        The former takes ownership, whereas the latter makes a copy. See RFC 6962, Section 3.2 for the definition of LogID.

                      • SCT_set_timestamp() to set the time the SCT was issued (time in milliseconds since the Unix Epoch).

                      • SCT_set_signature_nid() to set the NID of the signature.
                      • SCT_set0_signature() or SCT_set1_signature() to set the raw signature value.

                        The former takes ownership, whereas the latter makes a copy.

                      • SCT_set0_extensions() or SCT_set1_extensions to provide SCT extensions.

                        The former takes ownership, whereas the latter makes a copy.

                      Alternatively, the SCT can be pre-populated from the following data using SCT_new_from_base64():

                      • The SCT version (only SCT_VERSION_V1 is currently supported).
                      • The LogID (see RFC 6962, Section 3.2), base64 encoded.
                      • The type of certificate the SCT was issued for: CT_LOG_ENTRY_TYPE_X509 for a normal certificate. CT_LOG_ENTRY_TYPE_PRECERT for a pre-certificate.
                      • The time that the SCT was issued (time in milliseconds since the Unix Epoch).
                      • The SCT extensions, base64 encoded.
                      • The SCT signature, base64 encoded.

                      SCT_set_source() can be used to record where the SCT was found (TLS extension, X.509 certificate extension or OCSP response). This is not required for verifying the SCT.

                      SCT_free() frees the specified SCT. If the argument is NULL, nothing is done.

                      SCT_LIST_free() frees the specified stack of SCTs. If the argument is NULL, nothing is done.

                      "},{"location":"man3/SCT_new/#notes","title":"NOTES","text":"

                      Some of the setters return int, instead of void. These will all return 1 on success, 0 on failure. They will not make changes on failure.

                      All of the setters will reset the validation status of the SCT to SCT_VALIDATION_STATUS_NOT_SET (see SCT_validate(3)).

                      SCT_set_source() will call SCT_set_log_entry_type() if the type of certificate the SCT was issued for can be inferred from where the SCT was found. For example, an SCT found in an X.509 extension must have been issued for a pre- certificate.

                      SCT_set_source() will not refuse unknown values.

                      "},{"location":"man3/SCT_new/#return-values","title":"RETURN VALUES","text":"

                      SCT_set_version() returns 1 if the specified version is supported, 0 otherwise.

                      SCT_set_log_entry_type() returns 1 if the specified log entry type is supported, 0 otherwise.

                      SCT_set0_log_id() and SCT_set1_log_id return 1 if the specified LogID is a valid SHA-256 hash, 0 otherwise. Additionally, SCT_set1_log_id returns 0 if malloc fails.

                      SCT_set_signature_nid returns 1 if the specified NID is supported, 0 otherwise.

                      SCT_set1_extensions and SCT_set1_signature return 1 if the supplied buffer is copied successfully, 0 otherwise (i.e. if malloc fails).

                      SCT_set_source returns 1 on success, 0 otherwise.

                      "},{"location":"man3/SCT_new/#see-also","title":"SEE ALSO","text":"

                      ct(7), SCT_validate(3), OBJ_nid2obj(3)

                      "},{"location":"man3/SCT_new/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.1.0.

                      "},{"location":"man3/SCT_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SCT_print/","title":"SCT_print","text":""},{"location":"man3/SCT_print/#name","title":"NAME","text":"

                      SCT_print, SCT_LIST_print, SCT_validation_status_string - Prints Signed Certificate Timestamps in a human-readable way

                      "},{"location":"man3/SCT_print/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ct.h>\n\nvoid SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);\nvoid SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,\n                    const char *separator, const CTLOG_STORE *logs);\nconst char *SCT_validation_status_string(const SCT *sct);\n
                      "},{"location":"man3/SCT_print/#description","title":"DESCRIPTION","text":"

                      SCT_print() prints a single Signed Certificate Timestamp (SCT) to a BIO in a human-readable format. SCT_LIST_print() prints an entire list of SCTs in a similar way. A separator can be specified to delimit each SCT in the output.

                      The output can be indented by a specified number of spaces. If a CTLOG_STORE is provided, it will be used to print the description of the CT log that issued each SCT (if that log is in the CTLOG_STORE). Alternatively, NULL can be passed as the CTLOG_STORE parameter to disable this feature.

                      SCT_validation_status_string() will return the validation status of an SCT as a human-readable string. Call SCT_validate() or SCT_LIST_validate() beforehand in order to set the validation status of an SCT first.

                      "},{"location":"man3/SCT_print/#return-values","title":"RETURN VALUES","text":"

                      SCT_validation_status_string() returns a NUL-terminated string representing the validation status of an SCT object.

                      "},{"location":"man3/SCT_print/#see-also","title":"SEE ALSO","text":"

                      ct(7), bio(7), CTLOG_STORE_new(3), SCT_validate(3)

                      "},{"location":"man3/SCT_print/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.1.0.

                      "},{"location":"man3/SCT_print/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SCT_validate/","title":"SCT_validate","text":""},{"location":"man3/SCT_validate/#name","title":"NAME","text":"

                      SCT_validate, SCT_LIST_validate, SCT_get_validation_status - checks Signed Certificate Timestamps (SCTs) are valid

                      "},{"location":"man3/SCT_validate/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ct.h>\n\ntypedef enum {\n    SCT_VALIDATION_STATUS_NOT_SET,\n    SCT_VALIDATION_STATUS_UNKNOWN_LOG,\n    SCT_VALIDATION_STATUS_VALID,\n    SCT_VALIDATION_STATUS_INVALID,\n    SCT_VALIDATION_STATUS_UNVERIFIED,\n    SCT_VALIDATION_STATUS_UNKNOWN_VERSION\n} sct_validation_status_t;\n\nint SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);\nint SCT_LIST_validate(const STACK_OF(SCT) *scts, CT_POLICY_EVAL_CTX *ctx);\nsct_validation_status_t SCT_get_validation_status(const SCT *sct);\n
                      "},{"location":"man3/SCT_validate/#description","title":"DESCRIPTION","text":"

                      SCT_validate() will check that an SCT is valid and verify its signature. SCT_LIST_validate() performs the same checks on an entire stack of SCTs. The result of the validation checks can be obtained by passing the SCT to SCT_get_validation_status().

                      A CT_POLICY_EVAL_CTX must be provided that specifies:

                      • The certificate the SCT was issued for.

                        Failure to provide the certificate will result in the validation status being SCT_VALIDATION_STATUS_UNVERIFIED.

                      • The issuer of that certificate.

                        This is only required if the SCT was issued for a pre-certificate (see RFC 6962). If it is required but not provided, the validation status will be SCT_VALIDATION_STATUS_UNVERIFIED.

                      • A CTLOG_STORE that contains the CT log that issued this SCT.

                        If the SCT was issued by a log that is not in this CTLOG_STORE, the validation status will be SCT_VALIDATION_STATUS_UNKNOWN_LOG.

                      If the SCT is of an unsupported version (only v1 is currently supported), the validation status will be SCT_VALIDATION_STATUS_UNKNOWN_VERSION.

                      If the SCT's signature is incorrect, its timestamp is in the future (relative to the time in CT_POLICY_EVAL_CTX), or if it is otherwise invalid, the validation status will be SCT_VALIDATION_STATUS_INVALID.

                      If all checks pass, the validation status will be SCT_VALIDATION_STATUS_VALID.

                      "},{"location":"man3/SCT_validate/#notes","title":"NOTES","text":"

                      A return value of 0 from SCT_LIST_validate() should not be interpreted as a failure. At a minimum, only one valid SCT may provide sufficient confidence that a certificate has been publicly logged.

                      "},{"location":"man3/SCT_validate/#return-values","title":"RETURN VALUES","text":"

                      SCT_validate() returns a negative integer if an internal error occurs, 0 if the SCT fails validation, or 1 if the SCT passes validation.

                      SCT_LIST_validate() returns a negative integer if an internal error occurs, 0 if any of SCTs fails validation, or 1 if they all pass validation.

                      SCT_get_validation_status() returns the validation status of the SCT. If SCT_validate() or SCT_LIST_validate() have not been passed that SCT, the returned value will be SCT_VALIDATION_STATUS_NOT_SET.

                      "},{"location":"man3/SCT_validate/#see-also","title":"SEE ALSO","text":"

                      ct(7)

                      "},{"location":"man3/SCT_validate/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.1.0.

                      "},{"location":"man3/SCT_validate/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SHA256_Init/","title":"SHA256_Init","text":""},{"location":"man3/SHA256_Init/#name","title":"NAME","text":"

                      SHA1, SHA1_Init, SHA1_Update, SHA1_Final, SHA224, SHA224_Init, SHA224_Update, SHA224_Final, SHA256, SHA256_Init, SHA256_Update, SHA256_Final, SHA384, SHA384_Init, SHA384_Update, SHA384_Final, SHA512, SHA512_Init, SHA512_Update, SHA512_Final - Secure Hash Algorithm

                      "},{"location":"man3/SHA256_Init/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/sha.h>\n\nunsigned char *SHA1(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA224(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA256(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA384(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA512(const unsigned char *data, size_t count, unsigned char *md_buf);\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int SHA1_Init(SHA_CTX *c);\nint SHA1_Update(SHA_CTX *c, const void *data, size_t len);\nint SHA1_Final(unsigned char *md, SHA_CTX *c);\n\nint SHA224_Init(SHA256_CTX *c);\nint SHA224_Update(SHA256_CTX *c, const void *data, size_t len);\nint SHA224_Final(unsigned char *md, SHA256_CTX *c);\n\nint SHA256_Init(SHA256_CTX *c);\nint SHA256_Update(SHA256_CTX *c, const void *data, size_t len);\nint SHA256_Final(unsigned char *md, SHA256_CTX *c);\n\nint SHA384_Init(SHA512_CTX *c);\nint SHA384_Update(SHA512_CTX *c, const void *data, size_t len);\nint SHA384_Final(unsigned char *md, SHA512_CTX *c);\n\nint SHA512_Init(SHA512_CTX *c);\nint SHA512_Update(SHA512_CTX *c, const void *data, size_t len);\nint SHA512_Final(unsigned char *md, SHA512_CTX *c);\n
                      "},{"location":"man3/SHA256_Init/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page except for SHA1(), SHA224(), SHA256(), SHA384() and SHA512() are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3), or the quick one-shot function EVP_Q_digest(3). SHA1(), SHA224(), SHA256(), SHA384(), and SHA256() can continue to be used. They can also be replaced by, e.g.,

                      (EVP_Q_digest(d, n, md, NULL, NULL, \"SHA256\", NULL) ? md : NULL)\n

                      SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a 160 bit output.

                      SHA1() computes the SHA-1 message digest of the n bytes at d and places it in md (which must have space for SHA_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array. Note: setting md to NULL is not thread safe.

                      The following functions may be used if the message is not completely stored in memory:

                      SHA1_Init() initializes a SHA_CTX structure.

                      SHA1_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

                      SHA1_Final() places the message digest in md, which must have space for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the SHA_CTX.

                      The SHA224, SHA256, SHA384 and SHA512 families of functions operate in the same way as for the SHA1 functions. Note that SHA224 and SHA256 use a SHA256_CTX object instead of SHA_CTX. SHA384 and SHA512 use SHA512_CTX. The buffer md must have space for the output from the SHA variant being used (defined by SHA224_DIGEST_LENGTH, SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and SHA512_DIGEST_LENGTH). Also note that, as for the SHA1() function above, the SHA224(), SHA256(), SHA384() and SHA512() functions are not thread safe if md is NULL.

                      "},{"location":"man3/SHA256_Init/#return-values","title":"RETURN VALUES","text":"

                      SHA1(), SHA224(), SHA256(), SHA384() and SHA512() return a pointer to the hash value.

                      SHA1_Init(), SHA1_Update() and SHA1_Final() and equivalent SHA224, SHA256, SHA384 and SHA512 functions return 1 for success, 0 otherwise.

                      "},{"location":"man3/SHA256_Init/#conforming-to","title":"CONFORMING TO","text":"

                      US Federal Information Processing Standard FIPS PUB 180-4 (Secure Hash Standard), ANSI X9.30

                      "},{"location":"man3/SHA256_Init/#see-also","title":"SEE ALSO","text":"

                      EVP_Q_digest(3), EVP_DigestInit(3)

                      "},{"location":"man3/SHA256_Init/#history","title":"HISTORY","text":"

                      All of these functions except SHA*() were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/SHA256_Init/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SMIME_read_ASN1/","title":"SMIME_read_ASN1","text":""},{"location":"man3/SMIME_read_ASN1/#name","title":"NAME","text":"

                      SMIME_read_ASN1_ex, SMIME_read_ASN1 - parse S/MIME message

                      "},{"location":"man3/SMIME_read_ASN1/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/asn1.h>\n\nASN1_VALUE *SMIME_read_ASN1_ex(BIO *in, int flags, BIO **bcont,\n                               const ASN1_ITEM *it, ASN1_VALUE **x,\n                               OSSL_LIB_CTX *libctx, const char *propq);\nASN1_VALUE *SMIME_read_ASN1(BIO *in, BIO **bcont, const ASN1_ITEM *it);\n
                      "},{"location":"man3/SMIME_read_ASN1/#description","title":"DESCRIPTION","text":"

                      SMIME_read_ASN1_ex() parses a message in S/MIME format.

                      in is a BIO to read the message from. If the flags argument contains CMS_BINARY then the input is assumed to be in binary format and is not translated to canonical form. If in addition SMIME_ASCIICRLF is set then the binary input is assumed to be followed by CR and LF characters, else only by an LF character. x can be used to optionally supply a previously created it ASN1_VALUE object (such as CMS_ContentInfo or PKCS7), it can be set to NULL. Valid values that can be used by ASN.1 structure it are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo). Any algorithm fetches that occur during the operation will use the OSSL_LIB_CTX supplied in the libctx parameter, and use the property query string propq See \"ALGORITHM FETCHING\" in crypto(7) for further details about algorithm fetching.

                      If cleartext signing is used then the content is saved in a memory bio which is written to *bcont, otherwise *bcont is set to NULL.

                      The parsed ASN1_VALUE structure is returned or NULL if an error occurred.

                      SMIME_read_ASN1() is similar to SMIME_read_ASN1_ex() but sets the value of x to NULL and the value of flags to 0.

                      "},{"location":"man3/SMIME_read_ASN1/#notes","title":"NOTES","text":"

                      The higher level functions SMIME_read_CMS_ex(3) and SMIME_read_PKCS7_ex(3) should be used instead of SMIME_read_ASN1_ex().

                      To support future functionality if bcont is not NULL *bcont should be initialized to NULL.

                      "},{"location":"man3/SMIME_read_ASN1/#bugs","title":"BUGS","text":"

                      The MIME parser used by SMIME_read_ASN1_ex() is somewhat primitive. While it will handle most S/MIME messages more complex compound formats may not work.

                      The use of a memory BIO to hold the signed content limits the size of message which can be processed due to memory restraints: a streaming single pass option should be available.

                      "},{"location":"man3/SMIME_read_ASN1/#return-values","title":"RETURN VALUES","text":"

                      SMIME_read_ASN1_ex() and SMIME_read_ASN1() return a valid ASN1_VALUE structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                      "},{"location":"man3/SMIME_read_ASN1/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), SMIME_read_CMS_ex(3), SMIME_read_PKCS7_ex(3), SMIME_write_ASN1(3), SMIME_write_ASN1_ex(3)

                      "},{"location":"man3/SMIME_read_ASN1/#history","title":"HISTORY","text":"

                      The function SMIME_read_ASN1_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/SMIME_read_ASN1/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SMIME_read_CMS/","title":"SMIME_read_CMS","text":""},{"location":"man3/SMIME_read_CMS/#name","title":"NAME","text":"

                      SMIME_read_CMS_ex, SMIME_read_CMS - parse S/MIME message

                      "},{"location":"man3/SMIME_read_CMS/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/cms.h>\n\nCMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont,\n                                   CMS_ContentInfo **cms);\nCMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);\n
                      "},{"location":"man3/SMIME_read_CMS/#description","title":"DESCRIPTION","text":"

                      SMIME_read_CMS() parses a message in S/MIME format.

                      in is a BIO to read the message from.

                      If cleartext signing is used then the content is saved in a memory bio which is written to *bcont, otherwise *bcont is set to NULL.

                      The parsed CMS_ContentInfo structure is returned or NULL if an error occurred.

                      SMIME_read_CMS_ex() is similar to SMIME_read_CMS() but optionally a previously created cms CMS_ContentInfo object can be supplied as well as some flags. To create a cms object use CMS_ContentInfo_new_ex(3). If the flags argument contains CMS_BINARY then the input is assumed to be in binary format and is not translated to canonical form. If in addition SMIME_ASCIICRLF is set then the binary input is assumed to be followed by CR and LF characters, else only by an LF character. If flags is 0 and cms is NULL then it is identical to SMIME_read_CMS().

                      "},{"location":"man3/SMIME_read_CMS/#notes","title":"NOTES","text":"

                      If *bcont is not NULL then the message is clear text signed. *bcont can then be passed to CMS_verify() with the CMS_DETACHED flag set.

                      Otherwise the type of the returned structure can be determined using CMS_get0_type().

                      To support future functionality if bcont is not NULL *bcont should be initialized to NULL. For example:

                      BIO *cont = NULL;\nCMS_ContentInfo *cms;\n\ncms = SMIME_read_CMS(in, &cont);\n
                      "},{"location":"man3/SMIME_read_CMS/#bugs","title":"BUGS","text":"

                      The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it will handle most S/MIME messages more complex compound formats may not work.

                      The parser assumes that the CMS_ContentInfo structure is always base64 encoded and will not handle the case where it is in binary format or uses quoted printable format.

                      The use of a memory BIO to hold the signed content limits the size of message which can be processed due to memory restraints: a streaming single pass option should be available.

                      "},{"location":"man3/SMIME_read_CMS/#return-values","title":"RETURN VALUES","text":"

                      SMIME_read_CMS_ex() and SMIME_read_CMS() return a valid CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                      "},{"location":"man3/SMIME_read_CMS/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3), CMS_decrypt(3)

                      "},{"location":"man3/SMIME_read_CMS/#history","title":"HISTORY","text":"

                      The function SMIME_read_CMS_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/SMIME_read_CMS/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SMIME_read_PKCS7/","title":"SMIME_read_PKCS7","text":""},{"location":"man3/SMIME_read_PKCS7/#name","title":"NAME","text":"

                      SMIME_read_PKCS7_ex, SMIME_read_PKCS7 - parse S/MIME message

                      "},{"location":"man3/SMIME_read_PKCS7/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nPKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7);\nPKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont);\n
                      "},{"location":"man3/SMIME_read_PKCS7/#description","title":"DESCRIPTION","text":"

                      SMIME_read_PKCS7() parses a message in S/MIME format.

                      in is a BIO to read the message from.

                      If cleartext signing is used then the content is saved in a memory bio which is written to *bcont, otherwise *bcont is set to NULL.

                      The parsed PKCS#7 structure is returned or NULL if an error occurred.

                      SMIME_read_PKCS7_ex() is similar to SMIME_read_PKCS7() but can optionally supply a previously created p7 PKCS#7 object. If p7 is NULL then it is identical to SMIME_read_PKCS7(). To create a p7 object use PKCS7_new_ex(3).

                      "},{"location":"man3/SMIME_read_PKCS7/#notes","title":"NOTES","text":"

                      If *bcont is not NULL then the message is clear text signed. *bcont can then be passed to PKCS7_verify() with the PKCS7_DETACHED flag set.

                      Otherwise the type of the returned structure can be determined using PKCS7_type_is_enveloped(), etc.

                      To support future functionality if bcont is not NULL *bcont should be initialized to NULL. For example:

                      BIO *cont = NULL;\nPKCS7 *p7;\n\np7 = SMIME_read_PKCS7(in, &cont);\n
                      "},{"location":"man3/SMIME_read_PKCS7/#bugs","title":"BUGS","text":"

                      The MIME parser used by SMIME_read_PKCS7() is somewhat primitive. While it will handle most S/MIME messages more complex compound formats may not work.

                      The parser assumes that the PKCS7 structure is always base64 encoded and will not handle the case where it is in binary format or uses quoted printable format.

                      The use of a memory BIO to hold the signed content limits the size of message which can be processed due to memory restraints: a streaming single pass option should be available.

                      "},{"location":"man3/SMIME_read_PKCS7/#return-values","title":"RETURN VALUES","text":"

                      SMIME_read_PKCS7_ex() and SMIME_read_PKCS7() return a valid PKCS7 structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                      "},{"location":"man3/SMIME_read_PKCS7/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), SMIME_read_PKCS7(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3)

                      "},{"location":"man3/SMIME_read_PKCS7/#history","title":"HISTORY","text":"

                      The function SMIME_read_PKCS7_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/SMIME_read_PKCS7/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SMIME_write_ASN1/","title":"SMIME_write_ASN1","text":""},{"location":"man3/SMIME_write_ASN1/#name","title":"NAME","text":"

                      SMIME_write_ASN1_ex, SMIME_write_ASN1 - convert structure to S/MIME format

                      "},{"location":"man3/SMIME_write_ASN1/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/asn1.h>\n\nint SMIME_write_ASN1_ex(BIO *out, ASN1_VALUE *val, BIO *data, int flags,\n                        int ctype_nid, int econt_nid,\n                        STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it,\n                        OSSL_LIB_CTX *libctx, const char *propq);\n\nint SMIME_write_ASN1(BIO *out,\n    ASN1_VALUE *val, BIO *data, int flags, int ctype_nid, int econt_nid,\n    STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);\n
                      "},{"location":"man3/SMIME_write_ASN1/#description","title":"DESCRIPTION","text":"

                      SMIME_write_ASN1_ex() adds the appropriate MIME headers to an object structure to produce an S/MIME message.

                      out is the BIO to write the data to. value is the appropriate ASN1_VALUE structure (either CMS_ContentInfo or PKCS7). If streaming is enabled then the content must be supplied via data. flags is an optional set of flags. ctype_nid is the NID of the content type, econt_nid is the NID of the embedded content type and mdalgs is a list of signed data digestAlgorithms. Valid values that can be used by the ASN.1 structure it are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo). The library context libctx and the property query propq are used when retrieving algorithms from providers.

                      "},{"location":"man3/SMIME_write_ASN1/#notes","title":"NOTES","text":"

                      The higher level functions SMIME_write_CMS(3) and SMIME_write_PKCS7(3) should be used instead of SMIME_write_ASN1().

                      The following flags can be passed in the flags parameter.

                      If CMS_DETACHED is set then cleartext signing will be used, this option only makes sense for SignedData where CMS_DETACHED is also set when the sign() method is called.

                      If the CMS_TEXT flag is set MIME headers for type text/plain are added to the content, this only makes sense if CMS_DETACHED is also set.

                      If the CMS_STREAM flag is set streaming is performed. This flag should only be set if CMS_STREAM was also set in the previous call to a CMS_ContentInfo or PKCS7 creation function.

                      If cleartext signing is being used and CMS_STREAM not set then the data must be read twice: once to compute the signature in sign method and once to output the S/MIME message.

                      If streaming is performed the content is output in BER format using indefinite length constructed encoding except in the case of signed data with detached content where the content is absent and DER format is used.

                      "},{"location":"man3/SMIME_write_ASN1/#return-values","title":"RETURN VALUES","text":"

                      SMIME_write_ASN1_ex() and SMIME_write_ASN1() return 1 for success or 0 for failure.

                      "},{"location":"man3/SMIME_write_ASN1/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), SMIME_write_CMS(3), SMIME_write_PKCS7(3)

                      "},{"location":"man3/SMIME_write_ASN1/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SMIME_write_CMS/","title":"SMIME_write_CMS","text":""},{"location":"man3/SMIME_write_CMS/#name","title":"NAME","text":"

                      SMIME_write_CMS - convert CMS structure to S/MIME format

                      "},{"location":"man3/SMIME_write_CMS/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/cms.h>\n\nint SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);\n
                      "},{"location":"man3/SMIME_write_CMS/#description","title":"DESCRIPTION","text":"

                      SMIME_write_CMS() adds the appropriate MIME headers to a CMS structure to produce an S/MIME message.

                      out is the BIO to write the data to. cms is the appropriate CMS_ContentInfo structure. If streaming is enabled then the content must be supplied in the data argument. flags is an optional set of flags.

                      "},{"location":"man3/SMIME_write_CMS/#notes","title":"NOTES","text":"

                      The following flags can be passed in the flags parameter.

                      If CMS_DETACHED is set then cleartext signing will be used, this option only makes sense for SignedData where CMS_DETACHED is also set when CMS_sign() is called.

                      If the CMS_TEXT flag is set MIME headers for type text/plain are added to the content, this only makes sense if CMS_DETACHED is also set.

                      If the CMS_STREAM flag is set streaming is performed. This flag should only be set if CMS_STREAM was also set in the previous call to a CMS_ContentInfo creation function.

                      If cleartext signing is being used and CMS_STREAM not set then the data must be read twice: once to compute the signature in CMS_sign() and once to output the S/MIME message.

                      If streaming is performed the content is output in BER format using indefinite length constructed encoding except in the case of signed data with detached content where the content is absent and DER format is used.

                      "},{"location":"man3/SMIME_write_CMS/#bugs","title":"BUGS","text":"

                      SMIME_write_CMS() always base64 encodes CMS structures, there should be an option to disable this.

                      "},{"location":"man3/SMIME_write_CMS/#return-values","title":"RETURN VALUES","text":"

                      SMIME_write_CMS() returns 1 for success or 0 for failure.

                      "},{"location":"man3/SMIME_write_CMS/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3) CMS_decrypt(3)

                      "},{"location":"man3/SMIME_write_CMS/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SMIME_write_PKCS7/","title":"SMIME_write_PKCS7","text":""},{"location":"man3/SMIME_write_PKCS7/#name","title":"NAME","text":"

                      SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format

                      "},{"location":"man3/SMIME_write_PKCS7/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/pkcs7.h>\n\nint SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags);\n
                      "},{"location":"man3/SMIME_write_PKCS7/#description","title":"DESCRIPTION","text":"

                      SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7 structure to produce an S/MIME message.

                      out is the BIO to write the data to. p7 is the appropriate PKCS7 structure. If streaming is enabled then the content must be supplied in the data argument. flags is an optional set of flags.

                      "},{"location":"man3/SMIME_write_PKCS7/#notes","title":"NOTES","text":"

                      The following flags can be passed in the flags parameter.

                      If PKCS7_DETACHED is set then cleartext signing will be used, this option only makes sense for signedData where PKCS7_DETACHED is also set when PKCS7_sign() is also called.

                      If the PKCS7_TEXT flag is set MIME headers for type text/plain are added to the content, this only makes sense if PKCS7_DETACHED is also set.

                      If the PKCS7_STREAM flag is set streaming is performed. This flag should only be set if PKCS7_STREAM was also set in the previous call to PKCS7_sign() or PKCS7_encrypt().

                      If cleartext signing is being used and PKCS7_STREAM not set then the data must be read twice: once to compute the signature in PKCS7_sign() and once to output the S/MIME message.

                      If streaming is performed the content is output in BER format using indefinite length constructed encoding except in the case of signed data with detached content where the content is absent and DER format is used.

                      "},{"location":"man3/SMIME_write_PKCS7/#bugs","title":"BUGS","text":"

                      SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there should be an option to disable this.

                      "},{"location":"man3/SMIME_write_PKCS7/#return-values","title":"RETURN VALUES","text":"

                      SMIME_write_PKCS7() returns 1 for success or 0 for failure.

                      "},{"location":"man3/SMIME_write_PKCS7/#see-also","title":"SEE ALSO","text":"

                      ERR_get_error(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3)

                      "},{"location":"man3/SMIME_write_PKCS7/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SRP_Calc_B/","title":"SRP_Calc_B","text":""},{"location":"man3/SRP_Calc_B/#name","title":"NAME","text":"

                      SRP_Calc_server_key, SRP_Calc_A, SRP_Calc_B_ex, SRP_Calc_B, SRP_Calc_u_ex, SRP_Calc_u, SRP_Calc_x_ex, SRP_Calc_x, SRP_Calc_client_key_ex, SRP_Calc_client_key - SRP authentication primitives

                      "},{"location":"man3/SRP_Calc_B/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/srp.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      /* server side .... */\nBIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,\n                            const BIGNUM *b, const BIGNUM *N);\nBIGNUM *SRP_Calc_B_ex(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,\n                      const BIGNUM *v, OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,\n                  const BIGNUM *v);\n\nBIGNUM *SRP_Calc_u_ex(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N,\n                      OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N);\n\n/* client side .... */\nBIGNUM *SRP_Calc_client_key_ex(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,\n                            const BIGNUM *x, const BIGNUM *a, const BIGNUM *u,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,\n                            const BIGNUM *x, const BIGNUM *a, const BIGNUM *u);\nBIGNUM *SRP_Calc_x_ex(const BIGNUM *s, const char *user, const char *pass,\n                      OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass);\nBIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g);\n
                      "},{"location":"man3/SRP_Calc_B/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                      The SRP functions described on this page are used to calculate various parameters and keys used by SRP as defined in RFC2945. The server key and B and u parameters are used on the server side and are calculated via SRP_Calc_server_key(), SRP_Calc_B_ex(), SRP_Calc_B(), SRP_Calc_u_ex() and SRP_Calc_u(). The client key and x and A parameters are used on the client side and are calculated via the functions SRP_Calc_client_key_ex(), SRP_Calc_client_key(), SRP_Calc_x_ex(), SRP_Calc_x() and SRP_Calc_A(). See RFC2945 for a detailed description of their usage and the meaning of the various BIGNUM parameters to these functions.

                      Most of these functions come in two forms. Those that take a libctx and propq parameter, and those that don't. Any cryptogrpahic functions that are fetched and used during the calculation use the provided libctx and propq. See \"ALGORITHM FETCHING\" in crypto(7) for more details. The variants that do not take a libctx and propq parameter use the default library context and property query string. The SRP_Calc_server_key() and SRP_Calc_A() functions do not have a form that takes libctx or propq parameters because they do not need to fetch any cryptographic algorithms.

                      "},{"location":"man3/SRP_Calc_B/#return-values","title":"RETURN VALUES","text":"

                      All these functions return the calculated key or parameter, or NULL on error.

                      "},{"location":"man3/SRP_Calc_B/#see-also","title":"SEE ALSO","text":"

                      openssl-srp(1), SRP_VBASE_new(3), SRP_user_pwd_new(3)

                      "},{"location":"man3/SRP_Calc_B/#history","title":"HISTORY","text":"

                      SRP_Calc_B_ex, SRP_Calc_u_ex, SRP_Calc_client_key_ex and SRP_Calc_x_ex were introduced in OpenSSL 3.0.

                      All of the other functions were added in OpenSSL 1.0.1.

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/SRP_Calc_B/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SRP_VBASE_new/","title":"SRP_VBASE_new","text":""},{"location":"man3/SRP_VBASE_new/#name","title":"NAME","text":"

                      SRP_VBASE_new, SRP_VBASE_free, SRP_VBASE_init, SRP_VBASE_add0_user, SRP_VBASE_get1_by_user, SRP_VBASE_get_by_user - Functions to create and manage a stack of SRP user verifier information

                      "},{"location":"man3/SRP_VBASE_new/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/srp.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      SRP_VBASE *SRP_VBASE_new(char *seed_key);\nvoid SRP_VBASE_free(SRP_VBASE *vb);\n\nint SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);\n\nint SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd);\nSRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);\nSRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);\n
                      "},{"location":"man3/SRP_VBASE_new/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                      The SRP_VBASE_new() function allocates a structure to store server side SRP verifier information. If seed_key is not NULL a copy is stored and used to generate dummy parameters for users that are not found by SRP_VBASE_get1_by_user(). This allows the server to hide the fact that it doesn't have a verifier for a particular username, as described in section 2.5.1.3 'Unknown SRP' of RFC 5054. The seed string should contain random NUL terminated binary data (therefore the random data should not contain NUL bytes!).

                      The SRP_VBASE_free() function frees up the vb structure. If vb is NULL, nothing is done.

                      The SRP_VBASE_init() function parses the information in a verifier file and populates the vb structure. The verifier file is a text file containing multiple entries, whose format is: flag base64(verifier) base64(salt) username gNid userinfo(optional) where the flag can be 'V' (valid) or 'R' (revoked). Note that the base64 encoding used here is non-standard so it is recommended to use openssl-srp(1) to generate this file.

                      The SRP_VBASE_add0_user() function adds the user_pwd verifier information to the vb structure. See SRP_user_pwd_new(3) to create and populate this record. The library takes ownership of user_pwd, it should not be freed by the caller.

                      The SRP_VBASE_get1_by_user() function returns the password info for the user whose username matches username. It replaces the deprecated SRP_VBASE_get_by_user(). If no matching user is found but a seed_key and default gN parameters have been set, dummy authentication information is generated from the seed_key, allowing the server to hide the fact that it doesn't have a verifier for a particular username. When using SRP as a TLS authentication mechanism, this will cause the handshake to proceed normally but the first client will be rejected with a \"bad_record_mac\" alert, as if the password was incorrect. If no matching user is found and the seed_key is not set, NULL is returned. Ownership of the returned pointer is released to the caller, it must be freed with SRP_user_pwd_free().

                      "},{"location":"man3/SRP_VBASE_new/#return-values","title":"RETURN VALUES","text":"

                      SRP_VBASE_init() returns SRP_NO_ERROR (0) on success and a positive value on failure. The error codes are SRP_ERR_OPEN_FILE if the file could not be opened, SRP_ERR_VBASE_INCOMPLETE_FILE if the file could not be parsed, SRP_ERR_MEMORY on memory allocation failure and SRP_ERR_VBASE_BN_LIB for invalid decoded parameter values.

                      SRP_VBASE_add0_user() returns 1 on success and 0 on failure.

                      "},{"location":"man3/SRP_VBASE_new/#see-also","title":"SEE ALSO","text":"

                      openssl-srp(1), SRP_create_verifier(3), SRP_user_pwd_new(3), SSL_CTX_set_srp_password(3)

                      "},{"location":"man3/SRP_VBASE_new/#history","title":"HISTORY","text":"

                      The SRP_VBASE_add0_user() function was added in OpenSSL 3.0.

                      All other functions were added in OpenSSL 1.0.1.

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/SRP_VBASE_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SRP_create_verifier/","title":"SRP_create_verifier","text":""},{"location":"man3/SRP_create_verifier/#name","title":"NAME","text":"

                      SRP_create_verifier_ex, SRP_create_verifier, SRP_create_verifier_BN_ex, SRP_create_verifier_BN, SRP_check_known_gN_param, SRP_get_default_gN - SRP authentication primitives

                      "},{"location":"man3/SRP_create_verifier/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/srp.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt,\n                              BIGNUM **verifier, const BIGNUM *N,\n                              const BIGNUM *g, OSSL_LIB_CTX *libctx,\n                              const char *propq);\nchar *SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,\n                             BIGNUM **verifier, const BIGNUM *N, const BIGNUM *g);\nchar *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,\n                             char **verifier, const char *N, const char *g,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nchar *SRP_create_verifier(const char *user, const char *pass, char **salt,\n                          char **verifier, const char *N, const char *g);\n\nchar *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);\nSRP_gN *SRP_get_default_gN(const char *id);\n
                      "},{"location":"man3/SRP_create_verifier/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                      The SRP_create_verifier_BN_ex() function creates an SRP password verifier from the supplied parameters as defined in section 2.4 of RFC 5054 using the library context libctx and property query string propq. Any cryptographic algorithms that need to be fetched will use the libctx and propq. See \"ALGORITHM FETCHING\" in crypto(7).

                      SRP_create_verifier_BN() is the same as SRP_create_verifier_BN_ex() except the default library context and property query string is used.

                      On successful exit *verifier will point to a newly allocated BIGNUM containing the verifier and (if a salt was not provided) *salt will be populated with a newly allocated BIGNUM containing a random salt. If *salt is not NULL then the provided salt is used instead. The caller is responsible for freeing the allocated *salt and *verifier BIGNUMS (use BN_free(3)).

                      The SRP_create_verifier() function is similar to SRP_create_verifier_BN() but all numeric parameters are in a non-standard base64 encoding originally designed for compatibility with libsrp. This is mainly present for historical compatibility and its use is discouraged. It is possible to pass NULL as N and an SRP group id as g instead to load the appropriate gN values (see SRP_get_default_gN()). If both N and g are NULL the 8192-bit SRP group parameters are used. The caller is responsible for freeing the allocated *salt and *verifier (use OPENSSL_free(3)).

                      The SRP_check_known_gN_param() function checks that g and N are valid SRP group parameters from RFC 5054 appendix A.

                      The SRP_get_default_gN() function returns the gN parameters for the RFC 5054 id SRP group size. The known ids are \"1024\", \"1536\", \"2048\", \"3072\", \"4096\", \"6144\" and \"8192\".

                      "},{"location":"man3/SRP_create_verifier/#return-values","title":"RETURN VALUES","text":"

                      SRP_create_verifier_BN_ex() and SRP_create_verifier_BN() return 1 on success and 0 on failure.

                      SRP_create_verifier_ex() and SRP_create_verifier() return NULL on failure and a non-NULL value on success: \"*\" if N is not NULL, the selected group id otherwise. This value should not be freed.

                      SRP_check_known_gN_param() returns the text representation of the group id (i.e. the prime bit size) or NULL if the arguments are not valid SRP group parameters. This value should not be freed.

                      SRP_get_default_gN() returns NULL if id is not a valid group size, or the 8192-bit group parameters if id is NULL.

                      "},{"location":"man3/SRP_create_verifier/#examples","title":"EXAMPLES","text":"

                      Generate and store a 8192 bit password verifier (error handling omitted for clarity):

                      #include <openssl/bn.h>\n#include <openssl/srp.h>\n\nconst char *username = \"username\";\nconst char *password = \"password\";\n\nSRP_VBASE *srpData = SRP_VBASE_new(NULL);\n\nSRP_gN *gN = SRP_get_default_gN(\"8192\");\n\nBIGNUM *salt = NULL, *verifier = NULL;\nSRP_create_verifier_BN_ex(username, password, &salt, &verifier, gN->N, gN->g,\n                          NULL, NULL);\n\nSRP_user_pwd *pwd = SRP_user_pwd_new();\nSRP_user_pwd_set1_ids(pwd, username, NULL);\nSRP_user_pwd_set0_sv(pwd, salt, verifier);\nSRP_user_pwd_set_gN(pwd, gN->g, gN->N);\n\nSRP_VBASE_add0_user(srpData, pwd);\n
                      "},{"location":"man3/SRP_create_verifier/#see-also","title":"SEE ALSO","text":"

                      openssl-srp(1), SRP_VBASE_new(3), SRP_user_pwd_new(3)

                      "},{"location":"man3/SRP_create_verifier/#history","title":"HISTORY","text":"

                      SRP_create_verifier_BN_ex() and SRP_create_verifier_ex() were introduced in OpenSSL 3.0. All other functions were added in OpenSSL 1.0.1.

                      All of these functions were deprecated in OpenSSL 3.0.

                      "},{"location":"man3/SRP_create_verifier/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SRP_user_pwd_new/","title":"SRP_user_pwd_new","text":""},{"location":"man3/SRP_user_pwd_new/#name","title":"NAME","text":"

                      SRP_user_pwd_new, SRP_user_pwd_free, SRP_user_pwd_set1_ids, SRP_user_pwd_set_gN, SRP_user_pwd_set0_sv - Functions to create a record of SRP user verifier information

                      "},{"location":"man3/SRP_user_pwd_new/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/srp.h>\n

                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      SRP_user_pwd *SRP_user_pwd_new(void);\nvoid SRP_user_pwd_free(SRP_user_pwd *user_pwd);\n\nint SRP_user_pwd_set1_ids(SRP_user_pwd *user_pwd, const char *id, const char *info);\nvoid SRP_user_pwd_set_gN(SRP_user_pwd *user_pwd, const BIGNUM *g, const BIGNUM *N);\nint SRP_user_pwd_set0_sv(SRP_user_pwd *user_pwd, BIGNUM *s, BIGNUM *v);\n
                      "},{"location":"man3/SRP_user_pwd_new/#description","title":"DESCRIPTION","text":"

                      All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                      The SRP_user_pwd_new() function allocates a structure to store a user verifier record.

                      The SRP_user_pwd_free() function frees up the user_pwd structure. If user_pwd is NULL, nothing is done.

                      The SRP_user_pwd_set1_ids() function sets the username to id and the optional user info to info for user_pwd. The library allocates new copies of id and info, the caller still owns the original memory.

                      The SRP_user_pwd_set0_sv() function sets the user salt to s and the verifier to v for user_pwd. The library takes ownership of the values, they should not be freed by the caller.

                      The SRP_user_pwd_set_gN() function sets the SRP group parameters for user_pwd. The memory is not freed by SRP_user_pwd_free(), the caller must make sure it is freed once it is no longer used.

                      "},{"location":"man3/SRP_user_pwd_new/#return-values","title":"RETURN VALUES","text":"

                      SRP_user_pwd_set1_ids() returns 1 on success and 0 on failure or if id was NULL.

                      SRP_user_pwd_set0_sv() returns 1 if both s and v are not NULL, 0 otherwise.

                      "},{"location":"man3/SRP_user_pwd_new/#see-also","title":"SEE ALSO","text":"

                      openssl-srp(1), SRP_create_verifier(3), SRP_VBASE_new(3), SSL_CTX_set_srp_password(3)

                      "},{"location":"man3/SRP_user_pwd_new/#history","title":"HISTORY","text":"

                      These functions were made public in OpenSSL 3.0 and are deprecated.

                      "},{"location":"man3/SRP_user_pwd_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CIPHER_get_name/","title":"SSL_CIPHER_get_name","text":""},{"location":"man3/SSL_CIPHER_get_name/#name","title":"NAME","text":"

                      SSL_CIPHER_get_name, SSL_CIPHER_standard_name, OPENSSL_cipher_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, SSL_CIPHER_description, SSL_CIPHER_get_cipher_nid, SSL_CIPHER_get_digest_nid, SSL_CIPHER_get_handshake_digest, SSL_CIPHER_get_kx_nid, SSL_CIPHER_get_auth_nid, SSL_CIPHER_is_aead, SSL_CIPHER_find, SSL_CIPHER_get_id, SSL_CIPHER_get_protocol_id - get SSL_CIPHER properties

                      "},{"location":"man3/SSL_CIPHER_get_name/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nconst char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);\nconst char *SSL_CIPHER_standard_name(const SSL_CIPHER *cipher);\nconst char *OPENSSL_cipher_name(const char *stdname);\nint SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);\nconst char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);\nchar *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size);\nint SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);\nint SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);\nconst EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);\nint SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);\nint SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);\nint SSL_CIPHER_is_aead(const SSL_CIPHER *c);\nconst SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr);\nuint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c);\nuint32_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c);\n
                      "},{"location":"man3/SSL_CIPHER_get_name/#description","title":"DESCRIPTION","text":"

                      SSL_CIPHER_get_name() returns a pointer to the name of cipher. If the cipher is NULL, it returns \"(NONE)\".

                      SSL_CIPHER_standard_name() returns a pointer to the standard RFC name of cipher. If the cipher is NULL, it returns \"(NONE)\". If the cipher has no standard name, it returns NULL. If cipher was defined in both SSLv3 and TLS, it returns the TLS name.

                      OPENSSL_cipher_name() returns a pointer to the OpenSSL name of stdname. If the stdname is NULL, or stdname has no corresponding OpenSSL name, it returns \"(NONE)\". Where both exist, stdname should be the TLS name rather than the SSLv3 name.

                      SSL_CIPHER_get_bits() returns the number of secret bits used for cipher. If cipher is NULL, 0 is returned.

                      SSL_CIPHER_get_version() returns string which indicates the SSL/TLS protocol version that first defined the cipher. It returns \"(NONE)\" if cipher is NULL.

                      SSL_CIPHER_get_cipher_nid() returns the cipher NID corresponding to c. If there is no cipher (e.g. for cipher suites with no encryption) then NID_undef is returned.

                      SSL_CIPHER_get_digest_nid() returns the digest NID corresponding to the MAC used by c during record encryption/decryption. If there is no digest (e.g. for AEAD cipher suites) then NID_undef is returned.

                      SSL_CIPHER_get_handshake_digest() returns an EVP_MD for the digest used during the SSL/TLS handshake when using the SSL_CIPHER c. Note that this may be different to the digest used to calculate the MAC for encrypted records.

                      SSL_CIPHER_get_kx_nid() returns the key exchange NID corresponding to the method used by c. If there is no key exchange, then NID_undef is returned. If any appropriate key exchange algorithm can be used (as in the case of TLS 1.3 cipher suites) NID_kx_any is returned. Examples (not comprehensive):

                      NID_kx_rsa\nNID_kx_ecdhe\nNID_kx_dhe\nNID_kx_psk\n

                      SSL_CIPHER_get_auth_nid() returns the authentication NID corresponding to the method used by c. If there is no authentication, then NID_undef is returned. If any appropriate authentication algorithm can be used (as in the case of TLS 1.3 cipher suites) NID_auth_any is returned. Examples (not comprehensive):

                      NID_auth_rsa\nNID_auth_ecdsa\nNID_auth_psk\n

                      SSL_CIPHER_is_aead() returns 1 if the cipher c is AEAD (e.g. GCM or ChaCha20/Poly1305), and 0 if it is not AEAD.

                      SSL_CIPHER_find() returns a SSL_CIPHER structure which has the cipher ID stored in ptr. The ptr parameter is a two element array of char, which stores the two-byte TLS cipher ID (as allocated by IANA) in network byte order. This parameter is usually retrieved from a TLS packet by using functions like SSL_client_hello_get0_ciphers(3). SSL_CIPHER_find() returns NULL if an error occurs or the indicated cipher is not found.

                      SSL_CIPHER_get_id() returns the OpenSSL-specific ID of the given cipher c. That ID is not the same as the IANA-specific ID.

                      SSL_CIPHER_get_protocol_id() returns the two-byte ID used in the TLS protocol of the given cipher c.

                      SSL_CIPHER_description() returns a textual description of the cipher used into the buffer buf of length len provided. If buf is provided, it must be at least 128 bytes. If buf is NULL it will be allocated using OPENSSL_malloc(). If the provided buffer is too small, or the allocation fails, NULL is returned.

                      The string returned by SSL_CIPHER_description() consists of several fields separated by whitespace:

                      • <ciphername>

                        Textual representation of the cipher name.

                      • <protocol version>

                        The minimum protocol version that the ciphersuite supports, such as TLSv1.2. Note that this is not always the same as the protocol version in which the ciphersuite was first defined because some ciphersuites are backwards compatible with earlier protocol versions.

                      • Kx=<key exchange>

                        Key exchange method such as RSA, ECDHE, etc.

                      • Au=<authentication>

                        Authentication method such as RSA, None, etc.. None is the representation of anonymous ciphers.

                      • Enc=<symmetric encryption method>

                        Encryption method, with number of secret bits, such as AESGCM(128).

                      • Mac=<message authentication code>

                        Message digest, such as SHA256.

                      Some examples for the output of SSL_CIPHER_description():

                      ECDHE-RSA-AES256-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD\nRSA-PSK-AES256-CBC-SHA384 TLSv1.0 Kx=RSAPSK   Au=RSA  Enc=AES(256)  Mac=SHA384\n
                      "},{"location":"man3/SSL_CIPHER_get_name/#return-values","title":"RETURN VALUES","text":"

                      SSL_CIPHER_get_name(), SSL_CIPHER_standard_name(), OPENSSL_cipher_name(), SSL_CIPHER_get_version() and SSL_CIPHER_description() return the corresponding value in a NUL-terminated string for a specific cipher or \"(NONE)\" if the cipher is not found.

                      SSL_CIPHER_get_bits() returns a positive integer representing the number of secret bits or 0 if an error occurred.

                      SSL_CIPHER_get_cipher_nid(), SSL_CIPHER_get_digest_nid(), SSL_CIPHER_get_kx_nid() and SSL_CIPHER_get_auth_nid() return the NID value or NID_undef if an error occurred.

                      SSL_CIPHER_get_handshake_digest() returns a valid EVP_MD structure or NULL if an error occurred.

                      SSL_CIPHER_is_aead() returns 1 if the cipher is AEAD or 0 otherwise.

                      SSL_CIPHER_find() returns a valid SSL_CIPHER structure or NULL if an error occurred.

                      SSL_CIPHER_get_id() returns a 4-byte integer representing the OpenSSL-specific ID.

                      SSL_CIPHER_get_protocol_id() returns a 2-byte integer representing the TLS protocol-specific ID.

                      "},{"location":"man3/SSL_CIPHER_get_name/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_get_current_cipher(3), SSL_get_ciphers(3), openssl-ciphers(1)

                      "},{"location":"man3/SSL_CIPHER_get_name/#history","title":"HISTORY","text":"

                      The SSL_CIPHER_get_version() function was updated to always return the correct protocol string in OpenSSL 1.1.0.

                      The SSL_CIPHER_description() function was changed to return NULL on error, rather than a fixed string, in OpenSSL 1.1.0.

                      The SSL_CIPHER_get_handshake_digest() function was added in OpenSSL 1.1.1.

                      The SSL_CIPHER_standard_name() function was globally available in OpenSSL 1.1.1. Before OpenSSL 1.1.1, tracing (enable-ssl-trace argument to Configure) was required to enable this function.

                      The OPENSSL_cipher_name() function was added in OpenSSL 1.1.1.

                      "},{"location":"man3/SSL_CIPHER_get_name/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_COMP_add_compression_method/","title":"SSL_COMP_add_compression_method","text":""},{"location":"man3/SSL_COMP_add_compression_method/#name","title":"NAME","text":"

                      SSL_COMP_add_compression_method, SSL_COMP_get_compression_methods, SSL_COMP_get0_name, SSL_COMP_get_id, SSL_COMP_free_compression_methods - handle SSL/TLS integrated compression methods

                      "},{"location":"man3/SSL_COMP_add_compression_method/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);\nSTACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);\nconst char *SSL_COMP_get0_name(const SSL_COMP *comp);\nint SSL_COMP_get_id(const SSL_COMP *comp);\n

                      The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                      void SSL_COMP_free_compression_methods(void);\n
                      "},{"location":"man3/SSL_COMP_add_compression_method/#description","title":"DESCRIPTION","text":"

                      SSL_COMP_add_compression_method() adds the compression method cm with the identifier id to the list of available compression methods. This list is globally maintained for all SSL operations within this application. It cannot be set for specific SSL_CTX or SSL objects.

                      SSL_COMP_get_compression_methods() returns a stack of all of the available compression methods or NULL on error.

                      SSL_COMP_get0_name() returns the name of the compression method comp.

                      SSL_COMP_get_id() returns the id of the compression method comp.

                      SSL_COMP_free_compression_methods() releases any resources acquired to maintain the internal table of compression methods.

                      "},{"location":"man3/SSL_COMP_add_compression_method/#notes","title":"NOTES","text":"

                      The TLS standard (or SSLv3) allows the integration of compression methods into the communication. The TLS RFC does however not specify compression methods or their corresponding identifiers, so there is currently no compatible way to integrate compression with unknown peers. It is therefore currently not recommended to integrate compression into applications. Applications for non-public use may agree on certain compression methods. Using different compression methods with the same identifier will lead to connection failure.

                      An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) will unconditionally send the list of all compression methods enabled with SSL_COMP_add_compression_method() to the server during the handshake. Unlike the mechanisms to set a cipher list, there is no method available to restrict the list of compression method on a per connection basis.

                      An OpenSSL server will match the identifiers listed by a client against its own compression methods and will unconditionally activate compression when a matching identifier is found. There is no way to restrict the list of compression methods supported on a per connection basis.

                      If enabled during compilation, the OpenSSL library will have the COMP_zlib() compression method available.

                      "},{"location":"man3/SSL_COMP_add_compression_method/#return-values","title":"RETURN VALUES","text":"

                      SSL_COMP_add_compression_method() may return the following values:

                      • 0

                        The operation succeeded.

                      • 1

                        The operation failed. Check the error queue to find out the reason.

                      SSL_COMP_get_compression_methods() returns the stack of compressions methods or NULL on error.

                      SSL_COMP_get0_name() returns the name of the compression method or NULL on error.

                      SSL_COMP_get_id() returns the name of the compression method or -1 on error.

                      "},{"location":"man3/SSL_COMP_add_compression_method/#see-also","title":"SEE ALSO","text":"

                      ssl(7)

                      "},{"location":"man3/SSL_COMP_add_compression_method/#history","title":"HISTORY","text":"

                      The SSL_COMP_free_compression_methods() function was deprecated in OpenSSL 1.1.0. The SSL_COMP_get0_name() and SSL_comp_get_id() functions were added in OpenSSL 1.1.0d.

                      "},{"location":"man3/SSL_COMP_add_compression_method/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CONF_CTX_new/","title":"SSL_CONF_CTX_new","text":""},{"location":"man3/SSL_CONF_CTX_new/#name","title":"NAME","text":"

                      SSL_CONF_CTX_new, SSL_CONF_CTX_free - SSL configuration allocation functions

                      "},{"location":"man3/SSL_CONF_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nSSL_CONF_CTX *SSL_CONF_CTX_new(void);\nvoid SSL_CONF_CTX_free(SSL_CONF_CTX *cctx);\n
                      "},{"location":"man3/SSL_CONF_CTX_new/#description","title":"DESCRIPTION","text":"

                      The function SSL_CONF_CTX_new() allocates and initialises an SSL_CONF_CTX structure for use with the SSL_CONF functions.

                      The function SSL_CONF_CTX_free() frees up the context cctx. If cctx is NULL nothing is done.

                      "},{"location":"man3/SSL_CONF_CTX_new/#return-values","title":"RETURN VALUES","text":"

                      SSL_CONF_CTX_new() returns either the newly allocated SSL_CONF_CTX structure or NULL if an error occurs.

                      SSL_CONF_CTX_free() does not return a value.

                      "},{"location":"man3/SSL_CONF_CTX_new/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                      "},{"location":"man3/SSL_CONF_CTX_new/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CONF_CTX_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/","title":"SSL_CONF_CTX_set1_prefix","text":""},{"location":"man3/SSL_CONF_CTX_set1_prefix/#name","title":"NAME","text":"

                      SSL_CONF_CTX_set1_prefix - Set configuration context command prefix

                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nunsigned int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *prefix);\n
                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#description","title":"DESCRIPTION","text":"

                      The function SSL_CONF_CTX_set1_prefix() sets the command prefix of cctx to prefix. If prefix is NULL it is restored to the default value.

                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#notes","title":"NOTES","text":"

                      Command prefixes alter the commands recognised by subsequent SSL_CONF_cmd() calls. For example for files, if the prefix \"SSL\" is set then command names such as \"SSLProtocol\", \"SSLOptions\" etc. are recognised instead of \"Protocol\" and \"Options\". Similarly for command lines if the prefix is \"--ssl-\" then \"--ssl-no_tls1_2\" is recognised instead of \"-no_tls1_2\".

                      If the SSL_CONF_FLAG_CMDLINE flag is set then prefix checks are case sensitive and \"-\" is the default. In the unlikely even an application explicitly wants to set no prefix it must be explicitly set to \"\".

                      If the SSL_CONF_FLAG_FILE flag is set then prefix checks are case insensitive and no prefix is the default.

                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#return-values","title":"RETURN VALUES","text":"

                      SSL_CONF_CTX_set1_prefix() returns 1 for success and 0 for failure.

                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CONF_CTX_set_flags/","title":"SSL_CONF_CTX_set_flags","text":""},{"location":"man3/SSL_CONF_CTX_set_flags/#name","title":"NAME","text":"

                      SSL_CONF_CTX_set_flags, SSL_CONF_CTX_clear_flags - Set or clear SSL configuration context flags

                      "},{"location":"man3/SSL_CONF_CTX_set_flags/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nunsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags);\nunsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, unsigned int flags);\n
                      "},{"location":"man3/SSL_CONF_CTX_set_flags/#description","title":"DESCRIPTION","text":"

                      The function SSL_CONF_CTX_set_flags() sets flags in the context cctx.

                      The function SSL_CONF_CTX_clear_flags() clears flags in the context cctx.

                      "},{"location":"man3/SSL_CONF_CTX_set_flags/#notes","title":"NOTES","text":"

                      The flags set affect how subsequent calls to SSL_CONF_cmd() or SSL_CONF_argv() behave.

                      Currently the following flags values are recognised:

                      • SSL_CONF_FLAG_CMDLINE, SSL_CONF_FLAG_FILE

                        recognise options intended for command line or configuration file use. At least one of these flags must be set.

                      • SSL_CONF_FLAG_CLIENT, SSL_CONF_FLAG_SERVER

                        recognise options intended for use in SSL/TLS clients or servers. One or both of these flags must be set.

                      • SSL_CONF_FLAG_CERTIFICATE

                        recognise certificate and private key options.

                      • SSL_CONF_FLAG_REQUIRE_PRIVATE

                        If this option is set then if a private key is not specified for a certificate it will attempt to load a private key from the certificate file when SSL_CONF_CTX_finish() is called. If a key cannot be loaded from the certificate file an error occurs.

                      • SSL_CONF_FLAG_SHOW_ERRORS

                        indicate errors relating to unrecognised options or missing arguments in the error queue. If this option isn't set such errors are only reflected in the return values of SSL_CONF_set_cmd() or SSL_CONF_set_argv()

                      "},{"location":"man3/SSL_CONF_CTX_set_flags/#return-values","title":"RETURN VALUES","text":"

                      SSL_CONF_CTX_set_flags() and SSL_CONF_CTX_clear_flags() returns the new flags value after setting or clearing flags.

                      "},{"location":"man3/SSL_CONF_CTX_set_flags/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                      "},{"location":"man3/SSL_CONF_CTX_set_flags/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CONF_CTX_set_flags/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/","title":"SSL_CONF_CTX_set_ssl_ctx","text":""},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#name","title":"NAME","text":"

                      SSL_CONF_CTX_finish, SSL_CONF_CTX_set_ssl_ctx, SSL_CONF_CTX_set_ssl - set context to configure

                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx);\nvoid SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl);\nint SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx);\n
                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#description","title":"DESCRIPTION","text":"

                      SSL_CONF_CTX_set_ssl_ctx() sets the context associated with cctx to the SSL_CTX structure ctx. Any previous SSL or SSL_CTX associated with cctx is cleared. Subsequent calls to SSL_CONF_cmd() will be sent to ctx.

                      SSL_CONF_CTX_set_ssl() sets the context associated with cctx to the SSL structure ssl. Any previous SSL or SSL_CTX associated with cctx is cleared. Subsequent calls to SSL_CONF_cmd() will be sent to ssl.

                      The function SSL_CONF_CTX_finish() must be called after all configuration operations have been completed. It is used to finalise any operations or to process defaults.

                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#notes","title":"NOTES","text":"

                      The context need not be set or it can be set to NULL in which case only syntax checking of commands is performed, where possible.

                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#return-values","title":"RETURN VALUES","text":"

                      SSL_CONF_CTX_set_ssl_ctx() and SSL_CTX_set_ssl() do not return a value.

                      SSL_CONF_CTX_finish() returns 1 for success and 0 for failure.

                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2012-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CONF_cmd/","title":"SSL_CONF_cmd","text":""},{"location":"man3/SSL_CONF_cmd/#name","title":"NAME","text":"

                      SSL_CONF_cmd_value_type, SSL_CONF_cmd - send configuration command

                      "},{"location":"man3/SSL_CONF_cmd/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CONF_cmd(SSL_CONF_CTX *ctx, const char *option, const char *value);\nint SSL_CONF_cmd_value_type(SSL_CONF_CTX *ctx, const char *option);\n
                      "},{"location":"man3/SSL_CONF_cmd/#description","title":"DESCRIPTION","text":"

                      The function SSL_CONF_cmd() performs configuration operation option with optional parameter value on ctx. Its purpose is to simplify application configuration of SSL_CTX or SSL structures by providing a common framework for command line options or configuration files.

                      SSL_CONF_cmd_value_type() returns the type of value that option refers to.

                      "},{"location":"man3/SSL_CONF_cmd/#supported-command-line-commands","title":"SUPPORTED COMMAND LINE COMMANDS","text":"

                      Currently supported option names for command lines (i.e. when the flag SSL_CONF_FLAG_CMDLINE is set) are listed below. Note: all option names are case sensitive. Unless otherwise stated commands can be used by both clients and servers and the value parameter is not used. The default prefix for command line commands is - and that is reflected below.

                      • -bugs

                        Various bug workarounds are set, same as setting SSL_OP_ALL.

                      • -no_comp

                        Disables support for SSL/TLS compression, same as setting SSL_OP_NO_COMPRESSION. As of OpenSSL 1.1.0, compression is off by default.

                      • -comp

                        Enables support for SSL/TLS compression, same as clearing SSL_OP_NO_COMPRESSION. This command was introduced in OpenSSL 1.1.0. As of OpenSSL 1.1.0, compression is off by default.

                      • -no_ticket

                        Disables support for session tickets, same as setting SSL_OP_NO_TICKET.

                      • -serverpref

                        Use server and not client preference order when determining which cipher suite, signature algorithm or elliptic curve to use for an incoming connection. Equivalent to SSL_OP_CIPHER_SERVER_PREFERENCE. Only used by servers.

                      • -client_renegotiation

                        Allows servers to accept client-initiated renegotiation. Equivalent to setting SSL_OP_ALLOW_CLIENT_RENEGOTIATION. Only used by servers.

                      • -legacy_renegotiation

                        Permits the use of unsafe legacy renegotiation. Equivalent to setting SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION.

                      • -no_renegotiation

                        Disables all attempts at renegotiation in TLSv1.2 and earlier, same as setting SSL_OP_NO_RENEGOTIATION.

                      • -no_resumption_on_reneg

                        Sets SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION. Only used by servers.

                      • -legacy_server_connect, -no_legacy_server_connect

                        Permits or prohibits the use of unsafe legacy renegotiation for OpenSSL clients only. Equivalent to setting or clearing SSL_OP_LEGACY_SERVER_CONNECT.

                      • -prioritize_chacha

                        Prioritize ChaCha ciphers when the client has a ChaCha20 cipher at the top of its preference list. This usually indicates a client without AES hardware acceleration (e.g. mobile) is in use. Equivalent to SSL_OP_PRIORITIZE_CHACHA. Only used by servers. Requires -serverpref.

                      • -allow_no_dhe_kex

                        In TLSv1.3 allow a non-(ec)dhe based key exchange mode on resumption. This means that there will be no forward secrecy for the resumed session.

                      • -strict

                        Enables strict mode protocol handling. Equivalent to setting SSL_CERT_FLAG_TLS_STRICT.

                      • -sigalgs algs

                        This sets the supported signature algorithms for TLSv1.2 and TLSv1.3. For clients this value is used directly for the supported signature algorithms extension. For servers it is used to determine which signature algorithms to support.

                        The algs argument should be a colon separated list of signature algorithms in order of decreasing preference of the form algorithm+hash or signature_scheme. algorithm is one of RSA, DSA or ECDSA and hash is a supported algorithm OID short name such as SHA1, SHA224, SHA256, SHA384 of SHA512. Note: algorithm and hash names are case sensitive. signature_scheme is one of the signature schemes defined in TLSv1.3, specified using the IETF name, e.g., ecdsa_secp256r1_sha256, ed25519, or rsa_pss_pss_sha256.

                        If this option is not set then all signature algorithms supported by the OpenSSL library are permissible.

                        Note: algorithms which specify a PKCS#1 v1.5 signature scheme (either by using RSA as the algorithm or by using one of the rsa_pkcs1_* identifiers) are ignored in TLSv1.3 and will not be negotiated.

                      • -client_sigalgs algs

                        This sets the supported signature algorithms associated with client authentication for TLSv1.2 and TLSv1.3. For servers the algs is used in the signature_algorithms field of a CertificateRequest message. For clients it is used to determine which signature algorithm to use with the client certificate. If a server does not request a certificate this option has no effect.

                        The syntax of algs is identical to -sigalgs. If not set, then the value set for -sigalgs will be used instead.

                      • -groups groups

                        This sets the supported groups. For clients, the groups are sent using the supported groups extension. For servers, it is used to determine which group to use. This setting affects groups used for signatures (in TLSv1.2 and earlier) and key exchange. The first group listed will also be used for the key_share sent by a client in a TLSv1.3 ClientHello.

                        The groups argument is a colon separated list of groups. The group can be either the NIST name (e.g. P-256), some other commonly used name where applicable (e.g. X25519, ffdhe2048) or an OpenSSL OID name (e.g. prime256v1). Group names are case sensitive. The list should be in order of preference with the most preferred group first.

                        Currently supported groups for TLSv1.3 are P-256, P-384, P-521, X25519, X448, ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192.

                      • -curves groups

                        This is a synonym for the -groups command.

                      • -named_curve curve

                        This sets the temporary curve used for ephemeral ECDH modes. Only used by servers.

                        The groups argument is a curve name or the special value auto which picks an appropriate curve based on client and server preferences. The curve can be either the NIST name (e.g. P-256) or an OpenSSL OID name (e.g. prime256v1). Curve names are case sensitive.

                      • -cipher ciphers

                        Sets the TLSv1.2 and below ciphersuite list to ciphers. This list will be combined with any configured TLSv1.3 ciphersuites. Note: syntax checking of ciphers is currently not performed unless a SSL or SSL_CTX structure is associated with ctx.

                      • -ciphersuites 1.3ciphers

                        Sets the available ciphersuites for TLSv1.3 to value. This is a colon-separated list of TLSv1.3 ciphersuite names in order of preference. This list will be combined any configured TLSv1.2 and below ciphersuites. See openssl-ciphers(1) for more information.

                      • -min_protocol minprot, -max_protocol maxprot

                        Sets the minimum and maximum supported protocol. Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3 for TLS; DTLSv1, DTLSv1.2 for DTLS, and None for no limit. If either the lower or upper bound is not specified then only the other bound applies, if specified. If your application supports both TLS and DTLS you can specify any of these options twice, once with a bound for TLS and again with an appropriate bound for DTLS. To restrict the supported protocol versions use these commands rather than the deprecated alternative commands below.

                      • -record_padding padding

                        Attempts to pad TLSv1.3 records so that they are a multiple of padding in length on send. A padding of 0 or 1 turns off padding. Otherwise, the padding must be >1 or <=16384.

                      • -debug_broken_protocol

                        Ignored.

                      • -no_middlebox

                        Turn off \"middlebox compatibility\", as described below.

                      "},{"location":"man3/SSL_CONF_cmd/#additional-options","title":"Additional Options","text":"

                      The following options are accepted by SSL_CONF_cmd(), but are not processed by the OpenSSL commands.

                      • -cert file

                        Attempts to use file as the certificate for the appropriate context. It currently uses SSL_CTX_use_certificate_chain_file() if an SSL_CTX structure is set or SSL_use_certificate_file() with filetype PEM if an SSL structure is set. This option is only supported if certificate operations are permitted.

                      • -key file

                        Attempts to use file as the private key for the appropriate context. This option is only supported if certificate operations are permitted. Note: if no -key option is set then a private key is not loaded unless the flag SSL_CONF_FLAG_REQUIRE_PRIVATE is set.

                      • -dhparam file

                        Attempts to use file as the set of temporary DH parameters for the appropriate context. This option is only supported if certificate operations are permitted.

                      • -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3

                        Disables protocol support for SSLv3, TLSv1.0, TLSv1.1, TLSv1.2 or TLSv1.3 by setting the corresponding options SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2 and SSL_OP_NO_TLSv1_3 respectively. These options are deprecated, use -min_protocol and -max_protocol instead.

                      • -anti_replay, -no_anti_replay

                        Switches replay protection, on or off respectively. With replay protection on, OpenSSL will automatically detect if a session ticket has been used more than once, TLSv1.3 has been negotiated, and early data is enabled on the server. A full handshake is forced if a session ticket is used a second or subsequent time. Anti-Replay is on by default unless overridden by a configuration file and is only used by servers. Anti-replay measures are required for compliance with the TLSv1.3 specification. Some applications may be able to mitigate the replay risks in other ways and in such cases the built-in OpenSSL functionality is not required. Switching off anti-replay is equivalent to SSL_OP_NO_ANTI_REPLAY.

                      "},{"location":"man3/SSL_CONF_cmd/#supported-configuration-file-commands","title":"SUPPORTED CONFIGURATION FILE COMMANDS","text":"

                      Currently supported option names for configuration files (i.e., when the flag SSL_CONF_FLAG_FILE is set) are listed below. All configuration file option names are case insensitive so signaturealgorithms is recognised as well as SignatureAlgorithms. Unless otherwise stated the value names are also case insensitive.

                      Note: the command prefix (if set) alters the recognised option values.

                      • CipherString

                        Sets the ciphersuite list for TLSv1.2 and below to value. This list will be combined with any configured TLSv1.3 ciphersuites. Note: syntax checking of value is currently not performed unless an SSL or SSL_CTX structure is associated with ctx.

                      • Ciphersuites

                        Sets the available ciphersuites for TLSv1.3 to value. This is a colon-separated list of TLSv1.3 ciphersuite names in order of preference. This list will be combined any configured TLSv1.2 and below ciphersuites. See openssl-ciphers(1) for more information.

                      • Certificate

                        Attempts to use the file value as the certificate for the appropriate context. It currently uses SSL_CTX_use_certificate_chain_file() if an SSL_CTX structure is set or SSL_use_certificate_file() with filetype PEM if an SSL structure is set. This option is only supported if certificate operations are permitted.

                      • PrivateKey

                        Attempts to use the file value as the private key for the appropriate context. This option is only supported if certificate operations are permitted. Note: if no PrivateKey option is set then a private key is not loaded unless the SSL_CONF_FLAG_REQUIRE_PRIVATE is set.

                      • ChainCAFile, ChainCAPath, VerifyCAFile, VerifyCAPath

                        These options indicate a file or directory used for building certificate chains or verifying certificate chains. These options are only supported if certificate operations are permitted.

                      • RequestCAFile

                        This option indicates a file containing a set of certificates in PEM form. The subject names of the certificates are sent to the peer in the certificate_authorities extension for TLS 1.3 (in ClientHello or CertificateRequest) or in a certificate request for previous versions or TLS.

                      • ServerInfoFile

                        Attempts to use the file value in the \"serverinfo\" extension using the function SSL_CTX_use_serverinfo_file.

                      • DHParameters

                        Attempts to use the file value as the set of temporary DH parameters for the appropriate context. This option is only supported if certificate operations are permitted.

                      • RecordPadding

                        Attempts to pad TLSv1.3 records so that they are a multiple of value in length on send. A value of 0 or 1 turns off padding. Otherwise, the value must be >1 or <=16384.

                      • SignatureAlgorithms

                        This sets the supported signature algorithms for TLSv1.2 and TLSv1.3. For clients this value is used directly for the supported signature algorithms extension. For servers it is used to determine which signature algorithms to support.

                        The value argument should be a colon separated list of signature algorithms in order of decreasing preference of the form algorithm+hash or signature_scheme. algorithm is one of RSA, DSA or ECDSA and hash is a supported algorithm OID short name such as SHA1, SHA224, SHA256, SHA384 of SHA512. Note: algorithm and hash names are case sensitive. signature_scheme is one of the signature schemes defined in TLSv1.3, specified using the IETF name, e.g., ecdsa_secp256r1_sha256, ed25519, or rsa_pss_pss_sha256.

                        If this option is not set then all signature algorithms supported by the OpenSSL library are permissible.

                        Note: algorithms which specify a PKCS#1 v1.5 signature scheme (either by using RSA as the algorithm or by using one of the rsa_pkcs1_* identifiers) are ignored in TLSv1.3 and will not be negotiated.

                      • ClientSignatureAlgorithms

                        This sets the supported signature algorithms associated with client authentication for TLSv1.2 and TLSv1.3. For servers the value is used in the signature_algorithms field of a CertificateRequest message. For clients it is used to determine which signature algorithm to use with the client certificate. If a server does not request a certificate this option has no effect.

                        The syntax of value is identical to SignatureAlgorithms. If not set then the value set for SignatureAlgorithms will be used instead.

                      • Groups

                        This sets the supported groups. For clients, the groups are sent using the supported groups extension. For servers, it is used to determine which group to use. This setting affects groups used for signatures (in TLSv1.2 and earlier) and key exchange. The first group listed will also be used for the key_share sent by a client in a TLSv1.3 ClientHello.

                        The value argument is a colon separated list of groups. The group can be either the NIST name (e.g. P-256), some other commonly used name where applicable (e.g. X25519, ffdhe2048) or an OpenSSL OID name (e.g. prime256v1). Group names are case sensitive. The list should be in order of preference with the most preferred group first.

                        Currently supported groups for TLSv1.3 are P-256, P-384, P-521, X25519, X448, ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192.

                      • Curves

                        This is a synonym for the \"Groups\" command.

                      • MinProtocol

                        This sets the minimum supported SSL, TLS or DTLS version.

                        Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3, DTLSv1 and DTLSv1.2. The SSL and TLS bounds apply only to TLS-based contexts, while the DTLS bounds apply only to DTLS-based contexts. The command can be repeated with one instance setting a TLS bound, and the other setting a DTLS bound. The value None applies to both types of contexts and disables the limits.

                      • MaxProtocol

                        This sets the maximum supported SSL, TLS or DTLS version.

                        Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3, DTLSv1 and DTLSv1.2. The SSL and TLS bounds apply only to TLS-based contexts, while the DTLS bounds apply only to DTLS-based contexts. The command can be repeated with one instance setting a TLS bound, and the other setting a DTLS bound. The value None applies to both types of contexts and disables the limits.

                      • Protocol

                        This can be used to enable or disable certain versions of the SSL, TLS or DTLS protocol.

                        The value argument is a comma separated list of supported protocols to enable or disable. If a protocol is preceded by - that version is disabled.

                        All protocol versions are enabled by default. You need to disable at least one protocol version for this setting have any effect. Only enabling some protocol versions does not disable the other protocol versions.

                        Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3, DTLSv1 and DTLSv1.2. The special value ALL refers to all supported versions.

                        This can't enable protocols that are disabled using MinProtocol or MaxProtocol, but can disable protocols that are still allowed by them.

                        The Protocol command is fragile and deprecated; do not use it. Use MinProtocol and MaxProtocol instead. If you do use Protocol, make sure that the resulting range of enabled protocols has no \"holes\", e.g. if TLS 1.0 and TLS 1.2 are both enabled, make sure to also leave TLS 1.1 enabled.

                      • Options

                        The value argument is a comma separated list of various flags to set. If a flag string is preceded - it is disabled. See the SSL_CTX_set_options(3) function for more details of individual options.

                        Each option is listed below. Where an operation is enabled by default the -flag syntax is needed to disable it.

                        SessionTicket: session ticket support, enabled by default. Inverse of SSL_OP_NO_TICKET: that is -SessionTicket is the same as setting SSL_OP_NO_TICKET.

                        Compression: SSL/TLS compression support, disabled by default. Inverse of SSL_OP_NO_COMPRESSION.

                        EmptyFragments: use empty fragments as a countermeasure against a SSL 3.0/TLS 1.0 protocol vulnerability affecting CBC ciphers. It is set by default. Inverse of SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS.

                        Bugs: enable various bug workarounds. Same as SSL_OP_ALL.

                        DHSingle: enable single use DH keys, set by default. Inverse of SSL_OP_DH_SINGLE. Only used by servers.

                        ECDHSingle: enable single use ECDH keys, set by default. Inverse of SSL_OP_ECDH_SINGLE. Only used by servers.

                        ServerPreference: use server and not client preference order when determining which cipher suite, signature algorithm or elliptic curve to use for an incoming connection. Equivalent to SSL_OP_CIPHER_SERVER_PREFERENCE. Only used by servers.

                        PrioritizeChaCha: prioritizes ChaCha ciphers when the client has a ChaCha20 cipher at the top of its preference list. This usually indicates a mobile client is in use. Equivalent to SSL_OP_PRIORITIZE_CHACHA. Only used by servers.

                        NoResumptionOnRenegotiation: set SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION flag. Only used by servers.

                        NoRenegotiation: disables all attempts at renegotiation in TLSv1.2 and earlier, same as setting SSL_OP_NO_RENEGOTIATION.

                        UnsafeLegacyRenegotiation: permits the use of unsafe legacy renegotiation. Equivalent to SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION.

                        UnsafeLegacyServerConnect: permits the use of unsafe legacy renegotiation for OpenSSL clients only. Equivalent to SSL_OP_LEGACY_SERVER_CONNECT.

                        EncryptThenMac: use encrypt-then-mac extension, enabled by default. Inverse of SSL_OP_NO_ENCRYPT_THEN_MAC: that is, -EncryptThenMac is the same as setting SSL_OP_NO_ENCRYPT_THEN_MAC.

                        AllowNoDHEKEX: In TLSv1.3 allow a non-(ec)dhe based key exchange mode on resumption. This means that there will be no forward secrecy for the resumed session. Equivalent to SSL_OP_ALLOW_NO_DHE_KEX.

                        MiddleboxCompat: If set then dummy Change Cipher Spec (CCS) messages are sent in TLSv1.3. This has the effect of making TLSv1.3 look more like TLSv1.2 so that middleboxes that do not understand TLSv1.3 will not drop the connection. This option is set by default. A future version of OpenSSL may not set this by default. Equivalent to SSL_OP_ENABLE_MIDDLEBOX_COMPAT.

                        AntiReplay: If set then OpenSSL will automatically detect if a session ticket has been used more than once, TLSv1.3 has been negotiated, and early data is enabled on the server. A full handshake is forced if a session ticket is used a second or subsequent time. This option is set by default and is only used by servers. Anti-replay measures are required to comply with the TLSv1.3 specification. Some applications may be able to mitigate the replay risks in other ways and in such cases the built-in OpenSSL functionality is not required. Disabling anti-replay is equivalent to setting SSL_OP_NO_ANTI_REPLAY.

                        ExtendedMasterSecret: use extended master secret extension, enabled by default. Inverse of SSL_OP_NO_EXTENDED_MASTER_SECRET: that is, -ExtendedMasterSecret is the same as setting SSL_OP_NO_EXTENDED_MASTER_SECRET.

                        CANames: use CA names extension, enabled by default. Inverse of SSL_OP_DISABLE_TLSEXT_CA_NAMES: that is, -CANames is the same as setting SSL_OP_DISABLE_TLSEXT_CA_NAMES.

                        KTLS: Enables kernel TLS if support has been compiled in, and it is supported by the negotiated ciphersuites and extensions. Equivalent to SSL_OP_ENABLE_KTLS.

                      • VerifyMode

                        The value argument is a comma separated list of flags to set.

                        Peer enables peer verification: for clients only.

                        Request requests but does not require a certificate from the client. Servers only.

                        Require requests and requires a certificate from the client: an error occurs if the client does not present a certificate. Servers only.

                        Once requests a certificate from a client only on the initial connection: not when renegotiating. Servers only.

                        RequestPostHandshake configures the connection to support requests but does not require a certificate from the client post-handshake. A certificate will not be requested during the initial handshake. The server application must provide a mechanism to request a certificate post-handshake. Servers only. TLSv1.3 only.

                        RequiresPostHandshake configures the connection to support requests and requires a certificate from the client post-handshake: an error occurs if the client does not present a certificate. A certificate will not be requested during the initial handshake. The server application must provide a mechanism to request a certificate post-handshake. Servers only. TLSv1.3 only.

                      • ClientCAFile, ClientCAPath

                        A file or directory of certificates in PEM format whose names are used as the set of acceptable names for client CAs. Servers only. This option is only supported if certificate operations are permitted.

                      "},{"location":"man3/SSL_CONF_cmd/#supported-command-types","title":"SUPPORTED COMMAND TYPES","text":"

                      The function SSL_CONF_cmd_value_type() currently returns one of the following types:

                      • SSL_CONF_TYPE_UNKNOWN

                        The option string is unrecognised, this return value can be use to flag syntax errors.

                      • SSL_CONF_TYPE_STRING

                        The value is a string without any specific structure.

                      • SSL_CONF_TYPE_FILE

                        The value is a filename.

                      • SSL_CONF_TYPE_DIR

                        The value is a directory name.

                      • SSL_CONF_TYPE_NONE

                        The value string is not used e.g. a command line option which doesn't take an argument.

                      "},{"location":"man3/SSL_CONF_cmd/#notes","title":"NOTES","text":"

                      The order of operations is significant. This can be used to set either defaults or values which cannot be overridden. For example if an application calls:

                      SSL_CONF_cmd(ctx, \"Protocol\", \"-SSLv3\");\nSSL_CONF_cmd(ctx, userparam, uservalue);\n

                      it will disable SSLv3 support by default but the user can override it. If however the call sequence is:

                      SSL_CONF_cmd(ctx, userparam, uservalue);\nSSL_CONF_cmd(ctx, \"Protocol\", \"-SSLv3\");\n

                      SSLv3 is always disabled and attempt to override this by the user are ignored.

                      By checking the return code of SSL_CONF_cmd() it is possible to query if a given option is recognised, this is useful if SSL_CONF_cmd() values are mixed with additional application specific operations.

                      For example an application might call SSL_CONF_cmd() and if it returns -2 (unrecognised command) continue with processing of application specific commands.

                      Applications can also use SSL_CONF_cmd() to process command lines though the utility function SSL_CONF_cmd_argv() is normally used instead. One way to do this is to set the prefix to an appropriate value using SSL_CONF_CTX_set1_prefix(), pass the current argument to option and the following argument to value (which may be NULL).

                      In this case if the return value is positive then it is used to skip that number of arguments as they have been processed by SSL_CONF_cmd(). If -2 is returned then option is not recognised and application specific arguments can be checked instead. If -3 is returned a required argument is missing and an error is indicated. If 0 is returned some other error occurred and this can be reported back to the user.

                      The function SSL_CONF_cmd_value_type() can be used by applications to check for the existence of a command or to perform additional syntax checking or translation of the command value. For example if the return value is SSL_CONF_TYPE_FILE an application could translate a relative pathname to an absolute pathname.

                      "},{"location":"man3/SSL_CONF_cmd/#return-values","title":"RETURN VALUES","text":"

                      SSL_CONF_cmd() returns 1 if the value of option is recognised and value is NOT used and 2 if both option and value are used. In other words it returns the number of arguments processed. This is useful when processing command lines.

                      A return value of -2 means option is not recognised.

                      A return value of -3 means option is recognised and the command requires a value but value is NULL.

                      A return code of 0 indicates that both option and value are valid but an error occurred attempting to perform the operation: for example due to an error in the syntax of value in this case the error queue may provide additional information.

                      "},{"location":"man3/SSL_CONF_cmd/#examples","title":"EXAMPLES","text":"

                      Set supported signature algorithms:

                      SSL_CONF_cmd(ctx, \"SignatureAlgorithms\", \"ECDSA+SHA256:RSA+SHA256:DSA+SHA256\");\n

                      There are various ways to select the supported protocols.

                      This set the minimum protocol version to TLSv1, and so disables SSLv3. This is the recommended way to disable protocols.

                      SSL_CONF_cmd(ctx, \"MinProtocol\", \"TLSv1\");\n

                      The following also disables SSLv3:

                      SSL_CONF_cmd(ctx, \"Protocol\", \"-SSLv3\");\n

                      The following will first enable all protocols, and then disable SSLv3. If no protocol versions were disabled before this has the same effect as \"-SSLv3\", but if some versions were disables this will re-enable them before disabling SSLv3.

                      SSL_CONF_cmd(ctx, \"Protocol\", \"ALL,-SSLv3\");\n

                      Only enable TLSv1.2:

                      SSL_CONF_cmd(ctx, \"MinProtocol\", \"TLSv1.2\");\nSSL_CONF_cmd(ctx, \"MaxProtocol\", \"TLSv1.2\");\n

                      This also only enables TLSv1.2:

                      SSL_CONF_cmd(ctx, \"Protocol\", \"-ALL,TLSv1.2\");\n

                      Disable TLS session tickets:

                      SSL_CONF_cmd(ctx, \"Options\", \"-SessionTicket\");\n

                      Enable compression:

                      SSL_CONF_cmd(ctx, \"Options\", \"Compression\");\n

                      Set supported curves to P-256, P-384:

                      SSL_CONF_cmd(ctx, \"Curves\", \"P-256:P-384\");\n
                      "},{"location":"man3/SSL_CONF_cmd/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_cmd_argv(3), SSL_CTX_set_options(3)

                      "},{"location":"man3/SSL_CONF_cmd/#history","title":"HISTORY","text":"

                      The SSL_CONF_cmd() function was added in OpenSSL 1.0.2.

                      The SSL_OP_NO_SSL2 option doesn't have effect since 1.1.0, but the macro is retained for backwards compatibility.

                      The SSL_CONF_TYPE_NONE was added in OpenSSL 1.1.0. In earlier versions of OpenSSL passing a command which didn't take an argument would return SSL_CONF_TYPE_UNKNOWN.

                      MinProtocol and MaxProtocol where added in OpenSSL 1.1.0.

                      AllowNoDHEKEX and PrioritizeChaCha were added in OpenSSL 1.1.1.

                      The UnsafeLegacyServerConnect option is no longer set by default from OpenSSL 3.0.

                      "},{"location":"man3/SSL_CONF_cmd/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2012-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CONF_cmd_argv/","title":"SSL_CONF_cmd_argv","text":""},{"location":"man3/SSL_CONF_cmd_argv/#name","title":"NAME","text":"

                      SSL_CONF_cmd_argv - SSL configuration command line processing

                      "},{"location":"man3/SSL_CONF_cmd_argv/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv);\n
                      "},{"location":"man3/SSL_CONF_cmd_argv/#description","title":"DESCRIPTION","text":"

                      The function SSL_CONF_cmd_argv() processes at most two command line arguments from pargv and pargc. The values of pargv and pargc are updated to reflect the number of command options processed. The pargc argument can be set to NULL if it is not used.

                      "},{"location":"man3/SSL_CONF_cmd_argv/#return-values","title":"RETURN VALUES","text":"

                      SSL_CONF_cmd_argv() returns the number of command arguments processed: 0, 1, 2 or a negative error code.

                      If -2 is returned then an argument for a command is missing.

                      If -1 is returned the command is recognised but couldn't be processed due to an error: for example a syntax error in the argument.

                      "},{"location":"man3/SSL_CONF_cmd_argv/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_cmd(3)

                      "},{"location":"man3/SSL_CONF_cmd_argv/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CONF_cmd_argv/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_add1_chain_cert/","title":"SSL_CTX_add1_chain_cert","text":""},{"location":"man3/SSL_CTX_add1_chain_cert/#name","title":"NAME","text":"

                      SSL_CTX_set0_chain, SSL_CTX_set1_chain, SSL_CTX_add0_chain_cert, SSL_CTX_add1_chain_cert, SSL_CTX_get0_chain_certs, SSL_CTX_clear_chain_certs, SSL_set0_chain, SSL_set1_chain, SSL_add0_chain_cert, SSL_add1_chain_cert, SSL_get0_chain_certs, SSL_clear_chain_certs, SSL_CTX_build_cert_chain, SSL_build_cert_chain, SSL_CTX_select_current_cert, SSL_select_current_cert, SSL_CTX_set_current_cert, SSL_set_current_cert - extra chain certificate processing

                      "},{"location":"man3/SSL_CTX_add1_chain_cert/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *sk);\nint SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *sk);\nint SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509);\nint SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509);\nint SSL_CTX_get0_chain_certs(SSL_CTX *ctx, STACK_OF(X509) **sk);\nint SSL_CTX_clear_chain_certs(SSL_CTX *ctx);\n\nint SSL_set0_chain(SSL *ssl, STACK_OF(X509) *sk);\nint SSL_set1_chain(SSL *ssl, STACK_OF(X509) *sk);\nint SSL_add0_chain_cert(SSL *ssl, X509 *x509);\nint SSL_add1_chain_cert(SSL *ssl, X509 *x509);\nint SSL_get0_chain_certs(SSL *ssl, STACK_OF(X509) **sk);\nint SSL_clear_chain_certs(SSL *ssl);\n\nint SSL_CTX_build_cert_chain(SSL_CTX *ctx, flags);\nint SSL_build_cert_chain(SSL *ssl, flags);\n\nint SSL_CTX_select_current_cert(SSL_CTX *ctx, X509 *x509);\nint SSL_select_current_cert(SSL *ssl, X509 *x509);\nint SSL_CTX_set_current_cert(SSL_CTX *ctx, long op);\nint SSL_set_current_cert(SSL *ssl, long op);\n
                      "},{"location":"man3/SSL_CTX_add1_chain_cert/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set0_chain() and SSL_CTX_set1_chain() set the certificate chain associated with the current certificate of ctx to sk.

                      SSL_CTX_add0_chain_cert() and SSL_CTX_add1_chain_cert() append the single certificate x509 to the chain associated with the current certificate of ctx.

                      SSL_CTX_get0_chain_certs() retrieves the chain associated with the current certificate of ctx.

                      SSL_CTX_clear_chain_certs() clears any existing chain associated with the current certificate of ctx. (This is implemented by calling SSL_CTX_set0_chain() with sk set to NULL).

                      SSL_CTX_build_cert_chain() builds the certificate chain for ctx. Normally this uses the chain store or the verify store if the chain store is not set. If the function is successful the built chain will replace any existing chain. The flags parameter can be set to SSL_BUILD_CHAIN_FLAG_UNTRUSTED to use existing chain certificates as untrusted CAs, SSL_BUILD_CHAIN_FLAG_NO_ROOT to omit the root CA from the built chain, SSL_BUILD_CHAIN_FLAG_CHECK to use all existing chain certificates only to build the chain (effectively sanity checking and rearranging them if necessary), the flag SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR ignores any errors during verification: if flag SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR is also set verification errors are cleared from the error queue. Details of the chain building process are described in \"Certification Path Building\" in openssl-verification-options(1).

                      Each of these functions operates on the current end entity (i.e. server or client) certificate. This is the last certificate loaded or selected on the corresponding ctx structure.

                      SSL_CTX_select_current_cert() selects x509 as the current end entity certificate, but only if x509 has already been loaded into ctx using a function such as SSL_CTX_use_certificate().

                      SSL_set0_chain(), SSL_set1_chain(), SSL_add0_chain_cert(), SSL_add1_chain_cert(), SSL_get0_chain_certs(), SSL_clear_chain_certs(), SSL_build_cert_chain(), SSL_select_current_cert() and SSL_set_current_cert() are similar except they apply to SSL structure ssl.

                      SSL_CTX_set_current_cert() changes the current certificate to a value based on the op argument. Currently op can be SSL_CERT_SET_FIRST to use the first valid certificate or SSL_CERT_SET_NEXT to set the next valid certificate after the current certificate. These two operations can be used to iterate over all certificates in an SSL_CTX structure.

                      SSL_set_current_cert() also supports the option SSL_CERT_SET_SERVER. If ssl is a server and has sent a certificate to a connected client this option sets that certificate to the current certificate and returns 1. If the negotiated cipher suite is anonymous (and thus no certificate will be sent) 2 is returned and the current certificate is unchanged. If ssl is not a server or a certificate has not been sent 0 is returned and the current certificate is unchanged.

                      All these functions are implemented as macros. Those containing a 1 increment the reference count of the supplied certificate or chain so it must be freed at some point after the operation. Those containing a 0 do not increment reference counts and the supplied certificate or chain MUST NOT be freed after the operation.

                      "},{"location":"man3/SSL_CTX_add1_chain_cert/#notes","title":"NOTES","text":"

                      The chains associate with an SSL_CTX structure are copied to any SSL structures when SSL_new() is called. SSL structures will not be affected by any chains subsequently changed in the parent SSL_CTX.

                      One chain can be set for each key type supported by a server. So, for example, an RSA and a DSA certificate can (and often will) have different chains.

                      The functions SSL_CTX_build_cert_chain() and SSL_build_cert_chain() can be used to check application configuration and to ensure any necessary subordinate CAs are sent in the correct order. Misconfigured applications sending incorrect certificate chains often cause problems with peers.

                      For example an application can add any set of certificates using SSL_CTX_use_certificate_chain_file() then call SSL_CTX_build_cert_chain() with the option SSL_BUILD_CHAIN_FLAG_CHECK to check and reorder them.

                      Applications can issue non fatal warnings when checking chains by setting the flag SSL_BUILD_CHAIN_FLAG_IGNORE_ERRORS and checking the return value.

                      Calling SSL_CTX_build_cert_chain() or SSL_build_cert_chain() is more efficient than the automatic chain building as it is only performed once. Automatic chain building is performed on each new session.

                      If any certificates are added using these functions no certificates added using SSL_CTX_add_extra_chain_cert() will be used.

                      "},{"location":"man3/SSL_CTX_add1_chain_cert/#return-values","title":"RETURN VALUES","text":"

                      SSL_set_current_cert() with SSL_CERT_SET_SERVER return 1 for success, 2 if no server certificate is used because the cipher suites is anonymous and 0 for failure.

                      SSL_CTX_build_cert_chain() and SSL_build_cert_chain() return 1 for success and 0 for failure. If the flag SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR and a verification error occurs then 2 is returned.

                      All other functions return 1 for success and 0 for failure.

                      "},{"location":"man3/SSL_CTX_add1_chain_cert/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_add_extra_chain_cert(3)

                      "},{"location":"man3/SSL_CTX_add1_chain_cert/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CTX_add1_chain_cert/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/","title":"SSL_CTX_add_extra_chain_cert","text":""},{"location":"man3/SSL_CTX_add_extra_chain_cert/#name","title":"NAME","text":"

                      SSL_CTX_add_extra_chain_cert, SSL_CTX_get_extra_chain_certs, SSL_CTX_get_extra_chain_certs_only, SSL_CTX_clear_extra_chain_certs - add, get or clear extra chain certificates

                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nlong SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *x509);\nlong SSL_CTX_get_extra_chain_certs(SSL_CTX *ctx, STACK_OF(X509) **sk);\nlong SSL_CTX_get_extra_chain_certs_only(SSL_CTX *ctx, STACK_OF(X509) **sk);\nlong SSL_CTX_clear_extra_chain_certs(SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_add_extra_chain_cert() adds the certificate x509 to the extra chain certificates associated with ctx. Several certificates can be added one after another.

                      SSL_CTX_get_extra_chain_certs() retrieves the extra chain certificates associated with ctx, or the chain associated with the current certificate of ctx if the extra chain is empty. The returned stack should not be freed by the caller.

                      SSL_CTX_get_extra_chain_certs_only() retrieves the extra chain certificates associated with ctx. The returned stack should not be freed by the caller.

                      SSL_CTX_clear_extra_chain_certs() clears all extra chain certificates associated with ctx.

                      These functions are implemented as macros.

                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#notes","title":"NOTES","text":"

                      When sending a certificate chain, extra chain certificates are sent in order following the end entity certificate.

                      If no chain is specified, the library will try to complete the chain from the available CA certificates in the trusted CA storage, see SSL_CTX_load_verify_locations(3).

                      The x509 certificate provided to SSL_CTX_add_extra_chain_cert() will be freed by the library when the SSL_CTX is destroyed. An application should not free the x509 object.

                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#restrictions","title":"RESTRICTIONS","text":"

                      Only one set of extra chain certificates can be specified per SSL_CTX structure. Different chains for different certificates (for example if both RSA and DSA certificates are specified by the same server) or different SSL structures with the same parent SSL_CTX cannot be specified using this function. For more flexibility functions such as SSL_add1_chain_cert() should be used instead.

                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_add_extra_chain_cert() and SSL_CTX_clear_extra_chain_certs() return 1 on success and 0 for failure. Check out the error stack to find out the reason for failure.

                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_use_certificate(3), SSL_CTX_set_client_cert_cb(3), SSL_CTX_load_verify_locations(3) SSL_CTX_set0_chain(3) SSL_CTX_set1_chain(3) SSL_CTX_add0_chain_cert(3) SSL_CTX_add1_chain_cert(3) SSL_set0_chain(3) SSL_set1_chain(3) SSL_add0_chain_cert(3) SSL_add1_chain_cert(3) SSL_CTX_build_cert_chain(3) SSL_build_cert_chain(3)

                      "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_add_session/","title":"SSL_CTX_add_session","text":""},{"location":"man3/SSL_CTX_add_session/#name","title":"NAME","text":"

                      SSL_CTX_add_session, SSL_CTX_remove_session - manipulate session cache

                      "},{"location":"man3/SSL_CTX_add_session/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);\n\nint SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);\n
                      "},{"location":"man3/SSL_CTX_add_session/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_add_session() adds the session c to the context ctx. The reference count for session c is incremented by 1. If a session with the same session id already exists, the old session is removed by calling SSL_SESSION_free(3).

                      SSL_CTX_remove_session() removes the session c from the context ctx and marks it as non-resumable. SSL_SESSION_free(3) is called once for c.

                      "},{"location":"man3/SSL_CTX_add_session/#notes","title":"NOTES","text":"

                      When adding a new session to the internal session cache, it is examined whether a session with the same session id already exists. In this case it is assumed that both sessions are identical. If the same session is stored in a different SSL_SESSION object, The old session is removed and replaced by the new session. If the session is actually identical (the SSL_SESSION object is identical), SSL_CTX_add_session() is a no-op, and the return value is 0.

                      If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE flag then the internal cache will not be populated automatically by new sessions negotiated by the SSL/TLS implementation, even though the internal cache will be searched automatically for session-resume requests (the latter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the application can use SSL_CTX_add_session() directly to have full control over the sessions that can be resumed if desired.

                      "},{"location":"man3/SSL_CTX_add_session/#return-values","title":"RETURN VALUES","text":"

                      The following values are returned by all functions:

                      • 0

                        The operation failed. In case of the add operation, it was tried to add the same (identical) session twice. In case of the remove operation, the session was not found in the cache.

                      • 1

                        The operation succeeded.

                      "},{"location":"man3/SSL_CTX_add_session/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_free(3)

                      "},{"location":"man3/SSL_CTX_add_session/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_config/","title":"SSL_CTX_config","text":""},{"location":"man3/SSL_CTX_config/#name","title":"NAME","text":"

                      SSL_CTX_config, SSL_config - configure SSL_CTX or SSL structure

                      "},{"location":"man3/SSL_CTX_config/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_config(SSL_CTX *ctx, const char *name);\nint SSL_config(SSL *s, const char *name);\n
                      "},{"location":"man3/SSL_CTX_config/#description","title":"DESCRIPTION","text":"

                      The functions SSL_CTX_config() and SSL_config() configure an SSL_CTX or SSL structure using the configuration name.

                      By calling SSL_CTX_config() or SSL_config() an application can perform many complex tasks based on the contents of the configuration file: greatly simplifying application configuration code. A degree of future proofing can also be achieved: an application can support configuration features in newer versions of OpenSSL automatically.

                      A configuration file must have been previously loaded, for example using CONF_modules_load_file(). See config(5) for details of the configuration file syntax.

                      "},{"location":"man3/SSL_CTX_config/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error occurred.

                      "},{"location":"man3/SSL_CTX_config/#examples","title":"EXAMPLES","text":"

                      If the file \"config.cnf\" contains the following:

                      testapp = test_sect\n\n[test_sect]\n

                      # # list of configuration modules

                      ssl_conf = ssl_sect\n\n[ssl_sect]\nserver = server_section\n\n[server_section]\nRSA.Certificate = server-rsa.pem\nECDSA.Certificate = server-ecdsa.pem\nCiphers = ALL:!RC4\n

                      An application could call:

                      if (CONF_modules_load_file(\"config.cnf\", \"testapp\", 0) <= 0) {\n    fprintf(stderr, \"Error processing config file\\n\");\n    goto err;\n}\n\nctx = SSL_CTX_new(TLS_server_method());\n\nif (SSL_CTX_config(ctx, \"server\") == 0) {\n    fprintf(stderr, \"Error configuring server.\\n\");\n    goto err;\n}\n

                      In this example two certificates and the cipher list are configured without the need for any additional application code.

                      "},{"location":"man3/SSL_CTX_config/#see-also","title":"SEE ALSO","text":"

                      ssl(7), config(5), SSL_CONF_cmd(3), CONF_modules_load_file(3)

                      "},{"location":"man3/SSL_CTX_config/#history","title":"HISTORY","text":"

                      The SSL_CTX_config() and SSL_config() functions were added in OpenSSL 1.1.0.

                      "},{"location":"man3/SSL_CTX_config/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_ctrl/","title":"SSL_CTX_ctrl","text":""},{"location":"man3/SSL_CTX_ctrl/#name","title":"NAME","text":"

                      SSL_CTX_ctrl, SSL_CTX_callback_ctrl, SSL_ctrl, SSL_callback_ctrl - internal handling functions for SSL_CTX and SSL objects

                      "},{"location":"man3/SSL_CTX_ctrl/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nlong SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);\nlong SSL_CTX_callback_ctrl(SSL_CTX *, int cmd, void (*fp)());\n\nlong SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg);\nlong SSL_callback_ctrl(SSL *, int cmd, void (*fp)());\n
                      "},{"location":"man3/SSL_CTX_ctrl/#description","title":"DESCRIPTION","text":"

                      The SSL_*_ctrl() family of functions is used to manipulate settings of the SSL_CTX and SSL objects. Depending on the command cmd the arguments larg, parg, or fp are evaluated. These functions should never be called directly. All functionalities needed are made available via other functions or macros.

                      "},{"location":"man3/SSL_CTX_ctrl/#return-values","title":"RETURN VALUES","text":"

                      The return values of the SSL*_ctrl() functions depend on the command supplied via the cmd parameter.

                      "},{"location":"man3/SSL_CTX_ctrl/#see-also","title":"SEE ALSO","text":"

                      ssl(7)

                      "},{"location":"man3/SSL_CTX_ctrl/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_dane_enable/","title":"SSL_CTX_dane_enable","text":""},{"location":"man3/SSL_CTX_dane_enable/#name","title":"NAME","text":"

                      SSL_CTX_dane_enable, SSL_CTX_dane_mtype_set, SSL_dane_enable, SSL_dane_tlsa_add, SSL_get0_dane_authority, SSL_get0_dane_tlsa, SSL_CTX_dane_set_flags, SSL_CTX_dane_clear_flags, SSL_dane_set_flags, SSL_dane_clear_flags - enable DANE TLS authentication of the remote TLS server in the local TLS client

                      "},{"location":"man3/SSL_CTX_dane_enable/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_dane_enable(SSL_CTX *ctx);\nint SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md,\n                           uint8_t mtype, uint8_t ord);\nint SSL_dane_enable(SSL *s, const char *basedomain);\nint SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector,\n                      uint8_t mtype, const unsigned char *data, size_t dlen);\nint SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki);\nint SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector,\n                       uint8_t *mtype, const unsigned char **data,\n                       size_t *dlen);\nunsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags);\nunsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags);\nunsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags);\nunsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags);\n
                      "},{"location":"man3/SSL_CTX_dane_enable/#description","title":"DESCRIPTION","text":"

                      These functions implement support for DANE TLSA (RFC6698 and RFC7671) peer authentication.

                      SSL_CTX_dane_enable() must be called first to initialize the shared state required for DANE support. Individual connections associated with the context can then enable per-connection DANE support as appropriate. DANE authentication is implemented in the X509_verify_cert(3) function, and applications that override X509_verify_cert(3) via SSL_CTX_set_cert_verify_callback(3) are responsible to authenticate the peer chain in whatever manner they see fit.

                      SSL_CTX_dane_mtype_set() may then be called zero or more times to adjust the supported digest algorithms. This must be done before any SSL handles are created for the context.

                      The mtype argument specifies a DANE TLSA matching type and the md argument specifies the associated digest algorithm handle. The ord argument specifies a strength ordinal. Algorithms with a larger strength ordinal are considered more secure. Strength ordinals are used to implement RFC7671 digest algorithm agility. Specifying a NULL digest algorithm for a matching type disables support for that matching type. Matching type Full(0) cannot be modified or disabled.

                      By default, matching type SHA2-256(1) (see RFC7218 for definitions of the DANE TLSA parameter acronyms) is mapped to EVP_sha256() with a strength ordinal of 1 and matching type SHA2-512(2) is mapped to EVP_sha512() with a strength ordinal of 2.

                      SSL_dane_enable() must be called before the SSL handshake is initiated with SSL_connect(3) if (and only if) you want to enable DANE for that connection. (The connection must be associated with a DANE-enabled SSL context). The basedomain argument specifies the RFC7671 TLSA base domain, which will be the primary peer reference identifier for certificate name checks. Additional server names can be specified via SSL_add1_host(3). The basedomain is used as the default SNI hint if none has yet been specified via SSL_set_tlsext_host_name(3).

                      SSL_dane_tlsa_add() may then be called one or more times, to load each of the TLSA records that apply to the remote TLS peer. (This too must be done prior to the beginning of the SSL handshake). The arguments specify the fields of the TLSA record. The data field is provided in binary (wire RDATA) form, not the hexadecimal ASCII presentation form, with an explicit length passed via dlen. The library takes a copy of the data buffer contents and the caller may free the original data buffer when convenient. A return value of 0 indicates that \"unusable\" TLSA records (with invalid or unsupported parameters) were provided. A negative return value indicates an internal error in processing the record.

                      The caller is expected to check the return value of each SSL_dane_tlsa_add() call and take appropriate action if none are usable or an internal error is encountered in processing some records.

                      If no TLSA records are added successfully, DANE authentication is not enabled, and authentication will be based on any configured traditional trust-anchors; authentication success in this case does not mean that the peer was DANE-authenticated.

                      SSL_get0_dane_authority() can be used to get more detailed information about the matched DANE trust-anchor after successful connection completion. The return value is negative if DANE verification failed (or was not enabled), 0 if an EE TLSA record directly matched the leaf certificate, or a positive number indicating the depth at which a TA record matched an issuer certificate. The complete verified chain can be retrieved via SSL_get0_verified_chain(3). The return value is an index into this verified chain, rather than the list of certificates sent by the peer as returned by SSL_get_peer_cert_chain(3).

                      If the mcert argument is not NULL and a TLSA record matched a chain certificate, a pointer to the matching certificate is returned via mcert. The returned address is a short-term internal reference to the certificate and must not be freed by the application. Applications that want to retain access to the certificate can call X509_up_ref(3) to obtain a long-term reference which must then be freed via X509_free(3) once no longer needed.

                      If no TLSA records directly matched any elements of the certificate chain, but a DANE-TA(2) SPKI(1) Full(0) record provided the public key that signed an element of the chain, then that key is returned via mspki argument (if not NULL). In this case the return value is the depth of the top-most element of the validated certificate chain. As with mcert this is a short-term internal reference, and EVP_PKEY_up_ref(3) and EVP_PKEY_free(3) can be used to acquire and release long-term references respectively.

                      SSL_get0_dane_tlsa() can be used to retrieve the fields of the TLSA record that matched the peer certificate chain. The return value indicates the match depth or failure to match just as with SSL_get0_dane_authority(). When the return value is nonnegative, the storage pointed to by the usage, selector, mtype and data parameters is updated to the corresponding TLSA record fields. The data field is in binary wire form, and is therefore not NUL-terminated, its length is returned via the dlen parameter. If any of these parameters is NULL, the corresponding field is not returned. The data parameter is set to a short-term internal-copy of the associated data field and must not be freed by the application. Applications that need long-term access to this field need to copy the content.

                      SSL_CTX_dane_set_flags() and SSL_dane_set_flags() can be used to enable optional DANE verification features. SSL_CTX_dane_clear_flags() and SSL_dane_clear_flags() can be used to disable the same features. The flags argument is a bit-mask of the features to enable or disable. The flags set for an SSL_CTX context are copied to each SSL handle associated with that context at the time the handle is created. Subsequent changes in the context's flags have no effect on the flags set for the handle.

                      At present, the only available option is DANE_FLAG_NO_DANE_EE_NAMECHECKS which can be used to disable server name checks when authenticating via DANE-EE(3) TLSA records. For some applications, primarily web browsers, it is not safe to disable name checks due to \"unknown key share\" attacks, in which a malicious server can convince a client that a connection to a victim server is instead a secure connection to the malicious server. The malicious server may then be able to violate cross-origin scripting restrictions. Thus, despite the text of RFC7671, name checks are by default enabled for DANE-EE(3) TLSA records, and can be disabled in applications where it is safe to do so. In particular, SMTP and XMPP clients should set this option as SRV and MX records already make it possible for a remote domain to redirect client connections to any server of its choice, and in any case SMTP and XMPP clients do not execute scripts downloaded from remote servers.

                      "},{"location":"man3/SSL_CTX_dane_enable/#return-values","title":"RETURN VALUES","text":"

                      The functions SSL_CTX_dane_enable(), SSL_CTX_dane_mtype_set(), SSL_dane_enable() and SSL_dane_tlsa_add() return a positive value on success. Negative return values indicate resource problems (out of memory, etc.) in the SSL library, while a return value of 0 indicates incorrect usage or invalid input, such as an unsupported TLSA record certificate usage, selector or matching type. Invalid input also includes malformed data, either a digest length that does not match the digest algorithm, or a Full(0) (binary ASN.1 DER form) certificate or a public key that fails to parse.

                      The functions SSL_get0_dane_authority() and SSL_get0_dane_tlsa() return a negative value when DANE authentication failed or was not enabled, a nonnegative value indicates the chain depth at which the TLSA record matched a chain certificate, or the depth of the top-most certificate, when the TLSA record is a full public key that is its signer.

                      The functions SSL_CTX_dane_set_flags(), SSL_CTX_dane_clear_flags(), SSL_dane_set_flags() and SSL_dane_clear_flags() return the flags in effect before they were called.

                      "},{"location":"man3/SSL_CTX_dane_enable/#examples","title":"EXAMPLES","text":"

                      Suppose \"smtp.example.com\" is the MX host of the domain \"example.com\", and has DNSSEC-validated TLSA records. The calls below will perform DANE authentication and arrange to match either the MX hostname or the destination domain name in the SMTP server certificate. Wildcards are supported, but must match the entire label. The actual name matched in the certificate (which might be a wildcard) is retrieved, and must be copied by the application if it is to be retained beyond the lifetime of the SSL connection.

                      SSL_CTX *ctx;\nSSL *ssl;\nint (*verify_cb)(int ok, X509_STORE_CTX *sctx) = NULL;\nint num_usable = 0;\nconst char *nexthop_domain = \"example.com\";\nconst char *dane_tlsa_domain = \"smtp.example.com\";\nuint8_t usage, selector, mtype;\n\nif ((ctx = SSL_CTX_new(TLS_client_method())) == NULL)\n    /* error */\nif (SSL_CTX_dane_enable(ctx) <= 0)\n    /* error */\nif ((ssl = SSL_new(ctx)) == NULL)\n    /* error */\nif (SSL_dane_enable(ssl, dane_tlsa_domain) <= 0)\n    /* error */\n\n/*\n * For many applications it is safe to skip DANE-EE(3) namechecks.  Do not\n * disable the checks unless \"unknown key share\" attacks pose no risk for\n * your application.\n */\nSSL_dane_set_flags(ssl, DANE_FLAG_NO_DANE_EE_NAMECHECKS);\n\nif (!SSL_add1_host(ssl, nexthop_domain))\n    /* error */\nSSL_set_hostflags(ssl, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);\n\nfor (... each TLSA record ...) {\n    unsigned char *data;\n    size_t len;\n    int ret;\n\n    /* set usage, selector, mtype, data, len */\n\n    /*\n     * Opportunistic DANE TLS clients support only DANE-TA(2) or DANE-EE(3).\n     * They treat all other certificate usages, and in particular PKIX-TA(0)\n     * and PKIX-EE(1), as unusable.\n     */\n    switch (usage) {\n    default:\n    case 0:     /* PKIX-TA(0) */\n    case 1:     /* PKIX-EE(1) */\n        continue;\n    case 2:     /* DANE-TA(2) */\n    case 3:     /* DANE-EE(3) */\n        break;\n    }\n\n    ret = SSL_dane_tlsa_add(ssl, usage, selector, mtype, data, len);\n    /* free data as appropriate */\n\n    if (ret < 0)\n        /* handle SSL library internal error */\n    else if (ret == 0)\n        /* handle unusable TLSA record */\n    else\n        ++num_usable;\n}\n\n/*\n * At this point, the verification mode is still the default SSL_VERIFY_NONE.\n * Opportunistic DANE clients use unauthenticated TLS when all TLSA records\n * are unusable, so continue the handshake even if authentication fails.\n */\nif (num_usable == 0) {\n    /* Log all records unusable? */\n\n    /* Optionally set verify_cb to a suitable non-NULL callback. */\n    SSL_set_verify(ssl, SSL_VERIFY_NONE, verify_cb);\n} else {\n    /* At least one usable record.  We expect to verify the peer */\n\n    /* Optionally set verify_cb to a suitable non-NULL callback. */\n\n    /*\n     * Below we elect to fail the handshake when peer verification fails.\n     * Alternatively, use the permissive SSL_VERIFY_NONE verification mode,\n     * complete the handshake, check the verification status, and if not\n     * verified disconnect gracefully at the application layer, especially if\n     * application protocol supports informing the server that authentication\n     * failed.\n     */\n    SSL_set_verify(ssl, SSL_VERIFY_PEER, verify_cb);\n}\n\n/*\n * Load any saved session for resumption, making sure that the previous\n * session applied the same security and authentication requirements that\n * would be expected of a fresh connection.\n */\n\n/* Perform SSL_connect() handshake and handle errors here */\n\nif (SSL_session_reused(ssl)) {\n    if (SSL_get_verify_result(ssl) == X509_V_OK) {\n        /*\n         * Resumed session was originally verified, this connection is\n         * authenticated.\n         */\n    } else {\n        /*\n         * Resumed session was not originally verified, this connection is not\n         * authenticated.\n         */\n    }\n} else if (SSL_get_verify_result(ssl) == X509_V_OK) {\n    const char *peername = SSL_get0_peername(ssl);\n    EVP_PKEY *mspki = NULL;\n\n    int depth = SSL_get0_dane_authority(ssl, NULL, &mspki);\n    if (depth >= 0) {\n        (void) SSL_get0_dane_tlsa(ssl, &usage, &selector, &mtype, NULL, NULL);\n        printf(\"DANE TLSA %d %d %d %s at depth %d\\n\", usage, selector, mtype,\n               (mspki != NULL) ? \"TA public key verified certificate\" :\n               depth ? \"matched TA certificate\" : \"matched EE certificate\",\n               depth);\n    }\n    if (peername != NULL) {\n        /* Name checks were in scope and matched the peername */\n        printf(\"Verified peername: %s\\n\", peername);\n    }\n} else {\n    /*\n     * Not authenticated, presumably all TLSA rrs unusable, but possibly a\n     * callback suppressed connection termination despite the presence of\n     * usable TLSA RRs none of which matched.  Do whatever is appropriate for\n     * fresh unauthenticated connections.\n     */\n}\n
                      "},{"location":"man3/SSL_CTX_dane_enable/#notes","title":"NOTES","text":"

                      It is expected that the majority of clients employing DANE TLS will be doing \"opportunistic DANE TLS\" in the sense of RFC7672 and RFC7435. That is, they will use DANE authentication when DNSSEC-validated TLSA records are published for a given peer, and otherwise will use unauthenticated TLS or even cleartext.

                      Such applications should generally treat any TLSA records published by the peer with usages PKIX-TA(0) and PKIX-EE(1) as \"unusable\", and should not include them among the TLSA records used to authenticate peer connections. In addition, some TLSA records with supported usages may be \"unusable\" as a result of invalid or unsupported parameters.

                      When a peer has TLSA records, but none are \"usable\", an opportunistic application must avoid cleartext, but cannot authenticate the peer, and so should generally proceed with an unauthenticated connection. Opportunistic applications need to note the return value of each call to SSL_dane_tlsa_add(), and if all return 0 (due to invalid or unsupported parameters) disable peer authentication by calling SSL_set_verify(3) with mode equal to SSL_VERIFY_NONE.

                      "},{"location":"man3/SSL_CTX_dane_enable/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_new(3), SSL_add1_host(3), SSL_set_hostflags(3), SSL_set_tlsext_host_name(3), SSL_set_verify(3), SSL_CTX_set_cert_verify_callback(3), SSL_get0_verified_chain(3), SSL_get_peer_cert_chain(3), SSL_get_verify_result(3), SSL_connect(3), SSL_get0_peername(3), X509_verify_cert(3), X509_up_ref(3), X509_free(3), EVP_get_digestbyname(3), EVP_PKEY_up_ref(3), EVP_PKEY_free(3)

                      "},{"location":"man3/SSL_CTX_dane_enable/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.1.0.

                      "},{"location":"man3/SSL_CTX_dane_enable/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_flush_sessions/","title":"SSL_CTX_flush_sessions","text":""},{"location":"man3/SSL_CTX_flush_sessions/#name","title":"NAME","text":"

                      SSL_CTX_flush_sessions - remove expired sessions

                      "},{"location":"man3/SSL_CTX_flush_sessions/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);\n
                      "},{"location":"man3/SSL_CTX_flush_sessions/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_flush_sessions() causes a run through the session cache of ctx to remove sessions expired at time tm.

                      "},{"location":"man3/SSL_CTX_flush_sessions/#notes","title":"NOTES","text":"

                      If enabled, the internal session cache will collect all sessions established up to the specified maximum number (see SSL_CTX_sess_set_cache_size()). As sessions will not be reused ones they are expired, they should be removed from the cache to save resources. This can either be done automatically whenever 255 new sessions were established (see SSL_CTX_set_session_cache_mode(3)) or manually by calling SSL_CTX_flush_sessions().

                      The parameter tm specifies the time which should be used for the expiration test, in most cases the actual time given by time(0) will be used.

                      SSL_CTX_flush_sessions() will only check sessions stored in the internal cache. When a session is found and removed, the remove_session_cb is however called to synchronize with the external cache (see SSL_CTX_sess_set_get_cb(3)).

                      "},{"location":"man3/SSL_CTX_flush_sessions/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_flush_sessions() does not return a value.

                      "},{"location":"man3/SSL_CTX_flush_sessions/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_CTX_set_timeout(3), SSL_CTX_sess_set_get_cb(3)

                      "},{"location":"man3/SSL_CTX_flush_sessions/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_free/","title":"SSL_CTX_free","text":""},{"location":"man3/SSL_CTX_free/#name","title":"NAME","text":"

                      SSL_CTX_free - free an allocated SSL_CTX object

                      "},{"location":"man3/SSL_CTX_free/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_free(SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_free/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_free() decrements the reference count of ctx, and removes the SSL_CTX object pointed to by ctx and frees up the allocated memory if the reference count has reached 0.

                      It also calls the free()ing procedures for indirectly affected items, if applicable: the session cache, the list of ciphers, the list of Client CAs, the certificates and keys.

                      If ctx is NULL nothing is done.

                      "},{"location":"man3/SSL_CTX_free/#warnings","title":"WARNINGS","text":"

                      If a session-remove callback is set (SSL_CTX_sess_set_remove_cb()), this callback will be called for each session being freed from ctx's session cache. This implies, that all corresponding sessions from an external session cache are removed as well. If this is not desired, the user should explicitly unset the callback by calling SSL_CTX_sess_set_remove_cb(ctx, NULL) prior to calling SSL_CTX_free().

                      "},{"location":"man3/SSL_CTX_free/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_free() does not provide diagnostic information.

                      "},{"location":"man3/SSL_CTX_free/#see-also","title":"SEE ALSO","text":"

                      SSL_CTX_new(3), ssl(7), SSL_CTX_sess_set_get_cb(3)

                      "},{"location":"man3/SSL_CTX_free/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_get0_param/","title":"SSL_CTX_get0_param","text":""},{"location":"man3/SSL_CTX_get0_param/#name","title":"NAME","text":"

                      SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param, SSL_CTX_set_purpose, SSL_CTX_set_trust, SSL_set_purpose, SSL_set_trust - get and set verification parameters

                      "},{"location":"man3/SSL_CTX_get0_param/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nX509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);\nX509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);\nint SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);\nint SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);\n\nint SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);\nint SSL_set_purpose(SSL *ssl, int purpose);\n\nint SSL_CTX_set_trust(SSL_CTX *ctx, int trust);\nint SSL_set_trust(SSL *ssl, int trust);\n
                      "},{"location":"man3/SSL_CTX_get0_param/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_get0_param() and SSL_get0_param() retrieve an internal pointer to the verification parameters for ctx or ssl respectively. The returned pointer must not be freed by the calling application.

                      SSL_CTX_set1_param() and SSL_set1_param() set the verification parameters to vpm for ctx or ssl.

                      The functions SSL_CTX_set_purpose() and SSL_set_purpose() are shorthands which set the purpose parameter on the verification parameters object. These functions are equivalent to calling X509_VERIFY_PARAM_set_purpose() directly.

                      The functions SSL_CTX_set_trust() and SSL_set_trust() are similarly shorthands which set the trust parameter on the verification parameters object. These functions are equivalent to calling X509_VERIFY_PARAM_set_trust() directly.

                      "},{"location":"man3/SSL_CTX_get0_param/#notes","title":"NOTES","text":"

                      Typically parameters are retrieved from an SSL_CTX or SSL structure using SSL_CTX_get0_param() or SSL_get0_param() and an application modifies them to suit its needs: for example to add a hostname check.

                      "},{"location":"man3/SSL_CTX_get0_param/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_get0_param() and SSL_get0_param() return a pointer to an X509_VERIFY_PARAM structure.

                      SSL_CTX_set1_param(), SSL_set1_param(), SSL_CTX_set_purpose(), SSL_set_purpose(), SSL_CTX_set_trust() and SSL_set_trust() return 1 for success and 0 for failure.

                      "},{"location":"man3/SSL_CTX_get0_param/#examples","title":"EXAMPLES","text":"

                      Check hostname matches \"www.foo.com\" in peer certificate:

                      X509_VERIFY_PARAM *vpm = SSL_get0_param(ssl);\nX509_VERIFY_PARAM_set1_host(vpm, \"www.foo.com\", 0);\n
                      "},{"location":"man3/SSL_CTX_get0_param/#see-also","title":"SEE ALSO","text":"

                      ssl(7), X509_VERIFY_PARAM_set_flags(3)

                      "},{"location":"man3/SSL_CTX_get0_param/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CTX_get0_param/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_get_verify_mode/","title":"SSL_CTX_get_verify_mode","text":""},{"location":"man3/SSL_CTX_get_verify_mode/#name","title":"NAME","text":"

                      SSL_CTX_get_verify_mode, SSL_get_verify_mode, SSL_CTX_get_verify_depth, SSL_get_verify_depth, SSL_get_verify_callback, SSL_CTX_get_verify_callback - get currently set verification parameters

                      "},{"location":"man3/SSL_CTX_get_verify_mode/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_get_verify_mode(const SSL_CTX *ctx);\nint SSL_get_verify_mode(const SSL *ssl);\nint SSL_CTX_get_verify_depth(const SSL_CTX *ctx);\nint SSL_get_verify_depth(const SSL *ssl);\nint (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *);\nint (*SSL_get_verify_callback(const SSL *ssl))(int, X509_STORE_CTX *);\n
                      "},{"location":"man3/SSL_CTX_get_verify_mode/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_get_verify_mode() returns the verification mode currently set in ctx.

                      SSL_get_verify_mode() returns the verification mode currently set in ssl.

                      SSL_CTX_get_verify_depth() returns the verification depth limit currently set in ctx. If no limit has been explicitly set, -1 is returned and the default value will be used.

                      SSL_get_verify_depth() returns the verification depth limit currently set in ssl. If no limit has been explicitly set, -1 is returned and the default value will be used.

                      SSL_CTX_get_verify_callback() returns a function pointer to the verification callback currently set in ctx. If no callback was explicitly set, the NULL pointer is returned and the default callback will be used.

                      SSL_get_verify_callback() returns a function pointer to the verification callback currently set in ssl. If no callback was explicitly set, the NULL pointer is returned and the default callback will be used.

                      "},{"location":"man3/SSL_CTX_get_verify_mode/#return-values","title":"RETURN VALUES","text":"

                      See DESCRIPTION

                      "},{"location":"man3/SSL_CTX_get_verify_mode/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_verify(3)

                      "},{"location":"man3/SSL_CTX_get_verify_mode/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_has_client_custom_ext/","title":"SSL_CTX_has_client_custom_ext","text":""},{"location":"man3/SSL_CTX_has_client_custom_ext/#name","title":"NAME","text":"

                      SSL_CTX_has_client_custom_ext - check whether a handler exists for a particular client extension type

                      "},{"location":"man3/SSL_CTX_has_client_custom_ext/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, unsigned int ext_type);\n
                      "},{"location":"man3/SSL_CTX_has_client_custom_ext/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_has_client_custom_ext() checks whether a handler has been set for a client extension of type ext_type using SSL_CTX_add_client_custom_ext().

                      "},{"location":"man3/SSL_CTX_has_client_custom_ext/#return-values","title":"RETURN VALUES","text":"

                      Returns 1 if a handler has been set, 0 otherwise.

                      "},{"location":"man3/SSL_CTX_has_client_custom_ext/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_add_client_custom_ext(3)

                      "},{"location":"man3/SSL_CTX_has_client_custom_ext/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_load_verify_locations/","title":"SSL_CTX_load_verify_locations","text":""},{"location":"man3/SSL_CTX_load_verify_locations/#name","title":"NAME","text":"

                      SSL_CTX_load_verify_dir, SSL_CTX_load_verify_file, SSL_CTX_load_verify_store, SSL_CTX_set_default_verify_paths, SSL_CTX_set_default_verify_dir, SSL_CTX_set_default_verify_file, SSL_CTX_set_default_verify_store, SSL_CTX_load_verify_locations - set default locations for trusted CA certificates

                      "},{"location":"man3/SSL_CTX_load_verify_locations/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_load_verify_dir(SSL_CTX *ctx, const char *CApath);\nint SSL_CTX_load_verify_file(SSL_CTX *ctx, const char *CAfile);\nint SSL_CTX_load_verify_store(SSL_CTX *ctx, const char *CAstore);\n\nint SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);\n\nint SSL_CTX_set_default_verify_dir(SSL_CTX *ctx);\nint SSL_CTX_set_default_verify_file(SSL_CTX *ctx);\nint SSL_CTX_set_default_verify_store(SSL_CTX *ctx);\n\nint SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,\n                                  const char *CApath);\n
                      "},{"location":"man3/SSL_CTX_load_verify_locations/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_load_verify_locations(), SSL_CTX_load_verify_dir(), SSL_CTX_load_verify_file(), SSL_CTX_load_verify_store() specifies the locations for ctx, at which CA certificates for verification purposes are located. The certificates available via CAfile, CApath and CAstore are trusted.

                      Details of the certificate verification and chain checking process are described in \"Certification Path Validation\" in openssl-verification-options(1).

                      SSL_CTX_set_default_verify_paths() specifies that the default locations from which CA certificates are loaded should be used. There is one default directory, one default file and one default store. The default CA certificates directory is called certs in the default OpenSSL directory, and this is also the default store. Alternatively the SSL_CERT_DIR environment variable can be defined to override this location. The default CA certificates file is called cert.pem in the default OpenSSL directory. Alternatively the SSL_CERT_FILE environment variable can be defined to override this location.

                      SSL_CTX_set_default_verify_dir() is similar to SSL_CTX_set_default_verify_paths() except that just the default directory is used.

                      SSL_CTX_set_default_verify_file() is similar to SSL_CTX_set_default_verify_paths() except that just the default file is used.

                      SSL_CTX_set_default_verify_store() is similar to SSL_CTX_set_default_verify_paths() except that just the default store is used.

                      "},{"location":"man3/SSL_CTX_load_verify_locations/#notes","title":"NOTES","text":"

                      If CAfile is not NULL, it points to a file of CA certificates in PEM format. The file can contain several CA certificates identified by

                      -----BEGIN CERTIFICATE-----\n... (CA certificate in base64 encoding) ...\n-----END CERTIFICATE-----\n

                      sequences. Before, between, and after the certificates text is allowed which can be used e.g. for descriptions of the certificates.

                      The CAfile is processed on execution of the SSL_CTX_load_verify_locations() function.

                      If CApath is not NULL, it points to a directory containing CA certificates in PEM format. The files each contain one CA certificate. The files are looked up by the CA subject name hash value, which must hence be available. If more than one CA certificate with the same name hash value exist, the extension must be different (e.g. 9d66eef0.0, 9d66eef0.1 etc). The search is performed in the ordering of the extension number, regardless of other properties of the certificates. Use the c_rehash utility to create the necessary links.

                      The certificates in CApath are only looked up when required, e.g. when building the certificate chain or when actually performing the verification of a peer certificate.

                      When looking up CA certificates for chain building, the OpenSSL library will search for suitable certificates first in CAfile, then in CApath. Details of the chain building process are described in \"Certification Path Building\" in openssl-verification-options(1).

                      If CAstore is not NULL, it's a URI for to a store, which may represent a single container or a whole catalogue of containers. Apart from the CAstore not necessarily being a local file or directory, it's generally treated the same way as a CApath.

                      In server mode, when requesting a client certificate, the server must send the list of CAs of which it will accept client certificates. This list is not influenced by the contents of CAfile or CApath and must explicitly be set using the SSL_CTX_set_client_CA_list(3) family of functions.

                      When building its own certificate chain, an OpenSSL client/server will try to fill in missing certificates from CAfile/CApath, if the certificate chain was not explicitly specified (see SSL_CTX_add_extra_chain_cert(3), SSL_CTX_use_certificate(3).

                      "},{"location":"man3/SSL_CTX_load_verify_locations/#warnings","title":"WARNINGS","text":"

                      If several CA certificates matching the name, key identifier, and serial number condition are available, only the first one will be examined. This may lead to unexpected results if the same CA certificate is available with different expiration dates. If a \"certificate expired\" verification error occurs, no other certificate will be searched. Make sure to not have expired certificates mixed with valid ones.

                      "},{"location":"man3/SSL_CTX_load_verify_locations/#return-values","title":"RETURN VALUES","text":"

                      For SSL_CTX_load_verify_locations the following return values can occur:

                      • 0

                        The operation failed because CAfile and CApath are NULL or the processing at one of the locations specified failed. Check the error stack to find out the reason.

                      • 1

                        The operation succeeded.

                      SSL_CTX_set_default_verify_paths(), SSL_CTX_set_default_verify_dir() and SSL_CTX_set_default_verify_file() all return 1 on success or 0 on failure. A missing default location is still treated as a success.

                      "},{"location":"man3/SSL_CTX_load_verify_locations/#examples","title":"EXAMPLES","text":"

                      Generate a CA certificate file with descriptive text from the CA certificates ca1.pem ca2.pem ca3.pem:

                      #!/bin/sh\nrm CAfile.pem\nfor i in ca1.pem ca2.pem ca3.pem ; do\n    openssl x509 -in $i -text >> CAfile.pem\ndone\n

                      Prepare the directory /some/where/certs containing several CA certificates for use as CApath:

                      cd /some/where/certs\nc_rehash .\n
                      "},{"location":"man3/SSL_CTX_load_verify_locations/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_client_CA_list(3), SSL_get_client_CA_list(3), SSL_CTX_use_certificate(3), SSL_CTX_add_extra_chain_cert(3), SSL_CTX_set_cert_store(3), SSL_CTX_set_client_CA_list(3)

                      "},{"location":"man3/SSL_CTX_load_verify_locations/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_new/","title":"SSL_CTX_new","text":""},{"location":"man3/SSL_CTX_new/#name","title":"NAME","text":"

                      TLSv1_2_method, TLSv1_2_server_method, TLSv1_2_client_method, SSL_CTX_new, SSL_CTX_new_ex, SSL_CTX_up_ref, SSLv3_method, SSLv3_server_method, SSLv3_client_method, TLSv1_method, TLSv1_server_method, TLSv1_client_method, TLSv1_1_method, TLSv1_1_server_method, TLSv1_1_client_method, TLS_method, TLS_server_method, TLS_client_method, SSLv23_method, SSLv23_server_method, SSLv23_client_method, DTLS_method, DTLS_server_method, DTLS_client_method, DTLSv1_method, DTLSv1_server_method, DTLSv1_client_method, DTLSv1_2_method, DTLSv1_2_server_method, DTLSv1_2_client_method - create a new SSL_CTX object as framework for TLS/SSL or DTLS enabled functions

                      "},{"location":"man3/SSL_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nSSL_CTX *SSL_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq,\n                        const SSL_METHOD *method);\nSSL_CTX *SSL_CTX_new(const SSL_METHOD *method);\nint SSL_CTX_up_ref(SSL_CTX *ctx);\n\nconst SSL_METHOD *TLS_method(void);\nconst SSL_METHOD *TLS_server_method(void);\nconst SSL_METHOD *TLS_client_method(void);\n\nconst SSL_METHOD *SSLv23_method(void);\nconst SSL_METHOD *SSLv23_server_method(void);\nconst SSL_METHOD *SSLv23_client_method(void);\n\n#ifndef OPENSSL_NO_SSL3_METHOD\nconst SSL_METHOD *SSLv3_method(void);\nconst SSL_METHOD *SSLv3_server_method(void);\nconst SSL_METHOD *SSLv3_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_TLS1_METHOD\nconst SSL_METHOD *TLSv1_method(void);\nconst SSL_METHOD *TLSv1_server_method(void);\nconst SSL_METHOD *TLSv1_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_TLS1_1_METHOD\nconst SSL_METHOD *TLSv1_1_method(void);\nconst SSL_METHOD *TLSv1_1_server_method(void);\nconst SSL_METHOD *TLSv1_1_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_TLS1_2_METHOD\nconst SSL_METHOD *TLSv1_2_method(void);\nconst SSL_METHOD *TLSv1_2_server_method(void);\nconst SSL_METHOD *TLSv1_2_client_method(void);\n#endif\n\nconst SSL_METHOD *DTLS_method(void);\nconst SSL_METHOD *DTLS_server_method(void);\nconst SSL_METHOD *DTLS_client_method(void);\n\n#ifndef OPENSSL_NO_DTLS1_METHOD\nconst SSL_METHOD *DTLSv1_method(void);\nconst SSL_METHOD *DTLSv1_server_method(void);\nconst SSL_METHOD *DTLSv1_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_DTLS1_2_METHOD\nconst SSL_METHOD *DTLSv1_2_method(void);\nconst SSL_METHOD *DTLSv1_2_server_method(void);\nconst SSL_METHOD *DTLSv1_2_client_method(void);\n#endif\n
                      "},{"location":"man3/SSL_CTX_new/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_new_ex() creates a new SSL_CTX object, which holds various configuration and data relevant to SSL/TLS or DTLS session establishment. These are later inherited by the SSL object representing an active session. The method parameter specifies whether the context will be used for the client or server side or both - for details see the \"NOTES\" below. The library context libctx (see OSSL_LIB_CTX(3)) is used to provide the cryptographic algorithms needed for the session. Any cryptographic algorithms that are used by any SSL objects created from this SSL_CTX will be fetched from the libctx using the property query string propq (see \"ALGORITHM FETCHING\" in crypto(7). Either or both the libctx or propq parameters may be NULL.

                      SSL_CTX_new() does the same as SSL_CTX_new_ex() except that the default library context is used and no property query string is specified.

                      An SSL_CTX object is reference counted. Creating an SSL_CTX object for the first time increments the reference count. Freeing the SSL_CTX (using SSL_CTX_free) decrements it. When the reference count drops to zero, any memory or resources allocated to the SSL_CTX object are freed. SSL_CTX_up_ref() increments the reference count for an existing SSL_CTX structure.

                      An SSL_CTX object should not be changed after it is used to create any SSL objects or from multiple threads concurrently, since the implementation does not provide serialization of access for these cases.

                      "},{"location":"man3/SSL_CTX_new/#notes","title":"NOTES","text":"

                      On session establishment, by default, no peer credentials verification is done. This must be explicitly requested, typically using SSL_CTX_set_verify(3). For verifying peer certificates many options can be set using various functions such as SSL_CTX_load_verify_locations(3) and SSL_CTX_set1_param(3). The X509_VERIFY_PARAM_set_purpose(3) function can be used, also in conjunction with SSL_CTX_get0_param(3), to set the intended purpose of the session. The default is X509_PURPOSE_SSL_SERVER on the client side and X509_PURPOSE_SSL_CLIENT on the server side.

                      The SSL_CTX object uses method as the connection method. Three method variants are available: a generic method (for either client or server use), a server-only method, and a client-only method.

                      The method parameter of SSL_CTX_new_ex() and SSL_CTX_new() can be one of the following:

                      • TLS_method(), TLS_server_method(), TLS_client_method()

                        These are the general-purpose version-flexible SSL/TLS methods. The actual protocol version used will be negotiated to the highest version mutually supported by the client and the server. The supported protocols are SSLv3, TLSv1, TLSv1.1, TLSv1.2 and TLSv1.3. Applications should use these methods, and avoid the version-specific methods described below, which are deprecated.

                      • SSLv23_method(), SSLv23_server_method(), SSLv23_client_method()

                        These functions do not exist anymore, they have been renamed to TLS_method(), TLS_server_method() and TLS_client_method() respectively. Currently, the old function calls are renamed to the corresponding new ones by preprocessor macros, to ensure that existing code which uses the old function names still compiles. However, using the old function names is deprecated and new code should call the new functions instead.

                      • TLSv1_2_method(), TLSv1_2_server_method(), TLSv1_2_client_method()

                        A TLS/SSL connection established with these methods will only understand the TLSv1.2 protocol. These methods are deprecated.

                      • TLSv1_1_method(), TLSv1_1_server_method(), TLSv1_1_client_method()

                        A TLS/SSL connection established with these methods will only understand the TLSv1.1 protocol. These methods are deprecated.

                      • TLSv1_method(), TLSv1_server_method(), TLSv1_client_method()

                        A TLS/SSL connection established with these methods will only understand the TLSv1 protocol. These methods are deprecated.

                      • SSLv3_method(), SSLv3_server_method(), SSLv3_client_method()

                        A TLS/SSL connection established with these methods will only understand the SSLv3 protocol. The SSLv3 protocol is deprecated and should not be used.

                      • DTLS_method(), DTLS_server_method(), DTLS_client_method()

                        These are the version-flexible DTLS methods. Currently supported protocols are DTLS 1.0 and DTLS 1.2.

                      • DTLSv1_2_method(), DTLSv1_2_server_method(), DTLSv1_2_client_method()

                        These are the version-specific methods for DTLSv1.2. These methods are deprecated.

                      • DTLSv1_method(), DTLSv1_server_method(), DTLSv1_client_method()

                        These are the version-specific methods for DTLSv1. These methods are deprecated.

                      SSL_CTX_new() initializes the list of ciphers, the session cache setting, the callbacks, the keys and certificates and the options to their default values.

                      TLS_method(), TLS_server_method(), TLS_client_method(), DTLS_method(), DTLS_server_method() and DTLS_client_method() are the version-flexible methods. All other methods only support one specific protocol version. Use the version-flexible methods instead of the version specific methods.

                      If you want to limit the supported protocols for the version flexible methods you can use SSL_CTX_set_min_proto_version(3), SSL_set_min_proto_version(3), SSL_CTX_set_max_proto_version(3) and SSL_set_max_proto_version(3) functions. Using these functions it is possible to choose e.g. TLS_server_method() and be able to negotiate with all possible clients, but to only allow newer protocols like TLS 1.0, TLS 1.1, TLS 1.2 or TLS 1.3.

                      The list of protocols available can also be limited using the SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_3, SSL_OP_NO_TLSv1_2 and SSL_OP_NO_TLSv1_3 options of the SSL_CTX_set_options(3) or SSL_set_options(3) functions, but this approach is not recommended. Clients should avoid creating \"holes\" in the set of protocols they support. When disabling a protocol, make sure that you also disable either all previous or all subsequent protocol versions. In clients, when a protocol version is disabled without disabling all previous protocol versions, the effect is to also disable all subsequent protocol versions.

                      The SSLv3 protocol is deprecated and should generally not be used. Applications should typically use SSL_CTX_set_min_proto_version(3) to set the minimum protocol to at least TLS1_VERSION.

                      "},{"location":"man3/SSL_CTX_new/#return-values","title":"RETURN VALUES","text":"

                      The following return values can occur:

                      • NULL

                        The creation of a new SSL_CTX object failed. Check the error stack to find out the reason.

                      • Pointer to an SSL_CTX object

                        The return value points to an allocated SSL_CTX object.

                        SSL_CTX_up_ref() returns 1 for success and 0 for failure.

                      "},{"location":"man3/SSL_CTX_new/#see-also","title":"SEE ALSO","text":"

                      SSL_CTX_set_options(3), SSL_CTX_free(3), SSL_CTX_set_verify(3), SSL_CTX_set1_param(3), SSL_CTX_get0_param(3), SSL_connect(3), SSL_accept(3), SSL_CTX_set_min_proto_version(3), ssl(7), SSL_set_connect_state(3)

                      "},{"location":"man3/SSL_CTX_new/#history","title":"HISTORY","text":"

                      Support for SSLv2 and the corresponding SSLv2_method(), SSLv2_server_method() and SSLv2_client_method() functions where removed in OpenSSL 1.1.0.

                      SSLv23_method(), SSLv23_server_method() and SSLv23_client_method() were deprecated and the preferred TLS_method(), TLS_server_method() and TLS_client_method() functions were added in OpenSSL 1.1.0.

                      All version-specific methods were deprecated in OpenSSL 1.1.0.

                      SSL_CTX_new_ex() was added in OpenSSL 3.0.

                      "},{"location":"man3/SSL_CTX_new/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_sess_number/","title":"SSL_CTX_sess_number","text":""},{"location":"man3/SSL_CTX_sess_number/#name","title":"NAME","text":"

                      SSL_CTX_sess_number, SSL_CTX_sess_connect, SSL_CTX_sess_connect_good, SSL_CTX_sess_connect_renegotiate, SSL_CTX_sess_accept, SSL_CTX_sess_accept_good, SSL_CTX_sess_accept_renegotiate, SSL_CTX_sess_hits, SSL_CTX_sess_cb_hits, SSL_CTX_sess_misses, SSL_CTX_sess_timeouts, SSL_CTX_sess_cache_full - obtain session cache statistics

                      "},{"location":"man3/SSL_CTX_sess_number/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nlong SSL_CTX_sess_number(SSL_CTX *ctx);\nlong SSL_CTX_sess_connect(SSL_CTX *ctx);\nlong SSL_CTX_sess_connect_good(SSL_CTX *ctx);\nlong SSL_CTX_sess_connect_renegotiate(SSL_CTX *ctx);\nlong SSL_CTX_sess_accept(SSL_CTX *ctx);\nlong SSL_CTX_sess_accept_good(SSL_CTX *ctx);\nlong SSL_CTX_sess_accept_renegotiate(SSL_CTX *ctx);\nlong SSL_CTX_sess_hits(SSL_CTX *ctx);\nlong SSL_CTX_sess_cb_hits(SSL_CTX *ctx);\nlong SSL_CTX_sess_misses(SSL_CTX *ctx);\nlong SSL_CTX_sess_timeouts(SSL_CTX *ctx);\nlong SSL_CTX_sess_cache_full(SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_sess_number/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_sess_number() returns the current number of sessions in the internal session cache.

                      SSL_CTX_sess_connect() returns the number of started SSL/TLS handshakes in client mode.

                      SSL_CTX_sess_connect_good() returns the number of successfully established SSL/TLS sessions in client mode.

                      SSL_CTX_sess_connect_renegotiate() returns the number of started renegotiations in client mode.

                      SSL_CTX_sess_accept() returns the number of started SSL/TLS handshakes in server mode.

                      SSL_CTX_sess_accept_good() returns the number of successfully established SSL/TLS sessions in server mode.

                      SSL_CTX_sess_accept_renegotiate() returns the number of started renegotiations in server mode.

                      SSL_CTX_sess_hits() returns the number of successfully reused sessions. In client mode a session set with SSL_set_session(3) successfully reused is counted as a hit. In server mode a session successfully retrieved from internal or external cache is counted as a hit.

                      SSL_CTX_sess_cb_hits() returns the number of successfully retrieved sessions from the external session cache in server mode.

                      SSL_CTX_sess_misses() returns the number of sessions proposed by clients that were not found in the internal session cache in server mode.

                      SSL_CTX_sess_timeouts() returns the number of sessions proposed by clients and either found in the internal or external session cache in server mode, but that were invalid due to timeout. These sessions are not included in the SSL_CTX_sess_hits() count.

                      SSL_CTX_sess_cache_full() returns the number of sessions that were removed because the maximum session cache size was exceeded.

                      "},{"location":"man3/SSL_CTX_sess_number/#return-values","title":"RETURN VALUES","text":"

                      The functions return the values indicated in the DESCRIPTION section.

                      "},{"location":"man3/SSL_CTX_sess_number/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_set_session(3), SSL_CTX_set_session_cache_mode(3) SSL_CTX_sess_set_cache_size(3)

                      "},{"location":"man3/SSL_CTX_sess_number/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_sess_set_cache_size/","title":"SSL_CTX_sess_set_cache_size","text":""},{"location":"man3/SSL_CTX_sess_set_cache_size/#name","title":"NAME","text":"

                      SSL_CTX_sess_set_cache_size, SSL_CTX_sess_get_cache_size - manipulate session cache size

                      "},{"location":"man3/SSL_CTX_sess_set_cache_size/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nlong SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, long t);\nlong SSL_CTX_sess_get_cache_size(SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_sess_set_cache_size/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_sess_set_cache_size() sets the size of the internal session cache of context ctx to t. This value is a hint and not an absolute; see the notes below.

                      SSL_CTX_sess_get_cache_size() returns the currently valid session cache size.

                      "},{"location":"man3/SSL_CTX_sess_set_cache_size/#notes","title":"NOTES","text":"

                      The internal session cache size is SSL_SESSION_CACHE_MAX_SIZE_DEFAULT, currently 1024*20, so that up to 20000 sessions can be held. This size can be modified using the SSL_CTX_sess_set_cache_size() call. A special case is the size 0, which is used for unlimited size.

                      If adding the session makes the cache exceed its size, then unused sessions are dropped from the end of the cache. Cache space may also be reclaimed by calling SSL_CTX_flush_sessions(3) to remove expired sessions.

                      If the size of the session cache is reduced and more sessions are already in the session cache, old session will be removed at the next time a session shall be added. This removal is not synchronized with the expiration of sessions.

                      "},{"location":"man3/SSL_CTX_sess_set_cache_size/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_sess_set_cache_size() returns the previously valid size.

                      SSL_CTX_sess_get_cache_size() returns the currently valid size.

                      "},{"location":"man3/SSL_CTX_sess_set_cache_size/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_CTX_sess_number(3), SSL_CTX_flush_sessions(3)

                      "},{"location":"man3/SSL_CTX_sess_set_cache_size/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_sess_set_get_cb/","title":"SSL_CTX_sess_set_get_cb","text":""},{"location":"man3/SSL_CTX_sess_set_get_cb/#name","title":"NAME","text":"

                      SSL_CTX_sess_set_new_cb, SSL_CTX_sess_set_remove_cb, SSL_CTX_sess_set_get_cb, SSL_CTX_sess_get_new_cb, SSL_CTX_sess_get_remove_cb, SSL_CTX_sess_get_get_cb - provide callback functions for server side external session caching

                      "},{"location":"man3/SSL_CTX_sess_set_get_cb/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,\n                             int (*new_session_cb)(SSL *, SSL_SESSION *));\nvoid SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,\n                                void (*remove_session_cb)(SSL_CTX *ctx,\n                                                          SSL_SESSION *));\nvoid SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,\n                             SSL_SESSION (*get_session_cb)(SSL *,\n                                                           const unsigned char *,\n                                                           int, int *));\n\nint (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl,\n                                             SSL_SESSION *sess);\nvoid (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx,\n                                                 SSL_SESSION *sess);\nSSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl,\n                                                      const unsigned char *data,\n                                                      int len, int *copy);\n
                      "},{"location":"man3/SSL_CTX_sess_set_get_cb/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_sess_set_new_cb() sets the callback function that is called whenever a new session was negotiated.

                      SSL_CTX_sess_set_remove_cb() sets the callback function that is called whenever a session is removed by the SSL engine. For example, this can occur because a session is considered faulty or has become obsolete because of exceeding the timeout value.

                      SSL_CTX_sess_set_get_cb() sets the callback function that is called whenever a TLS client proposed to resume a session but the session could not be found in the internal session cache (see SSL_CTX_set_session_cache_mode(3)). (TLS server only.)

                      SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb(), and SSL_CTX_sess_get_get_cb() retrieve the function pointers set by the corresponding set callback functions. If a callback function has not been set, the NULL pointer is returned.

                      "},{"location":"man3/SSL_CTX_sess_set_get_cb/#notes","title":"NOTES","text":"

                      In order to allow external session caching, synchronization with the internal session cache is realized via callback functions. Inside these callback functions, session can be saved to disk or put into a database using the d2i_SSL_SESSION(3) interface.

                      The new_session_cb() is called whenever a new session has been negotiated and session caching is enabled (see SSL_CTX_set_session_cache_mode(3)). The new_session_cb() is passed the ssl connection and the nascent ssl session sess. Since sessions are reference-counted objects, the reference count on the session is incremented before the callback, on behalf of the application. If the callback returns 0, the session will be immediately removed from the internal cache and the reference count released. If the callback returns 1, the application retains the reference (for an entry in the application-maintained \"external session cache\"), and is responsible for calling SSL_SESSION_free() when the session reference is no longer in use.

                      Note that in TLSv1.3, sessions are established after the main handshake has completed. The server decides when to send the client the session information and this may occur some time after the end of the handshake (or not at all). This means that applications should expect the new_session_cb() function to be invoked during the handshake (for <= TLSv1.2) or after the handshake (for TLSv1.3). It is also possible in TLSv1.3 for multiple sessions to be established with a single connection. In these case the new_session_cb() function will be invoked multiple times.

                      In TLSv1.3 it is recommended that each SSL_SESSION object is only used for resumption once. One way of enforcing that is for applications to call SSL_CTX_remove_session(3) after a session has been used.

                      The remove_session_cb() is called whenever the SSL engine removes a session from the internal cache. This can happen when the session is removed because it is expired or when a connection was not shutdown cleanly. It also happens for all sessions in the internal session cache when SSL_CTX_free(3) is called. The remove_session_cb() is passed the ctx and the ssl session sess. It does not provide any feedback.

                      The get_session_cb() is only called on SSL/TLS servers, and is given the session id proposed by the client. The get_session_cb() is always called, even when session caching was disabled. The get_session_cb() is passed the ssl connection and the session id of length length at the memory location data. By setting the parameter copy to 1, the callback can require the SSL engine to increment the reference count of the SSL_SESSION object; setting copy to 0 causes the reference count to remain unchanged. If the get_session_cb() does not write to copy, the reference count is incremented and the session must be explicitly freed with SSL_SESSION_free(3).

                      "},{"location":"man3/SSL_CTX_sess_set_get_cb/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb() and SSL_CTX_sess_get_get_cb() return different callback function pointers respectively.

                      "},{"location":"man3/SSL_CTX_sess_set_get_cb/#see-also","title":"SEE ALSO","text":"

                      ssl(7), d2i_SSL_SESSION(3), SSL_CTX_set_session_cache_mode(3), SSL_CTX_flush_sessions(3), SSL_SESSION_free(3), SSL_CTX_free(3)

                      "},{"location":"man3/SSL_CTX_sess_set_get_cb/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_sessions/","title":"SSL_CTX_sessions","text":""},{"location":"man3/SSL_CTX_sessions/#name","title":"NAME","text":"

                      SSL_CTX_sessions - access internal session cache

                      "},{"location":"man3/SSL_CTX_sessions/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nLHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_sessions/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_sessions() returns a pointer to the lhash databases containing the internal session cache for ctx.

                      "},{"location":"man3/SSL_CTX_sessions/#notes","title":"NOTES","text":"

                      The sessions in the internal session cache are kept in an LHASH(3) type database. It is possible to directly access this database e.g. for searching. In parallel, the sessions form a linked list which is maintained separately from the LHASH(3) operations, so that the database must not be modified directly but by using the SSL_CTX_add_session(3) family of functions.

                      "},{"location":"man3/SSL_CTX_sessions/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_sessions() returns a pointer to the lhash of SSL_SESSION.

                      "},{"location":"man3/SSL_CTX_sessions/#see-also","title":"SEE ALSO","text":"

                      ssl(7), LHASH(3), SSL_CTX_add_session(3), SSL_CTX_set_session_cache_mode(3)

                      "},{"location":"man3/SSL_CTX_sessions/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set0_CA_list/","title":"SSL_CTX_set0_CA_list","text":""},{"location":"man3/SSL_CTX_set0_CA_list/#name","title":"NAME","text":"

                      SSL_CTX_set_client_CA_list, SSL_set_client_CA_list, SSL_get_client_CA_list, SSL_CTX_get_client_CA_list, SSL_CTX_add_client_CA, SSL_add_client_CA, SSL_set0_CA_list, SSL_CTX_set0_CA_list, SSL_get0_CA_list, SSL_CTX_get0_CA_list, SSL_add1_to_CA_list, SSL_CTX_add1_to_CA_list, SSL_get0_peer_CA_list - get or set CA list

                      "},{"location":"man3/SSL_CTX_set0_CA_list/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *list);\nvoid SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *list);\nSTACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);\nSTACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx);\nint SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *cacert);\nint SSL_add_client_CA(SSL *ssl, X509 *cacert);\n\nvoid SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);\nvoid SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);\nconst STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx);\nconst STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s);\nint SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x);\nint SSL_add1_to_CA_list(SSL *ssl, const X509 *x);\n\nconst STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s);\n
                      "},{"location":"man3/SSL_CTX_set0_CA_list/#description","title":"DESCRIPTION","text":"

                      The functions described here set and manage the list of CA names that are sent between two communicating peers.

                      For TLS versions 1.2 and earlier the list of CA names is only sent from the server to the client when requesting a client certificate. So any list of CA names set is never sent from client to server and the list of CA names retrieved by SSL_get0_peer_CA_list() is always NULL.

                      For TLS 1.3 the list of CA names is sent using the certificate_authorities extension and may be sent by a client (in the ClientHello message) or by a server (when requesting a certificate).

                      In most cases it is not necessary to set CA names on the client side. The list of CA names that are acceptable to the client will be sent in plaintext to the server. This has privacy implications and may also have performance implications if the list is large. This optional capability was introduced as part of TLSv1.3 and therefore setting CA names on the client side will have no impact if that protocol version has been disabled. Most servers do not need this and so this should be avoided unless required.

                      The \"client CA list\" functions below only have an effect when called on the server side.

                      SSL_CTX_set_client_CA_list() sets the list of CAs sent to the client when requesting a client certificate for ctx. Ownership of list is transferred to ctx and it should not be freed by the caller.

                      SSL_set_client_CA_list() sets the list of CAs sent to the client when requesting a client certificate for the chosen ssl, overriding the setting valid for ssl's SSL_CTX object. Ownership of list is transferred to s and it should not be freed by the caller.

                      SSL_CTX_get_client_CA_list() returns the list of client CAs explicitly set for ctx using SSL_CTX_set_client_CA_list(). The returned list should not be freed by the caller.

                      SSL_get_client_CA_list() returns the list of client CAs explicitly set for ssl using SSL_set_client_CA_list() or ssl's SSL_CTX object with SSL_CTX_set_client_CA_list(), when in server mode. In client mode, SSL_get_client_CA_list returns the list of client CAs sent from the server, if any. The returned list should not be freed by the caller.

                      SSL_CTX_add_client_CA() adds the CA name extracted from cacert to the list of CAs sent to the client when requesting a client certificate for ctx.

                      SSL_add_client_CA() adds the CA name extracted from cacert to the list of CAs sent to the client when requesting a client certificate for the chosen ssl, overriding the setting valid for ssl's SSL_CTX object.

                      SSL_get0_peer_CA_list() retrieves the list of CA names (if any) the peer has sent. This can be called on either the server or the client side. The returned list should not be freed by the caller.

                      The \"generic CA list\" functions below are very similar to the \"client CA list\" functions except that they have an effect on both the server and client sides. The lists of CA names managed are separate - so you cannot (for example) set CA names using the \"client CA list\" functions and then get them using the \"generic CA list\" functions. Where a mix of the two types of functions has been used on the server side then the \"client CA list\" functions take precedence. Typically, on the server side, the \"client CA list \" functions should be used in preference. As noted above in most cases it is not necessary to set CA names on the client side.

                      SSL_CTX_set0_CA_list() sets the list of CAs to be sent to the peer to name_list. Ownership of name_list is transferred to ctx and it should not be freed by the caller.

                      SSL_set0_CA_list() sets the list of CAs to be sent to the peer to name_list overriding any list set in the parent SSL_CTX of s. Ownership of name_list is transferred to s and it should not be freed by the caller.

                      SSL_CTX_get0_CA_list() retrieves any previously set list of CAs set for ctx. The returned list should not be freed by the caller.

                      SSL_get0_CA_list() retrieves any previously set list of CAs set for s or if none are set the list from the parent SSL_CTX is retrieved. The returned list should not be freed by the caller.

                      SSL_CTX_add1_to_CA_list() appends the CA subject name extracted from x to the list of CAs sent to peer for ctx.

                      SSL_add1_to_CA_list() appends the CA subject name extracted from x to the list of CAs sent to the peer for s, overriding the setting in the parent SSL_CTX.

                      "},{"location":"man3/SSL_CTX_set0_CA_list/#notes","title":"NOTES","text":"

                      When a TLS/SSL server requests a client certificate (see SSL_CTX_set_verify(3)), it sends a list of CAs, for which it will accept certificates, to the client.

                      This list must explicitly be set using SSL_CTX_set_client_CA_list() or SSL_CTX_set0_CA_list() for ctx and SSL_set_client_CA_list() or SSL_set0_CA_list() for the specific ssl. The list specified overrides the previous setting. The CAs listed do not become trusted (list only contains the names, not the complete certificates); use SSL_CTX_load_verify_locations(3) to additionally load them for verification.

                      If the list of acceptable CAs is compiled in a file, the SSL_load_client_CA_file(3) function can be used to help to import the necessary data.

                      SSL_CTX_add_client_CA(), SSL_CTX_add1_to_CA_list(), SSL_add_client_CA() and SSL_add1_to_CA_list() can be used to add additional items the list of CAs. If no list was specified before using SSL_CTX_set_client_CA_list(), SSL_CTX_set0_CA_list(), SSL_set_client_CA_list() or SSL_set0_CA_list(), a new CA list for ctx or ssl (as appropriate) is opened.

                      "},{"location":"man3/SSL_CTX_set0_CA_list/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_client_CA_list(), SSL_set_client_CA_list(), SSL_CTX_set_client_CA_list(), SSL_set_client_CA_list(), SSL_CTX_set0_CA_list() and SSL_set0_CA_list() do not return a value.

                      SSL_CTX_get_client_CA_list(), SSL_get_client_CA_list(), SSL_CTX_get0_CA_list() and SSL_get0_CA_list() return a stack of CA names or NULL is no CA names are set.

                      SSL_CTX_add_client_CA(),SSL_add_client_CA(), SSL_CTX_add1_to_CA_list() and SSL_add1_to_CA_list() return 1 for success and 0 for failure.

                      SSL_get0_peer_CA_list() returns a stack of CA names sent by the peer or NULL or an empty stack if no list was sent.

                      "},{"location":"man3/SSL_CTX_set0_CA_list/#examples","title":"EXAMPLES","text":"

                      Scan all certificates in CAfile and list them as acceptable CAs:

                      SSL_CTX_set_client_CA_list(ctx, SSL_load_client_CA_file(CAfile));\n
                      "},{"location":"man3/SSL_CTX_set0_CA_list/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_load_client_CA_file(3), SSL_CTX_load_verify_locations(3)

                      "},{"location":"man3/SSL_CTX_set0_CA_list/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set1_curves/","title":"SSL_CTX_set1_curves","text":""},{"location":"man3/SSL_CTX_set1_curves/#name","title":"NAME","text":"

                      SSL_CTX_set1_groups, SSL_CTX_set1_groups_list, SSL_set1_groups, SSL_set1_groups_list, SSL_get1_groups, SSL_get_shared_group, SSL_get_negotiated_group, SSL_CTX_set1_curves, SSL_CTX_set1_curves_list, SSL_set1_curves, SSL_set1_curves_list, SSL_get1_curves, SSL_get_shared_curve - EC supported curve functions

                      "},{"location":"man3/SSL_CTX_set1_curves/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_set1_groups(SSL_CTX *ctx, int *glist, int glistlen);\nint SSL_CTX_set1_groups_list(SSL_CTX *ctx, char *list);\n\nint SSL_set1_groups(SSL *ssl, int *glist, int glistlen);\nint SSL_set1_groups_list(SSL *ssl, char *list);\n\nint SSL_get1_groups(SSL *ssl, int *groups);\nint SSL_get_shared_group(SSL *s, int n);\nint SSL_get_negotiated_group(SSL *s);\n\nint SSL_CTX_set1_curves(SSL_CTX *ctx, int *clist, int clistlen);\nint SSL_CTX_set1_curves_list(SSL_CTX *ctx, char *list);\n\nint SSL_set1_curves(SSL *ssl, int *clist, int clistlen);\nint SSL_set1_curves_list(SSL *ssl, char *list);\n\nint SSL_get1_curves(SSL *ssl, int *curves);\nint SSL_get_shared_curve(SSL *s, int n);\n
                      "},{"location":"man3/SSL_CTX_set1_curves/#description","title":"DESCRIPTION","text":"

                      For all of the functions below that set the supported groups there must be at least one group in the list. A number of these functions identify groups via a unique integer NID value. However, support for some groups may be added by external providers. In this case there will be no NID assigned for the group. When setting such groups applications should use the \"list\" form of these functions (i.e. SSL_CTX_set1_groups_list() and SSL_set1_groups_list).

                      SSL_CTX_set1_groups() sets the supported groups for ctx to glistlen groups in the array glist. The array consist of all NIDs of groups in preference order. For a TLS client the groups are used directly in the supported groups extension. For a TLS server the groups are used to determine the set of shared groups. Currently supported groups for TLSv1.3 are NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1, NID_X25519, NID_X448, NID_ffdhe2048, NID_ffdhe3072, NID_ffdhe4096, NID_ffdhe6144 and NID_ffdhe8192.

                      SSL_CTX_set1_groups_list() sets the supported groups for ctx to string list. The string is a colon separated list of group NIDs or names, for example \"P-521:P-384:P-256:X25519:ffdhe2048\". Currently supported groups for TLSv1.3 are P-256, P-384, P-521, X25519, X448, ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192. Support for other groups may be added by external providers.

                      SSL_set1_groups() and SSL_set1_groups_list() are similar except they set supported groups for the SSL structure ssl.

                      SSL_get1_groups() returns the set of supported groups sent by a client in the supported groups extension. It returns the total number of supported groups. The groups parameter can be NULL to simply return the number of groups for memory allocation purposes. The groups array is in the form of a set of group NIDs in preference order. It can return zero if the client did not send a supported groups extension. If a supported group NID is unknown then the value is set to the bitwise OR of TLSEXT_nid_unknown (0x1000000) and the id of the group.

                      SSL_get_shared_group() returns the NID of the shared group n for a server-side SSL ssl. If n is -1 then the total number of shared groups is returned, which may be zero. Other than for diagnostic purposes, most applications will only be interested in the first shared group so n is normally set to zero. If the value n is out of range, NID_undef is returned. If the NID for the shared group is unknown then the value is set to the bitwise OR of TLSEXT_nid_unknown (0x1000000) and the id of the group.

                      SSL_get_negotiated_group() returns the NID of the negotiated group used for the handshake key exchange process. For TLSv1.3 connections this typically reflects the state of the current connection, though in the case of PSK-only resumption, the returned value will be from a previous connection. For earlier TLS versions, when a session has been resumed, it always reflects the group used for key exchange during the initial handshake (otherwise it is from the current, non-resumption, connection). This can be called by either client or server. If the NID for the shared group is unknown then the value is set to the bitwise OR of TLSEXT_nid_unknown (0x1000000) and the id of the group.

                      All these functions are implemented as macros.

                      The curve functions are synonyms for the equivalently named group functions and are identical in every respect. They exist because, prior to TLS1.3, there was only the concept of supported curves. In TLS1.3 this was renamed to supported groups, and extended to include Diffie Hellman groups. The group functions should be used in preference.

                      "},{"location":"man3/SSL_CTX_set1_curves/#notes","title":"NOTES","text":"

                      If an application wishes to make use of several of these functions for configuration purposes either on a command line or in a file it should consider using the SSL_CONF interface instead of manually parsing options.

                      "},{"location":"man3/SSL_CTX_set1_curves/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set1_groups(), SSL_CTX_set1_groups_list(), SSL_set1_groups() and SSL_set1_groups_list(), return 1 for success and 0 for failure.

                      SSL_get1_groups() returns the number of groups, which may be zero.

                      SSL_get_shared_group() returns the NID of shared group n or NID_undef if there is no shared group n; or the total number of shared groups if n is -1.

                      When called on a client ssl, SSL_get_shared_group() has no meaning and returns -1.

                      SSL_get_negotiated_group() returns the NID of the negotiated group used for key exchange, or NID_undef if there was no negotiated group.

                      "},{"location":"man3/SSL_CTX_set1_curves/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_add_extra_chain_cert(3)

                      "},{"location":"man3/SSL_CTX_set1_curves/#history","title":"HISTORY","text":"

                      The curve functions were added in OpenSSL 1.0.2. The equivalent group functions were added in OpenSSL 1.1.1. The SSL_get_negotiated_group() function was added in OpenSSL 3.0.0.

                      "},{"location":"man3/SSL_CTX_set1_curves/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set1_sigalgs/","title":"SSL_CTX_set1_sigalgs","text":""},{"location":"man3/SSL_CTX_set1_sigalgs/#name","title":"NAME","text":"

                      SSL_CTX_set1_sigalgs, SSL_set1_sigalgs, SSL_CTX_set1_sigalgs_list, SSL_set1_sigalgs_list, SSL_CTX_set1_client_sigalgs, SSL_set1_client_sigalgs, SSL_CTX_set1_client_sigalgs_list, SSL_set1_client_sigalgs_list - set supported signature algorithms

                      "},{"location":"man3/SSL_CTX_set1_sigalgs/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nlong SSL_CTX_set1_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen);\nlong SSL_set1_sigalgs(SSL *ssl, const int *slist, long slistlen);\nlong SSL_CTX_set1_sigalgs_list(SSL_CTX *ctx, const char *str);\nlong SSL_set1_sigalgs_list(SSL *ssl, const char *str);\n\nlong SSL_CTX_set1_client_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen);\nlong SSL_set1_client_sigalgs(SSL *ssl, const int *slist, long slistlen);\nlong SSL_CTX_set1_client_sigalgs_list(SSL_CTX *ctx, const char *str);\nlong SSL_set1_client_sigalgs_list(SSL *ssl, const char *str);\n
                      "},{"location":"man3/SSL_CTX_set1_sigalgs/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set1_sigalgs() and SSL_set1_sigalgs() set the supported signature algorithms for ctx or ssl. The array slist of length slistlen must consist of pairs of NIDs corresponding to digest and public key algorithms.

                      SSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list() set the supported signature algorithms for ctx or ssl. The str parameter must be a null terminated string consisting of a colon separated list of elements, where each element is either a combination of a public key algorithm and a digest separated by +, or a TLS 1.3-style named SignatureScheme such as rsa_pss_pss_sha256.

                      SSL_CTX_set1_client_sigalgs(), SSL_set1_client_sigalgs(), SSL_CTX_set1_client_sigalgs_list() and SSL_set1_client_sigalgs_list() set signature algorithms related to client authentication, otherwise they are identical to SSL_CTX_set1_sigalgs(), SSL_set1_sigalgs(), SSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list().

                      All these functions are implemented as macros. The signature algorithm parameter (integer array or string) is not freed: the application should free it, if necessary.

                      "},{"location":"man3/SSL_CTX_set1_sigalgs/#notes","title":"NOTES","text":"

                      If an application wishes to allow the setting of signature algorithms as one of many user configurable options it should consider using the more flexible SSL_CONF API instead.

                      The signature algorithms set by a client are used directly in the supported signature algorithm in the client hello message.

                      The supported signature algorithms set by a server are not sent to the client but are used to determine the set of shared signature algorithms and (if server preferences are set with SSL_OP_CIPHER_SERVER_PREFERENCE) their order.

                      The client authentication signature algorithms set by a server are sent in a certificate request message if client authentication is enabled, otherwise they are unused.

                      Similarly client authentication signature algorithms set by a client are used to determined the set of client authentication shared signature algorithms.

                      Signature algorithms will neither be advertised nor used if the security level prohibits them (for example SHA1 if the security level is 4 or more).

                      Currently the NID_md5, NID_sha1, NID_sha224, NID_sha256, NID_sha384 and NID_sha512 digest NIDs are supported and the public key algorithm NIDs EVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA and EVP_PKEY_EC.

                      The short or long name values for digests can be used in a string (for example \"MD5\", \"SHA1\", \"SHA224\", \"SHA256\", \"SHA384\", \"SHA512\") and the public key algorithm strings \"RSA\", \"RSA-PSS\", \"DSA\" or \"ECDSA\".

                      The TLS 1.3 signature scheme names (such as \"rsa_pss_pss_sha256\") can also be used with the _list forms of the API.

                      The use of MD5 as a digest is strongly discouraged due to security weaknesses.

                      "},{"location":"man3/SSL_CTX_set1_sigalgs/#return-values","title":"RETURN VALUES","text":"

                      All these functions return 1 for success and 0 for failure.

                      "},{"location":"man3/SSL_CTX_set1_sigalgs/#examples","title":"EXAMPLES","text":"

                      Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA using an array:

                      const int slist[] = {NID_sha256, EVP_PKEY_EC, NID_sha256, EVP_PKEY_RSA};\n\nSSL_CTX_set1_sigalgs(ctx, slist, 4);\n

                      Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA using a string:

                      SSL_CTX_set1_sigalgs_list(ctx, \"ECDSA+SHA256:RSA+SHA256\");\n
                      "},{"location":"man3/SSL_CTX_set1_sigalgs/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_get_shared_sigalgs(3), SSL_CONF_CTX_new(3)

                      "},{"location":"man3/SSL_CTX_set1_sigalgs/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/","title":"SSL_CTX_set1_verify_cert_store","text":""},{"location":"man3/SSL_CTX_set1_verify_cert_store/#name","title":"NAME","text":"

                      SSL_CTX_set0_verify_cert_store, SSL_CTX_set1_verify_cert_store, SSL_CTX_set0_chain_cert_store, SSL_CTX_set1_chain_cert_store, SSL_set0_verify_cert_store, SSL_set1_verify_cert_store, SSL_set0_chain_cert_store, SSL_set1_chain_cert_store, SSL_CTX_get0_verify_cert_store, SSL_CTX_get0_chain_cert_store, SSL_get0_verify_cert_store, SSL_get0_chain_cert_store - set certificate verification or chain store

                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_set0_verify_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_set1_verify_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_set0_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_set1_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_get0_verify_cert_store(SSL_CTX *ctx, X509_STORE **st);\nint SSL_CTX_get0_chain_cert_store(SSL_CTX *ctx, X509_STORE **st);\n\nint SSL_set0_verify_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_set1_verify_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_set0_chain_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_set1_chain_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_get0_verify_cert_store(SSL *ctx, X509_STORE **st);\nint SSL_get0_chain_cert_store(SSL *ctx, X509_STORE **st);\n
                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set0_verify_cert_store() and SSL_CTX_set1_verify_cert_store() set the certificate store used for certificate verification to st.

                      SSL_CTX_set0_chain_cert_store() and SSL_CTX_set1_chain_cert_store() set the certificate store used for certificate chain building to st.

                      SSL_set0_verify_cert_store(), SSL_set1_verify_cert_store(), SSL_set0_chain_cert_store() and SSL_set1_chain_cert_store() are similar except they apply to SSL structure ssl.

                      SSL_CTX_get0_verify_chain_store(), SSL_get0_verify_chain_store(), SSL_CTX_get0_chain_cert_store() and SSL_get0_chain_cert_store() retrieve the objects previously set via the above calls. A pointer to the object (or NULL if no such object has been set) is written to *st.

                      All these functions are implemented as macros. Those containing a 1 increment the reference count of the supplied store so it must be freed at some point after the operation. Those containing a 0 do not increment reference counts and the supplied store MUST NOT be freed after the operation.

                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#notes","title":"NOTES","text":"

                      The stores pointers associated with an SSL_CTX structure are copied to any SSL structures when SSL_new() is called. As a result SSL structures will not be affected if the parent SSL_CTX store pointer is set to a new value.

                      The verification store is used to verify the certificate chain sent by the peer: that is an SSL/TLS client will use the verification store to verify the server's certificate chain and a SSL/TLS server will use it to verify any client certificate chain.

                      The chain store is used to build the certificate chain. Details of the chain building and checking process are described in \"Certification Path Building\" in openssl-verification-options(1) and \"Certification Path Validation\" in openssl-verification-options(1).

                      If the mode SSL_MODE_NO_AUTO_CHAIN is set or a certificate chain is configured already (for example using the functions such as SSL_CTX_add1_chain_cert(3) or SSL_CTX_add_extra_chain_cert(3)) then automatic chain building is disabled.

                      If the mode SSL_MODE_NO_AUTO_CHAIN is set then automatic chain building is disabled.

                      If the chain or the verification store is not set then the store associated with the parent SSL_CTX is used instead to retain compatibility with previous versions of OpenSSL.

                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#return-values","title":"RETURN VALUES","text":"

                      All these functions return 1 for success and 0 for failure.

                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_add_extra_chain_cert(3) SSL_CTX_set0_chain(3) SSL_CTX_set1_chain(3) SSL_CTX_add0_chain_cert(3) SSL_CTX_add1_chain_cert(3) SSL_set0_chain(3) SSL_set1_chain(3) SSL_add0_chain_cert(3) SSL_add1_chain_cert(3) SSL_CTX_build_cert_chain(3) SSL_build_cert_chain(3)

                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#history","title":"HISTORY","text":"

                      These functions were added in OpenSSL 1.0.2.

                      "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2013-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_alpn_select_cb/","title":"SSL_CTX_set_alpn_select_cb","text":""},{"location":"man3/SSL_CTX_set_alpn_select_cb/#name","title":"NAME","text":"

                      SSL_CTX_set_alpn_protos, SSL_set_alpn_protos, SSL_CTX_set_alpn_select_cb, SSL_CTX_set_next_proto_select_cb, SSL_CTX_set_next_protos_advertised_cb, SSL_select_next_proto, SSL_get0_alpn_selected, SSL_get0_next_proto_negotiated - handle application layer protocol negotiation (ALPN)

                      "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos,\n                            unsigned int protos_len);\nint SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,\n                        unsigned int protos_len);\nvoid SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,\n                                int (*cb) (SSL *ssl,\n                                           const unsigned char **out,\n                                           unsigned char *outlen,\n                                           const unsigned char *in,\n                                           unsigned int inlen,\n                                           void *arg), void *arg);\nvoid SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,\n                            unsigned int *len);\n\nvoid SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *ctx,\n                                           int (*cb)(SSL *ssl,\n                                                     const unsigned char **out,\n                                                     unsigned int *outlen,\n                                                     void *arg),\n                                           void *arg);\nvoid SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx,\n                              int (*cb)(SSL *s,\n                                        unsigned char **out,\n                                        unsigned char *outlen,\n                                        const unsigned char *in,\n                                        unsigned int inlen,\n                                        void *arg),\n                              void *arg);\nint SSL_select_next_proto(unsigned char **out, unsigned char *outlen,\n                          const unsigned char *server,\n                          unsigned int server_len,\n                          const unsigned char *client,\n                          unsigned int client_len);\nvoid SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,\n                            unsigned *len);\n
                      "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() are used by the client to set the list of protocols available to be negotiated. The protos must be in protocol-list format, described below. The length of protos is specified in protos_len. Setting protos_len to 0 clears any existing list of ALPN protocols and no ALPN extension will be sent to the server.

                      SSL_CTX_set_alpn_select_cb() sets the application callback cb used by a server to select which protocol to use for the incoming connection. When cb is NULL, ALPN is not used. The arg value is a pointer which is passed to the application callback.

                      cb is the application defined callback. The in, inlen parameters are a vector in protocol-list format. The value of the out, outlen vector should be set to the value of a single protocol selected from the in, inlen vector. The out buffer may point directly into in, or to a buffer that outlives the handshake. The arg parameter is the pointer set via SSL_CTX_set_alpn_select_cb().

                      SSL_select_next_proto() is a helper function used to select protocols. It implements the standard protocol selection. It is expected that this function is called from the application callback cb. The protocol data in server, server_len and client, client_len must be in the protocol-list format described below. The first item in the server, server_len list that matches an item in the client, client_len list is selected, and returned in out, outlen. The out value will point into either server or client, so it should be copied immediately. The client list must include at least one valid (nonempty) protocol entry in the list.

                      The SSL_select_next_proto() helper function can be useful from either the ALPN callback or the NPN callback (described below). If no match is found, the first item in client, client_len is returned in out, outlen and OPENSSL_NPN_NO_OVERLAP is returned. This can be useful when implementating the NPN callback. In the ALPN case, the value returned in out and outlen must be ignored if OPENSSL_NPN_NO_OVERLAP has been returned from SSL_select_next_proto().

                      SSL_CTX_set_next_proto_select_cb() sets a callback cb that is called when a client needs to select a protocol from the server's provided list, and a user-defined pointer argument arg which will be passed to this callback. For the callback itself, out must be set to point to the selected protocol (which may be within in). The length of the protocol name must be written into outlen. The server's advertised protocols are provided in in and inlen. The callback can assume that in is syntactically valid. The client must select a protocol (although it may be an empty, zero length protocol). It is fatal to the connection if this callback returns a value other than SSL_TLSEXT_ERR_OK or if the zero length protocol is selected. The arg parameter is the pointer set via SSL_CTX_set_next_proto_select_cb().

                      SSL_CTX_set_next_protos_advertised_cb() sets a callback cb that is called when a TLS server needs a list of supported protocols for Next Protocol Negotiation. The returned list must be in protocol-list format, described below. The list is returned by setting out to point to it and outlen to its length. This memory will not be modified, but the SSL does keep a reference to it. The callback should return SSL_TLSEXT_ERR_OK if it wishes to advertise. Otherwise, no such extension will be included in the ServerHello.

                      SSL_get0_alpn_selected() returns a pointer to the selected protocol in data with length len. It is not NUL-terminated. data is set to NULL and len is set to 0 if no protocol has been selected. data must not be freed.

                      SSL_get0_next_proto_negotiated() sets data and len to point to the client's requested protocol for this connection. If the client did not request any protocol or NPN is not enabled, then data is set to NULL and len to 0. Note that the client can request any protocol it chooses. The value returned from this function need not be a member of the list of supported protocols provided by the callback.

                      "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#notes","title":"NOTES","text":"

                      The protocol-lists must be in wire-format, which is defined as a vector of nonempty, 8-bit length-prefixed, byte strings. The length-prefix byte is not included in the length. Each string is limited to 255 bytes. A byte-string length of 0 is invalid. A truncated byte-string is invalid. The length of the vector is not in the vector itself, but in a separate variable.

                      Example:

                      unsigned char vector[] = {\n    6, 's', 'p', 'd', 'y', '/', '1',\n    8, 'h', 't', 't', 'p', '/', '1', '.', '1'\n};\nunsigned int length = sizeof(vector);\n

                      The ALPN callback is executed after the servername callback; as that servername callback may update the SSL_CTX, and subsequently, the ALPN callback.

                      If there is no ALPN proposed in the ClientHello, the ALPN callback is not invoked.

                      "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() return 0 on success, and non-0 on failure. WARNING: these functions reverse the return value convention.

                      SSL_select_next_proto() returns one of the following:

                      • OPENSSL_NPN_NEGOTIATED

                        A match was found and is returned in out, outlen.

                      • OPENSSL_NPN_NO_OVERLAP

                        No match was found. The first item in client, client_len is returned in out, outlen (or NULL and 0 in the case where the first entry in client is invalid).

                      The ALPN select callback cb, must return one of the following:

                      • SSL_TLSEXT_ERR_OK

                        ALPN protocol selected.

                      • SSL_TLSEXT_ERR_ALERT_FATAL

                        There was no overlap between the client's supplied list and the server configuration.

                      • SSL_TLSEXT_ERR_NOACK

                        ALPN protocol not selected, e.g., because no ALPN protocols are configured for this connection.

                      The callback set using SSL_CTX_set_next_proto_select_cb() should return SSL_TLSEXT_ERR_OK if successful. Any other value is fatal to the connection.

                      The callback set using SSL_CTX_set_next_protos_advertised_cb() should return SSL_TLSEXT_ERR_OK if it wishes to advertise. Otherwise, no such extension will be included in the ServerHello.

                      "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_tlsext_servername_callback(3), SSL_CTX_set_tlsext_servername_arg(3)

                      "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_cert_cb/","title":"SSL_CTX_set_cert_cb","text":""},{"location":"man3/SSL_CTX_set_cert_cb/#name","title":"NAME","text":"

                      SSL_CTX_set_cert_cb, SSL_set_cert_cb - handle certificate callback function

                      "},{"location":"man3/SSL_CTX_set_cert_cb/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cert_cb)(SSL *ssl, void *arg),\n                         void *arg);\nvoid SSL_set_cert_cb(SSL *s, int (*cert_cb)(SSL *ssl, void *arg), void *arg);\n
                      "},{"location":"man3/SSL_CTX_set_cert_cb/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_cert_cb() and SSL_set_cert_cb() sets the cert_cb callback, arg value is pointer which is passed to the application callback.

                      When cert_cb is NULL, no callback function is used.

                      cert_cb is the application defined callback. It is called before a certificate will be used by a client or server. The callback can then inspect the passed ssl structure and set or clear any appropriate certificates. If the callback is successful it MUST return 1 even if no certificates have been set. A zero is returned on error which will abort the handshake with a fatal internal error alert. A negative return value will suspend the handshake and the handshake function will return immediately. SSL_get_error(3) will return SSL_ERROR_WANT_X509_LOOKUP to indicate, that the handshake was suspended. The next call to the handshake function will again lead to the call of cert_cb. It is the job of the cert_cb to store information about the state of the last call, if required to continue.

                      "},{"location":"man3/SSL_CTX_set_cert_cb/#notes","title":"NOTES","text":"

                      An application will typically call SSL_use_certificate() and SSL_use_PrivateKey() to set the end entity certificate and private key. It can add intermediate and optionally the root CA certificates using SSL_add1_chain_cert().

                      It might also call SSL_certs_clear() to delete any certificates associated with the SSL object.

                      The certificate callback functionality supersedes the (largely broken) functionality provided by the old client certificate callback interface. It is always called even is a certificate is already set so the callback can modify or delete the existing certificate.

                      A more advanced callback might examine the handshake parameters and set whatever chain is appropriate. For example a legacy client supporting only TLSv1.0 might receive a certificate chain signed using SHA1 whereas a TLSv1.2 or later client which advertises support for SHA256 could receive a chain using SHA256.

                      Normal server sanity checks are performed on any certificates set by the callback. So if an EC chain is set for a curve the client does not support it will not be used.

                      "},{"location":"man3/SSL_CTX_set_cert_cb/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_cert_cb() and SSL_set_cert_cb() do not return values.

                      "},{"location":"man3/SSL_CTX_set_cert_cb/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_use_certificate(3), SSL_add1_chain_cert(3), SSL_get_client_CA_list(3), SSL_clear(3), SSL_free(3)

                      "},{"location":"man3/SSL_CTX_set_cert_cb/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2014-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_cert_store/","title":"SSL_CTX_set_cert_store","text":""},{"location":"man3/SSL_CTX_set_cert_store/#name","title":"NAME","text":"

                      SSL_CTX_set_cert_store, SSL_CTX_set1_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate verification storage

                      "},{"location":"man3/SSL_CTX_set_cert_store/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store);\nvoid SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store);\nX509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_set_cert_store/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_cert_store() sets/replaces the certificate verification storage of ctx to/with store. If another X509_STORE object is currently set in ctx, it will be X509_STORE_free()ed. SSL_CTX_set_cert_store() will take ownership of the store, i.e., the call X509_STORE_free(store) is no longer needed.

                      SSL_CTX_set1_cert_store() sets/replaces the certificate verification storage of ctx to/with store. The store's reference count is incremented. If another X509_STORE object is currently set in ctx, it will be X509_STORE_free()ed.

                      SSL_CTX_get_cert_store() returns a pointer to the current certificate verification storage.

                      "},{"location":"man3/SSL_CTX_set_cert_store/#notes","title":"NOTES","text":"

                      In order to verify the certificates presented by the peer, trusted CA certificates must be accessed. These CA certificates are made available via lookup methods, handled inside the X509_STORE. From the X509_STORE the X509_STORE_CTX used when verifying certificates is created.

                      Typically the trusted certificate store is handled indirectly via using SSL_CTX_load_verify_locations(3). Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions it is possible to manipulate the X509_STORE object beyond the SSL_CTX_load_verify_locations(3) call.

                      Currently no detailed documentation on how to use the X509_STORE object is available. Not all members of the X509_STORE are used when the verification takes place. So will e.g. the verify_callback() be overridden with the verify_callback() set via the SSL_CTX_set_verify(3) family of functions. This document must therefore be updated when documentation about the X509_STORE object and its handling becomes available.

                      SSL_CTX_set_cert_store() does not increment the store's reference count, so it should not be used to assign an X509_STORE that is owned by another SSL_CTX.

                      To share X509_STOREs between two SSL_CTXs, use SSL_CTX_get_cert_store() to get the X509_STORE from the first SSL_CTX, and then use SSL_CTX_set1_cert_store() to assign to the second SSL_CTX and increment the reference count of the X509_STORE.

                      "},{"location":"man3/SSL_CTX_set_cert_store/#restrictions","title":"RESTRICTIONS","text":"

                      The X509_STORE structure used by an SSL_CTX is used for verifying peer certificates and building certificate chains, it is also shared by every child SSL structure. Applications wanting finer control can use functions such as SSL_CTX_set1_verify_cert_store() instead.

                      "},{"location":"man3/SSL_CTX_set_cert_store/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_cert_store() does not return diagnostic output.

                      SSL_CTX_set1_cert_store() does not return diagnostic output.

                      SSL_CTX_get_cert_store() returns the current setting.

                      "},{"location":"man3/SSL_CTX_set_cert_store/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_load_verify_locations(3), SSL_CTX_set_verify(3)

                      "},{"location":"man3/SSL_CTX_set_cert_store/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/","title":"SSL_CTX_set_cert_verify_callback","text":""},{"location":"man3/SSL_CTX_set_cert_verify_callback/#name","title":"NAME","text":"

                      SSL_CTX_set_cert_verify_callback - set peer certificate verification procedure

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx,\n                                      int (*callback)(X509_STORE_CTX *, void *),\n                                      void *arg);\n
                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_cert_verify_callback() sets the verification callback function for ctx. SSL objects that are created from ctx inherit the setting valid at the time when SSL_new(3) is called.

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#notes","title":"NOTES","text":"

                      When a peer certificate has been received during a SSL/TLS handshake, a verification function is called regardless of the verification mode. If the application does not explicitly specify a verification callback function, the built-in verification function is used. If a verification callback callback is specified via SSL_CTX_set_cert_verify_callback(), the supplied callback function is called instead with the arguments callback(X509_STORE_CTX *x509_store_ctx, void *arg). The argument arg is specified by the application when setting callback. By setting callback to NULL, the default behaviour is restored.

                      callback should return 1 to indicate verification success and 0 to indicate verification failure. In server mode, a return value of 0 leads to handshake failure. In client mode, the behaviour is as follows. All values, including 0, are ignored if the verification mode is SSL_VERIFY_NONE. Otherwise, when the return value is less than or equal to 0, the handshake will fail.

                      In client mode callback may also call the SSL_set_retry_verify(3) function on the SSL object set in the x509_store_ctx ex data (see SSL_get_ex_data_X509_STORE_CTX_idx(3)) and return 1. This would be typically done in case the certificate verification was not yet able to succeed. This makes the handshake suspend and return control to the calling application with SSL_ERROR_WANT_RETRY_VERIFY. The app can for instance fetch further certificates or cert status information needed for the verification. Calling SSL_connect(3) again resumes the connection attempt by retrying the server certificate verification step. This process may even be repeated if need be.

                      In any case a viable verification result value must be reflected in the error member of x509_store_ctx, which can be done using X509_STORE_CTX_set_error(3). This is particularly important in case the callback allows the connection to continue (by returning 1). Note that the verification status in the store context is a possibly durable indication of the chain's validity! This gets recorded in the SSL session (and thus also in session tickets) and the validity of the originally presented chain is then visible on resumption, even though no chain is presented int that case. Moreover, the calling application will be informed about the detailed result of the verification procedure and may elect to base further decisions on it.

                      Within x509_store_ctx, callback has access to the verify_callback function set using SSL_CTX_set_verify(3).

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_cert_verify_callback() does not return a value.

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#warnings","title":"WARNINGS","text":"

                      Do not mix the verification callback described in this function with the verify_callback function called during the verification process. The latter is set using the SSL_CTX_set_verify(3) family of functions.

                      Providing a complete verification procedure including certificate purpose settings etc is a complex task. The built-in procedure is quite powerful and in most cases it should be sufficient to modify its behaviour using the verify_callback function.

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#bugs","title":"BUGS","text":"

                      SSL_CTX_set_cert_verify_callback() does not provide diagnostic information.

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_verify(3), X509_STORE_CTX_set_error(3), SSL_get_verify_result(3), SSL_set_retry_verify(3), SSL_CTX_load_verify_locations(3)

                      "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_cipher_list/","title":"SSL_CTX_set_cipher_list","text":""},{"location":"man3/SSL_CTX_set_cipher_list/#name","title":"NAME","text":"

                      SSL_CTX_set_cipher_list, SSL_set_cipher_list, SSL_CTX_set_ciphersuites, SSL_set_ciphersuites, OSSL_default_cipher_list, OSSL_default_ciphersuites - choose list of available SSL_CIPHERs

                      "},{"location":"man3/SSL_CTX_set_cipher_list/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);\nint SSL_set_cipher_list(SSL *ssl, const char *str);\n\nint SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);\nint SSL_set_ciphersuites(SSL *s, const char *str);\n\nconst char *OSSL_default_cipher_list(void);\nconst char *OSSL_default_ciphersuites(void);\n
                      "},{"location":"man3/SSL_CTX_set_cipher_list/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_cipher_list() sets the list of available ciphers (TLSv1.2 and below) for ctx using the control string str. The format of the string is described in openssl-ciphers(1). The list of ciphers is inherited by all ssl objects created from ctx. This function does not impact TLSv1.3 ciphersuites. Use SSL_CTX_set_ciphersuites() to configure those.

                      SSL_set_cipher_list() sets the list of ciphers (TLSv1.2 and below) only for ssl.

                      SSL_CTX_set_ciphersuites() is used to configure the available TLSv1.3 ciphersuites for ctx. This is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names in order of preference. Valid TLSv1.3 ciphersuite names are:

                      • TLS_AES_128_GCM_SHA256
                      • TLS_AES_256_GCM_SHA384
                      • TLS_CHACHA20_POLY1305_SHA256
                      • TLS_AES_128_CCM_SHA256
                      • TLS_AES_128_CCM_8_SHA256

                      An empty list is permissible. The default value for this setting is:

                      \"TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256\"

                      SSL_set_ciphersuites() is the same as SSL_CTX_set_ciphersuites() except it configures the ciphersuites for ssl.

                      OSSL_default_cipher_list() returns the default cipher string for TLSv1.2 (and earlier) ciphers. OSSL_default_ciphersuites() returns the default cipher string for TLSv1.3 ciphersuites.

                      "},{"location":"man3/SSL_CTX_set_cipher_list/#notes","title":"NOTES","text":"

                      The control string str for SSL_CTX_set_cipher_list(), SSL_set_cipher_list(), SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() should be universally usable and not depend on details of the library configuration (ciphers compiled in). Thus no syntax checking takes place. Items that are not recognized, because the corresponding ciphers are not compiled in or because they are mistyped, are simply ignored. Failure is only flagged if no ciphers could be collected at all.

                      It should be noted, that inclusion of a cipher to be used into the list is a necessary condition. On the client side, the inclusion into the list is also sufficient unless the security level excludes it. On the server side, additional restrictions apply. All ciphers have additional requirements. ADH ciphers don't need a certificate, but DH-parameters must have been set. All other ciphers need a corresponding certificate and key.

                      An RSA cipher can only be chosen, when an RSA certificate is available. RSA ciphers using DHE need a certificate and key and additional DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

                      A DSA cipher can only be chosen, when a DSA certificate is available. DSA ciphers always use DH key exchange and therefore need DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

                      When these conditions are not met for any cipher in the list (e.g. a client only supports export RSA ciphers with an asymmetric key length of 512 bits and the server is not configured to use temporary RSA keys), the \"no shared cipher\" (SSL_R_NO_SHARED_CIPHER) error is generated and the handshake will fail.

                      OSSL_default_cipher_list() and OSSL_default_ciphersuites() replace SSL_DEFAULT_CIPHER_LIST and TLS_DEFAULT_CIPHERSUITES, respectively. The cipher list defines are deprecated as of 3.0.

                      "},{"location":"man3/SSL_CTX_set_cipher_list/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher could be selected and 0 on complete failure.

                      SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() return 1 if the requested ciphersuite list was configured, and 0 otherwise.

                      "},{"location":"man3/SSL_CTX_set_cipher_list/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_get_ciphers(3), SSL_CTX_use_certificate(3), SSL_CTX_set_tmp_dh_callback(3), openssl-ciphers(1)

                      "},{"location":"man3/SSL_CTX_set_cipher_list/#history","title":"HISTORY","text":"

                      OSSL_default_cipher_list() and OSSL_default_ciphersites() are new in 3.0.

                      "},{"location":"man3/SSL_CTX_set_cipher_list/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/","title":"SSL_CTX_set_client_cert_cb","text":""},{"location":"man3/SSL_CTX_set_client_cert_cb/#name","title":"NAME","text":"

                      SSL_CTX_set_client_cert_cb, SSL_CTX_get_client_cert_cb - handle client certificate callback function

                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_client_cert_cb(SSL_CTX *ctx,\n                                int (*client_cert_cb)(SSL *ssl, X509 **x509,\n                                                      EVP_PKEY **pkey));\nint (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509,\n                                                EVP_PKEY **pkey);\n
                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_client_cert_cb() sets the client_cert_cb callback, that is called when a client certificate is requested by a server and no certificate was yet set for the SSL object.

                      When client_cert_cb is NULL, no callback function is used.

                      SSL_CTX_get_client_cert_cb() returns a pointer to the currently set callback function.

                      client_cert_cb is the application defined callback. If it wants to set a certificate, a certificate/private key combination must be set using the x509 and pkey arguments and \"1\" must be returned. The certificate will be installed into ssl, see the NOTES and BUGS sections. If no certificate should be set, \"0\" has to be returned and no certificate will be sent. A negative return value will suspend the handshake and the handshake function will return immediately. SSL_get_error(3) will return SSL_ERROR_WANT_X509_LOOKUP to indicate, that the handshake was suspended. The next call to the handshake function will again lead to the call of client_cert_cb. It is the job of the client_cert_cb to store information about the state of the last call, if required to continue.

                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/#notes","title":"NOTES","text":"

                      During a handshake (or renegotiation) a server may request a certificate from the client. A client certificate must only be sent, when the server did send the request.

                      When a certificate was set using the SSL_CTX_use_certificate(3) family of functions, it will be sent to the server. The TLS standard requires that only a certificate is sent, if it matches the list of acceptable CAs sent by the server. This constraint is violated by the default behavior of the OpenSSL library. Using the callback function it is possible to implement a proper selection routine or to allow a user interaction to choose the certificate to be sent.

                      If a callback function is defined and no certificate was yet defined for the SSL object, the callback function will be called. If the callback function returns a certificate, the OpenSSL library will try to load the private key and certificate data into the SSL object using the SSL_use_certificate() and SSL_use_private_key() functions. Thus it will permanently install the certificate and key for this SSL object. It will not be reset by calling SSL_clear(3). If the callback returns no certificate, the OpenSSL library will not send a certificate.

                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_get_client_cert_cb() returns function pointer of client_cert_cb or NULL if the callback is not set.

                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/#bugs","title":"BUGS","text":"

                      The client_cert_cb cannot return a complete certificate chain, it can only return one client certificate. If the chain only has a length of 2, the root CA certificate may be omitted according to the TLS standard and thus a standard conforming answer can be sent to the server. For a longer chain, the client must send the complete chain (with the option to leave out the root CA certificate). This can only be accomplished by either adding the intermediate CA certificates into the trusted certificate store for the SSL_CTX object (resulting in having to add CA certificates that otherwise maybe would not be trusted), or by adding the chain certificates using the SSL_CTX_add_extra_chain_cert(3) function, which is only available for the SSL_CTX object as a whole and that therefore probably can only apply for one client certificate, making the concept of the callback function (to allow the choice from several certificates) questionable.

                      Once the SSL object has been used in conjunction with the callback function, the certificate will be set for the SSL object and will not be cleared even when SSL_clear(3) is being called. It is therefore mandatory to destroy the SSL object using SSL_free(3) and create a new one to return to the previous state.

                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_use_certificate(3), SSL_CTX_add_extra_chain_cert(3), SSL_get_client_CA_list(3), SSL_clear(3), SSL_free(3)

                      "},{"location":"man3/SSL_CTX_set_client_cert_cb/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/","title":"SSL_CTX_set_client_hello_cb","text":""},{"location":"man3/SSL_CTX_set_client_hello_cb/#name","title":"NAME","text":"

                      SSL_CTX_set_client_hello_cb, SSL_client_hello_cb_fn, SSL_client_hello_isv2, SSL_client_hello_get0_legacy_version, SSL_client_hello_get0_random, SSL_client_hello_get0_session_id, SSL_client_hello_get0_ciphers, SSL_client_hello_get0_compression_methods, SSL_client_hello_get1_extensions_present, SSL_client_hello_get0_ext - callback functions for early server-side ClientHello processing

                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/#synopsis","title":"SYNOPSIS","text":"
                      typedef int (*SSL_client_hello_cb_fn)(SSL *s, int *al, void *arg);\nvoid SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn *f,\n                                 void *arg);\nint SSL_client_hello_isv2(SSL *s);\nunsigned int SSL_client_hello_get0_legacy_version(SSL *s);\nsize_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out);\nsize_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out);\nsize_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out);\nsize_t SSL_client_hello_get0_compression_methods(SSL *s,\n                                                 const unsigned char **out);\nint SSL_client_hello_get1_extensions_present(SSL *s, int **out,\n                                             size_t *outlen);\nint SSL_client_hello_get0_ext(SSL *s, unsigned int type, const unsigned char **out,\n                              size_t *outlen);\n
                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_client_hello_cb() sets the callback function, which is automatically called during the early stages of ClientHello processing on the server. The argument supplied when setting the callback is passed back to the callback at run time. A callback that returns failure (0) will cause the connection to terminate, and callbacks returning failure should indicate what alert value is to be sent in the al parameter. A callback may also return a negative value to suspend the handshake, and the handshake function will return immediately. SSL_get_error(3) will return SSL_ERROR_WANT_CLIENT_HELLO_CB to indicate that the handshake was suspended. It is the job of the ClientHello callback to store information about the state of the last call if needed to continue. On the next call into the handshake function, the ClientHello callback will be called again, and, if it returns success, normal handshake processing will continue from that point.

                      SSL_client_hello_isv2() indicates whether the ClientHello was carried in a SSLv2 record and is in the SSLv2 format. The SSLv2 format has substantial differences from the normal SSLv3 format, including using three bytes per cipher suite, and not allowing extensions. Additionally, the SSLv2 format 'challenge' field is exposed via SSL_client_hello_get0_random(), padded to SSL3_RANDOM_SIZE bytes with zeros if needed. For SSLv2 format ClientHellos, SSL_client_hello_get0_compression_methods() returns a dummy list that only includes the null compression method, since the SSLv2 format does not include a mechanism by which to negotiate compression.

                      SSL_client_hello_get0_random(), SSL_client_hello_get0_session_id(), SSL_client_hello_get0_ciphers(), and SSL_client_hello_get0_compression_methods() provide access to the corresponding ClientHello fields, returning the field length and optionally setting an out pointer to the octets of that field.

                      Similarly, SSL_client_hello_get0_ext() provides access to individual extensions from the ClientHello on a per-extension basis. For the provided wire protocol extension type value, the extension value and length are returned in the output parameters (if present).

                      SSL_client_hello_get1_extensions_present() can be used prior to SSL_client_hello_get0_ext(), to determine which extensions are present in the ClientHello before querying for them. The out and outlen parameters are both required, and on success the caller must release the storage allocated for *out using OPENSSL_free(). The contents of *out is an array of integers holding the numerical value of the TLS extension types in the order they appear in the ClientHello. *outlen contains the number of elements in the array. In situations when the ClientHello has no extensions, the function will return success with *out set to NULL and *outlen set to 0.

                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/#notes","title":"NOTES","text":"

                      The ClientHello callback provides a vast window of possibilities for application code to affect the TLS handshake. A primary use of the callback is to allow the server to examine the server name indication extension provided by the client in order to select an appropriate certificate to present, and make other configuration adjustments relevant to that server name and its configuration. Such configuration changes can include swapping out the associated SSL_CTX pointer, modifying the server's list of permitted TLS versions, changing the server's cipher list in response to the client's cipher list, etc.

                      It is also recommended that applications utilize a ClientHello callback and not use a servername callback, in order to avoid unexpected behavior that occurs due to the relative order of processing between things like session resumption and the historical servername callback.

                      The SSL_client_hello_* family of functions may only be called from code executing within a ClientHello callback.

                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/#return-values","title":"RETURN VALUES","text":"

                      The application's supplied ClientHello callback returns SSL_CLIENT_HELLO_SUCCESS on success, SSL_CLIENT_HELLO_ERROR on failure, and SSL_CLIENT_HELLO_RETRY to suspend processing.

                      SSL_client_hello_isv2() returns 1 for SSLv2-format ClientHellos and 0 otherwise.

                      SSL_client_hello_get0_random(), SSL_client_hello_get0_session_id(), SSL_client_hello_get0_ciphers(), and SSL_client_hello_get0_compression_methods() return the length of the corresponding ClientHello fields. If zero is returned, the output pointer should not be assumed to be valid.

                      SSL_client_hello_get0_ext() returns 1 if the extension of type 'type' is present, and 0 otherwise.

                      SSL_client_hello_get1_extensions_present() returns 1 on success and 0 on failure.

                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_tlsext_servername_callback(3), SSL_bytes_to_cipher_list(3)

                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/#history","title":"HISTORY","text":"

                      The SSL ClientHello callback, SSL_client_hello_isv2(), SSL_client_hello_get0_random(), SSL_client_hello_get0_session_id(), SSL_client_hello_get0_ciphers(), SSL_client_hello_get0_compression_methods(), SSL_client_hello_get0_ext(), and SSL_client_hello_get1_extensions_present() were added in OpenSSL 1.1.1.

                      "},{"location":"man3/SSL_CTX_set_client_hello_cb/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_ct_validation_callback/","title":"SSL_CTX_set_ct_validation_callback","text":""},{"location":"man3/SSL_CTX_set_ct_validation_callback/#name","title":"NAME","text":"

                      ssl_ct_validation_cb, SSL_enable_ct, SSL_CTX_enable_ct, SSL_disable_ct, SSL_CTX_disable_ct, SSL_set_ct_validation_callback, SSL_CTX_set_ct_validation_callback, SSL_ct_is_enabled, SSL_CTX_ct_is_enabled - control Certificate Transparency policy

                      "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\ntypedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx,\n                                   const STACK_OF(SCT) *scts, void *arg);\n\nint SSL_enable_ct(SSL *s, int validation_mode);\nint SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode);\nint SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback,\n                                   void *arg);\nint SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,\n                                       ssl_ct_validation_cb callback,\n                                       void *arg);\nvoid SSL_disable_ct(SSL *s);\nvoid SSL_CTX_disable_ct(SSL_CTX *ctx);\nint SSL_ct_is_enabled(const SSL *s);\nint SSL_CTX_ct_is_enabled(const SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#description","title":"DESCRIPTION","text":"

                      SSL_enable_ct() and SSL_CTX_enable_ct() enable the processing of signed certificate timestamps (SCTs) either for a given SSL connection or for all connections that share the given SSL context, respectively. This is accomplished by setting a built-in CT validation callback. The behaviour of the callback is determined by the validation_mode argument, which can be either of SSL_CT_VALIDATION_PERMISSIVE or SSL_CT_VALIDATION_STRICT as described below.

                      If validation_mode is equal to SSL_CT_VALIDATION_STRICT, then in a full TLS handshake with the verification mode set to SSL_VERIFY_PEER, if the peer presents no valid SCTs the handshake will be aborted. If the verification mode is SSL_VERIFY_NONE, the handshake will continue despite lack of valid SCTs. However, in that case if the verification status before the built-in callback was X509_V_OK it will be set to X509_V_ERR_NO_VALID_SCTS after the callback. Applications can call SSL_get_verify_result(3) to check the status at handshake completion, even after session resumption since the verification status is part of the saved session state. See SSL_set_verify(3), , SSL_session_reused(3).

                      If validation_mode is equal to SSL_CT_VALIDATION_PERMISSIVE, then the handshake continues, and the verification status is not modified, regardless of the validation status of any SCTs. The application can still inspect the validation status of the SCTs at handshake completion. Note that with session resumption there will not be any SCTs presented during the handshake. Therefore, in applications that delay SCT policy enforcement until after handshake completion, such delayed SCT checks should only be performed when the session is not resumed.

                      SSL_set_ct_validation_callback() and SSL_CTX_set_ct_validation_callback() register a custom callback that may implement a different policy than either of the above. This callback can examine the peer's SCTs and determine whether they are sufficient to allow the connection to continue. The TLS handshake is aborted if the verification mode is not SSL_VERIFY_NONE and the callback returns a non-positive result.

                      An arbitrary callback data argument, arg, can be passed in when setting the callback. This will be passed to the callback whenever it is invoked. Ownership of this context remains with the caller.

                      If no callback is set, SCTs will not be requested and Certificate Transparency validation will not occur.

                      No callback will be invoked when the peer presents no certificate, e.g. by employing an anonymous (aNULL) cipher suite. In that case the handshake continues as it would had no callback been requested. Callbacks are also not invoked when the peer certificate chain is invalid or validated via DANE-TA(2) or DANE-EE(3) TLSA records which use a private X.509 PKI, or no X.509 PKI at all, respectively. Clients that require SCTs are expected to not have enabled any aNULL ciphers nor to have specified server verification via DANE-TA(2) or DANE-EE(3) TLSA records.

                      SSL_disable_ct() and SSL_CTX_disable_ct() turn off CT processing, whether enabled via the built-in or the custom callbacks, by setting a NULL callback. These may be implemented as macros.

                      SSL_ct_is_enabled() and SSL_CTX_ct_is_enabled() return 1 if CT processing is enabled via either SSL_enable_ct() or a non-null custom callback, and 0 otherwise.

                      "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#notes","title":"NOTES","text":"

                      When SCT processing is enabled, OCSP stapling will be enabled. This is because one possible source of SCTs is the OCSP response from a server.

                      The time returned by SSL_SESSION_get_time() will be used to evaluate whether any presented SCTs have timestamps that are in the future (and therefore invalid).

                      "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#restrictions","title":"RESTRICTIONS","text":"

                      Certificate Transparency validation cannot be enabled and so a callback cannot be set if a custom client extension handler has been registered to handle SCT extensions (TLSEXT_TYPE_signed_certificate_timestamp).

                      "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#return-values","title":"RETURN VALUES","text":"

                      SSL_enable_ct(), SSL_CTX_enable_ct(), SSL_CTX_set_ct_validation_callback() and SSL_set_ct_validation_callback() return 1 if the callback is successfully set. They return 0 if an error occurs, e.g. a custom client extension handler has been setup to handle SCTs.

                      SSL_disable_ct() and SSL_CTX_disable_ct() do not return a result.

                      SSL_CTX_ct_is_enabled() and SSL_ct_is_enabled() return a 1 if a non-null CT validation callback is set, or 0 if no callback (or equivalently a NULL callback) is set.

                      "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#see-also","title":"SEE ALSO","text":"

                      ssl(7), , SSL_session_reused(3), SSL_set_verify(3), SSL_CTX_set_verify(3), SSL_SESSION_get_time(3)"},{"location":"man3/SSL_CTX_set_ct_validation_callback/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_ctlog_list_file/","title":"SSL_CTX_set_ctlog_list_file","text":""},{"location":"man3/SSL_CTX_set_ctlog_list_file/#name","title":"NAME","text":"

                      SSL_CTX_set_default_ctlog_list_file, SSL_CTX_set_ctlog_list_file - load a Certificate Transparency log list from a file

                      "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx);\nint SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path);\n
                      "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_default_ctlog_list_file() loads a list of Certificate Transparency (CT) logs from the default file location, \"ct_log_list.cnf\", found in the directory where OpenSSL is installed.

                      SSL_CTX_set_ctlog_list_file() loads a list of CT logs from a specific path. See CTLOG_STORE_new(3) for the file format.

                      "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#notes","title":"NOTES","text":"

                      These functions will not clear the existing CT log list - it will be appended to. To replace the existing list, use SSL_CTX_set0_ctlog_store(3) first.

                      If an error occurs whilst parsing a particular log entry in the file, that log entry will be skipped.

                      "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_default_ctlog_list_file() and SSL_CTX_set_ctlog_list_file() return 1 if the log list is successfully loaded, and 0 if an error occurs. In the case of an error, the log list may have been partially loaded.

                      "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_ct_validation_callback(3), CTLOG_STORE_new(3)

                      "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/","title":"SSL_CTX_set_default_passwd_cb","text":""},{"location":"man3/SSL_CTX_set_default_passwd_cb/#name","title":"NAME","text":"

                      SSL_CTX_set_default_passwd_cb, SSL_CTX_set_default_passwd_cb_userdata, SSL_CTX_get_default_passwd_cb, SSL_CTX_get_default_passwd_cb_userdata, SSL_set_default_passwd_cb, SSL_set_default_passwd_cb_userdata, SSL_get_default_passwd_cb, SSL_get_default_passwd_cb_userdata - set or get passwd callback for encrypted PEM file handling

                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);\nvoid SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);\npem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx);\nvoid *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx);\n\nvoid SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb);\nvoid SSL_set_default_passwd_cb_userdata(SSL *s, void *u);\npem_password_cb *SSL_get_default_passwd_cb(SSL *s);\nvoid *SSL_get_default_passwd_cb_userdata(SSL *s);\n
                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_default_passwd_cb() sets the default password callback called when loading/storing a PEM certificate with encryption.

                      SSL_CTX_set_default_passwd_cb_userdata() sets a pointer to userdata, u, which will be provided to the password callback on invocation.

                      SSL_CTX_get_default_passwd_cb() returns a function pointer to the password callback currently set in ctx. If no callback was explicitly set, the NULL pointer is returned.

                      SSL_CTX_get_default_passwd_cb_userdata() returns a pointer to the userdata currently set in ctx. If no userdata was explicitly set, the NULL pointer is returned.

                      SSL_set_default_passwd_cb(), SSL_set_default_passwd_cb_userdata(), SSL_get_default_passwd_cb() and SSL_get_default_passwd_cb_userdata() perform the same function as their SSL_CTX counterparts, but using an SSL object.

                      The password callback, which must be provided by the application, hands back the password to be used during decryption. On invocation a pointer to userdata is provided. The function must store the password into the provided buffer buf which is of size size. The actual length of the password must be returned to the calling function. rwflag indicates whether the callback is used for reading/decryption (rwflag=0) or writing/encryption (rwflag=1). For more details, see pem_password_cb(3).

                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#notes","title":"NOTES","text":"

                      When loading or storing private keys, a password might be supplied to protect the private key. The way this password can be supplied may depend on the application. If only one private key is handled, it can be practical to have the callback handle the password dialog interactively. If several keys have to be handled, it can be practical to ask for the password once, then keep it in memory and use it several times. In the last case, the password could be stored into the userdata storage and the callback only returns the password already stored.

                      When asking for the password interactively, the callback can use rwflag to check, whether an item shall be encrypted (rwflag=1). In this case the password dialog may ask for the same password twice for comparison in order to catch typos, that would make decryption impossible.

                      Other items in PEM formatting (certificates) can also be encrypted, it is however not usual, as certificate information is considered public.

                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#return-values","title":"RETURN VALUES","text":"

                      These functions do not provide diagnostic information.

                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#examples","title":"EXAMPLES","text":"

                      The following example returns the password provided as userdata to the calling function. The password is considered to be a '\\0' terminated string. If the password does not fit into the buffer, the password is truncated.

                      int my_cb(char *buf, int size, int rwflag, void *u)\n{\n    strncpy(buf, (char *)u, size);\n    buf[size - 1] = '\\0';\n    return strlen(buf);\n}\n
                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_use_certificate(3)

                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#history","title":"HISTORY","text":"

                      SSL_CTX_get_default_passwd_cb(), SSL_CTX_get_default_passwd_cb_userdata(), SSL_set_default_passwd_cb() and SSL_set_default_passwd_cb_userdata() were added in OpenSSL 1.1.0.

                      "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_generate_session_id/","title":"SSL_CTX_set_generate_session_id","text":""},{"location":"man3/SSL_CTX_set_generate_session_id/#name","title":"NAME","text":"

                      SSL_CTX_set_generate_session_id, SSL_set_generate_session_id, SSL_has_matching_session_id, GEN_SESSION_CB - manipulate generation of SSL session IDs (server only)

                      "},{"location":"man3/SSL_CTX_set_generate_session_id/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\ntypedef int (*GEN_SESSION_CB)(SSL *ssl, unsigned char *id,\n                              unsigned int *id_len);\n\nint SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb);\nint SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB, cb);\nint SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,\n                                unsigned int id_len);\n
                      "},{"location":"man3/SSL_CTX_set_generate_session_id/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_generate_session_id() sets the callback function for generating new session ids for SSL/TLS sessions for ctx to be cb.

                      SSL_set_generate_session_id() sets the callback function for generating new session ids for SSL/TLS sessions for ssl to be cb.

                      SSL_has_matching_session_id() checks, whether a session with id id (of length id_len) is already contained in the internal session cache of the parent context of ssl.

                      "},{"location":"man3/SSL_CTX_set_generate_session_id/#notes","title":"NOTES","text":"

                      When a new session is established between client and server, the server generates a session id. The session id is an arbitrary sequence of bytes. The length of the session id is between 1 and 32 bytes. The session id is not security critical but must be unique for the server. Additionally, the session id is transmitted in the clear when reusing the session so it must not contain sensitive information.

                      Without a callback being set, an OpenSSL server will generate a unique session id from pseudo random numbers of the maximum possible length. Using the callback function, the session id can be changed to contain additional information like e.g. a host id in order to improve load balancing or external caching techniques.

                      The callback function receives a pointer to the memory location to put id into and a pointer to the maximum allowed length id_len. The buffer at location id is only guaranteed to have the size id_len. The callback is only allowed to generate a shorter id and reduce id_len; the callback must never increase id_len or write to the location id exceeding the given limit.

                      The location id is filled with 0x00 before the callback is called, so the callback may only fill part of the possible length and leave id_len untouched while maintaining reproducibility.

                      Since the sessions must be distinguished, session ids must be unique. Without the callback a random number is used, so that the probability of generating the same session id is extremely small (2^256 for SSLv3/TLSv1). In order to assure the uniqueness of the generated session id, the callback must call SSL_has_matching_session_id() and generate another id if a conflict occurs. If an id conflict is not resolved, the handshake will fail. If the application codes e.g. a unique host id, a unique process number, and a unique sequence number into the session id, uniqueness could easily be achieved without randomness added (it should however be taken care that no confidential information is leaked this way). If the application can not guarantee uniqueness, it is recommended to use the maximum id_len and fill in the bytes not used to code special information with random data to avoid collisions.

                      SSL_has_matching_session_id() will only query the internal session cache, not the external one. Since the session id is generated before the handshake is completed, it is not immediately added to the cache. If another thread is using the same internal session cache, a race condition can occur in that another thread generates the same session id. Collisions can also occur when using an external session cache, since the external cache is not tested with SSL_has_matching_session_id() and the same race condition applies.

                      The callback must return 0 if it cannot generate a session id for whatever reason and return 1 on success.

                      "},{"location":"man3/SSL_CTX_set_generate_session_id/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_generate_session_id() and SSL_set_generate_session_id() return 1 on success and 0 for failure.

                      SSL_has_matching_session_id() returns 1 if another session with the same id is already in the cache, or 0 otherwise.

                      "},{"location":"man3/SSL_CTX_set_generate_session_id/#examples","title":"EXAMPLES","text":"

                      The callback function listed will generate a session id with the server id given, and will fill the rest with pseudo random bytes:

                      const char session_id_prefix = \"www-18\";\n\n#define MAX_SESSION_ID_ATTEMPTS 10\nstatic int generate_session_id(SSL *ssl, unsigned char *id,\n                               unsigned int *id_len)\n{\n    unsigned int count = 0;\n\n    do {\n        RAND_pseudo_bytes(id, *id_len);\n        /*\n         * Prefix the session_id with the required prefix. NB: If our\n         * prefix is too long, clip it - but there will be worse effects\n         * anyway, e.g. the server could only possibly create 1 session\n         * ID (i.e. the prefix!) so all future session negotiations will\n         * fail due to conflicts.\n         */\n        memcpy(id, session_id_prefix, strlen(session_id_prefix) < *id_len ?\n                                      strlen(session_id_prefix) : *id_len);\n    } while (SSL_has_matching_session_id(ssl, id, *id_len)\n              && ++count < MAX_SESSION_ID_ATTEMPTS);\n    if (count >= MAX_SESSION_ID_ATTEMPTS)\n        return 0;\n    return 1;\n}\n
                      "},{"location":"man3/SSL_CTX_set_generate_session_id/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_get_version(3)

                      "},{"location":"man3/SSL_CTX_set_generate_session_id/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_info_callback/","title":"SSL_CTX_set_info_callback","text":""},{"location":"man3/SSL_CTX_set_info_callback/#name","title":"NAME","text":"

                      SSL_CTX_set_info_callback, SSL_CTX_get_info_callback, SSL_set_info_callback, SSL_get_info_callback - handle information callback for SSL connections

                      "},{"location":"man3/SSL_CTX_set_info_callback/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_info_callback(SSL_CTX *ctx,\n                               void (*callback) (const SSL *ssl, int type, int val));\n\nvoid (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, int val);\n\nvoid SSL_set_info_callback(SSL *ssl,\n                           void (*callback) (const SSL *ssl, int type, int val));\n\nvoid (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, int val);\n
                      "},{"location":"man3/SSL_CTX_set_info_callback/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_info_callback() sets the callback function, that can be used to obtain state information for SSL objects created from ctx during connection setup and use. The setting for ctx is overridden from the setting for a specific SSL object, if specified. When callback is NULL, no callback function is used.

                      SSL_set_info_callback() sets the callback function, that can be used to obtain state information for ssl during connection setup and use. When callback is NULL, the callback setting currently valid for ctx is used.

                      SSL_CTX_get_info_callback() returns a pointer to the currently set information callback function for ctx.

                      SSL_get_info_callback() returns a pointer to the currently set information callback function for ssl.

                      "},{"location":"man3/SSL_CTX_set_info_callback/#notes","title":"NOTES","text":"

                      When setting up a connection and during use, it is possible to obtain state information from the SSL/TLS engine. When set, an information callback function is called whenever a significant event occurs such as: the state changes, an alert appears, or an error occurs.

                      The callback function is called as callback(SSL *ssl, int where, int ret). The where argument specifies information about where (in which context) the callback function was called. If ret is 0, an error condition occurred. If an alert is handled, SSL_CB_ALERT is set and ret specifies the alert information.

                      where is a bit-mask made up of the following bits:

                      • SSL_CB_LOOP

                        Callback has been called to indicate state change or some other significant state machine event. This may mean that the callback gets invoked more than once per state in some situations.

                      • SSL_CB_EXIT

                        Callback has been called to indicate exit of a handshake function. This will happen after the end of a handshake, but may happen at other times too such as on error or when IO might otherwise block and nonblocking is being used.

                      • SSL_CB_READ

                        Callback has been called during read operation.

                      • SSL_CB_WRITE

                        Callback has been called during write operation.

                      • SSL_CB_ALERT

                        Callback has been called due to an alert being sent or received.

                      • SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ)

                      • SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE)
                      • SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP)
                      • SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT)
                      • SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP)
                      • SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT)
                      • SSL_CB_HANDSHAKE_START

                        Callback has been called because a new handshake is started. It also occurs when resuming a handshake following a pause to handle early data.

                      • SSL_CB_HANDSHAKE_DONE

                        Callback has been called because a handshake is finished. It also occurs if the handshake is paused to allow the exchange of early data.

                      The current state information can be obtained using the SSL_state_string(3) family of functions.

                      The ret information can be evaluated using the SSL_alert_type_string(3) family of functions.

                      "},{"location":"man3/SSL_CTX_set_info_callback/#return-values","title":"RETURN VALUES","text":"

                      SSL_set_info_callback() does not provide diagnostic information.

                      SSL_get_info_callback() returns the current setting.

                      "},{"location":"man3/SSL_CTX_set_info_callback/#examples","title":"EXAMPLES","text":"

                      The following example callback function prints state strings, information about alerts being handled and error messages to the bio_err BIO.

                      void apps_ssl_info_callback(const SSL *s, int where, int ret)\n{\n    const char *str;\n    int w = where & ~SSL_ST_MASK;\n\n    if (w & SSL_ST_CONNECT)\n        str = \"SSL_connect\";\n    else if (w & SSL_ST_ACCEPT)\n        str = \"SSL_accept\";\n    else\n        str = \"undefined\";\n\n    if (where & SSL_CB_LOOP) {\n        BIO_printf(bio_err, \"%s:%s\\n\", str, SSL_state_string_long(s));\n    } else if (where & SSL_CB_ALERT) {\n        str = (where & SSL_CB_READ) ? \"read\" : \"write\";\n        BIO_printf(bio_err, \"SSL3 alert %s:%s:%s\\n\", str,\n                   SSL_alert_type_string_long(ret),\n                   SSL_alert_desc_string_long(ret));\n    } else if (where & SSL_CB_EXIT) {\n        if (ret == 0) {\n            BIO_printf(bio_err, \"%s:failed in %s\\n\",\n                       str, SSL_state_string_long(s));\n        } else if (ret < 0) {\n            BIO_printf(bio_err, \"%s:error in %s\\n\",\n                       str, SSL_state_string_long(s));\n        }\n    }\n}\n
                      "},{"location":"man3/SSL_CTX_set_info_callback/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_state_string(3), SSL_alert_type_string(3)

                      "},{"location":"man3/SSL_CTX_set_info_callback/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_keylog_callback/","title":"SSL_CTX_set_keylog_callback","text":""},{"location":"man3/SSL_CTX_set_keylog_callback/#name","title":"NAME","text":"

                      SSL_CTX_set_keylog_callback, SSL_CTX_get_keylog_callback, SSL_CTX_keylog_cb_func - logging TLS key material

                      "},{"location":"man3/SSL_CTX_set_keylog_callback/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\ntypedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line);\n\nvoid SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb);\nSSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx);\n
                      "},{"location":"man3/SSL_CTX_set_keylog_callback/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_keylog_callback() sets the TLS key logging callback. This callback is called whenever TLS key material is generated or received, in order to allow applications to store this keying material for debugging purposes.

                      SSL_CTX_get_keylog_callback() retrieves the previously set TLS key logging callback. If no callback has been set, this will return NULL. When there is no key logging callback, or if SSL_CTX_set_keylog_callback is called with NULL as the value of cb, no logging of key material will be done.

                      The key logging callback is called with two items: the ssl object associated with the connection, and line, a string containing the key material in the format used by NSS for its SSLKEYLOGFILE debugging output. To recreate that file, the key logging callback should log line, followed by a newline. line will always be a NUL-terminated string.

                      "},{"location":"man3/SSL_CTX_set_keylog_callback/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_get_keylog_callback() returns a pointer to SSL_CTX_keylog_cb_func or NULL if the callback is not set.

                      "},{"location":"man3/SSL_CTX_set_keylog_callback/#see-also","title":"SEE ALSO","text":"

                      ssl(7)

                      "},{"location":"man3/SSL_CTX_set_keylog_callback/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_max_cert_list/","title":"SSL_CTX_set_max_cert_list","text":""},{"location":"man3/SSL_CTX_set_max_cert_list/#name","title":"NAME","text":"

                      SSL_CTX_set_max_cert_list, SSL_CTX_get_max_cert_list, SSL_set_max_cert_list, SSL_get_max_cert_list - manipulate allowed size for the peer's certificate chain

                      "},{"location":"man3/SSL_CTX_set_max_cert_list/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nlong SSL_CTX_set_max_cert_list(SSL_CTX *ctx, long size);\nlong SSL_CTX_get_max_cert_list(SSL_CTX *ctx);\n\nlong SSL_set_max_cert_list(SSL *ssl, long size);\nlong SSL_get_max_cert_list(SSL *ctx);\n
                      "},{"location":"man3/SSL_CTX_set_max_cert_list/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_max_cert_list() sets the maximum size allowed for the peer's certificate chain for all SSL objects created from ctx to be <size> bytes. The SSL objects inherit the setting valid for ctx at the time SSL_new(3) is being called.

                      SSL_CTX_get_max_cert_list() returns the currently set maximum size for ctx.

                      SSL_set_max_cert_list() sets the maximum size allowed for the peer's certificate chain for ssl to be <size> bytes. This setting stays valid until a new value is set.

                      SSL_get_max_cert_list() returns the currently set maximum size for ssl.

                      "},{"location":"man3/SSL_CTX_set_max_cert_list/#notes","title":"NOTES","text":"

                      During the handshake process, the peer may send a certificate chain. The TLS/SSL standard does not give any maximum size of the certificate chain. The OpenSSL library handles incoming data by a dynamically allocated buffer. In order to prevent this buffer from growing without bounds due to data received from a faulty or malicious peer, a maximum size for the certificate chain is set.

                      The default value for the maximum certificate chain size is 100kB (30kB on the 16-bit DOS platform). This should be sufficient for usual certificate chains (OpenSSL's default maximum chain length is 10, see SSL_CTX_set_verify(3), and certificates without special extensions have a typical size of 1-2kB).

                      For special applications it can be necessary to extend the maximum certificate chain size allowed to be sent by the peer, see e.g. the work on \"Internet X.509 Public Key Infrastructure Proxy Certificate Profile\" and \"TLS Delegation Protocol\" at http://www.ietf.org/ and http://www.globus.org/ .

                      Under normal conditions it should never be necessary to set a value smaller than the default, as the buffer is handled dynamically and only uses the memory actually required by the data sent by the peer.

                      If the maximum certificate chain size allowed is exceeded, the handshake will fail with a SSL_R_EXCESSIVE_MESSAGE_SIZE error.

                      "},{"location":"man3/SSL_CTX_set_max_cert_list/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_max_cert_list() and SSL_set_max_cert_list() return the previously set value.

                      SSL_CTX_get_max_cert_list() and SSL_get_max_cert_list() return the currently set value.

                      "},{"location":"man3/SSL_CTX_set_max_cert_list/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_new(3), SSL_CTX_set_verify(3)

                      "},{"location":"man3/SSL_CTX_set_max_cert_list/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_min_proto_version/","title":"SSL_CTX_set_min_proto_version","text":""},{"location":"man3/SSL_CTX_set_min_proto_version/#name","title":"NAME","text":"

                      SSL_CTX_set_min_proto_version, SSL_CTX_set_max_proto_version, SSL_CTX_get_min_proto_version, SSL_CTX_get_max_proto_version, SSL_set_min_proto_version, SSL_set_max_proto_version, SSL_get_min_proto_version, SSL_get_max_proto_version - Get and set minimum and maximum supported protocol version

                      "},{"location":"man3/SSL_CTX_set_min_proto_version/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version);\nint SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version);\nint SSL_CTX_get_min_proto_version(SSL_CTX *ctx);\nint SSL_CTX_get_max_proto_version(SSL_CTX *ctx);\n\nint SSL_set_min_proto_version(SSL *ssl, int version);\nint SSL_set_max_proto_version(SSL *ssl, int version);\nint SSL_get_min_proto_version(SSL *ssl);\nint SSL_get_max_proto_version(SSL *ssl);\n
                      "},{"location":"man3/SSL_CTX_set_min_proto_version/#description","title":"DESCRIPTION","text":"

                      The functions get or set the minimum and maximum supported protocol versions for the ctx or ssl. This works in combination with the options set via SSL_CTX_set_options(3) that also make it possible to disable specific protocol versions. Use these functions instead of disabling specific protocol versions.

                      Setting the minimum or maximum version to 0, will enable protocol versions down to the lowest version, or up to the highest version supported by the library, respectively.

                      Getters return 0 in case ctx or ssl have been configured to automatically use the lowest or highest version supported by the library.

                      Currently supported versions are SSL3_VERSION, TLS1_VERSION, TLS1_1_VERSION, TLS1_2_VERSION, TLS1_3_VERSION for TLS and DTLS1_VERSION, DTLS1_2_VERSION for DTLS.

                      "},{"location":"man3/SSL_CTX_set_min_proto_version/#return-values","title":"RETURN VALUES","text":"

                      These setter functions return 1 on success and 0 on failure. The getter functions return the configured version or 0 for auto-configuration of lowest or highest protocol, respectively.

                      "},{"location":"man3/SSL_CTX_set_min_proto_version/#notes","title":"NOTES","text":"

                      All these functions are implemented using macros.

                      "},{"location":"man3/SSL_CTX_set_min_proto_version/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_CTX_set_options(3), SSL_CONF_cmd(3)

                      "},{"location":"man3/SSL_CTX_set_min_proto_version/#history","title":"HISTORY","text":"

                      The setter functions were added in OpenSSL 1.1.0. The getter functions were added in OpenSSL 1.1.1.

                      "},{"location":"man3/SSL_CTX_set_min_proto_version/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_mode/","title":"SSL_CTX_set_mode","text":""},{"location":"man3/SSL_CTX_set_mode/#name","title":"NAME","text":"

                      SSL_CTX_set_mode, SSL_CTX_clear_mode, SSL_set_mode, SSL_clear_mode, SSL_CTX_get_mode, SSL_get_mode - manipulate SSL engine mode

                      "},{"location":"man3/SSL_CTX_set_mode/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nlong SSL_CTX_set_mode(SSL_CTX *ctx, long mode);\nlong SSL_CTX_clear_mode(SSL_CTX *ctx, long mode);\nlong SSL_set_mode(SSL *ssl, long mode);\nlong SSL_clear_mode(SSL *ssl, long mode);\n\nlong SSL_CTX_get_mode(SSL_CTX *ctx);\nlong SSL_get_mode(SSL *ssl);\n
                      "},{"location":"man3/SSL_CTX_set_mode/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_mode() adds the mode set via bit-mask in mode to ctx. Options already set before are not cleared. SSL_CTX_clear_mode() removes the mode set via bit-mask in mode from ctx.

                      SSL_set_mode() adds the mode set via bit-mask in mode to ssl. Options already set before are not cleared. SSL_clear_mode() removes the mode set via bit-mask in mode from ssl.

                      SSL_CTX_get_mode() returns the mode set for ctx.

                      SSL_get_mode() returns the mode set for ssl.

                      "},{"location":"man3/SSL_CTX_set_mode/#notes","title":"NOTES","text":"

                      The following mode changes are available:

                      • SSL_MODE_ENABLE_PARTIAL_WRITE

                        Allow SSL_write_ex(..., n, &r) to return with 0 < r < n (i.e. report success when just a single record has been written). This works in a similar way for SSL_write(). When not set (the default), SSL_write_ex() or SSL_write() will only report success once the complete chunk was written. Once SSL_write_ex() or SSL_write() returns successful, r bytes have been written and the next call to SSL_write_ex() or SSL_write() must only send the n-r bytes left, imitating the behaviour of write().

                      • SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER

                        Make it possible to retry SSL_write_ex() or SSL_write() with changed buffer location (the buffer contents must stay the same). This is not the default to avoid the misconception that nonblocking SSL_write() behaves like nonblocking write().

                      • SSL_MODE_AUTO_RETRY

                        During normal operations, non-application data records might need to be sent or received that the application is not aware of. If a non-application data record was processed, SSL_read_ex(3) and SSL_read(3) can return with a failure and indicate the need to retry with SSL_ERROR_WANT_READ. If such a non-application data record was processed, the flag SSL_MODE_AUTO_RETRY causes it to try to process the next record instead of returning.

                        In a nonblocking environment applications must be prepared to handle incomplete read/write operations. Setting SSL_MODE_AUTO_RETRY for a nonblocking BIO will process non-application data records until either no more data is available or an application data record has been processed.

                        In a blocking environment, applications are not always prepared to deal with the functions returning intermediate reports such as retry requests, and setting the SSL_MODE_AUTO_RETRY flag will cause the functions to only return after successfully processing an application data record or a failure.

                        Turning off SSL_MODE_AUTO_RETRY can be useful with blocking BIOs in case they are used in combination with something like select() or poll(). Otherwise the call to SSL_read() or SSL_read_ex() might hang when a non-application record was sent and no application data was sent.

                      • SSL_MODE_RELEASE_BUFFERS

                        When we no longer need a read buffer or a write buffer for a given SSL, then release the memory we were using to hold it. Using this flag can save around 34k per idle SSL connection. This flag has no effect on SSL v2 connections, or on DTLS connections.

                      • SSL_MODE_SEND_FALLBACK_SCSV

                        Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications that reconnect with a downgraded protocol version; see draft-ietf-tls-downgrade-scsv-00 for details.

                        DO NOT ENABLE THIS if your application attempts a normal handshake. Only use this in explicit fallback retries, following the guidance in draft-ietf-tls-downgrade-scsv-00.

                      • SSL_MODE_ASYNC

                        Enable asynchronous processing. TLS I/O operations may indicate a retry with SSL_ERROR_WANT_ASYNC with this mode set if an asynchronous capable engine is used to perform cryptographic operations. See SSL_get_error(3).

                      • SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG

                        Older versions of OpenSSL had a bug in the computation of the label length used for computing the endpoint-pair shared secret. The bug was that the terminating zero was included in the length of the label. Setting this option enables this behaviour to allow interoperability with such broken implementations. Please note that setting this option breaks interoperability with correct implementations. This option only applies to DTLS over SCTP.

                      All modes are off by default except for SSL_MODE_AUTO_RETRY which is on by default since 1.1.1.

                      "},{"location":"man3/SSL_CTX_set_mode/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_mode() and SSL_set_mode() return the new mode bit-mask after adding mode.

                      SSL_CTX_get_mode() and SSL_get_mode() return the current bit-mask.

                      "},{"location":"man3/SSL_CTX_set_mode/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) or SSL_write(3), SSL_get_error(3)

                      "},{"location":"man3/SSL_CTX_set_mode/#history","title":"HISTORY","text":"

                      SSL_MODE_ASYNC was added in OpenSSL 1.1.0.

                      "},{"location":"man3/SSL_CTX_set_mode/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_msg_callback/","title":"SSL_CTX_set_msg_callback","text":""},{"location":"man3/SSL_CTX_set_msg_callback/#name","title":"NAME","text":"

                      SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg, SSL_set_msg_callback, SSL_set_msg_callback_arg - install callback for observing protocol messages

                      "},{"location":"man3/SSL_CTX_set_msg_callback/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_msg_callback(SSL_CTX *ctx,\n                              void (*cb)(int write_p, int version,\n                                         int content_type, const void *buf,\n                                         size_t len, SSL *ssl, void *arg));\nvoid SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);\n\nvoid SSL_set_msg_callback(SSL *ssl,\n                          void (*cb)(int write_p, int version,\n                                     int content_type, const void *buf,\n                                     size_t len, SSL *ssl, void *arg));\nvoid SSL_set_msg_callback_arg(SSL *ssl, void *arg);\n
                      "},{"location":"man3/SSL_CTX_set_msg_callback/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_msg_callback() or SSL_set_msg_callback() can be used to define a message callback function cb for observing all SSL/TLS protocol messages (such as handshake messages) that are received or sent, as well as other events that occur during processing. SSL_CTX_set_msg_callback_arg() and SSL_set_msg_callback_arg() can be used to set argument arg to the callback function, which is available for arbitrary application use.

                      SSL_CTX_set_msg_callback() and SSL_CTX_set_msg_callback_arg() specify default settings that will be copied to new SSL objects by SSL_new(3). SSL_set_msg_callback() and SSL_set_msg_callback_arg() modify the actual settings of an SSL object. Using a NULL pointer for cb disables the message callback.

                      When cb is called by the SSL/TLS library the function arguments have the following meaning:

                      • write_p

                        This flag is 0 when a protocol message has been received and 1 when a protocol message has been sent.

                      • version

                        The protocol version according to which the protocol message is interpreted by the library such as TLS1_3_VERSION, TLS1_2_VERSION etc. This is set to 0 for the SSL3_RT_HEADER pseudo content type (see NOTES below).

                      • content_type

                        This is one of the content type values defined in the protocol specification (SSL3_RT_CHANGE_CIPHER_SPEC, SSL3_RT_ALERT, SSL3_RT_HANDSHAKE; but never SSL3_RT_APPLICATION_DATA because the callback will only be called for protocol messages). Alternatively it may be a \"pseudo\" content type. These pseudo content types are used to signal some other event in the processing of data (see NOTES below).

                      • buf, len

                        buf points to a buffer containing the protocol message or other data (in the case of pseudo content types), which consists of len bytes. The buffer is no longer valid after the callback function has returned.

                      • ssl

                        The SSL object that received or sent the message.

                      • arg

                        The user-defined argument optionally defined by SSL_CTX_set_msg_callback_arg() or SSL_set_msg_callback_arg().

                      "},{"location":"man3/SSL_CTX_set_msg_callback/#notes","title":"NOTES","text":"

                      Protocol messages are passed to the callback function after decryption and fragment collection where applicable. (Thus record boundaries are not visible.)

                      If processing a received protocol message results in an error, the callback function may not be called. For example, the callback function will never see messages that are considered too large to be processed.

                      Due to automatic protocol version negotiation, version is not necessarily the protocol version used by the sender of the message: If a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, version will be SSL3_VERSION.

                      Pseudo content type values may be sent at various points during the processing of data. The following pseudo content types are currently defined:

                      • SSL3_RT_HEADER

                        Used when a record is sent or received. The buf contains the record header bytes only.

                      • SSL3_RT_INNER_CONTENT_TYPE

                        Used when an encrypted TLSv1.3 record is sent or received. In encrypted TLSv1.3 records the content type in the record header is always SSL3_RT_APPLICATION_DATA. The real content type for the record is contained in an \"inner\" content type. buf contains the encoded \"inner\" content type byte.

                      "},{"location":"man3/SSL_CTX_set_msg_callback/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_msg_callback(), SSL_CTX_set_msg_callback_arg(), SSL_set_msg_callback() and SSL_set_msg_callback_arg() do not return values.

                      "},{"location":"man3/SSL_CTX_set_msg_callback/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_new(3)

                      "},{"location":"man3/SSL_CTX_set_msg_callback/#history","title":"HISTORY","text":"

                      The pseudo content type SSL3_RT_INNER_CONTENT_TYPE was added in OpenSSL 1.1.1.

                      "},{"location":"man3/SSL_CTX_set_msg_callback/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_num_tickets/","title":"SSL_CTX_set_num_tickets","text":""},{"location":"man3/SSL_CTX_set_num_tickets/#name","title":"NAME","text":"

                      SSL_set_num_tickets, SSL_get_num_tickets, SSL_CTX_set_num_tickets, SSL_CTX_get_num_tickets, SSL_new_session_ticket - control the number of TLSv1.3 session tickets that are issued

                      "},{"location":"man3/SSL_CTX_set_num_tickets/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nint SSL_set_num_tickets(SSL *s, size_t num_tickets);\nsize_t SSL_get_num_tickets(const SSL *s);\nint SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);\nsize_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);\nint SSL_new_session_ticket(SSL *s);\n
                      "},{"location":"man3/SSL_CTX_set_num_tickets/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_num_tickets() and SSL_set_num_tickets() can be called for a server application and set the number of TLSv1.3 session tickets that will be sent to the client after a full handshake. Set the desired value (which could be 0) in the num_tickets argument. Typically these functions should be called before the start of the handshake.

                      The default number of tickets is 2. Following a resumption the number of tickets issued will never be more than 1 regardless of the value set via SSL_set_num_tickets() or SSL_CTX_set_num_tickets(). If num_tickets is set to 0 then no tickets will be issued for either a normal connection or a resumption.

                      Tickets are also issued on receipt of a post-handshake certificate from the client following a request by the server using SSL_verify_client_post_handshake(3). These new tickets will be associated with the updated client identity (i.e. including their certificate and verification status). The number of tickets issued will normally be the same as was used for the initial handshake. If the initial handshake was a full handshake then SSL_set_num_tickets() can be called again prior to calling SSL_verify_client_post_handshake() to update the number of tickets that will be sent.

                      To issue tickets after other events (such as application-layer changes), SSL_new_session_ticket() is used by a server application to request that a new ticket be sent when it is safe to do so. New tickets are only allowed to be sent in this manner after the initial handshake has completed, and only for TLS 1.3 connections. By default, the ticket generation and transmission are delayed until the server is starting a new write operation, so that it is bundled with other application data being written and properly aligned to a record boundary. If the connection was at a record boundary when SSL_new_session_ticket() was called, the ticket can be sent immediately (without waiting for the next application write) by calling SSL_do_handshake(). SSL_new_session_ticket() can be called more than once to request additional tickets be sent; all such requests are queued and written together when it is safe to do so and triggered by SSL_write() or SSL_do_handshake(). Note that a successful return from SSL_new_session_ticket() indicates only that the request to send a ticket was processed, not that the ticket itself was sent. To be notified when the ticket itself is sent, a new-session callback can be registered with SSL_CTX_sess_set_new_cb(3) that will be invoked as the ticket or tickets are generated.

                      SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets set by a previous call to SSL_CTX_set_num_tickets() or SSL_set_num_tickets(), or 2 if no such call has been made.

                      "},{"location":"man3/SSL_CTX_set_num_tickets/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_num_tickets(), SSL_set_num_tickets(), and SSL_new_session_ticket() return 1 on success or 0 on failure.

                      SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets that have been previously set.

                      "},{"location":"man3/SSL_CTX_set_num_tickets/#see-also","title":"SEE ALSO","text":"

                      ssl(7)

                      "},{"location":"man3/SSL_CTX_set_num_tickets/#history","title":"HISTORY","text":"

                      SSL_new_session_ticket() was added in OpenSSL 3.0.0. SSL_set_num_tickets(), SSL_get_num_tickets(), SSL_CTX_set_num_tickets(), and SSL_CTX_get_num_tickets() were added in OpenSSL 1.1.1.

                      "},{"location":"man3/SSL_CTX_set_num_tickets/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_options/","title":"SSL_CTX_set_options","text":""},{"location":"man3/SSL_CTX_set_options/#name","title":"NAME","text":"

                      SSL_CTX_set_options, SSL_set_options, SSL_CTX_clear_options, SSL_clear_options, SSL_CTX_get_options, SSL_get_options, SSL_get_secure_renegotiation_support - manipulate SSL options

                      "},{"location":"man3/SSL_CTX_set_options/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\nuint64_t SSL_CTX_set_options(SSL_CTX *ctx, uint64_t options);\nuint64_t SSL_set_options(SSL *ssl, uint64_t options);\n\nuint64_t SSL_CTX_clear_options(SSL_CTX *ctx, uint64_t options);\nuint64_t SSL_clear_options(SSL *ssl, uint64_t options);\n\nuint64_t SSL_CTX_get_options(const SSL_CTX *ctx);\nuint64_t SSL_get_options(const SSL *ssl);\n\nlong SSL_get_secure_renegotiation_support(SSL *ssl);\n
                      "},{"location":"man3/SSL_CTX_set_options/#description","title":"DESCRIPTION","text":"

                      SSL_CTX_set_options() adds the options set via bit-mask in options to ctx. Options already set before are not cleared!

                      SSL_set_options() adds the options set via bit-mask in options to ssl. Options already set before are not cleared!

                      SSL_CTX_clear_options() clears the options set via bit-mask in options to ctx.

                      SSL_clear_options() clears the options set via bit-mask in options to ssl.

                      SSL_CTX_get_options() returns the options set for ctx.

                      SSL_get_options() returns the options set for ssl.

                      SSL_get_secure_renegotiation_support() indicates whether the peer supports secure renegotiation. Note, this is implemented via a macro.

                      "},{"location":"man3/SSL_CTX_set_options/#notes","title":"NOTES","text":"

                      The behaviour of the SSL library can be changed by setting several options. The options are coded as bit-masks and can be combined by a bitwise or operation (|).

                      SSL_CTX_set_options() and SSL_set_options() affect the (external) protocol behaviour of the SSL library. The (internal) behaviour of the API can be changed by using the similar SSL_CTX_set_mode(3) and SSL_set_mode() functions.

                      During a handshake, the option settings of the SSL object are used. When a new SSL object is created from a context using SSL_new(), the current option setting is copied. Changes to ctx do not affect already created SSL objects. SSL_clear() does not affect the settings.

                      The following bug workaround options are available:

                      • SSL_OP_CRYPTOPRO_TLSEXT_BUG

                        Add server-hello extension from the early version of cryptopro draft when GOST ciphersuite is negotiated. Required for interoperability with CryptoPro CSP 3.x.

                      • SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS

                        Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol vulnerability affecting CBC ciphers, which cannot be handled by some broken SSL implementations. This option has no effect for connections using other ciphers.

                      • SSL_OP_SAFARI_ECDHE_ECDSA_BUG

                        Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on OS X. OS X 10.8..10.8.3 has broken support for ECDHE-ECDSA ciphers.

                      • SSL_OP_TLSEXT_PADDING

                        Adds a padding extension to ensure the ClientHello size is never between 256 and 511 bytes in length. This is needed as a workaround for some implementations.

                      • SSL_OP_ALL

                        All of the above bug workarounds.

                      It is usually safe to use SSL_OP_ALL to enable the bug workaround options if compatibility with somewhat broken implementations is desired.

                      The following modifying options are available:

                      • SSL_OP_ALLOW_CLIENT_RENEGOTIATION

                        Client-initiated renegotiation is disabled by default. Use this option to enable it.

                      • SSL_OP_ALLOW_NO_DHE_KEX

                        In TLSv1.3 allow a non-(ec)dhe based key exchange mode on resumption. This means that there will be no forward secrecy for the resumed session.

                      • SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION

                        Allow legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See the SECURE RENEGOTIATION section for more details.

                      • SSL_OP_CIPHER_SERVER_PREFERENCE

                        When choosing a cipher, use the server's preferences instead of the client preferences. When not set, the SSL server will always follow the clients preferences. When set, the SSL/TLS server will choose following its own preferences.

                      • SSL_OP_CISCO_ANYCONNECT

                        Use Cisco's version identifier of DTLS_BAD_VER when establishing a DTLSv1 connection. Only available when using the deprecated DTLSv1_client_method() API.

                      • SSL_OP_CLEANSE_PLAINTEXT

                        By default TLS connections keep a copy of received plaintext application data in a static buffer until it is overwritten by the next portion of data. When enabling SSL_OP_CLEANSE_PLAINTEXT deciphered application data is cleansed by calling OPENSSL_cleanse(3) after passing data to the application. Data is also cleansed when releasing the connection (e.g. SSL_free(3)).

                        Since OpenSSL only cleanses internal buffers, the application is still responsible for cleansing all other buffers. Most notably, this applies to buffers passed to functions like SSL_read(3), SSL_peek(3) but also like SSL_write(3).

                      • SSL_OP_COOKIE_EXCHANGE

                        Turn on Cookie Exchange as described in RFC4347 Section 4.2.1. Only affects DTLS connections.

                      • SSL_OP_DISABLE_TLSEXT_CA_NAMES

                        Disable TLS Extension CA Names. You may want to disable it for security reasons or for compatibility with some Windows TLS implementations crashing when this extension is larger than 1024 bytes.

                      • SSL_OP_ENABLE_KTLS

                        Enable the use of kernel TLS. In order to benefit from kernel TLS OpenSSL must have been compiled with support for it, and it must be supported by the negotiated ciphersuites and extensions. The specific ciphersuites and extensions that are supported may vary by platform and kernel version.

                        The kernel TLS data-path implements the record layer, and the encryption algorithm. The kernel will utilize the best hardware available for encryption. Using the kernel data-path should reduce the memory footprint of OpenSSL because no buffering is required. Also, the throughput should improve because data copy is avoided when user data is encrypted into kernel memory instead of the usual encrypt then copy to kernel.

                        Kernel TLS might not support all the features of OpenSSL. For instance, renegotiation, and setting the maximum fragment size is not possible as of Linux 4.20.

                        Note that with kernel TLS enabled some cryptographic operations are performed by the kernel directly and not via any available OpenSSL Providers. This might be undesirable if, for example, the application requires all cryptographic operations to be performed by the FIPS provider.

                      • SSL_OP_ENABLE_MIDDLEBOX_COMPAT

                        If set then dummy Change Cipher Spec (CCS) messages are sent in TLSv1.3. This has the effect of making TLSv1.3 look more like TLSv1.2 so that middleboxes that do not understand TLSv1.3 will not drop the connection. Regardless of whether this option is set or not CCS messages received from the peer will always be ignored in TLSv1.3. This option is set by default. To switch it off use SSL_clear_options(). A future version of OpenSSL may not set this by default.

                      • SSL_OP_IGNORE_UNEXPECTED_EOF

                        Some TLS implementations do not send the mandatory close_notify alert on shutdown. If the application tries to wait for the close_notify alert but the peer closes the connection without sending it, an error is generated. When this option is enabled the peer does not need to send the close_notify alert and a closed connection will be treated as if the close_notify alert was received.

                        You should only enable this option if the protocol running over TLS can detect a truncation attack itself, and that the application is checking for that truncation attack.

                        For more information on shutting down a connection, see SSL_shutdown(3).

                      • SSL_OP_LEGACY_SERVER_CONNECT

                        Allow legacy insecure renegotiation between OpenSSL and unpatched servers only. See the SECURE RENEGOTIATION section for more details.

                      • SSL_OP_NO_ANTI_REPLAY

                        By default, when a server is configured for early data (i.e., max_early_data > 0), OpenSSL will switch on replay protection. See SSL_read_early_data(3) for a description of the replay protection feature. Anti-replay measures are required to comply with the TLSv1.3 specification. Some applications may be able to mitigate the replay risks in other ways and in such cases the built in OpenSSL functionality is not required. Those applications can turn this feature off by setting this option. This is a server-side option only. It is ignored by clients.

                      • SSL_OP_NO_COMPRESSION

                        Do not use compression even if it is supported. This option is set by default. To switch it off use SSL_clear_options().

                      • SSL_OP_NO_ENCRYPT_THEN_MAC

                        Normally clients and servers will transparently attempt to negotiate the RFC7366 Encrypt-then-MAC option on TLS and DTLS connection.

                        If this option is set, Encrypt-then-MAC is disabled. Clients will not propose, and servers will not accept the extension.

                      • SSL_OP_NO_EXTENDED_MASTER_SECRET

                        Normally clients and servers will transparently attempt to negotiate the RFC7627 Extended Master Secret option on TLS and DTLS connection.

                        If this option is set, Extended Master Secret is disabled. Clients will not propose, and servers will not accept the extension.

                      • SSL_OP_NO_QUERY_MTU

                        Do not query the MTU. Only affects DTLS connections.

                      • SSL_OP_NO_RENEGOTIATION

                        Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest messages, and ignore renegotiation requests via ClientHello.

                      • SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION

                        When performing renegotiation as a server, always start a new session (i.e., session resumption requests are only accepted in the initial handshake). This option is not needed for clients.

                      • SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_NO_DTLSv1, SSL_OP_NO_DTLSv1_2

                        These options turn off the SSLv3, TLSv1, TLSv1.1, TLSv1.2 or TLSv1.3 protocol versions with TLS or the DTLSv1, DTLSv1.2 versions with DTLS, respectively. As of OpenSSL 1.1.0, these options are deprecated, use SSL_CTX_set_min_proto_version(3) and SSL_CTX_set_max_proto_version(3) instead.

                      • SSL_OP_NO_TICKET

                        SSL/TLS supports two mechanisms for resuming sessions: session ids and stateless session tickets.

                        When using session ids a copy of the session information is cached on the server and a unique id is sent to the client. When the client wishes to resume it provides the unique id so that the server can retrieve the session information from its cache.

                        When using stateless session tickets the server uses a session ticket encryption key to encrypt the session information. This encrypted data is sent to the client as a \"ticket\". When the client wishes to resume it sends the encrypted data back to the server. The server uses its key to decrypt the data and resume the session. In this way the server can operate statelessly - no session information needs to be cached locally.

                        The TLSv1.3 protocol only supports tickets and does not directly support session ids. However, OpenSSL allows two modes of ticket operation in TLSv1.3: stateful and stateless. Stateless tickets work the same way as in TLSv1.2 and below. Stateful tickets mimic the session id behaviour available in TLSv1.2 and below. The session information is cached on the server and the session id is wrapped up in a ticket and sent back to the client. When the client wishes to resume, it presents a ticket in the same way as for stateless tickets. The server can then extract the session id from the ticket and retrieve the session information from its cache.

                        By default OpenSSL will use stateless tickets. The SSL_OP_NO_TICKET option will cause stateless tickets to not be issued. In TLSv1.2 and below this means no ticket gets sent to the client at all. In TLSv1.3 a stateful ticket will be sent. This is a server-side option only.

                        In TLSv1.3 it is possible to suppress all tickets (stateful and stateless) from being sent by calling SSL_CTX_set_num_tickets(3) or SSL_set_num_tickets(3).

                      • SSL_OP_PRIORITIZE_CHACHA

                        When SSL_OP_CIPHER_SERVER_PREFERENCE is set, temporarily reprioritize ChaCha20-Poly1305 ciphers to the top of the server cipher list if a ChaCha20-Poly1305 cipher is at the top of the client cipher list. This helps those clients (e.g. mobile) use ChaCha20-Poly1305 if that cipher is anywhere in the server cipher list; but still allows other clients to use AES and other ciphers. Requires SSL_OP_CIPHER_SERVER_PREFERENCE.

                      • SSL_OP_TLS_ROLLBACK_BUG

                        Disable version rollback attack detection.

                        During the client key exchange, the client must send the same information about acceptable SSL/TLS protocol levels as during the first hello. Some clients violate this rule by adapting to the server's answer. (Example: the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server only understands up to SSLv3. In this case the client must still use the same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect to the server's answer and violate the version rollback protection.)

                      The following options no longer have any effect but their identifiers are retained for compatibility purposes:

                      • SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
                      • SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
                      • SSL_OP_SSLEAY_080_CLIENT_DH_BUG
                      • SSL_OP_TLS_D5_BUG
                      • SSL_OP_TLS_BLOCK_PADDING_BUG
                      • SSL_OP_MSIE_SSLV2_RSA_PADDING
                      • SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
                      • SSL_OP_MICROSOFT_SESS_ID_BUG
                      • SSL_OP_NETSCAPE_CHALLENGE_BUG
                      • SSL_OP_PKCS1_CHECK_1
                      • SSL_OP_PKCS1_CHECK_2
                      • SSL_OP_SINGLE_DH_USE
                      • SSL_OP_SINGLE_ECDH_USE
                      • SSL_OP_EPHEMERAL_RSA
                      • SSL_OP_NETSCAPE_CA_DN_BUG
                      • SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
                      "},{"location":"man3/SSL_CTX_set_options/#secure-renegotiation","title":"SECURE RENEGOTIATION","text":"

                      OpenSSL always attempts to use secure renegotiation as described in RFC5746. This counters the prefix attack described in CVE-2009-3555 and elsewhere.

                      This attack has far reaching consequences which application writers should be aware of. In the description below an implementation supporting secure renegotiation is referred to as patched. A server not supporting secure renegotiation is referred to as unpatched.

                      The following sections describe the operations permitted by OpenSSL's secure renegotiation implementation.

                      "},{"location":"man3/SSL_CTX_set_options/#patched-client-and-server","title":"Patched client and server","text":"

                      Connections and renegotiation are always permitted by OpenSSL implementations.

                      "},{"location":"man3/SSL_CTX_set_options/#unpatched-client-and-patched-openssl-server","title":"Unpatched client and patched OpenSSL server","text":"

                      The initial connection succeeds but client renegotiation is denied by the server with a no_renegotiation warning alert if TLS v1.0 is used or a fatal handshake_failure alert in SSL v3.0.

                      If the patched OpenSSL server attempts to renegotiate a fatal handshake_failure alert is sent. This is because the server code may be unaware of the unpatched nature of the client.

                      If the option SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is set then renegotiation always succeeds.

                      "},{"location":"man3/SSL_CTX_set_options/#patched-openssl-client-and-unpatched-server","title":"Patched OpenSSL client and unpatched server","text":"

                      If the option SSL_OP_LEGACY_SERVER_CONNECT or SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is set then initial connections and renegotiation between patched OpenSSL clients and unpatched servers succeeds. If neither option is set then initial connections to unpatched servers will fail.

                      Setting the option SSL_OP_LEGACY_SERVER_CONNECT has security implications; clients that are willing to connect to servers that do not implement RFC 5746 secure renegotiation are subject to attacks such as CVE-2009-3555.

                      OpenSSL client applications wishing to ensure they can connect to unpatched servers should always set SSL_OP_LEGACY_SERVER_CONNECT

                      OpenSSL client applications that want to ensure they can not connect to unpatched servers (and thus avoid any security issues) should always clear SSL_OP_LEGACY_SERVER_CONNECT using SSL_CTX_clear_options() or SSL_clear_options().

                      The difference between the SSL_OP_LEGACY_SERVER_CONNECT and SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION options is that SSL_OP_LEGACY_SERVER_CONNECT enables initial connections and secure renegotiation between OpenSSL clients and unpatched servers only, while SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION allows initial connections and renegotiation between OpenSSL and unpatched clients or servers.

                      "},{"location":"man3/SSL_CTX_set_options/#return-values","title":"RETURN VALUES","text":"

                      SSL_CTX_set_options() and SSL_set_options() return the new options bit-mask after adding options.

                      SSL_CTX_clear_options() and SSL_clear_options() return the new options bit-mask after clearing options.

                      SSL_CTX_get_options() and SSL_get_options() return the current bit-mask.

                      SSL_get_secure_renegotiation_support() returns 1 is the peer supports secure renegotiation and 0 if it does not.

                      "},{"location":"man3/SSL_CTX_set_options/#see-also","title":"SEE ALSO","text":"

                      ssl(7), SSL_new(3), SSL_clear(3), SSL_shutdown(3) SSL_CTX_set_tmp_dh_callback(3), SSL_CTX_set_min_proto_version(3), openssl-dhparam(1)

                      "},{"location":"man3/SSL_CTX_set_options/#history","title":"HISTORY","text":"

                      The attempt to always try to use secure renegotiation was added in OpenSSL 0.9.8m.

                      The SSL_OP_PRIORITIZE_CHACHA and SSL_OP_NO_RENEGOTIATION options were added in OpenSSL 1.1.1.

                      The SSL_OP_NO_EXTENDED_MASTER_SECRET and SSL_OP_IGNORE_UNEXPECTED_EOF options were added in OpenSSL 3.0.

                      The SSL_OP_ constants and the corresponding parameter and return values of the affected functions were changed to uint64_t type in OpenSSL 3.0. For that reason it is no longer possible use the SSL_OP_ macro values in preprocessor #if conditions. However it is still possible to test whether these macros are defined or not.

                      "},{"location":"man3/SSL_CTX_set_options/#copyright","title":"COPYRIGHT","text":"

                      Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.

                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                      "},{"location":"man3/SSL_CTX_set_psk_client_callback/","title":"SSL_CTX_set_psk_client_callback","text":""},{"location":"man3/SSL_CTX_set_psk_client_callback/#name","title":"NAME","text":"

                      SSL_psk_client_cb_func, SSL_psk_use_session_cb_func, SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback, SSL_CTX_set_psk_use_session_callback, SSL_set_psk_use_session_callback - set PSK client callback

                      "},{"location":"man3/SSL_CTX_set_psk_client_callback/#synopsis","title":"SYNOPSIS","text":"
                      #include <openssl/ssl.h>\n\ntypedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md,\n                                           const unsigned char **id,\n                                           size_t *idlen,\n                                           SSL_SESSION **sess);\n\n\nvoid SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx,\n                                          SSL_psk_use_session_cb_func cb);\nvoid SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb);\n\n\ntypedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl,\n                                               const char *hint,\n                                               char *identity,\n                                               unsigned int max_identity_len,\n                                               unsigned char *psk,\n                                               unsigned int max_psk_len);\n\nvoid SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb);\nvoid SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb);\n
                      "},{"location":"man3/SSL_CTX_set_psk_client_callback/#description","title":"DESCRIPTION","text":"

                      A client application wishing to use TLSv1.3 PSKs should use either SSL_CTX_set_psk_use_session_callback() or SSL_set_psk_use_session_callback() as appropriate. These functions cannot be used for TLSv1.2 and below PSKs.

                      The callback function is given a pointer to the SSL connection in ssl.

                      The first time the callback is called for a connection the md parameter is NULL. In some circumstances the callback will be called a second time. In that case the server will have specified a ciphersuite to use already and the PSK must be compatible with the digest for that ciphersuite. The digest will be given in md. The PSK returned by the callback is allowed to be different between the first and second time it is called.

                      On successful completion the callback must store a pointer to an identifier for the PSK in *id. The identifier length in bytes should be stored in *idlen. The memory pointed to by *id remains owned by the application and should be freed by it as required at any point after the handshake is complete.

                      Additionally the callback should store a pointer to an SSL_SESSION object in *sess. This is used as the basis for the PSK, and should, at a minimum, have the following fields set:

                      • The master key

                        This can be set via a call to SSL_SESSION_set1_master_key(3).

                      • A ciphersuite

                        Only the handshake digest associated with the ciphersuite is relevant for the PSK (the server may go on to negotiate any ciphersuite which is compatible with the digest). The application can use any TLSv1.3 ciphersuite. If md is not NULL the handshake digest for the ciphersuite should be the same. The ciphersuite can be set via a call to . The handshake digest of an SSL_CIPHER object can be checked using .

                      • The protocol version

                        This can be set via a call to SSL_SESSION_set_protocol_version(3) and should be TLS1_3_VERSION.

                      • Additionally the maximum early data value should be set via a call to SSL_SESSION_set_max_early_data(3) if the PSK will be used for sending early data.

                        Alternatively an SSL_SESSION created from a previous non-PSK handshake may also be used as the basis for a PSK.

                        Ownership of the SSL_SESSION object is passed to the OpenSSL library and so it should not be freed by the application.

                        It is also possible for the callback to succeed but not supply a PSK. In this case no PSK will be sent to the server but the handshake will continue. To do this the callback should return successfully and ensure that *sess is NULL. The contents of *id and *idlen will be ignored.

                        A client application wishing to use PSK ciphersuites for TLSv1.2 and below must provide a different callback function. This function will be called when the client is sending the ClientKeyExchange message to the server.

                        The purpose of the callback function is to select the PSK identity and the pre-shared key to use during the connection setup phase.

                        The callback is set using functions SSL_CTX_set_psk_client_callback() or SSL_set_psk_client_callback(). The callback function is given the connection in parameter ssl, a NUL-terminated PSK identity hint sent by the server in parameter hint, a buffer identity of length max_identity_len bytes (including the NUL-terminator) where the resulting NUL-terminated identity is to be stored, and a buffer psk of length max_psk_len bytes where the resulting pre-shared key is to be stored.

                        The callback for use in TLSv1.2 will also work in TLSv1.3 although it is recommended to use SSL_CTX_set_psk_use_session_callback() or SSL_set_psk_use_session_callback() for this purpose instead. If TLSv1.3 has been negotiated then OpenSSL will first check to see if a callback has been set via SSL_CTX_set_psk_use_session_callback() or SSL_set_psk_use_session_callback() and it will use that in preference. If no such callback is present then it will check to see if a callback has been set via SSL_CTX_set_psk_client_callback() or SSL_set_psk_client_callback() and use that. In this case the hint value will always be NULL and the handshake digest will default to SHA-256 for any returned PSK. TLSv1.3 early data exchanges are possible in PSK connections only with the SSL_psk_use_session_cb_func callback, and are not possible with the SSL_psk_client_cb_func callback.

                        "},{"location":"man3/SSL_CTX_set_psk_client_callback/#notes","title":"NOTES","text":"

                        Note that parameter hint given to the callback may be NULL.

                        A connection established via a TLSv1.3 PSK will appear as if session resumption has occurred so that SSL_session_reused(3) will return true.

                        There are no known security issues with sharing the same PSK between TLSv1.2 (or below) and TLSv1.3. However, the RFC has this note of caution:

                        \"While there is no known way in which the same PSK might produce related output in both versions, only limited analysis has been done. Implementations can ensure safety from cross-protocol related output by not reusing PSKs between TLS 1.3 and TLS 1.2.\"

                        "},{"location":"man3/SSL_CTX_set_psk_client_callback/#return-values","title":"RETURN VALUES","text":"

                        Return values from the SSL_psk_client_cb_func callback are interpreted as follows:

                        On success (callback found a PSK identity and a pre-shared key to use) the length (> 0) of psk in bytes is returned.

                        Otherwise or on errors the callback should return 0. In this case the connection setup fails.

                        The SSL_psk_use_session_cb_func callback should return 1 on success or 0 on failure. In the event of failure the connection setup fails.

                        "},{"location":"man3/SSL_CTX_set_psk_client_callback/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_psk_find_session_callback(3), SSL_set_psk_find_session_callback(3)

                        "},{"location":"man3/SSL_CTX_set_psk_client_callback/#history","title":"HISTORY","text":"

                        SSL_CTX_set_psk_use_session_callback() and SSL_set_psk_use_session_callback() were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_CTX_set_psk_client_callback/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_quiet_shutdown/","title":"SSL_CTX_set_quiet_shutdown","text":""},{"location":"man3/SSL_CTX_set_quiet_shutdown/#name","title":"NAME","text":"

                        SSL_CTX_set_quiet_shutdown, SSL_CTX_get_quiet_shutdown, SSL_set_quiet_shutdown, SSL_get_quiet_shutdown - manipulate shutdown behaviour

                        "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode);\nint SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);\n\nvoid SSL_set_quiet_shutdown(SSL *ssl, int mode);\nint SSL_get_quiet_shutdown(const SSL *ssl);\n
                        "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_quiet_shutdown() sets the \"quiet shutdown\" flag for ctx to be mode. SSL objects created from ctx inherit the mode valid at the time SSL_new(3) is called. mode may be 0 or 1.

                        SSL_CTX_get_quiet_shutdown() returns the \"quiet shutdown\" setting of ctx.

                        SSL_set_quiet_shutdown() sets the \"quiet shutdown\" flag for ssl to be mode. The setting stays valid until ssl is removed with SSL_free(3) or SSL_set_quiet_shutdown() is called again. It is not changed when SSL_clear(3) is called. mode may be 0 or 1.

                        SSL_get_quiet_shutdown() returns the \"quiet shutdown\" setting of ssl.

                        "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#notes","title":"NOTES","text":"

                        Normally when a SSL connection is finished, the parties must send out close_notify alert messages using SSL_shutdown(3) for a clean shutdown.

                        When setting the \"quiet shutdown\" flag to 1, SSL_shutdown(3) will set the internal flags to SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN. (SSL_shutdown(3) then behaves like SSL_set_shutdown(3) called with SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN.) The session is thus considered to be shutdown, but no close_notify alert is sent to the peer. This behaviour violates the TLS standard.

                        The default is normal shutdown behaviour as described by the TLS standard.

                        "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_quiet_shutdown() and SSL_set_quiet_shutdown() do not return diagnostic information.

                        SSL_CTX_get_quiet_shutdown() and SSL_get_quiet_shutdown return the current setting.

                        "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_shutdown(3), SSL_set_shutdown(3), SSL_new(3), SSL_clear(3), SSL_free(3)

                        "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_read_ahead/","title":"SSL_CTX_set_read_ahead","text":""},{"location":"man3/SSL_CTX_set_read_ahead/#name","title":"NAME","text":"

                        SSL_CTX_set_read_ahead, SSL_CTX_get_read_ahead, SSL_set_read_ahead, SSL_get_read_ahead, SSL_CTX_get_default_read_ahead - manage whether to read as many input bytes as possible

                        "},{"location":"man3/SSL_CTX_set_read_ahead/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_set_read_ahead(SSL *s, int yes);\nint SSL_get_read_ahead(const SSL *s);\n\nSSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes);\nlong SSL_CTX_get_read_ahead(SSL_CTX *ctx);\nlong SSL_CTX_get_default_read_ahead(SSL_CTX *ctx);\n
                        "},{"location":"man3/SSL_CTX_set_read_ahead/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_read_ahead() and SSL_set_read_ahead() set whether we should read as many input bytes as possible (for nonblocking reads) or not. For example if x bytes are currently required by OpenSSL, but y bytes are available from the underlying BIO (where y > x), then OpenSSL will read all y bytes into its buffer (providing that the buffer is large enough) if reading ahead is on, or x bytes otherwise. Setting the parameter yes to 0 turns reading ahead is off, other values turn it on. SSL_CTX_set_default_read_ahead() is identical to SSL_CTX_set_read_ahead().

                        SSL_CTX_get_read_ahead() and SSL_get_read_ahead() indicate whether reading ahead has been set or not. SSL_CTX_get_default_read_ahead() is identical to SSL_CTX_get_read_ahead().

                        "},{"location":"man3/SSL_CTX_set_read_ahead/#notes","title":"NOTES","text":"

                        These functions have no impact when used with DTLS. The return values for SSL_CTX_get_read_head() and SSL_get_read_ahead() are undefined for DTLS. Setting read_ahead can impact the behaviour of the SSL_pending() function (see SSL_pending(3)).

                        Since SSL_read() can return SSL_ERROR_WANT_READ for non-application data records, and SSL_has_pending() can't tell the difference between processed and unprocessed data, it's recommended that if read ahead is turned on that SSL_MODE_AUTO_RETRY is not turned off using SSL_CTX_clear_mode(). That will prevent getting SSL_ERROR_WANT_READ when there is still a complete record available that hasn't been processed.

                        If the application wants to continue to use the underlying transport (e.g. TCP connection) after the SSL connection is finished using SSL_shutdown() reading ahead should be turned off. Otherwise the SSL structure might read data that it shouldn't.

                        "},{"location":"man3/SSL_CTX_set_read_ahead/#return-values","title":"RETURN VALUES","text":"

                        SSL_get_read_ahead() and SSL_CTX_get_read_ahead() return 0 if reading ahead is off, and non zero otherwise.

                        "},{"location":"man3/SSL_CTX_set_read_ahead/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_pending(3)

                        "},{"location":"man3/SSL_CTX_set_read_ahead/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/","title":"SSL_CTX_set_record_padding_callback","text":""},{"location":"man3/SSL_CTX_set_record_padding_callback/#name","title":"NAME","text":"

                        SSL_CTX_set_record_padding_callback, SSL_set_record_padding_callback, SSL_CTX_set_record_padding_callback_arg, SSL_set_record_padding_callback_arg, SSL_CTX_get_record_padding_callback_arg, SSL_get_record_padding_callback_arg, SSL_CTX_set_block_padding, SSL_set_block_padding - install callback to specify TLS 1.3 record padding

                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, size_t (*cb)(SSL *s, int type, size_t len, void *arg));\nint SSL_set_record_padding_callback(SSL *ssl, size_t (*cb)(SSL *s, int type, size_t len, void *arg));\n\nvoid SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg);\nvoid *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx);\n\nvoid SSL_set_record_padding_callback_arg(SSL *ssl, void *arg);\nvoid *SSL_get_record_padding_callback_arg(const SSL *ssl);\n\nint SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size);\nint SSL_set_block_padding(SSL *ssl, size_t block_size);\n
                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_record_padding_callback() or SSL_set_record_padding_callback() can be used to assign a callback function cb to specify the padding for TLS 1.3 records. The value set in ctx is copied to a new SSL by SSL_new(). Kernel TLS is not possible if the record padding callback is set, and the callback function cannot be set if Kernel TLS is already configured for the current SSL object.

                        SSL_CTX_set_record_padding_callback_arg() and SSL_set_record_padding_callback_arg() assign a value arg that is passed to the callback when it is invoked. The value set in ctx is copied to a new SSL by SSL_new().

                        SSL_CTX_get_record_padding_callback_arg() and SSL_get_record_padding_callback_arg() retrieve the arg value that is passed to the callback.

                        SSL_CTX_set_block_padding() and SSL_set_block_padding() pads the record to a multiple of the block_size. A block_size of 0 or 1 disables block padding. The limit of block_size is SSL3_RT_MAX_PLAIN_LENGTH.

                        The callback is invoked for every record before encryption. The type parameter is the TLS record type that is being processed; may be one of SSL3_RT_APPLICATION_DATA, SSL3_RT_HANDSHAKE, or SSL3_RT_ALERT. The len parameter is the current plaintext length of the record before encryption. The arg parameter is the value set via SSL_CTX_set_record_padding_callback_arg() or SSL_set_record_padding_callback_arg().

                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/#return-values","title":"RETURN VALUES","text":"

                        The SSL_CTX_get_record_padding_callback_arg() and SSL_get_record_padding_callback_arg() functions return the arg value assigned in the corresponding set functions.

                        The SSL_CTX_set_block_padding() and SSL_set_block_padding() functions return 1 on success or 0 if block_size is too large.

                        The cb returns the number of padding bytes to add to the record. A return of 0 indicates no padding will be added. A return value that causes the record to exceed the maximum record size (SSL3_RT_MAX_PLAIN_LENGTH) will pad out to the maximum record size.

                        The SSL_CTX_get_record_padding_callback_arg() function returns 1 on success or 0 if the callback function is not set because Kernel TLS is configured for the SSL object.

                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/#notes","title":"NOTES","text":"

                        The default behavior is to add no padding to the record.

                        A user-supplied padding callback function will override the behavior set by SSL_set_block_padding() or SSL_CTX_set_block_padding(). Setting the user-supplied callback to NULL will restore the configured block padding behavior.

                        These functions only apply to TLS 1.3 records being written.

                        Padding bytes are not added in constant-time.

                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_new(3)

                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/#history","title":"HISTORY","text":"

                        The record padding API was added for TLS 1.3 support in OpenSSL 1.1.1.

                        The return type of SSL_CTX_set_record_padding_callback() function was changed to int in OpenSSL 3.0.

                        "},{"location":"man3/SSL_CTX_set_record_padding_callback/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_security_level/","title":"SSL_CTX_set_security_level","text":""},{"location":"man3/SSL_CTX_set_security_level/#name","title":"NAME","text":"

                        SSL_CTX_set_security_level, SSL_set_security_level, SSL_CTX_get_security_level, SSL_get_security_level, SSL_CTX_set_security_callback, SSL_set_security_callback, SSL_CTX_get_security_callback, SSL_get_security_callback, SSL_CTX_set0_security_ex_data, SSL_set0_security_ex_data, SSL_CTX_get0_security_ex_data, SSL_get0_security_ex_data - SSL/TLS security framework

                        "},{"location":"man3/SSL_CTX_set_security_level/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_security_level(SSL_CTX *ctx, int level);\nvoid SSL_set_security_level(SSL *s, int level);\n\nint SSL_CTX_get_security_level(const SSL_CTX *ctx);\nint SSL_get_security_level(const SSL *s);\n\nvoid SSL_CTX_set_security_callback(SSL_CTX *ctx,\n                                   int (*cb)(SSL *s, SSL_CTX *ctx, int op,\n                                             int bits, int nid,\n                                             void *other, void *ex));\n\nvoid SSL_set_security_callback(SSL *s, int (*cb)(SSL *s, SSL_CTX *ctx, int op,\n                                                 int bits, int nid,\n                                                 void *other, void *ex));\n\nint (*SSL_CTX_get_security_callback(const SSL_CTX *ctx))(SSL *s, SSL_CTX *ctx, int op,\n                                                         int bits, int nid, void *other,\n                                                         void *ex);\nint (*SSL_get_security_callback(const SSL *s))(SSL *s, SSL_CTX *ctx, int op,\n                                               int bits, int nid, void *other,\n                                               void *ex);\n\nvoid SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex);\nvoid SSL_set0_security_ex_data(SSL *s, void *ex);\n\nvoid *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx);\nvoid *SSL_get0_security_ex_data(const SSL *s);\n
                        "},{"location":"man3/SSL_CTX_set_security_level/#description","title":"DESCRIPTION","text":"

                        The functions SSL_CTX_set_security_level() and SSL_set_security_level() set the security level to level. If not set the library default security level is used.

                        The functions SSL_CTX_get_security_level() and SSL_get_security_level() retrieve the current security level.

                        SSL_CTX_set_security_callback(), SSL_set_security_callback(), SSL_CTX_get_security_callback() and SSL_get_security_callback() get or set the security callback associated with ctx or s. If not set a default security callback is used. The meaning of the parameters and the behaviour of the default callbacks is described below.

                        SSL_CTX_set0_security_ex_data(), SSL_set0_security_ex_data(), SSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() set the extra data pointer passed to the ex parameter of the callback. This value is passed to the callback verbatim and can be set to any convenient application specific value.

                        "},{"location":"man3/SSL_CTX_set_security_level/#default-callback-behaviour","title":"DEFAULT CALLBACK BEHAVIOUR","text":"

                        If an application doesn't set its own security callback the default callback is used. It is intended to provide sane defaults. The meaning of each level is described below.

                        • Level 0

                          Everything is permitted. This retains compatibility with previous versions of OpenSSL.

                        • Level 1

                          The security level corresponds to a minimum of 80 bits of security. Any parameters offering below 80 bits of security are excluded. As a result RSA, DSA and DH keys shorter than 1024 bits and ECC keys shorter than 160 bits are prohibited. All export cipher suites are prohibited since they all offer less than 80 bits of security. SSL version 2 is prohibited. Any cipher suite using MD5 for the MAC is also prohibited. Note that signatures using SHA1 and MD5 are also forbidden at this level as they have less than 80 security bits. Additionally, SSLv3, TLS 1.0, TLS 1.1 and DTLS 1.0 are all disabled at this level.

                        • Level 2

                          Security level set to 112 bits of security. As a result RSA, DSA and DH keys shorter than 2048 bits and ECC keys shorter than 224 bits are prohibited. In addition to the level 1 exclusions any cipher suite using RC4 is also prohibited. Compression is disabled.

                        • Level 3

                          Security level set to 128 bits of security. As a result RSA, DSA and DH keys shorter than 3072 bits and ECC keys shorter than 256 bits are prohibited. In addition to the level 2 exclusions cipher suites not offering forward secrecy are prohibited. Session tickets are disabled.

                        • Level 4

                          Security level set to 192 bits of security. As a result RSA, DSA and DH keys shorter than 7680 bits and ECC keys shorter than 384 bits are prohibited. Cipher suites using SHA1 for the MAC are prohibited.

                        • Level 5

                          Security level set to 256 bits of security. As a result RSA, DSA and DH keys shorter than 15360 bits and ECC keys shorter than 512 bits are prohibited.

                        "},{"location":"man3/SSL_CTX_set_security_level/#application-defined-security-callbacks","title":"APPLICATION DEFINED SECURITY CALLBACKS","text":"

                        Documentation to be provided.

                        "},{"location":"man3/SSL_CTX_set_security_level/#notes","title":"NOTES","text":"

                        The default security level can be configured when OpenSSL is compiled by setting -DOPENSSL_TLS_SECURITY_LEVEL=level. If not set then 1 is used.

                        The security framework disables or reject parameters inconsistent with the set security level. In the past this was difficult as applications had to set a number of distinct parameters (supported ciphers, supported curves supported signature algorithms) to achieve this end and some cases (DH parameter size for example) could not be checked at all.

                        By setting an appropriate security level much of this complexity can be avoided.

                        The bits of security limits affect all relevant parameters including cipher suite encryption algorithms, supported ECC curves, supported signature algorithms, DH parameter sizes, certificate key sizes and signature algorithms. This limit applies no matter what other custom settings an application has set: so if the cipher suite is set to ALL then only cipher suites consistent with the security level are permissible.

                        See SP800-57 for how the security limits are related to individual algorithms.

                        Some security levels require large key sizes for non-ECC public key algorithms which can severely degrade performance. For example 256 bits of security requires the use of RSA keys of at least 15360 bits in size.

                        Some restrictions can be gracefully handled: for example cipher suites offering insufficient security are not sent by the client and will not be selected by the server. Other restrictions such as the peer certificate key size or the DH parameter size will abort the handshake with a fatal alert.

                        Attempts to set certificates or parameters with insufficient security are also blocked. For example trying to set a certificate using a 512 bit RSA key or a certificate with a signature with SHA1 digest at level 1 using SSL_CTX_use_certificate(). Applications which do not check the return values for errors will misbehave: for example it might appear that a certificate is not set at all because it had been rejected.

                        "},{"location":"man3/SSL_CTX_set_security_level/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_security_level() and SSL_set_security_level() do not return values.

                        SSL_CTX_get_security_level() and SSL_get_security_level() return a integer that represents the security level with SSL_CTX or SSL, respectively.

                        SSL_CTX_set_security_callback() and SSL_set_security_callback() do not return values.

                        SSL_CTX_get_security_callback() and SSL_get_security_callback() return the pointer to the security callback or NULL if the callback is not set.

                        SSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() return the extra data pointer or NULL if the ex data is not set.

                        "},{"location":"man3/SSL_CTX_set_security_level/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_CTX_set_security_level/#history","title":"HISTORY","text":"

                        These functions were added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_CTX_set_security_level/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2014-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_session_cache_mode/","title":"SSL_CTX_set_session_cache_mode","text":""},{"location":"man3/SSL_CTX_set_session_cache_mode/#name","title":"NAME","text":"

                        SSL_CTX_set_session_cache_mode, SSL_CTX_get_session_cache_mode - enable/disable session caching

                        "},{"location":"man3/SSL_CTX_set_session_cache_mode/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_CTX_set_session_cache_mode(SSL_CTX ctx, long mode);\nlong SSL_CTX_get_session_cache_mode(SSL_CTX ctx);\n
                        "},{"location":"man3/SSL_CTX_set_session_cache_mode/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_session_cache_mode() enables/disables session caching by setting the operational mode for ctx to <mode>.

                        SSL_CTX_get_session_cache_mode() returns the currently used cache mode.

                        "},{"location":"man3/SSL_CTX_set_session_cache_mode/#notes","title":"NOTES","text":"

                        The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse. The sessions can be held in memory for each ctx, if more than one SSL_CTX object is being maintained, the sessions are unique for each SSL_CTX object.

                        In order to reuse a session, a client must send the session's id to the server. It can only send exactly one id. The server then either agrees to reuse the session or it starts a full handshake (to create a new session).

                        A server will look up the session in its internal session storage. If the session is not found in internal storage or lookups for the internal storage have been deactivated (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP), the server will try the external storage if available.

                        Since a client may try to reuse a session intended for use in a different context, the session id context must be set by the server (see SSL_CTX_set_session_id_context(3)).

                        The following session cache modes and modifiers are available:

                        • SSL_SESS_CACHE_OFF

                          No session caching for client or server takes place.

                        • SSL_SESS_CACHE_CLIENT

                          Client sessions are added to the session cache. As there is no reliable way for the OpenSSL library to know whether a session should be reused or which session to choose (due to the abstract BIO layer the SSL engine does not have details about the connection), the application must select the session to be reused by using the SSL_set_session(3) function. This option is not activated by default.

                        • SSL_SESS_CACHE_SERVER

                          Server sessions are added to the session cache. When a client proposes a session to be reused, the server looks for the corresponding session in (first) the internal session cache (unless SSL_SESS_CACHE_NO_INTERNAL_LOOKUP is set), then (second) in the external cache if available. If the session is found, the server will try to reuse the session. This is the default.

                        • SSL_SESS_CACHE_BOTH

                          Enable both SSL_SESS_CACHE_CLIENT and SSL_SESS_CACHE_SERVER at the same time.

                        • SSL_SESS_CACHE_NO_AUTO_CLEAR

                          Normally the session cache is checked for expired sessions every 255 connections using the SSL_CTX_flush_sessions(3) function. Since this may lead to a delay which cannot be controlled, the automatic flushing may be disabled and SSL_CTX_flush_sessions(3) can be called explicitly by the application.

                        • SSL_SESS_CACHE_NO_INTERNAL_LOOKUP

                          By setting this flag, session-resume operations in an SSL/TLS server will not automatically look up sessions in the internal cache, even if sessions are automatically stored there. If external session caching callbacks are in use, this flag guarantees that all lookups are directed to the external cache. As automatic lookup only applies for SSL/TLS servers, the flag has no effect on clients.

                        • SSL_SESS_CACHE_NO_INTERNAL_STORE

                          Depending on the presence of SSL_SESS_CACHE_CLIENT and/or SSL_SESS_CACHE_SERVER, sessions negotiated in an SSL/TLS handshake may be cached for possible reuse. Normally a new session is added to the internal cache as well as any external session caching (callback) that is configured for the SSL_CTX. This flag will prevent sessions being stored in the internal cache (though the application can add them manually using SSL_CTX_add_session(3)). Note: in any SSL/TLS servers where external caching is configured, any successful session lookups in the external cache (i.e. for session-resume requests) would normally be copied into the local cache before processing continues - this flag prevents these additions to the internal cache as well.

                        • SSL_SESS_CACHE_NO_INTERNAL

                          Enable both SSL_SESS_CACHE_NO_INTERNAL_LOOKUP and SSL_SESS_CACHE_NO_INTERNAL_STORE at the same time.

                        • SSL_SESS_CACHE_UPDATE_TIME

                          Updates the timestamp of the session when it is used, increasing the lifespan of the session. The session timeout applies to last use, rather then creation time.

                        The default mode is SSL_SESS_CACHE_SERVER.

                        "},{"location":"man3/SSL_CTX_set_session_cache_mode/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_session_cache_mode() returns the previously set cache mode.

                        SSL_CTX_get_session_cache_mode() returns the currently set cache mode.

                        "},{"location":"man3/SSL_CTX_set_session_cache_mode/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_set_session(3), SSL_session_reused(3), SSL_CTX_add_session(3), SSL_CTX_sess_number(3), SSL_CTX_sess_set_cache_size(3), SSL_CTX_sess_set_get_cb(3), SSL_CTX_set_session_id_context(3), SSL_CTX_set_timeout(3), SSL_CTX_flush_sessions(3)

                        "},{"location":"man3/SSL_CTX_set_session_cache_mode/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_session_id_context/","title":"SSL_CTX_set_session_id_context","text":""},{"location":"man3/SSL_CTX_set_session_id_context/#name","title":"NAME","text":"

                        SSL_CTX_set_session_id_context, SSL_set_session_id_context - set context within which session can be reused (server side only)

                        "},{"location":"man3/SSL_CTX_set_session_id_context/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,\n                                   unsigned int sid_ctx_len);\nint SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,\n                               unsigned int sid_ctx_len);\n
                        "},{"location":"man3/SSL_CTX_set_session_id_context/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_session_id_context() sets the context sid_ctx of length sid_ctx_len within which a session can be reused for the ctx object.

                        SSL_set_session_id_context() sets the context sid_ctx of length sid_ctx_len within which a session can be reused for the ssl object.

                        "},{"location":"man3/SSL_CTX_set_session_id_context/#notes","title":"NOTES","text":"

                        Sessions are generated within a certain context. When exporting/importing sessions with i2d_SSL_SESSION/d2i_SSL_SESSION it would be possible, to re-import a session generated from another context (e.g. another application), which might lead to malfunctions. Therefore, each application must set its own session id context sid_ctx which is used to distinguish the contexts and is stored in exported sessions. The sid_ctx can be any kind of binary data with a given length, it is therefore possible to use e.g. the name of the application and/or the hostname and/or service name ...

                        The session id context becomes part of the session. The session id context is set by the SSL/TLS server. The SSL_CTX_set_session_id_context() and SSL_set_session_id_context() functions are therefore only useful on the server side.

                        OpenSSL clients will check the session id context returned by the server when reusing a session.

                        The maximum length of the sid_ctx is limited to SSL_MAX_SID_CTX_LENGTH.

                        "},{"location":"man3/SSL_CTX_set_session_id_context/#warnings","title":"WARNINGS","text":"

                        If the session id context is not set on an SSL/TLS server and client certificates are used, stored sessions will not be reused but a fatal error will be flagged and the handshake will fail.

                        If a server returns a different session id context to an OpenSSL client when reusing a session, an error will be flagged and the handshake will fail. OpenSSL servers will always return the correct session id context, as an OpenSSL server checks the session id context itself before reusing a session as described above.

                        "},{"location":"man3/SSL_CTX_set_session_id_context/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_session_id_context() and SSL_set_session_id_context() return the following values:

                        • 0

                          The length sid_ctx_len of the session id context sid_ctx exceeded the maximum allowed length of SSL_MAX_SID_CTX_LENGTH. The error is logged to the error stack.

                        • 1

                          The operation succeeded.

                        "},{"location":"man3/SSL_CTX_set_session_id_context/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_CTX_set_session_id_context/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/","title":"SSL_CTX_set_session_ticket_cb","text":""},{"location":"man3/SSL_CTX_set_session_ticket_cb/#name","title":"NAME","text":"

                        SSL_CTX_set_session_ticket_cb, SSL_SESSION_get0_ticket_appdata, SSL_SESSION_set1_ticket_appdata, SSL_CTX_generate_session_ticket_fn, SSL_CTX_decrypt_session_ticket_fn - manage session ticket application data

                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\ntypedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg);\ntypedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss,\n                                                               const unsigned char *keyname,\n                                                               size_t keyname_len,\n                                                               SSL_TICKET_STATUS status,\n                                                               void *arg);\nint SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx,\n                                  SSL_CTX_generate_session_ticket_fn gen_cb,\n                                  SSL_CTX_decrypt_session_ticket_fn dec_cb,\n                                  void *arg);\nint SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len);\nint SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len);\n
                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_set_session_ticket_cb() sets the application callbacks gen_cb and dec_cb that are used by a server to set and get application data stored with a session, and placed into a session ticket. Either callback function may be set to NULL. The value of arg is passed to the callbacks.

                        gen_cb is the application defined callback invoked when a session ticket is about to be created. The application can call SSL_SESSION_set1_ticket_appdata() at this time to add application data to the session ticket. The value of arg is the same as that given to SSL_CTX_set_session_ticket_cb(). The gen_cb callback is defined as type SSL_CTX_generate_session_ticket_fn.

                        dec_cb is the application defined callback invoked after session ticket decryption has been attempted and any session ticket application data is available. If ticket decryption was successful then the ss argument contains the session data. The keyname and keyname_len arguments identify the key used to decrypt the session ticket. The status argument is the result of the ticket decryption. See the \"NOTES\" section below for further details. The value of arg is the same as that given to SSL_CTX_set_session_ticket_cb(). The dec_cb callback is defined as type SSL_CTX_decrypt_session_ticket_fn.

                        SSL_SESSION_set1_ticket_appdata() sets the application data specified by data and len into ss which is then placed into any generated session tickets. It can be called at any time before a session ticket is created to update the data placed into the session ticket. However, given that sessions and tickets are created by the handshake, the gen_cb is provided to notify the application that a session ticket is about to be generated.

                        SSL_SESSION_get0_ticket_appdata() assigns data to the session ticket application data and assigns len to the length of the session ticket application data from ss. The application data can be set via SSL_SESSION_set1_ticket_appdata() or by a session ticket. NULL will be assigned to data and 0 will be assigned to len if there is no session ticket application data. SSL_SESSION_get0_ticket_appdata() can be called any time after a session has been created. The dec_cb is provided to notify the application that a session ticket has just been decrypted.

                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#notes","title":"NOTES","text":"

                        When the dec_cb callback is invoked, the SSL_SESSION ss has not yet been assigned to the SSL s. The status indicates the result of the ticket decryption. The callback must check the status value before performing any action, as it is called even if ticket decryption fails.

                        The keyname and keyname_len arguments to dec_cb may be used to identify the key that was used to encrypt the session ticket.

                        The status argument can be any of these values:

                        • SSL_TICKET_EMPTY

                          Empty ticket present. No ticket data will be used and a new ticket should be sent to the client. This only occurs in TLSv1.2 or below. In TLSv1.3 it is not valid for a client to send an empty ticket.

                        • SSL_TICKET_NO_DECRYPT

                          The ticket couldn't be decrypted. No ticket data will be used and a new ticket should be sent to the client.

                        • SSL_TICKET_SUCCESS

                          A ticket was successfully decrypted, any session ticket application data should be available. A new ticket should not be sent to the client.

                        • SSL_TICKET_SUCCESS_RENEW

                          Same as SSL_TICKET_SUCCESS, but a new ticket should be sent to the client.

                        The return value can be any of these values:

                        • SSL_TICKET_RETURN_ABORT

                          The handshake should be aborted, either because of an error or because of some policy. Note that in TLSv1.3 a client may send more than one ticket in a single handshake. Therefore, just because one ticket is unacceptable it does not mean that all of them are. For this reason this option should be used with caution.

                        • SSL_TICKET_RETURN_IGNORE

                          Do not use a ticket (if one was available). Do not send a renewed ticket to the client.

                        • SSL_TICKET_RETURN_IGNORE_RENEW

                          Do not use a ticket (if one was available). Send a renewed ticket to the client.

                          If the callback does not wish to change the default ticket behaviour then it should return this value if status is SSL_TICKET_EMPTY or SSL_TICKET_NO_DECRYPT.

                        • SSL_TICKET_RETURN_USE

                          Use the ticket. Do not send a renewed ticket to the client. It is an error for the callback to return this value if status has a value other than SSL_TICKET_SUCCESS or SSL_TICKET_SUCCESS_RENEW.

                          If the callback does not wish to change the default ticket behaviour then it should return this value if status is SSL_TICKET_SUCCESS.

                        • SSL_TICKET_RETURN_USE_RENEW

                          Use the ticket. Send a renewed ticket to the client. It is an error for the callback to return this value if status has a value other than SSL_TICKET_SUCCESS or SSL_TICKET_SUCCESS_RENEW.

                          If the callback does not wish to change the default ticket behaviour then it should return this value if status is SSL_TICKET_SUCCESS_RENEW.

                        If status has the value SSL_TICKET_EMPTY or SSL_TICKET_NO_DECRYPT then no session data will be available and the callback must not use the ss argument. If status has the value SSL_TICKET_SUCCESS or SSL_TICKET_SUCCESS_RENEW then the application can call SSL_SESSION_get0_ticket_appdata() using the session provided in the ss argument to retrieve the application data.

                        When the gen_cb callback is invoked, the SSL_get_session() function can be used to retrieve the SSL_SESSION for SSL_SESSION_set1_ticket_appdata().

                        By default, in TLSv1.2 and below, a new session ticket is not issued on a successful resumption and therefore gen_cb will not be called. In TLSv1.3 the default behaviour is to always issue a new ticket on resumption. In both cases this behaviour can be changed if a ticket key callback is in use (see SSL_CTX_set_tlsext_ticket_key_cb(3)).

                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#return-values","title":"RETURN VALUES","text":"

                        The SSL_CTX_set_session_ticket_cb(), SSL_SESSION_set1_ticket_appdata() and SSL_SESSION_get0_ticket_appdata() functions return 1 on success and 0 on failure.

                        The gen_cb callback must return 1 to continue the connection. A return of 0 will terminate the connection with an INTERNAL_ERROR alert.

                        The dec_cb callback must return a value as described in \"NOTES\" above.

                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_session(3)

                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#history","title":"HISTORY","text":"

                        The SSL_CTX_set_session_ticket_cb(), SSL_SESSION_set1_ticket_appdata() and SSL_SESSION_get_ticket_appdata() functions were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/","title":"SSL_CTX_set_split_send_fragment","text":""},{"location":"man3/SSL_CTX_set_split_send_fragment/#name","title":"NAME","text":"

                        SSL_CTX_set_max_send_fragment, SSL_set_max_send_fragment, SSL_CTX_set_split_send_fragment, SSL_set_split_send_fragment, SSL_CTX_set_max_pipelines, SSL_set_max_pipelines, SSL_CTX_set_default_read_buffer_len, SSL_set_default_read_buffer_len, SSL_CTX_set_tlsext_max_fragment_length, SSL_set_tlsext_max_fragment_length, SSL_SESSION_get_max_fragment_length - Control fragment size settings and pipelining operations

                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, long);\nlong SSL_set_max_send_fragment(SSL *ssl, long m);\n\nlong SSL_CTX_set_max_pipelines(SSL_CTX *ctx, long m);\nlong SSL_set_max_pipelines(SSL_CTX *ssl, long m);\n\nlong SSL_CTX_set_split_send_fragment(SSL_CTX *ctx, long m);\nlong SSL_set_split_send_fragment(SSL *ssl, long m);\n\nvoid SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len);\nvoid SSL_set_default_read_buffer_len(SSL *s, size_t len);\n\nint SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode);\nint SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode);\nuint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *session);\n
                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/#description","title":"DESCRIPTION","text":"

                        Some engines are able to process multiple simultaneous crypto operations. This capability could be utilised to parallelise the processing of a single connection. For example a single write can be split into multiple records and each one encrypted independently and in parallel. Note: this will only work in TLS1.1+. There is no support in SSLv3, TLSv1.0 or DTLS (any version). This capability is known as \"pipelining\" within OpenSSL.

                        In order to benefit from the pipelining capability. You need to have an engine that provides ciphers that support this. The OpenSSL \"dasync\" engine provides AES128-SHA based ciphers that have this capability. However, these are for development and test purposes only.

                        SSL_CTX_set_max_send_fragment() and SSL_set_max_send_fragment() set the max_send_fragment parameter for SSL_CTX and SSL objects respectively. This value restricts the amount of plaintext bytes that will be sent in any one SSL/TLS record. By default its value is SSL3_RT_MAX_PLAIN_LENGTH (16384). These functions will only accept a value in the range 512 - SSL3_RT_MAX_PLAIN_LENGTH.

                        SSL_CTX_set_max_pipelines() and SSL_set_max_pipelines() set the maximum number of pipelines that will be used at any one time. This value applies to both \"read\" pipelining and \"write\" pipelining. By default only one pipeline will be used (i.e. normal non-parallel operation). The number of pipelines set must be in the range 1 - SSL_MAX_PIPELINES (32). Setting this to a value > 1 will also automatically turn on \"read_ahead\" (see SSL_CTX_set_read_ahead(3)). This is explained further below. OpenSSL will only ever use more than one pipeline if a cipher suite is negotiated that uses a pipeline capable cipher provided by an engine.

                        Pipelining operates slightly differently for reading encrypted data compared to writing encrypted data. SSL_CTX_set_split_send_fragment() and SSL_set_split_send_fragment() define how data is split up into pipelines when writing encrypted data. The number of pipelines used will be determined by the amount of data provided to the SSL_write_ex() or SSL_write() call divided by split_send_fragment.

                        For example if split_send_fragment is set to 2000 and max_pipelines is 4 then:

                        SSL_write/SSL_write_ex called with 0-2000 bytes == 1 pipeline used

                        SSL_write/SSL_write_ex called with 2001-4000 bytes == 2 pipelines used

                        SSL_write/SSL_write_ex called with 4001-6000 bytes == 3 pipelines used

                        SSL_write/SSL_write_ex called with 6001+ bytes == 4 pipelines used

                        split_send_fragment must always be less than or equal to max_send_fragment. By default it is set to be equal to max_send_fragment. This will mean that the same number of records will always be created as would have been created in the non-parallel case, although the data will be apportioned differently. In the parallel case data will be spread equally between the pipelines.

                        Read pipelining is controlled in a slightly different way than with write pipelining. While reading we are constrained by the number of records that the peer (and the network) can provide to us in one go. The more records we can get in one go the more opportunity we have to parallelise the processing. As noted above when setting max_pipelines to a value greater than one, read_ahead is automatically set. The read_ahead parameter causes OpenSSL to attempt to read as much data into the read buffer as the network can provide and will fit into the buffer. Without this set data is read into the read buffer one record at a time. The more data that can be read, the more opportunity there is for parallelising the processing at the cost of increased memory overhead per connection. Setting read_ahead can impact the behaviour of the SSL_pending() function (see SSL_pending(3)). In addition the default size of the internal read buffer is multiplied by the number of pipelines available to ensure that we can read multiple records in one go. This can therefore have a significant impact on memory usage.

                        The SSL_CTX_set_default_read_buffer_len() and SSL_set_default_read_buffer_len() functions control the size of the read buffer that will be used. The len parameter sets the size of the buffer. The value will only be used if it is greater than the default that would have been used anyway. The normal default value depends on a number of factors but it will be at least SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_ENCRYPTED_OVERHEAD (16704) bytes.

                        SSL_CTX_set_tlsext_max_fragment_length() sets the default maximum fragment length negotiation mode via value mode to ctx. This setting affects only SSL instances created after this function is called. It affects the client-side as only its side may initiate this extension use.

                        SSL_set_tlsext_max_fragment_length() sets the maximum fragment length negotiation mode via value mode to ssl. This setting will be used during a handshake when extensions are exchanged between client and server. So it only affects SSL sessions created after this function is called. It affects the client-side as only its side may initiate this extension use.

                        SSL_SESSION_get_max_fragment_length() gets the maximum fragment length negotiated in session.

                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/#return-values","title":"RETURN VALUES","text":"

                        All non-void functions return 1 on success and 0 on failure.

                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/#notes","title":"NOTES","text":"

                        The Maximum Fragment Length extension support is optional on the server side. If the server does not support this extension then SSL_SESSION_get_max_fragment_length() will return: TLSEXT_max_fragment_length_DISABLED.

                        The following modes are available:

                        • TLSEXT_max_fragment_length_DISABLED

                          Disables Maximum Fragment Length Negotiation (default).

                        • TLSEXT_max_fragment_length_512

                          Sets Maximum Fragment Length to 512 bytes.

                        • TLSEXT_max_fragment_length_1024

                          Sets Maximum Fragment Length to 1024.

                        • TLSEXT_max_fragment_length_2048

                          Sets Maximum Fragment Length to 2048.

                        • TLSEXT_max_fragment_length_4096

                          Sets Maximum Fragment Length to 4096.

                        With the exception of SSL_CTX_set_default_read_buffer_len() SSL_set_default_read_buffer_len(), SSL_CTX_set_tlsext_max_fragment_length(), SSL_set_tlsext_max_fragment_length() and SSL_SESSION_get_max_fragment_length() all these functions are implemented using macros.

                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_read_ahead(3), SSL_pending(3)

                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/#history","title":"HISTORY","text":"

                        The SSL_CTX_set_max_pipelines(), SSL_set_max_pipelines(), SSL_CTX_set_split_send_fragment(), SSL_set_split_send_fragment(), SSL_CTX_set_default_read_buffer_len() and SSL_set_default_read_buffer_len() functions were added in OpenSSL 1.1.0.

                        The SSL_CTX_set_tlsext_max_fragment_length(), SSL_set_tlsext_max_fragment_length() and SSL_SESSION_get_max_fragment_length() functions were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_CTX_set_split_send_fragment/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_srp_password/","title":"SSL_CTX_set_srp_password","text":""},{"location":"man3/SSL_CTX_set_srp_password/#name","title":"NAME","text":"

                        SSL_CTX_set_srp_username, SSL_CTX_set_srp_password, SSL_CTX_set_srp_strength, SSL_CTX_set_srp_cb_arg, SSL_CTX_set_srp_username_callback, SSL_CTX_set_srp_client_pwd_callback, SSL_CTX_set_srp_verify_param_callback, SSL_set_srp_server_param, SSL_set_srp_server_param_pw, SSL_get_srp_g, SSL_get_srp_N, SSL_get_srp_username, SSL_get_srp_userinfo - SRP control operations

                        "},{"location":"man3/SSL_CTX_set_srp_password/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n

                        The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name);\nint SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password);\nint SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);\nint SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);\nint SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,\n                                      int (*cb) (SSL *s, int *ad, void *arg));\nint SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,\n                                        char *(*cb) (SSL *s, void *arg));\nint SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,\n                                          int (*cb) (SSL *s, void *arg));\n\nint SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,\n                             BIGNUM *sa, BIGNUM *v, char *info);\nint SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,\n                                const char *grp);\n\nBIGNUM *SSL_get_srp_g(SSL *s);\nBIGNUM *SSL_get_srp_N(SSL *s);\n\nchar *SSL_get_srp_username(SSL *s);\nchar *SSL_get_srp_userinfo(SSL *s);\n
                        "},{"location":"man3/SSL_CTX_set_srp_password/#description","title":"DESCRIPTION","text":"

                        All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                        These functions provide access to SRP (Secure Remote Password) parameters, an alternate authentication mechanism for TLS. SRP allows the use of usernames and passwords over unencrypted channels without revealing the password to an eavesdropper. SRP also supplies a shared secret at the end of the authentication sequence that can be used to generate encryption keys.

                        The SRP protocol, version 3 is specified in RFC 2945. SRP version 6 is described in RFC 5054 with applications to TLS authentication.

                        The SSL_CTX_set_srp_username() function sets the SRP username for ctx. This should be called on the client prior to creating a connection to the server. The length of name must be shorter or equal to 255 characters.

                        The SSL_CTX_set_srp_password() function sets the SRP password for ctx. This may be called on the client prior to creating a connection to the server. This overrides the effect of SSL_CTX_set_srp_client_pwd_callback().

                        The SSL_CTX_set_srp_strength() function sets the SRP strength for ctx. This is the minimal length of the SRP prime in bits. If not specified 1024 is used. If not satisfied by the server key exchange the connection will be rejected.

                        The SSL_CTX_set_srp_cb_arg() function sets an extra parameter that will be passed to all following callbacks as arg.

                        The SSL_CTX_set_srp_username_callback() function sets the server side callback that is invoked when an SRP username is found in a ClientHello. The callback parameters are the SSL connection s, a writable error flag ad and the extra argument arg set by SSL_CTX_set_srp_cb_arg(). This callback should setup the server for the key exchange by calling SSL_set_srp_server_param() with the appropriate parameters for the received username. The username can be obtained by calling SSL_get_srp_username(). See SRP_VBASE_init(3) to parse the verifier file created by openssl-srp(1) or SRP_create_verifier(3) to generate it. The callback should return SSL_ERROR_NONE to proceed with the server key exchange, SSL3_AL_FATAL for a fatal error or any value < 0 for a retryable error. In the event of a SSL3_AL_FATAL the alert flag given by *al will be sent back. By default this will be SSL_AD_UNKNOWN_PSK_IDENTITY.

                        The SSL_CTX_set_srp_client_pwd_callback() function sets the client password callback on the client. The callback parameters are the SSL connection s and the extra argument arg set by SSL_CTX_set_srp_cb_arg(). The callback will be called as part of the generation of the client secrets. It should return the client password in text form or NULL to abort the connection. The resulting memory will be freed by the library as part of the callback resolution. This overrides the effect of SSL_CTX_set_srp_password().

                        The SSL_CTX_set_srp_verify_param_callback() sets the SRP gN parameter verification callback on the client. This allows the client to perform custom verification when receiving the server SRP proposed parameters. The callback parameters are the SSL connection s and the extra argument arg set by SSL_CTX_set_srp_cb_arg(). The callback should return a positive value to accept the server parameters. Returning 0 or a negative value will abort the connection. The server parameters can be obtained by calling SSL_get_srp_N() and SSL_get_srp_g(). Sanity checks are already performed by the library after the handshake (B % N non zero, check against the strength parameter) and are not necessary. If no callback is set the g and N parameters will be checked against known RFC 5054 values.

                        The SSL_set_srp_server_param() function sets all SRP parameters for the connection s. N and g are the SRP group parameters, sa is the user salt, v the password verifier and info is the optional user info.

                        The SSL_set_srp_server_param_pw() function sets all SRP parameters for the connection s by generating a random salt and a password verifier. user is the username, pass the password and grp the SRP group parameters identifier for SRP_get_default_gN(3).

                        The SSL_get_srp_g() function returns the SRP group generator for s, or from the underlying SSL_CTX if it is NULL.

                        The SSL_get_srp_N() function returns the SRP prime for s, or from the underlying SSL_CTX if it is NULL.

                        The SSL_get_srp_username() function returns the SRP username for s, or from the underlying SSL_CTX if it is NULL.

                        The SSL_get_srp_userinfo() function returns the SRP user info for s, or from the underlying SSL_CTX if it is NULL.

                        "},{"location":"man3/SSL_CTX_set_srp_password/#return-values","title":"RETURN VALUES","text":"

                        All SSL_CTX_set_* functions return 1 on success and 0 on failure.

                        SSL_set_srp_server_param() returns 1 on success and -1 on failure.

                        The SSL_get_SRP_* functions return a pointer to the requested data, the memory is owned by the library and should not be freed by the caller.

                        "},{"location":"man3/SSL_CTX_set_srp_password/#examples","title":"EXAMPLES","text":"

                        Setup SRP parameters on the client:

                        #include <openssl/ssl.h>\n\nconst char *username = \"username\";\nconst char *password = \"password\";\n\nSSL_CTX *ctx = SSL_CTX_new(TLS_client_method());\nif (!ctx)\n    /* Error */\nif (!SSL_CTX_set_srp_username(ctx, username))\n    /* Error */\nif (!SSL_CTX_set_srp_password(ctx, password))\n    /* Error */\n

                        Setup SRP server with verifier file:

                        #include <openssl/srp.h>\n#include <openssl/ssl.h>\n\nconst char *srpvfile = \"password.srpv\";\n\nint srpServerCallback(SSL *s, int *ad, void *arg)\n{\n    SRP_VBASE *srpData = (SRP_VBASE*) arg;\n    char *username = SSL_get_srp_username(s);\n\n    SRP_user_pwd *user_pwd = SRP_VBASE_get1_by_user(srpData, username);\n    if (!user_pwd)\n        /* Error */\n        return SSL3_AL_FATAL;\n\n    if (SSL_set_srp_server_param(s, user_pwd->N, user_pwd->g,\n        user_pwd->s, user_pwd->v, user_pwd->info) < 0)\n        /* Error */\n\n    SRP_user_pwd_free(user_pwd);\n    return SSL_ERROR_NONE;\n}\n\nSSL_CTX *ctx = SSL_CTX_new(TLS_server_method());\nif (!ctx)\n    /* Error */\n\n/*\n * seedKey should contain a NUL terminated sequence\n * of random non NUL bytes\n */\nconst char *seedKey;\n\nSRP_VBASE *srpData = SRP_VBASE_new(seedKey);\nif (SRP_VBASE_init(srpData, (char*) srpvfile) != SRP_NO_ERROR)\n   /* Error */\n\nSSL_CTX_set_srp_cb_arg(ctx, srpData);\nSSL_CTX_set_srp_username_callback(ctx, srpServerCallback);\n
                        "},{"location":"man3/SSL_CTX_set_srp_password/#see-also","title":"SEE ALSO","text":"

                        ssl(7), openssl-srp(1), SRP_VBASE_new(3), SRP_create_verifier(3)

                        "},{"location":"man3/SSL_CTX_set_srp_password/#history","title":"HISTORY","text":"

                        These functions were added in OpenSSL 1.0.1 and deprecated in OpenSSL 3.0.

                        "},{"location":"man3/SSL_CTX_set_srp_password/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_ssl_version/","title":"SSL_CTX_set_ssl_version","text":""},{"location":"man3/SSL_CTX_set_ssl_version/#name","title":"NAME","text":"

                        SSL_CTX_set_ssl_version, SSL_CTX_get_ssl_method, SSL_set_ssl_method, SSL_get_ssl_method - choose a new TLS/SSL method

                        "},{"location":"man3/SSL_CTX_set_ssl_version/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);\nconst SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx);\n\nint SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);\nconst SSL_METHOD *SSL_get_ssl_method(const SSL *ssl);\n
                        "},{"location":"man3/SSL_CTX_set_ssl_version/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_ssl_version() sets a new default TLS/SSL method for SSL objects newly created from this ctx. Most of the configuration attached to the SSL_CTX object is retained, with the exception of the configured TLS ciphers, which are reset to the default values. SSL objects already created from this SSL_CTX with SSL_new(3) are not affected, except when SSL_clear(3) is being called, as described below.

                        SSL_CTX_get_ssl_method() returns the SSL_METHOD which was used to construct the SSL_CTX.

                        SSL_set_ssl_method() sets a new TLS/SSL method for a particular ssl object. It may be reset, when SSL_clear() is called.

                        SSL_get_ssl_method() returns a pointer to the TLS/SSL method set in ssl.

                        "},{"location":"man3/SSL_CTX_set_ssl_version/#notes","title":"NOTES","text":"

                        The available method choices are described in SSL_CTX_new(3).

                        When SSL_clear(3) is called and no session is connected to an SSL object, the method of the SSL object is reset to the method currently set in the corresponding SSL_CTX object.

                        SSL_CTX_set_version() has unusual semantics and no clear use case; it would usually be preferable to create a new SSL_CTX object than to try to reuse an existing one in this fashion. Its usage is considered deprecated.

                        "},{"location":"man3/SSL_CTX_set_ssl_version/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur for SSL_CTX_set_ssl_version() and SSL_set_ssl_method():

                        • 0

                          The new choice failed, check the error stack to find out the reason.

                        • 1

                          The operation succeeded.

                        SSL_CTX_get_ssl_method() and SSL_get_ssl_method() always return non-NULL pointers.

                        "},{"location":"man3/SSL_CTX_set_ssl_version/#see-also","title":"SEE ALSO","text":"

                        SSL_CTX_new(3), SSL_new(3), SSL_clear(3), ssl(7), SSL_set_connect_state(3)

                        "},{"location":"man3/SSL_CTX_set_ssl_version/#history","title":"HISTORY","text":"

                        SSL_CTX_set_ssl_version() was deprecated in OpenSSL 3.0.

                        "},{"location":"man3/SSL_CTX_set_ssl_version/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/","title":"SSL_CTX_set_stateless_cookie_generate_cb","text":""},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#name","title":"NAME","text":"

                        SSL_CTX_set_stateless_cookie_generate_cb, SSL_CTX_set_stateless_cookie_verify_cb, SSL_CTX_set_cookie_generate_cb, SSL_CTX_set_cookie_verify_cb - Callback functions for stateless TLS1.3 cookies

                        "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_stateless_cookie_generate_cb(\n    SSL_CTX *ctx,\n    int (*gen_stateless_cookie_cb) (SSL *ssl,\n                                    unsigned char *cookie,\n                                    size_t *cookie_len));\nvoid SSL_CTX_set_stateless_cookie_verify_cb(\n    SSL_CTX *ctx,\n    int (*verify_stateless_cookie_cb) (SSL *ssl,\n                                       const unsigned char *cookie,\n                                       size_t cookie_len));\n\nvoid SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,\n                                    int (*app_gen_cookie_cb) (SSL *ssl,\n                                                              unsigned char\n                                                              *cookie,\n                                                              unsigned int\n                                                              *cookie_len));\nvoid SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,\n                                  int (*app_verify_cookie_cb) (SSL *ssl,\n                                                               const unsigned\n                                                               char *cookie,\n                                                               unsigned int\n                                                               cookie_len));\n
                        "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_stateless_cookie_generate_cb() sets the callback used by SSL_stateless(3) to generate the application-controlled portion of the cookie provided to clients in the HelloRetryRequest transmitted as a response to a ClientHello with a missing or invalid cookie. gen_stateless_cookie_cb() must write at most SSL_COOKIE_LENGTH bytes into cookie, and must write the number of bytes written to cookie_len. If a cookie cannot be generated, a zero return value can be used to abort the handshake.

                        SSL_CTX_set_stateless_cookie_verify_cb() sets the callback used by SSL_stateless(3) to determine whether the application-controlled portion of a ClientHello cookie is valid. The cookie data is pointed to by cookie and is of length cookie_len. A nonzero return value from verify_stateless_cookie_cb() communicates that the cookie is valid. The integrity of the entire cookie, including the application-controlled portion, is automatically verified by HMAC before verify_stateless_cookie_cb() is called.

                        SSL_CTX_set_cookie_generate_cb() sets the callback used by DTLSv1_listen(3) to generate the cookie provided to clients in the HelloVerifyRequest transmitted as a response to a ClientHello with a missing or invalid cookie. app_gen_cookie_cb() must write at most DTLS1_COOKIE_LENGTH bytes into cookie, and must write the number of bytes written to cookie_len. If a cookie cannot be generated, a zero return value can be used to abort the handshake.

                        SSL_CTX_set_cookie_verify_cb() sets the callback used by DTLSv1_listen(3) to determine whether the cookie in a ClientHello is valid. The cookie data is pointed to by cookie and is of length cookie_len. A nonzero return value from app_verify_cookie_cb() communicates that the cookie is valid. The integrity of the cookie is not verified by OpenSSL. This is an application responsibility.

                        "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#return-values","title":"RETURN VALUES","text":"

                        Neither function returns a value.

                        "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_stateless(3), DTLSv1_listen(3)

                        "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#history","title":"HISTORY","text":"

                        SSL_CTX_set_stateless_cookie_generate_cb() and SSL_CTX_set_stateless_cookie_verify_cb() were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_timeout/","title":"SSL_CTX_set_timeout","text":""},{"location":"man3/SSL_CTX_set_timeout/#name","title":"NAME","text":"

                        SSL_CTX_set_timeout, SSL_CTX_get_timeout - manipulate timeout values for session caching

                        "},{"location":"man3/SSL_CTX_set_timeout/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_CTX_set_timeout(SSL_CTX *ctx, long t);\nlong SSL_CTX_get_timeout(SSL_CTX *ctx);\n
                        "},{"location":"man3/SSL_CTX_set_timeout/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_timeout() sets the timeout for newly created sessions for ctx to t. The timeout value t must be given in seconds.

                        SSL_CTX_get_timeout() returns the currently set timeout value for ctx.

                        "},{"location":"man3/SSL_CTX_set_timeout/#notes","title":"NOTES","text":"

                        Whenever a new session is created, it is assigned a maximum lifetime. This lifetime is specified by storing the creation time of the session and the timeout value valid at this time. If the actual time is later than creation time plus timeout, the session is not reused.

                        Due to this realization, all sessions behave according to the timeout value valid at the time of the session negotiation. Changes of the timeout value do not affect already established sessions.

                        The expiration time of a single session can be modified using the SSL_SESSION_get_time(3) family of functions.

                        Expired sessions are removed from the internal session cache, whenever SSL_CTX_flush_sessions(3) is called, either directly by the application or automatically (see SSL_CTX_set_session_cache_mode(3))

                        The default value for session timeout is decided on a per protocol basis, see SSL_get_default_timeout(3). All currently supported protocols have the same default timeout value of 300 seconds.

                        This timeout value is used as the ticket lifetime hint for stateless session tickets. It is also used as the timeout value within the ticket itself.

                        For TLSv1.3, RFC8446 limits transmission of this value to 1 week (604800 seconds).

                        For TLSv1.2, tickets generated during an initial handshake use the value as specified. Tickets generated during a resumed handshake have a value of 0 for the ticket lifetime hint.

                        "},{"location":"man3/SSL_CTX_set_timeout/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_timeout() returns the previously set timeout value.

                        SSL_CTX_get_timeout() returns the currently set timeout value.

                        "},{"location":"man3/SSL_CTX_set_timeout/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_get_time(3), SSL_CTX_flush_sessions(3), SSL_get_default_timeout(3)

                        "},{"location":"man3/SSL_CTX_set_timeout/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/","title":"SSL_CTX_set_tlsext_servername_callback","text":""},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#name","title":"NAME","text":"

                        SSL_CTX_set_tlsext_servername_callback, SSL_CTX_set_tlsext_servername_arg, SSL_get_servername_type, SSL_get_servername, SSL_set_tlsext_host_name - handle server name indication (SNI)

                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx,\n                                  int (*cb)(SSL *s, int *al, void *arg));\nlong SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);\n\nconst char *SSL_get_servername(const SSL *s, const int type);\nint SSL_get_servername_type(const SSL *s);\n\nint SSL_set_tlsext_host_name(const SSL *s, const char *name);\n
                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#description","title":"DESCRIPTION","text":"

                        The functionality provided by the servername callback is mostly superseded by the ClientHello callback, which can be set using SSL_CTX_set_client_hello_cb(). However, even where the ClientHello callback is used, the servername callback is still necessary in order to acknowledge the servername requested by the client.

                        SSL_CTX_set_tlsext_servername_callback() sets the application callback cb used by a server to perform any actions or configuration required based on the servername extension received in the incoming connection. When cb is NULL, SNI is not used.

                        The servername callback should return one of the following values:

                        • SSL_TLSEXT_ERR_OK

                          This is used to indicate that the servername requested by the client has been accepted. Typically a server will call SSL_set_SSL_CTX() in the callback to set up a different configuration for the selected servername in this case.

                        • SSL_TLSEXT_ERR_ALERT_FATAL

                          In this case the servername requested by the client is not accepted and the handshake will be aborted. The value of the alert to be used should be stored in the location pointed to by the al parameter to the callback. By default this value is initialised to SSL_AD_UNRECOGNIZED_NAME.

                        • SSL_TLSEXT_ERR_ALERT_WARNING

                          If this value is returned then the servername is not accepted by the server. However, the handshake will continue and send a warning alert instead. The value of the alert should be stored in the location pointed to by the al parameter as for SSL_TLSEXT_ERR_ALERT_FATAL above. Note that TLSv1.3 does not support warning alerts, so if TLSv1.3 has been negotiated then this return value is treated the same way as SSL_TLSEXT_ERR_NOACK.

                        • SSL_TLSEXT_ERR_NOACK

                          This return value indicates that the servername is not accepted by the server. No alerts are sent and the server will not acknowledge the requested servername.

                        SSL_CTX_set_tlsext_servername_arg() sets a context-specific argument to be passed into the callback (via the arg parameter) for this SSL_CTX.

                        The behaviour of SSL_get_servername() depends on a number of different factors. In particular note that in TLSv1.3 the servername is negotiated in every handshake. In TLSv1.2 the servername is only negotiated on initial handshakes and not on resumption handshakes.

                        • On the client, before the handshake

                          If a servername has been set via a call to SSL_set_tlsext_host_name() then it will return that servername.

                          If one has not been set, but a TLSv1.2 resumption is being attempted and the session from the original handshake had a servername accepted by the server then it will return that servername.

                          Otherwise it returns NULL.

                        • On the client, during or after the handshake and a TLSv1.2 (or below) resumption occurred

                          If the session from the original handshake had a servername accepted by the server then it will return that servername.

                          Otherwise it returns the servername set via SSL_set_tlsext_host_name() or NULL if it was not called.

                        • On the client, during or after the handshake and a TLSv1.2 (or below) resumption did not occur

                          It will return the servername set via SSL_set_tlsext_host_name() or NULL if it was not called.

                        • On the server, before the handshake

                          The function will always return NULL before the handshake

                        • On the server, after the servername extension has been processed and a TLSv1.2 (or below) resumption occurred

                          If a servername was accepted by the server in the original handshake then it will return that servername, or NULL otherwise.

                        • On the server, after the servername extension has been processed and a TLSv1.2 (or below) resumption did not occur

                          The function will return the servername requested by the client in this handshake or NULL if none was requested.

                        Note that the ClientHello callback occurs before a servername extension from the client is processed. The servername, certificate and ALPN callbacks occur after a servername extension from the client is processed.

                        SSL_get_servername_type() returns the servername type or -1 if no servername is present. Currently the only supported type (defined in RFC3546) is TLSEXT_NAMETYPE_host_name.

                        SSL_set_tlsext_host_name() sets the server name indication ClientHello extension to contain the value name. The type of server name indication extension is set to TLSEXT_NAMETYPE_host_name (defined in RFC3546).

                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#notes","title":"NOTES","text":"

                        Several callbacks are executed during ClientHello processing, including the ClientHello, ALPN, and servername callbacks. The ClientHello callback is executed first, then the servername callback, followed by the ALPN callback.

                        The SSL_set_tlsext_host_name() function should only be called on SSL objects that will act as clients; otherwise the configured name will be ignored.

                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_tlsext_servername_callback() and SSL_CTX_set_tlsext_servername_arg() both always return 1 indicating success. SSL_set_tlsext_host_name() returns 1 on success, 0 in case of error.

                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_alpn_select_cb(3), SSL_get0_alpn_selected(3), SSL_CTX_set_client_hello_cb(3)

                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#history","title":"HISTORY","text":"

                        SSL_get_servername() historically provided some unexpected results in certain corner cases. This has been fixed from OpenSSL 1.1.1e.

                        Prior to 1.1.1e, when the client requested a servername in an initial TLSv1.2 handshake, the server accepted it, and then the client successfully resumed but set a different explicit servername in the second handshake then when called by the client it returned the servername from the second handshake. This has now been changed to return the servername requested in the original handshake.

                        Also prior to 1.1.1e, if the client sent a servername in the first handshake but the server did not accept it, and then a second handshake occurred where TLSv1.2 resumption was successful then when called by the server it returned the servername requested in the original handshake. This has now been changed to NULL.

                        "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/","title":"SSL_CTX_set_tlsext_status_cb","text":""},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#name","title":"NAME","text":"

                        SSL_CTX_set_tlsext_status_cb, SSL_CTX_get_tlsext_status_cb, SSL_CTX_set_tlsext_status_arg, SSL_CTX_get_tlsext_status_arg, SSL_CTX_set_tlsext_status_type, SSL_CTX_get_tlsext_status_type, SSL_set_tlsext_status_type, SSL_get_tlsext_status_type, SSL_get_tlsext_status_ocsp_resp, SSL_set_tlsext_status_ocsp_resp - OCSP Certificate Status Request functions

                        "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/tls1.h>\n\nlong SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx, int (*callback)(SSL *, void *));\nlong SSL_CTX_get_tlsext_status_cb(SSL_CTX *ctx, int (**callback)(SSL *, void *));\n\nlong SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg);\nlong SSL_CTX_get_tlsext_status_arg(SSL_CTX *ctx, void **arg);\n\nlong SSL_CTX_set_tlsext_status_type(SSL_CTX *ctx, int type);\nlong SSL_CTX_get_tlsext_status_type(SSL_CTX *ctx);\n\nlong SSL_set_tlsext_status_type(SSL *s, int type);\nlong SSL_get_tlsext_status_type(SSL *s);\n\nlong SSL_get_tlsext_status_ocsp_resp(ssl, unsigned char **resp);\nlong SSL_set_tlsext_status_ocsp_resp(ssl, unsigned char *resp, int len);\n
                        "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#description","title":"DESCRIPTION","text":"

                        A client application may request that a server send back an OCSP status response (also known as OCSP stapling). To do so the client should call the SSL_CTX_set_tlsext_status_type() function prior to the creation of any SSL objects. Alternatively an application can call the SSL_set_tlsext_status_type() function on an individual SSL object prior to the start of the handshake. Currently the only supported type is TLSEXT_STATUSTYPE_ocsp. This value should be passed in the type argument. Calling SSL_CTX_get_tlsext_status_type() will return the type TLSEXT_STATUSTYPE_ocsp previously set via SSL_CTX_set_tlsext_status_type() or -1 if not set.

                        The client should additionally provide a callback function to decide what to do with the returned OCSP response by calling SSL_CTX_set_tlsext_status_cb(). The callback function should determine whether the returned OCSP response is acceptable or not. The callback will be passed as an argument the value previously set via a call to SSL_CTX_set_tlsext_status_arg(). Note that the callback will not be called in the event of a handshake where session resumption occurs (because there are no Certificates exchanged in such a handshake). The callback previously set via SSL_CTX_set_tlsext_status_cb() can be retrieved by calling SSL_CTX_get_tlsext_status_cb(), and the argument by calling SSL_CTX_get_tlsext_status_arg().

                        On the client side SSL_get_tlsext_status_type() can be used to determine whether the client has previously called SSL_set_tlsext_status_type(). It will return TLSEXT_STATUSTYPE_ocsp if it has been called or -1 otherwise. On the server side SSL_get_tlsext_status_type() can be used to determine whether the client requested OCSP stapling. If the client requested it then this function will return TLSEXT_STATUSTYPE_ocsp, or -1 otherwise.

                        The response returned by the server can be obtained via a call to SSL_get_tlsext_status_ocsp_resp(). The value *resp will be updated to point to the OCSP response data and the return value will be the length of that data. Typically a callback would obtain an OCSP_RESPONSE object from this data via a call to the d2i_OCSP_RESPONSE() function. If the server has not provided any response data then *resp will be NULL and the return value from SSL_get_tlsext_status_ocsp_resp() will be -1.

                        A server application must also call the SSL_CTX_set_tlsext_status_cb() function if it wants to be able to provide clients with OCSP Certificate Status responses. Typically the server callback would obtain the server certificate that is being sent back to the client via a call to SSL_get_certificate(); obtain the OCSP response to be sent back; and then set that response data by calling SSL_set_tlsext_status_ocsp_resp(). A pointer to the response data should be provided in the resp argument, and the length of that data should be in the len argument.

                        "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#return-values","title":"RETURN VALUES","text":"

                        The callback when used on the client side should return a negative value on error; 0 if the response is not acceptable (in which case the handshake will fail) or a positive value if it is acceptable.

                        The callback when used on the server side should return with either SSL_TLSEXT_ERR_OK (meaning that the OCSP response that has been set should be returned), SSL_TLSEXT_ERR_NOACK (meaning that an OCSP response should not be returned) or SSL_TLSEXT_ERR_ALERT_FATAL (meaning that a fatal error has occurred).

                        SSL_CTX_set_tlsext_status_cb(), SSL_CTX_set_tlsext_status_arg(), SSL_CTX_set_tlsext_status_type(), SSL_set_tlsext_status_type() and SSL_set_tlsext_status_ocsp_resp() return 0 on error or 1 on success.

                        SSL_CTX_get_tlsext_status_type() returns the value previously set by SSL_CTX_set_tlsext_status_type(), or -1 if not set.

                        SSL_get_tlsext_status_ocsp_resp() returns the length of the OCSP response data or -1 if there is no OCSP response data.

                        SSL_get_tlsext_status_type() returns TLSEXT_STATUSTYPE_ocsp on the client side if SSL_set_tlsext_status_type() was previously called, or on the server side if the client requested OCSP stapling. Otherwise -1 is returned.

                        "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#history","title":"HISTORY","text":"

                        The SSL_get_tlsext_status_type(), SSL_CTX_get_tlsext_status_type() and SSL_CTX_set_tlsext_status_type() functions were added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/","title":"SSL_CTX_set_tlsext_ticket_key_cb","text":""},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#name","title":"NAME","text":"

                        SSL_CTX_set_tlsext_ticket_key_evp_cb, SSL_CTX_set_tlsext_ticket_key_cb - set a callback for session ticket processing

                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/tls1.h>\n\nint SSL_CTX_set_tlsext_ticket_key_evp_cb(SSL_CTX sslctx,\n    int (*cb)(SSL *s, unsigned char key_name[16],\n              unsigned char iv[EVP_MAX_IV_LENGTH],\n              EVP_CIPHER_CTX *ctx, EVP_MAC_CTX *hctx, int enc));\n

                        The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        int SSL_CTX_set_tlsext_ticket_key_cb(SSL_CTX sslctx,\n    int (*cb)(SSL *s, unsigned char key_name[16],\n              unsigned char iv[EVP_MAX_IV_LENGTH],\n              EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc));\n
                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_tlsext_ticket_key_evp_cb() sets a callback function cb for handling session tickets for the ssl context sslctx. Session tickets, defined in RFC5077 provide an enhanced session resumption capability where the server implementation is not required to maintain per session state. It only applies to TLS and there is no SSLv3 implementation.

                        The callback function cb will be called for every client instigated TLS session when session ticket extension is presented in the TLS hello message. It is the responsibility of this function to create or retrieve the cryptographic parameters and to maintain their state.

                        The OpenSSL library uses your callback function to help implement a common TLS ticket construction state according to RFC5077 Section 4 such that per session state is unnecessary and a small set of cryptographic variables needs to be maintained by the callback function implementation.

                        In order to reuse a session, a TLS client must send the session ticket extension to the server. The client must send exactly one session ticket. The server, through the callback function, either agrees to reuse the session ticket information or it starts a full TLS handshake to create a new session ticket.

                        Before the callback function is started ctx and hctx have been initialised with EVP_CIPHER_CTX_reset(3) and EVP_MAC_CTX_new(3) respectively.

                        For new sessions tickets, when the client doesn't present a session ticket, or an attempted retrieval of the ticket failed, or a renew option was indicated, the callback function will be called with enc equal to 1. The OpenSSL library expects that the function will set an arbitrary name, initialize iv, and set the cipher context ctx and the hash context hctx.

                        The name is 16 characters long and is used as a key identifier.

                        The iv length is the length of the IV of the corresponding cipher. The maximum IV length is EVP_MAX_IV_LENGTH bytes defined in <openssl/evp.h>.

                        The initialization vector iv should be a random value. The cipher context ctx should use the initialisation vector iv. The cipher context can be set using EVP_EncryptInit_ex(3). The hmac context and digest can be set using EVP_MAC_CTX_set_params(3) with the OSSL_MAC_PARAM_KEY and OSSL_MAC_PARAM_DIGEST parameters respectively.

                        When the client presents a session ticket, the callback function with be called with enc set to 0 indicating that the cb function should retrieve a set of parameters. In this case name and iv have already been parsed out of the session ticket. The OpenSSL library expects that the name will be used to retrieve a cryptographic parameters and that the cryptographic context ctx will be set with the retrieved parameters and the initialization vector iv. using a function like EVP_DecryptInit_ex(3). The key material and digest for hctx need to be set using EVP_MAC_CTX_set_params(3) with the OSSL_MAC_PARAM_KEY and OSSL_MAC_PARAM_DIGEST parameters respectively.

                        If the name is still valid but a renewal of the ticket is required the callback function should return 2. The library will call the callback again with an argument of enc equal to 1 to set the new ticket.

                        The return value of the cb function is used by OpenSSL to determine what further processing will occur. The following return values have meaning:

                        • 2

                          This indicates that the ctx and hctx have been set and the session can continue on those parameters. Additionally it indicates that the session ticket is in a renewal period and should be replaced. The OpenSSL library will call cb again with an enc argument of 1 to set the new ticket (see RFC5077 3.3 paragraph 2).

                        • 1

                          This indicates that the ctx and hctx have been set and the session can continue on those parameters.

                        • 0

                          This indicates that it was not possible to set/retrieve a session ticket and the SSL/TLS session will continue by negotiating a set of cryptographic parameters or using the alternate SSL/TLS resumption mechanism, session ids.

                          If called with enc equal to 0 the library will call the cb again to get a new set of parameters.

                        • less than 0

                          This indicates an error.

                        The SSL_CTX_set_tlsext_ticket_key_cb() function is identical to SSL_CTX_set_tlsext_ticket_key_evp_cb() except that it takes a deprecated HMAC_CTX pointer instead of an EVP_MAC_CTX one. Before this callback function is started hctx will have been initialised with EVP_MAC_CTX_new(3) and the digest set with EVP_MAC_CTX_set_params(3). The hctx key material can be set using HMAC_Init_ex(3).

                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#notes","title":"NOTES","text":"

                        Session resumption shortcuts the TLS handshake so that the client certificate negotiation doesn't occur. It makes up for this by storing the client certificate and all other negotiated state information encrypted within the ticket. In a resumed session the applications will have all this state information available exactly as if a full negotiation had occurred.

                        If an attacker can obtain the key used to encrypt a session ticket, they can obtain the master secret for any ticket using that key and decrypt any traffic using that session: even if the cipher suite supports forward secrecy. As a result applications may wish to use multiple keys and avoid using long term keys stored in files.

                        Applications can use longer keys to maintain a consistent level of security. For example if a cipher suite uses 256 bit ciphers but only a 128 bit ticket key the overall security is only 128 bits because breaking the ticket key will enable an attacker to obtain the session keys.

                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#return-values","title":"RETURN VALUES","text":"

                        Returns 1 to indicate the callback function was set and 0 otherwise.

                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#examples","title":"EXAMPLES","text":"

                        Reference Implementation:

                        SSL_CTX_set_tlsext_ticket_key_evp_cb(SSL, ssl_tlsext_ticket_key_cb);\n...\n\nstatic int ssl_tlsext_ticket_key_cb(SSL *s, unsigned char key_name[16],\n                                    unsigned char *iv, EVP_CIPHER_CTX *ctx,\n                                    EVP_MAC_CTX *hctx, int enc)\n{\n    OSSL_PARAM params[3];\n    your_type_t *key; /* something that you need to implement */\n\n    if (enc) { /* create new session */\n        if (RAND_bytes(iv, EVP_MAX_IV_LENGTH) <= 0)\n            return -1; /* insufficient random */\n\n        key = currentkey(); /* something that you need to implement */\n        if (key == NULL) {\n            /* current key doesn't exist or isn't valid */\n            key = createkey(); /*\n                                * Something that you need to implement.\n                                * createkey needs to initialise a name,\n                                * an aes_key, a hmac_key and optionally\n                                * an expire time.\n                                */\n            if (key == NULL) /* key couldn't be created */\n                return 0;\n        }\n        memcpy(key_name, key->name, 16);\n\n        if (EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, key->aes_key,\n                               iv) == 0)\n           return -1; /* error in cipher initialisation */\n\n        params[0] = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,\n                                                      key->hmac_key, 32);\n        params[1] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,\n                                                     \"sha256\", 0);\n        params[2] = OSSL_PARAM_construct_end();\n        if (EVP_MAC_CTX_set_params(hctx, params) == 0)\n           return -1; /* error in mac initialisation */\n\n        return 1;\n\n    } else { /* retrieve session */\n        time_t t = time(NULL);\n        key = findkey(key_name); /* something that you need to implement */\n\n        if (key == NULL || key->expire < t)\n            return 0;\n\n        params[0] = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                                      key->hmac_key, 32);\n        params[1] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,\n                                                     \"sha256\", 0);\n        params[2] = OSSL_PARAM_construct_end();\n        if (EVP_MAC_CTX_set_params(hctx, params) == 0)\n           return -1; /* error in mac initialisation */\n\n        if (EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, key->aes_key,\n                               iv) == 0)\n           return -1; /* error in cipher initialisation */\n\n        if (key->expire < t - RENEW_TIME) { /* RENEW_TIME: implement */\n            /*\n             * return 2 - This session will get a new ticket even though the\n             * current one is still valid.\n             */\n            return 2;\n        }\n        return 1;\n    }\n}\n
                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_set_session(3), SSL_session_reused(3), SSL_CTX_add_session(3), SSL_CTX_sess_number(3), SSL_CTX_sess_set_get_cb(3), SSL_CTX_set_session_id_context(3),

                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#history","title":"HISTORY","text":"

                        The SSL_CTX_set_tlsext_ticket_key_cb() function was deprecated in OpenSSL 3.0.

                        The SSL_CTX_set_tlsext_ticket_key_evp_cb() function was introduced in OpenSSL 3.0.

                        "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/","title":"SSL_CTX_set_tlsext_use_srtp","text":""},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#name","title":"NAME","text":"

                        SSL_CTX_set_tlsext_use_srtp, SSL_set_tlsext_use_srtp, SSL_get_srtp_profiles, SSL_get_selected_srtp_profile - Configure and query SRTP support

                        "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/srtp.h>\n\nint SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles);\nint SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles);\n\nSTACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl);\nSRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);\n
                        "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#description","title":"DESCRIPTION","text":"

                        SRTP is the Secure Real-Time Transport Protocol. OpenSSL implements support for the \"use_srtp\" DTLS extension defined in RFC5764. This provides a mechanism for establishing SRTP keying material, algorithms and parameters using DTLS. This capability may be used as part of an implementation that conforms to RFC5763. OpenSSL does not implement SRTP itself or RFC5763. Note that OpenSSL does not support the use of SRTP Master Key Identifiers (MKIs). Also note that this extension is only supported in DTLS. Any SRTP configuration will be ignored if a TLS connection is attempted.

                        An OpenSSL client wishing to send the \"use_srtp\" extension should call SSL_CTX_set_tlsext_use_srtp() to set its use for all SSL objects subsequently created from an SSL_CTX. Alternatively a client may call SSL_set_tlsext_use_srtp() to set its use for an individual SSL object. The profiles parameters should point to a NUL-terminated, colon delimited list of SRTP protection profile names.

                        The currently supported protection profile names are:

                        • SRTP_AES128_CM_SHA1_80

                          This corresponds to SRTP_AES128_CM_HMAC_SHA1_80 defined in RFC5764.

                        • SRTP_AES128_CM_SHA1_32

                          This corresponds to SRTP_AES128_CM_HMAC_SHA1_32 defined in RFC5764.

                        • SRTP_AEAD_AES_128_GCM

                          This corresponds to the profile of the same name defined in RFC7714.

                        • SRTP_AEAD_AES_256_GCM

                          This corresponds to the profile of the same name defined in RFC7714.

                        Supplying an unrecognised protection profile name will result in an error.

                        An OpenSSL server wishing to support the \"use_srtp\" extension should also call SSL_CTX_set_tlsext_use_srtp() or SSL_set_tlsext_use_srtp() to indicate the protection profiles that it is willing to negotiate.

                        The currently configured list of protection profiles for either a client or a server can be obtained by calling SSL_get_srtp_profiles(). This returns a stack of SRTP_PROTECTION_PROFILE objects. The memory pointed to in the return value of this function should not be freed by the caller.

                        After a handshake has been completed the negotiated SRTP protection profile (if any) can be obtained (on the client or the server) by calling SSL_get_selected_srtp_profile(). This function will return NULL if no SRTP protection profile was negotiated. The memory returned from this function should not be freed by the caller.

                        If an SRTP protection profile has been successfully negotiated then the SRTP keying material (on both the client and server) should be obtained via a call to SSL_export_keying_material(3). This call should provide a label value of \"EXTRACTOR-dtls_srtp\" and a NULL context value (use_context is 0). The total length of keying material obtained should be equal to two times the sum of the master key length and the salt length as defined for the protection profile in use. This provides the client write master key, the server write master key, the client write master salt and the server write master salt in that order.

                        "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_tlsext_use_srtp() and SSL_set_tlsext_use_srtp() return 0 on success or 1 on error.

                        SSL_get_srtp_profiles() returns a stack of SRTP_PROTECTION_PROFILE objects on success or NULL on error or if no protection profiles have been configured.

                        SSL_get_selected_srtp_profile() returns a pointer to an SRTP_PROTECTION_PROFILE object if one has been negotiated or NULL otherwise.

                        "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_export_keying_material(3)

                        "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/","title":"SSL_CTX_set_tmp_dh_callback","text":""},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#name","title":"NAME","text":"

                        SSL_CTX_set_dh_auto, SSL_set_dh_auto, SSL_CTX_set0_tmp_dh_pkey, SSL_set0_tmp_dh_pkey, SSL_CTX_set_tmp_dh_callback, SSL_CTX_set_tmp_dh, SSL_set_tmp_dh_callback, SSL_set_tmp_dh - handle DH keys for ephemeral key exchange

                        "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_CTX_set_dh_auto(SSL_CTX *ctx, int onoff);\nlong SSL_set_dh_auto(SSL *s, int onoff);\nint SSL_CTX_set0_tmp_dh_pkey(SSL_CTX *ctx, EVP_PKEY *dhpkey);\nint SSL_set0_tmp_dh_pkey(SSL *s, EVP_PKEY *dhpkey);\n

                        The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,\n                                 DH *(*tmp_dh_callback)(SSL *ssl, int is_export,\n                                                        int keylength));\nlong SSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh);\n\nvoid SSL_set_tmp_dh_callback(SSL *ctx,\n                             DH *(*tmp_dh_callback)(SSL *ssl, int is_export,\n                                                    int keylength));\nlong SSL_set_tmp_dh(SSL *ssl, DH *dh);\n
                        "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#description","title":"DESCRIPTION","text":"

                        The functions described on this page are relevant for servers only.

                        Some ciphersuites may use ephemeral Diffie-Hellman (DH) key exchange. In these cases, the session data is negotiated using the ephemeral/temporary DH key and the key supplied and certified by the certificate chain is only used for signing. Anonymous ciphers (without a permanent server key) also use ephemeral DH keys.

                        Using ephemeral DH key exchange yields forward secrecy as the connection can only be decrypted when the DH key is known. By generating a temporary DH key inside the server application that is lost when the application is left, it becomes impossible for an attacker to decrypt past sessions, even if they get hold of the normal (certified) key, as this key was only used for signing.

                        In order to perform a DH key exchange the server must use a DH group (DH parameters) and generate a DH key. The server will always generate a new DH key during the negotiation.

                        As generating DH parameters is extremely time consuming, an application should not generate the parameters on the fly. DH parameters can be reused, as the actual key is newly generated during the negotiation.

                        Typically applications should use well known DH parameters that have built-in support in OpenSSL. The macros SSL_CTX_set_dh_auto() and SSL_set_dh_auto() configure OpenSSL to use the default built-in DH parameters for the SSL_CTX and SSL objects respectively. Passing a value of 1 in the onoff parameter switches the feature on, and passing a value of 0 switches it off. The default setting is off.

                        If \"auto\" DH parameters are switched on then the parameters will be selected to be consistent with the size of the key associated with the server's certificate. If there is no certificate (e.g. for PSK ciphersuites), then it it will be consistent with the size of the negotiated symmetric cipher key.

                        Applications may supply their own DH parameters instead of using the built-in values. This approach is discouraged and applications should in preference use the built-in parameter support described above. Applications wishing to supply their own DH parameters should call SSL_CTX_set0_tmp_dh_pkey() or SSL_set0_tmp_dh_pkey() to supply the parameters for the SSL_CTX or SSL respectively. The parameters should be supplied in the dhpkey argument as an EVP_PKEY containing DH parameters. Ownership of the dhpkey value is passed to the SSL_CTX or SSL object as a result of this call, and so the caller should not free it if the function call is successful.

                        The deprecated macros SSL_CTX_set_tmp_dh() and SSL_set_tmp_dh() do the same thing as SSL_CTX_set0_tmp_dh_pkey() and SSL_set0_tmp_dh_pkey() except that the DH parameters are supplied in a DH object instead in the dh argument, and ownership of the DH object is retained by the application. Applications should use \"auto\" parameters instead, or call SSL_CTX_set0_tmp_dh_pkey() or SSL_set0_tmp_dh_pkey() as appropriate.

                        An application may instead specify the DH parameters via a callback function using the functions SSL_CTX_set_tmp_dh_callback() or SSL_set_tmp_dh_callback() to set the callback for the SSL_CTX or SSL object respectively. These functions are deprecated. Applications should instead use \"auto\" parameters, or specify the parameters via SSL_CTX_set0_tmp_dh_pkey() or SSL_set0_tmp_dh_pkey() as appropriate.

                        The callback will be invoked during a connection when DH parameters are required. The SSL object for the current connection is supplied as an argument. Previous versions of OpenSSL used the is_export and keylength arguments to control parameter generation for export and non-export cipher suites. Modern OpenSSL does not support export ciphersuites and so these arguments are unused and can be ignored by the callback. The callback should return the parameters to be used in a DH object. Ownership of the DH object is retained by the application and should later be freed.

                        "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#return-values","title":"RETURN VALUES","text":"

                        All of these functions/macros return 1 for success or 0 on error.

                        "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_cipher_list(3), SSL_CTX_set_options(3), openssl-ciphers(1), openssl-dhparam(1)

                        "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_tmp_ecdh/","title":"SSL_CTX_set_tmp_ecdh","text":""},{"location":"man3/SSL_CTX_set_tmp_ecdh/#name","title":"NAME","text":"

                        SSL_CTX_set_tmp_ecdh, SSL_set_tmp_ecdh, SSL_CTX_set_ecdh_auto, SSL_set_ecdh_auto - handle ECDH keys for ephemeral key exchange

                        "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ecdh);\nlong SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ecdh);\n\nlong SSL_CTX_set_ecdh_auto(SSL_CTX *ctx, int state);\nlong SSL_set_ecdh_auto(SSL *ssl, int state);\n
                        "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_tmp_ecdh() sets ECDH parameters to be used to be ecdh. The key is inherited by all ssl objects created from ctx. This macro is deprecated in favor of SSL_CTX_set1_groups(3).

                        SSL_set_tmp_ecdh() sets the parameters only for ssl. This macro is deprecated in favor of SSL_set1_groups(3).

                        SSL_CTX_set_ecdh_auto() and SSL_set_ecdh_auto() are deprecated and have no effect.

                        "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_tmp_ecdh() and SSL_set_tmp_ecdh() return 1 on success and 0 on failure.

                        "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set1_curves(3), SSL_CTX_set_cipher_list(3), SSL_CTX_set_options(3), SSL_CTX_set_tmp_dh_callback(3), openssl-ciphers(1), openssl-ecparam(1)

                        "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_set_verify/","title":"SSL_CTX_set_verify","text":""},{"location":"man3/SSL_CTX_set_verify/#name","title":"NAME","text":"

                        SSL_get_ex_data_X509_STORE_CTX_idx, SSL_CTX_set_verify, SSL_set_verify, SSL_CTX_set_verify_depth, SSL_set_verify_depth, SSL_verify_cb, SSL_verify_client_post_handshake, SSL_set_post_handshake_auth, SSL_CTX_set_post_handshake_auth - set various SSL/TLS parameters for peer certificate verification

                        "},{"location":"man3/SSL_CTX_set_verify/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\ntypedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx);\n\nvoid SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb verify_callback);\nvoid SSL_set_verify(SSL *ssl, int mode, SSL_verify_cb verify_callback);\nSSL_get_ex_data_X509_STORE_CTX_idx(void);\n\nvoid SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth);\nvoid SSL_set_verify_depth(SSL *ssl, int depth);\n\nint SSL_verify_client_post_handshake(SSL *ssl);\nvoid SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val);\nvoid SSL_set_post_handshake_auth(SSL *ssl, int val);\n
                        "},{"location":"man3/SSL_CTX_set_verify/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_verify() sets the verification flags for ctx to be mode and specifies the verify_callback function to be used. If no callback function shall be specified, the NULL pointer can be used for verify_callback.

                        SSL_set_verify() sets the verification flags for ssl to be mode and specifies the verify_callback function to be used. If no callback function shall be specified, the NULL pointer can be used for verify_callback. In this case last verify_callback set specifically for this ssl remains. If no special callback was set before, the default callback for the underlying ctx is used, that was valid at the time ssl was created with SSL_new(3). Within the callback function, SSL_get_ex_data_X509_STORE_CTX_idx can be called to get the data index of the current SSL object that is doing the verification.

                        In client mode verify_callback may also call the SSL_set_retry_verify(3) function on the SSL object set in the x509_store_ctx ex data (see SSL_get_ex_data_X509_STORE_CTX_idx(3)) and return 1. This would be typically done in case the certificate verification was not yet able to succeed. This makes the handshake suspend and return control to the calling application with SSL_ERROR_WANT_RETRY_VERIFY. The application can for instance fetch further certificates or cert status information needed for the verification. Calling SSL_connect(3) again resumes the connection attempt by retrying the server certificate verification step. This process may even be repeated if need be. Note that the handshake may still be aborted if a subsequent invocation of the callback (e.g., at a lower depth, or for a separate error condition) returns 0.

                        SSL_CTX_set_verify_depth() sets the maximum depth for the certificate chain verification that shall be allowed for ctx.

                        SSL_set_verify_depth() sets the maximum depth for the certificate chain verification that shall be allowed for ssl.

                        SSL_CTX_set_post_handshake_auth() and SSL_set_post_handshake_auth() enable the Post-Handshake Authentication extension to be added to the ClientHello such that post-handshake authentication can be requested by the server. If val is 0 then the extension is not sent, otherwise it is. By default the extension is not sent. A certificate callback will need to be set via SSL_CTX_set_client_cert_cb() if no certificate is provided at initialization.

                        SSL_verify_client_post_handshake() causes a CertificateRequest message to be sent by a server on the given ssl connection. The SSL_VERIFY_PEER flag must be set; the SSL_VERIFY_POST_HANDSHAKE flag is optional.

                        "},{"location":"man3/SSL_CTX_set_verify/#notes","title":"NOTES","text":"

                        The verification of certificates can be controlled by a set of logically or'ed mode flags:

                        • SSL_VERIFY_NONE

                          Server mode: the server will not send a client certificate request to the client, so the client will not send a certificate.

                          Client mode: if not using an anonymous cipher (by default disabled), the server will send a certificate which will be checked. The result of the certificate verification process can be checked after the TLS/SSL handshake using the SSL_get_verify_result(3) function. The handshake will be continued regardless of the verification result.

                        • SSL_VERIFY_PEER

                          Server mode: the server sends a client certificate request to the client. The certificate returned (if any) is checked. If the verification process fails, the TLS/SSL handshake is immediately terminated with an alert message containing the reason for the verification failure. The behaviour can be controlled by the additional SSL_VERIFY_FAIL_IF_NO_PEER_CERT, SSL_VERIFY_CLIENT_ONCE and SSL_VERIFY_POST_HANDSHAKE flags.

                          Client mode: the server certificate is verified. If the verification process fails, the TLS/SSL handshake is immediately terminated with an alert message containing the reason for the verification failure. If no server certificate is sent, because an anonymous cipher is used, SSL_VERIFY_PEER is ignored.

                        • SSL_VERIFY_FAIL_IF_NO_PEER_CERT

                          Server mode: if the client did not return a certificate, the TLS/SSL handshake is immediately terminated with a \"handshake failure\" alert. This flag must be used together with SSL_VERIFY_PEER.

                          Client mode: ignored (see BUGS)

                        • SSL_VERIFY_CLIENT_ONCE

                          Server mode: only request a client certificate once during the connection. Do not ask for a client certificate again during renegotiation or post-authentication if a certificate was requested during the initial handshake. This flag must be used together with SSL_VERIFY_PEER.

                          Client mode: ignored (see BUGS)

                        • SSL_VERIFY_POST_HANDSHAKE

                          Server mode: the server will not send a client certificate request during the initial handshake, but will send the request via SSL_verify_client_post_handshake(). This allows the SSL_CTX or SSL to be configured for post-handshake peer verification before the handshake occurs. This flag must be used together with SSL_VERIFY_PEER. TLSv1.3 only; no effect on pre-TLSv1.3 connections.

                          Client mode: ignored (see BUGS)

                        If the mode is SSL_VERIFY_NONE none of the other flags may be set.

                        If verification flags are not modified explicitly by SSL_CTX_set_verify() or SSL_set_verify(), the default value will be SSL_VERIFY_NONE.

                        The actual verification procedure is performed either using the built-in verification procedure or using another application provided verification function set with SSL_CTX_set_cert_verify_callback(3). The following descriptions apply in the case of the built-in procedure. An application provided procedure also has access to the verify depth information and the verify_callback() function, but the way this information is used may be different.

                        SSL_CTX_set_verify_depth() and SSL_set_verify_depth() set a limit on the number of certificates between the end-entity and trust-anchor certificates. Neither the end-entity nor the trust-anchor certificates count against depth. If the certificate chain needed to reach a trusted issuer is longer than depth+2, X509_V_ERR_CERT_CHAIN_TOO_LONG will be issued. The depth count is \"level 0:peer certificate\", \"level 1: CA certificate\", \"level 2: higher level CA certificate\", and so on. Setting the maximum depth to 2 allows the levels 0, 1, 2 and 3 (0 being the end-entity and 3 the trust-anchor). The default depth limit is 100, allowing for the peer certificate, at most 100 intermediate CA certificates and a final trust anchor certificate.

                        The verify_callback function is used to control the behaviour when the SSL_VERIFY_PEER flag is set. It must be supplied by the application and receives two arguments: preverify_ok indicates, whether the verification of the certificate in question was passed (preverify_ok=1) or not (preverify_ok=0). x509_ctx is a pointer to the complete context used for the certificate chain verification.

                        The certificate chain is checked starting with the deepest nesting level (the root CA certificate) and worked upward to the peer's certificate. At each level signatures and issuer attributes are checked. Whenever a verification error is found, the error number is stored in x509_ctx and verify_callback is called with preverify_ok=0. By applying X509_CTX_store_* functions verify_callback can locate the certificate in question and perform additional steps (see EXAMPLES). If no error is found for a certificate, verify_callback is called with preverify_ok=1 before advancing to the next level.

                        The return value of verify_callback controls the strategy of the further verification process. If verify_callback returns 0, the verification process is immediately stopped with \"verification failed\" state. If SSL_VERIFY_PEER is set, a verification failure alert is sent to the peer and the TLS/SSL handshake is terminated. If verify_callback returns 1, the verification process is continued. If verify_callback always returns 1, the TLS/SSL handshake will not be terminated with respect to verification failures and the connection will be established. The calling process can however retrieve the error code of the last verification error using SSL_get_verify_result(3) or by maintaining its own error storage managed by verify_callback.

                        If no verify_callback is specified, the default callback will be used. Its return value is identical to preverify_ok, so that any verification failure will lead to a termination of the TLS/SSL handshake with an alert message, if SSL_VERIFY_PEER is set.

                        After calling SSL_set_post_handshake_auth(), the client will need to add a certificate or certificate callback to its configuration before it can successfully authenticate. This must be called before SSL_connect().

                        SSL_verify_client_post_handshake() requires that verify flags have been previously set, and that a client sent the post-handshake authentication extension. When the client returns a certificate the verify callback will be invoked. A write operation must take place for the Certificate Request to be sent to the client, this can be done with SSL_do_handshake() or SSL_write_ex(). Only one certificate request may be outstanding at any time.

                        When post-handshake authentication occurs, a refreshed NewSessionTicket message is sent to the client.

                        "},{"location":"man3/SSL_CTX_set_verify/#bugs","title":"BUGS","text":"

                        In client mode, it is not checked whether the SSL_VERIFY_PEER flag is set, but whether any flags other than SSL_VERIFY_NONE are set. This can lead to unexpected behaviour if SSL_VERIFY_PEER and other flags are not used as required.

                        "},{"location":"man3/SSL_CTX_set_verify/#return-values","title":"RETURN VALUES","text":"

                        The SSL*_set_verify*() functions do not provide diagnostic information.

                        The SSL_verify_client_post_handshake() function returns 1 if the request succeeded, and 0 if the request failed. The error stack can be examined to determine the failure reason.

                        "},{"location":"man3/SSL_CTX_set_verify/#examples","title":"EXAMPLES","text":"

                        The following code sequence realizes an example verify_callback function that will always continue the TLS/SSL handshake regardless of verification failure, if wished. The callback realizes a verification depth limit with more informational output.

                        All verification errors are printed; information about the certificate chain is printed on request. The example is realized for a server that does allow but not require client certificates.

                        The example makes use of the ex_data technique to store application data into/retrieve application data from the SSL structure (see CRYPTO_get_ex_new_index(3), SSL_get_ex_data_X509_STORE_CTX_idx(3)).

                        ...\ntypedef struct {\n  int verbose_mode;\n  int verify_depth;\n  int always_continue;\n} mydata_t;\nint mydata_index;\n\n...\nstatic int verify_callback(int preverify_ok, X509_STORE_CTX *ctx)\n{\n    char    buf[256];\n    X509   *err_cert;\n    int     err, depth;\n    SSL    *ssl;\n    mydata_t *mydata;\n\n    err_cert = X509_STORE_CTX_get_current_cert(ctx);\n    err = X509_STORE_CTX_get_error(ctx);\n    depth = X509_STORE_CTX_get_error_depth(ctx);\n\n    /*\n     * Retrieve the pointer to the SSL of the connection currently treated\n     * and the application specific data stored into the SSL object.\n     */\n    ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());\n    mydata = SSL_get_ex_data(ssl, mydata_index);\n\n    X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256);\n\n    /*\n     * Catch a too long certificate chain. The depth limit set using\n     * SSL_CTX_set_verify_depth() is by purpose set to \"limit+1\" so\n     * that whenever the \"depth>verify_depth\" condition is met, we\n     * have violated the limit and want to log this error condition.\n     * We must do it here, because the CHAIN_TOO_LONG error would not\n     * be found explicitly; only errors introduced by cutting off the\n     * additional certificates would be logged.\n     */\n    if (depth > mydata->verify_depth) {\n        preverify_ok = 0;\n        err = X509_V_ERR_CERT_CHAIN_TOO_LONG;\n        X509_STORE_CTX_set_error(ctx, err);\n    }\n    if (!preverify_ok) {\n        printf(\"verify error:num=%d:%s:depth=%d:%s\\n\", err,\n               X509_verify_cert_error_string(err), depth, buf);\n    } else if (mydata->verbose_mode) {\n        printf(\"depth=%d:%s\\n\", depth, buf);\n    }\n\n    /*\n     * At this point, err contains the last verification error. We can use\n     * it for something special\n     */\n    if (!preverify_ok && (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)) {\n        X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, 256);\n        printf(\"issuer= %s\\n\", buf);\n    }\n\n    if (mydata->always_continue)\n        return 1;\n    else\n        return preverify_ok;\n}\n...\n\nmydata_t mydata;\n\n...\nmydata_index = SSL_get_ex_new_index(0, \"mydata index\", NULL, NULL, NULL);\n\n...\nSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE,\n                   verify_callback);\n\n/*\n * Let the verify_callback catch the verify_depth error so that we get\n * an appropriate error in the logfile.\n */\nSSL_CTX_set_verify_depth(verify_depth + 1);\n\n/*\n * Set up the SSL specific data into \"mydata\" and store it into th SSL\n * structure.\n */\nmydata.verify_depth = verify_depth; ...\nSSL_set_ex_data(ssl, mydata_index, &mydata);\n\n...\nSSL_accept(ssl);       /* check of success left out for clarity */\nif (peer = SSL_get_peer_certificate(ssl)) {\n    if (SSL_get_verify_result(ssl) == X509_V_OK) {\n        /* The client sent a certificate which verified OK */\n    }\n}\n
                        "},{"location":"man3/SSL_CTX_set_verify/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_new(3), SSL_CTX_get_verify_mode(3), SSL_get_verify_result(3), SSL_CTX_load_verify_locations(3), SSL_get_peer_certificate(3), SSL_CTX_set_cert_verify_callback(3), SSL_get_ex_data_X509_STORE_CTX_idx(3), SSL_CTX_set_client_cert_cb(3), CRYPTO_get_ex_new_index(3)

                        "},{"location":"man3/SSL_CTX_set_verify/#history","title":"HISTORY","text":"

                        The SSL_VERIFY_POST_HANDSHAKE option, and the SSL_verify_client_post_handshake() and SSL_set_post_handshake_auth() functions were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_CTX_set_verify/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_use_certificate/","title":"SSL_CTX_use_certificate","text":""},{"location":"man3/SSL_CTX_use_certificate/#name","title":"NAME","text":"

                        SSL_CTX_use_certificate, SSL_CTX_use_certificate_ASN1, SSL_CTX_use_certificate_file, SSL_use_certificate, SSL_use_certificate_ASN1, SSL_use_certificate_file, SSL_CTX_use_certificate_chain_file, SSL_use_certificate_chain_file, SSL_CTX_use_PrivateKey, SSL_CTX_use_PrivateKey_ASN1, SSL_CTX_use_PrivateKey_file, SSL_CTX_use_RSAPrivateKey, SSL_CTX_use_RSAPrivateKey_ASN1, SSL_CTX_use_RSAPrivateKey_file, SSL_use_PrivateKey_file, SSL_use_PrivateKey_ASN1, SSL_use_PrivateKey, SSL_use_RSAPrivateKey, SSL_use_RSAPrivateKey_ASN1, SSL_use_RSAPrivateKey_file, SSL_CTX_check_private_key, SSL_check_private_key, SSL_CTX_use_cert_and_key, SSL_use_cert_and_key - load certificate and key data

                        "},{"location":"man3/SSL_CTX_use_certificate/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);\nint SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);\nint SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);\nint SSL_use_certificate(SSL *ssl, X509 *x);\nint SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);\nint SSL_use_certificate_file(SSL *ssl, const char *file, int type);\n\nint SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file);\nint SSL_use_certificate_chain_file(SSL *ssl, const char *file);\n\nint SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);\nint SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, const unsigned char *d,\n                                long len);\nint SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);\nint SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);\nint SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);\nint SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);\nint SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);\nint SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len);\nint SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);\nint SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);\nint SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len);\nint SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);\n\nint SSL_CTX_check_private_key(const SSL_CTX *ctx);\nint SSL_check_private_key(const SSL *ssl);\n\nint SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x, EVP_PKEY *pkey, STACK_OF(X509) *chain, int override);\nint SSL_use_cert_and_key(SSL *ssl, X509 *x, EVP_PKEY *pkey, STACK_OF(X509) *chain, int override);\n
                        "},{"location":"man3/SSL_CTX_use_certificate/#description","title":"DESCRIPTION","text":"

                        These functions load the certificates and private keys into the SSL_CTX or SSL object, respectively.

                        The SSL_CTX_* class of functions loads the certificates and keys into the SSL_CTX object ctx. The information is passed to SSL objects ssl created from ctx with SSL_new(3) by copying, so that changes applied to ctx do not propagate to already existing SSL objects.

                        The SSL_* class of functions only loads certificates and keys into a specific SSL object. The specific information is kept, when SSL_clear(3) is called for this SSL object.

                        SSL_CTX_use_certificate() loads the certificate x into ctx, SSL_use_certificate() loads x into ssl. The rest of the certificates needed to form the complete certificate chain can be specified using the SSL_CTX_add_extra_chain_cert(3) function. On success the reference counter of the x is incremented.

                        SSL_CTX_use_certificate_ASN1() loads the ASN1 encoded certificate from the memory location d (with length len) into ctx, SSL_use_certificate_ASN1() loads the ASN1 encoded certificate into ssl.

                        SSL_CTX_use_certificate_file() loads the first certificate stored in file into ctx. The formatting type of the certificate must be specified from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. SSL_use_certificate_file() loads the certificate from file into ssl. See the NOTES section on why SSL_CTX_use_certificate_chain_file() should be preferred.

                        SSL_CTX_use_certificate_chain_file() loads a certificate chain from file into ctx. The certificates must be in PEM format and must be sorted starting with the subject's certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA. SSL_use_certificate_chain_file() is similar except it loads the certificate chain into ssl.

                        SSL_CTX_use_PrivateKey() adds pkey as private key to ctx. SSL_CTX_use_RSAPrivateKey() adds the private key rsa of type RSA to ctx. SSL_use_PrivateKey() adds pkey as private key to ssl; SSL_use_RSAPrivateKey() adds rsa as private key of type RSA to ssl. If a certificate has already been set and the private key does not belong to the certificate an error is returned. To change a [certificate/private-key] pair, the new certificate needs to be set first with SSL_use_certificate() or SSL_CTX_use_certificate() before setting the private key with SSL_CTX_use_PrivateKey() or SSL_use_PrivateKey(). On success the reference counter of the pkey/rsa is incremented.

                        SSL_CTX_use_cert_and_key() and SSL_use_cert_and_key() assign the X.509 certificate x, private key key, and certificate chain onto the corresponding ssl or ctx. The pkey argument must be the private key of the X.509 certificate x. If the override argument is 0, then x, pkey and chain are set only if all were not previously set. If override is non-0, then the certificate, private key and chain certs are always set. If pkey is NULL, then the public key of x is used as the private key. This is intended to be used with hardware (via the ENGINE interface) that stores the private key securely, such that it cannot be accessed by OpenSSL. The reference count of the public key is incremented (twice if there is no private key); it is not copied nor duplicated. This allows all private key validations checks to succeed without an actual private key being assigned via SSL_CTX_use_PrivateKey(), etc.

                        SSL_CTX_use_PrivateKey_ASN1() adds the private key of type pk stored at memory location d (length len) to ctx. SSL_CTX_use_RSAPrivateKey_ASN1() adds the private key of type RSA stored at memory location d (length len) to ctx. SSL_use_PrivateKey_ASN1() and SSL_use_RSAPrivateKey_ASN1() add the private key to ssl.

                        SSL_CTX_use_PrivateKey_file() adds the first private key found in file to ctx. The formatting type of the private key must be specified from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. SSL_CTX_use_RSAPrivateKey_file() adds the first private RSA key found in file to ctx. SSL_use_PrivateKey_file() adds the first private key found in file to ssl; SSL_use_RSAPrivateKey_file() adds the first private RSA key found to ssl.

                        SSL_CTX_check_private_key() checks the consistency of a private key with the corresponding certificate loaded into ctx. If more than one key/certificate pair (RSA/DSA) is installed, the last item installed will be checked. If e.g. the last item was an RSA certificate or key, the RSA key/certificate pair will be checked. SSL_check_private_key() performs the same check for ssl. If no key/certificate was explicitly added for this ssl, the last item added into ctx will be checked.

                        "},{"location":"man3/SSL_CTX_use_certificate/#notes","title":"NOTES","text":"

                        The internal certificate store of OpenSSL can hold several private key/certificate pairs at a time. The certificate used depends on the cipher selected, see also SSL_CTX_set_cipher_list(3).

                        When reading certificates and private keys from file, files of type SSL_FILETYPE_ASN1 (also known as DER, binary encoding) can only contain one certificate or private key, consequently SSL_CTX_use_certificate_chain_file() is only applicable to PEM formatting. Files of type SSL_FILETYPE_PEM can contain more than one item.

                        SSL_CTX_use_certificate_chain_file() adds the first certificate found in the file to the certificate store. The other certificates are added to the store of chain certificates using SSL_CTX_add1_chain_cert(3). Note: versions of OpenSSL before 1.0.2 only had a single certificate chain store for all certificate types, OpenSSL 1.0.2 and later have a separate chain store for each type. SSL_CTX_use_certificate_chain_file() should be used instead of the SSL_CTX_use_certificate_file() function in order to allow the use of complete certificate chains even when no trusted CA storage is used or when the CA issuing the certificate shall not be added to the trusted CA storage.

                        If additional certificates are needed to complete the chain during the TLS negotiation, CA certificates are additionally looked up in the locations of trusted CA certificates, see SSL_CTX_load_verify_locations(3).

                        The private keys loaded from file can be encrypted. In order to successfully load encrypted keys, a function returning the passphrase must have been supplied, see SSL_CTX_set_default_passwd_cb(3). (Certificate files might be encrypted as well from the technical point of view, it however does not make sense as the data in the certificate is considered public anyway.)

                        All of the functions to set a new certificate will replace any existing certificate of the same type that has already been set. Similarly all of the functions to set a new private key will replace any private key that has already been set. Applications should call SSL_CTX_check_private_key(3) or SSL_check_private_key(3) as appropriate after loading a new certificate and private key to confirm that the certificate and key match.

                        "},{"location":"man3/SSL_CTX_use_certificate/#return-values","title":"RETURN VALUES","text":"

                        On success, the functions return 1. Otherwise check out the error stack to find out the reason.

                        "},{"location":"man3/SSL_CTX_use_certificate/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_new(3), SSL_clear(3), SSL_CTX_load_verify_locations(3), SSL_CTX_set_default_passwd_cb(3), SSL_CTX_set_cipher_list(3), SSL_CTX_set_client_CA_list(3), SSL_CTX_set_client_cert_cb(3), SSL_CTX_add_extra_chain_cert(3)

                        "},{"location":"man3/SSL_CTX_use_certificate/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/","title":"SSL_CTX_use_psk_identity_hint","text":""},{"location":"man3/SSL_CTX_use_psk_identity_hint/#name","title":"NAME","text":"

                        SSL_psk_server_cb_func, SSL_psk_find_session_cb_func, SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint, SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback, SSL_CTX_set_psk_find_session_callback, SSL_set_psk_find_session_callback - set PSK identity hint to use

                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\ntypedef int (*SSL_psk_find_session_cb_func)(SSL *ssl,\n                                            const unsigned char *identity,\n                                            size_t identity_len,\n                                            SSL_SESSION **sess);\n\n\nvoid SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx,\n                                           SSL_psk_find_session_cb_func cb);\nvoid SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb);\n\ntypedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl,\n                                               const char *identity,\n                                               unsigned char *psk,\n                                               unsigned int max_psk_len);\n\nint SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);\nint SSL_use_psk_identity_hint(SSL *ssl, const char *hint);\n\nvoid SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb);\nvoid SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb);\n
                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#description","title":"DESCRIPTION","text":"

                        A server application wishing to use TLSv1.3 PSKs should set a callback using either SSL_CTX_set_psk_find_session_callback() or SSL_set_psk_find_session_callback() as appropriate.

                        The callback function is given a pointer to the SSL connection in ssl and an identity in identity of length identity_len. The callback function should identify an SSL_SESSION object that provides the PSK details and store it in *sess. The SSL_SESSION object should, as a minimum, set the master key, the ciphersuite and the protocol version. See SSL_CTX_set_psk_use_session_callback(3) for details.

                        It is also possible for the callback to succeed but not supply a PSK. In this case no PSK will be used but the handshake will continue. To do this the callback should return successfully and ensure that *sess is NULL.

                        Identity hints are not relevant for TLSv1.3. A server application wishing to use PSK ciphersuites for TLSv1.2 and below may call SSL_CTX_use_psk_identity_hint() to set the given NUL-terminated PSK identity hint hint for SSL context object ctx. SSL_use_psk_identity_hint() sets the given NUL-terminated PSK identity hint hint for the SSL connection object ssl. If hint is NULL the current hint from ctx or ssl is deleted.

                        In the case where PSK identity hint is NULL, the server does not send the ServerKeyExchange message to the client.

                        A server application wishing to use PSKs for TLSv1.2 and below must provide a callback function which is called when the server receives the ClientKeyExchange message from the client. The purpose of the callback function is to validate the received PSK identity and to fetch the pre-shared key used during the connection setup phase. The callback is set using the functions SSL_CTX_set_psk_server_callback() or SSL_set_psk_server_callback(). The callback function is given the connection in parameter ssl, NUL-terminated PSK identity sent by the client in parameter identity, and a buffer psk of length max_psk_len bytes where the pre-shared key is to be stored.

                        The callback for use in TLSv1.2 will also work in TLSv1.3 although it is recommended to use SSL_CTX_set_psk_find_session_callback() or SSL_set_psk_find_session_callback() for this purpose instead. If TLSv1.3 has been negotiated then OpenSSL will first check to see if a callback has been set via SSL_CTX_set_psk_find_session_callback() or SSL_set_psk_find_session_callback() and it will use that in preference. If no such callback is present then it will check to see if a callback has been set via SSL_CTX_set_psk_server_callback() or SSL_set_psk_server_callback() and use that. In this case the handshake digest will default to SHA-256 for any returned PSK. TLSv1.3 early data exchanges are possible in PSK connections only with the SSL_psk_find_session_cb_func callback, and are not possible with the SSL_psk_server_cb_func callback.

                        A connection established via a TLSv1.3 PSK will appear as if session resumption has occurred so that SSL_session_reused(3) will return true.

                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return 1 on success, 0 otherwise.

                        Return values from the TLSv1.2 and below server callback are interpreted as follows:

                        • 0

                          PSK identity was not found. An \"unknown_psk_identity\" alert message will be sent and the connection setup fails.

                        • 0

                          PSK identity was found and the server callback has provided the PSK successfully in parameter psk. Return value is the length of psk in bytes. It is an error to return a value greater than max_psk_len.

                          If the PSK identity was not found but the callback instructs the protocol to continue anyway, the callback must provide some random data to psk and return the length of the random data, so the connection will fail with decryption_error before it will be finished completely.

                        The SSL_psk_find_session_cb_func callback should return 1 on success or 0 on failure. In the event of failure the connection setup fails.

                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#notes","title":"NOTES","text":"

                        There are no known security issues with sharing the same PSK between TLSv1.2 (or below) and TLSv1.3. However, the RFC has this note of caution:

                        \"While there is no known way in which the same PSK might produce related output in both versions, only limited analysis has been done. Implementations can ensure safety from cross-protocol related output by not reusing PSKs between TLS 1.3 and TLS 1.2.\"

                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_psk_use_session_callback(3), SSL_set_psk_use_session_callback(3)

                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#history","title":"HISTORY","text":"

                        SSL_CTX_set_psk_find_session_callback() and SSL_set_psk_find_session_callback() were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_CTX_use_serverinfo/","title":"SSL_CTX_use_serverinfo","text":""},{"location":"man3/SSL_CTX_use_serverinfo/#name","title":"NAME","text":"

                        SSL_CTX_use_serverinfo_ex, SSL_CTX_use_serverinfo, SSL_CTX_use_serverinfo_file - use serverinfo extension

                        "},{"location":"man3/SSL_CTX_use_serverinfo/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version,\n                              const unsigned char *serverinfo,\n                              size_t serverinfo_length);\n\nint SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,\n                           size_t serverinfo_length);\n\nint SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file);\n
                        "},{"location":"man3/SSL_CTX_use_serverinfo/#description","title":"DESCRIPTION","text":"

                        These functions load \"serverinfo\" TLS extensions into the SSL_CTX. A \"serverinfo\" extension is returned in response to an empty ClientHello Extension.

                        SSL_CTX_use_serverinfo_ex() loads one or more serverinfo extensions from a byte array into ctx. The version parameter specifies the format of the byte array provided in *serverinfo which is of length serverinfo_length.

                        If version is SSL_SERVERINFOV2 then the extensions in the array must consist of a 4-byte context, a 2-byte Extension Type, a 2-byte length, and then length bytes of extension_data. The context and type values have the same meaning as for SSL_CTX_add_custom_ext(3). If serverinfo is being loaded for extensions to be added to a Certificate message, then the extension will only be added for the first certificate in the message (which is always the end-entity certificate).

                        If version is SSL_SERVERINFOV1 then the extensions in the array must consist of a 2-byte Extension Type, a 2-byte length, and then length bytes of extension_data. The type value has the same meaning as for SSL_CTX_add_custom_ext(3). The following default context value will be used in this case:

                        SSL_EXT_TLS1_2_AND_BELOW_ONLY | SSL_EXT_CLIENT_HELLO\n| SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_IGNORE_ON_RESUMPTION\n

                        SSL_CTX_use_serverinfo() does the same thing as SSL_CTX_use_serverinfo_ex() except that there is no version parameter so a default version of SSL_SERVERINFOV1 is used instead.

                        SSL_CTX_use_serverinfo_file() loads one or more serverinfo extensions from file into ctx. The extensions must be in PEM format. Each extension must be in a format as described above for SSL_CTX_use_serverinfo_ex(). Each PEM extension name must begin with the phrase \"BEGIN SERVERINFOV2 FOR \" for SSL_SERVERINFOV2 data or \"BEGIN SERVERINFO FOR \" for SSL_SERVERINFOV1 data.

                        If more than one certificate (RSA/DSA) is installed using SSL_CTX_use_certificate(), the serverinfo extension will be loaded into the last certificate installed. If e.g. the last item was an RSA certificate, the loaded serverinfo extension data will be loaded for that certificate. To use the serverinfo extension for multiple certificates, SSL_CTX_use_serverinfo() needs to be called multiple times, once after each time a certificate is loaded via a call to SSL_CTX_use_certificate().

                        "},{"location":"man3/SSL_CTX_use_serverinfo/#return-values","title":"RETURN VALUES","text":"

                        On success, the functions return 1. On failure, the functions return 0. Check out the error stack to find out the reason.

                        "},{"location":"man3/SSL_CTX_use_serverinfo/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_CTX_use_serverinfo/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2013-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_free/","title":"SSL_SESSION_free","text":""},{"location":"man3/SSL_SESSION_free/#name","title":"NAME","text":"

                        SSL_SESSION_new, SSL_SESSION_dup, SSL_SESSION_up_ref, SSL_SESSION_free - create, free and manage SSL_SESSION structures

                        "},{"location":"man3/SSL_SESSION_free/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSSL_SESSION *SSL_SESSION_new(void);\nSSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src);\nint SSL_SESSION_up_ref(SSL_SESSION *ses);\nvoid SSL_SESSION_free(SSL_SESSION *session);\n
                        "},{"location":"man3/SSL_SESSION_free/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_new() creates a new SSL_SESSION structure and returns a pointer to it.

                        SSL_SESSION_dup() creates a new SSL_SESSION structure that is a copy of src. The copy is not owned by any cache that src may have been in.

                        SSL_SESSION_up_ref() increments the reference count on the given SSL_SESSION structure.

                        SSL_SESSION_free() decrements the reference count of session and removes the SSL_SESSION structure pointed to by session and frees up the allocated memory, if the reference count has reached 0. If session is NULL nothing is done.

                        "},{"location":"man3/SSL_SESSION_free/#notes","title":"NOTES","text":"

                        SSL_SESSION objects are allocated, when a TLS/SSL handshake operation is successfully completed. Depending on the settings, see SSL_CTX_set_session_cache_mode(3), the SSL_SESSION objects are internally referenced by the SSL_CTX and linked into its session cache. SSL objects may be using the SSL_SESSION object; as a session may be reused, several SSL objects may be using one SSL_SESSION object at the same time. It is therefore crucial to keep the reference count (usage information) correct and not delete a SSL_SESSION object that is still used, as this may lead to program failures due to dangling pointers. These failures may also appear delayed, e.g. when an SSL_SESSION object was completely freed as the reference count incorrectly became 0, but it is still referenced in the internal session cache and the cache list is processed during a SSL_CTX_flush_sessions(3) operation.

                        SSL_SESSION_free() must only be called for SSL_SESSION objects, for which the reference count was explicitly incremented (e.g. by calling SSL_get1_session(), see SSL_get_session(3)) or when the SSL_SESSION object was generated outside a TLS handshake operation, e.g. by using d2i_SSL_SESSION(3). It must not be called on other SSL_SESSION objects, as this would cause incorrect reference counts and therefore program failures.

                        "},{"location":"man3/SSL_SESSION_free/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_new returns a pointer to the newly allocated SSL_SESSION structure or NULL on error.

                        SSL_SESSION_dup returns a pointer to the new copy or NULL on error.

                        SSL_SESSION_up_ref returns 1 on success or 0 on error.

                        "},{"location":"man3/SSL_SESSION_free/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_session(3), SSL_CTX_set_session_cache_mode(3), SSL_CTX_flush_sessions(3), d2i_SSL_SESSION(3)

                        "},{"location":"man3/SSL_SESSION_free/#history","title":"HISTORY","text":"

                        The SSL_SESSION_dup() function was added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_SESSION_free/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_get0_cipher/","title":"SSL_SESSION_get0_cipher","text":""},{"location":"man3/SSL_SESSION_get0_cipher/#name","title":"NAME","text":"

                        SSL_SESSION_get0_cipher, SSL_SESSION_set_cipher - set and retrieve the SSL cipher associated with a session

                        "},{"location":"man3/SSL_SESSION_get0_cipher/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s);\nint SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher);\n
                        "},{"location":"man3/SSL_SESSION_get0_cipher/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_get0_cipher() retrieves the cipher that was used by the connection when the session was created, or NULL if it cannot be determined.

                        The value returned is a pointer to an object maintained within s and should not be released.

                        SSL_SESSION_set_cipher() can be used to set the ciphersuite associated with the SSL_SESSION s to cipher. For example, this could be used to set up a session based PSK (see SSL_CTX_set_psk_use_session_callback(3)).

                        "},{"location":"man3/SSL_SESSION_get0_cipher/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_get0_cipher() returns the SSL_CIPHER associated with the SSL_SESSION or NULL if it cannot be determined.

                        SSL_SESSION_set_cipher() returns 1 on success or 0 on failure.

                        "},{"location":"man3/SSL_SESSION_get0_cipher/#see-also","title":"SEE ALSO","text":"

                        ssl(7), d2i_SSL_SESSION(3), SSL_SESSION_get_time(3), SSL_SESSION_get0_hostname(3), SSL_SESSION_free(3), SSL_CTX_set_psk_use_session_callback(3)

                        "},{"location":"man3/SSL_SESSION_get0_cipher/#history","title":"HISTORY","text":"

                        The SSL_SESSION_get0_cipher() function was added in OpenSSL 1.1.0. The SSL_SESSION_set_cipher() function was added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_SESSION_get0_cipher/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_get0_hostname/","title":"SSL_SESSION_get0_hostname","text":""},{"location":"man3/SSL_SESSION_get0_hostname/#name","title":"NAME","text":"

                        SSL_SESSION_get0_hostname, SSL_SESSION_set1_hostname, SSL_SESSION_get0_alpn_selected, SSL_SESSION_set1_alpn_selected - get and set SNI and ALPN data associated with a session

                        "},{"location":"man3/SSL_SESSION_get0_hostname/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst char *SSL_SESSION_get0_hostname(const SSL_SESSION *s);\nint SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname);\n\nvoid SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s,\n                                    const unsigned char **alpn,\n                                    size_t *len);\nint SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, const unsigned char *alpn,\n                                   size_t len);\n
                        "},{"location":"man3/SSL_SESSION_get0_hostname/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_get0_hostname() retrieves the SNI value that was sent by the client when the session was created if it was accepted by the server and TLSv1.2 or below was negotiated. Otherwise NULL is returned. Note that in TLSv1.3 the SNI hostname is negotiated with each handshake including resumption handshakes and is therefore never associated with the session.

                        The value returned is a pointer to memory maintained within s and should not be free'd.

                        SSL_SESSION_set1_hostname() sets the SNI value for the hostname to a copy of the string provided in hostname.

                        SSL_SESSION_get0_alpn_selected() retrieves the selected ALPN protocol for this session and its associated length in bytes. The returned value of *alpn is a pointer to memory maintained within s and should not be free'd.

                        SSL_SESSION_set1_alpn_selected() sets the ALPN protocol for this session to the value in alpn which should be of length len bytes. A copy of the input value is made, and the caller retains ownership of the memory pointed to by alpn.

                        "},{"location":"man3/SSL_SESSION_get0_hostname/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_get0_hostname() returns either a string or NULL based on if there is the SNI value sent by client.

                        SSL_SESSION_set1_hostname() returns 1 on success or 0 on error.

                        SSL_SESSION_set1_alpn_selected() returns 1 on success or 0 on error.

                        "},{"location":"man3/SSL_SESSION_get0_hostname/#see-also","title":"SEE ALSO","text":"

                        ssl(7), d2i_SSL_SESSION(3), SSL_SESSION_get_time(3), SSL_SESSION_free(3)

                        "},{"location":"man3/SSL_SESSION_get0_hostname/#history","title":"HISTORY","text":"

                        The SSL_SESSION_set1_hostname(), SSL_SESSION_get0_alpn_selected() and SSL_SESSION_set1_alpn_selected() functions were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_SESSION_get0_hostname/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_get0_id_context/","title":"SSL_SESSION_get0_id_context","text":""},{"location":"man3/SSL_SESSION_get0_id_context/#name","title":"NAME","text":"

                        SSL_SESSION_get0_id_context, SSL_SESSION_set1_id_context - get and set the SSL ID context associated with a session

                        "},{"location":"man3/SSL_SESSION_get0_id_context/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s,\n                                                 unsigned int *len);\nint SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,\n                               unsigned int sid_ctx_len);\n
                        "},{"location":"man3/SSL_SESSION_get0_id_context/#description","title":"DESCRIPTION","text":"

                        See SSL_CTX_set_session_id_context(3) for further details on session ID contexts.

                        SSL_SESSION_get0_id_context() returns the ID context associated with the SSL/TLS session s. The length of the ID context is written to *len if len is not NULL.

                        The value returned is a pointer to an object maintained within s and should not be released.

                        SSL_SESSION_set1_id_context() takes a copy of the provided ID context given in sid_ctx and associates it with the session s. The length of the ID context is given by sid_ctx_len which must not exceed SSL_MAX_SID_CTX_LENGTH bytes.

                        "},{"location":"man3/SSL_SESSION_get0_id_context/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_set1_id_context() returns 1 on success or 0 on error.

                        "},{"location":"man3/SSL_SESSION_get0_id_context/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_set_session_id_context(3)

                        "},{"location":"man3/SSL_SESSION_get0_id_context/#history","title":"HISTORY","text":"

                        The SSL_SESSION_get0_id_context() function was added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_SESSION_get0_id_context/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_get0_peer/","title":"SSL_SESSION_get0_peer","text":""},{"location":"man3/SSL_SESSION_get0_peer/#name","title":"NAME","text":"

                        SSL_SESSION_get0_peer - get details about peer's certificate for a session

                        "},{"location":"man3/SSL_SESSION_get0_peer/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nX509 *SSL_SESSION_get0_peer(SSL_SESSION *s);\n
                        "},{"location":"man3/SSL_SESSION_get0_peer/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_get0_peer() returns the peer certificate associated with the session s or NULL if no peer certificate is available. The caller should not free the returned value (unless X509_up_ref(3) has also been called).

                        "},{"location":"man3/SSL_SESSION_get0_peer/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_get0_peer() returns a pointer to the peer certificate or NULL if no peer certificate is available.

                        "},{"location":"man3/SSL_SESSION_get0_peer/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_SESSION_get0_peer/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_get_compress_id/","title":"SSL_SESSION_get_compress_id","text":""},{"location":"man3/SSL_SESSION_get_compress_id/#name","title":"NAME","text":"

                        SSL_SESSION_get_compress_id - get details about the compression associated with a session

                        "},{"location":"man3/SSL_SESSION_get_compress_id/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nunsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);\n
                        "},{"location":"man3/SSL_SESSION_get_compress_id/#description","title":"DESCRIPTION","text":"

                        If compression has been negotiated for an ssl session then SSL_SESSION_get_compress_id() will return the id for the compression method or 0 otherwise. The only built-in supported compression method is zlib which has an id of 1.

                        "},{"location":"man3/SSL_SESSION_get_compress_id/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_get_compress_id() returns the id of the compression method or 0 if none.

                        "},{"location":"man3/SSL_SESSION_get_compress_id/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_SESSION_get_compress_id/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_get_protocol_version/","title":"SSL_SESSION_get_protocol_version","text":""},{"location":"man3/SSL_SESSION_get_protocol_version/#name","title":"NAME","text":"

                        SSL_SESSION_get_protocol_version, SSL_SESSION_set_protocol_version - get and set the session protocol version

                        "},{"location":"man3/SSL_SESSION_get_protocol_version/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_SESSION_get_protocol_version(const SSL_SESSION *s);\nint SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version);\n
                        "},{"location":"man3/SSL_SESSION_get_protocol_version/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_get_protocol_version() returns the protocol version number used by session s.

                        SSL_SESSION_set_protocol_version() sets the protocol version associated with the SSL_SESSION object s to the value version. This value should be a version constant such as TLS1_3_VERSION etc. For example, this could be used to set up a session based PSK (see SSL_CTX_set_psk_use_session_callback(3)).

                        "},{"location":"man3/SSL_SESSION_get_protocol_version/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_get_protocol_version() returns a number indicating the protocol version used for the session; this number matches the constants e.g. TLS1_VERSION, TLS1_2_VERSION or TLS1_3_VERSION.

                        Note that the SSL_SESSION_get_protocol_version() function does not perform a null check on the provided session s pointer.

                        SSL_SESSION_set_protocol_version() returns 1 on success or 0 on failure.

                        "},{"location":"man3/SSL_SESSION_get_protocol_version/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_psk_use_session_callback(3)

                        "},{"location":"man3/SSL_SESSION_get_protocol_version/#history","title":"HISTORY","text":"

                        The SSL_SESSION_get_protocol_version() function was added in OpenSSL 1.1.0. The SSL_SESSION_set_protocol_version() function was added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_SESSION_get_protocol_version/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_get_time/","title":"SSL_SESSION_get_time","text":""},{"location":"man3/SSL_SESSION_get_time/#name","title":"NAME","text":"

                        SSL_SESSION_get_time, SSL_SESSION_set_time, SSL_SESSION_get_timeout, SSL_SESSION_set_timeout, SSL_get_time, SSL_set_time, SSL_get_timeout, SSL_set_timeout - retrieve and manipulate session time and timeout settings

                        "},{"location":"man3/SSL_SESSION_get_time/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_SESSION_get_time(const SSL_SESSION *s);\nlong SSL_SESSION_set_time(SSL_SESSION *s, long tm);\nlong SSL_SESSION_get_timeout(const SSL_SESSION *s);\nlong SSL_SESSION_set_timeout(SSL_SESSION *s, long tm);\n\nlong SSL_get_time(const SSL_SESSION *s);\nlong SSL_set_time(SSL_SESSION *s, long tm);\nlong SSL_get_timeout(const SSL_SESSION *s);\nlong SSL_set_timeout(SSL_SESSION *s, long tm);\n
                        "},{"location":"man3/SSL_SESSION_get_time/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_get_time() returns the time at which the session s was established. The time is given in seconds since the Epoch and therefore compatible to the time delivered by the time() call.

                        SSL_SESSION_set_time() replaces the creation time of the session s with the chosen value tm.

                        SSL_SESSION_get_timeout() returns the timeout value set for session s in seconds.

                        SSL_SESSION_set_timeout() sets the timeout value for session s in seconds to tm.

                        The SSL_get_time(), SSL_set_time(), SSL_get_timeout(), and SSL_set_timeout() functions are synonyms for the SSL_SESSION_*() counterparts.

                        "},{"location":"man3/SSL_SESSION_get_time/#notes","title":"NOTES","text":"

                        Sessions are expired by examining the creation time and the timeout value. Both are set at creation time of the session to the actual time and the default timeout value at creation, respectively, as set by SSL_CTX_set_timeout(3). Using these functions it is possible to extend or shorten the lifetime of the session.

                        "},{"location":"man3/SSL_SESSION_get_time/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_get_time() and SSL_SESSION_get_timeout() return the currently valid values.

                        SSL_SESSION_set_time() and SSL_SESSION_set_timeout() return 1 on success.

                        If any of the function is passed the NULL pointer for the session s, 0 is returned.

                        "},{"location":"man3/SSL_SESSION_get_time/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_timeout(3), SSL_get_default_timeout(3)

                        "},{"location":"man3/SSL_SESSION_get_time/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_has_ticket/","title":"SSL_SESSION_has_ticket","text":""},{"location":"man3/SSL_SESSION_has_ticket/#name","title":"NAME","text":"

                        SSL_SESSION_get0_ticket, SSL_SESSION_has_ticket, SSL_SESSION_get_ticket_lifetime_hint - get details about the ticket associated with a session

                        "},{"location":"man3/SSL_SESSION_has_ticket/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_SESSION_has_ticket(const SSL_SESSION *s);\nunsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s);\nvoid SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick,\n                             size_t *len);\n
                        "},{"location":"man3/SSL_SESSION_has_ticket/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_has_ticket() returns 1 if there is a Session Ticket associated with this session, and 0 otherwise.

                        SSL_SESSION_get_ticket_lifetime_hint returns the lifetime hint in seconds associated with the session ticket.

                        SSL_SESSION_get0_ticket obtains a pointer to the ticket associated with a session. The length of the ticket is written to *len. If tick is non NULL then a pointer to the ticket is written to *tick. The pointer is only valid while the connection is in use. The session (and hence the ticket pointer) may also become invalid as a result of a call to SSL_CTX_flush_sessions().

                        "},{"location":"man3/SSL_SESSION_has_ticket/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_has_ticket() returns 1 if session ticket exists or 0 otherwise.

                        SSL_SESSION_get_ticket_lifetime_hint() returns the number of seconds.

                        "},{"location":"man3/SSL_SESSION_has_ticket/#see-also","title":"SEE ALSO","text":"

                        ssl(7), d2i_SSL_SESSION(3), SSL_SESSION_get_time(3), SSL_SESSION_free(3)

                        "},{"location":"man3/SSL_SESSION_has_ticket/#history","title":"HISTORY","text":"

                        The SSL_SESSION_has_ticket(), SSL_SESSION_get_ticket_lifetime_hint() and SSL_SESSION_get0_ticket() functions were added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_SESSION_has_ticket/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_is_resumable/","title":"SSL_SESSION_is_resumable","text":""},{"location":"man3/SSL_SESSION_is_resumable/#name","title":"NAME","text":"

                        SSL_SESSION_is_resumable - determine whether an SSL_SESSION object can be used for resumption

                        "},{"location":"man3/SSL_SESSION_is_resumable/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_SESSION_is_resumable(const SSL_SESSION *s);\n
                        "},{"location":"man3/SSL_SESSION_is_resumable/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_is_resumable() determines whether an SSL_SESSION object can be used to resume a session or not. Returns 1 if it can or 0 if not. Note that attempting to resume with a non-resumable session will result in a full handshake.

                        "},{"location":"man3/SSL_SESSION_is_resumable/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_is_resumable() returns 1 if the session is resumable or 0 otherwise.

                        "},{"location":"man3/SSL_SESSION_is_resumable/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_session(3), SSL_CTX_sess_set_new_cb(3)

                        "},{"location":"man3/SSL_SESSION_is_resumable/#history","title":"HISTORY","text":"

                        The SSL_SESSION_is_resumable() function was added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_SESSION_is_resumable/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_print/","title":"SSL_SESSION_print","text":""},{"location":"man3/SSL_SESSION_print/#name","title":"NAME","text":"

                        SSL_SESSION_print, SSL_SESSION_print_fp, SSL_SESSION_print_keylog - printf information about a session

                        "},{"location":"man3/SSL_SESSION_print/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses);\nint SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses);\nint SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x);\n
                        "},{"location":"man3/SSL_SESSION_print/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_print() prints summary information about the session provided in ses to the BIO fp.

                        SSL_SESSION_print_fp() does the same as SSL_SESSION_print() except it prints it to the FILE fp.

                        SSL_SESSION_print_keylog() prints session information to the provided BIO <bp> in NSS keylog format.

                        "},{"location":"man3/SSL_SESSION_print/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_print(), SSL_SESSION_print_fp() and SSL_SESSION_print_keylog return 1 on success or 0 on error.

                        "},{"location":"man3/SSL_SESSION_print/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_SESSION_print/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_SESSION_set1_id/","title":"SSL_SESSION_set1_id","text":""},{"location":"man3/SSL_SESSION_set1_id/#name","title":"NAME","text":"

                        SSL_SESSION_get_id, SSL_SESSION_set1_id - get and set the SSL session ID

                        "},{"location":"man3/SSL_SESSION_set1_id/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,\n                                        unsigned int *len);\nint SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,\n                        unsigned int sid_len);\n
                        "},{"location":"man3/SSL_SESSION_set1_id/#description","title":"DESCRIPTION","text":"

                        SSL_SESSION_get_id() returns a pointer to the internal session id value for the session s. The length of the id in bytes is stored in *len. The length may be 0. The caller should not free the returned pointer directly.

                        SSL_SESSION_set1_id() sets the session ID for the ssl SSL/TLS session to sid of length sid_len.

                        "},{"location":"man3/SSL_SESSION_set1_id/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_get_id() returns a pointer to the session id value. SSL_SESSION_set1_id() returns 1 for success and 0 for failure, for example if the supplied session ID length exceeds SSL_MAX_SSL_SESSION_ID_LENGTH.

                        "},{"location":"man3/SSL_SESSION_set1_id/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_SESSION_set1_id/#history","title":"HISTORY","text":"

                        The SSL_SESSION_set1_id() function was added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_SESSION_set1_id/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_accept/","title":"SSL_accept","text":""},{"location":"man3/SSL_accept/#name","title":"NAME","text":"

                        SSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake

                        "},{"location":"man3/SSL_accept/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_accept(SSL *ssl);\n
                        "},{"location":"man3/SSL_accept/#description","title":"DESCRIPTION","text":"

                        SSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. The communication channel must already have been set and assigned to the ssl by setting an underlying BIO.

                        "},{"location":"man3/SSL_accept/#notes","title":"NOTES","text":"

                        The behaviour of SSL_accept() depends on the underlying BIO.

                        If the underlying BIO is blocking, SSL_accept() will only return once the handshake has been finished or an error occurred.

                        If the underlying BIO is nonblocking, SSL_accept() will also return when the underlying BIO could not satisfy the needs of SSL_accept() to continue the handshake, indicating the problem by the return value -1. In this case a call to SSL_get_error() with the return value of SSL_accept() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_accept(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                        "},{"location":"man3/SSL_accept/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

                        • 1

                          The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

                        • <0

                          The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur if action is needed to continue the operation for nonblocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

                        "},{"location":"man3/SSL_accept/#see-also","title":"SEE ALSO","text":"

                        SSL_get_error(3), SSL_connect(3), SSL_shutdown(3), ssl(7), bio(7), SSL_set_connect_state(3), SSL_do_handshake(3), SSL_CTX_new(3)

                        "},{"location":"man3/SSL_accept/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_alert_type_string/","title":"SSL_alert_type_string","text":""},{"location":"man3/SSL_alert_type_string/#name","title":"NAME","text":"

                        SSL_alert_type_string, SSL_alert_type_string_long, SSL_alert_desc_string, SSL_alert_desc_string_long - get textual description of alert information

                        "},{"location":"man3/SSL_alert_type_string/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst char *SSL_alert_type_string(int value);\nconst char *SSL_alert_type_string_long(int value);\n\nconst char *SSL_alert_desc_string(int value);\nconst char *SSL_alert_desc_string_long(int value);\n
                        "},{"location":"man3/SSL_alert_type_string/#description","title":"DESCRIPTION","text":"

                        SSL_alert_type_string() returns a one letter string indicating the type of the alert specified by value.

                        SSL_alert_type_string_long() returns a string indicating the type of the alert specified by value.

                        SSL_alert_desc_string() returns a two letter string as a short form describing the reason of the alert specified by value.

                        SSL_alert_desc_string_long() returns a string describing the reason of the alert specified by value.

                        "},{"location":"man3/SSL_alert_type_string/#notes","title":"NOTES","text":"

                        When one side of an SSL/TLS communication wants to inform the peer about a special situation, it sends an alert. The alert is sent as a special message and does not influence the normal data stream (unless its contents results in the communication being canceled).

                        A warning alert is sent, when a non-fatal error condition occurs. The \"close notify\" alert is sent as a warning alert. Other examples for non-fatal errors are certificate errors (\"certificate expired\", \"unsupported certificate\"), for which a warning alert may be sent. (The sending party may however decide to send a fatal error.) The receiving side may cancel the connection on reception of a warning alert on it discretion.

                        Several alert messages must be sent as fatal alert messages as specified by the TLS RFC. A fatal alert always leads to a connection abort.

                        "},{"location":"man3/SSL_alert_type_string/#return-values","title":"RETURN VALUES","text":"

                        The following strings can occur for SSL_alert_type_string() or SSL_alert_type_string_long():

                        • \"W\"/\"warning\"
                        • \"F\"/\"fatal\"
                        • \"U\"/\"unknown\"

                          This indicates that no support is available for this alert type. Probably value does not contain a correct alert message.

                        The following strings can occur for SSL_alert_desc_string() or SSL_alert_desc_string_long():

                        • \"CN\"/\"close notify\"

                          The connection shall be closed. This is a warning alert.

                        • \"UM\"/\"unexpected message\"

                          An inappropriate message was received. This alert is always fatal and should never be observed in communication between proper implementations.

                        • \"BM\"/\"bad record mac\"

                          This alert is returned if a record is received with an incorrect MAC. This message is always fatal.

                        • \"DF\"/\"decompression failure\"

                          The decompression function received improper input (e.g. data that would expand to excessive length). This message is always fatal.

                        • \"HF\"/\"handshake failure\"

                          Reception of a handshake_failure alert message indicates that the sender was unable to negotiate an acceptable set of security parameters given the options available. This is a fatal error.

                        • \"NC\"/\"no certificate\"

                          A client, that was asked to send a certificate, does not send a certificate (SSLv3 only).

                        • \"BC\"/\"bad certificate\"

                          A certificate was corrupt, contained signatures that did not verify correctly, etc

                        • \"UC\"/\"unsupported certificate\"

                          A certificate was of an unsupported type.

                        • \"CR\"/\"certificate revoked\"

                          A certificate was revoked by its signer.

                        • \"CE\"/\"certificate expired\"

                          A certificate has expired or is not currently valid.

                        • \"CU\"/\"certificate unknown\"

                          Some other (unspecified) issue arose in processing the certificate, rendering it unacceptable.

                        • \"IP\"/\"illegal parameter\"

                          A field in the handshake was out of range or inconsistent with other fields. This is always fatal.

                        • \"DC\"/\"decryption failed\"

                          A TLSCiphertext decrypted in an invalid way: either it wasn't an even multiple of the block length or its padding values, when checked, weren't correct. This message is always fatal.

                        • \"RO\"/\"record overflow\"

                          A TLSCiphertext record was received which had a length more than 2^14+2048 bytes, or a record decrypted to a TLSCompressed record with more than 2^14+1024 bytes. This message is always fatal.

                        • \"CA\"/\"unknown CA\"

                          A valid certificate chain or partial chain was received, but the certificate was not accepted because the CA certificate could not be located or couldn't be matched with a known, trusted CA. This message is always fatal.

                        • \"AD\"/\"access denied\"

                          A valid certificate was received, but when access control was applied, the sender decided not to proceed with negotiation. This message is always fatal.

                        • \"DE\"/\"decode error\"

                          A message could not be decoded because some field was out of the specified range or the length of the message was incorrect. This message is always fatal.

                        • \"CY\"/\"decrypt error\"

                          A handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate a finished message.

                        • \"ER\"/\"export restriction\"

                          A negotiation not in compliance with export restrictions was detected; for example, attempting to transfer a 1024 bit ephemeral RSA key for the RSA_EXPORT handshake method. This message is always fatal.

                        • \"PV\"/\"protocol version\"

                          The protocol version the client has attempted to negotiate is recognized, but not supported. (For example, old protocol versions might be avoided for security reasons). This message is always fatal.

                        • \"IS\"/\"insufficient security\"

                          Returned instead of handshake_failure when a negotiation has failed specifically because the server requires ciphers more secure than those supported by the client. This message is always fatal.

                        • \"IE\"/\"internal error\"

                          An internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue (such as a memory allocation failure). This message is always fatal.

                        • \"US\"/\"user canceled\"

                          This handshake is being canceled for some reason unrelated to a protocol failure. If the user cancels an operation after the handshake is complete, just closing the connection by sending a close_notify is more appropriate. This alert should be followed by a close_notify. This message is generally a warning.

                        • \"NR\"/\"no renegotiation\"

                          Sent by the client in response to a hello request or by the server in response to a client hello after initial handshaking. Either of these would normally lead to renegotiation; when that is not appropriate, the recipient should respond with this alert; at that point, the original requester can decide whether to proceed with the connection. One case where this would be appropriate would be where a server has spawned a process to satisfy a request; the process might receive security parameters (key length, authentication, etc.) at startup and it might be difficult to communicate changes to these parameters after that point. This message is always a warning.

                        • \"UP\"/\"unknown PSK identity\"

                          Sent by the server to indicate that it does not recognize a PSK identity or an SRP identity.

                        • \"UK\"/\"unknown\"

                          This indicates that no description is available for this alert type. Probably value does not contain a correct alert message.

                        "},{"location":"man3/SSL_alert_type_string/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_info_callback(3)

                        "},{"location":"man3/SSL_alert_type_string/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_alloc_buffers/","title":"SSL_alloc_buffers","text":""},{"location":"man3/SSL_alloc_buffers/#name","title":"NAME","text":"

                        SSL_free_buffers, SSL_alloc_buffers - manage SSL structure buffers

                        "},{"location":"man3/SSL_alloc_buffers/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_free_buffers(SSL *ssl);\nint SSL_alloc_buffers(SSL *ssl);\n
                        "},{"location":"man3/SSL_alloc_buffers/#description","title":"DESCRIPTION","text":"

                        SSL_free_buffers() frees the read and write buffers of the given ssl. SSL_alloc_buffers() allocates the read and write buffers of the given ssl.

                        The SSL_MODE_RELEASE_BUFFERS mode releases read or write buffers whenever the buffers have been drained. These functions allow applications to manually control when buffers are freed and allocated.

                        After freeing the buffers, the buffers are automatically reallocated upon a new read or write. The SSL_alloc_buffers() does not need to be called, but can be used to make sure the buffers are preallocated. This can be used to avoid allocation during data processing or with CRYPTO_set_mem_functions() to control where and how buffers are allocated.

                        "},{"location":"man3/SSL_alloc_buffers/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0 (Failure)

                          The SSL_free_buffers() function returns 0 when there is pending data to be read or written. The SSL_alloc_buffers() function returns 0 when there is an allocation failure.

                        • 1 (Success)

                          The SSL_free_buffers() function returns 1 if the buffers have been freed. This value is also returned if the buffers had been freed before calling SSL_free_buffers(). The SSL_alloc_buffers() function returns 1 if the buffers have been allocated. This value is also returned if the buffers had been allocated before calling SSL_alloc_buffers().

                        "},{"location":"man3/SSL_alloc_buffers/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_free(3), SSL_clear(3), SSL_new(3), SSL_CTX_set_mode(3), CRYPTO_set_mem_functions(3)

                        "},{"location":"man3/SSL_alloc_buffers/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_check_chain/","title":"SSL_check_chain","text":""},{"location":"man3/SSL_check_chain/#name","title":"NAME","text":"

                        SSL_check_chain - check certificate chain suitability

                        "},{"location":"man3/SSL_check_chain/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain);\n
                        "},{"location":"man3/SSL_check_chain/#description","title":"DESCRIPTION","text":"

                        SSL_check_chain() checks whether certificate x, private key pk and certificate chain chain is suitable for use with the current session s.

                        "},{"location":"man3/SSL_check_chain/#return-values","title":"RETURN VALUES","text":"

                        SSL_check_chain() returns a bitmap of flags indicating the validity of the chain.

                        CERT_PKEY_VALID: the chain can be used with the current session. If this flag is not set then the certificate will never be used even if the application tries to set it because it is inconsistent with the peer preferences.

                        CERT_PKEY_SIGN: the EE key can be used for signing.

                        CERT_PKEY_EE_SIGNATURE: the signature algorithm of the EE certificate is acceptable.

                        CERT_PKEY_CA_SIGNATURE: the signature algorithms of all CA certificates are acceptable.

                        CERT_PKEY_EE_PARAM: the parameters of the end entity certificate are acceptable (e.g. it is a supported curve).

                        CERT_PKEY_CA_PARAM: the parameters of all CA certificates are acceptable.

                        CERT_PKEY_EXPLICIT_SIGN: the end entity certificate algorithm can be used explicitly for signing (i.e. it is mentioned in the signature algorithms extension).

                        CERT_PKEY_ISSUER_NAME: the issuer name is acceptable. This is only meaningful for client authentication.

                        CERT_PKEY_CERT_TYPE: the certificate type is acceptable. Only meaningful for client authentication.

                        CERT_PKEY_SUITEB: chain is suitable for Suite B use.

                        "},{"location":"man3/SSL_check_chain/#notes","title":"NOTES","text":"

                        SSL_check_chain() must be called in servers after a client hello message or in clients after a certificate request message. It will typically be called in the certificate callback.

                        An application wishing to support multiple certificate chains may call this function on each chain in turn: starting with the one it considers the most secure. It could then use the chain of the first set which returns suitable flags.

                        As a minimum the flag CERT_PKEY_VALID must be set for a chain to be usable. An application supporting multiple chains with different CA signature algorithms may also wish to check CERT_PKEY_CA_SIGNATURE too. If no chain is suitable a server should fall back to the most secure chain which sets CERT_PKEY_VALID.

                        The validity of a chain is determined by checking if it matches a supported signature algorithm, supported curves and in the case of client authentication certificate types and issuer names.

                        Since the supported signature algorithms extension is only used in TLS 1.2, TLS 1.3 and DTLS 1.2 the results for earlier versions of TLS and DTLS may not be very useful. Applications may wish to specify a different \"legacy\" chain for earlier versions of TLS or DTLS.

                        "},{"location":"man3/SSL_check_chain/#see-also","title":"SEE ALSO","text":"

                        SSL_CTX_set_cert_cb(3), ssl(7)

                        "},{"location":"man3/SSL_check_chain/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_clear/","title":"SSL_clear","text":""},{"location":"man3/SSL_clear/#name","title":"NAME","text":"

                        SSL_clear - reset SSL object to allow another connection

                        "},{"location":"man3/SSL_clear/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_clear(SSL *ssl);\n
                        "},{"location":"man3/SSL_clear/#description","title":"DESCRIPTION","text":"

                        Reset ssl to allow another connection. All settings (method, ciphers, BIOs) are kept.

                        "},{"location":"man3/SSL_clear/#notes","title":"NOTES","text":"

                        SSL_clear is used to prepare an SSL object for a new connection. While all settings are kept, a side effect is the handling of the current SSL session. If a session is still open, it is considered bad and will be removed from the session cache, as required by RFC2246. A session is considered open, if SSL_shutdown(3) was not called for the connection or at least SSL_set_shutdown(3) was used to set the SSL_SENT_SHUTDOWN state.

                        If a session was closed cleanly, the session object will be kept and all settings corresponding. This explicitly means, that e.g. the special method used during the session will be kept for the next handshake. So if the session was a TLSv1 session, a SSL client object will use a TLSv1 client method for the next handshake and a SSL server object will use a TLSv1 server method, even if TLS_*_methods were chosen on startup. This will might lead to connection failures (see SSL_new(3)) for a description of the method's properties.

                        "},{"location":"man3/SSL_clear/#warnings","title":"WARNINGS","text":"

                        SSL_clear() resets the SSL object to allow for another connection. The reset operation however keeps several settings of the last sessions (some of these settings were made automatically during the last handshake). It only makes sense for a new connection with the exact same peer that shares these settings, and may fail if that peer changes its settings between connections. Use the sequence SSL_get_session(3); SSL_new(3); SSL_set_session(3); SSL_free(3) instead to avoid such failures (or simply SSL_free(3); SSL_new(3) if session reuse is not desired).

                        "},{"location":"man3/SSL_clear/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          The SSL_clear() operation could not be performed. Check the error stack to find out the reason.

                        • 1

                          The SSL_clear() operation was successful.

                        SSL_new(3), SSL_free(3), SSL_shutdown(3), SSL_set_shutdown(3), SSL_CTX_set_options(3), ssl(7), SSL_CTX_set_client_cert_cb(3)

                        "},{"location":"man3/SSL_clear/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_connect/","title":"SSL_connect","text":""},{"location":"man3/SSL_connect/#name","title":"NAME","text":"

                        SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server

                        "},{"location":"man3/SSL_connect/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_connect(SSL *ssl);\n
                        "},{"location":"man3/SSL_connect/#description","title":"DESCRIPTION","text":"

                        SSL_connect() initiates the TLS/SSL handshake with a server. The communication channel must already have been set and assigned to the ssl by setting an underlying BIO.

                        "},{"location":"man3/SSL_connect/#notes","title":"NOTES","text":"

                        The behaviour of SSL_connect() depends on the underlying BIO.

                        If the underlying BIO is blocking, SSL_connect() will only return once the handshake has been finished or an error occurred.

                        If the underlying BIO is nonblocking, SSL_connect() will also return when the underlying BIO could not satisfy the needs of SSL_connect() to continue the handshake, indicating the problem by the return value -1. In this case a call to SSL_get_error() with the return value of SSL_connect() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_connect(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                        Many systems implement Nagle's algorithm by default which means that it will buffer outgoing TCP data if a TCP packet has already been sent for which no corresponding ACK has been received yet from the peer. This can have performance impacts after a successful TLSv1.3 handshake or a successful TLSv1.2 (or below) resumption handshake, because the last peer to communicate in the handshake is the client. If the client is also the first to send application data (as is typical for many protocols) then this data could be buffered until an ACK has been received for the final handshake message.

                        The TCP_NODELAY socket option is often available to disable Nagle's algorithm. If an application opts to disable Nagle's algorithm consideration should be given to turning it back on again later if appropriate. The helper function BIO_set_tcp_ndelay() can be used to turn on or off the TCP_NODELAY option.

                        "},{"location":"man3/SSL_connect/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

                        • 1

                          The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

                        • <0

                          The TLS/SSL handshake was not successful, because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur if action is needed to continue the operation for nonblocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

                        "},{"location":"man3/SSL_connect/#see-also","title":"SEE ALSO","text":"

                        SSL_get_error(3), SSL_accept(3), SSL_shutdown(3), ssl(7), bio(7), SSL_set_connect_state(3), SSL_do_handshake(3), SSL_CTX_new(3)

                        "},{"location":"man3/SSL_connect/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_do_handshake/","title":"SSL_do_handshake","text":""},{"location":"man3/SSL_do_handshake/#name","title":"NAME","text":"

                        SSL_do_handshake - perform a TLS/SSL handshake

                        "},{"location":"man3/SSL_do_handshake/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_do_handshake(SSL *ssl);\n
                        "},{"location":"man3/SSL_do_handshake/#description","title":"DESCRIPTION","text":"

                        SSL_do_handshake() will wait for a SSL/TLS handshake to take place. If the connection is in client mode, the handshake will be started. The handshake routines may have to be explicitly set in advance using either SSL_set_connect_state(3) or SSL_set_accept_state(3).

                        "},{"location":"man3/SSL_do_handshake/#notes","title":"NOTES","text":"

                        The behaviour of SSL_do_handshake() depends on the underlying BIO.

                        If the underlying BIO is blocking, SSL_do_handshake() will only return once the handshake has been finished or an error occurred.

                        If the underlying BIO is nonblocking, SSL_do_handshake() will also return when the underlying BIO could not satisfy the needs of SSL_do_handshake() to continue the handshake. In this case a call to SSL_get_error() with the return value of SSL_do_handshake() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_do_handshake(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                        "},{"location":"man3/SSL_do_handshake/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

                        • 1

                          The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

                        • <0

                          The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur if action is needed to continue the operation for nonblocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

                        "},{"location":"man3/SSL_do_handshake/#see-also","title":"SEE ALSO","text":"

                        SSL_get_error(3), SSL_connect(3), SSL_accept(3), ssl(7), bio(7), SSL_set_connect_state(3)

                        "},{"location":"man3/SSL_do_handshake/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_export_keying_material/","title":"SSL_export_keying_material","text":""},{"location":"man3/SSL_export_keying_material/#name","title":"NAME","text":"

                        SSL_export_keying_material, SSL_export_keying_material_early - obtain keying material for application use

                        "},{"location":"man3/SSL_export_keying_material/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,\n                               const char *label, size_t llen,\n                               const unsigned char *context,\n                               size_t contextlen, int use_context);\n\nint SSL_export_keying_material_early(SSL *s, unsigned char *out, size_t olen,\n                                     const char *label, size_t llen,\n                                     const unsigned char *context,\n                                     size_t contextlen);\n
                        "},{"location":"man3/SSL_export_keying_material/#description","title":"DESCRIPTION","text":"

                        During the creation of a TLS or DTLS connection shared keying material is established between the two endpoints. The functions SSL_export_keying_material() and SSL_export_keying_material_early() enable an application to use some of this keying material for its own purposes in accordance with RFC5705 (for TLSv1.2 and below) or RFC8446 (for TLSv1.3).

                        SSL_export_keying_material() derives keying material using the exporter_master_secret established in the handshake.

                        SSL_export_keying_material_early() is only usable with TLSv1.3, and derives keying material using the early_exporter_master_secret (as defined in the TLS 1.3 RFC). For the client, the early_exporter_master_secret is only available when the client attempts to send 0-RTT data. For the server, it is only available when the server accepts 0-RTT data.

                        An application may need to securely establish the context within which this keying material will be used. For example this may include identifiers for the application session, application algorithms or parameters, or the lifetime of the context. The context value is left to the application but must be the same on both sides of the communication.

                        For a given SSL connection s, olen bytes of data will be written to out. The application specific context should be supplied in the location pointed to by context and should be contextlen bytes long. Provision of a context is optional. If the context should be omitted entirely then use_context should be set to 0. Otherwise it should be any other value. If use_context is 0 then the values of context and contextlen are ignored. Note that in TLSv1.2 and below a zero length context is treated differently from no context at all, and will result in different keying material being returned. In TLSv1.3 a zero length context is that same as no context at all and will result in the same keying material being returned.

                        An application specific label should be provided in the location pointed to by label and should be llen bytes long. Typically this will be a value from the IANA Exporter Label Registry (https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). Alternatively labels beginning with \"EXPERIMENTAL\" are permitted by the standard to be used without registration. TLSv1.3 imposes a maximum label length of 249 bytes.

                        Note that this function is only defined for TLSv1.0 and above, and DTLSv1.0 and above. Attempting to use it in SSLv3 will result in an error.

                        "},{"location":"man3/SSL_export_keying_material/#return-values","title":"RETURN VALUES","text":"

                        SSL_export_keying_material() returns 0 or -1 on failure or 1 on success.

                        SSL_export_keying_material_early() returns 0 on failure or 1 on success.

                        "},{"location":"man3/SSL_export_keying_material/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_export_keying_material/#history","title":"HISTORY","text":"

                        The SSL_export_keying_material_early() function was added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_export_keying_material/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_extension_supported/","title":"SSL_extension_supported","text":""},{"location":"man3/SSL_extension_supported/#name","title":"NAME","text":"

                        SSL_extension_supported, SSL_custom_ext_add_cb_ex, SSL_custom_ext_free_cb_ex, SSL_custom_ext_parse_cb_ex, SSL_CTX_add_custom_ext, SSL_CTX_add_client_custom_ext, SSL_CTX_add_server_custom_ext, custom_ext_add_cb, custom_ext_free_cb, custom_ext_parse_cb - custom TLS extension handling

                        "},{"location":"man3/SSL_extension_supported/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\ntypedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type,\n                                        unsigned int context,\n                                        const unsigned char **out,\n                                        size_t *outlen, X509 *x,\n                                        size_t chainidx, int *al,\n                                        void *add_arg);\n\ntypedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type,\n                                          unsigned int context,\n                                          const unsigned char *out,\n                                          void *add_arg);\n\ntypedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type,\n                                          unsigned int context,\n                                          const unsigned char *in,\n                                          size_t inlen, X509 *x,\n                                          size_t chainidx, int *al,\n                                          void *parse_arg);\n\nint SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type,\n                           unsigned int context,\n                           SSL_custom_ext_add_cb_ex add_cb,\n                           SSL_custom_ext_free_cb_ex free_cb,\n                           void *add_arg,\n                           SSL_custom_ext_parse_cb_ex parse_cb,\n                           void *parse_arg);\n\ntypedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type,\n                                 const unsigned char **out,\n                                 size_t *outlen, int *al,\n                                 void *add_arg);\n\ntypedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type,\n                                   const unsigned char *out,\n                                   void *add_arg);\n\ntypedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type,\n                                   const unsigned char *in,\n                                   size_t inlen, int *al,\n                                   void *parse_arg);\n\nint SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type,\n                                  custom_ext_add_cb add_cb,\n                                  custom_ext_free_cb free_cb, void *add_arg,\n                                  custom_ext_parse_cb parse_cb,\n                                  void *parse_arg);\n\nint SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, unsigned int ext_type,\n                                  custom_ext_add_cb add_cb,\n                                  custom_ext_free_cb free_cb, void *add_arg,\n                                  custom_ext_parse_cb parse_cb,\n                                  void *parse_arg);\n\nint SSL_extension_supported(unsigned int ext_type);\n
                        "},{"location":"man3/SSL_extension_supported/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_add_custom_ext() adds a custom extension for a TLS/DTLS client or server for all supported protocol versions with extension type ext_type and callbacks add_cb, free_cb and parse_cb (see the \"EXTENSION CALLBACKS\" section below). The context value determines which messages and under what conditions the extension will be added/parsed (see the \"EXTENSION CONTEXTS\" section below).

                        SSL_CTX_add_client_custom_ext() adds a custom extension for a TLS/DTLS client with extension type ext_type and callbacks add_cb, free_cb and parse_cb. This function is similar to SSL_CTX_add_custom_ext() except it only applies to clients, uses the older style of callbacks, and implicitly sets the context value to:

                        SSL_EXT_TLS1_2_AND_BELOW_ONLY | SSL_EXT_CLIENT_HELLO\n| SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_IGNORE_ON_RESUMPTION\n

                        SSL_CTX_add_server_custom_ext() adds a custom extension for a TLS/DTLS server with extension type ext_type and callbacks add_cb, free_cb and parse_cb. This function is similar to SSL_CTX_add_custom_ext() except it only applies to servers, uses the older style of callbacks, and implicitly sets the context value to the same as for SSL_CTX_add_client_custom_ext() above.

                        The ext_type parameter corresponds to the extension_type field of RFC5246 et al. It is not a NID. In all cases the extension type must not be handled by OpenSSL internally or an error occurs.

                        SSL_extension_supported() returns 1 if the extension ext_type is handled internally by OpenSSL and 0 otherwise.

                        "},{"location":"man3/SSL_extension_supported/#extension-callbacks","title":"EXTENSION CALLBACKS","text":"

                        The callback add_cb is called to send custom extension data to be included in various TLS messages. The ext_type parameter is set to the extension type which will be added and add_arg to the value set when the extension handler was added. When using the new style callbacks the context parameter will indicate which message is currently being constructed e.g. for the ClientHello it will be set to SSL_EXT_CLIENT_HELLO.

                        If the application wishes to include the extension ext_type it should set *out to the extension data, set *outlen to the length of the extension data and return 1.

                        If the add_cb does not wish to include the extension it must return 0.

                        If add_cb returns -1 a fatal handshake error occurs using the TLS alert value specified in *al.

                        When constructing the ClientHello, if add_cb is set to NULL a zero length extension is added for ext_type. For all other messages if add_cb is set to NULL then no extension is added.

                        When constructing a Certificate message the callback will be called for each certificate in the message. The x parameter will indicate the current certificate and the chainidx parameter will indicate the position of the certificate in the message. The first certificate is always the end entity certificate and has a chainidx value of 0. The certificates are in the order that they were received in the Certificate message.

                        For all messages except the ServerHello and EncryptedExtensions every registered add_cb is always called to see if the application wishes to add an extension (as long as all requirements of the specified context are met).

                        For the ServerHello and EncryptedExtension messages every registered add_cb is called once if and only if the requirements of the specified context are met and the corresponding extension was received in the ClientHello. That is, if no corresponding extension was received in the ClientHello then add_cb will not be called.

                        If an extension is added (that is add_cb returns 1) free_cb is called (if it is set) with the value of out set by the add callback. It can be used to free up any dynamic extension data set by add_cb. Since out is constant (to permit use of constant data in add_cb) applications may need to cast away const to free the data.

                        The callback parse_cb receives data for TLS extensions. The callback is only called if the extension is present and relevant for the context (see \"EXTENSION CONTEXTS\" below).

                        The extension data consists of inlen bytes in the buffer in for the extension ext_type.

                        If the message being parsed is a TLSv1.3 compatible Certificate message then parse_cb will be called for each certificate contained within the message. The x parameter will indicate the current certificate and the chainidx parameter will indicate the position of the certificate in the message. The first certificate is always the end entity certificate and has a chainidx value of 0.

                        If the parse_cb considers the extension data acceptable it must return 1. If it returns 0 or a negative value a fatal handshake error occurs using the TLS alert value specified in *al.

                        The buffer in is a temporary internal buffer which will not be valid after the callback returns.

                        "},{"location":"man3/SSL_extension_supported/#extension-contexts","title":"EXTENSION CONTEXTS","text":"

                        An extension context defines which messages and under which conditions an extension should be added or expected. The context is built up by performing a bitwise OR of multiple pre-defined values together. The valid context values are:

                        • SSL_EXT_TLS_ONLY

                          The extension is only allowed in TLS

                        • SSL_EXT_DTLS_ONLY

                          The extension is only allowed in DTLS

                        • SSL_EXT_TLS_IMPLEMENTATION_ONLY

                          The extension is allowed in DTLS, but there is only a TLS implementation available (so it is ignored in DTLS).

                        • SSL_EXT_SSL3_ALLOWED

                          Extensions are not typically defined for SSLv3. Setting this value will allow the extension in SSLv3. Applications will not typically need to use this.

                        • SSL_EXT_TLS1_2_AND_BELOW_ONLY

                          The extension is only defined for TLSv1.2/DTLSv1.2 and below. Servers will ignore this extension if it is present in the ClientHello and TLSv1.3 is negotiated.

                        • SSL_EXT_TLS1_3_ONLY

                          The extension is only defined for TLS1.3 and above. Servers will ignore this extension if it is present in the ClientHello and TLSv1.2 or below is negotiated.

                        • SSL_EXT_IGNORE_ON_RESUMPTION

                          The extension will be ignored during parsing if a previous session is being successfully resumed.

                        • SSL_EXT_CLIENT_HELLO

                          The extension may be present in the ClientHello message.

                        • SSL_EXT_TLS1_2_SERVER_HELLO

                          The extension may be present in a TLSv1.2 or below compatible ServerHello message.

                        • SSL_EXT_TLS1_3_SERVER_HELLO

                          The extension may be present in a TLSv1.3 compatible ServerHello message.

                        • SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS

                          The extension may be present in an EncryptedExtensions message.

                        • SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST

                          The extension may be present in a HelloRetryRequest message.

                        • SSL_EXT_TLS1_3_CERTIFICATE

                          The extension may be present in a TLSv1.3 compatible Certificate message.

                        • SSL_EXT_TLS1_3_NEW_SESSION_TICKET

                          The extension may be present in a TLSv1.3 compatible NewSessionTicket message.

                        • SSL_EXT_TLS1_3_CERTIFICATE_REQUEST

                          The extension may be present in a TLSv1.3 compatible CertificateRequest message.

                        The context must include at least one message value (otherwise the extension will never be used).

                        "},{"location":"man3/SSL_extension_supported/#notes","title":"NOTES","text":"

                        The add_arg and parse_arg parameters can be set to arbitrary values which will be passed to the corresponding callbacks. They can, for example, be used to store the extension data received in a convenient structure or pass the extension data to be added or freed when adding extensions.

                        If the same custom extension type is received multiple times a fatal decode_error alert is sent and the handshake aborts. If a custom extension is received in a ServerHello/EncryptedExtensions message which was not sent in the ClientHello a fatal unsupported_extension alert is sent and the handshake is aborted. The ServerHello/EncryptedExtensions add_cb callback is only called if the corresponding extension was received in the ClientHello. This is compliant with the TLS specifications. This behaviour ensures that each callback is called at most once and that an application can never send unsolicited extensions.

                        "},{"location":"man3/SSL_extension_supported/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_add_custom_ext(), SSL_CTX_add_client_custom_ext() and SSL_CTX_add_server_custom_ext() return 1 for success and 0 for failure. A failure can occur if an attempt is made to add the same ext_type more than once, if an attempt is made to use an extension type handled internally by OpenSSL or if an internal error occurs (for example a memory allocation failure).

                        SSL_extension_supported() returns 1 if the extension ext_type is handled internally by OpenSSL and 0 otherwise.

                        "},{"location":"man3/SSL_extension_supported/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_extension_supported/#history","title":"HISTORY","text":"

                        The SSL_CTX_add_custom_ext() function was added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_extension_supported/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2014-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_free/","title":"SSL_free","text":""},{"location":"man3/SSL_free/#name","title":"NAME","text":"

                        SSL_free - free an allocated SSL structure

                        "},{"location":"man3/SSL_free/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_free(SSL *ssl);\n
                        "},{"location":"man3/SSL_free/#description","title":"DESCRIPTION","text":"

                        SSL_free() decrements the reference count of ssl, and removes the SSL structure pointed to by ssl and frees up the allocated memory if the reference count has reached 0. If ssl is NULL nothing is done.

                        "},{"location":"man3/SSL_free/#notes","title":"NOTES","text":"

                        SSL_free() also calls the free()ing procedures for indirectly affected items, if applicable: the buffering BIO, the read and write BIOs, cipher lists specially created for this ssl, the SSL_SESSION. Do not explicitly free these indirectly freed up items before or after calling SSL_free(), as trying to free things twice may lead to program failure.

                        The ssl session has reference counts from two users: the SSL object, for which the reference count is removed by SSL_free() and the internal session cache. If the session is considered bad, because SSL_shutdown(3) was not called for the connection and SSL_set_shutdown(3) was not used to set the SSL_SENT_SHUTDOWN state, the session will also be removed from the session cache as required by RFC2246.

                        "},{"location":"man3/SSL_free/#return-values","title":"RETURN VALUES","text":"

                        SSL_free() does not provide diagnostic information.

                        SSL_new(3), SSL_clear(3), SSL_shutdown(3), SSL_set_shutdown(3), ssl(7)

                        "},{"location":"man3/SSL_free/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get0_peer_scts/","title":"SSL_get0_peer_scts","text":""},{"location":"man3/SSL_get0_peer_scts/#name","title":"NAME","text":"

                        SSL_get0_peer_scts - get SCTs received

                        "},{"location":"man3/SSL_get0_peer_scts/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s);\n
                        "},{"location":"man3/SSL_get0_peer_scts/#description","title":"DESCRIPTION","text":"

                        SSL_get0_peer_scts() returns the signed certificate timestamps (SCTs) that have been received. If this is the first time that this function has been called for a given SSL instance, it will examine the TLS extensions, OCSP response and the peer's certificate for SCTs. Future calls will return the same SCTs.

                        "},{"location":"man3/SSL_get0_peer_scts/#restrictions","title":"RESTRICTIONS","text":"

                        If no Certificate Transparency validation callback has been set (using SSL_CTX_set_ct_validation_callback or SSL_set_ct_validation_callback), this function is not guaranteed to return all of the SCTs that the peer is capable of sending.

                        "},{"location":"man3/SSL_get0_peer_scts/#return-values","title":"RETURN VALUES","text":"

                        SSL_get0_peer_scts() returns a list of SCTs found, or NULL if an error occurs.

                        "},{"location":"man3/SSL_get0_peer_scts/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_ct_validation_callback(3)

                        "},{"location":"man3/SSL_get0_peer_scts/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_SSL_CTX/","title":"SSL_get_SSL_CTX","text":""},{"location":"man3/SSL_get_SSL_CTX/#name","title":"NAME","text":"

                        SSL_get_SSL_CTX - get the SSL_CTX from which an SSL is created

                        "},{"location":"man3/SSL_get_SSL_CTX/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);\n
                        "},{"location":"man3/SSL_get_SSL_CTX/#description","title":"DESCRIPTION","text":"

                        SSL_get_SSL_CTX() returns a pointer to the SSL_CTX object, from which ssl was created with SSL_new(3).

                        "},{"location":"man3/SSL_get_SSL_CTX/#return-values","title":"RETURN VALUES","text":"

                        The pointer to the SSL_CTX object is returned.

                        "},{"location":"man3/SSL_get_SSL_CTX/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_new(3)

                        "},{"location":"man3/SSL_get_SSL_CTX/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_all_async_fds/","title":"SSL_get_all_async_fds","text":""},{"location":"man3/SSL_get_all_async_fds/#name","title":"NAME","text":"

                        SSL_waiting_for_async, SSL_get_all_async_fds, SSL_get_changed_async_fds - manage asynchronous operations

                        "},{"location":"man3/SSL_get_all_async_fds/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/async.h>\n#include <openssl/ssl.h>\n\nint SSL_waiting_for_async(SSL *s);\nint SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fd, size_t *numfds);\nint SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, size_t *numaddfds,\n                              OSSL_ASYNC_FD *delfd, size_t *numdelfds);\n
                        "},{"location":"man3/SSL_get_all_async_fds/#description","title":"DESCRIPTION","text":"

                        SSL_waiting_for_async() determines whether an SSL connection is currently waiting for asynchronous operations to complete (see the SSL_MODE_ASYNC mode in SSL_CTX_set_mode(3)).

                        SSL_get_all_async_fds() returns a list of file descriptor which can be used in a call to select() or poll() to determine whether the current asynchronous operation has completed or not. A completed operation will result in data appearing as \"read ready\" on the file descriptor (no actual data should be read from the file descriptor). This function should only be called if the SSL object is currently waiting for asynchronous work to complete (i.e. SSL_ERROR_WANT_ASYNC has been received - see SSL_get_error(3)). Typically the list will only contain one file descriptor. However, if multiple asynchronous capable engines are in use then more than one is possible. The number of file descriptors returned is stored in *numfds and the file descriptors themselves are in *fds. The fds parameter may be NULL in which case no file descriptors are returned but *numfds is still populated. It is the callers responsibility to ensure sufficient memory is allocated at *fds so typically this function is called twice (once with a NULL fds parameter and once without).

                        SSL_get_changed_async_fds() returns a list of the asynchronous file descriptors that have been added and a list that have been deleted since the last SSL_ERROR_WANT_ASYNC was received (or since the SSL object was created if no SSL_ERROR_WANT_ASYNC has been received). Similar to SSL_get_all_async_fds() it is the callers responsibility to ensure that *addfd and *delfd have sufficient memory allocated, although they may be NULL. The number of added fds and the number of deleted fds are stored in *numaddfds and *numdelfds respectively.

                        "},{"location":"man3/SSL_get_all_async_fds/#return-values","title":"RETURN VALUES","text":"

                        SSL_waiting_for_async() will return 1 if the current SSL operation is waiting for an async operation to complete and 0 otherwise.

                        SSL_get_all_async_fds() and SSL_get_changed_async_fds() return 1 on success or 0 on error.

                        "},{"location":"man3/SSL_get_all_async_fds/#notes","title":"NOTES","text":"

                        On Windows platforms the <openssl/async.h> header is dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/async.h>.

                        "},{"location":"man3/SSL_get_all_async_fds/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_error(3), SSL_CTX_set_mode(3)

                        "},{"location":"man3/SSL_get_all_async_fds/#history","title":"HISTORY","text":"

                        The SSL_waiting_for_async(), SSL_get_all_async_fds() and SSL_get_changed_async_fds() functions were added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_get_all_async_fds/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_certificate/","title":"SSL_get_certificate","text":""},{"location":"man3/SSL_get_certificate/#name","title":"NAME","text":"

                        SSL_get_certificate, SSL_get_privatekey - retrieve TLS/SSL certificate and private key

                        "},{"location":"man3/SSL_get_certificate/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nX509 *SSL_get_certificate(const SSL *s);\nEVP_PKEY *SSL_get_privatekey(const SSL *s);\n
                        "},{"location":"man3/SSL_get_certificate/#description","title":"DESCRIPTION","text":"

                        SSL_get_certificate() returns a pointer to an X509 object representing a certificate used as the local peer's identity.

                        Multiple certificates can be configured; for example, a server might have both RSA and ECDSA certificates. The certificate which is returned by SSL_get_certificate() is determined as follows:

                        • If it is called before certificate selection has occurred, it returns the most recently added certificate, or NULL if no certificate has been added.
                        • After certificate selection has occurred, it returns the certificate which was selected during the handshake, or NULL if no certificate was selected (for example, on a client where no client certificate is in use).

                        Certificate selection occurs during the handshake; therefore, the value returned by SSL_get_certificate() during any callback made during the handshake process will depend on whether that callback is made before or after certificate selection occurs.

                        A specific use for SSL_get_certificate() is inside a callback set via a call to SSL_CTX_set_tlsext_status_cb(3). This callback occurs after certificate selection, where it can be used to examine a server's chosen certificate, for example for the purpose of identifying a certificate's OCSP responder URL so that an OCSP response can be obtained.

                        SSL_get_privatekey() returns a pointer to the EVP_PKEY object corresponding to the certificate returned by SSL_get_certificate(), if any.

                        "},{"location":"man3/SSL_get_certificate/#return-values","title":"RETURN VALUES","text":"

                        These functions return pointers to their respective objects, or NULL if no such object is available. Returned objects are owned by the SSL object and should not be freed by users of these functions.

                        "},{"location":"man3/SSL_get_certificate/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_tlsext_status_cb(3)

                        "},{"location":"man3/SSL_get_certificate/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_ciphers/","title":"SSL_get_ciphers","text":""},{"location":"man3/SSL_get_ciphers/#name","title":"NAME","text":"

                        SSL_get1_supported_ciphers, SSL_get_client_ciphers, SSL_get_ciphers, SSL_CTX_get_ciphers, SSL_bytes_to_cipher_list, SSL_get_cipher_list, SSL_get_shared_ciphers - get list of available SSL_CIPHERs

                        "},{"location":"man3/SSL_get_ciphers/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSTACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);\nSTACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);\nSTACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s);\nSTACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *ssl);\nint SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len,\n                             int isv2format, STACK_OF(SSL_CIPHER) **sk,\n                             STACK_OF(SSL_CIPHER) **scsvs);\nconst char *SSL_get_cipher_list(const SSL *ssl, int priority);\nchar *SSL_get_shared_ciphers(const SSL *s, char *buf, int size);\n
                        "},{"location":"man3/SSL_get_ciphers/#description","title":"DESCRIPTION","text":"

                        SSL_get_ciphers() returns the stack of available SSL_CIPHERs for ssl, sorted by preference. If ssl is NULL or no ciphers are available, NULL is returned.

                        SSL_CTX_get_ciphers() returns the stack of available SSL_CIPHERs for ctx.

                        SSL_get1_supported_ciphers() returns the stack of enabled SSL_CIPHERs for ssl as would be sent in a ClientHello (that is, sorted by preference). The list depends on settings like the cipher list, the supported protocol versions, the security level, and the enabled signature algorithms. SRP and PSK ciphers are only enabled if the appropriate callbacks or settings have been applied. The list of ciphers that would be sent in a ClientHello can differ from the list of ciphers that would be acceptable when acting as a server. For example, additional ciphers may be usable by a server if there is a gap in the list of supported protocols, and some ciphers may not be usable by a server if there is not a suitable certificate configured. If ssl is NULL or no ciphers are available, NULL is returned.

                        SSL_get_client_ciphers() returns the stack of available SSL_CIPHERs matching the list received from the client on ssl. If ssl is NULL, no ciphers are available, or ssl is not operating in server mode, NULL is returned.

                        SSL_bytes_to_cipher_list() treats the supplied len octets in bytes as a wire-protocol cipher suite specification (in the three-octet-per-cipher SSLv2 wire format if isv2format is nonzero; otherwise the two-octet SSLv3/TLS wire format), and parses the cipher suites supported by the library into the returned stacks of SSL_CIPHER objects sk and Signalling Cipher-Suite Values scsvs. Unsupported cipher suites are ignored. Returns 1 on success and 0 on failure.

                        SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER listed for ssl with priority. If ssl is NULL, no ciphers are available, or there are less ciphers than priority available, NULL is returned.

                        SSL_get_shared_ciphers() creates a colon separated and NUL terminated list of SSL_CIPHER names that are available in both the client and the server. buf is the buffer that should be populated with the list of names and size is the size of that buffer. A pointer to buf is returned on success or NULL on error. If the supplied buffer is not large enough to contain the complete list of names then a truncated list of names will be returned. Note that just because a ciphersuite is available (i.e. it is configured in the cipher list) and shared by both the client and the server it does not mean that it is enabled (see the description of SSL_get1_supported_ciphers() above). This function will return available shared ciphersuites whether or not they are enabled. This is a server side function only and must only be called after the completion of the initial handshake.

                        "},{"location":"man3/SSL_get_ciphers/#notes","title":"NOTES","text":"

                        The details of the ciphers obtained by SSL_get_ciphers(), SSL_CTX_get_ciphers() SSL_get1_supported_ciphers() and SSL_get_client_ciphers() can be obtained using the SSL_CIPHER_get_name(3) family of functions.

                        Call SSL_get_cipher_list() with priority starting from 0 to obtain the sorted list of available ciphers, until NULL is returned.

                        Note: SSL_get_ciphers(), SSL_CTX_get_ciphers() and SSL_get_client_ciphers() return a pointer to an internal cipher stack, which will be freed later on when the SSL or SSL_SESSION object is freed. Therefore, the calling code MUST NOT free the return value itself.

                        The stack returned by SSL_get1_supported_ciphers() should be freed using sk_SSL_CIPHER_free().

                        The stacks returned by SSL_bytes_to_cipher_list() should be freed using sk_SSL_CIPHER_free().

                        "},{"location":"man3/SSL_get_ciphers/#return-values","title":"RETURN VALUES","text":"

                        See DESCRIPTION

                        "},{"location":"man3/SSL_get_ciphers/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_cipher_list(3), SSL_CIPHER_get_name(3)

                        "},{"location":"man3/SSL_get_ciphers/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_client_random/","title":"SSL_get_client_random","text":""},{"location":"man3/SSL_get_client_random/#name","title":"NAME","text":"

                        SSL_get_client_random, SSL_get_server_random, SSL_SESSION_get_master_key, SSL_SESSION_set1_master_key - get internal TLS/SSL random values and get/set master key

                        "},{"location":"man3/SSL_get_client_random/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nsize_t SSL_get_client_random(const SSL *ssl, unsigned char *out, size_t outlen);\nsize_t SSL_get_server_random(const SSL *ssl, unsigned char *out, size_t outlen);\nsize_t SSL_SESSION_get_master_key(const SSL_SESSION *session,\n                                  unsigned char *out, size_t outlen);\nint SSL_SESSION_set1_master_key(SSL_SESSION *sess, const unsigned char *in,\n                                size_t len);\n
                        "},{"location":"man3/SSL_get_client_random/#description","title":"DESCRIPTION","text":"

                        SSL_get_client_random() extracts the random value sent from the client to the server during the initial SSL/TLS handshake. It copies as many bytes as it can of this value into the buffer provided in out, which must have at least outlen bytes available. It returns the total number of bytes that were actually copied. If outlen is zero, SSL_get_client_random() copies nothing, and returns the total size of the client_random value.

                        SSL_get_server_random() behaves the same, but extracts the random value sent from the server to the client during the initial SSL/TLS handshake.

                        SSL_SESSION_get_master_key() behaves the same, but extracts the master secret used to guarantee the security of the SSL/TLS session. This one can be dangerous if misused; see NOTES below.

                        SSL_SESSION_set1_master_key() sets the master key value associated with the SSL_SESSION sess. For example, this could be used to set up a session based PSK (see SSL_CTX_set_psk_use_session_callback(3)). The master key of length len should be provided at in. The supplied master key is copied by the function, so the caller is responsible for freeing and cleaning any memory associated with in. The caller must ensure that the length of the key is suitable for the ciphersuite associated with the SSL_SESSION.

                        "},{"location":"man3/SSL_get_client_random/#notes","title":"NOTES","text":"

                        You probably shouldn't use these functions.

                        These functions expose internal values from the TLS handshake, for use in low-level protocols. You probably should not use them, unless you are implementing something that needs access to the internal protocol details.

                        Despite the names of SSL_get_client_random() and SSL_get_server_random(), they ARE NOT random number generators. Instead, they return the mostly-random values that were already generated and used in the TLS protocol. Using them in place of RAND_bytes() would be grossly foolish.

                        The security of your TLS session depends on keeping the master key secret: do not expose it, or any information about it, to anybody. If you need to calculate another secret value that depends on the master secret, you should probably use SSL_export_keying_material() instead, and forget that you ever saw these functions.

                        In current versions of the TLS protocols, the length of client_random (and also server_random) is always SSL3_RANDOM_SIZE bytes. Support for other outlen arguments to the SSL_get_*_random() functions is provided in case of the unlikely event that a future version or variant of TLS uses some other length there.

                        Finally, though the \"client_random\" and \"server_random\" values are called \"random\", many TLS implementations will generate four bytes of those values based on their view of the current time.

                        "},{"location":"man3/SSL_get_client_random/#return-values","title":"RETURN VALUES","text":"

                        SSL_SESSION_set1_master_key() returns 1 on success or 0 on failure.

                        For the other functions, if outlen is greater than 0 then these functions return the number of bytes actually copied, which will be less than or equal to outlen. If outlen is 0 then these functions return the maximum number of bytes they would copy -- that is, the length of the underlying field.

                        "},{"location":"man3/SSL_get_client_random/#see-also","title":"SEE ALSO","text":"

                        ssl(7), RAND_bytes(3), SSL_export_keying_material(3), SSL_CTX_set_psk_use_session_callback(3)

                        "},{"location":"man3/SSL_get_client_random/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_current_cipher/","title":"SSL_get_current_cipher","text":""},{"location":"man3/SSL_get_current_cipher/#name","title":"NAME","text":"

                        SSL_get_current_cipher, SSL_get_cipher_name, SSL_get_cipher, SSL_get_cipher_bits, SSL_get_cipher_version, SSL_get_pending_cipher - get SSL_CIPHER of a connection

                        "},{"location":"man3/SSL_get_current_cipher/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl);\nconst SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);\n\nconst char *SSL_get_cipher_name(const SSL *s);\nconst char *SSL_get_cipher(const SSL *s);\nint SSL_get_cipher_bits(const SSL *s, int *np);\nconst char *SSL_get_cipher_version(const SSL *s);\n
                        "},{"location":"man3/SSL_get_current_cipher/#description","title":"DESCRIPTION","text":"

                        SSL_get_current_cipher() returns a pointer to an SSL_CIPHER object containing the description of the actually used cipher of a connection established with the ssl object. See SSL_CIPHER_get_name(3) for more details.

                        SSL_get_cipher_name() obtains the name of the currently used cipher. SSL_get_cipher() is identical to SSL_get_cipher_name(). SSL_get_cipher_bits() is a macro to obtain the number of secret/algorithm bits used and SSL_get_cipher_version() returns the protocol name.

                        SSL_get_pending_cipher() returns a pointer to an SSL_CIPHER object containing the description of the cipher (if any) that has been negotiated for future use on the connection established with the ssl object, but is not yet in use. This may be the case during handshake processing, when control flow can be returned to the application via any of several callback methods. The internal sequencing of handshake processing and callback invocation is not guaranteed to be stable from release to release, and at present only the callback set by SSL_CTX_set_alpn_select_cb() is guaranteed to have a non-NULL return value. Other callbacks may be added to this list over time.

                        "},{"location":"man3/SSL_get_current_cipher/#return-values","title":"RETURN VALUES","text":"

                        SSL_get_current_cipher() returns the cipher actually used, or NULL if no session has been established.

                        SSL_get_pending_cipher() returns the cipher to be used at the next change of cipher suite, or NULL if no such cipher is known.

                        "},{"location":"man3/SSL_get_current_cipher/#notes","title":"NOTES","text":"

                        SSL_get_cipher, SSL_get_cipher_bits, SSL_get_cipher_version, and SSL_get_cipher_name are implemented as macros.

                        "},{"location":"man3/SSL_get_current_cipher/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CIPHER_get_name(3)

                        "},{"location":"man3/SSL_get_current_cipher/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_default_timeout/","title":"SSL_get_default_timeout","text":""},{"location":"man3/SSL_get_default_timeout/#name","title":"NAME","text":"

                        SSL_get_default_timeout - get default session timeout value

                        "},{"location":"man3/SSL_get_default_timeout/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_get_default_timeout(const SSL *ssl);\n
                        "},{"location":"man3/SSL_get_default_timeout/#description","title":"DESCRIPTION","text":"

                        SSL_get_default_timeout() returns the default timeout value assigned to SSL_SESSION objects negotiated for the protocol valid for ssl.

                        "},{"location":"man3/SSL_get_default_timeout/#notes","title":"NOTES","text":"

                        Whenever a new session is negotiated, it is assigned a timeout value, after which it will not be accepted for session reuse. If the timeout value was not explicitly set using SSL_CTX_set_timeout(3), the hardcoded default timeout for the protocol will be used.

                        SSL_get_default_timeout() return this hardcoded value, which is 300 seconds for all currently supported protocols.

                        "},{"location":"man3/SSL_get_default_timeout/#return-values","title":"RETURN VALUES","text":"

                        See description.

                        "},{"location":"man3/SSL_get_default_timeout/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_get_time(3), SSL_CTX_flush_sessions(3), SSL_get_default_timeout(3)

                        "},{"location":"man3/SSL_get_default_timeout/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_error/","title":"SSL_get_error","text":""},{"location":"man3/SSL_get_error/#name","title":"NAME","text":"

                        SSL_get_error - obtain result code for TLS/SSL I/O operation

                        "},{"location":"man3/SSL_get_error/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_get_error(const SSL *ssl, int ret);\n
                        "},{"location":"man3/SSL_get_error/#description","title":"DESCRIPTION","text":"

                        SSL_get_error() returns a result code (suitable for the C \"switch\" statement) for a preceding call to SSL_connect(), SSL_accept(), SSL_do_handshake(), SSL_read_ex(), SSL_read(), SSL_peek_ex(), SSL_peek(), SSL_shutdown(), SSL_write_ex() or SSL_write() on ssl. The value returned by that TLS/SSL I/O function must be passed to SSL_get_error() in parameter ret.

                        In addition to ssl and ret, SSL_get_error() inspects the current thread's OpenSSL error queue. Thus, SSL_get_error() must be used in the same thread that performed the TLS/SSL I/O operation, and no other OpenSSL function calls should appear in between. The current thread's error queue must be empty before the TLS/SSL I/O operation is attempted, or SSL_get_error() will not work reliably.

                        "},{"location":"man3/SSL_get_error/#notes","title":"NOTES","text":"

                        Some TLS implementations do not send a close_notify alert on shutdown.

                        On an unexpected EOF, versions before OpenSSL 3.0 returned SSL_ERROR_SYSCALL, nothing was added to the error stack, and errno was 0. Since OpenSSL 3.0 the returned error is SSL_ERROR_SSL with a meaningful error on the error stack (SSL_R_UNEXPECTED_EOF_WHILE_READING). This error reason code may be used for control flow decisions (see the man page for ERR_GET_REASON(3) for further details on this).

                        "},{"location":"man3/SSL_get_error/#return-values","title":"RETURN VALUES","text":"

                        The following return values can currently occur:

                        • SSL_ERROR_NONE

                          The TLS/SSL I/O operation completed. This result code is returned if and only if ret > 0.

                        • SSL_ERROR_ZERO_RETURN

                          The TLS/SSL peer has closed the connection for writing by sending the close_notify alert. No more data can be read. Note that SSL_ERROR_ZERO_RETURN does not necessarily indicate that the underlying transport has been closed.

                          This error can also appear when the option SSL_OP_IGNORE_UNEXPECTED_EOF is set. See SSL_CTX_set_options(3) for more details.

                        • SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE

                          The operation did not complete and can be retried later.

                          SSL_ERROR_WANT_READ is returned when the last operation was a read operation from a nonblocking BIO. It means that not enough data was available at this time to complete the operation. If at a later time the underlying BIO has data available for reading the same function can be called again.

                          SSL_read() and SSL_read_ex() can also set SSL_ERROR_WANT_READ when there is still unprocessed data available at either the SSL or the BIO layer, even for a blocking BIO. See SSL_read(3) for more information.

                          SSL_ERROR_WANT_WRITE is returned when the last operation was a write to a nonblocking BIO and it was unable to sent all data to the BIO. When the BIO is writable again, the same function can be called again.

                          Note that the retry may again lead to an SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition. There is no fixed upper limit for the number of iterations that may be necessary until progress becomes visible at application protocol level.

                          It is safe to call SSL_read() or SSL_read_ex() when more data is available even when the call that set this error was an SSL_write() or SSL_write_ex(). However, if the call was an SSL_write() or SSL_write_ex(), it should be called again to continue sending the application data. If you get SSL_ERROR_WANT_WRITE from SSL_write() or SSL_write_ex() then you should not do any other operation that could trigger IO other than to repeat the previous SSL_write() call.

                          For socket BIOs (e.g. when SSL_set_fd() was used), select() or poll() on the underlying socket can be used to find out when the TLS/SSL I/O function should be retried.

                          Caveat: Any TLS/SSL I/O function can lead to either of SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE. In particular, SSL_read_ex(), SSL_read(), SSL_peek_ex(), or SSL_peek() may want to write data and SSL_write() or SSL_write_ex() may want to read data. This is mainly because TLS/SSL handshakes may occur at any time during the protocol (initiated by either the client or the server); SSL_read_ex(), SSL_read(), SSL_peek_ex(), SSL_peek(), SSL_write_ex(), and SSL_write() will handle any pending handshakes.

                        • SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT

                          The operation did not complete; the same TLS/SSL I/O function should be called again later. The underlying BIO was not connected yet to the peer and the call would block in connect()/accept(). The SSL function should be called again when the connection is established. These messages can only appear with a BIO_s_connect() or BIO_s_accept() BIO, respectively. In order to find out, when the connection has been successfully established, on many platforms select() or poll() for writing on the socket file descriptor can be used.

                        • SSL_ERROR_WANT_X509_LOOKUP

                          The operation did not complete because an application callback set by SSL_CTX_set_client_cert_cb() has asked to be called again. The TLS/SSL I/O function should be called again later. Details depend on the application.

                        • SSL_ERROR_WANT_ASYNC

                          The operation did not complete because an asynchronous engine is still processing data. This will only occur if the mode has been set to SSL_MODE_ASYNC using SSL_CTX_set_mode(3) or SSL_set_mode(3) and an asynchronous capable engine is being used. An application can determine whether the engine has completed its processing using select() or poll() on the asynchronous wait file descriptor. This file descriptor is available by calling SSL_get_all_async_fds(3) or SSL_get_changed_async_fds(3). The TLS/SSL I/O function should be called again later. The function must be called from the same thread that the original call was made from.

                        • SSL_ERROR_WANT_ASYNC_JOB

                          The asynchronous job could not be started because there were no async jobs available in the pool (see ASYNC_init_thread(3)). This will only occur if the mode has been set to SSL_MODE_ASYNC using SSL_CTX_set_mode(3) or SSL_set_mode(3) and a maximum limit has been set on the async job pool through a call to ASYNC_init_thread(3). The application should retry the operation after a currently executing asynchronous operation for the current thread has completed.

                        • SSL_ERROR_WANT_CLIENT_HELLO_CB

                          The operation did not complete because an application callback set by SSL_CTX_set_client_hello_cb() has asked to be called again. The TLS/SSL I/O function should be called again later. Details depend on the application.

                        • SSL_ERROR_SYSCALL

                          Some non-recoverable, fatal I/O error occurred. The OpenSSL error queue may contain more information on the error. For socket I/O on Unix systems, consult errno for details. If this error occurs then no further I/O operations should be performed on the connection and SSL_shutdown() must not be called.

                          This value can also be returned for other errors, check the error queue for details.

                        • SSL_ERROR_SSL

                          A non-recoverable, fatal error in the SSL library occurred, usually a protocol error. The OpenSSL error queue contains more information on the error. If this error occurs then no further I/O operations should be performed on the connection and SSL_shutdown() must not be called.

                        "},{"location":"man3/SSL_get_error/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_get_error/#history","title":"HISTORY","text":"

                        The SSL_ERROR_WANT_ASYNC error code was added in OpenSSL 1.1.0. The SSL_ERROR_WANT_CLIENT_HELLO_CB error code was added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_get_error/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_extms_support/","title":"SSL_get_extms_support","text":""},{"location":"man3/SSL_get_extms_support/#name","title":"NAME","text":"

                        SSL_get_extms_support - extended master secret support

                        "},{"location":"man3/SSL_get_extms_support/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_get_extms_support(SSL *ssl);\n
                        "},{"location":"man3/SSL_get_extms_support/#description","title":"DESCRIPTION","text":"

                        SSL_get_extms_support() indicates whether the current session used extended master secret.

                        This function is implemented as a macro.

                        "},{"location":"man3/SSL_get_extms_support/#return-values","title":"RETURN VALUES","text":"

                        SSL_get_extms_support() returns 1 if the current session used extended master secret, 0 if it did not and -1 if a handshake is currently in progress i.e. it is not possible to determine if extended master secret was used.

                        "},{"location":"man3/SSL_get_extms_support/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_get_extms_support/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_fd/","title":"SSL_get_fd","text":""},{"location":"man3/SSL_get_fd/#name","title":"NAME","text":"

                        SSL_get_fd, SSL_get_rfd, SSL_get_wfd - get file descriptor linked to an SSL object

                        "},{"location":"man3/SSL_get_fd/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_get_fd(const SSL *ssl);\nint SSL_get_rfd(const SSL *ssl);\nint SSL_get_wfd(const SSL *ssl);\n
                        "},{"location":"man3/SSL_get_fd/#description","title":"DESCRIPTION","text":"

                        SSL_get_fd() returns the file descriptor which is linked to ssl. SSL_get_rfd() and SSL_get_wfd() return the file descriptors for the read or the write channel, which can be different. If the read and the write channel are different, SSL_get_fd() will return the file descriptor of the read channel.

                        "},{"location":"man3/SSL_get_fd/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • -1

                          The operation failed, because the underlying BIO is not of the correct type (suitable for file descriptors).

                        • =0

                          The file descriptor linked to ssl.

                        "},{"location":"man3/SSL_get_fd/#see-also","title":"SEE ALSO","text":"

                        SSL_set_fd(3), ssl(7) , bio(7)

                        "},{"location":"man3/SSL_get_fd/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_peer_cert_chain/","title":"SSL_get_peer_cert_chain","text":""},{"location":"man3/SSL_get_peer_cert_chain/#name","title":"NAME","text":"

                        SSL_get_peer_cert_chain, SSL_get0_verified_chain - get the X509 certificate chain of the peer

                        "},{"location":"man3/SSL_get_peer_cert_chain/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSTACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);\nSTACK_OF(X509) *SSL_get0_verified_chain(const SSL *ssl);\n
                        "},{"location":"man3/SSL_get_peer_cert_chain/#description","title":"DESCRIPTION","text":"

                        SSL_get_peer_cert_chain() returns a pointer to STACK_OF(X509) certificates forming the certificate chain sent by the peer. If called on the client side, the stack also contains the peer's certificate; if called on the server side, the peer's certificate must be obtained separately using SSL_get_peer_certificate(3). If the peer did not present a certificate, NULL is returned.

                        NB: SSL_get_peer_cert_chain() returns the peer chain as sent by the peer: it only consists of certificates the peer has sent (in the order the peer has sent them) it is not a verified chain.

                        SSL_get0_verified_chain() returns the verified certificate chain of the peer including the peer's end entity certificate. It must be called after a session has been successfully established. If peer verification was not successful (as indicated by SSL_get_verify_result() not returning X509_V_OK) the chain may be incomplete or invalid.

                        "},{"location":"man3/SSL_get_peer_cert_chain/#notes","title":"NOTES","text":"

                        If the session is resumed peers do not send certificates so a NULL pointer is returned by these functions. Applications can call SSL_session_reused() to determine whether a session is resumed.

                        The reference count of each certificate in the returned STACK_OF(X509) object is not incremented and the returned stack may be invalidated by renegotiation. If applications wish to use any certificates in the returned chain indefinitely they must increase the reference counts using X509_up_ref() or obtain a copy of the whole chain with X509_chain_up_ref().

                        "},{"location":"man3/SSL_get_peer_cert_chain/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • NULL

                          No certificate was presented by the peer or no connection was established or the certificate chain is no longer available when a session is reused.

                        • Pointer to a STACK_OF(X509)

                          The return value points to the certificate chain presented by the peer.

                        "},{"location":"man3/SSL_get_peer_cert_chain/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_peer_certificate(3), X509_up_ref(3), X509_chain_up_ref(3)

                        "},{"location":"man3/SSL_get_peer_cert_chain/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_peer_certificate/","title":"SSL_get_peer_certificate","text":""},{"location":"man3/SSL_get_peer_certificate/#name","title":"NAME","text":"

                        SSL_get_peer_certificate, SSL_get0_peer_certificate, SSL_get1_peer_certificate - get the X509 certificate of the peer

                        "},{"location":"man3/SSL_get_peer_certificate/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nX509 *SSL_get0_peer_certificate(const SSL *ssl);\nX509 *SSL_get1_peer_certificate(const SSL *ssl);\n

                        The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        X509 *SSL_get_peer_certificate(const SSL *ssl);\n
                        "},{"location":"man3/SSL_get_peer_certificate/#description","title":"DESCRIPTION","text":"

                        These functions return a pointer to the X509 certificate the peer presented. If the peer did not present a certificate, NULL is returned.

                        "},{"location":"man3/SSL_get_peer_certificate/#notes","title":"NOTES","text":"

                        Due to the protocol definition, a TLS/SSL server will always send a certificate, if present. A client will only send a certificate when explicitly requested to do so by the server (see SSL_CTX_set_verify(3)). If an anonymous cipher is used, no certificates are sent.

                        That a certificate is returned does not indicate information about the verification state, use SSL_get_verify_result(3) to check the verification state.

                        The reference count of the X509 object returned by SSL_get1_peer_certificate() is incremented by one, so that it will not be destroyed when the session containing the peer certificate is freed. The X509 object must be explicitly freed using X509_free().

                        The reference count of the X509 object returned by SSL_get0_peer_certificate() is not incremented, and must not be freed.

                        SSL_get_peer_certificate() is an alias of SSL_get1_peer_certificate().

                        "},{"location":"man3/SSL_get_peer_certificate/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • NULL

                          No certificate was presented by the peer or no connection was established.

                        • Pointer to an X509 certificate

                          The return value points to the certificate presented by the peer.

                        "},{"location":"man3/SSL_get_peer_certificate/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_verify_result(3), SSL_CTX_set_verify(3)

                        "},{"location":"man3/SSL_get_peer_certificate/#history","title":"HISTORY","text":"

                        SSL_get0_peer_certificate() and SSL_get1_peer_certificate() were added in 3.0.0. SSL_get_peer_certificate() was deprecated in 3.0.0.

                        "},{"location":"man3/SSL_get_peer_certificate/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_peer_signature_nid/","title":"SSL_get_peer_signature_nid","text":""},{"location":"man3/SSL_get_peer_signature_nid/#name","title":"NAME","text":"

                        SSL_get_peer_signature_nid, SSL_get_peer_signature_type_nid, SSL_get_signature_nid, SSL_get_signature_type_nid - get TLS message signing types

                        "},{"location":"man3/SSL_get_peer_signature_nid/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_get_peer_signature_nid(SSL *ssl, int *psig_nid);\nint SSL_get_peer_signature_type_nid(const SSL *ssl, int *psigtype_nid);\nint SSL_get_signature_nid(SSL *ssl, int *psig_nid);\nint SSL_get_signature_type_nid(const SSL *ssl, int *psigtype_nid);\n
                        "},{"location":"man3/SSL_get_peer_signature_nid/#description","title":"DESCRIPTION","text":"

                        SSL_get_peer_signature_nid() sets *psig_nid to the NID of the digest used by the peer to sign TLS messages. It is implemented as a macro.

                        SSL_get_peer_signature_type_nid() sets *psigtype_nid to the signature type used by the peer to sign TLS messages. Currently the signature type is the NID of the public key type used for signing except for PSS signing where it is EVP_PKEY_RSA_PSS. To differentiate between rsa_pss_rsae_* and rsa_pss_pss_* signatures, it's necessary to check the type of public key in the peer's certificate.

                        SSL_get_signature_nid() and SSL_get_signature_type_nid() return the equivalent information for the local end of the connection.

                        "},{"location":"man3/SSL_get_peer_signature_nid/#return-values","title":"RETURN VALUES","text":"

                        These functions return 1 for success and 0 for failure. There are several possible reasons for failure: the cipher suite has no signature (e.g. it uses RSA key exchange or is anonymous), the TLS version is below 1.2 or the functions were called too early, e.g. before the peer signed a message.

                        "},{"location":"man3/SSL_get_peer_signature_nid/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_peer_certificate(3),

                        "},{"location":"man3/SSL_get_peer_signature_nid/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_peer_tmp_key/","title":"SSL_get_peer_tmp_key","text":""},{"location":"man3/SSL_get_peer_tmp_key/#name","title":"NAME","text":"

                        SSL_get_peer_tmp_key, SSL_get_server_tmp_key, SSL_get_tmp_key - get information about temporary keys used during a handshake

                        "},{"location":"man3/SSL_get_peer_tmp_key/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_get_peer_tmp_key(SSL *ssl, EVP_PKEY **key);\nlong SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **key);\nlong SSL_get_tmp_key(SSL *ssl, EVP_PKEY **key);\n
                        "},{"location":"man3/SSL_get_peer_tmp_key/#description","title":"DESCRIPTION","text":"

                        SSL_get_peer_tmp_key() returns the temporary key provided by the peer and used during key exchange. For example, if ECDHE is in use, then this represents the peer's public ECDHE key. On success a pointer to the key is stored in *key. It is the caller's responsibility to free this key after use using EVP_PKEY_free(3).

                        SSL_get_server_tmp_key() is a backwards compatibility alias for SSL_get_peer_tmp_key(). Under that name it worked just on the client side of the connection, its behaviour on the server end is release-dependent.

                        SSL_get_tmp_key() returns the equivalent information for the local end of the connection.

                        "},{"location":"man3/SSL_get_peer_tmp_key/#return-values","title":"RETURN VALUES","text":"

                        All these functions return 1 on success and 0 otherwise.

                        "},{"location":"man3/SSL_get_peer_tmp_key/#notes","title":"NOTES","text":"

                        This function is implemented as a macro.

                        "},{"location":"man3/SSL_get_peer_tmp_key/#see-also","title":"SEE ALSO","text":"

                        ssl(7), EVP_PKEY_free(3)

                        "},{"location":"man3/SSL_get_peer_tmp_key/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_psk_identity/","title":"SSL_get_psk_identity","text":""},{"location":"man3/SSL_get_psk_identity/#name","title":"NAME","text":"

                        SSL_get_psk_identity, SSL_get_psk_identity_hint - get PSK client identity and hint

                        "},{"location":"man3/SSL_get_psk_identity/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst char *SSL_get_psk_identity_hint(const SSL *ssl);\nconst char *SSL_get_psk_identity(const SSL *ssl);\n
                        "},{"location":"man3/SSL_get_psk_identity/#description","title":"DESCRIPTION","text":"

                        SSL_get_psk_identity_hint() is used to retrieve the PSK identity hint used during the connection setup related to SSL object ssl. Similarly, SSL_get_psk_identity() is used to retrieve the PSK identity used during the connection setup.

                        "},{"location":"man3/SSL_get_psk_identity/#return-values","title":"RETURN VALUES","text":"

                        If non-NULL, SSL_get_psk_identity_hint() returns the PSK identity hint and SSL_get_psk_identity() returns the PSK identity. Both are NULL-terminated. SSL_get_psk_identity_hint() may return NULL if no PSK identity hint was used during the connection setup.

                        Note that the return value is valid only during the lifetime of the SSL object ssl.

                        "},{"location":"man3/SSL_get_psk_identity/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_get_psk_identity/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_rbio/","title":"SSL_get_rbio","text":""},{"location":"man3/SSL_get_rbio/#name","title":"NAME","text":"

                        SSL_get_rbio, SSL_get_wbio - get BIO linked to an SSL object

                        "},{"location":"man3/SSL_get_rbio/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nBIO *SSL_get_rbio(SSL *ssl);\nBIO *SSL_get_wbio(SSL *ssl);\n
                        "},{"location":"man3/SSL_get_rbio/#description","title":"DESCRIPTION","text":"

                        SSL_get_rbio() and SSL_get_wbio() return pointers to the BIOs for the read or the write channel, which can be different. The reference count of the BIO is not incremented.

                        "},{"location":"man3/SSL_get_rbio/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • NULL

                          No BIO was connected to the SSL object

                        • Any other pointer

                          The BIO linked to ssl.

                        "},{"location":"man3/SSL_get_rbio/#see-also","title":"SEE ALSO","text":"

                        SSL_set_bio(3), ssl(7) , bio(7)

                        "},{"location":"man3/SSL_get_rbio/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_session/","title":"SSL_get_session","text":""},{"location":"man3/SSL_get_session/#name","title":"NAME","text":"

                        SSL_get_session, SSL_get0_session, SSL_get1_session - retrieve TLS/SSL session data

                        "},{"location":"man3/SSL_get_session/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSSL_SESSION *SSL_get_session(const SSL *ssl);\nSSL_SESSION *SSL_get0_session(const SSL *ssl);\nSSL_SESSION *SSL_get1_session(SSL *ssl);\n
                        "},{"location":"man3/SSL_get_session/#description","title":"DESCRIPTION","text":"

                        SSL_get_session() returns a pointer to the SSL_SESSION actually used in ssl. The reference count of the SSL_SESSION is not incremented, so that the pointer can become invalid by other operations.

                        SSL_get0_session() is the same as SSL_get_session().

                        SSL_get1_session() is the same as SSL_get_session(), but the reference count of the SSL_SESSION is incremented by one.

                        "},{"location":"man3/SSL_get_session/#notes","title":"NOTES","text":"

                        The ssl session contains all information required to re-establish the connection without a full handshake for SSL versions up to and including TLSv1.2. In TLSv1.3 the same is true, but sessions are established after the main handshake has occurred. The server will send the session information to the client at a time of its choosing, which may be some while after the initial connection is established (or never). Calling these functions on the client side in TLSv1.3 before the session has been established will still return an SSL_SESSION object but that object cannot be used for resuming the session. See SSL_SESSION_is_resumable(3) for information on how to determine whether an SSL_SESSION object can be used for resumption or not.

                        Additionally, in TLSv1.3, a server can send multiple messages that establish a session for a single connection. In that case, on the client side, the above functions will only return information on the last session that was received. On the server side they will only return information on the last session that was sent, or if no session tickets were sent then the session for the current connection.

                        The preferred way for applications to obtain a resumable SSL_SESSION object is to use a new session callback as described in SSL_CTX_sess_set_new_cb(3). The new session callback is only invoked when a session is actually established, so this avoids the problem described above where an application obtains an SSL_SESSION object that cannot be used for resumption in TLSv1.3. It also enables applications to obtain information about all sessions sent by the server.

                        A session will be automatically removed from the session cache and marked as non-resumable if the connection is not closed down cleanly, e.g. if a fatal error occurs on the connection or SSL_shutdown(3) is not called prior to SSL_free(3).

                        In TLSv1.3 it is recommended that each SSL_SESSION object is only used for resumption once.

                        SSL_get0_session() returns a pointer to the actual session. As the reference counter is not incremented, the pointer is only valid while the connection is in use. If SSL_clear(3) or SSL_free(3) is called, the session may be removed completely (if considered bad), and the pointer obtained will become invalid. Even if the session is valid, it can be removed at any time due to timeout during SSL_CTX_flush_sessions(3).

                        If the data is to be kept, SSL_get1_session() will increment the reference count, so that the session will not be implicitly removed by other operations but stays in memory. In order to remove the session SSL_SESSION_free(3) must be explicitly called once to decrement the reference count again.

                        SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object).

                        "},{"location":"man3/SSL_get_session/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • NULL

                          There is no session available in ssl.

                        • Pointer to an SSL_SESSION

                          The return value points to the data of an SSL session.

                        "},{"location":"man3/SSL_get_session/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_free(3), SSL_clear(3), SSL_SESSION_free(3)

                        "},{"location":"man3/SSL_get_session/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_shared_sigalgs/","title":"SSL_get_shared_sigalgs","text":""},{"location":"man3/SSL_get_shared_sigalgs/#name","title":"NAME","text":"

                        SSL_get_shared_sigalgs, SSL_get_sigalgs - get supported signature algorithms

                        "},{"location":"man3/SSL_get_shared_sigalgs/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_get_shared_sigalgs(SSL *s, int idx,\n                           int *psign, int *phash, int *psignhash,\n                           unsigned char *rsig, unsigned char *rhash);\n\nint SSL_get_sigalgs(SSL *s, int idx,\n                    int *psign, int *phash, int *psignhash,\n                    unsigned char *rsig, unsigned char *rhash);\n
                        "},{"location":"man3/SSL_get_shared_sigalgs/#description","title":"DESCRIPTION","text":"

                        SSL_get_shared_sigalgs() returns information about the shared signature algorithms supported by peer s. The parameter idx indicates the index of the shared signature algorithm to return starting from zero. The signature algorithm NID is written to *psign, the hash NID to *phash and the sign and hash NID to *psignhash. The raw signature and hash values are written to *rsig and *rhash.

                        SSL_get_sigalgs() is similar to SSL_get_shared_sigalgs() except it returns information about all signature algorithms supported by s in the order they were sent by the peer.

                        "},{"location":"man3/SSL_get_shared_sigalgs/#return-values","title":"RETURN VALUES","text":"

                        SSL_get_shared_sigalgs() and SSL_get_sigalgs() return the number of signature algorithms or 0 if the idx parameter is out of range.

                        "},{"location":"man3/SSL_get_shared_sigalgs/#notes","title":"NOTES","text":"

                        These functions are typically called for debugging purposes (to report the peer's preferences) or where an application wants finer control over certificate selection. Most applications will rely on internal handling and will not need to call them.

                        If an application is only interested in the highest preference shared signature algorithm it can just set idx to zero.

                        Any or all of the parameters psign, phash, psignhash, rsig or rhash can be set to NULL if the value is not required. By setting them all to NULL and setting idx to zero the total number of signature algorithms can be determined: which can be zero.

                        These functions must be called after the peer has sent a list of supported signature algorithms: after a client hello (for servers) or a certificate request (for clients). They can (for example) be called in the certificate callback.

                        Only TLS 1.2, TLS 1.3 and DTLS 1.2 currently support signature algorithms. If these functions are called on an earlier version of TLS or DTLS zero is returned.

                        The shared signature algorithms returned by SSL_get_shared_sigalgs() are ordered according to configuration and peer preferences.

                        The raw values correspond to the on the wire form as defined by RFC5246 et al. The NIDs are OpenSSL equivalents. For example if the peer sent sha256(4) and rsa(1) then *rhash would be 4, *rsign 1, *phash NID_sha256, *psig NID_rsaEncryption and *psighash NID_sha256WithRSAEncryption.

                        If a signature algorithm is not recognised the corresponding NIDs will be set to NID_undef. This may be because the value is not supported, is not an appropriate combination (for example MD5 and DSA) or the signature algorithm does not use a hash (for example Ed25519).

                        "},{"location":"man3/SSL_get_shared_sigalgs/#see-also","title":"SEE ALSO","text":"

                        SSL_CTX_set_cert_cb(3), ssl(7)

                        "},{"location":"man3/SSL_get_shared_sigalgs/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_verify_result/","title":"SSL_get_verify_result","text":""},{"location":"man3/SSL_get_verify_result/#name","title":"NAME","text":"

                        SSL_get_verify_result - get result of peer certificate verification

                        "},{"location":"man3/SSL_get_verify_result/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nlong SSL_get_verify_result(const SSL *ssl);\n
                        "},{"location":"man3/SSL_get_verify_result/#description","title":"DESCRIPTION","text":"

                        SSL_get_verify_result() returns the result of the verification of the X509 certificate presented by the peer, if any.

                        "},{"location":"man3/SSL_get_verify_result/#notes","title":"NOTES","text":"

                        SSL_get_verify_result() can only return one error code while the verification of a certificate can fail because of many reasons at the same time. Only the last verification error that occurred during the processing is available from SSL_get_verify_result().

                        Sometimes there can be a sequence of errors leading to the verification failure as reported by SSL_get_verify_result(). To get the errors, it is necessary to setup a verify callback via SSL_CTX_set_verify(3) or SSL_set_verify(3) and retrieve the errors from the error stack there, because once SSL_connect(3) returns, these errors may no longer be available.

                        The verification result is part of the established session and is restored when a session is reused.

                        "},{"location":"man3/SSL_get_verify_result/#bugs","title":"BUGS","text":"

                        If no peer certificate was presented, the returned result code is X509_V_OK. This is because no verification error occurred, it does however not indicate success. SSL_get_verify_result() is only useful in connection with SSL_get_peer_certificate(3).

                        "},{"location":"man3/SSL_get_verify_result/#return-values","title":"RETURN VALUES","text":"

                        The following return values can currently occur:

                        • X509_V_OK

                          The verification succeeded or no peer certificate was presented.

                        • Any other value

                          Documented in openssl-verify(1).

                        "},{"location":"man3/SSL_get_verify_result/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_set_verify_result(3), SSL_get_peer_certificate(3), openssl-verify(1)

                        "},{"location":"man3/SSL_get_verify_result/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_get_version/","title":"SSL_get_version","text":""},{"location":"man3/SSL_get_version/#name","title":"NAME","text":"

                        SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_version - get the protocol information of a connection

                        "},{"location":"man3/SSL_get_version/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_client_version(const SSL *s);\n\nconst char *SSL_get_version(const SSL *ssl);\n\nint SSL_is_dtls(const SSL *ssl);\n\nint SSL_version(const SSL *s);\n
                        "},{"location":"man3/SSL_get_version/#description","title":"DESCRIPTION","text":"

                        SSL_client_version() returns the numeric protocol version advertised by the client in the legacy_version field of the ClientHello when initiating the connection. Note that, for TLS, this value will never indicate a version greater than TLSv1.2 even if TLSv1.3 is subsequently negotiated. SSL_get_version() returns the name of the protocol used for the connection. SSL_version() returns the numeric protocol version used for the connection. They should only be called after the initial handshake has been completed. Prior to that the results returned from these functions may be unreliable.

                        SSL_is_dtls() returns one if the connection is using DTLS, zero if not.

                        "},{"location":"man3/SSL_get_version/#return-values","title":"RETURN VALUES","text":"

                        SSL_get_version() returns one of the following strings:

                        • SSLv3

                          The connection uses the SSLv3 protocol.

                        • TLSv1

                          The connection uses the TLSv1.0 protocol.

                        • TLSv1.1

                          The connection uses the TLSv1.1 protocol.

                        • TLSv1.2

                          The connection uses the TLSv1.2 protocol.

                        • TLSv1.3

                          The connection uses the TLSv1.3 protocol.

                        • unknown

                          This indicates an unknown protocol version.

                        SSL_version() and SSL_client_version() return an integer which could include any of the following:

                        • SSL3_VERSION

                          The connection uses the SSLv3 protocol.

                        • TLS1_VERSION

                          The connection uses the TLSv1.0 protocol.

                        • TLS1_1_VERSION

                          The connection uses the TLSv1.1 protocol.

                        • TLS1_2_VERSION

                          The connection uses the TLSv1.2 protocol.

                        • TLS1_3_VERSION

                          The connection uses the TLSv1.3 protocol (never returned for SSL_client_version()).

                        "},{"location":"man3/SSL_get_version/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_get_version/#history","title":"HISTORY","text":"

                        The SSL_is_dtls() function was added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_get_version/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_group_to_name/","title":"SSL_group_to_name","text":""},{"location":"man3/SSL_group_to_name/#name","title":"NAME","text":"

                        SSL_group_to_name - get name of group

                        "},{"location":"man3/SSL_group_to_name/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst char *SSL_group_to_name(const SSL *ssl, int id);\n
                        "},{"location":"man3/SSL_group_to_name/#description","title":"DESCRIPTION","text":"

                        SSL_group_to_name() is used to retrieve the TLS group name associated with a given TLS group ID, as registered via built-in or external providers and as returned by a call to SSL_get1_groups() or SSL_get_shared_group().

                        "},{"location":"man3/SSL_group_to_name/#return-values","title":"RETURN VALUES","text":"

                        If non-NULL, SSL_group_to_name() returns the TLS group name corresponding to the given id as a NUL-terminated string. If SSL_group_to_name() returns NULL, an error occurred; possibly no corresponding tlsname was registered during provider initialisation.

                        Note that the return value is valid only during the lifetime of the SSL object ssl.

                        "},{"location":"man3/SSL_group_to_name/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_group_to_name/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_in_init/","title":"SSL_in_init","text":""},{"location":"man3/SSL_in_init/#name","title":"NAME","text":"

                        SSL_in_before, SSL_in_init, SSL_is_init_finished, SSL_in_connect_init, SSL_in_accept_init, SSL_get_state - retrieve information about the handshake state machine

                        "},{"location":"man3/SSL_in_init/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_in_init(const SSL *s);\nint SSL_in_before(const SSL *s);\nint SSL_is_init_finished(const SSL *s);\n\nint SSL_in_connect_init(SSL *s);\nint SSL_in_accept_init(SSL *s);\n\nOSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl);\n
                        "},{"location":"man3/SSL_in_init/#description","title":"DESCRIPTION","text":"

                        SSL_in_init() returns 1 if the SSL/TLS state machine is currently processing or awaiting handshake messages, or 0 otherwise.

                        SSL_in_before() returns 1 if no SSL/TLS handshake has yet been initiated, or 0 otherwise.

                        SSL_is_init_finished() returns 1 if the SSL/TLS connection is in a state where fully protected application data can be transferred or 0 otherwise.

                        Note that in some circumstances (such as when early data is being transferred) SSL_in_init(), SSL_in_before() and SSL_is_init_finished() can all return 0.

                        SSL_in_connect_init() returns 1 if s is acting as a client and SSL_in_init() would return 1, or 0 otherwise.

                        SSL_in_accept_init() returns 1 if s is acting as a server and SSL_in_init() would return 1, or 0 otherwise.

                        SSL_in_connect_init() and SSL_in_accept_init() are implemented as macros.

                        SSL_get_state() returns a value indicating the current state of the handshake state machine. OSSL_HANDSHAKE_STATE is an enumerated type where each value indicates a discrete state machine state. Note that future versions of OpenSSL may define more states so applications should expect to receive unrecognised state values. The naming format is made up of a number of elements as follows:

                        protocol_ST_role_message

                        protocol is one of TLS or DTLS. DTLS is used where a state is specific to the DTLS protocol. Otherwise TLS is used.

                        role is one of CR, CW, SR or SW to indicate \"client reading\", \"client writing\", \"server reading\" or \"server writing\" respectively.

                        message is the name of a handshake message that is being or has been sent, or is being or has been processed.

                        Additionally there are some special states that do not conform to the above format. These are:

                        • TLS_ST_BEFORE

                          No handshake messages have yet been been sent or received.

                        • TLS_ST_OK

                          Handshake message sending/processing has completed.

                        • TLS_ST_EARLY_DATA

                          Early data is being processed

                        • TLS_ST_PENDING_EARLY_DATA_END

                          Awaiting the end of early data processing

                        "},{"location":"man3/SSL_in_init/#return-values","title":"RETURN VALUES","text":"

                        SSL_in_init(), SSL_in_before(), SSL_is_init_finished(), SSL_in_connect_init() and SSL_in_accept_init() return values as indicated above.

                        SSL_get_state() returns the current handshake state.

                        "},{"location":"man3/SSL_in_init/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_read_early_data(3)

                        "},{"location":"man3/SSL_in_init/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_key_update/","title":"SSL_key_update","text":""},{"location":"man3/SSL_key_update/#name","title":"NAME","text":"

                        SSL_key_update, SSL_get_key_update_type, SSL_renegotiate, SSL_renegotiate_abbreviated, SSL_renegotiate_pending - initiate and obtain information about updating connection keys

                        "},{"location":"man3/SSL_key_update/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_key_update(SSL *s, int updatetype);\nint SSL_get_key_update_type(const SSL *s);\n\nint SSL_renegotiate(SSL *s);\nint SSL_renegotiate_abbreviated(SSL *s);\nint SSL_renegotiate_pending(const SSL *s);\n
                        "},{"location":"man3/SSL_key_update/#description","title":"DESCRIPTION","text":"

                        SSL_key_update() schedules an update of the keys for the current TLS connection. If the updatetype parameter is set to SSL_KEY_UPDATE_NOT_REQUESTED then the sending keys for this connection will be updated and the peer will be informed of the change. If the updatetype parameter is set to SSL_KEY_UPDATE_REQUESTED then the sending keys for this connection will be updated and the peer will be informed of the change along with a request for the peer to additionally update its sending keys. It is an error if updatetype is set to SSL_KEY_UPDATE_NONE.

                        SSL_key_update() must only be called after the initial handshake has been completed and TLSv1.3 has been negotiated, at the same time, the application needs to ensure that the writing of data has been completed. The key update will not take place until the next time an IO operation such as SSL_read_ex() or SSL_write_ex() takes place on the connection. Alternatively SSL_do_handshake() can be called to force the update to take place immediately.

                        SSL_get_key_update_type() can be used to determine whether a key update operation has been scheduled but not yet performed. The type of the pending key update operation will be returned if there is one, or SSL_KEY_UPDATE_NONE otherwise.

                        SSL_renegotiate() and SSL_renegotiate_abbreviated() should only be called for connections that have negotiated TLSv1.2 or less. Calling them on any other connection will result in an error.

                        When called from the client side, SSL_renegotiate() schedules a completely new handshake over an existing SSL/TLS connection. The next time an IO operation such as SSL_read_ex() or SSL_write_ex() takes place on the connection a check will be performed to confirm that it is a suitable time to start a renegotiation. If so, then it will be initiated immediately. OpenSSL will not attempt to resume any session associated with the connection in the new handshake.

                        When called from the client side, SSL_renegotiate_abbreviated() works in the same was as SSL_renegotiate() except that OpenSSL will attempt to resume the session associated with the current connection in the new handshake.

                        When called from the server side, SSL_renegotiate() and SSL_renegotiate_abbreviated() behave identically. They both schedule a request for a new handshake to be sent to the client. The next time an IO operation is performed then the same checks as on the client side are performed and then, if appropriate, the request is sent. The client may or may not respond with a new handshake and it may or may not attempt to resume an existing session. If a new handshake is started then this will be handled transparently by calling any OpenSSL IO function.

                        If an OpenSSL client receives a renegotiation request from a server then again this will be handled transparently through calling any OpenSSL IO function. For a TLS connection the client will attempt to resume the current session in the new handshake. For historical reasons, DTLS clients will not attempt to resume the session in the new handshake.

                        The SSL_renegotiate_pending() function returns 1 if a renegotiation or renegotiation request has been scheduled but not yet acted on, or 0 otherwise.

                        "},{"location":"man3/SSL_key_update/#return-values","title":"RETURN VALUES","text":"

                        SSL_key_update(), SSL_renegotiate() and SSL_renegotiate_abbreviated() return 1 on success or 0 on error.

                        SSL_get_key_update_type() returns the update type of the pending key update operation or SSL_KEY_UPDATE_NONE if there is none.

                        SSL_renegotiate_pending() returns 1 if a renegotiation or renegotiation request has been scheduled but not yet acted on, or 0 otherwise.

                        "},{"location":"man3/SSL_key_update/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_read_ex(3), SSL_write_ex(3), SSL_do_handshake(3)

                        "},{"location":"man3/SSL_key_update/#history","title":"HISTORY","text":"

                        The SSL_key_update() and SSL_get_key_update_type() functions were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_key_update/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_library_init/","title":"SSL_library_init","text":""},{"location":"man3/SSL_library_init/#name","title":"NAME","text":"

                        SSL_library_init, OpenSSL_add_ssl_algorithms - initialize SSL library by registering algorithms

                        "},{"location":"man3/SSL_library_init/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_library_init(void);\n\nint OpenSSL_add_ssl_algorithms(void);\n
                        "},{"location":"man3/SSL_library_init/#description","title":"DESCRIPTION","text":"

                        SSL_library_init() registers the available SSL/TLS ciphers and digests.

                        OpenSSL_add_ssl_algorithms() is a synonym for SSL_library_init() and is implemented as a macro.

                        "},{"location":"man3/SSL_library_init/#notes","title":"NOTES","text":"

                        SSL_library_init() must be called before any other action takes place. SSL_library_init() is not reentrant.

                        "},{"location":"man3/SSL_library_init/#warnings","title":"WARNINGS","text":"

                        SSL_library_init() adds ciphers and digests used directly and indirectly by SSL/TLS.

                        "},{"location":"man3/SSL_library_init/#return-values","title":"RETURN VALUES","text":"

                        SSL_library_init() always returns \"1\", so it is safe to discard the return value.

                        "},{"location":"man3/SSL_library_init/#see-also","title":"SEE ALSO","text":"

                        ssl(7), RAND_add(3)

                        "},{"location":"man3/SSL_library_init/#history","title":"HISTORY","text":"

                        The SSL_library_init() and OpenSSL_add_ssl_algorithms() functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_ssl().

                        "},{"location":"man3/SSL_library_init/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_load_client_CA_file/","title":"SSL_load_client_CA_file","text":""},{"location":"man3/SSL_load_client_CA_file/#name","title":"NAME","text":"

                        SSL_load_client_CA_file_ex, SSL_load_client_CA_file, SSL_add_file_cert_subjects_to_stack, SSL_add_dir_cert_subjects_to_stack, SSL_add_store_cert_subjects_to_stack - load certificate names

                        "},{"location":"man3/SSL_load_client_CA_file/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSTACK_OF(X509_NAME) *SSL_load_client_CA_file_ex(const char *file,\n                                                OSSL_LIB_CTX *libctx,\n                                                const char *propq);\nSTACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);\n\nint SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n                                        const char *file);\nint SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n                                       const char *dir);\nint SSL_add_store_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n                                         const char *store);\n
                        "},{"location":"man3/SSL_load_client_CA_file/#description","title":"DESCRIPTION","text":"

                        SSL_load_client_CA_file_ex() reads certificates from file and returns a STACK_OF(X509_NAME) with the subject names found. The library context libctx and property query propq are used when fetching algorithms from providers.

                        SSL_load_client_CA_file() is similar to SSL_load_client_CA_file_ex() but uses NULL for the library context libctx and property query propq.

                        SSL_add_file_cert_subjects_to_stack() reads certificates from file, and adds their subject name to the already existing stack.

                        SSL_add_dir_cert_subjects_to_stack() reads certificates from every file in the directory dir, and adds their subject name to the already existing stack.

                        SSL_add_store_cert_subjects_to_stack() loads certificates from the store URI, and adds their subject name to the already existing stack.

                        "},{"location":"man3/SSL_load_client_CA_file/#notes","title":"NOTES","text":"

                        SSL_load_client_CA_file() reads a file of PEM formatted certificates and extracts the X509_NAMES of the certificates found. While the name suggests the specific usage as support function for SSL_CTX_set_client_CA_list(3), it is not limited to CA certificates.

                        "},{"location":"man3/SSL_load_client_CA_file/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur for SSL_load_client_CA_file_ex(), and SSL_load_client_CA_file():

                        • NULL

                          The operation failed, check out the error stack for the reason.

                        • Pointer to STACK_OF(X509_NAME)

                          Pointer to the subject names of the successfully read certificates.

                        The following return values can occur for SSL_add_file_cert_subjects_to_stack(), SSL_add_dir_cert_subjects_to_stack(), and SSL_add_store_cert_subjects_to_stack():

                        • 0 (Failure)

                          The operation failed.

                        • 1 (Success)

                          The operation succeeded.

                        "},{"location":"man3/SSL_load_client_CA_file/#examples","title":"EXAMPLES","text":"

                        Load names of CAs from file and use it as a client CA list:

                        SSL_CTX *ctx;\nSTACK_OF(X509_NAME) *cert_names;\n\n...\ncert_names = SSL_load_client_CA_file(\"/path/to/CAfile.pem\");\nif (cert_names != NULL)\n    SSL_CTX_set_client_CA_list(ctx, cert_names);\nelse\n    /* error */\n...\n
                        "},{"location":"man3/SSL_load_client_CA_file/#see-also","title":"SEE ALSO","text":"

                        ssl(7), ossl_store(7), SSL_CTX_set_client_CA_list(3)

                        "},{"location":"man3/SSL_load_client_CA_file/#history","title":"HISTORY","text":"

                        SSL_load_client_CA_file_ex() and SSL_add_store_cert_subjects_to_stack() were added in OpenSSL 3.0.

                        "},{"location":"man3/SSL_load_client_CA_file/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_new/","title":"SSL_new","text":""},{"location":"man3/SSL_new/#name","title":"NAME","text":"

                        SSL_dup, SSL_new, SSL_up_ref - create an SSL structure for a connection

                        "},{"location":"man3/SSL_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSSL *SSL_dup(SSL *s);\nSSL *SSL_new(SSL_CTX *ctx);\nint SSL_up_ref(SSL *s);\n
                        "},{"location":"man3/SSL_new/#description","title":"DESCRIPTION","text":"

                        SSL_new() creates a new SSL structure which is needed to hold the data for a TLS/SSL connection. The new structure inherits the settings of the underlying context ctx: connection method, options, verification settings, timeout settings. An SSL structure is reference counted. Creating an SSL structure for the first time increments the reference count. Freeing it (using SSL_free) decrements it. When the reference count drops to zero, any memory or resources allocated to the SSL structure are freed.

                        SSL_up_ref() increments the reference count for an existing SSL structure.

                        The function SSL_dup() creates and returns a new SSL structure from the same SSL_CTX that was used to create s. It additionally duplicates a subset of the settings in s into the new SSL object.

                        For SSL_dup() to work, the connection MUST be in its initial state and MUST NOT have yet started the SSL handshake. For connections that are not in their initial state SSL_dup() just increments an internal reference count and returns the same handle. It may be possible to use SSL_clear(3) to recycle an SSL handle that is not in its initial state for reuse, but this is best avoided. Instead, save and restore the session, if desired, and construct a fresh handle for each connection.

                        The subset of settings in s that are duplicated are:

                        • any session data if configured (including the session_id_context)
                        • any tmp_dh settings set via SSL_set_tmp_dh(3), SSL_set_tmp_dh_callback(3), or SSL_set_dh_auto(3)
                        • any configured certificates, private keys or certificate chains
                        • any configured signature algorithms, or client signature algorithms
                        • any DANE settings
                        • any Options set via SSL_set_options(3)
                        • any Mode set via SSL_set_mode(3)
                        • any minimum or maximum protocol settings set via SSL_set_min_proto_version(3) or SSL_set_max_proto_version(3) (Note: Only from OpenSSL 1.1.1h and above)
                        • any verify mode, callback or depth set via SSL_set_verify(3) or SSL_set_verify_depth(3) or any configured X509 verification parameters
                        • any msg callback or info callback set via SSL_set_msg_callback(3) or SSL_set_info_callback(3)
                        • any default password callback set via SSL_set_default_passwd_cb(3)
                        • any session id generation callback set via SSL_set_generate_session_id(3)
                        • any configured Cipher List
                        • initial accept (server) or connect (client) state
                        • the max cert list value set via SSL_set_max_cert_list(3)
                        • the read_ahead value set via SSL_set_read_ahead(3)
                        • application specific data set via SSL_set_ex_data(3)
                        • any CA list or client CA list set via SSL_set0_CA_list(3), SSL_set0_client_CA_list() or similar functions
                        • any security level settings or callbacks
                        • any configured serverinfo data
                        • any configured PSK identity hint
                        • any configured custom extensions
                        • any client certificate types configured via SSL_set1_client_certificate_types
                        "},{"location":"man3/SSL_new/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • NULL

                          The creation of a new SSL structure failed. Check the error stack to find out the reason.

                        • Pointer to an SSL structure

                          The return value points to an allocated SSL structure.

                          SSL_up_ref() returns 1 for success and 0 for failure.

                        "},{"location":"man3/SSL_new/#see-also","title":"SEE ALSO","text":"

                        SSL_free(3), SSL_clear(3), SSL_CTX_set_options(3), SSL_get_SSL_CTX(3), ssl(7)

                        "},{"location":"man3/SSL_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_pending/","title":"SSL_pending","text":""},{"location":"man3/SSL_pending/#name","title":"NAME","text":"

                        SSL_pending, SSL_has_pending - check for readable bytes buffered in an SSL object

                        "},{"location":"man3/SSL_pending/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_pending(const SSL *ssl);\nint SSL_has_pending(const SSL *s);\n
                        "},{"location":"man3/SSL_pending/#description","title":"DESCRIPTION","text":"

                        Data is received in whole blocks known as records from the peer. A whole record is processed (e.g. decrypted) in one go and is buffered by OpenSSL until it is read by the application via a call to SSL_read_ex(3) or SSL_read(3).

                        SSL_pending() returns the number of bytes which have been processed, buffered and are available inside ssl for immediate read.

                        If the SSL object's read_ahead flag is set (see SSL_CTX_set_read_ahead(3)), additional protocol bytes (beyond the current record) may have been read containing more TLS/SSL records. This also applies to DTLS and pipelining (see SSL_CTX_set_split_send_fragment(3)). These additional bytes will be buffered by OpenSSL but will remain unprocessed until they are needed. As these bytes are still in an unprocessed state SSL_pending() will ignore them. Therefore, it is possible for no more bytes to be readable from the underlying BIO (because OpenSSL has already read them) and for SSL_pending() to return 0, even though readable application data bytes are available (because the data is in unprocessed buffered records).

                        SSL_has_pending() returns 1 if s has buffered data (whether processed or unprocessed) and 0 otherwise. Note that it is possible for SSL_has_pending() to return 1, and then a subsequent call to SSL_read_ex() or SSL_read() to return no data because the unprocessed buffered data when processed yielded no application data (for example this can happen during renegotiation). It is also possible in this scenario for SSL_has_pending() to continue to return 1 even after an SSL_read_ex() or SSL_read() call because the buffered and unprocessed data is not yet processable (e.g. because OpenSSL has only received a partial record so far).

                        "},{"location":"man3/SSL_pending/#return-values","title":"RETURN VALUES","text":"

                        SSL_pending() returns the number of buffered and processed application data bytes that are pending and are available for immediate read. SSL_has_pending() returns 1 if there is buffered record data in the SSL object and 0 otherwise.

                        "},{"location":"man3/SSL_pending/#see-also","title":"SEE ALSO","text":"

                        SSL_read_ex(3), SSL_read(3), SSL_CTX_set_read_ahead(3), SSL_CTX_set_split_send_fragment(3), ssl(7)

                        "},{"location":"man3/SSL_pending/#history","title":"HISTORY","text":"

                        The SSL_has_pending() function was added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_pending/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_read/","title":"SSL_read","text":""},{"location":"man3/SSL_read/#name","title":"NAME","text":"

                        SSL_read_ex, SSL_read, SSL_peek_ex, SSL_peek - read bytes from a TLS/SSL connection

                        "},{"location":"man3/SSL_read/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes);\nint SSL_read(SSL *ssl, void *buf, int num);\n\nint SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes);\nint SSL_peek(SSL *ssl, void *buf, int num);\n
                        "},{"location":"man3/SSL_read/#description","title":"DESCRIPTION","text":"

                        SSL_read_ex() and SSL_read() try to read num bytes from the specified ssl into the buffer buf. On success SSL_read_ex() will store the number of bytes actually read in *readbytes.

                        SSL_peek_ex() and SSL_peek() are identical to SSL_read_ex() and SSL_read() respectively except no bytes are actually removed from the underlying BIO during the read, so that a subsequent call to SSL_read_ex() or SSL_read() will yield at least the same bytes.

                        "},{"location":"man3/SSL_read/#notes","title":"NOTES","text":"

                        In the paragraphs below a \"read function\" is defined as one of SSL_read_ex(), SSL_read(), SSL_peek_ex() or SSL_peek().

                        If necessary, a read function will negotiate a TLS/SSL session, if not already explicitly performed by SSL_connect(3) or SSL_accept(3). If the peer requests a re-negotiation, it will be performed transparently during the read function operation. The behaviour of the read functions depends on the underlying BIO.

                        For the transparent negotiation to succeed, the ssl must have been initialized to client or server mode. This is being done by calling SSL_set_connect_state(3) or SSL_set_accept_state() before the first invocation of a read function.

                        The read functions work based on the SSL/TLS records. The data are received in records (with a maximum record size of 16kB). Only when a record has been completely received, can it be processed (decryption and check of integrity). Therefore, data that was not retrieved at the last read call can still be buffered inside the SSL layer and will be retrieved on the next read call. If num is higher than the number of bytes buffered then the read functions will return with the bytes buffered. If no more bytes are in the buffer, the read functions will trigger the processing of the next record. Only when the record has been received and processed completely will the read functions return reporting success. At most the contents of one record will be returned. As the size of an SSL/TLS record may exceed the maximum packet size of the underlying transport (e.g. TCP), it may be necessary to read several packets from the transport layer before the record is complete and the read call can succeed.

                        If SSL_MODE_AUTO_RETRY has been switched off and a non-application data record has been processed, the read function can return and set the error to SSL_ERROR_WANT_READ. In this case there might still be unprocessed data available in the BIO. If read ahead was set using SSL_CTX_set_read_ahead(3), there might also still be unprocessed data available in the SSL. This behaviour can be controlled using the SSL_CTX_set_mode(3) call.

                        If the underlying BIO is blocking, a read function will only return once the read operation has been finished or an error occurred, except when a non-application data record has been processed and SSL_MODE_AUTO_RETRY is not set. Note that if SSL_MODE_AUTO_RETRY is set and only non-application data is available the call will hang.

                        If the underlying BIO is nonblocking, a read function will also return when the underlying BIO could not satisfy the needs of the function to continue the operation. In this case a call to SSL_get_error(3) with the return value of the read function will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. As at any time it's possible that non-application data needs to be sent, a read function can also cause write operations. The calling process then must repeat the call after taking appropriate action to satisfy the needs of the read function. The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                        SSL_pending(3) can be used to find out whether there are buffered bytes available for immediate retrieval. In this case the read function can be called without blocking or actually receiving new data from the underlying socket.

                        "},{"location":"man3/SSL_read/#return-values","title":"RETURN VALUES","text":"

                        SSL_read_ex() and SSL_peek_ex() will return 1 for success or 0 for failure. Success means that 1 or more application data bytes have been read from the SSL connection. Failure means that no bytes could be read from the SSL connection. Failures can be retryable (e.g. we are waiting for more bytes to be delivered by the network) or non-retryable (e.g. a fatal network error). In the event of a failure call SSL_get_error(3) to find out the reason which indicates whether the call is retryable or not.

                        For SSL_read() and SSL_peek() the following return values can occur:

                        • 0

                          The read operation was successful. The return value is the number of bytes actually read from the TLS/SSL connection.

                        • <= 0

                          The read operation was not successful, because either the connection was closed, an error occurred or action must be taken by the calling process. Call SSL_get_error(3) with the return value ret to find out the reason.

                          Old documentation indicated a difference between 0 and -1, and that -1 was retryable. You should instead call SSL_get_error() to find out if it's retryable.

                        "},{"location":"man3/SSL_read/#see-also","title":"SEE ALSO","text":"

                        SSL_get_error(3), SSL_write_ex(3), SSL_CTX_set_mode(3), SSL_CTX_new(3), SSL_connect(3), SSL_accept(3) SSL_set_connect_state(3), SSL_pending(3), SSL_shutdown(3), SSL_set_shutdown(3), ssl(7), bio(7)

                        "},{"location":"man3/SSL_read/#history","title":"HISTORY","text":"

                        The SSL_read_ex() and SSL_peek_ex() functions were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_read/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_read_early_data/","title":"SSL_read_early_data","text":""},{"location":"man3/SSL_read_early_data/#name","title":"NAME","text":"

                        SSL_set_max_early_data, SSL_CTX_set_max_early_data, SSL_get_max_early_data, SSL_CTX_get_max_early_data, SSL_set_recv_max_early_data, SSL_CTX_set_recv_max_early_data, SSL_get_recv_max_early_data, SSL_CTX_get_recv_max_early_data, SSL_SESSION_get_max_early_data, SSL_SESSION_set_max_early_data, SSL_write_early_data, SSL_read_early_data, SSL_get_early_data_status, SSL_allow_early_data_cb_fn, SSL_CTX_set_allow_early_data_cb, SSL_set_allow_early_data_cb - functions for sending and receiving early data

                        "},{"location":"man3/SSL_read_early_data/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data);\nuint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx);\nint SSL_set_max_early_data(SSL *s, uint32_t max_early_data);\nuint32_t SSL_get_max_early_data(const SSL *s);\n\nint SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data);\nuint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx);\nint SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data);\nuint32_t SSL_get_recv_max_early_data(const SSL *s);\n\nuint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s);\nint SSL_SESSION_set_max_early_data(SSL_SESSION *s, uint32_t max_early_data);\n\nint SSL_write_early_data(SSL *s, const void *buf, size_t num, size_t *written);\n\nint SSL_read_early_data(SSL *s, void *buf, size_t num, size_t *readbytes);\n\nint SSL_get_early_data_status(const SSL *s);\n\n\ntypedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg);\n\nvoid SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx,\n                                     SSL_allow_early_data_cb_fn cb,\n                                     void *arg);\nvoid SSL_set_allow_early_data_cb(SSL *s,\n                                 SSL_allow_early_data_cb_fn cb,\n                                 void *arg);\n
                        "},{"location":"man3/SSL_read_early_data/#description","title":"DESCRIPTION","text":"

                        These functions are used to send and receive early data where TLSv1.3 has been negotiated. Early data can be sent by the client immediately after its initial ClientHello without having to wait for the server to complete the handshake. Early data can be sent if a session has previously been established with the server or when establishing a new session using an out-of-band PSK, and only when the server is known to support it. Additionally these functions can be used to send data from the server to the client when the client has not yet completed the authentication stage of the handshake.

                        Early data has weaker security properties than other data sent over an SSL/TLS connection. In particular the data does not have forward secrecy. There are also additional considerations around replay attacks (see \"REPLAY PROTECTION\" below). For these reasons extreme care should be exercised when using early data. For specific details, consult the TLS 1.3 specification.

                        When a server receives early data it may opt to immediately respond by sending application data back to the client. Data sent by the server at this stage is done before the full handshake has been completed. Specifically the client's authentication messages have not yet been received, i.e. the client is unauthenticated at this point and care should be taken when using this capability.

                        A server or client can determine whether the full handshake has been completed or not by calling SSL_is_init_finished(3).

                        On the client side, the function SSL_SESSION_get_max_early_data() can be used to determine if a session established with a server can be used to send early data. If the session cannot be used then this function will return 0. Otherwise it will return the maximum number of early data bytes that can be sent.

                        The function SSL_SESSION_set_max_early_data() sets the maximum number of early data bytes that can be sent for a session. This would typically be used when creating a PSK session file (see SSL_CTX_set_psk_use_session_callback(3)). If using a ticket based PSK then this is set automatically to the value provided by the server.

                        A client uses the function SSL_write_early_data() to send early data. This function is similar to the SSL_write_ex(3) function, but with the following differences. See SSL_write_ex(3) for information on how to write bytes to the underlying connection, and how to handle any errors that may arise. This page describes the differences between SSL_write_early_data() and SSL_write_ex(3).

                        When called by a client, SSL_write_early_data() must be the first IO function called on a new connection, i.e. it must occur before any calls to SSL_write_ex(3), SSL_read_ex(3), SSL_connect(3), SSL_do_handshake(3) or other similar functions. It may be called multiple times to stream data to the server, but the total number of bytes written must not exceed the value returned from SSL_SESSION_get_max_early_data(). Once the initial SSL_write_early_data() call has completed successfully the client may interleave calls to SSL_read_ex(3) and SSL_read(3) with calls to SSL_write_early_data() as required.

                        If SSL_write_early_data() fails you should call SSL_get_error(3) to determine the correct course of action, as for SSL_write_ex(3).

                        When the client no longer wishes to send any more early data then it should complete the handshake by calling a function such as SSL_connect(3) or SSL_do_handshake(3). Alternatively you can call a standard write function such as SSL_write_ex(3), which will transparently complete the connection and write the requested data.

                        A server may choose to ignore early data that has been sent to it. Once the connection has been completed you can determine whether the server accepted or rejected the early data by calling SSL_get_early_data_status(). This will return SSL_EARLY_DATA_ACCEPTED if the data was accepted, SSL_EARLY_DATA_REJECTED if it was rejected or SSL_EARLY_DATA_NOT_SENT if no early data was sent. This function may be called by either the client or the server.

                        A server uses the SSL_read_early_data() function to receive early data on a connection for which early data has been enabled using SSL_CTX_set_max_early_data() or SSL_set_max_early_data(). As for SSL_write_early_data(), this must be the first IO function called on a connection, i.e. it must occur before any calls to SSL_write_ex(3), SSL_read_ex(3), SSL_accept(3), SSL_do_handshake(3), or other similar functions.

                        SSL_read_early_data() is similar to SSL_read_ex(3) with the following differences. Refer to SSL_read_ex(3) for full details.

                        SSL_read_early_data() may return 3 possible values:

                        • SSL_READ_EARLY_DATA_ERROR

                          This indicates an IO or some other error occurred. This should be treated in the same way as a 0 return value from SSL_read_ex(3).

                        • SSL_READ_EARLY_DATA_SUCCESS

                          This indicates that early data was successfully read. This should be treated in the same way as a 1 return value from SSL_read_ex(3). You should continue to call SSL_read_early_data() to read more data.

                        • SSL_READ_EARLY_DATA_FINISH

                          This indicates that no more early data can be read. It may be returned on the first call to SSL_read_early_data() if the client has not sent any early data, or if the early data was rejected.

                        Once the initial SSL_read_early_data() call has completed successfully (i.e. it has returned SSL_READ_EARLY_DATA_SUCCESS or SSL_READ_EARLY_DATA_FINISH) then the server may choose to write data immediately to the unauthenticated client using SSL_write_early_data(). If SSL_read_early_data() returned SSL_READ_EARLY_DATA_FINISH then in some situations (e.g. if the client only supports TLSv1.2) the handshake may have already been completed and calls to SSL_write_early_data() are not allowed. Call SSL_is_init_finished(3) to determine whether the handshake has completed or not. If the handshake is still in progress then the server may interleave calls to SSL_write_early_data() with calls to SSL_read_early_data() as required.

                        Servers must not call SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) or SSL_write(3) until SSL_read_early_data() has returned with SSL_READ_EARLY_DATA_FINISH. Once it has done so the connection to the client still needs to be completed. Complete the connection by calling a function such as SSL_accept(3) or SSL_do_handshake(3). Alternatively you can call a standard read function such as SSL_read_ex(3), which will transparently complete the connection and read the requested data. Note that it is an error to attempt to complete the connection before SSL_read_early_data() has returned SSL_READ_EARLY_DATA_FINISH.

                        Only servers may call SSL_read_early_data().

                        Calls to SSL_read_early_data() may, in certain circumstances, complete the connection immediately without further need to call a function such as SSL_accept(3). This can happen if the client is using a protocol version less than TLSv1.3. Applications can test for this by calling SSL_is_init_finished(3). Alternatively, applications may choose to call SSL_accept(3) anyway. Such a call will successfully return immediately with no further action taken.

                        When a session is created between a server and a client the server will specify the maximum amount of any early data that it will accept on any future connection attempt. By default the server does not accept early data; a server may indicate support for early data by calling SSL_CTX_set_max_early_data() or SSL_set_max_early_data() to set it for the whole SSL_CTX or an individual SSL object respectively. The max_early_data parameter specifies the maximum amount of early data in bytes that is permitted to be sent on a single connection. Similarly the SSL_CTX_get_max_early_data() and SSL_get_max_early_data() functions can be used to obtain the current maximum early data settings for the SSL_CTX and SSL objects respectively. Generally a server application will either use both of SSL_read_early_data() and SSL_CTX_set_max_early_data() (or SSL_set_max_early_data()), or neither of them, since there is no practical benefit from using only one of them. If the maximum early data setting for a server is nonzero then replay protection is automatically enabled (see \"REPLAY PROTECTION\" below).

                        If the server rejects the early data sent by a client then it will skip over the data that is sent. The maximum amount of received early data that is skipped is controlled by the recv_max_early_data setting. If a client sends more than this then the connection will abort. This value can be set by calling SSL_CTX_set_recv_max_early_data() or SSL_set_recv_max_early_data(). The current value for this setting can be obtained by calling SSL_CTX_get_recv_max_early_data() or SSL_get_recv_max_early_data(). The default value for this setting is 16,384 bytes.

                        The recv_max_early_data value also has an impact on early data that is accepted. The amount of data that is accepted will always be the lower of the max_early_data for the session and the recv_max_early_data setting for the server. If a client sends more data than this then the connection will abort.

                        The configured value for max_early_data on a server may change over time as required. However, clients may have tickets containing the previously configured max_early_data value. The recv_max_early_data should always be equal to or higher than any recently configured max_early_data value in order to avoid aborted connections. The recv_max_early_data should never be set to less than the current configured max_early_data value.

                        Some server applications may wish to have more control over whether early data is accepted or not, for example to mitigate replay risks (see \"REPLAY PROTECTION\" below) or to decline early_data when the server is heavily loaded. The functions SSL_CTX_set_allow_early_data_cb() and SSL_set_allow_early_data_cb() set a callback which is called at a point in the handshake immediately before a decision is made to accept or reject early data. The callback is provided with a pointer to the user data argument that was provided when the callback was first set. Returning 1 from the callback will allow early data and returning 0 will reject it. Note that the OpenSSL library may reject early data for other reasons in which case this callback will not get called. Notably, the built-in replay protection feature will still be used even if a callback is present unless it has been explicitly disabled using the SSL_OP_NO_ANTI_REPLAY option. See \"REPLAY PROTECTION\" below.

                        "},{"location":"man3/SSL_read_early_data/#notes","title":"NOTES","text":"

                        The whole purpose of early data is to enable a client to start sending data to the server before a full round trip of network traffic has occurred. Application developers should ensure they consider optimisation of the underlying TCP socket to obtain a performant solution. For example Nagle's algorithm is commonly used by operating systems in an attempt to avoid lots of small TCP packets. In many scenarios this is beneficial for performance, but it does not work well with the early data solution as implemented in OpenSSL. In Nagle's algorithm the OS will buffer outgoing TCP data if a TCP packet has already been sent which we have not yet received an ACK for from the peer. The buffered data will only be transmitted if enough data to fill an entire TCP packet is accumulated, or if the ACK is received from the peer. The initial ClientHello will be sent in the first TCP packet along with any data from the first call to SSL_write_early_data(). If the amount of data written will exceed the size of a single TCP packet, or if there are more calls to SSL_write_early_data() then that additional data will be sent in subsequent TCP packets which will be buffered by the OS and not sent until an ACK is received for the first packet containing the ClientHello. This means the early data is not actually sent until a complete round trip with the server has occurred which defeats the objective of early data.

                        In many operating systems the TCP_NODELAY socket option is available to disable Nagle's algorithm. If an application opts to disable Nagle's algorithm consideration should be given to turning it back on again after the handshake is complete if appropriate.

                        In rare circumstances, it may be possible for a client to have a session that reports a max early data value greater than 0, but where the server does not support this. For example, this can occur if a server has had its configuration changed to accept a lower max early data value such as by calling SSL_CTX_set_recv_max_early_data(). Another example is if a server used to support TLSv1.3 but was later downgraded to TLSv1.2. Sending early data to such a server will cause the connection to abort. Clients that encounter an aborted connection while sending early data may want to retry the connection without sending early data as this does not happen automatically. A client will have to establish a new transport layer connection to the server and attempt the SSL/TLS connection again but without sending early data. Note that it is inadvisable to retry with a lower maximum protocol version.

                        "},{"location":"man3/SSL_read_early_data/#replay-protection","title":"REPLAY PROTECTION","text":"

                        When early data is in use the TLS protocol provides no security guarantees that the same early data was not replayed across multiple connections. As a mitigation for this issue OpenSSL automatically enables replay protection if the server is configured with a nonzero max early data value. With replay protection enabled sessions are forced to be single use only. If a client attempts to reuse a session ticket more than once, then the second and subsequent attempts will fall back to a full handshake (and any early data that was submitted will be ignored). Note that single use tickets are enforced even if a client does not send any early data.

                        The replay protection mechanism relies on the internal OpenSSL server session cache (see SSL_CTX_set_session_cache_mode(3)). When replay protection is being used the server will operate as if the SSL_OP_NO_TICKET option had been selected (see SSL_CTX_set_options(3)). Sessions will be added to the cache whenever a session ticket is issued. When a client attempts to resume the session, OpenSSL will check for its presence in the internal cache. If it exists then the resumption is allowed and the session is removed from the cache. If it does not exist then the resumption is not allowed and a full handshake will occur.

                        Note that some applications may maintain an external cache of sessions (see SSL_CTX_sess_set_new_cb(3) and similar functions). It is the application's responsibility to ensure that any sessions in the external cache are also populated in the internal cache and that once removed from the internal cache they are similarly removed from the external cache. Failing to do this could result in an application becoming vulnerable to replay attacks. Note that OpenSSL will lock the internal cache while a session is removed but that lock is not held when the remove session callback (see SSL_CTX_sess_set_remove_cb(3)) is called. This could result in a small amount of time where the session has been removed from the internal cache but is still available in the external cache. Applications should be designed with this in mind in order to minimise the possibility of replay attacks.

                        The OpenSSL replay protection does not apply to external Pre Shared Keys (PSKs) (e.g. see SSL_CTX_set_psk_find_session_callback(3)). Therefore, extreme caution should be applied when combining external PSKs with early data.

                        Some applications may mitigate the replay risks in other ways. For those applications it is possible to turn off the built-in replay protection feature using the SSL_OP_NO_ANTI_REPLAY option. See SSL_CTX_set_options(3) for details. Applications can also set a callback to make decisions about accepting early data or not. See SSL_CTX_set_allow_early_data_cb() above for details.

                        "},{"location":"man3/SSL_read_early_data/#return-values","title":"RETURN VALUES","text":"

                        SSL_write_early_data() returns 1 for success or 0 for failure. In the event of a failure call SSL_get_error(3) to determine the correct course of action.

                        SSL_read_early_data() returns SSL_READ_EARLY_DATA_ERROR for failure, SSL_READ_EARLY_DATA_SUCCESS for success with more data to read and SSL_READ_EARLY_DATA_FINISH for success with no more to data be read. In the event of a failure call SSL_get_error(3) to determine the correct course of action.

                        SSL_get_max_early_data(), SSL_CTX_get_max_early_data() and SSL_SESSION_get_max_early_data() return the maximum number of early data bytes that may be sent.

                        SSL_set_max_early_data(), SSL_CTX_set_max_early_data() and SSL_SESSION_set_max_early_data() return 1 for success or 0 for failure.

                        SSL_get_early_data_status() returns SSL_EARLY_DATA_ACCEPTED if early data was accepted by the server, SSL_EARLY_DATA_REJECTED if early data was rejected by the server, or SSL_EARLY_DATA_NOT_SENT if no early data was sent.

                        "},{"location":"man3/SSL_read_early_data/#see-also","title":"SEE ALSO","text":"

                        SSL_get_error(3), SSL_write_ex(3), SSL_read_ex(3), SSL_connect(3), SSL_accept(3), SSL_do_handshake(3), SSL_CTX_set_psk_use_session_callback(3), ssl(7)

                        "},{"location":"man3/SSL_read_early_data/#history","title":"HISTORY","text":"

                        All of the functions described above were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_read_early_data/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_rstate_string/","title":"SSL_rstate_string","text":""},{"location":"man3/SSL_rstate_string/#name","title":"NAME","text":"

                        SSL_rstate_string, SSL_rstate_string_long - get textual description of state of an SSL object during read operation

                        "},{"location":"man3/SSL_rstate_string/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst char *SSL_rstate_string(SSL *ssl);\nconst char *SSL_rstate_string_long(SSL *ssl);\n
                        "},{"location":"man3/SSL_rstate_string/#description","title":"DESCRIPTION","text":"

                        SSL_rstate_string() returns a 2 letter string indicating the current read state of the SSL object ssl.

                        SSL_rstate_string_long() returns a string indicating the current read state of the SSL object ssl.

                        "},{"location":"man3/SSL_rstate_string/#notes","title":"NOTES","text":"

                        When performing a read operation, the SSL/TLS engine must parse the record, consisting of header and body. When working in a blocking environment, SSL_rstate_string[_long]() should always return \"RD\"/\"read done\".

                        This function should only seldom be needed in applications.

                        "},{"location":"man3/SSL_rstate_string/#return-values","title":"RETURN VALUES","text":"

                        SSL_rstate_string() and SSL_rstate_string_long() can return the following values:

                        • \"RH\"/\"read header\"

                          The header of the record is being evaluated.

                        • \"RB\"/\"read body\"

                          The body of the record is being evaluated.

                        • \"RD\"/\"read done\"

                          The record has been completely processed.

                        • \"unknown\"/\"unknown\"

                          The read state is unknown. This should never happen.

                        "},{"location":"man3/SSL_rstate_string/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_rstate_string/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_session_reused/","title":"SSL_session_reused","text":""},{"location":"man3/SSL_session_reused/#name","title":"NAME","text":"

                        SSL_session_reused - query whether a reused session was negotiated during handshake

                        "},{"location":"man3/SSL_session_reused/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_session_reused(const SSL *ssl);\n
                        "},{"location":"man3/SSL_session_reused/#description","title":"DESCRIPTION","text":"

                        Query, whether a reused session was negotiated during the handshake.

                        "},{"location":"man3/SSL_session_reused/#notes","title":"NOTES","text":"

                        During the negotiation, a client can propose to reuse a session. The server then looks up the session in its cache. If both client and server agree on the session, it will be reused and a flag is being set that can be queried by the application.

                        "},{"location":"man3/SSL_session_reused/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          A new session was negotiated.

                        • 1

                          A session was reused.

                        "},{"location":"man3/SSL_session_reused/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_set_session(3), SSL_CTX_set_session_cache_mode(3)

                        "},{"location":"man3/SSL_session_reused/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set1_host/","title":"SSL_set1_host","text":""},{"location":"man3/SSL_set1_host/#name","title":"NAME","text":"

                        SSL_set1_host, SSL_add1_host, SSL_set_hostflags, SSL_get0_peername - SSL server verification parameters

                        "},{"location":"man3/SSL_set1_host/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_set1_host(SSL *s, const char *hostname);\nint SSL_add1_host(SSL *s, const char *hostname);\nvoid SSL_set_hostflags(SSL *s, unsigned int flags);\nconst char *SSL_get0_peername(SSL *s);\n
                        "},{"location":"man3/SSL_set1_host/#description","title":"DESCRIPTION","text":"

                        These functions configure server hostname checks in the SSL client.

                        SSL_set1_host() sets the expected DNS hostname to name clearing any previously specified hostname. If name is NULL or the empty string, the list of hostnames is cleared and name checks are not performed on the peer certificate. When a nonempty name is specified, certificate verification automatically checks the peer hostname via X509_check_host(3) with flags as specified via SSL_set_hostflags(). Clients that enable DANE TLSA authentication via SSL_dane_enable(3) should leave it to that function to set the primary reference identifier of the peer, and should not call SSL_set1_host().

                        SSL_add1_host() adds name as an additional reference identifier that can match the peer's certificate. Any previous names set via SSL_set1_host() or SSL_add1_host() are retained, no change is made if name is NULL or empty. When multiple names are configured, the peer is considered verified when any name matches. This function is required for DANE TLSA in the presence of service name indirection via CNAME, MX or SRV records as specified in RFC7671, RFC7672 or RFC7673.

                        SSL_set_hostflags() sets the flags that will be passed to X509_check_host(3) when name checks are applicable, by default the flags value is 0. See X509_check_host(3) for the list of available flags and their meaning.

                        SSL_get0_peername() returns the DNS hostname or subject CommonName from the peer certificate that matched one of the reference identifiers. When wildcard matching is not disabled, the name matched in the peer certificate may be a wildcard name. When one of the reference identifiers configured via SSL_set1_host() or SSL_add1_host() starts with \".\", which indicates a parent domain prefix rather than a fixed name, the matched peer name may be a sub-domain of the reference identifier. The returned string is allocated by the library and is no longer valid once the associated ssl handle is cleared or freed, or a renegotiation takes place. Applications must not free the return value.

                        SSL clients are advised to use these functions in preference to explicitly calling X509_check_host(3). Hostname checks may be out of scope with the RFC7671 DANE-EE(3) certificate usage, and the internal check will be suppressed as appropriate when DANE is enabled.

                        "},{"location":"man3/SSL_set1_host/#return-values","title":"RETURN VALUES","text":"

                        SSL_set1_host() and SSL_add1_host() return 1 for success and 0 for failure.

                        SSL_get0_peername() returns NULL if peername verification is not applicable (as with RFC7671 DANE-EE(3)), or no trusted peername was matched. Otherwise, it returns the matched peername. To determine whether verification succeeded call SSL_get_verify_result(3).

                        "},{"location":"man3/SSL_set1_host/#examples","title":"EXAMPLES","text":"

                        Suppose \"smtp.example.com\" is the MX host of the domain \"example.com\". The calls below will arrange to match either the MX hostname or the destination domain name in the SMTP server certificate. Wildcards are supported, but must match the entire label. The actual name matched in the certificate (which might be a wildcard) is retrieved, and must be copied by the application if it is to be retained beyond the lifetime of the SSL connection.

                        SSL_set_hostflags(ssl, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);\nif (!SSL_set1_host(ssl, \"smtp.example.com\"))\n    /* error */\nif (!SSL_add1_host(ssl, \"example.com\"))\n    /* error */\n\n/* XXX: Perform SSL_connect() handshake and handle errors here */\n\nif (SSL_get_verify_result(ssl) == X509_V_OK) {\n    const char *peername = SSL_get0_peername(ssl);\n\n    if (peername != NULL)\n        /* Name checks were in scope and matched the peername */\n}\n
                        "},{"location":"man3/SSL_set1_host/#see-also","title":"SEE ALSO","text":"

                        ssl(7), X509_check_host(3), SSL_get_verify_result(3). SSL_dane_enable(3).

                        "},{"location":"man3/SSL_set1_host/#history","title":"HISTORY","text":"

                        These functions were added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_set1_host/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_async_callback/","title":"SSL_set_async_callback","text":""},{"location":"man3/SSL_set_async_callback/#name","title":"NAME","text":"

                        SSL_CTX_set_async_callback, SSL_CTX_set_async_callback_arg, SSL_set_async_callback, SSL_set_async_callback_arg, SSL_get_async_status, SSL_async_callback_fn - manage asynchronous operations

                        "},{"location":"man3/SSL_set_async_callback/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\ntypedef int (*SSL_async_callback_fn)(SSL *s, void *arg);\nint SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback);\nint SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg);\nint SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback);\nint SSL_set_async_callback_arg(SSL *s, void *arg);\nint SSL_get_async_status(SSL *s, int *status);\n
                        "},{"location":"man3/SSL_set_async_callback/#description","title":"DESCRIPTION","text":"

                        SSL_CTX_set_async_callback() sets an asynchronous callback function. All SSL objects generated based on this SSL_CTX will get this callback. If an engine supports the callback mechanism, it will be automatically called if SSL_MODE_ASYNC has been set and an asynchronous capable engine completes a cryptography operation to notify the application to resume the paused work flow.

                        SSL_CTX_set_async_callback_arg() sets the callback argument.

                        SSL_set_async_callback() allows an application to set a callback in an asynchronous SSL object, so that when an engine completes a cryptography operation, the callback will be called to notify the application to resume the paused work flow.

                        SSL_set_async_callback_arg() sets an argument for the SSL object when the above callback is called.

                        SSL_get_async_status() returns the engine status. This function facilitates the communication from the engine to the application. During an SSL session, cryptographic operations are dispatched to an engine. The engine status is very useful for an application to know if the operation has been successfully dispatched. If the engine does not support this additional callback method, ASYNC_STATUS_UNSUPPORTED will be returned. See ASYNC_WAIT_CTX_set_status() for a description of all of the status values.

                        An example of the above functions would be the following:

                        1. Application sets the async callback and callback data on an SSL connection by calling SSL_set_async_callback().
                        2. Application sets SSL_MODE_ASYNC and makes an asynchronous SSL call
                        3. OpenSSL submits the asynchronous request to the engine. If a retry occurs at this point then the status within the ASYNC_WAIT_CTX would be set and the async callback function would be called (goto Step 7).
                        4. The OpenSSL engine pauses the current job and returns, so that the application can continue processing other connections.
                        5. At a future point in time (probably via a polling mechanism or via an interrupt) the engine will become aware that the asynchronous request has finished processing.
                        6. The engine will call the application's callback passing the callback data as a parameter.
                        7. The callback function should then run. Note: it is a requirement that the callback function is small and nonblocking as it will be run in the context of a polling mechanism or an interrupt.
                        8. It is the application's responsibility via the callback function to schedule recalling the OpenSSL asynchronous function and to continue processing.
                        9. The callback function has the option to check the status returned via SSL_get_async_status() to determine whether a retry happened instead of the request being submitted, allowing different processing if required.
                        "},{"location":"man3/SSL_set_async_callback/#return-values","title":"RETURN VALUES","text":"

                        SSL_CTX_set_async_callback(), SSL_set_async_callback(), SSL_CTX_set_async_callback_arg(), SSL_CTX_set_async_callback_arg() and SSL_get_async_status() return 1 on success or 0 on error.

                        "},{"location":"man3/SSL_set_async_callback/#see-also","title":"SEE ALSO","text":"

                        ssl(7)

                        "},{"location":"man3/SSL_set_async_callback/#history","title":"HISTORY","text":"

                        SSL_CTX_set_async_callback(), SSL_CTX_set_async_callback_arg(), SSL_set_async_callback(), SSL_set_async_callback_arg() and SSL_get_async_status() were first added to OpenSSL 3.0.

                        "},{"location":"man3/SSL_set_async_callback/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_bio/","title":"SSL_set_bio","text":""},{"location":"man3/SSL_set_bio/#name","title":"NAME","text":"

                        SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with a BIO

                        "},{"location":"man3/SSL_set_bio/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);\nvoid SSL_set0_rbio(SSL *s, BIO *rbio);\nvoid SSL_set0_wbio(SSL *s, BIO *wbio);\n
                        "},{"location":"man3/SSL_set_bio/#description","title":"DESCRIPTION","text":"

                        SSL_set0_rbio() connects the BIO rbio for the read operations of the ssl object. The SSL engine inherits the behaviour of rbio. If the BIO is nonblocking then the ssl object will also have nonblocking behaviour. This function transfers ownership of rbio to ssl. It will be automatically freed using BIO_free_all(3) when the ssl is freed. On calling this function, any existing rbio that was previously set will also be freed via a call to BIO_free_all(3) (this includes the case where the rbio is set to the same value as previously).

                        SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it connects the BIO wbio for the write operations of the ssl object. Note that if the rbio and wbio are the same then SSL_set0_rbio() and SSL_set0_wbio() each take ownership of one reference. Therefore, it may be necessary to increment the number of references available using BIO_up_ref(3) before calling the set0 functions.

                        SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except that it connects both the rbio and the wbio at the same time, and transfers the ownership of rbio and wbio to ssl according to the following set of rules:

                        • If neither the rbio or wbio have changed from their previous values then nothing is done.
                        • If the rbio and wbio parameters are different and both are different to their previously set values then one reference is consumed for the rbio and one reference is consumed for the wbio.
                        • If the rbio and wbio parameters are the same and the rbio is not the same as the previously set value then one reference is consumed.
                        • If the rbio and wbio parameters are the same and the rbio is the same as the previously set value, then no additional references are consumed.
                        • If the rbio and wbio parameters are different and the rbio is the same as the previously set value then one reference is consumed for the wbio and no references are consumed for the rbio.
                        • If the rbio and wbio parameters are different and the wbio is the same as the previously set value and the old rbio and wbio values were the same as each other then one reference is consumed for the rbio and no references are consumed for the wbio.
                        • If the rbio and wbio parameters are different and the wbio is the same as the previously set value and the old rbio and wbio values were different to each other, then one reference is consumed for the rbio and one reference is consumed for the wbio.

                        Because of this complexity, this function should be avoided; use SSL_set0_rbio() and SSL_set0_wbio() instead.

                        "},{"location":"man3/SSL_set_bio/#return-values","title":"RETURN VALUES","text":"

                        SSL_set_bio(), SSL_set0_rbio() and SSL_set0_wbio() cannot fail.

                        "},{"location":"man3/SSL_set_bio/#see-also","title":"SEE ALSO","text":"

                        SSL_get_rbio(3), SSL_connect(3), SSL_accept(3), SSL_shutdown(3), ssl(7), bio(7)

                        "},{"location":"man3/SSL_set_bio/#history","title":"HISTORY","text":"

                        SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0.

                        "},{"location":"man3/SSL_set_bio/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_connect_state/","title":"SSL_set_connect_state","text":""},{"location":"man3/SSL_set_connect_state/#name","title":"NAME","text":"

                        SSL_set_connect_state, SSL_set_accept_state, SSL_is_server - functions for manipulating and examining the client or server mode of an SSL object

                        "},{"location":"man3/SSL_set_connect_state/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_set_connect_state(SSL *ssl);\n\nvoid SSL_set_accept_state(SSL *ssl);\n\nint SSL_is_server(const SSL *ssl);\n
                        "},{"location":"man3/SSL_set_connect_state/#description","title":"DESCRIPTION","text":"

                        SSL_set_connect_state() sets ssl to work in client mode.

                        SSL_set_accept_state() sets ssl to work in server mode.

                        SSL_is_server() checks if ssl is working in server mode.

                        "},{"location":"man3/SSL_set_connect_state/#notes","title":"NOTES","text":"

                        When the SSL_CTX object was created with SSL_CTX_new(3), it was either assigned a dedicated client method, a dedicated server method, or a generic method, that can be used for both client and server connections. (The method might have been changed with SSL_CTX_set_ssl_version(3) or SSL_set_ssl_method(3).)

                        When beginning a new handshake, the SSL engine must know whether it must call the connect (client) or accept (server) routines. Even though it may be clear from the method chosen, whether client or server mode was requested, the handshake routines must be explicitly set.

                        When using the SSL_connect(3) or SSL_accept(3) routines, the correct handshake routines are automatically set. When performing a transparent negotiation using SSL_write_ex(3), SSL_write(3), SSL_read_ex(3), or SSL_read(3), the handshake routines must be explicitly set in advance using either SSL_set_connect_state() or SSL_set_accept_state().

                        If SSL_is_server() is called before SSL_set_connect_state() or SSL_set_accept_state() is called (either automatically or explicitly), the result depends on what method was used when SSL_CTX was created with SSL_CTX_new(3). If a generic method or a dedicated server method was passed to SSL_CTX_new(3), SSL_is_server() returns 1; otherwise, it returns 0.

                        "},{"location":"man3/SSL_set_connect_state/#return-values","title":"RETURN VALUES","text":"

                        SSL_set_connect_state() and SSL_set_accept_state() do not return diagnostic information.

                        SSL_is_server() returns 1 if ssl is working in server mode or 0 for client mode.

                        "},{"location":"man3/SSL_set_connect_state/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_new(3), SSL_CTX_new(3), SSL_connect(3), SSL_accept(3), SSL_write_ex(3), SSL_write(3), SSL_read_ex(3), SSL_read(3), SSL_do_handshake(3), SSL_CTX_set_ssl_version(3)

                        "},{"location":"man3/SSL_set_connect_state/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_fd/","title":"SSL_set_fd","text":""},{"location":"man3/SSL_set_fd/#name","title":"NAME","text":"

                        SSL_set_fd, SSL_set_rfd, SSL_set_wfd - connect the SSL object with a file descriptor

                        "},{"location":"man3/SSL_set_fd/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_set_fd(SSL *ssl, int fd);\nint SSL_set_rfd(SSL *ssl, int fd);\nint SSL_set_wfd(SSL *ssl, int fd);\n
                        "},{"location":"man3/SSL_set_fd/#description","title":"DESCRIPTION","text":"

                        SSL_set_fd() sets the file descriptor fd as the input/output facility for the TLS/SSL (encrypted) side of ssl. fd will typically be the socket file descriptor of a network connection.

                        When performing the operation, a socket BIO is automatically created to interface between the ssl and fd. The BIO and hence the SSL engine inherit the behaviour of fd. If fd is nonblocking, the ssl will also have nonblocking behaviour.

                        If there was already a BIO connected to ssl, BIO_free() will be called (for both the reading and writing side, if different).

                        SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only for the read channel or the write channel, which can be set independently.

                        "},{"location":"man3/SSL_set_fd/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          The operation failed. Check the error stack to find out why.

                        • 1

                          The operation succeeded.

                        "},{"location":"man3/SSL_set_fd/#notes","title":"NOTES","text":"

                        On Windows, a socket handle is a 64-bit data type (UINT_PTR), which leads to a compiler warning (conversion from 'SOCKET' to 'int', possible loss of data) when passing the socket handle to SSL_set_*fd(). For the time being, this warning can safely be ignored, because although the Microsoft documentation claims that the upper limit is INVALID_SOCKET-1 (2^64 - 2), in practice the current socket() implementation returns an index into the kernel handle table, the size of which is limited to 2^24.

                        "},{"location":"man3/SSL_set_fd/#see-also","title":"SEE ALSO","text":"

                        SSL_get_fd(3), SSL_set_bio(3), SSL_connect(3), SSL_accept(3), SSL_shutdown(3), ssl(7) , bio(7)

                        "},{"location":"man3/SSL_set_fd/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_retry_verify/","title":"SSL_set_retry_verify","text":""},{"location":"man3/SSL_set_retry_verify/#name","title":"NAME","text":"

                        SSL_set_retry_verify - indicate that certificate verification should be retried

                        "},{"location":"man3/SSL_set_retry_verify/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_set_retry_verify(SSL *ssl);\n
                        "},{"location":"man3/SSL_set_retry_verify/#description","title":"DESCRIPTION","text":"

                        SSL_set_retry_verify() should be called from the certificate verification callback on a client when the application wants to indicate that the handshake should be suspended and the control should be returned to the application. SSL_want_retry_verify(3) will return 1 as a consequence until the handshake is resumed again by the application, retrying the verification step.

                        Please refer to SSL_CTX_set_cert_verify_callback(3) for further details.

                        "},{"location":"man3/SSL_set_retry_verify/#notes","title":"NOTES","text":"

                        The effect of calling SSL_set_retry_verify() outside of the certificate verification callback on the client side is undefined.

                        "},{"location":"man3/SSL_set_retry_verify/#return-values","title":"RETURN VALUES","text":"

                        SSL_set_retry verify() returns 1 on success, 0 otherwise.

                        "},{"location":"man3/SSL_set_retry_verify/#examples","title":"EXAMPLES","text":"

                        The following code snippet shows how to obtain the SSL object associated with the X509_STORE_CTX to call the SSL_set_retry_verify() function:

                        int idx = SSL_get_ex_data_X509_STORE_CTX_idx();\nSSL *ssl;\n\n/* this should not happen but check anyway */\nif (idx < 0\n    || (ssl = X509_STORE_CTX_get_ex_data(ctx, idx)) == NULL) \n    return 0;\n\nif (/* we need to retry verification callback */)\n    return SSL_set_retry_verify(ssl);\n\n/* do normal processing of the verification callback */\n
                        "},{"location":"man3/SSL_set_retry_verify/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_connect(3), SSL_CTX_set_cert_verify_callback(3), SSL_want_retry_verify(3)

                        "},{"location":"man3/SSL_set_retry_verify/#history","title":"HISTORY","text":"

                        SSL_set_retry_verify() was added in OpenSSL 3.0.2 to replace backwards incompatible handling of a negative return value from the verification callback.

                        "},{"location":"man3/SSL_set_retry_verify/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_session/","title":"SSL_set_session","text":""},{"location":"man3/SSL_set_session/#name","title":"NAME","text":"

                        SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect

                        "},{"location":"man3/SSL_set_session/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_set_session(SSL *ssl, SSL_SESSION *session);\n
                        "},{"location":"man3/SSL_set_session/#description","title":"DESCRIPTION","text":"

                        SSL_set_session() sets session to be used when the TLS/SSL connection is to be established. SSL_set_session() is only useful for TLS/SSL clients. When the session is set, the reference count of session is incremented by 1. If the session is not reused, the reference count is decremented again during SSL_connect(). Whether the session was reused can be queried with the SSL_session_reused(3) call.

                        If there is already a session set inside ssl (because it was set with SSL_set_session() before or because the same ssl was already used for a connection), SSL_SESSION_free() will be called for that session. This is also the case when session is a NULL pointer. If that old session is still open, it is considered bad and will be removed from the session cache (if used). A session is considered open, if SSL_shutdown(3) was not called for the connection (or at least SSL_set_shutdown(3) was used to set the SSL_SENT_SHUTDOWN state).

                        "},{"location":"man3/SSL_set_session/#notes","title":"NOTES","text":"

                        SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object).

                        "},{"location":"man3/SSL_set_session/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          The operation failed; check the error stack to find out the reason.

                        • 1

                          The operation succeeded.

                        "},{"location":"man3/SSL_set_session/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_SESSION_free(3), SSL_get_session(3), SSL_session_reused(3), SSL_CTX_set_session_cache_mode(3)

                        "},{"location":"man3/SSL_set_session/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_shutdown/","title":"SSL_set_shutdown","text":""},{"location":"man3/SSL_set_shutdown/#name","title":"NAME","text":"

                        SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection

                        "},{"location":"man3/SSL_set_shutdown/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_set_shutdown(SSL *ssl, int mode);\n\nint SSL_get_shutdown(const SSL *ssl);\n
                        "},{"location":"man3/SSL_set_shutdown/#description","title":"DESCRIPTION","text":"

                        SSL_set_shutdown() sets the shutdown state of ssl to mode.

                        SSL_get_shutdown() returns the shutdown mode of ssl.

                        "},{"location":"man3/SSL_set_shutdown/#notes","title":"NOTES","text":"

                        The shutdown state of an ssl connection is a bit-mask of:

                        • 0

                          No shutdown setting, yet.

                        • SSL_SENT_SHUTDOWN

                          A close_notify shutdown alert was sent to the peer, the connection is being considered closed and the session is closed and correct.

                        • SSL_RECEIVED_SHUTDOWN

                          A shutdown alert was received form the peer, either a normal close_notify or a fatal error.

                        SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.

                        The shutdown state of the connection is used to determine the state of the ssl session. If the session is still open, when SSL_clear(3) or SSL_free(3) is called, it is considered bad and removed according to RFC2246. The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN (according to the TLS RFC, it is acceptable to only send the close_notify alert but to not wait for the peer's answer, when the underlying connection is closed). SSL_set_shutdown() can be used to set this state without sending a close alert to the peer (see SSL_shutdown(3)).

                        If a close_notify was received, SSL_RECEIVED_SHUTDOWN will be set, for setting SSL_SENT_SHUTDOWN the application must however still call SSL_shutdown(3) or SSL_set_shutdown() itself.

                        "},{"location":"man3/SSL_set_shutdown/#return-values","title":"RETURN VALUES","text":"

                        SSL_set_shutdown() does not return diagnostic information.

                        SSL_get_shutdown() returns the current setting.

                        "},{"location":"man3/SSL_set_shutdown/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_shutdown(3), SSL_CTX_set_quiet_shutdown(3), SSL_clear(3), SSL_free(3)

                        "},{"location":"man3/SSL_set_shutdown/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_set_verify_result/","title":"SSL_set_verify_result","text":""},{"location":"man3/SSL_set_verify_result/#name","title":"NAME","text":"

                        SSL_set_verify_result - override result of peer certificate verification

                        "},{"location":"man3/SSL_set_verify_result/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nvoid SSL_set_verify_result(SSL *ssl, long verify_result);\n
                        "},{"location":"man3/SSL_set_verify_result/#description","title":"DESCRIPTION","text":"

                        SSL_set_verify_result() sets verify_result of the object ssl to be the result of the verification of the X509 certificate presented by the peer, if any.

                        "},{"location":"man3/SSL_set_verify_result/#notes","title":"NOTES","text":"

                        SSL_set_verify_result() overrides the verification result. It only changes the verification result of the ssl object. It does not become part of the established session, so if the session is to be reused later, the original value will reappear.

                        The valid codes for verify_result are documented in openssl-verify(1).

                        "},{"location":"man3/SSL_set_verify_result/#return-values","title":"RETURN VALUES","text":"

                        SSL_set_verify_result() does not provide a return value.

                        "},{"location":"man3/SSL_set_verify_result/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_verify_result(3), SSL_get_peer_certificate(3), openssl-verify(1)

                        "},{"location":"man3/SSL_set_verify_result/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_shutdown/","title":"SSL_shutdown","text":""},{"location":"man3/SSL_shutdown/#name","title":"NAME","text":"

                        SSL_shutdown - shut down a TLS/SSL connection

                        "},{"location":"man3/SSL_shutdown/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_shutdown(SSL *ssl);\n
                        "},{"location":"man3/SSL_shutdown/#description","title":"DESCRIPTION","text":"

                        SSL_shutdown() shuts down an active TLS/SSL connection. It sends the close_notify shutdown alert to the peer.

                        SSL_shutdown() tries to send the close_notify shutdown alert to the peer. Whether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and a currently open session is considered closed and good and will be kept in the session cache for further reuse.

                        Note that SSL_shutdown() must not be called if a previous fatal error has occurred on a connection i.e. if SSL_get_error() has returned SSL_ERROR_SYSCALL or SSL_ERROR_SSL.

                        The shutdown procedure consists of two steps: sending of the close_notify shutdown alert, and reception of the peer's close_notify shutdown alert. The order of those two steps depends on the application.

                        It is acceptable for an application to only send its shutdown alert and then close the underlying connection without waiting for the peer's response. This way resources can be saved, as the process can already terminate or serve another connection. This should only be done when it is known that the other side will not send more data, otherwise there is a risk of a truncation attack.

                        When a client only writes and never reads from the connection, and the server has sent a session ticket to establish a session, the client might not be able to resume the session because it did not received and process the session ticket from the server. In case the application wants to be able to resume the session, it is recommended to do a complete shutdown procedure (bidirectional close_notify alerts).

                        When the underlying connection shall be used for more communications, the complete shutdown procedure must be performed, so that the peers stay synchronized.

                        SSL_shutdown() only closes the write direction. It is not possible to call SSL_write() after calling SSL_shutdown(). The read direction is closed by the peer.

                        The behaviour of SSL_shutdown() additionally depends on the underlying BIO. If the underlying BIO is blocking, SSL_shutdown() will only return once the handshake step has been finished or an error occurred.

                        If the underlying BIO is nonblocking, SSL_shutdown() will also return when the underlying BIO could not satisfy the needs of SSL_shutdown() to continue the handshake. In this case a call to SSL_get_error() with the return value of SSL_shutdown() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_shutdown(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                        After SSL_shutdown() returned 0, it is possible to call SSL_shutdown() again to wait for the peer's close_notify alert. SSL_shutdown() will return 1 in that case. However, it is recommended to wait for it using SSL_read() instead.

                        SSL_shutdown() can be modified to only set the connection to \"shutdown\" state but not actually send the close_notify alert messages, see SSL_CTX_set_quiet_shutdown(3). When \"quiet shutdown\" is enabled, SSL_shutdown() will always succeed and return 1. Note that this is not standard compliant behaviour. It should only be done when the peer has a way to make sure all data has been received and doesn't wait for the close_notify alert message, otherwise an unexpected EOF will be reported.

                        There are implementations that do not send the required close_notify alert. If there is a need to communicate with such an implementation, and it's clear that all data has been received, do not wait for the peer's close_notify alert. Waiting for the close_notify alert when the peer just closes the connection will result in an error being generated. The error can be ignored using the SSL_OP_IGNORE_UNEXPECTED_EOF. For more information see SSL_CTX_set_options(3).

                        "},{"location":"man3/SSL_shutdown/#first-to-close-the-connection","title":"First to close the connection","text":"

                        When the application is the first party to send the close_notify alert, SSL_shutdown() will only send the alert and then set the SSL_SENT_SHUTDOWN flag (so that the session is considered good and will be kept in the cache). If successful, SSL_shutdown() will return 0.

                        If a unidirectional shutdown is enough (the underlying connection shall be closed anyway), this first successful call to SSL_shutdown() is sufficient.

                        In order to complete the bidirectional shutdown handshake, the peer needs to send back a close_notify alert. The SSL_RECEIVED_SHUTDOWN flag will be set after receiving and processing it.

                        The peer is still allowed to send data after receiving the close_notify event. When it is done sending data, it will send the close_notify alert. SSL_read() should be called until all data is received. SSL_read() will indicate the end of the peer data by returning <= 0 and SSL_get_error() returning SSL_ERROR_ZERO_RETURN.

                        "},{"location":"man3/SSL_shutdown/#peer-closes-the-connection","title":"Peer closes the connection","text":"

                        If the peer already sent the close_notify alert and it was already processed implicitly inside another function (SSL_read(3)), the SSL_RECEIVED_SHUTDOWN flag is set. SSL_read() will return <= 0 in that case, and SSL_get_error() will return SSL_ERROR_ZERO_RETURN. SSL_shutdown() will send the close_notify alert, set the SSL_SENT_SHUTDOWN flag. If successful, SSL_shutdown() will return 1.

                        Whether SSL_RECEIVED_SHUTDOWN is already set can be checked using the SSL_get_shutdown() (see also SSL_set_shutdown(3) call.

                        "},{"location":"man3/SSL_shutdown/#return-values","title":"RETURN VALUES","text":"

                        The following return values can occur:

                        • 0

                          The shutdown is not yet finished: the close_notify was sent but the peer did not send it back yet. Call SSL_read() to do a bidirectional shutdown.

                          Unlike most other function, returning 0 does not indicate an error. SSL_get_error(3) should not get called, it may misleadingly indicate an error even though no error occurred.

                        • 1

                          The shutdown was successfully completed. The close_notify alert was sent and the peer's close_notify alert was received.

                        • <0

                          The shutdown was not successful. Call SSL_get_error(3) with the return value ret to find out the reason. It can occur if an action is needed to continue the operation for nonblocking BIOs.

                          It can also occur when not all data was read using SSL_read().

                        "},{"location":"man3/SSL_shutdown/#see-also","title":"SEE ALSO","text":"

                        SSL_get_error(3), SSL_connect(3), SSL_accept(3), SSL_set_shutdown(3), SSL_CTX_set_quiet_shutdown(3), SSL_CTX_set_options(3) SSL_clear(3), SSL_free(3), ssl(7), bio(7)

                        "},{"location":"man3/SSL_shutdown/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_state_string/","title":"SSL_state_string","text":""},{"location":"man3/SSL_state_string/#name","title":"NAME","text":"

                        SSL_state_string, SSL_state_string_long - get textual description of state of an SSL object

                        "},{"location":"man3/SSL_state_string/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nconst char *SSL_state_string(const SSL *ssl);\nconst char *SSL_state_string_long(const SSL *ssl);\n
                        "},{"location":"man3/SSL_state_string/#description","title":"DESCRIPTION","text":"

                        SSL_state_string() returns an abbreviated string indicating the current state of the SSL object ssl. The returned NUL-terminated string contains 6 or fewer characters.

                        SSL_state_string_long() returns a descriptive string indicating the current state of the SSL object ssl.

                        "},{"location":"man3/SSL_state_string/#notes","title":"NOTES","text":"

                        During its use, an SSL objects passes several states. The state is internally maintained. Querying the state information is not very informative before or when a connection has been established. It however can be of significant interest during the handshake.

                        When using nonblocking sockets, the function call performing the handshake may return with SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition, so that SSL_state_string[_long]() may be called.

                        For both blocking or nonblocking sockets, the details state information can be used within the info_callback function set with the SSL_set_info_callback() call.

                        "},{"location":"man3/SSL_state_string/#return-values","title":"RETURN VALUES","text":"

                        Detailed description of possible states to be included later.

                        "},{"location":"man3/SSL_state_string/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_CTX_set_info_callback(3)

                        "},{"location":"man3/SSL_state_string/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_want/","title":"SSL_want","text":""},{"location":"man3/SSL_want/#name","title":"NAME","text":"

                        SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup, SSL_want_retry_verify, SSL_want_async, SSL_want_async_job, SSL_want_client_hello_cb - obtain state information TLS/SSL I/O operation

                        "},{"location":"man3/SSL_want/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nint SSL_want(const SSL *ssl);\nint SSL_want_nothing(const SSL *ssl);\nint SSL_want_read(const SSL *ssl);\nint SSL_want_write(const SSL *ssl);\nint SSL_want_x509_lookup(const SSL *ssl);\nint SSL_want_retry_verify(const SSL *ssl);\nint SSL_want_async(const SSL *ssl);\nint SSL_want_async_job(const SSL *ssl);\nint SSL_want_client_hello_cb(const SSL *ssl);\n
                        "},{"location":"man3/SSL_want/#description","title":"DESCRIPTION","text":"

                        SSL_want() returns state information for the SSL object ssl.

                        The other SSL_want_*() calls are shortcuts for the possible states returned by SSL_want().

                        "},{"location":"man3/SSL_want/#notes","title":"NOTES","text":"

                        SSL_want() examines the internal state information of the SSL object. Its return values are similar to that of SSL_get_error(3). Unlike SSL_get_error(3), which also evaluates the error queue, the results are obtained by examining an internal state flag only. The information must therefore only be used for normal operation under nonblocking I/O. Error conditions are not handled and must be treated using SSL_get_error(3).

                        The result returned by SSL_want() should always be consistent with the result of SSL_get_error(3).

                        "},{"location":"man3/SSL_want/#return-values","title":"RETURN VALUES","text":"

                        The following return values can currently occur for SSL_want():

                        • SSL_NOTHING

                          There is no data to be written or to be read.

                        • SSL_WRITING

                          There are data in the SSL buffer that must be written to the underlying BIO layer in order to complete the actual SSL_*() operation. A call to SSL_get_error(3) should return SSL_ERROR_WANT_WRITE.

                        • SSL_READING

                          More data must be read from the underlying BIO layer in order to complete the actual SSL_*() operation. A call to SSL_get_error(3) should return SSL_ERROR_WANT_READ.

                        • SSL_X509_LOOKUP

                          The operation did not complete because an application callback set by SSL_CTX_set_client_cert_cb() has asked to be called again. A call to SSL_get_error(3) should return SSL_ERROR_WANT_X509_LOOKUP.

                        • SSL_RETRY_VERIFY

                          The operation did not complete because a certificate verification callback has asked to be called again via SSL_set_retry_verify(3). A call to SSL_get_error(3) should return SSL_ERROR_WANT_RETRY_VERIFY.

                        • SSL_ASYNC_PAUSED

                          An asynchronous operation partially completed and was then paused. See SSL_get_all_async_fds(3). A call to SSL_get_error(3) should return SSL_ERROR_WANT_ASYNC.

                        • SSL_ASYNC_NO_JOBS

                          The asynchronous job could not be started because there were no async jobs available in the pool (see ASYNC_init_thread(3)). A call to SSL_get_error(3) should return SSL_ERROR_WANT_ASYNC_JOB.

                        • SSL_CLIENT_HELLO_CB

                          The operation did not complete because an application callback set by SSL_CTX_set_client_hello_cb() has asked to be called again. A call to SSL_get_error(3) should return SSL_ERROR_WANT_CLIENT_HELLO_CB.

                        SSL_want_nothing(), SSL_want_read(), SSL_want_write(), SSL_want_x509_lookup(), SSL_want_retry_verify(), SSL_want_async(), SSL_want_async_job(), and SSL_want_client_hello_cb() return 1 when the corresponding condition is true or 0 otherwise.

                        "},{"location":"man3/SSL_want/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_get_error(3)

                        "},{"location":"man3/SSL_want/#history","title":"HISTORY","text":"

                        The SSL_want_client_hello_cb() function and the SSL_CLIENT_HELLO_CB return value were added in OpenSSL 1.1.1.

                        "},{"location":"man3/SSL_want/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/SSL_write/","title":"SSL_write","text":""},{"location":"man3/SSL_write/#name","title":"NAME","text":"

                        SSL_write_ex, SSL_write, SSL_sendfile - write bytes to a TLS/SSL connection

                        "},{"location":"man3/SSL_write/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size, int flags);\nint SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written);\nint SSL_write(SSL *ssl, const void *buf, int num);\n
                        "},{"location":"man3/SSL_write/#description","title":"DESCRIPTION","text":"

                        SSL_write_ex() and SSL_write() write num bytes from the buffer buf into the specified ssl connection. On success SSL_write_ex() will store the number of bytes written in *written.

                        SSL_sendfile() writes size bytes from offset offset in the file descriptor fd to the specified SSL connection s. This function provides efficient zero-copy semantics. SSL_sendfile() is available only when Kernel TLS is enabled, which can be checked by calling BIO_get_ktls_send(). It is provided here to allow users to maintain the same interface. The meaning of flags is platform dependent. Currently, under Linux it is ignored.

                        "},{"location":"man3/SSL_write/#notes","title":"NOTES","text":"

                        In the paragraphs below a \"write function\" is defined as one of either SSL_write_ex(), or SSL_write().

                        If necessary, a write function will negotiate a TLS/SSL session, if not already explicitly performed by SSL_connect(3) or SSL_accept(3). If the peer requests a re-negotiation, it will be performed transparently during the write function operation. The behaviour of the write functions depends on the underlying BIO.

                        For the transparent negotiation to succeed, the ssl must have been initialized to client or server mode. This is being done by calling SSL_set_connect_state(3) or SSL_set_accept_state() before the first call to a write function.

                        If the underlying BIO is blocking, the write functions will only return, once the write operation has been finished or an error occurred.

                        If the underlying BIO is nonblocking the write functions will also return when the underlying BIO could not satisfy the needs of the function to continue the operation. In this case a call to SSL_get_error(3) with the return value of the write function will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. As at any time a re-negotiation is possible, a call to a write function can also cause read operations! The calling process then must repeat the call after taking appropriate action to satisfy the needs of the write function. The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                        The write functions will only return with success when the complete contents of buf of length num has been written. This default behaviour can be changed with the SSL_MODE_ENABLE_PARTIAL_WRITE option of SSL_CTX_set_mode(3). When this flag is set the write functions will also return with success when a partial write has been successfully completed. In this case the write function operation is considered completed. The bytes are sent and a new write call with a new buffer (with the already sent bytes removed) must be started. A partial write is performed with the size of a message block, which is 16kB.

                        "},{"location":"man3/SSL_write/#warnings","title":"WARNINGS","text":"

                        When a write function call has to be repeated because SSL_get_error(3) returned SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE, it must be repeated with the same arguments. The data that was passed might have been partially processed. When SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER was set using SSL_CTX_set_mode(3) the pointer can be different, but the data and length should still be the same.

                        You should not call SSL_write() with num=0, it will return an error. SSL_write_ex() can be called with num=0, but will not send application data to the peer.

                        "},{"location":"man3/SSL_write/#return-values","title":"RETURN VALUES","text":"

                        SSL_write_ex() will return 1 for success or 0 for failure. Success means that all requested application data bytes have been written to the SSL connection or, if SSL_MODE_ENABLE_PARTIAL_WRITE is in use, at least 1 application data byte has been written to the SSL connection. Failure means that not all the requested bytes have been written yet (if SSL_MODE_ENABLE_PARTIAL_WRITE is not in use) or no bytes could be written to the SSL connection (if SSL_MODE_ENABLE_PARTIAL_WRITE is in use). Failures can be retryable (e.g. the network write buffer has temporarily filled up) or non-retryable (e.g. a fatal network error). In the event of a failure call SSL_get_error(3) to find out the reason which indicates whether the call is retryable or not.

                        For SSL_write() the following return values can occur:

                        • 0

                          The write operation was successful, the return value is the number of bytes actually written to the TLS/SSL connection.

                        • <= 0

                          The write operation was not successful, because either the connection was closed, an error occurred or action must be taken by the calling process. Call SSL_get_error() with the return value ret to find out the reason.

                          Old documentation indicated a difference between 0 and -1, and that -1 was retryable. You should instead call SSL_get_error() to find out if it's retryable.

                        For SSL_sendfile(), the following return values can occur:

                        • = 0

                          The write operation was successful, the return value is the number of bytes of the file written to the TLS/SSL connection. The return value can be less than size for a partial write.

                        • < 0

                          The write operation was not successful, because either the connection was closed, an error occurred or action must be taken by the calling process. Call SSL_get_error() with the return value to find out the reason.

                        "},{"location":"man3/SSL_write/#see-also","title":"SEE ALSO","text":"

                        SSL_get_error(3), SSL_read_ex(3), SSL_read(3) SSL_CTX_set_mode(3), SSL_CTX_new(3), SSL_connect(3), SSL_accept(3) SSL_set_connect_state(3), BIO_ctrl(3), ssl(7), bio(7)

                        "},{"location":"man3/SSL_write/#history","title":"HISTORY","text":"

                        The SSL_write_ex() function was added in OpenSSL 1.1.1. The SSL_sendfile() function was added in OpenSSL 3.0.

                        "},{"location":"man3/SSL_write/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/TS_RESP_CTX_new/","title":"TS_RESP_CTX_new","text":""},{"location":"man3/TS_RESP_CTX_new/#name","title":"NAME","text":"

                        TS_RESP_CTX_new_ex, TS_RESP_CTX_new, TS_RESP_CTX_free - Timestamp response context object creation

                        "},{"location":"man3/TS_RESP_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ts.h>\n\nTS_RESP_CTX *TS_RESP_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nTS_RESP_CTX *TS_RESP_CTX_new(void);\nvoid TS_RESP_CTX_free(TS_RESP_CTX *ctx);\n
                        "},{"location":"man3/TS_RESP_CTX_new/#description","title":"DESCRIPTION","text":"

                        Creates a response context that can be used for generating responses.

                        TS_RESP_CTX_new_ex() allocates and initializes a TS_RESP_CTX structure with a library context of libctx and a property query of propq. The library context and property query can be used to select which providers supply the fetched algorithms.

                        TS_RESP_CTX_new() is similar to TS_RESP_CTX_new_ex() but sets the library context and property query to NULL. This results in the default (NULL) library context being used for any operations requiring algorithm fetches.

                        TS_RESP_CTX_free() frees the TS_RESP_CTX object ctx. If the argument is NULL, nothing is done.

                        "},{"location":"man3/TS_RESP_CTX_new/#return-values","title":"RETURN VALUES","text":"

                        If the allocation fails, TS_RESP_CTX_new_ex() and TS_RESP_CTX_new() return NULL, otherwise it returns a pointer to the newly allocated structure.

                        "},{"location":"man3/TS_RESP_CTX_new/#history","title":"HISTORY","text":"

                        The function TS_RESP_CTX_new_ex() was added in OpenSSL 3.0.

                        "},{"location":"man3/TS_RESP_CTX_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/TS_VERIFY_CTX_set_certs/","title":"TS_VERIFY_CTX_set_certs","text":""},{"location":"man3/TS_VERIFY_CTX_set_certs/#name","title":"NAME","text":"

                        TS_VERIFY_CTX_set_certs, TS_VERIFY_CTS_set_certs - set certificates for TS response verification

                        "},{"location":"man3/TS_VERIFY_CTX_set_certs/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ts.h>\n\nSTACK_OF(X509) *TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx,\n                                        STACK_OF(X509) *certs);\nSTACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx,\n                                        STACK_OF(X509) *certs);\n
                        "},{"location":"man3/TS_VERIFY_CTX_set_certs/#description","title":"DESCRIPTION","text":"

                        The Time-Stamp Protocol (TSP) is defined by RFC 3161. TSP is a protocol used to provide long term proof of the existence of a certain datum before a particular time. TSP defines a Time Stamping Authority (TSA) and an entity who shall make requests to the TSA. Usually the TSA is denoted as the server side and the requesting entity is denoted as the client.

                        In TSP, when a server is sending a response to a client, the server normally needs to sign the response data - the TimeStampToken (TST) - with its private key. Then the client shall verify the received TST by the server's certificate chain.

                        TS_VERIFY_CTX_set_certs() is used to set the server's certificate chain when verifying a TST. ctx is the verification context created in advance and certs is a stack of X509 certificates.

                        TS_VERIFY_CTS_set_certs() is a misspelled version of TS_VERIFY_CTX_set_certs() which takes the same parameters and returns the same result.

                        "},{"location":"man3/TS_VERIFY_CTX_set_certs/#return-values","title":"RETURN VALUES","text":"

                        TS_VERIFY_CTX_set_certs() returns the stack of X509 certificates the user passes in via parameter certs.

                        "},{"location":"man3/TS_VERIFY_CTX_set_certs/#see-also","title":"SEE ALSO","text":"

                        OSSL_ESS_check_signing_certs(3)

                        "},{"location":"man3/TS_VERIFY_CTX_set_certs/#history","title":"HISTORY","text":"

                        The spelling of TS_VERIFY_CTX_set_certs() was corrected in OpenSSL 3.0.0. The misspelled version TS_VERIFY_CTS_set_certs() has been retained for compatibility reasons, but it is deprecated in OpenSSL 3.0.0.

                        "},{"location":"man3/TS_VERIFY_CTX_set_certs/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/UI_STRING/","title":"UI_STRING","text":""},{"location":"man3/UI_STRING/#name","title":"NAME","text":"

                        UI_STRING, UI_string_types, UI_get_string_type, UI_get_input_flags, UI_get0_output_string, UI_get0_action_string, UI_get0_result_string, UI_get_result_string_length, UI_get0_test_string, UI_get_result_minsize, UI_get_result_maxsize, UI_set_result, UI_set_result_ex - User interface string parsing

                        "},{"location":"man3/UI_STRING/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ui.h>\n\ntypedef struct ui_string_st UI_STRING;\n\nenum UI_string_types {\n    UIT_NONE = 0,\n    UIT_PROMPT,                 /* Prompt for a string */\n    UIT_VERIFY,                 /* Prompt for a string and verify */\n    UIT_BOOLEAN,                /* Prompt for a yes/no response */\n    UIT_INFO,                   /* Send info to the user */\n    UIT_ERROR                   /* Send an error message to the user */\n};\n\nenum UI_string_types UI_get_string_type(UI_STRING *uis);\nint UI_get_input_flags(UI_STRING *uis);\nconst char *UI_get0_output_string(UI_STRING *uis);\nconst char *UI_get0_action_string(UI_STRING *uis);\nconst char *UI_get0_result_string(UI_STRING *uis);\nint UI_get_result_string_length(UI_STRING *uis);\nconst char *UI_get0_test_string(UI_STRING *uis);\nint UI_get_result_minsize(UI_STRING *uis);\nint UI_get_result_maxsize(UI_STRING *uis);\nint UI_set_result(UI *ui, UI_STRING *uis, const char *result);\nint UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);\n
                        "},{"location":"man3/UI_STRING/#description","title":"DESCRIPTION","text":"

                        The UI_STRING gets created internally and added to a UI whenever one of the functions UI_add_input_string(), UI_dup_input_string(), UI_add_verify_string(), UI_dup_verify_string(), UI_add_input_boolean(), UI_dup_input_boolean(), UI_add_info_string(), UI_dup_info_string(), UI_add_error_string() or UI_dup_error_string() is called. For a UI_METHOD user, there's no need to know more. For a UI_METHOD creator, it is of interest to fetch text from these UI_STRING objects as well as adding results to some of them.

                        UI_get_string_type() is used to retrieve the type of the given UI_STRING.

                        UI_get_input_flags() is used to retrieve the flags associated with the given UI_STRING.

                        UI_get0_output_string() is used to retrieve the actual string to output (prompt, info, error, ...).

                        UI_get0_action_string() is used to retrieve the action description associated with a UIT_BOOLEAN type UI_STRING. For all other UI_STRING types, NULL is returned. See UI_add_input_boolean(3).

                        UI_get0_result_string() and UI_get_result_string_length() are used to retrieve the result of a prompt and its length. This is only useful for UIT_PROMPT and UIT_VERIFY type strings. For all other UI_STRING types, UI_get0_result_string() returns NULL and UI_get_result_string_length() returns -1.

                        UI_get0_test_string() is used to retrieve the string to compare the prompt result with. This is only useful for UIT_VERIFY type strings. For all other UI_STRING types, NULL is returned.

                        UI_get_result_minsize() and UI_get_result_maxsize() are used to retrieve the minimum and maximum required size of the result. This is only useful for UIT_PROMPT and UIT_VERIFY type strings. For all other UI_STRING types, -1 is returned.

                        UI_set_result_ex() is used to set the result value of a prompt and its length. For UIT_PROMPT and UIT_VERIFY type UI strings, this sets the result retrievable with UI_get0_result_string() by copying the contents of result if its length fits the minimum and maximum size requirements. For UIT_BOOLEAN type UI strings, this sets the first character of the result retrievable with UI_get0_result_string() to the first ok_char given with UI_add_input_boolean() or UI_dup_input_boolean() if the result matched any of them, or the first of the cancel_chars if the result matched any of them, otherwise it's set to the NUL char \\0. See UI_add_input_boolean(3) for more information on ok_chars and cancel_chars.

                        UI_set_result() does the same thing as UI_set_result_ex(), but calculates its length internally. It expects the string to be terminated with a NUL byte, and is therefore only useful with normal C strings.

                        "},{"location":"man3/UI_STRING/#return-values","title":"RETURN VALUES","text":"

                        UI_get_string_type() returns the UI string type.

                        UI_get_input_flags() returns the UI string flags.

                        UI_get0_output_string() returns the UI string output string.

                        UI_get0_action_string() returns the UI string action description string for UIT_BOOLEAN type UI strings, NULL for any other type.

                        UI_get0_result_string() returns the UI string result buffer for UIT_PROMPT and UIT_VERIFY type UI strings, NULL for any other type.

                        UI_get_result_string_length() returns the UI string result buffer's content length for UIT_PROMPT and UIT_VERIFY type UI strings, -1 for any other type.

                        UI_get0_test_string() returns the UI string action description string for UIT_VERIFY type UI strings, NULL for any other type.

                        UI_get_result_minsize() returns the minimum allowed result size for the UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other type.

                        UI_get_result_maxsize() returns the minimum allowed result size for the UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other type.

                        UI_set_result() returns 0 on success or when the UI string is of any type other than UIT_PROMPT, UIT_VERIFY or UIT_BOOLEAN, -1 on error.

                        "},{"location":"man3/UI_STRING/#see-also","title":"SEE ALSO","text":"

                        UI(3)

                        "},{"location":"man3/UI_STRING/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/UI_UTIL_read_pw/","title":"UI_UTIL_read_pw","text":""},{"location":"man3/UI_UTIL_read_pw/#name","title":"NAME","text":"

                        UI_UTIL_read_pw_string, UI_UTIL_read_pw, UI_UTIL_wrap_read_pem_callback - user interface utilities

                        "},{"location":"man3/UI_UTIL_read_pw/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ui.h>\n\nint UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,\n                           int verify);\nint UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,\n                    int verify);\nUI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag);\n
                        "},{"location":"man3/UI_UTIL_read_pw/#description","title":"DESCRIPTION","text":"

                        UI_UTIL_read_pw_string() asks for a passphrase, using prompt as a prompt, and stores it in buf. The maximum allowed size is given with length, including the terminating NUL byte. If verify is nonzero, the password will be verified as well.

                        UI_UTIL_read_pw() does the same as UI_UTIL_read_pw_string(), the difference is that you can give it an external buffer buff for the verification passphrase.

                        UI_UTIL_wrap_read_pem_callback() can be used to create a temporary UI_METHOD that wraps a given PEM password callback cb. rwflag is used to specify if this method will be used for passphrase entry without (0) or with (1) verification. When not used any more, the returned method should be freed with UI_destroy_method().

                        "},{"location":"man3/UI_UTIL_read_pw/#notes","title":"NOTES","text":"

                        UI_UTIL_read_pw_string() and UI_UTIL_read_pw() use default UI_METHOD. See UI_get_default_method(3) and friends for more information.

                        The result from the UI_METHOD created by UI_UTIL_wrap_read_pem_callback() will generate password strings in the encoding that the given password callback generates. The default password prompting functions (apart from UI_UTIL_read_pw_string() and UI_UTIL_read_pw(), there is PEM_def_callback(), EVP_read_pw_string() and EVP_read_pw_string_min()) all use the default UI_METHOD.

                        "},{"location":"man3/UI_UTIL_read_pw/#return-values","title":"RETURN VALUES","text":"

                        UI_UTIL_read_pw_string() and UI_UTIL_read_pw() return 0 on success or a negative value on error.

                        UI_UTIL_wrap_read_pem_callback() returns a valid UI_METHOD structure or NULL if an error occurred.

                        "},{"location":"man3/UI_UTIL_read_pw/#see-also","title":"SEE ALSO","text":"

                        UI_get_default_method(3)

                        "},{"location":"man3/UI_UTIL_read_pw/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/UI_create_method/","title":"UI_create_method","text":""},{"location":"man3/UI_create_method/#name","title":"NAME","text":"

                        UI_METHOD, UI_create_method, UI_destroy_method, UI_method_set_opener, UI_method_set_writer, UI_method_set_flusher, UI_method_set_reader, UI_method_set_closer, UI_method_set_data_duplicator, UI_method_set_prompt_constructor, UI_method_set_ex_data, UI_method_get_opener, UI_method_get_writer, UI_method_get_flusher, UI_method_get_reader, UI_method_get_closer, UI_method_get_data_duplicator, UI_method_get_data_destructor, UI_method_get_prompt_constructor, UI_method_get_ex_data - user interface method creation and destruction

                        "},{"location":"man3/UI_create_method/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ui.h>\n\ntypedef struct ui_method_st UI_METHOD;\n\nUI_METHOD *UI_create_method(const char *name);\nvoid UI_destroy_method(UI_METHOD *ui_method);\nint UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui));\nint UI_method_set_writer(UI_METHOD *method,\n                         int (*writer) (UI *ui, UI_STRING *uis));\nint UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui));\nint UI_method_set_reader(UI_METHOD *method,\n                         int (*reader) (UI *ui, UI_STRING *uis));\nint UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui));\nint UI_method_set_data_duplicator(UI_METHOD *method,\n                                  void *(*duplicator) (UI *ui, void *ui_data),\n                                  void (*destructor)(UI *ui, void *ui_data));\nint UI_method_set_prompt_constructor(UI_METHOD *method,\n                                     char *(*prompt_constructor) (UI *ui,\n                                                                  const char\n                                                                  *object_desc,\n                                                                  const char\n                                                                  *object_name));\nint UI_method_set_ex_data(UI_METHOD *method, int idx, void *data);\nint (*UI_method_get_opener(const UI_METHOD *method)) (UI *);\nint (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *);\nint (*UI_method_get_flusher(const UI_METHOD *method)) (UI *);\nint (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *);\nint (*UI_method_get_closer(const UI_METHOD *method)) (UI *);\nchar *(*UI_method_get_prompt_constructor(const UI_METHOD *method))\n    (UI *, const char *, const char *);\nvoid *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *);\nvoid (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *);\nconst void *UI_method_get_ex_data(const UI_METHOD *method, int idx);\n
                        "},{"location":"man3/UI_create_method/#description","title":"DESCRIPTION","text":"

                        A method contains a few functions that implement the low-level of the User Interface. These functions are:

                        • an opener

                          This function takes a reference to a UI and starts a session, for example by opening a channel to a tty, or by creating a dialog box.

                        • a writer

                          This function takes a reference to a UI and a UI String, and writes the string where appropriate, maybe to the tty, maybe added as a field label in a dialog box. Note that this gets fed all strings associated with a UI, one after the other, so care must be taken which ones it actually uses.

                        • a flusher

                          This function takes a reference to a UI, and flushes everything that has been output so far. For example, if the method builds up a dialog box, this can be used to actually display it and accepting input ended with a pressed button.

                        • a reader

                          This function takes a reference to a UI and a UI string and reads off the given prompt, maybe from the tty, maybe from a field in a dialog box. Note that this gets fed all strings associated with a UI, one after the other, so care must be taken which ones it actually uses.

                        • a closer

                          This function takes a reference to a UI, and closes the session, maybe by closing the channel to the tty, maybe by destroying a dialog box.

                        All of these functions are expected to return 0 on error, 1 on success, or -1 on out-off-band events, for example if some prompting has been cancelled (by pressing Ctrl-C, for example). Only the flusher or the reader are expected to return -1. If returned by another of the functions, it's treated as if 0 was returned.

                        Regarding the writer and the reader, don't assume the former should only write and don't assume the latter should only read. This depends on the needs of the method.

                        For example, a typical tty reader wouldn't write the prompts in the write, but would rather do so in the reader, because of the sequential nature of prompting on a tty. This is how the UI_OpenSSL() method does it.

                        In contrast, a method that builds up a dialog box would add all prompt text in the writer, have all input read in the flusher and store the results in some temporary buffer, and finally have the reader just fetch those results.

                        The central function that uses these method functions is UI_process(), and it does it in five steps:

                        1. Open the session using the opener function if that one's defined. If an error occurs, jump to 5.
                        2. For every UI String associated with the UI, call the writer function if that one's defined. If an error occurs, jump to 5.
                        3. Flush everything using the flusher function if that one's defined. If an error occurs, jump to 5.
                        4. For every UI String associated with the UI, call the reader function if that one's defined. If an error occurs, jump to 5.
                        5. Close the session using the closer function if that one's defined.

                        UI_create_method() creates a new UI method with a given name.

                        UI_destroy_method() destroys the given UI method ui_method.

                        UI_method_set_opener(), UI_method_set_writer(), UI_method_set_flusher(), UI_method_set_reader() and UI_method_set_closer() set the five main method function to the given function pointer.

                        UI_method_set_data_duplicator() sets the user data duplicator and destructor. See UI_dup_user_data(3).

                        UI_method_set_prompt_constructor() sets the prompt constructor. See UI_construct_prompt(3).

                        UI_method_set_ex_data() sets application specific data with a given EX_DATA index. See CRYPTO_get_ex_new_index(3) for general information on how to get that index.

                        UI_method_get_opener(), UI_method_get_writer(), UI_method_get_flusher(), UI_method_get_reader(), UI_method_get_closer(), UI_method_get_data_duplicator(), UI_method_get_data_destructor() and UI_method_get_prompt_constructor() return the different method functions.

                        UI_method_get_ex_data() returns the application data previously stored with UI_method_set_ex_data().

                        "},{"location":"man3/UI_create_method/#return-values","title":"RETURN VALUES","text":"

                        UI_create_method() returns a UI_METHOD pointer on success, NULL on error.

                        UI_method_set_opener(), UI_method_set_writer(), UI_method_set_flusher(), UI_method_set_reader(), UI_method_set_closer(), UI_method_set_data_duplicator() and UI_method_set_prompt_constructor() return 0 on success, -1 if the given method is NULL.

                        UI_method_set_ex_data() returns 1 on success and 0 on error (because CRYPTO_set_ex_data() does so).

                        UI_method_get_opener(), UI_method_get_writer(), UI_method_get_flusher(), UI_method_get_reader(), UI_method_get_closer(), UI_method_get_data_duplicator(), UI_method_get_data_destructor() and UI_method_get_prompt_constructor() return the requested function pointer if it's set in the method, otherwise NULL.

                        UI_method_get_ex_data() returns a pointer to the application specific data associated with the method.

                        "},{"location":"man3/UI_create_method/#see-also","title":"SEE ALSO","text":"

                        UI(3), CRYPTO_get_ex_data(3), UI_STRING(3)

                        "},{"location":"man3/UI_create_method/#history","title":"HISTORY","text":"

                        The UI_method_set_data_duplicator(), UI_method_get_data_duplicator() and UI_method_get_data_destructor() functions were added in OpenSSL 1.1.1.

                        "},{"location":"man3/UI_create_method/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/UI_new/","title":"UI_new","text":""},{"location":"man3/UI_new/#name","title":"NAME","text":"

                        UI, UI_new, UI_new_method, UI_free, UI_add_input_string, UI_dup_input_string, UI_add_verify_string, UI_dup_verify_string, UI_add_input_boolean, UI_dup_input_boolean, UI_add_info_string, UI_dup_info_string, UI_add_error_string, UI_dup_error_string, UI_construct_prompt, UI_add_user_data, UI_dup_user_data, UI_get0_user_data, UI_get0_result, UI_get_result_length, UI_process, UI_ctrl, UI_set_default_method, UI_get_default_method, UI_get_method, UI_set_method, UI_OpenSSL, UI_null - user interface

                        "},{"location":"man3/UI_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ui.h>\n\ntypedef struct ui_st UI;\n\nUI *UI_new(void);\nUI *UI_new_method(const UI_METHOD *method);\nvoid UI_free(UI *ui);\n\nint UI_add_input_string(UI *ui, const char *prompt, int flags,\n                        char *result_buf, int minsize, int maxsize);\nint UI_dup_input_string(UI *ui, const char *prompt, int flags,\n                        char *result_buf, int minsize, int maxsize);\nint UI_add_verify_string(UI *ui, const char *prompt, int flags,\n                         char *result_buf, int minsize, int maxsize,\n                         const char *test_buf);\nint UI_dup_verify_string(UI *ui, const char *prompt, int flags,\n                         char *result_buf, int minsize, int maxsize,\n                         const char *test_buf);\nint UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,\n                         const char *ok_chars, const char *cancel_chars,\n                         int flags, char *result_buf);\nint UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,\n                         const char *ok_chars, const char *cancel_chars,\n                         int flags, char *result_buf);\nint UI_add_info_string(UI *ui, const char *text);\nint UI_dup_info_string(UI *ui, const char *text);\nint UI_add_error_string(UI *ui, const char *text);\nint UI_dup_error_string(UI *ui, const char *text);\n\nchar *UI_construct_prompt(UI *ui_method,\n                          const char *phrase_desc, const char *object_name);\n\nvoid *UI_add_user_data(UI *ui, void *user_data);\nint UI_dup_user_data(UI *ui, void *user_data);\nvoid *UI_get0_user_data(UI *ui);\n\nconst char *UI_get0_result(UI *ui, int i);\nint UI_get_result_length(UI *ui, int i);\n\nint UI_process(UI *ui);\n\nint UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)());\n\nvoid UI_set_default_method(const UI_METHOD *meth);\nconst UI_METHOD *UI_get_default_method(void);\nconst UI_METHOD *UI_get_method(UI *ui);\nconst UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);\n\nUI_METHOD *UI_OpenSSL(void);\nconst UI_METHOD *UI_null(void);\n
                        "},{"location":"man3/UI_new/#description","title":"DESCRIPTION","text":"

                        UI stands for User Interface, and is general purpose set of routines to prompt the user for text-based information. Through user-written methods (see UI_create_method(3)), prompting can be done in any way imaginable, be it plain text prompting, through dialog boxes or from a cell phone.

                        All the functions work through a context of the type UI. This context contains all the information needed to prompt correctly as well as a reference to a UI_METHOD, which is an ordered vector of functions that carry out the actual prompting.

                        The first thing to do is to create a UI with UI_new() or UI_new_method(), then add information to it with the UI_add or UI_dup functions. Also, user-defined random data can be passed down to the underlying method through calls to UI_add_user_data() or UI_dup_user_data(). The default UI method doesn't care about these data, but other methods might. Finally, use UI_process() to actually perform the prompting and UI_get0_result() and UI_get_result_length() to find the result to the prompt and its length.

                        A UI can contain more than one prompt, which are performed in the given sequence. Each prompt gets an index number which is returned by the UI_add and UI_dup functions, and has to be used to get the corresponding result with UI_get0_result() and UI_get_result_length().

                        UI_process() can be called more than once on the same UI, thereby allowing a UI to have a long lifetime, but can just as well have a short lifetime.

                        The functions are as follows:

                        UI_new() creates a new UI using the default UI method. When done with this UI, it should be freed using UI_free().

                        UI_new_method() creates a new UI using the given UI method. When done with this UI, it should be freed using UI_free().

                        UI_OpenSSL() returns the built-in UI method (note: not necessarily the default one, since the default can be changed. See further on). This method is the most machine/OS dependent part of OpenSSL and normally generates the most problems when porting.

                        UI_null() returns a UI method that does nothing. Its use is to avoid getting internal defaults for passed UI_METHOD pointers.

                        UI_free() removes a UI from memory, along with all other pieces of memory that's connected to it, like duplicated input strings, results and others. If ui is NULL nothing is done.

                        UI_add_input_string() and UI_add_verify_string() add a prompt to the UI, as well as flags and a result buffer and the desired minimum and maximum sizes of the result, not counting the final NUL character. The given information is used to prompt for information, for example a password, and to verify a password (i.e. having the user enter it twice and check that the same string was entered twice). UI_add_verify_string() takes and extra argument that should be a pointer to the result buffer of the input string that it's supposed to verify, or verification will fail.

                        UI_add_input_boolean() adds a prompt to the UI that's supposed to be answered in a boolean way, with a single character for yes and a different character for no. A set of characters that can be used to cancel the prompt is given as well. The prompt itself is divided in two, one part being the descriptive text (given through the prompt argument) and one describing the possible answers (given through the action_desc argument).

                        UI_add_info_string() and UI_add_error_string() add strings that are shown at the same time as the prompt for extra information or to show an error string. The difference between the two is only conceptual. With the built-in method, there's no technical difference between them. Other methods may make a difference between them, however.

                        The flags currently supported are UI_INPUT_FLAG_ECHO, which is relevant for UI_add_input_string() and will have the users response be echoed (when prompting for a password, this flag should obviously not be used, and UI_INPUT_FLAG_DEFAULT_PWD, which means that a default password of some sort will be used (completely depending on the application and the UI method).

                        UI_dup_input_string(), UI_dup_verify_string(), UI_dup_input_boolean(), UI_dup_info_string() and UI_dup_error_string() are basically the same as their UI_add counterparts, except that they make their own copies of all strings.

                        UI_construct_prompt() is a helper function that can be used to create a prompt from two pieces of information: a phrase description phrase_desc and an object name object_name, where the latter may be NULL. The default constructor (if there is none provided by the method used) creates a string \"Enter phrase_desc for object_name:\" where the \" for object_name\" part is left out if object_name is NULL. With the description \"pass phrase\" and the filename \"foo.key\", that becomes \"Enter pass phrase for foo.key:\". Other methods may create whatever string and may include encodings that will be processed by the other method functions.

                        UI_add_user_data() adds a user data pointer for the method to use at any time. The built-in UI method doesn't care about this info. Note that several calls to this function doesn't add data, it replaces the previous blob with the one given as argument.

                        UI_dup_user_data() duplicates the user data and works as an alternative to UI_add_user_data() when the user data needs to be preserved for a longer duration, perhaps even the lifetime of the application. The UI object takes ownership of this duplicate and will free it whenever it gets replaced or the UI is destroyed. UI_dup_user_data() returns 0 on success, or -1 on memory allocation failure or if the method doesn't have a duplicator function.

                        UI_get0_user_data() retrieves the data that has last been given to the UI with UI_add_user_data() or UI_dup_user_data.

                        UI_get0_result() returns a pointer to the result buffer associated with the information indexed by i.

                        UI_get_result_length() returns the length of the result buffer associated with the information indexed by i.

                        UI_process() goes through the information given so far, does all the printing and prompting and returns the final status, which is -2 on out-of-band events (Interrupt, Cancel, ...), -1 on error and 0 on success.

                        UI_ctrl() adds extra control for the application author. For now, it understands two commands: UI_CTRL_PRINT_ERRORS, which makes UI_process() print the OpenSSL error stack as part of processing the UI, and UI_CTRL_IS_REDOABLE, which returns a flag saying if the used UI can be used again or not.

                        UI_set_default_method() changes the default UI method to the one given. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

                        UI_get_default_method() returns a pointer to the current default UI method.

                        UI_get_method() returns the UI method associated with a given UI.

                        UI_set_method() changes the UI method associated with a given UI.

                        "},{"location":"man3/UI_new/#notes","title":"NOTES","text":"

                        The resulting strings that the built in method UI_OpenSSL() generate are assumed to be encoded according to the current locale or (for Windows) code page. For applications having different demands, these strings need to be converted appropriately by the caller. For Windows, if the OPENSSL_WIN32_UTF8 environment variable is set, the built-in method UI_OpenSSL() will produce UTF-8 encoded strings instead.

                        "},{"location":"man3/UI_new/#return-values","title":"RETURN VALUES","text":"

                        UI_new() and UI_new_method() return a valid UI structure or NULL if an error occurred.

                        UI_add_input_string(), UI_dup_input_string(), UI_add_verify_string(), UI_dup_verify_string(), UI_add_input_boolean(), UI_dup_input_boolean(), UI_add_info_string(), UI_dup_info_string(), UI_add_error_string() and UI_dup_error_string() return a positive number on success or a value which is less than or equal to 0 otherwise.

                        UI_construct_prompt() returns a string or NULL if an error occurred.

                        UI_dup_user_data() returns 0 on success or -1 on error.

                        UI_get0_result() returns a string or NULL on error.

                        UI_get_result_length() returns a positive integer or 0 on success; otherwise it returns -1 on error.

                        UI_process() returns 0 on success or a negative value on error.

                        UI_ctrl() returns a mask on success or -1 on error.

                        UI_get_default_method(), UI_get_method(), UI_OpenSSL(), UI_null() and UI_set_method() return either a valid UI_METHOD structure or NULL respectively.

                        "},{"location":"man3/UI_new/#history","title":"HISTORY","text":"

                        The UI_dup_user_data() function was added in OpenSSL 1.1.1.

                        "},{"location":"man3/UI_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509V3_get_d2i/","title":"X509V3_get_d2i","text":""},{"location":"man3/X509V3_get_d2i/#name","title":"NAME","text":"

                        X509V3_get_d2i, X509V3_add1_i2d, X509V3_EXT_d2i, X509V3_EXT_i2d, X509_get_ext_d2i, X509_add1_ext_i2d, X509_CRL_get_ext_d2i, X509_CRL_add1_ext_i2d, X509_REVOKED_get_ext_d2i, X509_REVOKED_add1_ext_i2d, X509_get0_extensions, X509_CRL_get0_extensions, X509_REVOKED_get0_extensions - X509 extension decode and encode functions

                        "},{"location":"man3/X509V3_get_d2i/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nvoid *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit,\n                     int *idx);\nint X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value,\n                    int crit, unsigned long flags);\n\nvoid *X509V3_EXT_d2i(X509_EXTENSION *ext);\nX509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);\n\nvoid *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx);\nint X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,\n                      unsigned long flags);\n\nvoid *X509_CRL_get_ext_d2i(const X509_CRL *crl, int nid, int *crit, int *idx);\nint X509_CRL_add1_ext_i2d(X509_CRL *crl, int nid, void *value, int crit,\n                          unsigned long flags);\n\nvoid *X509_REVOKED_get_ext_d2i(const X509_REVOKED *r, int nid, int *crit, int *idx);\nint X509_REVOKED_add1_ext_i2d(X509_REVOKED *r, int nid, void *value, int crit,\n                              unsigned long flags);\n\nconst STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x);\nconst STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl);\nconst STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r);\n
                        "},{"location":"man3/X509V3_get_d2i/#description","title":"DESCRIPTION","text":"

                        X509V3_get_d2i() looks for an extension with OID nid in the extensions x and, if found, decodes it. If idx is NULL then only one occurrence of an extension is permissible, otherwise the first extension after index *idx is returned and *idx updated to the location of the extension. If crit is not NULL then *crit is set to a status value: -2 if the extension occurs multiple times (this is only returned if idx is NULL), -1 if the extension could not be found, 0 if the extension is found and is not critical and 1 if critical. A pointer to an extension specific structure or NULL is returned.

                        X509V3_add1_i2d() adds extension value to STACK *x (allocating a new STACK if necessary) using OID nid and criticality crit according to flags.

                        X509V3_EXT_d2i() attempts to decode the ASN.1 data contained in extension ext and returns a pointer to an extension specific structure or NULL if the extension could not be decoded (invalid syntax or not supported).

                        X509V3_EXT_i2d() encodes the extension specific structure ext_struc with OID ext_nid and criticality crit.

                        X509_get_ext_d2i() and X509_add1_ext_i2d() operate on the extensions of certificate x. They are otherwise identical to X509V3_get_d2i() and X509V3_add1_i2d().

                        X509_CRL_get_ext_d2i() and X509_CRL_add1_ext_i2d() operate on the extensions of CRL crl. They are otherwise identical to X509V3_get_d2i() and X509V3_add1_i2d().

                        X509_REVOKED_get_ext_d2i() and X509_REVOKED_add1_ext_i2d() operate on the extensions of X509_REVOKED structure r (i.e for CRL entry extensions). They are otherwise identical to X509V3_get_d2i() and X509V3_add1_i2d().

                        X509_get0_extensions(), X509_CRL_get0_extensions() and X509_REVOKED_get0_extensions() return a STACK of all the extensions of a certificate, a CRL or a CRL entry respectively.

                        "},{"location":"man3/X509V3_get_d2i/#notes","title":"NOTES","text":"

                        In almost all cases an extension can occur at most once and multiple occurrences is an error. Therefore, the idx parameter is usually NULL.

                        The flags parameter may be one of the following values.

                        X509V3_ADD_DEFAULT appends a new extension only if the extension does not exist. An error is returned if the extension exists.

                        X509V3_ADD_APPEND appends a new extension, ignoring whether the extension exists.

                        X509V3_ADD_REPLACE replaces an existing extension. If the extension does not exist, appends a new extension.

                        X509V3_ADD_REPLACE_EXISTING replaces an existing extension. If the extension does not exist, returns an error.

                        X509V3_ADD_KEEP_EXISTING appends a new extension only if the extension does not exist. An error is not returned if the extension exists.

                        X509V3_ADD_DELETE deletes and frees an existing extension. If the extension does not exist, returns an error. No new extension is added.

                        If X509V3_ADD_SILENT is bitwise ORed with flags: any error returned will not be added to the error queue.

                        The function X509V3_get_d2i() and its variants will return NULL if the extension is not found, occurs multiple times or cannot be decoded. It is possible to determine the precise reason by checking the value of *crit.

                        The function X509V3_add1_i2d() and its variants allocate X509_EXTENSION objects on STACK *x depending on flags. The X509_EXTENSION objects must be explicitly freed using X509_EXTENSION_free().

                        "},{"location":"man3/X509V3_get_d2i/#supported-extensions","title":"SUPPORTED EXTENSIONS","text":"

                        The following sections contain a list of all supported extensions including their name and NID.

                        "},{"location":"man3/X509V3_get_d2i/#pkix-certificate-extensions","title":"PKIX Certificate Extensions","text":"

                        The following certificate extensions are defined in PKIX standards such as RFC5280.

                        Basic Constraints                  NID_basic_constraints\nKey Usage                          NID_key_usage\nExtended Key Usage                 NID_ext_key_usage\n\nSubject Key Identifier             NID_subject_key_identifier\nAuthority Key Identifier           NID_authority_key_identifier\n\nPrivate Key Usage Period           NID_private_key_usage_period\n\nSubject Alternative Name           NID_subject_alt_name\nIssuer Alternative Name            NID_issuer_alt_name\n\nAuthority Information Access       NID_info_access\nSubject Information Access         NID_sinfo_access\n\nName Constraints                   NID_name_constraints\n\nCertificate Policies               NID_certificate_policies\nPolicy Mappings                    NID_policy_mappings\nPolicy Constraints                 NID_policy_constraints\nInhibit Any Policy                 NID_inhibit_any_policy\n\nTLS Feature                        NID_tlsfeature\n
                        "},{"location":"man3/X509V3_get_d2i/#netscape-certificate-extensions","title":"Netscape Certificate Extensions","text":"

                        The following are (largely obsolete) Netscape certificate extensions.

                        Netscape Cert Type                 NID_netscape_cert_type\nNetscape Base Url                  NID_netscape_base_url\nNetscape Revocation Url            NID_netscape_revocation_url\nNetscape CA Revocation Url         NID_netscape_ca_revocation_url\nNetscape Renewal Url               NID_netscape_renewal_url\nNetscape CA Policy Url             NID_netscape_ca_policy_url\nNetscape SSL Server Name           NID_netscape_ssl_server_name\nNetscape Comment                   NID_netscape_comment\n
                        "},{"location":"man3/X509V3_get_d2i/#miscellaneous-certificate-extensions","title":"Miscellaneous Certificate Extensions","text":"
                        Strong Extranet ID                 NID_sxnet\nProxy Certificate Information      NID_proxyCertInfo\n
                        "},{"location":"man3/X509V3_get_d2i/#pkix-crl-extensions","title":"PKIX CRL Extensions","text":"

                        The following are CRL extensions from PKIX standards such as RFC5280.

                        CRL Number                         NID_crl_number\nCRL Distribution Points            NID_crl_distribution_points\nDelta CRL Indicator                NID_delta_crl\nFreshest CRL                       NID_freshest_crl\nInvalidity Date                    NID_invalidity_date\nIssuing Distribution Point         NID_issuing_distribution_point\n

                        The following are CRL entry extensions from PKIX standards such as RFC5280.

                        CRL Reason Code                    NID_crl_reason\nCertificate Issuer                 NID_certificate_issuer\n
                        "},{"location":"man3/X509V3_get_d2i/#ocsp-extensions","title":"OCSP Extensions","text":"
                        OCSP Nonce                         NID_id_pkix_OCSP_Nonce\nOCSP CRL ID                        NID_id_pkix_OCSP_CrlID\nAcceptable OCSP Responses          NID_id_pkix_OCSP_acceptableResponses\nOCSP No Check                      NID_id_pkix_OCSP_noCheck\nOCSP Archive Cutoff                NID_id_pkix_OCSP_archiveCutoff\nOCSP Service Locator               NID_id_pkix_OCSP_serviceLocator\nHold Instruction Code              NID_hold_instruction_code\n
                        "},{"location":"man3/X509V3_get_d2i/#certificate-transparency-extensions","title":"Certificate Transparency Extensions","text":"

                        The following extensions are used by certificate transparency, RFC6962

                        CT Precertificate SCTs             NID_ct_precert_scts\nCT Certificate SCTs                NID_ct_cert_scts\n
                        "},{"location":"man3/X509V3_get_d2i/#return-values","title":"RETURN VALUES","text":"

                        X509V3_get_d2i(), its variants, and X509V3_EXT_d2i() return a pointer to an extension specific structure or NULL if an error occurs.

                        X509V3_add1_i2d() and its variants return 1 if the operation is successful and 0 if it fails due to a non-fatal error (extension not found, already exists, cannot be encoded) or -1 due to a fatal error such as a memory allocation failure.

                        X509V3_EXT_i2d() returns a pointer to an X509_EXTENSION structure or NULL if an error occurs.

                        X509_get0_extensions(), X509_CRL_get0_extensions() and X509_REVOKED_get0_extensions() return a stack of extensions. They return NULL if no extensions are present.

                        "},{"location":"man3/X509V3_get_d2i/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509_verify_cert(3)

                        "},{"location":"man3/X509V3_get_d2i/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509V3_set_ctx/","title":"X509V3_set_ctx","text":""},{"location":"man3/X509V3_set_ctx/#name","title":"NAME","text":"

                        X509V3_set_ctx, X509V3_set_issuer_pkey - X.509 v3 extension generation utilities

                        "},{"location":"man3/X509V3_set_ctx/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nvoid X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,\n                    X509_REQ *req, X509_CRL *crl, int flags);\nint X509V3_set_issuer_pkey(X509V3_CTX *ctx, EVP_PKEY *pkey);\n
                        "},{"location":"man3/X509V3_set_ctx/#description","title":"DESCRIPTION","text":"

                        X509V3_set_ctx() fills in the basic fields of ctx of type X509V3_CTX, providing details potentially needed by functions producing X509 v3 extensions, e.g., to look up values for filling in authority key identifiers. Any of subject, req, or crl may be provided, pointing to a certificate, certification request, or certificate revocation list, respectively. When constructing the subject key identifier of a certificate by computing a hash value of its public key, the public key is taken from subject or req. Similarly, when constructing subject alternative names from any email addresses contained in a subject DN, the subject DN is taken from subject or req. If subject or crl is provided, issuer should point to its issuer, for instance to help generating an authority key identifier extension. Note that if subject is provided, issuer may be the same as subject, which means that subject is self-issued (or even self-signed). flags may be 0 or contain X509V3_CTX_TEST, which means that just the syntax of extension definitions is to be checked without actually producing an extension, or X509V3_CTX_REPLACE, which means that each X.509v3 extension added as defined in some configuration section shall replace any already existing extension with the same OID.

                        X509V3_set_issuer_pkey() explicitly sets the issuer private key of the certificate that has been provided in ctx. This should be done for self-issued certificates (which may be self-signed or not) to provide fallback data for the authority key identifier extension.

                        "},{"location":"man3/X509V3_set_ctx/#return-values","title":"RETURN VALUES","text":"

                        X509V3_set_ctx() and X509V3_set_issuer_pkey() return 1 on success and 0 on error.

                        "},{"location":"man3/X509V3_set_ctx/#see-also","title":"SEE ALSO","text":"

                        X509_add_ext(3)

                        "},{"location":"man3/X509V3_set_ctx/#history","title":"HISTORY","text":"

                        X509V3_set_issuer_pkey() was added in OpenSSL 3.0.

                        CTX_TEST was deprecated in OpenSSL 3.0; use X509V3_CTX_TEST instead.

                        "},{"location":"man3/X509V3_set_ctx/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_ALGOR_dup/","title":"X509_ALGOR_dup","text":""},{"location":"man3/X509_ALGOR_dup/#name","title":"NAME","text":"

                        X509_ALGOR_dup, X509_ALGOR_set0, X509_ALGOR_get0, X509_ALGOR_set_md, X509_ALGOR_cmp, X509_ALGOR_copy - AlgorithmIdentifier functions

                        "},{"location":"man3/X509_ALGOR_dup/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nX509_ALGOR *X509_ALGOR_dup(X509_ALGOR *alg);\nint X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);\nvoid X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,\n                     const void **ppval, const X509_ALGOR *alg);\nvoid X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);\nint X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);\nint X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src);\n
                        "},{"location":"man3/X509_ALGOR_dup/#description","title":"DESCRIPTION","text":"

                        X509_ALGOR_dup() returns a copy of alg.

                        X509_ALGOR_set0() sets the algorithm OID of alg to aobj and the associated parameter type to ptype with value pval. If ptype is V_ASN1_UNDEF the parameter is omitted, otherwise ptype and pval have the same meaning as the type and value parameters to ASN1_TYPE_set(). All the supplied parameters are used internally so must NOT be freed after this call.

                        X509_ALGOR_get0() is the inverse of X509_ALGOR_set0(): it returns the algorithm OID in *paobj and the associated parameter in *pptype and *ppval from the AlgorithmIdentifier alg.

                        X509_ALGOR_set_md() sets the AlgorithmIdentifier alg to appropriate values for the message digest md.

                        X509_ALGOR_cmp() compares a and b and returns 0 if they have identical encodings and nonzero otherwise.

                        X509_ALGOR_copy() copies the source values into the dest structs; making a duplicate of each (and free any thing pointed to from within *dest).

                        "},{"location":"man3/X509_ALGOR_dup/#return-values","title":"RETURN VALUES","text":"

                        X509_ALGOR_dup() returns a valid X509_ALGOR structure or NULL if an error occurred.

                        X509_ALGOR_set0() and X509_ALGOR_copy() return 1 on success or 0 on error.

                        X509_ALGOR_get0() and X509_ALGOR_set_md() return no values.

                        X509_ALGOR_cmp() returns 0 if the two parameters have identical encodings and nonzero otherwise.

                        "},{"location":"man3/X509_ALGOR_dup/#history","title":"HISTORY","text":"

                        The X509_ALGOR_copy() was added in 1.1.1e.

                        "},{"location":"man3/X509_ALGOR_dup/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_ATTRIBUTE/","title":"X509_ATTRIBUTE","text":""},{"location":"man3/X509_ATTRIBUTE/#name","title":"NAME","text":"

                        X509_ATTRIBUTE, X509at_get_attr, X509at_get_attr_count, X509at_get_attr_by_NID, X509at_get_attr_by_OBJ, X509at_delete_attr, X509at_add1_attr, X509at_add1_attr_by_OBJ, X509at_add1_attr_by_NID, X509at_add1_attr_by_txt, X509at_get0_data_by_OBJ, X509_ATTRIBUTE_create, X509_ATTRIBUTE_create_by_NID, X509_ATTRIBUTE_create_by_OBJ, X509_ATTRIBUTE_create_by_txt, X509_ATTRIBUTE_set1_object, X509_ATTRIBUTE_set1_data, X509_ATTRIBUTE_count, X509_ATTRIBUTE_get0_data, X509_ATTRIBUTE_get0_object, X509_ATTRIBUTE_get0_type - X509 attribute functions

                        "},{"location":"man3/X509_ATTRIBUTE/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\ntypedef struct x509_attributes_st X509_ATTRIBUTE;\n\nint X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);\nint X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,\n                           int lastpos);\nint X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,\n                           const ASN1_OBJECT *obj, int lastpos);\nX509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);\nX509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,\n                                           X509_ATTRIBUTE *attr);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE)\n                                                  **x, const ASN1_OBJECT *obj,\n                                                  int type,\n                                                  const unsigned char *bytes,\n                                                  int len);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE)\n                                                  **x, int nid, int type,\n                                                  const unsigned char *bytes,\n                                                  int len);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE)\n                                                  **x, const char *attrname,\n                                                  int type,\n                                                  const unsigned char *bytes,\n                                                  int len);\nvoid *X509at_get0_data_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *x,\n                              const ASN1_OBJECT *obj, int lastpos, int type);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,\n                                             int atrtype, const void *data,\n                                             int len);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,\n                                             const ASN1_OBJECT *obj,\n                                             int atrtype, const void *data,\n                                             int len);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,\n                                             const char *atrname, int type,\n                                             const unsigned char *bytes,\n                                             int len);\nint X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);\nint X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype,\n                             const void *data, int len);\nvoid *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype,\n                               void *data);\nint X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr);\nASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);\nASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);\n
                        "},{"location":"man3/X509_ATTRIBUTE/#description","title":"DESCRIPTION","text":"

                        X509_ATTRIBUTE objects are used by many standards including X509, X509_REQ, PKCS12, PKCS8, PKCS7 and CMS.

                        The X509_ATTRIBUTE object is used to represent the ASN.1 Attribute as defined in RFC 5280, i.e.

                        Attribute ::= SEQUENCE {\n  type             AttributeType,\n  values    SET OF AttributeValue }\n\nAttributeType ::= OBJECT IDENTIFIER\nAttributeValue ::= ANY -- DEFINED BY AttributeType\n

                        For example CMS defines the signing-time attribute as:

                        id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)\n    us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }\n\nSigningTime ::= Time\n\nTime ::= CHOICE {\n  utcTime UTCTime,\n  generalizedTime GeneralizedTime }\n

                        In OpenSSL AttributeType maps to an ASN1_OBJECT object and AttributeValue maps to a list of ASN1_TYPE objects.

                        The following functions are used for X509_ATTRIBUTE objects.

                        X509at_get_attr_by_OBJ() finds the location of the first matching object obj in a list of attributes sk. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to X509at_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the list.

                        X509at_get_attr_by_NID() is similar to X509at_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                        X509at_get_attr() returns the X509_ATTRIBUTE object at index loc in the list of attributes x. loc should be in the range from 0 to X509at_get_attr_count() - 1.

                        X509at_delete_attr() removes the X509_ATTRIBUTE object at index loc in the list of attributes x.

                        X509at_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE object to the list x. Both x and attr must be non NULL or an error will occur. If *x is NULL then a new list is created, otherwise it uses the passed in list. An error will occur if an existing attribute (with the same attribute type) already exists in the attribute list.

                        X509at_add1_attr_by_OBJ() creates a new X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the attribute list x. Both x and attr must be non NULL or an error will occur. If *x is NULL then a new attribute list is created. If obj already exists in the attribute list then an error occurs.

                        X509at_add1_attr_by_NID() is similar to X509at_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                        X509at_add1_attr_by_txt() is similar to X509at_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                        X509_ATTRIBUTE_set1_object() assigns a ASN1_OBJECT obj to the attribute attr. If attr contained an existing ASN1_OBJECT then it is freed. An error occurs if either attr or obj are NULL, or if the passed in obj cannot be duplicated.

                        X509_ATTRIBUTE_set1_data() pushes a new ASN1_TYPE object onto the attr attributes list. The new object is assigned a copy of the data in data of size len. If attrtype has flag MBSTRING_FLAG set then a table lookup using the attr attributes NID is used to set an ASN1_STRING using ASN1_STRING_set_by_NID(), and the passed in data must be in the format required for that object type or an error will occur. If len is not -1 then internally ASN1_STRING_type_new() is used with the passed in attrtype. If attrtype is 0 the call does nothing except return 1.

                        X509_ATTRIBUTE_create() creates a new X509_ATTRIBUTE using the nid to set the ASN1_OBJECT OID and the atrtype and value to set the ASN1_TYPE.

                        X509_ATTRIBUTE_create_by_OBJ() uses X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type atrtype and data data of length len. If the passed in attribute attr OR *attr is NULL then a new X509_ATTRIBUTE will be returned, otherwise the passed in X509_ATTRIBUTE is used. Note that the ASN1_OBJECT obj is pushed onto the attributes existing list of objects, which could be an issue if the attributes was different.

                        X509_ATTRIBUTE_create_by_NID() is similar to X509_ATTRIBUTE_create_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                        X509_ATTRIBUTE_create_by_txt() is similar to X509_ATTRIBUTE_create_by_OBJ() except that it passes a name atrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                        X509_ATTRIBUTE_count() returns the number of ASN1_TYPE objects in an attribute attr.

                        X509_ATTRIBUTE_get0_type() returns the ASN1_TYPE object at index idx in the attribute list attr. idx should be in the range of 0 to X509_ATTRIBUTE_count() - 1 or an error will occur.

                        X509_ATTRIBUTE_get0_data() returns the data of an ASN1_TYPE object at index idx in the attribute attr. data is unused and can be set to NULL. An error will occur if the attribute type atrtype does not match the type of the ASN1_TYPE object at index idx OR if atrtype is either V_ASN1_BOOLEAN or V_ASN1_NULL OR if the idx is not in the range 0 to X509_ATTRIBUTE_count() - 1.

                        X509at_get0_data_by_OBJ() finds the first attribute in an attribute list x that matches the obj starting at index lastpos and returns the data retrieved from the found attributes first ASN1_TYPE object. An error will occur if the attribute type type does not match the type of the ASN1_TYPE object OR if type is either V_ASN1_BOOLEAN or V_ASN1_NULL OR the attribute is not found. If lastpos is less than -1 then an error will occur if there are multiple objects in the list x that match obj. If lastpos is less than -2 then an error will occur if there is more than one ASN1_TYPE object in the found attribute.

                        "},{"location":"man3/X509_ATTRIBUTE/#return-values","title":"RETURN VALUES","text":"

                        X509at_get_attr_count() returns the number of attributes in the list x or -1 if x is NULL.

                        X509at_get_attr_by_OBJ() returns -1 if either the list is empty OR the object is not found, otherwise it returns the location of the object in the list.

                        X509at_get_attr_by_NID() is similar to X509at_get_attr_by_OBJ(), except that it returns -2 if the nid is not known by OpenSSL.

                        X509at_get_attr() returns either an X509_ATTRIBUTE or NULL if there is a error.

                        X509at_delete_attr() returns either the removed X509_ATTRIBUTE or NULL if there is a error.

                        X509_ATTRIBUTE_count() returns -1 on error, otherwise it returns the number of ASN1_TYPE elements.

                        X509_ATTRIBUTE_get0_type() returns NULL on error, otherwise it returns a ASN1_TYPE object.

                        X509_ATTRIBUTE_get0_data() returns NULL if an error occurs, otherwise it returns the data associated with an ASN1_TYPE object.

                        X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() returns 1 on success, or 0 otherwise.

                        X509_ATTRIBUTE_create(), X509_ATTRIBUTE_create_by_OBJ(), X509_ATTRIBUTE_create_by_NID() and X509_ATTRIBUTE_create_by_txt() return either a X509_ATTRIBUTE on success, or NULL if there is a error.

                        X509at_add1_attr(), X509at_add1_attr_by_OBJ(), X509at_add1_attr_by_NID() and X509at_add1_attr_by_txt() return NULL on error, otherwise they return a list of X509_ATTRIBUTE.

                        X509at_get0_data_by_OBJ() returns the data retrieved from the found attributes first ASN1_TYPE object, or NULL if an error occurs.

                        "},{"location":"man3/X509_ATTRIBUTE/#see-also","title":"SEE ALSO","text":"

                        ASN1_TYPE_get(3), ASN1_INTEGER_get(3), ASN1_ENUMERATED_get(3), ASN1_STRING_get0_data(3), ASN1_STRING_length(3), ASN1_STRING_type(3), X509_REQ_get_attr(3), EVP_PKEY_get_attr(3), CMS_signed_get_attr(3), PKCS8_pkey_get0_attrs(3),

                        "},{"location":"man3/X509_ATTRIBUTE/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_CRL_get0_by_serial/","title":"X509_CRL_get0_by_serial","text":""},{"location":"man3/X509_CRL_get0_by_serial/#name","title":"NAME","text":"

                        X509_CRL_get0_by_serial, X509_CRL_get0_by_cert, X509_CRL_get_REVOKED, X509_REVOKED_get0_serialNumber, X509_REVOKED_get0_revocationDate, X509_REVOKED_set_serialNumber, X509_REVOKED_set_revocationDate, X509_CRL_add0_revoked, X509_CRL_sort - CRL revoked entry utility functions

                        "},{"location":"man3/X509_CRL_get0_by_serial/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_CRL_get0_by_serial(X509_CRL *crl,\n                            X509_REVOKED **ret, const ASN1_INTEGER *serial);\nint X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);\n\nSTACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl);\n\nconst ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *r);\nconst ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *r);\n\nint X509_REVOKED_set_serialNumber(X509_REVOKED *r, ASN1_INTEGER *serial);\nint X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);\n\nint X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);\n\nint X509_CRL_sort(X509_CRL *crl);\n
                        "},{"location":"man3/X509_CRL_get0_by_serial/#description","title":"DESCRIPTION","text":"

                        X509_CRL_get0_by_serial() attempts to find a revoked entry in crl for serial number serial. If it is successful, it sets *ret to the internal pointer of the matching entry. As a result, *ret MUST NOT be freed after the call.

                        X509_CRL_get0_by_cert() is similar to X509_get0_by_serial() except it looks for a revoked entry using the serial number of certificate x.

                        X509_CRL_get_REVOKED() returns an internal pointer to a STACK of all revoked entries for crl.

                        X509_REVOKED_get0_serialNumber() returns an internal pointer to the serial number of r.

                        X509_REVOKED_get0_revocationDate() returns an internal pointer to the revocation date of r.

                        X509_REVOKED_set_serialNumber() sets the serial number of r to serial. The supplied serial pointer is not used internally so it should be freed after use.

                        X509_REVOKED_set_revocationDate() sets the revocation date of r to tm. The supplied tm pointer is not used internally so it should be freed after use.

                        X509_CRL_add0_revoked() appends revoked entry rev to CRL crl. The pointer rev is used internally so it MUST NOT be freed after the call: it is freed when the parent CRL is freed.

                        X509_CRL_sort() sorts the revoked entries of crl into ascending serial number order.

                        "},{"location":"man3/X509_CRL_get0_by_serial/#notes","title":"NOTES","text":"

                        Applications can determine the number of revoked entries returned by X509_CRL_get_REVOKED() using sk_X509_REVOKED_num() and examine each one in turn using sk_X509_REVOKED_value().

                        "},{"location":"man3/X509_CRL_get0_by_serial/#return-values","title":"RETURN VALUES","text":"

                        X509_CRL_get0_by_serial() and X509_CRL_get0_by_cert() return 0 for failure, 1 on success except if the revoked entry has the reason removeFromCRL (8), in which case 2 is returned.

                        X509_CRL_get_REVOKED() returns a STACK of revoked entries.

                        X509_REVOKED_get0_serialNumber() returns an ASN1_INTEGER structure.

                        X509_REVOKED_get0_revocationDate() returns an ASN1_TIME structure.

                        X509_REVOKED_set_serialNumber(), X509_REVOKED_set_revocationDate(), X509_CRL_add0_revoked() and X509_CRL_sort() return 1 for success and 0 for failure.

                        "},{"location":"man3/X509_CRL_get0_by_serial/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_CRL_get0_by_serial/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_EXTENSION_set_object/","title":"X509_EXTENSION_set_object","text":""},{"location":"man3/X509_EXTENSION_set_object/#name","title":"NAME","text":"

                        X509_EXTENSION_set_object, X509_EXTENSION_set_critical, X509_EXTENSION_set_data, X509_EXTENSION_create_by_NID, X509_EXTENSION_create_by_OBJ, X509_EXTENSION_get_object, X509_EXTENSION_get_critical, X509_EXTENSION_get_data - extension utility functions

                        "},{"location":"man3/X509_EXTENSION_set_object/#synopsis","title":"SYNOPSIS","text":"
                        int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj);\nint X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);\nint X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);\n\nX509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,\n                                             int nid, int crit,\n                                             ASN1_OCTET_STRING *data);\nX509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,\n                                             const ASN1_OBJECT *obj, int crit,\n                                             ASN1_OCTET_STRING *data);\n\nASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);\nint X509_EXTENSION_get_critical(const X509_EXTENSION *ex);\nASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);\n
                        "},{"location":"man3/X509_EXTENSION_set_object/#description","title":"DESCRIPTION","text":"

                        X509_EXTENSION_set_object() sets the extension type of ex to obj. The obj pointer is duplicated internally so obj should be freed up after use.

                        X509_EXTENSION_set_critical() sets the criticality of ex to crit. If crit is zero the extension in non-critical otherwise it is critical.

                        X509_EXTENSION_set_data() sets the data in extension ex to data. The data pointer is duplicated internally.

                        X509_EXTENSION_create_by_NID() creates an extension of type nid, criticality crit using data data. The created extension is returned and written to *ex reusing or allocating a new extension if necessary so *ex should either be NULL or a valid X509_EXTENSION structure it must not be an uninitialised pointer.

                        X509_EXTENSION_create_by_OBJ() is identical to X509_EXTENSION_create_by_NID() except it creates and extension using obj instead of a NID.

                        X509_EXTENSION_get_object() returns the extension type of ex as an ASN1_OBJECT pointer. The returned pointer is an internal value which must not be freed up.

                        X509_EXTENSION_get_critical() returns the criticality of extension ex it returns 1 for critical and 0 for non-critical.

                        X509_EXTENSION_get_data() returns the data of extension ex. The returned pointer is an internal value which must not be freed up.

                        "},{"location":"man3/X509_EXTENSION_set_object/#notes","title":"NOTES","text":"

                        These functions manipulate the contents of an extension directly. Most applications will want to parse or encode and add an extension: they should use the extension encode and decode functions instead such as X509_add1_ext_i2d() and X509_get_ext_d2i().

                        The data associated with an extension is the extension encoding in an ASN1_OCTET_STRING structure.

                        "},{"location":"man3/X509_EXTENSION_set_object/#return-values","title":"RETURN VALUES","text":"

                        X509_EXTENSION_set_object() X509_EXTENSION_set_critical() and X509_EXTENSION_set_data() return 1 for success and 0 for failure.

                        X509_EXTENSION_create_by_NID() and X509_EXTENSION_create_by_OBJ() return an X509_EXTENSION pointer or NULL if an error occurs.

                        X509_EXTENSION_get_object() returns an ASN1_OBJECT pointer.

                        X509_EXTENSION_get_critical() returns 0 for non-critical and 1 for critical.

                        X509_EXTENSION_get_data() returns an ASN1_OCTET_STRING pointer.

                        "},{"location":"man3/X509_EXTENSION_set_object/#see-also","title":"SEE ALSO","text":"

                        X509V3_get_d2i(3)

                        "},{"location":"man3/X509_EXTENSION_set_object/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_LOOKUP/","title":"X509_LOOKUP","text":""},{"location":"man3/X509_LOOKUP/#name","title":"NAME","text":"

                        X509_LOOKUP, X509_LOOKUP_TYPE, X509_LOOKUP_new, X509_LOOKUP_free, X509_LOOKUP_init, X509_LOOKUP_shutdown, X509_LOOKUP_set_method_data, X509_LOOKUP_get_method_data, X509_LOOKUP_ctrl_ex, X509_LOOKUP_ctrl, X509_LOOKUP_load_file_ex, X509_LOOKUP_load_file, X509_LOOKUP_add_dir, X509_LOOKUP_add_store_ex, X509_LOOKUP_add_store, X509_LOOKUP_load_store_ex, X509_LOOKUP_load_store, X509_LOOKUP_get_store, X509_LOOKUP_by_subject_ex, X509_LOOKUP_by_subject, X509_LOOKUP_by_issuer_serial, X509_LOOKUP_by_fingerprint, X509_LOOKUP_by_alias - OpenSSL certificate lookup mechanisms

                        "},{"location":"man3/X509_LOOKUP/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\ntypedef x509_lookup_st X509_LOOKUP;\n\ntypedef enum X509_LOOKUP_TYPE;\n\nX509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);\nint X509_LOOKUP_init(X509_LOOKUP *ctx);\nint X509_LOOKUP_shutdown(X509_LOOKUP *ctx);\nvoid X509_LOOKUP_free(X509_LOOKUP *ctx);\n\nint X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data);\nvoid *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx);\n\nint X509_LOOKUP_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,\n                        char **ret, OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,\n                     long argl, char **ret);\nint X509_LOOKUP_load_file_ex(X509_LOOKUP *ctx, char *name, long type,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_load_file(X509_LOOKUP *ctx, char *name, long type);\nint X509_LOOKUP_load_file_ex(X509_LOOKUP *ctx, char *name, long type,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_add_dir(X509_LOOKUP *ctx, char *name, long type);\nint X509_LOOKUP_add_store_ex(X509_LOOKUP *ctx, char *uri, OSSL_LIB_CTX *libctx,\n                             const char *propq);\nint X509_LOOKUP_add_store(X509_LOOKUP *ctx, char *uri);\nint X509_LOOKUP_load_store_ex(X509_LOOKUP *ctx, char *uri, OSSL_LIB_CTX *libctx,\n                              const char *propq);\nint X509_LOOKUP_load_store(X509_LOOKUP *ctx, char *uri);\n\nX509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx);\n\nint X509_LOOKUP_by_subject_ex(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                              const X509_NAME *name, X509_OBJECT *ret,\n                              OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                           const X509_NAME *name, X509_OBJECT *ret);\nint X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                                 const X509_NAME *name,\n                                 const ASN1_INTEGER *serial, X509_OBJECT *ret);\nint X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                               const unsigned char *bytes, int len,\n                               X509_OBJECT *ret);\nint X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                         const char *str, int len, X509_OBJECT *ret);\n
                        "},{"location":"man3/X509_LOOKUP/#description","title":"DESCRIPTION","text":"

                        The X509_LOOKUP structure holds the information needed to look up certificates and CRLs according to an associated X509_LOOKUP_METHOD(3). Multiple X509_LOOKUP instances can be added to an X509_STORE(3) to enable lookup in that store.

                        X509_LOOKUP_new() creates a new X509_LOOKUP using the given lookup method. It can also be created by calling X509_STORE_add_lookup(3), which will associate a X509_STORE with the lookup mechanism.

                        X509_LOOKUP_init() initializes the internal state and resources as needed by the given X509_LOOKUP to do its work.

                        X509_LOOKUP_shutdown() tears down the internal state and resources of the given X509_LOOKUP.

                        X509_LOOKUP_free() destructs the given X509_LOOKUP. If the argument is NULL, nothing is done.

                        X509_LOOKUP_set_method_data() and X509_LOOKUP_get_method_data() associates and retrieves a pointer to application data to and from the given X509_LOOKUP, respectively.

                        X509_LOOKUP_ctrl_ex() is used to set or get additional data to or from a X509_LOOKUP structure or its associated X509_LOOKUP_METHOD(3). The arguments of the control command are passed via argc and argl, its return value via *ret. The library context libctx and property query propq are used when fetching algorithms from providers. The meaning of the arguments depends on the cmd number of the control command. In general, this function is not called directly, but wrapped by a macro call, see below. The control _cmd_s known to OpenSSL are discussed in more depth in \"Control Commands\".

                        X509_LOOKUP_ctrl() is similar to X509_LOOKUP_ctrl_ex() but uses NULL for the library context libctx and property query propq.

                        X509_LOOKUP_load_file_ex() passes a filename to be loaded immediately into the associated X509_STORE. The library context libctx and property query propq are used when fetching algorithms from providers. type indicates what type of object is expected. This can only be used with a lookup using the implementation X509_LOOKUP_file(3).

                        X509_LOOKUP_load_file() is similar to X509_LOOKUP_load_file_ex() but uses NULL for the library context libctx and property query propq.

                        X509_LOOKUP_add_dir() passes a directory specification from which certificates and CRLs are loaded on demand into the associated X509_STORE. type indicates what type of object is expected. This can only be used with a lookup using the implementation X509_LOOKUP_hash_dir(3).

                        X509_LOOKUP_add_store_ex() passes a URI for a directory-like structure from which containers with certificates and CRLs are loaded on demand into the associated X509_STORE. The library context libctx and property query propq are used when fetching algorithms from providers.

                        X509_LOOKUP_add_store() is similar to X509_LOOKUP_add_store_ex() but uses NULL for the library context libctx and property query propq.

                        X509_LOOKUP_load_store_ex() passes a URI for a single container from which certificates and CRLs are immediately loaded into the associated X509_STORE. The library context libctx and property query propq are used when fetching algorithms from providers. These functions can only be used with a lookup using the implementation X509_LOOKUP_store(3).

                        X509_LOOKUP_load_store() is similar to X509_LOOKUP_load_store_ex() but uses NULL for the library context libctx and property query propq.

                        X509_LOOKUP_load_file_ex(), X509_LOOKUP_load_file(), X509_LOOKUP_add_dir(), X509_LOOKUP_add_store_ex() X509_LOOKUP_add_store(), X509_LOOKUP_load_store_ex() and X509_LOOKUP_load_store() are implemented as macros that use X509_LOOKUP_ctrl().

                        X509_LOOKUP_by_subject_ex(), X509_LOOKUP_by_subject(), X509_LOOKUP_by_issuer_serial(), X509_LOOKUP_by_fingerprint(), and X509_LOOKUP_by_alias() look up certificates and CRLs in the X509_STORE(3) associated with the X509_LOOKUP using different criteria, where the looked up object is stored in ret. Some of the underlying X509_LOOKUP_METHODs will also cache objects matching the criteria in the associated X509_STORE, which makes it possible to handle cases where the criteria have more than one hit.

                        "},{"location":"man3/X509_LOOKUP/#control-commands","title":"Control Commands","text":"

                        The X509_LOOKUP_METHODs built into OpenSSL recognize the following X509_LOOKUP_ctrl() _cmd_s:

                        • X509_L_FILE_LOAD

                          This is the command that X509_LOOKUP_load_file_ex() and X509_LOOKUP_load_file() use. The filename is passed in argc, and the type in argl.

                        • X509_L_ADD_DIR

                          This is the command that X509_LOOKUP_add_dir() uses. The directory specification is passed in argc, and the type in argl.

                        • X509_L_ADD_STORE

                          This is the command that X509_LOOKUP_add_store_ex() and X509_LOOKUP_add_store() use. The URI is passed in argc.

                        • X509_L_LOAD_STORE

                          This is the command that X509_LOOKUP_load_store_ex() and X509_LOOKUP_load_store() use. The URI is passed in argc.

                        "},{"location":"man3/X509_LOOKUP/#return-values","title":"RETURN VALUES","text":"

                        X509_LOOKUP_new() returns a X509_LOOKUP pointer when successful, or NULL on error.

                        X509_LOOKUP_init() and X509_LOOKUP_shutdown() return 1 on success, or 0 on error.

                        X509_LOOKUP_ctrl() returns -1 if the X509_LOOKUP doesn't have an associated X509_LOOKUP_METHOD, or 1 if the doesn't have a control function. Otherwise, it returns what the control function in the X509_LOOKUP_METHOD returns, which is usually 1 on success and 0 in error.

                        X509_LOOKUP_get_store() returns a X509_STORE pointer if there is one, otherwise NULL.

                        X509_LOOKUP_by_subject_ex(), X509_LOOKUP_by_subject(), X509_LOOKUP_by_issuer_serial(), X509_LOOKUP_by_fingerprint(), and X509_LOOKUP_by_alias() all return 0 if there is no X509_LOOKUP_METHOD or that method doesn't implement the corresponding function. Otherwise, it returns what the corresponding function in the X509_LOOKUP_METHOD returns, which is usually 1 on success and 0 in error.

                        "},{"location":"man3/X509_LOOKUP/#see-also","title":"SEE ALSO","text":"

                        X509_LOOKUP_METHOD(3), X509_STORE(3)

                        "},{"location":"man3/X509_LOOKUP/#history","title":"HISTORY","text":"

                        The functions X509_LOOKUP_by_subject_ex() and X509_LOOKUP_ctrl_ex() were added in OpenSSL 3.0.

                        The macros X509_LOOKUP_load_file_ex(), X509_LOOKUP_load_store_ex() and 509_LOOKUP_add_store_ex() were added in OpenSSL 3.0.

                        "},{"location":"man3/X509_LOOKUP/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_LOOKUP_hash_dir/","title":"X509_LOOKUP_hash_dir","text":""},{"location":"man3/X509_LOOKUP_hash_dir/#name","title":"NAME","text":"

                        X509_LOOKUP_hash_dir, X509_LOOKUP_file, X509_LOOKUP_store, X509_load_cert_file_ex, X509_load_cert_file, X509_load_crl_file, X509_load_cert_crl_file_ex, X509_load_cert_crl_file - Default OpenSSL certificate lookup methods

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\nX509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);\nX509_LOOKUP_METHOD *X509_LOOKUP_file(void);\nX509_LOOKUP_METHOD *X509_LOOKUP_store(void);\n\nint X509_load_cert_file_ex(X509_LOOKUP *ctx, const char *file, int type,\n                           OSSL_LIB_CTX *libctx, const char *propq);\nint X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);\nint X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);\nint X509_load_cert_crl_file_ex(X509_LOOKUP *ctx, const char *file, int type,\n                               OSSL_LIB_CTX *libctx, const char *propq);\nint X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);\n
                        "},{"location":"man3/X509_LOOKUP_hash_dir/#description","title":"DESCRIPTION","text":"

                        X509_LOOKUP_hash_dir and X509_LOOKUP_file are two certificate lookup methods to use with X509_STORE, provided by OpenSSL library.

                        Users of the library typically do not need to create instances of these methods manually, they would be created automatically by X509_STORE_load_locations(3) or SSL_CTX_load_verify_locations(3) functions.

                        Internally loading of certificates and CRLs is implemented via functions X509_load_cert_crl_file, X509_load_cert_file and X509_load_crl_file. These functions support parameter type, which can be one of constants FILETYPE_PEM, FILETYPE_ASN1 and FILETYPE_DEFAULT. They load certificates and/or CRLs from specified file into memory cache of X509_STORE objects which given ctx parameter is associated with.

                        Functions X509_load_cert_file and X509_load_crl_file can load both PEM and DER formats depending of type value. Because DER format cannot contain more than one certificate or CRL object (while PEM can contain several concatenated PEM objects) X509_load_cert_crl_file with FILETYPE_ASN1 is equivalent to X509_load_cert_file.

                        Constant FILETYPE_DEFAULT with NULL filename causes these functions to load default certificate store file (see X509_STORE_set_default_paths(3).

                        Functions return number of objects loaded from file or 0 in case of error.

                        Both methods support adding several certificate locations into one X509_STORE.

                        This page documents certificate store formats used by these methods and caching policy.

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#file-method","title":"File Method","text":"

                        The X509_LOOKUP_file method loads all the certificates or CRLs present in a file into memory at the time the file is added as a lookup source.

                        File format is ASCII text which contains concatenated PEM certificates and CRLs.

                        This method should be used by applications which work with a small set of CAs.

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#hashed-directory-method","title":"Hashed Directory Method","text":"

                        X509_LOOKUP_hash_dir is a more advanced method, which loads certificates and CRLs on demand, and caches them in memory once they are loaded. As of OpenSSL 1.0.0, it also checks for newer CRLs upon each lookup, so that newer CRLs are as soon as they appear in the directory.

                        The directory should contain one certificate or CRL per file in PEM format, with a filename of the form hash.N for a certificate, or hash.rN for a CRL. The hash is the value returned by the X509_NAME_hash_ex(3) function applied to the subject name for certificates or issuer name for CRLs. The hash can also be obtained via the -hash option of the openssl-x509(1) or openssl-crl(1) commands.

                        The .N or .rN suffix is a sequence number that starts at zero, and is incremented consecutively for each certificate or CRL with the same hash value. Gaps in the sequence numbers are not supported, it is assumed that there are no more objects with the same hash beyond the first missing number in the sequence.

                        Sequence numbers make it possible for the directory to contain multiple certificates with same subject name hash value. For example, it is possible to have in the store several certificates with same subject or several CRLs with same issuer (and, for example, different validity period).

                        When checking for new CRLs once one CRL for given hash value is loaded, hash_dir lookup method checks only for certificates with sequence number greater than that of the already cached CRL.

                        Note that the hash algorithm used for subject name hashing changed in OpenSSL 1.0.0, and all certificate stores have to be rehashed when moving from OpenSSL 0.9.8 to 1.0.0.

                        OpenSSL includes a openssl-rehash(1) utility which creates symlinks with hashed names for all files with .pem suffix in a given directory.

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#ossl_store-method","title":"OSSL_STORE Method","text":"

                        X509_LOOKUP_store is a method that allows access to any store of certificates and CRLs through any loader supported by ossl_store(7). It works with the help of URIs, which can be direct references to certificates or CRLs, but can also be references to catalogues of such objects (that behave like directories).

                        This method overlaps the \"File Method\" and \"Hashed Directory Method\" because of the 'file:' scheme loader. It does no caching of its own, but can use a caching ossl_store(7) loader, and therefore depends on the loader's capability.

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#return-values","title":"RETURN VALUES","text":"

                        X509_LOOKUP_hash_dir(), X509_LOOKUP_file() and X509_LOOKUP_store() always return a valid X509_LOOKUP_METHOD structure.

                        X509_load_cert_file(), X509_load_crl_file() and X509_load_cert_crl_file() return the number of loaded objects or 0 on error.

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#see-also","title":"SEE ALSO","text":"

                        PEM_read_PrivateKey(3), X509_STORE_load_locations(3), SSL_CTX_load_verify_locations(3), X509_LOOKUP_meth_new(3), ossl_store(7)

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#history","title":"HISTORY","text":"

                        The functions X509_load_cert_file_ex(), X509_load_cert_crl_file_ex() and X509_LOOKUP_store() were added in OpenSSL 3.0.

                        "},{"location":"man3/X509_LOOKUP_hash_dir/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_LOOKUP_meth_new/","title":"X509_LOOKUP_meth_new","text":""},{"location":"man3/X509_LOOKUP_meth_new/#name","title":"NAME","text":"

                        X509_LOOKUP_METHOD, X509_LOOKUP_meth_new, X509_LOOKUP_meth_free, X509_LOOKUP_meth_set_new_item, X509_LOOKUP_meth_get_new_item, X509_LOOKUP_meth_set_free, X509_LOOKUP_meth_get_free, X509_LOOKUP_meth_set_init, X509_LOOKUP_meth_get_init, X509_LOOKUP_meth_set_shutdown, X509_LOOKUP_meth_get_shutdown, X509_LOOKUP_ctrl_fn, X509_LOOKUP_meth_set_ctrl, X509_LOOKUP_meth_get_ctrl, X509_LOOKUP_get_by_subject_fn, X509_LOOKUP_meth_set_get_by_subject, X509_LOOKUP_meth_get_get_by_subject, X509_LOOKUP_get_by_issuer_serial_fn, X509_LOOKUP_meth_set_get_by_issuer_serial, X509_LOOKUP_meth_get_get_by_issuer_serial, X509_LOOKUP_get_by_fingerprint_fn, X509_LOOKUP_meth_set_get_by_fingerprint, X509_LOOKUP_meth_get_get_by_fingerprint, X509_LOOKUP_get_by_alias_fn, X509_LOOKUP_meth_set_get_by_alias, X509_LOOKUP_meth_get_get_by_alias, X509_OBJECT_set1_X509, X509_OBJECT_set1_X509_CRL - Routines to build up X509_LOOKUP methods

                        "},{"location":"man3/X509_LOOKUP_meth_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\ntypedef x509_lookup_method_st X509_LOOKUP_METHOD;\n\nX509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name);\nvoid X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method);\n\nint X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method,\n                                  int (*new_item) (X509_LOOKUP *ctx));\nint (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\nint X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method,\n                              void (*free) (X509_LOOKUP *ctx));\nvoid (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\nint X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method,\n                              int (*init) (X509_LOOKUP *ctx));\nint (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\nint X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method,\n                                  int (*shutdown) (X509_LOOKUP *ctx));\nint (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\ntypedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc,\n                                   long argl, char **ret);\nint X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_ctrl_fn ctrl_fn);\nX509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx,\n                                             X509_LOOKUP_TYPE type,\n                                             const X509_NAME *name,\n                                             X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_get_by_subject_fn fn);\nX509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject(\n    const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx,\n                                                   X509_LOOKUP_TYPE type,\n                                                   const X509_NAME *name,\n                                                   const ASN1_INTEGER *serial,\n                                                   X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_issuer_serial(\n    X509_LOOKUP_METHOD *method, X509_LOOKUP_get_by_issuer_serial_fn fn);\nX509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial(\n    const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx,\n                                                 X509_LOOKUP_TYPE type,\n                                                 const unsigned char* bytes,\n                                                 int len,\n                                                 X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_get_by_fingerprint_fn fn);\nX509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint(\n    const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx,\n                                           X509_LOOKUP_TYPE type,\n                                           const char *str,\n                                           int len,\n                                           X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_get_by_alias_fn fn);\nX509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias(\n    const X509_LOOKUP_METHOD *method);\n\nint X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj);\nint X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj);\n
                        "},{"location":"man3/X509_LOOKUP_meth_new/#description","title":"DESCRIPTION","text":"

                        The X509_LOOKUP_METHOD type is a structure used for the implementation of new X509_LOOKUP types. It provides a set of functions used by OpenSSL for the implementation of various X509 and X509_CRL lookup capabilities. One instance of an X509_LOOKUP_METHOD can be associated to many instantiations of an X509_LOOKUP structure.

                        X509_LOOKUP_meth_new() creates a new X509_LOOKUP_METHOD structure. It should be given a human-readable string containing a brief description of the lookup method.

                        X509_LOOKUP_meth_free() destroys a X509_LOOKUP_METHOD structure. If the argument is NULL, nothing is done.

                        X509_LOOKUP_get_new_item() and X509_LOOKUP_set_new_item() get and set the function that is called when an X509_LOOKUP object is created with X509_LOOKUP_new(). If an X509_LOOKUP_METHOD requires any per-X509_LOOKUP specific data, the supplied new_item function should allocate this data and invoke X509_LOOKUP_set_method_data(3).

                        X509_LOOKUP_get_free() and X509_LOOKUP_set_free() get and set the function that is used to free any method data that was allocated and set from within new_item function.

                        X509_LOOKUP_meth_get_init() and X509_LOOKUP_meth_set_init() get and set the function that is used to initialize the method data that was set with X509_LOOKUP_set_method_data(3) as part of the new_item routine.

                        X509_LOOKUP_meth_get_shutdown() and X509_LOOKUP_meth_set_shutdown() get and set the function that is used to shut down the method data whose state was previously initialized in the init function.

                        X509_LOOKUP_meth_get_ctrl() and X509_LOOKUP_meth_set_ctrl() get and set a function to be used to handle arbitrary control commands issued by X509_LOOKUP_ctrl(). The control function is given the X509_LOOKUP ctx, along with the arguments passed by X509_LOOKUP_ctrl. cmd is an arbitrary integer that defines some operation. argc is a pointer to an array of characters. argl is an integer. ret, if set, points to a location where any return data should be written to. How argc and argl are used depends entirely on the control function.

                        X509_LOOKUP_set_get_by_subject(), X509_LOOKUP_set_get_by_issuer_serial(), X509_LOOKUP_set_get_by_fingerprint(), X509_LOOKUP_set_get_by_alias() set the functions used to retrieve an X509 or X509_CRL object by the object's subject, issuer, fingerprint, and alias respectively. These functions are given the X509_LOOKUP context, the type of the X509_OBJECT being requested, parameters related to the lookup, and an X509_OBJECT that will receive the requested object.

                        Implementations must add objects they find to the X509_STORE object using X509_STORE_add_cert() or X509_STORE_add_crl(). This increments its reference count. However, the X509_STORE_CTX_get_by_subject() function also increases the reference count which leads to one too many references being held. Therefore, applications should additionally call X509_free() or X509_CRL_free() to decrement the reference count again.

                        Implementations should also use either X509_OBJECT_set1_X509() or X509_OBJECT_set1_X509_CRL() to set the result. Note that this also increments the result's reference count.

                        Any method data that was created as a result of the new_item function set by X509_LOOKUP_meth_set_new_item() can be accessed with X509_LOOKUP_get_method_data(3). The X509_STORE object that owns the X509_LOOKUP may be accessed with X509_LOOKUP_get_store(3). Successful lookups should return 1, and unsuccessful lookups should return 0.

                        X509_LOOKUP_get_get_by_subject(), X509_LOOKUP_get_get_by_issuer_serial(), X509_LOOKUP_get_get_by_fingerprint(), X509_LOOKUP_get_get_by_alias() retrieve the function set by the corresponding setter.

                        "},{"location":"man3/X509_LOOKUP_meth_new/#return-values","title":"RETURN VALUES","text":"

                        The X509_LOOKUP_meth_set functions return 1 on success or 0 on error.

                        The X509_LOOKUP_meth_get functions return the corresponding function pointers.

                        "},{"location":"man3/X509_LOOKUP_meth_new/#see-also","title":"SEE ALSO","text":"

                        X509_STORE_new(3), SSL_CTX_set_cert_store(3)

                        "},{"location":"man3/X509_LOOKUP_meth_new/#history","title":"HISTORY","text":"

                        The functions described here were added in OpenSSL 1.1.0i.

                        "},{"location":"man3/X509_LOOKUP_meth_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_NAME_ENTRY_get_object/","title":"X509_NAME_ENTRY_get_object","text":""},{"location":"man3/X509_NAME_ENTRY_get_object/#name","title":"NAME","text":"

                        X509_NAME_ENTRY_get_object, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY_set_object, X509_NAME_ENTRY_set_data, X509_NAME_ENTRY_create_by_txt, X509_NAME_ENTRY_create_by_NID, X509_NAME_ENTRY_create_by_OBJ - X509_NAME_ENTRY utility functions

                        "},{"location":"man3/X509_NAME_ENTRY_get_object/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne);\nASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);\n\nint X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj);\nint X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,\n                             const unsigned char *bytes, int len);\n\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field,\n                                               int type, const unsigned char *bytes,\n                                               int len);\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,\n                                               int type, const unsigned char *bytes,\n                                               int len);\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,\n                                               const ASN1_OBJECT *obj, int type,\n                                               const unsigned char *bytes, int len);\n
                        "},{"location":"man3/X509_NAME_ENTRY_get_object/#description","title":"DESCRIPTION","text":"

                        X509_NAME_ENTRY_get_object() retrieves the field name of ne in and ASN1_OBJECT structure.

                        X509_NAME_ENTRY_get_data() retrieves the field value of ne in and ASN1_STRING structure.

                        X509_NAME_ENTRY_set_object() sets the field name of ne to obj.

                        X509_NAME_ENTRY_set_data() sets the field value of ne to string type type and value determined by bytes and len.

                        X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_create_by_OBJ() create and return an X509_NAME_ENTRY structure.

                        "},{"location":"man3/X509_NAME_ENTRY_get_object/#notes","title":"NOTES","text":"

                        X509_NAME_ENTRY_get_object() and X509_NAME_ENTRY_get_data() can be used to examine an X509_NAME_ENTRY function as returned by X509_NAME_get_entry() for example.

                        X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_OBJ(), X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_set_data() are seldom used in practice because X509_NAME_ENTRY structures are almost always part of X509_NAME structures and the corresponding X509_NAME functions are typically used to create and add new entries in a single operation.

                        The arguments of these functions support similar options to the similarly named ones of the corresponding X509_NAME functions such as X509_NAME_add_entry_by_txt(). So for example type can be set to MBSTRING_ASC but in the case of X509_set_data() the field name must be set first so the relevant field information can be looked up internally.

                        "},{"location":"man3/X509_NAME_ENTRY_get_object/#return-values","title":"RETURN VALUES","text":"

                        X509_NAME_ENTRY_get_object() returns a valid ASN1_OBJECT structure if it is set or NULL if an error occurred.

                        X509_NAME_ENTRY_get_data() returns a valid ASN1_STRING structure if it is set or NULL if an error occurred.

                        X509_NAME_ENTRY_set_object() and X509_NAME_ENTRY_set_data() return 1 on success or 0 on error.

                        X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_create_by_OBJ() return a valid X509_NAME_ENTRY on success or NULL if an error occurred.

                        "},{"location":"man3/X509_NAME_ENTRY_get_object/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3), d2i_X509_NAME(3), OBJ_nid2obj(3)

                        "},{"location":"man3/X509_NAME_ENTRY_get_object/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_NAME_add_entry_by_txt/","title":"X509_NAME_add_entry_by_txt","text":""},{"location":"man3/X509_NAME_add_entry_by_txt/#name","title":"NAME","text":"

                        X509_NAME_add_entry_by_txt, X509_NAME_add_entry_by_OBJ, X509_NAME_add_entry_by_NID, X509_NAME_add_entry, X509_NAME_delete_entry - X509_NAME modification functions

                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,\n                               const unsigned char *bytes, int len, int loc, int set);\n\nint X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type,\n                               const unsigned char *bytes, int len, int loc, int set);\n\nint X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,\n                               const unsigned char *bytes, int len, int loc, int set);\n\nint X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, int loc, int set);\n\nX509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);\n
                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#description","title":"DESCRIPTION","text":"

                        X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ() and X509_NAME_add_entry_by_NID() add a field whose name is defined by a string field, an object obj or a NID nid respectively. The field value to be added is in bytes of length len. If len is -1 then the field length is calculated internally using strlen(bytes).

                        The type of field is determined by type which can either be a definition of the type of bytes (such as MBSTRING_ASC) or a standard ASN1 type (such as V_ASN1_IA5STRING). The new entry is added to a position determined by loc and set.

                        X509_NAME_add_entry() adds a copy of X509_NAME_ENTRY structure ne to name. The new entry is added to a position determined by loc and set. Since a copy of ne is added ne must be freed up after the call.

                        X509_NAME_delete_entry() deletes an entry from name at position loc. The deleted entry is returned and must be freed up.

                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#notes","title":"NOTES","text":"

                        The use of string types such as MBSTRING_ASC or MBSTRING_UTF8 is strongly recommended for the type parameter. This allows the internal code to correctly determine the type of the field and to apply length checks according to the relevant standards. This is done using ASN1_STRING_set_by_NID().

                        If instead an ASN1 type is used no checks are performed and the supplied data in bytes is used directly.

                        In X509_NAME_add_entry_by_txt() the field string represents the field name using OBJ_txt2obj(field, 0).

                        The loc and set parameters determine where a new entry should be added. For almost all applications loc can be set to -1 and set to 0. This adds a new entry to the end of name as a single valued RelativeDistinguishedName (RDN).

                        loc actually determines the index where the new entry is inserted: if it is -1 it is appended.

                        set determines how the new type is added. If it is zero a new RDN is created.

                        If set is -1 or 1 it is added as a new set member to the previous or next RDN structure, respectively. This will then become part of a multi-valued RDN (containing a set of AVAs). Since multi-valued RDNs are very rarely used set typically will be zero.

                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#return-values","title":"RETURN VALUES","text":"

                        X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ(), X509_NAME_add_entry_by_NID() and X509_NAME_add_entry() return 1 for success of 0 if an error occurred.

                        X509_NAME_delete_entry() returns either the deleted X509_NAME_ENTRY structure or NULL if an error occurred.

                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#examples","title":"EXAMPLES","text":"

                        Create an X509_NAME structure:

                        \"C=UK, O=Disorganized Organization, CN=Joe Bloggs\"

                        X509_NAME *nm;\n\nnm = X509_NAME_new();\nif (nm == NULL)\n    /* Some error */\nif (!X509_NAME_add_entry_by_txt(nm, \"C\", MBSTRING_ASC,\n                                \"UK\", -1, -1, 0))\n    /* Error */\nif (!X509_NAME_add_entry_by_txt(nm, \"O\", MBSTRING_ASC,\n                                \"Disorganized Organization\", -1, -1, 0))\n    /* Error */\nif (!X509_NAME_add_entry_by_txt(nm, \"CN\", MBSTRING_ASC,\n                                \"Joe Bloggs\", -1, -1, 0))\n    /* Error */\n
                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#bugs","title":"BUGS","text":"

                        type can still be set to V_ASN1_APP_CHOOSE to use a different algorithm to determine field types. Since this form does not understand multicharacter types, performs no length checks and can result in invalid field types its use is strongly discouraged.

                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3), d2i_X509_NAME(3)

                        "},{"location":"man3/X509_NAME_add_entry_by_txt/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_NAME_get0_der/","title":"X509_NAME_get0_der","text":""},{"location":"man3/X509_NAME_get0_der/#name","title":"NAME","text":"

                        X509_NAME_get0_der - get X509_NAME DER encoding

                        "},{"location":"man3/X509_NAME_get0_der/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_NAME_get0_der(const X509_NAME *nm, const unsigned char **pder,\n                       size_t *pderlen);\n
                        "},{"location":"man3/X509_NAME_get0_der/#description","title":"DESCRIPTION","text":"

                        The function X509_NAME_get0_der() returns an internal pointer to the encoding of an X509_NAME structure in *pder and consisting of *pderlen bytes. It is useful for applications that wish to examine the encoding of an X509_NAME structure without copying it.

                        "},{"location":"man3/X509_NAME_get0_der/#return-values","title":"RETURN VALUES","text":"

                        The function X509_NAME_get0_der() returns 1 for success and 0 if an error occurred.

                        "},{"location":"man3/X509_NAME_get0_der/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3)

                        "},{"location":"man3/X509_NAME_get0_der/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_NAME_get_index_by_NID/","title":"X509_NAME_get_index_by_NID","text":""},{"location":"man3/X509_NAME_get_index_by_NID/#name","title":"NAME","text":"

                        X509_NAME_get_index_by_NID, X509_NAME_get_index_by_OBJ, X509_NAME_get_entry, X509_NAME_entry_count, X509_NAME_get_text_by_NID, X509_NAME_get_text_by_OBJ - X509_NAME lookup and enumeration functions

                        "},{"location":"man3/X509_NAME_get_index_by_NID/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos);\nint X509_NAME_get_index_by_OBJ(const X509_NAME *name,\n                               const ASN1_OBJECT *obj, int lastpos);\n\nint X509_NAME_entry_count(const X509_NAME *name);\nX509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc);\n\nint X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,\n                              char *buf, int len);\nint X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,\n                              char *buf, int len);\n
                        "},{"location":"man3/X509_NAME_get_index_by_NID/#description","title":"DESCRIPTION","text":"

                        These functions allow an X509_NAME structure to be examined. The X509_NAME structure is the same as the Name type defined in RFC2459 (and elsewhere) and used for example in certificate subject and issuer names.

                        X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() retrieve the next index matching nid or obj after lastpos. lastpos should initially be set to -1. If there are no more entries -1 is returned. If nid is invalid (doesn't correspond to a valid OID) then -2 is returned.

                        X509_NAME_entry_count() returns the total number of entries in name.

                        X509_NAME_get_entry() retrieves the X509_NAME_ENTRY from name corresponding to index loc. Acceptable values for loc run from 0 to (X509_NAME_entry_count(name) - 1). The value returned is an internal pointer which must not be freed.

                        X509_NAME_get_text_by_NID(), X509_NAME_get_text_by_OBJ() retrieve the \"text\" from the first entry in name which matches nid or obj, if no such entry exists -1 is returned. At most len bytes will be written and the text written to buf will be null terminated. The length of the output string written is returned excluding the terminating null. If buf is then the amount of space needed in buf (excluding the final null) is returned."},{"location":"man3/X509_NAME_get_index_by_NID/#notes","title":"NOTES","text":"

                        X509_NAME_get_text_by_NID() and X509_NAME_get_text_by_OBJ() should be considered deprecated because they have various limitations which make them of minimal use in practice. They can only find the first matching entry and will copy the contents of the field verbatim: this can be highly confusing if the target is a multicharacter string type like a BMPString or a UTF8String.

                        For a more general solution X509_NAME_get_index_by_NID() or X509_NAME_get_index_by_OBJ() should be used followed by X509_NAME_get_entry() on any matching indices and then the various X509_NAME_ENTRY utility functions on the result.

                        The list of all relevant NID_* and OBJ_* codes can be found in the source code header files <openssl/obj_mac.h> and/or <openssl/objects.h>.

                        Applications which could pass invalid NIDs to X509_NAME_get_index_by_NID() should check for the return value of -2. Alternatively the NID validity can be determined first by checking OBJ_nid2obj(nid) is not NULL.

                        "},{"location":"man3/X509_NAME_get_index_by_NID/#return-values","title":"RETURN VALUES","text":"

                        X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() return the index of the next matching entry or -1 if not found. X509_NAME_get_index_by_NID() can also return -2 if the supplied NID is invalid.

                        X509_NAME_entry_count() returns the total number of entries, and 0 for failure.

                        X509_NAME_get_entry() returns an X509_NAME pointer to the requested entry or NULL if the index is invalid.

                        "},{"location":"man3/X509_NAME_get_index_by_NID/#examples","title":"EXAMPLES","text":"

                        Process all entries:

                        int i;\nX509_NAME_ENTRY *e;\n\nfor (i = 0; i < X509_NAME_entry_count(nm); i++) {\n    e = X509_NAME_get_entry(nm, i);\n    /* Do something with e */\n}\n

                        Process all commonName entries:

                        int lastpos = -1;\nX509_NAME_ENTRY *e;\n\nfor (;;) {\n    lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos);\n    if (lastpos == -1)\n        break;\n    e = X509_NAME_get_entry(nm, lastpos);\n    /* Do something with e */\n}\n
                        "},{"location":"man3/X509_NAME_get_index_by_NID/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3), d2i_X509_NAME(3)

                        "},{"location":"man3/X509_NAME_get_index_by_NID/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_NAME_print_ex/","title":"X509_NAME_print_ex","text":""},{"location":"man3/X509_NAME_print_ex/#name","title":"NAME","text":"

                        X509_NAME_print_ex, X509_NAME_print_ex_fp, X509_NAME_print, X509_NAME_oneline - X509_NAME printing routines

                        "},{"location":"man3/X509_NAME_print_ex/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_NAME_print_ex(BIO *out, const X509_NAME *nm,\n                       int indent, unsigned long flags);\nint X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm,\n                          int indent, unsigned long flags);\nchar *X509_NAME_oneline(const X509_NAME *a, char *buf, int size);\nint X509_NAME_print(BIO *bp, const X509_NAME *name, int obase);\n
                        "},{"location":"man3/X509_NAME_print_ex/#description","title":"DESCRIPTION","text":"

                        X509_NAME_print_ex() prints a human readable version of nm to BIO out. Each line (for multiline formats) is indented by indent spaces. The output format can be extensively customised by use of the flags parameter.

                        X509_NAME_print_ex_fp() is identical to X509_NAME_print_ex() except the output is written to FILE pointer fp.

                        X509_NAME_oneline() prints an ASCII version of a to buf. This supports multi-valued RDNs and escapes / and + characters in values. If buf is NULL then a buffer is dynamically allocated and returned, and size is ignored. Otherwise, at most size bytes will be written, including the ending '\\0', and buf is returned.

                        X509_NAME_print() prints out name to bp indenting each line by obase characters. Multiple lines are used if the output (including indent) exceeds 80 characters.

                        "},{"location":"man3/X509_NAME_print_ex/#notes","title":"NOTES","text":"

                        The functions X509_NAME_oneline() and X509_NAME_print() produce a non standard output form, they don't handle multi-character fields and have various quirks and inconsistencies. Their use is strongly discouraged in new applications and they could be deprecated in a future release.

                        Although there are a large number of possible flags for most purposes XN_FLAG_ONELINE, XN_FLAG_MULTILINE or XN_FLAG_RFC2253 will suffice. As noted on the ASN1_STRING_print_ex(3) manual page for UTF8 terminals the ASN1_STRFLGS_ESC_MSB should be unset: so for example XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB would be used.

                        The complete set of the flags supported by X509_NAME_print_ex() is listed below.

                        Several options can be ored together.

                        The options XN_FLAG_SEP_COMMA_PLUS, XN_FLAG_SEP_CPLUS_SPC, XN_FLAG_SEP_SPLUS_SPC and XN_FLAG_SEP_MULTILINE determine the field separators to use. Two distinct separators are used between distinct RelativeDistinguishedName components and separate values in the same RDN for a multi-valued RDN. Multi-valued RDNs are currently very rare so the second separator will hardly ever be used.

                        XN_FLAG_SEP_COMMA_PLUS uses comma and plus as separators. XN_FLAG_SEP_CPLUS_SPC uses comma and plus with spaces: this is more readable that plain comma and plus. XN_FLAG_SEP_SPLUS_SPC uses spaced semicolon and plus. XN_FLAG_SEP_MULTILINE uses spaced newline and plus respectively.

                        If XN_FLAG_DN_REV is set the whole DN is printed in reversed order.

                        The fields XN_FLAG_FN_SN, XN_FLAG_FN_LN, XN_FLAG_FN_OID, XN_FLAG_FN_NONE determine how a field name is displayed. It will use the short name (e.g. CN) the long name (e.g. commonName) always use OID numerical form (normally OIDs are only used if the field name is not recognised) and no field name respectively.

                        If XN_FLAG_SPC_EQ is set then spaces will be placed around the '=' character separating field names and values.

                        If XN_FLAG_DUMP_UNKNOWN_FIELDS is set then the encoding of unknown fields is printed instead of the values.

                        If XN_FLAG_FN_ALIGN is set then field names are padded to 20 characters: this is only of use for multiline format.

                        Additionally all the options supported by ASN1_STRING_print_ex() can be used to control how each field value is displayed.

                        In addition a number options can be set for commonly used formats.

                        XN_FLAG_RFC2253 sets options which produce an output compatible with RFC2253. It is equivalent to: ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS

                        XN_FLAG_ONELINE is a more readable one line format which is the same as: ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN

                        XN_FLAG_MULTILINE is a multiline format which is the same as: ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN

                        XN_FLAG_COMPAT uses a format identical to X509_NAME_print(): in fact it calls X509_NAME_print() internally.

                        "},{"location":"man3/X509_NAME_print_ex/#return-values","title":"RETURN VALUES","text":"

                        X509_NAME_oneline() returns a valid string on success or NULL on error.

                        X509_NAME_print() returns 1 on success or 0 on error.

                        X509_NAME_print_ex() and X509_NAME_print_ex_fp() return 1 on success or 0 on error if the XN_FLAG_COMPAT is set, which is the same as X509_NAME_print(). Otherwise, it returns -1 on error or other values on success.

                        "},{"location":"man3/X509_NAME_print_ex/#see-also","title":"SEE ALSO","text":"

                        ASN1_STRING_print_ex(3)

                        "},{"location":"man3/X509_NAME_print_ex/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_PUBKEY_new/","title":"X509_PUBKEY_new","text":""},{"location":"man3/X509_PUBKEY_new/#name","title":"NAME","text":"

                        X509_PUBKEY_new_ex, X509_PUBKEY_new, X509_PUBKEY_free, X509_PUBKEY_dup, X509_PUBKEY_set, X509_PUBKEY_get0, X509_PUBKEY_get, d2i_PUBKEY_ex, d2i_PUBKEY, i2d_PUBKEY, d2i_PUBKEY_bio, d2i_PUBKEY_fp, i2d_PUBKEY_fp, i2d_PUBKEY_bio, X509_PUBKEY_set0_param, X509_PUBKEY_get0_param, X509_PUBKEY_eq - SubjectPublicKeyInfo public key functions

                        "},{"location":"man3/X509_PUBKEY_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nX509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nX509_PUBKEY *X509_PUBKEY_new(void);\nvoid X509_PUBKEY_free(X509_PUBKEY *a);\nX509_PUBKEY *X509_PUBKEY_dup(const X509_PUBKEY *a);\n\nint X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);\nEVP_PKEY *X509_PUBKEY_get0(const X509_PUBKEY *key);\nEVP_PKEY *X509_PUBKEY_get(const X509_PUBKEY *key);\n\nEVP_PKEY *d2i_PUBKEY_ex(EVP_PKEY **a, const unsigned char **pp, long length,\n                        OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length);\nint i2d_PUBKEY(const EVP_PKEY *a, unsigned char **pp);\n\nEVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);\nEVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);\n\nint i2d_PUBKEY_fp(const FILE *fp, EVP_PKEY *pkey);\nint i2d_PUBKEY_bio(BIO *bp, const EVP_PKEY *pkey);\n\nint X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,\n                           int ptype, void *pval,\n                           unsigned char *penc, int penclen);\nint X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,\n                           const unsigned char **pk, int *ppklen,\n                           X509_ALGOR **pa, const X509_PUBKEY *pub);\nint X509_PUBKEY_eq(X509_PUBKEY *a, X509_PUBKEY *b);\n
                        "},{"location":"man3/X509_PUBKEY_new/#description","title":"DESCRIPTION","text":"

                        The X509_PUBKEY structure represents the ASN.1 SubjectPublicKeyInfo structure defined in RFC5280 and used in certificates and certificate requests.

                        X509_PUBKEY_new_ex() allocates and initializes an X509_PUBKEY structure associated with the given OSSL_LIB_CTX in the libctx parameter. Any algorithm fetches associated with using the X509_PUBKEY object will use the property query string propq. See \"ALGORITHM FETCHING\" in crypto(7) for further information about algorithm fetching.

                        X509_PUBKEY_new() is the same as X509_PUBKEY_new_ex() except that the default (NULL) OSSL_LIB_CTX and a NULL property query string are used.

                        X509_PUBKEY_dup() creates a duplicate copy of the X509_PUBKEY object specified by a.

                        X509_PUBKEY_free() frees up X509_PUBKEY structure a. If a is NULL nothing is done.

                        X509_PUBKEY_set() sets the public key in *x to the public key contained in the EVP_PKEY structure pkey. If *x is not NULL any existing public key structure will be freed.

                        X509_PUBKEY_get0() returns the public key contained in key. The returned value is an internal pointer which MUST NOT be freed after use.

                        X509_PUBKEY_get() is similar to X509_PUBKEY_get0() except the reference count on the returned key is incremented so it MUST be freed using EVP_PKEY_free() after use.

                        d2i_PUBKEY_ex() decodes an EVP_PKEY structure using SubjectPublicKeyInfo format. Some public key decoding implementations may use cryptographic algorithms. In this case the supplied library context libctx and property query string propq are used. d2i_PUBKEY() does the same as d2i_PUBKEY_ex() except that the default library context and property query string are used.

                        i2d_PUBKEY() encodes an EVP_PKEY structure using SubjectPublicKeyInfo format.

                        d2i_PUBKEY_bio(), d2i_PUBKEY_fp(), i2d_PUBKEY_bio() and i2d_PUBKEY_fp() are similar to d2i_PUBKEY() and i2d_PUBKEY() except they decode or encode using a BIO or FILE pointer.

                        X509_PUBKEY_set0_param() sets the public key parameters of pub. The OID associated with the algorithm is set to aobj. The type of the algorithm parameters is set to type using the structure pval. The encoding of the public key itself is set to the penclen bytes contained in buffer penc. On success ownership of all the supplied parameters is passed to pub so they must not be freed after the call.

                        X509_PUBKEY_get0_param() retrieves the public key parameters from pub, *ppkalg is set to the associated OID and the encoding consists of *ppklen bytes at *pk, *pa is set to the associated AlgorithmIdentifier for the public key. If the value of any of these parameters is not required it can be set to NULL. All of the retrieved pointers are internal and must not be freed after the call.

                        X509_PUBKEY_eq() compares two X509_PUBKEY values.

                        "},{"location":"man3/X509_PUBKEY_new/#notes","title":"NOTES","text":"

                        The X509_PUBKEY functions can be used to encode and decode public keys in a standard format.

                        In many cases applications will not call the X509_PUBKEY functions directly: they will instead call wrapper functions such as X509_get0_pubkey().

                        "},{"location":"man3/X509_PUBKEY_new/#return-values","title":"RETURN VALUES","text":"

                        If the allocation fails, X509_PUBKEY_new() and X509_PUBKEY_dup() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

                        X509_PUBKEY_free() does not return a value.

                        X509_PUBKEY_get0() and X509_PUBKEY_get() return a pointer to an EVP_PKEY structure or NULL if an error occurs.

                        X509_PUBKEY_set(), X509_PUBKEY_set0_param() and X509_PUBKEY_get0_param() return 1 for success and 0 if an error occurred.

                        X509_PUBKEY_eq() returns 1 for equal, 0 for different, and < 0 on error.

                        "},{"location":"man3/X509_PUBKEY_new/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_get_pubkey(3),

                        "},{"location":"man3/X509_PUBKEY_new/#history","title":"HISTORY","text":"

                        The X509_PUBKEY_new_ex() and X509_PUBKEY_eq() functions were added in OpenSSL 3.0.

                        "},{"location":"man3/X509_PUBKEY_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_REQ_get_attr/","title":"X509_REQ_get_attr","text":""},{"location":"man3/X509_REQ_get_attr/#name","title":"NAME","text":"

                        X509_REQ_get_attr_count, X509_REQ_get_attr_by_NID, X509_REQ_get_attr_by_OBJ, X509_REQ_get_attr, X509_REQ_delete_attr, X509_REQ_add1_attr, X509_REQ_add1_attr_by_OBJ, X509_REQ_add1_attr_by_NID, X509_REQ_add1_attr_by_txt - X509_ATTRIBUTE support for signed certificate requests

                        "},{"location":"man3/X509_REQ_get_attr/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_REQ_get_attr_count(const X509_REQ *req);\nint X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos);\nint X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj,\n                             int lastpos);\nX509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);\nX509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);\nint X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);\nint X509_REQ_add1_attr_by_OBJ(X509_REQ *req,\n                              const ASN1_OBJECT *obj, int type,\n                              const unsigned char *bytes, int len);\nint X509_REQ_add1_attr_by_NID(X509_REQ *req,\n                              int nid, int type,\n                              const unsigned char *bytes, int len);\nint X509_REQ_add1_attr_by_txt(X509_REQ *req,\n                              const char *attrname, int type,\n                              const unsigned char *bytes, int len);\n
                        "},{"location":"man3/X509_REQ_get_attr/#description","title":"DESCRIPTION","text":"

                        X509_REQ_get_attr_by_OBJ() finds the location of the first matching object obj in the req attribute list. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to X509_REQ_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the attribute list.

                        X509_REQ_get_attr_by_NID() is similar to X509_REQ_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                        X509_REQ_get_attr() returns the X509_ATTRIBUTE object at index loc in the req attribute list. loc should be in the range from 0 to X509_REQ_get_attr_count() - 1.

                        X509_REQ_delete_attr() removes the X509_ATTRIBUTE object at index loc in the req objects list of attributes. An error occurs if req is NULL.

                        X509_REQ_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE __attr> to the req object's attribute list. An error will occur if either the attribute list is NULL or the attribute already exists.

                        X509_REQ_add1_attr_by_OBJ() creates a new X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the req object's attribute list. req must be non NULL or an error will occur. If obj already exists in the attribute list then an error occurs.

                        X509_REQ_add1_attr_by_NID() is similar to X509_REQ_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                        X509_REQ_add1_attr_by_txt() is similar to X509_REQ_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                        Refer to X509_ATTRIBUTE(3) for information related to attributes.

                        "},{"location":"man3/X509_REQ_get_attr/#return-values","title":"RETURN VALUES","text":"

                        X509_REQ_get_attr_count() returns the number of attributes in the req object attribute list or -1 if the attribute list is NULL.

                        X509_REQ_get_attr_by_OBJ() returns -1 if either the req object's attribute list is empty OR obj is not found, otherwise it returns the location of the obj in the attribute list.

                        X509_REQ_get_attr_by_NID() is similar to X509_REQ_get_attr_by_OBJ(), except that it returns -2 if the nid is not known by OpenSSL.

                        X509_REQ_get_attr() returns either an X509_ATTRIBUTE or NULL on error.

                        X509_REQ_delete_attr() returns either the removed X509_ATTRIBUTE or NULL if there is a error.

                        X509_REQ_add1_attr(), X509_REQ_add1_attr_by_OBJ(), X509_REQ_add1_attr_by_NID() and X509_REQ_add1_attr_by_txt() return 1 on success or 0 on error.

                        "},{"location":"man3/X509_REQ_get_attr/#notes","title":"NOTES","text":"

                        Any functions that modify the attributes (add or delete) internally set a flag to indicate the ASN.1 encoding has been modified.

                        "},{"location":"man3/X509_REQ_get_attr/#see-also","title":"SEE ALSO","text":"

                        X509_ATTRIBUTE(3)

                        "},{"location":"man3/X509_REQ_get_attr/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_REQ_get_extensions/","title":"X509_REQ_get_extensions","text":""},{"location":"man3/X509_REQ_get_extensions/#name","title":"NAME","text":"

                        X509_REQ_get_extensions, X509_REQ_add_extensions, X509_REQ_add_extensions_nid - handle X.509 extension attributes of a CSR

                        "},{"location":"man3/X509_REQ_get_extensions/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nSTACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);\nint X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *exts);\nint X509_REQ_add_extensions_nid(X509_REQ *req,\n                                const STACK_OF(X509_EXTENSION) *exts, int nid);\n
                        "},{"location":"man3/X509_REQ_get_extensions/#description","title":"DESCRIPTION","text":"

                        X509_REQ_get_extensions() returns the first list of X.509 extensions found in the attributes of req. The returned list is empty if there are no such extensions in req. The caller is responsible for freeing the list obtained.

                        X509_REQ_add_extensions() adds to req a list of X.509 extensions exts, which must not be NULL, using the default NID_ext_req. This function must not be called more than once on the same req.

                        X509_REQ_add_extensions_nid() is like X509_REQ_add_extensions() except that nid is used to identify the extensions attribute. This function must not be called more than once with the same req and nid.

                        "},{"location":"man3/X509_REQ_get_extensions/#return-values","title":"RETURN VALUES","text":"

                        X509_REQ_get_extensions() returns a pointer to STACK_OF(X509_EXTENSION) or NULL on error.

                        X509_REQ_add_extensions() and X509_REQ_add_extensions_nid() return 1 on success, 0 on error.

                        "},{"location":"man3/X509_REQ_get_extensions/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_SIG_get0/","title":"X509_SIG_get0","text":""},{"location":"man3/X509_SIG_get0/#name","title":"NAME","text":"

                        X509_SIG_get0, X509_SIG_getm - DigestInfo functions

                        "},{"location":"man3/X509_SIG_get0/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nvoid X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg,\n                   const ASN1_OCTET_STRING **pdigest);\nvoid X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg,\n                   ASN1_OCTET_STRING **pdigest);\n
                        "},{"location":"man3/X509_SIG_get0/#description","title":"DESCRIPTION","text":"

                        X509_SIG_get0() returns pointers to the algorithm identifier and digest value in sig. X509_SIG_getm() is identical to X509_SIG_get0() except the pointers returned are not constant and can be modified: for example to initialise them.

                        "},{"location":"man3/X509_SIG_get0/#return-values","title":"RETURN VALUES","text":"

                        X509_SIG_get0() and X509_SIG_getm() return no values.

                        "},{"location":"man3/X509_SIG_get0/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3)

                        "},{"location":"man3/X509_SIG_get0/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_STORE_CTX_get_error/","title":"X509_STORE_CTX_get_error","text":""},{"location":"man3/X509_STORE_CTX_get_error/#name","title":"NAME","text":"

                        X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, X509_STORE_CTX_get_error_depth, X509_STORE_CTX_set_error_depth, X509_STORE_CTX_get_current_cert, X509_STORE_CTX_set_current_cert, X509_STORE_CTX_get0_cert, X509_STORE_CTX_get1_chain, X509_verify_cert_error_string - get or set certificate verification status information

                        "},{"location":"man3/X509_STORE_CTX_get_error/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint   X509_STORE_CTX_get_error(const X509_STORE_CTX *ctx);\nvoid  X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s);\nint   X509_STORE_CTX_get_error_depth(const X509_STORE_CTX *ctx);\nvoid  X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth);\nX509 *X509_STORE_CTX_get_current_cert(const X509_STORE_CTX *ctx);\nvoid  X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x);\nX509 *X509_STORE_CTX_get0_cert(const X509_STORE_CTX *ctx);\n\nSTACK_OF(X509) *X509_STORE_CTX_get1_chain(const X509_STORE_CTX *ctx);\n\nconst char *X509_verify_cert_error_string(long n);\n
                        "},{"location":"man3/X509_STORE_CTX_get_error/#description","title":"DESCRIPTION","text":"

                        These functions are typically called after certificate or chain verification using X509_verify_cert(3) or X509_STORE_CTX_verify(3) has indicated an error or in a verification callback to determine the nature of an error.

                        X509_STORE_CTX_get_error() returns the error code of ctx. See the \"ERROR CODES\" section for a full description of all error codes. It may return a code != X509_V_OK even if X509_verify_cert() did not indicate an error, likely because a verification callback function has waived the error.

                        X509_STORE_CTX_set_error() sets the error code of ctx to s. For example it might be used in a verification callback to set an error based on additional checks.

                        X509_STORE_CTX_get_error_depth() returns the depth of the error. This is a nonnegative integer representing where in the certificate chain the error occurred. If it is zero it occurred in the end entity certificate, one if it is the certificate which signed the end entity certificate and so on.

                        X509_STORE_CTX_set_error_depth() sets the error depth. This can be used in combination with X509_STORE_CTX_set_error() to set the depth at which an error condition was detected.

                        X509_STORE_CTX_get_current_cert() returns the current certificate in ctx. If an error occurred, the current certificate will be the one that is most closely related to the error, or possibly NULL if no such certificate is relevant.

                        X509_STORE_CTX_set_current_cert() sets the certificate x in ctx which caused the error. This value is not intended to remain valid for very long, and remains owned by the caller. It may be examined by a verification callback invoked to handle each error encountered during chain verification and is no longer required after such a callback. If a callback wishes the save the certificate for use after it returns, it needs to increment its reference count via X509_up_ref(3). Once such a saved certificate is no longer needed it can be freed with X509_free(3).

                        X509_STORE_CTX_get0_cert() retrieves an internal pointer to the certificate being verified by the ctx.

                        X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous verification is successful. Otherwise the returned chain may be incomplete or invalid. The returned chain persists after the ctx structure is freed. When it is no longer needed it should be free up using:

                        sk_X509_pop_free(chain, X509_free);\n

                        X509_verify_cert_error_string() returns a human readable error string for verification error n.

                        "},{"location":"man3/X509_STORE_CTX_get_error/#return-values","title":"RETURN VALUES","text":"

                        X509_STORE_CTX_get_error() returns X509_V_OK or an error code.

                        X509_STORE_CTX_get_error_depth() returns a nonnegative error depth.

                        X509_STORE_CTX_get_current_cert() returns the certificate which caused the error or NULL if no certificate is relevant to the error.

                        X509_verify_cert_error_string() returns a human readable error string for verification error n.

                        "},{"location":"man3/X509_STORE_CTX_get_error/#error-codes","title":"ERROR CODES","text":"

                        A list of error codes and messages is shown below. Some of the error codes are defined but currently never returned: these are described as \"unused\".

                        • X509_V_OK: ok

                          The operation was successful.

                        • X509_V_ERR_UNSPECIFIED: unspecified certificate verification error

                          Unspecified error; should not happen.

                        • X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate

                          The issuer certificate of a locally looked up certificate could not be found. This normally means the list of trusted certificates is not complete. To allow any certificate (not only a self-signed one) in the trust store to terminate the chain the X509_V_FLAG_PARTIAL_CHAIN flag may be set.

                        • X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL

                          The CRL of a certificate could not be found.

                        • X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature

                          The certificate signature could not be decrypted. This means that the actual signature value could not be determined rather than it not matching the expected value, this is only meaningful for RSA keys.

                        • X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature

                          The CRL signature could not be decrypted: this means that the actual signature value could not be determined rather than it not matching the expected value. Unused.

                        • X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key

                          The public key in the certificate SubjectPublicKeyInfo field could not be read.

                        • X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure

                          The signature of the certificate is invalid.

                        • X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure

                          The signature of the CRL is invalid.

                        • X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid

                          The certificate is not yet valid: the notBefore date is after the current time.

                        • X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired

                          The certificate has expired: that is the notAfter date is before the current time.

                        • X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid

                          The CRL is not yet valid.

                        • X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired

                          The CRL has expired.

                        • X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field

                          The certificate notBefore field contains an invalid time.

                        • X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field

                          The certificate notAfter field contains an invalid time.

                        • X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field

                          The CRL lastUpdate field contains an invalid time.

                        • X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field

                          The CRL nextUpdate field contains an invalid time.

                        • X509_V_ERR_OUT_OF_MEM: out of memory

                          An error occurred trying to allocate memory.

                        • X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self-signed certificate

                          The passed certificate is self-signed and the same certificate cannot be found in the list of trusted certificates.

                        • X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self-signed certificate in certificate chain

                          The certificate chain could be built up using the untrusted certificates but no suitable trust anchor (which typically is a self-signed root certificate) could be found in the trust store.

                        • X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate

                          The issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found.

                        • X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate

                          No signatures could be verified because the chain contains only one certificate and it is not self-signed and the X509_V_FLAG_PARTIAL_CHAIN flag is not set.

                        • X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long

                          The certificate chain length is greater than the supplied maximum depth.

                        • X509_V_ERR_CERT_REVOKED: certificate revoked

                          The certificate has been revoked.

                        • X509_V_ERR_NO_ISSUER_PUBLIC_KEY: issuer certificate doesn't have a public key

                          The issuer certificate does not have a public key.

                        • X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded

                          The basicConstraints path-length parameter has been exceeded.

                        • X509_V_ERR_INVALID_PURPOSE: unsuitable certificate purpose

                          The target certificate cannot be used for the specified purpose.

                        • X509_V_ERR_CERT_UNTRUSTED: certificate not trusted

                          The root CA is not marked as trusted for the specified purpose.

                        • X509_V_ERR_CERT_REJECTED: certificate rejected

                          The root CA is marked to reject the specified purpose.

                        • X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch

                          The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate.

                        • X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch

                          The current candidate issuer certificate was rejected because its subject key identifier was present and did not match the authority key identifier current certificate.

                        • X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch

                          The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate.

                        • X509_V_ERR_KEYUSAGE_NO_CERTSIGN: key usage does not include certificate signing

                          The current candidate issuer certificate was rejected because its keyUsage extension does not permit certificate signing.

                        • X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: unable to get CRL issuer certificate

                          Unable to get CRL issuer certificate.

                        • X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: unhandled critical extension

                          Unhandled critical extension.

                        • X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: key usage does not include CRL signing

                          Key usage does not include CRL signing.

                        • X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: unhandled critical CRL extension

                          Unhandled critical CRL extension.

                        • X509_V_ERR_INVALID_NON_CA: invalid non-CA certificate (has CA markings)

                          Invalid non-CA certificate has CA markings.

                        • X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED: proxy path length constraint exceeded

                          Proxy path length constraint exceeded.

                        • X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: key usage does not include digital signature

                          Key usage does not include digital signature, and therefore cannot sign certificates.

                        • X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED: proxy certificates not allowed, please set the appropriate flag

                          Proxy certificates not allowed unless the X509_V_FLAG_ALLOW_PROXY_CERTS flag is set.

                        • X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificate extension

                          A certificate extension had an invalid value (for example an incorrect encoding) or some value inconsistent with other extensions.

                        • X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent certificate policy extension

                          A certificate policies extension had an invalid value (for example an incorrect encoding) or some value inconsistent with other extensions. This error only occurs if policy processing is enabled.

                        • X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy

                          The verification flags were set to require and explicit policy but none was present.

                        • X509_V_ERR_DIFFERENT_CRL_SCOPE: different CRL scope

                          The only CRLs that could be found did not match the scope of the certificate.

                        • X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: unsupported extension feature

                          Some feature of a certificate extension is not supported. Unused.

                        • X509_V_ERR_UNNESTED_RESOURCE: RFC 3779 resource not subset of parent's resources

                          See RFC 3779 for details.

                        • X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation

                          A name constraint violation occurred in the permitted subtrees.

                        • X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation

                          A name constraint violation occurred in the excluded subtrees.

                        • X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum not supported

                          A certificate name constraints extension included a minimum or maximum field: this is not supported.

                        • X509_V_ERR_APPLICATION_VERIFICATION: application verification failure

                          An application specific error. This will never be returned unless explicitly set by an application callback.

                        • X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constraint type

                          An unsupported name constraint type was encountered. OpenSSL currently only supports directory name, DNS name, email and URI types.

                        • X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid name constraint syntax

                          The format of the name constraint is not recognised: for example an email address format of a form not mentioned in RFC3280. This could be caused by a garbage extension or some new feature not currently supported.

                        • X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: unsupported or invalid name syntax

                          Unsupported or invalid name syntax.

                        • X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error

                          An error occurred when attempting to verify the CRL path. This error can only happen if extended CRL checking is enabled.

                        • X509_V_ERR_PATH_LOOP: path loop

                          Path loop.

                        • X509_V_ERR_HOSTNAME_MISMATCH: hostname mismatch

                          Hostname mismatch.

                        • X509_V_ERR_EMAIL_MISMATCH: email address mismatch

                          Email address mismatch.

                        • X509_V_ERR_IP_ADDRESS_MISMATCH: IP address mismatch

                          IP address mismatch.

                        • X509_V_ERR_DANE_NO_MATCH: no matching DANE TLSA records

                          DANE TLSA authentication is enabled, but no TLSA records matched the certificate chain. This error is only possible in openssl-s_client(1).

                        • X509_V_ERR_EE_KEY_TOO_SMALL: EE certificate key too weak

                          EE certificate key too weak.

                        • X509_V_ERR_CA_KEY_TOO_SMALL: CA certificate key too weak

                          CA certificate key too weak.

                        • X509_V_ERR_CA_MD_TOO_WEAK: CA signature digest algorithm too weak

                          CA signature digest algorithm too weak.

                        • X509_V_ERR_INVALID_CALL: invalid certificate verification context

                          Invalid certificate verification context.

                        • X509_V_ERR_STORE_LOOKUP: issuer certificate lookup error

                          Issuer certificate lookup error.

                        • X509_V_ERR_NO_VALID_SCTS: certificate transparency required, but no valid SCTs found

                          Certificate Transparency required, but no valid SCTs found.

                        • X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION: proxy subject name violation

                          Proxy subject name violation.

                        • X509_V_ERR_OCSP_VERIFY_NEEDED: OCSP verification needed

                          Returned by the verify callback to indicate an OCSP verification is needed.

                        • X509_V_ERR_OCSP_VERIFY_FAILED: OCSP verification failed

                          Returned by the verify callback to indicate OCSP verification failed.

                        • X509_V_ERR_OCSP_CERT_UNKNOWN: OCSP unknown cert

                          Returned by the verify callback to indicate that the certificate is not recognized by the OCSP responder.

                        • X509_V_ERR_UNSUPPORTED_SIGNATURE_ALGORITHM: unsupported signature algorithm

                          Cannot find certificate signature algorithm.

                        • X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH: subject signature algorithm and issuer public key algorithm mismatch

                          The issuer's public key is not of the type required by the signature in the subject's certificate.

                        • X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY: cert info signature and signature algorithm mismatch

                          The algorithm given in the certificate info is inconsistent with the one used for the certificate signature.

                        • X509_V_ERR_INVALID_CA: invalid CA certificate

                          A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose.

                        "},{"location":"man3/X509_STORE_CTX_get_error/#notes","title":"NOTES","text":"

                        The above functions should be used instead of directly referencing the fields in the X509_VERIFY_CTX structure.

                        In versions of OpenSSL before 1.0 the current certificate returned by X509_STORE_CTX_get_current_cert() was never NULL. Applications should check the return value before printing out any debugging information relating to the current certificate.

                        If an unrecognised error code is passed to X509_verify_cert_error_string() the numerical value of the unknown code is returned in a static buffer. This is not thread safe but will never happen unless an invalid code is passed.

                        "},{"location":"man3/X509_STORE_CTX_get_error/#bugs","title":"BUGS","text":"

                        Previous versions of this documentation swapped the meaning of the X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT and X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY error codes.

                        "},{"location":"man3/X509_STORE_CTX_get_error/#see-also","title":"SEE ALSO","text":"

                        X509_verify_cert(3), X509_STORE_CTX_verify(3), X509_up_ref(3), X509_free(3).

                        "},{"location":"man3/X509_STORE_CTX_get_error/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2009-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_STORE_CTX_new/","title":"X509_STORE_CTX_new","text":""},{"location":"man3/X509_STORE_CTX_new/#name","title":"NAME","text":"

                        X509_STORE_CTX_new_ex, X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STORE_CTX_init, X509_STORE_CTX_set0_trusted_stack, X509_STORE_CTX_set_cert, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param, X509_STORE_CTX_get0_untrusted, X509_STORE_CTX_set0_untrusted, X509_STORE_CTX_get_num_untrusted, X509_STORE_CTX_get0_chain, X509_STORE_CTX_set0_verified_chain, X509_STORE_CTX_set_default, X509_STORE_CTX_set_verify, X509_STORE_CTX_verify_fn, X509_STORE_CTX_set_purpose, X509_STORE_CTX_set_trust, X509_STORE_CTX_purpose_inherit - X509_STORE_CTX initialisation

                        "},{"location":"man3/X509_STORE_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\nX509_STORE_CTX *X509_STORE_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nX509_STORE_CTX *X509_STORE_CTX_new(void);\nvoid X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_free(X509_STORE_CTX *ctx);\n\nint X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *trust_store,\n                        X509 *target, STACK_OF(X509) *untrusted);\n\nvoid X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);\n\nvoid X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *target);\nvoid X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk);\n\nX509_VERIFY_PARAM *X509_STORE_CTX_get0_param(const X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);\n\nSTACK_OF(X509)* X509_STORE_CTX_get0_untrusted(const X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);\n\nint X509_STORE_CTX_get_num_untrusted(const X509_STORE_CTX *ctx);\nSTACK_OF(X509) *X509_STORE_CTX_get0_chain(const X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *chain);\n\nint X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);\ntypedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *);\nvoid X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, X509_STORE_CTX_verify_fn verify);\n\nint X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);\nint X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);\nint X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,\n                                   int purpose, int trust);\n
                        "},{"location":"man3/X509_STORE_CTX_new/#description","title":"DESCRIPTION","text":"

                        These functions initialise an X509_STORE_CTX structure for subsequent use by X509_verify_cert(3) or X509_STORE_CTX_verify(3).

                        X509_STORE_CTX_new_ex() returns a newly initialised X509_STORE_CTX structure associated with the specified library context libctx and property query string propq. Any cryptographic algorithms fetched while performing processing with the X509_STORE_CTX will use that library context and property query string.

                        X509_STORE_CTX_new() is the same as X509_STORE_CTX_new_ex() except that the default library context and a NULL property query string are used.

                        X509_STORE_CTX_cleanup() internally cleans up an X509_STORE_CTX structure. It is used by X509_STORE_CTX_init() and X509_STORE_CTX_free().

                        X509_STORE_CTX_free() completely frees up ctx. After this call ctx is no longer valid. If ctx is NULL nothing is done.

                        It must be called before each call to X509_verify_cert(3) or X509_STORE_CTX_verify(3), i.e., a context is only good for one verification. If you want to verify a further certificate or chain with the same ctx then you must call X509_STORE_CTX_init() again. The trusted certificate store is set to trust_store of type X509_STORE. This may be NULL because there are no trusted certificates or because they are provided simply as a list using X509_STORE_CTX_set0_trusted_stack(). The certificate to be verified is set to target, and a list of additional certificates may be provided in untrusted, which will be untrusted but may be used to build the chain. Each of the trust_store, target and untrusted parameters can be NULL. Yet note that X509_verify_cert(3) and X509_STORE_CTX_verify(3) will need a verification target. This can also be set using X509_STORE_CTX_set_cert(). For X509_STORE_CTX_verify(3), which takes by default the first element of the list of untrusted certificates as its verification target, this can be also set indirectly using X509_STORE_CTX_set0_untrusted().

                        X509_STORE_CTX_set0_trusted_stack() sets the set of trusted certificates of ctx to sk. This is an alternative way of specifying trusted certificates instead of using an X509_STORE where its complexity is not needed or to make sure that only the given set sk of certificates are trusted.

                        X509_STORE_CTX_set_cert() sets the target certificate to be verified in ctx to target.

                        X509_STORE_CTX_set0_verified_chain() sets the validated chain to chain. Ownership of the chain is transferred to ctx, and so it should not be free'd by the caller.

                        X509_STORE_CTX_get0_chain() returns the internal pointer used by the ctx that contains the constructed (output) chain.

                        X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate verification to sk. These CRLs will only be used if CRL verification is enabled in the associated X509_VERIFY_PARAM structure. This might be used where additional \"useful\" CRLs are supplied as part of a protocol, for example in a PKCS#7 structure.

                        X509_STORE_CTX_get0_param() retrieves an internal pointer to the verification parameters associated with ctx.

                        X509_STORE_CTX_set0_param() sets the internal verification parameter pointer to param. After this call param should not be used.

                        X509_STORE_CTX_get0_untrusted() retrieves an internal pointer to the stack of untrusted certificates associated with ctx.

                        X509_STORE_CTX_set0_untrusted() sets the internal pointer to the stack of untrusted certificates associated with ctx to sk. X509_STORE_CTX_verify() will take the first element, if any, as its default target if the target certificate is not set explicitly.

                        X509_STORE_CTX_get_num_untrusted() returns the number of untrusted certificates that were used in building the chain. This is can be used after calling X509_verify_cert(3) and similar functions. With X509_STORE_CTX_verify(3), this does not count the first chain element.

                        X509_STORE_CTX_get0_chain() returns the internal pointer used by the ctx that contains the validated chain.

                        Details of the chain building and checking process are described in \"Certification Path Building\" in openssl-verification-options(1) and \"Certification Path Validation\" in openssl-verification-options(1).

                        X509_STORE_CTX_set0_verified_chain() sets the validated chain used by ctx to be chain. Ownership of the chain is transferred to ctx, and so it should not be free'd by the caller.

                        X509_STORE_CTX_set_default() looks up and sets the default verification method to name. This uses the function X509_VERIFY_PARAM_lookup() to find an appropriate set of parameters from the purpose identifier name. Currently defined purposes are sslclient, sslserver, nssslserver, smimesign, smimeencrypt, crlsign, ocsphelper, timestampsign, and any.

                        X509_STORE_CTX_set_verify() provides the capability for overriding the default verify function. This function is responsible for verifying chain signatures and expiration times.

                        A verify function is defined as an X509_STORE_CTX_verify type which has the following signature:

                        int (*verify)(X509_STORE_CTX *);\n

                        This function should receive the current X509_STORE_CTX as a parameter and return 1 on success or 0 on failure.

                        X509 certificates may contain information about what purposes keys contained within them can be used for. For example \"TLS WWW Server Authentication\" or \"Email Protection\". This \"key usage\" information is held internally to the certificate itself. In addition the trust store containing trusted certificates can declare what purposes we trust different certificates for. This \"trust\" information is not held within the certificate itself but is \"meta\" information held alongside it. This \"meta\" information is associated with the certificate after it is issued and could be determined by a system administrator. For example a certificate might declare that it is suitable for use for both \"TLS WWW Server Authentication\" and \"TLS Client Authentication\", but a system administrator might only trust it for the former. An X.509 certificate extension exists that can record extended key usage information to supplement the purpose information described above. This extended mechanism is arbitrarily extensible and not well suited for a generic library API; applications that need to validate extended key usage information in certificates will need to define a custom \"purpose\" (see below) or supply a nondefault verification callback (X509_STORE_set_verify_cb_func(3)).

                        X509_STORE_CTX_set_purpose() sets the purpose for the target certificate being verified in the ctx. Built-in available values for the purpose argument are X509_PURPOSE_SSL_CLIENT, X509_PURPOSE_SSL_SERVER, X509_PURPOSE_NS_SSL_SERVER, X509_PURPOSE_SMIME_SIGN, X509_PURPOSE_SMIME_ENCRYPT, X509_PURPOSE_CRL_SIGN, X509_PURPOSE_ANY, X509_PURPOSE_OCSP_HELPER and X509_PURPOSE_TIMESTAMP_SIGN. It is also possible to create a custom purpose value. Setting a purpose will ensure that the key usage declared within certificates in the chain being verified is consistent with that purpose as well as, potentially, other checks. Every purpose also has an associated default trust value which will also be set at the same time. During verification this trust setting will be verified to check it is consistent with the trust set by the system administrator for certificates in the chain.

                        X509_STORE_CTX_set_trust() sets the trust value for the target certificate being verified in the ctx. Built-in available values for the trust argument are X509_TRUST_COMPAT, X509_TRUST_SSL_CLIENT, X509_TRUST_SSL_SERVER, X509_TRUST_EMAIL, X509_TRUST_OBJECT_SIGN, X509_TRUST_OCSP_SIGN, X509_TRUST_OCSP_REQUEST and X509_TRUST_TSA. It is also possible to create a custom trust value. Since X509_STORE_CTX_set_purpose() also sets the trust value it is normally sufficient to only call that function. If both are called then X509_STORE_CTX_set_trust() should be called after X509_STORE_CTX_set_purpose() since the trust setting of the last call will be used.

                        It should not normally be necessary for end user applications to call X509_STORE_CTX_purpose_inherit() directly. Typically applications should call X509_STORE_CTX_set_purpose() or X509_STORE_CTX_set_trust() instead. Using this function it is possible to set the purpose and trust values for the ctx at the same time. Both ctx and its internal verification parameter pointer must not be NULL. The def_purpose and purpose arguments can have the same purpose values as described for X509_STORE_CTX_set_purpose() above. The trust argument can have the same trust values as described in X509_STORE_CTX_set_trust() above. Any of the def_purpose, purpose or trust values may also have the value 0 to indicate that the supplied parameter should be ignored. After calling this function the purpose to be used for verification is set from the purpose argument unless the purpose was already set in ctx before, and the trust is set from the trust argument unless the trust was already set in ctx before. If trust is 0 then the trust value will be set from the default trust value for purpose. If the default trust value for the purpose is X509_TRUST_DEFAULT and trust is 0 then the default trust value associated with the def_purpose value is used for the trust setting instead.

                        "},{"location":"man3/X509_STORE_CTX_new/#notes","title":"NOTES","text":"

                        The certificates and CRLs in a store are used internally and should not be freed up until after the associated X509_STORE_CTX is freed.

                        "},{"location":"man3/X509_STORE_CTX_new/#bugs","title":"BUGS","text":"

                        The certificates and CRLs in a context are used internally and should not be freed up until after the associated X509_STORE_CTX is freed. Copies should be made or reference counts increased instead.

                        "},{"location":"man3/X509_STORE_CTX_new/#return-values","title":"RETURN VALUES","text":"

                        X509_STORE_CTX_new() returns a newly allocated context or NULL if an error occurred.

                        X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred.

                        X509_STORE_CTX_get0_param() returns a pointer to an X509_VERIFY_PARAM structure or NULL if an error occurred.

                        X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(), X509_STORE_CTX_set0_trusted_stack(), X509_STORE_CTX_set_cert(), X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not return values.

                        X509_STORE_CTX_set_default() returns 1 for success or 0 if an error occurred.

                        X509_STORE_CTX_get_num_untrusted() returns the number of untrusted certificates used.

                        "},{"location":"man3/X509_STORE_CTX_new/#see-also","title":"SEE ALSO","text":"

                        X509_verify_cert(3), X509_STORE_CTX_verify(3), X509_VERIFY_PARAM_set_flags(3)

                        "},{"location":"man3/X509_STORE_CTX_new/#history","title":"HISTORY","text":"

                        The X509_STORE_CTX_set0_crls() function was added in OpenSSL 1.0.0. The X509_STORE_CTX_get_num_untrusted() function was added in OpenSSL 1.1.0. The X509_STORE_CTX_new_ex() function was added in OpenSSL 3.0.

                        There is no need to call X509_STORE_CTX_cleanup() explicitly since OpenSSL 3.0.

                        "},{"location":"man3/X509_STORE_CTX_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2009-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/","title":"X509_STORE_CTX_set_verify_cb","text":""},{"location":"man3/X509_STORE_CTX_set_verify_cb/#name","title":"NAME","text":"

                        X509_STORE_CTX_get_cleanup, X509_STORE_CTX_get_lookup_crls, X509_STORE_CTX_get_lookup_certs, X509_STORE_CTX_get_check_policy, X509_STORE_CTX_get_cert_crl, X509_STORE_CTX_get_check_crl, X509_STORE_CTX_get_get_crl, X509_STORE_CTX_get_check_revocation, X509_STORE_CTX_get_check_issued, X509_STORE_CTX_get_get_issuer, X509_STORE_CTX_get_verify_cb, X509_STORE_CTX_set_verify_cb, X509_STORE_CTX_verify_cb, X509_STORE_CTX_print_verify_cb - get and set X509_STORE_CTX components such as verification callback

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\ntypedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *);\nint X509_STORE_CTX_print_verify_cb(int ok, X509_STORE_CTX *ctx);\n\nX509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx);\n\nvoid X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,\n                                  X509_STORE_CTX_verify_cb verify_cb);\n\nX509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx);\nX509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx);\nX509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx);\nX509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx);\nX509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx);\nX509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx);\n
                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#description","title":"DESCRIPTION","text":"

                        X509_STORE_CTX_set_verify_cb() sets the verification callback of ctx to verify_cb overwriting any existing callback.

                        The verification callback can be used to customise the operation of certificate verification, for instance by overriding error conditions or logging errors for debugging purposes.

                        However, a verification callback is not essential and the default operation is often sufficient.

                        The ok parameter to the callback indicates the value the callback should return to retain the default behaviour. If it is zero then an error condition is indicated. If it is 1 then no error occurred. If the flag X509_V_FLAG_NOTIFY_POLICY is set then ok is set to 2 to indicate the policy checking is complete.

                        The ctx parameter to the callback is the X509_STORE_CTX structure that is performing the verification operation. A callback can examine this structure and receive additional information about the error, for example by calling X509_STORE_CTX_get_current_cert(). Additional application data can be passed to the callback via the ex_data mechanism.

                        X509_STORE_CTX_print_verify_cb() is a verification callback function that, when a certificate verification has failed, adds an entry to the error queue with code X509_R_CERTIFICATE_VERIFICATION_FAILED and with diagnostic details, including the most relevant fields of the target certificate that failed to verify and, if appropriate, of the available untrusted and trusted certificates.

                        X509_STORE_CTX_get_verify_cb() returns the value of the current callback for the specific ctx.

                        X509_STORE_CTX_get_get_issuer(), X509_STORE_CTX_get_check_issued(), X509_STORE_CTX_get_check_revocation(), X509_STORE_CTX_get_get_crl(), X509_STORE_CTX_get_check_crl(), X509_STORE_CTX_get_cert_crl(), X509_STORE_CTX_get_check_policy(), X509_STORE_CTX_get_lookup_certs(), X509_STORE_CTX_get_lookup_crls() and X509_STORE_CTX_get_cleanup() return the function pointers cached from the corresponding X509_STORE, please see X509_STORE_set_verify(3) for more information.

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#warnings","title":"WARNINGS","text":"

                        In general a verification callback should NOT unconditionally return 1 in all circumstances because this will allow verification to succeed no matter what the error. This effectively removes all security from the application because any certificate (including untrusted generated ones) will be accepted.

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#notes","title":"NOTES","text":"

                        The verification callback can be set and inherited from the parent structure performing the operation. In some cases (such as S/MIME verification) the X509_STORE_CTX structure is created and destroyed internally and the only way to set a custom verification callback is by inheriting it from the associated X509_STORE.

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#return-values","title":"RETURN VALUES","text":"

                        X509_STORE_CTX_set_verify_cb() does not return a value.

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#examples","title":"EXAMPLES","text":"

                        Default callback operation:

                        int verify_callback(int ok, X509_STORE_CTX *ctx) {\n    return ok;\n}\n

                        Simple example, suppose a certificate in the chain is expired and we wish to continue after this error:

                        int verify_callback(int ok, X509_STORE_CTX *ctx) {\n    /* Tolerate certificate expiration */\n    if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED)\n        return 1;\n    /* Otherwise don't override */\n    return ok;\n}\n

                        More complex example, we don't wish to continue after any certificate has expired just one specific case:

                        int verify_callback(int ok, X509_STORE_CTX *ctx)\n{\n    int err = X509_STORE_CTX_get_error(ctx);\n    X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx);\n\n    if (err == X509_V_ERR_CERT_HAS_EXPIRED) {\n        if (check_is_acceptable_expired_cert(err_cert)\n            return 1;\n    }\n    return ok;\n}\n

                        Full featured logging callback. In this case the bio_err is assumed to be a global logging BIO, an alternative would to store a BIO in ctx using ex_data.

                        int verify_callback(int ok, X509_STORE_CTX *ctx)\n{\n    X509 *err_cert;\n    int err, depth;\n\n    err_cert = X509_STORE_CTX_get_current_cert(ctx);\n    err = X509_STORE_CTX_get_error(ctx);\n    depth = X509_STORE_CTX_get_error_depth(ctx);\n\n    BIO_printf(bio_err, \"depth=%d \", depth);\n    if (err_cert) {\n        X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert),\n                           0, XN_FLAG_ONELINE);\n        BIO_puts(bio_err, \"\\n\");\n    }\n    else\n        BIO_puts(bio_err, \"<no cert>\\n\");\n    if (!ok)\n        BIO_printf(bio_err, \"verify error:num=%d:%s\\n\", err,\n                   X509_verify_cert_error_string(err));\n    switch (err) {\n    case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:\n        BIO_puts(bio_err, \"issuer= \");\n        X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert),\n                           0, XN_FLAG_ONELINE);\n        BIO_puts(bio_err, \"\\n\");\n        break;\n    case X509_V_ERR_CERT_NOT_YET_VALID:\n    case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:\n        BIO_printf(bio_err, \"notBefore=\");\n        ASN1_TIME_print(bio_err, X509_get_notBefore(err_cert));\n        BIO_printf(bio_err, \"\\n\");\n        break;\n    case X509_V_ERR_CERT_HAS_EXPIRED:\n    case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:\n        BIO_printf(bio_err, \"notAfter=\");\n        ASN1_TIME_print(bio_err, X509_get_notAfter(err_cert));\n        BIO_printf(bio_err, \"\\n\");\n        break;\n    case X509_V_ERR_NO_EXPLICIT_POLICY:\n        policies_print(bio_err, ctx);\n        break;\n    }\n    if (err == X509_V_OK && ok == 2)\n        /* print out policies */\n\n    BIO_printf(bio_err, \"verify return:%d\\n\", ok);\n    return(ok);\n}\n
                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#see-also","title":"SEE ALSO","text":"

                        X509_STORE_CTX_get_error(3) X509_STORE_set_verify_cb_func(3) X509_STORE_CTX_get_ex_new_index(3)

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#history","title":"HISTORY","text":"

                        The X509_STORE_CTX_get_get_issuer(), X509_STORE_CTX_get_check_issued(), X509_STORE_CTX_get_check_revocation(), X509_STORE_CTX_get_get_crl(), X509_STORE_CTX_get_check_crl(), X509_STORE_CTX_get_cert_crl(), X509_STORE_CTX_get_check_policy(), X509_STORE_CTX_get_lookup_certs(), X509_STORE_CTX_get_lookup_crls() and X509_STORE_CTX_get_cleanup() functions were added in OpenSSL 1.1.0.

                        X509_STORE_CTX_print_verify_cb() was added in OpenSSL 3.0.

                        "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2009-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_STORE_add_cert/","title":"X509_STORE_add_cert","text":""},{"location":"man3/X509_STORE_add_cert/#name","title":"NAME","text":"

                        X509_STORE, X509_STORE_add_cert, X509_STORE_add_crl, X509_STORE_set_depth, X509_STORE_set_flags, X509_STORE_set_purpose, X509_STORE_set_trust, X509_STORE_add_lookup, X509_STORE_load_file_ex, X509_STORE_load_file, X509_STORE_load_path, X509_STORE_load_store_ex, X509_STORE_load_store, X509_STORE_set_default_paths_ex, X509_STORE_set_default_paths, X509_STORE_load_locations_ex, X509_STORE_load_locations - X509_STORE manipulation

                        "},{"location":"man3/X509_STORE_add_cert/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\ntypedef x509_store_st X509_STORE;\n\nint X509_STORE_add_cert(X509_STORE *ctx, X509 *x);\nint X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);\nint X509_STORE_set_depth(X509_STORE *store, int depth);\nint X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);\nint X509_STORE_set_purpose(X509_STORE *ctx, int purpose);\nint X509_STORE_set_trust(X509_STORE *ctx, int trust);\n\nX509_LOOKUP *X509_STORE_add_lookup(X509_STORE *store,\n                                   X509_LOOKUP_METHOD *meth);\n\nint X509_STORE_set_default_paths_ex(X509_STORE *ctx, OSSL_LIB_CTX *libctx,\n                                    const char *propq);\nint X509_STORE_set_default_paths(X509_STORE *ctx);\nint X509_STORE_load_file_ex(X509_STORE *ctx, const char *file,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nint X509_STORE_load_file(X509_STORE *ctx, const char *file);\nint X509_STORE_load_path(X509_STORE *ctx, const char *dir);\nint X509_STORE_load_store_ex(X509_STORE *ctx, const char *uri,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint X509_STORE_load_store(X509_STORE *ctx, const char *uri);\nint X509_STORE_load_locations_ex(X509_STORE *ctx, const char *file,\n                                 const char *dir, OSSL_LIB_CTX *libctx,\n                                 const char *propq);\nint X509_STORE_load_locations(X509_STORE *ctx,\n                              const char *file, const char *dir);\n
                        "},{"location":"man3/X509_STORE_add_cert/#description","title":"DESCRIPTION","text":"

                        The X509_STORE structure is intended to be a consolidated mechanism for holding information about X.509 certificates and CRLs, and constructing and validating chains of certificates terminating in trusted roots. It admits multiple lookup mechanisms and efficient scaling performance with large numbers of certificates, and a great deal of flexibility in how validation and policy checks are performed.

                        Details of the chain building and checking process are described in \"Certification Path Building\" in openssl-verification-options(1) and \"Certification Path Validation\" in openssl-verification-options(1).

                        X509_STORE_new(3) creates an empty X509_STORE structure, which contains no information about trusted certificates or where such certificates are located on disk, and is generally not usable. Normally, trusted certificates will be added to the X509_STORE to prepare it for use, via mechanisms such as X509_STORE_add_lookup() and X509_LOOKUP_file(), or PEM_read_bio_X509_AUX() and X509_STORE_add_cert(). CRLs can also be added, and many behaviors configured as desired.

                        Once the X509_STORE is suitably configured, X509_STORE_CTX_new() is used to instantiate a single-use X509_STORE_CTX for each chain-building and verification operation. That process includes providing the end-entity certificate to be verified and an additional set of untrusted certificates that may be used in chain-building. As such, it is expected that the certificates included in the X509_STORE are certificates that represent trusted entities such as root certificate authorities (CAs). OpenSSL represents these trusted certificates internally as X509 objects with an associated X509_CERT_AUX, as are produced by PEM_read_bio_X509_AUX() and similar routines that refer to X509_AUX. The public interfaces that operate on such trusted certificates still operate on pointers to X509 objects, though.

                        X509_STORE_add_cert() and X509_STORE_add_crl() add the respective object to the X509_STORE's local storage. Untrusted objects should not be added in this way. The added object's reference count is incremented by one, hence the caller retains ownership of the object and needs to free it when it is no longer needed.

                        X509_STORE_set_depth(), X509_STORE_set_flags(), X509_STORE_set_purpose(), X509_STORE_set_trust(), and X509_STORE_set1_param() set the default values for the corresponding values used in certificate chain validation. Their behavior is documented in the corresponding X509_VERIFY_PARAM manual pages, e.g., X509_VERIFY_PARAM_set_depth(3).

                        X509_STORE_add_lookup() finds or creates a X509_LOOKUP(3) with the X509_LOOKUP_METHOD(3) meth and adds it to the X509_STORE store. This also associates the X509_STORE with the lookup, so X509_LOOKUP functions can look up objects in that store.

                        X509_STORE_load_file_ex() loads trusted certificate(s) into an X509_STORE from a given file. The library context libctx and property query propq are used when fetching algorithms from providers.

                        X509_STORE_load_file() is similar to X509_STORE_load_file_ex() but uses NULL for the library context libctx and property query propq.

                        X509_STORE_load_path() loads trusted certificate(s) into an X509_STORE from a given directory path. The certificates in the directory must be in hashed form, as documented in X509_LOOKUP_hash_dir(3).

                        X509_STORE_load_store_ex() loads trusted certificate(s) into an X509_STORE from a store at a given URI. The library context libctx and property query propq are used when fetching algorithms from providers.

                        X509_STORE_load_store() is similar to X509_STORE_load_store_ex() but uses NULL for the library context libctx and property query propq.

                        X509_STORE_load_locations_ex() combines X509_STORE_load_file_ex() and X509_STORE_load_path() for a given file and/or directory path. It is permitted to specify just a file, just a directory, or both paths.

                        X509_STORE_load_locations() is similar to X509_STORE_load_locations_ex() but uses NULL for the library context libctx and property query propq.

                        X509_STORE_set_default_paths_ex() is somewhat misnamed, in that it does not set what default paths should be used for loading certificates. Instead, it loads certificates into the X509_STORE from the hardcoded default paths. The library context libctx and property query propq are used when fetching algorithms from providers.

                        X509_STORE_set_default_paths() is similar to X509_STORE_set_default_paths_ex() but uses NULL for the library context libctx and property query propq.

                        "},{"location":"man3/X509_STORE_add_cert/#return-values","title":"RETURN VALUES","text":"

                        X509_STORE_add_cert(), X509_STORE_add_crl(), X509_STORE_set_depth(), X509_STORE_set_flags(), X509_STORE_set_purpose(), X509_STORE_set_trust(), X509_STORE_load_file_ex(), X509_STORE_load_file(), X509_STORE_load_path(), X509_STORE_load_store_ex(), X509_STORE_load_store(), X509_STORE_load_locations_ex(), X509_STORE_load_locations(), X509_STORE_set_default_paths_ex() and X509_STORE_set_default_paths() return 1 on success or 0 on failure.

                        X509_STORE_add_lookup() returns the found or created X509_LOOKUP(3), or NULL on error.

                        "},{"location":"man3/X509_STORE_add_cert/#see-also","title":"SEE ALSO","text":"

                        X509_LOOKUP_hash_dir(3). X509_VERIFY_PARAM_set_depth(3). X509_STORE_new(3), X509_STORE_get0_param(3)

                        "},{"location":"man3/X509_STORE_add_cert/#history","title":"HISTORY","text":"

                        The functions X509_STORE_set_default_paths_ex(), X509_STORE_load_file_ex(), X509_STORE_load_store_ex() and X509_STORE_load_locations_ex() were added in OpenSSL 3.0.

                        "},{"location":"man3/X509_STORE_add_cert/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_STORE_get0_param/","title":"X509_STORE_get0_param","text":""},{"location":"man3/X509_STORE_get0_param/#name","title":"NAME","text":"

                        X509_STORE_get0_param, X509_STORE_set1_param, X509_STORE_get0_objects, X509_STORE_get1_all_certs - X509_STORE setter and getter functions

                        "},{"location":"man3/X509_STORE_get0_param/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\nX509_VERIFY_PARAM *X509_STORE_get0_param(const X509_STORE *ctx);\nint X509_STORE_set1_param(X509_STORE *ctx, const X509_VERIFY_PARAM *pm);\nSTACK_OF(X509_OBJECT) *X509_STORE_get0_objects(const X509_STORE *ctx);\nSTACK_OF(X509) *X509_STORE_get1_all_certs(X509_STORE *st);\n
                        "},{"location":"man3/X509_STORE_get0_param/#description","title":"DESCRIPTION","text":"

                        X509_STORE_set1_param() sets the verification parameters to pm for ctx.

                        X509_STORE_get0_param() retrieves an internal pointer to the verification parameters for ctx. The returned pointer must not be freed by the calling application

                        X509_STORE_get0_objects() retrieves an internal pointer to the store's X509 object cache. The cache contains X509 and X509_CRL objects. The returned pointer must not be freed by the calling application.

                        X509_STORE_get1_all_certs() returns a list of all certificates in the store. The caller is responsible for freeing the returned list.

                        "},{"location":"man3/X509_STORE_get0_param/#return-values","title":"RETURN VALUES","text":"

                        X509_STORE_get0_param() returns a pointer to an X509_VERIFY_PARAM structure.

                        X509_STORE_set1_param() returns 1 for success and 0 for failure.

                        X509_STORE_get0_objects() returns a pointer to a stack of X509_OBJECT.

                        X509_STORE_get1_all_certs() returns a pointer to a stack of the retrieved certificates on success, else NULL.

                        "},{"location":"man3/X509_STORE_get0_param/#see-also","title":"SEE ALSO","text":"

                        X509_STORE_new(3)

                        "},{"location":"man3/X509_STORE_get0_param/#history","title":"HISTORY","text":"

                        X509_STORE_get0_param and X509_STORE_get0_objects were added in OpenSSL 1.1.0. X509_STORE_get1_certs was added in OpenSSL 3.0.

                        "},{"location":"man3/X509_STORE_get0_param/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_STORE_new/","title":"X509_STORE_new","text":""},{"location":"man3/X509_STORE_new/#name","title":"NAME","text":"

                        X509_STORE_new, X509_STORE_up_ref, X509_STORE_free, X509_STORE_lock,X509_STORE_unlock - X509_STORE allocation, freeing and locking functions

                        "},{"location":"man3/X509_STORE_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\nX509_STORE *X509_STORE_new(void);\nvoid X509_STORE_free(X509_STORE *v);\nint X509_STORE_lock(X509_STORE *v);\nint X509_STORE_unlock(X509_STORE *v);\nint X509_STORE_up_ref(X509_STORE *v);\n
                        "},{"location":"man3/X509_STORE_new/#description","title":"DESCRIPTION","text":"

                        The X509_STORE_new() function returns a new X509_STORE.

                        X509_STORE_up_ref() increments the reference count associated with the X509_STORE object.

                        X509_STORE_lock() locks the store from modification by other threads, X509_STORE_unlock() unlocks it.

                        X509_STORE_free() frees up a single X509_STORE object. If the argument is NULL, nothing is done.

                        "},{"location":"man3/X509_STORE_new/#return-values","title":"RETURN VALUES","text":"

                        X509_STORE_new() returns a newly created X509_STORE or NULL if the call fails.

                        X509_STORE_up_ref(), X509_STORE_lock() and X509_STORE_unlock() return 1 for success and 0 for failure.

                        X509_STORE_free() does not return values.

                        "},{"location":"man3/X509_STORE_new/#see-also","title":"SEE ALSO","text":"

                        X509_STORE_set_verify_cb_func(3) X509_STORE_get0_param(3)

                        "},{"location":"man3/X509_STORE_new/#history","title":"HISTORY","text":"

                        The X509_STORE_up_ref(), X509_STORE_lock() and X509_STORE_unlock() functions were added in OpenSSL 1.1.0.

                        "},{"location":"man3/X509_STORE_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/","title":"X509_STORE_set_verify_cb_func","text":""},{"location":"man3/X509_STORE_set_verify_cb_func/#name","title":"NAME","text":"

                        X509_STORE_set_lookup_crls_cb, X509_STORE_set_verify_func, X509_STORE_get_cleanup, X509_STORE_set_cleanup, X509_STORE_get_lookup_crls, X509_STORE_set_lookup_crls, X509_STORE_get_lookup_certs, X509_STORE_set_lookup_certs, X509_STORE_get_check_policy, X509_STORE_set_check_policy, X509_STORE_get_cert_crl, X509_STORE_set_cert_crl, X509_STORE_get_check_crl, X509_STORE_set_check_crl, X509_STORE_get_get_crl, X509_STORE_set_get_crl, X509_STORE_get_check_revocation, X509_STORE_set_check_revocation, X509_STORE_get_check_issued, X509_STORE_set_check_issued, X509_STORE_CTX_get1_issuer, X509_STORE_get_get_issuer, X509_STORE_set_get_issuer, X509_STORE_CTX_get_verify, X509_STORE_set_verify, X509_STORE_get_verify_cb, X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb, X509_STORE_CTX_cert_crl_fn, X509_STORE_CTX_check_crl_fn, X509_STORE_CTX_check_issued_fn, X509_STORE_CTX_check_policy_fn, X509_STORE_CTX_check_revocation_fn, X509_STORE_CTX_cleanup_fn, X509_STORE_CTX_get_crl_fn, X509_STORE_CTX_get_issuer_fn, X509_STORE_CTX_lookup_certs_fn, X509_STORE_CTX_lookup_crls_fn - set verification callback

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\ntypedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer,\n                                            X509_STORE_CTX *ctx, X509 *x);\ntypedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx,\n                                              X509 *x, X509 *issuer);\ntypedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx);\ntypedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx,\n                                         X509_CRL **crl, X509 *x);\ntypedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl);\ntypedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx,\n                                          X509_CRL *crl, X509 *x);\ntypedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx);\ntypedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx,\n                                                          const X509_NAME *nm);\ntypedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(const\n                                                             X509_STORE_CTX *ctx,\n                                                             const X509_NAME *nm);\ntypedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_verify_cb(X509_STORE *ctx,\n                              X509_STORE_CTX_verify_cb verify_cb);\nX509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify);\nX509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(const X509_STORE_CTX *ctx);\n\nint X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\nX509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(const X509_STORE_CTX *ctx);\nvoid X509_STORE_set_get_issuer(X509_STORE *ctx,\n                               X509_STORE_CTX_get_issuer_fn get_issuer);\n\nvoid X509_STORE_set_check_issued(X509_STORE *ctx,\n                                 X509_STORE_CTX_check_issued_fn check_issued);\nX509_STORE_CTX_check_issued_fn\n    X509_STORE_get_check_issued(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_check_revocation(X509_STORE *ctx,\n                                     X509_STORE_CTX_check_revocation_fn check_revocation);\nX509_STORE_CTX_check_revocation_fn\n    X509_STORE_get_check_revocation(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_get_crl(X509_STORE *ctx,\n                            X509_STORE_CTX_get_crl_fn get_crl);\nX509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_check_crl(X509_STORE *ctx,\n                              X509_STORE_CTX_check_crl_fn check_crl);\nX509_STORE_CTX_check_crl_fn\n    X509_STORE_get_check_crl(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_cert_crl(X509_STORE *ctx,\n                             X509_STORE_CTX_cert_crl_fn cert_crl);\nX509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_check_policy(X509_STORE *ctx,\n                                 X509_STORE_CTX_check_policy_fn check_policy);\nX509_STORE_CTX_check_policy_fn\n    X509_STORE_get_check_policy(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_lookup_certs(X509_STORE *ctx,\n                                 X509_STORE_CTX_lookup_certs_fn lookup_certs);\nX509_STORE_CTX_lookup_certs_fn\n    X509_STORE_get_lookup_certs(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_lookup_crls(X509_STORE *ctx,\n                                X509_STORE_CTX_lookup_crls_fn lookup_crls);\nX509_STORE_CTX_lookup_crls_fn\n    X509_STORE_get_lookup_crls(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_cleanup(X509_STORE *ctx,\n                            X509_STORE_CTX_cleanup_fn cleanup);\nX509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(const X509_STORE_CTX *ctx);\n\n/* Aliases */\nvoid X509_STORE_set_verify_cb_func(X509_STORE *st,\n                                   X509_STORE_CTX_verify_cb verify_cb);\nvoid X509_STORE_set_verify_func(X509_STORE *ctx,\n                                X509_STORE_CTX_verify_fn verify);\nvoid X509_STORE_set_lookup_crls_cb(X509_STORE *ctx,\n                                   X509_STORE_CTX_lookup_crls_fn lookup_crls);\n
                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#description","title":"DESCRIPTION","text":"

                        X509_STORE_set_verify_cb() sets the verification callback of ctx to verify_cb overwriting the previous callback. The callback assigned with this function becomes a default for the one that can be assigned directly to the corresponding X509_STORE_CTX, please see X509_STORE_CTX_set_verify_cb(3) for further information.

                        X509_STORE_set_verify() sets the final chain verification function for ctx to verify. Its purpose is to go through the chain of certificates and check that all signatures are valid and that the current time is within the limits of each certificate's first and last validity time. The final chain verification functions must return 0 on failure and 1 on success. If no chain verification function is provided, the internal default function will be used instead.

                        X509_STORE_CTX_get1_issuer() tries to find a certificate from the store component of ctx with a subject name matching the issuer name of x. On success it assigns to *issuer the first match that is currently valid, or at least the most recently expired match if there is no currently valid one. If the function returns 1 the caller is responsible for freeing *issuer.

                        X509_STORE_set_get_issuer() sets the function get_issuer to get the \"best\" candidate issuer certificate of the given certificate x. When such a certificate is found, get_issuer must up-ref and assign it to *issuer and then return 1. Otherwise get_issuer must return 0 if not found and -1 (or 0) on failure. If X509_STORE_set_get_issuer() is not used or get_issuer is NULL then X509_STORE_CTX_get1_issuer() is used as the default implementation.

                        X509_STORE_set_check_issued() sets the function to check that a given certificate x is issued by the issuer certificate issuer. This function must return 0 on failure (among others if x hasn't been issued with issuer) and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_set_check_revocation() sets the revocation checking function. Its purpose is to look through the final chain and check the revocation status for each certificate. It must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_set_get_crl() sets the function to get the crl for a given certificate x. When found, the crl must be assigned to *crl. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_set_check_crl() sets the function to check the validity of the given crl. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_set_cert_crl() sets the function to check the revocation status of the given certificate x against the given crl. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_set_check_policy() sets the function to check the policies of all the certificates in the final chain.. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_set_lookup_certs() and X509_STORE_set_lookup_crls() set the functions to look up all the certs or all the CRLs that match the given name nm. These functions return NULL on failure and a pointer to a stack of certificates (X509) or to a stack of CRLs (X509_CRL) on success. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_set_cleanup() sets the final cleanup function, which is called when the context (X509_STORE_CTX) is being torn down. This function doesn't return any value. If no function to get the issuer is provided, the internal default function will be used instead.

                        X509_STORE_get_verify_cb(), X509_STORE_CTX_get_verify(), X509_STORE_get_get_issuer(), X509_STORE_get_check_issued(), X509_STORE_get_check_revocation(), X509_STORE_get_get_crl(), X509_STORE_get_check_crl(), X509_STORE_set_verify(), X509_STORE_set_get_issuer(), X509_STORE_get_cert_crl(), X509_STORE_get_check_policy(), X509_STORE_get_lookup_certs(), X509_STORE_get_lookup_crls() and X509_STORE_get_cleanup() all return the function pointer assigned with X509_STORE_set_check_issued(), X509_STORE_set_check_revocation(), X509_STORE_set_get_crl(), X509_STORE_set_check_crl(), X509_STORE_set_cert_crl(), X509_STORE_set_check_policy(), X509_STORE_set_lookup_certs(), X509_STORE_set_lookup_crls() and X509_STORE_set_cleanup(), or NULL if no assignment has been made.

                        X509_STORE_set_verify_cb_func(), X509_STORE_set_verify_func() and X509_STORE_set_lookup_crls_cb() are aliases for X509_STORE_set_verify_cb(), X509_STORE_set_verify() and X509_STORE_set_lookup_crls, available as macros for backward compatibility.

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#notes","title":"NOTES","text":"

                        All the callbacks from a X509_STORE are inherited by the corresponding X509_STORE_CTX structure when it is initialized. See X509_STORE_CTX_set_verify_cb(3) for further details.

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#bugs","title":"BUGS","text":"

                        The macro version of this function was the only one available before OpenSSL 1.0.0.

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#return-values","title":"RETURN VALUES","text":"

                        The X509_STORE_set_*() functions do not return a value.

                        The X509_STORE_get_*() functions return a pointer of the appropriate function type.

                        X509_STORE_CTX_get1_issuer() returns 1 if a suitable certificate is found, 0 if not found, -1 on other error.

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#see-also","title":"SEE ALSO","text":"

                        X509_STORE_CTX_set_verify_cb(3), X509_STORE_CTX_get0_chain(3), X509_STORE_CTX_verify_cb(3), X509_STORE_CTX_verify_fn(3), CMS_verify(3)

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#history","title":"HISTORY","text":"

                        The X509_STORE_set_verify_cb() function was added in OpenSSL 1.0.0.

                        The functions X509_STORE_set_verify_cb(), X509_STORE_get_verify_cb(), X509_STORE_set_verify(), X509_STORE_CTX_get_verify(), X509_STORE_set_get_issuer(), X509_STORE_get_get_issuer(), X509_STORE_set_check_issued(), X509_STORE_get_check_issued(), X509_STORE_set_check_revocation(), X509_STORE_get_check_revocation(), X509_STORE_set_get_crl(), X509_STORE_get_get_crl(), X509_STORE_set_check_crl(), X509_STORE_get_check_crl(), X509_STORE_set_cert_crl(), X509_STORE_get_cert_crl(), X509_STORE_set_check_policy(), X509_STORE_get_check_policy(), X509_STORE_set_lookup_certs(), X509_STORE_get_lookup_certs(), X509_STORE_set_lookup_crls(), X509_STORE_get_lookup_crls(), X509_STORE_set_cleanup() and X509_STORE_get_cleanup() were added in OpenSSL 1.1.0.

                        "},{"location":"man3/X509_STORE_set_verify_cb_func/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/","title":"X509_VERIFY_PARAM_set_flags","text":""},{"location":"man3/X509_VERIFY_PARAM_set_flags/#name","title":"NAME","text":"

                        X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_get_inh_flags, X509_VERIFY_PARAM_set_inh_flags, X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_auth_level, X509_VERIFY_PARAM_get_auth_level, X509_VERIFY_PARAM_set_time, X509_VERIFY_PARAM_get_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies, X509_VERIFY_PARAM_get0_host, X509_VERIFY_PARAM_set1_host, X509_VERIFY_PARAM_add1_host, X509_VERIFY_PARAM_set_hostflags, X509_VERIFY_PARAM_get_hostflags, X509_VERIFY_PARAM_get0_peername, X509_VERIFY_PARAM_get0_email, X509_VERIFY_PARAM_set1_email, X509_VERIFY_PARAM_set1_ip, X509_VERIFY_PARAM_get1_ip_asc, X509_VERIFY_PARAM_set1_ip_asc - X509 verification parameters

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\nint X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param,\n                                unsigned long flags);\nint X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,\n                                  unsigned long flags);\nunsigned long X509_VERIFY_PARAM_get_flags(const X509_VERIFY_PARAM *param);\n\nint X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param,\n                                    uint32_t flags);\nuint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param);\n\nint X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);\nint X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);\n\nvoid X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);\ntime_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param);\n\nint X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,\n                                  ASN1_OBJECT *policy);\nint X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,\n                                    STACK_OF(ASN1_OBJECT) *policies);\n\nvoid X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);\nint X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);\n\nvoid X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param,\n                                      int auth_level);\nint X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param);\n\nchar *X509_VERIFY_PARAM_get0_host(X509_VERIFY_PARAM *param, int n);\nint X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,\n                                const char *name, size_t namelen);\nint X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,\n                                const char *name, size_t namelen);\nvoid X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,\n                                     unsigned int flags);\nunsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param);\nchar *X509_VERIFY_PARAM_get0_peername(const X509_VERIFY_PARAM *param);\nchar *X509_VERIFY_PARAM_get0_email(X509_VERIFY_PARAM *param);\nint X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,\n                                 const char *email, size_t emaillen);\nchar *X509_VERIFY_PARAM_get1_ip_asc(X509_VERIFY_PARAM *param);\nint X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,\n                              const unsigned char *ip, size_t iplen);\nint X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc);\n
                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#description","title":"DESCRIPTION","text":"

                        These functions manipulate the X509_VERIFY_PARAM structure associated with a certificate verification operation.

                        The X509_VERIFY_PARAM_set_flags() function sets the flags in param by oring it with flags. See \"VERIFICATION FLAGS\" for a complete description of values the flags parameter can take.

                        X509_VERIFY_PARAM_get_flags() returns the flags in param.

                        X509_VERIFY_PARAM_get_inh_flags() returns the inheritance flags in param which specifies how verification flags are copied from one structure to another. X509_VERIFY_PARAM_set_inh_flags() sets the inheritance flags. See the INHERITANCE FLAGS section for a description of these bits.

                        X509_VERIFY_PARAM_clear_flags() clears the flags flags in param.

                        X509_VERIFY_PARAM_set_purpose() sets the verification purpose in param to purpose. This determines the acceptable purpose of the certificate chain, for example X509_PURPOSE_SSL_CLIENT. The purpose requirement is cleared if purpose is 0.

                        X509_VERIFY_PARAM_set_trust() sets the trust setting in param to trust.

                        X509_VERIFY_PARAM_set_time() sets the verification time in param to t. Normally the current time is used.

                        X509_VERIFY_PARAM_add0_policy() adds policy to the acceptable policy set. Contrary to preexisting documentation of this function it does not enable policy checking.

                        X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled by default) and sets the acceptable policy set to policies. Any existing policy set is cleared. The policies parameter can be NULL to clear an existing policy set.

                        X509_VERIFY_PARAM_set_depth() sets the maximum verification depth to depth. That is the maximum number of intermediate CA certificates that can appear in a chain. A maximal depth chain contains 2 more certificates than the limit, since neither the end-entity certificate nor the trust-anchor count against this limit. Thus a depth limit of 0 only allows the end-entity certificate to be signed directly by the trust anchor, while with a depth limit of 1 there can be one intermediate CA certificate between the trust anchor and the end-entity certificate.

                        X509_VERIFY_PARAM_set_auth_level() sets the authentication security level to auth_level. The authentication security level determines the acceptable signature and public key strength when verifying certificate chains. For a certificate chain to validate, the public keys of all the certificates must meet the specified security level. The signature algorithm security level is not enforced for the chain's trust anchor certificate, which is either directly trusted or validated by means other than its signature. See SSL_CTX_set_security_level(3) for the definitions of the available levels. The default security level is -1, or \"not set\". At security level 0 or lower all algorithms are acceptable. Security level 1 requires at least 80-bit-equivalent security and is broadly interoperable, though it will, for example, reject MD5 signatures or RSA keys shorter than 1024 bits.

                        X509_VERIFY_PARAM_get0_host() returns the nth expected DNS hostname that has been set using X509_VERIFY_PARAM_set1_host() or X509_VERIFY_PARAM_add1_host(). To obtain all names start with n = 0 and increment n as long as no NULL pointer is returned.

                        X509_VERIFY_PARAM_set1_host() sets the expected DNS hostname to name clearing any previously specified hostname. If name is NULL, or empty the list of hostnames is cleared, and name checks are not performed on the peer certificate. If name is NUL-terminated, namelen may be zero, otherwise namelen must be set to the length of name.

                        When a hostname is specified, certificate verification automatically invokes X509_check_host(3) with flags equal to the flags argument given to X509_VERIFY_PARAM_set_hostflags() (default zero). Applications are strongly advised to use this interface in preference to explicitly calling X509_check_host(3), hostname checks may be out of scope with the DANE-EE(3) certificate usage, and the internal check will be suppressed as appropriate when DANE verification is enabled.

                        When the subject CommonName will not be ignored, whether as a result of the X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT host flag, or because no DNS subject alternative names are present in the certificate, any DNS name constraints in issuer certificates apply to the subject CommonName as well as the subject alternative name extension.

                        When the subject CommonName will be ignored, whether as a result of the X509_CHECK_FLAG_NEVER_CHECK_SUBJECT host flag, or because some DNS subject alternative names are present in the certificate, DNS name constraints in issuer certificates will not be applied to the subject DN. As described in X509_check_host(3) the X509_CHECK_FLAG_NEVER_CHECK_SUBJECT flag takes precedence over the X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT flag.

                        X509_VERIFY_PARAM_get_hostflags() returns any host flags previously set via a call to X509_VERIFY_PARAM_set_hostflags().

                        X509_VERIFY_PARAM_add1_host() adds name as an additional reference identifier that can match the peer's certificate. Any previous names set via X509_VERIFY_PARAM_set1_host() or X509_VERIFY_PARAM_add1_host() are retained, no change is made if name is NULL or empty. When multiple names are configured, the peer is considered verified when any name matches.

                        X509_VERIFY_PARAM_get0_peername() returns the DNS hostname or subject CommonName from the peer certificate that matched one of the reference identifiers. When wildcard matching is not disabled, or when a reference identifier specifies a parent domain (starts with \".\") rather than a hostname, the peer name may be a wildcard name or a sub-domain of the reference identifier respectively. The return string is allocated by the library and is no longer valid once the associated param argument is freed. Applications must not free the return value.

                        X509_VERIFY_PARAM_get0_email() returns the expected RFC822 email address.

                        X509_VERIFY_PARAM_set1_email() sets the expected RFC822 email address to email. If email is NUL-terminated, emaillen may be zero, otherwise emaillen must be set to the length of email. When an email address is specified, certificate verification automatically invokes X509_check_email(3).

                        X509_VERIFY_PARAM_get1_ip_asc() returns the expected IP address as a string. The caller is responsible for freeing it.

                        X509_VERIFY_PARAM_set1_ip() sets the expected IP address to ip. The ip argument is in binary format, in network byte-order and iplen must be set to 4 for IPv4 and 16 for IPv6. When an IP address is specified, certificate verification automatically invokes X509_check_ip(3).

                        X509_VERIFY_PARAM_set1_ip_asc() sets the expected IP address to ipasc. The ipasc argument is a NUL-terminal ASCII string: dotted decimal quad for IPv4 and colon-separated hexadecimal for IPv6. The condensed \"::\" notation is supported for IPv6 addresses.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#return-values","title":"RETURN VALUES","text":"

                        X509_VERIFY_PARAM_set_flags(), X509_VERIFY_PARAM_clear_flags(), X509_VERIFY_PARAM_set_inh_flags(), X509_VERIFY_PARAM_set_purpose(), X509_VERIFY_PARAM_set_trust(), X509_VERIFY_PARAM_add0_policy() X509_VERIFY_PARAM_set1_policies(), X509_VERIFY_PARAM_set1_host(), X509_VERIFY_PARAM_add1_host(), X509_VERIFY_PARAM_set1_email(), X509_VERIFY_PARAM_set1_ip() and X509_VERIFY_PARAM_set1_ip_asc() return 1 for success and 0 for failure.

                        X509_VERIFY_PARAM_get0_host(), X509_VERIFY_PARAM_get0_email(), and X509_VERIFY_PARAM_get1_ip_asc(), return the string pointers specified above or NULL if the respective value has not been set or on error.

                        X509_VERIFY_PARAM_get_flags() returns the current verification flags.

                        X509_VERIFY_PARAM_get_hostflags() returns any current host flags.

                        X509_VERIFY_PARAM_get_inh_flags() returns the current inheritance flags.

                        X509_VERIFY_PARAM_set_time() and X509_VERIFY_PARAM_set_depth() do not return values.

                        X509_VERIFY_PARAM_get_depth() returns the current verification depth.

                        X509_VERIFY_PARAM_get_auth_level() returns the current authentication security level.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#verification-flags","title":"VERIFICATION FLAGS","text":"

                        The verification flags consists of zero or more of the following flags ored together.

                        X509_V_FLAG_CRL_CHECK enables CRL checking for the certificate chain leaf certificate. An error occurs if a suitable CRL cannot be found.

                        X509_V_FLAG_CRL_CHECK_ALL enables CRL checking for the entire certificate chain.

                        X509_V_FLAG_IGNORE_CRITICAL disables critical extension checking. By default any unhandled critical extensions in certificates or (if checked) CRLs result in a fatal error. If this flag is set unhandled critical extensions are ignored. WARNING setting this option for anything other than debugging purposes can be a security risk. Finer control over which extensions are supported can be performed in the verification callback.

                        The X509_V_FLAG_X509_STRICT flag disables workarounds for some broken certificates and makes the verification strictly apply X509 rules.

                        X509_V_FLAG_ALLOW_PROXY_CERTS enables proxy certificate verification.

                        X509_V_FLAG_POLICY_CHECK enables certificate policy checking, by default no policy checking is performed. Additional information is sent to the verification callback relating to policy checking.

                        X509_V_FLAG_EXPLICIT_POLICY, X509_V_FLAG_INHIBIT_ANY and X509_V_FLAG_INHIBIT_MAP set the require explicit policy, inhibit any policy and inhibit policy mapping flags respectively as defined in RFC3280. Policy checking is automatically enabled if any of these flags are set.

                        If X509_V_FLAG_NOTIFY_POLICY is set and the policy checking is successful a special status code is set to the verification callback. This permits it to examine the valid policy tree and perform additional checks or simply log it for debugging purposes.

                        By default some additional features such as indirect CRLs and CRLs signed by different keys are disabled. If X509_V_FLAG_EXTENDED_CRL_SUPPORT is set they are enabled.

                        If X509_V_FLAG_USE_DELTAS is set delta CRLs (if present) are used to determine certificate status. If not set deltas are ignored.

                        X509_V_FLAG_CHECK_SS_SIGNATURE requests checking the signature of the last certificate in a chain if the certificate is supposedly self-signed. This is prohibited and will result in an error if it is a non-conforming CA certificate with key usage restrictions not including the keyCertSign bit. By default this check is disabled because it doesn't add any additional security but in some cases applications might want to check the signature anyway. A side effect of not checking the self-signature of such a certificate is that disabled or unsupported message digests used for the signature are not treated as fatal errors.

                        When X509_V_FLAG_TRUSTED_FIRST is set, which is always the case since OpenSSL 1.1.0, construction of the certificate chain in X509_verify_cert(3) searches the trust store for issuer certificates before searching the provided untrusted certificates. Local issuer certificates are often more likely to satisfy local security requirements and lead to a locally trusted root. This is especially important when some certificates in the trust store have explicit trust settings (see \"TRUST SETTINGS\" in openssl-x509(1)).

                        The X509_V_FLAG_NO_ALT_CHAINS flag could have been used before OpenSSL 1.1.0 to suppress checking for alternative chains. By default, unless X509_V_FLAG_TRUSTED_FIRST is set, when building a certificate chain, if the first certificate chain found is not trusted, then OpenSSL will attempt to replace untrusted certificates supplied by the peer with certificates from the trust store to see if an alternative chain can be found that is trusted. As of OpenSSL 1.1.0, with X509_V_FLAG_TRUSTED_FIRST always set, this option has no effect.

                        The X509_V_FLAG_PARTIAL_CHAIN flag causes non-self-signed certificates in the trust store to be treated as trust anchors, in the same way as self-signed root CA certificates. This makes it possible to trust self-issued certificates as well as certificates issued by an intermediate CA without having to trust their ancestor root CA. With OpenSSL 1.1.0 and later and X509_V_FLAG_PARTIAL_CHAIN set, chain construction stops as soon as the first certificate contained in the trust store is added to the chain, whether that certificate is a self-signed \"root\" certificate or a not self-signed \"intermediate\" or self-issued certificate. Thus, when an intermediate certificate is found in the trust store, the verified chain passed to callbacks may be shorter than it otherwise would be without the X509_V_FLAG_PARTIAL_CHAIN flag.

                        The X509_V_FLAG_NO_CHECK_TIME flag suppresses checking the validity period of certificates and CRLs against the current time. If X509_VERIFY_PARAM_set_time() is used to specify a verification time, the check is not suppressed.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#inheritance-flags","title":"INHERITANCE FLAGS","text":"

                        These flags specify how parameters are \"inherited\" from one structure to another.

                        If X509_VP_FLAG_ONCE is set then the current setting is zeroed after the next call.

                        If X509_VP_FLAG_LOCKED is set then no values are copied. This overrides all of the following flags.

                        If X509_VP_FLAG_DEFAULT is set then anything set in the source is copied to the destination. Effectively the values in \"to\" become default values which will be used only if nothing new is set in \"from\". This is the default.

                        If X509_VP_FLAG_OVERWRITE is set then all value are copied across whether they are set or not. Flags is still Ored though.

                        If X509_VP_FLAG_RESET_FLAGS is set then the flags value is copied instead of ORed.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#notes","title":"NOTES","text":"

                        The above functions should be used to manipulate verification parameters instead of functions which work in specific structures such as X509_STORE_CTX_set_flags() which are likely to be deprecated in a future release.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#bugs","title":"BUGS","text":"

                        Delta CRL checking is currently primitive. Only a single delta can be used and (partly due to limitations of X509_STORE) constructed CRLs are not maintained.

                        If CRLs checking is enable CRLs are expected to be available in the corresponding X509_STORE structure. No attempt is made to download CRLs from the CRL distribution points extension.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#examples","title":"EXAMPLES","text":"

                        Enable CRL checking when performing certificate verification during SSL connections associated with an SSL_CTX structure ctx:

                        X509_VERIFY_PARAM *param;\n\nparam = X509_VERIFY_PARAM_new();\nX509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);\nSSL_CTX_set1_param(ctx, param);\nX509_VERIFY_PARAM_free(param);\n
                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#see-also","title":"SEE ALSO","text":"

                        X509_verify_cert(3), X509_check_host(3), X509_check_email(3), X509_check_ip(3), openssl-x509(1)

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#history","title":"HISTORY","text":"

                        The X509_V_FLAG_NO_ALT_CHAINS flag was added in OpenSSL 1.1.0. The flag X509_V_FLAG_CB_ISSUER_CHECK was deprecated in OpenSSL 1.1.0 and has no effect.

                        The X509_VERIFY_PARAM_get_hostflags() function was added in OpenSSL 1.1.0i.

                        The X509_VERIFY_PARAM_get0_host(), X509_VERIFY_PARAM_get0_email(), and X509_VERIFY_PARAM_get1_ip_asc() functions were added in OpenSSL 3.0.

                        The function X509_VERIFY_PARAM_add0_policy() was historically documented as enabling policy checking however the implementation has never done this. The documentation was changed to align with the implementation.

                        "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2009-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_add_cert/","title":"X509_add_cert","text":""},{"location":"man3/X509_add_cert/#name","title":"NAME","text":"

                        X509_add_cert, X509_add_certs - X509 certificate list addition functions

                        "},{"location":"man3/X509_add_cert/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags);\nint X509_add_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs, int flags);\n
                        "},{"location":"man3/X509_add_cert/#description","title":"DESCRIPTION","text":"

                        X509_add_cert() adds a certificate cert to the given list sk.

                        X509_add_certs() adds a list of certificate certs to the given list sk. The certs argument may be NULL, which implies no effect. It does not modify the list certs but in case the X509_ADD_FLAG_UP_REF flag (described below) is set the reference counters of those of its members added to sk are increased.

                        Both these functions have a flags parameter, which is used to control details of the operation.

                        The value X509_ADD_FLAG_DEFAULT, which equals 0, means no special semantics.

                        If X509_ADD_FLAG_UP_REF is set then the reference counts of those certificates added successfully are increased.

                        If X509_ADD_FLAG_PREPEND is set then the certificates are prepended to sk. By default they are appended to sk. In both cases the original order of the added certificates is preserved.

                        If X509_ADD_FLAG_NO_DUP is set then certificates already contained in sk, which is determined using X509_cmp(3), are ignored.

                        If X509_ADD_FLAG_NO_SS is set then certificates that are marked self-signed, which is determined using X509_self_signed(3), are ignored.

                        "},{"location":"man3/X509_add_cert/#return-values","title":"RETURN VALUES","text":"

                        Both functions return 1 for success and 0 for failure.

                        "},{"location":"man3/X509_add_cert/#notes","title":"NOTES","text":"

                        If X509_add_certs() is used with the flags X509_ADD_FLAG_NO_DUP or X509_ADD_FLAG_NO_SS it is advisable to use also X509_ADD_FLAG_UP_REF because otherwise likely not for all members of the certs list the ownership is transferred to the list of certificates sk.

                        Care should also be taken in case the certs argument equals sk.

                        "},{"location":"man3/X509_add_cert/#see-also","title":"SEE ALSO","text":"

                        X509_cmp(3) X509_self_signed(3)

                        "},{"location":"man3/X509_add_cert/#history","title":"HISTORY","text":"

                        The functions X509_add_cert() and X509_add_certs() were added in OpenSSL 3.0.

                        "},{"location":"man3/X509_add_cert/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_check_ca/","title":"X509_check_ca","text":""},{"location":"man3/X509_check_ca/#name","title":"NAME","text":"

                        X509_check_ca - check if given certificate is CA certificate

                        "},{"location":"man3/X509_check_ca/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nint X509_check_ca(X509 *cert);\n
                        "},{"location":"man3/X509_check_ca/#description","title":"DESCRIPTION","text":"

                        This function checks if given certificate is CA certificate (can be used to sign other certificates). The certificate must be a complete certificate otherwise an error is returned.

                        "},{"location":"man3/X509_check_ca/#return-values","title":"RETURN VALUES","text":"

                        Function return 0, if it is not CA certificate, 1 if it is proper X509v3 CA certificate with basicConstraints extension CA:TRUE, 3, if it is self-signed X509 v1 certificate, 4, if it is certificate with keyUsage extension with bit keyCertSign set, but without basicConstraints, and 5 if it has outdated Netscape Certificate Type extension telling that it is CA certificate.

                        This function will also return 0 on error.

                        Actually, any nonzero value means that this certificate could have been used to sign other certificates.

                        "},{"location":"man3/X509_check_ca/#see-also","title":"SEE ALSO","text":"

                        X509_verify_cert(3), X509_check_issued(3), X509_check_purpose(3)

                        "},{"location":"man3/X509_check_ca/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_check_host/","title":"X509_check_host","text":""},{"location":"man3/X509_check_host/#name","title":"NAME","text":"

                        X509_check_host, X509_check_email, X509_check_ip, X509_check_ip_asc - X.509 certificate matching

                        "},{"location":"man3/X509_check_host/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nint X509_check_host(X509 *, const char *name, size_t namelen,\n                    unsigned int flags, char **peername);\nint X509_check_email(X509 *, const char *address, size_t addresslen,\n                     unsigned int flags);\nint X509_check_ip(X509 *, const unsigned char *address, size_t addresslen,\n                  unsigned int flags);\nint X509_check_ip_asc(X509 *, const char *address, unsigned int flags);\n
                        "},{"location":"man3/X509_check_host/#description","title":"DESCRIPTION","text":"

                        The certificate matching functions are used to check whether a certificate matches a given hostname, email address, or IP address. The validity of the certificate and its trust level has to be checked by other means.

                        X509_check_host() checks if the certificate Subject Alternative Name (SAN) or Subject CommonName (CN) matches the specified hostname, which must be encoded in the preferred name syntax described in section 3.5 of RFC 1034. By default, wildcards are supported and they match only in the left-most label; but they may match part of that label with an explicit prefix or suffix. For example, by default, the host name \"www.example.com\" would match a certificate with a SAN or CN value of \"*.example.com\", \"w*.example.com\" or \"*w.example.com\".

                        Per section 6.4.2 of RFC 6125, name values representing international domain names must be given in A-label form. The namelen argument must be the number of characters in the name string or zero in which case the length is calculated with strlen(name). When name starts with a dot (e.g. \".example.com\"), it will be matched by a certificate valid for any sub-domain of name, (see also X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS below).

                        When the certificate is matched, and peername is not NULL, a pointer to a copy of the matching SAN or CN from the peer certificate is stored at the address passed in peername. The application is responsible for freeing the peername via OPENSSL_free() when it is no longer needed.

                        X509_check_email() checks if the certificate matches the specified email address. The mailbox syntax of RFC 822 is supported, comments are not allowed, and no attempt is made to normalize quoted characters. The mailbox syntax of RFC 6531 is supported for SmtpUTF8Mailbox address in subjectAltName according to RFC 8398, with similar limitations as for RFC 822 syntax, and no attempt is made to convert from A-label to U-label before comparison. The addresslen argument must be the number of characters in the address string or zero in which case the length is calculated with strlen(address).

                        X509_check_ip() checks if the certificate matches a specified IPv4 or IPv6 address. The address array is in binary format, in network byte order. The length is either 4 (IPv4) or 16 (IPv6). Only explicitly marked addresses in the certificates are considered; IP addresses stored in DNS names and Common Names are ignored. There are currently no flags that would affect the behavior of this call.

                        X509_check_ip_asc() is similar, except that the NUL-terminated string address is first converted to the internal representation.

                        The flags argument is usually 0. It can be the bitwise OR of the flags:

                        • X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT,
                        • X509_CHECK_FLAG_NEVER_CHECK_SUBJECT,
                        • X509_CHECK_FLAG_NO_WILDCARDS,
                        • X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS,
                        • X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS.
                        • X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS.

                        The X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT flag causes the function to consider the subject DN even if the certificate contains at least one subject alternative name of the right type (DNS name or email address as appropriate); the default is to ignore the subject DN when at least one corresponding subject alternative names is present.

                        The X509_CHECK_FLAG_NEVER_CHECK_SUBJECT flag causes the function to never consider the subject DN even if the certificate contains no subject alternative names of the right type (DNS name or email address as appropriate); the default is to use the subject DN when no corresponding subject alternative names are present. If both X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT and X509_CHECK_FLAG_NEVER_CHECK_SUBJECT are specified, the latter takes precedence and the subject DN is not checked for matching names.

                        If set, X509_CHECK_FLAG_NO_WILDCARDS disables wildcard expansion; this only applies to X509_check_host.

                        If set, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS suppresses support for \"*\" as wildcard pattern in labels that have a prefix or suffix, such as: \"www*\" or \"*www\"; this only applies to X509_check_host.

                        If set, X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS allows a \"*\" that constitutes the complete label of a DNS name (e.g. \"*.example.com\") to match more than one label in name; this flag only applies to X509_check_host.

                        If set, X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS restricts name values which start with \".\", that would otherwise match any sub-domain in the peer certificate, to only match direct child sub-domains. Thus, for instance, with this flag set a name of \".example.com\" would match a peer certificate with a DNS name of \"www.example.com\", but would not match a peer certificate with a DNS name of \"www.sub.example.com\"; this flag only applies to X509_check_host.

                        "},{"location":"man3/X509_check_host/#return-values","title":"RETURN VALUES","text":"

                        The functions return 1 for a successful match, 0 for a failed match and -1 for an internal error: typically a memory allocation failure or an ASN.1 decoding error.

                        All functions can also return -2 if the input is malformed. For example, X509_check_host() returns -2 if the provided name contains embedded NULs.

                        "},{"location":"man3/X509_check_host/#notes","title":"NOTES","text":"

                        Applications are encouraged to use X509_VERIFY_PARAM_set1_host() rather than explicitly calling X509_check_host(3). Hostname checks may be out of scope with the DANE-EE(3) certificate usage, and the internal checks will be suppressed as appropriate when DANE support is enabled.

                        "},{"location":"man3/X509_check_host/#see-also","title":"SEE ALSO","text":"

                        SSL_get_verify_result(3), X509_VERIFY_PARAM_set1_host(3), X509_VERIFY_PARAM_add1_host(3), X509_VERIFY_PARAM_set1_email(3), X509_VERIFY_PARAM_set1_ip(3)

                        "},{"location":"man3/X509_check_host/#history","title":"HISTORY","text":"

                        These functions were added in OpenSSL 1.0.2.

                        "},{"location":"man3/X509_check_host/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2012-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_check_issued/","title":"X509_check_issued","text":""},{"location":"man3/X509_check_issued/#name","title":"NAME","text":"

                        X509_check_issued - checks if certificate is apparently issued by another certificate

                        "},{"location":"man3/X509_check_issued/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nint X509_check_issued(X509 *issuer, X509 *subject);\n
                        "},{"location":"man3/X509_check_issued/#description","title":"DESCRIPTION","text":"

                        X509_check_issued() checks if certificate subject was apparently issued using (CA) certificate issuer. This function takes into account not only matching of the issuer field of subject with the subject field of issuer, but also compares all sub-fields of the authorityKeyIdentifier extension of subject, as far as present, with the respective subjectKeyIdentifier, serial number, and issuer fields of issuer, as far as present. It also checks if the keyUsage field (if present) of issuer allows certificate signing. It does not actually check the certificate signature. An error is returned if the issuer or the subject are incomplete certificates.

                        "},{"location":"man3/X509_check_issued/#return-values","title":"RETURN VALUES","text":"

                        X509_check_issued() returns X509_V_OK if all checks are successful or some X509_V_ERR* constant to indicate an error.

                        "},{"location":"man3/X509_check_issued/#see-also","title":"SEE ALSO","text":"

                        X509_verify_cert(3), X509_verify(3), X509_check_ca(3), openssl-verify(1), X509_self_signed(3)

                        "},{"location":"man3/X509_check_issued/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_check_private_key/","title":"X509_check_private_key","text":""},{"location":"man3/X509_check_private_key/#name","title":"NAME","text":"

                        X509_check_private_key, X509_REQ_check_private_key - check the consistency of a private key with the public key in an X509 certificate or certificate request

                        "},{"location":"man3/X509_check_private_key/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_check_private_key(X509 *x, EVP_PKEY *k);\n\nint X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k);\n
                        "},{"location":"man3/X509_check_private_key/#description","title":"DESCRIPTION","text":"

                        X509_check_private_key() function checks the consistency of private key k with the public key in x.

                        X509_REQ_check_private_key() is equivalent to X509_check_private_key() except that x represents a certificate request of structure X509_REQ.

                        "},{"location":"man3/X509_check_private_key/#return-values","title":"RETURN VALUES","text":"

                        X509_check_private_key() and X509_REQ_check_private_key() return 1 if the keys match each other, and 0 if not.

                        If the key is invalid or an error occurred, the reason code can be obtained using ERR_get_error(3).

                        "},{"location":"man3/X509_check_private_key/#bugs","title":"BUGS","text":"

                        The check_private_key functions don't check if k itself is indeed a private key or not. It merely compares the public materials (e.g. exponent and modulus of an RSA key) and/or key parameters (e.g. EC params of an EC key) of a key pair. So if you pass a public key to these functions in k, it will return success.

                        "},{"location":"man3/X509_check_private_key/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3)

                        "},{"location":"man3/X509_check_private_key/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_check_purpose/","title":"X509_check_purpose","text":""},{"location":"man3/X509_check_purpose/#name","title":"NAME","text":"

                        X509_check_purpose - Check the purpose of a certificate

                        "},{"location":"man3/X509_check_purpose/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nint X509_check_purpose(X509 *x, int id, int ca);\n
                        "},{"location":"man3/X509_check_purpose/#description","title":"DESCRIPTION","text":"

                        This function checks if certificate x was created with the purpose represented by id. If ca is nonzero, then certificate x is checked to determine if it's a possible CA with various levels of certainty possibly returned. The certificate x must be a complete certificate otherwise the function returns an error.

                        Below are the potential ID's that can be checked:

                        # # define X509_PURPOSE_SSL_CLIENT 1 # # define X509_PURPOSE_SSL_SERVER 2 # # define X509_PURPOSE_NS_SSL_SERVER 3 # # define X509_PURPOSE_SMIME_SIGN 4 # # define X509_PURPOSE_SMIME_ENCRYPT 5 # # define X509_PURPOSE_CRL_SIGN 6 # # define X509_PURPOSE_ANY 7 # # define X509_PURPOSE_OCSP_HELPER 8 # # define X509_PURPOSE_TIMESTAMP_SIGN 9

                        The checks performed take into account the X.509 extensions keyUsage, extendedKeyUsage, and basicConstraints.

                        "},{"location":"man3/X509_check_purpose/#return-values","title":"RETURN VALUES","text":"

                        For non-CA checks

                        • -1 an error condition has occurred
                        • 1 if the certificate was created to perform the purpose represented by id
                        • 0 if the certificate was not created to perform the purpose represented by id

                        For CA checks the below integers could be returned with the following meanings:

                        • -1 an error condition has occurred
                        • 0 not a CA or does not have the purpose represented by id
                        • 1 is a CA.
                        • 2 Only possible in old versions of openSSL when basicConstraints are absent. New versions will not return this value. May be a CA
                        • 3 basicConstraints absent but self signed V1.
                        • 4 basicConstraints absent but keyUsage present and keyCertSign asserted.
                        • 5 legacy Netscape specific CA Flags present
                        "},{"location":"man3/X509_check_purpose/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_cmp/","title":"X509_cmp","text":""},{"location":"man3/X509_cmp/#name","title":"NAME","text":"

                        X509_cmp, X509_NAME_cmp, X509_issuer_and_serial_cmp, X509_issuer_name_cmp, X509_subject_name_cmp, X509_CRL_cmp, X509_CRL_match - compare X509 certificates and related values

                        "},{"location":"man3/X509_cmp/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_cmp(const X509 *a, const X509 *b);\nint X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);\nint X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);\nint X509_issuer_name_cmp(const X509 *a, const X509 *b);\nint X509_subject_name_cmp(const X509 *a, const X509 *b);\nint X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);\nint X509_CRL_match(const X509_CRL *a, const X509_CRL *b);\n
                        "},{"location":"man3/X509_cmp/#description","title":"DESCRIPTION","text":"

                        This set of functions are used to compare X509 objects, including X509 certificates, X509 CRL objects and various values in an X509 certificate.

                        The X509_cmp() function compares two X509 objects indicated by parameters a and b. The comparison is based on the memcmp result of the hash values of two X509 objects and the canonical (DER) encoding values.

                        The X509_NAME_cmp() function compares two X509_NAME objects indicated by parameters a and b. The comparison is based on the memcmp result of the canonical (DER) encoding values of the two objects using i2d_X509_NAME(3). This procedure adheres to the matching rules for Distinguished Names (DN) given in RFC 4517 section 4.2.15 and RFC 5280 section 7.1. In particular, the order of Relative Distinguished Names (RDNs) is relevant. On the other hand, if an RDN is multi-valued, i.e., it contains a set of AttributeValueAssertions (AVAs), its members are effectively not ordered.

                        The X509_issuer_and_serial_cmp() function compares the serial number and issuer values in the given X509 objects a and b.

                        The X509_issuer_name_cmp(), X509_subject_name_cmp() and X509_CRL_cmp() functions are effectively wrappers of the X509_NAME_cmp() function. These functions compare issuer names and subject names of the objects, or issuers of X509_CRL objects, respectively.

                        The X509_CRL_match() function compares two X509_CRL objects. Unlike the X509_CRL_cmp() function, this function compares the whole CRL content instead of just the issuer name.

                        "},{"location":"man3/X509_cmp/#return-values","title":"RETURN VALUES","text":"

                        The X509 comparison functions return -1, 0, or 1 if object a is found to be less than, to match, or be greater than object b, respectively.

                        X509_NAME_cmp(), X509_issuer_and_serial_cmp(), X509_issuer_name_cmp(), X509_subject_name_cmp(), X509_CRL_cmp(), and X509_CRL_match() may return -2 to indicate an error.

                        "},{"location":"man3/X509_cmp/#notes","title":"NOTES","text":"

                        These functions in fact utilize the underlying memcmp of the C library to do the comparison job. Data to be compared varies from DER encoding data, hash value or ASN1_STRING. The sign of the comparison can be used to order the objects but it does not have a special meaning in some cases.

                        X509_NAME_cmp() and wrappers utilize the value -2 to indicate errors in some circumstances, which could cause confusion for the applications.

                        "},{"location":"man3/X509_cmp/#see-also","title":"SEE ALSO","text":"

                        i2d_X509_NAME(3), i2d_X509(3)

                        "},{"location":"man3/X509_cmp/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_cmp_time/","title":"X509_cmp_time","text":""},{"location":"man3/X509_cmp_time/#name","title":"NAME","text":"

                        X509_cmp_time, X509_cmp_current_time, X509_cmp_timeframe, X509_time_adj, X509_time_adj_ex, X509_gmtime_adj - X509 time functions

                        "},{"location":"man3/X509_cmp_time/#synopsis","title":"SYNOPSIS","text":"
                        int X509_cmp_time(const ASN1_TIME *asn1_time, time_t *in_tm);\nint X509_cmp_current_time(const ASN1_TIME *asn1_time);\nint X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm,\n                       const ASN1_TIME *start, const ASN1_TIME *end);\nASN1_TIME *X509_time_adj(ASN1_TIME *asn1_time, long offset_sec, time_t *in_tm);\nASN1_TIME *X509_time_adj_ex(ASN1_TIME *asn1_time, int offset_day, long\n                            offset_sec, time_t *in_tm);\nASN1_TIME *X509_gmtime_adj(ASN1_TIME *asn1_time, long offset_sec);\n
                        "},{"location":"man3/X509_cmp_time/#description","title":"DESCRIPTION","text":"

                        X509_cmp_time() compares the ASN1_TIME in asn1_time with the time in <in_tm>.

                        X509_cmp_current_time() compares the ASN1_TIME in asn1_time with the current time, expressed as time_t.

                        X509_cmp_timeframe() compares the given time period with the reference time included in the verification parameters vpm if they are not NULL and contain X509_V_FLAG_USE_CHECK_TIME; else the current time is used as reference time.

                        X509_time_adj_ex() sets the ASN1_TIME structure asn1_time to the time offset_day and offset_sec after in_tm.

                        X509_time_adj() sets the ASN1_TIME structure asn1_time to the time offset_sec after in_tm. This method can only handle second offsets up to the capacity of long, so the newer X509_time_adj_ex() API should be preferred.

                        In both methods, if asn1_time is NULL, a new ASN1_TIME structure is allocated and returned.

                        In all methods, if in_tm is NULL, the current time, expressed as time_t, is used.

                        asn1_time must satisfy the ASN1_TIME format mandated by RFC 5280, i.e., its format must be either YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ.

                        X509_gmtime_adj() sets the ASN1_TIME structure asn1_time to the time offset_sec after the current time. It is equivalent to calling X509_time_adj() with the last parameter as NULL.

                        "},{"location":"man3/X509_cmp_time/#bugs","title":"BUGS","text":"

                        Unlike many standard comparison functions, X509_cmp_time() and X509_cmp_current_time() return 0 on error.

                        "},{"location":"man3/X509_cmp_time/#return-values","title":"RETURN VALUES","text":"

                        X509_cmp_time() and X509_cmp_current_time() return -1 if asn1_time is earlier than, or equal to, in_tm (resp. current time), and 1 otherwise. These methods return 0 on error.

                        X509_cmp_timeframe() returns 0 if vpm is not NULL and the verification parameters do not contain X509_V_FLAG_USE_CHECK_TIME but do contain X509_V_FLAG_NO_CHECK_TIME. Otherwise it returns 1 if the end time is not NULL and the reference time (which has determined as stated above) is past the end time, -1 if the start time is not NULL and the reference time is before, else 0 to indicate that the reference time is in range (implying that the end time is not before the start time if both are present).

                        X509_time_adj(), X509_time_adj_ex() and X509_gmtime_adj() return a pointer to the updated ASN1_TIME structure, and NULL on error.

                        "},{"location":"man3/X509_cmp_time/#history","title":"HISTORY","text":"

                        X509_cmp_timeframe() was added in OpenSSL 3.0.

                        "},{"location":"man3/X509_cmp_time/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_digest/","title":"X509_digest","text":""},{"location":"man3/X509_digest/#name","title":"NAME","text":"

                        X509_digest, X509_digest_sig, X509_CRL_digest, X509_pubkey_digest, X509_NAME_digest, X509_REQ_digest, PKCS7_ISSUER_AND_SERIAL_digest - get digest of various objects

                        "},{"location":"man3/X509_digest/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md,\n                unsigned int *len);\nASN1_OCTET_STRING *X509_digest_sig(const X509 *cert,\n                                   EVP_MD **md_used, int *md_is_fallback);\n\nint X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, unsigned char *md,\n                    unsigned int *len);\n\nint X509_pubkey_digest(const X509 *data, const EVP_MD *type,\n                       unsigned char *md, unsigned int *len);\n\nint X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,\n                    unsigned char *md, unsigned int *len);\n\nint X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,\n                     unsigned char *md, unsigned int *len);\n\n#include <openssl/pkcs7.h>\n\nint PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,\n                                   const EVP_MD *type, unsigned char *md,\n                                   unsigned int *len);\n
                        "},{"location":"man3/X509_digest/#description","title":"DESCRIPTION","text":"

                        X509_digest_sig() calculates a digest of the given certificate cert using the same hash algorithm as in its signature, if the digest is an integral part of the certificate signature algorithm identifier. Otherwise, a fallback hash algorithm is determined as follows: SHA512 if the signature algorithm is ED25519, SHAKE256 if it is ED448, otherwise SHA256. The output parameters are assigned as follows. Unless md_used is NULL, the hash algorithm used is provided in *md_used and must be freed by the caller (if it is not NULL). Unless md_is_fallback is NULL, the *md_is_fallback is set to 1 if the hash algorithm used is a fallback, otherwise to 0.

                        X509_pubkey_digest() returns a digest of the DER representation of the public key in the specified X509 data object.

                        All other functions described here return a digest of the DER representation of their entire data objects.

                        The type parameter specifies the digest to be used, such as EVP_sha1(). The md is a pointer to the buffer where the digest will be copied and is assumed to be large enough; the constant EVP_MAX_MD_SIZE is suggested. The len parameter, if not NULL, points to a place where the digest size will be stored.

                        "},{"location":"man3/X509_digest/#return-values","title":"RETURN VALUES","text":"

                        X509_digest_sig() returns an ASN1_OCTET_STRING pointer on success, else NULL.

                        All other functions described here return 1 for success and 0 for failure.

                        "},{"location":"man3/X509_digest/#see-also","title":"SEE ALSO","text":"

                        EVP_sha1(3)

                        "},{"location":"man3/X509_digest/#history","title":"HISTORY","text":"

                        The X509_digest_sig() function was added in OpenSSL 3.0.

                        "},{"location":"man3/X509_digest/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_dup/","title":"X509_dup","text":""},{"location":"man3/X509_dup/#name","title":"NAME","text":"

                        DECLARE_ASN1_FUNCTIONS, IMPLEMENT_ASN1_FUNCTIONS, ASN1_ITEM, ACCESS_DESCRIPTION_free, ACCESS_DESCRIPTION_new, ADMISSIONS_free, ADMISSIONS_new, ADMISSION_SYNTAX_free, ADMISSION_SYNTAX_new, ASIdOrRange_free, ASIdOrRange_new, ASIdentifierChoice_free, ASIdentifierChoice_new, ASIdentifiers_free, ASIdentifiers_new, ASRange_free, ASRange_new, AUTHORITY_INFO_ACCESS_free, AUTHORITY_INFO_ACCESS_new, AUTHORITY_KEYID_free, AUTHORITY_KEYID_new, BASIC_CONSTRAINTS_free, BASIC_CONSTRAINTS_new, CERTIFICATEPOLICIES_free, CERTIFICATEPOLICIES_new, CMS_ContentInfo_free, CMS_ContentInfo_new, CMS_ContentInfo_new_ex, CMS_ContentInfo_print_ctx, CMS_ReceiptRequest_free, CMS_ReceiptRequest_new, CRL_DIST_POINTS_free, CRL_DIST_POINTS_new, DIRECTORYSTRING_free, DIRECTORYSTRING_new, DISPLAYTEXT_free, DISPLAYTEXT_new, DIST_POINT_NAME_free, DIST_POINT_NAME_new, DIST_POINT_free, DIST_POINT_new, DSAparams_dup, ECPARAMETERS_free, ECPARAMETERS_new, ECPKPARAMETERS_free, ECPKPARAMETERS_new, EDIPARTYNAME_free, EDIPARTYNAME_new, ESS_CERT_ID_dup, ESS_CERT_ID_free, ESS_CERT_ID_new, ESS_CERT_ID_V2_dup, ESS_CERT_ID_V2_free, ESS_CERT_ID_V2_new, ESS_ISSUER_SERIAL_dup, ESS_ISSUER_SERIAL_free, ESS_ISSUER_SERIAL_new, ESS_SIGNING_CERT_dup, ESS_SIGNING_CERT_free, ESS_SIGNING_CERT_it, ESS_SIGNING_CERT_new, ESS_SIGNING_CERT_V2_dup, ESS_SIGNING_CERT_V2_free, ESS_SIGNING_CERT_V2_it, ESS_SIGNING_CERT_V2_new, EXTENDED_KEY_USAGE_free, EXTENDED_KEY_USAGE_new, GENERAL_NAMES_free, GENERAL_NAMES_new, GENERAL_NAME_dup, GENERAL_NAME_free, GENERAL_NAME_new, GENERAL_SUBTREE_free, GENERAL_SUBTREE_new, IPAddressChoice_free, IPAddressChoice_new, IPAddressFamily_free, IPAddressFamily_new, IPAddressOrRange_free, IPAddressOrRange_new, IPAddressRange_free, IPAddressRange_new, ISSUER_SIGN_TOOL_free, ISSUER_SIGN_TOOL_it, ISSUER_SIGN_TOOL_new, ISSUING_DIST_POINT_free, ISSUING_DIST_POINT_it, ISSUING_DIST_POINT_new, NAME_CONSTRAINTS_free, NAME_CONSTRAINTS_new, NAMING_AUTHORITY_free, NAMING_AUTHORITY_new, NETSCAPE_CERT_SEQUENCE_free, NETSCAPE_CERT_SEQUENCE_new, NETSCAPE_SPKAC_free, NETSCAPE_SPKAC_new, NETSCAPE_SPKI_free, NETSCAPE_SPKI_new, NOTICEREF_free, NOTICEREF_new, OCSP_BASICRESP_free, OCSP_BASICRESP_new, OCSP_CERTID_dup, OCSP_CERTID_new, OCSP_CERTSTATUS_free, OCSP_CERTSTATUS_new, OCSP_CRLID_free, OCSP_CRLID_new, OCSP_ONEREQ_free, OCSP_ONEREQ_new, OCSP_REQINFO_free, OCSP_REQINFO_new, OCSP_RESPBYTES_free, OCSP_RESPBYTES_new, OCSP_RESPDATA_free, OCSP_RESPDATA_new, OCSP_RESPID_free, OCSP_RESPID_new, OCSP_RESPONSE_new, OCSP_REVOKEDINFO_free, OCSP_REVOKEDINFO_new, OCSP_SERVICELOC_free, OCSP_SERVICELOC_new, OCSP_SIGNATURE_free, OCSP_SIGNATURE_new, OCSP_SINGLERESP_free, OCSP_SINGLERESP_new, OSSL_CMP_ITAV_dup, OSSL_CMP_ITAV_free, OSSL_CMP_MSG_dup, OSSL_CMP_MSG_it, OSSL_CMP_MSG_free, OSSL_CMP_PKIHEADER_free, OSSL_CMP_PKIHEADER_it, OSSL_CMP_PKIHEADER_new, OSSL_CMP_PKISI_dup, OSSL_CMP_PKISI_free, OSSL_CMP_PKISI_it, OSSL_CMP_PKISI_new, OSSL_CMP_PKISTATUS_it, OSSL_CRMF_CERTID_dup, OSSL_CRMF_CERTID_free, OSSL_CRMF_CERTID_it, OSSL_CRMF_CERTID_new, OSSL_CRMF_CERTTEMPLATE_free, OSSL_CRMF_CERTTEMPLATE_it, OSSL_CRMF_CERTTEMPLATE_new, OSSL_CRMF_ENCRYPTEDVALUE_free, OSSL_CRMF_ENCRYPTEDVALUE_it, OSSL_CRMF_ENCRYPTEDVALUE_new, OSSL_CRMF_MSGS_free, OSSL_CRMF_MSGS_it, OSSL_CRMF_MSGS_new, OSSL_CRMF_MSG_dup, OSSL_CRMF_MSG_free, OSSL_CRMF_MSG_it, OSSL_CRMF_MSG_new, OSSL_CRMF_PBMPARAMETER_free, OSSL_CRMF_PBMPARAMETER_it, OSSL_CRMF_PBMPARAMETER_new, OSSL_CRMF_PKIPUBLICATIONINFO_free, OSSL_CRMF_PKIPUBLICATIONINFO_it, OSSL_CRMF_PKIPUBLICATIONINFO_new, OSSL_CRMF_SINGLEPUBINFO_free, OSSL_CRMF_SINGLEPUBINFO_it, OSSL_CRMF_SINGLEPUBINFO_new, OTHERNAME_free, OTHERNAME_new, PBE2PARAM_free, PBE2PARAM_new, PBEPARAM_free, PBEPARAM_new, PBKDF2PARAM_free, PBKDF2PARAM_new, PKCS12_BAGS_free, PKCS12_BAGS_new, PKCS12_MAC_DATA_free, PKCS12_MAC_DATA_new, PKCS12_SAFEBAG_free, PKCS12_SAFEBAG_new, PKCS12_free, PKCS12_new, PKCS7_DIGEST_free, PKCS7_DIGEST_new, PKCS7_ENCRYPT_free, PKCS7_ENCRYPT_new, PKCS7_ENC_CONTENT_free, PKCS7_ENC_CONTENT_new, PKCS7_ENVELOPE_free, PKCS7_ENVELOPE_new, PKCS7_ISSUER_AND_SERIAL_free, PKCS7_ISSUER_AND_SERIAL_new, PKCS7_RECIP_INFO_free, PKCS7_RECIP_INFO_new, PKCS7_SIGNED_free, PKCS7_SIGNED_new, PKCS7_SIGNER_INFO_free, PKCS7_SIGNER_INFO_new, PKCS7_SIGN_ENVELOPE_free, PKCS7_SIGN_ENVELOPE_new, PKCS7_dup, PKCS7_free, PKCS7_new_ex, PKCS7_new, PKCS7_print_ctx, PKCS8_PRIV_KEY_INFO_free, PKCS8_PRIV_KEY_INFO_new, PKEY_USAGE_PERIOD_free, PKEY_USAGE_PERIOD_new, POLICYINFO_free, POLICYINFO_new, POLICYQUALINFO_free, POLICYQUALINFO_new, POLICY_CONSTRAINTS_free, POLICY_CONSTRAINTS_new, POLICY_MAPPING_free, POLICY_MAPPING_new, PROFESSION_INFOS_free, PROFESSION_INFOS_new, PROFESSION_INFO_free, PROFESSION_INFO_new, PROXY_CERT_INFO_EXTENSION_free, PROXY_CERT_INFO_EXTENSION_new, PROXY_POLICY_free, PROXY_POLICY_new, RSAPrivateKey_dup, RSAPublicKey_dup, RSA_OAEP_PARAMS_free, RSA_OAEP_PARAMS_new, RSA_PSS_PARAMS_free, RSA_PSS_PARAMS_new, RSA_PSS_PARAMS_dup, SCRYPT_PARAMS_free, SCRYPT_PARAMS_new, SXNETID_free, SXNETID_new, SXNET_free, SXNET_new, TLS_FEATURE_free, TLS_FEATURE_new, TS_ACCURACY_dup, TS_ACCURACY_free, TS_ACCURACY_new, TS_MSG_IMPRINT_dup, TS_MSG_IMPRINT_free, TS_MSG_IMPRINT_new, TS_REQ_dup, TS_REQ_free, TS_REQ_new, TS_RESP_dup, TS_RESP_free, TS_RESP_new, TS_STATUS_INFO_dup, TS_STATUS_INFO_free, TS_STATUS_INFO_new, TS_TST_INFO_dup, TS_TST_INFO_free, TS_TST_INFO_new, USERNOTICE_free, USERNOTICE_new, X509_ALGOR_free, X509_ALGOR_it, X509_ALGOR_new, X509_ATTRIBUTE_dup, X509_ATTRIBUTE_free, X509_ATTRIBUTE_new, X509_CERT_AUX_free, X509_CERT_AUX_new, X509_CINF_free, X509_CINF_new, X509_CRL_INFO_free, X509_CRL_INFO_new, X509_CRL_dup, X509_CRL_free, X509_CRL_new_ex, X509_CRL_new, X509_EXTENSION_dup, X509_EXTENSION_free, X509_EXTENSION_new, X509_NAME_ENTRY_dup, X509_NAME_ENTRY_free, X509_NAME_ENTRY_new, X509_NAME_dup, X509_NAME_free, X509_NAME_new, X509_REQ_INFO_free, X509_REQ_INFO_new, X509_REQ_dup, X509_REQ_free, X509_REQ_new, X509_REQ_new_ex, X509_REVOKED_dup, X509_REVOKED_free, X509_REVOKED_new, X509_SIG_free, X509_SIG_new, X509_VAL_free, X509_VAL_new, X509_dup, - ASN1 object utilities

                        "},{"location":"man3/X509_dup/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/asn1t.h>\n\nDECLARE_ASN1_FUNCTIONS(type)\nIMPLEMENT_ASN1_FUNCTIONS(stname)\n\ntypedef struct ASN1_ITEM_st ASN1_ITEM;\n\nextern const ASN1_ITEM TYPE_it;\nTYPE *TYPE_new(void);\nTYPE *TYPE_dup(const TYPE *a);\nvoid TYPE_free(TYPE *a);\nint TYPE_print_ctx(BIO *out, TYPE *a, int indent, const ASN1_PCTX *pctx);\n

                        The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        DSA *DSAparams_dup(const DSA *dsa);\nRSA *RSAPrivateKey_dup(const RSA *rsa);\nRSA *RSAPublicKey_dup(const RSA *rsa);\n
                        "},{"location":"man3/X509_dup/#description","title":"DESCRIPTION","text":"

                        In the description below, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509.

                        The OpenSSL ASN1 parsing library templates are like a data-driven bytecode interpreter. Every ASN1 object as a global variable, TYPE_it, that describes the item such as its fields. (On systems which cannot export variables from shared libraries, the global is instead a function which returns a pointer to a static variable.

                        The macro DECLARE_ASN1_FUNCTIONS() is typically used in header files to generate the function declarations.

                        The macro IMPLEMENT_ASN1_FUNCTIONS() is used once in a source file to generate the function bodies.

                        TYPE_new() allocates an empty object of the indicated type. The object returned must be released by calling TYPE_free().

                        TYPE_new_ex() is similar to TYPE_new() but also passes the library context libctx and the property query propq to use when retrieving algorithms from providers. This created object can then be used when loading binary data using d2i_TYPE().

                        TYPE_dup() copies an existing object, leaving it untouched. Note, however, that the internal representation of the object may contain (besides the ASN.1 structure) further data, which is not copied. For instance, an X509 object usually is augmented by cached information on X.509v3 extensions, etc., and losing it can lead to wrong validation results. To avoid such situations, better use TYPE_up_ref() if available. For the case of X509 objects, an alternative to using X509_up_ref(3) may be to still call TYPE_dup(), e.g., copied_cert = X509_dup(cert), followed by X509_check_purpose(copied_cert, -1, 0), which re-builds the cached data.

                        TYPE_free() releases the object and all pointers and sub-objects within it. If the argument is NULL, nothing is done.

                        TYPE_print_ctx() prints the object a on the specified BIO out. Each line will be prefixed with indent spaces. The pctx specifies the printing context and is for internal use; use NULL to get the default behavior. If a print function is user-defined, then pass in any pctx down to any nested calls.

                        "},{"location":"man3/X509_dup/#return-values","title":"RETURN VALUES","text":"

                        TYPE_new(), TYPE_new_ex() and TYPE_dup() return a pointer to the object or NULL on failure.

                        TYPE_print_ctx() returns 1 on success or zero on failure.

                        "},{"location":"man3/X509_dup/#see-also","title":"SEE ALSO","text":"

                        X509_up_ref(3)

                        "},{"location":"man3/X509_dup/#history","title":"HISTORY","text":"

                        The functions X509_REQ_new_ex(), X509_CRL_new_ex(), PKCS7_new_ex() and CMS_ContentInfo_new_ex() were added in OpenSSL 3.0.

                        The functions DSAparams_dup(), RSAPrivateKey_dup() and RSAPublicKey_dup() were deprecated in 3.0.

                        "},{"location":"man3/X509_dup/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get0_distinguishing_id/","title":"X509_get0_distinguishing_id","text":""},{"location":"man3/X509_get0_distinguishing_id/#name","title":"NAME","text":"

                        X509_get0_distinguishing_id, X509_set0_distinguishing_id, X509_REQ_get0_distinguishing_id, X509_REQ_set0_distinguishing_id - get or set the Distinguishing ID for certificate operations

                        "},{"location":"man3/X509_get0_distinguishing_id/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nASN1_OCTET_STRING *X509_get0_distinguishing_id(X509 *x);\nvoid X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *distid);\nASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x);\nvoid X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *distid);\n
                        "},{"location":"man3/X509_get0_distinguishing_id/#description","title":"DESCRIPTION","text":"

                        The Distinguishing ID is defined in FIPS 196 as follows:

                        • Distinguishing identifier

                          Information which unambiguously distinguishes an entity in the authentication process.

                        The SM2 signature algorithm requires a Distinguishing ID value when generating and verifying a signature, but the Ddistinguishing ID may also find other uses. In the context of SM2, the Distinguishing ID is often referred to as the \"SM2 ID\".

                        For the purpose off verifying a certificate or a certification request, a Distinguishing ID may be attached to it, so functions like X509_verify(3) or X509_REQ_verify(3) have easy access to that identity for signature verification.

                        X509_get0_distinguishing_id() gets the Distinguishing ID value of a certificate x by returning an ASN1_OCTET_STRING object which should not be freed by the caller.

                        X509_set0_distinguishing_id() assigns distid to the certificate x. Calling this function transfers the memory management of the value to the X509 object, and therefore the value that has been passed in should not be freed by the caller after this function has been called.

                        X509_REQ_get0_distinguishing_id() and X509_REQ_set0_distinguishing_id() have the same functionality as X509_get0_distinguishing_id() and X509_set0_distinguishing_id() except that they deal with X509_REQ objects instead of X509.

                        "},{"location":"man3/X509_get0_distinguishing_id/#return-values","title":"RETURN VALUES","text":"

                        X509_set0_distinguishing_id() and X509_REQ_set0_distinguishing_id() do not return a value.

                        "},{"location":"man3/X509_get0_distinguishing_id/#see-also","title":"SEE ALSO","text":"

                        X509_verify(3), SM2(7)

                        "},{"location":"man3/X509_get0_distinguishing_id/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get0_notBefore/","title":"X509_get0_notBefore","text":""},{"location":"man3/X509_get0_notBefore/#name","title":"NAME","text":"

                        X509_get0_notBefore, X509_getm_notBefore, X509_get0_notAfter, X509_getm_notAfter, X509_set1_notBefore, X509_set1_notAfter, X509_CRL_get0_lastUpdate, X509_CRL_get0_nextUpdate, X509_CRL_set1_lastUpdate, X509_CRL_set1_nextUpdate - get or set certificate or CRL dates

                        "},{"location":"man3/X509_get0_notBefore/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nconst ASN1_TIME *X509_get0_notBefore(const X509 *x);\nconst ASN1_TIME *X509_get0_notAfter(const X509 *x);\n\nASN1_TIME *X509_getm_notBefore(const X509 *x);\nASN1_TIME *X509_getm_notAfter(const X509 *x);\n\nint X509_set1_notBefore(X509 *x, const ASN1_TIME *tm);\nint X509_set1_notAfter(X509 *x, const ASN1_TIME *tm);\n\nconst ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl);\nconst ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl);\n\nint X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);\nint X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);\n
                        "},{"location":"man3/X509_get0_notBefore/#description","title":"DESCRIPTION","text":"

                        X509_get0_notBefore() and X509_get0_notAfter() return the notBefore and notAfter fields of certificate x respectively. The value returned is an internal pointer which must not be freed up after the call.

                        X509_getm_notBefore() and X509_getm_notAfter() are similar to X509_get0_notBefore() and X509_get0_notAfter() except they return non-constant mutable references to the associated date field of the certificate.

                        X509_set1_notBefore() and X509_set1_notAfter() set the notBefore and notAfter fields of x to tm. Ownership of the passed parameter tm is not transferred by these functions so it must be freed up after the call.

                        X509_CRL_get0_lastUpdate() and X509_CRL_get0_nextUpdate() return the lastUpdate and nextUpdate fields of crl. The value returned is an internal pointer which must not be freed up after the call. If the nextUpdate field is absent from crl then NULL is returned.

                        X509_CRL_set1_lastUpdate() and X509_CRL_set1_nextUpdate() set the lastUpdate and nextUpdate fields of crl to tm. Ownership of the passed parameter tm is not transferred by these functions so it must be freed up after the call.

                        "},{"location":"man3/X509_get0_notBefore/#return-values","title":"RETURN VALUES","text":"

                        X509_get0_notBefore(), X509_get0_notAfter() and X509_CRL_get0_lastUpdate() return a pointer to an ASN1_TIME structure.

                        X509_CRL_get0_lastUpdate() return a pointer to an ASN1_TIME structure or NULL if the lastUpdate field is absent.

                        X509_set1_notBefore(), X509_set1_notAfter(), X509_CRL_set1_lastUpdate() and X509_CRL_set1_nextUpdate() return 1 for success or 0 for failure.

                        "},{"location":"man3/X509_get0_notBefore/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_get0_notBefore/#history","title":"HISTORY","text":"

                        These functions are available in all versions of OpenSSL.

                        X509_get_notBefore() and X509_get_notAfter() were deprecated in OpenSSL 1.1.0

                        "},{"location":"man3/X509_get0_notBefore/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get0_signature/","title":"X509_get0_signature","text":""},{"location":"man3/X509_get0_signature/#name","title":"NAME","text":"

                        X509_get0_signature, X509_REQ_set0_signature, X509_REQ_set1_signature_algo, X509_get_signature_nid, X509_get0_tbs_sigalg, X509_REQ_get0_signature, X509_REQ_get_signature_nid, X509_CRL_get0_signature, X509_CRL_get_signature_nid, X509_get_signature_info, X509_SIG_INFO_get, X509_SIG_INFO_set - signature information

                        "},{"location":"man3/X509_get0_signature/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nvoid X509_get0_signature(const ASN1_BIT_STRING **psig,\n                         const X509_ALGOR **palg,\n                         const X509 *x);\nvoid X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig);\nint X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg);\nint X509_get_signature_nid(const X509 *x);\nconst X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);\n\nvoid X509_REQ_get0_signature(const X509_REQ *crl,\n                             const ASN1_BIT_STRING **psig,\n                             const X509_ALGOR **palg);\nint X509_REQ_get_signature_nid(const X509_REQ *crl);\n\nvoid X509_CRL_get0_signature(const X509_CRL *crl,\n                             const ASN1_BIT_STRING **psig,\n                             const X509_ALGOR **palg);\nint X509_CRL_get_signature_nid(const X509_CRL *crl);\n\nint X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits,\n                            uint32_t *flags);\n\nint X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid,\n                     int *secbits, uint32_t *flags);\nvoid X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid,\n                       int secbits, uint32_t flags);\n
                        "},{"location":"man3/X509_get0_signature/#description","title":"DESCRIPTION","text":"

                        X509_get0_signature() sets *psig to the signature of x and *palg to the signature algorithm of x. The values returned are internal pointers which MUST NOT be freed up after the call.

                        X509_set0_signature() and X509_REQ_set1_signature_algo() are the equivalent setters for the two values of X509_get0_signature().

                        X509_get0_tbs_sigalg() returns the signature algorithm in the signed portion of x.

                        X509_get_signature_nid() returns the NID corresponding to the signature algorithm of x.

                        X509_REQ_get0_signature(), X509_REQ_get_signature_nid() X509_CRL_get0_signature() and X509_CRL_get_signature_nid() perform the same function for certificate requests and CRLs.

                        X509_get_signature_info() retrieves information about the signature of certificate x. The NID of the signing digest is written to *mdnid, the public key algorithm to *pknid, the effective security bits to *secbits and flag details to *flags. Any of the parameters can be set to NULL if the information is not required.

                        X509_SIG_INFO_get() and X509_SIG_INFO_set() get and set information about a signature in an X509_SIG_INFO structure. They are only used by implementations of algorithms which need to set custom signature information: most applications will never need to call them.

                        "},{"location":"man3/X509_get0_signature/#notes","title":"NOTES","text":"

                        These functions provide lower level access to signatures in certificates where an application wishes to analyse or generate a signature in a form where X509_sign() et al is not appropriate (for example a non standard or unsupported format).

                        The security bits returned by X509_get_signature_info() refers to information available from the certificate signature (such as the signing digest). In some cases the actual security of the signature is less because the signing key is less secure: for example a certificate signed using SHA-512 and a 1024 bit RSA key.

                        "},{"location":"man3/X509_get0_signature/#return-values","title":"RETURN VALUES","text":"

                        X509_get_signature_nid(), X509_REQ_get_signature_nid() and X509_CRL_get_signature_nid() return a NID.

                        X509_get0_signature(), X509_REQ_get0_signature() and X509_CRL_get0_signature() do not return values.

                        X509_get_signature_info() returns 1 if the signature information returned is valid or 0 if the information is not available (e.g. unknown algorithms or malformed parameters).

                        X509_REQ_set1_signature_algo() returns 0 on success; or 1 on an error (e.g. null ALGO pointer). X509_REQ_set0_signature does not return an error value.

                        "},{"location":"man3/X509_get0_signature/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_get0_signature/#history","title":"HISTORY","text":"

                        The X509_get0_signature() and X509_get_signature_nid() functions were added in OpenSSL 1.0.2.

                        The X509_REQ_get0_signature(), X509_REQ_get_signature_nid(), X509_CRL_get0_signature() and X509_CRL_get_signature_nid() were added in OpenSSL 1.1.0.

                        The X509_REQ_set0_signature() and X509_REQ_set1_signature_algo() were added in OpenSSL 1.1.1e.

                        "},{"location":"man3/X509_get0_signature/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get0_uids/","title":"X509_get0_uids","text":""},{"location":"man3/X509_get0_uids/#name","title":"NAME","text":"

                        X509_get0_uids - get certificate unique identifiers

                        "},{"location":"man3/X509_get0_uids/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nvoid X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid,\n                    const ASN1_BIT_STRING **psuid);\n
                        "},{"location":"man3/X509_get0_uids/#description","title":"DESCRIPTION","text":"

                        X509_get0_uids() sets *piuid and *psuid to the issuer and subject unique identifiers of certificate x or NULL if the fields are not present.

                        "},{"location":"man3/X509_get0_uids/#notes","title":"NOTES","text":"

                        The issuer and subject unique identifier fields are very rarely encountered in practice outside test cases.

                        "},{"location":"man3/X509_get0_uids/#return-values","title":"RETURN VALUES","text":"

                        X509_get0_uids() does not return a value.

                        "},{"location":"man3/X509_get0_uids/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_get0_uids/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get_extension_flags/","title":"X509_get_extension_flags","text":""},{"location":"man3/X509_get_extension_flags/#name","title":"NAME","text":"

                        X509_get0_subject_key_id, X509_get0_authority_key_id, X509_get0_authority_issuer, X509_get0_authority_serial, X509_get_pathlen, X509_get_extension_flags, X509_get_key_usage, X509_get_extended_key_usage, X509_set_proxy_flag, X509_set_proxy_pathlen, X509_get_proxy_pathlen - retrieve certificate extension data

                        "},{"location":"man3/X509_get_extension_flags/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nlong X509_get_pathlen(X509 *x);\nuint32_t X509_get_extension_flags(X509 *x);\nuint32_t X509_get_key_usage(X509 *x);\nuint32_t X509_get_extended_key_usage(X509 *x);\nconst ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x);\nconst ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x);\nconst GENERAL_NAMES *X509_get0_authority_issuer(X509 *x);\nconst ASN1_INTEGER *X509_get0_authority_serial(X509 *x);\nvoid X509_set_proxy_flag(X509 *x);\nvoid X509_set_proxy_pathlen(int l);\nlong X509_get_proxy_pathlen(X509 *x);\n
                        "},{"location":"man3/X509_get_extension_flags/#description","title":"DESCRIPTION","text":"

                        These functions retrieve information related to commonly used certificate extensions.

                        X509_get_pathlen() retrieves the path length extension from a certificate. This extension is used to limit the length of a cert chain that may be issued from that CA.

                        X509_get_extension_flags() retrieves general information about a certificate, it will return one or more of the following flags ored together.

                        • EXFLAG_V1

                          The certificate is an obsolete version 1 certificate.

                        • EXFLAG_BCONS

                          The certificate contains a basic constraints extension.

                        • EXFLAG_CA

                          The certificate contains basic constraints and asserts the CA flag.

                        • EXFLAG_PROXY

                          The certificate is a valid proxy certificate.

                        • EXFLAG_SI

                          The certificate is self issued (that is subject and issuer names match).

                        • EXFLAG_SS

                          The subject and issuer names match and extension values imply it is self signed.

                        • EXFLAG_FRESHEST

                          The freshest CRL extension is present in the certificate.

                        • EXFLAG_CRITICAL

                          The certificate contains an unhandled critical extension.

                        • EXFLAG_INVALID

                          Some certificate extension values are invalid or inconsistent. The certificate should be rejected. This bit may also be raised after an out-of-memory error while processing the X509 object, so it may not be related to the processed ASN1 object itself.

                        • EXFLAG_NO_FINGERPRINT

                          Failed to compute the internal SHA1 hash value of the certificate or CRL. This may be due to malloc failure or because no SHA1 implementation was found.

                        • EXFLAG_INVALID_POLICY

                          The NID_certificate_policies certificate extension is invalid or inconsistent. The certificate should be rejected. This bit may also be raised after an out-of-memory error while processing the X509 object, so it may not be related to the processed ASN1 object itself.

                        • EXFLAG_KUSAGE

                          The certificate contains a key usage extension. The value can be retrieved using X509_get_key_usage().

                        • EXFLAG_XKUSAGE

                          The certificate contains an extended key usage extension. The value can be retrieved using X509_get_extended_key_usage().

                        X509_get_key_usage() returns the value of the key usage extension. If key usage is present will return zero or more of the flags: KU_DIGITAL_SIGNATURE, KU_NON_REPUDIATION, KU_KEY_ENCIPHERMENT, KU_DATA_ENCIPHERMENT, KU_KEY_AGREEMENT, KU_KEY_CERT_SIGN, KU_CRL_SIGN, KU_ENCIPHER_ONLY or KU_DECIPHER_ONLY corresponding to individual key usage bits. If key usage is absent then UINT32_MAX is returned.

                        X509_get_extended_key_usage() returns the value of the extended key usage extension. If extended key usage is present it will return zero or more of the flags: XKU_SSL_SERVER, XKU_SSL_CLIENT, XKU_SMIME, XKU_CODE_SIGN XKU_OCSP_SIGN, XKU_TIMESTAMP, XKU_DVCS or XKU_ANYEKU. These correspond to the OIDs id-kp-serverAuth, id-kp-clientAuth, id-kp-emailProtection, id-kp-codeSigning, id-kp-OCSPSigning, id-kp-timeStamping, id-kp-dvcs and anyExtendedKeyUsage respectively. Additionally XKU_SGC is set if either Netscape or Microsoft SGC OIDs are present.

                        X509_get0_subject_key_id() returns an internal pointer to the subject key identifier of x as an ASN1_OCTET_STRING or NULL if the extension is not present or cannot be parsed.

                        X509_get0_authority_key_id() returns an internal pointer to the authority key identifier of x as an ASN1_OCTET_STRING or NULL if the extension is not present or cannot be parsed.

                        X509_get0_authority_issuer() returns an internal pointer to the authority certificate issuer of x as a stack of GENERAL_NAME structures or NULL if the extension is not present or cannot be parsed.

                        X509_get0_authority_serial() returns an internal pointer to the authority certificate serial number of x as an ASN1_INTEGER or NULL if the extension is not present or cannot be parsed.

                        X509_set_proxy_flag() marks the certificate with the EXFLAG_PROXY flag. This is for the users who need to mark non-RFC3820 proxy certificates as such, as OpenSSL only detects RFC3820 compliant ones.

                        X509_set_proxy_pathlen() sets the proxy certificate path length for the given certificate x. This is for the users who need to mark non-RFC3820 proxy certificates as such, as OpenSSL only detects RFC3820 compliant ones.

                        X509_get_proxy_pathlen() returns the proxy certificate path length for the given certificate x if it is a proxy certificate.

                        "},{"location":"man3/X509_get_extension_flags/#notes","title":"NOTES","text":"

                        The value of the flags correspond to extension values which are cached in the X509 structure. If the flags returned do not provide sufficient information an application should examine extension values directly for example using X509_get_ext_d2i().

                        If the key usage or extended key usage extension is absent then typically usage is unrestricted. For this reason X509_get_key_usage() and X509_get_extended_key_usage() return UINT32_MAX when the corresponding extension is absent. Applications can additionally check the return value of X509_get_extension_flags() and take appropriate action is an extension is absent.

                        If X509_get0_subject_key_id() returns NULL then the extension may be absent or malformed. Applications can determine the precise reason using X509_get_ext_d2i().

                        "},{"location":"man3/X509_get_extension_flags/#return-values","title":"RETURN VALUES","text":"

                        X509_get_pathlen() returns the path length value, or -1 if the extension is not present.

                        X509_get_extension_flags(), X509_get_key_usage() and X509_get_extended_key_usage() return sets of flags corresponding to the certificate extension values.

                        X509_get0_subject_key_id() returns the subject key identifier as a pointer to an ASN1_OCTET_STRING structure or NULL if the extension is absent or an error occurred during parsing.

                        X509_get_proxy_pathlen() returns the path length value if the given certificate is a proxy one and has a path length set, and -1 otherwise.

                        "},{"location":"man3/X509_get_extension_flags/#see-also","title":"SEE ALSO","text":"

                        X509_check_purpose(3)

                        "},{"location":"man3/X509_get_extension_flags/#history","title":"HISTORY","text":"

                        X509_get_pathlen(), X509_set_proxy_flag(), X509_set_proxy_pathlen() and X509_get_proxy_pathlen() were added in OpenSSL 1.1.0.

                        "},{"location":"man3/X509_get_extension_flags/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get_pubkey/","title":"X509_get_pubkey","text":""},{"location":"man3/X509_get_pubkey/#name","title":"NAME","text":"

                        X509_get_pubkey, X509_get0_pubkey, X509_set_pubkey, X509_get_X509_PUBKEY, X509_REQ_get_pubkey, X509_REQ_get0_pubkey, X509_REQ_set_pubkey, X509_REQ_get_X509_PUBKEY - get or set certificate or certificate request public key

                        "},{"location":"man3/X509_get_pubkey/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nEVP_PKEY *X509_get_pubkey(X509 *x);\nEVP_PKEY *X509_get0_pubkey(const X509 *x);\nint X509_set_pubkey(X509 *x, EVP_PKEY *pkey);\nX509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x);\n\nEVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);\nEVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req);\nint X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);\nX509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *x);\n
                        "},{"location":"man3/X509_get_pubkey/#description","title":"DESCRIPTION","text":"

                        X509_get_pubkey() attempts to decode the public key for certificate x. If successful it returns the public key as an EVP_PKEY pointer with its reference count incremented: this means the returned key must be freed up after use. X509_get0_pubkey() is similar except it does not increment the reference count of the returned EVP_PKEY so it must not be freed up after use.

                        X509_get_X509_PUBKEY() returns an internal pointer to the X509_PUBKEY structure which encodes the certificate of x. The returned value must not be freed up after use.

                        X509_set_pubkey() attempts to set the public key for certificate x to pkey. The key pkey should be freed up after use.

                        X509_REQ_get_pubkey(), X509_REQ_get0_pubkey(), X509_REQ_set_pubkey() and X509_REQ_get_X509_PUBKEY() are similar but operate on certificate request req.

                        "},{"location":"man3/X509_get_pubkey/#notes","title":"NOTES","text":"

                        The first time a public key is decoded the EVP_PKEY structure is cached in the certificate or certificate request itself. Subsequent calls return the cached structure with its reference count incremented to improve performance.

                        "},{"location":"man3/X509_get_pubkey/#return-values","title":"RETURN VALUES","text":"

                        X509_get_pubkey(), X509_get0_pubkey(), X509_get_X509_PUBKEY(), X509_REQ_get_pubkey() and X509_REQ_get_X509_PUBKEY() return a public key or NULL if an error occurred.

                        X509_set_pubkey() and X509_REQ_set_pubkey() return 1 for success and 0 for failure.

                        "},{"location":"man3/X509_get_pubkey/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_get_pubkey/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get_serialNumber/","title":"X509_get_serialNumber","text":""},{"location":"man3/X509_get_serialNumber/#name","title":"NAME","text":"

                        X509_get_serialNumber, X509_get0_serialNumber, X509_set_serialNumber - get or set certificate serial number

                        "},{"location":"man3/X509_get_serialNumber/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nASN1_INTEGER *X509_get_serialNumber(X509 *x);\nconst ASN1_INTEGER *X509_get0_serialNumber(const X509 *x);\nint X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);\n
                        "},{"location":"man3/X509_get_serialNumber/#description","title":"DESCRIPTION","text":"

                        X509_get_serialNumber() returns the serial number of certificate x as an ASN1_INTEGER structure which can be examined or initialised. The value returned is an internal pointer which MUST NOT be freed up after the call.

                        X509_get0_serialNumber() is the same as X509_get_serialNumber() except it accepts a const parameter and returns a const result.

                        X509_set_serialNumber() sets the serial number of certificate x to serial. A copy of the serial number is used internally so serial should be freed up after use.

                        "},{"location":"man3/X509_get_serialNumber/#return-values","title":"RETURN VALUES","text":"

                        X509_get_serialNumber() and X509_get0_serialNumber() return an ASN1_INTEGER structure.

                        X509_set_serialNumber() returns 1 for success and 0 for failure.

                        "},{"location":"man3/X509_get_serialNumber/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_get_serialNumber/#history","title":"HISTORY","text":"

                        The X509_get_serialNumber() and X509_set_serialNumber() functions are available in all versions of OpenSSL. The X509_get0_serialNumber() function was added in OpenSSL 1.1.0.

                        "},{"location":"man3/X509_get_serialNumber/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get_subject_name/","title":"X509_get_subject_name","text":""},{"location":"man3/X509_get_subject_name/#name","title":"NAME","text":"

                        X509_NAME_hash_ex, X509_NAME_hash, X509_get_subject_name, X509_set_subject_name, X509_subject_name_hash, X509_get_issuer_name, X509_set_issuer_name, X509_issuer_name_hash, X509_REQ_get_subject_name, X509_REQ_set_subject_name, X509_CRL_get_issuer, X509_CRL_set_issuer_name - get X509_NAME hashes or get and set issuer or subject names

                        "},{"location":"man3/X509_get_subject_name/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nunsigned long X509_NAME_hash_ex(const X509_NAME *x, OSSL_LIB_CTX *libctx,\n                                const char *propq, int *ok);\n\nX509_NAME *X509_get_subject_name(const X509 *x);\nint X509_set_subject_name(X509 *x, const X509_NAME *name);\nunsigned long X509_subject_name_hash(X509 *x);\n\nX509_NAME *X509_get_issuer_name(const X509 *x);\nint X509_set_issuer_name(X509 *x, const X509_NAME *name);\nunsigned long X509_issuer_name_hash(X509 *x);\n\nX509_NAME *X509_REQ_get_subject_name(const X509_REQ *req);\nint X509_REQ_set_subject_name(X509_REQ *req, const X509_NAME *name);\n\nX509_NAME *X509_CRL_get_issuer(const X509_CRL *crl);\nint X509_CRL_set_issuer_name(X509_CRL *x, const X509_NAME *name);\n

                        The following macro has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        #define X509_NAME_hash(x) X509_NAME_hash_ex(x, NULL, NULL, NULL)\n
                        "},{"location":"man3/X509_get_subject_name/#description","title":"DESCRIPTION","text":"

                        X509_NAME_hash_ex() returns a hash value of name x or 0 on failure, using any given library context libctx and property query propq. The ok result argument may be NULL or else is used to return 1 for success and 0 for failure. Failure may happen on malloc error or if no SHA1 implementation is available.

                        X509_NAME_hash() returns a hash value of name x or 0 on failure, using the default library context and default property query.

                        X509_get_subject_name() returns the subject name of certificate x. The returned value is an internal pointer which MUST NOT be freed.

                        X509_set_subject_name() sets the issuer name of certificate x to name. The name parameter is copied internally and should be freed up when it is no longer needed.

                        X509_subject_name_hash() returns a hash value of the subject name of certificate x.

                        X509_get_issuer_name(), X509_set_issuer_name(), and X509_issuer_name_hash() are identical to X509_get_subject_name(), X509_set_subject_name(), and X509_subject_name_hash() except they relate to the issuer name of x.

                        Similarly X509_REQ_get_subject_name(), X509_REQ_set_subject_name(), X509_CRL_get_issuer() and X509_CRL_set_issuer_name() get or set the subject or issuer names of certificate requests of CRLs respectively.

                        "},{"location":"man3/X509_get_subject_name/#return-values","title":"RETURN VALUES","text":"

                        X509_get_subject_name(), X509_get_issuer_name(), X509_REQ_get_subject_name() and X509_CRL_get_issuer() return an X509_NAME pointer.

                        X509_NAME_hash_ex(), X509_NAME_hash(), X509_subject_name_hash() and X509_issuer_name_hash() return the first four bytes of the SHA1 hash value, converted to unsigned long in little endian order, or 0 on failure.

                        X509_set_subject_name(), X509_set_issuer_name(), X509_REQ_set_subject_name() and X509_CRL_set_issuer_name() return 1 for success and 0 for failure.

                        "},{"location":"man3/X509_get_subject_name/#bugs","title":"BUGS","text":"

                        In case X509_NAME_hash(), X509_subject_name_hash(), or X509_issuer_name_hash() returns 0 it remains unclear if this is the real hash value or due to failure. Better use X509_NAME_hash_ex() instead.

                        "},{"location":"man3/X509_get_subject_name/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), d2i_X509(3) X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_get_subject_name/#history","title":"HISTORY","text":"

                        X509_REQ_get_subject_name() is a function in OpenSSL 1.1.0 and a macro in earlier versions.

                        X509_CRL_get_issuer() is a function in OpenSSL 1.1.0. It was previously added in OpenSSL 1.0.0 as a macro.

                        X509_NAME_hash() was turned into a macro and deprecated in OpenSSL 3.0.

                        "},{"location":"man3/X509_get_subject_name/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_get_version/","title":"X509_get_version","text":""},{"location":"man3/X509_get_version/#name","title":"NAME","text":"

                        X509_get_version, X509_set_version, X509_REQ_get_version, X509_REQ_set_version, X509_CRL_get_version, X509_CRL_set_version - get or set certificate, certificate request or CRL version

                        "},{"location":"man3/X509_get_version/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nlong X509_get_version(const X509 *x);\nint X509_set_version(X509 *x, long version);\n\nlong X509_REQ_get_version(const X509_REQ *req);\nint X509_REQ_set_version(X509_REQ *x, long version);\n\nlong X509_CRL_get_version(const X509_CRL *crl);\nint X509_CRL_set_version(X509_CRL *x, long version);\n
                        "},{"location":"man3/X509_get_version/#description","title":"DESCRIPTION","text":"

                        X509_get_version() returns the numerical value of the version field of certificate x. These correspond to the constants X509_VERSION_1, X509_VERSION_2, and X509_VERSION_3. Note: the values of these constants are defined by standards (X.509 et al) to be one less than the certificate version. So X509_VERSION_3 has value 2 and X509_VERSION_1 has value 0.

                        X509_set_version() sets the numerical value of the version field of certificate x to version.

                        Similarly X509_REQ_get_version(), X509_REQ_set_version(), X509_CRL_get_version() and X509_CRL_set_version() get and set the version number of certificate requests and CRLs. They use constants X509_REQ_VERSION_1, X509_CRL_VERSION_1, and X509_CRL_VERSION_2.

                        "},{"location":"man3/X509_get_version/#notes","title":"NOTES","text":"

                        The version field of certificates, certificate requests and CRLs has a DEFAULT value of v1(0) meaning the field should be omitted for version 1. This is handled transparently by these functions.

                        "},{"location":"man3/X509_get_version/#return-values","title":"RETURN VALUES","text":"

                        X509_get_version(), X509_REQ_get_version() and X509_CRL_get_version() return the numerical value of the version field.

                        X509_set_version(), X509_REQ_set_version() and X509_CRL_set_version() return 1 for success and 0 for failure.

                        "},{"location":"man3/X509_get_version/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_get_version/#history","title":"HISTORY","text":"

                        X509_get_version(), X509_REQ_get_version() and X509_CRL_get_version() are functions in OpenSSL 1.1.0, in previous versions they were macros.

                        "},{"location":"man3/X509_get_version/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_load_http/","title":"X509_load_http","text":""},{"location":"man3/X509_load_http/#name","title":"NAME","text":"

                        X509_load_http, X509_http_nbio, X509_CRL_load_http, X509_CRL_http_nbio - certificate and CRL loading functions

                        "},{"location":"man3/X509_load_http/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nX509 *X509_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);\nX509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);\n

                        The following macros have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        #define X509_http_nbio(rctx, pcert)\n#define X509_CRL_http_nbio(rctx, pcrl)\n
                        "},{"location":"man3/X509_load_http/#description","title":"DESCRIPTION","text":"

                        X509_load_http() and X509_CRL_load_http() loads a certificate or a CRL, respectively, in ASN.1 format using HTTP from the given url.

                        If bio is given and rbio is NULL then this BIO is used instead of an internal one for connecting, writing the request, and reading the response. If both bio and rbio are given (which may be memory BIOs, for instance) then no explicit connection is attempted, bio is used for writing the request, and rbio for reading the response.

                        If the timeout parameter is > 0 this indicates the maximum number of seconds to wait until the transfer is complete. A value of 0 enables waiting indefinitely, while a value < 0 immediately leads to a timeout condition.

                        X509_http_nbio() and X509_CRL_http_nbio() are macros for backward compatibility that have the same effect as the functions above but with infinite timeout and without the possibility to specify custom BIOs.

                        "},{"location":"man3/X509_load_http/#return-values","title":"RETURN VALUES","text":"

                        On success the function yield the loaded value, else NULL. Error conditions include connection/transfer timeout, parse errors, etc.

                        "},{"location":"man3/X509_load_http/#see-also","title":"SEE ALSO","text":"

                        OSSL_HTTP_get(3)

                        "},{"location":"man3/X509_load_http/#history","title":"HISTORY","text":"

                        X509_load_http() and X509_CRL_load_http() were added in OpenSSL 3.0. X509_http_nbio() and X509_CRL_http_nbio() were deprecated in OpenSSL 3.0.

                        "},{"location":"man3/X509_load_http/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_new/","title":"X509_new","text":""},{"location":"man3/X509_new/#name","title":"NAME","text":"

                        X509_new, X509_new_ex, X509_free, X509_up_ref, X509_chain_up_ref - X509 certificate ASN1 allocation functions

                        "},{"location":"man3/X509_new/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nX509 *X509_new(void);\nX509 *X509_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nvoid X509_free(X509 *a);\nint X509_up_ref(X509 *a);\nSTACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *x);\n
                        "},{"location":"man3/X509_new/#description","title":"DESCRIPTION","text":"

                        The X509 ASN1 allocation routines allocate and free an X509 structure, which represents an X509 certificate.

                        X509_new_ex() allocates and initializes a X509 structure with a library context of libctx, property query of propq and a reference count of 1. Many X509 functions such as X509_check_purpose(), and X509_verify() use this library context to select which providers supply the fetched algorithms (SHA1 is used internally). This created X509 object can then be used when loading binary data using d2i_X509().

                        X509_new() is similar to X509_new_ex() but sets the library context and property query to NULL. This results in the default (NULL) library context being used for any X509 operations requiring algorithm fetches.

                        X509_free() decrements the reference count of X509 structure a and frees it up if the reference count is zero. If the argument is NULL, nothing is done.

                        X509_up_ref() increments the reference count of a.

                        X509_chain_up_ref() increases the reference count of all certificates in chain x and returns a copy of the stack, or an empty stack if a is NULL.

                        "},{"location":"man3/X509_new/#notes","title":"NOTES","text":"

                        The function X509_up_ref() if useful if a certificate structure is being used by several different operations each of which will free it up after use: this avoids the need to duplicate the entire certificate structure.

                        The function X509_chain_up_ref() doesn't just up the reference count of each certificate. It also returns a copy of the stack, using sk_X509_dup(), but it serves a similar purpose: the returned chain persists after the original has been freed.

                        "},{"location":"man3/X509_new/#return-values","title":"RETURN VALUES","text":"

                        If the allocation fails, X509_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                        X509_up_ref() returns 1 for success and 0 for failure.

                        X509_chain_up_ref() returns a copy of the stack or NULL if an error occurred.

                        "},{"location":"man3/X509_new/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/X509_new/#history","title":"HISTORY","text":"

                        The function X509_new_ex() was added in OpenSSL 3.0.

                        "},{"location":"man3/X509_new/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_sign/","title":"X509_sign","text":""},{"location":"man3/X509_sign/#name","title":"NAME","text":"

                        X509_sign, X509_sign_ctx, X509_REQ_sign, X509_REQ_sign_ctx, X509_CRL_sign, X509_CRL_sign_ctx - sign certificate, certificate request, or CRL signature

                        "},{"location":"man3/X509_sign/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);\n\nint X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);\n\nint X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);\n
                        "},{"location":"man3/X509_sign/#description","title":"DESCRIPTION","text":"

                        X509_sign() signs certificate x using private key pkey and message digest md and sets the signature in x. X509_sign_ctx() also signs certificate x but uses the parameters contained in digest context ctx.

                        X509_REQ_sign(), X509_REQ_sign_ctx(), X509_CRL_sign(), and X509_CRL_sign_ctx() sign certificate requests and CRLs, respectively.

                        "},{"location":"man3/X509_sign/#notes","title":"NOTES","text":"

                        X509_sign_ctx() is used where the default parameters for the corresponding public key and digest are not suitable. It can be used to sign keys using RSA-PSS for example.

                        For efficiency reasons and to work around ASN.1 encoding issues the encoding of the signed portion of a certificate, certificate request and CRL is cached internally. If the signed portion of the structure is modified the encoding is not always updated meaning a stale version is sometimes used. This is not normally a problem because modifying the signed portion will invalidate the signature and signing will always update the encoding.

                        "},{"location":"man3/X509_sign/#return-values","title":"RETURN VALUES","text":"

                        All functions return the size of the signature in bytes for success and zero for failure.

                        "},{"location":"man3/X509_sign/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3), X509_NAME_add_entry_by_txt(3), X509_new(3), X509_verify_cert(3), X509_verify(3), X509_REQ_verify_ex(3), X509_REQ_verify(3), X509_CRL_verify(3)

                        "},{"location":"man3/X509_sign/#history","title":"HISTORY","text":"

                        The X509_sign(), X509_REQ_sign() and X509_CRL_sign() functions are available in all versions of OpenSSL.

                        The X509_sign_ctx(), X509_REQ_sign_ctx() and X509_CRL_sign_ctx() functions were added in OpenSSL 1.0.1.

                        "},{"location":"man3/X509_sign/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_verify/","title":"X509_verify","text":""},{"location":"man3/X509_verify/#name","title":"NAME","text":"

                        X509_verify, X509_self_signed, X509_REQ_verify_ex, X509_REQ_verify, X509_CRL_verify - verify certificate, certificate request, or CRL signature

                        "},{"location":"man3/X509_verify/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509_verify(X509 *x, EVP_PKEY *pkey);\nint X509_self_signed(X509 *cert, int verify_signature);\n\nint X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,\n                       const char *propq);\nint X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);\nint X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);\n
                        "},{"location":"man3/X509_verify/#description","title":"DESCRIPTION","text":"

                        X509_verify() verifies the signature of certificate x using public key pkey. Only the signature is checked: no other checks (such as certificate chain validity) are performed.

                        X509_self_signed() checks whether certificate cert is self-signed. For success the issuer and subject names must match, the components of the authority key identifier (if present) must match the subject key identifier etc. The signature itself is actually verified only if verify_signature is 1, as for explicitly trusted certificates this verification is not worth the effort.

                        X509_REQ_verify_ex(), X509_REQ_verify() and X509_CRL_verify() verify the signatures of certificate requests and CRLs, respectively.

                        "},{"location":"man3/X509_verify/#return-values","title":"RETURN VALUES","text":"

                        X509_verify(), X509_REQ_verify_ex(), X509_REQ_verify() and X509_CRL_verify() return 1 if the signature is valid and 0 if the signature check fails. If the signature could not be checked at all because it was ill-formed, the certificate or the request was not complete or some other error occurred then -1 is returned.

                        X509_self_signed() returns the same values but also returns 1 if all respective fields match and verify_signature is 0.

                        "},{"location":"man3/X509_verify/#see-also","title":"SEE ALSO","text":"

                        d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509V3_get_d2i(3), X509_verify_cert(3), OSSL_LIB_CTX(3)

                        "},{"location":"man3/X509_verify/#history","title":"HISTORY","text":"

                        The X509_verify(), X509_REQ_verify(), and X509_CRL_verify() functions are available in all versions of OpenSSL.

                        X509_REQ_verify_ex(), and X509_self_signed() were added in OpenSSL 3.0.

                        "},{"location":"man3/X509_verify/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509_verify_cert/","title":"X509_verify_cert","text":""},{"location":"man3/X509_verify_cert/#name","title":"NAME","text":"

                        X509_build_chain, X509_verify_cert, X509_STORE_CTX_verify - build and verify X509 certificate chain

                        "},{"location":"man3/X509_verify_cert/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509_vfy.h>\n\nSTACK_OF(X509) *X509_build_chain(X509 *target, STACK_OF(X509) *certs,\n                                 X509_STORE *store, int with_self_signed,\n                                 OSSL_LIB_CTX *libctx, const char *propq);\nint X509_verify_cert(X509_STORE_CTX *ctx);\nint X509_STORE_CTX_verify(X509_STORE_CTX *ctx);\n
                        "},{"location":"man3/X509_verify_cert/#description","title":"DESCRIPTION","text":"

                        X509_build_chain() builds a certificate chain starting from target using the optional list of intermediate CA certificates certs. If store is NULL it builds the chain as far down as possible, ignoring errors. Else the chain must reach a trust anchor contained in store. It internally uses a X509_STORE_CTX structure associated with the library context libctx and property query string propq, both of which may be NULL. In case there is more than one possibility for the chain, only one is taken.

                        On success it returns a pointer to a new stack of (up_ref'ed) certificates starting with target and followed by all available intermediate certificates. A self-signed trust anchor is included only if target is the trust anchor of with_self_signed is 1. If a non-NULL stack is returned the caller is responsible for freeing it.

                        The X509_verify_cert() function attempts to discover and validate a certificate chain based on parameters in ctx. The verification context, of type X509_STORE_CTX, can be constructed using X509_STORE_CTX_new(3) and X509_STORE_CTX_init(3). It usually includes a target certificate to be verified, a set of certificates serving as trust anchors, a list of non-trusted certificates that may be helpful for chain construction, flags such as X509_V_FLAG_X509_STRICT, and various other optional components such as a callback function that allows customizing the verification outcome. A complete description of the certificate verification process is contained in the openssl-verification-options(1) manual page.

                        Applications rarely call this function directly but it is used by OpenSSL internally for certificate validation, in both the S/MIME and SSL/TLS code.

                        A negative return value from X509_verify_cert() can occur if it is invoked incorrectly, such as with no certificate set in ctx, or when it is called twice in succession without reinitialising ctx for the second call. A negative return value can also happen due to internal resource problems or because an internal inconsistency has been detected. Applications must interpret any return value <= 0 as an error.

                        The X509_STORE_CTX_verify() behaves like X509_verify_cert() except that its target certificate is the first element of the list of untrusted certificates in ctx unless a target certificate is set explicitly.

                        "},{"location":"man3/X509_verify_cert/#return-values","title":"RETURN VALUES","text":"

                        X509_build_chain() returns NULL on error, else a stack of certificates.

                        Both X509_verify_cert() and X509_STORE_CTX_verify() return 1 if a complete chain can be built and validated, otherwise they return 0, and in exceptional circumstances (such as malloc failure and internal errors) they can also return a negative code.

                        If a complete chain can be built and validated both functions return 1. If the certificate must be rejected on the basis of the data available or any required certificate status data is not available they return 0. If no definite answer possible they usually return a negative code.

                        On error or failure additional error information can be obtained by examining ctx using, for example, X509_STORE_CTX_get_error(3). Even if verification indicated success, the stored error code may be different from X509_V_OK, likely because a verification callback function has waived the error.

                        "},{"location":"man3/X509_verify_cert/#see-also","title":"SEE ALSO","text":"

                        X509_STORE_CTX_new(3), X509_STORE_CTX_init(3), X509_STORE_CTX_get_error(3)

                        "},{"location":"man3/X509_verify_cert/#history","title":"HISTORY","text":"

                        X509_build_chain() and X509_STORE_CTX_verify() were added in OpenSSL 3.0.

                        "},{"location":"man3/X509_verify_cert/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2009-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/X509v3_get_ext_by_NID/","title":"X509v3_get_ext_by_NID","text":""},{"location":"man3/X509v3_get_ext_by_NID/#name","title":"NAME","text":"

                        X509v3_get_ext_count, X509v3_get_ext, X509v3_get_ext_by_NID, X509v3_get_ext_by_OBJ, X509v3_get_ext_by_critical, X509v3_delete_ext, X509v3_add_ext, X509_get_ext_count, X509_get_ext, X509_get_ext_by_NID, X509_get_ext_by_OBJ, X509_get_ext_by_critical, X509_delete_ext, X509_add_ext, X509_CRL_get_ext_count, X509_CRL_get_ext, X509_CRL_get_ext_by_NID, X509_CRL_get_ext_by_OBJ, X509_CRL_get_ext_by_critical, X509_CRL_delete_ext, X509_CRL_add_ext, X509_REVOKED_get_ext_count, X509_REVOKED_get_ext, X509_REVOKED_get_ext_by_NID, X509_REVOKED_get_ext_by_OBJ, X509_REVOKED_get_ext_by_critical, X509_REVOKED_delete_ext, X509_REVOKED_add_ext - extension stack utility functions

                        "},{"location":"man3/X509v3_get_ext_by_NID/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nint X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);\nX509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);\n\nint X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,\n                          int nid, int lastpos);\nint X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,\n                          const ASN1_OBJECT *obj, int lastpos);\nint X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,\n                               int crit, int lastpos);\nX509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);\nSTACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,\n                                         X509_EXTENSION *ex, int loc);\n\nint X509_get_ext_count(const X509 *x);\nX509_EXTENSION *X509_get_ext(const X509 *x, int loc);\nint X509_get_ext_by_NID(const X509 *x, int nid, int lastpos);\nint X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos);\nint X509_get_ext_by_critical(const X509 *x, int crit, int lastpos);\nX509_EXTENSION *X509_delete_ext(X509 *x, int loc);\nint X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);\n\nint X509_CRL_get_ext_count(const X509_CRL *x);\nX509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);\nint X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos);\nint X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj,\n                            int lastpos);\nint X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos);\nX509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);\nint X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);\n\nint X509_REVOKED_get_ext_count(const X509_REVOKED *x);\nX509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc);\nint X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos);\nint X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,\n                                int lastpos);\nint X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, int lastpos);\nX509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);\nint X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);\n
                        "},{"location":"man3/X509v3_get_ext_by_NID/#description","title":"DESCRIPTION","text":"

                        X509v3_get_ext_count() retrieves the number of extensions in x.

                        X509v3_get_ext() retrieves extension loc from x. The index loc can take any value from 0 to X509_get_ext_count(x) - 1. The returned extension is an internal pointer which MUST NOT be freed by the application.

                        X509v3_get_ext_by_NID() and X509v3_get_ext_by_OBJ() look for an extension with nid or obj from extension STACK x. The search starts from the extension after lastpos or from the beginning if lastpos is -1. If the extension is found, its index is returned, otherwise -1 is returned.

                        X509v3_get_ext_by_critical() is similar to X509v3_get_ext_by_NID() except it looks for an extension of criticality crit. A zero value for crit looks for a non-critical extension. A nonzero value looks for a critical extension.

                        X509v3_delete_ext() deletes the extension with index loc from x. The deleted extension is returned and must be freed by the caller. If loc is an invalid index value, NULL is returned.

                        X509v3_add_ext() adds extension ex to STACK *x at position loc. If loc is -1, the new extension is added to the end. If *x is NULL, a new STACK will be allocated. The passed extension ex is duplicated internally so it must be freed after use.

                        X509_get_ext_count(), X509_get_ext(), X509_get_ext_by_NID(), X509_get_ext_by_OBJ(), X509_get_ext_by_critical(), X509_delete_ext() and X509_add_ext() operate on the extensions of certificate x. They are otherwise identical to the X509v3 functions.

                        X509_CRL_get_ext_count(), X509_CRL_get_ext(), X509_CRL_get_ext_by_NID(), X509_CRL_get_ext_by_OBJ(), X509_CRL_get_ext_by_critical(), X509_CRL_delete_ext() and X509_CRL_add_ext() operate on the extensions of CRL x. They are otherwise identical to the X509v3 functions.

                        X509_REVOKED_get_ext_count(), X509_REVOKED_get_ext(), X509_REVOKED_get_ext_by_NID(), X509_REVOKED_get_ext_by_OBJ(), X509_REVOKED_get_ext_by_critical(), X509_REVOKED_delete_ext() and X509_REVOKED_add_ext() operate on the extensions of CRL entry x. They are otherwise identical to the X509v3 functions.

                        "},{"location":"man3/X509v3_get_ext_by_NID/#notes","title":"NOTES","text":"

                        These functions are used to examine stacks of extensions directly. Applications that want to parse or encode and add an extension should use the extension encode and decode functions instead, such as X509_add1_ext_i2d() and X509_get_ext_d2i().

                        For X509v3_get_ext_by_NID(), X509v3_get_ext_by_OBJ(), X509v3_get_ext_by_critical() and its variants, a zero index return value is not an error since extension STACK x indices start from zero. These search functions start from the extension after the lastpos parameter so it should initially be set to -1. If it is set to zero, the initial extension will not be checked.

                        X509v3_delete_ext() and its variants are a bit counter-intuitive because these functions do not free the extension they delete. They return an X509_EXTENSION object which must be explicitly freed using X509_EXTENSION_free().

                        "},{"location":"man3/X509v3_get_ext_by_NID/#return-values","title":"RETURN VALUES","text":"

                        X509v3_get_ext_count() returns the extension count or 0 for failure.

                        X509v3_get_ext(), X509v3_delete_ext() and X509_delete_ext() return an X509_EXTENSION structure or NULL if an error occurs.

                        X509v3_get_ext_by_OBJ() and X509v3_get_ext_by_critical() return the extension index or -1 if an error occurs.

                        X509v3_get_ext_by_NID() returns the extension index or negative values if an error occurs.

                        X509v3_add_ext() returns a STACK of extensions or NULL on error.

                        X509_add_ext() returns 1 on success and 0 on error.

                        "},{"location":"man3/X509v3_get_ext_by_NID/#see-also","title":"SEE ALSO","text":"

                        X509V3_get_d2i(3)

                        "},{"location":"man3/X509v3_get_ext_by_NID/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/b2i_PVK_bio_ex/","title":"b2i_PVK_bio_ex","text":""},{"location":"man3/b2i_PVK_bio_ex/#name","title":"NAME","text":"

                        b2i_PVK_bio, b2i_PVK_bio_ex, i2b_PVK_bio, i2b_PVK_bio_ex - Decode and encode functions for reading and writing MSBLOB format private keys

                        "},{"location":"man3/b2i_PVK_bio_ex/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/pem.h>\n\nEVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);\nEVP_PKEY *b2i_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u,\n                         OSSL_LIB_CTX *libctx, const char *propq);\nint i2b_PVK_bio(BIO *out, const EVP_PKEY *pk, int enclevel,\n                pem_password_cb *cb, void *u);\nint i2b_PVK_bio_ex(BIO *out, const EVP_PKEY *pk, int enclevel,\n                   pem_password_cb *cb, void *u,\n                   OSSL_LIB_CTX *libctx, const char *propq);\n
                        "},{"location":"man3/b2i_PVK_bio_ex/#description","title":"DESCRIPTION","text":"

                        b2i_PVK_bio_ex() decodes a private key of MSBLOB format read from a BIO. It attempts to automatically determine the key type. If the key is encrypted then cb is called with the user data u in order to obtain a password to decrypt the key. The supplied library context libctx and property query string propq are used in any decrypt operation.

                        b2i_PVK_bio() does the same as b2i_PVK_bio_ex() except that the default library context and property query string are used.

                        i2b_PVK_bio_ex() encodes pk using MSBLOB format. If enclevel is 1 then a password obtained via pem_password_cb is used to encrypt the private key. If enclevel is 0 then no encryption is applied. The user data in u is passed to the password callback. The supplied library context libctx and property query string propq are used in any decrypt operation.

                        i2b_PVK_bio() does the same as i2b_PVK_bio_ex() except that the default library context and property query string are used.

                        "},{"location":"man3/b2i_PVK_bio_ex/#return-values","title":"RETURN VALUES","text":"

                        The b2i_PVK_bio() and b2i_PVK_bio_ex() functions return a valid EVP_KEY structure or NULL if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                        i2b_PVK_bio() and i2b_PVK_bio_ex() return the number of bytes successfully encoded or a negative value if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                        "},{"location":"man3/b2i_PVK_bio_ex/#see-also","title":"SEE ALSO","text":"

                        crypto(7), d2i_PKCS8PrivateKey_bio(3)

                        "},{"location":"man3/b2i_PVK_bio_ex/#history","title":"HISTORY","text":"

                        b2i_PVK_bio_ex() and i2b_PVK_bio_ex() were added in OpenSSL 3.0.

                        "},{"location":"man3/b2i_PVK_bio_ex/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/d2i_PKCS8PrivateKey_bio/","title":"d2i_PKCS8PrivateKey_bio","text":""},{"location":"man3/d2i_PKCS8PrivateKey_bio/#name","title":"NAME","text":"

                        d2i_PKCS8PrivateKey_bio, d2i_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_bio, i2d_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_nid_bio, i2d_PKCS8PrivateKey_nid_fp - PKCS#8 format private key functions

                        "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/pem.h>\n\nEVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);\nEVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_bio(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc,\n                            char *kstr, int klen,\n                            pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_fp(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc,\n                           char *kstr, int klen,\n                           pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_nid_bio(BIO *bp, const EVP_PKEY *x, int nid,\n                                char *kstr, int klen,\n                                pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_nid_fp(FILE *fp, const EVP_PKEY *x, int nid,\n                               char *kstr, int klen,\n                               pem_password_cb *cb, void *u);\n
                        "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#description","title":"DESCRIPTION","text":"

                        The PKCS#8 functions encode and decode private keys in PKCS#8 format using both PKCS#5 v1.5 and PKCS#5 v2.0 password based encryption algorithms.

                        Other than the use of DER as opposed to PEM these functions are identical to the corresponding PEM function as described in PEM_read_PrivateKey(3).

                        "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#notes","title":"NOTES","text":"

                        These functions are currently the only way to store encrypted private keys using DER format.

                        Currently all the functions use BIOs or FILE pointers, there are no functions which work directly on memory: this can be readily worked around by converting the buffers to memory BIOs, see BIO_s_mem(3) for details.

                        These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                        "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#return-values","title":"RETURN VALUES","text":"

                        d2i_PKCS8PrivateKey_bio() and d2i_PKCS8PrivateKey_fp() return a valid EVP_PKEY structure or NULL if an error occurred.

                        i2d_PKCS8PrivateKey_bio(), i2d_PKCS8PrivateKey_fp(), i2d_PKCS8PrivateKey_nid_bio() and i2d_PKCS8PrivateKey_nid_fp() return 1 on success or 0 on error.

                        "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#see-also","title":"SEE ALSO","text":"

                        PEM_read_PrivateKey(3), passphrase-encoding(7)

                        "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/d2i_PrivateKey/","title":"d2i_PrivateKey","text":""},{"location":"man3/d2i_PrivateKey/#name","title":"NAME","text":"

                        d2i_PrivateKey_ex, d2i_PrivateKey, d2i_PublicKey, d2i_KeyParams, d2i_AutoPrivateKey_ex, d2i_AutoPrivateKey, i2d_PrivateKey, i2d_PublicKey, i2d_KeyParams, i2d_KeyParams_bio, d2i_PrivateKey_ex_bio, d2i_PrivateKey_bio, d2i_PrivateKey_ex_fp, d2i_PrivateKey_fp, d2i_KeyParams_bio, i2d_PrivateKey_bio, i2d_PrivateKey_fp - decode and encode functions for reading and saving EVP_PKEY structures

                        "},{"location":"man3/d2i_PrivateKey/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/evp.h>\n\nEVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp,\n                            long length, OSSL_LIB_CTX *libctx,\n                            const char *propq);\nEVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,\n                         long length);\nEVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,\n                        long length);\nEVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp,\n                        long length);\nEVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp,\n                                long length, OSSL_LIB_CTX *libctx,\n                                const char *propq);\nEVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,\n                             long length);\n\nint i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp);\nint i2d_PublicKey(const EVP_PKEY *a, unsigned char **pp);\nint i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp);\nint i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey);\nEVP_PKEY *d2i_KeyParams_bio(int type, EVP_PKEY **a, BIO *in);\n\n\n#include <openssl/x509.h>\n\nEVP_PKEY *d2i_PrivateKey_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,\n                                const char *propq);\nEVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);\nEVP_PKEY *d2i_PrivateKey_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,\n                               const char *propq);\nEVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);\n\nint i2d_PrivateKey_bio(BIO *bp, const EVP_PKEY *pkey);\nint i2d_PrivateKey_fp(FILE *fp, const EVP_PKEY *pkey);\n
                        "},{"location":"man3/d2i_PrivateKey/#description","title":"DESCRIPTION","text":"

                        d2i_PrivateKey_ex() decodes a private key using algorithm type. It attempts to use any key-specific format or PKCS#8 unencrypted PrivateKeyInfo format. The type parameter should be a public key algorithm constant such as EVP_PKEY_RSA. An error occurs if the decoded key does not match type. Some private key decoding implementations may use cryptographic algorithms (for example to automatically derive the public key if it is not explicitly included in the encoding). In this case the supplied library context libctx and property query string propq are used. If successful and the a parameter is not NULL the function assigns the returned EVP_PKEY structure pointer to *a, overwriting any previous value.

                        d2i_PrivateKey() does the same as d2i_PrivateKey_ex() except that the default library context and property query string are used. d2i_PublicKey() does the same for public keys. d2i_KeyParams() does the same for key parameters.

                        The d2i_PrivateKey_ex_bio() and d2i_PrivateKey_bio() functions are similar to d2i_PrivateKey_ex() and d2i_PrivateKey() respectively except that they decode the data read from the given BIO. The d2i_PrivateKey_ex_fp() and d2i_PrivateKey_fp() functions are the same except that they read the data from the given FILE.

                        d2i_AutoPrivateKey_ex() and d2i_AutoPrivateKey() are similar to d2i_PrivateKey_ex() and d2i_PrivateKey() respectively except that they attempt to automatically detect the private key format.

                        i2d_PrivateKey() encodes a. It uses a key specific format or, if none is defined for that key type, PKCS#8 unencrypted PrivateKeyInfo format. i2d_PublicKey() does the same for public keys. i2d_KeyParams() does the same for key parameters. These functions are similar to the d2i_X509() functions; see d2i_X509(3). i2d_PrivateKey_bio() and i2d_PrivateKey_fp() do the same thing except that they encode to a BIO or FILE respectively. Again, these work similarly to the functions described in d2i_X509(3).

                        "},{"location":"man3/d2i_PrivateKey/#notes","title":"NOTES","text":"

                        All the functions that operate on data in memory update the data pointer *pp after a successful operation, just like the other d2i and i2d functions; see d2i_X509(3).

                        All these functions use DER format and unencrypted keys. Applications wishing to encrypt or decrypt private keys should use other functions such as d2i_PKCS8PrivateKey() instead.

                        To decode a key with type EVP_PKEY_EC, d2i_PublicKey() requires *a to be a non-NULL EVP_PKEY structure assigned an EC_KEY structure referencing the proper EC_GROUP.

                        "},{"location":"man3/d2i_PrivateKey/#return-values","title":"RETURN VALUES","text":"

                        The d2i_PrivateKey_ex(), d2i_PrivateKey(), d2i_AutoPrivateKey_ex(), d2i_AutoPrivateKey(), d2i_PrivateKey_ex_bio(), d2i_PrivateKey_bio(), d2i_PrivateKey_ex_fp(), d2i_PrivateKey_fp(), d2i_PublicKey(), d2i_KeyParams() and d2i_KeyParams_bio() functions return a valid EVP_PKEY structure or NULL if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                        i2d_PrivateKey(), i2d_PublicKey() and i2d_KeyParams() return the number of bytes successfully encoded or a negative value if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                        i2d_PrivateKey_bio(), i2d_PrivateKey_fp() and i2d_KeyParams_bio() return 1 if successfully encoded or zero if an error occurs.

                        "},{"location":"man3/d2i_PrivateKey/#see-also","title":"SEE ALSO","text":"

                        crypto(7), d2i_PKCS8PrivateKey_bio(3)

                        "},{"location":"man3/d2i_PrivateKey/#history","title":"HISTORY","text":"

                        d2i_PrivateKey_ex(), d2i_PrivateKey_ex_bio(), d2i_PrivateKey_ex_fp(), and d2i_AutoPrivateKey_ex() were added in OpenSSL 3.0.

                        "},{"location":"man3/d2i_PrivateKey/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/d2i_RSAPrivateKey/","title":"d2i_RSAPrivateKey","text":""},{"location":"man3/d2i_RSAPrivateKey/#name","title":"NAME","text":"

                        d2i_DSAPrivateKey, d2i_DSAPrivateKey_bio, d2i_DSAPrivateKey_fp, d2i_DSAPublicKey, d2i_DSA_PUBKEY, d2i_DSA_PUBKEY_bio, d2i_DSA_PUBKEY_fp, d2i_DSAparams, d2i_RSAPrivateKey, d2i_RSAPrivateKey_bio, d2i_RSAPrivateKey_fp, d2i_RSAPublicKey, d2i_RSAPublicKey_bio, d2i_RSAPublicKey_fp, d2i_RSA_PUBKEY, d2i_RSA_PUBKEY_bio, d2i_RSA_PUBKEY_fp, d2i_DHparams, d2i_DHparams_bio, d2i_DHparams_fp, d2i_ECParameters, d2i_ECPrivateKey, d2i_ECPrivateKey_bio, d2i_ECPrivateKey_fp, d2i_EC_PUBKEY, d2i_EC_PUBKEY_bio, d2i_EC_PUBKEY_fp, i2d_RSAPrivateKey, i2d_RSAPrivateKey_bio, i2d_RSAPrivateKey_fp, i2d_RSAPublicKey, i2d_RSAPublicKey_bio, i2d_RSAPublicKey_fp, i2d_RSA_PUBKEY, i2d_RSA_PUBKEY_bio, i2d_RSA_PUBKEY_fp, i2d_DHparams, i2d_DHparams_bio, i2d_DHparams_fp, i2d_DSAPrivateKey, i2d_DSAPrivateKey_bio, i2d_DSAPrivateKey_fp, i2d_DSAPublicKey, i2d_DSA_PUBKEY, i2d_DSA_PUBKEY_bio, i2d_DSA_PUBKEY_fp, i2d_DSAparams, i2d_ECParameters, i2d_ECPrivateKey, i2d_ECPrivateKey_bio, i2d_ECPrivateKey_fp, i2d_EC_PUBKEY, i2d_EC_PUBKEY_bio, i2d_EC_PUBKEY_fp - DEPRECATED

                        "},{"location":"man3/d2i_RSAPrivateKey/#synopsis","title":"SYNOPSIS","text":"

                        The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                        TYPE *d2i_TYPEPrivateKey(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPEPrivateKey_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPEPrivateKey_fp(FILE *fp, TYPE **a);\nTYPE *d2i_TYPEPublicKey(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPEPublicKey_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPEPublicKey_fp(FILE *fp, TYPE **a);\nTYPE *d2i_TYPEparams(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPEparams_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPEparams_fp(FILE *fp, TYPE **a);\nTYPE *d2i_TYPE_PUBKEY(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPE_PUBKEY_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPE_PUBKEY_fp(FILE *fp, TYPE **a);\n\nint i2d_TYPEPrivateKey(const TYPE *a, unsigned char **ppout);\nint i2d_TYPEPrivateKey(TYPE *a, unsigned char **ppout);\nint i2d_TYPEPrivateKey_fp(FILE *fp, const TYPE *a);\nint i2d_TYPEPrivateKey_fp(FILE *fp, TYPE *a);\nint i2d_TYPEPrivateKey_bio(BIO *bp, const TYPE *a);\nint i2d_TYPEPrivateKey_bio(BIO *bp, TYPE *a);\nint i2d_TYPEPublicKey(const TYPE *a, unsigned char **ppout);\nint i2d_TYPEPublicKey(TYPE *a, unsigned char **ppout);\nint i2d_TYPEPublicKey_fp(FILE *fp, const TYPE *a);\nint i2d_TYPEPublicKey_fp(FILE *fp, TYPE *a);\nint i2d_TYPEPublicKey_bio(BIO *bp, const TYPE *a);\nint i2d_TYPEPublicKey_bio(BIO *bp, TYPE *a);\nint i2d_TYPEparams(const TYPE *a, unsigned char **ppout);\nint i2d_TYPEparams(TYPE *a, unsigned char **ppout);\nint i2d_TYPEparams_fp(FILE *fp, const TYPE *a);\nint i2d_TYPEparams_fp(FILE *fp, TYPE *a);\nint i2d_TYPEparams_bio(BIO *bp, const TYPE *a);\nint i2d_TYPEparams_bio(BIO *bp, TYPE *a);\nint i2d_TYPE_PUBKEY(const TYPE *a, unsigned char **ppout);\nint i2d_TYPE_PUBKEY(TYPE *a, unsigned char **ppout);\nint i2d_TYPE_PUBKEY_fp(FILE *fp, const TYPE *a);\nint i2d_TYPE_PUBKEY_fp(FILE *fp, TYPE *a);\nint i2d_TYPE_PUBKEY_bio(BIO *bp, const TYPE *a);\nint i2d_TYPE_PUBKEY_bio(BIO *bp, TYPE *a);\n
                        "},{"location":"man3/d2i_RSAPrivateKey/#description","title":"DESCRIPTION","text":"

                        All functions described here are deprecated. Please use OSSL_DECODER(3) instead of the d2i functions and OSSL_ENCODER(3) instead of the i2d functions. See \"Migration\" below.

                        In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes, such as RSA. The function parameters ppin and ppout are generally either both named pp in the headers, or in and out.

                        All the functions here behave the way that's described in d2i_X509(3).

                        Please note that not all functions in the synopsis are available for all key types. For example, there are no d2i_RSAparams() or i2d_RSAparams(), because the PKCS#1 RSA structure doesn't include any key parameters.

                        d2i__TYPE_PrivateKey() and derivates thereof decode DER encoded TYPE private key data organized in a type specific structure.

                        d2i__TYPE_PublicKey() and derivates thereof decode DER encoded TYPE public key data organized in a type specific structure.

                        d2i__TYPE_params() and derivates thereof decode DER encoded TYPE key parameters organized in a type specific structure.

                        d2i_TYPE_PUBKEY() and derivates thereof decode DER encoded TYPE public key data organized in a SubjectPublicKeyInfo structure.

                        i2d__TYPE_PrivateKey() and derivates thereof encode the private key TYPE data into a type specific DER encoded structure.

                        i2d__TYPE_PublicKey() and derivates thereof encode the public key TYPE data into a type specific DER encoded structure.

                        i2d__TYPE_params() and derivates thereof encode the TYPE key parameters data into a type specific DER encoded structure.

                        i2d_TYPE_PUBKEY() and derivates thereof encode the public key TYPE data into a DER encoded SubjectPublicKeyInfo structure.

                        For example, d2i_RSAPrivateKey() and d2i_RSAPublicKey() expects the structure defined by PKCS#1. Similarly, i2d_RSAPrivateKey() and i2d_RSAPublicKey() produce DER encoded string organized according to PKCS#1.

                        "},{"location":"man3/d2i_RSAPrivateKey/#migration","title":"Migration","text":"

                        Migration from the diverse TYPEs requires using corresponding new OpenSSL types. For all TYPEs described here, the corresponding new type is EVP_PKEY. The rest of this section assumes that this has been done, exactly how to do that is described elsewhere.

                        There are two migration paths:

                        • Replace b<d2i_TYPE_PrivateKey()> with d2i_PrivateKey(3), b<d2i__TYPE_PublicKey()> with d2i_PublicKey(3), b<d2i__TYPE_params()> with d2i_KeyParams(3), b<d2i__TYPE_PUBKEY()> with d2i_PUBKEY(3), b<i2d_TYPE_PrivateKey()> with i2d_PrivateKey(3), b<i2d__TYPE_PublicKey()> with i2d_PublicKey(3), b<i2d__TYPE_params()> with i2d_KeyParams(3), b<i2d__TYPE_PUBKEY()> with i2d_PUBKEY(3). A caveat is that i2d_PrivateKey(3) may output a DER encoded PKCS#8 outermost structure instead of the type specific structure, and that d2i_PrivateKey(3) recognises and unpacks a PKCS#8 structures.
                        • Use OSSL_DECODER(3) and OSSL_ENCODER(3). How to migrate is described below. All those descriptions assume that the key to be encoded is in the variable pkey.
                        "},{"location":"man3/d2i_RSAPrivateKey/#migrating-i2d-functions-to-ossl_encoder","title":"Migrating i2d functions to OSSL_ENCODER","text":"

                        The exact OSSL_ENCODER(3) output is driven by arguments rather than by function names. The sample code to get DER encoded output in a type specific structure is uniform, the only things that vary are the selection of what part of the EVP_PKEY should be output, and the structure. The i2d functions names can therefore be translated into two variables, selection and structure as follows:

                        • i2d__TYPE_PrivateKey() translates into:

                          int selection = EVP_PKEY_KEYPAIR;\nconst char *structure = \"type-specific\";\n
                        • i2d__TYPE_PublicKey() translates into:

                          int selection = EVP_PKEY_PUBLIC_KEY;\nconst char *structure = \"type-specific\";\n
                        • i2d__TYPE_params() translates into:

                          int selection = EVP_PKEY_PARAMETERS;\nconst char *structure = \"type-specific\";\n
                        • i2d_TYPE_PUBKEY() translates into:

                          int selection = EVP_PKEY_PUBLIC_KEY;\nconst char *structure = \"SubjectPublicKeyInfo\";\n

                        The following sample code does the rest of the work:

                        unsigned char *p = buffer;     /* |buffer| is supplied by the caller */\nsize_t len = buffer_size;      /* assumed be the size of |buffer| */\nOSSL_ENCODER_CTX *ctx =\n    OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, \"DER\", structure,\n                                  NULL, NULL);\nif (ctx == NULL) {\n    /* fatal error handling */\n}\nif (OSSL_ENCODER_CTX_get_num_encoders(ctx) == 0) {\n    OSSL_ENCODER_CTX_free(ctx);\n    /* non-fatal error handling */\n}\nif (!OSSL_ENCODER_to_data(ctx, &p, &len)) {\n    OSSL_ENCODER_CTX_free(ctx);\n    /* error handling */\n}\nOSSL_ENCODER_CTX_free(ctx);\n
                        "},{"location":"man3/d2i_RSAPrivateKey/#notes","title":"NOTES","text":"

                        The letters i and d in i2d_TYPE() stand for \"internal\" (that is, an internal C structure) and \"DER\" respectively. So i2d_TYPE() converts from internal to DER.

                        The functions can also understand BER forms.

                        The actual TYPE structure passed to i2d_TYPE() must be a valid populated TYPE structure -- it cannot simply be fed with an empty structure such as that returned by TYPE_new().

                        The encoded data is in binary form and may contain embedded zeros. Therefore, any FILE pointers or BIOs should be opened in binary mode. Functions such as strlen() will not return the correct length of the encoded structure.

                        The ways that *ppin and *ppout are incremented after the operation can trap the unwary. See the WARNINGS section in d2i_X509(3) for some common errors. The reason for this-auto increment behaviour is to reflect a typical usage of ASN1 functions: after one structure is encoded or decoded another will be processed after it.

                        The following points about the data types might be useful:

                        • DSA_PUBKEY

                          Represents a DSA public key using a SubjectPublicKeyInfo structure.

                        • DSAPublicKey, DSAPrivateKey

                          Use a non-standard OpenSSL format and should be avoided; use DSA_PUBKEY, PEM_write_PrivateKey(3), or similar instead.

                        "},{"location":"man3/d2i_RSAPrivateKey/#return-values","title":"RETURN VALUES","text":"

                        d2i_TYPE(), d2i_TYPE_bio() and d2i_TYPE_fp() return a valid TYPE structure or NULL if an error occurs. If the \"reuse\" capability has been used with a valid structure being passed in via a, then the object is freed in the event of error and *a is set to NULL.

                        i2d_TYPE() returns the number of bytes successfully encoded or a negative value if an error occurs.

                        i2d_TYPE_bio() and i2d_TYPE_fp() return 1 for success and 0 if an error occurs.

                        "},{"location":"man3/d2i_RSAPrivateKey/#see-also","title":"SEE ALSO","text":"

                        OSSL_ENCODER(3), OSSL_DECODER(3), d2i_PrivateKey(3), d2i_PublicKey(3), d2i_KeyParams(3), d2i_PUBKEY(3), i2d_PrivateKey(3), i2d_PublicKey(3), i2d_KeyParams(3), i2d_PUBKEY(3)

                        "},{"location":"man3/d2i_RSAPrivateKey/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/d2i_SSL_SESSION/","title":"d2i_SSL_SESSION","text":""},{"location":"man3/d2i_SSL_SESSION/#name","title":"NAME","text":"

                        d2i_SSL_SESSION, i2d_SSL_SESSION - convert SSL_SESSION object from/to ASN1 representation

                        "},{"location":"man3/d2i_SSL_SESSION/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ssl.h>\n\nSSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,\n                             long length);\nint i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);\n
                        "},{"location":"man3/d2i_SSL_SESSION/#description","title":"DESCRIPTION","text":"

                        These functions decode and encode an SSL_SESSION object. For encoding details see d2i_X509(3).

                        SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object).

                        "},{"location":"man3/d2i_SSL_SESSION/#return-values","title":"RETURN VALUES","text":"

                        d2i_SSL_SESSION() returns a pointer to the newly allocated SSL_SESSION object. In case of failure the NULL-pointer is returned and the error message can be retrieved from the error stack.

                        i2d_SSL_SESSION() returns the size of the ASN1 representation in bytes. When the session is not valid, 0 is returned and no operation is performed.

                        "},{"location":"man3/d2i_SSL_SESSION/#see-also","title":"SEE ALSO","text":"

                        ssl(7), SSL_SESSION_free(3), SSL_CTX_sess_set_get_cb(3), d2i_X509(3)

                        "},{"location":"man3/d2i_SSL_SESSION/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/d2i_X509/","title":"d2i_X509","text":""},{"location":"man3/d2i_X509/#name","title":"NAME","text":"

                        d2i_ACCESS_DESCRIPTION, d2i_ADMISSIONS, d2i_ADMISSION_SYNTAX, d2i_ASIdOrRange, d2i_ASIdentifierChoice, d2i_ASIdentifiers, d2i_ASN1_BIT_STRING, d2i_ASN1_BMPSTRING, d2i_ASN1_ENUMERATED, d2i_ASN1_GENERALIZEDTIME, d2i_ASN1_GENERALSTRING, d2i_ASN1_IA5STRING, d2i_ASN1_INTEGER, d2i_ASN1_NULL, d2i_ASN1_OBJECT, d2i_ASN1_OCTET_STRING, d2i_ASN1_PRINTABLE, d2i_ASN1_PRINTABLESTRING, d2i_ASN1_SEQUENCE_ANY, d2i_ASN1_SET_ANY, d2i_ASN1_T61STRING, d2i_ASN1_TIME, d2i_ASN1_TYPE, d2i_ASN1_UINTEGER, d2i_ASN1_UNIVERSALSTRING, d2i_ASN1_UTCTIME, d2i_ASN1_UTF8STRING, d2i_ASN1_VISIBLESTRING, d2i_ASRange, d2i_AUTHORITY_INFO_ACCESS, d2i_AUTHORITY_KEYID, d2i_BASIC_CONSTRAINTS, d2i_CERTIFICATEPOLICIES, d2i_CMS_ContentInfo, d2i_CMS_ReceiptRequest, d2i_CMS_bio, d2i_CRL_DIST_POINTS, d2i_DHxparams, d2i_DIRECTORYSTRING, d2i_DISPLAYTEXT, d2i_DIST_POINT, d2i_DIST_POINT_NAME, d2i_DSA_SIG, d2i_ECDSA_SIG, d2i_ECPKParameters, d2i_EDIPARTYNAME, d2i_ESS_CERT_ID, d2i_ESS_CERT_ID_V2, d2i_ESS_ISSUER_SERIAL, d2i_ESS_SIGNING_CERT, d2i_ESS_SIGNING_CERT_V2, d2i_EXTENDED_KEY_USAGE, d2i_GENERAL_NAME, d2i_GENERAL_NAMES, d2i_IPAddressChoice, d2i_IPAddressFamily, d2i_IPAddressOrRange, d2i_IPAddressRange, d2i_ISSUER_SIGN_TOOL, d2i_ISSUING_DIST_POINT, d2i_NAMING_AUTHORITY, d2i_NETSCAPE_CERT_SEQUENCE, d2i_NETSCAPE_SPKAC, d2i_NETSCAPE_SPKI, d2i_NOTICEREF, d2i_OCSP_BASICRESP, d2i_OCSP_CERTID, d2i_OCSP_CERTSTATUS, d2i_OCSP_CRLID, d2i_OCSP_ONEREQ, d2i_OCSP_REQINFO, d2i_OCSP_REQUEST, d2i_OCSP_RESPBYTES, d2i_OCSP_RESPDATA, d2i_OCSP_RESPID, d2i_OCSP_RESPONSE, d2i_OCSP_REVOKEDINFO, d2i_OCSP_SERVICELOC, d2i_OCSP_SIGNATURE, d2i_OCSP_SINGLERESP, d2i_OSSL_CMP_MSG, d2i_OSSL_CMP_PKIHEADER, d2i_OSSL_CMP_PKISI, d2i_OSSL_CRMF_CERTID, d2i_OSSL_CRMF_CERTTEMPLATE, d2i_OSSL_CRMF_ENCRYPTEDVALUE, d2i_OSSL_CRMF_MSG, d2i_OSSL_CRMF_MSGS, d2i_OSSL_CRMF_PBMPARAMETER, d2i_OSSL_CRMF_PKIPUBLICATIONINFO, d2i_OSSL_CRMF_SINGLEPUBINFO, d2i_OTHERNAME, d2i_PBE2PARAM, d2i_PBEPARAM, d2i_PBKDF2PARAM, d2i_PKCS12, d2i_PKCS12_BAGS, d2i_PKCS12_MAC_DATA, d2i_PKCS12_SAFEBAG, d2i_PKCS12_bio, d2i_PKCS12_fp, d2i_PKCS7, d2i_PKCS7_DIGEST, d2i_PKCS7_ENCRYPT, d2i_PKCS7_ENC_CONTENT, d2i_PKCS7_ENVELOPE, d2i_PKCS7_ISSUER_AND_SERIAL, d2i_PKCS7_RECIP_INFO, d2i_PKCS7_SIGNED, d2i_PKCS7_SIGNER_INFO, d2i_PKCS7_SIGN_ENVELOPE, d2i_PKCS7_bio, d2i_PKCS7_fp, d2i_PKCS8_PRIV_KEY_INFO, d2i_PKCS8_PRIV_KEY_INFO_bio, d2i_PKCS8_PRIV_KEY_INFO_fp, d2i_PKCS8_bio, d2i_PKCS8_fp, d2i_PKEY_USAGE_PERIOD, d2i_POLICYINFO, d2i_POLICYQUALINFO, d2i_PROFESSION_INFO, d2i_PROXY_CERT_INFO_EXTENSION, d2i_PROXY_POLICY, d2i_RSA_OAEP_PARAMS, d2i_RSA_PSS_PARAMS, d2i_SCRYPT_PARAMS, d2i_SCT_LIST, d2i_SXNET, d2i_SXNETID, d2i_TS_ACCURACY, d2i_TS_MSG_IMPRINT, d2i_TS_MSG_IMPRINT_bio, d2i_TS_MSG_IMPRINT_fp, d2i_TS_REQ, d2i_TS_REQ_bio, d2i_TS_REQ_fp, d2i_TS_RESP, d2i_TS_RESP_bio, d2i_TS_RESP_fp, d2i_TS_STATUS_INFO, d2i_TS_TST_INFO, d2i_TS_TST_INFO_bio, d2i_TS_TST_INFO_fp, d2i_USERNOTICE, d2i_X509, d2i_X509_bio, d2i_X509_fp, d2i_X509_ALGOR, d2i_X509_ALGORS, d2i_X509_ATTRIBUTE, d2i_X509_CERT_AUX, d2i_X509_CINF, d2i_X509_CRL, d2i_X509_CRL_INFO, d2i_X509_CRL_bio, d2i_X509_CRL_fp, d2i_X509_EXTENSION, d2i_X509_EXTENSIONS, d2i_X509_NAME, d2i_X509_NAME_ENTRY, d2i_X509_PUBKEY, d2i_X509_PUBKEY_bio, d2i_X509_PUBKEY_fp, d2i_X509_REQ, d2i_X509_REQ_INFO, d2i_X509_REQ_bio, d2i_X509_REQ_fp, d2i_X509_REVOKED, d2i_X509_SIG, d2i_X509_VAL, i2d_ACCESS_DESCRIPTION, i2d_ADMISSIONS, i2d_ADMISSION_SYNTAX, i2d_ASIdOrRange, i2d_ASIdentifierChoice, i2d_ASIdentifiers, i2d_ASN1_BIT_STRING, i2d_ASN1_BMPSTRING, i2d_ASN1_ENUMERATED, i2d_ASN1_GENERALIZEDTIME, i2d_ASN1_GENERALSTRING, i2d_ASN1_IA5STRING, i2d_ASN1_INTEGER, i2d_ASN1_NULL, i2d_ASN1_OBJECT, i2d_ASN1_OCTET_STRING, i2d_ASN1_PRINTABLE, i2d_ASN1_PRINTABLESTRING, i2d_ASN1_SEQUENCE_ANY, i2d_ASN1_SET_ANY, i2d_ASN1_T61STRING, i2d_ASN1_TIME, i2d_ASN1_TYPE, i2d_ASN1_UNIVERSALSTRING, i2d_ASN1_UTCTIME, i2d_ASN1_UTF8STRING, i2d_ASN1_VISIBLESTRING, i2d_ASN1_bio_stream, i2d_ASRange, i2d_AUTHORITY_INFO_ACCESS, i2d_AUTHORITY_KEYID, i2d_BASIC_CONSTRAINTS, i2d_CERTIFICATEPOLICIES, i2d_CMS_ContentInfo, i2d_CMS_ReceiptRequest, i2d_CMS_bio, i2d_CRL_DIST_POINTS, i2d_DHxparams, i2d_DIRECTORYSTRING, i2d_DISPLAYTEXT, i2d_DIST_POINT, i2d_DIST_POINT_NAME, i2d_DSA_SIG, i2d_ECDSA_SIG, i2d_ECPKParameters, i2d_EDIPARTYNAME, i2d_ESS_CERT_ID, i2d_ESS_CERT_ID_V2, i2d_ESS_ISSUER_SERIAL, i2d_ESS_SIGNING_CERT, i2d_ESS_SIGNING_CERT_V2, i2d_EXTENDED_KEY_USAGE, i2d_GENERAL_NAME, i2d_GENERAL_NAMES, i2d_IPAddressChoice, i2d_IPAddressFamily, i2d_IPAddressOrRange, i2d_IPAddressRange, i2d_ISSUER_SIGN_TOOL, i2d_ISSUING_DIST_POINT, i2d_NAMING_AUTHORITY, i2d_NETSCAPE_CERT_SEQUENCE, i2d_NETSCAPE_SPKAC, i2d_NETSCAPE_SPKI, i2d_NOTICEREF, i2d_OCSP_BASICRESP, i2d_OCSP_CERTID, i2d_OCSP_CERTSTATUS, i2d_OCSP_CRLID, i2d_OCSP_ONEREQ, i2d_OCSP_REQINFO, i2d_OCSP_REQUEST, i2d_OCSP_RESPBYTES, i2d_OCSP_RESPDATA, i2d_OCSP_RESPID, i2d_OCSP_RESPONSE, i2d_OCSP_REVOKEDINFO, i2d_OCSP_SERVICELOC, i2d_OCSP_SIGNATURE, i2d_OCSP_SINGLERESP, i2d_OSSL_CMP_MSG, i2d_OSSL_CMP_PKIHEADER, i2d_OSSL_CMP_PKISI, i2d_OSSL_CRMF_CERTID, i2d_OSSL_CRMF_CERTTEMPLATE, i2d_OSSL_CRMF_ENCRYPTEDVALUE, i2d_OSSL_CRMF_MSG, i2d_OSSL_CRMF_MSGS, i2d_OSSL_CRMF_PBMPARAMETER, i2d_OSSL_CRMF_PKIPUBLICATIONINFO, i2d_OSSL_CRMF_SINGLEPUBINFO, i2d_OTHERNAME, i2d_PBE2PARAM, i2d_PBEPARAM, i2d_PBKDF2PARAM, i2d_PKCS12, i2d_PKCS12_BAGS, i2d_PKCS12_MAC_DATA, i2d_PKCS12_SAFEBAG, i2d_PKCS12_bio, i2d_PKCS12_fp, i2d_PKCS7, i2d_PKCS7_DIGEST, i2d_PKCS7_ENCRYPT, i2d_PKCS7_ENC_CONTENT, i2d_PKCS7_ENVELOPE, i2d_PKCS7_ISSUER_AND_SERIAL, i2d_PKCS7_NDEF, i2d_PKCS7_RECIP_INFO, i2d_PKCS7_SIGNED, i2d_PKCS7_SIGNER_INFO, i2d_PKCS7_SIGN_ENVELOPE, i2d_PKCS7_bio, i2d_PKCS7_fp, i2d_PKCS8PrivateKeyInfo_bio, i2d_PKCS8PrivateKeyInfo_fp, i2d_PKCS8_PRIV_KEY_INFO, i2d_PKCS8_PRIV_KEY_INFO_bio, i2d_PKCS8_PRIV_KEY_INFO_fp, i2d_PKCS8_bio, i2d_PKCS8_fp, i2d_PKEY_USAGE_PERIOD, i2d_POLICYINFO, i2d_POLICYQUALINFO, i2d_PROFESSION_INFO, i2d_PROXY_CERT_INFO_EXTENSION, i2d_PROXY_POLICY, i2d_RSA_OAEP_PARAMS, i2d_RSA_PSS_PARAMS, i2d_SCRYPT_PARAMS, i2d_SCT_LIST, i2d_SXNET, i2d_SXNETID, i2d_TS_ACCURACY, i2d_TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT_bio, i2d_TS_MSG_IMPRINT_fp, i2d_TS_REQ, i2d_TS_REQ_bio, i2d_TS_REQ_fp, i2d_TS_RESP, i2d_TS_RESP_bio, i2d_TS_RESP_fp, i2d_TS_STATUS_INFO, i2d_TS_TST_INFO, i2d_TS_TST_INFO_bio, i2d_TS_TST_INFO_fp, i2d_USERNOTICE, i2d_X509, i2d_X509_bio, i2d_X509_fp, i2d_X509_ALGOR, i2d_X509_ALGORS, i2d_X509_ATTRIBUTE, i2d_X509_CERT_AUX, i2d_X509_CINF, i2d_X509_CRL, i2d_X509_CRL_INFO, i2d_X509_CRL_bio, i2d_X509_CRL_fp, i2d_X509_EXTENSION, i2d_X509_EXTENSIONS, i2d_X509_NAME, i2d_X509_NAME_ENTRY, i2d_X509_PUBKEY, i2d_X509_PUBKEY_bio, i2d_X509_PUBKEY_fp, i2d_X509_REQ, i2d_X509_REQ_INFO, i2d_X509_REQ_bio, i2d_X509_REQ_fp, i2d_X509_REVOKED, i2d_X509_SIG, i2d_X509_VAL, - convert objects from/to ASN.1/DER representation

                        "},{"location":"man3/d2i_X509/#synopsis","title":"SYNOPSIS","text":"
                        TYPE *d2i_TYPE(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPE_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPE_fp(FILE *fp, TYPE **a);\n\nint i2d_TYPE(const TYPE *a, unsigned char **ppout);\nint i2d_TYPE(TYPE *a, unsigned char **ppout);\nint i2d_TYPE_fp(FILE *fp, const TYPE *a);\nint i2d_TYPE_fp(FILE *fp, TYPE *a);\nint i2d_TYPE_bio(BIO *bp, const TYPE *a);\nint i2d_TYPE_bio(BIO *bp, TYPE *a);\n
                        "},{"location":"man3/d2i_X509/#description","title":"DESCRIPTION","text":"

                        In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes, such as X509_CRL. The function parameters ppin and ppout are generally either both named pp in the headers, or in and out.

                        These functions convert OpenSSL objects to and from their ASN.1/DER encoding. Unlike the C structures which can have pointers to sub-objects within, the DER is a serialized encoding, suitable for sending over the network, writing to a file, and so on.

                        d2i_TYPE() attempts to decode len bytes at *ppin. If successful a pointer to the TYPE structure is returned and *ppin is incremented to the byte following the parsed data. If a is not NULL then a pointer to the returned structure is also written to *a. If an error occurred then NULL is returned. The caller retains ownership of the returned object and needs to free it when it is no longer needed, e.g. using X509_free() for X509 objects or DSA_SIG_free() for DSA_SIG objects.

                        On a successful return, if *a is not NULL then it is assumed that *a contains a valid TYPE structure and an attempt is made to reuse it. For TYPE structures where it matters it is possible to set up a library context on the decoded structure this way (see the EXAMPLES section). However using the \"reuse\" capability for other purposes is strongly discouraged (see BUGS below, and the discussion in the RETURN VALUES section).

                        d2i_TYPE_bio() is similar to d2i_TYPE() except it attempts to parse data from BIO bp.

                        d2i_TYPE_fp() is similar to d2i_TYPE() except it attempts to parse data from FILE pointer fp.

                        i2d_TYPE() encodes the structure pointed to by a into DER format. If ppout is not NULL, it writes the DER encoded data to the buffer at *ppout, and increments it to point after the data just written. If the return value is negative an error occurred, otherwise it returns the length of the encoded data.

                        If *ppout is NULL memory will be allocated for a buffer and the encoded data written to it. In this case *ppout is not incremented and it points to the start of the data just written.

                        i2d_TYPE_bio() is similar to i2d_TYPE() except it writes the encoding of the structure a to BIO bp and it returns 1 for success and 0 for failure.

                        i2d_TYPE_fp() is similar to i2d_TYPE() except it writes the encoding of the structure a to FILE pointer fp and it returns 1 for success and 0 for failure.

                        These routines do not encrypt private keys and therefore offer no security; use PEM_write_PrivateKey(3) or similar for writing to files.

                        "},{"location":"man3/d2i_X509/#notes","title":"NOTES","text":"

                        The letters i and d in i2d_TYPE() stand for \"internal\" (that is, an internal C structure) and \"DER\" respectively. So i2d_TYPE() converts from internal to DER.

                        The functions can also understand BER forms.

                        The actual TYPE structure passed to i2d_TYPE() must be a valid populated TYPE structure -- it cannot simply be fed with an empty structure such as that returned by TYPE_new().

                        The encoded data is in binary form and may contain embedded zeros. Therefore, any FILE pointers or BIOs should be opened in binary mode. Functions such as strlen() will not return the correct length of the encoded structure.

                        The ways that *ppin and *ppout are incremented after the operation can trap the unwary. See the WARNINGS section for some common errors. The reason for this-auto increment behaviour is to reflect a typical usage of ASN1 functions: after one structure is encoded or decoded another will be processed after it.

                        The following points about the data types might be useful:

                        • ASN1_OBJECT

                          Represents an ASN1 OBJECT IDENTIFIER.

                        • DHparams

                          Represents a PKCS#3 DH parameters structure.

                        • DHxparams

                          Represents an ANSI X9.42 DH parameters structure.

                        • ECDSA_SIG

                          Represents an ECDSA signature.

                        • X509_ALGOR

                          Represents an AlgorithmIdentifier structure as used in IETF RFC 6960 and elsewhere.

                        • X509_NAME

                          Represents a Name type as used for subject and issuer names in IETF RFC 6960 and elsewhere.

                        • X509_REQ

                          Represents a PKCS#10 certificate request.

                        • X509_SIG

                          Represents the DigestInfo structure defined in PKCS#1 and PKCS#7.

                        "},{"location":"man3/d2i_X509/#return-values","title":"RETURN VALUES","text":"

                        d2i_TYPE(), d2i_TYPE_bio() and d2i_TYPE_fp() return a valid TYPE structure or NULL if an error occurs. If the \"reuse\" capability has been used with a valid structure being passed in via a, then the object is freed in the event of error and *a is set to NULL.

                        i2d_TYPE() returns the number of bytes successfully encoded or a negative value if an error occurs.

                        i2d_TYPE_bio() and i2d_TYPE_fp() return 1 for success and 0 if an error occurs.

                        "},{"location":"man3/d2i_X509/#examples","title":"EXAMPLES","text":"

                        Allocate and encode the DER encoding of an X509 structure:

                        int len;\nunsigned char *buf;\n\nbuf = NULL;\nlen = i2d_X509(x, &buf);\nif (len < 0)\n    /* error */\n

                        Attempt to decode a buffer:

                        X509 *x;\nunsigned char *buf;\nconst unsigned char *p;\nint len;\n\n/* Set up buf and len to point to the input buffer. */\np = buf;\nx = d2i_X509(NULL, &p, len);\nif (x == NULL)\n    /* error */\n

                        Alternative technique:

                        X509 *x;\nunsigned char *buf;\nconst unsigned char *p;\nint len;\n\n/* Set up buf and len to point to the input buffer. */\np = buf;\nx = NULL;\n\nif (d2i_X509(&x, &p, len) == NULL)\n    /* error */\n

                        Setting up a library context and property query:

                        X509 *x;\nunsigned char *buf;\nconst unsigned char *p;\nint len;\nOSSL_LIB_CTX *libctx = ....;\nconst char *propq = ....;\n\n/* Set up buf and len to point to the input buffer. */\np = buf;\nx = X509_new_ex(libctx, propq);\n\nif (d2i_X509(&x, &p, len) == NULL)\n    /* error, x was freed and NULL assigned to it (see RETURN VALUES) */\n
                        "},{"location":"man3/d2i_X509/#warnings","title":"WARNINGS","text":"

                        Using a temporary variable is mandatory. A common mistake is to attempt to use a buffer directly as follows:

                        int len;\nunsigned char *buf;\n\nlen = i2d_X509(x, NULL);\nbuf = OPENSSL_malloc(len);\n...\ni2d_X509(x, &buf);\n...\nOPENSSL_free(buf);\n

                        This code will result in buf apparently containing garbage because it was incremented after the call to point after the data just written. Also buf will no longer contain the pointer allocated by OPENSSL_malloc() and the subsequent call to OPENSSL_free() is likely to crash.

                        Another trap to avoid is misuse of the a argument to d2i_TYPE():

                        X509 *x;\n\nif (d2i_X509(&x, &p, len) == NULL)\n    /* error */\n

                        This will probably crash somewhere in d2i_X509(). The reason for this is that the variable x is uninitialized and an attempt will be made to interpret its (invalid) value as an X509 structure, typically causing a segmentation violation. If x is set to NULL first then this will not happen.

                        "},{"location":"man3/d2i_X509/#bugs","title":"BUGS","text":"

                        In some versions of OpenSSL the \"reuse\" behaviour of d2i_TYPE() when *a is valid is broken and some parts of the reused structure may persist if they are not present in the new one. Additionally, in versions of OpenSSL prior to 1.1.0, when the \"reuse\" behaviour is used and an error occurs the behaviour is inconsistent. Some functions behaved as described here, while some did not free *a on error and did not set *a to NULL.

                        As a result of the above issues the \"reuse\" behaviour is strongly discouraged.

                        i2d_TYPE() will not return an error in many versions of OpenSSL, if mandatory fields are not initialized due to a programming error then the encoded structure may contain invalid data or omit the fields entirely and will not be parsed by d2i_TYPE(). This may be fixed in future so code should not assume that i2d_TYPE() will always succeed.

                        Any function which encodes a structure (i2d_TYPE(), i2d_TYPE_bio() or i2d_TYPE_fp()) may return a stale encoding if the structure has been modified after deserialization or previous serialization. This is because some objects cache the encoding for efficiency reasons.

                        "},{"location":"man3/d2i_X509/#copyright","title":"COPYRIGHT","text":"

                        Copyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/i2d_CMS_bio_stream/","title":"i2d_CMS_bio_stream","text":""},{"location":"man3/i2d_CMS_bio_stream/#name","title":"NAME","text":"

                        i2d_CMS_bio_stream - output CMS_ContentInfo structure in BER format

                        "},{"location":"man3/i2d_CMS_bio_stream/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/cms.h>\n\nint i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);\n
                        "},{"location":"man3/i2d_CMS_bio_stream/#description","title":"DESCRIPTION","text":"

                        i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format.

                        It is otherwise identical to the function SMIME_write_CMS().

                        "},{"location":"man3/i2d_CMS_bio_stream/#notes","title":"NOTES","text":"

                        This function is effectively a version of the i2d_CMS_bio() supporting streaming.

                        "},{"location":"man3/i2d_CMS_bio_stream/#bugs","title":"BUGS","text":"

                        The prefix \"i2d\" is arguably wrong because the function outputs BER format.

                        "},{"location":"man3/i2d_CMS_bio_stream/#return-values","title":"RETURN VALUES","text":"

                        i2d_CMS_bio_stream() returns 1 for success or 0 for failure.

                        "},{"location":"man3/i2d_CMS_bio_stream/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3) CMS_decrypt(3), SMIME_write_CMS(3), PEM_write_bio_CMS_stream(3)

                        "},{"location":"man3/i2d_CMS_bio_stream/#history","title":"HISTORY","text":"

                        The i2d_CMS_bio_stream() function was added in OpenSSL 1.0.0.

                        "},{"location":"man3/i2d_CMS_bio_stream/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/i2d_PKCS7_bio_stream/","title":"i2d_PKCS7_bio_stream","text":""},{"location":"man3/i2d_PKCS7_bio_stream/#name","title":"NAME","text":"

                        i2d_PKCS7_bio_stream - output PKCS7 structure in BER format

                        "},{"location":"man3/i2d_PKCS7_bio_stream/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/pkcs7.h>\n\nint i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);\n
                        "},{"location":"man3/i2d_PKCS7_bio_stream/#description","title":"DESCRIPTION","text":"

                        i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format.

                        It is otherwise identical to the function SMIME_write_PKCS7().

                        "},{"location":"man3/i2d_PKCS7_bio_stream/#notes","title":"NOTES","text":"

                        This function is effectively a version of the d2i_PKCS7_bio() supporting streaming.

                        "},{"location":"man3/i2d_PKCS7_bio_stream/#bugs","title":"BUGS","text":"

                        The prefix \"i2d\" is arguably wrong because the function outputs BER format.

                        "},{"location":"man3/i2d_PKCS7_bio_stream/#return-values","title":"RETURN VALUES","text":"

                        i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure.

                        "},{"location":"man3/i2d_PKCS7_bio_stream/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3), SMIME_write_PKCS7(3), PEM_write_bio_PKCS7_stream(3)

                        "},{"location":"man3/i2d_PKCS7_bio_stream/#history","title":"HISTORY","text":"

                        The i2d_PKCS7_bio_stream() function was added in OpenSSL 1.0.0.

                        "},{"location":"man3/i2d_PKCS7_bio_stream/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/i2d_re_X509_tbs/","title":"i2d_re_X509_tbs","text":""},{"location":"man3/i2d_re_X509_tbs/#name","title":"NAME","text":"

                        d2i_X509_AUX, i2d_X509_AUX, i2d_re_X509_tbs, i2d_re_X509_CRL_tbs, i2d_re_X509_REQ_tbs - X509 encode and decode functions

                        "},{"location":"man3/i2d_re_X509_tbs/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509.h>\n\nX509 *d2i_X509_AUX(X509 **px, const unsigned char **in, long len);\nint i2d_X509_AUX(const X509 *x, unsigned char **out);\nint i2d_re_X509_tbs(X509 *x, unsigned char **out);\nint i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp);\nint i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);\n
                        "},{"location":"man3/i2d_re_X509_tbs/#description","title":"DESCRIPTION","text":"

                        The X509 encode and decode routines encode and parse an X509 structure, which represents an X509 certificate.

                        d2i_X509_AUX() is similar to d2i_X509(3) but the input is expected to consist of an X509 certificate followed by auxiliary trust information. This is used by the PEM routines to read \"TRUSTED CERTIFICATE\" objects. This function should not be called on untrusted input.

                        i2d_X509_AUX() is similar to i2d_X509(3), but the encoded output contains both the certificate and any auxiliary trust information. This is used by the PEM routines to write \"TRUSTED CERTIFICATE\" objects. Note that this is a non-standard OpenSSL-specific data format.

                        i2d_re_X509_tbs() is similar to i2d_X509(3) except it encodes only the TBSCertificate portion of the certificate. i2d_re_X509_CRL_tbs() and i2d_re_X509_REQ_tbs() are analogous for CRL and certificate request, respectively. The \"re\" in i2d_re_X509_tbs stands for \"re-encode\", and ensures that a fresh encoding is generated in case the object has been modified after creation (see the BUGS section).

                        The encoding of the TBSCertificate portion of a certificate is cached in the X509 structure internally to improve encoding performance and to ensure certificate signatures are verified correctly in some certificates with broken (non-DER) encodings.

                        If, after modification, the X509 object is re-signed with X509_sign(), the encoding is automatically renewed. Otherwise, the encoding of the TBSCertificate portion of the X509 can be manually renewed by calling i2d_re_X509_tbs().

                        "},{"location":"man3/i2d_re_X509_tbs/#return-values","title":"RETURN VALUES","text":"

                        d2i_X509_AUX() returns a valid X509 structure or NULL if an error occurred.

                        i2d_X509_AUX() returns the length of encoded data or -1 on error.

                        i2d_re_X509_tbs(), i2d_re_X509_CRL_tbs() and i2d_re_X509_REQ_tbs() return the length of encoded data or <=0 on error.

                        "},{"location":"man3/i2d_re_X509_tbs/#see-also","title":"SEE ALSO","text":"

                        ERR_get_error(3) X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                        "},{"location":"man3/i2d_re_X509_tbs/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/o2i_SCT_LIST/","title":"o2i_SCT_LIST","text":""},{"location":"man3/o2i_SCT_LIST/#name","title":"NAME","text":"

                        o2i_SCT_LIST, i2o_SCT_LIST, o2i_SCT, i2o_SCT - decode and encode Signed Certificate Timestamp lists in TLS wire format

                        "},{"location":"man3/o2i_SCT_LIST/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/ct.h>\n\nSTACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,\n                            size_t len);\nint i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);\nSCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);\nint i2o_SCT(const SCT *sct, unsigned char **out);\n
                        "},{"location":"man3/o2i_SCT_LIST/#description","title":"DESCRIPTION","text":"

                        The SCT_LIST and SCT functions are very similar to the i2d and d2i family of functions, except that they convert to and from TLS wire format, as described in RFC 6962. See d2i_SCT_LIST(3) for more information about how the parameters are treated and the return values.

                        "},{"location":"man3/o2i_SCT_LIST/#return-values","title":"RETURN VALUES","text":"

                        All of the functions have return values consistent with those stated for d2i_SCT_LIST(3) and i2d_SCT_LIST(3).

                        "},{"location":"man3/o2i_SCT_LIST/#see-also","title":"SEE ALSO","text":"

                        ct(7), d2i_SCT_LIST(3), i2d_SCT_LIST(3)

                        "},{"location":"man3/o2i_SCT_LIST/#history","title":"HISTORY","text":"

                        These functions were added in OpenSSL 1.1.0.

                        "},{"location":"man3/o2i_SCT_LIST/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man3/s2i_ASN1_IA5STRING/","title":"s2i_ASN1_IA5STRING","text":""},{"location":"man3/s2i_ASN1_IA5STRING/#name","title":"NAME","text":"

                        i2s_ASN1_IA5STRING, s2i_ASN1_IA5STRING, i2s_ASN1_INTEGER, s2i_ASN1_INTEGER, i2s_ASN1_OCTET_STRING, s2i_ASN1_OCTET_STRING, i2s_ASN1_ENUMERATED, i2s_ASN1_ENUMERATED_TABLE, i2s_ASN1_UTF8STRING, s2i_ASN1_UTF8STRING - convert objects from/to ASN.1/string representation

                        "},{"location":"man3/s2i_ASN1_IA5STRING/#synopsis","title":"SYNOPSIS","text":"
                        #include <openssl/x509v3.h>\n\nchar *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5);\nASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,\n                                  X509V3_CTX *ctx, const char *str);\nchar *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a);\nASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, const char *value);\nchar *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,\n                           const ASN1_OCTET_STRING *oct);\nASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,\n                                        X509V3_CTX *ctx, const char *str);\nchar *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *a);\nchar *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method,\n                               const ASN1_ENUMERATED *e);\n\nchar *i2s_ASN1_UTF8STRING(X509V3_EXT_METHOD *method,\n                          ASN1_UTF8STRING *utf8);\nASN1_UTF8STRING *s2i_ASN1_UTF8STRING(X509V3_EXT_METHOD *method,\n                                     X509V3_CTX *ctx, const char *str);\n
                        "},{"location":"man3/s2i_ASN1_IA5STRING/#description","title":"DESCRIPTION","text":"

                        These functions convert OpenSSL objects to and from their ASN.1/string representation. This function is used for X509v3 extensions.

                        "},{"location":"man3/s2i_ASN1_IA5STRING/#notes","title":"NOTES","text":"

                        The letters i and s in i2s and s2i stand for \"internal\" (that is, an internal C structure) and string respectively. So i2s_ASN1_IA5STRING() converts from internal to string.

                        It is the caller's responsibility to free the returned string. In the i2s_ASN1_IA5STRING() function the string is copied and the ownership of the original string remains with the caller.

                        "},{"location":"man3/s2i_ASN1_IA5STRING/#return-values","title":"RETURN VALUES","text":"

                        i2s_ASN1_IA5STRING() returns the pointer to a IA5 string or NULL if an error occurs.

                        s2i_ASN1_IA5STRING() return a valid ASN1_IA5STRING structure or NULL if an error occurs.

                        i2s_ASN1_INTEGER() return a valid string or NULL if an error occurs.

                        s2i_ASN1_INTEGER() returns the pointer to a ASN1_INTEGER structure or NULL if an error occurs.

                        i2s_ASN1_OCTET_STRING() returns the pointer to a OCTET_STRING string or NULL if an error occurs.

                        s2i_ASN1_OCTET_STRING() return a valid ASN1_OCTET_STRING structure or NULL if an error occurs.

                        i2s_ASN1_ENUMERATED() return a valid string or NULL if an error occurs.

                        s2i_ASN1_ENUMERATED() returns the pointer to a ASN1_ENUMERATED structure or NULL if an error occurs.

                        s2i_ASN1_UTF8STRING() return a valid ASN1_UTF8STRING structure or NULL if an error occurs.

                        i2s_ASN1_UTF8STRING() returns the pointer to a UTF-8 string or NULL if an error occurs.

                        "},{"location":"man3/s2i_ASN1_IA5STRING/#history","title":"HISTORY","text":"

                        i2s_ASN1_UTF8STRING() and s2i_ASN1_UTF8STRING() were made public in OpenSSL 3.0.

                        "},{"location":"man3/s2i_ASN1_IA5STRING/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man5/config/","title":"config","text":""},{"location":"man5/config/#name","title":"NAME","text":"

                        config - OpenSSL CONF library configuration files

                        "},{"location":"man5/config/#description","title":"DESCRIPTION","text":"

                        This page documents the syntax of OpenSSL configuration files, as parsed by NCONF_load(3) and related functions. This format is used by many of the OpenSSL commands, and to initialize the libraries when used by any application.

                        The first part describes the general syntax of the configuration files, and subsequent sections describe the semantics of individual modules. Other modules are described in fips_config(5) and x509v3_config(5). The syntax for defining ASN.1 values is described in ASN1_generate_nconf(3).

                        "},{"location":"man5/config/#syntax","title":"SYNTAX","text":"

                        A configuration file is a series of lines. Blank lines, and whitespace between the elements of a line, have no significance. A comment starts with a # character; the rest of the line is ignored. If the # is the first non-space character in a line, the entire line is ignored.

                        "},{"location":"man5/config/#directives","title":"Directives","text":"

                        Two directives can be used to control the parsing of configuration files: .include and .pragma.

                        For compatibility with older versions of OpenSSL, an equal sign after the directive will be ignored. Older versions will treat it as an assignment, so care should be taken if the difference in semantics is important.

                        A file can include other files using the include syntax:

                        .include [=] pathname\n

                        If pathname is a simple filename, that file is included directly at that point. Included files can have .include statements that specify other files. If pathname is a directory, all files within that directory that have a .cnf or .conf extension will be included. (This is only available on systems with POSIX IO support.) Any sub-directories found inside the pathname are ignored. Similarly, if a file is opened while scanning a directory, and that file has an .include directive that specifies a directory, that is also ignored.

                        As a general rule, the pathname should be an absolute path; this can be enforced with the abspath and includedir pragmas, described below. The environment variable OPENSSL_CONF_INCLUDE, if it exists, is prepended to all relative pathnames. If the pathname is still relative, it is interpreted based on the current working directory.

                        To require all file inclusions to name absolute paths, use the following directive:

                        .pragma [=] abspath:value\n

                        The default behavior, where the value is false or off, is to allow relative paths. To require all .include pathnames to be absolute paths, use a value of true or on.

                        In these files, the dollar sign, $, is used to reference a variable, as described below. On some platforms, however, it is common to treat $ as a regular character in symbol names. Supporting this behavior can be done with the following directive:

                        .pragma [=] dollarid:value\n

                        The default behavior, where the value is false or off, is to treat the dollarsign as indicating a variable name; foo$bar is interpreted as foo followed by the expansion of the variable bar. If value is true or on, then foo$bar is a single seven-character name and variable expansions must be specified using braces or parentheses.

                        .pragma [=] includedir:value\n

                        If a relative pathname is specified in the .include directive, and the OPENSSL_CONF_INCLUDE environment variable doesn't exist, then the value of the includedir pragma, if it exists, is prepended to the pathname.

                        "},{"location":"man5/config/#settings","title":"Settings","text":"

                        A configuration file is divided into a number of sections. A section begins with the section name in square brackets, and ends when a new section starts, or at the end of the file. The section name can consist of alphanumeric characters and underscores. Whitespace between the name and the brackets is removed.

                        The first section of a configuration file is special and is referred to as the default section. This section is usually unnamed and spans from the start of file until the first named section. When a name is being looked up, it is first looked up in the current or named section, and then the default section if necessary.

                        The environment is mapped onto a section called ENV.

                        Within a section are a series of name/value assignments, described in more detail below. As a reminder, the square brackets shown in this example are required, not optional:

                        [ section ]\nname1 = This is value1\nname2 = Another value\n...\n[ newsection ]\nname1 = New value1\nname3 = Value 3\n

                        The name can contain any alphanumeric characters as well as a few punctuation symbols such as . , ; and _. Whitespace after the name and before the equal sign is ignored.

                        If a name is repeated in the same section, then all but the last value are ignored. In certain circumstances, such as with Certificate DNs, the same field may occur multiple times. In order to support this, commands like openssl-req(1) ignore any leading text that is preceded with a period. For example:

                        1.OU = First OU\n2.OU = Second OU\n

                        The value consists of the string following the = character until end of line with any leading and trailing whitespace removed.

                        The value string undergoes variable expansion. The text $var or ${var} inserts the value of the named variable from the current section. To use a value from another section use $section::name or ${section::name}. By using $ENV::name, the value of the specified environment variable will be substituted.

                        Variables must be defined before their value is referenced, otherwise an error is flagged and the file will not load. This can be worked around by specifying a default value in the default section before the variable is used.

                        Any name/value settings in an ENV section are available to the configuration file, but are not propagated to the environment.

                        It is an error if the value ends up longer than 64k.

                        It is possible to escape certain characters by using a single ' or double \" quote around the value, or using a backslash \\ before the character, By making the last character of a line a \\ a value string can be spread across multiple lines. In addition the sequences \\n, \\r, \\b and \\t are recognized.

                        The expansion and escape rules as described above that apply to value also apply to the pathname of the .include directive.

                        "},{"location":"man5/config/#openssl-library-configuration","title":"OPENSSL LIBRARY CONFIGURATION","text":"

                        The sections below use the informal term module to refer to a part of the OpenSSL functionality. This is not the same as the formal term FIPS module, for example.

                        The OpenSSL configuration looks up the value of openssl_conf in the default section and takes that as the name of a section that specifies how to configure any modules in the library. It is not an error to leave any module in its default configuration. An application can specify a different name by calling CONF_modules_load_file(), for example, directly.

                        OpenSSL also looks up the value of config_diagnostics. If this exists and has a nonzero numeric value, any error suppressing flags passed to CONF_modules_load() will be ignored. This is useful for diagnosing misconfigurations but its use in production requires additional consideration. With this option enabled, a configuration error will completely prevent access to a service. Without this option and in the presence of a configuration error, access will be allowed but the desired configuration will not be used.

                        # # These must be in the default section config_diagnostics = 1 openssl_conf = openssl_init

                        [openssl_init]\noid_section = oids\nproviders = providers\nalg_section = evp_properties\nssl_conf = ssl_configuration\nengines = engines\nrandom = random\n\n[oids]\n... new oids here ...\n\n[providers]\n... provider stuff here ...\n\n[evp_properties]\n... EVP properties here ...\n\n[ssl_configuration]\n... SSL/TLS configuration properties here ...\n\n[engines]\n... engine properties here ...\n\n[random]\n... random properties here ...\n

                        The semantics of each module are described below. The phrase \"in the initialization section\" refers to the section identified by the openssl_conf or other name (given as openssl_init in the example above). The examples below assume the configuration above is used to specify the individual sections.

                        "},{"location":"man5/config/#asn1-object-identifier-configuration","title":"ASN.1 Object Identifier Configuration","text":"

                        The name oid_section in the initialization section names the section containing name/value pairs of OID's. The name is the short name; the value is an optional long name followed by a comma, and the numeric value. While some OpenSSL commands have their own section for specifying OID's, this section makes them available to all commands and applications.

                        [oids]\nshortName = a very long OID name, 1.2.3.4\nnewoid1 = 1.2.3.4.1\nsome_other_oid = 1.2.3.5\n

                        If a full configuration with the above fragment is in the file example.cnf, then the following command line:

                        OPENSSL_CONF=example.cnf openssl asn1parse -genstr OID:1.2.3.4.1\n

                        will output:

                        0:d=0  hl=2 l=   4 prim: OBJECT            :newoid1\n

                        showing that the OID \"newoid1\" has been added as \"1.2.3.4.1\".

                        "},{"location":"man5/config/#provider-configuration","title":"Provider Configuration","text":"

                        The name providers in the initialization section names the section containing cryptographic provider configuration. The name/value assignments in this section each name a provider, and point to the configuration section for that provider. The provider-specific section is used to specify how to load the module, activate it, and set other parameters.

                        Within a provider section, the following names have meaning:

                        • identity

                          This is used to specify an alternate name, overriding the default name specified in the list of providers. For example:

                          [providers]\nfoo = foo_provider\n\n[foo_provider]\nidentity = my_fips_module\n
                        • module

                          Specifies the pathname of the module (typically a shared library) to load.

                        • activate

                          If present, the module is activated. The value assigned to this name is not significant.

                        All parameters in the section as well as sub-sections are made available to the provider.

                        "},{"location":"man5/config/#default-provider-and-its-activation","title":"Default provider and its activation","text":"

                        If no providers are activated explicitly, the default one is activated implicitly. See OSSL_PROVIDER-default(7) for more details.

                        If you add a section explicitly activating any other provider(s), you most probably need to explicitly activate the default provider, otherwise it becomes unavailable in openssl. It may make the system remotely unavailable.

                        "},{"location":"man5/config/#evp-configuration","title":"EVP Configuration","text":"

                        The name alg_section in the initialization section names the section containing algorithmic properties when using the EVP API.

                        Within the algorithm properties section, the following names have meaning:

                        • default_properties

                          The value may be anything that is acceptable as a property query string for EVP_set_default_properties().

                        • fips_mode (deprecated)

                          The value is a boolean that can be yes or no. If the value is yes, this is exactly equivalent to:

                          default_properties = fips=yes\n

                          If the value is no, nothing happens. Using this name is deprecated, and if used, it must be the only name in the section.

                        "},{"location":"man5/config/#ssl-configuration","title":"SSL Configuration","text":"

                        The name ssl_conf in the initialization section names the section containing the list of SSL/TLS configurations. As with the providers, each name in this section identifies a section with the configuration for that name. For example:

                        [ssl_configuration]\nserver = server_tls_config\nclient = client_tls_config\nsystem_default = tls_system_default\n\n[server_tls_config]\n... configuration for SSL/TLS servers ...\n\n[client_tls_config]\n... configuration for SSL/TLS clients ...\n

                        The configuration name system_default has a special meaning. If it exists, it is applied whenever an SSL_CTX object is created. For example, to impose system-wide minimum TLS and DTLS protocol versions:

                        [tls_system_default]\nMinProtocol = TLSv1.2\nMinProtocol = DTLSv1.2\n

                        The minimum TLS protocol is applied to SSL_CTX objects that are TLS-based, and the minimum DTLS protocol to those are DTLS-based. The same applies also to maximum versions set with MaxProtocol.

                        Each configuration section consists of name/value pairs that are parsed by SSL_CONF_cmd(3), which will be called by SSL_CTX_config() or SSL_config(), appropriately. Note that any characters before an initial dot in the configuration section are ignored, so that the same command can be used multiple times. This probably is most useful for loading different key types, as shown here:

                        [server_tls_config]\nRSA.Certificate = server-rsa.pem\nECDSA.Certificate = server-ecdsa.pem\n
                        "},{"location":"man5/config/#engine-configuration","title":"Engine Configuration","text":"

                        The name engines in the initialization section names the section containing the list of ENGINE configurations. As with the providers, each name in this section identifies an engine with the configuration for that engine. The engine-specific section is used to specify how to load the engine, activate it, and set other parameters.

                        Within an engine section, the following names have meaning:

                        • engine_id

                          This is used to specify an alternate name, overriding the default name specified in the list of engines. If present, it must be first. For example:

                          [engines]\nfoo = foo_engine\n\n[foo_engine]\nengine_id = myfoo\n
                        • dynamic_path

                          This loads and adds an ENGINE from the given path. It is equivalent to sending the ctrls SO_PATH with the path argument followed by LIST_ADD with value 2 and LOAD to the dynamic ENGINE. If this is not the required behaviour then alternative ctrls can be sent directly to the dynamic ENGINE using ctrl commands.

                        • init

                          This specifies whether to initialize the ENGINE. If the value is 0 the ENGINE will not be initialized, if the value is 1 an attempt is made to initialize the ENGINE immediately. If the init command is not present then an attempt will be made to initialize the ENGINE after all commands in its section have been processed.

                        • default_algorithms

                          This sets the default algorithms an ENGINE will supply using the function ENGINE_set_default_string().

                        All other names are taken to be the name of a ctrl command that is sent to the ENGINE, and the value is the argument passed with the command. The special value EMPTY means no value is sent with the command. For example:

                        [engines]\nfoo = foo_engine\n\n[foo_engine]\ndynamic_path = /some/path/fooengine.so\nsome_ctrl = some_value\ndefault_algorithms = ALL\nother_ctrl = EMPTY\n
                        "},{"location":"man5/config/#random-configuration","title":"Random Configuration","text":"

                        The name random in the initialization section names the section containing the random number generator settings.

                        Within the random section, the following names have meaning:

                        • random

                          This is used to specify the random bit generator. For example:

                          [random]\nrandom = CTR-DRBG\n

                          The available random bit generators are:

                          • CTR-DRBG
                          • HASH-DRBG
                          • HMAC-DRBG
                        • cipher

                          This specifies what cipher a CTR-DRBG random bit generator will use. Other random bit generators ignore this name. The default value is AES-256-CTR.

                        • digest

                          This specifies what digest the HASH-DRBG or HMAC-DRBG random bit generators will use. Other random bit generators ignore this name.

                        • properties

                          This sets the property query used when fetching the random bit generator and any underlying algorithms.

                        • seed

                          This sets the randomness source that should be used. By default SEED-SRC will be used outside of the FIPS provider. The FIPS provider uses call backs to access the same randomness sources from outside the validated boundary.

                        • seed_properties

                          This sets the property query used when fetching the randomness source.

                        "},{"location":"man5/config/#examples","title":"EXAMPLES","text":"

                        This example shows how to use quoting and escaping.

                        # # This is the default section. HOME = /temp configdir = $ENV::HOME/config

                        [ section_one ]\n

                        # # Quotes permit leading and trailing whitespace any = \" any variable name \" other = A string that can \\ cover several lines \\ by including \\ characters message = Hello World\\n

                        [ section_two ]\ngreeting = $section_one::message\n

                        This example shows how to expand environment variables safely. In this example, the variable tempfile is intended to refer to a temporary file, and the environment variable TEMP or TMP, if present, specify the directory where the file should be put. Since the default section is checked if a variable does not exist, it is possible to set TMP to default to /tmp, and TEMP to default to TMP.

                        # # These two lines must be in the default section. TMP = /tmp TEMP = $ENV::TMP

                        # # This can be used anywhere tmpfile = ${ENV::TEMP}/tmp.filename

                        This example shows how to enforce FIPS mode for the application sample.

                        sample = fips_config\n\n[fips_config]\nalg_section = evp_properties\n\n[evp_properties]\ndefault_properties = \"fips=yes\"\n
                        "},{"location":"man5/config/#environment","title":"ENVIRONMENT","text":"
                        • OPENSSL_CONF

                          The path to the config file, or the empty string for none. Ignored in set-user-ID and set-group-ID programs.

                        • OPENSSL_ENGINES

                          The path to the engines directory. Ignored in set-user-ID and set-group-ID programs.

                        • OPENSSL_MODULES

                          The path to the directory with OpenSSL modules, such as providers. Ignored in set-user-ID and set-group-ID programs.

                        • OPENSSL_CONF_INCLUDE

                          The optional path to prepend to all .include paths.

                        "},{"location":"man5/config/#bugs","title":"BUGS","text":"

                        There is no way to include characters using the octal \\nnn form. Strings are all null terminated so nulls cannot form part of the value.

                        The escaping isn't quite right: if you want to use sequences like \\n you can't use any quote escaping on the same line.

                        The limit that only one directory can be opened and read at a time can be considered a bug and should be fixed.

                        "},{"location":"man5/config/#history","title":"HISTORY","text":"

                        An undocumented API, NCONF_WIN32(), used a slightly different set of parsing rules there were intended to be tailored to the Microsoft Windows platform. Specifically, the backslash character was not an escape character and could be used in pathnames, only the double-quote character was recognized, and comments began with a semi-colon. This function was deprecated in OpenSSL 3.0; applications with configuration files using that syntax will have to be modified.

                        "},{"location":"man5/config/#see-also","title":"SEE ALSO","text":"

                        openssl-x509(1), openssl-req(1), openssl-ca(1), openssl-fipsinstall(1), ASN1_generate_nconf(3), EVP_set_default_properties(3), CONF_modules_load(3), CONF_modules_load_file(3), fips_config(5), and x509v3_config(5).

                        "},{"location":"man5/config/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man5/fips_config/","title":"fips_config","text":""},{"location":"man5/fips_config/#name","title":"NAME","text":"

                        fips_config - OpenSSL FIPS configuration

                        "},{"location":"man5/fips_config/#description","title":"DESCRIPTION","text":"

                        A separate configuration file, using the OpenSSL config(5) syntax, is used to hold information about the FIPS module. This includes a digest of the shared library file, and status about the self-testing. This data is used automatically by the module itself for two purposes:

                          • Run the startup FIPS self-test known answer tests (KATS).

                          This is normally done once, at installation time, but may also be set up to run each time the module is used.

                          • Verify the module's checksum.

                          This is done each time the module is used.

                        This file is generated by the openssl-fipsinstall(1) program, and used internally by the FIPS module during its initialization.

                        The following options are supported. They should all appear in a section whose name is identified by the fips option in the providers section, as described in \"Provider Configuration Module\" in config(5).

                        • activate

                          If present, the module is activated. The value assigned to this name is not significant.

                        • install-version

                          A version number for the fips install process. Should be 1.

                        • conditional-errors

                          The FIPS module normally enters an internal error mode if any self test fails. Once this error mode is active, no services or cryptographic algorithms are accessible from this point on. Continuous tests are a subset of the self tests (e.g., a key pair test during key generation, or the CRNG output test). Setting this value to 0 allows the error mode to not be triggered if any continuous test fails. The default value of 1 will trigger the error mode. Regardless of the value, the operation (e.g., key generation) that called the continuous test will return an error code if its continuous test fails. The operation may then be retried if the error mode has not been triggered.

                        • security-checks

                          This indicates if run-time checks related to enforcement of security parameters such as minimum security strength of keys and approved curve names are used. A value of '1' will perform the checks, otherwise if the value is '0' the checks are not performed and FIPS compliance must be done by procedures documented in the relevant Security Policy.

                        • module-mac

                          The calculated MAC of the FIPS provider file.

                        • install-status

                          An indicator that the self-tests were successfully run. This should only be written after the module has successfully passed its self tests during installation. If this field is not present, then the self tests will run when the module loads.

                        • install-mac

                          A MAC of the value of the install-status option, to prevent accidental changes to that value. It is written-to at the same time as install-status is updated.

                        For example:

                        [fips_sect]\nactivate = 1\ninstall-version = 1\nconditional-errors = 1\nsecurity-checks = 1\nmodule-mac = 41:D0:FA:C2:5D:41:75:CD:7D:C3:90:55:6F:A4:DC\ninstall-mac = FE:10:13:5A:D3:B4:C7:82:1B:1E:17:4C:AC:84:0C\ninstall-status = INSTALL_SELF_TEST_KATS_RUN\n
                        "},{"location":"man5/fips_config/#notes","title":"NOTES","text":"

                        When using the FIPS provider, it is recommended that the config_diagnostics option is enabled to prevent accidental use of non-FIPS validated algorithms via broken or mistaken configuration. See config(5).

                        "},{"location":"man5/fips_config/#see-also","title":"SEE ALSO","text":"

                        config(5) openssl-fipsinstall(1)

                        "},{"location":"man5/fips_config/#history","title":"HISTORY","text":"

                        This functionality was added in OpenSSL 3.0.

                        "},{"location":"man5/fips_config/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man5/x509v3_config/","title":"x509v3_config","text":""},{"location":"man5/x509v3_config/#name","title":"NAME","text":"

                        x509v3_config - X509 V3 certificate extension configuration format

                        "},{"location":"man5/x509v3_config/#description","title":"DESCRIPTION","text":"

                        Several OpenSSL commands can add extensions to a certificate or certificate request based on the contents of a configuration file and CLI options such as -addext. The syntax of configuration files is described in config(5). The commands typically have an option to specify the name of the configuration file, and a section within that file; see the documentation of the individual command for details.

                        This page uses extensions as the name of the section, when needed in examples.

                        Each entry in the extension section takes the form:

                        name = [critical, ]value(s)\n

                        If critical is present then the extension will be marked as critical.

                        If multiple entries are processed for the same extension name, later entries override earlier ones with the same name.

                        The format of values depends on the value of name, many have a type-value pairing where the type and value are separated by a colon. There are four main types of extension:

                        string\nmulti-valued\nraw\narbitrary\n

                        Each is described in the following paragraphs.

                        String extensions simply have a string which contains either the value itself or how it is obtained.

                        Multi-valued extensions have a short form and a long form. The short form is a comma-separated list of names and values:

                        basicConstraints = critical, CA:true, pathlen:1\n

                        The long form allows the values to be placed in a separate section:

                        [extensions]\nbasicConstraints = critical, @basic_constraints\n\n[basic_constraints]\nCA = true\npathlen = 1\n

                        Both forms are equivalent.

                        If an extension is multi-value and a field value must contain a comma the long form must be used otherwise the comma would be misinterpreted as a field separator. For example:

                        subjectAltName = URI:ldap://somehost.com/CN=foo,OU=bar\n

                        will produce an error but the equivalent form:

                        [extensions]\nsubjectAltName = @subject_alt_section\n\n[subject_alt_section]\nsubjectAltName = URI:ldap://somehost.com/CN=foo,OU=bar\n

                        is valid.

                        OpenSSL does not support multiple occurrences of the same field within a section. In this example:

                        [extensions]\nsubjectAltName = @alt_section\n\n[alt_section]\nemail = steve@example.com\nemail = steve@example.org\n

                        will only recognize the last value. To specify multiple values append a numeric identifier, as shown here:

                        [extensions]\nsubjectAltName = @alt_section\n\n[alt_section]\nemail.1 = steve@example.com\nemail.2 = steve@example.org\n

                        The syntax of raw extensions is defined by the source code that parses the extension but should be documented. See \"Certificate Policies\" for an example of a raw extension.

                        If an extension type is unsupported, then the arbitrary extension syntax must be used, see the \"ARBITRARY EXTENSIONS\" section for more details.

                        "},{"location":"man5/x509v3_config/#standard-extensions","title":"STANDARD EXTENSIONS","text":"

                        The following sections describe the syntax of each supported extension. They do not define the semantics of the extension.

                        "},{"location":"man5/x509v3_config/#basic-constraints","title":"Basic Constraints","text":"

                        This is a multi-valued extension which indicates whether a certificate is a CA certificate. The first value is CA followed by TRUE or FALSE. If CA is TRUE then an optional pathlen name followed by a nonnegative value can be included.

                        For example:

                        basicConstraints = CA:TRUE\n\nbasicConstraints = CA:FALSE\n\nbasicConstraints = critical, CA:TRUE, pathlen:1\n

                        A CA certificate must include the basicConstraints name with the CA parameter set to TRUE. An end-user certificate must either have CA:FALSE or omit the extension entirely. The pathlen parameter specifies the maximum number of CAs that can appear below this one in a chain. A pathlen of zero means the CA cannot sign any sub-CA's, and can only sign end-entity certificates.

                        "},{"location":"man5/x509v3_config/#key-usage","title":"Key Usage","text":"

                        Key usage is a multi-valued extension consisting of a list of names of the permitted key usages. The defined values are: digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign, encipherOnly, and decipherOnly.

                        Examples:

                        keyUsage = digitalSignature, nonRepudiation\n\nkeyUsage = critical, keyCertSign\n
                        "},{"location":"man5/x509v3_config/#extended-key-usage","title":"Extended Key Usage","text":"

                        This extension consists of a list of values indicating purposes for which the certificate public key can be used. Each value can be either a short text name or an OID. The following text names, and their intended meaning, are known:

                        Value                  Meaning according to RFC 5280 etc.\n-----                  ----------------------------------\nserverAuth             SSL/TLS WWW Server Authentication\nclientAuth             SSL/TLS WWW Client Authentication\ncodeSigning            Code Signing\nemailProtection        E-mail Protection (S/MIME)\ntimeStamping           Trusted Timestamping\nOCSPSigning            OCSP Signing\nipsecIKE               ipsec Internet Key Exchange\nmsCodeInd              Microsoft Individual Code Signing (authenticode)\nmsCodeCom              Microsoft Commercial Code Signing (authenticode)\nmsCTLSign              Microsoft Trust List Signing\nmsEFS                  Microsoft Encrypted File System\n

                        While IETF RFC 5280 says that id-kp-serverAuth and id-kp-clientAuth are only for WWW use, in practice they are used for all kinds of TLS clients and servers, and this is what OpenSSL assumes as well.

                        Examples:

                        extendedKeyUsage = critical, codeSigning, 1.2.3.4\n\nextendedKeyUsage = serverAuth, clientAuth\n
                        "},{"location":"man5/x509v3_config/#subject-key-identifier","title":"Subject Key Identifier","text":"

                        The SKID extension specification has a value with three choices. If the value is the word none then no SKID extension will be included. If the value is the word hash, or by default for the x509, req, and ca apps, the process specified in RFC 5280 section 4.2.1.2. (1) is followed: The keyIdentifier is composed of the 160-bit SHA-1 hash of the value of the BIT STRING subjectPublicKey (excluding the tag, length, and number of unused bits).

                        Otherwise, the value must be a hex string (possibly with : separating bytes) to output directly, however, this is strongly discouraged.

                        Example:

                        subjectKeyIdentifier = hash\n
                        "},{"location":"man5/x509v3_config/#authority-key-identifier","title":"Authority Key Identifier","text":"

                        The AKID extension specification may have the value none indicating that no AKID shall be included. Otherwise it may have the value keyid or issuer or both of them, separated by ,. Either or both can have the option always, indicated by putting a colon : between the value and this option. For self-signed certificates the AKID is suppressed unless always is present. By default the x509, req, and ca apps behave as if \"none\" was given for self-signed certificates and \"keyid, issuer\" otherwise.

                        If keyid is present, an attempt is made to copy the subject key identifier (SKID) from the issuer certificate except if the issuer certificate is the same as the current one and it is not self-signed. The hash of the public key related to the signing key is taken as fallback if the issuer certificate is the same as the current certificate. If always is present but no value can be obtained, an error is returned.

                        If issuer is present, and in addition it has the option always specified or keyid is not present, then the issuer DN and serial number are copied from the issuer certificate.

                        Examples:

                        authorityKeyIdentifier = keyid, issuer\n\nauthorityKeyIdentifier = keyid, issuer:always\n
                        "},{"location":"man5/x509v3_config/#subject-alternative-name","title":"Subject Alternative Name","text":"

                        This is a multi-valued extension that supports several types of name identifier, including email (an email address), URI (a uniform resource indicator), DNS (a DNS domain name), RID (a registered ID: OBJECT IDENTIFIER), IP (an IP address), dirName (a distinguished name), and otherName. The syntax of each is described in the following paragraphs.

                        The email option has two special values. copy will automatically include any email addresses contained in the certificate subject name in the extension. move will automatically move any email addresses from the certificate subject name to the extension.

                        The IP address used in the IP option can be in either IPv4 or IPv6 format.

                        The value of dirName is specifies the configuration section containing the distinguished name to use, as a set of name-value pairs. Multi-valued AVAs can be formed by prefacing the name with a + character.

                        The value of otherName can include arbitrary data associated with an OID; the value should be the OID followed by a semicolon and the content in specified using the syntax in ASN1_generate_nconf(3).

                        Examples:

                        subjectAltName = email:copy, email:my@example.com, URI:http://my.example.com/\n\nsubjectAltName = IP:192.168.7.1\n\nsubjectAltName = IP:13::17\n\nsubjectAltName = email:my@example.com, RID:1.2.3.4\n\nsubjectAltName = otherName:1.2.3.4;UTF8:some other identifier\n\n[extensions]\nsubjectAltName = dirName:dir_sect\n\n[dir_sect]\nC = UK\nO = My Organization\nOU = My Unit\nCN = My Name\n

                        Non-ASCII Email Address conforming the syntax defined in Section 3.3 of RFC 6531 are provided as otherName.SmtpUTF8Mailbox. According to RFC 8398, the email address should be provided as UTF8String. To enforce the valid representation in the certificate, the SmtpUTF8Mailbox should be provided as follows

                        subjectAltName=@alts\n[alts]\notherName = 1.3.6.1.5.5.7.8.9;FORMAT:UTF8,UTF8String:nonasciiname.example.com\n
                        "},{"location":"man5/x509v3_config/#issuer-alternative-name","title":"Issuer Alternative Name","text":"

                        This extension supports most of the options of subject alternative name; it does not support email:copy. It also adds issuer:copy as an allowed value, which copies any subject alternative names from the issuer certificate, if possible.

                        Example:

                        issuerAltName = issuer:copy\n
                        "},{"location":"man5/x509v3_config/#authority-info-access","title":"Authority Info Access","text":"

                        This extension gives details about how to retrieve information that related to the certificate that the CA makes available. The syntax is access_id;location, where access_id is an object identifier (although only a few values are well-known) and location has the same syntax as subject alternative name (except that email:copy is not supported).

                        Possible values for access_id include OCSP (OCSP responder), caIssuers (CA Issuers), ad_timestamping (AD Time Stamping), AD_DVCS (ad dvcs), caRepository (CA Repository).

                        Examples:

                        authorityInfoAccess = OCSP;URI:http://ocsp.example.com/,caIssuers;URI:http://myca.example.com/ca.cer\n\nauthorityInfoAccess = OCSP;URI:http://ocsp.example.com/\n
                        "},{"location":"man5/x509v3_config/#crl-distribution-points","title":"CRL distribution points","text":"

                        This is a multi-valued extension whose values can be either a name-value pair using the same form as subject alternative name or a single value specifying the section name containing all the distribution point values.

                        When a name-value pair is used, a DistributionPoint extension will be set with the given value as the fullName field as the distributionPoint value, and the reasons and cRLIssuer fields will be omitted.

                        When a single option is used, the value specifies the section, and that section can have the following items:

                        • fullname

                          The full name of the distribution point, in the same format as the subject alternative name.

                        • relativename

                          The value is taken as a distinguished name fragment that is set as the value of the nameRelativeToCRLIssuer field.

                        • CRLIssuer

                          The value must in the same format as the subject alternative name.

                        • reasons

                          A multi-value field that contains the reasons for revocation. The recognized values are: keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold, privilegeWithdrawn, and AACompromise.

                        Only one of fullname or relativename should be specified.

                        Simple examples:

                        crlDistributionPoints = URI:http://example.com/myca.crl\n\ncrlDistributionPoints = URI:http://example.com/myca.crl, URI:http://example.org/my.crl\n

                        Full distribution point example:

                        [extensions]\ncrlDistributionPoints = crldp1_section\n\n[crldp1_section]\nfullname = URI:http://example.com/myca.crl\nCRLissuer = dirName:issuer_sect\nreasons = keyCompromise, CACompromise\n\n[issuer_sect]\nC = UK\nO = Organisation\nCN = Some Name\n
                        "},{"location":"man5/x509v3_config/#issuing-distribution-point","title":"Issuing Distribution Point","text":"

                        This extension should only appear in CRLs. It is a multi-valued extension whose syntax is similar to the \"section\" pointed to by the CRL distribution points extension. The following names have meaning:

                        • fullname

                          The full name of the distribution point, in the same format as the subject alternative name.

                        • relativename

                          The value is taken as a distinguished name fragment that is set as the value of the nameRelativeToCRLIssuer field.

                        • onlysomereasons

                          A multi-value field that contains the reasons for revocation. The recognized values are: keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold, privilegeWithdrawn, and AACompromise.

                        • onlyuser, onlyCA, onlyAA, indirectCRL

                          The value for each of these names is a boolean.

                        Example:

                        [extensions]\nissuingDistributionPoint = critical, @idp_section\n\n[idp_section]\nfullname = URI:http://example.com/myca.crl\nindirectCRL = TRUE\nonlysomereasons = keyCompromise, CACompromise\n
                        "},{"location":"man5/x509v3_config/#certificate-policies","title":"Certificate Policies","text":"

                        This is a raw extension that supports all of the defined fields of the certificate extension.

                        Policies without qualifiers are specified by giving the OID. Multiple policies are comma-separated. For example:

                        certificatePolicies = 1.2.4.5, 1.1.3.4\n

                        To include policy qualifiers, use the \"@section\" syntax to point to a section that specifies all the information.

                        The section referred to must include the policy OID using the name policyIdentifier. cPSuri qualifiers can be included using the syntax:

                        CPS.nnn = value\n

                        where nnn is a number.

                        userNotice qualifiers can be set using the syntax:

                        userNotice.nnn = @notice\n

                        The value of the userNotice qualifier is specified in the relevant section. This section can include explicitText, organization, and noticeNumbers options. explicitText and organization are text strings, noticeNumbers is a comma separated list of numbers. The organization and noticeNumbers options (if included) must BOTH be present. Some software might require the ia5org option at the top level; this changes the encoding from Displaytext to IA5String.

                        Example:

                        [extensions]\ncertificatePolicies = ia5org, 1.2.3.4, 1.5.6.7.8, @polsect\n\n[polsect]\npolicyIdentifier = 1.3.5.8\nCPS.1 = \"http://my.host.example.com/\"\nCPS.2 = \"http://my.your.example.com/\"\nuserNotice.1 = @notice\n\n[notice]\nexplicitText = \"Explicit Text Here\"\norganization = \"Organisation Name\"\nnoticeNumbers = 1, 2, 3, 4\n

                        The character encoding of explicitText can be specified by prefixing the value with UTF8, BMP, or VISIBLE followed by colon. For example:

                        [notice]\nexplicitText = \"UTF8:Explicit Text Here\"\n
                        "},{"location":"man5/x509v3_config/#policy-constraints","title":"Policy Constraints","text":"

                        This is a multi-valued extension which consisting of the names requireExplicitPolicy or inhibitPolicyMapping and a non negative integer value. At least one component must be present.

                        Example:

                        policyConstraints = requireExplicitPolicy:3\n
                        "},{"location":"man5/x509v3_config/#inhibit-any-policy","title":"Inhibit Any Policy","text":"

                        This is a string extension whose value must be a non negative integer.

                        Example:

                        inhibitAnyPolicy = 2\n
                        "},{"location":"man5/x509v3_config/#name-constraints","title":"Name Constraints","text":"

                        This is a multi-valued extension. The name should begin with the word permitted or excluded followed by a ;. The rest of the name and the value follows the syntax of subjectAltName except email:copy is not supported and the IP form should consist of an IP addresses and subnet mask separated by a /.

                        Examples:

                        nameConstraints = permitted;IP:192.168.0.0/255.255.0.0\n\nnameConstraints = permitted;email:.example.com\n\nnameConstraints = excluded;email:.com\n
                        "},{"location":"man5/x509v3_config/#ocsp-no-check","title":"OCSP No Check","text":"

                        This is a string extension. It is parsed, but ignored.

                        Example:

                        noCheck = ignored\n
                        "},{"location":"man5/x509v3_config/#tls-feature-aka-must-staple","title":"TLS Feature (aka Must Staple)","text":"

                        This is a multi-valued extension consisting of a list of TLS extension identifiers. Each identifier may be a number (0..65535) or a supported name. When a TLS client sends a listed extension, the TLS server is expected to include that extension in its reply.

                        The supported names are: status_request and status_request_v2.

                        Example:

                        tlsfeature = status_request\n
                        "},{"location":"man5/x509v3_config/#deprecated-extensions","title":"DEPRECATED EXTENSIONS","text":"

                        The following extensions are non standard, Netscape specific and largely obsolete. Their use in new applications is discouraged.

                        "},{"location":"man5/x509v3_config/#netscape-string-extensions","title":"Netscape String extensions","text":"

                        Netscape Comment (nsComment) is a string extension containing a comment which will be displayed when the certificate is viewed in some browsers. Other extensions of this type are: nsBaseUrl, nsRevocationUrl, nsCaRevocationUrl, nsRenewalUrl, nsCaPolicyUrl and nsSslServerName.

                        "},{"location":"man5/x509v3_config/#netscape-certificate-type","title":"Netscape Certificate Type","text":"

                        This is a multi-valued extensions which consists of a list of flags to be included. It was used to indicate the purposes for which a certificate could be used. The basicConstraints, keyUsage and extended key usage extensions are now used instead.

                        Acceptable values for nsCertType are: client, server, email, objsign, reserved, sslCA, emailCA, objCA.

                        "},{"location":"man5/x509v3_config/#arbitrary-extensions","title":"ARBITRARY EXTENSIONS","text":"

                        If an extension is not supported by the OpenSSL code then it must be encoded using the arbitrary extension format. It is also possible to use the arbitrary format for supported extensions. Extreme care should be taken to ensure that the data is formatted correctly for the given extension type.

                        There are two ways to encode arbitrary extensions.

                        The first way is to use the word ASN1 followed by the extension content using the same syntax as ASN1_generate_nconf(3). For example:

                        [extensions]\n1.2.3.4 = critical, ASN1:UTF8String:Some random data\n1.2.3.4.1 = ASN1:SEQUENCE:seq_sect\n\n[seq_sect]\nfield1 = UTF8:field1\nfield2 = UTF8:field2\n

                        It is also possible to use the word DER to include the raw encoded data in any extension.

                        1.2.3.4 = critical, DER:01:02:03:04\n1.2.3.4.1 = DER:01020304\n

                        The value following DER is a hex dump of the DER encoding of the extension Any extension can be placed in this form to override the default behaviour. For example:

                        basicConstraints = critical, DER:00:01:02:03\n
                        "},{"location":"man5/x509v3_config/#warnings","title":"WARNINGS","text":"

                        There is no guarantee that a specific implementation will process a given extension. It may therefore be sometimes possible to use certificates for purposes prohibited by their extensions because a specific application does not recognize or honour the values of the relevant extensions.

                        The DER and ASN1 options should be used with caution. It is possible to create invalid extensions if they are not used carefully.

                        "},{"location":"man5/x509v3_config/#see-also","title":"SEE ALSO","text":"

                        openssl-req(1), openssl-ca(1), openssl-x509(1), ASN1_generate_nconf(3)

                        "},{"location":"man5/x509v3_config/#copyright","title":"COPYRIGHT","text":"

                        Copyright 2004-2023 The OpenSSL Project Authors. All Rights Reserved.

                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                        "},{"location":"man7/EVP_ASYM_CIPHER-RSA/","title":"EVP_ASYM_CIPHER-RSA","text":""},{"location":"man7/EVP_ASYM_CIPHER-RSA/#name","title":"NAME","text":"

                        EVP_ASYM_CIPHER-RSA - RSA Asymmetric Cipher algorithm support

                        "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#description","title":"DESCRIPTION","text":"

                        Asymmetric Cipher support for the RSA key type.

                        "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#rsa-asymmetric-cipher-parameters","title":"RSA Asymmetric Cipher parameters","text":"
                        • \"pad-mode\" (OSSL_ASYM_CIPHER_PARAM_PAD_MODE)

                          The default provider understands these RSA padding modes in string form:

                          • \"none\" (OSSL_PKEY_RSA_PAD_MODE_NONE)
                          • \"oaep\" (OSSL_PKEY_RSA_PAD_MODE_OAEP)
                          • \"pkcs1\" (OSSL_PKEY_RSA_PAD_MODE_PKCSV15)
                          • \"x931\" (OSSL_PKEY_RSA_PAD_MODE_X931)
                        • \"pad-mode\" (OSSL_ASYM_CIPHER_PARAM_PAD_MODE) <integer>

                          The default provider understands these RSA padding modes in integer form:

                          • 1 (RSA_PKCS1_PADDING)
                          • 3 (RSA_NO_PADDING)
                          • 4 (RSA_PKCS1_OAEP_PADDING)
                          • 5 (RSA_X931_PADDING)

                          See EVP_PKEY_CTX_set_rsa_padding(3) for further details.

                        • \"digest\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST)

                        • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS)
                        • \"mgf1-digest\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST)
                        • \"mgf1-digest-props\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS)
                        • \"oaep-label\" (OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL) <octet string>
                        • \"tls-client-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                          See RSA_PKCS1_WITH_TLS_PADDING on the page EVP_PKEY_CTX_set_rsa_padding(3).

                        • \"tls-negotiated-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                          See RSA_PKCS1_WITH_TLS_PADDING on the page EVP_PKEY_CTX_set_rsa_padding(3).

                          See \"Asymmetric Cipher Parameters\" in provider-asym_cipher(7) for more information.

                        • "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#see-also","title":"SEE ALSO","text":"

                          EVP_PKEY-RSA(7), EVP_PKEY(3), provider-asym_cipher(7), provider-keymgmt(7), OSSL_PROVIDER-default(7) OSSL_PROVIDER-FIPS(7)

                          "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#copyright","title":"COPYRIGHT","text":"

                          Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                          "},{"location":"man7/EVP_ASYM_CIPHER-SM2/","title":"EVP_ASYM_CIPHER-SM2","text":""},{"location":"man7/EVP_ASYM_CIPHER-SM2/#name","title":"NAME","text":"

                          EVP_ASYM_CIPHER-SM2 - SM2 Asymmetric Cipher algorithm support

                          "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#description","title":"DESCRIPTION","text":"

                          Asymmetric Cipher support for the SM2 key type.

                          "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#sm2-asymmetric-cipher-parameters","title":"SM2 Asymmetric Cipher parameters","text":"
                          • \"digest\" (OSSL_ASYM_CIPHER_PARAM_DIGEST)
                          • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_DIGEST_PROPS)

                            See \"Asymmetric Cipher Parameters\" in provider-asym_cipher(7).

                            "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#see-also","title":"SEE ALSO","text":"

                            EVP_PKEY-SM2(7), EVP_PKEY(3), provider-asym_cipher(7), provider-keymgmt(7), OSSL_PROVIDER-default(7)

                            "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-AES/","title":"EVP_CIPHER-AES","text":""},{"location":"man7/EVP_CIPHER-AES/#name","title":"NAME","text":"

                            EVP_CIPHER-AES - The AES EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-AES/#description","title":"DESCRIPTION","text":"

                            Support for AES symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-AES/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the FIPS provider as well as the default provider:

                            • \"AES-128-CBC\", \"AES-192-CBC\" and \"AES-256-CBC\"
                            • \"AES-128-CBC-CTS\", \"AES-192-CBC-CTS\" and \"AES-256-CBC-CTS\"
                            • \"AES-128-CFB\", \"AES-192-CFB\", \"AES-256-CFB\", \"AES-128-CFB1\", \"AES-192-CFB1\", \"AES-256-CFB1\", \"AES-128-CFB8\", \"AES-192-CFB8\" and \"AES-256-CFB8\"
                            • \"AES-128-CTR\", \"AES-192-CTR\" and \"AES-256-CTR\"
                            • \"AES-128-ECB\", \"AES-192-ECB\" and \"AES-256-ECB\"
                            • \"AES-192-OFB\", \"AES-128-OFB\" and \"AES-256-OFB\"
                            • \"AES-128-XTS\" and \"AES-256-XTS\"
                            • \"AES-128-CCM\", \"AES-192-CCM\" and \"AES-256-CCM\"
                            • \"AES-128-GCM\", \"AES-192-GCM\" and \"AES-256-GCM\"
                            • \"AES-128-WRAP\", \"AES-192-WRAP\", \"AES-256-WRAP\", \"AES-128-WRAP-PAD\", \"AES-192-WRAP-PAD\", \"AES-256-WRAP-PAD\", \"AES-128-WRAP-INV\", \"AES-192-WRAP-INV\", \"AES-256-WRAP-INV\", \"AES-128-WRAP-PAD-INV\", \"AES-192-WRAP-PAD-INV\" and \"AES-256-WRAP-PAD-INV\"
                            • \"AES-128-CBC-HMAC-SHA1\", \"AES-256-CBC-HMAC-SHA1\", \"AES-128-CBC-HMAC-SHA256\" and \"AES-256-CBC-HMAC-SHA256\"

                            The following algorithms are available in the default provider, but not the FIPS provider:

                            • \"AES-128-OCB\", \"AES-192-OCB\" and \"AES-256-OCB\"
                            • \"AES-128-SIV\", \"AES-192-SIV\" and \"AES-256-SIV\"
                            "},{"location":"man7/EVP_CIPHER-AES/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-AES/#notes","title":"NOTES","text":"

                            The AES-SIV and AES-WRAP mode implementations do not support streaming. That means to obtain correct results there can be only one EVP_EncryptUpdate(3) or EVP_DecryptUpdate(3) call after the initialization of the context.

                            The AES-XTS implementations allow streaming to be performed, but each EVP_EncryptUpdate(3) or EVP_DecryptUpdate(3) call requires each input to be a multiple of the blocksize. Only the final EVP_EncryptUpdate() or EVP_DecryptUpdate() call can optionally have an input that is not a multiple of the blocksize but is larger than one block. In that case ciphertext stealing (CTS) is used to fill the block.

                            "},{"location":"man7/EVP_CIPHER-AES/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                            "},{"location":"man7/EVP_CIPHER-AES/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-ARIA/","title":"EVP_CIPHER-ARIA","text":""},{"location":"man7/EVP_CIPHER-ARIA/#name","title":"NAME","text":"

                            EVP_CIPHER-ARIA - The ARIA EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-ARIA/#description","title":"DESCRIPTION","text":"

                            Support for ARIA symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-ARIA/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the default provider:

                            • \"ARIA-128-CBC\", \"ARIA-192-CBC\" and \"ARIA-256-CBC\"
                            • \"ARIA-128-CFB\", \"ARIA-192-CFB\", \"ARIA-256-CFB\", \"ARIA-128-CFB1\", \"ARIA-192-CFB1\", \"ARIA-256-CFB1\", \"ARIA-128-CFB8\", \"ARIA-192-CFB8\" and \"ARIA-256-CFB8\"
                            • \"ARIA-128-CTR\", \"ARIA-192-CTR\" and \"ARIA-256-CTR\"
                            • \"ARIA-128-ECB\", \"ARIA-192-ECB\" and \"ARIA-256-ECB\"
                            • \"AES-192-OCB\", \"AES-128-OCB\" and \"AES-256-OCB\"
                            • \"ARIA-128-OFB\", \"ARIA-192-OFB\" and \"ARIA-256-OFB\"
                            • \"ARIA-128-CCM\", \"ARIA-192-CCM\" and \"ARIA-256-CCM\"
                            • \"ARIA-128-GCM\", \"ARIA-192-GCM\" and \"ARIA-256-GCM\"
                            "},{"location":"man7/EVP_CIPHER-ARIA/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-ARIA/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-default(7)

                            "},{"location":"man7/EVP_CIPHER-ARIA/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-BLOWFISH/","title":"EVP_CIPHER-BLOWFISH","text":""},{"location":"man7/EVP_CIPHER-BLOWFISH/#name","title":"NAME","text":"

                            EVP_CIPHER-BLOWFISH - The BLOBFISH EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-BLOWFISH/#description","title":"DESCRIPTION","text":"

                            Support for BLOWFISH symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-BLOWFISH/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the legacy provider:

                            • \"BF-ECB\"
                            • \"BF-CBC\"
                            • \"BF-OFB\"
                            • \"BF-CFB\"
                            "},{"location":"man7/EVP_CIPHER-BLOWFISH/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-BLOWFISH/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-legacy(7)

                            "},{"location":"man7/EVP_CIPHER-BLOWFISH/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-CAMELLIA/","title":"EVP_CIPHER-CAMELLIA","text":""},{"location":"man7/EVP_CIPHER-CAMELLIA/#name","title":"NAME","text":"

                            EVP_CIPHER-CAMELLIA - The CAMELLIA EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-CAMELLIA/#description","title":"DESCRIPTION","text":"

                            Support for CAMELLIA symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-CAMELLIA/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the default provider:

                            • \"CAMELLIA-128-CBC\", \"CAMELLIA-192-CBC\" and \"CAMELLIA-256-CBC\"
                            • \"CAMELLIA-128-CBC-CTS\", \"CAMELLIA-192-CBC-CTS\" and \"CAMELLIA-256-CBC-CTS\"
                            • \"CAMELLIA-128-CFB\", \"CAMELLIA-192-CFB\", \"CAMELLIA-256-CFB\", \"CAMELLIA-128-CFB1\", \"CAMELLIA-192-CFB1\", \"CAMELLIA-256-CFB1\", \"CAMELLIA-128-CFB8\", \"CAMELLIA-192-CFB8\" and \"CAMELLIA-256-CFB8\"
                            • \"CAMELLIA-128-CTR\", \"CAMELLIA-192-CTR\" and \"CAMELLIA-256-CTR\"
                            • \"CAMELLIA-128-ECB\", \"CAMELLIA-192-ECB\" and \"CAMELLIA-256-ECB\"
                            • \"CAMELLIA-192-OFB\", \"CAMELLIA-128-OFB\" and \"CAMELLIA-256-OFB\"
                            "},{"location":"man7/EVP_CIPHER-CAMELLIA/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-CAMELLIA/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-default(7)

                            "},{"location":"man7/EVP_CIPHER-CAMELLIA/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-CAST/","title":"EVP_CIPHER-CAST","text":""},{"location":"man7/EVP_CIPHER-CAST/#name","title":"NAME","text":"

                            EVP_CIPHER-CAST - The CAST EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-CAST/#description","title":"DESCRIPTION","text":"

                            Support for CAST symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-CAST/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the legacy provider:

                            • \"CAST-128-CBC\", \"CAST-192-CBC\" and \"CAST-256-CBC\"
                            • \"CAST-128-CFB\", \"CAST-192-CFB\", \"CAST-256-CFB\"
                            • \"CAST-128-ECB\", \"CAST-192-ECB\" and \"CAST-256-ECB\"
                            • \"CAST-192-OFB\", \"CAST-128-OFB\" and \"CAST-256-OFB\"
                            "},{"location":"man7/EVP_CIPHER-CAST/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-CAST/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-legacy(7)

                            "},{"location":"man7/EVP_CIPHER-CAST/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-CHACHA/","title":"EVP_CIPHER-CHACHA","text":""},{"location":"man7/EVP_CIPHER-CHACHA/#name","title":"NAME","text":"

                            EVP_CIPHER-CHACHA - The CHACHA EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-CHACHA/#description","title":"DESCRIPTION","text":"

                            Support for CHACHA symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-CHACHA/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the default provider:

                            • \"ChaCha20\"
                            • \"ChaCha20-Poly1305\"
                            "},{"location":"man7/EVP_CIPHER-CHACHA/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-CHACHA/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-default(7)

                            "},{"location":"man7/EVP_CIPHER-CHACHA/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-DES/","title":"EVP_CIPHER-DES","text":""},{"location":"man7/EVP_CIPHER-DES/#name","title":"NAME","text":"

                            EVP_CIPHER-DES - The DES EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-DES/#description","title":"DESCRIPTION","text":"

                            Support for DES symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-DES/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the FIPS provider as well as the default provider:

                            • \"DES-EDE3-ECB\" or \"DES-EDE3\"
                            • \"DES-EDE3-CBC\" or \"DES3\"

                            The following algorithms are available in the default provider, but not the FIPS provider:

                            • \"DES-EDE3-CFB8\" and \"DES-EDE3-CFB1\"
                            • \"DES-EDE-ECB\" or \"DES-EDE\"
                            • \"DES-EDE-CBC\"
                            • \"DES-EDE-OFB\"
                            • \"DES-EDE-CFB\"
                            • \"DES3-WRAP\"

                            The following algorithms are available in the legacy provider:

                            • \"DES-ECB\"
                            • \"DES-CBC\"
                            • \"DES-OFB\"
                            • \"DES-CFB\", \"DES-CFB1\" and \"DES-CFB8\"
                            • \"DESX-CBC\"
                            "},{"location":"man7/EVP_CIPHER-DES/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-DES/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-legacy(7),

                            "},{"location":"man7/EVP_CIPHER-DES/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-IDEA/","title":"EVP_CIPHER-IDEA","text":""},{"location":"man7/EVP_CIPHER-IDEA/#name","title":"NAME","text":"

                            EVP_CIPHER-IDEA - The IDEA EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-IDEA/#description","title":"DESCRIPTION","text":"

                            Support for IDEA symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-IDEA/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the legacy provider:

                            • \"IDEA-ECB\"
                            • \"IDEA-CBC\"
                            • \"IDEA-OFB\" or \"IDEA-OFB64\"
                            • \"IDEA-CFB\" or \"IDEA-CFB64\"
                            "},{"location":"man7/EVP_CIPHER-IDEA/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-IDEA/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-legacy(7)

                            "},{"location":"man7/EVP_CIPHER-IDEA/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-NULL/","title":"EVP_CIPHER-NULL","text":""},{"location":"man7/EVP_CIPHER-NULL/#name","title":"NAME","text":"

                            EVP_CIPHER-NULL - The NULL EVP_CIPHER implementation

                            "},{"location":"man7/EVP_CIPHER-NULL/#description","title":"DESCRIPTION","text":"

                            Support for a NULL symmetric encryption using the EVP_CIPHER API. This is used when the TLS cipher suite is TLS_NULL_WITH_NULL_NULL. This does no encryption (just copies the data) and has a mac size of zero.

                            "},{"location":"man7/EVP_CIPHER-NULL/#algorithm-name","title":"Algorithm Name","text":"

                            The following algorithm is available in the default provider:

                            • \"NULL\"
                            "},{"location":"man7/EVP_CIPHER-NULL/#parameters","title":"Parameters","text":"

                            This implementation supports the following parameters:

                            "},{"location":"man7/EVP_CIPHER-NULL/#gettable-evp_cipher-parameters","title":"Gettable EVP_CIPHER parameters","text":"

                            See \"Gettable EVP_CIPHER parameters\" in EVP_EncryptInit(3)

                            "},{"location":"man7/EVP_CIPHER-NULL/#gettable-evp_cipher_ctx-parameters","title":"Gettable EVP_CIPHER_CTX parameters","text":"
                            • \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN) <unsigned integer>
                            • \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN and <OSSL_CIPHER_PARAM_AEAD_IVLEN) <unsigned integer>
                            • \"tls-mac\" (OSSL_CIPHER_PARAM_TLS_MAC) <octet ptr>

                            See \"PARAMETERS\" in EVP_EncryptInit(3) for further information.

                            "},{"location":"man7/EVP_CIPHER-NULL/#settable-evp_cipher_ctx-parameters","title":"Settable EVP_CIPHER_CTX parameters","text":"
                            • \"tls-mac-size\" (OSSL_CIPHER_PARAM_TLS_MAC_SIZE) <unsigned integer>

                            See \"PARAMETERS\" in EVP_EncryptInit(3) for further information.

                            "},{"location":"man7/EVP_CIPHER-NULL/#conforming-to","title":"CONFORMING TO","text":"

                            RFC 5246 section-6.2.3.1

                            "},{"location":"man7/EVP_CIPHER-NULL/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-default(7)

                            "},{"location":"man7/EVP_CIPHER-NULL/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-RC2/","title":"EVP_CIPHER-RC2","text":""},{"location":"man7/EVP_CIPHER-RC2/#name","title":"NAME","text":"

                            EVP_CIPHER-RC2 - The RC2 EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-RC2/#description","title":"DESCRIPTION","text":"

                            Support for RC2 symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-RC2/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the legacy provider:

                            • \"RC2-CBC\", \"RC2\" or \"RC2-128\"
                            • \"RC2-40-CBC\" or \"RC2-40\"
                            • \"RC2-64-CBC\" or \"RC2-64\"
                            • \"RC2-ECB\"
                            • \"RC2-CFB\"
                            • \"RC2-OFB\"
                            "},{"location":"man7/EVP_CIPHER-RC2/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-RC2/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-legacy(7)

                            "},{"location":"man7/EVP_CIPHER-RC2/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-RC4/","title":"EVP_CIPHER-RC4","text":""},{"location":"man7/EVP_CIPHER-RC4/#name","title":"NAME","text":"

                            EVP_CIPHER-RC4 - The RC4 EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-RC4/#description","title":"DESCRIPTION","text":"

                            Support for RC4 symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-RC4/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the legacy provider:

                            • \"RC4\"
                            • \"RC4-40\"
                            • \"RC4-HMAC-MD5\"
                            "},{"location":"man7/EVP_CIPHER-RC4/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-RC4/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-legacy(7)

                            "},{"location":"man7/EVP_CIPHER-RC4/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-RC5/","title":"EVP_CIPHER-RC5","text":""},{"location":"man7/EVP_CIPHER-RC5/#name","title":"NAME","text":"

                            EVP_CIPHER-RC5 - The RC5 EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-RC5/#description","title":"DESCRIPTION","text":"

                            Support for RC5 symmetric encryption using the EVP_CIPHER API.

                            Disabled by default. Use the enable-rc5 configuration option to enable.

                            "},{"location":"man7/EVP_CIPHER-RC5/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the legacy provider:

                            • \"RC5-CBC\" or \"RC5\"
                            • \"RC5-ECB\"
                            • \"RC5-OFB\"
                            • \"RC5-CFB\"
                            "},{"location":"man7/EVP_CIPHER-RC5/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-RC5/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-legacy(7)

                            "},{"location":"man7/EVP_CIPHER-RC5/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-SEED/","title":"EVP_CIPHER-SEED","text":""},{"location":"man7/EVP_CIPHER-SEED/#name","title":"NAME","text":"

                            EVP_CIPHER-SEED - The SEED EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-SEED/#description","title":"DESCRIPTION","text":"

                            Support for SEED symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-SEED/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the legacy provider:

                            • \"SEED-CBC\" or \"SEED\"
                            • \"SEED-ECB\"
                            • \"SEED-OFB\" or \"SEED-OFB128\"
                            • \"SEED-CFB\" or \"SEED-CFB128\"
                            "},{"location":"man7/EVP_CIPHER-SEED/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-SEED/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-legacy(7)

                            "},{"location":"man7/EVP_CIPHER-SEED/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_CIPHER-SM4/","title":"EVP_CIPHER-SM4","text":""},{"location":"man7/EVP_CIPHER-SM4/#name","title":"NAME","text":"

                            EVP_CIPHER-SM4 - The SM4 EVP_CIPHER implementations

                            "},{"location":"man7/EVP_CIPHER-SM4/#description","title":"DESCRIPTION","text":"

                            Support for SM4 symmetric encryption using the EVP_CIPHER API.

                            "},{"location":"man7/EVP_CIPHER-SM4/#algorithm-names","title":"Algorithm Names","text":"

                            The following algorithms are available in the default provider:

                            • \"SM4-CBC:SM4\"
                            • \"SM4-ECB\"
                            • \"SM4-CTR\"
                            • \"SM4-OFB\" or \"SM4-OFB128\"
                            • \"SM4-CFB\" or \"SM4-CFB128\"
                            "},{"location":"man7/EVP_CIPHER-SM4/#parameters","title":"Parameters","text":"

                            This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                            "},{"location":"man7/EVP_CIPHER-SM4/#see-also","title":"SEE ALSO","text":"

                            provider-cipher(7), OSSL_PROVIDER-default(7)

                            "},{"location":"man7/EVP_CIPHER-SM4/#copyright","title":"COPYRIGHT","text":"

                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                            "},{"location":"man7/EVP_KDF-HKDF/","title":"EVP_KDF-HKDF","text":""},{"location":"man7/EVP_KDF-HKDF/#name","title":"NAME","text":"

                            EVP_KDF-HKDF - The HKDF EVP_KDF implementation

                            "},{"location":"man7/EVP_KDF-HKDF/#description","title":"DESCRIPTION","text":"

                            Support for computing the HKDF KDF through the EVP_KDF API.

                            The EVP_KDF-HKDF algorithm implements the HKDF key derivation function. HKDF follows the \"extract-then-expand\" paradigm, where the KDF logically consists of two modules. The first stage takes the input keying material and \"extracts\" from it a fixed-length pseudorandom key K. The second stage \"expands\" the key K into several additional pseudorandom keys (the output of the KDF).

                            "},{"location":"man7/EVP_KDF-HKDF/#identity","title":"Identity","text":"

                            \"HKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                            "},{"location":"man7/EVP_KDF-HKDF/#supported-parameters","title":"Supported parameters","text":"

                            The supported parameters are:

                            • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                            • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                            • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>
                            • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                              These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                            • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                              This parameter sets the info value. The length of the context info buffer cannot exceed 1024 bytes; this should be more than enough for any normal use of HKDF.

                            • \"mode\" (OSSL_KDF_PARAM_MODE) or <integer>

                              This parameter sets the mode for the HKDF operation. There are three modes that are currently defined:

                              • \"EXTRACT_AND_EXPAND\" or EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND

                                This is the default mode. Calling EVP_KDF_derive(3) on an EVP_KDF_CTX set up for HKDF will perform an extract followed by an expand operation in one go. The derived key returned will be the result after the expand operation. The intermediate fixed-length pseudorandom key K is not returned.

                                In this mode the digest, key, salt and info values must be set before a key is derived otherwise an error will occur.

                              • \"EXTRACT_ONLY\" or EVP_KDF_HKDF_MODE_EXTRACT_ONLY

                                In this mode calling EVP_KDF_derive(3) will just perform the extract operation. The value returned will be the intermediate fixed-length pseudorandom key K. The keylen parameter must match the size of K, which can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest.

                                The digest, key and salt values must be set before a key is derived otherwise an error will occur.

                              • \"EXPAND_ONLY\" or EVP_KDF_HKDF_MODE_EXPAND_ONLY

                                In this mode calling EVP_KDF_derive(3) will just perform the expand operation. The input key should be set to the intermediate fixed-length pseudorandom key K returned from a previous extract operation.

                                The digest, key and info values must be set before a key is derived otherwise an error will occur.

                              "},{"location":"man7/EVP_KDF-HKDF/#notes","title":"NOTES","text":"

                              A context for HKDF can be obtained by calling:

                              EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"HKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                              The output length of an HKDF expand operation is specified via the keylen parameter to the EVP_KDF_derive(3) function. When using EVP_KDF_HKDF_MODE_EXTRACT_ONLY the keylen parameter must equal the size of the intermediate fixed-length pseudorandom key otherwise an error will occur. For that mode, the fixed output size can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest on the EVP_KDF_CTX.

                              "},{"location":"man7/EVP_KDF-HKDF/#examples","title":"EXAMPLES","text":"

                              This example derives 10 bytes using SHA-256 with the secret key \"secret\", salt value \"salt\" and info value \"label\":

                              EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[5], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"HKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"salt\", (size_t)4);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n
                              "},{"location":"man7/EVP_KDF-HKDF/#conforming-to","title":"CONFORMING TO","text":"

                              RFC 5869

                              "},{"location":"man7/EVP_KDF-HKDF/#see-also","title":"SEE ALSO","text":"

                              EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3), EVP_KDF-TLS13_KDF(7)

                              "},{"location":"man7/EVP_KDF-HKDF/#history","title":"HISTORY","text":"

                              This functionality was added in OpenSSL 3.0.

                              "},{"location":"man7/EVP_KDF-HKDF/#copyright","title":"COPYRIGHT","text":"

                              Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                              "},{"location":"man7/EVP_KDF-KB/","title":"EVP_KDF-KB","text":""},{"location":"man7/EVP_KDF-KB/#name","title":"NAME","text":"

                              EVP_KDF-KB - The Key-Based EVP_KDF implementation

                              "},{"location":"man7/EVP_KDF-KB/#description","title":"DESCRIPTION","text":"

                              The EVP_KDF-KB algorithm implements the Key-Based key derivation function (KBKDF). KBKDF derives a key from repeated application of a keyed MAC to an input secret (and other optional values).

                              "},{"location":"man7/EVP_KDF-KB/#identity","title":"Identity","text":"

                              \"KBKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                              "},{"location":"man7/EVP_KDF-KB/#supported-parameters","title":"Supported parameters","text":"

                              The supported parameters are:

                              • \"mode\" (OSSL_KDF_PARAM_MODE)

                                The mode parameter determines which flavor of KBKDF to use - currently the choices are \"counter\" and \"feedback\". \"counter\" is the default, and will be used if unspecified.

                              • \"mac\" (OSSL_KDF_PARAM_MAC)

                                The value is either CMAC, HMAC, KMAC128 or KMAC256.

                              • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                              • \"cipher\" (OSSL_KDF_PARAM_CIPHER)
                              • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                              • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>
                              • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                              • \"info (OSSL_KDF_PARAM_INFO) <octet string>
                              • \"seed\" (OSSL_KDF_PARAM_SEED) <octet string>

                                The seed parameter is unused in counter mode.

                              • \"use-l\" (OSSL_KDF_PARAM_KBKDF_USE_L) <integer>

                                Set to 0 to disable use of the optional Fixed Input data 'L' (see SP800-108). The default value of 1 will be used if unspecified.

                              • \"use-separator\" (OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR) <integer>

                                Set to 0 to disable use of the optional Fixed Input data 'zero separator' (see SP800-108) that is placed between the Label and Context. The default value of 1 will be used if unspecified.

                              • \"r\" (OSSL_KDF_PARAM_KBKDF_R) <integer>

                                Set the fixed value 'r', indicating the length of the counter in bits.

                                Supported values are 8, 16, 24, and 32. The default value of 32 will be used if unspecified.

                              • Depending on whether mac is CMAC or HMAC, either digest or cipher is required (respectively) and the other is unused. They are unused for KMAC128 and KMAC256.

                                The parameters key, salt, info, and seed correspond to KI, Label, Context, and IV (respectively) in SP800-108. As in that document, salt, info, and seed are optional and may be omitted.

                                \"mac\", \"digest\", cipher\" and \"properties\" are described in \"PARAMETERS\" in EVP_KDF(3).

                                "},{"location":"man7/EVP_KDF-KB/#notes","title":"NOTES","text":"

                                A context for KBKDF can be obtained by calling:

                                EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"KBKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                The output length of an KBKDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                Note that currently OpenSSL only implements counter and feedback modes. Other variants may be supported in the future.

                                "},{"location":"man7/EVP_KDF-KB/#examples","title":"EXAMPLES","text":"

                                This example derives 10 bytes using COUNTER-HMAC-SHA256, with KI \"secret\", Label \"label\", and Context \"context\".

                                EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"KBKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        \"SHA2-256\", 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,\n                                        \"HMAC\", 0);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", strlen(\"secret\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"label\", strlen(\"label\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"context\", strlen(\"context\"));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0)\n    error(\"EVP_KDF_derive\");\n\nEVP_KDF_CTX_free(kctx);\n

                                This example derives 10 bytes using FEEDBACK-CMAC-AES256, with KI \"secret\", Label \"label\", and IV \"sixteen bytes iv\".

                                EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[8], *p = params;\nunsigned char *iv = \"sixteen bytes iv\";\n\nkdf = EVP_KDF_fetch(NULL, \"KBKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER, \"AES256\", 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC, \"CMAC\", 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MODE, \"FEEDBACK\", 0);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", strlen(\"secret\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"label\", strlen(\"label\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"context\", strlen(\"context\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,\n                                         iv, strlen(iv));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0)\n    error(\"EVP_KDF_derive\");\n\nEVP_KDF_CTX_free(kctx);\n
                                "},{"location":"man7/EVP_KDF-KB/#conforming-to","title":"CONFORMING TO","text":"

                                NIST SP800-108, IETF RFC 6803, IETF RFC 8009.

                                "},{"location":"man7/EVP_KDF-KB/#see-also","title":"SEE ALSO","text":"

                                EVP_KDF(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                "},{"location":"man7/EVP_KDF-KB/#history","title":"HISTORY","text":"

                                This functionality was added in OpenSSL 3.0.

                                Support for KMAC was added in OpenSSL 3.1.

                                "},{"location":"man7/EVP_KDF-KB/#copyright","title":"COPYRIGHT","text":"

                                Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. Copyright 2019 Red Hat, Inc.

                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                "},{"location":"man7/EVP_KDF-KRB5KDF/","title":"EVP_KDF-KRB5KDF","text":""},{"location":"man7/EVP_KDF-KRB5KDF/#name","title":"NAME","text":"

                                EVP_KDF-KRB5KDF - The RFC3961 Krb5 KDF EVP_KDF implementation

                                "},{"location":"man7/EVP_KDF-KRB5KDF/#description","title":"DESCRIPTION","text":"

                                Support for computing the KRB5KDF KDF through the EVP_KDF API.

                                The EVP_KDF-KRB5KDF algorithm implements the key derivation function defined in RFC 3961, section 5.1 and is used by Krb5 to derive session keys. Three inputs are required to perform key derivation: a cipher, (for example AES-128-CBC), the initial key, and a constant.

                                "},{"location":"man7/EVP_KDF-KRB5KDF/#identity","title":"Identity","text":"

                                \"KRB5KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                "},{"location":"man7/EVP_KDF-KRB5KDF/#supported-parameters","title":"Supported parameters","text":"

                                The supported parameters are:

                                • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                • \"cipher\" (OSSL_KDF_PARAM_CIPHER)
                                • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                  These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                • \"constant\" (OSSL_KDF_PARAM_CONSTANT) <octet string>

                                  This parameter sets the constant value for the KDF. If a value is already set, the contents are replaced.

                                • "},{"location":"man7/EVP_KDF-KRB5KDF/#notes","title":"NOTES","text":"

                                  A context for KRB5KDF can be obtained by calling:

                                  EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"KRB5KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                  The output length of the KRB5KDF derivation is specified via the keylen parameter to the EVP_KDF_derive(3) function, and MUST match the key length for the chosen cipher or an error is returned. Moreover, the constant's length must not exceed the block size of the cipher. Since the KRB5KDF output length depends on the chosen cipher, calling EVP_KDF_CTX_get_kdf_size(3) to obtain the requisite length returns the correct length only after the cipher is set. Prior to that EVP_MAX_KEY_LENGTH is returned. The caller must allocate a buffer of the correct length for the chosen cipher, and pass that buffer to the EVP_KDF_derive(3) function along with that length.

                                  "},{"location":"man7/EVP_KDF-KRB5KDF/#examples","title":"EXAMPLES","text":"

                                  This example derives a key using the AES-128-CBC cipher:

                                  EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char key[16] = \"01234...\";\nunsigned char constant[] = \"I'm a constant\";\nunsigned char out[16];\nsize_t outlen = sizeof(out);\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"KRB5KDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER,\n                                        SN_aes_128_cbc,\n                                        strlen(SN_aes_128_cbc));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         key, (size_t)16);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_CONSTANT,\n                                         constant, strlen(constant));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, outlen, params) <= 0)\n    /* Error */\n\nEVP_KDF_CTX_free(kctx);\n
                                  "},{"location":"man7/EVP_KDF-KRB5KDF/#conforming-to","title":"CONFORMING TO","text":"

                                  RFC 3961

                                  "},{"location":"man7/EVP_KDF-KRB5KDF/#see-also","title":"SEE ALSO","text":"

                                  EVP_KDF(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                  "},{"location":"man7/EVP_KDF-KRB5KDF/#history","title":"HISTORY","text":"

                                  This functionality was added in OpenSSL 3.0.

                                  "},{"location":"man7/EVP_KDF-KRB5KDF/#copyright","title":"COPYRIGHT","text":"

                                  Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                  "},{"location":"man7/EVP_KDF-PBKDF1/","title":"EVP_KDF-PBKDF1","text":""},{"location":"man7/EVP_KDF-PBKDF1/#name","title":"NAME","text":"

                                  EVP_KDF-PBKDF1 - The PBKDF1 EVP_KDF implementation

                                  "},{"location":"man7/EVP_KDF-PBKDF1/#description","title":"DESCRIPTION","text":"

                                  Support for computing the PBKDF1 password-based KDF through the EVP_KDF API.

                                  The EVP_KDF-PBKDF1 algorithm implements the PBKDF1 password-based key derivation function, as described in RFC 8018; it derives a key from a password using a salt and iteration count.

                                  "},{"location":"man7/EVP_KDF-PBKDF1/#identity","title":"Identity","text":"

                                  \"PBKDF1\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                  "},{"location":"man7/EVP_KDF-PBKDF1/#supported-parameters","title":"Supported parameters","text":"

                                  The supported parameters are:

                                  • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                  • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                                  • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

                                    This parameter has a default value of 0 and should be set.

                                  • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                  • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                    These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                    "},{"location":"man7/EVP_KDF-PBKDF1/#notes","title":"NOTES","text":"

                                    A typical application of this algorithm is to derive keying material for an encryption algorithm from a password in the \"pass\", a salt in \"salt\", and an iteration count.

                                    Increasing the \"iter\" parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                    No assumption is made regarding the given password; it is simply treated as a byte sequence.

                                    "},{"location":"man7/EVP_KDF-PBKDF1/#conforming-to","title":"CONFORMING TO","text":"

                                    RFC 8018

                                    "},{"location":"man7/EVP_KDF-PBKDF1/#see-also","title":"SEE ALSO","text":"

                                    EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                    "},{"location":"man7/EVP_KDF-PBKDF1/#history","title":"HISTORY","text":"

                                    This functionality was added in OpenSSL 3.0.

                                    "},{"location":"man7/EVP_KDF-PBKDF1/#copyright","title":"COPYRIGHT","text":"

                                    Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                    "},{"location":"man7/EVP_KDF-PBKDF2/","title":"EVP_KDF-PBKDF2","text":""},{"location":"man7/EVP_KDF-PBKDF2/#name","title":"NAME","text":"

                                    EVP_KDF-PBKDF2 - The PBKDF2 EVP_KDF implementation

                                    "},{"location":"man7/EVP_KDF-PBKDF2/#description","title":"DESCRIPTION","text":"

                                    Support for computing the PBKDF2 password-based KDF through the EVP_KDF API.

                                    The EVP_KDF-PBKDF2 algorithm implements the PBKDF2 password-based key derivation function, as described in SP800-132; it derives a key from a password using a salt and iteration count.

                                    "},{"location":"man7/EVP_KDF-PBKDF2/#identity","title":"Identity","text":"

                                    \"PBKDF2\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                    "},{"location":"man7/EVP_KDF-PBKDF2/#supported-parameters","title":"Supported parameters","text":"

                                    The supported parameters are:

                                    • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                    • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                                    • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

                                      This parameter has a default value of 2048.

                                    • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                    • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                      These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                    • \"pkcs5\" (OSSL_KDF_PARAM_PKCS5) <integer>

                                      This parameter can be used to enable or disable SP800-132 compliance checks. Setting the mode to 0 enables the compliance checks.

                                      The checks performed are:

                                        • the iteration count is at least 1000.
                                        • the salt length is at least 128 bits.
                                        • the derived key length is at least 112 bits.

                                      The default provider uses a default mode of 1 for backwards compatibility, and the FIPS provider uses a default mode of 0.

                                      The value string is expected to be a decimal number 0 or 1.

                                    • "},{"location":"man7/EVP_KDF-PBKDF2/#notes","title":"NOTES","text":"

                                      A typical application of this algorithm is to derive keying material for an encryption algorithm from a password in the \"pass\", a salt in \"salt\", and an iteration count.

                                      Increasing the \"iter\" parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                      No assumption is made regarding the given password; it is simply treated as a byte sequence.

                                      "},{"location":"man7/EVP_KDF-PBKDF2/#conforming-to","title":"CONFORMING TO","text":"

                                      SP800-132

                                      "},{"location":"man7/EVP_KDF-PBKDF2/#see-also","title":"SEE ALSO","text":"

                                      EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                      "},{"location":"man7/EVP_KDF-PBKDF2/#history","title":"HISTORY","text":"

                                      This functionality was added in OpenSSL 3.0.

                                      "},{"location":"man7/EVP_KDF-PBKDF2/#copyright","title":"COPYRIGHT","text":"

                                      Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                      "},{"location":"man7/EVP_KDF-PKCS12KDF/","title":"EVP_KDF-PKCS12KDF","text":""},{"location":"man7/EVP_KDF-PKCS12KDF/#name","title":"NAME","text":"

                                      EVP_KDF-PKCS12KDF - The PKCS#12 EVP_KDF implementation

                                      "},{"location":"man7/EVP_KDF-PKCS12KDF/#description","title":"DESCRIPTION","text":"

                                      Support for computing the PKCS#12 password-based KDF through the EVP_KDF API.

                                      The EVP_KDF-PKCS12KDF algorithm implements the PKCS#12 password-based key derivation function, as described in appendix B of RFC 7292 (PKCS #12: Personal Information Exchange Syntax); it derives a key from a password using a salt, iteration count and the intended usage.

                                      "},{"location":"man7/EVP_KDF-PKCS12KDF/#identity","title":"Identity","text":"

                                      \"PKCS12KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                      "},{"location":"man7/EVP_KDF-PKCS12KDF/#supported-parameters","title":"Supported parameters","text":"

                                      The supported parameters are:

                                      • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                      • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                                      • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>
                                      • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                      • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                        These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                      • \"id\" (OSSL_KDF_PARAM_PKCS12_ID) <integer>

                                        This parameter is used to specify the intended usage of the output bits, as per RFC 7292 section B.3.

                                      • "},{"location":"man7/EVP_KDF-PKCS12KDF/#notes","title":"NOTES","text":"

                                        This algorithm is not available in the FIPS provider as it is not FIPS approvable.

                                        A typical application of this algorithm is to derive keying material for an encryption algorithm from a password in the \"pass\", a salt in \"salt\", and an iteration count.

                                        Increasing the \"iter\" parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                        No assumption is made regarding the given password; it is simply treated as a byte sequence.

                                        "},{"location":"man7/EVP_KDF-PKCS12KDF/#conforming-to","title":"CONFORMING TO","text":"

                                        RFC7292

                                        "},{"location":"man7/EVP_KDF-PKCS12KDF/#see-also","title":"SEE ALSO","text":"

                                        EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3), OSSL_PROVIDER-FIPS(7)

                                        "},{"location":"man7/EVP_KDF-PKCS12KDF/#history","title":"HISTORY","text":"

                                        This functionality was added in OpenSSL 3.0.

                                        "},{"location":"man7/EVP_KDF-PKCS12KDF/#copyright","title":"COPYRIGHT","text":"

                                        Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                        "},{"location":"man7/EVP_KDF-SCRYPT/","title":"EVP_KDF-SCRYPT","text":""},{"location":"man7/EVP_KDF-SCRYPT/#name","title":"NAME","text":"

                                        EVP_KDF-SCRYPT - The scrypt EVP_KDF implementation

                                        "},{"location":"man7/EVP_KDF-SCRYPT/#description","title":"DESCRIPTION","text":"

                                        Support for computing the scrypt password-based KDF through the EVP_KDF API.

                                        The EVP_KDF-SCRYPT algorithm implements the scrypt password-based key derivation function, as described in RFC 7914. It is memory-hard in the sense that it deliberately requires a significant amount of RAM for efficient computation. The intention of this is to render brute forcing of passwords on systems that lack large amounts of main memory (such as GPUs or ASICs) computationally infeasible.

                                        scrypt provides three work factors that can be customized: N, r and p. N, which has to be a positive power of two, is the general work factor and scales CPU time in an approximately linear fashion. r is the block size of the internally used hash function and p is the parallelization factor. Both r and p need to be greater than zero. The amount of RAM that scrypt requires for its computation is roughly (128 * N * r * p) bytes.

                                        In the original paper of Colin Percival (\"Stronger Key Derivation via Sequential Memory-Hard Functions\", 2009), the suggested values that give a computation time of less than 5 seconds on a 2.5 GHz Intel Core 2 Duo are N = 2^20 = 1048576, r = 8, p = 1. Consequently, the required amount of memory for this computation is roughly 1 GiB. On a more recent CPU (Intel i7-5930K at 3.5 GHz), this computation takes about 3 seconds. When N, r or p are not specified, they default to 1048576, 8, and 1, respectively. The maximum amount of RAM that may be used by scrypt defaults to 1025 MiB.

                                        "},{"location":"man7/EVP_KDF-SCRYPT/#identity","title":"Identity","text":"

                                        \"SCRYPT\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                        "},{"location":"man7/EVP_KDF-SCRYPT/#supported-parameters","title":"Supported parameters","text":"

                                        The supported parameters are:

                                        • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                        • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                          These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                        • \"n\" (OSSL_KDF_PARAM_SCRYPT_N) <unsigned integer>

                                        • \"r\" (OSSL_KDF_PARAM_SCRYPT_R) <unsigned integer>
                                        • \"p\" (OSSL_KDF_PARAM_SCRYPT_P) <unsigned integer>
                                        • \"maxmem_bytes\" (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>

                                          These parameters configure the scrypt work factors N, r, maxmem and p. Both N and maxmem_bytes are parameters of type uint64_t. Both r and p are parameters of type uint32_t.

                                        • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                          This can be used to set the property query string when fetching the fixed digest internally. NULL is used if this value is not set.

                                          "},{"location":"man7/EVP_KDF-SCRYPT/#notes","title":"NOTES","text":"

                                          A context for scrypt can be obtained by calling:

                                          EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"SCRYPT\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                          The output length of an scrypt key derivation is specified via the \"keylen\" parameter to the EVP_KDF_derive(3) function.

                                          "},{"location":"man7/EVP_KDF-SCRYPT/#examples","title":"EXAMPLES","text":"

                                          This example derives a 64-byte long test vector using scrypt with the password \"password\", salt \"NaCl\" and N = 1024, r = 8, p = 16.

                                          EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[64];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SCRYPT\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_PASSWORD,\n                                         \"password\", (size_t)8);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"NaCl\", (size_t)4);\n*p++ = OSSL_PARAM_construct_uint64(OSSL_KDF_PARAM_SCRYPT_N, (uint64_t)1024);\n*p++ = OSSL_PARAM_construct_uint32(OSSL_KDF_PARAM_SCRYPT_R, (uint32_t)8);\n*p++ = OSSL_PARAM_construct_uint32(OSSL_KDF_PARAM_SCRYPT_P, (uint32_t)16);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\n{\n    const unsigned char expected[sizeof(out)] = {\n        0xfd, 0xba, 0xbe, 0x1c, 0x9d, 0x34, 0x72, 0x00,\n        0x78, 0x56, 0xe7, 0x19, 0x0d, 0x01, 0xe9, 0xfe,\n        0x7c, 0x6a, 0xd7, 0xcb, 0xc8, 0x23, 0x78, 0x30,\n        0xe7, 0x73, 0x76, 0x63, 0x4b, 0x37, 0x31, 0x62,\n        0x2e, 0xaf, 0x30, 0xd9, 0x2e, 0x22, 0xa3, 0x88,\n        0x6f, 0xf1, 0x09, 0x27, 0x9d, 0x98, 0x30, 0xda,\n        0xc7, 0x27, 0xaf, 0xb9, 0x4a, 0x83, 0xee, 0x6d,\n        0x83, 0x60, 0xcb, 0xdf, 0xa2, 0xcc, 0x06, 0x40\n    };\n\n    assert(!memcmp(out, expected, sizeof(out)));\n}\n\nEVP_KDF_CTX_free(kctx);\n
                                          "},{"location":"man7/EVP_KDF-SCRYPT/#conforming-to","title":"CONFORMING TO","text":"

                                          RFC 7914

                                          "},{"location":"man7/EVP_KDF-SCRYPT/#see-also","title":"SEE ALSO","text":"

                                          EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                          "},{"location":"man7/EVP_KDF-SCRYPT/#history","title":"HISTORY","text":"

                                          This functionality was added in OpenSSL 3.0.

                                          "},{"location":"man7/EVP_KDF-SCRYPT/#copyright","title":"COPYRIGHT","text":"

                                          Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                          "},{"location":"man7/EVP_KDF-SS/","title":"EVP_KDF-SS","text":""},{"location":"man7/EVP_KDF-SS/#name","title":"NAME","text":"

                                          EVP_KDF-SS - The Single Step / One Step EVP_KDF implementation

                                          "},{"location":"man7/EVP_KDF-SS/#description","title":"DESCRIPTION","text":"

                                          The EVP_KDF-SS algorithm implements the Single Step key derivation function (SSKDF). SSKDF derives a key using input such as a shared secret key (that was generated during the execution of a key establishment scheme) and fixedinfo. SSKDF is also informally referred to as 'Concat KDF'.

                                          "},{"location":"man7/EVP_KDF-SS/#auxiliary-function","title":"Auxiliary function","text":"

                                          The implementation uses a selectable auxiliary function H, which can be one of:

                                          • H(x) = hash(x, digest=md)
                                          • H(x) = HMAC_hash(x, key=salt, digest=md)
                                          • H(x) = KMACxxx(x, key=salt, custom=\"KDF\", outlen=mac_size)

                                          Both the HMAC and KMAC implementations set the key using the 'salt' value. The hash and HMAC also require the digest to be set.

                                          "},{"location":"man7/EVP_KDF-SS/#identity","title":"Identity","text":"

                                          \"SSKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                          "},{"location":"man7/EVP_KDF-SS/#supported-parameters","title":"Supported parameters","text":"

                                          The supported parameters are:

                                          • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                          • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                            This parameter is ignored for KMAC.

                                          • \"mac\" (OSSL_KDF_PARAM_MAC)

                                          • \"maclen\" (OSSL_KDF_PARAM_MAC_SIZE) <unsigned integer>
                                          • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                            These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                          • \"key\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                            This parameter set the shared secret that is used for key derivation.

                                          • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                            This parameter sets an optional value for fixedinfo, also known as otherinfo.

                                          • "},{"location":"man7/EVP_KDF-SS/#notes","title":"NOTES","text":"

                                            A context for SSKDF can be obtained by calling:

                                            EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                            The output length of an SSKDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                            "},{"location":"man7/EVP_KDF-SS/#examples","title":"EXAMPLES","text":"

                                            This example derives 10 bytes using H(x) = SHA-256, with the secret key \"secret\" and fixedinfo value \"label\":

                                            EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n

                                            This example derives 10 bytes using H(x) = HMAC(SHA-256), with the secret key \"secret\", fixedinfo value \"label\" and salt \"salt\":

                                            EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,\n                                        SN_hmac, strlen(SN_hmac));\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"salt\", (size_t)4);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n

                                            This example derives 10 bytes using H(x) = KMAC128(x,salt,outlen), with the secret key \"secret\" fixedinfo value \"label\", salt of \"salt\" and KMAC outlen of 20:

                                            EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,\n                                        SN_kmac128, strlen(SN_kmac128));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"salt\", (size_t)4);\n*p++ = OSSL_PARAM_construct_size_t(OSSL_KDF_PARAM_MAC_SIZE, (size_t)20);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n
                                            "},{"location":"man7/EVP_KDF-SS/#conforming-to","title":"CONFORMING TO","text":"

                                            NIST SP800-56Cr1.

                                            "},{"location":"man7/EVP_KDF-SS/#see-also","title":"SEE ALSO","text":"

                                            EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                            "},{"location":"man7/EVP_KDF-SS/#history","title":"HISTORY","text":"

                                            This functionality was added in OpenSSL 3.0.

                                            "},{"location":"man7/EVP_KDF-SS/#copyright","title":"COPYRIGHT","text":"

                                            Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.

                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                            "},{"location":"man7/EVP_KDF-SSHKDF/","title":"EVP_KDF-SSHKDF","text":""},{"location":"man7/EVP_KDF-SSHKDF/#name","title":"NAME","text":"

                                            EVP_KDF-SSHKDF - The SSHKDF EVP_KDF implementation

                                            "},{"location":"man7/EVP_KDF-SSHKDF/#description","title":"DESCRIPTION","text":"

                                            Support for computing the SSHKDF KDF through the EVP_KDF API.

                                            The EVP_KDF-SSHKDF algorithm implements the SSHKDF key derivation function. It is defined in RFC 4253, section 7.2 and is used by SSH to derive IVs, encryption keys and integrity keys. Five inputs are required to perform key derivation: The hashing function (for example SHA256), the Initial Key, the Exchange Hash, the Session ID, and the derivation key type.

                                            "},{"location":"man7/EVP_KDF-SSHKDF/#identity","title":"Identity","text":"

                                            \"SSHKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                            "},{"location":"man7/EVP_KDF-SSHKDF/#supported-parameters","title":"Supported parameters","text":"

                                            The supported parameters are:

                                            • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                            • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                            • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                              These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                            • \"xcghash\" (OSSL_KDF_PARAM_SSHKDF_XCGHASH) <octet string>

                                            • \"session_id\" (OSSL_KDF_PARAM_SSHKDF_SESSION_ID) <octet string>

                                              These parameters set the respective values for the KDF. If a value is already set, the contents are replaced.

                                            • \"type\" (OSSL_KDF_PARAM_SSHKDF_TYPE)

                                              This parameter sets the type for the SSHKDF operation. There are six supported types:

                                              • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV

                                                The Initial IV from client to server. A single char of value 65 (ASCII char 'A').

                                              • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI

                                                The Initial IV from server to client A single char of value 66 (ASCII char 'B').

                                              • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV

                                                The Encryption Key from client to server A single char of value 67 (ASCII char 'C').

                                              • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI

                                                The Encryption Key from server to client A single char of value 68 (ASCII char 'D').

                                              • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV

                                                The Integrity Key from client to server A single char of value 69 (ASCII char 'E').

                                              • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI

                                                The Integrity Key from client to server A single char of value 70 (ASCII char 'F').

                                              "},{"location":"man7/EVP_KDF-SSHKDF/#notes","title":"NOTES","text":"

                                              A context for SSHKDF can be obtained by calling:

                                              EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"SSHKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                              The output length of the SSHKDF derivation is specified via the keylen parameter to the EVP_KDF_derive(3) function. Since the SSHKDF output length is variable, calling EVP_KDF_CTX_get_kdf_size(3) to obtain the requisite length is not meaningful. The caller must allocate a buffer of the desired length, and pass that buffer to the EVP_KDF_derive(3) function along with the desired length.

                                              "},{"location":"man7/EVP_KDF-SSHKDF/#examples","title":"EXAMPLES","text":"

                                              This example derives an 8 byte IV using SHA-256 with a 1K \"key\" and appropriate \"xcghash\" and \"session_id\" values:

                                              EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nchar type = EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV;\nunsigned char key[1024] = \"01234...\";\nunsigned char xcghash[32] = \"012345...\";\nunsigned char session_id[32] = \"012345...\";\nunsigned char out[8];\nsize_t outlen = sizeof(out);\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSHKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         key, (size_t)1024);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SSHKDF_XCGHASH,\n                                         xcghash, (size_t)32);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SSHKDF_SESSION_ID,\n                                         session_id, (size_t)32);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_SSHKDF_TYPE,\n                                        &type, sizeof(type));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, outlen, params) <= 0)\n    /* Error */\n
                                              "},{"location":"man7/EVP_KDF-SSHKDF/#conforming-to","title":"CONFORMING TO","text":"

                                              RFC 4253

                                              "},{"location":"man7/EVP_KDF-SSHKDF/#see-also","title":"SEE ALSO","text":"

                                              EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                              "},{"location":"man7/EVP_KDF-SSHKDF/#history","title":"HISTORY","text":"

                                              This functionality was added in OpenSSL 3.0.

                                              "},{"location":"man7/EVP_KDF-SSHKDF/#copyright","title":"COPYRIGHT","text":"

                                              Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                              "},{"location":"man7/EVP_KDF-TLS13_KDF/","title":"EVP_KDF-TLS13_KDF","text":""},{"location":"man7/EVP_KDF-TLS13_KDF/#name","title":"NAME","text":"

                                              EVP_KDF-TLS13_KDF - The TLS 1.3 EVP_KDF implementation

                                              "},{"location":"man7/EVP_KDF-TLS13_KDF/#description","title":"DESCRIPTION","text":"

                                              Support for computing the TLS 1.3 version of the HKDF KDF through the EVP_KDF API.

                                              The EVP_KDF-TLS13_KDF algorithm implements the HKDF key derivation function as used by TLS 1.3.

                                              "},{"location":"man7/EVP_KDF-TLS13_KDF/#identity","title":"Identity","text":"

                                              \"TLS13-KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                              "},{"location":"man7/EVP_KDF-TLS13_KDF/#supported-parameters","title":"Supported parameters","text":"

                                              The supported parameters are:

                                              • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                              • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                              • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>
                                              • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                                These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                              • \"prefix\" (OSSL_KDF_PARAM_PREFIX) <octet string>

                                                This parameter sets the label prefix on the specified TLS 1.3 KDF context. For TLS 1.3 this should be set to the ASCII string \"tls13 \" without a trailing zero byte. Refer to RFC 8446 section 7.1 \"Key Schedule\" for details.

                                              • \"label\" (OSSL_KDF_PARAM_LABEL) <octet string>

                                                This parameter sets the label on the specified TLS 1.3 KDF context. Refer to RFC 8446 section 7.1 \"Key Schedule\" for details.

                                              • \"data\" (OSSL_KDF_PARAM_DATA) <octet string>

                                                This parameter sets the context data on the specified TLS 1.3 KDF context. Refer to RFC 8446 section 7.1 \"Key Schedule\" for details.

                                              • \"mode\" (OSSL_KDF_PARAM_MODE) or <integer>

                                                This parameter sets the mode for the TLS 1.3 KDF operation. There are two modes that are currently defined:

                                                • \"EXTRACT_ONLY\" or EVP_KDF_HKDF_MODE_EXTRACT_ONLY

                                                  In this mode calling EVP_KDF_derive(3) will just perform the extract operation. The value returned will be the intermediate fixed-length pseudorandom key K. The keylen parameter must match the size of K, which can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest.

                                                  The digest, key and salt values must be set before a key is derived otherwise an error will occur.

                                                • \"EXPAND_ONLY\" or EVP_KDF_HKDF_MODE_EXPAND_ONLY

                                                  In this mode calling EVP_KDF_derive(3) will just perform the expand operation. The input key should be set to the intermediate fixed-length pseudorandom key K returned from a previous extract operation.

                                                  The digest, key and info values must be set before a key is derived otherwise an error will occur.

                                                "},{"location":"man7/EVP_KDF-TLS13_KDF/#notes","title":"NOTES","text":"

                                                This KDF is intended for use by the TLS 1.3 implementation in libssl. It does not support all the options and capabilities that HKDF does.

                                                The OSSL_PARAM array passed to EVP_KDF_derive(3) or EVP_KDF_CTX_set_params(3) must specify all of the parameters required. This KDF does not support a piecemeal approach to providing these.

                                                A context for a TLS 1.3 KDF can be obtained by calling:

                                                EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"TLS13-KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                The output length of a TLS 1.3 KDF expand operation is specified via the keylen parameter to the EVP_KDF_derive(3) function. When using EVP_KDF_HKDF_MODE_EXTRACT_ONLY the keylen parameter must equal the size of the intermediate fixed-length pseudorandom key otherwise an error will occur. For that mode, the fixed output size can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest on the EVP_KDF_CTX.

                                                "},{"location":"man7/EVP_KDF-TLS13_KDF/#conforming-to","title":"CONFORMING TO","text":"

                                                RFC 8446

                                                "},{"location":"man7/EVP_KDF-TLS13_KDF/#see-also","title":"SEE ALSO","text":"

                                                EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3), EVP_KDF-HKDF(7)

                                                "},{"location":"man7/EVP_KDF-TLS13_KDF/#history","title":"HISTORY","text":"

                                                This functionality was added in OpenSSL 3.0.

                                                "},{"location":"man7/EVP_KDF-TLS13_KDF/#copyright","title":"COPYRIGHT","text":"

                                                Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                "},{"location":"man7/EVP_KDF-TLS1_PRF/","title":"EVP_KDF-TLS1_PRF","text":""},{"location":"man7/EVP_KDF-TLS1_PRF/#name","title":"NAME","text":"

                                                EVP_KDF-TLS1_PRF - The TLS1 PRF EVP_KDF implementation

                                                "},{"location":"man7/EVP_KDF-TLS1_PRF/#description","title":"DESCRIPTION","text":"

                                                Support for computing the TLS1 PRF through the EVP_KDF API.

                                                The EVP_KDF-TLS1_PRF algorithm implements the PRF used by TLS versions up to and including TLS 1.2.

                                                "},{"location":"man7/EVP_KDF-TLS1_PRF/#identity","title":"Identity","text":"

                                                \"TLS1-PRF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                "},{"location":"man7/EVP_KDF-TLS1_PRF/#supported-parameters","title":"Supported parameters","text":"

                                                The supported parameters are:

                                                • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                  These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                  The OSSL_KDF_PARAM_DIGEST parameter is used to set the message digest associated with the TLS PRF. EVP_md5_sha1() is treated as a special case which uses the PRF algorithm using both MD5 and SHA1 as used in TLS 1.0 and 1.1.

                                                • \"secret\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                                  This parameter sets the secret value of the TLS PRF. Any existing secret value is replaced.

                                                • \"seed\" (OSSL_KDF_PARAM_SEED) <octet string>

                                                  This parameter sets the context seed. The length of the context seed cannot exceed 1024 bytes; this should be more than enough for any normal use of the TLS PRF.

                                                • "},{"location":"man7/EVP_KDF-TLS1_PRF/#notes","title":"NOTES","text":"

                                                  A context for the TLS PRF can be obtained by calling:

                                                  EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"TLS1-PRF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                  The digest, secret value and seed must be set before a key is derived otherwise an error will occur.

                                                  The output length of the PRF is specified by the keylen parameter to the EVP_KDF_derive() function.

                                                  "},{"location":"man7/EVP_KDF-TLS1_PRF/#examples","title":"EXAMPLES","text":"

                                                  This example derives 10 bytes using SHA-256 with the secret key \"secret\" and seed value \"seed\":

                                                  EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"TLS1-PRF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,\n                                         \"seed\", (size_t)4);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\nEVP_KDF_CTX_free(kctx);\n
                                                  "},{"location":"man7/EVP_KDF-TLS1_PRF/#conforming-to","title":"CONFORMING TO","text":"

                                                  RFC 2246, RFC 5246 and NIST SP 800-135 r1

                                                  "},{"location":"man7/EVP_KDF-TLS1_PRF/#see-also","title":"SEE ALSO","text":"

                                                  EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                  "},{"location":"man7/EVP_KDF-TLS1_PRF/#history","title":"HISTORY","text":"

                                                  This functionality was added in OpenSSL 3.0.

                                                  "},{"location":"man7/EVP_KDF-TLS1_PRF/#copyright","title":"COPYRIGHT","text":"

                                                  Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                  "},{"location":"man7/EVP_KDF-X942-ASN1/","title":"EVP_KDF-X942-ASN1","text":""},{"location":"man7/EVP_KDF-X942-ASN1/#name","title":"NAME","text":"

                                                  EVP_KDF-X942-ASN1 - The X9.42-2003 asn1 EVP_KDF implementation

                                                  "},{"location":"man7/EVP_KDF-X942-ASN1/#description","title":"DESCRIPTION","text":"

                                                  The EVP_KDF-X942-ASN1 algorithm implements the key derivation function X942KDF-ASN1. It is used by DH KeyAgreement, to derive a key using input such as a shared secret key and other info. The other info is DER encoded data that contains a 32 bit counter as well as optional fields for \"partyu-info\", \"partyv-info\", \"supp-pubinfo\" and \"supp-privinfo\". This kdf is used by Cryptographic Message Syntax (CMS).

                                                  "},{"location":"man7/EVP_KDF-X942-ASN1/#identity","title":"Identity","text":"

                                                  \"X942KDF-ASN1\" or \"X942KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                  "},{"location":"man7/EVP_KDF-X942-ASN1/#supported-parameters","title":"Supported parameters","text":"

                                                  The supported parameters are:

                                                  • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                  • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                    These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                  • \"secret\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                                    The shared secret used for key derivation. This parameter sets the secret.

                                                  • \"acvp-info\" (OSSL_KDF_PARAM_X942_ACVPINFO) <octet string>

                                                    This value should not be used in production and should only be used for ACVP testing. It is an optional octet string containing a combined DER encoded blob of any of the optional fields related to \"partyu-info\", \"partyv-info\", \"supp-pubinfo\" and \"supp-privinfo\". If it is specified then none of these other fields should be used.

                                                  • \"partyu-info\" (OSSL_KDF_PARAM_X942_PARTYUINFO) <octet string>

                                                    An optional octet string containing public info contributed by the initiator.

                                                  • \"ukm\" (OSSL_KDF_PARAM_UKM) <octet string>

                                                    An alias for \"partyu-info\". In CMS this is the user keying material.

                                                  • \"partyv-info\" (OSSL_KDF_PARAM_X942_PARTYVINFO) <octet string>

                                                    An optional octet string containing public info contributed by the responder.

                                                  • \"supp-pubinfo\" (OSSL_KDF_PARAM_X942_SUPP_PUBINFO) <octet string>

                                                    An optional octet string containing some additional, mutually-known public information. Setting this value also sets \"use-keybits\" to 0.

                                                  • \"use-keybits\" (OSSL_KDF_PARAM_X942_USE_KEYBITS) <integer>

                                                    The default value of 1 will use the KEK key length (in bits) as the \"supp-pubinfo\". A value of 0 disables setting the \"supp-pubinfo\".

                                                  • \"supp-privinfo\" (OSSL_KDF_PARAM_X942_SUPP_PRIVINFO) <octet string>

                                                    An optional octet string containing some additional, mutually-known private information.

                                                  • \"cekalg\" (OSSL_KDF_PARAM_CEK_ALG)

                                                    This parameter sets the CEK wrapping algorithm name. Valid values are \"AES-128-WRAP\", \"AES-192-WRAP\", \"AES-256-WRAP\" and \"DES3-WRAP\".

                                                    "},{"location":"man7/EVP_KDF-X942-ASN1/#notes","title":"NOTES","text":"

                                                    A context for X942KDF can be obtained by calling:

                                                    EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"X942KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                    The output length of an X942KDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                                    "},{"location":"man7/EVP_KDF-X942-ASN1/#examples","title":"EXAMPLES","text":"

                                                    This example derives 24 bytes, with the secret key \"secret\" and random user keying material:

                                                    EVP_KDF_CTX *kctx;\nEVP_KDF_CTX *kctx;\nunsigned char out[192/8];\nunsignred char ukm[64];\nOSSL_PARAM params[5], *p = params;\n\nif (RAND_bytes(ukm, sizeof(ukm)) <= 0)\n    error(\"RAND_bytes\");\n\nkdf = EVP_KDF_fetch(NULL, \"X942KDF\", NULL);\nif (kctx == NULL)\n    error(\"EVP_KDF_fetch\");\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\nif (kctx == NULL)\n    error(\"EVP_KDF_CTX_new\");\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, \"SHA256\", 0);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_UKM, ukm, sizeof(ukm));\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CEK_ALG, \"AES-256-WRAP, 0);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0)\n    error(\"EVP_KDF_derive\");\n\nEVP_KDF_CTX_free(kctx);\n
                                                    "},{"location":"man7/EVP_KDF-X942-ASN1/#conforming-to","title":"CONFORMING TO","text":"

                                                    ANS1 X9.42-2003 RFC 2631

                                                    "},{"location":"man7/EVP_KDF-X942-ASN1/#see-also","title":"SEE ALSO","text":"

                                                    EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                    "},{"location":"man7/EVP_KDF-X942-ASN1/#history","title":"HISTORY","text":"

                                                    This functionality was added in OpenSSL 3.0.

                                                    "},{"location":"man7/EVP_KDF-X942-ASN1/#copyright","title":"COPYRIGHT","text":"

                                                    Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                    "},{"location":"man7/EVP_KDF-X942-CONCAT/","title":"EVP_KDF-X942-CONCAT","text":""},{"location":"man7/EVP_KDF-X942-CONCAT/#name","title":"NAME","text":"

                                                    EVP_KDF-X942-CONCAT - The X942 Concat EVP_KDF implementation

                                                    "},{"location":"man7/EVP_KDF-X942-CONCAT/#description","title":"DESCRIPTION","text":"

                                                    The EVP_KDF-X942-CONCAT algorithm is identical to EVP_KDF-X963. It is used for key agreement to derive a key using input such as a shared secret key and shared info.

                                                    "},{"location":"man7/EVP_KDF-X942-CONCAT/#identity","title":"Identity","text":"

                                                    \"X942KDF_CONCAT\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                    This is an alias for \"X963KDF\".

                                                    See EVP_KDF-X963(7) for a list of supported parameters and examples.

                                                    "},{"location":"man7/EVP_KDF-X942-CONCAT/#history","title":"HISTORY","text":"

                                                    This functionality was added in OpenSSL 3.0.

                                                    "},{"location":"man7/EVP_KDF-X942-CONCAT/#copyright","title":"COPYRIGHT","text":"

                                                    Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                    "},{"location":"man7/EVP_KDF-X963/","title":"EVP_KDF-X963","text":""},{"location":"man7/EVP_KDF-X963/#name","title":"NAME","text":"

                                                    EVP_KDF-X963 - The X9.63-2001 EVP_KDF implementation

                                                    "},{"location":"man7/EVP_KDF-X963/#description","title":"DESCRIPTION","text":"

                                                    The EVP_KDF-X963 algorithm implements the key derivation function (X963KDF). X963KDF is used by Cryptographic Message Syntax (CMS) for EC KeyAgreement, to derive a key using input such as a shared secret key and shared info.

                                                    "},{"location":"man7/EVP_KDF-X963/#identity","title":"Identity","text":"

                                                    \"X963KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                    "},{"location":"man7/EVP_KDF-X963/#supported-parameters","title":"Supported parameters","text":"

                                                    The supported parameters are:

                                                    • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                    • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                      These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                    • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                                      The shared secret used for key derivation. This parameter sets the secret.

                                                    • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                                      This parameter specifies an optional value for shared info.

                                                    • "},{"location":"man7/EVP_KDF-X963/#notes","title":"NOTES","text":"

                                                      X963KDF is very similar to the SSKDF that uses a digest as the auxiliary function, X963KDF appends the counter to the secret, whereas SSKDF prepends the counter.

                                                      A context for X963KDF can be obtained by calling:

                                                      EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"X963KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                      The output length of an X963KDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                                      "},{"location":"man7/EVP_KDF-X963/#examples","title":"EXAMPLES","text":"

                                                      This example derives 10 bytes, with the secret key \"secret\" and sharedinfo value \"label\":

                                                      EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"X963KDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n
                                                      "},{"location":"man7/EVP_KDF-X963/#conforming-to","title":"CONFORMING TO","text":"

                                                      \"SEC 1: Elliptic Curve Cryptography\"

                                                      "},{"location":"man7/EVP_KDF-X963/#see-also","title":"SEE ALSO","text":"

                                                      EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                      "},{"location":"man7/EVP_KDF-X963/#history","title":"HISTORY","text":"

                                                      This functionality was added in OpenSSL 3.0.

                                                      "},{"location":"man7/EVP_KDF-X963/#copyright","title":"COPYRIGHT","text":"

                                                      Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                      "},{"location":"man7/EVP_KEM-RSA/","title":"EVP_KEM-RSA","text":""},{"location":"man7/EVP_KEM-RSA/#name","title":"NAME","text":"

                                                      EVP_KEM-RSA - EVP_KEM RSA keytype and algorithm support

                                                      "},{"location":"man7/EVP_KEM-RSA/#description","title":"DESCRIPTION","text":"

                                                      The RSA keytype and its parameters are described in EVP_PKEY-RSA(7). See EVP_PKEY_encapsulate(3) and EVP_PKEY_decapsulate(3) for more info.

                                                      "},{"location":"man7/EVP_KEM-RSA/#rsa-kem-parameters","title":"RSA KEM parameters","text":"
                                                      • \"operation\" (OSSL_KEM_PARAM_OPERATION)

                                                        The OpenSSL RSA Key Encapsulation Mechanism only currently supports the following operation

                                                        • \"RSASVE\"

                                                          The encapsulate function simply generates a secret using random bytes and then encrypts the secret using the RSA public key (with no padding). The decapsulate function recovers the secret using the RSA private key.

                                                        This can be set using EVP_PKEY_CTX_set_kem_op().

                                                        "},{"location":"man7/EVP_KEM-RSA/#conforming-to","title":"CONFORMING TO","text":"
                                                        • SP800-56Br2

                                                          Section 7.2.1.2 RSASVE Generate Operation (RSASVE.GENERATE). Section 7.2.1.3 RSASVE Recovery Operation (RSASVE.RECOVER).

                                                        "},{"location":"man7/EVP_KEM-RSA/#see-also","title":"SEE ALSO","text":"

                                                        EVP_PKEY_CTX_set_kem_op(3), EVP_PKEY_encapsulate(3), EVP_PKEY_decapsulate(3) EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7)

                                                        "},{"location":"man7/EVP_KEM-RSA/#history","title":"HISTORY","text":"

                                                        This functionality was added in OpenSSL 3.0.

                                                        "},{"location":"man7/EVP_KEM-RSA/#copyright","title":"COPYRIGHT","text":"

                                                        Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                        "},{"location":"man7/EVP_KEYEXCH-DH/","title":"EVP_KEYEXCH-DH","text":""},{"location":"man7/EVP_KEYEXCH-DH/#name","title":"NAME","text":"

                                                        EVP_KEYEXCH-DH - DH Key Exchange algorithm support

                                                        "},{"location":"man7/EVP_KEYEXCH-DH/#description","title":"DESCRIPTION","text":"

                                                        Key exchange support for the DH key type.

                                                        "},{"location":"man7/EVP_KEYEXCH-DH/#dh-key-exchange-parameters","title":"DH key exchange parameters","text":"
                                                        • \"pad\" (OSSL_EXCHANGE_PARAM_PAD) <unsigned integer>

                                                          Sets the padding mode for the associated key exchange ctx. Setting a value of 1 will turn padding on. Setting a value of 0 will turn padding off. If padding is off then the derived shared secret may be smaller than the largest possible secret size. If padding is on then the derived shared secret will have its first bytes filled with zeros where necessary to make the shared secret the same size as the largest possible secret size. The padding mode parameter is ignored (and padding implicitly enabled) when the KDF type is set to \"X942KDF-ASN1\" (OSSL_KDF_NAME_X942KDF_ASN1).

                                                        • \"kdf-type\" (OSSL_EXCHANGE_PARAM_KDF_TYPE)

                                                          See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                        • \"kdf-digest\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST)

                                                          See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                        • \"kdf-digest-props\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS)

                                                          See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                        • \"kdf-outlen\" (OSSL_EXCHANGE_PARAM_KDF_OUTLEN) <unsigned integer>

                                                          See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                        • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string>

                                                          See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                        • \"cekalg\" (OSSL_KDF_PARAM_CEK_ALG) <octet string ptr>

                                                          See \"KDF Parameters\" in provider-kdf(7).

                                                        • "},{"location":"man7/EVP_KEYEXCH-DH/#examples","title":"EXAMPLES","text":"

                                                          The examples assume a host and peer both generate keys using the same named group (or domain parameters). See \"Examples\" in EVP_PKEY-DH(7). Both the host and peer transfer their public key to each other.

                                                          To convert the peer's generated key pair to a public key in DER format in order to transfer to the host:

                                                          EVP_PKEY *peer_key; /* It is assumed this contains the peers generated key */\nunsigned char *peer_pub_der = NULL;\nint peer_pub_der_len;\n\npeer_pub_der_len = i2d_PUBKEY(peer_key, &peer_pub_der);\n...\nOPENSSL_free(peer_pub_der);\n

                                                          To convert the received peer's public key from DER format on the host:

                                                          const unsigned char *pd = peer_pub_der;\nEVP_PKEY *peer_pub_key = d2i_PUBKEY(NULL, &pd, peer_pub_der_len);\n...\nEVP_PKEY_free(peer_pub_key);\n

                                                          To derive a shared secret on the host using the host's key and the peer's public key:

                                                          /* It is assumed that the host_key and peer_pub_key are set up */\nvoid derive_secret(EVP_KEY *host_key, EVP_PKEY *peer_pub_key)\n{\n    unsigned int pad = 1;\n    OSSL_PARAM params[2];\n    unsigned char *secret = NULL;\n    size_t secret_len = 0;\n    EVP_PKEY_CTX *dctx = EVP_PKEY_CTX_new_from_pkey(NULL, host_key, NULL);\n\n    EVP_PKEY_derive_init(dctx);\n\n    /* Optionally set the padding */\n    params[0] = OSSL_PARAM_construct_uint(OSSL_EXCHANGE_PARAM_PAD, &pad);\n    params[1] = OSSL_PARAM_construct_end();\n    EVP_PKEY_CTX_set_params(dctx, params);\n\n    EVP_PKEY_derive_set_peer(dctx, peer_pub_key);\n\n    /* Get the size by passing NULL as the buffer */\n    EVP_PKEY_derive(dctx, NULL, &secret_len);\n    secret = OPENSSL_zalloc(secret_len);\n\n    EVP_PKEY_derive(dctx, secret, &secret_len);\n    ...\n    OPENSSL_clear_free(secret, secret_len);\n    EVP_PKEY_CTX_free(dctx);\n}\n

                                                          Very similar code can be used by the peer to derive the same shared secret using the host's public key and the peer's generated key pair.

                                                          "},{"location":"man7/EVP_KEYEXCH-DH/#see-also","title":"SEE ALSO","text":"

                                                          EVP_PKEY-DH(7), EVP_PKEY-FFC(7), EVP_PKEY(3), provider-keyexch(7), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                          "},{"location":"man7/EVP_KEYEXCH-DH/#copyright","title":"COPYRIGHT","text":"

                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                          "},{"location":"man7/EVP_KEYEXCH-ECDH/","title":"EVP_KEYEXCH-ECDH","text":""},{"location":"man7/EVP_KEYEXCH-ECDH/#name","title":"NAME","text":"

                                                          EVP_KEYEXCH-ECDH - ECDH Key Exchange algorithm support

                                                          "},{"location":"man7/EVP_KEYEXCH-ECDH/#description","title":"DESCRIPTION","text":"

                                                          Key exchange support for the ECDH key type.

                                                          "},{"location":"man7/EVP_KEYEXCH-ECDH/#ecdh-key-exchange-parameters","title":"ECDH Key Exchange parameters","text":"
                                                          • \"ecdh-cofactor-mode\" (OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE) <integer>

                                                            Sets or gets the ECDH mode of operation for the associated key exchange ctx.

                                                            In the context of an Elliptic Curve Diffie-Hellman key exchange, this parameter can be used to select between the plain Diffie-Hellman (DH) or Cofactor Diffie-Hellman (CDH) variants of the key exchange algorithm.

                                                            When setting, the value should be 1, 0 or -1, respectively forcing cofactor mode on, off, or resetting it to the default for the private key associated with the given key exchange ctx.

                                                            When getting, the value should be either 1 or 0, respectively signaling if the cofactor mode is on or off.

                                                            See also provider-keymgmt(7) for the related OSSL_PKEY_PARAM_USE_COFACTOR_ECDH parameter that can be set on a per-key basis.

                                                          • \"kdf-type\" (OSSL_EXCHANGE_PARAM_KDF_TYPE)

                                                            See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                          • \"kdf-digest\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST)

                                                            See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                          • \"kdf-digest-props\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS)

                                                            See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                          • \"kdf-outlen\" (OSSL_EXCHANGE_PARAM_KDF_OUTLEN) <unsigned integer>

                                                            See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                          • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string>

                                                            See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                          • "},{"location":"man7/EVP_KEYEXCH-ECDH/#examples","title":"EXAMPLES","text":"

                                                            Keys for the host and peer must be generated as shown in \"Examples\" in EVP_PKEY-EC(7) using the same curve name.

                                                            The code to generate a shared secret for the normal case is identical to \"Examples\" in EVP_KEYEXCH-DH(7).

                                                            To derive a shared secret on the host using the host's key and the peer's public key but also using X963KDF with a user key material:

                                                            /* It is assumed that the host_key, peer_pub_key and ukm are set up */\nvoid derive_secret(EVP_PKEY *host_key, EVP_PKEY *peer_key,\n                   unsigned char *ukm, size_t ukm_len)\n{\n    unsigned char secret[64];\n    size_t out_len = sizeof(secret);\n    size_t secret_len = out_len;\n    unsigned int pad = 1;\n    OSSL_PARAM params[6];\n    EVP_PKEY_CTX *dctx = EVP_PKEY_CTX_new_from_pkey(NULL, host_key, NULL);\n\n    EVP_PKEY_derive_init(dctx);\n\n    params[0] = OSSL_PARAM_construct_uint(OSSL_EXCHANGE_PARAM_PAD, &pad);\n    params[1] = OSSL_PARAM_construct_utf8_string(OSSL_EXCHANGE_PARAM_KDF_TYPE,\n                                                 \"X963KDF\", 0);\n    params[2] = OSSL_PARAM_construct_utf8_string(OSSL_EXCHANGE_PARAM_KDF_DIGEST,\n                                                 \"SHA1\", 0);\n    params[3] = OSSL_PARAM_construct_size_t(OSSL_EXCHANGE_PARAM_KDF_OUTLEN,\n                                            &out_len);\n    params[4] = OSSL_PARAM_construct_octet_string(OSSL_EXCHANGE_PARAM_KDF_UKM,\n                                                  ukm, ukm_len);\n    params[5] = OSSL_PARAM_construct_end();\n    EVP_PKEY_CTX_set_params(dctx, params);\n\n    EVP_PKEY_derive_set_peer(dctx, peer_pub_key);\n    EVP_PKEY_derive(dctx, secret, &secret_len);\n    ...\n    OPENSSL_clear_free(secret, secret_len);\n    EVP_PKEY_CTX_free(dctx);\n}\n
                                                            "},{"location":"man7/EVP_KEYEXCH-ECDH/#see-also","title":"SEE ALSO","text":"

                                                            EVP_PKEY-EC(7) EVP_PKEY(3), provider-keyexch(7), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                            "},{"location":"man7/EVP_KEYEXCH-ECDH/#copyright","title":"COPYRIGHT","text":"

                                                            Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                            "},{"location":"man7/EVP_KEYEXCH-X25519/","title":"EVP_KEYEXCH-X25519","text":""},{"location":"man7/EVP_KEYEXCH-X25519/#name","title":"NAME","text":"

                                                            EVP_KEYEXCH-X25519, EVP_KEYEXCH-X448 - X25519 and X448 Key Exchange algorithm support

                                                            "},{"location":"man7/EVP_KEYEXCH-X25519/#description","title":"DESCRIPTION","text":"

                                                            Key exchange support for the X25519 and X448 key types.

                                                            "},{"location":"man7/EVP_KEYEXCH-X25519/#key-exchange-parameters","title":"Key exchange parameters","text":"
                                                            • \"pad\" (OSSL_EXCHANGE_PARAM_PAD) <unsigned integer>

                                                              See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                            "},{"location":"man7/EVP_KEYEXCH-X25519/#examples","title":"EXAMPLES","text":"

                                                            Keys for the host and peer can be generated as shown in \"Examples\" in EVP_PKEY-X25519(7).

                                                            The code to generate a shared secret is identical to \"Examples\" in EVP_KEYEXCH-DH(7).

                                                            "},{"location":"man7/EVP_KEYEXCH-X25519/#see-also","title":"SEE ALSO","text":"

                                                            EVP_PKEY-FFC(7), EVP_PKEY-DH(7) EVP_PKEY(3), provider-keyexch(7), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                            "},{"location":"man7/EVP_KEYEXCH-X25519/#copyright","title":"COPYRIGHT","text":"

                                                            Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                            "},{"location":"man7/EVP_MAC-BLAKE2/","title":"EVP_MAC-BLAKE2","text":""},{"location":"man7/EVP_MAC-BLAKE2/#name","title":"NAME","text":"

                                                            EVP_MAC-BLAKE2, EVP_MAC-BLAKE2BMAC, EVP_MAC-BLAKE2SMAC - The BLAKE2 EVP_MAC implementations

                                                            "},{"location":"man7/EVP_MAC-BLAKE2/#description","title":"DESCRIPTION","text":"

                                                            Support for computing BLAKE2 MACs through the EVP_MAC API.

                                                            "},{"location":"man7/EVP_MAC-BLAKE2/#identity","title":"Identity","text":"

                                                            These implementations are identified with one of these names and properties, to be used with EVP_MAC_fetch():

                                                            • \"BLAKE2BMAC\", \"provider=default\"
                                                            • \"BLAKE2SMAC\", \"provider=default\"
                                                            "},{"location":"man7/EVP_MAC-BLAKE2/#supported-parameters","title":"Supported parameters","text":"

                                                            The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                            All these parameters (except for \"block-size\") can be set with EVP_MAC_CTX_set_params(). Furthermore, the \"size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of a size_t. Likewise, the \"block-size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_block_size().

                                                            • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                              Sets the MAC key. It may be at most 64 bytes for BLAKE2BMAC or 32 for BLAKE2SMAC and at least 1 byte in both cases. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                            • \"custom\" (OSSL_MAC_PARAM_CUSTOM) <octet string>

                                                              Sets the customization/personalization string. It is an optional value of at most 16 bytes for BLAKE2BMAC or 8 for BLAKE2SMAC, and is empty by default.

                                                            • \"salt\" (OSSL_MAC_PARAM_SALT) <octet string>

                                                              Sets the salt. It is an optional value of at most 16 bytes for BLAKE2BMAC or 8 for BLAKE2SMAC, and is empty by default.

                                                            • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                              Sets the MAC size. It can be any number between 1 and 32 for EVP_MAC_BLAKE2S or between 1 and 64 for EVP_MAC_BLAKE2B. It is 32 and 64 respectively by default.

                                                            • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                              Gets the MAC block size. It is 64 for EVP_MAC_BLAKE2S and 128 for EVP_MAC_BLAKE2B.

                                                            "},{"location":"man7/EVP_MAC-BLAKE2/#see-also","title":"SEE ALSO","text":"

                                                            EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                            "},{"location":"man7/EVP_MAC-BLAKE2/#history","title":"HISTORY","text":"

                                                            The macros and functions described here were added to OpenSSL 3.0.

                                                            "},{"location":"man7/EVP_MAC-BLAKE2/#copyright","title":"COPYRIGHT","text":"

                                                            Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                            "},{"location":"man7/EVP_MAC-CMAC/","title":"EVP_MAC-CMAC","text":""},{"location":"man7/EVP_MAC-CMAC/#name","title":"NAME","text":"

                                                            EVP_MAC-CMAC - The CMAC EVP_MAC implementation

                                                            "},{"location":"man7/EVP_MAC-CMAC/#description","title":"DESCRIPTION","text":"

                                                            Support for computing CMAC MACs through the EVP_MAC API.

                                                            This implementation uses EVP_CIPHER functions to get access to the underlying cipher.

                                                            "},{"location":"man7/EVP_MAC-CMAC/#identity","title":"Identity","text":"

                                                            This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                            • \"CMAC\", \"provider=default\" or \"provider=fips\"
                                                            "},{"location":"man7/EVP_MAC-CMAC/#supported-parameters","title":"Supported parameters","text":"

                                                            The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                            The following parameter can be set with EVP_MAC_CTX_set_params():

                                                            • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                              Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                            • \"cipher\" (OSSL_MAC_PARAM_CIPHER)

                                                              Sets the name of the underlying cipher to be used. The mode of the cipher must be CBC.

                                                            • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

                                                              Sets the properties to be queried when trying to fetch the underlying cipher. This must be given together with the cipher naming parameter to be considered valid.

                                                              The following parameters can be retrieved with EVP_MAC_CTX_get_params():

                                                              • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                The \"size\" parameter can also be retrieved with with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter is equal to that of an unsigned int.

                                                              • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                Gets the MAC block size. The \"block-size\" parameter can also be retrieved with EVP_MAC_CTX_get_block_size().

                                                              "},{"location":"man7/EVP_MAC-CMAC/#see-also","title":"SEE ALSO","text":"

                                                              EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                              "},{"location":"man7/EVP_MAC-CMAC/#copyright","title":"COPYRIGHT","text":"

                                                              Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                              "},{"location":"man7/EVP_MAC-GMAC/","title":"EVP_MAC-GMAC","text":""},{"location":"man7/EVP_MAC-GMAC/#name","title":"NAME","text":"

                                                              EVP_MAC-GMAC - The GMAC EVP_MAC implementation

                                                              "},{"location":"man7/EVP_MAC-GMAC/#description","title":"DESCRIPTION","text":"

                                                              Support for computing GMAC MACs through the EVP_MAC API.

                                                              This implementation uses EVP_CIPHER functions to get access to the underlying cipher.

                                                              "},{"location":"man7/EVP_MAC-GMAC/#identity","title":"Identity","text":"

                                                              This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                              • \"GMAC\", \"provider=default\" or \"provider=fips\"
                                                              "},{"location":"man7/EVP_MAC-GMAC/#supported-parameters","title":"Supported parameters","text":"

                                                              The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                              The following parameter can be set with EVP_MAC_CTX_set_params():

                                                              • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                              • \"iv\" (OSSL_MAC_PARAM_IV) <octet string>

                                                                Sets the IV of the underlying cipher, when applicable.

                                                              • \"cipher\" (OSSL_MAC_PARAM_CIPHER)

                                                                Sets the name of the underlying cipher to be used.

                                                              • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

                                                                Sets the properties to be queried when trying to fetch the underlying cipher. This must be given together with the cipher naming parameter to be considered valid.

                                                                The following parameters can be retrieved with EVP_MAC_CTX_get_params():

                                                                • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                  Gets the MAC size.

                                                                The \"size\" parameter can also be retrieved with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter is equal to that of an unsigned int.

                                                                "},{"location":"man7/EVP_MAC-GMAC/#see-also","title":"SEE ALSO","text":"

                                                                EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                "},{"location":"man7/EVP_MAC-GMAC/#copyright","title":"COPYRIGHT","text":"

                                                                Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                "},{"location":"man7/EVP_MAC-HMAC/","title":"EVP_MAC-HMAC","text":""},{"location":"man7/EVP_MAC-HMAC/#name","title":"NAME","text":"

                                                                EVP_MAC-HMAC - The HMAC EVP_MAC implementation

                                                                "},{"location":"man7/EVP_MAC-HMAC/#description","title":"DESCRIPTION","text":"

                                                                Support for computing HMAC MACs through the EVP_MAC API.

                                                                This implementation uses EVP_MD functions to get access to the underlying digest.

                                                                "},{"location":"man7/EVP_MAC-HMAC/#identity","title":"Identity","text":"

                                                                This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                • \"HMAC\", \"provider=default\" or \"provider=fips\"
                                                                "},{"location":"man7/EVP_MAC-HMAC/#supported-parameters","title":"Supported parameters","text":"

                                                                The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                The following parameter can be set with EVP_MAC_CTX_set_params():

                                                                • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                  Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                • \"digest\" (OSSL_MAC_PARAM_DIGEST)

                                                                  Sets the name of the underlying digest to be used.

                                                                • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

                                                                  Sets the properties to be queried when trying to fetch the underlying digest. This must be given together with the digest naming parameter (\"digest\", or OSSL_MAC_PARAM_DIGEST) to be considered valid.

                                                                • \"digest-noinit\" (OSSL_MAC_PARAM_DIGEST_NOINIT) <integer>

                                                                  A flag to set the MAC digest to not initialise the implementation specific data. The value 0 or 1 is expected.

                                                                • \"digest-oneshot\" (OSSL_MAC_PARAM_DIGEST_ONESHOT) <integer>

                                                                  A flag to set the MAC digest to be a one-shot operation. The value 0 or 1 is expected.

                                                                • \"tls-data-size\" (OSSL_MAC_PARAM_TLS_DATA_SIZE) <unsigned integer>

                                                                • The following parameter can be retrieved with EVP_MAC_CTX_get_params():

                                                                  • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                    The \"size\" parameter can also be retrieved with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter is equal to that of an unsigned int.

                                                                  • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                    Gets the MAC block size. The \"block-size\" parameter can also be retrieved with EVP_MAC_CTX_get_block_size().

                                                                  "},{"location":"man7/EVP_MAC-HMAC/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3), HMAC(3)

                                                                  "},{"location":"man7/EVP_MAC-HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MAC-KMAC/","title":"EVP_MAC-KMAC","text":""},{"location":"man7/EVP_MAC-KMAC/#name","title":"NAME","text":"

                                                                  EVP_MAC-KMAC, EVP_MAC-KMAC128, EVP_MAC-KMAC256 - The KMAC EVP_MAC implementations

                                                                  "},{"location":"man7/EVP_MAC-KMAC/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing KMAC MACs through the EVP_MAC API.

                                                                  "},{"location":"man7/EVP_MAC-KMAC/#identity","title":"Identity","text":"

                                                                  These implementations are identified with one of these names and properties, to be used with EVP_MAC_fetch():

                                                                  • \"KMAC-128\", \"provider=default\" or \"provider=fips\"
                                                                  • \"KMAC-256\", \"provider=default\" or \"provider=fips\"
                                                                  "},{"location":"man7/EVP_MAC-KMAC/#supported-parameters","title":"Supported parameters","text":"

                                                                  The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                  All these parameters (except for \"block-size\") can be set with EVP_MAC_CTX_set_params(). Furthermore, the \"size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of a size_t. Likewise, the \"block-size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_block_size().

                                                                  • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                    Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3). The length of the key (in bytes) must be in the range 4...512.

                                                                  • \"custom\" (OSSL_MAC_PARAM_CUSTOM) <octet string>

                                                                    Sets the customization string. It is an optional value with a length of at most 512 bytes, and is empty by default.

                                                                  • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                    Sets the MAC size. By default, it is 32 for KMAC-128 and 64 for KMAC-256.

                                                                  • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                    Gets the MAC block size. It is 168 for KMAC-128 and 136 for KMAC-256.

                                                                  • \"xof\" (OSSL_MAC_PARAM_XOF) <integer>

                                                                    The \"xof\" parameter value is expected to be 1 or 0. Use 1 to enable XOF mode. The default value is 0.

                                                                  The \"custom\" parameter must be set as part of or before the EVP_MAC_init() call. The \"xof\" and \"size\" parameters can be set at any time before EVP_MAC_final(). The \"key\" parameter is set as part of the EVP_MAC_init() call, but can be set before it instead.

                                                                  "},{"location":"man7/EVP_MAC-KMAC/#examples","title":"EXAMPLES","text":"
                                                                  #include <openssl/evp.h>\n#include <openssl/params.h>\n\nstatic int do_kmac(const unsigned char *in, size_t in_len,\n                   const unsigned char *key, size_t key_len,\n                   const unsigned char *custom, size_t custom_len,\n                   int xof_enabled, unsigned char *out, int out_len)\n{\n    EVP_MAC_CTX *ctx = NULL;\n    EVP_MAC *mac = NULL;\n    OSSL_PARAM params[4], *p;\n    int ret = 0;\n    size_t l = 0;\n\n    mac = EVP_MAC_fetch(NULL, \"KMAC-128\", NULL);\n    if (mac == NULL)\n        goto err;\n    ctx = EVP_MAC_CTX_new(mac);\n    /* The mac can be freed after it is used by EVP_MAC_CTX_new */\n    EVP_MAC_free(mac);\n    if (ctx == NULL)\n        goto err;\n\n    /*\n     * Setup parameters required before calling EVP_MAC_init()\n     * The parameters OSSL_MAC_PARAM_XOF and OSSL_MAC_PARAM_SIZE may also be\n     * used at this point.\n     */\n    p = params;\n    *p++ = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,\n                                             (void *)key, key_len);\n    if (custom != NULL && custom_len != 0)\n      *p++ = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_CUSTOM,\n                                               (void *)custom, custom_len);\n    *p = OSSL_PARAM_construct_end();\n    if (!EVP_MAC_CTX_set_params(ctx, params))\n        goto err;\n\n    if (!EVP_MAC_init(ctx))\n        goto err;\n\n    /*\n     * Note: the following optional parameters can be set any time\n     * before EVP_MAC_final().\n     */\n    p = params;\n    *p++ = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_XOF, &xof_enabled);\n    *p++ = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_SIZE, &out_len);\n    *p = OSSL_PARAM_construct_end();\n    if (!EVP_MAC_CTX_set_params(ctx, params))\n        goto err;\n\n    /* The update may be called multiple times here for streamed input */\n    if (!EVP_MAC_update(ctx, in, in_len))\n        goto err;\n    if (!EVP_MAC_final(ctx, out, &l, out_len))\n        goto err;\n    ret = 1;\nerr:\n    EVP_MAC_CTX_free(ctx);\n    return ret;\n}\n
                                                                  "},{"location":"man7/EVP_MAC-KMAC/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                  "},{"location":"man7/EVP_MAC-KMAC/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MAC-Poly1305/","title":"EVP_MAC-Poly1305","text":""},{"location":"man7/EVP_MAC-Poly1305/#name","title":"NAME","text":"

                                                                  EVP_MAC-Poly1305 - The Poly1305 EVP_MAC implementation

                                                                  "},{"location":"man7/EVP_MAC-Poly1305/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing Poly1305 MACs through the EVP_MAC API.

                                                                  "},{"location":"man7/EVP_MAC-Poly1305/#identity","title":"Identity","text":"

                                                                  This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                  • \"POLY1305\", \"provider=default\"
                                                                  "},{"location":"man7/EVP_MAC-Poly1305/#supported-parameters","title":"Supported parameters","text":"

                                                                  The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                  The following parameter can be set with EVP_MAC_CTX_set_params():

                                                                  • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                    Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                  The following parameters can be retrieved with EVP_MAC_CTX_get_params():

                                                                  • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                    Gets the MAC size.

                                                                  The \"size\" parameter can also be retrieved with with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of an unsigned int.

                                                                  "},{"location":"man7/EVP_MAC-Poly1305/#notes","title":"NOTES","text":"

                                                                  The OpenSSL implementation of the Poly 1305 MAC corresponds to RFC 7539.

                                                                  It is critical to never reuse the key. The security implication noted in RFC 8439 applies equally to the OpenSSL implementation.

                                                                  "},{"location":"man7/EVP_MAC-Poly1305/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                  "},{"location":"man7/EVP_MAC-Poly1305/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MAC-Siphash/","title":"EVP_MAC-Siphash","text":""},{"location":"man7/EVP_MAC-Siphash/#name","title":"NAME","text":"

                                                                  EVP_MAC-Siphash - The Siphash EVP_MAC implementation

                                                                  "},{"location":"man7/EVP_MAC-Siphash/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing Siphash MACs through the EVP_MAC API.

                                                                  "},{"location":"man7/EVP_MAC-Siphash/#identity","title":"Identity","text":"

                                                                  This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                  • \"SIPHASH\", \"provider=default\"
                                                                  "},{"location":"man7/EVP_MAC-Siphash/#supported-parameters","title":"Supported parameters","text":"

                                                                  The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                  All these parameters can be set with EVP_MAC_CTX_set_params(). Furthermore, the \"size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of a size_t.

                                                                  • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                    Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                  • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                    Sets the MAC size.

                                                                  • \"c-rounds\" (OSSL_MAC_PARAM_C_ROUNDS) <unsigned integer>

                                                                    Specifies the number of rounds per message block. By default this is 2.

                                                                  • \"d-rounds\" (OSSL_MAC_PARAM_D_ROUNDS) <unsigned integer>

                                                                    Specifies the number of finalisation rounds. By default this is 4.

                                                                  "},{"location":"man7/EVP_MAC-Siphash/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                  "},{"location":"man7/EVP_MAC-Siphash/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-BLAKE2/","title":"EVP_MD-BLAKE2","text":""},{"location":"man7/EVP_MD-BLAKE2/#name","title":"NAME","text":"

                                                                  EVP_MD-BLAKE2 - The BLAKE2 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-BLAKE2/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing BLAKE2 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-BLAKE2/#identities","title":"Identities","text":"

                                                                  This implementation is only available with the default provider, and includes the following varieties:

                                                                  • BLAKE2S-256

                                                                    Known names are \"BLAKE2S-256\" and \"BLAKE2s256\".

                                                                  • BLAKE2B-512

                                                                    Known names are \"BLAKE2B-512\" and \"BLAKE2b512\".

                                                                  "},{"location":"man7/EVP_MD-BLAKE2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-BLAKE2/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-BLAKE2/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-MD2/","title":"EVP_MD-MD2","text":""},{"location":"man7/EVP_MD-MD2/#name","title":"NAME","text":"

                                                                  EVP_MD-MD2 - The MD2 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-MD2/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing MD2 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-MD2/#identity","title":"Identity","text":"

                                                                  This implementation is only available with the legacy provider, and is identified with the name \"MD2\".

                                                                  "},{"location":"man7/EVP_MD-MD2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-MD2/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-MD2/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-MD4/","title":"EVP_MD-MD4","text":""},{"location":"man7/EVP_MD-MD4/#name","title":"NAME","text":"

                                                                  EVP_MD-MD4 - The MD4 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-MD4/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing MD4 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-MD4/#identity","title":"Identity","text":"

                                                                  This implementation is only available with the legacy provider, and is identified with the name \"MD4\".

                                                                  "},{"location":"man7/EVP_MD-MD4/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-MD4/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-MD4/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-MD5-SHA1/","title":"EVP_MD-MD5-SHA1","text":""},{"location":"man7/EVP_MD-MD5-SHA1/#name","title":"NAME","text":"

                                                                  EVP_MD-MD5-SHA1 - The MD5-SHA1 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-MD5-SHA1/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing MD5-SHA1 digests through the EVP_MD API.

                                                                  MD5-SHA1 is a rather special digest that's used with SSLv3.

                                                                  "},{"location":"man7/EVP_MD-MD5-SHA1/#identity","title":"Identity","text":"

                                                                  This implementation is only available with the default provider, and is identified with the name \"MD5-SHA1\".

                                                                  "},{"location":"man7/EVP_MD-MD5-SHA1/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-MD5-SHA1/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                  This implementation supports the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                  • \"ssl3-ms\" (OSSL_DIGEST_PARAM_SSL3_MS) <octet string>

                                                                    This parameter is set by libssl in order to calculate a signature hash for an SSLv3 CertificateVerify message as per RFC6101. It is only set after all handshake messages have already been digested via OP_digest_update() calls. The parameter provides the master secret value to be added to the digest. The digest implementation should calculate the complete digest as per RFC6101 section 5.6.8. The next call after setting this parameter should be OP_digest_final().

                                                                  "},{"location":"man7/EVP_MD-MD5-SHA1/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-MD5-SHA1/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-MD5/","title":"EVP_MD-MD5","text":""},{"location":"man7/EVP_MD-MD5/#name","title":"NAME","text":"

                                                                  EVP_MD-MD5 - The MD5 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-MD5/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing MD5 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-MD5/#identity","title":"Identity","text":"

                                                                  This implementation is only available with the default provider, and is identified with the name \"MD5\".

                                                                  "},{"location":"man7/EVP_MD-MD5/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-MD5/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-MD5/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-MDC2/","title":"EVP_MD-MDC2","text":""},{"location":"man7/EVP_MD-MDC2/#name","title":"NAME","text":"

                                                                  EVP_MD-MDC2 - The MDC2 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-MDC2/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing MDC2 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-MDC2/#identity","title":"Identity","text":"

                                                                  This implementation is only available with the legacy provider, and is identified with the name \"MDC2\".

                                                                  "},{"location":"man7/EVP_MD-MDC2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-MDC2/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                  This implementation supports the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                  • \"pad-type\" (OSSL_DIGEST_PARAM_PAD_TYPE) <unsigned integer>

                                                                    Sets the padding type to be used. Normally the final MDC2 block is padded with zeros. If the pad type is set to 2 then the final block is padded with 0x80 followed by zeros.

                                                                  "},{"location":"man7/EVP_MD-MDC2/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-legacy(7)

                                                                  "},{"location":"man7/EVP_MD-MDC2/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-NULL/","title":"EVP_MD-NULL","text":""},{"location":"man7/EVP_MD-NULL/#name","title":"NAME","text":"

                                                                  EVP_MD-NULL - The NULL EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-NULL/#description","title":"DESCRIPTION","text":"

                                                                  Support for a NULL digest through the EVP_MD API. This algorithm does nothing and returns 1 for its init, update and final methods.

                                                                  "},{"location":"man7/EVP_MD-NULL/#algorithm-name","title":"Algorithm Name","text":"

                                                                  The following algorithm is available in the default provider:

                                                                  • \"NULL\"
                                                                  "},{"location":"man7/EVP_MD-NULL/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-NULL/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-NULL/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-RIPEMD160/","title":"EVP_MD-RIPEMD160","text":""},{"location":"man7/EVP_MD-RIPEMD160/#name","title":"NAME","text":"

                                                                  EVP_MD-RIPEMD160 - The RIPEMD160 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-RIPEMD160/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing RIPEMD160 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-RIPEMD160/#identities","title":"Identities","text":"

                                                                  This implementation is available in both the default and legacy providers, and is identified with any of the names \"RIPEMD-160\", \"RIPEMD160\", \"RIPEMD\" and \"RMD160\".

                                                                  "},{"location":"man7/EVP_MD-RIPEMD160/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-RIPEMD160/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-RIPEMD160/#history","title":"HISTORY","text":"

                                                                  This digest was added to the default provider in OpenSSL 3.0.7.

                                                                  "},{"location":"man7/EVP_MD-RIPEMD160/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-SHA1/","title":"EVP_MD-SHA1","text":""},{"location":"man7/EVP_MD-SHA1/#name","title":"NAME","text":"

                                                                  EVP_MD-SHA1 - The SHA1 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-SHA1/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing SHA1 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-SHA1/#identities","title":"Identities","text":"

                                                                  This implementation is available with the FIPS provider as well as the default provider, and is identified with the names \"SHA1\" and \"SHA-1\".

                                                                  "},{"location":"man7/EVP_MD-SHA1/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-SHA1/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                  This implementation supports the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                  • \"ssl3-ms\" (OSSL_DIGEST_PARAM_SSL3_MS) <octet string>

                                                                    This parameter is set by libssl in order to calculate a signature hash for an SSLv3 CertificateVerify message as per RFC6101. It is only set after all handshake messages have already been digested via OP_digest_update() calls. The parameter provides the master secret value to be added to the digest. The digest implementation should calculate the complete digest as per RFC6101 section 5.6.8. The next call after setting this parameter should be OP_digest_final().

                                                                  "},{"location":"man7/EVP_MD-SHA1/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-SHA1/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-SHA2/","title":"EVP_MD-SHA2","text":""},{"location":"man7/EVP_MD-SHA2/#name","title":"NAME","text":"

                                                                  EVP_MD-SHA2 - The SHA2 EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-SHA2/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing SHA2 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-SHA2/#identities","title":"Identities","text":"

                                                                  This implementation includes the following varieties:

                                                                  • Available with the FIPS provider as well as the default provider:

                                                                    • SHA2-224

                                                                      Known names are \"SHA2-224\", \"SHA-224\" and \"SHA224\".

                                                                    • SHA2-256

                                                                      Known names are \"SHA2-256\", \"SHA-256\" and \"SHA256\".

                                                                    • SHA2-384

                                                                      Known names are \"SHA2-384\", \"SHA-384\" and \"SHA384\".

                                                                    • SHA2-512

                                                                      Known names are \"SHA2-512\", \"SHA-512\" and \"SHA512\". - Available with the default provider: - SHA2-512/224

                                                                      Known names are \"SHA2-512/224\", \"SHA-512/224\" and \"SHA512-224\".

                                                                    • SHA2-512/256

                                                                      Known names are \"SHA2-512/256\", \"SHA-512/256\" and \"SHA512-256\".

                                                                  "},{"location":"man7/EVP_MD-SHA2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-SHA2/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-SHA2/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-SHA3/","title":"EVP_MD-SHA3","text":""},{"location":"man7/EVP_MD-SHA3/#name","title":"NAME","text":"

                                                                  EVP_MD-SHA3 - The SHA3 EVP_MD implementations

                                                                  "},{"location":"man7/EVP_MD-SHA3/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing SHA3 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-SHA3/#identities","title":"Identities","text":"

                                                                  This implementation is available with the FIPS provider as well as the default provider, and includes the following varieties:

                                                                  • \"SHA3-224\"
                                                                  • \"SHA3-256\"
                                                                  • \"SHA3-384\"
                                                                  • \"SHA3-512\"
                                                                  "},{"location":"man7/EVP_MD-SHA3/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-SHA3/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-SHA3/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-SHAKE/","title":"EVP_MD-SHAKE","text":""},{"location":"man7/EVP_MD-SHAKE/#name","title":"NAME","text":"

                                                                  EVP_MD-SHAKE, EVP_MD-KECCAK-KMAC - The SHAKE / KECCAK family EVP_MD implementations

                                                                  "},{"location":"man7/EVP_MD-SHAKE/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing SHAKE or KECCAK-KMAC digests through the EVP_MD API.

                                                                  KECCAK-KMAC is an Extendable Output Function (XOF), with a definition similar to SHAKE, used by the KMAC EVP_MAC implementation (see EVP_MAC-KMAC(7)).

                                                                  "},{"location":"man7/EVP_MD-SHAKE/#identities","title":"Identities","text":"

                                                                  This implementation is available in the FIPS provider as well as the default provider, and includes the following varieties:

                                                                  • KECCAK-KMAC-128

                                                                    Known names are \"KECCAK-KMAC-128\" and \"KECCAK-KMAC128\". This is used by EVP_MAC-KMAC128(7). Using the notation from NIST FIPS 202 (Section 6.2), we have KECCAK-KMAC-128(M,\u00a0d) = KECCAK[256](M\u00a0||\u00a000,\u00a0d) (see the description of KMAC128 in Appendix A of NIST SP 800-185).

                                                                  • KECCAK-KMAC-256

                                                                    Known names are \"KECCAK-KMAC-256\" and \"KECCAK-KMAC256\". This is used by EVP_MAC-KMAC256(7). Using the notation from NIST FIPS 202 (Section 6.2), we have KECCAK-KMAC-256(M,\u00a0d) = KECCAK[512](M\u00a0||\u00a000,\u00a0d) (see the description of KMAC256 in Appendix A of NIST SP 800-185).

                                                                  • SHAKE-128

                                                                    Known names are \"SHAKE-128\" and \"SHAKE128\".

                                                                  • SHAKE-256

                                                                    Known names are \"SHAKE-256\" and \"SHAKE256\".

                                                                  "},{"location":"man7/EVP_MD-SHAKE/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-SHAKE/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                  These implementations support the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                  • \"xoflen\" (OSSL_DIGEST_PARAM_XOFLEN) <unsigned integer>

                                                                    Sets the digest length for extendable output functions. The length of the \"xoflen\" parameter should not exceed that of a size_t.

                                                                    For backwards compatibility reasons the default xoflen length for SHAKE-128 is 16 (bytes) which results in a security strength of only 64 bits. To ensure the maximum security strength of 128 bits, the xoflen should be set to at least 32.

                                                                    For backwards compatibility reasons the default xoflen length for SHAKE-256 is 32 (bytes) which results in a security strength of only 128 bits. To ensure the maximum security strength of 256 bits, the xoflen should be set to at least 64.

                                                                  "},{"location":"man7/EVP_MD-SHAKE/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-SHAKE/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-SM3/","title":"EVP_MD-SM3","text":""},{"location":"man7/EVP_MD-SM3/#name","title":"NAME","text":"

                                                                  EVP_MD-SM3 - The SM3 EVP_MD implementations

                                                                  "},{"location":"man7/EVP_MD-SM3/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing SM3 digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-SM3/#identity","title":"Identity","text":"

                                                                  This implementation is only available with the default provider, and is identified with the name \"SM3\".

                                                                  "},{"location":"man7/EVP_MD-SM3/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-SM3/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-SM3/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-WHIRLPOOL/","title":"EVP_MD-WHIRLPOOL","text":""},{"location":"man7/EVP_MD-WHIRLPOOL/#name","title":"NAME","text":"

                                                                  EVP_MD-WHIRLPOOL - The WHIRLPOOL EVP_MD implementation

                                                                  "},{"location":"man7/EVP_MD-WHIRLPOOL/#description","title":"DESCRIPTION","text":"

                                                                  Support for computing WHIRLPOOL digests through the EVP_MD API.

                                                                  "},{"location":"man7/EVP_MD-WHIRLPOOL/#identity","title":"Identity","text":"

                                                                  This implementation is only available with the legacy provider, and is identified with the name \"WHIRLPOOL\".

                                                                  "},{"location":"man7/EVP_MD-WHIRLPOOL/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                  This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                  "},{"location":"man7/EVP_MD-WHIRLPOOL/#see-also","title":"SEE ALSO","text":"

                                                                  provider-digest(7), OSSL_PROVIDER-default(7)

                                                                  "},{"location":"man7/EVP_MD-WHIRLPOOL/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_MD-common/","title":"EVP_MD-common","text":""},{"location":"man7/EVP_MD-common/#name","title":"NAME","text":"

                                                                  EVP_MD-common - The OpenSSL EVP_MD implementations, common things

                                                                  "},{"location":"man7/EVP_MD-common/#description","title":"DESCRIPTION","text":"

                                                                  All the OpenSSL EVP_MD implementations understand the following OSSL_PARAM(3) entries that are gettable with EVP_MD_get_params(3), as well as these:

                                                                  • \"blocksize\" (OSSL_DIGEST_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                    The digest block size. The length of the \"blocksize\" parameter should not exceed that of a size_t.

                                                                    This value can also be retrieved with EVP_MD_get_block_size(3).

                                                                  • \"size\" (OSSL_DIGEST_PARAM_SIZE) <unsigned integer>

                                                                    The digest output size. The length of the \"size\" parameter should not exceed that of a size_t.

                                                                    This value can also be retrieved with EVP_MD_get_size(3).

                                                                  • \"flags\" (OSSL_DIGEST_PARAM_FLAGS) <unsigned integer>

                                                                    Diverse flags that describe exceptional behaviour for the digest. These flags are described in \"DESCRIPTION\" in EVP_MD_meth_set_flags(3).

                                                                    The length of the \"flags\" parameter should equal that of an unsigned long int.

                                                                    This value can also be retrieved with EVP_MD_get_flags(3).

                                                                  "},{"location":"man7/EVP_MD-common/#see-also","title":"SEE ALSO","text":"

                                                                  EVP_MD_get_params(3), provider-digest(7)

                                                                  "},{"location":"man7/EVP_MD-common/#copyright","title":"COPYRIGHT","text":"

                                                                  Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                  "},{"location":"man7/EVP_PKEY-DH/","title":"EVP_PKEY-DH","text":""},{"location":"man7/EVP_PKEY-DH/#name","title":"NAME","text":"

                                                                  EVP_PKEY-DH, EVP_PKEY-DHX, EVP_KEYMGMT-DH, EVP_KEYMGMT-DHX - EVP_PKEY DH and DHX keytype and algorithm support

                                                                  "},{"location":"man7/EVP_PKEY-DH/#description","title":"DESCRIPTION","text":"

                                                                  For DH FFC key agreement, two classes of domain parameters can be used: \"safe\" domain parameters that are associated with approved named safe-prime groups, and a class of \"FIPS186-type\" domain parameters. FIPS186-type domain parameters should only be used for backward compatibility with existing applications that cannot be upgraded to use the approved safe-prime groups.

                                                                  See EVP_PKEY-FFC(7) for more information about FFC keys.

                                                                  The DH key type uses PKCS#3 format which saves p and g, but not the q value. The DHX key type uses X9.42 format which saves the value of q and this must be used for FIPS186-4. If key validation is required, users should be aware of the nuances associated with FIPS186-4 style parameters as discussed in \"DH key validation\".

                                                                  "},{"location":"man7/EVP_PKEY-DH/#dh-and-dhx-domain-parameters","title":"DH and DHX domain parameters","text":"

                                                                  In addition to the common FCC parameters that all FFC keytypes should support (see \"FFC parameters\" in EVP_PKEY-FFC(7)) the DHX and DH keytype implementations support the following:

                                                                  • \"group\" (OSSL_PKEY_PARAM_GROUP_NAME)

                                                                    Sets or gets a string that associates a DH or DHX named safe prime group with known values for p, q and g.

                                                                    The following values can be used by the OpenSSL's default and FIPS providers: \"ffdhe2048\", \"ffdhe3072\", \"ffdhe4096\", \"ffdhe6144\", \"ffdhe8192\", \"modp_2048\", \"modp_3072\", \"modp_4096\", \"modp_6144\", \"modp_8192\".

                                                                    The following additional values can also be used by OpenSSL's default provider: \"modp_1536\", \"dh_1024_160\", \"dh_2048_224\", \"dh_2048_256\".

                                                                    DH/DHX named groups can be easily validated since the parameters are well known. For protocols that only transfer p and g the value of q can also be retrieved.

                                                                    "},{"location":"man7/EVP_PKEY-DH/#dh-and-dhx-additional-parameters","title":"DH and DHX additional parameters","text":"
                                                                    • \"encoded-pub-key\" (OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY) <octet string>

                                                                      Used for getting and setting the encoding of the DH public key used in a key exchange message for the TLS protocol. See EVP_PKEY_set1_encoded_public_key() and EVP_PKEY_get1_encoded_public_key().

                                                                    "},{"location":"man7/EVP_PKEY-DH/#dh-additional-domain-parameters","title":"DH additional domain parameters","text":"
                                                                    • \"safeprime-generator\" (OSSL_PKEY_PARAM_DH_GENERATOR) <integer>

                                                                      Used for DH generation of safe primes using the old safe prime generator code. The default value is 2. It is recommended to use a named safe prime group instead, if domain parameter validation is required.

                                                                      Randomly generated safe primes are not allowed by FIPS, so setting this value for the OpenSSL FIPS provider will instead choose a named safe prime group based on the size of p.

                                                                    "},{"location":"man7/EVP_PKEY-DH/#dh-and-dhx-domain-parameter-key-generation-parameters","title":"DH and DHX domain parameter / key generation parameters","text":"

                                                                    In addition to the common FFC key generation parameters that all FFC key types should support (see \"FFC key generation parameters\" in EVP_PKEY-FFC(7)) the DH and DHX keytype implementation supports the following:

                                                                    • \"type\" (OSSL_PKEY_PARAM_FFC_TYPE)

                                                                      Sets the type of parameter generation. For DH valid values are:

                                                                      • \"fips186_4\"
                                                                      • \"default\"
                                                                      • \"fips186_2\"

                                                                        These are described in \"FFC key generation parameters\" in EVP_PKEY-FFC(7)

                                                                      • \"group\"

                                                                        This specifies that a named safe prime name will be chosen using the \"pbits\" type.

                                                                      • \"generator\"

                                                                        A safe prime generator. See the \"safeprime-generator\" type above. This is only valid for DH keys.

                                                                    • \"pbits\" (OSSL_PKEY_PARAM_FFC_PBITS) <unsigned integer>

                                                                      Sets the size (in bits) of the prime 'p'.

                                                                      For \"fips186_4\" this must be 2048. For \"fips186_2\" this must be 1024. For \"group\" this can be any one of 2048, 3072, 4096, 6144 or 8192.

                                                                    • \"priv_len\" (OSSL_PKEY_PARAM_DH_PRIV_LEN) <integer>

                                                                      An optional value to set the maximum length of the generated private key. The default value used if this is not set is the maximum value of BN_num_bits(q)). The minimum value that this can be set to is 2 * s. Where s is the security strength of the key which has values of 112, 128, 152, 176 and 200 for key sizes of 2048, 3072, 4096, 6144 and 8192.

                                                                    • "},{"location":"man7/EVP_PKEY-DH/#dh-key-validation","title":"DH key validation","text":"

                                                                      For DHX that is not a named group the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for seed, pcounter and gindex or hindex may need to be stored for validation purposes. For DHX the seed and pcounter can be stored in ASN1 data (but the gindex or hindex cannot be stored). It is recommended to use a named safe prime group instead.

                                                                      For DH keys, EVP_PKEY_param_check(3) behaves in the following way: The OpenSSL FIPS provider tests if the parameters are either an approved safe prime group OR that the FFC parameters conform to FIPS186-4 as defined in SP800-56Ar3 Assurances of Domain-Parameter Validity. The OpenSSL default provider uses simpler checks that allows there to be no q value for backwards compatibility.

                                                                      For DH keys, EVP_PKEY_param_check_quick(3) is equivalent to EVP_PKEY_param_check(3).

                                                                      For DH keys, EVP_PKEY_public_check(3) conforms to SP800-56Ar3 FFC Full Public-Key Validation.

                                                                      For DH keys, EVP_PKEY_public_check_quick(3) conforms to SP800-56Ar3 FFC Partial Public-Key Validation when the DH key is an approved named safe prime group, otherwise it is the same as EVP_PKEY_public_check(3).

                                                                      For DH Keys, EVP_PKEY_private_check(3) tests that the private key is in the correct range according to SP800-56Ar3. The OpenSSL FIPS provider requires the value of q to be set (note that this is set for named safe prime groups). For backwards compatibility the OpenSSL default provider only requires p to be set.

                                                                      For DH keys, EVP_PKEY_pairwise_check(3) conforms to SP800-56Ar3 Owner Assurance of Pair-wise Consistency.

                                                                      "},{"location":"man7/EVP_PKEY-DH/#examples","title":"EXAMPLES","text":"

                                                                      An EVP_PKEY context can be obtained by calling:

                                                                      EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"DH\", NULL);\n

                                                                      A DH key can be generated with a named safe prime group by calling:

                                                                      int priv_len = 2 * 112;\nOSSL_PARAM params[3];\nEVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"DH\", NULL);\n\nparams[0] = OSSL_PARAM_construct_utf8_string(\"group\", \"ffdhe2048\", 0);\n/* \"priv_len\" is optional */\nparams[1] = OSSL_PARAM_construct_int(\"priv_len\", &priv_len);\nparams[2] = OSSL_PARAM_construct_end();\n\nEVP_PKEY_keygen_init(pctx);\nEVP_PKEY_CTX_set_params(pctx, params);\nEVP_PKEY_generate(pctx, &pkey);\n...\nEVP_PKEY_free(pkey);\nEVP_PKEY_CTX_free(pctx);\n

                                                                      DHX domain parameters can be generated according to FIPS186-4 by calling:

                                                                      int gindex = 2;\nunsigned int pbits = 2048;\nunsigned int qbits = 256;\nOSSL_PARAM params[6];\nEVP_PKEY *param_key = NULL;\nEVP_PKEY_CTX *pctx = NULL;\n\npctx = EVP_PKEY_CTX_new_from_name(NULL, \"DHX\", NULL);\nEVP_PKEY_paramgen_init(pctx);\n\nparams[0] = OSSL_PARAM_construct_uint(\"pbits\", &pbits);\nparams[1] = OSSL_PARAM_construct_uint(\"qbits\", &qbits);\nparams[2] = OSSL_PARAM_construct_int(\"gindex\", &gindex);\nparams[3] = OSSL_PARAM_construct_utf8_string(\"type\", \"fips186_4\", 0);\nparams[4] = OSSL_PARAM_construct_utf8_string(\"digest\", \"SHA256\", 0);\nparams[5] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(pctx, params);\n\nEVP_PKEY_generate(pctx, &param_key);\n\nEVP_PKEY_print_params(bio_out, param_key, 0, NULL);\n...\nEVP_PKEY_free(param_key);\nEVP_PKEY_CTX_free(pctx);\n

                                                                      A DH key can be generated using domain parameters by calling:

                                                                      EVP_PKEY *key = NULL;\nEVP_PKEY_CTX *gctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);\n\nEVP_PKEY_keygen_init(gctx);\nEVP_PKEY_generate(gctx, &key);\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n...\nEVP_PKEY_free(key);\nEVP_PKEY_CTX_free(gctx);\n

                                                                      To validate FIPS186-4 DHX domain parameters decoded from PEM or DER data, additional values used during generation may be required to be set into the key.

                                                                      EVP_PKEY_todata(), OSSL_PARAM_merge(), and EVP_PKEY_fromdata() are useful to add these parameters to the original key or domain parameters before the actual validation. In production code the return values should be checked.

                                                                      EVP_PKEY *received_domp = ...; /* parameters received and decoded */\nunsigned char *seed = ...;     /* and additional parameters received */\nsize_t seedlen = ...;          /* by other means, required */\nint gindex = ...;              /* for the validation */\nint pcounter = ...;\nint hindex = ...;\nOSSL_PARAM extra_params[4];\nOSSL_PARAM *domain_params = NULL;\nOSSL_PARAM *merged_params = NULL;\nEVP_PKEY_CTX *ctx = NULL, *validate_ctx = NULL;\nEVP_PKEY *complete_domp = NULL;\n\nEVP_PKEY_todata(received_domp, OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                &domain_params);\nextra_params[0] = OSSL_PARAM_construct_octet_string(\"seed\", seed, seedlen);\n/*\n * NOTE: For unverifiable g use \"hindex\" instead of \"gindex\"\n * extra_params[1] = OSSL_PARAM_construct_int(\"hindex\", &hindex);\n */\nextra_params[1] = OSSL_PARAM_construct_int(\"gindex\", &gindex);\nextra_params[2] = OSSL_PARAM_construct_int(\"pcounter\", &pcounter);\nextra_params[3] = OSSL_PARAM_construct_end();\nmerged_params = OSSL_PARAM_merge(domain_params, extra_params);\n\nctx = EVP_PKEY_CTX_new_from_name(NULL, \"DHX\", NULL);\nEVP_PKEY_fromdata_init(ctx);\nEVP_PKEY_fromdata(ctx, &complete_domp, OSSL_KEYMGMT_SELECT_ALL,\n                  merged_params);\n\nvalidate_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, complete_domp, NULL);\nif (EVP_PKEY_param_check(validate_ctx) > 0)\n    /* validation_passed(); */\nelse\n    /* validation_failed(); */\n\nOSSL_PARAM_free(domain_params);\nOSSL_PARAM_free(merged_params);\nEVP_PKEY_CTX_free(ctx);\nEVP_PKEY_CTX_free(validate_ctx);\nEVP_PKEY_free(complete_domp);\n
                                                                      "},{"location":"man7/EVP_PKEY-DH/#conforming-to","title":"CONFORMING TO","text":"
                                                                      • RFC 7919 (TLS ffdhe named safe prime groups)
                                                                      • RFC 3526 (IKE modp named safe prime groups)
                                                                      • RFC 5114 (Additional DH named groups for dh_1024_160\", \"dh_2048_224\" and \"dh_2048_256\").

                                                                      The following sections of SP800-56Ar3:

                                                                      • 5.5.1.1 FFC Domain Parameter Selection/Generation
                                                                      • Appendix D: FFC Safe-prime Groups

                                                                      The following sections of FIPS186-4:

                                                                      • A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
                                                                      • A.2.3 Generation of canonical generator g.
                                                                      • A.2.1 Unverifiable Generation of the Generator g.
                                                                      "},{"location":"man7/EVP_PKEY-DH/#see-also","title":"SEE ALSO","text":"

                                                                      EVP_PKEY-FFC(7), EVP_KEYEXCH-DH(7) EVP_PKEY(3), provider-keymgmt(7), EVP_KEYMGMT(3), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7)

                                                                      "},{"location":"man7/EVP_PKEY-DH/#copyright","title":"COPYRIGHT","text":"

                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                      "},{"location":"man7/EVP_PKEY-DSA/","title":"EVP_PKEY-DSA","text":""},{"location":"man7/EVP_PKEY-DSA/#name","title":"NAME","text":"

                                                                      EVP_PKEY-DSA, EVP_KEYMGMT-DSA - EVP_PKEY DSA keytype and algorithm support

                                                                      "},{"location":"man7/EVP_PKEY-DSA/#description","title":"DESCRIPTION","text":"

                                                                      For DSA the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for seed, pcounter and gindex may need to be stored for validation purposes. For DSA these fields are not stored in the ASN1 data so they need to be stored externally if validation is required.

                                                                      "},{"location":"man7/EVP_PKEY-DSA/#dsa-parameters","title":"DSA parameters","text":"

                                                                      The DSA key type supports the FFC parameters (see \"FFC parameters\" in EVP_PKEY-FFC(7)).

                                                                      "},{"location":"man7/EVP_PKEY-DSA/#dsa-key-generation-parameters","title":"DSA key generation parameters","text":"

                                                                      The DSA key type supports the FFC key generation parameters (see \"FFC key generation parameters\" in EVP_PKEY-FFC(7)

                                                                      The following restrictions apply to the \"pbits\" field:

                                                                      For \"fips186_4\" this must be either 2048 or 3072. For \"fips186_2\" this must be 1024. For \"group\" this can be any one of 2048, 3072, 4096, 6144 or 8192.

                                                                      "},{"location":"man7/EVP_PKEY-DSA/#dsa-key-validation","title":"DSA key validation","text":"

                                                                      For DSA keys, EVP_PKEY_param_check(3) behaves in the following way: The OpenSSL FIPS provider conforms to the rules within the FIPS186-4 standard for FFC parameter validation. For backwards compatibility the OpenSSL default provider uses a much simpler check (see below) for parameter validation, unless the seed parameter is set.

                                                                      For DSA keys, EVP_PKEY_param_check_quick(3) behaves in the following way: A simple check of L and N and partial g is performed. The default provider also supports validation of legacy \"fips186_2\" keys.

                                                                      For DSA keys, EVP_PKEY_public_check(3), EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3) the OpenSSL default and FIPS providers conform to the rules within SP800-56Ar3 for public, private and pairwise tests respectively.

                                                                      "},{"location":"man7/EVP_PKEY-DSA/#examples","title":"EXAMPLES","text":"

                                                                      An EVP_PKEY context can be obtained by calling:

                                                                      EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"DSA\", NULL);\n

                                                                      The DSA domain parameters can be generated by calling:

                                                                      unsigned int pbits = 2048;\nunsigned int qbits = 256;\nint gindex = 1;\nOSSL_PARAM params[5];\nEVP_PKEY *param_key = NULL;\nEVP_PKEY_CTX *pctx = NULL;\n\npctx = EVP_PKEY_CTX_new_from_name(NULL, \"DSA\", NULL);\nEVP_PKEY_paramgen_init(pctx);\n\nparams[0] = OSSL_PARAM_construct_uint(\"pbits\", &pbits);\nparams[1] = OSSL_PARAM_construct_uint(\"qbits\", &qbits);\nparams[2] = OSSL_PARAM_construct_int(\"gindex\", &gindex);\nparams[3] = OSSL_PARAM_construct_utf8_string(\"digest\", \"SHA384\", 0);\nparams[4] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(pctx, params);\n\nEVP_PKEY_generate(pctx, &param_key);\nEVP_PKEY_CTX_free(pctx);\n\nEVP_PKEY_print_params(bio_out, param_key, 0, NULL);\n

                                                                      A DSA key can be generated using domain parameters by calling:

                                                                      EVP_PKEY *key = NULL;\nEVP_PKEY_CTX *gctx = NULL;\n\ngctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);\nEVP_PKEY_keygen_init(gctx);\nEVP_PKEY_generate(gctx, &key);\nEVP_PKEY_CTX_free(gctx);\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n
                                                                      "},{"location":"man7/EVP_PKEY-DSA/#conforming-to","title":"CONFORMING TO","text":"

                                                                      The following sections of FIPS186-4:

                                                                      • A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
                                                                      • A.2.3 Generation of canonical generator g.
                                                                      • A.2.1 Unverifiable Generation of the Generator g.
                                                                      "},{"location":"man7/EVP_PKEY-DSA/#see-also","title":"SEE ALSO","text":"

                                                                      EVP_PKEY-FFC(7), EVP_SIGNATURE-DSA(7) EVP_PKEY(3), provider-keymgmt(7), EVP_KEYMGMT(3), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7)

                                                                      "},{"location":"man7/EVP_PKEY-DSA/#copyright","title":"COPYRIGHT","text":"

                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                      "},{"location":"man7/EVP_PKEY-EC/","title":"EVP_PKEY-EC","text":""},{"location":"man7/EVP_PKEY-EC/#name","title":"NAME","text":"

                                                                      EVP_PKEY-EC, EVP_KEYMGMT-EC - EVP_PKEY EC keytype and algorithm support

                                                                      "},{"location":"man7/EVP_PKEY-EC/#description","title":"DESCRIPTION","text":"

                                                                      The EC keytype is implemented in OpenSSL's default provider.

                                                                      "},{"location":"man7/EVP_PKEY-EC/#common-ec-parameters","title":"Common EC parameters","text":"

                                                                      The normal way of specifying domain parameters for an EC curve is via the curve name \"group\". For curves with no curve name, explicit parameters can be used that specify \"field-type\", \"p\", \"a\", \"b\", \"generator\" and \"order\". Explicit parameters are supported for backwards compatibility reasons, but they are not compliant with multiple standards (including RFC5915) which only allow named curves.

                                                                      The following KeyGen/Gettable/Import/Export types are available for the built-in EC algorithm:

                                                                      • \"group\" (OSSL_PKEY_PARAM_GROUP_NAME)

                                                                        The curve name.

                                                                      • \"field-type\" (OSSL_PKEY_PARAM_EC_FIELD_TYPE)

                                                                        The value should be either \"prime-field\" or \"characteristic-two-field\", which correspond to prime field Fp and binary field F2^m.

                                                                      • \"p\" (OSSL_PKEY_PARAM_EC_P) <unsigned integer>

                                                                        For a curve over Fp p is the prime for the field. For a curve over F2^m p represents the irreducible polynomial - each bit represents a term in the polynomial. Therefore, there will either be three or five bits set dependent on whether the polynomial is a trinomial or a pentanomial.

                                                                      • \"a\" (OSSL_PKEY_PARAM_EC_A) <unsigned integer>

                                                                      • \"b\" (OSSL_PKEY_PARAM_EC_B) <unsigned integer>
                                                                      • \"seed\" (OSSL_PKEY_PARAM_EC_SEED) <octet string>

                                                                        a and b represents the coefficients of the curve For Fp: y^2 mod p = x^3 +ax + b mod p OR For F2^m: y^2 + xy = x^3 + ax^2 + b

                                                                        seed is an optional value that is for information purposes only. It represents the random number seed used to generate the coefficient b from a random number.

                                                                      • \"generator\" (OSSL_PKEY_PARAM_EC_GENERATOR) <octet string>

                                                                      • \"order\" (OSSL_PKEY_PARAM_EC_ORDER) <unsigned integer>
                                                                      • \"cofactor\" (OSSL_PKEY_PARAM_EC_COFACTOR) <unsigned integer>

                                                                        The generator is a well defined point on the curve chosen for cryptographic operations. The encoding conforms with Sec. 2.3.3 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. See EC_POINT_oct2point(). Integers used for point multiplications will be between 0 and order - 1. cofactor is an optional value. order multiplied by the cofactor gives the number of points on the curve.

                                                                      • \"decoded-from-explicit\" (OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS) <integer>

                                                                        Gets a flag indicating whether the key or parameters were decoded from explicit curve parameters. Set to 1 if so or 0 if a named curve was used.

                                                                      • \"use-cofactor-flag\" (OSSL_PKEY_PARAM_USE_COFACTOR_ECDH) <integer>

                                                                        Enable Cofactor DH (ECC CDH) if this value is 1, otherwise it uses normal EC DH if the value is zero. The cofactor variant multiplies the shared secret by the EC curve's cofactor (note for some curves the cofactor is 1).

                                                                        See also EVP_KEYEXCH-ECDH(7) for the related OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE parameter that can be set on a per-operation basis.

                                                                      • \"encoding\" (OSSL_PKEY_PARAM_EC_ENCODING)

                                                                        Set the format used for serializing the EC group parameters. Valid values are \"explicit\" or \"named_curve\". The default value is \"named_curve\".

                                                                      • \"point-format\" (OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT)

                                                                        Sets or gets the point_conversion_form for the key. For a description of point_conversion_forms please see EC_POINT_new(3). Valid values are \"uncompressed\" or \"compressed\". The default value is \"uncompressed\".

                                                                      • \"group-check\" (OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE)

                                                                        Sets or Gets the type of group check done when EVP_PKEY_param_check() is called. Valid values are \"default\", \"named\" and \"named-nist\". The \"named\" type checks that the domain parameters match the inbuilt curve parameters, \"named-nist\" is similar but also checks that the named curve is a nist curve. The \"default\" type does domain parameter validation for the OpenSSL default provider, but is equivalent to \"named-nist\" for the OpenSSL FIPS provider.

                                                                      • \"include-public\" (OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC) <integer>

                                                                        Setting this value to 0 indicates that the public key should not be included when encoding the private key. The default value of 1 will include the public key.

                                                                      • \"pub\" (OSSL_PKEY_PARAM_PUB_KEY) <octet string>

                                                                        The public key value in encoded EC point format conforming to Sec. 2.3.3 and 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. This parameter is used when importing or exporting the public key value with the EVP_PKEY_fromdata() and EVP_PKEY_todata() functions.

                                                                        Note, in particular, that the choice of point compression format used for encoding the exported value via EVP_PKEY_todata() depends on the underlying provider implementation. Before OpenSSL 3.0.8, the implementation of providers included with OpenSSL always opted for an encoding in compressed format, unconditionally. Since OpenSSL 3.0.8, the implementation has been changed to honor the OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT parameter, if set, or to default to uncompressed format.

                                                                      • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>

                                                                        The private key value.

                                                                      • \"encoded-pub-key\" (OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY) <octet string>

                                                                        Used for getting and setting the encoding of an EC public key. The public key is expected to be a point conforming to Sec. 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard.

                                                                      • \"qx\" (OSSL_PKEY_PARAM_EC_PUB_X) <unsigned integer>

                                                                        Used for getting the EC public key X component.

                                                                      • \"qy\" (OSSL_PKEY_PARAM_EC_PUB_Y) <unsigned integer>

                                                                        Used for getting the EC public key Y component.

                                                                      • \"default-digest\" (OSSL_PKEY_PARAM_DEFAULT_DIGEST)

                                                                        Getter that returns the default digest name. (Currently returns \"SHA256\" as of OpenSSL 3.0).

                                                                        The following Gettable types are also available for the built-in EC algorithm:

                                                                        • \"basis-type\" (OSSL_PKEY_PARAM_EC_CHAR2_TYPE)

                                                                          Supports the values \"tpBasis\" for a trinomial or \"ppBasis\" for a pentanomial. This field is only used for a binary field F2^m.

                                                                        • \"m\" (OSSL_PKEY_PARAM_EC_CHAR2_M) <integer>

                                                                        • \"tp\" (OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS) <integer>
                                                                        • \"k1\" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K1) <integer>
                                                                        • \"k2\" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K2) <integer>
                                                                        • \"k3\" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K3) <integer>

                                                                          These fields are only used for a binary field F2^m. m is the degree of the binary field.

                                                                          tp is the middle bit of a trinomial so its value must be in the range m > tp > 0.

                                                                          k1, k2 and k3 are used to get the middle bits of a pentanomial such that m > k3 > k2 > k1 > 0

                                                                        • "},{"location":"man7/EVP_PKEY-EC/#ec-key-validation","title":"EC key validation","text":"

                                                                          For EC keys, EVP_PKEY_param_check(3) behaves in the following way: For the OpenSSL default provider it uses either EC_GROUP_check(3) or EC_GROUP_check_named_curve(3) depending on the flag EC_FLAG_CHECK_NAMED_GROUP. The OpenSSL FIPS provider uses EC_GROUP_check_named_curve(3) in order to conform to SP800-56Ar3 Assurances of Domain-Parameter Validity.

                                                                          For EC keys, EVP_PKEY_param_check_quick(3) is equivalent to EVP_PKEY_param_check(3).

                                                                          For EC keys, EVP_PKEY_public_check(3) and EVP_PKEY_public_check_quick(3) conform to SP800-56Ar3 ECC Full Public-Key Validation and ECC Partial Public-Key Validation respectively.

                                                                          For EC Keys, EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3) conform to SP800-56Ar3 Private key validity and Owner Assurance of Pair-wise Consistency respectively.

                                                                          "},{"location":"man7/EVP_PKEY-EC/#examples","title":"EXAMPLES","text":"

                                                                          An EVP_PKEY context can be obtained by calling:

                                                                          EVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n

                                                                          An EVP_PKEY ECDSA or ECDH key can be generated with a \"P-256\" named group by calling:

                                                                          pkey = EVP_EC_gen(\"P-256\");\n

                                                                          or like this:

                                                                          EVP_PKEY *key = NULL;\nOSSL_PARAM params[2];\nEVP_PKEY_CTX *gctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n\nEVP_PKEY_keygen_init(gctx);\n\nparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,\n                                             \"P-256\", 0);\nparams[1] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(gctx, params);\n\nEVP_PKEY_generate(gctx, &key);\n\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n...\nEVP_PKEY_free(key);\nEVP_PKEY_CTX_free(gctx);\n

                                                                          An EVP_PKEY EC CDH (Cofactor Diffie-Hellman) key can be generated with a \"K-571\" named group by calling:

                                                                          int use_cdh = 1;\nEVP_PKEY *key = NULL;\nOSSL_PARAM params[3];\nEVP_PKEY_CTX *gctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n\nEVP_PKEY_keygen_init(gctx);\n\nparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,\n                                             \"K-571\", 0);\n/*\n * This curve has a cofactor that is not 1 - so setting CDH mode changes\n * the behaviour. For many curves the cofactor is 1 - so setting this has\n * no effect.\n */\nparams[1] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_USE_COFACTOR_ECDH,\n                                     &use_cdh);\nparams[2] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(gctx, params);\n\nEVP_PKEY_generate(gctx, &key);\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n...\nEVP_PKEY_free(key);\nEVP_PKEY_CTX_free(gctx);\n
                                                                          "},{"location":"man7/EVP_PKEY-EC/#see-also","title":"SEE ALSO","text":"

                                                                          EVP_EC_gen(3), EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7), EVP_SIGNATURE-ECDSA(7), EVP_KEYEXCH-ECDH(7)

                                                                          "},{"location":"man7/EVP_PKEY-EC/#copyright","title":"COPYRIGHT","text":"

                                                                          Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                          "},{"location":"man7/EVP_PKEY-FFC/","title":"EVP_PKEY-FFC","text":""},{"location":"man7/EVP_PKEY-FFC/#name","title":"NAME","text":"

                                                                          EVP_PKEY-FFC - EVP_PKEY DSA and DH/DHX shared FFC parameters.

                                                                          "},{"location":"man7/EVP_PKEY-FFC/#description","title":"DESCRIPTION","text":"

                                                                          Finite field cryptography (FFC) is a method of implementing discrete logarithm cryptography using finite field mathematics. DSA is an example of FFC and Diffie-Hellman key establishment algorithms specified in SP800-56A can also be implemented as FFC.

                                                                          The DSA, DH and DHX keytypes are implemented in OpenSSL's default and FIPS providers. The implementations support the basic DSA, DH and DHX keys, containing the public and private keys pub and priv as well as the three main domain parameters p, q and g.

                                                                          For DSA (and DH that is not a named group) the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for seed, pcounter and gindex may need to be stored for validation purposes. For DH the seed and pcounter can be stored in ASN1 data (but the gindex is not). For DSA however, these fields are not stored in the ASN1 data so they need to be stored externally if validation is required.

                                                                          The DH key type uses PKCS#3 format which saves p and g, but not the 'q' value. The DHX key type uses X9.42 format which saves the value of 'q' and this must be used for FIPS186-4.

                                                                          "},{"location":"man7/EVP_PKEY-FFC/#ffc-parameters","title":"FFC parameters","text":"

                                                                          In addition to the common parameters that all keytypes should support (see \"Common parameters\" in provider-keymgmt(7)), the DSA, DH and DHX keytype implementations support the following.

                                                                          • \"pub\" (OSSL_PKEY_PARAM_PUB_KEY) <unsigned integer>

                                                                            The public key value.

                                                                          • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>

                                                                            The private key value.

                                                                          "},{"location":"man7/EVP_PKEY-FFC/#ffc-dsa-dh-and-dhx-domain-parameters","title":"FFC DSA, DH and DHX domain parameters","text":"
                                                                          • \"p\" (OSSL_PKEY_PARAM_FFC_P) <unsigned integer>

                                                                            A DSA or Diffie-Hellman prime \"p\" value.

                                                                          • \"g\" (OSSL_PKEY_PARAM_FFC_G) <unsigned integer>

                                                                            A DSA or Diffie-Hellman generator \"g\" value.

                                                                          "},{"location":"man7/EVP_PKEY-FFC/#ffc-dsa-and-dhx-domain-parameters","title":"FFC DSA and DHX domain parameters","text":"
                                                                          • \"q\" (OSSL_PKEY_PARAM_FFC_Q) <unsigned integer>

                                                                            A DSA or Diffie-Hellman prime \"q\" value.

                                                                          • \"seed\" (OSSL_PKEY_PARAM_FFC_SEED) <octet string>

                                                                            An optional domain parameter seed value used during generation and validation of p, q and canonical g. For validation this needs to set the seed that was produced during generation.

                                                                          • \"gindex\" (OSSL_PKEY_PARAM_FFC_GINDEX) <integer>

                                                                            Sets the index to use for canonical generation and verification of the generator g. Set this to a positive value from 0..FF to use this mode. This gindex can then be reused during key validation to verify the value of g. If this value is not set or is -1 then unverifiable generation of the generator g will be used.

                                                                          • \"pcounter\" (OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer>

                                                                            An optional domain parameter counter value that is output during generation of p. This value must be saved if domain parameter validation is required.

                                                                          • \"hindex\" (OSSL_PKEY_PARAM_FFC_H) <integer>

                                                                            For unverifiable generation of the generator g this value is output during generation of g. Its value is the first integer larger than one that satisfies g = h^j mod p (where g != 1 and \"j\" is the cofactor).

                                                                          • \"j\" (OSSL_PKEY_PARAM_FFC_COFACTOR) <unsigned integer>

                                                                            An optional informational cofactor parameter that should equal to (p - 1) / q.

                                                                          • \"validate-pq\" (OSSL_PKEY_PARAM_FFC_VALIDATE_PQ) <unsigned integer>

                                                                          • \"validate-g\" (OSSL_PKEY_PARAM_FFC_VALIDATE_G) <unsigned integer>

                                                                            These boolean values are used during FIPS186-4 or FIPS186-2 key validation checks (See EVP_PKEY_param_check(3)) to select validation options. By default validate-pq and validate-g are both set to 1 to check that p,q and g are valid. Either of these may be set to 0 to skip a test, which is mainly useful for testing purposes.

                                                                          • \"validate-legacy\" (OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY) <unsigned integer>

                                                                            This boolean value is used during key validation checks (See EVP_PKEY_param_check(3)) to select the validation type. The default value of 0 selects FIPS186-4 validation. Setting this value to 1 selects FIPS186-2 validation.

                                                                          "},{"location":"man7/EVP_PKEY-FFC/#ffc-key-generation-parameters","title":"FFC key generation parameters","text":"

                                                                          The following key generation types are available for DSA and DHX algorithms:

                                                                          • \"type\" (OSSL_PKEY_PARAM_FFC_TYPE)

                                                                            Sets the type of parameter generation. The shared valid values are:

                                                                            • \"fips186_4\"

                                                                              The current standard.

                                                                            • \"fips186_2\"

                                                                              The old standard that should only be used for legacy purposes.

                                                                            • \"default\"

                                                                              This can choose one of \"fips186_4\" or \"fips186_2\" depending on other parameters set for parameter generation.

                                                                          • \"pbits\" (OSSL_PKEY_PARAM_FFC_PBITS) <unsigned integer>

                                                                            Sets the size (in bits) of the prime 'p'.

                                                                          • \"qbits\" (OSSL_PKEY_PARAM_FFC_QBITS) <unsigned integer>

                                                                            Sets the size (in bits) of the prime 'q'.

                                                                            For \"fips186_4\" this can be either 224 or 256. For \"fips186_2\" this has a size of 160.

                                                                          • \"digest\" (OSSL_PKEY_PARAM_FFC_DIGEST)

                                                                            Sets the Digest algorithm to be used as part of the Key Generation Function associated with the given Key Generation ctx. This must also be set for key validation.

                                                                          • \"properties\" (OSSL_PKEY_PARAM_FFC_DIGEST_PROPS)

                                                                            Sets properties to be used upon look up of the implementation for the selected Digest algorithm for the Key Generation Function associated with the given key generation ctx. This may also be set for key validation.

                                                                          • \"seed\" (OSSL_PKEY_PARAM_FFC_SEED) <octet string>

                                                                            For \"fips186_4\" or \"fips186_2\" generation this sets the seed data to use instead of generating a random seed internally. This should be used for testing purposes only. This will either produce fixed values for the generated parameters OR it will fail if the seed did not generate valid primes.

                                                                          • \"gindex\" (OSSL_PKEY_PARAM_FFC_GINDEX) <integer>

                                                                          • \"pcounter\" (OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer>
                                                                          • \"hindex\" (OSSL_PKEY_PARAM_FFC_H) <integer>

                                                                            These types are described above.

                                                                          • "},{"location":"man7/EVP_PKEY-FFC/#conforming-to","title":"CONFORMING TO","text":"

                                                                            The following sections of SP800-56Ar3:

                                                                            • 5.5.1.1 FFC Domain Parameter Selection/Generation

                                                                            The following sections of FIPS186-4:

                                                                            • A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
                                                                            • A.2.3 Generation of canonical generator g.
                                                                            • A.2.1 Unverifiable Generation of the Generator g.
                                                                            "},{"location":"man7/EVP_PKEY-FFC/#see-also","title":"SEE ALSO","text":"

                                                                            EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_SIGNATURE-DSA(7), EVP_KEYEXCH-DH(7) EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                                            "},{"location":"man7/EVP_PKEY-FFC/#copyright","title":"COPYRIGHT","text":"

                                                                            Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                            "},{"location":"man7/EVP_PKEY-HMAC/","title":"EVP_PKEY-HMAC","text":""},{"location":"man7/EVP_PKEY-HMAC/#name","title":"NAME","text":"

                                                                            EVP_PKEY-HMAC, EVP_KEYMGMT-HMAC, EVP_PKEY-Siphash, EVP_KEYMGMT-Siphash, EVP_PKEY-Poly1305, EVP_KEYMGMT-Poly1305, EVP_PKEY-CMAC, EVP_KEYMGMT-CMAC - EVP_PKEY legacy MAC keytypes and algorithm support

                                                                            "},{"location":"man7/EVP_PKEY-HMAC/#description","title":"DESCRIPTION","text":"

                                                                            The HMAC and CMAC key types are implemented in OpenSSL's default and FIPS providers. Additionally the Siphash and Poly1305 key types are implemented in the default provider. Performing MAC operations via an EVP_PKEY is considered legacy and are only available for backwards compatibility purposes and for a restricted set of algorithms. The preferred way of performing MAC operations is via the EVP_MAC APIs. See EVP_MAC_init(3).

                                                                            For further details on using EVP_PKEY based MAC keys see EVP_SIGNATURE-HMAC(7), EVP_SIGNATURE-Siphash(7), EVP_SIGNATURE-Poly1305(7) or EVP_SIGNATURE-CMAC(7).

                                                                            "},{"location":"man7/EVP_PKEY-HMAC/#common-mac-parameters","title":"Common MAC parameters","text":"

                                                                            All the MAC keytypes support the following parameters.

                                                                            • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string>

                                                                              The MAC key value.

                                                                            • \"properties\" (OSSL_PKEY_PARAM_PROPERTIES)

                                                                              A property query string to be used when any algorithms are fetched.

                                                                              "},{"location":"man7/EVP_PKEY-HMAC/#cmac-parameters","title":"CMAC parameters","text":"

                                                                              As well as the parameters described above, the CMAC keytype additionally supports the following parameters.

                                                                              • \"cipher\" (OSSL_PKEY_PARAM_CIPHER)

                                                                                The name of a cipher to be used when generating the MAC.

                                                                              • \"engine\" (OSSL_PKEY_PARAM_ENGINE)

                                                                                The name of an engine to be used for the specified cipher (if any).

                                                                                "},{"location":"man7/EVP_PKEY-HMAC/#common-mac-key-generation-parameters","title":"Common MAC key generation parameters","text":"

                                                                                MAC key generation is unusual in that no new key is actually generated. Instead a new provider side key object is created with the supplied raw key value. This is done for backwards compatibility with previous versions of OpenSSL.

                                                                                • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string>

                                                                                  The MAC key value.

                                                                                "},{"location":"man7/EVP_PKEY-HMAC/#cmac-key-generation-parameters","title":"CMAC key generation parameters","text":"

                                                                                In addition to the common MAC key generation parameters, the CMAC key generation additionally recognises the following.

                                                                                • \"cipher\" (OSSL_PKEY_PARAM_CIPHER)

                                                                                  The name of a cipher to be used when generating the MAC.

                                                                                  "},{"location":"man7/EVP_PKEY-HMAC/#see-also","title":"SEE ALSO","text":"

                                                                                  EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7)

                                                                                  "},{"location":"man7/EVP_PKEY-HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                  Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/","title":"EVP_PKEY-RSA","text":""},{"location":"man7/EVP_PKEY-RSA/#name","title":"NAME","text":"

                                                                                  EVP_PKEY-RSA, EVP_KEYMGMT-RSA, RSA - EVP_PKEY RSA keytype and algorithm support

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#description","title":"DESCRIPTION","text":"

                                                                                  The RSA keytype is implemented in OpenSSL's default and FIPS providers. That implementation supports the basic RSA keys, containing the modulus n, the public exponent e, the private exponent d, and a collection of prime factors, exponents and coefficient for CRT calculations, of which the first few are known as p and q, dP and dQ, and qInv.

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#common-rsa-parameters","title":"Common RSA parameters","text":"

                                                                                  In addition to the common parameters that all keytypes should support (see \"Common parameters\" in provider-keymgmt(7)), the RSA keytype implementation supports the following.

                                                                                  • \"n\" (OSSL_PKEY_PARAM_RSA_N) <unsigned integer>

                                                                                    The RSA modulus \"n\" value.

                                                                                  • \"e\" (OSSL_PKEY_PARAM_RSA_E) <unsigned integer>

                                                                                    The RSA public exponent \"e\" value. This value must always be set when creating a raw key using EVP_PKEY_fromdata(3). Note that when a decryption operation is performed, that this value is used for blinding purposes to prevent timing attacks.

                                                                                  • \"d\" (OSSL_PKEY_PARAM_RSA_D) <unsigned integer>

                                                                                    The RSA private exponent \"d\" value.

                                                                                  • \"rsa-factor1\" (OSSL_PKEY_PARAM_RSA_FACTOR1) <unsigned integer>

                                                                                  • \"rsa-factor2\" (OSSL_PKEY_PARAM_RSA_FACTOR2) <unsigned integer>
                                                                                  • \"rsa-factor3\" (OSSL_PKEY_PARAM_RSA_FACTOR3) <unsigned integer>
                                                                                  • \"rsa-factor4\" (OSSL_PKEY_PARAM_RSA_FACTOR4) <unsigned integer>
                                                                                  • \"rsa-factor5\" (OSSL_PKEY_PARAM_RSA_FACTOR5) <unsigned integer>
                                                                                  • \"rsa-factor6\" (OSSL_PKEY_PARAM_RSA_FACTOR6) <unsigned integer>
                                                                                  • \"rsa-factor7\" (OSSL_PKEY_PARAM_RSA_FACTOR7) <unsigned integer>
                                                                                  • \"rsa-factor8\" (OSSL_PKEY_PARAM_RSA_FACTOR8) <unsigned integer>
                                                                                  • \"rsa-factor9\" (OSSL_PKEY_PARAM_RSA_FACTOR9) <unsigned integer>
                                                                                  • \"rsa-factor10\" (OSSL_PKEY_PARAM_RSA_FACTOR10) <unsigned integer>

                                                                                    RSA prime factors. The factors are known as \"p\", \"q\" and \"r_i\" in RFC8017. Up to eight additional \"r_i\" prime factors are supported.

                                                                                  • \"rsa-exponent1\" (OSSL_PKEY_PARAM_RSA_EXPONENT1) <unsigned integer>

                                                                                  • \"rsa-exponent2\" (OSSL_PKEY_PARAM_RSA_EXPONENT2) <unsigned integer>
                                                                                  • \"rsa-exponent3\" (OSSL_PKEY_PARAM_RSA_EXPONENT3) <unsigned integer>
                                                                                  • \"rsa-exponent4\" (OSSL_PKEY_PARAM_RSA_EXPONENT4) <unsigned integer>
                                                                                  • \"rsa-exponent5\" (OSSL_PKEY_PARAM_RSA_EXPONENT5) <unsigned integer>
                                                                                  • \"rsa-exponent6\" (OSSL_PKEY_PARAM_RSA_EXPONENT6) <unsigned integer>
                                                                                  • \"rsa-exponent7\" (OSSL_PKEY_PARAM_RSA_EXPONENT7) <unsigned integer>
                                                                                  • \"rsa-exponent8\" (OSSL_PKEY_PARAM_RSA_EXPONENT8) <unsigned integer>
                                                                                  • \"rsa-exponent9\" (OSSL_PKEY_PARAM_RSA_EXPONENT9) <unsigned integer>
                                                                                  • \"rsa-exponent10\" (OSSL_PKEY_PARAM_RSA_EXPONENT10) <unsigned integer>

                                                                                    RSA CRT (Chinese Remainder Theorem) exponents. The exponents are known as \"dP\", \"dQ\" and \"d_i\" in RFC8017. Up to eight additional \"d_i\" exponents are supported.

                                                                                  • \"rsa-coefficient1\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT1) <unsigned integer>

                                                                                  • \"rsa-coefficient2\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT2) <unsigned integer>
                                                                                  • \"rsa-coefficient3\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT3) <unsigned integer>
                                                                                  • \"rsa-coefficient4\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT4) <unsigned integer>
                                                                                  • \"rsa-coefficient5\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT5) <unsigned integer>
                                                                                  • \"rsa-coefficient6\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT6) <unsigned integer>
                                                                                  • \"rsa-coefficient7\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT7) <unsigned integer>
                                                                                  • \"rsa-coefficient8\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT8) <unsigned integer>
                                                                                  • \"rsa-coefficient9\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT9) <unsigned integer>

                                                                                    RSA CRT (Chinese Remainder Theorem) coefficients. The coefficients are known as \"qInv\" and \"t_i\". Up to eight additional \"t_i\" exponents are supported.

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-generation-parameters","title":"RSA key generation parameters","text":"

                                                                                  When generating RSA keys, the following key generation parameters may be used.

                                                                                  • \"bits\" (OSSL_PKEY_PARAM_RSA_BITS) <unsigned integer>

                                                                                    The value should be the cryptographic length for the RSA cryptosystem, in bits.

                                                                                  • \"primes\" (OSSL_PKEY_PARAM_RSA_PRIMES) <unsigned integer>

                                                                                    The value should be the number of primes for the generated RSA key. The default is 2. It isn't permitted to specify a larger number of primes than 10. Additionally, the number of primes is limited by the length of the key being generated so the maximum number could be less. Some providers may only support a value of 2.

                                                                                  • \"e\" (OSSL_PKEY_PARAM_RSA_E) <unsigned integer>

                                                                                    The RSA \"e\" value. The value may be any odd number greater than or equal to 65537. The default value is 65537. For legacy reasons a value of 3 is currently accepted but is deprecated.

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-generation-parameters-for-fips-module-testing","title":"RSA key generation parameters for FIPS module testing","text":"

                                                                                  When generating RSA keys, the following additional key generation parameters may be used for algorithm testing purposes only. Do not use these to generate RSA keys for a production environment.

                                                                                  • \"xp\" (OSSL_PKEY_PARAM_RSA_TEST_XP) <unsigned integer>
                                                                                  • \"xq\" (OSSL_PKEY_PARAM_RSA_TEST_XQ) <unsigned integer>

                                                                                    These 2 fields are normally randomly generated and are used to generate \"p\" and \"q\".

                                                                                  • \"xp1\" (OSSL_PKEY_PARAM_RSA_TEST_XP1) <unsigned integer>

                                                                                  • \"xp2\" (OSSL_PKEY_PARAM_RSA_TEST_XP2) <unsigned integer>
                                                                                  • \"xq1\" (OSSL_PKEY_PARAM_RSA_TEST_XQ1) <unsigned integer>
                                                                                  • \"xq2\" (OSSL_PKEY_PARAM_RSA_TEST_XQ2) <unsigned integer>

                                                                                    These 4 fields are normally randomly generated. The prime factors \"p1\", \"p2\", \"q1\" and \"q2\" are determined from these values.

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-parameters-for-fips-module-testing","title":"RSA key parameters for FIPS module testing","text":"

                                                                                  The following intermediate values can be retrieved only if the values specified in \"RSA key generation parameters for FIPS module testing\" are set. These should not be accessed in a production environment.

                                                                                  • \"p1\" (OSSL_PKEY_PARAM_RSA_TEST_P1) <unsigned integer>
                                                                                  • \"p2\" (OSSL_PKEY_PARAM_RSA_TEST_P2) <unsigned integer>
                                                                                  • \"q1\" (OSSL_PKEY_PARAM_RSA_TEST_Q1) <unsigned integer>
                                                                                  • \"q2\" (OSSL_PKEY_PARAM_RSA_TEST_Q2) <unsigned integer>

                                                                                    The auxiliary probable primes.

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-validation","title":"RSA key validation","text":"

                                                                                  For RSA keys, EVP_PKEY_param_check(3) and EVP_PKEY_param_check_quick(3) both return 1 unconditionally.

                                                                                  For RSA keys, EVP_PKEY_public_check(3) conforms to the SP800-56Br1 public key check when the OpenSSL FIPS provider is used. The OpenSSL default provider performs similar tests but relaxes the keysize restrictions for backwards compatibility.

                                                                                  For RSA keys, EVP_PKEY_public_check_quick(3) is the same as EVP_PKEY_public_check(3).

                                                                                  For RSA keys, EVP_PKEY_private_check(3) conforms to the SP800-56Br1 private key test.

                                                                                  For RSA keys, EVP_PKEY_pairwise_check(3) conforms to the SP800-56Br1 KeyPair Validation check for the OpenSSL FIPS provider. The OpenSSL default provider allows testing of the validity of multi-primes.

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#conforming-to","title":"CONFORMING TO","text":"
                                                                                  • FIPS186-4

                                                                                    Section B.3.6 Generation of Probable Primes with Conditions Based on Auxiliary Probable Primes

                                                                                  • RFC 8017, excluding RSA-PSS and RSA-OAEP

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#examples","title":"EXAMPLES","text":"

                                                                                  An EVP_PKEY context can be obtained by calling:

                                                                                  EVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n

                                                                                  An RSA key can be generated simply like this:

                                                                                  pkey = EVP_RSA_gen(4096);\n

                                                                                  or like this:

                                                                                  EVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n\nEVP_PKEY_keygen_init(pctx);\nEVP_PKEY_generate(pctx, &pkey);\nEVP_PKEY_CTX_free(pctx);\n

                                                                                  An RSA key can be generated with key generation parameters:

                                                                                  unsigned int primes = 3;\nunsigned int bits = 4096;\nOSSL_PARAM params[3];\nEVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n\nEVP_PKEY_keygen_init(pctx);\n\nparams[0] = OSSL_PARAM_construct_uint(\"bits\", &bits);\nparams[1] = OSSL_PARAM_construct_uint(\"primes\", &primes);\nparams[2] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(pctx, params);\n\nEVP_PKEY_generate(pctx, &pkey);\nEVP_PKEY_print_private(bio_out, pkey, 0, NULL);\nEVP_PKEY_CTX_free(pctx);\n
                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#see-also","title":"SEE ALSO","text":"

                                                                                  EVP_RSA_gen(3), EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7)

                                                                                  "},{"location":"man7/EVP_PKEY-RSA/#copyright","title":"COPYRIGHT","text":"

                                                                                  Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                  "},{"location":"man7/EVP_PKEY-SM2/","title":"EVP_PKEY-SM2","text":""},{"location":"man7/EVP_PKEY-SM2/#name","title":"NAME","text":"

                                                                                  EVP_PKEY-SM2, EVP_KEYMGMT-SM2, SM2 - EVP_PKEY keytype support for the Chinese SM2 signature and encryption algorithms

                                                                                  "},{"location":"man7/EVP_PKEY-SM2/#description","title":"DESCRIPTION","text":"

                                                                                  The SM2 algorithm was first defined by the Chinese national standard GM/T 0003-2012 and was later standardized by ISO as ISO/IEC 14888. SM2 is actually an elliptic curve based algorithm. The current implementation in OpenSSL supports both signature and encryption schemes via the EVP interface.

                                                                                  When doing the SM2 signature algorithm, it requires a distinguishing identifier to form the message prefix which is hashed before the real message is hashed.

                                                                                  "},{"location":"man7/EVP_PKEY-SM2/#common-sm2-parameters","title":"Common SM2 parameters","text":"

                                                                                  SM2 uses the parameters defined in \"Common EC parameters\" in EVP_PKEY-EC(7). The following parameters are different:

                                                                                  • \"cofactor\" (OSSL_PKEY_PARAM_EC_COFACTOR) <unsigned integer>

                                                                                    This parameter is ignored for SM2.

                                                                                  • (OSSL_PKEY_PARAM_DEFAULT_DIGEST)

                                                                                    Getter that returns the default digest name. (Currently returns \"SM3\" as of OpenSSL 3.0).

                                                                                    "},{"location":"man7/EVP_PKEY-SM2/#notes","title":"NOTES","text":"

                                                                                    SM2 signatures can be generated by using the 'DigestSign' series of APIs, for instance, EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal(). Ditto for the verification process by calling the 'DigestVerify' series of APIs. Note that the SM2 algorithm requires the presence of the public key for signatures, as such the OSSL_PKEY_PARAM_PUB_KEY option must be set on any key used in signature generation.

                                                                                    Before computing an SM2 signature, an EVP_PKEY_CTX needs to be created, and an SM2 ID must be set for it, like this:

                                                                                    EVP_PKEY_CTX_set1_id(pctx, id, id_len);\n

                                                                                    Before calling the EVP_DigestSignInit() or EVP_DigestVerifyInit() functions, that EVP_PKEY_CTX should be assigned to the EVP_MD_CTX, like this:

                                                                                    EVP_MD_CTX_set_pkey_ctx(mctx, pctx);\n

                                                                                    There is normally no need to pass a pctx parameter to EVP_DigestSignInit() or EVP_DigestVerifyInit() in such a scenario.

                                                                                    SM2 can be tested with the openssl-speed(1) application since version 3.0. Currently, the only valid algorithm name is sm2.

                                                                                    Since version 3.0, SM2 keys can be generated and loaded only when the domain parameters specify the SM2 elliptic curve.

                                                                                    "},{"location":"man7/EVP_PKEY-SM2/#examples","title":"EXAMPLES","text":"

                                                                                    This example demonstrates the calling sequence for using an EVP_PKEY to verify a message with the SM2 signature algorithm and the SM3 hash algorithm:

                                                                                    #include <openssl/evp.h>\n\n/* obtain an EVP_PKEY using whatever methods... */\nmctx = EVP_MD_CTX_new();\npctx = EVP_PKEY_CTX_new(pkey, NULL);\nEVP_PKEY_CTX_set1_id(pctx, id, id_len);\nEVP_MD_CTX_set_pkey_ctx(mctx, pctx);\nEVP_DigestVerifyInit(mctx, NULL, EVP_sm3(), NULL, pkey);\nEVP_DigestVerifyUpdate(mctx, msg, msg_len);\nEVP_DigestVerifyFinal(mctx, sig, sig_len)\n
                                                                                    "},{"location":"man7/EVP_PKEY-SM2/#see-also","title":"SEE ALSO","text":"

                                                                                    EVP_PKEY_CTX_new(3), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3), EVP_PKEY_CTX_set1_id(3), EVP_MD_CTX_set_pkey_ctx(3)

                                                                                    "},{"location":"man7/EVP_PKEY-SM2/#copyright","title":"COPYRIGHT","text":"

                                                                                    Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                    "},{"location":"man7/EVP_PKEY-X25519/","title":"EVP_PKEY-X25519","text":""},{"location":"man7/EVP_PKEY-X25519/#name","title":"NAME","text":"

                                                                                    EVP_PKEY-X25519, EVP_PKEY-X448, EVP_PKEY-ED25519, EVP_PKEY-ED448, EVP_KEYMGMT-X25519, EVP_KEYMGMT-X448, EVP_KEYMGMT-ED25519, EVP_KEYMGMT-ED448 - EVP_PKEY X25519, X448, ED25519 and ED448 keytype and algorithm support

                                                                                    "},{"location":"man7/EVP_PKEY-X25519/#description","title":"DESCRIPTION","text":"

                                                                                    The X25519, X448, ED25519 and ED448 keytypes are implemented in OpenSSL's default and FIPS providers. These implementations support the associated key, containing the public key pub and the private key priv.

                                                                                    No additional parameters can be set during key generation.

                                                                                    "},{"location":"man7/EVP_PKEY-X25519/#common-x25519-x448-ed25519-and-ed448-parameters","title":"Common X25519, X448, ED25519 and ED448 parameters","text":"

                                                                                    In addition to the common parameters that all keytypes should support (see \"Common parameters\" in provider-keymgmt(7)), the implementation of these keytypes support the following.

                                                                                    • \"group\" (OSSL_PKEY_PARAM_GROUP_NAME)

                                                                                      This is only supported by X25519 and X448. The group name must be \"x25519\" or \"x448\" respectively for those algorithms. This is only present for consistency with other key exchange algorithms and is typically not needed.

                                                                                    • \"pub\" (OSSL_PKEY_PARAM_PUB_KEY) <octet string>

                                                                                      The public key value.

                                                                                    • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string>

                                                                                      The private key value.

                                                                                    • \"encoded-pub-key\" (OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY) <octet string>

                                                                                      Used for getting and setting the encoding of a public key for the X25519 and X448 key types. Public keys are expected be encoded in a format as defined by RFC7748.

                                                                                    • "},{"location":"man7/EVP_PKEY-X25519/#ed25519-and-ed448-parameters","title":"ED25519 and ED448 parameters","text":"
                                                                                      • \"mandatory-digest\" (OSSL_PKEY_PARAM_MANDATORY_DIGEST)

                                                                                        The empty string, signifying that no digest may be specified.

                                                                                        "},{"location":"man7/EVP_PKEY-X25519/#conforming-to","title":"CONFORMING TO","text":"
                                                                                        • RFC 8032
                                                                                        • RFC 8410
                                                                                        "},{"location":"man7/EVP_PKEY-X25519/#examples","title":"EXAMPLES","text":"

                                                                                        An EVP_PKEY context can be obtained by calling:

                                                                                        EVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"X25519\", NULL);\n\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"X448\", NULL);\n\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"ED25519\", NULL);\n\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"ED448\", NULL);\n

                                                                                        An X25519 key can be generated like this:

                                                                                        pkey = EVP_PKEY_Q_keygen(NULL, NULL, \"X25519\");\n

                                                                                        An X448, ED25519, or ED448 key can be generated likewise.

                                                                                        "},{"location":"man7/EVP_PKEY-X25519/#see-also","title":"SEE ALSO","text":"

                                                                                        EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7), EVP_KEYEXCH-X25519(7), EVP_KEYEXCH-X448(7), EVP_SIGNATURE-ED25519(7), EVP_SIGNATURE-ED448(7)

                                                                                        "},{"location":"man7/EVP_PKEY-X25519/#copyright","title":"COPYRIGHT","text":"

                                                                                        Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                        "},{"location":"man7/EVP_RAND-CTR-DRBG/","title":"EVP_RAND-CTR-DRBG","text":""},{"location":"man7/EVP_RAND-CTR-DRBG/#name","title":"NAME","text":"

                                                                                        EVP_RAND-CTR-DRBG - The CTR DRBG EVP_RAND implementation

                                                                                        "},{"location":"man7/EVP_RAND-CTR-DRBG/#description","title":"DESCRIPTION","text":"

                                                                                        Support for the counter deterministic random bit generator through the EVP_RAND API.

                                                                                        "},{"location":"man7/EVP_RAND-CTR-DRBG/#identity","title":"Identity","text":"

                                                                                        \"CTR-DRBG\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                        "},{"location":"man7/EVP_RAND-CTR-DRBG/#supported-parameters","title":"Supported parameters","text":"

                                                                                        The supported parameters are:

                                                                                        • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                        • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                        • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
                                                                                        • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                        • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                        • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                        • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                        • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                        • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                        • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                        • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                        • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
                                                                                        • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)
                                                                                        • \"cipher\" (OSSL_DRBG_PARAM_CIPHER)

                                                                                          These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                        • \"use_derivation_function\" (OSSL_DRBG_PARAM_USE_DF) <integer>

                                                                                          This Boolean indicates if a derivation function should be used or not. A nonzero value (the default) uses the derivation function. A zero value does not.

                                                                                        • "},{"location":"man7/EVP_RAND-CTR-DRBG/#notes","title":"NOTES","text":"

                                                                                          A context for CTR DRBG can be obtained by calling:

                                                                                          EVP_RAND *rand = EVP_RAND_fetch(NULL, \"CTR-DRBG\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                          "},{"location":"man7/EVP_RAND-CTR-DRBG/#examples","title":"EXAMPLES","text":"
                                                                                          EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[2], *p = params;\nunsigned int strength = 128;\n\nrand = EVP_RAND_fetch(NULL, \"CTR-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,\n                                        SN_aes_256_ctr, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                          "},{"location":"man7/EVP_RAND-CTR-DRBG/#conforming-to","title":"CONFORMING TO","text":"

                                                                                          NIST SP 800-90A and SP 800-90B

                                                                                          "},{"location":"man7/EVP_RAND-CTR-DRBG/#see-also","title":"SEE ALSO","text":"

                                                                                          EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3)

                                                                                          "},{"location":"man7/EVP_RAND-CTR-DRBG/#copyright","title":"COPYRIGHT","text":"

                                                                                          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                          "},{"location":"man7/EVP_RAND-HASH-DRBG/","title":"EVP_RAND-HASH-DRBG","text":""},{"location":"man7/EVP_RAND-HASH-DRBG/#name","title":"NAME","text":"

                                                                                          EVP_RAND-HASH-DRBG - The HASH DRBG EVP_RAND implementation

                                                                                          "},{"location":"man7/EVP_RAND-HASH-DRBG/#description","title":"DESCRIPTION","text":"

                                                                                          Support for the hash deterministic random bit generator through the EVP_RAND API.

                                                                                          "},{"location":"man7/EVP_RAND-HASH-DRBG/#identity","title":"Identity","text":"

                                                                                          \"HASH-DRBG\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                          "},{"location":"man7/EVP_RAND-HASH-DRBG/#supported-parameters","title":"Supported parameters","text":"

                                                                                          The supported parameters are:

                                                                                          • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                          • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                          • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
                                                                                          • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                          • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                          • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                          • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                          • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                          • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                          • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                          • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                          • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
                                                                                          • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)
                                                                                          • \"digest\" (OSSL_DRBG_PARAM_DIGEST)

                                                                                            These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                            "},{"location":"man7/EVP_RAND-HASH-DRBG/#notes","title":"NOTES","text":"

                                                                                            When the FIPS provider is installed using the -no_drbg_truncated_digests option to fipsinstall, only these digests are permitted (as per FIPS 140-3 IG D.R):

                                                                                            • SHA-1
                                                                                            • SHA2-256
                                                                                            • SHA2-512
                                                                                            • SHA3-256
                                                                                            • SHA3-512

                                                                                            A context for HASH DRBG can be obtained by calling:

                                                                                            EVP_RAND *rand = EVP_RAND_fetch(NULL, \"HASH-DRBG\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                            "},{"location":"man7/EVP_RAND-HASH-DRBG/#examples","title":"EXAMPLES","text":"
                                                                                            EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[2], *p = params;\nunsigned int strength = 128;\n\nrand = EVP_RAND_fetch(NULL, \"HASH-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha512, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                            "},{"location":"man7/EVP_RAND-HASH-DRBG/#conforming-to","title":"CONFORMING TO","text":"

                                                                                            NIST SP 800-90A and SP 800-90B

                                                                                            "},{"location":"man7/EVP_RAND-HASH-DRBG/#see-also","title":"SEE ALSO","text":"

                                                                                            EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3), openssl-fipsinstall(1)

                                                                                            "},{"location":"man7/EVP_RAND-HASH-DRBG/#history","title":"HISTORY","text":"

                                                                                            OpenSSL 3.1.1 introduced the -no_drbg_truncated_digests option to fipsinstall which restricts the permitted digests when using the FIPS provider in a complaint manner. For details refer to FIPS 140-3 IG D.R.

                                                                                            "},{"location":"man7/EVP_RAND-HASH-DRBG/#copyright","title":"COPYRIGHT","text":"

                                                                                            Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                            "},{"location":"man7/EVP_RAND-HMAC-DRBG/","title":"EVP_RAND-HMAC-DRBG","text":""},{"location":"man7/EVP_RAND-HMAC-DRBG/#name","title":"NAME","text":"

                                                                                            EVP_RAND-HMAC-DRBG - The HMAC DRBG EVP_RAND implementation

                                                                                            "},{"location":"man7/EVP_RAND-HMAC-DRBG/#description","title":"DESCRIPTION","text":"

                                                                                            Support for the HMAC deterministic random bit generator through the EVP_RAND API.

                                                                                            "},{"location":"man7/EVP_RAND-HMAC-DRBG/#identity","title":"Identity","text":"

                                                                                            \"HMAC-DRBG\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                            "},{"location":"man7/EVP_RAND-HMAC-DRBG/#supported-parameters","title":"Supported parameters","text":"

                                                                                            The supported parameters are:

                                                                                            • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                            • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                            • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
                                                                                            • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                            • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                            • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                            • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                            • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                            • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                            • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                            • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                            • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
                                                                                            • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)
                                                                                            • \"mac\" (OSSL_DRBG_PARAM_MAC)
                                                                                            • \"digest\" (OSSL_DRBG_PARAM_DIGEST)

                                                                                              These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                              "},{"location":"man7/EVP_RAND-HMAC-DRBG/#notes","title":"NOTES","text":"

                                                                                              When using the FIPS provider, only these digests are permitted (as per FIPS 140-3 IG D.R):

                                                                                              • SHA-1
                                                                                              • SHA2-256
                                                                                              • SHA2-512
                                                                                              • SHA3-256
                                                                                              • SHA3-512

                                                                                              A context for HMAC DRBG can be obtained by calling:

                                                                                              EVP_RAND *rand = EVP_RAND_fetch(NULL, \"HMAC-DRBG\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                              "},{"location":"man7/EVP_RAND-HMAC-DRBG/#examples","title":"EXAMPLES","text":"
                                                                                              EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[3], *p = params;\nunsigned int strength = 128;\n\nrand = EVP_RAND_fetch(NULL, \"HMAC-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_MAC, SN_hmac, 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha256, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                              "},{"location":"man7/EVP_RAND-HMAC-DRBG/#conforming-to","title":"CONFORMING TO","text":"

                                                                                              NIST SP 800-90A and SP 800-90B

                                                                                              "},{"location":"man7/EVP_RAND-HMAC-DRBG/#see-also","title":"SEE ALSO","text":"

                                                                                              EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3), openssl-fipsinstall(1)

                                                                                              "},{"location":"man7/EVP_RAND-HMAC-DRBG/#history","title":"HISTORY","text":"

                                                                                              OpenSSL 3.1.1 introduced the -no_drbg_truncated_digests option to fipsinstall which restricts the permitted digests when using the FIPS provider in a complaint manner. For details refer to FIPS 140-3 IG D.R).

                                                                                              "},{"location":"man7/EVP_RAND-HMAC-DRBG/#copyright","title":"COPYRIGHT","text":"

                                                                                              Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/","title":"EVP_RAND-SEED-SRC","text":""},{"location":"man7/EVP_RAND-SEED-SRC/#name","title":"NAME","text":"

                                                                                              EVP_RAND-SEED-SRC - The randomness seed source EVP_RAND implementation

                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/#description","title":"DESCRIPTION","text":"

                                                                                              Support for deterministic random number generator seeding through the EVP_RAND API.

                                                                                              The seed sources used are specified at the time OpenSSL is configured for building using the --with-rand-seed= option. By default, operating system randomness sources are used.

                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/#identity","title":"Identity","text":"

                                                                                              \"SEED-SRC\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/#supported-parameters","title":"Supported parameters","text":"

                                                                                              The supported parameters are:

                                                                                              • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                              • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                              • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>

                                                                                                These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/#notes","title":"NOTES","text":"

                                                                                              A context for the seed source can be obtained by calling:

                                                                                              EVP_RAND *rand = EVP_RAND_fetch(NULL, \"SEED-SRC\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/#examples","title":"EXAMPLES","text":"
                                                                                              EVP_RAND *rand;\nEVP_RAND_CTX *seed, *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[2], *p = params;\nunsigned int strength = 128;\n\n/* Create and instantiate a seed source */\nrand = EVP_RAND_fetch(NULL, \"SEED-SRC\", NULL);\nseed = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_instantiate(seed, strength, 0, NULL, 0, NULL);\nEVP_RAND_free(rand);\n\n/* Feed this into a DRBG */\nrand = EVP_RAND_fetch(NULL, \"CTR-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, seed);\nEVP_RAND_free(rand);\n\n/* Configure the DRBG */\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,\n                                        SN_aes_256_ctr, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\nEVP_RAND_CTX_free(seed);\n
                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/#see-also","title":"SEE ALSO","text":"

                                                                                              EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3)

                                                                                              "},{"location":"man7/EVP_RAND-SEED-SRC/#copyright","title":"COPYRIGHT","text":"

                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/","title":"EVP_RAND-TEST-RAND","text":""},{"location":"man7/EVP_RAND-TEST-RAND/#name","title":"NAME","text":"

                                                                                              EVP_RAND-TEST-RAND - The test EVP_RAND implementation

                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#description","title":"DESCRIPTION","text":"

                                                                                              Support for a test generator through the EVP_RAND API. This generator is for test purposes only, it does not generate random numbers.

                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#identity","title":"Identity","text":"

                                                                                              \"TEST-RAND\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#supported-parameters","title":"Supported parameters","text":"

                                                                                              The supported parameters are:

                                                                                              • \"state\" (OSSL_RAND_PARAM_STATE) <integer>

                                                                                                These parameter works as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                              • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>

                                                                                              • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                              • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                              • \"max_request\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                              • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                              • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                              • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                              • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                              • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                              • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                              • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>

                                                                                                These parameters work as described in \"PARAMETERS\" in EVP_RAND(3), except that they can all be set as well as read.

                                                                                              • \"test_entropy\" (OSSL_RAND_PARAM_TEST_ENTROPY) <octet string>

                                                                                                Sets the bytes returned when the test generator is sent an entropy request. The current position is remembered across generate calls. If there are insufficient data present to satisfy a call, an error is returned.

                                                                                              • \"test_nonce\" (OSSL_RAND_PARAM_TEST_NONCE) <octet string>

                                                                                                Sets the bytes returned when the test generator is sent a nonce request. Each nonce request will return all of the bytes.

                                                                                              • \"generate\" (OSSL_RAND_PARAM_GENERATE) <integer>

                                                                                                If this parameter is zero, it will only emit the nonce and entropy data supplied via the aforementioned parameters. Otherwise, low quality non-cryptographic pseudorandom output is produced. This parameter defaults to zero.

                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#notes","title":"NOTES","text":"

                                                                                              A context for a test generator can be obtained by calling:

                                                                                              EVP_RAND *rand = EVP_RAND_fetch(NULL, \"TEST-RAND\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#examples","title":"EXAMPLES","text":"
                                                                                              EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[4], *p = params;\nunsigned char entropy[1000] = { ... };\nunsigned char nonce[20] = { ... };\nunsigned int strength = 48;\n\nrand = EVP_RAND_fetch(NULL, \"TEST-RAND\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, &strength);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_ENTROPY,\n                                         entropy, sizeof(entropy));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_NONCE,\n                                         nonce, sizeof(nonce));\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#see-also","title":"SEE ALSO","text":"

                                                                                              EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3)

                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#history","title":"HISTORY","text":"

                                                                                              This functionality was added in OpenSSL 3.0.

                                                                                              "},{"location":"man7/EVP_RAND-TEST-RAND/#copyright","title":"COPYRIGHT","text":"

                                                                                              Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                              "},{"location":"man7/EVP_RAND/","title":"EVP_RAND","text":""},{"location":"man7/EVP_RAND/#name","title":"NAME","text":"

                                                                                              EVP_RAND - the random bit generator

                                                                                              "},{"location":"man7/EVP_RAND/#synopsis","title":"SYNOPSIS","text":"
                                                                                              #include <openssl/evp.h>\n#include <rand.h>\n
                                                                                              "},{"location":"man7/EVP_RAND/#description","title":"DESCRIPTION","text":"

                                                                                              The default OpenSSL RAND method is based on the EVP_RAND classes to provide non-deterministic inputs to other cryptographic algorithms.

                                                                                              While the RAND API is the 'frontend' which is intended to be used by application developers for obtaining random bytes, the EVP_RAND API serves as the 'backend', connecting the former with the operating systems's entropy sources and providing access to deterministic random bit generators (DRBG) and their configuration parameters. A DRBG is a certain type of cryptographically-secure pseudo-random number generator (CSPRNG), which is described in [NIST SP 800-90A Rev. 1].

                                                                                              "},{"location":"man7/EVP_RAND/#disclaimer","title":"Disclaimer","text":"

                                                                                              Unless you have very specific requirements for your random generator, it is in general not necessary to utilize the EVP_RAND API directly. The usual way to obtain random bytes is to use RAND_bytes(3) or RAND_priv_bytes(3), see also RAND(7).

                                                                                              "},{"location":"man7/EVP_RAND/#typical-use-cases","title":"Typical Use Cases","text":"

                                                                                              Typical examples for such special use cases are the following:

                                                                                              • You want to use your own private DRBG instances. Multiple DRBG instances which are accessed only by a single thread provide additional security (because their internal states are independent) and better scalability in multithreaded applications (because they don't need to be locked).
                                                                                              • You need to integrate a previously unsupported entropy source. Refer to provider-rand(7) for the implementation details to support adding randomness sources to EVP_RAND.
                                                                                              • You need to change the default settings of the standard OpenSSL RAND implementation to meet specific requirements.
                                                                                              "},{"location":"man7/EVP_RAND/#evp_rand-chaining","title":"EVP_RAND CHAINING","text":"

                                                                                              An EVP_RAND instance can be used as the entropy source of another EVP_RAND instance, provided it has itself access to a valid entropy source. The EVP_RAND instance which acts as entropy source is called the parent, the other instance the child. Typically, the child will be a DRBG because it does not make sense for the child to be an entropy source.

                                                                                              This is called chaining. A chained EVP_RAND instance is created by passing a pointer to the parent EVP_RAND_CTX as argument to the EVP_RAND_CTX_new() call. It is possible to create chains of more than two DRBG in a row. It is also possible to use any EVP_RAND_CTX class as the parent, however, only a live entropy source may ignore and not use its parent.

                                                                                              "},{"location":"man7/EVP_RAND/#the-three-shared-drbg-instances","title":"THE THREE SHARED DRBG INSTANCES","text":"

                                                                                              Currently, there are three shared DRBG instances, the <primary>, <public>, and <private> DRBG. While the <primary> DRBG is a single global instance, the <public> and <private> DRBG are created per thread and accessed through thread-local storage.

                                                                                              By default, the functions RAND_bytes(3) and RAND_priv_bytes(3) use the thread-local <public> and <private> DRBG instance, respectively.

                                                                                              "},{"location":"man7/EVP_RAND/#the-primary-drbg-instance","title":"The <primary> DRBG instance","text":"

                                                                                              The <primary> DRBG is not used directly by the application, only for reseeding the two other two DRBG instances. It reseeds itself by obtaining randomness either from os entropy sources or by consuming randomness which was added previously by RAND_add(3).

                                                                                              "},{"location":"man7/EVP_RAND/#the-public-drbg-instance","title":"The <public> DRBG instance","text":"

                                                                                              This instance is used per default by RAND_bytes(3).

                                                                                              "},{"location":"man7/EVP_RAND/#the-private-drbg-instance","title":"The <private> DRBG instance","text":"

                                                                                              This instance is used per default by RAND_priv_bytes(3)

                                                                                              "},{"location":"man7/EVP_RAND/#locking","title":"LOCKING","text":"

                                                                                              The <primary> DRBG is intended to be accessed concurrently for reseeding by its child DRBG instances. The necessary locking is done internally. It is not thread-safe to access the <primary> DRBG directly via the EVP_RAND interface. The <public> and <private> DRBG are thread-local, i.e. there is an instance of each per thread. So they can safely be accessed without locking via the EVP_RAND interface.

                                                                                              Pointers to these DRBG instances can be obtained using RAND_get0_primary(), RAND_get0_public() and RAND_get0_private(), respectively. Note that it is not allowed to store a pointer to one of the thread-local DRBG instances in a variable or other memory location where it will be accessed and used by multiple threads.

                                                                                              All other DRBG instances created by an application don't support locking, because they are intended to be used by a single thread. Instead of accessing a single DRBG instance concurrently from different threads, it is recommended to instantiate a separate DRBG instance per thread. Using the <primary> DRBG as entropy source for multiple DRBG instances on different threads is thread-safe, because the DRBG instance will lock the <primary> DRBG automatically for obtaining random input.

                                                                                              "},{"location":"man7/EVP_RAND/#the-overall-picture","title":"THE OVERALL PICTURE","text":"

                                                                                              The following picture gives an overview over how the DRBG instances work together and are being used.

                                                                                                         +--------------------+\n           | os entropy sources |\n           +--------------------+\n                    |\n                    v           +-----------------------------+\n RAND_add() ==> <primary>     <-| shared DRBG (with locking)  |\n                  /   \\         +-----------------------------+\n                 /     \\              +---------------------------+\n          <public>     <private>   <- | per-thread DRBG instances |\n             |             |          +---------------------------+\n             v             v\n           RAND_bytes()   RAND_priv_bytes()\n                |               ^\n                |               |\n+------------------+      +------------------------------------+\n| general purpose  |      | used for secrets like session keys |\n| random generator |      | and private keys for certificates  |\n+------------------+      +------------------------------------+\n

                                                                                              The usual way to obtain random bytes is to call RAND_bytes(...) or RAND_priv_bytes(...). These calls are roughly equivalent to calling EVP_RAND_generate(<public>, ...) and EVP_RAND_generate(<private>, ...), respectively.

                                                                                              "},{"location":"man7/EVP_RAND/#reseeding","title":"RESEEDING","text":"

                                                                                              A DRBG instance seeds itself automatically, pulling random input from its entropy source. The entropy source can be either a trusted operating system entropy source, or another DRBG with access to such a source.

                                                                                              Automatic reseeding occurs after a predefined number of generate requests. The selection of the trusted entropy sources is configured at build time using the --with-rand-seed option. The following sections explain the reseeding process in more detail.

                                                                                              "},{"location":"man7/EVP_RAND/#automatic-reseeding","title":"Automatic Reseeding","text":"

                                                                                              Before satisfying a generate request (EVP_RAND_generate(3)), the DRBG reseeds itself automatically, if one of the following conditions holds:

                                                                                              - the DRBG was not instantiated (=seeded) yet or has been uninstantiated.

                                                                                              - the number of generate requests since the last reseeding exceeds a certain threshold, the so called reseed_interval. This behaviour can be disabled by setting the reseed_interval to 0.

                                                                                              - the time elapsed since the last reseeding exceeds a certain time interval, the so called reseed_time_interval. This can be disabled by setting the reseed_time_interval to 0.

                                                                                              - the DRBG is in an error state.

                                                                                              Note: An error state is entered if the entropy source fails while the DRBG is seeding or reseeding. The last case ensures that the DRBG automatically recovers from the error as soon as the entropy source is available again.

                                                                                              "},{"location":"man7/EVP_RAND/#manual-reseeding","title":"Manual Reseeding","text":"

                                                                                              In addition to automatic reseeding, the caller can request an immediate reseeding of the DRBG with fresh entropy by setting the prediction resistance parameter to 1 when calling EVP_RAND_generate(3).

                                                                                              The document [NIST SP 800-90C] describes prediction resistance requests in detail and imposes strict conditions on the entropy sources that are approved for providing prediction resistance. A request for prediction resistance can only be satisfied by pulling fresh entropy from a live entropy source (section 5.5.2 of [NIST SP 800-90C]). It is up to the user to ensure that a live entropy source is configured and is being used.

                                                                                              For the three shared DRBGs (and only for these) there is another way to reseed them manually: If RAND_add(3) is called with a positive randomness argument (or RAND_seed(3)), then this will immediately reseed the <primary> DRBG. The <public> and <private> DRBG will detect this on their next generate call and reseed, pulling randomness from <primary>.

                                                                                              The last feature has been added to support the common practice used with previous OpenSSL versions to call RAND_add() before calling RAND_bytes().

                                                                                              "},{"location":"man7/EVP_RAND/#entropy-input-and-additional-data","title":"Entropy Input and Additional Data","text":"

                                                                                              The DRBG distinguishes two different types of random input: entropy, which comes from a trusted source, and additional input', which can optionally be added by the user and is considered untrusted. It is possible to add additional input not only during reseeding, but also for every generate request.

                                                                                              "},{"location":"man7/EVP_RAND/#configuring-the-random-seed-source","title":"Configuring the Random Seed Source","text":"

                                                                                              In most cases OpenSSL will automatically choose a suitable seed source for automatically seeding and reseeding its <primary> DRBG. In some cases however, it will be necessary to explicitly specify a seed source during configuration, using the --with-rand-seed option. For more information, see the INSTALL instructions. There are also operating systems where no seed source is available and automatic reseeding is disabled by default.

                                                                                              The following two sections describe the reseeding process of the primary DRBG, depending on whether automatic reseeding is available or not.

                                                                                              "},{"location":"man7/EVP_RAND/#reseeding-the-primary-drbg-with-automatic-seeding-enabled","title":"Reseeding the primary DRBG with automatic seeding enabled","text":"

                                                                                              Calling RAND_poll() or RAND_add() is not necessary, because the DRBG pulls the necessary entropy from its source automatically. However, both calls are permitted, and do reseed the RNG.

                                                                                              RAND_add() can be used to add both kinds of random input, depending on the value of the randomness argument:

                                                                                              • randomness == 0:

                                                                                                The random bytes are mixed as additional input into the current state of the DRBG. Mixing in additional input is not considered a full reseeding, hence the reseed counter is not reset.

                                                                                              • randomness > 0:

                                                                                                The random bytes are used as entropy input for a full reseeding (resp. reinstantiation) if the DRBG is instantiated (resp. uninstantiated or in an error state). The number of random bits required for reseeding is determined by the security strength of the DRBG. Currently it defaults to 256 bits (32 bytes). It is possible to provide less randomness than required. In this case the missing randomness will be obtained by pulling random input from the trusted entropy sources.

                                                                                              NOTE: Manual reseeding is *not allowed* in FIPS mode, because [NIST SP-800-90Ar1] mandates that entropy *shall not* be provided by the consuming application for instantiation (Section 9.1) or reseeding (Section 9.2). For that reason, the randomness argument is ignored and the random bytes provided by the RAND_add(3) and RAND_seed(3) calls are treated as additional data.

                                                                                              "},{"location":"man7/EVP_RAND/#reseeding-the-primary-drbg-with-automatic-seeding-disabled","title":"Reseeding the primary DRBG with automatic seeding disabled","text":"

                                                                                              Calling RAND_poll() will always fail.

                                                                                              RAND_add() needs to be called for initial seeding and periodic reseeding. At least 48 bytes (384 bits) of randomness have to be provided, otherwise the (re-)seeding of the DRBG will fail. This corresponds to one and a half times the security strength of the DRBG. The extra half is used for the nonce during instantiation.

                                                                                              More precisely, the number of bytes needed for seeding depend on the security strength of the DRBG, which is set to 256 by default.

                                                                                              "},{"location":"man7/EVP_RAND/#see-also","title":"SEE ALSO","text":"

                                                                                              RAND(7), EVP_RAND(3)

                                                                                              "},{"location":"man7/EVP_RAND/#history","title":"HISTORY","text":"

                                                                                              This functionality was added in OpenSSL 3.0.

                                                                                              "},{"location":"man7/EVP_RAND/#copyright","title":"COPYRIGHT","text":"

                                                                                              Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                              "},{"location":"man7/EVP_SIGNATURE-DSA/","title":"EVP_SIGNATURE-DSA","text":""},{"location":"man7/EVP_SIGNATURE-DSA/#name","title":"NAME","text":"

                                                                                              EVP_SIGNATURE-DSA - The EVP_PKEY DSA signature implementation

                                                                                              "},{"location":"man7/EVP_SIGNATURE-DSA/#description","title":"DESCRIPTION","text":"

                                                                                              Support for computing DSA signatures. See EVP_PKEY-DSA(7) for information related to DSA keys.

                                                                                              "},{"location":"man7/EVP_SIGNATURE-DSA/#signature-parameters","title":"Signature Parameters","text":"

                                                                                              The following signature parameters can be set using EVP_PKEY_CTX_set_params(). This may be called after EVP_PKEY_sign_init() or EVP_PKEY_verify_init(), and before calling EVP_PKEY_sign() or EVP_PKEY_verify().

                                                                                              • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)
                                                                                              • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                The settable parameters are described in provider-signature(7).

                                                                                                The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>
                                                                                                • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                  The gettable parameters are described in provider-signature(7).

                                                                                                  "},{"location":"man7/EVP_SIGNATURE-DSA/#see-also","title":"SEE ALSO","text":"

                                                                                                  EVP_PKEY_CTX_set_params(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), provider-signature(7),

                                                                                                  "},{"location":"man7/EVP_SIGNATURE-DSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                  Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                  "},{"location":"man7/EVP_SIGNATURE-ECDSA/","title":"EVP_SIGNATURE-ECDSA","text":""},{"location":"man7/EVP_SIGNATURE-ECDSA/#name","title":"NAME","text":"

                                                                                                  EVP_SIGNATURE-ECDSA - The EVP_PKEY ECDSA signature implementation.

                                                                                                  "},{"location":"man7/EVP_SIGNATURE-ECDSA/#description","title":"DESCRIPTION","text":"

                                                                                                  Support for computing ECDSA signatures. See EVP_PKEY-EC(7) for information related to EC keys.

                                                                                                  "},{"location":"man7/EVP_SIGNATURE-ECDSA/#ecdsa-signature-parameters","title":"ECDSA Signature Parameters","text":"

                                                                                                  The following signature parameters can be set using EVP_PKEY_CTX_set_params(). This may be called after EVP_PKEY_sign_init() or EVP_PKEY_verify_init(), and before calling EVP_PKEY_sign() or EVP_PKEY_verify().

                                                                                                  • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)
                                                                                                  • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                    These parameters are described in provider-signature(7).

                                                                                                    The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                    • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>
                                                                                                    • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                      The parameters are described in provider-signature(7).

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ECDSA/#see-also","title":"SEE ALSO","text":"

                                                                                                      EVP_PKEY_CTX_set_params(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), provider-signature(7),

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ECDSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ED25519/","title":"EVP_SIGNATURE-ED25519","text":""},{"location":"man7/EVP_SIGNATURE-ED25519/#name","title":"NAME","text":"

                                                                                                      EVP_SIGNATURE-ED25519, EVP_SIGNATURE-ED448, Ed25519, Ed448 - EVP_PKEY Ed25519 and Ed448 support

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ED25519/#description","title":"DESCRIPTION","text":"

                                                                                                      The Ed25519 and Ed448 EVP_PKEY implementation supports key generation, one-shot digest sign and digest verify using PureEdDSA and Ed25519 or Ed448 (see RFC8032). It has associated private and public key formats compatible with RFC 8410.

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ED25519/#ed25519-and-ed448-signature-parameters","title":"ED25519 and ED448 Signature Parameters","text":"

                                                                                                      No additional parameters can be set during one-shot signing or verification. In particular, because PureEdDSA is used, a digest must NOT be specified when signing or verifying. See EVP_PKEY-X25519(7) for information related to X25519 and X448 keys.

                                                                                                      The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                      • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>

                                                                                                        The parameters are described in provider-signature(7).

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ED25519/#notes","title":"NOTES","text":"

                                                                                                      The PureEdDSA algorithm does not support the streaming mechanism of other signature algorithms using, for example, EVP_DigestUpdate(). The message to sign or verify must be passed using the one-shot EVP_DigestSign() and EVP_DigestVerify() functions.

                                                                                                      When calling EVP_DigestSignInit() or EVP_DigestVerifyInit(), the digest type parameter MUST be set to NULL.

                                                                                                      Applications wishing to sign certificates (or other structures such as CRLs or certificate requests) using Ed25519 or Ed448 can either use X509_sign() or X509_sign_ctx() in the usual way.

                                                                                                      Ed25519 or Ed448 private keys can be set directly using EVP_PKEY_new_raw_private_key(3) or loaded from a PKCS#8 private key file using PEM_read_bio_PrivateKey(3) (or similar function). Completely new keys can also be generated (see the example below). Setting a private key also sets the associated public key.

                                                                                                      Ed25519 or Ed448 public keys can be set directly using EVP_PKEY_new_raw_public_key(3) or loaded from a SubjectPublicKeyInfo structure in a PEM file using PEM_read_bio_PUBKEY(3) (or similar function).

                                                                                                      Ed25519 and Ed448 can be tested with the openssl-speed(1) application since version 1.1.1. Valid algorithm names are ed25519, ed448 and eddsa. If eddsa is specified, then both Ed25519 and Ed448 are benchmarked.

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ED25519/#examples","title":"EXAMPLES","text":"

                                                                                                      To sign a message using a ED25519 or ED448 key:

                                                                                                      void do_sign(EVP_PKEY *ed_key, unsigned char *msg, size_t msg_len)\n{\n    size_t sig_len;\n    unsigned char *sig = NULL;\n    EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();\n\n    EVP_DigestSignInit(md_ctx, NULL, NULL, NULL, ed_key);\n    /* Calculate the requires size for the signature by passing a NULL buffer */\n    EVP_DigestSign(md_ctx, NULL, &sig_len, msg, msg_len);\n    sig = OPENSSL_zalloc(sig_len);\n\n    EVP_DigestSign(md_ctx, sig, &sig_len, msg, msg_len);\n    ...\n    OPENSSL_free(sig);\n    EVP_MD_CTX_free(md_ctx);\n}\n
                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ED25519/#see-also","title":"SEE ALSO","text":"

                                                                                                      EVP_PKEY-X25519(7) provider-signature(7), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3),

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ED25519/#copyright","title":"COPYRIGHT","text":"

                                                                                                      Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-HMAC/","title":"EVP_SIGNATURE-HMAC","text":""},{"location":"man7/EVP_SIGNATURE-HMAC/#name","title":"NAME","text":"

                                                                                                      EVP_SIGNATURE-HMAC, EVP_SIGNATURE-Siphash, EVP_SIGNATURE-Poly1305, EVP_SIGNATURE-CMAC - The legacy EVP_PKEY MAC signature implementations

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-HMAC/#description","title":"DESCRIPTION","text":"

                                                                                                      The algorithms described here have legacy support for creating MACs using EVP_DigestSignInit(3) and related functions. This is not the preferred way of creating MACs. Instead you should use the newer EVP_MAC_init(3) functions. This mechanism is provided for backwards compatibility with older versions of OpenSSL.

                                                                                                      The same signature parameters can be set using EVP_PKEY_CTX_set_params() as can be set via EVP_MAC_CTX_set_params() for the underlying EVP_MAC. See EVP_MAC-HMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7) and EVP_MAC-CMAC(7) for details.

                                                                                                      See L<EVP_PKEY-HMAC(7)>, L<EVP_PKEY-Siphash(7)>, L<EVP_PKEY-Poly1305(7)> or\nL<EVP_PKEY-CMAC(7)> for details about parameters that are supported during the\ncreation of an EVP_PKEY.\n
                                                                                                      "},{"location":"man7/EVP_SIGNATURE-HMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                      EVP_MAC_init(3), EVP_DigestSignInit(3), EVP_PKEY-HMAC(7), EVP_PKEY-Siphash(7), EVP_PKEY-Poly1305(7), EVP_PKEY-CMAC(7), EVP_MAC-HMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7), EVP_MAC-CMAC(7), provider-signature(7),

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-RSA/","title":"EVP_SIGNATURE-RSA","text":""},{"location":"man7/EVP_SIGNATURE-RSA/#name","title":"NAME","text":"

                                                                                                      EVP_SIGNATURE-RSA - The EVP_PKEY RSA signature implementation

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-RSA/#description","title":"DESCRIPTION","text":"

                                                                                                      Support for computing RSA signatures. See EVP_PKEY-RSA(7) for information related to RSA keys.

                                                                                                      "},{"location":"man7/EVP_SIGNATURE-RSA/#signature-parameters","title":"Signature Parameters","text":"

                                                                                                      The following signature parameters can be set using EVP_PKEY_CTX_set_params(). This may be called after EVP_PKEY_sign_init() or EVP_PKEY_verify_init(), and before calling EVP_PKEY_sign() or EVP_PKEY_verify().

                                                                                                      • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)
                                                                                                      • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                        These common parameters are described in provider-signature(7).

                                                                                                      • \"pad-mode\" (OSSL_SIGNATURE_PARAM_PAD_MODE)

                                                                                                        The type of padding to be used. Its value can be one of the following:

                                                                                                        • \"none\" (OSSL_PKEY_RSA_PAD_MODE_NONE)
                                                                                                        • \"pkcs1\" (OSSL_PKEY_RSA_PAD_MODE_PKCSV15)
                                                                                                        • \"x931\" (OSSL_PKEY_RSA_PAD_MODE_X931)
                                                                                                        • \"pss\" (OSSL_PKEY_RSA_PAD_MODE_PSS)
                                                                                                      • \"mgf1-digest\" (OSSL_SIGNATURE_PARAM_MGF1_DIGEST)

                                                                                                        The digest algorithm name to use for the maskGenAlgorithm used by \"pss\" mode.

                                                                                                      • \"mgf1-properties\" (OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES)

                                                                                                        Sets the name of the property query associated with the \"mgf1-digest\" algorithm. NULL is used if this optional value is not set.

                                                                                                      • \"saltlen\" (OSSL_SIGNATURE_PARAM_PSS_SALTLEN) <integer> or

                                                                                                        The \"pss\" mode minimum salt length. The value can either be an integer, a string value representing a number or one of the following string values:

                                                                                                        • \"digest\" (OSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST)

                                                                                                          Use the same length as the digest size.

                                                                                                        • \"max\" (OSSL_PKEY_RSA_PSS_SALT_LEN_MAX)

                                                                                                          Use the maximum salt length.

                                                                                                        • \"auto\" (OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO)

                                                                                                          Auto detect the salt length.

                                                                                                        • \"auto-digestmax\" (OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO_DIGEST_MAX)

                                                                                                          Auto detect the salt length when verifying. Maximize the salt length up to the digest size when signing to comply with FIPS 186-4 section 5.5.

                                                                                                        The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                        • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>

                                                                                                          This common parameter is described in provider-signature(7).

                                                                                                        • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                        • \"pad-mode\" (OSSL_SIGNATURE_PARAM_PAD_MODE)
                                                                                                        • \"mgf1-digest\" (OSSL_SIGNATURE_PARAM_MGF1_DIGEST)
                                                                                                        • \"saltlen\" (OSSL_SIGNATURE_PARAM_PSS_SALTLEN) <integer> or

                                                                                                          These parameters are as described above.

                                                                                                          "},{"location":"man7/EVP_SIGNATURE-RSA/#see-also","title":"SEE ALSO","text":"

                                                                                                          EVP_PKEY_CTX_set_params(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), provider-signature(7),

                                                                                                          "},{"location":"man7/EVP_SIGNATURE-RSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/","title":"OSSL_PROVIDER-FIPS","text":""},{"location":"man7/OSSL_PROVIDER-FIPS/#name","title":"NAME","text":"

                                                                                                          OSSL_PROVIDER-FIPS - OpenSSL FIPS provider

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#description","title":"DESCRIPTION","text":"

                                                                                                          The OpenSSL FIPS provider is a special provider that conforms to the Federal Information Processing Standards (FIPS) specified in FIPS 140-3. This 'module' contains an approved set of cryptographic algorithms that is validated by an accredited testing laboratory.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#properties","title":"Properties","text":"

                                                                                                          The implementations in this provider specifically have these properties defined:

                                                                                                          • \"provider=fips\"
                                                                                                          • \"fips=yes\"

                                                                                                          It may be used in a property query string with fetching functions such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3), as well as with other functions that take a property query string, such as EVP_PKEY_CTX_new_from_name(3).

                                                                                                          To be FIPS compliant, it is mandatory to include fips=yes as part of all property queries. This ensures that only FIPS approved implementations are used for cryptographic operations. The fips=yes query may also include other non-crypto support operations that are not in the FIPS provider, such as asymmetric key encoders, see \"Asymmetric Key Management\" in OSSL_PROVIDER-default(7).

                                                                                                          It is not mandatory to include provider=fips as part of your property query. Including provider=fips in your property query guarantees that the OpenSSL FIPS provider is used for cryptographic operations rather than other FIPS capable providers.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#provider-parameters","title":"Provider parameters","text":"

                                                                                                          See \"Provider parameters\" in provider-base(7) for a list of base parameters. Additionally the OpenSSL FIPS provider also supports the following gettable parameters:

                                                                                                          • \"security-checks\" (OSSL_OSSL_PROV_PARAM_SECURITY_CHECKS) <unsigned integer>

                                                                                                            For further information refer to the openssl-fipsinstall(1) option -no_security_checks.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                          The OpenSSL FIPS provider supports these operations and algorithms:

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#hashing-algorithms-message-digests","title":"Hashing Algorithms / Message Digests","text":"
                                                                                                          • SHA1, see EVP_MD-SHA1(7)
                                                                                                          • SHA2, see EVP_MD-SHA2(7)
                                                                                                          • SHA3, see EVP_MD-SHA3(7)
                                                                                                          • KECCAK-KMAC, see EVP_MD-KECCAK-KMAC(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#symmetric-ciphers","title":"Symmetric Ciphers","text":"
                                                                                                          • AES, see EVP_CIPHER-AES(7)
                                                                                                          • DES-EDE3 (TripleDES), see EVP_CIPHER-DES(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#message-authentication-code-mac","title":"Message Authentication Code (MAC)","text":"
                                                                                                          • CMAC, see EVP_MAC-CMAC(7)
                                                                                                          • GMAC, see EVP_MAC-GMAC(7)
                                                                                                          • HMAC, see EVP_MAC-HMAC(7)
                                                                                                          • KMAC, see EVP_MAC-KMAC(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#key-derivation-function-kdf","title":"Key Derivation Function (KDF)","text":"
                                                                                                          • HKDF, see EVP_KDF-HKDF(7)
                                                                                                          • TLS13-KDF, see EVP_KDF-TLS13_KDF(7)
                                                                                                          • SSKDF, see EVP_KDF-SS(7)
                                                                                                          • PBKDF2, see EVP_KDF-PBKDF2(7)
                                                                                                          • SSHKDF, see EVP_KDF-SSHKDF(7)
                                                                                                          • TLS1-PRF, see EVP_KDF-TLS1_PRF(7)
                                                                                                          • KBKDF, see EVP_KDF-KB(7)
                                                                                                          • X942KDF-ASN1, see EVP_KDF-X942-ASN1(7)
                                                                                                          • X942KDF-CONCAT, see EVP_KDF-X942-CONCAT(7)
                                                                                                          • X963KDF, see EVP_KDF-X963(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#key-exchange","title":"Key Exchange","text":"
                                                                                                          • DH, see EVP_KEYEXCH-DH(7)
                                                                                                          • ECDH, see EVP_KEYEXCH-ECDH(7)
                                                                                                          • X25519, see EVP_KEYEXCH-X25519(7)
                                                                                                          • X448, see EVP_KEYEXCH-X448(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-signature","title":"Asymmetric Signature","text":"
                                                                                                          • RSA, see EVP_SIGNATURE-RSA(7)
                                                                                                          • X25519, see EVP_SIGNATURE-ED25519(7)
                                                                                                          • X448, see EVP_SIGNATURE-ED448(7)
                                                                                                          • HMAC, see EVP_SIGNATURE-HMAC(7)
                                                                                                          • CMAC, see EVP_SIGNATURE-CMAC(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-cipher","title":"Asymmetric Cipher","text":"
                                                                                                          • RSA, see EVP_ASYM_CIPHER-RSA(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-key-encapsulation","title":"Asymmetric Key Encapsulation","text":"
                                                                                                          • RSA, see EVP_KEM-RSA(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-key-management","title":"Asymmetric Key Management","text":"
                                                                                                          • DH, see EVP_KEYMGMT-DH(7)
                                                                                                          • DHX, see EVP_KEYMGMT-DHX(7)
                                                                                                          • DSA, see EVP_KEYMGMT-DSA(7)
                                                                                                          • RSA, see EVP_KEYMGMT-RSA(7)
                                                                                                          • EC, see EVP_KEYMGMT-EC(7)
                                                                                                          • X25519, see EVP_KEYMGMT-X25519(7)
                                                                                                          • X448, see EVP_KEYMGMT-X448(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#random-number-generation","title":"Random Number Generation","text":"
                                                                                                          • CTR-DRBG, see EVP_RAND-CTR-DRBG(7)
                                                                                                          • HASH-DRBG, see EVP_RAND-HASH-DRBG(7)
                                                                                                          • HMAC-DRBG, see EVP_RAND-HMAC-DRBG(7)
                                                                                                          • TEST-RAND, see EVP_RAND-TEST-RAND(7)

                                                                                                            TEST-RAND is an unapproved algorithm.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#self-testing","title":"SELF TESTING","text":"

                                                                                                          One of the requirements for the FIPS module is self testing. An optional callback mechanism is available to return information to the user using OSSL_SELF_TEST_set_callback(3).

                                                                                                          The parameters passed to the callback are described in OSSL_SELF_TEST_new(3)

                                                                                                          The OpenSSL FIPS module uses the following mechanism to provide information about the self tests as they run. This is useful for debugging if a self test is failing. The callback also allows forcing any self test to fail, in order to check that it operates correctly on failure. Note that all self tests run even if a self test failure occurs.

                                                                                                          The FIPS module passes the following type(s) to OSSL_SELF_TEST_onbegin().

                                                                                                          • \"Module_Integrity\" (OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY)

                                                                                                            Uses HMAC SHA256 on the module file to validate that the module has not been modified. The integrity value is compared to a value written to a configuration file during installation.

                                                                                                          • \"Install_Integrity\" (OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY)

                                                                                                            Uses HMAC SHA256 on a fixed string to validate that the installation process has already been performed and the self test KATS have already been tested, The integrity value is compared to a value written to a configuration file after successfully running the self tests during installation.

                                                                                                          • \"KAT_Cipher\" (OSSL_SELF_TEST_TYPE_KAT_CIPHER)

                                                                                                            Known answer test for a symmetric cipher.

                                                                                                          • \"KAT_AsymmetricCipher\" (OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER)

                                                                                                            Known answer test for a asymmetric cipher.

                                                                                                          • \"KAT_Digest\" (OSSL_SELF_TEST_TYPE_KAT_DIGEST)

                                                                                                            Known answer test for a digest.

                                                                                                          • \"KAT_Signature\" (OSSL_SELF_TEST_TYPE_KAT_SIGNATURE)

                                                                                                            Known answer test for a signature.

                                                                                                          • \"PCT_Signature\" (OSSL_SELF_TEST_TYPE_PCT_SIGNATURE)

                                                                                                            Pairwise Consistency check for a signature.

                                                                                                          • \"KAT_KDF\" (OSSL_SELF_TEST_TYPE_KAT_KDF)

                                                                                                            Known answer test for a key derivation function.

                                                                                                          • \"KAT_KA\" (OSSL_SELF_TEST_TYPE_KAT_KA)

                                                                                                            Known answer test for key agreement.

                                                                                                          • \"DRBG\" (OSSL_SELF_TEST_TYPE_DRBG)

                                                                                                            Known answer test for a Deterministic Random Bit Generator.

                                                                                                          • \"Conditional_PCT\" (OSSL_SELF_TEST_TYPE_PCT)

                                                                                                            Conditional test that is run during the generation of key pairs.

                                                                                                          • \"Continuous_RNG_Test\" (OSSL_SELF_TEST_TYPE_CRNG)

                                                                                                            Continuous random number generator test.

                                                                                                          The \"Module_Integrity\" self test is always run at startup. The \"Install_Integrity\" self test is used to check if the self tests have already been run at installation time. If they have already run then the self tests are not run on subsequent startups. All other self test categories are run once at installation time, except for the \"Pairwise_Consistency_Test\".

                                                                                                          There is only one instance of the \"Module_Integrity\" and \"Install_Integrity\" self tests. All other self tests may have multiple instances.

                                                                                                          The FIPS module passes the following descriptions(s) to OSSL_SELF_TEST_onbegin().

                                                                                                          • \"HMAC\" (OSSL_SELF_TEST_DESC_INTEGRITY_HMAC)

                                                                                                            \"Module_Integrity\" and \"Install_Integrity\" use this.

                                                                                                          • \"RSA\" (OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1)

                                                                                                          • \"ECDSA\" (OSSL_SELF_TEST_DESC_PCT_ECDSA)
                                                                                                          • \"DSA\" (OSSL_SELF_TEST_DESC_PCT_DSA)

                                                                                                            Key generation tests used with the \"Pairwise_Consistency_Test\" type.

                                                                                                          • \"RSA_Encrypt\" (OSSL_SELF_TEST_DESC_ASYM_RSA_ENC)

                                                                                                          • \"RSA_Decrypt\" (OSSL_SELF_TEST_DESC_ASYM_RSA_DEC)

                                                                                                            \"KAT_AsymmetricCipher\" uses this to indicate an encrypt or decrypt KAT.

                                                                                                          • \"AES_GCM\" (OSSL_SELF_TEST_DESC_CIPHER_AES_GCM)

                                                                                                          • \"AES_ECB_Decrypt\" (OSSL_SELF_TEST_DESC_CIPHER_AES_ECB)
                                                                                                          • \"TDES\" (OSSL_SELF_TEST_DESC_CIPHER_TDES)

                                                                                                            Symmetric cipher tests used with the \"KAT_Cipher\" type.

                                                                                                          • \"SHA1\" (OSSL_SELF_TEST_DESC_MD_SHA1)

                                                                                                          • \"SHA2\" (OSSL_SELF_TEST_DESC_MD_SHA2)
                                                                                                          • \"SHA3\" (OSSL_SELF_TEST_DESC_MD_SHA3)

                                                                                                            Digest tests used with the \"KAT_Digest\" type.

                                                                                                          • \"DSA\" (OSSL_SELF_TEST_DESC_SIGN_DSA)

                                                                                                          • \"RSA\" (OSSL_SELF_TEST_DESC_SIGN_RSA)
                                                                                                          • \"ECDSA\" (OSSL_SELF_TEST_DESC_SIGN_ECDSA)

                                                                                                            Signature tests used with the \"KAT_Signature\" type.

                                                                                                          • \"ECDH\" (OSSL_SELF_TEST_DESC_KA_ECDH)

                                                                                                          • \"DH\" (OSSL_SELF_TEST_DESC_KA_DH)

                                                                                                            Key agreement tests used with the \"KAT_KA\" type.

                                                                                                          • \"HKDF\" (OSSL_SELF_TEST_DESC_KDF_HKDF)

                                                                                                          • \"TLS13_KDF_EXTRACT\" (OSSL_SELF_TEST_DESC_KDF_TLS13_EXTRACT)
                                                                                                          • \"TLS13_KDF_EXPAND\" (OSSL_SELF_TEST_DESC_KDF_TLS13_EXPAND)
                                                                                                          • \"SSKDF\" (OSSL_SELF_TEST_DESC_KDF_SSKDF)
                                                                                                          • \"X963KDF\" (OSSL_SELF_TEST_DESC_KDF_X963KDF)
                                                                                                          • \"X942KDF\" (OSSL_SELF_TEST_DESC_KDF_X942KDF)
                                                                                                          • \"PBKDF2\" (OSSL_SELF_TEST_DESC_KDF_PBKDF2)
                                                                                                          • \"SSHKDF\" (OSSL_SELF_TEST_DESC_KDF_SSHKDF)
                                                                                                          • \"TLS12_PRF\" (OSSL_SELF_TEST_DESC_KDF_TLS12_PRF)
                                                                                                          • \"KBKDF\" (OSSL_SELF_TEST_DESC_KDF_KBKDF)

                                                                                                            Key Derivation Function tests used with the \"KAT_KDF\" type.

                                                                                                          • \"CTR\" (OSSL_SELF_TEST_DESC_DRBG_CTR)

                                                                                                          • \"HASH\" (OSSL_SELF_TEST_DESC_DRBG_HASH)
                                                                                                          • \"HMAC\" (OSSL_SELF_TEST_DESC_DRBG_HMAC)

                                                                                                            DRBG tests used with the \"DRBG\" type.

                                                                                                            = item \"RNG\" (OSSL_SELF_TEST_DESC_RNG)

                                                                                                            \"Continuous_RNG_Test\" uses this.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#examples","title":"EXAMPLES","text":"

                                                                                                          A simple self test callback is shown below for illustrative purposes.

                                                                                                          #include <openssl/self_test.h>\n\nstatic OSSL_CALLBACK self_test_cb;\n\nstatic int self_test_cb(const OSSL_PARAM params[], void *arg)\n{\n  int ret = 0;\n  const OSSL_PARAM *p = NULL;\n  const char *phase = NULL, *type = NULL, *desc = NULL;\n\n  p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_PHASE);\n  if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)\n      goto err;\n  phase = (const char *)p->data;\n\n  p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_DESC);\n  if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)\n      goto err;\n  desc = (const char *)p->data;\n\n  p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_TYPE);\n  if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)\n      goto err;\n  type = (const char *)p->data;\n\n  /* Do some logging */\n  if (strcmp(phase, OSSL_SELF_TEST_PHASE_START) == 0)\n      BIO_printf(bio_out, \"%s : (%s) : \", desc, type);\n  if (strcmp(phase, OSSL_SELF_TEST_PHASE_PASS) == 0\n          || strcmp(phase, OSSL_SELF_TEST_PHASE_FAIL) == 0)\n      BIO_printf(bio_out, \"%s\\n\", phase);\n\n  /* Corrupt the SHA1 self test during the 'corrupt' phase by returning 0 */\n  if (strcmp(phase, OSSL_SELF_TEST_PHASE_CORRUPT) == 0\n          && strcmp(desc, OSSL_SELF_TEST_DESC_MD_SHA1) == 0) {\n      BIO_printf(bio_out, \"%s %s\", phase, desc);\n      return 0;\n  }\n  ret = 1;\nerr:\n  return ret;\n}\n
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#notes","title":"NOTES","text":"

                                                                                                          Some released versions of OpenSSL do not include a validated FIPS provider. To determine which versions have undergone the validation process, please refer to the OpenSSL Downloads page. If you require FIPS-approved functionality, it is essential to build your FIPS provider using one of the validated versions listed there. Normally, it is possible to utilize a FIPS provider constructed from one of the validated versions alongside libcrypto and libssl compiled from any release within the same major release series. This flexibility enables you to address bug fixes and CVEs that fall outside the FIPS boundary.

                                                                                                          The FIPS provider in OpenSSL 3.1 includes some non-FIPS validated algorithms, consequently the property query fips=yes is mandatory for applications that want to operate in a FIPS approved manner. The algorithms are:

                                                                                                          • Triple DES ECB
                                                                                                          • Triple DES CBC
                                                                                                          • EdDSA
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#see-also","title":"SEE ALSO","text":"

                                                                                                          openssl-fipsinstall(1), fips_config(5), OSSL_SELF_TEST_set_callback(3), OSSL_SELF_TEST_new(3), OSSL_PARAM(3), openssl-core.h(7), openssl-core_dispatch.h(7), provider(7), https://www.openssl.org/source/

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#history","title":"HISTORY","text":"

                                                                                                          This functionality was added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-FIPS/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/","title":"OSSL_PROVIDER-base","text":""},{"location":"man7/OSSL_PROVIDER-base/#name","title":"NAME","text":"

                                                                                                          OSSL_PROVIDER-base - OpenSSL base provider

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/#description","title":"DESCRIPTION","text":"

                                                                                                          The OpenSSL base provider supplies the encoding for OpenSSL's asymmetric cryptography.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/#properties","title":"Properties","text":"

                                                                                                          The implementations in this provider specifically have this property defined:

                                                                                                          • \"provider=base\"

                                                                                                          It may be used in a property query string with fetching functions.

                                                                                                          It isn't mandatory to query for this property, except to make sure to get implementations of this provider and none other.

                                                                                                          • \"type=parameters\"
                                                                                                          • \"type=private\"
                                                                                                          • \"type=public\"

                                                                                                          These may be used in a property query string with fetching functions to select which data are to be encoded. Either the private key material, the public key material or the domain parameters can be selected.

                                                                                                          • \"format=der\"
                                                                                                          • \"format=pem\"
                                                                                                          • \"format=text\"

                                                                                                          These may be used in a property query string with fetching functions to select the encoding output format. Either the DER, PEM and plaintext are currently permitted.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                          The OpenSSL base provider supports these operations and algorithms:

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/#asymmetric-key-encoder","title":"Asymmetric Key Encoder","text":"

                                                                                                          In addition to \"provider=base\", some of these encoders define the property \"fips=yes\", to allow them to be used together with the FIPS provider.

                                                                                                          • RSA, see OSSL_ENCODER-RSA(7)
                                                                                                          • DH, see OSSL_ENCODER-DH(7)
                                                                                                          • DSA, see OSSL_ENCODER-DSA(7)
                                                                                                          • EC, see OSSL_ENCODER-EC(7)
                                                                                                          • X25519, see OSSL_ENCODER-X25519(7)
                                                                                                          • X448, see OSSL_ENCODER-X448(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/#see-also","title":"SEE ALSO","text":"

                                                                                                          OSSL_PROVIDER-default(7), openssl-core.h(7), openssl-core_dispatch.h(7), provider(7)

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/#history","title":"HISTORY","text":"

                                                                                                          This functionality was added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-base/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/","title":"OSSL_PROVIDER-default","text":""},{"location":"man7/OSSL_PROVIDER-default/#name","title":"NAME","text":"

                                                                                                          OSSL_PROVIDER-default - OpenSSL default provider

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#description","title":"DESCRIPTION","text":"

                                                                                                          The OpenSSL default provider supplies the majority of OpenSSL's diverse algorithm implementations. If an application doesn't specify anything else explicitly (e.g. in the application or via config), then this is the provider that will be used as fallback: It is loaded automatically the first time that an algorithm is fetched from a provider or a function acting on providers is called and no other provider has been loaded yet.

                                                                                                          If an attempt to load a provider has already been made (whether successful or not) then the default provider won't be loaded automatically. Therefore if the default provider is to be used in conjunction with other providers then it must be loaded explicitly. Automatic loading of the default provider only occurs a maximum of once; if the default provider is explicitly unloaded then the default provider will not be automatically loaded again.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#properties","title":"Properties","text":"

                                                                                                          The implementations in this provider specifically have this property defined:

                                                                                                          • \"provider=default\"

                                                                                                          It may be used in a property query string with fetching functions such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3), as well as with other functions that take a property query string, such as EVP_PKEY_CTX_new_from_name(3).

                                                                                                          It isn't mandatory to query for this property, except to make sure to get implementations of this provider and none other.

                                                                                                          Some implementations may define additional properties. Exact information is listed below

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                          The OpenSSL default provider supports these operations and algorithms:

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#hashing-algorithms-message-digests","title":"Hashing Algorithms / Message Digests","text":"
                                                                                                          • SHA1, see EVP_MD-SHA1(7)
                                                                                                          • SHA2, see EVP_MD-SHA2(7)
                                                                                                          • SHA3, see EVP_MD-SHA3(7)
                                                                                                          • KECCAK-KMAC, see EVP_MD-KECCAK-KMAC(7)
                                                                                                          • SHAKE, see EVP_MD-SHAKE(7)
                                                                                                          • BLAKE2, see EVP_MD-BLAKE2(7)
                                                                                                          • SM3, see EVP_MD-SM3(7)
                                                                                                          • MD5, see EVP_MD-MD5(7)
                                                                                                          • MD5-SHA1, see EVP_MD-MD5-SHA1(7)
                                                                                                          • RIPEMD160, see EVP_MD-RIPEMD160(7)
                                                                                                          • NULL, see EVP_MD-NULL(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#symmetric-ciphers","title":"Symmetric Ciphers","text":"
                                                                                                          • AES, see EVP_CIPHER-AES(7)
                                                                                                          • ARIA, see EVP_CIPHER-ARIA(7)
                                                                                                          • CAMELLIA, see EVP_CIPHER-CAMELLIA(7)
                                                                                                          • 3DES, see EVP_CIPHER-DES(7)
                                                                                                          • SEED, see EVP_CIPHER-SEED(7)
                                                                                                          • SM4, see EVP_CIPHER-SM4(7)
                                                                                                          • ChaCha20, see EVP_CIPHER-CHACHA(7)
                                                                                                          • ChaCha20-Poly1305, see EVP_CIPHER-CHACHA(7)
                                                                                                          • NULL, see EVP_CIPHER-NULL(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#message-authentication-code-mac","title":"Message Authentication Code (MAC)","text":"
                                                                                                          • BLAKE2, see EVP_MAC-BLAKE2(7)
                                                                                                          • CMAC, see EVP_MAC-CMAC(7)
                                                                                                          • GMAC, see EVP_MAC-GMAC(7)
                                                                                                          • HMAC, see EVP_MAC-HMAC(7)
                                                                                                          • KMAC, see EVP_MAC-KMAC(7)
                                                                                                          • SIPHASH, see EVP_MAC-Siphash(7)
                                                                                                          • POLY1305, see EVP_MAC-Poly1305(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#key-derivation-function-kdf","title":"Key Derivation Function (KDF)","text":"
                                                                                                          • HKDF, see EVP_KDF-HKDF(7)
                                                                                                          • SSKDF, see EVP_KDF-SS(7)
                                                                                                          • PBKDF2, see EVP_KDF-PBKDF2(7)
                                                                                                          • PKCS12KDF, see EVP_KDF-PKCS12KDF(7)
                                                                                                          • SSHKDF, see EVP_KDF-SSHKDF(7)
                                                                                                          • TLS1-PRF, see EVP_KDF-TLS1_PRF(7)
                                                                                                          • KBKDF, see EVP_KDF-KB(7)
                                                                                                          • X942KDF-ASN1, see EVP_KDF-X942-ASN1(7)
                                                                                                          • X942KDF-CONCAT, see EVP_KDF-X942-CONCAT(7)
                                                                                                          • X963KDF, see EVP_KDF-X963(7)
                                                                                                          • SCRYPT, see EVP_KDF-SCRYPT(7)
                                                                                                          • KRB5KDF, see EVP_KDF-KRB5KDF(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#key-exchange","title":"Key Exchange","text":"
                                                                                                          • DH, see EVP_KEYEXCH-DH(7)
                                                                                                          • ECDH, see EVP_KEYEXCH-ECDH(7)
                                                                                                          • X25519, see EVP_KEYEXCH-X25519(7)
                                                                                                          • X448, see EVP_KEYEXCH-X448(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-signature","title":"Asymmetric Signature","text":"
                                                                                                          • DSA, see EVP_SIGNATURE-DSA(7)
                                                                                                          • RSA, see EVP_SIGNATURE-RSA(7)
                                                                                                          • HMAC, see EVP_SIGNATURE-HMAC(7)
                                                                                                          • SIPHASH, see EVP_SIGNATURE-Siphash(7)
                                                                                                          • POLY1305, see EVP_SIGNATURE-Poly1305(7)
                                                                                                          • CMAC, see EVP_SIGNATURE-CMAC(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-cipher","title":"Asymmetric Cipher","text":"
                                                                                                          • RSA, see EVP_ASYM_CIPHER-RSA(7)
                                                                                                          • SM2, see EVP_ASYM_CIPHER-SM2(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-key-encapsulation","title":"Asymmetric Key Encapsulation","text":"
                                                                                                          • RSA, see EVP_KEM-RSA(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-key-management","title":"Asymmetric Key Management","text":"
                                                                                                          • DH, see EVP_KEYMGMT-DH(7)
                                                                                                          • DHX, see EVP_KEYMGMT-DHX(7)
                                                                                                          • DSA, see EVP_KEYMGMT-DSA(7)
                                                                                                          • RSA, see EVP_KEYMGMT-RSA(7)
                                                                                                          • EC, see EVP_KEYMGMT-EC(7)
                                                                                                          • X25519, see EVP_KEYMGMT-X25519(7)
                                                                                                          • X448, see EVP_KEYMGMT-X448(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#random-number-generation","title":"Random Number Generation","text":"
                                                                                                          • CTR-DRBG, see EVP_RAND-CTR-DRBG(7)
                                                                                                          • HASH-DRBG, see EVP_RAND-HASH-DRBG(7)
                                                                                                          • HMAC-DRBG, see EVP_RAND-HMAC-DRBG(7)
                                                                                                          • SEED-SRC, see EVP_RAND-SEED-SRC(7)
                                                                                                          • TEST-RAND, see EVP_RAND-TEST-RAND(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-key-encoder","title":"Asymmetric Key Encoder","text":"

                                                                                                          The default provider also includes all of the encoding algorithms present in the base provider. Some of these have the property \"fips=yes\", to allow them to be used together with the FIPS provider.

                                                                                                          • RSA, see OSSL_ENCODER-RSA(7)
                                                                                                          • DH, see OSSL_ENCODER-DH(7)
                                                                                                          • DSA, see OSSL_ENCODER-DSA(7)
                                                                                                          • EC, see OSSL_ENCODER-EC(7)
                                                                                                          • X25519, see OSSL_ENCODER-X25519(7)
                                                                                                          • X448, see OSSL_ENCODER-X448(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#see-also","title":"SEE ALSO","text":"

                                                                                                          openssl-core.h(7), openssl-core_dispatch.h(7), provider(7), OSSL_PROVIDER-base(7)

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#history","title":"HISTORY","text":"

                                                                                                          The RIPEMD160 digest was added to the default provider in OpenSSL 3.0.7.

                                                                                                          All other functionality was added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-default/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/","title":"OSSL_PROVIDER-legacy","text":""},{"location":"man7/OSSL_PROVIDER-legacy/#name","title":"NAME","text":"

                                                                                                          OSSL_PROVIDER-legacy - OpenSSL legacy provider

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#description","title":"DESCRIPTION","text":"

                                                                                                          The OpenSSL legacy provider supplies OpenSSL implementations of algorithms that have been deemed legacy. Such algorithms have commonly fallen out of use, have been deemed insecure by the cryptography community, or something similar.

                                                                                                          We can consider this the retirement home of cryptographic algorithms.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#properties","title":"Properties","text":"

                                                                                                          The implementations in this provider specifically has this property defined:

                                                                                                          • \"provider=legacy\"

                                                                                                          It may be used in a property query string with fetching functions such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3), as well as with other functions that take a property query string, such as EVP_PKEY_CTX_new_from_name(3).

                                                                                                          It isn't mandatory to query for any of these properties, except to make sure to get implementations of this provider and none other.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                          The OpenSSL legacy provider supports these operations and algorithms:

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#hashing-algorithms-message-digests","title":"Hashing Algorithms / Message Digests","text":"
                                                                                                          • MD2, see EVP_MD-MD2(7)
                                                                                                          • MD4, see EVP_MD-MD4(7)
                                                                                                          • MDC2, see EVP_MD-MDC2(7)
                                                                                                          • WHIRLPOOL, see EVP_MD-WHIRLPOOL(7)
                                                                                                          • RIPEMD160, see EVP_MD-RIPEMD160(7)
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#symmetric-ciphers","title":"Symmetric Ciphers","text":"

                                                                                                          Not all of these symmetric cipher algorithms are enabled by default.

                                                                                                          • Blowfish, see EVP_CIPHER-BLOWFISH(7)
                                                                                                          • CAST, see EVP_CIPHER-CAST(7)
                                                                                                          • DES, see EVP_CIPHER-DES(7)

                                                                                                            The algorithm names are: DES_ECB, DES_CBC, DES_OFB, DES_CFB, DES_CFB1, DES_CFB8 and DESX_CBC.

                                                                                                          • IDEA, see EVP_CIPHER-IDEA(7)

                                                                                                          • RC2, see EVP_CIPHER-RC2(7)
                                                                                                          • RC4, see EVP_CIPHER-RC4(7)
                                                                                                          • RC5, see EVP_CIPHER-RC5(7)

                                                                                                            Disabled by default. Use enable-rc5 config option to enable.

                                                                                                          • SEED, see EVP_CIPHER-SEED(7)

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#key-derivation-function-kdf","title":"Key Derivation Function (KDF)","text":"
                                                                                                          • PBKDF1
                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#see-also","title":"SEE ALSO","text":"

                                                                                                          OSSL_PARAM(3), openssl-core.h(7), openssl-core_dispatch.h(7), provider(7)

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#history","title":"HISTORY","text":"

                                                                                                          This functionality was added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-legacy/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-null/","title":"OSSL_PROVIDER-null","text":""},{"location":"man7/OSSL_PROVIDER-null/#name","title":"NAME","text":"

                                                                                                          OSSL_PROVIDER-null - OpenSSL null provider

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-null/#description","title":"DESCRIPTION","text":"

                                                                                                          The OpenSSL null provider supplies no algorithms.

                                                                                                          It can used to guarantee that the default library context and a fallback provider will not be accidentally accessed.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-null/#properties","title":"Properties","text":"

                                                                                                          The null provider defines no properties.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-null/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                          The OpenSSL null provider supports no operations and algorithms.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-null/#see-also","title":"SEE ALSO","text":"

                                                                                                          provider(7)

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-null/#history","title":"HISTORY","text":"

                                                                                                          This functionality was added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/OSSL_PROVIDER-null/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/RAND/","title":"RAND","text":""},{"location":"man7/RAND/#name","title":"NAME","text":"

                                                                                                          RAND - the OpenSSL random generator

                                                                                                          "},{"location":"man7/RAND/#description","title":"DESCRIPTION","text":"

                                                                                                          Random numbers are a vital part of cryptography, they are needed to provide unpredictability for tasks like key generation, creating salts, and many more. Software-based generators must be seeded with external randomness before they can be used as a cryptographically-secure pseudo-random number generator (CSPRNG). The availability of common hardware with special instructions and modern operating systems, which may use items such as interrupt jitter and network packet timings, can be reasonable sources of seeding material.

                                                                                                          OpenSSL comes with a default implementation of the RAND API which is based on the deterministic random bit generator (DRBG) model as described in [NIST SP 800-90A Rev. 1]. The default random generator will initialize automatically on first use and will be fully functional without having to be initialized ('seeded') explicitly. It seeds and reseeds itself automatically using trusted random sources provided by the operating system.

                                                                                                          As a normal application developer, you do not have to worry about any details, just use RAND_bytes(3) to obtain random data. Having said that, there is one important rule to obey: Always check the error return value of RAND_bytes(3) and do not take randomness for granted. Although (re-)seeding is automatic, it can fail because no trusted random source is available or the trusted source(s) temporarily fail to provide sufficient random seed material. In this case the CSPRNG enters an error state and ceases to provide output, until it is able to recover from the error by reseeding itself. For more details on reseeding and error recovery, see EVP_RAND(7).

                                                                                                          For values that should remain secret, you can use RAND_priv_bytes(3) instead. This method does not provide 'better' randomness, it uses the same type of CSPRNG. The intention behind using a dedicated CSPRNG exclusively for private values is that none of its output should be visible to an attacker (e.g., used as salt value), in order to reveal as little information as possible about its internal state, and that a compromise of the \"public\" CSPRNG instance will not affect the secrecy of these private values.

                                                                                                          In the rare case where the default implementation does not satisfy your special requirements, the default RAND internals can be replaced by your own EVP_RAND(3) objects.

                                                                                                          Changing the default random generator should be necessary only in exceptional cases and is not recommended, unless you have a profound knowledge of cryptographic principles and understand the implications of your changes.

                                                                                                          "},{"location":"man7/RAND/#default-setup","title":"DEFAULT SETUP","text":"

                                                                                                          The default OpenSSL RAND method is based on the EVP_RAND deterministic random bit generator (DRBG) classes. A DRBG is a certain type of cryptographically-secure pseudo-random number generator (CSPRNG), which is described in [NIST SP 800-90A Rev. 1].

                                                                                                          "},{"location":"man7/RAND/#see-also","title":"SEE ALSO","text":"

                                                                                                          RAND_bytes(3), RAND_priv_bytes(3), EVP_RAND(3), RAND_get0_primary(3), EVP_RAND(7)

                                                                                                          "},{"location":"man7/RAND/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/RSA-PSS/","title":"RSA-PSS","text":""},{"location":"man7/RSA-PSS/#name","title":"NAME","text":"

                                                                                                          RSA-PSS - EVP_PKEY RSA-PSS algorithm support

                                                                                                          "},{"location":"man7/RSA-PSS/#description","title":"DESCRIPTION","text":"

                                                                                                          The RSA-PSS EVP_PKEY implementation is a restricted version of the RSA algorithm which only supports signing, verification and key generation using PSS padding modes with optional parameter restrictions.

                                                                                                          It has associated private key and public key formats.

                                                                                                          This algorithm shares several control operations with the RSA algorithm but with some restrictions described below.

                                                                                                          "},{"location":"man7/RSA-PSS/#signing-and-verification","title":"Signing and Verification","text":"

                                                                                                          Signing and verification is similar to the RSA algorithm except the padding mode is always PSS. If the key in use has parameter restrictions then the corresponding signature parameters are set to the restrictions: for example, if the key can only be used with digest SHA256, MGF1 SHA256 and minimum salt length 32 then the digest, MGF1 digest and salt length will be set to SHA256, SHA256 and 32 respectively.

                                                                                                          "},{"location":"man7/RSA-PSS/#key-generation","title":"Key Generation","text":"

                                                                                                          By default no parameter restrictions are placed on the generated key.

                                                                                                          "},{"location":"man7/RSA-PSS/#notes","title":"NOTES","text":"

                                                                                                          The public key format is documented in RFC4055.

                                                                                                          The PKCS#8 private key format used for RSA-PSS keys is similar to the RSA format except it uses the id-RSASSA-PSS OID and the parameters field, if present, restricts the key parameters in the same way as the public key.

                                                                                                          "},{"location":"man7/RSA-PSS/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                          RFC 4055

                                                                                                          "},{"location":"man7/RSA-PSS/#see-also","title":"SEE ALSO","text":"

                                                                                                          EVP_PKEY_CTX_set_rsa_pss_keygen_md(3), EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(3), EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(3), EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

                                                                                                          "},{"location":"man7/RSA-PSS/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/X25519/","title":"X25519","text":""},{"location":"man7/X25519/#name","title":"NAME","text":"

                                                                                                          X25519, X448 - EVP_PKEY X25519 and X448 support

                                                                                                          "},{"location":"man7/X25519/#description","title":"DESCRIPTION","text":"

                                                                                                          The X25519 and X448 EVP_PKEY implementation supports key generation and key derivation using X25519 and X448. It has associated private and public key formats compatible with RFC 8410.

                                                                                                          No additional parameters can be set during key generation.

                                                                                                          The peer public key must be set using EVP_PKEY_derive_set_peer() when performing key derivation.

                                                                                                          "},{"location":"man7/X25519/#notes","title":"NOTES","text":"

                                                                                                          A context for the X25519 algorithm can be obtained by calling:

                                                                                                          EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);\n

                                                                                                          For the X448 algorithm a context can be obtained by calling:

                                                                                                          EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X448, NULL);\n

                                                                                                          X25519 or X448 private keys can be set directly using EVP_PKEY_new_raw_private_key(3) or loaded from a PKCS#8 private key file using PEM_read_bio_PrivateKey(3) (or similar function). Completely new keys can also be generated (see the example below). Setting a private key also sets the associated public key.

                                                                                                          X25519 or X448 public keys can be set directly using EVP_PKEY_new_raw_public_key(3) or loaded from a SubjectPublicKeyInfo structure in a PEM file using PEM_read_bio_PUBKEY(3) (or similar function).

                                                                                                          "},{"location":"man7/X25519/#examples","title":"EXAMPLES","text":"

                                                                                                          This example generates an X25519 private key and writes it to standard output in PEM format:

                                                                                                          #include <openssl/evp.h>\n#include <openssl/pem.h>\n...\nEVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);\nEVP_PKEY_keygen_init(pctx);\nEVP_PKEY_keygen(pctx, &pkey);\nEVP_PKEY_CTX_free(pctx);\nPEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);\n

                                                                                                          The key derivation example in EVP_PKEY_derive(3) can be used with X25519 and X448.

                                                                                                          "},{"location":"man7/X25519/#see-also","title":"SEE ALSO","text":"

                                                                                                          EVP_PKEY_CTX_new(3), EVP_PKEY_keygen(3), EVP_PKEY_derive(3), EVP_PKEY_derive_set_peer(3)

                                                                                                          "},{"location":"man7/X25519/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/bio/","title":"bio","text":""},{"location":"man7/bio/#name","title":"NAME","text":"

                                                                                                          bio - Basic I/O abstraction

                                                                                                          "},{"location":"man7/bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                          #include <openssl/bio.h>\n
                                                                                                          "},{"location":"man7/bio/#description","title":"DESCRIPTION","text":"

                                                                                                          A BIO is an I/O abstraction, it hides many of the underlying I/O details from an application. If an application uses a BIO for its I/O it can transparently handle SSL connections, unencrypted network connections and file I/O.

                                                                                                          There are two types of BIO, a source/sink BIO and a filter BIO.

                                                                                                          As its name implies a source/sink BIO is a source and/or sink of data, examples include a socket BIO and a file BIO.

                                                                                                          A filter BIO takes data from one BIO and passes it through to another, or the application. The data may be left unmodified (for example a message digest BIO) or translated (for example an encryption BIO). The effect of a filter BIO may change according to the I/O operation it is performing: for example an encryption BIO will encrypt data if it is being written to and decrypt data if it is being read from.

                                                                                                          BIOs can be joined together to form a chain (a single BIO is a chain with one component). A chain normally consists of one source/sink BIO and one or more filter BIOs. Data read from or written to the first BIO then traverses the chain to the end (normally a source/sink BIO).

                                                                                                          Some BIOs (such as memory BIOs) can be used immediately after calling BIO_new(). Others (such as file BIOs) need some additional initialization, and frequently a utility function exists to create and initialize such BIOs.

                                                                                                          If BIO_free() is called on a BIO chain it will only free one BIO resulting in a memory leak.

                                                                                                          Calling BIO_free_all() on a single BIO has the same effect as calling BIO_free() on it other than the discarded return value.

                                                                                                          Normally the type argument is supplied by a function which returns a pointer to a BIO_METHOD. There is a naming convention for such functions: a source/sink BIO typically starts with BIO_s_ and a filter BIO with BIO_f_.

                                                                                                          "},{"location":"man7/bio/#examples","title":"EXAMPLES","text":"

                                                                                                          Create a memory BIO:

                                                                                                          BIO *mem = BIO_new(BIO_s_mem());\n
                                                                                                          "},{"location":"man7/bio/#see-also","title":"SEE ALSO","text":"

                                                                                                          BIO_ctrl(3), BIO_f_base64(3), BIO_f_buffer(3), BIO_f_cipher(3), BIO_f_md(3), BIO_f_null(3), BIO_f_ssl(3), BIO_f_readbuffer(3), BIO_find_type(3), BIO_new(3), BIO_new_bio_pair(3), BIO_push(3), BIO_read_ex(3), BIO_s_accept(3), BIO_s_bio(3), BIO_s_connect(3), BIO_s_fd(3), BIO_s_file(3), BIO_s_mem(3), BIO_s_null(3), BIO_s_socket(3), BIO_set_callback(3), BIO_should_retry(3)

                                                                                                          "},{"location":"man7/bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/crypto/","title":"crypto","text":""},{"location":"man7/crypto/#name","title":"NAME","text":"

                                                                                                          crypto - OpenSSL cryptographic library

                                                                                                          "},{"location":"man7/crypto/#synopsis","title":"SYNOPSIS","text":"

                                                                                                          See the individual manual pages for details.

                                                                                                          "},{"location":"man7/crypto/#description","title":"DESCRIPTION","text":"

                                                                                                          The OpenSSL crypto library (libcrypto) implements a wide range of cryptographic algorithms used in various Internet standards. The services provided by this library are used by the OpenSSL implementations of TLS and CMS, and they have also been used to implement many other third party products and protocols.

                                                                                                          The functionality includes symmetric encryption, public key cryptography, key agreement, certificate handling, cryptographic hash functions, cryptographic pseudo-random number generators, message authentication codes (MACs), key derivation functions (KDFs), and various utilities.

                                                                                                          "},{"location":"man7/crypto/#algorithms","title":"Algorithms","text":"

                                                                                                          Cryptographic primitives such as the SHA256 digest, or AES encryption are referred to in OpenSSL as \"algorithms\". Each algorithm may have multiple implementations available for use. For example the RSA algorithm is available as a \"default\" implementation suitable for general use, and a \"fips\" implementation which has been validated to FIPS standards for situations where that is important. It is also possible that a third party could add additional implementations such as in a hardware security module (HSM).

                                                                                                          "},{"location":"man7/crypto/#operations","title":"Operations","text":"

                                                                                                          Different algorithms can be grouped together by their purpose. For example there are algorithms for encryption, and different algorithms for digesting data. These different groups are known as \"operations\" in OpenSSL. Each operation has a different set of functions associated with it. For example to perform an encryption operation using AES (or any other encryption algorithm) you would use the encryption functions detailed on the EVP_EncryptInit(3) page. Or to perform a digest operation using SHA256 then you would use the digesting functions on the EVP_DigestInit(3) page.

                                                                                                          "},{"location":"man7/crypto/#providers","title":"Providers","text":"

                                                                                                          A provider in OpenSSL is a component that collects together algorithm implementations. In order to use an algorithm you must have at least one provider loaded that contains an implementation of it. OpenSSL comes with a number of providers and they may also be obtained from third parties. If you don't load a provider explicitly (either in program code or via config) then the OpenSSL built-in \"default\" provider will be automatically loaded.

                                                                                                          "},{"location":"man7/crypto/#library-contexts","title":"Library contexts","text":"

                                                                                                          A library context can be thought of as a \"scope\" within which configuration options take effect. When a provider is loaded, it is only loaded within the scope of a given library context. In this way it is possible for different components of a complex application to each use a different library context and have different providers loaded with different configuration settings.

                                                                                                          If an application does not explicitly create a library context then the \"default\" library context will be used.

                                                                                                          Library contexts are represented by the OSSL_LIB_CTX type. Many OpenSSL API functions take a library context as a parameter. Applications can always pass NULL for this parameter to just use the default library context.

                                                                                                          The default library context is automatically created the first time it is needed. This will automatically load any available configuration file and will initialise OpenSSL for use. Unlike in earlier versions of OpenSSL (prior to 1.1.0) no explicit initialisation steps need to be taken.

                                                                                                          Similarly when the application exits the default library context is automatically destroyed. No explicit de-initialisation steps need to be taken.

                                                                                                          See OSSL_LIB_CTX(3) for more information about library contexts. See also \"ALGORITHM FETCHING\".

                                                                                                          "},{"location":"man7/crypto/#multi-threaded-applications","title":"Multi-threaded applications","text":"

                                                                                                          As long as OpenSSL has been built with support for threads (the default case on most platforms) then most OpenSSL functions are thread-safe in the sense that it is safe to call the same function from multiple threads at the same time. However most OpenSSL data structures are not thread-safe. For example the BIO_write(3) and BIO_read(3) functions are thread safe. However it would not be thread safe to call BIO_write() from one thread while calling BIO_read() in another where both functions are passed the same BIO object since both of them may attempt to make changes to the same BIO object.

                                                                                                          There are exceptions to these rules. A small number of functions are not thread safe at all. Where this is the case this restriction should be noted in the documentation for the function. Similarly some data structures may be partially or fully thread safe. For example it is safe to use an OSSL_LIB_CTX in multiple threads.

                                                                                                          See openssl-threads(7) for a more detailed discussion on OpenSSL threading support.

                                                                                                          "},{"location":"man7/crypto/#algorithm-fetching","title":"ALGORITHM FETCHING","text":"

                                                                                                          In order to use an algorithm an implementation for it must first be \"fetched\". Fetching is the process of looking through the available implementations, applying selection criteria (via a property query string), and finally choosing the implementation that will be used.

                                                                                                          Two types of fetching are supported by OpenSSL - explicit fetching and implicit fetching.

                                                                                                          "},{"location":"man7/crypto/#property-query-strings","title":"Property query strings","text":"

                                                                                                          When fetching an algorithm it is possible to specify a property query string to guide the selection process. For example a property query string of \"provider=default\" could be used to force the selection to only consider algorithm implementations in the default provider.

                                                                                                          Property query strings can be specified explicitly as an argument to a function. It is also possible to specify a default property query string for the whole library context using the EVP_set_default_properties(3) or EVP_default_properties_enable_fips(3) functions. Where both default properties and function specific properties are specified then they are combined. Function specific properties will override default properties where there is a conflict.

                                                                                                          See property(7) for more information about properties.

                                                                                                          "},{"location":"man7/crypto/#explicit-fetching","title":"Explicit fetching","text":"

                                                                                                          Users of the OpenSSL libraries never query a provider directly for an algorithm implementation. Instead, the diverse OpenSSL APIs often have explicit fetching functions that do the work, and they return an appropriate algorithm object back to the user. These functions usually have the name APINAME_fetch, where APINAME is the name of the operation. For example EVP_MD_fetch(3) can be used to explicitly fetch a digest algorithm implementation. The user is responsible for freeing the object returned from the APINAME_fetch function using APINAME_free when it is no longer needed.

                                                                                                          These fetching functions follow a fairly common pattern, where three arguments are passed:

                                                                                                          • The library context

                                                                                                            See OSSL_LIB_CTX(3) for a more detailed description. This may be NULL to signify the default (global) library context, or a context created by the user. Only providers loaded in this library context (see OSSL_PROVIDER_load(3)) will be considered by the fetching function. In case no provider has been loaded in this library context then the default provider will be loaded as a fallback (see OSSL_PROVIDER-default(7)).

                                                                                                          • An identifier

                                                                                                            For all currently implemented fetching functions this is the algorithm name.

                                                                                                          • A property query string

                                                                                                            The property query string used to guide selection of the algorithm implementation.

                                                                                                          The algorithm implementation that is fetched can then be used with other diverse functions that use them. For example the EVP_DigestInit_ex(3) function takes as a parameter an EVP_MD object which may have been returned from an earlier call to EVP_MD_fetch(3).

                                                                                                          "},{"location":"man7/crypto/#implicit-fetching","title":"Implicit fetching","text":"

                                                                                                          OpenSSL has a number of functions that return an algorithm object with no associated implementation, such as EVP_sha256(3), EVP_aes_128_cbc(3), EVP_get_cipherbyname(3) or EVP_get_digestbyname(3). These are present for compatibility with OpenSSL before version 3.0 where explicit fetching was not available.

                                                                                                          When they are used with functions like EVP_DigestInit_ex(3) or EVP_CipherInit_ex(3), the actual implementation to be used is fetched implicitly using default search criteria.

                                                                                                          In some cases implicit fetching can also occur when a NULL algorithm parameter is supplied. In this case an algorithm implementation is implicitly fetched using default search criteria and an algorithm name that is consistent with the context in which it is being used.

                                                                                                          Functions that revolve around EVP_PKEY_CTX and EVP_PKEY(3), such as EVP_DigestSignInit(3) and friends, all fetch the implementations implicitly. Because these functions involve both an operation type (such as EVP_SIGNATURE(3)) and an EVP_KEYMGMT(3) for the EVP_PKEY(3), they try the following:

                                                                                                          1. Fetch the operation type implementation from any provider given a library context and property string stored in the EVP_PKEY_CTX.

                                                                                                            If the provider of the operation type implementation is different from the provider of the EVP_PKEY(3)'s EVP_KEYMGMT(3) implementation, try to fetch a EVP_KEYMGMT(3) implementation in the same provider as the operation type implementation and export the EVP_PKEY(3) to it (effectively making a temporary copy of the original key).

                                                                                                            If anything in this step fails, the next step is used as a fallback.

                                                                                                          2. As a fallback, try to fetch the operation type implementation from the same provider as the original EVP_PKEY(3)'s EVP_KEYMGMT(3), still using the property string from the EVP_PKEY_CTX.

                                                                                                          "},{"location":"man7/crypto/#performance","title":"Performance","text":"

                                                                                                          If you perform the same operation many times then it is recommended to use \"Explicit fetching\" to prefetch an algorithm once initially, and then pass this created object to any operations that are currently using \"Implicit fetching\". See an example of Explicit fetching in \"USING ALGORITHMS IN APPLICATIONS\".

                                                                                                          Prior to OpenSSL 3.0, constant method tables (such as EVP_sha256()) were used directly to access methods. If you pass one of these convenience functions to an operation the fixed methods are ignored, and only the name is used to internally fetch methods from a provider.

                                                                                                          If the prefetched object is not passed to operations, then any implicit fetch will use the internally cached prefetched object, but it will still be slower than passing the prefetched object directly.

                                                                                                          Fetching via a provider offers more flexibility, but it is slower than the old method, since it must search for the algorithm in all loaded providers, and then populate the method table using provider supplied methods. Internally OpenSSL caches similar algorithms on the first fetch (so loading a digest caches all digests).

                                                                                                          The following methods can be used for prefetching:

                                                                                                          • EVP_MD_fetch(3)
                                                                                                          • EVP_CIPHER_fetch(3)
                                                                                                          • EVP_KDF_fetch(3)
                                                                                                          • EVP_MAC_fetch(3)
                                                                                                          • EVP_KEM_fetch(3)
                                                                                                          • OSSL_ENCODER_fetch(3)
                                                                                                          • OSSL_DECODER_fetch(3)
                                                                                                          • EVP_RAND_fetch(3)

                                                                                                          The following methods are used internally when performing operations:

                                                                                                          • EVP_KEYMGMT_fetch(3)
                                                                                                          • EVP_KEYEXCH_fetch(3)
                                                                                                          • EVP_SIGNATURE_fetch(3)
                                                                                                          • OSSL_STORE_LOADER_fetch(3)

                                                                                                          See OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7) and OSSL_PROVIDER-legacy(7) for a list of algorithm names that can be fetched.

                                                                                                          "},{"location":"man7/crypto/#fetching-examples","title":"FETCHING EXAMPLES","text":"

                                                                                                          The following section provides a series of examples of fetching algorithm implementations.

                                                                                                          Fetch any available implementation of SHA2-256 in the default context. Note that some algorithms have aliases. So \"SHA256\" and \"SHA2-256\" are synonymous:

                                                                                                          EVP_MD *md = EVP_MD_fetch(NULL, \"SHA2-256\", NULL);\n...\nEVP_MD_free(md);\n

                                                                                                          Fetch any available implementation of AES-128-CBC in the default context:

                                                                                                          EVP_CIPHER *cipher = EVP_CIPHER_fetch(NULL, \"AES-128-CBC\", NULL);\n...\nEVP_CIPHER_free(cipher);\n

                                                                                                          Fetch an implementation of SHA2-256 from the default provider in the default context:

                                                                                                          EVP_MD *md = EVP_MD_fetch(NULL, \"SHA2-256\", \"provider=default\");\n...\nEVP_MD_free(md);\n

                                                                                                          Fetch an implementation of SHA2-256 that is not from the default provider in the default context:

                                                                                                          EVP_MD *md = EVP_MD_fetch(NULL, \"SHA2-256\", \"provider!=default\");\n...\nEVP_MD_free(md);\n

                                                                                                          Fetch an implementation of SHA2-256 from the default provider in the specified context:

                                                                                                          EVP_MD *md = EVP_MD_fetch(ctx, \"SHA2-256\", \"provider=default\");\n...\nEVP_MD_free(md);\n

                                                                                                          Load the legacy provider into the default context and then fetch an implementation of WHIRLPOOL from it:

                                                                                                          /* This only needs to be done once - usually at application start up */\nOSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, \"legacy\");\n\nEVP_MD *md = EVP_MD_fetch(NULL, \"WHIRLPOOL\", \"provider=legacy\");\n...\nEVP_MD_free(md);\n

                                                                                                          Note that in the above example the property string \"provider=legacy\" is optional since, assuming no other providers have been loaded, the only implementation of the \"whirlpool\" algorithm is in the \"legacy\" provider. Also note that the default provider should be explicitly loaded if it is required in addition to other providers:

                                                                                                          /* This only needs to be done once - usually at application start up */\nOSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, \"legacy\");\nOSSL_PROVIDER *default = OSSL_PROVIDER_load(NULL, \"default\");\n\nEVP_MD *md_whirlpool = EVP_MD_fetch(NULL, \"whirlpool\", NULL);\nEVP_MD *md_sha256 = EVP_MD_fetch(NULL, \"SHA2-256\", NULL);\n...\nEVP_MD_free(md_whirlpool);\nEVP_MD_free(md_sha256);\n
                                                                                                          "},{"location":"man7/crypto/#openssl-providers","title":"OPENSSL PROVIDERS","text":"

                                                                                                          OpenSSL comes with a set of providers.

                                                                                                          The algorithms available in each of these providers may vary due to build time configuration options. The openssl-list(1) command can be used to list the currently available algorithms.

                                                                                                          The names of the algorithms shown from openssl-list(1) can be used as an algorithm identifier to the appropriate fetching function. Also see the provider specific manual pages linked below for further details about using the algorithms available in each of the providers.

                                                                                                          As well as the OpenSSL providers third parties can also implement providers. For information on writing a provider see provider(7).

                                                                                                          "},{"location":"man7/crypto/#default-provider","title":"Default provider","text":"

                                                                                                          The default provider is built in as part of the libcrypto library and contains all of the most commonly used algorithm implementations. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string \"provider=default\" can be used as a search criterion for these implementations. The default provider includes all of the functionality in the base provider below.

                                                                                                          If you don't load any providers at all then the \"default\" provider will be automatically loaded. If you explicitly load any provider then the \"default\" provider would also need to be explicitly loaded if it is required.

                                                                                                          See OSSL_PROVIDER-default(7).

                                                                                                          "},{"location":"man7/crypto/#base-provider","title":"Base provider","text":"

                                                                                                          The base provider is built in as part of the libcrypto library and contains algorithm implementations for encoding and decoding for OpenSSL keys. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string \"provider=base\" can be used as a search criterion for these implementations. Some encoding and decoding algorithm implementations are not FIPS algorithm implementations in themselves but support algorithms from the FIPS provider and are allowed for use in \"FIPS mode\". The property query string \"fips=yes\" can be used to select such algorithms.

                                                                                                          See OSSL_PROVIDER-base(7).

                                                                                                          "},{"location":"man7/crypto/#fips-provider","title":"FIPS provider","text":"

                                                                                                          The FIPS provider is a dynamically loadable module, and must therefore be loaded explicitly, either in code or through OpenSSL configuration (see config(5)). It contains algorithm implementations that have been validated according to the FIPS 140-2 standard. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string \"provider=fips\" can be used as a search criterion for these implementations. All approved algorithm implementations in the FIPS provider can also be selected with the property \"fips=yes\". The FIPS provider may also contain non-approved algorithm implementations and these can be selected with the property \"fips=no\".

                                                                                                          See OSSL_PROVIDER-FIPS(7) and fips_module(7).

                                                                                                          "},{"location":"man7/crypto/#legacy-provider","title":"Legacy provider","text":"

                                                                                                          The legacy provider is a dynamically loadable module, and must therefore be loaded explicitly, either in code or through OpenSSL configuration (see config(5)). It contains algorithm implementations that are considered insecure, or are no longer in common use such as MD2 or RC4. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property \"provider=legacy\" can be used as a search criterion for these implementations.

                                                                                                          See OSSL_PROVIDER-legacy(7).

                                                                                                          "},{"location":"man7/crypto/#null-provider","title":"Null provider","text":"

                                                                                                          The null provider is built in as part of the libcrypto library. It contains no algorithms in it at all. When fetching algorithms the default provider will be automatically loaded if no other provider has been explicitly loaded. To prevent that from happening you can explicitly load the null provider.

                                                                                                          See OSSL_PROVIDER-null(7).

                                                                                                          "},{"location":"man7/crypto/#using-algorithms-in-applications","title":"USING ALGORITHMS IN APPLICATIONS","text":"

                                                                                                          Cryptographic algorithms are made available to applications through use of the \"EVP\" APIs. Each of the various operations such as encryption, digesting, message authentication codes, etc., have a set of EVP function calls that can be invoked to use them. See the evp(7) page for further details.

                                                                                                          Most of these follow a common pattern. A \"context\" object is first created. For example for a digest operation you would use an EVP_MD_CTX, and for an encryption/decryption operation you would use an EVP_CIPHER_CTX. The operation is then initialised ready for use via an \"init\" function - optionally passing in a set of parameters (using the OSSL_PARAM(3) type) to configure how the operation should behave. Next data is fed into the operation in a series of \"update\" calls. The operation is finalised using a \"final\" call which will typically provide some kind of output. Finally the context is cleaned up and freed.

                                                                                                          The following shows a complete example for doing this process for digesting data using SHA256. The process is similar for other operations such as encryption/decryption, signatures, message authentication codes, etc.

                                                                                                          #include <stdio.h>\n#include <openssl/evp.h>\n#include <openssl/bio.h>\n#include <openssl/err.h>\n\nint main(void)\n{\n    EVP_MD_CTX *ctx = NULL;\n    EVP_MD *sha256 = NULL;\n    const unsigned char msg[] = {\n        0x00, 0x01, 0x02, 0x03\n    };\n    unsigned int len = 0;\n    unsigned char *outdigest = NULL;\n    int ret = 1;\n\n    /* Create a context for the digest operation */\n    ctx = EVP_MD_CTX_new();\n    if (ctx == NULL)\n        goto err;\n\n    /*\n     * Fetch the SHA256 algorithm implementation for doing the digest. We're\n     * using the \"default\" library context here (first NULL parameter), and\n     * we're not supplying any particular search criteria for our SHA256\n     * implementation (second NULL parameter). Any SHA256 implementation will\n     * do.\n     * In a larger application this fetch would just be done once, and could\n     * be used for multiple calls to other operations such as EVP_DigestInit_ex().\n     */\n    sha256 = EVP_MD_fetch(NULL, \"SHA256\", NULL);\n    if (sha256 == NULL)\n        goto err;\n\n   /* Initialise the digest operation */\n   if (!EVP_DigestInit_ex(ctx, sha256, NULL))\n       goto err;\n\n    /*\n     * Pass the message to be digested. This can be passed in over multiple\n     * EVP_DigestUpdate calls if necessary\n     */\n    if (!EVP_DigestUpdate(ctx, msg, sizeof(msg)))\n        goto err;\n\n    /* Allocate the output buffer */\n    outdigest = OPENSSL_malloc(EVP_MD_get_size(sha256));\n    if (outdigest == NULL)\n        goto err;\n\n    /* Now calculate the digest itself */\n    if (!EVP_DigestFinal_ex(ctx, outdigest, &len))\n        goto err;\n\n    /* Print out the digest result */\n    BIO_dump_fp(stdout, outdigest, len);\n\n    ret = 0;\n\n err:\n    /* Clean up all the resources we allocated */\n    OPENSSL_free(outdigest);\n    EVP_MD_free(sha256);\n    EVP_MD_CTX_free(ctx);\n    if (ret != 0)\n       ERR_print_errors_fp(stderr);\n    return ret;\n}\n
                                                                                                          "},{"location":"man7/crypto/#configuration","title":"CONFIGURATION","text":"

                                                                                                          By default OpenSSL will load a configuration file when it is first used. This will set up various configuration settings within the default library context. Applications that create their own library contexts may optionally configure them with a config file using the OSSL_LIB_CTX_load_config(3) function.

                                                                                                          The configuration file can be used to automatically load providers and set up default property query strings.

                                                                                                          For information on the OpenSSL configuration file format see config(5).

                                                                                                          "},{"location":"man7/crypto/#encoding-and-decoding-keys","title":"ENCODING AND DECODING KEYS","text":"

                                                                                                          Many algorithms require the use of a key. Keys can be generated dynamically using the EVP APIs (for example see EVP_PKEY_Q_keygen(3)). However it is often necessary to save or load keys (or their associated parameters) to or from some external format such as PEM or DER (see openssl-glossary(7)). OpenSSL uses encoders and decoders to perform this task.

                                                                                                          Encoders and decoders are just algorithm implementations in the same way as any other algorithm implementation in OpenSSL. They are implemented by providers. The OpenSSL encoders and decoders are available in the default provider. They are also duplicated in the base provider.

                                                                                                          For information about encoders see OSSL_ENCODER_CTX_new_for_pkey(3). For information about decoders see OSSL_DECODER_CTX_new_for_pkey(3).

                                                                                                          "},{"location":"man7/crypto/#library-conventions","title":"LIBRARY CONVENTIONS","text":"

                                                                                                          Many OpenSSL functions that \"get\" or \"set\" a value follow a naming convention using the numbers 0 and 1, i.e. \"get0\", \"get1\", \"set0\" and \"set1\". This can also apply to some functions that \"add\" a value to an existing set, i.e. \"add0\" and \"add1\".

                                                                                                          For example the functions:

                                                                                                          int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);\nint X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj);\n

                                                                                                          In the 0 version the ownership of the object is passed to (for an add or set) or retained by (for a get) the parent object. For example after calling the X509_CRL_add0_revoked() function above, ownership of the rev object is passed to the crl object. Therefore, after calling this function rev should not be freed directly. It will be freed implicitly when crl is freed.

                                                                                                          In the 1 version the ownership of the object is not passed to or retained by the parent object. Instead a copy or \"up ref\" of the object is performed. So after calling the X509_add1_trust_object() function above the application will still be responsible for freeing the obj value where appropriate.

                                                                                                          "},{"location":"man7/crypto/#see-also","title":"SEE ALSO","text":"

                                                                                                          openssl(1), ssl(7), evp(7), OSSL_LIB_CTX(3), openssl-threads(7), property(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-base(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-legacy(7), OSSL_PROVIDER-null(7), openssl-glossary(7), provider(7)

                                                                                                          "},{"location":"man7/crypto/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/ct/","title":"ct","text":""},{"location":"man7/ct/#name","title":"NAME","text":"

                                                                                                          ct - Certificate Transparency

                                                                                                          "},{"location":"man7/ct/#synopsis","title":"SYNOPSIS","text":"
                                                                                                          #include <openssl/ct.h>\n
                                                                                                          "},{"location":"man7/ct/#description","title":"DESCRIPTION","text":"

                                                                                                          This library implements Certificate Transparency (CT) verification for TLS clients, as defined in RFC 6962. This verification can provide some confidence that a certificate has been publicly logged in a set of CT logs.

                                                                                                          By default, these checks are disabled. They can be enabled using SSL_CTX_enable_ct(3) or SSL_enable_ct(3).

                                                                                                          This library can also be used to parse and examine CT data structures, such as Signed Certificate Timestamps (SCTs), or to read a list of CT logs. There are functions for: - decoding and encoding SCTs in DER and TLS wire format. - printing SCTs. - verifying the authenticity of SCTs. - loading a CT log list from a CONF file.

                                                                                                          "},{"location":"man7/ct/#see-also","title":"SEE ALSO","text":"

                                                                                                          d2i_SCT_LIST(3), CTLOG_STORE_new(3), CTLOG_STORE_get0_log_by_id(3), SCT_new(3), SCT_print(3), SCT_validate(3), SCT_validate(3), CT_POLICY_EVAL_CTX_new(3), SSL_CTX_set_ct_validation_callback(3)

                                                                                                          "},{"location":"man7/ct/#history","title":"HISTORY","text":"

                                                                                                          The ct library was added in OpenSSL 1.1.0.

                                                                                                          "},{"location":"man7/ct/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/des_modes/","title":"des_modes","text":""},{"location":"man7/des_modes/#name","title":"NAME","text":"

                                                                                                          des_modes - the variants of DES and other crypto algorithms of OpenSSL

                                                                                                          "},{"location":"man7/des_modes/#description","title":"DESCRIPTION","text":"

                                                                                                          Several crypto algorithms for OpenSSL can be used in a number of modes. Those are used for using block ciphers in a way similar to stream ciphers, among other things.

                                                                                                          "},{"location":"man7/des_modes/#overview","title":"OVERVIEW","text":""},{"location":"man7/des_modes/#electronic-codebook-mode-ecb","title":"Electronic Codebook Mode (ECB)","text":"

                                                                                                          Normally, this is found as the function algorithm_ecb_encrypt().

                                                                                                          • 64 bits are enciphered at a time.
                                                                                                          • The order of the blocks can be rearranged without detection.
                                                                                                          • The same plaintext block always produces the same ciphertext block (for the same key) making it vulnerable to a 'dictionary attack'.
                                                                                                          • An error will only affect one ciphertext block.
                                                                                                          "},{"location":"man7/des_modes/#cipher-block-chaining-mode-cbc","title":"Cipher Block Chaining Mode (CBC)","text":"

                                                                                                          Normally, this is found as the function algorithm_cbc_encrypt(). Be aware that des_cbc_encrypt() is not really DES CBC (it does not update the IV); use des_ncbc_encrypt() instead.

                                                                                                          • a multiple of 64 bits are enciphered at a time.
                                                                                                          • The CBC mode produces the same ciphertext whenever the same plaintext is encrypted using the same key and starting variable.
                                                                                                          • The chaining operation makes the ciphertext blocks dependent on the current and all preceding plaintext blocks and therefore blocks can not be rearranged.
                                                                                                          • The use of different starting variables prevents the same plaintext enciphering to the same ciphertext.
                                                                                                          • An error will affect the current and the following ciphertext blocks.
                                                                                                          "},{"location":"man7/des_modes/#cipher-feedback-mode-cfb","title":"Cipher Feedback Mode (CFB)","text":"

                                                                                                          Normally, this is found as the function algorithm_cfb_encrypt().

                                                                                                          • a number of bits (j) <= 64 are enciphered at a time.
                                                                                                          • The CFB mode produces the same ciphertext whenever the same plaintext is encrypted using the same key and starting variable.
                                                                                                          • The chaining operation makes the ciphertext variables dependent on the current and all preceding variables and therefore j-bit variables are chained together and can not be rearranged.
                                                                                                          • The use of different starting variables prevents the same plaintext enciphering to the same ciphertext.
                                                                                                          • The strength of the CFB mode depends on the size of k (maximal if j == k). In my implementation this is always the case.
                                                                                                          • Selection of a small value for j will require more cycles through the encipherment algorithm per unit of plaintext and thus cause greater processing overheads.
                                                                                                          • Only multiples of j bits can be enciphered.
                                                                                                          • An error will affect the current and the following ciphertext variables.
                                                                                                          "},{"location":"man7/des_modes/#output-feedback-mode-ofb","title":"Output Feedback Mode (OFB)","text":"

                                                                                                          Normally, this is found as the function algorithm_ofb_encrypt().

                                                                                                          • a number of bits (j) <= 64 are enciphered at a time.
                                                                                                          • The OFB mode produces the same ciphertext whenever the same plaintext enciphered using the same key and starting variable. More over, in the OFB mode the same key stream is produced when the same key and start variable are used. Consequently, for security reasons a specific start variable should be used only once for a given key.
                                                                                                          • The absence of chaining makes the OFB more vulnerable to specific attacks.
                                                                                                          • The use of different start variables values prevents the same plaintext enciphering to the same ciphertext, by producing different key streams.
                                                                                                          • Selection of a small value for j will require more cycles through the encipherment algorithm per unit of plaintext and thus cause greater processing overheads.
                                                                                                          • Only multiples of j bits can be enciphered.
                                                                                                          • OFB mode of operation does not extend ciphertext errors in the resultant plaintext output. Every bit error in the ciphertext causes only one bit to be in error in the deciphered plaintext.
                                                                                                          • OFB mode is not self-synchronizing. If the two operation of encipherment and decipherment get out of synchronism, the system needs to be re-initialized.
                                                                                                          • Each re-initialization should use a value of the start variable different from the start variable values used before with the same key. The reason for this is that an identical bit stream would be produced each time from the same parameters. This would be susceptible to a 'known plaintext' attack.
                                                                                                          "},{"location":"man7/des_modes/#triple-ecb-mode","title":"Triple ECB Mode","text":"

                                                                                                          Normally, this is found as the function algorithm_ecb3_encrypt().

                                                                                                          • Encrypt with key1, decrypt with key2 and encrypt with key3 again.
                                                                                                          • As for ECB encryption but increases the key length to 168 bits. There are theoretic attacks that can be used that make the effective key length 112 bits, but this attack also requires 2^56 blocks of memory, not very likely, even for the NSA.
                                                                                                          • If both keys are the same it is equivalent to encrypting once with just one key.
                                                                                                          • If the first and last key are the same, the key length is 112 bits. There are attacks that could reduce the effective key strength to only slightly more than 56 bits, but these require a lot of memory.
                                                                                                          • If all 3 keys are the same, this is effectively the same as normal ecb mode.
                                                                                                          "},{"location":"man7/des_modes/#triple-cbc-mode","title":"Triple CBC Mode","text":"

                                                                                                          Normally, this is found as the function algorithm_ede3_cbc_encrypt().

                                                                                                          • Encrypt with key1, decrypt with key2 and then encrypt with key3.
                                                                                                          • As for CBC encryption but increases the key length to 168 bits with the same restrictions as for triple ecb mode.
                                                                                                          "},{"location":"man7/des_modes/#notes","title":"NOTES","text":"

                                                                                                          This text was been written in large parts by Eric Young in his original documentation for SSLeay, the predecessor of OpenSSL. In turn, he attributed it to:

                                                                                                              AS 2805.5.2\n    Australian Standard\n    Electronic funds transfer - Requirements for interfaces,\n    Part 5.2: Modes of operation for an n-bit block cipher algorithm\n    Appendix A\n
                                                                                                          "},{"location":"man7/des_modes/#see-also","title":"SEE ALSO","text":"

                                                                                                          BF_encrypt(3), DES_crypt(3)

                                                                                                          "},{"location":"man7/des_modes/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/evp/","title":"evp","text":""},{"location":"man7/evp/#name","title":"NAME","text":"

                                                                                                          evp - high-level cryptographic functions

                                                                                                          "},{"location":"man7/evp/#synopsis","title":"SYNOPSIS","text":"
                                                                                                          #include <openssl/evp.h>\n
                                                                                                          "},{"location":"man7/evp/#description","title":"DESCRIPTION","text":"

                                                                                                          The EVP library provides a high-level interface to cryptographic functions.

                                                                                                          The EVP_SealXXX and EVP_OpenXXX functions provide public key encryption and decryption to implement digital \"envelopes\".

                                                                                                          The EVP_DigestSignXXX and EVP_DigestVerifyXXX functions implement digital signatures and Message Authentication Codes (MACs). Also see the older EVP_SignXXX and EVP_VerifyXXX functions.

                                                                                                          Symmetric encryption is available with the EVP_EncryptXXX functions. The EVP_DigestXXX functions provide message digests.

                                                                                                          The EVP_PKEYXXX functions provide a high-level interface to asymmetric algorithms. To create a new EVP_PKEY see EVP_PKEY_new(3). EVP_PKEYs can be associated with a private key of a particular algorithm by using the functions described on the EVP_PKEY_fromdata(3) page, or new keys can be generated using EVP_PKEY_keygen(3). EVP_PKEYs can be compared using EVP_PKEY_eq(3), or printed using EVP_PKEY_print_private(3). EVP_PKEY_todata(3) can be used to convert a key back into an OSSL_PARAM(3) array.

                                                                                                          The EVP_PKEY functions support the full range of asymmetric algorithm operations:

                                                                                                          • For key agreement see EVP_PKEY_derive(3)
                                                                                                          • For signing and verifying see EVP_PKEY_sign(3), EVP_PKEY_verify(3) and EVP_PKEY_verify_recover(3). However, note that these functions do not perform a digest of the data to be signed. Therefore, normally you would use the EVP_DigestSignInit(3) functions for this purpose.
                                                                                                          • For encryption and decryption see EVP_PKEY_encrypt(3) and EVP_PKEY_decrypt(3) respectively. However, note that these functions perform encryption and decryption only. As public key encryption is an expensive operation, normally you would wrap an encrypted message in a \"digital envelope\" using the EVP_SealInit(3) and EVP_OpenInit(3) functions.

                                                                                                          The EVP_BytesToKey(3) function provides some limited support for password based encryption. Careful selection of the parameters will provide a PKCS#5 PBKDF1 compatible implementation. However, new applications should not typically use this (preferring, for example, PBKDF2 from PCKS#5).

                                                                                                          The EVP_EncodeXXX and EVP_DecodeXXX functions implement base 64 encoding and decoding.

                                                                                                          All the symmetric algorithms (ciphers), digests and asymmetric algorithms (public key algorithms) can be replaced by ENGINE modules providing alternative implementations. If ENGINE implementations of ciphers or digests are registered as defaults, then the various EVP functions will automatically use those implementations automatically in preference to built in software implementations. For more information, consult the engine(3) man page.

                                                                                                          Although low-level algorithm specific functions exist for many algorithms their use is discouraged. They cannot be used with an ENGINE and ENGINE versions of new algorithms cannot be accessed using the low-level functions. Also makes code harder to adapt to new algorithms and some options are not cleanly supported at the low-level and some operations are more efficient using the high-level interface.

                                                                                                          "},{"location":"man7/evp/#see-also","title":"SEE ALSO","text":"

                                                                                                          EVP_DigestInit(3), EVP_EncryptInit(3), EVP_OpenInit(3), EVP_SealInit(3), EVP_DigestSignInit(3), EVP_SignInit(3), EVP_VerifyInit(3), EVP_EncodeInit(3), EVP_PKEY_new(3), EVP_PKEY_fromdata(3), EVP_PKEY_todata(3), EVP_PKEY_keygen(3), EVP_PKEY_print_private(3), EVP_PKEY_decrypt(3), EVP_PKEY_encrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3), EVP_BytesToKey(3), ENGINE_by_id(3)

                                                                                                          "},{"location":"man7/evp/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/fips_module/","title":"fips_module","text":""},{"location":"man7/fips_module/#name","title":"NAME","text":"

                                                                                                          fips_module - OpenSSL fips module guide

                                                                                                          "},{"location":"man7/fips_module/#synopsis","title":"SYNOPSIS","text":"

                                                                                                          See the individual manual pages for details.

                                                                                                          "},{"location":"man7/fips_module/#description","title":"DESCRIPTION","text":"

                                                                                                          This guide details different ways that OpenSSL can be used in conjunction with the FIPS module. Which is the correct approach to use will depend on your own specific circumstances and what you are attempting to achieve.

                                                                                                          For information related to installing the FIPS module see https://github.com/openssl/openssl/blob/master/README-FIPS.md.

                                                                                                          Note that the old functions FIPS_mode() and FIPS_mode_set() are no longer present so you must remove them from your application if you use them.

                                                                                                          Applications written to use the OpenSSL 3.0 FIPS module should not use any legacy APIs or features that avoid the FIPS module. Specifically this includes:

                                                                                                          • Low level cryptographic APIs (use the high level APIs, such as EVP, instead)
                                                                                                          • Engines
                                                                                                          • Any functions that create or modify custom \"METHODS\" (for example EVP_MD_meth_new(), EVP_CIPHER_meth_new(), EVP_PKEY_meth_new(), RSA_meth_new(), EC_KEY_METHOD_new(), etc.)

                                                                                                          All of the above APIs are deprecated in OpenSSL 3.0 - so a simple rule is to avoid using all deprecated functions. See migration_guide(7) for a list of deprecated functions.

                                                                                                          "},{"location":"man7/fips_module/#making-all-applications-use-the-fips-module-by-default","title":"Making all applications use the FIPS module by default","text":"

                                                                                                          One simple approach is to cause all applications that are using OpenSSL to only use the FIPS module for cryptographic algorithms by default.

                                                                                                          This approach can be done purely via configuration. As long as applications are built and linked against OpenSSL 3.0 and do not override the loading of the default config file or its settings then they can automatically start using the FIPS module without the need for any further code changes.

                                                                                                          To do this the default OpenSSL config file will have to be modified. The location of this config file will depend on the platform, and any options that were given during the build process. You can check the location of the config file by running this command:

                                                                                                          $ openssl version -d\nOPENSSLDIR: \"/usr/local/ssl\"\n

                                                                                                          Caution: Many Operating Systems install OpenSSL by default. It is a common error to not have the correct version of OpenSSL in your $PATH. Check that you are running an OpenSSL 3.0 version like this:

                                                                                                          $ openssl version -v\nOpenSSL 3.0.0-dev xx XXX xxxx (Library: OpenSSL 3.0.0-dev xx XXX xxxx)\n

                                                                                                          The OPENSSLDIR value above gives the directory name for where the default config file is stored. So in this case the default config file will be called /usr/local/ssl/openssl.cnf.

                                                                                                          Edit the config file to add the following lines near the beginning:

                                                                                                          config_diagnostics = 1\nopenssl_conf = openssl_init\n\n.include /usr/local/ssl/fipsmodule.cnf\n\n[openssl_init]\nproviders = provider_sect\nalg_section = algorithm_sect\n\n[provider_sect]\nfips = fips_sect\nbase = base_sect\n\n[base_sect]\nactivate = 1\n\n[algorithm_sect]\ndefault_properties = fips=yes\n

                                                                                                          Obviously the include file location above should match the path and name of the FIPS module config file that you installed earlier. See https://github.com/openssl/openssl/blob/master/README-FIPS.md.

                                                                                                          For FIPS usage, it is recommended that the config_diagnostics option is enabled to prevent accidental use of non-FIPS validated algorithms via broken or mistaken configuration. See config(5).

                                                                                                          Any applications that use OpenSSL 3.0 and are started after these changes are made will start using only the FIPS module unless those applications take explicit steps to avoid this default behaviour. Note that this configuration also activates the \"base\" provider. The base provider does not include any cryptographic algorithms (and therefore does not impact the validation status of any cryptographic operations), but does include other supporting algorithms that may be required. It is designed to be used in conjunction with the FIPS module.

                                                                                                          This approach has the primary advantage that it is simple, and no code changes are required in applications in order to benefit from the FIPS module. There are some disadvantages to this approach:

                                                                                                          • You may not want all applications to use the FIPS module.

                                                                                                            It may be the case that some applications should and some should not use the FIPS module.

                                                                                                          • If applications take explicit steps to not load the default config file or set different settings.

                                                                                                            This method will not work for these cases.

                                                                                                          • The algorithms available in the FIPS module are a subset of the algorithms that are available in the default OpenSSL Provider.

                                                                                                            If any applications attempt to use any algorithms that are not present, then they will fail.

                                                                                                          • Usage of certain deprecated APIs avoids the use of the FIPS module.

                                                                                                            If any applications use those APIs then the FIPS module will not be used.

                                                                                                          "},{"location":"man7/fips_module/#selectively-making-applications-use-the-fips-module-by-default","title":"Selectively making applications use the FIPS module by default","text":"

                                                                                                          A variation on the above approach is to do the same thing on an individual application basis. The default OpenSSL config file depends on the compiled in value for OPENSSLDIR as described in the section above. However it is also possible to override the config file to be used via the OPENSSL_CONF environment variable. For example the following, on Unix, will cause the application to be executed with a non-standard config file location:

                                                                                                          $ OPENSSL_CONF=/my/nondefault/openssl.cnf myapplication\n

                                                                                                          Using this mechanism you can control which config file is loaded (and hence whether the FIPS module is loaded) on an application by application basis.

                                                                                                          This removes the disadvantage listed above that you may not want all applications to use the FIPS module. All the other advantages and disadvantages still apply.

                                                                                                          "},{"location":"man7/fips_module/#programmatically-loading-the-fips-module-default-library-context","title":"Programmatically loading the FIPS module (default library context)","text":"

                                                                                                          Applications may choose to load the FIPS provider explicitly rather than relying on config to do this. The config file is still necessary in order to hold the FIPS module config data (such as its self test status and integrity data). But in this case we do not automatically activate the FIPS provider via that config file.

                                                                                                          To do things this way configure as per \"Making all applications use the FIPS module by default\" above, but edit the fipsmodule.cnf file to remove or comment out the line which says activate = 1 (note that setting this value to 0 is not sufficient). This means all the required config information will be available to load the FIPS module, but it is not automatically loaded when the application starts. The FIPS provider can then be loaded programmatically like this:

                                                                                                          #include <openssl/provider.h>\n\nint main(void)\n{\n    OSSL_PROVIDER *fips;\n    OSSL_PROVIDER *base;\n\n    fips = OSSL_PROVIDER_load(NULL, \"fips\");\n    if (fips == NULL) {\n        printf(\"Failed to load FIPS provider\\n\");\n        exit(EXIT_FAILURE);\n    }\n    base = OSSL_PROVIDER_load(NULL, \"base\");\n    if (base == NULL) {\n        OSSL_PROVIDER_unload(fips);\n        printf(\"Failed to load base provider\\n\");\n        exit(EXIT_FAILURE);\n    }\n\n    /* Rest of application */\n\n    OSSL_PROVIDER_unload(base);\n    OSSL_PROVIDER_unload(fips);\n    exit(EXIT_SUCCESS);\n}\n

                                                                                                          Note that this should be one of the first things that you do in your application. If any OpenSSL functions get called that require the use of cryptographic functions before this occurs then, if no provider has yet been loaded, then the default provider will be automatically loaded. If you then later explicitly load the FIPS provider then you will have both the FIPS and the default provider loaded at the same time. It is undefined which implementation of an algorithm will be used if multiple implementations are available and you have not explicitly specified via a property query (see below) which one should be used.

                                                                                                          Also note that in this example we have additionally loaded the \"base\" provider. This loads a sub-set of algorithms that are also available in the default provider - specifically non cryptographic ones which may be used in conjunction with the FIPS provider. For example this contains algorithms for encoding and decoding keys. If you decide not to load the default provider then you will usually want to load the base provider instead.

                                                                                                          In this example we are using the \"default\" library context. OpenSSL functions operate within the scope of a library context. If no library context is explicitly specified then the default library context is used. For further details about library contexts see the OSSL_LIB_CTX(3) man page.

                                                                                                          "},{"location":"man7/fips_module/#loading-the-fips-module-at-the-same-time-as-other-providers","title":"Loading the FIPS module at the same time as other providers","text":"

                                                                                                          It is possible to have the FIPS provider and other providers (such as the default provider) all loaded at the same time into the same library context. You can use a property query string during algorithm fetches to specify which implementation you would like to use.

                                                                                                          For example to fetch an implementation of SHA256 which conforms to FIPS standards you can specify the property query fips=yes like this:

                                                                                                          EVP_MD *sha256;\n\nsha256 = EVP_MD_fetch(NULL, \"SHA2-256\", \"fips=yes\");\n

                                                                                                          If no property query is specified, or more than one implementation matches the property query then it is undefined which implementation of a particular algorithm will be returned.

                                                                                                          This example shows an explicit request for an implementation of SHA256 from the default provider:

                                                                                                          EVP_MD *sha256;\n\nsha256 = EVP_MD_fetch(NULL, \"SHA2-256\", \"provider=default\");\n

                                                                                                          It is also possible to set a default property query string. The following example sets the default property query of fips=yes for all fetches within the default library context:

                                                                                                          EVP_set_default_properties(NULL, \"fips=yes\");\n

                                                                                                          If a fetch function has both an explicit property query specified, and a default property query is defined then the two queries are merged together and both apply. The local property query overrides the default properties if the same property name is specified in both.

                                                                                                          There are two important built-in properties that you should be aware of:

                                                                                                          The \"provider\" property enables you to specify which provider you want an implementation to be fetched from, e.g. provider=default or provider=fips. All algorithms implemented in a provider have this property set on them.

                                                                                                          There is also the fips property. All FIPS algorithms match against the property query fips=yes. There are also some non-cryptographic algorithms available in the default and base providers that also have the fips=yes property defined for them. These are the encoder and decoder algorithms that can (for example) be used to write out a key generated in the FIPS provider to a file. The encoder and decoder algorithms are not in the FIPS module itself but are allowed to be used in conjunction with the FIPS algorithms.

                                                                                                          It is possible to specify default properties within a config file. For example the following config file automatically loads the default and FIPS providers and sets the default property value to be fips=yes. Note that this config file does not load the \"base\" provider. All supporting algorithms that are in \"base\" are also in \"default\", so it is unnecessary in this case:

                                                                                                          config_diagnostics = 1\nopenssl_conf = openssl_init\n\n.include /usr/local/ssl/fipsmodule.cnf\n\n[openssl_init]\nproviders = provider_sect\nalg_section = algorithm_sect\n\n[provider_sect]\nfips = fips_sect\ndefault = default_sect\n\n[default_sect]\nactivate = 1\n\n[algorithm_sect]\ndefault_properties = fips=yes\n
                                                                                                          "},{"location":"man7/fips_module/#programmatically-loading-the-fips-module-nondefault-library-context","title":"Programmatically loading the FIPS module (nondefault library context)","text":"

                                                                                                          In addition to using properties to separate usage of the FIPS module from other usages this can also be achieved using library contexts. In this example we create two library contexts. In one we assume the existence of a config file called openssl-fips.cnf that automatically loads and configures the FIPS and base providers. The other library context will just use the default provider.

                                                                                                          OSSL_LIB_CTX *fips_libctx, *nonfips_libctx;\nOSSL_PROVIDER *defctxnull = NULL;\nEVP_MD *fipssha256 = NULL, *nonfipssha256 = NULL;\nint ret = 1;\n\n/*\n * Create two nondefault library contexts. One for fips usage and\n * one for non-fips usage\n */\nfips_libctx = OSSL_LIB_CTX_new();\nnonfips_libctx = OSSL_LIB_CTX_new();\nif (fips_libctx == NULL || nonfips_libctx == NULL)\n    goto err;\n\n/* Prevent anything from using the default library context */\ndefctxnull = OSSL_PROVIDER_load(NULL, \"null\");\n\n/*\n * Load config file for the FIPS library context. We assume that\n * this config file will automatically activate the FIPS and base\n * providers so we don't need to explicitly load them here.\n */\nif (!OSSL_LIB_CTX_load_config(fips_libctx, \"openssl-fips.cnf\"))\n    goto err;\n\n/*\n * Set the default property query on the FIPS library context to\n * ensure that only FIPS algorithms can be used.  There are a few non-FIPS\n * approved algorithms in the FIPS provider for backward compatibility reasons.\n */\nif (!EVP_set_default_properties(fips_libctx, \"fips=yes\"))\n    goto err;\n\n/*\n * We don't need to do anything special to load the default\n * provider into nonfips_libctx. This happens automatically if no\n * other providers are loaded.\n * Because we don't call OSSL_LIB_CTX_load_config() explicitly for\n * nonfips_libctx it will just use the default config file.\n */\n\n/* As an example get some digests */\n\n/* Get a FIPS validated digest */\nfipssha256 = EVP_MD_fetch(fips_libctx, \"SHA2-256\", NULL);\nif (fipssha256 == NULL)\n    goto err;\n\n/* Get a non-FIPS validated digest */\nnonfipssha256 = EVP_MD_fetch(nonfips_libctx, \"SHA2-256\", NULL);\nif (nonfipssha256 == NULL)\n    goto err;\n\n/* Use the digests */\n\nprintf(\"Success\\n\");\nret = 0;\n\nerr:\nEVP_MD_free(fipssha256);\nEVP_MD_free(nonfipssha256);\nOSSL_LIB_CTX_free(fips_libctx);\nOSSL_LIB_CTX_free(nonfips_libctx);\nOSSL_PROVIDER_unload(defctxnull);\n\nreturn ret;\n

                                                                                                          Note that we have made use of the special \"null\" provider here which we load into the default library context. We could have chosen to use the default library context for FIPS usage, and just create one additional library context for other usages - or vice versa. However if code has not been converted to use library contexts then the default library context will be automatically used. This could be the case for your own existing applications as well as certain parts of OpenSSL itself. Not all parts of OpenSSL are library context aware. If this happens then you could \"accidentally\" use the wrong library context for a particular operation. To be sure this doesn't happen you can load the \"null\" provider into the default library context. Because a provider has been explicitly loaded, the default provider will not automatically load. This means code using the default context by accident will fail because no algorithms will be available.

                                                                                                          See \"Library Context\" in migration_guide(7) for additional information about the Library Context.

                                                                                                          "},{"location":"man7/fips_module/#using-encoders-and-decoders-with-the-fips-module","title":"Using Encoders and Decoders with the FIPS module","text":"

                                                                                                          Encoders and decoders are used to read and write keys or parameters from or to some external format (for example a PEM file). If your application generates keys or parameters that then need to be written into PEM or DER format then it is likely that you will need to use an encoder to do this. Similarly you need a decoder to read previously saved keys and parameters. In most cases this will be invisible to you if you are using APIs that existed in OpenSSL 1.1.1 or earlier such as i2d_PrivateKey(3). However the appropriate encoder/decoder will need to be available in the library context associated with the key or parameter object. The built-in OpenSSL encoders and decoders are implemented in both the default and base providers and are not in the FIPS module boundary. However since they are not cryptographic algorithms themselves it is still possible to use them in conjunction with the FIPS module, and therefore these encoders/decoders have the fips=yes property against them. You should ensure that either the default or base provider is loaded into the library context in this case.

                                                                                                          "},{"location":"man7/fips_module/#using-the-fips-module-in-ssltls","title":"Using the FIPS module in SSL/TLS","text":"

                                                                                                          Writing an application that uses libssl in conjunction with the FIPS module is much the same as writing a normal libssl application. If you are using global properties and the default library context to specify usage of FIPS validated algorithms then this will happen automatically for all cryptographic algorithms in libssl. If you are using a nondefault library context to load the FIPS provider then you can supply this to libssl using the function SSL_CTX_new_ex(3). This works as a drop in replacement for the function SSL_CTX_new(3) except it provides you with the capability to specify the library context to be used. You can also use the same function to specify libssl specific properties to use.

                                                                                                          In this first example we create two SSL_CTX objects using two different library contexts.

                                                                                                          /*\n * We assume that a nondefault library context with the FIPS\n * provider loaded has been created called fips_libctx.\n */\nSSL_CTX *fips_ssl_ctx = SSL_CTX_new_ex(fips_libctx, \"fips=yes\", TLS_method());\n/*\n * We assume that a nondefault library context with the default\n * provider loaded has been created called non_fips_libctx.\n */\nSSL_CTX *non_fips_ssl_ctx = SSL_CTX_new_ex(non_fips_libctx, NULL,\n                                           TLS_method());\n

                                                                                                          In this second example we create two SSL_CTX objects using different properties to specify FIPS usage:

                                                                                                          /*\n * The \"fips=yes\" property includes all FIPS approved algorithms\n * as well as encoders from the default provider that are allowed\n * to be used. The NULL below indicates that we are using the\n * default library context.\n */\nSSL_CTX *fips_ssl_ctx = SSL_CTX_new_ex(NULL, \"fips=yes\", TLS_method());\n/*\n * The \"provider!=fips\" property allows algorithms from any\n * provider except the FIPS provider\n */\nSSL_CTX *non_fips_ssl_ctx = SSL_CTX_new_ex(NULL, \"provider!=fips\",\n                                           TLS_method());\n
                                                                                                          "},{"location":"man7/fips_module/#confirming-that-an-algorithm-is-being-provided-by-the-fips-module","title":"Confirming that an algorithm is being provided by the FIPS module","text":"

                                                                                                          A chain of links needs to be followed to go from an algorithm instance to the provider that implements it. The process is similar for all algorithms. Here the example of a digest is used.

                                                                                                          To go from an EVP_MD_CTX to an EVP_MD, use EVP_MD_CTX_md(3) . To go from the EVP_MD to its OSSL_PROVIDER, use EVP_MD_get0_provider(3). To extract the name from the OSSL_PROVIDER, use OSSL_PROVIDER_get0_name(3).

                                                                                                          "},{"location":"man7/fips_module/#notes","title":"NOTES","text":"

                                                                                                          Some released versions of OpenSSL do not include a validated FIPS provider. To determine which versions have undergone the validation process, please refer to the OpenSSL Downloads page. If you require FIPS-approved functionality, it is essential to build your FIPS provider using one of the validated versions listed there. Normally, it is possible to utilize a FIPS provider constructed from one of the validated versions alongside libcrypto and libssl compiled from any release within the same major release series. This flexibility enables you to address bug fixes and CVEs that fall outside the FIPS boundary.

                                                                                                          The FIPS provider in OpenSSL 3.1 includes some non-FIPS validated algorithms, consequently the property query fips=yes is mandatory for applications that want to operate in a FIPS approved manner. The algorithms are:

                                                                                                          • Triple DES ECB
                                                                                                          • Triple DES CBC
                                                                                                          • EdDSA
                                                                                                          "},{"location":"man7/fips_module/#see-also","title":"SEE ALSO","text":"

                                                                                                          migration_guide(7), crypto(7), fips_config(5), https://www.openssl.org/source/

                                                                                                          "},{"location":"man7/fips_module/#history","title":"HISTORY","text":"

                                                                                                          The FIPS module guide was created for use with the new FIPS provider in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/fips_module/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/life_cycle-cipher/","title":"life_cycle-cipher","text":""},{"location":"man7/life_cycle-cipher/#name","title":"NAME","text":"

                                                                                                          life_cycle-cipher - The cipher algorithm life-cycle

                                                                                                          "},{"location":"man7/life_cycle-cipher/#description","title":"DESCRIPTION","text":"

                                                                                                          All symmetric ciphers (CIPHERs) go through a number of stages in their life-cycle:

                                                                                                          • start

                                                                                                            This state represents the CIPHER before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                          • newed

                                                                                                            This state represents the CIPHER after it has been allocated.

                                                                                                          • initialised

                                                                                                            These states represent the CIPHER when it is set up and capable of processing input. There are three possible initialised states:

                                                                                                            • initialised using EVP_CipherInit
                                                                                                            • initialised for decryption using EVP_DecryptInit
                                                                                                            • initialised for encryption using EVP_EncryptInit
                                                                                                          • updated

                                                                                                            These states represent the CIPHER when it is set up and capable of processing additional input or generating output. The three possible states directly correspond to those for initialised above. The three different streams should not be mixed.

                                                                                                          • finaled

                                                                                                            This state represents the CIPHER when it has generated output.

                                                                                                          • freed

                                                                                                            This state is entered when the CIPHER is freed. It is the terminal state for all life-cycle transitions.

                                                                                                          "},{"location":"man7/life_cycle-cipher/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                          The usual life-cycle of a CIPHER is illustrated:

                                                                                                          "},{"location":"man7/life_cycle-cipher/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                          This section defines all of the legal state transitions. This is the canonical list.

                                                                                                          Function Call Current State start newed initialised updated finaled initialiseddecryption updateddecryption initialisedencryption updatedencryption freed EVP_CIPHER_CTX_new newed EVP_CipherInit initialised initialised initialised initialised initialised initialised initialised initialised EVP_DecryptInit initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption EVP_EncryptInit initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption EVP_CipherUpdate updated updated EVP_DecryptUpdate updateddecryption updateddecryption EVP_EncryptUpdate updatedencryption updatedencryption EVP_CipherFinal finaled EVP_DecryptFinal finaleddecryption EVP_EncryptFinal finaleddecryption EVP_CIPHER_CTX_free freed freed freed freed freed freed freed freed freed EVP_CIPHER_CTX_reset newed newed newed newed newed newed newed EVP_CIPHER_CTX_get_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption EVP_CIPHER_CTX_set_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption EVP_CIPHER_CTX_gettable_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption EVP_CIPHER_CTX_settable_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption"},{"location":"man7/life_cycle-cipher/#notes","title":"NOTES","text":"

                                                                                                          At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                          "},{"location":"man7/life_cycle-cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                          provider-cipher(7), EVP_EncryptInit(3)

                                                                                                          "},{"location":"man7/life_cycle-cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/life_cycle-digest/","title":"life_cycle-digest","text":""},{"location":"man7/life_cycle-digest/#name","title":"NAME","text":"

                                                                                                          life_cycle-digest - The digest algorithm life-cycle

                                                                                                          "},{"location":"man7/life_cycle-digest/#description","title":"DESCRIPTION","text":"

                                                                                                          All message digests (MDs) go through a number of stages in their life-cycle:

                                                                                                          • start

                                                                                                            This state represents the MD before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                          • newed

                                                                                                            This state represents the MD after it has been allocated.

                                                                                                          • initialised

                                                                                                            This state represents the MD when it is set up and capable of processing input.

                                                                                                          • updated

                                                                                                            This state represents the MD when it is set up and capable of processing additional input or generating output.

                                                                                                          • finaled

                                                                                                            This state represents the MD when it has generated output.

                                                                                                          • freed

                                                                                                            This state is entered when the MD is freed. It is the terminal state for all life-cycle transitions.

                                                                                                          "},{"location":"man7/life_cycle-digest/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                          The usual life-cycle of a MD is illustrated:

                                                                                                          "},{"location":"man7/life_cycle-digest/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                          This section defines all of the legal state transitions. This is the canonical list.

                                                                                                          Function Call Current State start newed initialised updated finaled freed EVP_MD_CTX_new newed EVP_DigestInit initialised initialised initialised initialised EVP_DigestUpdate updated updated EVP_DigestFinal finaled EVP_DigestFinalXOF finaled EVP_MD_CTX_free freed freed freed freed freed EVP_MD_CTX_reset newed newed newed newed EVP_MD_CTX_get_params newed initialised updated EVP_MD_CTX_set_params newed initialised updated EVP_MD_CTX_gettable_params newed initialised updated EVP_MD_CTX_settable_params newed initialised updated"},{"location":"man7/life_cycle-digest/#notes","title":"NOTES","text":"

                                                                                                          At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                          "},{"location":"man7/life_cycle-digest/#see-also","title":"SEE ALSO","text":"

                                                                                                          provider-digest(7), EVP_DigestInit(3)

                                                                                                          "},{"location":"man7/life_cycle-digest/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/life_cycle-kdf/","title":"life_cycle-kdf","text":""},{"location":"man7/life_cycle-kdf/#name","title":"NAME","text":"

                                                                                                          life_cycle-kdf - The KDF algorithm life-cycle

                                                                                                          "},{"location":"man7/life_cycle-kdf/#description","title":"DESCRIPTION","text":"

                                                                                                          All key derivation functions (KDFs) and pseudo random functions (PRFs) go through a number of stages in their life-cycle:

                                                                                                          • start

                                                                                                            This state represents the KDF/PRF before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                          • newed

                                                                                                            This state represents the KDF/PRF after it has been allocated.

                                                                                                          • deriving

                                                                                                            This state represents the KDF/PRF when it is set up and capable of generating output.

                                                                                                          • freed

                                                                                                            This state is entered when the KDF/PRF is freed. It is the terminal state for all life-cycle transitions.

                                                                                                          "},{"location":"man7/life_cycle-kdf/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                          The usual life-cycle of a KDF/PRF is illustrated:

                                                                                                          "},{"location":"man7/life_cycle-kdf/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                          This section defines all of the legal state transitions. This is the canonical list.

                                                                                                          Function Call Current State start newed deriving freed EVP_KDF_CTX_new newed EVP_KDF_derive deriving deriving EVP_KDF_CTX_free freed freed freed EVP_KDF_CTX_reset newed newed EVP_KDF_CTX_get_params newed deriving EVP_KDF_CTX_set_params newed deriving EVP_KDF_CTX_gettable_params newed deriving EVP_KDF_CTX_settable_params newed deriving"},{"location":"man7/life_cycle-kdf/#notes","title":"NOTES","text":"

                                                                                                          At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                          "},{"location":"man7/life_cycle-kdf/#see-also","title":"SEE ALSO","text":"

                                                                                                          provider-kdf(7), EVP_KDF(3).

                                                                                                          "},{"location":"man7/life_cycle-kdf/#history","title":"HISTORY","text":"

                                                                                                          The provider KDF interface was introduced in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/life_cycle-kdf/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/life_cycle-mac/","title":"life_cycle-mac","text":""},{"location":"man7/life_cycle-mac/#name","title":"NAME","text":"

                                                                                                          life_cycle-mac - The MAC algorithm life-cycle

                                                                                                          "},{"location":"man7/life_cycle-mac/#description","title":"DESCRIPTION","text":"

                                                                                                          All message authentication codes (MACs) go through a number of stages in their life-cycle:

                                                                                                          • start

                                                                                                            This state represents the MAC before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                          • newed

                                                                                                            This state represents the MAC after it has been allocated.

                                                                                                          • initialised

                                                                                                            This state represents the MAC when it is set up and capable of processing input.

                                                                                                          • updated

                                                                                                            This state represents the MAC when it is set up and capable of processing additional input or generating output.

                                                                                                          • finaled

                                                                                                            This state represents the MAC when it has generated output.

                                                                                                          • freed

                                                                                                            This state is entered when the MAC is freed. It is the terminal state for all life-cycle transitions.

                                                                                                          "},{"location":"man7/life_cycle-mac/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                          The usual life-cycle of a MAC is illustrated:

                                                                                                          "},{"location":"man7/life_cycle-mac/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                          This section defines all of the legal state transitions. This is the canonical list.

                                                                                                          Function Call Current State start newed initialised updated finaled freed EVP_MAC_CTX_new newed EVP_MAC_init initialised initialised initialised initialised EVP_MAC_update updated updated EVP_MAC_final finaled EVP_MAC_finalXOF finaled EVP_MAC_CTX_free freed freed freed freed freed EVP_MAC_CTX_get_params newed initialised updated EVP_MAC_CTX_set_params newed initialised updated EVP_MAC_CTX_gettable_params newed initialised updated EVP_MAC_CTX_settable_params newed initialised updated"},{"location":"man7/life_cycle-mac/#notes","title":"NOTES","text":"

                                                                                                          At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                          "},{"location":"man7/life_cycle-mac/#see-also","title":"SEE ALSO","text":"

                                                                                                          provider-mac(7), EVP_MAC(3).

                                                                                                          "},{"location":"man7/life_cycle-mac/#history","title":"HISTORY","text":"

                                                                                                          The provider MAC interface was introduced in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/life_cycle-mac/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/life_cycle-pkey/","title":"life_cycle-pkey","text":""},{"location":"man7/life_cycle-pkey/#name","title":"NAME","text":"

                                                                                                          life_cycle-pkey - The PKEY algorithm life-cycle

                                                                                                          "},{"location":"man7/life_cycle-pkey/#description","title":"DESCRIPTION","text":"

                                                                                                          All public keys (PKEYs) go through a number of stages in their life-cycle:

                                                                                                          • start

                                                                                                            This state represents the PKEY before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                          • newed

                                                                                                            This state represents the PKEY after it has been allocated.

                                                                                                          • decapsulate

                                                                                                            This state represents the PKEY when it is ready to perform a private key decapsulation operation.

                                                                                                          • decrypt

                                                                                                            This state represents the PKEY when it is ready to decrypt some ciphertext.

                                                                                                          • derive

                                                                                                            This state represents the PKEY when it is ready to derive a shared secret.

                                                                                                          • digest sign

                                                                                                            This state represents the PKEY when it is ready to perform a private key signature operation.

                                                                                                          • encapsulate

                                                                                                            This state represents the PKEY when it is ready to perform a public key encapsulation operation.

                                                                                                          • encrypt

                                                                                                            This state represents the PKEY when it is ready to encrypt some plaintext.

                                                                                                          • key generation

                                                                                                            This state represents the PKEY when it is ready to generate a new public/private key.

                                                                                                          • parameter generation

                                                                                                            This state represents the PKEY when it is ready to generate key parameters.

                                                                                                          • verify

                                                                                                            This state represents the PKEY when it is ready to verify a public key signature.

                                                                                                          • verify recover

                                                                                                            This state represents the PKEY when it is ready to recover a public key signature data.

                                                                                                          • freed

                                                                                                            This state is entered when the PKEY is freed. It is the terminal state for all life-cycle transitions.

                                                                                                          "},{"location":"man7/life_cycle-pkey/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                          The usual life-cycle of a PKEY object is illustrated:

                                                                                                          "},{"location":"man7/life_cycle-pkey/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                          This section defines all of the legal state transitions. This is the canonical list.

                                                                                                          Function Call Current State start newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration freed EVP_PKEY_CTX_new newed EVP_PKEY_CTX_new_id newed EVP_PKEY_CTX_new_from_name newed EVP_PKEY_CTX_new_from_pkey newed EVP_PKEY_sign_init digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign EVP_PKEY_sign digestsign EVP_PKEY_verify_init verify verify verify verify verify verify verify verify verify verify verify EVP_PKEY_verify verify EVP_PKEY_verify_recover_init verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover EVP_PKEY_verify_recover verifyrecover EVP_PKEY_encrypt_init encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt EVP_PKEY_encrypt encrypt EVP_PKEY_decrypt_init decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt EVP_PKEY_decrypt decrypt EVP_PKEY_derive_init derive derive derive derive derive derive derive derive derive derive derive EVP_PKEY_derive_set_peer derive EVP_PKEY_derive derive EVP_PKEY_encapsulate_init encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate EVP_PKEY_encapsulate encapsulate EVP_PKEY_decapsulate_init decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate EVP_PKEY_decapsulate decapsulate EVP_PKEY_paramgen_init parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration EVP_PKEY_paramgen parametergeneration EVP_PKEY_keygen_init keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration EVP_PKEY_keygen keygeneration EVP_PKEY_gen parametergeneration keygeneration EVP_PKEY_CTX_get_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_set_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_gettable_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_settable_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_free freed freed freed freed freed freed freed freed freed freed freed freed"},{"location":"man7/life_cycle-pkey/#notes","title":"NOTES","text":"

                                                                                                          At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                          "},{"location":"man7/life_cycle-pkey/#see-also","title":"SEE ALSO","text":"

                                                                                                          EVP_PKEY_new(3), EVP_PKEY_decapsulate(3), EVP_PKEY_decrypt(3), EVP_PKEY_encapsulate(3), EVP_PKEY_encrypt(3), EVP_PKEY_derive(3), EVP_PKEY_keygen(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3)

                                                                                                          "},{"location":"man7/life_cycle-pkey/#history","title":"HISTORY","text":"

                                                                                                          The provider PKEY interface was introduced in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/life_cycle-pkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/life_cycle-rand/","title":"life_cycle-rand","text":""},{"location":"man7/life_cycle-rand/#name","title":"NAME","text":"

                                                                                                          life_cycle-rand - The RAND algorithm life-cycle

                                                                                                          "},{"location":"man7/life_cycle-rand/#description","title":"DESCRIPTION","text":"

                                                                                                          All random number generator (RANDs) go through a number of stages in their life-cycle:

                                                                                                          • start

                                                                                                            This state represents the RAND before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                          • newed

                                                                                                            This state represents the RAND after it has been allocated but unable to generate any output.

                                                                                                          • instantiated

                                                                                                            This state represents the RAND when it is set up and capable of generating output.

                                                                                                          • uninstantiated

                                                                                                            This state represents the RAND when it has been shutdown and it is no longer capable of generating output.

                                                                                                          • freed

                                                                                                            This state is entered when the RAND is freed. It is the terminal state for all life-cycle transitions.

                                                                                                          "},{"location":"man7/life_cycle-rand/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                          The usual life-cycle of a RAND is illustrated:

                                                                                                          "},{"location":"man7/life_cycle-rand/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                          This section defines all of the legal state transitions. This is the canonical list.

                                                                                                          Function Call Current State start newed instantiated uninstantiated freed EVP_RAND_CTX_new newed EVP_RAND_instantiate instantiated EVP_RAND_generate instantiated EVP_RAND_uninstantiate uninstantiated EVP_RAND_CTX_free freed freed freed freed EVP_RAND_CTX_get_params newed instantiated uninstantiated EVP_RAND_CTX_set_params newed instantiated uninstantiated EVP_RAND_CTX_gettable_params newed instantiated uninstantiated EVP_RAND_CTX_settable_params newed instantiated uninstantiated"},{"location":"man7/life_cycle-rand/#notes","title":"NOTES","text":"

                                                                                                          At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                          "},{"location":"man7/life_cycle-rand/#see-also","title":"SEE ALSO","text":"

                                                                                                          provider-rand(7), EVP_RAND(3).

                                                                                                          "},{"location":"man7/life_cycle-rand/#history","title":"HISTORY","text":"

                                                                                                          The provider RAND interface was introduced in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/life_cycle-rand/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/migration_guide/","title":"migration_guide","text":""},{"location":"man7/migration_guide/#name","title":"NAME","text":"

                                                                                                          migration_guide - OpenSSL migration guide

                                                                                                          "},{"location":"man7/migration_guide/#synopsis","title":"SYNOPSIS","text":"

                                                                                                          See the individual manual pages for details.

                                                                                                          "},{"location":"man7/migration_guide/#description","title":"DESCRIPTION","text":"

                                                                                                          This guide details the changes required to migrate to new versions of OpenSSL. Currently this covers OpenSSL 3.0 & 3.1. For earlier versions refer to https://github.com/openssl/openssl/blob/master/CHANGES.md. For an overview of some of the key concepts introduced in OpenSSL 3.0 see crypto(7).

                                                                                                          "},{"location":"man7/migration_guide/#openssl-31","title":"OPENSSL 3.1","text":""},{"location":"man7/migration_guide/#main-changes-from-openssl-30","title":"Main Changes from OpenSSL 3.0","text":"

                                                                                                          The FIPS provider in OpenSSL 3.1 includes some non-FIPS validated algorithms, consequently the property query fips=yes is mandatory for applications that want to operate in a FIPS approved manner. The algorithms are:

                                                                                                          • Triple DES ECB
                                                                                                          • Triple DES CBC
                                                                                                          • EdDSA

                                                                                                          There are no other changes requiring additional migration measures since OpenSSL 3.0.

                                                                                                          "},{"location":"man7/migration_guide/#openssl-30","title":"OPENSSL 3.0","text":""},{"location":"man7/migration_guide/#main-changes-from-openssl-111","title":"Main Changes from OpenSSL 1.1.1","text":""},{"location":"man7/migration_guide/#major-release","title":"Major Release","text":"

                                                                                                          OpenSSL 3.0 is a major release and consequently any application that currently uses an older version of OpenSSL will at the very least need to be recompiled in order to work with the new version. It is the intention that the large majority of applications will work unchanged with OpenSSL 3.0 if those applications previously worked with OpenSSL 1.1.1. However this is not guaranteed and some changes may be required in some cases. Changes may also be required if applications need to take advantage of some of the new features available in OpenSSL 3.0 such as the availability of the FIPS module.

                                                                                                          "},{"location":"man7/migration_guide/#license-change","title":"License Change","text":"

                                                                                                          In previous versions, OpenSSL was licensed under the dual OpenSSL and SSLeay licenses (both licenses apply). From OpenSSL 3.0 this is replaced by the Apache License v2.

                                                                                                          "},{"location":"man7/migration_guide/#providers-and-fips-support","title":"Providers and FIPS support","text":"

                                                                                                          One of the key changes from OpenSSL 1.1.1 is the introduction of the Provider concept. Providers collect together and make available algorithm implementations. With OpenSSL 3.0 it is possible to specify, either programmatically or via a config file, which providers you want to use for any given application. OpenSSL 3.0 comes with 5 different providers as standard. Over time third parties may distribute additional providers that can be plugged into OpenSSL. All algorithm implementations available via providers are accessed through the \"high level\" APIs (for example those functions prefixed with EVP). They cannot be accessed using the \"Low Level APIs\".

                                                                                                          One of the standard providers available is the FIPS provider. This makes available FIPS validated cryptographic algorithms. The FIPS provider is disabled by default and needs to be enabled explicitly at configuration time using the enable-fips option. If it is enabled, the FIPS provider gets built and installed in addition to the other standard providers. No separate installation procedure is necessary. There is however a dedicated install_fips make target, which serves the special purpose of installing only the FIPS provider into an existing OpenSSL installation.

                                                                                                          Not all algorithms may be available for the application at a particular moment. If the application code uses any digest or cipher algorithm via the EVP interface, the application should verify the result of the EVP_EncryptInit(3), EVP_EncryptInit_ex(3), and EVP_DigestInit(3) functions. In case when the requested algorithm is not available, these functions will fail.

                                                                                                          See also \"Legacy Algorithms\" for information on the legacy provider.

                                                                                                          See also \"Completing the installation of the FIPS Module\" and \"Using the FIPS Module in applications\".

                                                                                                          "},{"location":"man7/migration_guide/#low-level-apis","title":"Low Level APIs","text":"

                                                                                                          OpenSSL has historically provided two sets of APIs for invoking cryptographic algorithms: the \"high level\" APIs (such as the EVP APIs) and the \"low level\" APIs. The high level APIs are typically designed to work across all algorithm types. The \"low level\" APIs are targeted at a specific algorithm implementation. For example, the EVP APIs provide the functions EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal(3) to perform symmetric encryption. Those functions can be used with the algorithms AES, CHACHA, 3DES etc. On the other hand, to do AES encryption using the low level APIs you would have to call AES specific functions such as AES_set_encrypt_key(3), AES_encrypt(3), and so on. The functions for 3DES are different. Use of the low level APIs has been informally discouraged by the OpenSSL development team for a long time. However in OpenSSL 3.0 this is made more formal. All such low level APIs have been deprecated. You may still use them in your applications, but you may start to see deprecation warnings during compilation (dependent on compiler support for this). Deprecated APIs may be removed from future versions of OpenSSL so you are strongly encouraged to update your code to use the high level APIs instead.

                                                                                                          This is described in more detail in \"Deprecation of Low Level Functions\"

                                                                                                          "},{"location":"man7/migration_guide/#legacy-algorithms","title":"Legacy Algorithms","text":"

                                                                                                          Some cryptographic algorithms such as MD2 and DES that were available via the EVP APIs are now considered legacy and their use is strongly discouraged. These legacy EVP algorithms are still available in OpenSSL 3.0 but not by default. If you want to use them then you must load the legacy provider. This can be as simple as a config file change, or can be done programmatically. See OSSL_PROVIDER-legacy(7) for a complete list of algorithms. Applications using the EVP APIs to access these algorithms should instead use more modern algorithms. If that is not possible then these applications should ensure that the legacy provider has been loaded. This can be achieved either programmatically or via configuration. See crypto(7) man page for more information about providers.

                                                                                                          "},{"location":"man7/migration_guide/#engines-and-method-apis","title":"Engines and \"METHOD\" APIs","text":"

                                                                                                          The refactoring to support Providers conflicts internally with the APIs used to support engines, including the ENGINE API and any function that creates or modifies custom \"METHODS\" (for example EVP_MD_meth_new(3), EVP_CIPHER_meth_new(3), EVP_PKEY_meth_new(3), RSA_meth_new(3), EC_KEY_METHOD_new(3), etc.). These functions are being deprecated in OpenSSL 3.0, and users of these APIs should know that their use can likely bypass provider selection and configuration, with unintended consequences. This is particularly relevant for applications written to use the OpenSSL 3.0 FIPS module, as detailed below. Authors and maintainers of external engines are strongly encouraged to refactor their code transforming engines into providers using the new Provider API and avoiding deprecated methods.

                                                                                                          "},{"location":"man7/migration_guide/#support-of-legacy-engines","title":"Support of legacy engines","text":"

                                                                                                          If openssl is not built without engine support or deprecated API support, engines will still work. However, their applicability will be limited.

                                                                                                          New algorithms provided via engines will still work.

                                                                                                          Engine-backed keys can be loaded via custom OSSL_STORE implementation. In this case the EVP_PKEY objects created via ENGINE_load_private_key(3) will be considered legacy and will continue to work.

                                                                                                          To ensure the future compatibility, the engines should be turned to providers. To prefer the provider-based hardware offload, you can specify the default properties to prefer your provider.

                                                                                                          Setting engine-based or application-based default low-level crypto method such as RSA_METHOD or EC_KEY_METHOD is still possible and keys inside the default provider will use the engine-based implementation for the crypto operations. However EVP_PKEYs created by decoding by using OSSL_DECODER, PEM_ or d2i_ APIs will be provider-based. To create a fully legacy EVP_PKEYs EVP_PKEY_set1_RSA(3), EVP_PKEY_set1_EC_KEY(3) or similar functions must be used.

                                                                                                          "},{"location":"man7/migration_guide/#versioning-scheme","title":"Versioning Scheme","text":"

                                                                                                          The OpenSSL versioning scheme has changed with the OpenSSL 3.0 release. The new versioning scheme has this format:

                                                                                                          MAJOR.MINOR.PATCH

                                                                                                          For OpenSSL 1.1.1 and below, different patch levels were indicated by a letter at the end of the release version number. This will no longer be used and instead the patch level is indicated by the final number in the version. A change in the second (MINOR) number indicates that new features may have been added. OpenSSL versions with the same major number are API and ABI compatible. If the major number changes then API and ABI compatibility is not guaranteed.

                                                                                                          For more information, see OpenSSL_version(3).

                                                                                                          "},{"location":"man7/migration_guide/#other-major-new-features","title":"Other major new features","text":""},{"location":"man7/migration_guide/#certificate-management-protocol-cmp-rfc-4210","title":"Certificate Management Protocol (CMP, RFC 4210)","text":"

                                                                                                          This also covers CRMF (RFC 4211) and HTTP transfer (RFC 6712) See openssl-cmp(1) and OSSL_CMP_exec_certreq(3) as starting points.

                                                                                                          "},{"location":"man7/migration_guide/#https-client","title":"HTTP(S) client","text":"

                                                                                                          A proper HTTP(S) client that supports GET and POST, redirection, plain and ASN.1-encoded contents, proxies, and timeouts.

                                                                                                          "},{"location":"man7/migration_guide/#key-derivation-function-api-evp_kdf","title":"Key Derivation Function API (EVP_KDF)","text":"

                                                                                                          This simplifies the process of adding new KDF and PRF implementations.

                                                                                                          Previously KDF algorithms had been shoe-horned into using the EVP_PKEY object which was not a logical mapping. Existing applications that use KDF algorithms using EVP_PKEY (scrypt, TLS1 PRF and HKDF) may be slower as they use an EVP_KDF bridge internally. All new applications should use the new EVP_KDF(3) interface. See also \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-default(7) and \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-FIPS(7).

                                                                                                          "},{"location":"man7/migration_guide/#message-authentication-code-api-evp_mac","title":"Message Authentication Code API (EVP_MAC)","text":"

                                                                                                          This simplifies the process of adding MAC implementations.

                                                                                                          This includes a generic EVP_PKEY to EVP_MAC bridge, to facilitate the continued use of MACs through raw private keys in functionality such as EVP_DigestSign(3) and EVP_DigestVerify(3).

                                                                                                          All new applications should use the new EVP_MAC(3) interface. See also \"Message Authentication Code (MAC)\" in OSSL_PROVIDER-default(7) and \"Message Authentication Code (MAC)\" in OSSL_PROVIDER-FIPS(7).

                                                                                                          "},{"location":"man7/migration_guide/#algorithm-fetching","title":"Algorithm Fetching","text":"

                                                                                                          Using calls to convenience functions such as EVP_sha256() and EVP_aes_256_gcm() may incur a performance penalty when using providers. Retrieving algorithms from providers involves searching for an algorithm by name. This is much slower than directly accessing a method table. It is recommended to prefetch algorithms if an algorithm is used many times. See \"Performance\" in crypto(7), \"Explicit fetching\" in crypto(7) and \"Implicit fetching\" in crypto(7).

                                                                                                          "},{"location":"man7/migration_guide/#support-for-linux-kernel-tls","title":"Support for Linux Kernel TLS","text":"

                                                                                                          In order to use KTLS, support for it must be compiled in using the enable-ktls configuration option. It must also be enabled at run time using the SSL_OP_ENABLE_KTLS option.

                                                                                                          "},{"location":"man7/migration_guide/#new-algorithms","title":"New Algorithms","text":"
                                                                                                          • KDF algorithms \"SINGLE STEP\" and \"SSH\"

                                                                                                            See EVP_KDF-SS(7) and EVP_KDF-SSHKDF(7)

                                                                                                          • MAC Algorithms \"GMAC\" and \"KMAC\"

                                                                                                            See EVP_MAC-GMAC(7) and EVP_MAC-KMAC(7).

                                                                                                          • KEM Algorithm \"RSASVE\"

                                                                                                            See EVP_KEM-RSA(7).

                                                                                                          • Cipher Algorithm \"AES-SIV\"

                                                                                                            See \"SIV Mode\" in EVP_EncryptInit(3).

                                                                                                          • AES Key Wrap inverse ciphers supported by EVP layer.

                                                                                                            The inverse ciphers use AES decryption for wrapping, and AES encryption for unwrapping. The algorithms are: \"AES-128-WRAP-INV\", \"AES-192-WRAP-INV\", \"AES-256-WRAP-INV\", \"AES-128-WRAP-PAD-INV\", \"AES-192-WRAP-PAD-INV\" and \"AES-256-WRAP-PAD-INV\".

                                                                                                          • CTS ciphers added to EVP layer.

                                                                                                            The algorithms are \"AES-128-CBC-CTS\", \"AES-192-CBC-CTS\", \"AES-256-CBC-CTS\", \"CAMELLIA-128-CBC-CTS\", \"CAMELLIA-192-CBC-CTS\" and \"CAMELLIA-256-CBC-CTS\". CS1, CS2 and CS3 variants are supported.

                                                                                                          "},{"location":"man7/migration_guide/#cms-and-pkcs7-updates","title":"CMS and PKCS#7 updates","text":"
                                                                                                          • Added CAdES-BES signature verification support.
                                                                                                          • Added CAdES-BES signature scheme and attributes support (RFC 5126) to CMS API.
                                                                                                          • Added AuthEnvelopedData content type structure (RFC 5083) using AES_GCM

                                                                                                            This uses the AES-GCM parameter (RFC 5084) for the Cryptographic Message Syntax. Its purpose is to support encryption and decryption of a digital envelope that is both authenticated and encrypted using AES GCM mode.

                                                                                                          • PKCS7_get_octet_string(3) and PKCS7_type_is_other(3) were made public.

                                                                                                          "},{"location":"man7/migration_guide/#pkcs12-api-updates","title":"PKCS#12 API updates","text":"

                                                                                                          The default algorithms for pkcs12 creation with the PKCS12_create() function were changed to more modern PBKDF2 and AES based algorithms. The default MAC iteration count was changed to PKCS12_DEFAULT_ITER to make it equal with the password-based encryption iteration count. The default digest algorithm for the MAC computation was changed to SHA-256. The pkcs12 application now supports -legacy option that restores the previous default algorithms to support interoperability with legacy systems.

                                                                                                          Added enhanced PKCS#12 APIs which accept a library context OSSL_LIB_CTX and (where relevant) a property query. Other APIs which handle PKCS#7 and PKCS#8 objects have also been enhanced where required. This includes:

                                                                                                          PKCS12_add_key_ex(3), PKCS12_add_safe_ex(3), PKCS12_add_safes_ex(3), PKCS12_create_ex(3), PKCS12_decrypt_skey_ex(3), PKCS12_init_ex(3), PKCS12_item_decrypt_d2i_ex(3), PKCS12_item_i2d_encrypt_ex(3), PKCS12_key_gen_asc_ex(3), PKCS12_key_gen_uni_ex(3), PKCS12_key_gen_utf8_ex(3), PKCS12_pack_p7encdata_ex(3), PKCS12_pbe_crypt_ex(3), PKCS12_PBE_keyivgen_ex(3), PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(3), PKCS5_pbe2_set_iv_ex(3), PKCS5_pbe_set0_algor_ex(3), PKCS5_pbe_set_ex(3), PKCS5_pbkdf2_set_ex(3), PKCS5_v2_PBE_keyivgen_ex(3), PKCS5_v2_scrypt_keyivgen_ex(3), PKCS8_decrypt_ex(3), PKCS8_encrypt_ex(3), PKCS8_set0_pbe_ex(3).

                                                                                                          As part of this change the EVP_PBE_xxx APIs can also accept a library context and property query and will call an extended version of the key/IV derivation function which supports these parameters. This includes EVP_PBE_CipherInit_ex(3), EVP_PBE_find_ex(3) and EVP_PBE_scrypt_ex(3).

                                                                                                          "},{"location":"man7/migration_guide/#pkcs12-kdf-versus-fips","title":"PKCS#12 KDF versus FIPS","text":"

                                                                                                          Unlike in 1.x.y, the PKCS12KDF algorithm used when a PKCS#12 structure is created with a MAC that does not work with the FIPS provider as the PKCS12KDF is not a FIPS approvable mechanism.

                                                                                                          See EVP_KDF-PKCS12KDF(7), PKCS12_create(3), openssl-pkcs12(1), OSSL_PROVIDER-FIPS(7).

                                                                                                          "},{"location":"man7/migration_guide/#windows-thread-synchronization-changes","title":"Windows thread synchronization changes","text":"

                                                                                                          Windows thread synchronization uses read/write primitives (SRWLock) when supported by the OS, otherwise CriticalSection continues to be used.

                                                                                                          "},{"location":"man7/migration_guide/#trace-api","title":"Trace API","text":"

                                                                                                          A new generic trace API has been added which provides support for enabling instrumentation through trace output. This feature is mainly intended as an aid for developers and is disabled by default. To utilize it, OpenSSL needs to be configured with the enable-trace option.

                                                                                                          If the tracing API is enabled, the application can activate trace output by registering BIOs as trace channels for a number of tracing and debugging categories. See OSSL_trace_enabled(3).

                                                                                                          "},{"location":"man7/migration_guide/#key-validation-updates","title":"Key validation updates","text":"

                                                                                                          EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) now work for more key types. This includes RSA, DSA, ED25519, X25519, ED448 and X448. Previously (in 1.1.1) they would return -2. For key types that do not have parameters then EVP_PKEY_param_check(3) will always return 1.

                                                                                                          "},{"location":"man7/migration_guide/#other-notable-deprecations-and-changes","title":"Other notable deprecations and changes","text":""},{"location":"man7/migration_guide/#the-function-code-part-of-an-openssl-error-code-is-no-longer-relevant","title":"The function code part of an OpenSSL error code is no longer relevant","text":"

                                                                                                          This code is now always set to zero. Related functions are deprecated.

                                                                                                          "},{"location":"man7/migration_guide/#stack-and-hash-macros-have-been-cleaned-up","title":"STACK and HASH macros have been cleaned up","text":"

                                                                                                          The type-safe wrappers are declared everywhere and implemented once. See DEFINE_STACK_OF(3) and DEFINE_LHASH_OF_EX(3).

                                                                                                          "},{"location":"man7/migration_guide/#the-rand_drbg-subsystem-has-been-removed","title":"The RAND_DRBG subsystem has been removed","text":"

                                                                                                          The new EVP_RAND(3) is a partial replacement: the DRBG callback framework is absent. The RAND_DRBG API did not fit well into the new provider concept as implemented by EVP_RAND and EVP_RAND_CTX.

                                                                                                          "},{"location":"man7/migration_guide/#removed-fips_mode-and-fips_mode_set","title":"Removed FIPS_mode() and FIPS_mode_set()","text":"

                                                                                                          These functions are legacy APIs that are not applicable to the new provider model. Applications should instead use EVP_default_properties_is_fips_enabled(3) and EVP_default_properties_enable_fips(3).

                                                                                                          "},{"location":"man7/migration_guide/#key-generation-is-slower","title":"Key generation is slower","text":"

                                                                                                          The Miller-Rabin test now uses 64 rounds, which is used for all prime generation, including RSA key generation. This affects the time for larger keys sizes.

                                                                                                          The default key generation method for the regular 2-prime RSA keys was changed to the FIPS186-4 B.3.6 method (Generation of Probable Primes with Conditions Based on Auxiliary Probable Primes). This method is slower than the original method.

                                                                                                          "},{"location":"man7/migration_guide/#change-pbkdf2-to-conform-to-sp800-132-instead-of-the-older-pkcs5-rfc2898","title":"Change PBKDF2 to conform to SP800-132 instead of the older PKCS5 RFC2898","text":"

                                                                                                          This checks that the salt length is at least 128 bits, the derived key length is at least 112 bits, and that the iteration count is at least 1000. For backwards compatibility these checks are disabled by default in the default provider, but are enabled by default in the FIPS provider.

                                                                                                          To enable or disable the checks see OSSL_KDF_PARAM_PKCS5 in EVP_KDF-PBKDF2(7). The parameter can be set using EVP_KDF_derive(3).

                                                                                                          "},{"location":"man7/migration_guide/#enforce-a-minimum-dh-modulus-size-of-512-bits","title":"Enforce a minimum DH modulus size of 512 bits","text":"

                                                                                                          Smaller sizes now result in an error.

                                                                                                          "},{"location":"man7/migration_guide/#sm2-key-changes","title":"SM2 key changes","text":"

                                                                                                          EC EVP_PKEYs with the SM2 curve have been reworked to automatically become EVP_PKEY_SM2 rather than EVP_PKEY_EC.

                                                                                                          Unlike in previous OpenSSL versions, this means that applications cannot call EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2) to get SM2 computations.

                                                                                                          Parameter and key generation is also reworked to make it possible to generate EVP_PKEY_SM2 parameters and keys. Applications must now generate SM2 keys directly and must not create an EVP_PKEY_EC key first. It is no longer possible to import an SM2 key with domain parameters other than the SM2 elliptic curve ones.

                                                                                                          Validation of SM2 keys has been separated from the validation of regular EC keys, allowing to improve the SM2 validation process to reject loaded private keys that are not conforming to the SM2 ISO standard. In particular, a private scalar k outside the range 1 <= k < n-1 is now correctly rejected.

                                                                                                          "},{"location":"man7/migration_guide/#evp_pkey_set_alias_type-method-has-been-removed","title":"EVP_PKEY_set_alias_type() method has been removed","text":"

                                                                                                          This function made a EVP_PKEY object mutable after it had been set up. In OpenSSL 3.0 it was decided that a provided key should not be able to change its type, so this function has been removed.

                                                                                                          "},{"location":"man7/migration_guide/#functions-that-return-an-internal-key-should-be-treated-as-read-only","title":"Functions that return an internal key should be treated as read only","text":"

                                                                                                          Functions such as EVP_PKEY_get0_RSA(3) behave slightly differently in OpenSSL 3.0. Previously they returned a pointer to the low-level key used internally by libcrypto. From OpenSSL 3.0 this key may now be held in a provider. Calling these functions will only return a handle on the internal key where the EVP_PKEY was constructed using this key in the first place, for example using a function or macro such as EVP_PKEY_assign_RSA(3), EVP_PKEY_set1_RSA(3), etc. Where the EVP_PKEY holds a provider managed key, then these functions now return a cached copy of the key. Changes to the internal provider key that take place after the first time the cached key is accessed will not be reflected back in the cached copy. Similarly any changes made to the cached copy by application code will not be reflected back in the internal provider key.

                                                                                                          For the above reasons the keys returned from these functions should typically be treated as read-only. To emphasise this the value returned from EVP_PKEY_get0_RSA(3), EVP_PKEY_get0_DSA(3), EVP_PKEY_get0_EC_KEY(3) and EVP_PKEY_get0_DH(3) have been made const. This may break some existing code. Applications broken by this change should be modified. The preferred solution is to refactor the code to avoid the use of these deprecated functions. Failing this the code should be modified to use a const pointer instead. The EVP_PKEY_get1_RSA(3), EVP_PKEY_get1_DSA(3), EVP_PKEY_get1_EC_KEY(3) and EVP_PKEY_get1_DH(3) functions continue to return a non-const pointer to enable them to be \"freed\". However they should also be treated as read-only.

                                                                                                          "},{"location":"man7/migration_guide/#the-public-key-check-has-moved-from-evp_pkey_derive-to-evp_pkey_derive_set_peer","title":"The public key check has moved from EVP_PKEY_derive() to EVP_PKEY_derive_set_peer()","text":"

                                                                                                          This may mean result in an error in EVP_PKEY_derive_set_peer(3) rather than during EVP_PKEY_derive(3). To disable this check use EVP_PKEY_derive_set_peer_ex(dh, peer, 0).

                                                                                                          "},{"location":"man7/migration_guide/#the-print-format-has-cosmetic-changes-for-some-functions","title":"The print format has cosmetic changes for some functions","text":"

                                                                                                          The output from numerous \"printing\" functions such as X509_signature_print(3), X509_print_ex(3), X509_CRL_print_ex(3), and other similar functions has been amended such that there may be cosmetic differences between the output observed in 1.1.1 and 3.0. This also applies to the -text output from the openssl x509 and openssl crl applications.

                                                                                                          "},{"location":"man7/migration_guide/#interactive-mode-from-the-openssl-program-has-been-removed","title":"Interactive mode from the openssl program has been removed","text":"

                                                                                                          From now on, running it without arguments is equivalent to openssl help.

                                                                                                          "},{"location":"man7/migration_guide/#the-error-return-values-from-some-control-calls-ctrl-have-changed","title":"The error return values from some control calls (ctrl) have changed","text":"

                                                                                                          One significant change is that controls which used to return -2 for invalid inputs, now return -1 indicating a generic error condition instead.

                                                                                                          "},{"location":"man7/migration_guide/#dh-and-dhx-key-types-have-different-settable-parameters","title":"DH and DHX key types have different settable parameters","text":"

                                                                                                          Previously (in 1.1.1) these conflicting parameters were allowed, but will now result in errors. See EVP_PKEY-DH(7) for further details. This affects the behaviour of openssl-genpkey(1) for DH parameter generation.

                                                                                                          "},{"location":"man7/migration_guide/#evp_cipher_ctx_set_flags-ordering-change","title":"EVP_CIPHER_CTX_set_flags() ordering change","text":"

                                                                                                          If using a cipher from a provider the EVP_CIPH_FLAG_LENGTH_BITS flag can only be set after the cipher has been assigned to the cipher context. See \"FLAGS\" in EVP_EncryptInit(3) for more information.

                                                                                                          "},{"location":"man7/migration_guide/#validation-of-operation-context-parameters","title":"Validation of operation context parameters","text":"

                                                                                                          Due to move of the implementation of cryptographic operations to the providers, validation of various operation parameters can be postponed until the actual operation is executed where previously it happened immediately when an operation parameter was set.

                                                                                                          For example when setting an unsupported curve with EVP_PKEY_CTX_set_ec_paramgen_curve_nid() this function call will not fail but later keygen operations with the EVP_PKEY_CTX will fail.

                                                                                                          "},{"location":"man7/migration_guide/#removal-of-function-code-from-the-error-codes","title":"Removal of function code from the error codes","text":"

                                                                                                          The function code part of the error code is now always set to 0. For that reason the ERR_GET_FUNC() macro was removed. Applications must resolve the error codes only using the library number and the reason code.

                                                                                                          "},{"location":"man7/migration_guide/#chacha20-poly1305-cipher-does-not-allow-a-truncated-iv-length-to-be-used","title":"ChaCha20-Poly1305 cipher does not allow a truncated IV length to be used","text":"

                                                                                                          In OpenSSL 3.0 setting the IV length to any value other than 12 will result in an error. Prior to OpenSSL 3.0 the ivlen could be smaller that the required 12 byte length, using EVP_CIPHER_CTX_ctrl(ctx, EVP_CRTL_AEAD_SET_IVLEN, ivlen, NULL). This resulted in an IV that had leading zero padding.

                                                                                                          "},{"location":"man7/migration_guide/#installation-and-compilation","title":"Installation and Compilation","text":"

                                                                                                          Please refer to the INSTALL.md file in the top of the distribution for instructions on how to build and install OpenSSL 3.0. Please also refer to the various platform specific NOTES files for your specific platform.

                                                                                                          "},{"location":"man7/migration_guide/#upgrading-from-openssl-111","title":"Upgrading from OpenSSL 1.1.1","text":"

                                                                                                          Upgrading to OpenSSL 3.0 from OpenSSL 1.1.1 should be relatively straight forward in most cases. The most likely area where you will encounter problems is if you have used low level APIs in your code (as discussed above). In that case you are likely to start seeing deprecation warnings when compiling your application. If this happens you have 3 options:

                                                                                                          1. Ignore the warnings. They are just warnings. The deprecated functions are still present and you may still use them. However be aware that they may be removed from a future version of OpenSSL.
                                                                                                          2. Suppress the warnings. Refer to your compiler documentation on how to do this.
                                                                                                          3. Remove your usage of the low level APIs. In this case you will need to rewrite your code to use the high level APIs instead
                                                                                                          "},{"location":"man7/migration_guide/#error-code-changes","title":"Error code changes","text":"

                                                                                                          As OpenSSL 3.0 provides a brand new Encoder/Decoder mechanism for working with widely used file formats, application code that checks for particular error reason codes on key loading failures might need an update.

                                                                                                          Password-protected keys may deserve special attention. If only some errors are treated as an indicator that the user should be asked about the password again, it's worth testing these scenarios and processing the newly relevant codes.

                                                                                                          There may be more cases to treat specially, depending on the calling application code.

                                                                                                          "},{"location":"man7/migration_guide/#upgrading-from-openssl-102","title":"Upgrading from OpenSSL 1.0.2","text":"

                                                                                                          Upgrading to OpenSSL 3.0 from OpenSSL 1.0.2 is likely to be significantly more difficult. In addition to the issues discussed above in the section about \"Upgrading from OpenSSL 1.1.1\", the main things to be aware of are:

                                                                                                          1. The build and installation procedure has changed significantly.

                                                                                                            Check the file INSTALL.md in the top of the installation for instructions on how to build and install OpenSSL for your platform. Also read the various NOTES files in the same directory, as applicable for your platform.

                                                                                                          2. Many structures have been made opaque in OpenSSL 3.0.

                                                                                                            The structure definitions have been removed from the public header files and moved to internal header files. In practice this means that you can no longer stack allocate some structures. Instead they must be heap allocated through some function call (typically those function names have a _new suffix to them). Additionally you must use \"setter\" or \"getter\" functions to access the fields within those structures.

                                                                                                            For example code that previously looked like this:

                                                                                                            EVP_MD_CTX md_ctx;\n\n/* This line will now generate compiler errors */\nEVP_MD_CTX_init(&md_ctx);\n

                                                                                                            The code needs to be amended to look like this:

                                                                                                            EVP_MD_CTX *md_ctx;\n\nmd_ctx = EVP_MD_CTX_new();\n...\n...\nEVP_MD_CTX_free(md_ctx);\n
                                                                                                          3. Support for TLSv1.3 has been added.

                                                                                                            This has a number of implications for SSL/TLS applications. See the TLS1.3 page for further details.

                                                                                                          More details about the breaking changes between OpenSSL versions 1.0.2 and 1.1.0 can be found on the OpenSSL 1.1.0 Changes page.

                                                                                                          "},{"location":"man7/migration_guide/#upgrading-from-the-openssl-20-fips-object-module","title":"Upgrading from the OpenSSL 2.0 FIPS Object Module","text":"

                                                                                                          The OpenSSL 2.0 FIPS Object Module was a separate download that had to be built separately and then integrated into your main OpenSSL 1.0.2 build. In OpenSSL 3.0 the FIPS support is fully integrated into the mainline version of OpenSSL and is no longer a separate download. For further information see \"Completing the installation of the FIPS Module\".

                                                                                                          The function calls FIPS_mode() and FIPS_mode_set() have been removed from OpenSSL 3.0. You should rewrite your application to not use them. See fips_module(7) and OSSL_PROVIDER-FIPS(7) for details.

                                                                                                          "},{"location":"man7/migration_guide/#completing-the-installation-of-the-fips-module","title":"Completing the installation of the FIPS Module","text":"

                                                                                                          The FIPS Module will be built and installed automatically if FIPS support has been configured. The current documentation can be found in the README-FIPS file.

                                                                                                          "},{"location":"man7/migration_guide/#programming","title":"Programming","text":"

                                                                                                          Applications written to work with OpenSSL 1.1.1 will mostly just work with OpenSSL 3.0. However changes will be required if you want to take advantage of some of the new features that OpenSSL 3.0 makes available. In order to do that you need to understand some new concepts introduced in OpenSSL 3.0. Read \"Library contexts\" in crypto(7) for further information.

                                                                                                          "},{"location":"man7/migration_guide/#library-context","title":"Library Context","text":"

                                                                                                          A library context allows different components of a complex application to each use a different library context and have different providers loaded with different configuration settings. See \"Library contexts\" in crypto(7) for further info.

                                                                                                          If the user creates an OSSL_LIB_CTX via OSSL_LIB_CTX_new(3) then many functions may need to be changed to pass additional parameters to handle the library context.

                                                                                                          "},{"location":"man7/migration_guide/#using-a-library-context-old-functions-that-should-be-changed","title":"Using a Library Context - Old functions that should be changed","text":"

                                                                                                          If a library context is needed then all EVP_* digest functions that return a const EVP_MD * such as EVP_sha256() should be replaced with a call to EVP_MD_fetch(3). See \"ALGORITHM FETCHING\" in crypto(7).

                                                                                                          If a library context is needed then all EVP_* cipher functions that return a const EVP_CIPHER * such as EVP_aes_128_cbc() should be replaced vith a call to EVP_CIPHER_fetch(3). See \"ALGORITHM FETCHING\" in crypto(7).

                                                                                                          Some functions can be passed an object that has already been set up with a library context such as d2i_X509(3), d2i_X509_CRL(3), d2i_X509_REQ(3) and d2i_X509_PUBKEY(3). If NULL is passed instead then the created object will be set up with the default library context. Use X509_new_ex(3), X509_CRL_new_ex(3), X509_REQ_new_ex(3) and X509_PUBKEY_new_ex(3) if a library context is required.

                                                                                                          All functions listed below with a NAME have a replacement function NAME_ex that takes OSSL_LIB_CTX as an additional argument. Functions that have other mappings are listed along with the respective name.

                                                                                                          • ASN1_item_new(3), ASN1_item_d2i(3), ASN1_item_d2i_fp(3), ASN1_item_d2i_bio(3), ASN1_item_sign(3) and ASN1_item_verify(3)
                                                                                                          • BIO_new(3)
                                                                                                          • b2i_RSA_PVK_bio() and i2b_PVK_bio()
                                                                                                          • BN_CTX_new(3) and BN_CTX_secure_new(3)
                                                                                                          • CMS_AuthEnvelopedData_create(3), CMS_ContentInfo_new(3), CMS_data_create(3), CMS_digest_create(3), CMS_EncryptedData_encrypt(3), CMS_encrypt(3), CMS_EnvelopedData_create(3), CMS_ReceiptRequest_create0(3) and CMS_sign(3)
                                                                                                          • CONF_modules_load_file(3)
                                                                                                          • CTLOG_new(3), CTLOG_new_from_base64(3) and CTLOG_STORE_new(3)
                                                                                                          • CT_POLICY_EVAL_CTX_new(3)
                                                                                                          • d2i_AutoPrivateKey(3), d2i_PrivateKey(3) and d2i_PUBKEY(3)
                                                                                                          • d2i_PrivateKey_bio(3) and d2i_PrivateKey_fp(3)

                                                                                                            Use d2i_PrivateKey_ex_bio(3) and d2i_PrivateKey_ex_fp(3)

                                                                                                          • EC_GROUP_new(3)

                                                                                                            Use EC_GROUP_new_by_curve_name_ex(3) or EC_GROUP_new_from_params(3).

                                                                                                          • EVP_DigestSignInit(3) and EVP_DigestVerifyInit(3)

                                                                                                          • EVP_PBE_CipherInit(3), EVP_PBE_find(3) and EVP_PBE_scrypt(3)
                                                                                                          • PKCS5_PBE_keyivgen(3)
                                                                                                          • EVP_PKCS82PKEY(3)
                                                                                                          • EVP_PKEY_CTX_new_id(3)

                                                                                                            Use EVP_PKEY_CTX_new_from_name(3)

                                                                                                          • EVP_PKEY_derive_set_peer(3), EVP_PKEY_new_raw_private_key(3) and EVP_PKEY_new_raw_public_key(3)

                                                                                                          • EVP_SignFinal(3) and EVP_VerifyFinal(3)
                                                                                                          • NCONF_new(3)
                                                                                                          • OCSP_RESPID_match(3) and OCSP_RESPID_set_by_key(3)
                                                                                                          • OPENSSL_thread_stop(3)
                                                                                                          • OSSL_STORE_open(3)
                                                                                                          • PEM_read_bio_Parameters(3), PEM_read_bio_PrivateKey(3), PEM_read_bio_PUBKEY(3), PEM_read_PrivateKey(3) and PEM_read_PUBKEY(3)
                                                                                                          • PEM_write_bio_PrivateKey(3), PEM_write_bio_PUBKEY(3), PEM_write_PrivateKey(3) and PEM_write_PUBKEY(3)
                                                                                                          • PEM_X509_INFO_read_bio(3) and PEM_X509_INFO_read(3)
                                                                                                          • PKCS12_add_key(3), PKCS12_add_safe(3), PKCS12_add_safes(3), PKCS12_create(3), PKCS12_decrypt_skey(3), PKCS12_init(3), PKCS12_item_decrypt_d2i(3), PKCS12_item_i2d_encrypt(3), PKCS12_key_gen_asc(3), PKCS12_key_gen_uni(3), PKCS12_key_gen_utf8(3), PKCS12_pack_p7encdata(3), PKCS12_pbe_crypt(3), PKCS12_PBE_keyivgen(3), PKCS12_SAFEBAG_create_pkcs8_encrypt(3)
                                                                                                          • PKCS5_pbe_set0_algor(3), PKCS5_pbe_set(3), PKCS5_pbe2_set_iv(3), PKCS5_pbkdf2_set(3) and PKCS5_v2_scrypt_keyivgen(3)
                                                                                                          • PKCS7_encrypt(3), PKCS7_new(3) and PKCS7_sign(3)
                                                                                                          • PKCS8_decrypt(3), PKCS8_encrypt(3) and PKCS8_set0_pbe(3)
                                                                                                          • RAND_bytes(3) and RAND_priv_bytes(3)
                                                                                                          • SMIME_write_ASN1(3)
                                                                                                          • SSL_load_client_CA_file(3)
                                                                                                          • SSL_CTX_new(3)
                                                                                                          • TS_RESP_CTX_new(3)
                                                                                                          • X509_CRL_new(3)
                                                                                                          • X509_load_cert_crl_file(3) and X509_load_cert_file(3)
                                                                                                          • X509_LOOKUP_by_subject(3) and X509_LOOKUP_ctrl(3)
                                                                                                          • X509_NAME_hash(3)
                                                                                                          • X509_new(3)
                                                                                                          • X509_REQ_new(3) and X509_REQ_verify(3)
                                                                                                          • X509_STORE_CTX_new(3), X509_STORE_set_default_paths(3), X509_STORE_load_file(3), X509_STORE_load_locations(3) and X509_STORE_load_store(3)
                                                                                                          "},{"location":"man7/migration_guide/#new-functions-that-use-a-library-context","title":"New functions that use a Library context","text":"

                                                                                                          The following functions can be passed a library context if required. Passing NULL will use the default library context.

                                                                                                          • BIO_new_from_core_bio(3)
                                                                                                          • EVP_ASYM_CIPHER_fetch(3) and EVP_ASYM_CIPHER_do_all_provided(3)
                                                                                                          • EVP_CIPHER_fetch(3) and EVP_CIPHER_do_all_provided(3)
                                                                                                          • EVP_default_properties_enable_fips(3) and EVP_default_properties_is_fips_enabled(3)
                                                                                                          • EVP_KDF_fetch(3) and EVP_KDF_do_all_provided(3)
                                                                                                          • EVP_KEM_fetch(3) and EVP_KEM_do_all_provided(3)
                                                                                                          • EVP_KEYEXCH_fetch(3) and EVP_KEYEXCH_do_all_provided(3)
                                                                                                          • EVP_KEYMGMT_fetch(3) and EVP_KEYMGMT_do_all_provided(3)
                                                                                                          • EVP_MAC_fetch(3) and EVP_MAC_do_all_provided(3)
                                                                                                          • EVP_MD_fetch(3) and EVP_MD_do_all_provided(3)
                                                                                                          • EVP_PKEY_CTX_new_from_pkey(3)
                                                                                                          • EVP_PKEY_Q_keygen(3)
                                                                                                          • EVP_Q_mac(3) and EVP_Q_digest(3)
                                                                                                          • EVP_RAND(3) and EVP_RAND_do_all_provided(3)
                                                                                                          • EVP_set_default_properties(3)
                                                                                                          • EVP_SIGNATURE_fetch(3) and EVP_SIGNATURE_do_all_provided(3)
                                                                                                          • OSSL_CMP_CTX_new(3) and OSSL_CMP_SRV_CTX_new(3)
                                                                                                          • OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(3)
                                                                                                          • OSSL_CRMF_MSG_create_popo(3) and OSSL_CRMF_MSGS_verify_popo(3)
                                                                                                          • OSSL_CRMF_pbm_new(3) and OSSL_CRMF_pbmp_new(3)
                                                                                                          • OSSL_DECODER_CTX_add_extra(3) and OSSL_DECODER_CTX_new_for_pkey(3)
                                                                                                          • OSSL_DECODER_fetch(3) and OSSL_DECODER_do_all_provided(3)
                                                                                                          • OSSL_ENCODER_CTX_add_extra(3)
                                                                                                          • OSSL_ENCODER_fetch(3) and OSSL_ENCODER_do_all_provided(3)
                                                                                                          • OSSL_LIB_CTX_free(3), OSSL_LIB_CTX_load_config(3) and OSSL_LIB_CTX_set0_default(3)
                                                                                                          • OSSL_PROVIDER_add_builtin(3), OSSL_PROVIDER_available(3), OSSL_PROVIDER_do_all(3), OSSL_PROVIDER_load(3), OSSL_PROVIDER_set_default_search_path(3) and OSSL_PROVIDER_try_load(3)
                                                                                                          • OSSL_SELF_TEST_get_callback(3) and OSSL_SELF_TEST_set_callback(3)
                                                                                                          • OSSL_STORE_attach(3)
                                                                                                          • OSSL_STORE_LOADER_fetch(3) and OSSL_STORE_LOADER_do_all_provided(3)
                                                                                                          • RAND_get0_primary(3), RAND_get0_private(3), RAND_get0_public(3), RAND_set_DRBG_type(3) and RAND_set_seed_source_type(3)
                                                                                                          "},{"location":"man7/migration_guide/#providers","title":"Providers","text":"

                                                                                                          Providers are described in detail here \"Providers\" in crypto(7). See also \"OPENSSL PROVIDERS\" in crypto(7).

                                                                                                          "},{"location":"man7/migration_guide/#fetching-algorithms-and-property-queries","title":"Fetching algorithms and property queries","text":"

                                                                                                          Implicit and Explicit Fetching is described in detail here \"ALGORITHM FETCHING\" in crypto(7).

                                                                                                          "},{"location":"man7/migration_guide/#mapping-evp-controls-and-flags-to-provider-ossl_param3-parameters","title":"Mapping EVP controls and flags to provider OSSL_PARAM(3) parameters","text":"

                                                                                                          The existing functions for controls (such as EVP_CIPHER_CTX_ctrl(3)) and manipulating flags (such as EVP_MD_CTX_set_flags(3))internally use OSSL_PARAMS to pass information to/from provider objects. See OSSL_PARAM(3) for additional information related to parameters.

                                                                                                          For ciphers see \"CONTROLS\" in EVP_EncryptInit(3), \"FLAGS\" in EVP_EncryptInit(3) and \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                          For digests see \"CONTROLS\" in EVP_DigestInit(3), \"FLAGS\" in EVP_DigestInit(3) and \"PARAMETERS\" in EVP_DigestInit(3).

                                                                                                          "},{"location":"man7/migration_guide/#deprecation-of-low-level-functions","title":"Deprecation of Low Level Functions","text":"

                                                                                                          A significant number of APIs have been deprecated in OpenSSL 3.0. This section describes some common categories of deprecations. See \"Deprecated function mappings\" for the list of deprecated functions that refer to these categories.

                                                                                                          "},{"location":"man7/migration_guide/#providers-are-a-replacement-for-engines-and-low-level-method-overrides","title":"Providers are a replacement for engines and low-level method overrides","text":"

                                                                                                          Any accessor that uses an ENGINE is deprecated (such as EVP_PKEY_set1_engine()). Applications using engines should instead use providers.

                                                                                                          Before providers were added algorithms were overridden by changing the methods used by algorithms. All these methods such as RSA_new_method() and RSA_meth_new() are now deprecated and can be replaced by using providers instead.

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-i2d-and-d2i-functions-for-low-level-key-types","title":"Deprecated i2d and d2i functions for low-level key types","text":"

                                                                                                          Any i2d and d2i functions such as d2i_DHparams() that take a low-level key type have been deprecated. Applications should instead use the OSSL_DECODER(3) and OSSL_ENCODER(3) APIs to read and write files. See \"Migration\" in d2i_RSAPrivateKey(3) for further details.

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-key-object-getters-and-setters","title":"Deprecated low-level key object getters and setters","text":"

                                                                                                          Applications that set or get low-level key objects (such as EVP_PKEY_set1_DH() or EVP_PKEY_get0()) should instead use the OSSL_ENCODER (See OSSL_ENCODER_to_bio(3)) or OSSL_DECODER (See OSSL_DECODER_from_bio(3)) APIs, or alternatively use EVP_PKEY_fromdata(3) or EVP_PKEY_todata(3).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-key-parameter-getters","title":"Deprecated low-level key parameter getters","text":"

                                                                                                          Functions that access low-level objects directly such as RSA_get0_n(3) are now deprecated. Applications should use one of EVP_PKEY_get_bn_param(3), EVP_PKEY_get_int_param(3), l, EVP_PKEY_get_utf8_string_param(3), EVP_PKEY_get_octet_string_param(3) or EVP_PKEY_get_params(3) to access fields from an EVP_PKEY. Gettable parameters are listed in \"Common RSA parameters\" in EVP_PKEY-RSA(7), \"DH parameters\" in EVP_PKEY-DH(7), \"DSA parameters\" in EVP_PKEY-DSA(7), \"FFC parameters\" in EVP_PKEY-FFC(7), \"Common EC parameters\" in EVP_PKEY-EC(7) and \"Common X25519, X448, ED25519 and ED448 parameters\" in EVP_PKEY-X25519(7). Applications may also use EVP_PKEY_todata(3) to return all fields."},{"location":"man7/migration_guide/#deprecated-low-level-key-parameter-setters","title":"Deprecated low-level key parameter setters","text":"

                                                                                                          Functions that access low-level objects directly such as RSA_set0_crt_params(3) are now deprecated. Applications should use EVP_PKEY_fromdata(3) to create new keys from user provided key data. Keys should be immutable once they are created, so if required the user may use EVP_PKEY_todata(3), OSSL_PARAM_merge(3), and EVP_PKEY_fromdata(3) to create a modified key. See \"Examples\" in EVP_PKEY-DH(7) for more information. See \"Deprecated low-level key generation functions\" for information on generating a key using parameters.

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-object-creation","title":"Deprecated low-level object creation","text":"

                                                                                                          Low-level objects were created using methods such as RSA_new(3), RSA_up_ref(3) and RSA_free(3). Applications should instead use the high-level EVP_PKEY APIs, e.g. EVP_PKEY_new(3), EVP_PKEY_up_ref(3) and EVP_PKEY_free(3). See also EVP_PKEY_CTX_new_from_name(3) and EVP_PKEY_CTX_new_from_pkey(3).

                                                                                                          EVP_PKEYs may be created in a variety of ways: See also \"Deprecated low-level key generation functions\", \"Deprecated low-level key reading and writing functions\" and \"Deprecated low-level key parameter setters\".

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-encryption-functions","title":"Deprecated low-level encryption functions","text":"

                                                                                                          Low-level encryption functions such as AES_encrypt(3) and AES_decrypt(3) have been informally discouraged from use for a long time. Applications should instead use the high level EVP APIs EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3), and EVP_EncryptFinal_ex(3) or EVP_DecryptInit_ex(3), EVP_DecryptUpdate(3) and EVP_DecryptFinal_ex(3).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-digest-functions","title":"Deprecated low-level digest functions","text":"

                                                                                                          Use of low-level digest functions such as SHA1_Init(3) have been informally discouraged from use for a long time. Applications should instead use the the high level EVP APIs EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3), or the quick one-shot EVP_Q_digest(3).

                                                                                                          Note that the functions SHA1(3), SHA224(3), SHA256(3), SHA384(3) and SHA512(3) have changed to macros that use EVP_Q_digest(3).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-signing-functions","title":"Deprecated low-level signing functions","text":"

                                                                                                          Use of low-level signing functions such as DSA_sign(3) have been informally discouraged for a long time. Instead applications should use EVP_DigestSign(3) and EVP_DigestVerify(3). See also EVP_SIGNATURE-RSA(7), EVP_SIGNATURE-DSA(7), EVP_SIGNATURE-ECDSA(7) and EVP_SIGNATURE-ED25519(7).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-mac-functions","title":"Deprecated low-level MAC functions","text":"

                                                                                                          Low-level mac functions such as CMAC_Init(3) are deprecated. Applications should instead use the new EVP_MAC(3) interface, using EVP_MAC_CTX_new(3), EVP_MAC_CTX_free(3), EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3) or the single-shot MAC function EVP_Q_mac(3). See EVP_MAC(3), EVP_MAC-HMAC(7), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-KMAC(7), EVP_MAC-BLAKE2(7), EVP_MAC-Poly1305(7) and EVP_MAC-Siphash(7) for additional information.

                                                                                                          Note that the one-shot method HMAC() is still available for compatibility purposes, but this can also be replaced by using EVP_Q_MAC if a library context is required.

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-validation-functions","title":"Deprecated low-level validation functions","text":"

                                                                                                          Low-level validation functions such as DH_check(3) have been informally discouraged from use for a long time. Applications should instead use the high-level EVP_PKEY APIs such as EVP_PKEY_check(3), EVP_PKEY_param_check(3), EVP_PKEY_param_check_quick(3), EVP_PKEY_public_check(3), EVP_PKEY_public_check_quick(3), EVP_PKEY_private_check(3), and EVP_PKEY_pairwise_check(3).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-key-exchange-functions","title":"Deprecated low-level key exchange functions","text":"

                                                                                                          Many low-level functions have been informally discouraged from use for a long time. Applications should instead use EVP_PKEY_derive(3). See EVP_KEYEXCH-DH(7), EVP_KEYEXCH-ECDH(7) and EVP_KEYEXCH-X25519(7).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-key-generation-functions","title":"Deprecated low-level key generation functions","text":"

                                                                                                          Many low-level functions have been informally discouraged from use for a long time. Applications should instead use EVP_PKEY_keygen_init(3) and EVP_PKEY_generate(3) as described in EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-RSA(7), EVP_PKEY-EC(7) and EVP_PKEY-X25519(7). The 'quick' one-shot function EVP_PKEY_Q_keygen(3) and macros for the most common cases: and EVP_EC_gen(3) may also be used."},{"location":"man7/migration_guide/#deprecated-low-level-key-reading-and-writing-functions","title":"Deprecated low-level key reading and writing functions","text":"

                                                                                                          Use of low-level objects (such as DSA) has been informally discouraged from use for a long time. Functions to read and write these low-level objects (such as PEM_read_DSA_PUBKEY()) should be replaced. Applications should instead use OSSL_ENCODER_to_bio(3) and OSSL_DECODER_from_bio(3).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-low-level-key-printing-functions","title":"Deprecated low-level key printing functions","text":"

                                                                                                          Use of low-level objects (such as DSA) has been informally discouraged from use for a long time. Functions to print these low-level objects such as DSA_print() should be replaced with the equivalent EVP_PKEY functions. Application should use one of EVP_PKEY_print_public(3), EVP_PKEY_print_private(3), EVP_PKEY_print_params(3), EVP_PKEY_print_public_fp(3), EVP_PKEY_print_private_fp(3) or EVP_PKEY_print_params_fp(3). Note that internally these use OSSL_ENCODER_to_bio(3) and OSSL_DECODER_from_bio(3).

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-function-mappings","title":"Deprecated function mappings","text":"

                                                                                                          The following functions have been deprecated in 3.0.

                                                                                                          • AES_bi_ige_encrypt() and AES_ige_encrypt()

                                                                                                            There is no replacement for the IGE functions. New code should not use these modes. These undocumented functions were never integrated into the EVP layer. They implemented the AES Infinite Garble Extension (IGE) mode and AES Bi-directional IGE mode. These modes were never formally standardised and usage of these functions is believed to be very small. In particular AES_bi_ige_encrypt() has a known bug. It accepts 2 AES keys, but only one is ever used. The security implications are believed to be minimal, but this issue was never fixed for backwards compatibility reasons.

                                                                                                          • AES_encrypt(), AES_decrypt(), AES_set_encrypt_key(), AES_set_decrypt_key(), AES_cbc_encrypt(), AES_cfb128_encrypt(), AES_cfb1_encrypt(), AES_cfb8_encrypt(), AES_ecb_encrypt(), AES_ofb128_encrypt()

                                                                                                          • AES_unwrap_key(), AES_wrap_key()

                                                                                                            See \"Deprecated low-level encryption functions\"

                                                                                                          • AES_options()

                                                                                                            There is no replacement. It returned a string indicating if the AES code was unrolled.

                                                                                                          • ASN1_digest(), ASN1_sign(), ASN1_verify()

                                                                                                            There are no replacements. These old functions are not used, and could be disabled with the macro NO_ASN1_OLD since OpenSSL 0.9.7.

                                                                                                          • ASN1_STRING_length_set()

                                                                                                            Use ASN1_STRING_set(3) or ASN1_STRING_set0(3) instead. This was a potentially unsafe function that could change the bounds of a previously passed in pointer.

                                                                                                          • BF_encrypt(), BF_decrypt(), BF_set_key(), BF_cbc_encrypt(), BF_cfb64_encrypt(), BF_ecb_encrypt(), BF_ofb64_encrypt()

                                                                                                            See \"Deprecated low-level encryption functions\". The Blowfish algorithm has been moved to the Legacy Provider.

                                                                                                          • BF_options()

                                                                                                            There is no replacement. This option returned a constant string.

                                                                                                          • BIO_get_callback(), BIO_set_callback(), BIO_debug_callback()

                                                                                                            Use the respective non-deprecated _ex() functions.

                                                                                                          • BN_is_prime_ex(), BN_is_prime_fasttest_ex()

                                                                                                            Use BN_check_prime(3) which avoids possible misuse and always uses at least 64 rounds of the Miller-Rabin primality test.

                                                                                                          • BN_pseudo_rand(), BN_pseudo_rand_range()

                                                                                                            Use BN_rand(3) and BN_rand_range(3).

                                                                                                          • BN_X931_derive_prime_ex(), BN_X931_generate_prime_ex(), BN_X931_generate_Xpq()

                                                                                                            There are no replacements for these low-level functions. They were used internally by RSA_X931_derive_ex() and RSA_X931_generate_key_ex() which are also deprecated. Use EVP_PKEY_keygen(3) instead.

                                                                                                          • Camellia_encrypt(), Camellia_decrypt(), Camellia_set_key(), Camellia_cbc_encrypt(), Camellia_cfb128_encrypt(), Camellia_cfb1_encrypt(), Camellia_cfb8_encrypt(), Camellia_ctr128_encrypt(), Camellia_ecb_encrypt(), Camellia_ofb128_encrypt()

                                                                                                            See \"Deprecated low-level encryption functions\".

                                                                                                          • CAST_encrypt(), CAST_decrypt(), CAST_set_key(), CAST_cbc_encrypt(), CAST_cfb64_encrypt(), CAST_ecb_encrypt(), CAST_ofb64_encrypt()

                                                                                                            See \"Deprecated low-level encryption functions\". The CAST algorithm has been moved to the Legacy Provider.

                                                                                                          • CMAC_CTX_new(), CMAC_CTX_cleanup(), CMAC_CTX_copy(), CMAC_CTX_free(), CMAC_CTX_get0_cipher_ctx()

                                                                                                            See \"Deprecated low-level MAC functions\".

                                                                                                          • CMAC_Init(), CMAC_Update(), CMAC_Final(), CMAC_resume()

                                                                                                            See \"Deprecated low-level MAC functions\".

                                                                                                          • CRYPTO_mem_ctrl(), CRYPTO_mem_debug_free(), CRYPTO_mem_debug_malloc(), CRYPTO_mem_debug_pop(), CRYPTO_mem_debug_push(), CRYPTO_mem_debug_realloc(), CRYPTO_mem_leaks(), CRYPTO_mem_leaks_cb(), CRYPTO_mem_leaks_fp(), CRYPTO_set_mem_debug()

                                                                                                            Memory-leak checking has been deprecated in favor of more modern development tools, such as compiler memory and leak sanitizers or Valgrind.

                                                                                                          • CRYPTO_cts128_encrypt_block(), CRYPTO_cts128_encrypt(), CRYPTO_cts128_decrypt_block(), CRYPTO_cts128_decrypt(), CRYPTO_nistcts128_encrypt_block(), CRYPTO_nistcts128_encrypt(), CRYPTO_nistcts128_decrypt_block(), CRYPTO_nistcts128_decrypt()

                                                                                                            Use the higher level functions EVP_CipherInit_ex2(), EVP_CipherUpdate() and EVP_CipherFinal_ex() instead. See the \"cts_mode\" parameter in \"Gettable and Settable EVP_CIPHER_CTX parameters\" in EVP_EncryptInit(3). See \"EXAMPLES\" in EVP_EncryptInit(3) for a AES-256-CBC-CTS example.

                                                                                                          • d2i_DHparams(), d2i_DHxparams(), d2i_DSAparams(), d2i_DSAPrivateKey(), d2i_DSAPrivateKey_bio(), d2i_DSAPrivateKey_fp(), d2i_DSA_PUBKEY(), d2i_DSA_PUBKEY_bio(), d2i_DSA_PUBKEY_fp(), d2i_DSAPublicKey(), d2i_ECParameters(), d2i_ECPrivateKey(), d2i_ECPrivateKey_bio(), d2i_ECPrivateKey_fp(), d2i_EC_PUBKEY(), d2i_EC_PUBKEY_bio(), d2i_EC_PUBKEY_fp(), d2i_RSAPrivateKey(), d2i_RSAPrivateKey_bio(), d2i_RSAPrivateKey_fp(), d2i_RSA_PUBKEY(), d2i_RSA_PUBKEY_bio(), d2i_RSA_PUBKEY_fp(), d2i_RSAPublicKey(), d2i_RSAPublicKey_bio(), d2i_RSAPublicKey_fp()

                                                                                                            See \"Deprecated i2d and d2i functions for low-level key types\"

                                                                                                          • o2i_ECPublicKey()

                                                                                                            Use EVP_PKEY_set1_encoded_public_key(3). See \"Deprecated low-level key parameter setters\"

                                                                                                          • DES_crypt(), DES_fcrypt(), DES_encrypt1(), DES_encrypt2(), DES_encrypt3(), DES_decrypt3(), DES_ede3_cbc_encrypt(), DES_ede3_cfb64_encrypt(), DES_ede3_cfb_encrypt(),DES_ede3_ofb64_encrypt(), DES_ecb_encrypt(), DES_ecb3_encrypt(), DES_ofb64_encrypt(), DES_ofb_encrypt(), DES_cfb64_encrypt DES_cfb_encrypt(), DES_cbc_encrypt(), DES_ncbc_encrypt(), DES_pcbc_encrypt(), DES_xcbc_encrypt(), DES_cbc_cksum(), DES_quad_cksum(), DES_check_key_parity(), DES_is_weak_key(), DES_key_sched(), DES_options(), DES_random_key(), DES_set_key(), DES_set_key_checked(), DES_set_key_unchecked(), DES_set_odd_parity(), DES_string_to_2keys(), DES_string_to_key()

                                                                                                            See \"Deprecated low-level encryption functions\". Algorithms for \"DESX-CBC\", \"DES-ECB\", \"DES-CBC\", \"DES-OFB\", \"DES-CFB\", \"DES-CFB1\" and \"DES-CFB8\" have been moved to the Legacy Provider.

                                                                                                          • DH_bits(), DH_security_bits(), DH_size()

                                                                                                            Use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                          • DH_check(), DH_check_ex(), DH_check_params(), DH_check_params_ex(), DH_check_pub_key(), DH_check_pub_key_ex()

                                                                                                            See \"Deprecated low-level validation functions\"

                                                                                                          • DH_clear_flags(), DH_test_flags(), DH_set_flags()

                                                                                                            The DH_FLAG_CACHE_MONT_P flag has been deprecated without replacement. The DH_FLAG_TYPE_DH and DH_FLAG_TYPE_DHX have been deprecated. Use EVP_PKEY_is_a() to determine the type of a key. There is no replacement for setting these flags.

                                                                                                          • DH_compute_key() DH_compute_key_padded()

                                                                                                            See \"Deprecated low-level key exchange functions\".

                                                                                                          • DH_new(), DH_new_by_nid(), DH_free(), DH_up_ref()

                                                                                                            See \"Deprecated low-level object creation\"

                                                                                                          • DH_generate_key(), DH_generate_parameters_ex()

                                                                                                            See \"Deprecated low-level key generation functions\".

                                                                                                          • DH_get0_pqg(), DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_key(), DH_get0_priv_key(), DH_get0_pub_key(), DH_get_length(), DH_get_nid()

                                                                                                            See \"Deprecated low-level key parameter getters\"

                                                                                                          • DH_get_1024_160(), DH_get_2048_224(), DH_get_2048_256()

                                                                                                            Applications should instead set the OSSL_PKEY_PARAM_GROUP_NAME as specified in \"DH parameters\" in EVP_PKEY-DH(7)) to one of \"dh_1024_160\", \"dh_2048_224\" or \"dh_2048_256\" when generating a DH key.

                                                                                                          • DH_KDF_X9_42()

                                                                                                            Applications should use EVP_PKEY_CTX_set_dh_kdf_type(3) instead.

                                                                                                          • DH_get_default_method(), DH_get0_engine(), DH_meth_*(), DH_new_method(), DH_OpenSSL(), DH_get_ex_data(), DH_set_default_method(), DH_set_method(), DH_set_ex_data()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                          • DHparams_print(), DHparams_print_fp()

                                                                                                            See \"Deprecated low-level key printing functions\"

                                                                                                          • DH_set0_key(), DH_set0_pqg(), DH_set_length()

                                                                                                            See \"Deprecated low-level key parameter setters\"

                                                                                                          • DSA_bits(), DSA_security_bits(), DSA_size()

                                                                                                            Use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                          • DHparams_dup(), DSA_dup_DH()

                                                                                                            There is no direct replacement. Applications may use EVP_PKEY_copy_parameters(3) and EVP_PKEY_dup(3) instead.

                                                                                                          • DSA_generate_key(), DSA_generate_parameters_ex()

                                                                                                            See \"Deprecated low-level key generation functions\".

                                                                                                          • DSA_get0_engine(), DSA_get_default_method(), DSA_get_ex_data(), DSA_get_method(), DSA_meth_*(), DSA_new_method(), DSA_OpenSSL(), DSA_set_default_method(), DSA_set_ex_data(), DSA_set_method()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                          • DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_pqg(), DSA_get0_key(), DSA_get0_priv_key(), DSA_get0_pub_key()

                                                                                                            See \"Deprecated low-level key parameter getters\".

                                                                                                          • DSA_new(), DSA_free(), DSA_up_ref()

                                                                                                            See \"Deprecated low-level object creation\"

                                                                                                          • DSAparams_dup()

                                                                                                            There is no direct replacement. Applications may use EVP_PKEY_copy_parameters(3) and EVP_PKEY_dup(3) instead.

                                                                                                          • DSAparams_print(), DSAparams_print_fp(), DSA_print(), DSA_print_fp()

                                                                                                            See \"Deprecated low-level key printing functions\"

                                                                                                          • DSA_set0_key(), DSA_set0_pqg()

                                                                                                            See \"Deprecated low-level key parameter setters\"

                                                                                                          • DSA_set_flags(), DSA_clear_flags(), DSA_test_flags()

                                                                                                            The DSA_FLAG_CACHE_MONT_P flag has been deprecated without replacement.

                                                                                                          • DSA_sign(), DSA_do_sign(), DSA_sign_setup(), DSA_verify(), DSA_do_verify()

                                                                                                            See \"Deprecated low-level signing functions\".

                                                                                                          • ECDH_compute_key()

                                                                                                            See \"Deprecated low-level key exchange functions\".

                                                                                                          • ECDH_KDF_X9_62()

                                                                                                            Applications may either set this using the helper function EVP_PKEY_CTX_set_ecdh_kdf_type(3) or by setting an OSSL_PARAM(3) using the \"kdf-type\" as shown in \"EXAMPLES\" in EVP_KEYEXCH-ECDH(7)

                                                                                                          • ECDSA_sign(), ECDSA_sign_ex(), ECDSA_sign_setup(), ECDSA_do_sign(), ECDSA_do_sign_ex(), ECDSA_verify(), ECDSA_do_verify()

                                                                                                            See \"Deprecated low-level signing functions\".

                                                                                                          • ECDSA_size()

                                                                                                            Applications should use EVP_PKEY_get_size(3).

                                                                                                          • EC_GF2m_simple_method(), EC_GFp_mont_method(), EC_GFp_nist_method(), EC_GFp_nistp224_method(), EC_GFp_nistp256_method(), EC_GFp_nistp521_method(), EC_GFp_simple_method()

                                                                                                            There are no replacements for these functions. Applications should rely on the library automatically assigning a suitable method internally when an EC_GROUP is constructed.

                                                                                                          • EC_GROUP_clear_free()

                                                                                                            Use EC_GROUP_free(3) instead.

                                                                                                          • EC_GROUP_get_curve_GF2m(), EC_GROUP_get_curve_GFp(), EC_GROUP_set_curve_GF2m(), EC_GROUP_set_curve_GFp()

                                                                                                            Applications should use EC_GROUP_get_curve(3) and EC_GROUP_set_curve(3).

                                                                                                          • EC_GROUP_have_precompute_mult(), EC_GROUP_precompute_mult(), EC_KEY_precompute_mult()

                                                                                                            These functions are not widely used. Applications should instead switch to named curves which OpenSSL has hardcoded lookup tables for.

                                                                                                          • EC_GROUP_new(), EC_GROUP_method_of(), EC_POINT_method_of()

                                                                                                            EC_METHOD is now an internal-only concept and a suitable EC_METHOD is assigned internally without application intervention. Users of EC_GROUP_new() should switch to a different suitable constructor.

                                                                                                          • EC_KEY_can_sign()

                                                                                                            Applications should use EVP_PKEY_can_sign(3) instead.

                                                                                                          • EC_KEY_check_key()

                                                                                                            See \"Deprecated low-level validation functions\"

                                                                                                          • EC_KEY_set_flags(), EC_KEY_get_flags(), EC_KEY_clear_flags()

                                                                                                            See \"Common EC parameters\" in EVP_PKEY-EC(7) which handles flags as separate parameters for OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT, OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE, OSSL_PKEY_PARAM_EC_ENCODING, OSSL_PKEY_PARAM_USE_COFACTOR_ECDH and OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC. See also \"EXAMPLES\" in EVP_PKEY-EC(7)

                                                                                                          • EC_KEY_dup(), EC_KEY_copy()

                                                                                                            There is no direct replacement. Applications may use EVP_PKEY_copy_parameters(3) and EVP_PKEY_dup(3) instead.

                                                                                                          • EC_KEY_decoded_from_explicit_params()

                                                                                                            There is no replacement.

                                                                                                          • EC_KEY_generate_key()

                                                                                                            See \"Deprecated low-level key generation functions\".

                                                                                                          • EC_KEY_get0_group(), EC_KEY_get0_private_key(), EC_KEY_get0_public_key(), EC_KEY_get_conv_form(), EC_KEY_get_enc_flags()

                                                                                                            See \"Deprecated low-level key parameter getters\".

                                                                                                          • EC_KEY_get0_engine(), EC_KEY_get_default_method(), EC_KEY_get_method(), EC_KEY_new_method(), EC_KEY_get_ex_data(), EC_KEY_OpenSSL(), EC_KEY_set_ex_data(), EC_KEY_set_default_method(), EC_KEY_METHOD_*(), EC_KEY_set_method()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                          • EC_METHOD_get_field_type()

                                                                                                            Use EC_GROUP_get_field_type(3) instead. See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                          • EC_KEY_key2buf(), EC_KEY_oct2key(), EC_KEY_oct2priv(), EC_KEY_priv2buf(), EC_KEY_priv2oct()

                                                                                                            There are no replacements for these.

                                                                                                          • EC_KEY_new(), EC_KEY_new_by_curve_name(), EC_KEY_free(), EC_KEY_up_ref()

                                                                                                            See \"Deprecated low-level object creation\"

                                                                                                          • EC_KEY_print(), EC_KEY_print_fp()

                                                                                                            See \"Deprecated low-level key printing functions\"

                                                                                                          • EC_KEY_set_asn1_flag(), EC_KEY_set_conv_form(), EC_KEY_set_enc_flags()

                                                                                                            See \"Deprecated low-level key parameter setters\".

                                                                                                          • EC_KEY_set_group(), EC_KEY_set_private_key(), EC_KEY_set_public_key(), EC_KEY_set_public_key_affine_coordinates()

                                                                                                            See \"Deprecated low-level key parameter setters\".

                                                                                                          • ECParameters_print(), ECParameters_print_fp(), ECPKParameters_print(), ECPKParameters_print_fp()

                                                                                                            See \"Deprecated low-level key printing functions\"

                                                                                                          • EC_POINT_bn2point(), EC_POINT_point2bn()

                                                                                                            These functions were not particularly useful, since EC point serialization formats are not individual big-endian integers.

                                                                                                          • EC_POINT_get_affine_coordinates_GF2m(), EC_POINT_get_affine_coordinates_GFp(), EC_POINT_set_affine_coordinates_GF2m(), EC_POINT_set_affine_coordinates_GFp()

                                                                                                            Applications should use EC_POINT_get_affine_coordinates(3) and EC_POINT_set_affine_coordinates(3) instead.

                                                                                                          • EC_POINT_get_Jprojective_coordinates_GFp(), EC_POINT_set_Jprojective_coordinates_GFp()

                                                                                                            These functions are not widely used. Applications should instead use the EC_POINT_set_affine_coordinates(3) and EC_POINT_get_affine_coordinates(3) functions.

                                                                                                          • EC_POINT_make_affine(), EC_POINTs_make_affine()

                                                                                                            There is no replacement. These functions were not widely used, and OpenSSL automatically performs this conversion when needed.

                                                                                                          • EC_POINT_set_compressed_coordinates_GF2m(), EC_POINT_set_compressed_coordinates_GFp()

                                                                                                            Applications should use EC_POINT_set_compressed_coordinates(3) instead.

                                                                                                          • EC_POINTs_mul()

                                                                                                            This function is not widely used. Applications should instead use the EC_POINT_mul(3) function.

                                                                                                          • ENGINE_*()

                                                                                                            All engine functions are deprecated. An engine should be rewritten as a provider. See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                          • ERR_load_*(), ERR_func_error_string(), ERR_get_error_line(), ERR_get_error_line_data(), ERR_get_state()

                                                                                                            OpenSSL now loads error strings automatically so these functions are not needed.

                                                                                                          • ERR_peek_error_line_data(), ERR_peek_last_error_line_data()

                                                                                                            The new functions are ERR_peek_error_func(3), ERR_peek_last_error_func(3), ERR_peek_error_data(3), ERR_peek_last_error_data(3), ERR_get_error_all(3), ERR_peek_error_all(3) and ERR_peek_last_error_all(3). Applications should use ERR_get_error_all(3), or pick information with ERR_peek functions and finish off with getting the error code by using ERR_get_error(3).

                                                                                                          • EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_iv_noconst(), EVP_CIPHER_CTX_original_iv()

                                                                                                            Applications should instead use EVP_CIPHER_CTX_get_updated_iv(3), EVP_CIPHER_CTX_get_updated_iv(3) and EVP_CIPHER_CTX_get_original_iv(3) respectively. See EVP_CIPHER_CTX_get_original_iv(3) for further information.

                                                                                                          • EVP_CIPHER_meth_*(), EVP_MD_CTX_set_update_fn(), EVP_MD_CTX_update_fn(), EVP_MD_meth_*()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                          • EVP_PKEY_CTRL_PKCS7_ENCRYPT(), EVP_PKEY_CTRL_PKCS7_DECRYPT(), EVP_PKEY_CTRL_PKCS7_SIGN(), EVP_PKEY_CTRL_CMS_ENCRYPT(), EVP_PKEY_CTRL_CMS_DECRYPT(), and EVP_PKEY_CTRL_CMS_SIGN()

                                                                                                            These control operations are not invoked by the OpenSSL library anymore and are replaced by direct checks of the key operation against the key type when the operation is initialized.

                                                                                                          • EVP_PKEY_CTX_get0_dh_kdf_ukm(), EVP_PKEY_CTX_get0_ecdh_kdf_ukm()

                                                                                                            See the \"kdf-ukm\" item in \"DH key exchange parameters\" in EVP_KEYEXCH-DH(7) and \"ECDH Key Exchange parameters\" in EVP_KEYEXCH-ECDH(7). These functions are obsolete and should not be required.

                                                                                                          • EVP_PKEY_CTX_set_rsa_keygen_pubexp()

                                                                                                            Applications should use EVP_PKEY_CTX_set1_rsa_keygen_pubexp(3) instead.

                                                                                                          • EVP_PKEY_cmp(), EVP_PKEY_cmp_parameters()

                                                                                                            Applications should use EVP_PKEY_eq(3) and EVP_PKEY_parameters_eq(3) instead. See EVP_PKEY_copy_parameters(3) for further details.

                                                                                                          • EVP_PKEY_encrypt_old(), EVP_PKEY_decrypt_old(),

                                                                                                            Applications should use EVP_PKEY_encrypt_init(3) and EVP_PKEY_encrypt(3) or EVP_PKEY_decrypt_init(3) and EVP_PKEY_decrypt(3) instead.

                                                                                                          • EVP_PKEY_get0()

                                                                                                            This function returns NULL if the key comes from a provider.

                                                                                                          • EVP_PKEY_get0_DH(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_EC_KEY(), EVP_PKEY_get0_RSA(), EVP_PKEY_get1_DH(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_EC_KEY and EVP_PKEY_get1_RSA(), EVP_PKEY_get0_hmac(), EVP_PKEY_get0_poly1305(), EVP_PKEY_get0_siphash()

                                                                                                            See \"Functions that return an internal key should be treated as read only\".

                                                                                                          • EVP_PKEY_meth_*()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                          • EVP_PKEY_new_CMAC_key()

                                                                                                            See \"Deprecated low-level MAC functions\".

                                                                                                          • EVP_PKEY_assign(), EVP_PKEY_set1_DH(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_EC_KEY(), EVP_PKEY_set1_RSA()

                                                                                                            See \"Deprecated low-level key object getters and setters\"

                                                                                                          • EVP_PKEY_set1_tls_encodedpoint() EVP_PKEY_get1_tls_encodedpoint()

                                                                                                            These functions were previously used by libssl to set or get an encoded public key into/from an EVP_PKEY object. With OpenSSL 3.0 these are replaced by the more generic functions EVP_PKEY_set1_encoded_public_key(3) and EVP_PKEY_get1_encoded_public_key(3). The old versions have been converted to deprecated macros that just call the new functions.

                                                                                                          • EVP_PKEY_set1_engine(), EVP_PKEY_get0_engine()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                          • EVP_PKEY_set_alias_type()

                                                                                                            This function has been removed. There is no replacement. See \"EVP_PKEY_set_alias_type() method has been removed\"

                                                                                                          • HMAC_Init_ex(), HMAC_Update(), HMAC_Final(), HMAC_size()

                                                                                                            See \"Deprecated low-level MAC functions\".

                                                                                                          • HMAC_CTX_new(), HMAC_CTX_free(), HMAC_CTX_copy(), HMAC_CTX_reset(), HMAC_CTX_set_flags(), HMAC_CTX_get_md()

                                                                                                            See \"Deprecated low-level MAC functions\".

                                                                                                          • i2d_DHparams(), i2d_DHxparams()

                                                                                                            See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                          • i2d_DSAparams(), i2d_DSAPrivateKey(), i2d_DSAPrivateKey_bio(), i2d_DSAPrivateKey_fp(), i2d_DSA_PUBKEY(), i2d_DSA_PUBKEY_bio(), i2d_DSA_PUBKEY_fp(), i2d_DSAPublicKey()

                                                                                                            See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                          • i2d_ECParameters(), i2d_ECPrivateKey(), i2d_ECPrivateKey_bio(), i2d_ECPrivateKey_fp(), i2d_EC_PUBKEY(), i2d_EC_PUBKEY_bio(), i2d_EC_PUBKEY_fp()

                                                                                                            See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                          • i2o_ECPublicKey()

                                                                                                            Use EVP_PKEY_get1_encoded_public_key(3). See \"Deprecated low-level key parameter getters\"

                                                                                                          • i2d_RSAPrivateKey(), i2d_RSAPrivateKey_bio(), i2d_RSAPrivateKey_fp(), i2d_RSA_PUBKEY(), i2d_RSA_PUBKEY_bio(), i2d_RSA_PUBKEY_fp(), i2d_RSAPublicKey(), i2d_RSAPublicKey_bio(), i2d_RSAPublicKey_fp()

                                                                                                            See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                          • IDEA_encrypt(), IDEA_set_decrypt_key(), IDEA_set_encrypt_key(), IDEA_cbc_encrypt(), IDEA_cfb64_encrypt(), IDEA_ecb_encrypt(), IDEA_ofb64_encrypt()

                                                                                                            See \"Deprecated low-level encryption functions\". IDEA has been moved to the Legacy Provider.

                                                                                                          • IDEA_options()

                                                                                                            There is no replacement. This function returned a constant string.

                                                                                                          • MD2(), MD2_Init(), MD2_Update(), MD2_Final()

                                                                                                            See \"Deprecated low-level encryption functions\". MD2 has been moved to the Legacy Provider.

                                                                                                          • MD2_options()

                                                                                                            There is no replacement. This function returned a constant string.

                                                                                                          • MD4(), MD4_Init(), MD4_Update(), MD4_Final(), MD4_Transform()

                                                                                                            See \"Deprecated low-level encryption functions\". MD4 has been moved to the Legacy Provider.

                                                                                                          • MDC2(), MDC2_Init(), MDC2_Update(), MDC2_Final()

                                                                                                            See \"Deprecated low-level encryption functions\". MDC2 has been moved to the Legacy Provider.

                                                                                                          • MD5(), MD5_Init(), MD5_Update(), MD5_Final(), MD5_Transform()

                                                                                                            See \"Deprecated low-level encryption functions\".

                                                                                                          • NCONF_WIN32()

                                                                                                            This undocumented function has no replacement. See \"HISTORY\" in config(5) for more details.

                                                                                                          • OCSP_parse_url()

                                                                                                            Use OSSL_HTTP_parse_url(3) instead.

                                                                                                          • OCSP_REQ_CTX type and OCSP_REQ_CTX_*() functions

                                                                                                            These methods were used to collect all necessary data to form a HTTP request, and to perform the HTTP transfer with that request. With OpenSSL 3.0, the type is OSSL_HTTP_REQ_CTX, and the deprecated functions are replaced with OSSL_HTTP_REQ_CTX_*(). See OSSL_HTTP_REQ_CTX(3) for additional details.

                                                                                                          • OPENSSL_fork_child(), OPENSSL_fork_parent(), OPENSSL_fork_prepare()

                                                                                                            There is no replacement for these functions. These pthread fork support methods were unused by OpenSSL.

                                                                                                          • OSSL_STORE_ctrl(), OSSL_STORE_do_all_loaders(), OSSL_STORE_LOADER_get0_engine(), OSSL_STORE_LOADER_get0_scheme(), OSSL_STORE_LOADER_new(), OSSL_STORE_LOADER_set_attach(), OSSL_STORE_LOADER_set_close(), OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_eof(), OSSL_STORE_LOADER_set_error(), OSSL_STORE_LOADER_set_expect(), OSSL_STORE_LOADER_set_find(), OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_register_loader(), OSSL_STORE_unregister_loader(), OSSL_STORE_vctrl()

                                                                                                            These functions helped applications and engines create loaders for schemes they supported. These are all deprecated and discouraged in favour of provider implementations, see provider-storemgmt(7).

                                                                                                          • PEM_read_DHparams(), PEM_read_bio_DHparams(), PEM_read_DSAparams(), PEM_read_bio_DSAparams(), PEM_read_DSAPrivateKey(), PEM_read_DSA_PUBKEY(), PEM_read_bio_DSAPrivateKey and PEM_read_bio_DSA_PUBKEY(), PEM_read_ECPKParameters(), PEM_read_ECPrivateKey(), PEM_read_EC_PUBKEY(), PEM_read_bio_ECPKParameters(), PEM_read_bio_ECPrivateKey(), PEM_read_bio_EC_PUBKEY(), PEM_read_RSAPrivateKey(), PEM_read_RSA_PUBKEY(), PEM_read_RSAPublicKey(), PEM_read_bio_RSAPrivateKey(), PEM_read_bio_RSA_PUBKEY(), PEM_read_bio_RSAPublicKey(), PEM_write_bio_DHparams(), PEM_write_bio_DHxparams(), PEM_write_DHparams(), PEM_write_DHxparams(), PEM_write_DSAparams(), PEM_write_DSAPrivateKey(), PEM_write_DSA_PUBKEY(), PEM_write_bio_DSAparams(), PEM_write_bio_DSAPrivateKey(), PEM_write_bio_DSA_PUBKEY(), PEM_write_ECPKParameters(), PEM_write_ECPrivateKey(), PEM_write_EC_PUBKEY(), PEM_write_bio_ECPKParameters(), PEM_write_bio_ECPrivateKey(), PEM_write_bio_EC_PUBKEY(), PEM_write_RSAPrivateKey(), PEM_write_RSA_PUBKEY(), PEM_write_RSAPublicKey(), PEM_write_bio_RSAPrivateKey(), PEM_write_bio_RSA_PUBKEY(), PEM_write_bio_RSAPublicKey(),

                                                                                                            See \"Deprecated low-level key reading and writing functions\"

                                                                                                          • PKCS1_MGF1()

                                                                                                            See \"Deprecated low-level encryption functions\".

                                                                                                          • RAND_get_rand_method(), RAND_set_rand_method(), RAND_OpenSSL(), RAND_set_rand_engine()

                                                                                                            Applications should instead use RAND_set_DRBG_type(3), EVP_RAND(3) and EVP_RAND(7). See RAND_set_rand_method(3) for more details.

                                                                                                          • RC2_encrypt(), RC2_decrypt(), RC2_set_key(), RC2_cbc_encrypt(), RC2_cfb64_encrypt(), RC2_ecb_encrypt(), RC2_ofb64_encrypt(), RC4(), RC4_set_key(), RC4_options(), RC5_32_encrypt(), RC5_32_set_key(), RC5_32_decrypt(), RC5_32_cbc_encrypt(), RC5_32_cfb64_encrypt(), RC5_32_ecb_encrypt(), RC5_32_ofb64_encrypt()

                                                                                                            See \"Deprecated low-level encryption functions\". The Algorithms \"RC2\", \"RC4\" and \"RC5\" have been moved to the Legacy Provider.

                                                                                                          • RIPEMD160(), RIPEMD160_Init(), RIPEMD160_Update(), RIPEMD160_Final(), RIPEMD160_Transform()

                                                                                                            See \"Deprecated low-level digest functions\". The RIPE algorithm has been moved to the Legacy Provider.

                                                                                                          • RSA_bits(), RSA_security_bits(), RSA_size()

                                                                                                            Use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                          • RSA_check_key(), RSA_check_key_ex()

                                                                                                            See \"Deprecated low-level validation functions\"

                                                                                                          • RSA_clear_flags(), RSA_flags(), RSA_set_flags(), RSA_test_flags(), RSA_setup_blinding(), RSA_blinding_off(), RSA_blinding_on()

                                                                                                            All of these RSA flags have been deprecated without replacement:

                                                                                                            RSA_FLAG_BLINDING, RSA_FLAG_CACHE_PRIVATE, RSA_FLAG_CACHE_PUBLIC, RSA_FLAG_EXT_PKEY, RSA_FLAG_NO_BLINDING, RSA_FLAG_THREAD_SAFE RSA_METHOD_FLAG_NO_CHECK

                                                                                                          • RSA_generate_key_ex(), RSA_generate_multi_prime_key()

                                                                                                            See \"Deprecated low-level key generation functions\".

                                                                                                          • RSA_get0_engine()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                          • RSA_get0_crt_params(), RSA_get0_d(), RSA_get0_dmp1(), RSA_get0_dmq1(), RSA_get0_e(), RSA_get0_factors(), RSA_get0_iqmp(), RSA_get0_key(), RSA_get0_multi_prime_crt_params(), RSA_get0_multi_prime_factors(), RSA_get0_n(), RSA_get0_p(), RSA_get0_pss_params(), RSA_get0_q(), RSA_get_multi_prime_extra_count()

                                                                                                            See \"Deprecated low-level key parameter getters\"

                                                                                                          • RSA_new(), RSA_free(), RSA_up_ref()

                                                                                                            See \"Deprecated low-level object creation\".

                                                                                                          • RSA_get_default_method(), RSA_get_ex_data and RSA_get_method()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                          • RSA_get_version()

                                                                                                            There is no replacement.

                                                                                                          • RSA_meth_*(), RSA_new_method(), RSA_null_method and RSA_PKCS1_OpenSSL()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                          • RSA_padding_add_*(), RSA_padding_check_*()

                                                                                                            See \"Deprecated low-level signing functions\" and \"Deprecated low-level encryption functions\".

                                                                                                          • RSA_print(), RSA_print_fp()

                                                                                                            See \"Deprecated low-level key printing functions\"

                                                                                                          • RSA_public_encrypt(), RSA_private_decrypt()

                                                                                                            See \"Deprecated low-level encryption functions\"

                                                                                                          • RSA_private_encrypt(), RSA_public_decrypt()

                                                                                                            This is equivalent to doing sign and verify recover operations (with a padding mode of none). See \"Deprecated low-level signing functions\".

                                                                                                          • RSAPrivateKey_dup(), RSAPublicKey_dup()

                                                                                                            There is no direct replacement. Applications may use EVP_PKEY_dup(3).

                                                                                                          • RSAPublicKey_it(), RSAPrivateKey_it()

                                                                                                            See \"Deprecated low-level key reading and writing functions\"

                                                                                                          • RSA_set0_crt_params(), RSA_set0_factors(), RSA_set0_key(), RSA_set0_multi_prime_params()

                                                                                                            See \"Deprecated low-level key parameter setters\".

                                                                                                          • RSA_set_default_method(), RSA_set_method(), RSA_set_ex_data()

                                                                                                            See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                          • RSA_sign(), RSA_sign_ASN1_OCTET_STRING(), RSA_verify(), RSA_verify_ASN1_OCTET_STRING(), RSA_verify_PKCS1_PSS(), RSA_verify_PKCS1_PSS_mgf1()

                                                                                                            See \"Deprecated low-level signing functions\".

                                                                                                          • RSA_X931_derive_ex(), RSA_X931_generate_key_ex(), RSA_X931_hash_id()

                                                                                                            There are no replacements for these functions. X931 padding can be set using \"Signature Parameters\" in EVP_SIGNATURE-RSA(7). See OSSL_SIGNATURE_PARAM_PAD_MODE.

                                                                                                          • SEED_encrypt(), SEED_decrypt(), SEED_set_key(), SEED_cbc_encrypt(), SEED_cfb128_encrypt(), SEED_ecb_encrypt(), SEED_ofb128_encrypt()

                                                                                                            See \"Deprecated low-level encryption functions\". The SEED algorithm has been moved to the Legacy Provider.

                                                                                                          • SHA1_Init(), SHA1_Update(), SHA1_Final(), SHA1_Transform(), SHA224_Init(), SHA224_Update(), SHA224_Final(), SHA256_Init(), SHA256_Update(), SHA256_Final(), SHA256_Transform(), SHA384_Init(), SHA384_Update(), SHA384_Final(), SHA512_Init(), SHA512_Update(), SHA512_Final(), SHA512_Transform()

                                                                                                            See \"Deprecated low-level digest functions\".

                                                                                                          • SRP_Calc_A(), SRP_Calc_B(), SRP_Calc_client_key(), SRP_Calc_server_key(), SRP_Calc_u(), SRP_Calc_x(), SRP_check_known_gN_param(), SRP_create_verifier(), SRP_create_verifier_BN(), SRP_get_default_gN(), SRP_user_pwd_free(), SRP_user_pwd_new(), SRP_user_pwd_set0_sv(), SRP_user_pwd_set1_ids(), SRP_user_pwd_set_gN(), SRP_VBASE_add0_user(), SRP_VBASE_free(), SRP_VBASE_get1_by_user(), SRP_VBASE_init(), SRP_VBASE_new(), SRP_Verify_A_mod_N(), SRP_Verify_B_mod_N()

                                                                                                            There are no replacements for the SRP functions.

                                                                                                          • SSL_CTX_set_tmp_dh_callback(), SSL_set_tmp_dh_callback(), SSL_CTX_set_tmp_dh(), SSL_set_tmp_dh()

                                                                                                            These are used to set the Diffie-Hellman (DH) parameters that are to be used by servers requiring ephemeral DH keys. Instead applications should consider using the built-in DH parameters that are available by calling SSL_CTX_set_dh_auto(3) or SSL_set_dh_auto(3). If custom parameters are necessary then applications can use the alternative functions SSL_CTX_set0_tmp_dh_pkey(3) and SSL_set0_tmp_dh_pkey(3). There is no direct replacement for the \"callback\" functions. The callback was originally useful in order to have different parameters for export and non-export ciphersuites. Export ciphersuites are no longer supported by OpenSSL. Use of the callback functions should be replaced by one of the other methods described above.

                                                                                                          • SSL_CTX_set_tlsext_ticket_key_cb()

                                                                                                            Use the new SSL_CTX_set_tlsext_ticket_key_evp_cb(3) function instead.

                                                                                                          • WHIRLPOOL(), WHIRLPOOL_Init(), WHIRLPOOL_Update(), WHIRLPOOL_Final(), WHIRLPOOL_BitUpdate()

                                                                                                            See \"Deprecated low-level digest functions\". The Whirlpool algorithm has been moved to the Legacy Provider.

                                                                                                          • X509_certificate_type()

                                                                                                            This was an undocumented function. Applications can use X509_get0_pubkey(3) and X509_get0_signature(3) instead.

                                                                                                          • X509_http_nbio(), X509_CRL_http_nbio()

                                                                                                            Use X509_load_http(3) and X509_CRL_load_http(3) instead.

                                                                                                          "},{"location":"man7/migration_guide/#nid-handling-for-provided-keys-and-algorithms","title":"NID handling for provided keys and algorithms","text":"

                                                                                                          The following functions for NID (numeric id) handling have changed semantics.

                                                                                                          • EVP_PKEY_id(), EVP_PKEY_get_id()

                                                                                                            This function was previously used to reliably return the NID of an EVP_PKEY object, e.g., to look up the name of the algorithm of such EVP_PKEY by calling OBJ_nid2sn(3). With the introduction of provider(7)s EVP_PKEY_id() or its new equivalent EVP_PKEY_get_id(3) might now also return the value -1 (EVP_PKEY_KEYMGMT) indicating the use of a provider to implement the EVP_PKEY object. Therefore, the use of EVP_PKEY_get0_type_name(3) is recommended for retrieving the name of the EVP_PKEY algorithm.

                                                                                                          "},{"location":"man7/migration_guide/#using-the-fips-module-in-applications","title":"Using the FIPS Module in applications","text":"

                                                                                                          See fips_module(7) and OSSL_PROVIDER-FIPS(7) for details.

                                                                                                          "},{"location":"man7/migration_guide/#openssl-command-line-application-changes","title":"OpenSSL command line application changes","text":""},{"location":"man7/migration_guide/#new-applications","title":"New applications","text":"

                                                                                                          openssl kdf uses the new EVP_KDF(3) API. openssl kdf uses the new EVP_MAC(3) API.

                                                                                                          "},{"location":"man7/migration_guide/#added-options","title":"Added options","text":"

                                                                                                          -provider_path and -provider are available to all apps and can be used multiple times to load any providers, such as the 'legacy' provider or third party providers. If used then the 'default' provider would also need to be specified if required. The -provider_path must be specified before the -provider option.

                                                                                                          The list app has many new options. See openssl-list(1) for more information.

                                                                                                          -crl_lastupdate and -crl_nextupdate used by openssl ca allows explicit setting of fields in the generated CRL.

                                                                                                          "},{"location":"man7/migration_guide/#removed-options","title":"Removed options","text":"

                                                                                                          Interactive mode is not longer available.

                                                                                                          The -crypt option used by openssl passwd. The -c option used by openssl x509, openssl dhparam, openssl dsaparam, and openssl ecparam.

                                                                                                          "},{"location":"man7/migration_guide/#other-changes","title":"Other Changes","text":"

                                                                                                          The output of Command line applications may have minor changes. These are primarily changes in capitalisation and white space. However, in some cases, there are additional differences. For example, the DH parameters output from openssl dhparam now lists 'P', 'Q', 'G' and 'pcounter' instead of 'prime', 'generator', 'subgroup order' and 'counter' respectively.

                                                                                                          The openssl commands that read keys, certificates, and CRLs now automatically detect the PEM or DER format of the input files so it is not necessary to explicitly specify the input format anymore. However if the input format option is used the specified format will be required.

                                                                                                          openssl speed no longer uses low-level API calls. This implies some of the performance numbers might not be comparable with the previous releases due to higher overhead. This applies particularly to measuring performance on smaller data chunks.

                                                                                                          b<openssl dhparam>, openssl dsa, openssl gendsa, openssl dsaparam, openssl genrsa and openssl rsa have been modified to use PKEY APIs. openssl genrsa and openssl rsa now write PKCS #8 keys by default.

                                                                                                          "},{"location":"man7/migration_guide/#default-settings","title":"Default settings","text":"

                                                                                                          \"SHA256\" is now the default digest for TS query used by openssl ts.

                                                                                                          "},{"location":"man7/migration_guide/#deprecated-apps","title":"Deprecated apps","text":"

                                                                                                          openssl rsautl is deprecated, use openssl pkeyutl instead. openssl dhparam, openssl dsa, openssl gendsa, openssl dsaparam, openssl genrsa, openssl rsa, openssl genrsa and openssl rsa are now in maintenance mode and no new features will be added to them.

                                                                                                          "},{"location":"man7/migration_guide/#tls-changes","title":"TLS Changes","text":"
                                                                                                          • TLS 1.3 FFDHE key exchange support added

                                                                                                            This uses DH safe prime named groups.

                                                                                                          • Support for fully \"pluggable\" TLSv1.3 groups.

                                                                                                            This means that providers may supply their own group implementations (using either the \"key exchange\" or the \"key encapsulation\" methods) which will automatically be detected and used by libssl.

                                                                                                          • SSL and SSL_CTX options are now 64 bit instead of 32 bit.

                                                                                                            The signatures of the functions to get and set options on SSL and SSL_CTX objects changed from \"unsigned long\" to \"uint64_t\" type.

                                                                                                            This may require source code changes. For example it is no longer possible to use the SSL_OP_ macro values in preprocessor #if conditions. However it is still possible to test whether these macros are defined or not.

                                                                                                            See SSL_CTX_get_options(3), SSL_CTX_set_options(3), SSL_get_options(3) and SSL_set_options(3).

                                                                                                          • SSL_set1_host() and SSL_add1_host() Changes

                                                                                                            These functions now take IP literal addresses as well as actual hostnames.

                                                                                                          • Added SSL option SSL_OP_CLEANSE_PLAINTEXT

                                                                                                            If the option is set, openssl cleanses (zeroizes) plaintext bytes from internal buffers after delivering them to the application. Note, the application is still responsible for cleansing other copies (e.g.: data received by SSL_read(3)).

                                                                                                          • Client-initiated renegotiation is disabled by default.

                                                                                                            To allow it, use the -client_renegotiation option, the SSL_OP_ALLOW_CLIENT_RENEGOTIATION flag, or the ClientRenegotiation config parameter as appropriate.

                                                                                                          • Secure renegotiation is now required by default for TLS connections

                                                                                                            Support for RFC 5746 secure renegotiation is now required by default for SSL or TLS connections to succeed. Applications that require the ability to connect to legacy peers will need to explicitly set SSL_OP_LEGACY_SERVER_CONNECT. Accordingly, SSL_OP_LEGACY_SERVER_CONNECT is no longer set as part of SSL_OP_ALL.

                                                                                                          • Combining the Configure options no-ec and no-dh no longer disables TLSv1.3

                                                                                                            Typically if OpenSSL has no EC or DH algorithms then it cannot support connections with TLSv1.3. However OpenSSL now supports \"pluggable\" groups through providers. Therefore third party providers may supply group implementations even where there are no built-in ones. Attempting to create TLS connections in such a build without also disabling TLSv1.3 at run time or using third party provider groups may result in handshake failures. TLSv1.3 can be disabled at compile time using the \"no-tls1_3\" Configure option.

                                                                                                          • SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() changes.

                                                                                                            The methods now ignore unknown ciphers.

                                                                                                          • Security callback change.

                                                                                                            The security callback, which can be customised by application code, supports the security operation SSL_SECOP_TMP_DH. This is defined to take an EVP_PKEY in the \"other\" parameter. In most places this is what is passed. All these places occur server side. However there was one client side call of this security operation and it passed a DH object instead. This is incorrect according to the definition of SSL_SECOP_TMP_DH, and is inconsistent with all of the other locations. Therefore this client side call has been changed to pass an EVP_PKEY instead.

                                                                                                          • New SSL option SSL_OP_IGNORE_UNEXPECTED_EOF

                                                                                                            The SSL option SSL_OP_IGNORE_UNEXPECTED_EOF is introduced. If that option is set, an unexpected EOF is ignored, it pretends a close notify was received instead and so the returned error becomes SSL_ERROR_ZERO_RETURN.

                                                                                                          • The security strength of SHA1 and MD5 based signatures in TLS has been reduced.

                                                                                                            This results in SSL 3, TLS 1.0, TLS 1.1 and DTLS 1.0 no longer working at the default security level of 1 and instead requires security level 0. The security level can be changed either using the cipher string with @SECLEVEL, or calling SSL_CTX_set_security_level(3). This also means that where the signature algorithms extension is missing from a ClientHello then the handshake will fail in TLS 1.2 at security level 1. This is because, although this extension is optional, failing to provide one means that OpenSSL will fallback to a default set of signature algorithms. This default set requires the availability of SHA1.

                                                                                                          • X509 certificates signed using SHA1 are no longer allowed at security level 1 and above.

                                                                                                            In TLS/SSL the default security level is 1. It can be set either using the cipher string with @SECLEVEL, or calling SSL_CTX_set_security_level(3). If the leaf certificate is signed with SHA-1, a call to SSL_CTX_use_certificate(3) will fail if the security level is not lowered first. Outside TLS/SSL, the default security level is -1 (effectively 0). It can be set using X509_VERIFY_PARAM_set_auth_level(3) or using the -auth_level options of the commands.

                                                                                                          "},{"location":"man7/migration_guide/#see-also","title":"SEE ALSO","text":"

                                                                                                          fips_module(7)

                                                                                                          "},{"location":"man7/migration_guide/#history","title":"HISTORY","text":"

                                                                                                          The migration guide was created for OpenSSL 3.0.

                                                                                                          "},{"location":"man7/migration_guide/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/openssl-core.h/","title":"openssl-core.h","text":""},{"location":"man7/openssl-core.h/#name","title":"NAME","text":"

                                                                                                          openssl/core.h - OpenSSL Core types

                                                                                                          "},{"location":"man7/openssl-core.h/#synopsis","title":"SYNOPSIS","text":"
                                                                                                          #include <openssl/core.h>\n
                                                                                                          "},{"location":"man7/openssl-core.h/#description","title":"DESCRIPTION","text":"

                                                                                                          The <openssl/core.h> header defines a number of public types that are used to communicate between the OpenSSL libraries and implementation providers. These types are designed to minimise the need for intimate knowledge of internal structures between the OpenSSL libraries and the providers.

                                                                                                          The types are:

                                                                                                          • OSSL_DISPATCH(3)
                                                                                                          • OSSL_ITEM(3)
                                                                                                          • OSSL_ALGORITHM(3)
                                                                                                          • OSSL_PARAM(3)
                                                                                                          • OSSL_CALLBACK(3)
                                                                                                          • OSSL_PASSPHRASE_CALLBACK(3)
                                                                                                          "},{"location":"man7/openssl-core.h/#see-also","title":"SEE ALSO","text":"

                                                                                                          openssl-core_dispatch.h(7)

                                                                                                          "},{"location":"man7/openssl-core.h/#history","title":"HISTORY","text":"

                                                                                                          The types described here were added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/openssl-core.h/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/openssl-core_dispatch.h/","title":"openssl-core_dispatch.h","text":""},{"location":"man7/openssl-core_dispatch.h/#name","title":"NAME","text":"

                                                                                                          openssl/core_dispatch.h - OpenSSL provider dispatch numbers and function types

                                                                                                          "},{"location":"man7/openssl-core_dispatch.h/#synopsis","title":"SYNOPSIS","text":"
                                                                                                          #include <openssl/core_dispatch.h>\n
                                                                                                          "},{"location":"man7/openssl-core_dispatch.h/#description","title":"DESCRIPTION","text":"

                                                                                                          The <openssl/core_dispatch.h> header defines all the operation numbers, dispatch numbers and provider interface function types currently available.

                                                                                                          The operation and dispatch numbers are represented with macros, which are named as follows:

                                                                                                          • operation numbers

                                                                                                            These macros have the form OSSL_OP__opname_.

                                                                                                          • dipatch numbers

                                                                                                            These macros have the form OSSL_FUNC__opname___funcname_, where _opname_ is the same as in the macro for the operation this function belongs to.

                                                                                                          With every dispatch number, there is an associated function type.

                                                                                                          For further information, please see the provider(7)

                                                                                                          "},{"location":"man7/openssl-core_dispatch.h/#see-also","title":"SEE ALSO","text":"

                                                                                                          provider(7)

                                                                                                          "},{"location":"man7/openssl-core_dispatch.h/#history","title":"HISTORY","text":"

                                                                                                          The types and macros described here were added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/openssl-core_dispatch.h/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/openssl-core_names.h/","title":"openssl-core_names.h","text":""},{"location":"man7/openssl-core_names.h/#name","title":"NAME","text":"

                                                                                                          openssl/core_names.h - OpenSSL provider parameter names

                                                                                                          "},{"location":"man7/openssl-core_names.h/#synopsis","title":"SYNOPSIS","text":"
                                                                                                          #include <openssl/core_names.h>\n
                                                                                                          "},{"location":"man7/openssl-core_names.h/#description","title":"DESCRIPTION","text":"

                                                                                                          The <openssl/core_names.h> header defines a multitude of macros for OSSL_PARAM(3) names, algorithm names and other known names used with OpenSSL's providers, made available for practical purposes only.

                                                                                                          Existing names are further described in the manuals for OpenSSL's providers (see \"SEE ALSO\") and the manuals for each algorithm they provide (listed in those provider manuals).

                                                                                                          "},{"location":"man7/openssl-core_names.h/#see-also","title":"SEE ALSO","text":"

                                                                                                          OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-legacy(7)

                                                                                                          "},{"location":"man7/openssl-core_names.h/#history","title":"HISTORY","text":"

                                                                                                          The macros described here were added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/openssl-core_names.h/#caveats","title":"CAVEATS","text":"

                                                                                                          This header file does not constitute a general registry of names. Providers that implement new algorithms are to be responsible for their own parameter names.

                                                                                                          However, authors of provider that implement their own variants of algorithms that OpenSSL providers support will want to pay attention to the names provided in this header to work in a compatible manner.

                                                                                                          "},{"location":"man7/openssl-core_names.h/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/openssl-env/","title":"openssl-env","text":""},{"location":"man7/openssl-env/#name","title":"NAME","text":"

                                                                                                          openssl-env - OpenSSL environment variables

                                                                                                          "},{"location":"man7/openssl-env/#description","title":"DESCRIPTION","text":"

                                                                                                          The OpenSSL libraries use environment variables to override the compiled-in default paths for various data. To avoid security risks, the environment is usually not consulted when the executable is set-user-ID or set-group-ID.

                                                                                                          • CTLOG_FILE

                                                                                                            Specifies the path to a certificate transparency log list. See CTLOG_STORE_new(3).

                                                                                                          • OPENSSL

                                                                                                            Specifies the path to the openssl executable. Used by the rehash script (see \"Script Configuration\" in openssl-rehash(1)) and by the CA.pl script (see \"NOTES\" in CA.pl(1)

                                                                                                          • OPENSSL_CONF, OPENSSL_CONF_INCLUDE

                                                                                                            Specifies the path to a configuration file and the directory for included files. See config(5).

                                                                                                          • OPENSSL_CONFIG

                                                                                                            Specifies a configuration option and filename for the req and ca commands invoked by the CA.pl script. See CA.pl(1).

                                                                                                          • OPENSSL_ENGINES

                                                                                                            Specifies the directory from which dynamic engines are loaded. See openssl-engine(1).

                                                                                                          • OPENSSL_MALLOC_FD, OPENSSL_MALLOC_FAILURES

                                                                                                            If built with debugging, this allows memory allocation to fail. See OPENSSL_malloc(3).

                                                                                                          • OPENSSL_MODULES

                                                                                                            Specifies the directory from which cryptographic providers are loaded. Equivalently, the generic -provider-path command-line option may be used.

                                                                                                          • OPENSSL_WIN32_UTF8

                                                                                                            If set, then UI_OpenSSL(3) returns UTF-8 encoded strings, rather than ones encoded in the current code page, and the openssl(1) program also transcodes the command-line parameters from the current code page to UTF-8. This environment variable is only checked on Microsoft Windows platforms.

                                                                                                          • RANDFILE

                                                                                                            The state file for the random number generator. This should not be needed in normal use. See RAND_load_file(3).

                                                                                                          • SSL_CERT_DIR, SSL_CERT_FILE

                                                                                                            Specify the default directory or file containing CA certificates. See SSL_CTX_load_verify_locations(3).

                                                                                                          • TSGET

                                                                                                            Additional arguments for the tsget(1) command.

                                                                                                          • OPENSSL_ia32cap, OPENSSL_sparcv9cap, OPENSSL_ppccap, OPENSSL_armcap, OPENSSL_s390xcap, OPENSSL_riscvcap

                                                                                                            OpenSSL supports a number of different algorithm implementations for various machines and, by default, it determines which to use based on the processor capabilities and run time feature enquiry. These environment variables can be used to exert more control over this selection process. See OPENSSL_ia32cap(3), OPENSSL_s390xcap(3).

                                                                                                          • NO_PROXY, HTTPS_PROXY, HTTP_PROXY

                                                                                                            Specify a proxy hostname. See OSSL_HTTP_parse_url(3).

                                                                                                          "},{"location":"man7/openssl-env/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/openssl-glossary/","title":"openssl-glossary","text":""},{"location":"man7/openssl-glossary/#name","title":"NAME","text":"

                                                                                                          openssl-glossary - An OpenSSL Glossary

                                                                                                          "},{"location":"man7/openssl-glossary/#description","title":"DESCRIPTION","text":"
                                                                                                          • Algorithm

                                                                                                            Cryptographic primitives such as the SHA256 digest, or AES encryption are referred to in OpenSSL as \"algorithms\". There can be more than one implementation for any given algorithm available for use.

                                                                                                            crypto(7)

                                                                                                          • ASN.1, ASN1

                                                                                                            ASN.1 (\"Abstract Syntax Notation One\") is a notation for describing abstract types and values. It is defined in the ITU-T documents X.680 to X.683:

                                                                                                            https://www.itu.int/rec/T-REC-X.680, https://www.itu.int/rec/T-REC-X.681, https://www.itu.int/rec/T-REC-X.682, https://www.itu.int/rec/T-REC-X.683

                                                                                                          • Base Provider

                                                                                                            An OpenSSL Provider that contains encoders and decoders for OpenSSL keys. All the algorithm implementations in the Base Provider are also available in the Default Provider.

                                                                                                            OSSL_PROVIDER-base(7)

                                                                                                          • Decoder

                                                                                                            A decoder is a type of algorithm used for decoding keys and parameters from some external format such as PEM or DER.

                                                                                                            OSSL_DECODER_CTX_new_for_pkey(3)

                                                                                                          • Default Provider

                                                                                                            An OpenSSL Provider that contains the most common OpenSSL algorithm implementations. It is loaded by default if no other provider is available. All the algorithm implementations in the Base Provider are also available in the Default Provider.

                                                                                                            OSSL_PROVIDER-default(7)

                                                                                                          • DER (\"Distinguished Encoding Rules\")

                                                                                                            DER is a binary encoding of data, structured according to an ASN.1 specification. This is a common encoding used for cryptographic objects such as private and public keys, certificates, CRLs, ...

                                                                                                            It is defined in ITU-T document X.690:

                                                                                                            https://www.itu.int/rec/T-REC-X.690

                                                                                                          • Encoder

                                                                                                            An encoder is a type of algorithm used for encoding keys and parameters to some external format such as PEM or DER.

                                                                                                            OSSL_ENCODER_CTX_new_for_pkey(3)

                                                                                                          • Explicit Fetching

                                                                                                            Explicit Fetching is a type of Fetching (see Fetching). Explicit Fetching is where a function call is made to obtain an algorithm object representing an implementation such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3)

                                                                                                          • Fetching

                                                                                                            Fetching is the process of looking through the available algorithm implementations, applying selection criteria (via a property query string), and finally choosing the implementation that will be used.

                                                                                                            Also see Explicit Fetching and Implicit Fetching.

                                                                                                            crypto(7)

                                                                                                          • FIPS Provider

                                                                                                            An OpenSSL Provider that contains OpenSSL algorithm implementations that have been validated according to the FIPS 140-2 standard.

                                                                                                            OSSL_PROVIDER-FIPS(7)

                                                                                                          • Implicit Fetching

                                                                                                            Implicit Fetching is a type of Fetching (see Fetching). Implicit Fetching is where an algorithm object with no associated implementation is used such as the return value from EVP_sha256(3) or EVP_aes_128_cbc(3). With implicit fetching an implementation is fetched automatically using default selection criteria the first time the algorithm is used.

                                                                                                          • Legacy Provider

                                                                                                            An OpenSSL Provider that contains algorithm implementations that are considered insecure or are no longer in common use.

                                                                                                            OSSL_PROVIDER-legacy(7)

                                                                                                          • Library Context

                                                                                                            A Library Context in OpenSSL is represented by the type OSSL_LIB_CTX. It can be thought of as a scope within which configuration options apply. If an application does not explicitly create a library context then the \"default\" one is used. Many OpenSSL functions can take a library context as an argument. A NULL value can always be passed to indicate the default library context.

                                                                                                            OSSL_LIB_CTX(3)

                                                                                                          • MSBLOB

                                                                                                            MSBLOB is a Microsoft specific binary format for RSA and DSA keys, both private and public. This form is never passphrase protected.

                                                                                                          • Null Provider

                                                                                                            An OpenSSL Provider that contains no algorithm implementations. This can be useful to prevent the default provider from being automatically loaded in a library context.

                                                                                                            OSSL_PROVIDER-null(7)

                                                                                                          • Operation

                                                                                                            An operation is a group of OpenSSL functions with a common purpose such as encryption, or digesting.

                                                                                                            crypto(7)

                                                                                                          • PEM (\"Privacy Enhanced Message\")

                                                                                                            PEM is a format used for encoding of binary content into a mail and ASCII friendly form. The content is a series of base64-encoded lines, surrounded by begin/end markers each on their own line. For example:

                                                                                                            -----BEGIN PRIVATE KEY-----\nMIICdg....\n... bhTQ==\n-----END PRIVATE KEY-----\n

                                                                                                            Optional header line(s) may appear after the begin line, and their existence depends on the type of object being written or read.

                                                                                                            For all OpenSSL uses, the binary content is expected to be a DER encoded structure.

                                                                                                            This is defined in IETF RFC 1421:

                                                                                                            https://tools.ietf.org/html/rfc1421

                                                                                                          • PKCS#8

                                                                                                            PKCS#8 is a specification of ASN.1 structures that OpenSSL uses for storing or transmitting any private key in a key type agnostic manner. There are two structures worth noting for OpenSSL use, one that contains the key data in unencrypted form (known as \"PrivateKeyInfo\") and an encrypted wrapper structure (known as \"EncryptedPrivateKeyInfo\").

                                                                                                            This is specified in RFC 5208:

                                                                                                            https://tools.ietf.org/html/rfc5208

                                                                                                          • Property

                                                                                                            A property is a way of classifying and selecting algorithm implementations. A property is a key/value pair expressed as a string. For example all algorithm implementations in the default provider have the property \"provider=default\". An algorithm implementation can have multiple properties defined against it.

                                                                                                            Also see Property Query String.

                                                                                                            property(7)

                                                                                                          • Property Query String

                                                                                                            A property query string is a string containing a sequence of properties that can be used to select an algorithm implementation. For example the query string \"provider=example,foo=bar\" will select algorithms from the \"example\" provider that have a \"foo\" property defined for them with a value of \"bar\".

                                                                                                            Property Query Strings are used during fetching. See Fetching.

                                                                                                            property(7)

                                                                                                          • Provider

                                                                                                            A provider in OpenSSL is a component that groups together algorithm implementations. Providers can come from OpenSSL itself or from third parties.

                                                                                                            provider(7)

                                                                                                          • PVK

                                                                                                            PVK is a Microsoft specific binary format for RSA and DSA private keys. This form may be passphrase protected.

                                                                                                          • SubjectPublicKeyInfo

                                                                                                            SubjectPublicKeyInfo is an ASN.1 structure that OpenSSL uses for storing and transmitting any public key in a key type agnostic manner.

                                                                                                            This is specified as part of the specification for certificates, RFC 5280:

                                                                                                            https://tools.ietf.org/html/rfc5280

                                                                                                          "},{"location":"man7/openssl-glossary/#history","title":"HISTORY","text":"

                                                                                                          This glossary was added in OpenSSL 3.0.

                                                                                                          "},{"location":"man7/openssl-glossary/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/openssl-threads/","title":"openssl-threads","text":""},{"location":"man7/openssl-threads/#name","title":"NAME","text":"

                                                                                                          openssl-threads - Overview of thread safety in OpenSSL

                                                                                                          "},{"location":"man7/openssl-threads/#description","title":"DESCRIPTION","text":"

                                                                                                          In this man page, we use the term thread-safe to indicate that an object or function can be used by multiple threads at the same time.

                                                                                                          OpenSSL can be built with or without threads support. The most important use of this support is so that OpenSSL itself can use a single consistent API, as shown in \"EXAMPLES\" in CRYPTO_THREAD_run_once(3). Multi-platform applications can also use this API.

                                                                                                          In particular, being configured for threads support does not imply that all OpenSSL objects are thread-safe. To emphasize: most objects are not safe for simultaneous use. Exceptions to this should be documented on the specific manual pages, and some general high-level guidance is given here.

                                                                                                          One major use of the OpenSSL thread API is to implement reference counting. Many objects within OpenSSL are reference-counted, so resources are not released, until the last reference is removed. References are often increased automatically (such as when an X509 certificate object is added into an X509_STORE trust store). There is often an object_up_ref() function that can be used to increase the reference count. Failure to match object_up_ref() calls with the right number of object_free() calls is a common source of memory leaks when a program exits.

                                                                                                          Many objects have set and get API's to set attributes in the object. A set0 passes ownership from the caller to the object and a get0 returns a pointer but the attribute ownership remains with the object and a reference to it is returned. A set1 or get1 function does not change the ownership, but instead updates the attribute's reference count so that the object is shared between the caller and the object; the caller must free the returned attribute when finished. Functions that involve attributes that have reference counts themselves, but are named with just set or get are historical; and the documentation must state how the references are handled. Get methods are often thread-safe as long as the ownership requirements are met and shared objects are not modified. Set methods, or modifying shared objects, are generally not thread-safe as discussed below.

                                                                                                          Objects are thread-safe as long as the API's being invoked don't modify the object; in this case the parameter is usually marked in the API as const. Not all parameters are marked this way. Note that a const declaration does not mean immutable; for example X509_cmp(3) takes pointers to const objects, but the implementation uses a C cast to remove that so it can lock objects, generate and cache a DER encoding, and so on.

                                                                                                          Another instance of thread-safety is when updates to an object's internal state, such as cached values, are done with locks. One example of this is the reference counting API's described above.

                                                                                                          In all cases, however, it is generally not safe for one thread to mutate an object, such as setting elements of a private or public key, while another thread is using that object, such as verifying a signature.

                                                                                                          The same API's can usually be used simultaneously on different objects without interference. For example, two threads can calculate a signature using two different EVP_PKEY_CTX objects.

                                                                                                          For implicit global state or singletons, thread-safety depends on the facility. The CRYPTO_secure_malloc(3) and related API's have their own lock, while CRYPTO_malloc(3) assumes the underlying platform allocation will do any necessary locking. Some API's, such as NCONF_load(3) and related do no locking at all; this can be considered a bug.

                                                                                                          A separate, although related, issue is modifying \"factory\" objects when other objects have been created from that. For example, an SSL_CTX object created by SSL_CTX_new(3) is used to create per-connection SSL objects by calling SSL_new(3). In this specific case, and probably for factory methods in general, it is not safe to modify the factory object after it has been used to create other objects.

                                                                                                          "},{"location":"man7/openssl-threads/#see-also","title":"SEE ALSO","text":"

                                                                                                          CRYPTO_THREAD_run_once(3), local system threads documentation.

                                                                                                          "},{"location":"man7/openssl-threads/#bugs","title":"BUGS","text":"

                                                                                                          This page is admittedly very incomplete.

                                                                                                          "},{"location":"man7/openssl-threads/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/openssl_user_macros/","title":"openssl_user_macros","text":""},{"location":"man7/openssl_user_macros/#name","title":"NAME","text":"

                                                                                                          openssl_user_macros, OPENSSL_API_COMPAT, OPENSSL_NO_DEPRECATED - User defined macros

                                                                                                          "},{"location":"man7/openssl_user_macros/#description","title":"DESCRIPTION","text":"

                                                                                                          User defined macros allow the programmer to control certain aspects of what is exposed by the OpenSSL headers.

                                                                                                          NOTE: to be effective, a user defined macro must be defined before including any header file that depends on it, either in the compilation command (cc -DMACRO=value) or by defining the macro in source before including any headers.

                                                                                                          Other manual pages may refer to this page when declarations depend on user defined macros.

                                                                                                          "},{"location":"man7/openssl_user_macros/#the-macros","title":"The macros","text":"
                                                                                                          • OPENSSL_API_COMPAT

                                                                                                            The value is a version number, given in one of the following two forms:

                                                                                                            • 0xMNNFF000L

                                                                                                              This is the form supported for all versions up to 1.1.x, where M represents the major number, NN represents the minor number, and FF represents the fix number, as a hexadecimal number. For version 1.1.0, that's 0x10100000L.

                                                                                                              Any version number may be given, but these numbers are the current known major deprecation points, making them the most meaningful:

                                                                                                              • 0x00908000L (version 0.9.8)
                                                                                                              • 0x10000000L (version 1.0.0)
                                                                                                              • 0x10100000L (version 1.1.0)

                                                                                                              For convenience, higher numbers are accepted as well, as long as feasible. For example, 0x60000000L will work as expected. However, it is recommended to start using the second form instead:

                                                                                                            • mmnnpp

                                                                                                              This form is a simple decimal number calculated with this formula:

                                                                                                              major * 10000 + minor * 100 + patch

                                                                                                              where major, minor and patch are the desired major, minor and patch components of the version number. For example:

                                                                                                              • 30000 corresponds to version 3.0.0
                                                                                                              • 10002 corresponds to version 1.0.2
                                                                                                              • 420101 corresponds to version 42.1.1

                                                                                                            If OPENSSL_API_COMPAT is undefined, this default value is used in its place: 30100

                                                                                                          • OPENSSL_NO_DEPRECATED

                                                                                                            If this macro is defined, all deprecated public symbols in all OpenSSL versions up to and including the version given by OPENSSL_API_COMPAT (or the default value given above, when OPENSSL_API_COMPAT isn't defined) will be hidden.

                                                                                                          "},{"location":"man7/openssl_user_macros/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/ossl_store-file/","title":"ossl_store-file","text":""},{"location":"man7/ossl_store-file/#name","title":"NAME","text":"

                                                                                                          ossl_store-file - The store 'file' scheme loader

                                                                                                          "},{"location":"man7/ossl_store-file/#synopsis","title":"SYNOPSIS","text":"

                                                                                                          #include <openssl/store.h>

                                                                                                          "},{"location":"man7/ossl_store-file/#description","title":"DESCRIPTION","text":"

                                                                                                          Support for the 'file' scheme is built into libcrypto. Since files come in all kinds of formats and content types, the 'file' scheme has its own layer of functionality called \"file handlers\", which are used to try to decode diverse types of file contents.

                                                                                                          In case a file is formatted as PEM, each called file handler receives the PEM name (everything following any '-----BEGIN') as well as possible PEM headers, together with the decoded PEM body. Since PEM formatted files can contain more than one object, the file handlers are called upon for each such object.

                                                                                                          If the file isn't determined to be formatted as PEM, the content is loaded in raw form in its entirety and passed to the available file handlers as is, with no PEM name or headers.

                                                                                                          Each file handler is expected to handle PEM and non-PEM content as appropriate. Some may refuse non-PEM content for the sake of determinism (for example, there are keys out in the wild that are represented as an ASN.1 OCTET STRING. In raw form, it's not easily possible to distinguish those from any other data coming as an ASN.1 OCTET STRING, so such keys would naturally be accepted as PEM files only).

                                                                                                          "},{"location":"man7/ossl_store-file/#notes","title":"NOTES","text":"

                                                                                                          When needed, the 'file' scheme loader will require a pass phrase by using the UI_METHOD that was passed via OSSL_STORE_open(). This pass phrase is expected to be UTF-8 encoded, anything else will give an undefined result. The files made accessible through this loader are expected to be standard compliant with regards to pass phrase encoding. Files that aren't should be re-generated with a correctly encoded pass phrase. See passphrase-encoding(7) for more information.

                                                                                                          "},{"location":"man7/ossl_store-file/#see-also","title":"SEE ALSO","text":"

                                                                                                          ossl_store(7), passphrase-encoding(7)

                                                                                                          "},{"location":"man7/ossl_store-file/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/ossl_store/","title":"ossl_store","text":""},{"location":"man7/ossl_store/#name","title":"NAME","text":"

                                                                                                          ossl_store - Store retrieval functions

                                                                                                          "},{"location":"man7/ossl_store/#synopsis","title":"SYNOPSIS","text":"

                                                                                                          #include <openssl/store.h>

                                                                                                          "},{"location":"man7/ossl_store/#description","title":"DESCRIPTION","text":""},{"location":"man7/ossl_store/#general","title":"General","text":"

                                                                                                          A STORE is a layer of functionality to retrieve a number of supported objects from a repository of any kind, addressable as a filename or as a URI.

                                                                                                          The functionality supports the pattern \"open a channel to the repository\", \"loop and retrieve one object at a time\", and \"finish up by closing the channel\".

                                                                                                          The retrieved objects are returned as a wrapper type OSSL_STORE_INFO, from which an OpenSSL type can be retrieved.

                                                                                                          "},{"location":"man7/ossl_store/#uri-schemes-and-loaders","title":"URI schemes and loaders","text":"

                                                                                                          Support for a URI scheme is called a STORE \"loader\", and can be added dynamically from the calling application or from a loadable engine.

                                                                                                          Support for the 'file' scheme is built into libcrypto. See ossl_store-file(7) for more information.

                                                                                                          "},{"location":"man7/ossl_store/#ui_method-and-pass-phrases","title":"UI_METHOD and pass phrases","text":"

                                                                                                          The OSS_STORE API does nothing to enforce any specific format or encoding on the pass phrase that the UI_METHOD provides. However, the pass phrase is expected to be UTF-8 encoded. The result of any other encoding is undefined.

                                                                                                          "},{"location":"man7/ossl_store/#examples","title":"EXAMPLES","text":""},{"location":"man7/ossl_store/#a-generic-call","title":"A generic call","text":"
                                                                                                          #include <openssl/ui.h> /* for UI_get_default_method */\n#include <openssl/store.h>\n\nOSSL_STORE_CTX *ctx = OSSL_STORE_open(\"file:/foo/bar/data.pem\",\n                       UI_get_default_method(), NULL, NULL, NULL);\n\n/*\n * OSSL_STORE_eof() simulates file semantics for any repository to signal\n * that no more data can be expected\n */\nwhile (!OSSL_STORE_eof(ctx)) {\n    OSSL_STORE_INFO *info = OSSL_STORE_load(ctx);\n\n    /*\n     * Do whatever is necessary with the OSSL_STORE_INFO,\n     * here just one example\n     */\n    switch (OSSL_STORE_INFO_get_type(info)) {\n    case OSSL_STORE_INFO_CERT:\n        /* Print the X.509 certificate text */\n        X509_print_fp(stdout, OSSL_STORE_INFO_get0_CERT(info));\n        /* Print the X.509 certificate PEM output */\n        PEM_write_X509(stdout, OSSL_STORE_INFO_get0_CERT(info));\n        break;\n    }\n    OSSL_STORE_INFO_free(info);\n}\n\nOSSL_STORE_close(ctx);\n
                                                                                                          "},{"location":"man7/ossl_store/#see-also","title":"SEE ALSO","text":"

                                                                                                          OSSL_STORE_INFO(3), OSSL_STORE_LOADER(3), OSSL_STORE_open(3), OSSL_STORE_expect(3), OSSL_STORE_SEARCH(3)

                                                                                                          "},{"location":"man7/ossl_store/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/passphrase-encoding/","title":"passphrase-encoding","text":""},{"location":"man7/passphrase-encoding/#name","title":"NAME","text":"

                                                                                                          passphrase-encoding - How diverse parts of OpenSSL treat pass phrases character encoding

                                                                                                          "},{"location":"man7/passphrase-encoding/#description","title":"DESCRIPTION","text":"

                                                                                                          In a modern world with all sorts of character encodings, the treatment of pass phrases has become increasingly complex. This manual page attempts to give an overview over how this problem is currently addressed in different parts of the OpenSSL library.

                                                                                                          "},{"location":"man7/passphrase-encoding/#the-general-case","title":"The general case","text":"

                                                                                                          The OpenSSL library doesn't treat pass phrases in any special way as a general rule, and trusts the application or user to choose a suitable character set and stick to that throughout the lifetime of affected objects. This means that for an object that was encrypted using a pass phrase encoded in ISO-8859-1, that object needs to be decrypted using a pass phrase encoded in ISO-8859-1. Using the wrong encoding is expected to cause a decryption failure.

                                                                                                          "},{"location":"man7/passphrase-encoding/#pkcs12","title":"PKCS#12","text":"

                                                                                                          PKCS#12 is a bit different regarding pass phrase encoding. The standard stipulates that the pass phrase shall be encoded as an ASN.1 BMPString, which consists of the code points of the basic multilingual plane, encoded in big endian (UCS-2 BE).

                                                                                                          OpenSSL tries to adapt to this requirements in one of the following manners:

                                                                                                          1. Treats the received pass phrase as UTF-8 encoded and tries to re-encode it to UTF-16 (which is the same as UCS-2 for characters U+0000 to U+D7FF and U+E000 to U+FFFF, but becomes an expansion for any other character), or failing that, proceeds with step 2.
                                                                                                          2. Assumes that the pass phrase is encoded in ASCII or ISO-8859-1 and opportunistically prepends each byte with a zero byte to obtain the UCS-2 encoding of the characters, which it stores as a BMPString.

                                                                                                            Note that since there is no check of your locale, this may produce UCS-2 / UTF-16 characters that do not correspond to the original pass phrase characters for other character sets, such as any ISO-8859-X encoding other than ISO-8859-1 (or for Windows, CP 1252 with exception for the extra \"graphical\" characters in the 0x80-0x9F range).

                                                                                                          OpenSSL versions older than 1.1.0 do variant 2 only, and that is the reason why OpenSSL still does this, to be able to read files produced with older versions.

                                                                                                          It should be noted that this approach isn't entirely fault free.

                                                                                                          A pass phrase encoded in ISO-8859-2 could very well have a sequence such as 0xC3 0xAF (which is the two characters \"LATIN CAPITAL LETTER A WITH BREVE\" and \"LATIN CAPITAL LETTER Z WITH DOT ABOVE\" in ISO-8859-2 encoding), but would be misinterpreted as the perfectly valid UTF-8 encoded code point U+00EF (LATIN SMALL LETTER I WITH DIAERESIS) if the pass phrase doesn't contain anything that would be invalid UTF-8. A pass phrase that contains this kind of byte sequence will give a different outcome in OpenSSL 1.1.0 and newer than in OpenSSL older than 1.1.0.

                                                                                                          0x00 0xC3 0x00 0xAF                 #   # OpenSSL older than 1.1.0\n0x00 0xEF                           #   # OpenSSL 1.1.0 and newer\n

                                                                                                          On the same accord, anything encoded in UTF-8 that was given to OpenSSL older than 1.1.0 was misinterpreted as ISO-8859-1 sequences.

                                                                                                          "},{"location":"man7/passphrase-encoding/#ossl_store","title":"OSSL_STORE","text":"

                                                                                                          ossl_store(7) acts as a general interface to access all kinds of objects, potentially protected with a pass phrase, a PIN or something else. This API stipulates that pass phrases should be UTF-8 encoded, and that any other pass phrase encoding may give undefined results. This API relies on the application to ensure UTF-8 encoding, and doesn't check that this is the case, so what it gets, it will also pass to the underlying loader.

                                                                                                          "},{"location":"man7/passphrase-encoding/#recommendations","title":"RECOMMENDATIONS","text":"

                                                                                                          This section assumes that you know what pass phrase was used for encryption, but that it may have been encoded in a different character encoding than the one used by your current input method. For example, the pass phrase may have been used at a time when your default encoding was ISO-8859-1 (i.e. \"na\u00efve\" resulting in the byte sequence 0x6E 0x61 0xEF 0x76 0x65), and you're now in an environment where your default encoding is UTF-8 (i.e. \"na\u00efve\" resulting in the byte sequence 0x6E 0x61 0xC3 0xAF 0x76 0x65). Whenever it's mentioned that you should use a certain character encoding, it should be understood that you either change the input method to use the mentioned encoding when you type in your pass phrase, or use some suitable tool to convert your pass phrase from your default encoding to the target encoding.

                                                                                                          Also note that the sub-sections below discuss human readable pass phrases. This is particularly relevant for PKCS#12 objects, where human readable pass phrases are assumed. For other objects, it's as legitimate to use any byte sequence (such as a sequence of bytes from /dev/urandom that's been saved away), which makes any character encoding discussion irrelevant; in such cases, simply use the same byte sequence as it is.

                                                                                                          "},{"location":"man7/passphrase-encoding/#creating-new-objects","title":"Creating new objects","text":"

                                                                                                          For creating new pass phrase protected objects, make sure the pass phrase is encoded using UTF-8. This is default on most modern Unixes, but may involve an effort on other platforms. Specifically for Windows, setting the environment variable OPENSSL_WIN32_UTF8 will have anything entered on [Windows] console prompt converted to UTF-8 (command line and separately prompted pass phrases alike).

                                                                                                          "},{"location":"man7/passphrase-encoding/#opening-existing-objects","title":"Opening existing objects","text":"

                                                                                                          For opening pass phrase protected objects where you know what character encoding was used for the encryption pass phrase, make sure to use the same encoding again.

                                                                                                          For opening pass phrase protected objects where the character encoding that was used is unknown, or where the producing application is unknown, try one of the following:

                                                                                                          1. Try the pass phrase that you have as it is in the character encoding of your environment. It's possible that its byte sequence is exactly right.
                                                                                                          2. Convert the pass phrase to UTF-8 and try with the result. Specifically with PKCS#12, this should open up any object that was created according to the specification.
                                                                                                          3. Do a na\u00efve (i.e. purely mathematical) ISO-8859-1 to UTF-8 conversion and try with the result. This differs from the previous attempt because ISO-8859-1 maps directly to U+0000 to U+00FF, which other non-UTF-8 character sets do not.

                                                                                                            This also takes care of the case when a UTF-8 encoded string was used with OpenSSL older than 1.1.0. (for example, \u00ef, which is 0xC3 0xAF when encoded in UTF-8, would become 0xC3 0x83 0xC2 0xAF when re-encoded in the na\u00efve manner. The conversion to BMPString would then yield 0x00 0xC3 0x00 0xA4 0x00 0x00, the erroneous/non-compliant encoding used by OpenSSL older than 1.1.0)

                                                                                                          "},{"location":"man7/passphrase-encoding/#see-also","title":"SEE ALSO","text":"

                                                                                                          evp(7), ossl_store(7), EVP_BytesToKey(3), EVP_DecryptInit(3), PEM_do_header(3), PKCS12_parse(3), PKCS12_newpass(3), d2i_PKCS8PrivateKey_bio(3)

                                                                                                          "},{"location":"man7/passphrase-encoding/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/property/","title":"property","text":""},{"location":"man7/property/#name","title":"NAME","text":"

                                                                                                          property - Properties, a selection mechanism for algorithm implementations

                                                                                                          "},{"location":"man7/property/#description","title":"DESCRIPTION","text":"

                                                                                                          As of OpenSSL 3.0, a new method has been introduced to decide which of multiple implementations of an algorithm will be used. The method is centered around the concept of properties. Each implementation defines a number of properties and when an algorithm is being selected, filters based on these properties can be used to choose the most appropriate implementation of the algorithm.

                                                                                                          Properties are like variables, they are referenced by name and have a value assigned.

                                                                                                          "},{"location":"man7/property/#property-names","title":"Property Names","text":"

                                                                                                          Property names fall into two categories: those reserved by the OpenSSL project and user defined names. A reserved property name consists of a single C-style identifier (except for leading underscores not being permitted), which begins with a letter and can be followed by any number of letters, numbers and underscores. Property names are case-insensitive, but OpenSSL will only use lowercase letters.

                                                                                                          A user defined property name is similar, but it must consist of two or more C-style identifiers, separated by periods. The last identifier in the name can be considered the 'true' property name, which is prefixed by some sort of 'namespace'. Providers for example could include their name in the prefix and use property names like

                                                                                                          <provider_name>.<property_name>\n<provider_name>.<algorithm_name>.<property_name>\n
                                                                                                          "},{"location":"man7/property/#properties","title":"Properties","text":"

                                                                                                          A property is a name=value pair. A property definition is a sequence of comma separated properties. There can be any number of properties in a definition, however each name must be unique. For example: \"\" defines an empty property definition (i.e., no restriction); \"my.foo=bar\" defines a property named my.foo which has a string value bar and \"iteration.count=3\" defines a property named iteration.count which has a numeric value of 3. The full syntax for property definitions appears below.

                                                                                                          "},{"location":"man7/property/#implementations","title":"Implementations","text":"

                                                                                                          Each implementation of an algorithm can define any number of properties. For example, the default provider defines the property provider=default for all of its algorithms. Likewise, OpenSSL's FIPS provider defines provider=fips and the legacy provider defines provider=legacy for all of their algorithms.

                                                                                                          "},{"location":"man7/property/#queries","title":"Queries","text":"

                                                                                                          A property query clause is a single conditional test. For example, \"fips=yes\", \"provider!=default\" or \"?iteration.count=3\". The first two represent mandatory clauses, such clauses must match for any algorithm to even be under consideration. The third clause represents an optional clause. Matching such clauses is not a requirement, but any additional optional match counts in favor of the algorithm. More details about that in the Lookups section. A property query is a sequence of comma separated property query clauses. It is an error if a property name appears in more than one query clause. The full syntax for property queries appears below, but the available syntactic features are:

                                                                                                          • = is an infix operator providing an equality test.
                                                                                                          • != is an infix operator providing an inequality test.
                                                                                                          • ? is a prefix operator that means that the following clause is optional but preferred.
                                                                                                          • - is a prefix operator that means any global query clause involving the following property name should be ignored.
                                                                                                          • \"...\" is a quoted string. The quotes are not included in the body of the string.
                                                                                                          • '...' is a quoted string. The quotes are not included in the body of the string.
                                                                                                          "},{"location":"man7/property/#lookups","title":"Lookups","text":"

                                                                                                          When an algorithm is looked up, a property query is used to determine the best matching algorithm. All mandatory query clauses must be present and the implementation that additionally has the largest number of matching optional query clauses will be used. If there is more than one such optimal candidate, the result will be chosen from amongst those in an indeterminate way. Ordering of optional clauses is not significant.

                                                                                                          "},{"location":"man7/property/#shortcut","title":"Shortcut","text":"

                                                                                                          In order to permit a more concise expression of boolean properties, there is one short cut: a property name alone (e.g. \"my.property\") is exactly equivalent to \"my.property=yes\" in both definitions and queries.

                                                                                                          "},{"location":"man7/property/#global-and-local","title":"Global and Local","text":"

                                                                                                          Two levels of property query are supported. A context based property query that applies to all fetch operations and a local property query. Where both the context and local queries include a clause with the same name, the local clause overrides the context clause.

                                                                                                          It is possible for a local property query to remove a clause in the context property query by preceding the property name with a '-'. For example, a context property query that contains \"fips=yes\" would normally result in implementations that have \"fips=yes\".

                                                                                                          However, if the setting of the \"fips\" property is irrelevant to the operations being performed, the local property query can include the clause \"-fips\". Note that the local property query could not use \"fips=no\" because that would disallow any implementations with \"fips=yes\" rather than not caring about the setting.

                                                                                                          "},{"location":"man7/property/#syntax","title":"SYNTAX","text":"

                                                                                                          The lexical syntax in EBNF is given by:

                                                                                                          Definition     ::= PropertyName ( '=' Value )?\n                       ( ',' PropertyName ( '=' Value )? )*\nQuery          ::= PropertyQuery ( ',' PropertyQuery )*\nPropertyQuery  ::= '-' PropertyName\n                 | '?'? ( PropertyName (( '=' | '!=' ) Value)?)\nValue          ::= NumberLiteral | StringLiteral\nStringLiteral  ::= QuotedString | UnquotedString\nQuotedString   ::= '\"' [^\"]* '\"' | \"'\" [^']* \"'\"\nUnquotedString ::= [A-Za-z] [^{space},]+\nNumberLiteral  ::= '0' ( [0-7]* | 'x' [0-9A-Fa-f]+ ) | '-'? [1-9] [0-9]+\nPropertyName   ::= [A-Za-z] [A-Za-z0-9_]* ( '.' [A-Za-z] [A-Za-z0-9_]* )*\n

                                                                                                          The flavour of EBNF being used is defined by: https://www.w3.org/TR/2010/REC-xquery-20101214/#EBNFNotation.

                                                                                                          "},{"location":"man7/property/#history","title":"HISTORY","text":"

                                                                                                          Properties were added in OpenSSL 3.0

                                                                                                          "},{"location":"man7/property/#copyright","title":"COPYRIGHT","text":"

                                                                                                          Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                          "},{"location":"man7/provider-asym_cipher/","title":"provider-asym_cipher","text":""},{"location":"man7/provider-asym_cipher/#name","title":"NAME","text":"

                                                                                                          provider-asym_cipher - The asym_cipher library <-> provider functions

                                                                                                          "},{"location":"man7/provider-asym_cipher/#synopsis","title":"SYNOPSIS","text":"
                                                                                                          #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_asym_cipher_newctx(void *provctx);\nvoid OSSL_FUNC_asym_cipher_freectx(void *ctx);\nvoid *OSSL_FUNC_asym_cipher_dupctx(void *ctx);\n\n/* Encryption */\nint OSSL_FUNC_asym_cipher_encrypt_init(void *ctx, void *provkey,\n                                       const OSSL_PARAM params[]);\nint OSSL_FUNC_asym_cipher_encrypt(void *ctx, unsigned char *out, size_t *outlen,\n                                  size_t outsize, const unsigned char *in,\n                                  size_t inlen);\n\n/* Decryption */\nint OSSL_FUNC_asym_cipher_decrypt_init(void *ctx, void *provkey,\n                                       const OSSL_PARAM params[]);\nint OSSL_FUNC_asym_cipher_decrypt(void *ctx, unsigned char *out, size_t *outlen,\n                                  size_t outsize, const unsigned char *in,\n                                  size_t inlen);\n\n/* Asymmetric Cipher parameters */\nint OSSL_FUNC_asym_cipher_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_asym_cipher_gettable_ctx_params(void *provctx);\nint OSSL_FUNC_asym_cipher_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_asym_cipher_settable_ctx_params(void *provctx);\n
                                                                                                          "},{"location":"man7/provider-asym_cipher/#description","title":"DESCRIPTION","text":"

                                                                                                          This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                          The asymmetric cipher (OSSL_OP_ASYM_CIPHER) operation enables providers to implement asymmetric cipher algorithms and make them available to applications via the API functions EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3) and other related functions).

                                                                                                          All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                          All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_asym_cipher_newctx() has these:

                                                                                                          typedef void *(OSSL_FUNC_asym_cipher_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_asym_cipher_newctx_fn\n    OSSL_FUNC_asym_cipher_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                          OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                          OSSL_FUNC_asym_cipher_newctx               OSSL_FUNC_ASYM_CIPHER_NEWCTX\nOSSL_FUNC_asym_cipher_freectx              OSSL_FUNC_ASYM_CIPHER_FREECTX\nOSSL_FUNC_asym_cipher_dupctx               OSSL_FUNC_ASYM_CIPHER_DUPCTX\n\nOSSL_FUNC_asym_cipher_encrypt_init         OSSL_FUNC_ASYM_CIPHER_ENCRYPT_INIT\nOSSL_FUNC_asym_cipher_encrypt              OSSL_FUNC_ASYM_CIPHER_ENCRYPT\n\nOSSL_FUNC_asym_cipher_decrypt_init         OSSL_FUNC_ASYM_CIPHER_DECRYPT_INIT\nOSSL_FUNC_asym_cipher_decrypt              OSSL_FUNC_ASYM_CIPHER_DECRYPT\n\nOSSL_FUNC_asym_cipher_get_ctx_params       OSSL_FUNC_ASYM_CIPHER_GET_CTX_PARAMS\nOSSL_FUNC_asym_cipher_gettable_ctx_params  OSSL_FUNC_ASYM_CIPHER_GETTABLE_CTX_PARAMS\nOSSL_FUNC_asym_cipher_set_ctx_params       OSSL_FUNC_ASYM_CIPHER_SET_CTX_PARAMS\nOSSL_FUNC_asym_cipher_settable_ctx_params  OSSL_FUNC_ASYM_CIPHER_SETTABLE_CTX_PARAMS\n

                                                                                                          An asymmetric cipher algorithm implementation may not implement all of these functions. In order to be a consistent set of functions a provider must implement OSSL_FUNC_asym_cipher_newctx and OSSL_FUNC_asym_cipher_freectx. It must also implement both of OSSL_FUNC_asym_cipher_encrypt_init and OSSL_FUNC_asym_cipher_encrypt, or both of OSSL_FUNC_asym_cipher_decrypt_init and OSSL_FUNC_asym_cipher_decrypt. OSSL_FUNC_asym_cipher_get_ctx_params is optional but if it is present then so must OSSL_FUNC_asym_cipher_gettable_ctx_params. Similarly, OSSL_FUNC_asym_cipher_set_ctx_params is optional but if it is present then so must OSSL_FUNC_asym_cipher_settable_ctx_params.

                                                                                                          An asymmetric cipher algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                          "},{"location":"man7/provider-asym_cipher/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                          OSSL_FUNC_asym_cipher_newctx() should create and return a pointer to a provider side structure for holding context information during an asymmetric cipher operation. A pointer to this context will be passed back in a number of the other asymmetric cipher operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                          OSSL_FUNC_asym_cipher_freectx() is passed a pointer to the provider side asymmetric cipher context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                          OSSL_FUNC_asym_cipher_dupctx() should duplicate the provider side asymmetric cipher context in the ctx parameter and return the duplicate copy.

                                                                                                          "},{"location":"man7/provider-asym_cipher/#encryption-functions","title":"Encryption Functions","text":"

                                                                                                          OSSL_FUNC_asym_cipher_encrypt_init() initialises a context for an asymmetric encryption given a provider side asymmetric cipher context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_asym_cipher_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)). OSSL_FUNC_asym_cipher_encrypt() performs the actual encryption itself. A previously initialised asymmetric cipher context is passed in the ctx parameter. The data to be encrypted is pointed to by the in parameter which is inlen bytes long. Unless out is NULL, the encrypted data should be written to the location pointed to by the out parameter and it should not exceed outsize bytes in length. The length of the encrypted data should be written to *outlen. If out is NULL then the maximum length of the encrypted data should be written to *outlen.

                                                                                                          "},{"location":"man7/provider-asym_cipher/#decryption-functions","title":"Decryption Functions","text":"

                                                                                                          OSSL_FUNC_asym_cipher_decrypt_init() initialises a context for an asymmetric decryption given a provider side asymmetric cipher context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_asym_cipher_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)).

                                                                                                          OSSL_FUNC_asym_cipher_decrypt() performs the actual decryption itself. A previously initialised asymmetric cipher context is passed in the ctx parameter. The data to be decrypted is pointed to by the in parameter which is inlen bytes long. Unless out is NULL, the decrypted data should be written to the location pointed to by the out parameter and it should not exceed outsize bytes in length. The length of the decrypted data should be written to *outlen. If out is NULL then the maximum length of the decrypted data should be written to *outlen.

                                                                                                          "},{"location":"man7/provider-asym_cipher/#asymmetric-cipher-parameters","title":"Asymmetric Cipher Parameters","text":"

                                                                                                          See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_asym_cipher_get_ctx_params() and OSSL_FUNC_asym_cipher_set_ctx_params() functions.

                                                                                                          OSSL_FUNC_asym_cipher_get_ctx_params() gets asymmetric cipher parameters associated with the given provider side asymmetric cipher context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                          OSSL_FUNC_asym_cipher_set_ctx_params() sets the asymmetric cipher parameters associated with the given provider side asymmetric cipher context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                          Parameters currently recognised by built-in asymmetric cipher algorithms are as follows. Not all parameters are relevant to, or are understood by all asymmetric cipher algorithms:

                                                                                                          • \"pad-mode\" (OSSL_ASYM_CIPHER_PARAM_PAD_MODE) OR <integer>

                                                                                                            The type of padding to be used. The interpretation of this value will depend on the algorithm in use.

                                                                                                          • \"digest\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST)

                                                                                                            Gets or sets the name of the OAEP digest algorithm used when OAEP padding is in use.

                                                                                                          • \"digest\" (OSSL_ASYM_CIPHER_PARAM_DIGEST)

                                                                                                            Gets or sets the name of the digest algorithm used by the algorithm (where applicable).

                                                                                                          • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS)

                                                                                                            Gets or sets the properties to use when fetching the OAEP digest algorithm.

                                                                                                          • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_DIGEST_PROPS)

                                                                                                            Gets or sets the properties to use when fetching the cipher digest algorithm.

                                                                                                          • \"mgf1-digest\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST)

                                                                                                            Gets or sets the name of the MGF1 digest algorithm used when OAEP or PSS padding is in use.

                                                                                                          • \"mgf1-digest-props\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS)

                                                                                                            Gets or sets the properties to use when fetching the MGF1 digest algorithm.

                                                                                                          • \"oaep-label\" (OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL) <octet string ptr>

                                                                                                            Gets the OAEP label used when OAEP padding is in use.

                                                                                                          • \"oaep-label\" (OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL) <octet string>

                                                                                                            Sets the OAEP label used when OAEP padding is in use.

                                                                                                          • \"tls-client-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                                                                                                            The TLS protocol version first requested by the client.

                                                                                                          • \"tls-negotiated-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                                                                                                            The negotiated TLS protocol version.

                                                                                                          • OSSL_FUNC_asym_cipher_gettable_ctx_params() and OSSL_FUNC_asym_cipher_settable_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters, i.e. parameters that can be used with OSSL_FUNC_asym_cipherget_ctx_params() and OSSL_FUNC_asym_cipher_set_ctx_params() respectively.

                                                                                                            "},{"location":"man7/provider-asym_cipher/#return-values","title":"RETURN VALUES","text":"

                                                                                                            OSSL_FUNC_asym_cipher_newctx() and OSSL_FUNC_asym_cipher_dupctx() should return the newly created provider side asymmetric cipher context, or NULL on failure.

                                                                                                            All other functions should return 1 for success or 0 on error.

                                                                                                            "},{"location":"man7/provider-asym_cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                            provider(7)

                                                                                                            "},{"location":"man7/provider-asym_cipher/#history","title":"HISTORY","text":"

                                                                                                            The provider ASYM_CIPHER interface was introduced in OpenSSL 3.0.

                                                                                                            "},{"location":"man7/provider-asym_cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                            Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                            "},{"location":"man7/provider-base/","title":"provider-base","text":""},{"location":"man7/provider-base/#name","title":"NAME","text":"

                                                                                                            provider-base - The basic OpenSSL library <-> provider functions

                                                                                                            "},{"location":"man7/provider-base/#synopsis","title":"SYNOPSIS","text":"
                                                                                                            #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Functions offered by libcrypto to the providers */\nconst OSSL_ITEM *core_gettable_params(const OSSL_CORE_HANDLE *handle);\nint core_get_params(const OSSL_CORE_HANDLE *handle, OSSL_PARAM params[]);\n\ntypedef void (*OSSL_thread_stop_handler_fn)(void *arg);\nint core_thread_start(const OSSL_CORE_HANDLE *handle,\n                      OSSL_thread_stop_handler_fn handfn,\n                      void *arg);\n\nOPENSSL_CORE_CTX *core_get_libctx(const OSSL_CORE_HANDLE *handle);\nvoid core_new_error(const OSSL_CORE_HANDLE *handle);\nvoid core_set_error_debug(const OSSL_CORE_HANDLE *handle,\n                          const char *file, int line, const char *func);\nvoid core_vset_error(const OSSL_CORE_HANDLE *handle,\n                     uint32_t reason, const char *fmt, va_list args);\n\nint core_obj_add_sigid(const OSSL_CORE_HANDLE *prov, const char  *sign_name,\n                       const char *digest_name, const char *pkey_name);\nint core_obj_create(const OSSL_CORE_HANDLE *handle, const char *oid,\n                    const char *sn, const char *ln);\n\n/*\n * Some OpenSSL functionality is directly offered to providers via\n * dispatch\n */\nvoid *CRYPTO_malloc(size_t num, const char *file, int line);\nvoid *CRYPTO_zalloc(size_t num, const char *file, int line);\nvoid CRYPTO_free(void *ptr, const char *file, int line);\nvoid CRYPTO_clear_free(void *ptr, size_t num,\n                       const char *file, int line);\nvoid *CRYPTO_realloc(void *addr, size_t num,\n                     const char *file, int line);\nvoid *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,\n                           const char *file, int line);\nvoid *CRYPTO_secure_malloc(size_t num, const char *file, int line);\nvoid *CRYPTO_secure_zalloc(size_t num, const char *file, int line);\nvoid CRYPTO_secure_free(void *ptr, const char *file, int line);\nvoid CRYPTO_secure_clear_free(void *ptr, size_t num,\n                              const char *file, int line);\nint CRYPTO_secure_allocated(const void *ptr);\nvoid OPENSSL_cleanse(void *ptr, size_t len);\n\nunsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);\n\nOSSL_CORE_BIO *BIO_new_file(const char *filename, const char *mode);\nOSSL_CORE_BIO *BIO_new_membuf(const void *buf, int len);\nint BIO_read_ex(OSSL_CORE_BIO *bio, void *data, size_t data_len,\n                size_t *bytes_read);\nint BIO_write_ex(OSSL_CORE_BIO *bio, const void *data, size_t data_len,\n                 size_t *written);\nint BIO_up_ref(OSSL_CORE_BIO *bio);\nint BIO_free(OSSL_CORE_BIO *bio);\nint BIO_vprintf(OSSL_CORE_BIO *bio, const char *format, va_list args);\nint BIO_vsnprintf(char *buf, size_t n, const char *fmt, va_list args);\n\nvoid OSSL_SELF_TEST_set_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK *cb,\n                                 void *cbarg);\n\nsize_t get_entropy(const OSSL_CORE_HANDLE *handle,\n                   unsigned char **pout, int entropy,\n                   size_t min_len, size_t max_len);\nsize_t get_user_entropy(const OSSL_CORE_HANDLE *handle,\n                        unsigned char **pout, int entropy,\n                        size_t min_len, size_t max_len);\nvoid cleanup_entropy(const OSSL_CORE_HANDLE *handle,\n                     unsigned char *buf, size_t len);\nvoid cleanup_user_entropy(const OSSL_CORE_HANDLE *handle,\n                          unsigned char *buf, size_t len);\nsize_t get_nonce(const OSSL_CORE_HANDLE *handle,\n                 unsigned char **pout, size_t min_len, size_t max_len,\n                 const void *salt, size_t salt_len);\nsize_t get_user_nonce(const OSSL_CORE_HANDLE *handle,\n                      unsigned char **pout, size_t min_len, size_t max_len,\n                      const void *salt, size_t salt_len);\nvoid cleanup_nonce(const OSSL_CORE_HANDLE *handle,\n                   unsigned char *buf, size_t len);\nvoid cleanup_user_nonce(const OSSL_CORE_HANDLE *handle,\n                        unsigned char *buf, size_t len);\n\n/* Functions for querying the providers in the application library context */\nint provider_register_child_cb(const OSSL_CORE_HANDLE *handle,\n                    int (*create_cb)(const OSSL_CORE_HANDLE *provider,\n                                     void *cbdata),\n                    int (*remove_cb)(const OSSL_CORE_HANDLE *provider,\n                                     void *cbdata),\n                    int (*global_props_cb)(const char *props, void *cbdata),\n                    void *cbdata);\nvoid provider_deregister_child_cb(const OSSL_CORE_HANDLE *handle);\nconst char *provider_name(const OSSL_CORE_HANDLE *prov);\nvoid *provider_get0_provider_ctx(const OSSL_CORE_HANDLE *prov);\nconst OSSL_DISPATCH *provider_get0_dispatch(const OSSL_CORE_HANDLE *prov);\nint provider_up_ref(const OSSL_CORE_HANDLE *prov, int activate);\nint provider_free(const OSSL_CORE_HANDLE *prov, int deactivate);\n\n/* Functions offered by the provider to libcrypto */\nvoid provider_teardown(void *provctx);\nconst OSSL_ITEM *provider_gettable_params(void *provctx);\nint provider_get_params(void *provctx, OSSL_PARAM params[]);\nconst OSSL_ALGORITHM *provider_query_operation(void *provctx,\n                                               int operation_id,\n                                               const int *no_store);\nvoid provider_unquery_operation(void *provctx, int operation_id,\n                                const OSSL_ALGORITHM *algs);\nconst OSSL_ITEM *provider_get_reason_strings(void *provctx);\nint provider_get_capabilities(void *provctx, const char *capability,\n                              OSSL_CALLBACK *cb, void *arg);\nint provider_self_test(void *provctx);\n
                                                                                                            "},{"location":"man7/provider-base/#description","title":"DESCRIPTION","text":"

                                                                                                            All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays, in the call of the provider initialization function. See \"Provider\" in provider(7) for a description of the initialization function. They are known as \"upcalls\".

                                                                                                            All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from a OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" core_gettable_params() has these:

                                                                                                            typedef OSSL_PARAM *\n    (OSSL_FUNC_core_gettable_params_fn)(const OSSL_CORE_HANDLE *handle);\nstatic ossl_inline OSSL_NAME_core_gettable_params_fn\n    OSSL_FUNC_core_gettable_params(const OSSL_DISPATCH *opf);\n

                                                                                                            OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                            For in (the OSSL_DISPATCH(3) array passed from libcrypto to the provider):

                                                                                                            core_gettable_params           OSSL_FUNC_CORE_GETTABLE_PARAMS\ncore_get_params                OSSL_FUNC_CORE_GET_PARAMS\ncore_thread_start              OSSL_FUNC_CORE_THREAD_START\ncore_get_libctx                OSSL_FUNC_CORE_GET_LIBCTX\ncore_new_error                 OSSL_FUNC_CORE_NEW_ERROR\ncore_set_error_debug           OSSL_FUNC_CORE_SET_ERROR_DEBUG\ncore_vset_error                OSSL_FUNC_CORE_VSET_ERROR\ncore_obj_add_sigid             OSSL_FUNC_CORE_OBJ_ADD_SIGID\ncore_obj_create                OSSL_FUNC_CORE_OBJ_CREATE\nCRYPTO_malloc                  OSSL_FUNC_CRYPTO_MALLOC\nCRYPTO_zalloc                  OSSL_FUNC_CRYPTO_ZALLOC\nCRYPTO_free                    OSSL_FUNC_CRYPTO_FREE\nCRYPTO_clear_free              OSSL_FUNC_CRYPTO_CLEAR_FREE\nCRYPTO_realloc                 OSSL_FUNC_CRYPTO_REALLOC\nCRYPTO_clear_realloc           OSSL_FUNC_CRYPTO_CLEAR_REALLOC\nCRYPTO_secure_malloc           OSSL_FUNC_CRYPTO_SECURE_MALLOC\nCRYPTO_secure_zalloc           OSSL_FUNC_CRYPTO_SECURE_ZALLOC\nCRYPTO_secure_free             OSSL_FUNC_CRYPTO_SECURE_FREE\nCRYPTO_secure_clear_free       OSSL_FUNC_CRYPTO_SECURE_CLEAR_FREE\nCRYPTO_secure_allocated        OSSL_FUNC_CRYPTO_SECURE_ALLOCATED\nBIO_new_file                   OSSL_FUNC_BIO_NEW_FILE\nBIO_new_mem_buf                OSSL_FUNC_BIO_NEW_MEMBUF\nBIO_read_ex                    OSSL_FUNC_BIO_READ_EX\nBIO_write_ex                   OSSL_FUNC_BIO_WRITE_EX\nBIO_up_ref                     OSSL_FUNC_BIO_UP_REF\nBIO_free                       OSSL_FUNC_BIO_FREE\nBIO_vprintf                    OSSL_FUNC_BIO_VPRINTF\nBIO_vsnprintf                  OSSL_FUNC_BIO_VSNPRINTF\nBIO_puts                       OSSL_FUNC_BIO_PUTS\nBIO_gets                       OSSL_FUNC_BIO_GETS\nBIO_ctrl                       OSSL_FUNC_BIO_CTRL\nOPENSSL_cleanse                OSSL_FUNC_OPENSSL_CLEANSE\nOSSL_SELF_TEST_set_callback    OSSL_FUNC_SELF_TEST_CB\nossl_rand_get_entropy          OSSL_FUNC_GET_ENTROPY\nossl_rand_get_user_entropy     OSSL_FUNC_GET_USER_ENTROPY\nossl_rand_cleanup_entropy      OSSL_FUNC_CLEANUP_ENTROPY\nossl_rand_cleanup_user_entropy OSSL_FUNC_CLEANUP_USER_ENTROPY\nossl_rand_get_nonce            OSSL_FUNC_GET_NONCE\nossl_rand_get_user_nonce       OSSL_FUNC_GET_USER_NONCE\nossl_rand_cleanup_nonce        OSSL_FUNC_CLEANUP_NONCE\nossl_rand_cleanup_user_nonce   OSSL_FUNC_CLEANUP_USER_NONCE\nprovider_register_child_cb     OSSL_FUNC_PROVIDER_REGISTER_CHILD_CB\nprovider_deregister_child_cb   OSSL_FUNC_PROVIDER_DEREGISTER_CHILD_CB\nprovider_name                  OSSL_FUNC_PROVIDER_NAME\nprovider_get0_provider_ctx     OSSL_FUNC_PROVIDER_GET0_PROVIDER_CTX\nprovider_get0_dispatch         OSSL_FUNC_PROVIDER_GET0_DISPATCH\nprovider_up_ref                OSSL_FUNC_PROVIDER_UP_REF\nprovider_free                  OSSL_FUNC_PROVIDER_FREE\n

                                                                                                            For *out (the OSSL_DISPATCH(3) array passed from the provider to libcrypto):

                                                                                                            provider_teardown              OSSL_FUNC_PROVIDER_TEARDOWN\nprovider_gettable_params       OSSL_FUNC_PROVIDER_GETTABLE_PARAMS\nprovider_get_params            OSSL_FUNC_PROVIDER_GET_PARAMS\nprovider_query_operation       OSSL_FUNC_PROVIDER_QUERY_OPERATION\nprovider_unquery_operation     OSSL_FUNC_PROVIDER_UNQUERY_OPERATION\nprovider_get_reason_strings    OSSL_FUNC_PROVIDER_GET_REASON_STRINGS\nprovider_get_capabilities      OSSL_FUNC_PROVIDER_GET_CAPABILITIES\nprovider_self_test             OSSL_FUNC_PROVIDER_SELF_TEST\n
                                                                                                            "},{"location":"man7/provider-base/#core-functions","title":"Core functions","text":"

                                                                                                            core_gettable_params() returns a constant array of descriptor OSSL_PARAM(3), for parameters that core_get_params() can handle.

                                                                                                            core_get_params() retrieves parameters from the core for the given handle. See \"Core parameters\" below for a description of currently known parameters.

                                                                                                            The core_thread_start() function informs the core that the provider has stated an interest in the current thread. The core will inform the provider when the thread eventually stops. It must be passed the handle for this provider, as well as a callback handfn which will be called when the thread stops. The callback will subsequently be called, with the supplied argument arg, from the thread that is stopping and gets passed the provider context as an argument. This may be useful to perform thread specific clean up such as freeing thread local variables.

                                                                                                            core_get_libctx() retrieves the core context in which the library object for the current provider is stored, accessible through the handle. This function is useful only for built-in providers such as the default provider. Never cast this to OSSL_LIB_CTX in a provider that is not built-in as the OSSL_LIB_CTX of the library loading the provider might be a completely different structure than the OSSL_LIB_CTX of the library the provider is linked to. Use OSSL_LIB_CTX_new_child(3) instead to obtain a proper library context that is linked to the application library context.

                                                                                                            core_new_error(), core_set_error_debug() and core_vset_error() are building blocks for reporting an error back to the core, with reference to the handle.

                                                                                                            • core_new_error()

                                                                                                              allocates a new thread specific error record.

                                                                                                              This corresponds to the OpenSSL function ERR_new(3).

                                                                                                            • core_set_error_debug()

                                                                                                              sets debugging information in the current thread specific error record. The debugging information includes the name of the file file, the line line and the function name func where the error occurred.

                                                                                                              This corresponds to the OpenSSL function ERR_set_debug(3).

                                                                                                            • core_vset_error()

                                                                                                              sets the reason for the error, along with any addition data. The reason is a number defined by the provider and used to index the reason strings table that's returned by provider_get_reason_strings(). The additional data is given as a format string fmt and a set of arguments args, which are treated in the same manner as with BIO_vsnprintf(). file and line may also be passed to indicate exactly where the error occurred or was reported.

                                                                                                              This corresponds to the OpenSSL function ERR_vset_error(3).

                                                                                                            The core_obj_create() function registers a new OID and associated short name sn and long name ln for the given handle. It is similar to the OpenSSL function OBJ_create(3) except that it returns 1 on success or 0 on failure. It will treat as success the case where the OID already exists (even if the short name sn or long name ln provided as arguments differ from those associated with the existing OID, in which case the new names are not associated).

                                                                                                            The core_obj_add_sigid() function registers a new composite signature algorithm (sign_name) consisting of an underlying signature algorithm (pkey_name) and digest algorithm (digest_name) for the given handle. It assumes that the OIDs for the composite signature algorithm as well as for the underlying signature and digest algorithms are either already known to OpenSSL or have been registered via a call to core_obj_create(). It corresponds to the OpenSSL function OBJ_add_sigid(3), except that the objects are identified by name rather than a numeric NID. Any name (OID, short name or long name) can be used to identify the object. It will treat as success the case where the composite signature algorithm already exists (even if registered against a different underlying signature or digest algorithm). For digest_name, NULL or an empty string is permissible for signature algorithms that do not need a digest to operate correctly. The function returns 1 on success or 0 on failure.

                                                                                                            CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_free(), CRYPTO_clear_free(), CRYPTO_realloc(), CRYPTO_clear_realloc(), CRYPTO_secure_malloc(), CRYPTO_secure_zalloc(), CRYPTO_secure_free(), CRYPTO_secure_clear_free(), CRYPTO_secure_allocated(), BIO_new_file(), BIO_new_mem_buf(), BIO_read_ex(), BIO_write_ex(), BIO_up_ref(), BIO_free(), BIO_vprintf(), BIO_vsnprintf(), BIO_gets(), BIO_puts(), BIO_ctrl(), OPENSSL_cleanse() and OPENSSL_hexstr2buf() correspond exactly to the public functions with the same name. As a matter of fact, the pointers in the OSSL_DISPATCH(3) array are typically direct pointers to those public functions. Note that the BIO functions take an OSSL_CORE_BIO type rather than the standard BIO type. This is to ensure that a provider does not mix BIOs from the core with BIOs used on the provider side (the two are not compatible). OSSL_SELF_TEST_set_callback() is used to set an optional callback that can be passed into a provider. This may be ignored by a provider.

                                                                                                            get_entropy() retrieves seeding material from the operating system. The seeding material will have at least entropy bytes of randomness and the output will have at least min_len and at most max_len bytes. The buffer address is stored in *pout and the buffer length is returned to the caller. On error, zero is returned.

                                                                                                            get_user_entropy() is the same as get_entropy() except that it will attempt to gather seed material via the seed source specified by a call to RAND_set_seed_source_type(3) or via \"Random Configuration\" in config(5).

                                                                                                            cleanup_entropy() is used to clean up and free the buffer returned by get_entropy(). The entropy pointer returned by get_entropy() is passed in buf and its length in len.

                                                                                                            cleanup_user_entropy() is used to clean up and free the buffer returned by get_user_entropy(). The entropy pointer returned by get_user_entropy() is passed in buf and its length in len.

                                                                                                            get_nonce() retrieves a nonce using the passed salt parameter of length salt_len and operating system specific information. The salt should contain uniquely identifying information and this is included, in an unspecified manner, as part of the output. The output is stored in a buffer which contains at least min_len and at most max_len bytes. The buffer address is stored in *pout and the buffer length returned to the caller. On error, zero is returned.

                                                                                                            get_user_nonce() is the same as get_nonce() except that it will attempt to gather seed material via the seed source specified by a call to RAND_set_seed_source_type(3) or via \"Random Configuration\" in config(5).

                                                                                                            cleanup_nonce() is used to clean up and free the buffer returned by get_nonce(). The nonce pointer returned by get_nonce() is passed in buf and its length in len.

                                                                                                            cleanup_user_nonce() is used to clean up and free the buffer returned by get_user_nonce(). The nonce pointer returned by get_user_nonce() is passed in buf and its length in len.

                                                                                                            provider_register_child_cb() registers callbacks for being informed about the loading and unloading of providers in the application's library context. handle is this provider's handle and cbdata is this provider's data that will be passed back to the callbacks. It returns 1 on success or 0 otherwise. These callbacks may be called while holding locks in libcrypto. In order to avoid deadlocks the callback implementation must not be long running and must not call other OpenSSL API functions or upcalls.

                                                                                                            create_cb is a callback that will be called when a new provider is loaded into the application's library context. It is also called for any providers that are already loaded at the point that this callback is registered. The callback is passed the handle being used for the new provider being loadded and this provider's data in cbdata. It should return 1 on success or 0 on failure.

                                                                                                            remove_cb is a callback that will be called when a new provider is unloaded from the application's library context. It is passed the handle being used for the provider being unloaded and this provider's data in cbdata. It should return 1 on success or 0 on failure.

                                                                                                            global_props_cb is a callback that will be called when the global properties from the parent library context are changed. It should return 1 on success or 0 on failure.

                                                                                                            provider_deregister_child_cb() unregisters callbacks previously registered via provider_register_child_cb(). If provider_register_child_cb() has been called then provider_deregister_child_cb() should be called at or before the point that this provider's teardown function is called.

                                                                                                            provider_name() returns a string giving the name of the provider identified by handle.

                                                                                                            provider_get0_provider_ctx() returns the provider context that is associated with the provider identified by prov.

                                                                                                            provider_get0_dispatch() gets the dispatch table registered by the provider identified by prov when it initialised.

                                                                                                            provider_up_ref() increments the reference count on the provider prov. If activate is nonzero then the provider is also loaded if it is not already loaded. It returns 1 on success or 0 on failure.

                                                                                                            provider_free() decrements the reference count on the provider prov. If deactivate is nonzero then the provider is also unloaded if it is not already loaded. It returns 1 on success or 0 on failure.

                                                                                                            "},{"location":"man7/provider-base/#provider-functions","title":"Provider functions","text":"

                                                                                                            provider_teardown() is called when a provider is shut down and removed from the core's provider store. It must free the passed provctx.

                                                                                                            provider_gettable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that provider_get_params() can handle.

                                                                                                            provider_get_params() should process the OSSL_PARAM(3) array params, setting the values of the parameters it understands.

                                                                                                            provider_query_operation() should return a constant OSSL_ALGORITHM(3) that corresponds to the given operation_id. It should indicate if the core may store a reference to this array by setting *no_store to 0 (core may store a reference) or 1 (core may not store a reference).

                                                                                                            provider_unquery_operation() informs the provider that the result of a provider_query_operation() is no longer directly required and that the function pointers have been copied. The operation_id should match that passed to provider_query_operation() and algs should be its return value.

                                                                                                            provider_get_reason_strings() should return a constant OSSL_ITEM(3) array that provides reason strings for reason codes the provider may use when reporting errors using core_put_error().

                                                                                                            The provider_get_capabilities() function should call the callback cb passing it a set of OSSL_PARAM(3)s and the caller supplied argument arg. The OSSL_PARAM(3)s should provide details about the capability with the name given in the capability argument relevant for the provider context provctx. If a provider supports multiple capabilities with the given name then it may call the callback multiple times (one for each capability). Capabilities can be useful for describing the services that a provider can offer. For further details see the \"CAPABILITIES\" section below. It should return 1 on success or 0 on error.

                                                                                                            The provider_self_test() function should perform known answer tests on a subset of the algorithms that it uses, and may also verify the integrity of the provider module. It should return 1 on success or 0 on error. It will return 1 if this function is not used.

                                                                                                            None of these functions are mandatory, but a provider is fairly useless without at least provider_query_operation(), and provider_gettable_params() is fairly useless if not accompanied by provider_get_params().

                                                                                                            "},{"location":"man7/provider-base/#provider-parameters","title":"Provider parameters","text":"

                                                                                                            provider_get_params() can return the following provider parameters to the core:

                                                                                                            • \"name\" (OSSL_PROV_PARAM_NAME)

                                                                                                              This points to a string that should give a unique name for the provider.

                                                                                                            • \"version\" (OSSL_PROV_PARAM_VERSION)

                                                                                                              This points to a string that is a version number associated with this provider. OpenSSL in-built providers use OPENSSL_VERSION_STR, but this may be different for any third party provider. This string is for informational purposes only.

                                                                                                            • \"buildinfo\" (OSSL_PROV_PARAM_BUILDINFO)

                                                                                                              This points to a string that is a build information associated with this provider. OpenSSL in-built providers use OPENSSL_FULL_VERSION_STR, but this may be different for any third party provider.

                                                                                                            • \"status\" (OSSL_PROV_PARAM_STATUS) <unsigned integer>

                                                                                                              This returns 0 if the provider has entered an error state, otherwise it returns 1.

                                                                                                            • provider_gettable_params() should return the above parameters.

                                                                                                              "},{"location":"man7/provider-base/#core-parameters","title":"Core parameters","text":"

                                                                                                              core_get_params() can retrieve the following core parameters for each provider:

                                                                                                              • \"openssl-version\" (OSSL_PROV_PARAM_CORE_VERSION)

                                                                                                                This points to the OpenSSL libraries' full version string, i.e. the string expanded from the macro OPENSSL_VERSION_STR.

                                                                                                              • \"provider-name\" (OSSL_PROV_PARAM_CORE_PROV_NAME)

                                                                                                                This points to the OpenSSL libraries' idea of what the calling provider is named.

                                                                                                              • \"module-filename\" (OSSL_PROV_PARAM_CORE_MODULE_FILENAME)

                                                                                                                This points to a string containing the full filename of the providers module file.

                                                                                                                Additionally, provider specific configuration parameters from the config file are available, in dotted name form. The dotted name form is a concatenation of section names and final config command name separated by periods.

                                                                                                                For example, let's say we have the following config example:

                                                                                                                config_diagnostics = 1\nopenssl_conf = openssl_init\n\n[openssl_init]\nproviders = providers_sect\n\n[providers_sect]\nfoo = foo_sect\n\n[foo_sect]\nactivate = 1\ndata1 = 2\ndata2 = str\nmore = foo_more\n\n[foo_more]\ndata3 = foo,bar\n

                                                                                                                The provider will have these additional parameters available:

                                                                                                                • \"activate\"

                                                                                                                  pointing at the string \"1\"

                                                                                                                • \"data1\"

                                                                                                                  pointing at the string \"2\"

                                                                                                                • \"data2\"

                                                                                                                  pointing at the string \"str\"

                                                                                                                • \"more.data3\"

                                                                                                                  pointing at the string \"foo,bar\"

                                                                                                                For more information on handling parameters, see OSSL_PARAM(3) as OSSL_PARAM_int(3).

                                                                                                                "},{"location":"man7/provider-base/#capabilities","title":"CAPABILITIES","text":"

                                                                                                                Capabilities describe some of the services that a provider can offer. Applications can query the capabilities to discover those services.

                                                                                                                "},{"location":"man7/provider-base/#tls-group-capability","title":"\"TLS-GROUP\" Capability","text":"

                                                                                                                The \"TLS-GROUP\" capability can be queried by libssl to discover the list of TLS groups that a provider can support. Each group supported can be used for key exchange (KEX) or key encapsulation method (KEM) during a TLS handshake. TLS clients can advertise the list of TLS groups they support in the supported_groups extension, and TLS servers can select a group from the offered list that they also support. In this way a provider can add to the list of groups that libssl already supports with additional ones.

                                                                                                                Each TLS group that a provider supports should be described via the callback passed in through the provider_get_capabilities function. Each group should have the following details supplied (all are mandatory, except OSSL_CAPABILITY_TLS_GROUP_IS_KEM):

                                                                                                                • \"tls-group-name\" (OSSL_CAPABILITY_TLS_GROUP_NAME)

                                                                                                                  The name of the group as given in the IANA TLS Supported Groups registry https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8.

                                                                                                                • \"tls-group-name-internal\" (OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL)

                                                                                                                  The name of the group as known by the provider. This could be the same as the \"tls-group-name\", but does not have to be.

                                                                                                                • \"tls-group-id\" (OSSL_CAPABILITY_TLS_GROUP_ID) <unsigned integer>

                                                                                                                  The TLS group id value as given in the IANA TLS Supported Groups registry.

                                                                                                                • \"tls-group-alg\" (OSSL_CAPABILITY_TLS_GROUP_ALG)

                                                                                                                  The name of a Key Management algorithm that the provider offers and that should be used with this group. Keys created should be able to support key exchange or key encapsulation method (KEM), as implied by the optional OSSL_CAPABILITY_TLS_GROUP_IS_KEM flag. The algorithm must support key and parameter generation as well as the key/parameter generation parameter, OSSL_PKEY_PARAM_GROUP_NAME. The group name given via \"tls-group-name-internal\" above will be passed via OSSL_PKEY_PARAM_GROUP_NAME when libssl wishes to generate keys/parameters.

                                                                                                                • \"tls-group-sec-bits\" (OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS) <unsigned integer>

                                                                                                                  The number of bits of security offered by keys in this group. The number of bits should be comparable with the ones given in table 2 and 3 of the NIST SP800-57 document.

                                                                                                                • \"tls-group-is-kem\" (OSSL_CAPABILITY_TLS_GROUP_IS_KEM) <unsigned integer>

                                                                                                                  Boolean flag to describe if the group should be used in key exchange (KEX) mode (0, default) or in key encapsulation method (KEM) mode (1).

                                                                                                                  This parameter is optional: if not specified, KEX mode is assumed as the default mode for the group.

                                                                                                                  In KEX mode, in a typical Diffie-Hellman fashion, both sides execute keygen then derive against the peer public key. To operate in KEX mode, the group implementation must support the provider functions as described in provider-keyexch(7).

                                                                                                                  In KEM mode, the client executes keygen and sends its public key, the server executes encapsulate using the client's public key and sends back the resulting ciphertext, finally the client executes decapsulate to retrieve the same shared secret generated by the server's encapsulate. To operate in KEM mode, the group implementation must support the provider functions as described in provider-kem(7).

                                                                                                                  Both in KEX and KEM mode, the resulting shared secret is then used according to the protocol specification.

                                                                                                                • \"tls-min-tls\" (OSSL_CAPABILITY_TLS_GROUP_MIN_TLS) <integer>

                                                                                                                • \"tls-max-tls\" (OSSL_CAPABILITY_TLS_GROUP_MAX_TLS) <integer>
                                                                                                                • \"tls-min-dtls\" (OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS) <integer>
                                                                                                                • \"tls-max-dtls\" (OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS) <integer>

                                                                                                                  These parameters can be used to describe the minimum and maximum TLS and DTLS versions supported by the group. The values equate to the on-the-wire encoding of the various TLS versions. For example TLSv1.3 is 0x0304 (772 decimal), and TLSv1.2 is 0x0303 (771 decimal). A 0 indicates that there is no defined minimum or maximum. A -1 indicates that the group should not be used in that protocol.

                                                                                                                • "},{"location":"man7/provider-base/#notes","title":"NOTES","text":"

                                                                                                                  The core_obj_create() and core_obj_add_sigid() functions were not thread safe in OpenSSL 3.0.

                                                                                                                  "},{"location":"man7/provider-base/#examples","title":"EXAMPLES","text":"

                                                                                                                  This is an example of a simple provider made available as a dynamically loadable module. It implements the fictitious algorithm FOO for the fictitious operation BAR.

                                                                                                                  #include <malloc.h>\n#include <openssl/core.h>\n#include <openssl/core_dispatch.h>\n\n/* Errors used in this provider */\n#define E_MALLOC       1\n\nstatic const OSSL_ITEM reasons[] = {\n    { E_MALLOC, \"memory allocation failure\" }.\n    { 0, NULL } /* Termination */\n};\n\n/*\n * To ensure we get the function signature right, forward declare\n * them using function types provided by openssl/core_dispatch.h\n */\nOSSL_FUNC_bar_newctx_fn foo_newctx;\nOSSL_FUNC_bar_freectx_fn foo_freectx;\nOSSL_FUNC_bar_init_fn foo_init;\nOSSL_FUNC_bar_update_fn foo_update;\nOSSL_FUNC_bar_final_fn foo_final;\n\nOSSL_FUNC_provider_query_operation_fn p_query;\nOSSL_FUNC_provider_get_reason_strings_fn p_reasons;\nOSSL_FUNC_provider_teardown_fn p_teardown;\n\nOSSL_provider_init_fn OSSL_provider_init;\n\nOSSL_FUNC_core_put_error *c_put_error = NULL;\n\n/* Provider context */\nstruct prov_ctx_st {\n    OSSL_CORE_HANDLE *handle;\n}\n\n/* operation context for the algorithm FOO */\nstruct foo_ctx_st {\n    struct prov_ctx_st *provctx;\n    int b;\n};\n\nstatic void *foo_newctx(void *provctx)\n{\n    struct foo_ctx_st *fooctx = malloc(sizeof(*fooctx));\n\n    if (fooctx != NULL)\n        fooctx->provctx = provctx;\n    else\n        c_put_error(provctx->handle, E_MALLOC, __FILE__, __LINE__);\n    return fooctx;\n}\n\nstatic void foo_freectx(void *fooctx)\n{\n    free(fooctx);\n}\n\nstatic int foo_init(void *vfooctx)\n{\n    struct foo_ctx_st *fooctx = vfooctx;\n\n    fooctx->b = 0x33;\n}\n\nstatic int foo_update(void *vfooctx, unsigned char *in, size_t inl)\n{\n    struct foo_ctx_st *fooctx = vfooctx;\n\n    /* did you expect something serious? */\n    if (inl == 0)\n        return 1;\n    for (; inl-- > 0; in++)\n        *in ^= fooctx->b;\n    return 1;\n}\n\nstatic int foo_final(void *vfooctx)\n{\n    struct foo_ctx_st *fooctx = vfooctx;\n\n    fooctx->b = 0x66;\n}\n\nstatic const OSSL_DISPATCH foo_fns[] = {\n    { OSSL_FUNC_BAR_NEWCTX, (void (*)(void))foo_newctx },\n    { OSSL_FUNC_BAR_FREECTX, (void (*)(void))foo_freectx },\n    { OSSL_FUNC_BAR_INIT, (void (*)(void))foo_init },\n    { OSSL_FUNC_BAR_UPDATE, (void (*)(void))foo_update },\n    { OSSL_FUNC_BAR_FINAL, (void (*)(void))foo_final },\n    { 0, NULL }\n};\n\nstatic const OSSL_ALGORITHM bars[] = {\n    { \"FOO\", \"provider=chumbawamba\", foo_fns },\n    { NULL, NULL, NULL }\n};\n\nstatic const OSSL_ALGORITHM *p_query(void *provctx, int operation_id,\n                                     int *no_store)\n{\n    switch (operation_id) {\n    case OSSL_OP_BAR:\n        return bars;\n    }\n    return NULL;\n}\n\nstatic const OSSL_ITEM *p_reasons(void *provctx)\n{\n    return reasons;\n}\n\nstatic void p_teardown(void *provctx)\n{\n    free(provctx);\n}\n\nstatic const OSSL_DISPATCH prov_fns[] = {\n    { OSSL_FUNC_PROVIDER_TEARDOWN, (void (*)(void))p_teardown },\n    { OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))p_query },\n    { OSSL_FUNC_PROVIDER_GET_REASON_STRINGS, (void (*)(void))p_reasons },\n    { 0, NULL }\n};\n\nint OSSL_provider_init(const OSSL_CORE_HANDLE *handle,\n                       const OSSL_DISPATCH *in,\n                       const OSSL_DISPATCH **out,\n                       void **provctx)\n{\n    struct prov_ctx_st *pctx = NULL;\n\n    for (; in->function_id != 0; in++)\n        switch (in->function_id) {\n        case OSSL_FUNC_CORE_PUT_ERROR:\n            c_put_error = OSSL_FUNC_core_put_error(in);\n            break;\n        }\n\n    *out = prov_fns;\n\n    if ((pctx = malloc(sizeof(*pctx))) == NULL) {\n        /*\n         * ALEA IACTA EST, if the core retrieves the reason table\n         * regardless, that string will be displayed, otherwise not.\n         */\n        c_put_error(handle, E_MALLOC, __FILE__, __LINE__);\n        return 0;\n    }\n    pctx->handle = handle;\n    return 1;\n}\n

                                                                                                                  This relies on a few things existing in openssl/core_dispatch.h:

                                                                                                                  #define OSSL_OP_BAR            4711\n\n#define OSSL_FUNC_BAR_NEWCTX      1\ntypedef void *(OSSL_FUNC_bar_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_bar_newctx(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_newctx_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_FREECTX     2\ntypedef void (OSSL_FUNC_bar_freectx_fn)(void *ctx);\nstatic ossl_inline OSSL_FUNC_bar_freectx(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_freectx_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_INIT        3\ntypedef void *(OSSL_FUNC_bar_init_fn)(void *ctx);\nstatic ossl_inline OSSL_FUNC_bar_init(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_init_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_UPDATE      4\ntypedef void *(OSSL_FUNC_bar_update_fn)(void *ctx,\n                                      unsigned char *in, size_t inl);\nstatic ossl_inline OSSL_FUNC_bar_update(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_update_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_FINAL       5\ntypedef void *(OSSL_FUNC_bar_final_fn)(void *ctx);\nstatic ossl_inline OSSL_FUNC_bar_final(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_final_fn *)opf->function; }\n
                                                                                                                  "},{"location":"man7/provider-base/#see-also","title":"SEE ALSO","text":"

                                                                                                                  provider(7)

                                                                                                                  "},{"location":"man7/provider-base/#history","title":"HISTORY","text":"

                                                                                                                  The concept of providers and everything surrounding them was introduced in OpenSSL 3.0.

                                                                                                                  "},{"location":"man7/provider-base/#copyright","title":"COPYRIGHT","text":"

                                                                                                                  Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                  "},{"location":"man7/provider-cipher/","title":"provider-cipher","text":""},{"location":"man7/provider-cipher/#name","title":"NAME","text":"

                                                                                                                  provider-cipher - The cipher library <-> provider functions

                                                                                                                  "},{"location":"man7/provider-cipher/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                  #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_cipher_newctx(void *provctx);\nvoid OSSL_FUNC_cipher_freectx(void *cctx);\nvoid *OSSL_FUNC_cipher_dupctx(void *cctx);\n\n/* Encryption/decryption */\nint OSSL_FUNC_cipher_encrypt_init(void *cctx, const unsigned char *key,\n                                  size_t keylen, const unsigned char *iv,\n                                  size_t ivlen, const OSSL_PARAM params[]);\nint OSSL_FUNC_cipher_decrypt_init(void *cctx, const unsigned char *key,\n                                  size_t keylen, const unsigned char *iv,\n                                  size_t ivlen, const OSSL_PARAM params[]);\nint OSSL_FUNC_cipher_update(void *cctx, unsigned char *out, size_t *outl,\n                            size_t outsize, const unsigned char *in, size_t inl);\nint OSSL_FUNC_cipher_final(void *cctx, unsigned char *out, size_t *outl,\n                           size_t outsize);\nint OSSL_FUNC_cipher_cipher(void *cctx, unsigned char *out, size_t *outl,\n                            size_t outsize, const unsigned char *in, size_t inl);\n\n/* Cipher parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_cipher_gettable_params(void *provctx);\n\n/* Cipher operation parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_cipher_gettable_ctx_params(void *cctx,\n                                                       void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_cipher_settable_ctx_params(void *cctx,\n                                                       void *provctx);\n\n/* Cipher parameters */\nint OSSL_FUNC_cipher_get_params(OSSL_PARAM params[]);\n\n/* Cipher operation parameters */\nint OSSL_FUNC_cipher_get_ctx_params(void *cctx, OSSL_PARAM params[]);\nint OSSL_FUNC_cipher_set_ctx_params(void *cctx, const OSSL_PARAM params[]);\n
                                                                                                                  "},{"location":"man7/provider-cipher/#description","title":"DESCRIPTION","text":"

                                                                                                                  This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                  The CIPHER operation enables providers to implement cipher algorithms and make them available to applications via the API functions EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal(3) (as well as the decrypt equivalents and other related functions).

                                                                                                                  All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                  All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_cipher_newctx() has these:

                                                                                                                  typedef void *(OSSL_FUNC_cipher_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_cipher_newctx_fn\n    OSSL_FUNC_cipher_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                  OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                  OSSL_FUNC_cipher_newctx               OSSL_FUNC_CIPHER_NEWCTX\nOSSL_FUNC_cipher_freectx              OSSL_FUNC_CIPHER_FREECTX\nOSSL_FUNC_cipher_dupctx               OSSL_FUNC_CIPHER_DUPCTX\n\nOSSL_FUNC_cipher_encrypt_init         OSSL_FUNC_CIPHER_ENCRYPT_INIT\nOSSL_FUNC_cipher_decrypt_init         OSSL_FUNC_CIPHER_DECRYPT_INIT\nOSSL_FUNC_cipher_update               OSSL_FUNC_CIPHER_UPDATE\nOSSL_FUNC_cipher_final                OSSL_FUNC_CIPHER_FINAL\nOSSL_FUNC_cipher_cipher               OSSL_FUNC_CIPHER_CIPHER\n\nOSSL_FUNC_cipher_get_params           OSSL_FUNC_CIPHER_GET_PARAMS\nOSSL_FUNC_cipher_get_ctx_params       OSSL_FUNC_CIPHER_GET_CTX_PARAMS\nOSSL_FUNC_cipher_set_ctx_params       OSSL_FUNC_CIPHER_SET_CTX_PARAMS\n\nOSSL_FUNC_cipher_gettable_params      OSSL_FUNC_CIPHER_GETTABLE_PARAMS\nOSSL_FUNC_cipher_gettable_ctx_params  OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS\nOSSL_FUNC_cipher_settable_ctx_params  OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS\n

                                                                                                                  A cipher algorithm implementation may not implement all of these functions. In order to be a consistent set of functions there must at least be a complete set of \"encrypt\" functions, or a complete set of \"decrypt\" functions, or a single \"cipher\" function. In all cases both the OSSL_FUNC_cipher_newctx and OSSL_FUNC_cipher_freectx functions must be present. All other functions are optional.

                                                                                                                  "},{"location":"man7/provider-cipher/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                  OSSL_FUNC_cipher_newctx() should create and return a pointer to a provider side structure for holding context information during a cipher operation. A pointer to this context will be passed back in a number of the other cipher operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                  OSSL_FUNC_cipher_freectx() is passed a pointer to the provider side cipher context in the cctx parameter. This function should free any resources associated with that context.

                                                                                                                  OSSL_FUNC_cipher_dupctx() should duplicate the provider side cipher context in the cctx parameter and return the duplicate copy.

                                                                                                                  "},{"location":"man7/provider-cipher/#encryptiondecryption-functions","title":"Encryption/Decryption Functions","text":"

                                                                                                                  OSSL_FUNC_cipher_encrypt_init() initialises a cipher operation for encryption given a newly created provider side cipher context in the cctx parameter. The key to be used is given in key which is keylen bytes long. The IV to be used is given in iv which is ivlen bytes long. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_cipher_set_ctx_params().

                                                                                                                  OSSL_FUNC_cipher_decrypt_init() is the same as OSSL_FUNC_cipher_encrypt_init() except that it initialises the context for a decryption operation.

                                                                                                                  OSSL_FUNC_cipher_update() is called to supply data to be encrypted/decrypted as part of a previously initialised cipher operation. The cctx parameter contains a pointer to a previously initialised provider side context. OSSL_FUNC_cipher_update() should encrypt/decrypt inl bytes of data at the location pointed to by in. The encrypted data should be stored in out and the amount of data written to *outl which should not exceed outsize bytes. OSSL_FUNC_cipher_update() may be called multiple times for a single cipher operation. It is the responsibility of the cipher implementation to handle input lengths that are not multiples of the block length. In such cases a cipher implementation will typically cache partial blocks of input data until a complete block is obtained. The pointers out and in may point to the same location, in which case the encryption must be done in-place. If out and in point to different locations, the requirements of EVP_EncryptUpdate(3) and EVP_DecryptUpdate(3) guarantee that the two buffers are disjoint. Similarly, the requirements of EVP_EncryptUpdate(3) and EVP_DecryptUpdate(3) ensure that the buffer pointed to by out contains sufficient room for the operation being performed.

                                                                                                                  OSSL_FUNC_cipher_final() completes an encryption or decryption started through previous OSSL_FUNC_cipher_encrypt_init() or OSSL_FUNC_cipher_decrypt_init(), and OSSL_FUNC_cipher_update() calls. The cctx parameter contains a pointer to the provider side context. Any final encryption/decryption output should be written to out and the amount of data written to *outl which should not exceed outsize bytes. The same expectations apply to outsize as documented for EVP_EncryptFinal(3) and EVP_DecryptFinal(3).

                                                                                                                  OSSL_FUNC_cipher_cipher() performs encryption/decryption using the provider side cipher context in the cctx parameter that should have been previously initialised via a call to OSSL_FUNC_cipher_encrypt_init() or OSSL_FUNC_cipher_decrypt_init(). This should call the raw underlying cipher function without any padding. This will be invoked in the provider as a result of the application calling EVP_Cipher(3). The application is responsible for ensuring that the input is a multiple of the block length. The data to be encrypted/decrypted will be in in, and it will be inl bytes in length. The output from the encryption/decryption should be stored in out and the amount of data stored should be put in *outl which should be no more than outsize bytes.

                                                                                                                  "},{"location":"man7/provider-cipher/#cipher-parameters","title":"Cipher Parameters","text":"

                                                                                                                  See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                  OSSL_FUNC_cipher_get_params() gets details of the algorithm implementation and stores them in params.

                                                                                                                  OSSL_FUNC_cipher_set_ctx_params() sets cipher operation parameters for the provider side cipher context cctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                  OSSL_FUNC_cipher_get_ctx_params() gets cipher operation details details from the given provider side cipher context cctx and stores them in params. Passing NULL for params should return true.

                                                                                                                  OSSL_FUNC_cipher_gettable_params(), OSSL_FUNC_cipher_gettable_ctx_params(), and OSSL_FUNC_cipher_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_cipher_get_params(), OSSL_FUNC_cipher_get_ctx_params(), and OSSL_FUNC_cipher_set_ctx_params() can handle, respectively. OSSL_FUNC_cipher_gettable_ctx_params() and OSSL_FUNC_cipher_settable_ctx_params() will return the parameters associated with the provider side context cctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                  Parameters currently recognised by built-in ciphers are listed in \"PARAMETERS\" in EVP_EncryptInit(3). Not all parameters are relevant to, or are understood by all ciphers.

                                                                                                                  "},{"location":"man7/provider-cipher/#return-values","title":"RETURN VALUES","text":"

                                                                                                                  OSSL_FUNC_cipher_newctx() and OSSL_FUNC_cipher_dupctx() should return the newly created provider side cipher context, or NULL on failure.

                                                                                                                  OSSL_FUNC_cipher_encrypt_init(), OSSL_FUNC_cipher_decrypt_init(), OSSL_FUNC_cipher_update(), OSSL_FUNC_cipher_final(), OSSL_FUNC_cipher_cipher(), OSSL_FUNC_cipher_get_params(), OSSL_FUNC_cipher_get_ctx_params() and OSSL_FUNC_cipher_set_ctx_params() should return 1 for success or 0 on error.

                                                                                                                  OSSL_FUNC_cipher_gettable_params(), OSSL_FUNC_cipher_gettable_ctx_params() and OSSL_FUNC_cipher_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                  "},{"location":"man7/provider-cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                                  provider(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-legacy(7), EVP_CIPHER-AES(7), EVP_CIPHER-ARIA(7), EVP_CIPHER-BLOWFISH(7), EVP_CIPHER-CAMELLIA(7), EVP_CIPHER-CAST(7), EVP_CIPHER-CHACHA(7), EVP_CIPHER-DES(7), EVP_CIPHER-IDEA(7), EVP_CIPHER-RC2(7), EVP_CIPHER-RC4(7), EVP_CIPHER-RC5(7), EVP_CIPHER-SEED(7), EVP_CIPHER-SM4(7), EVP_CIPHER-NULL(7), life_cycle-cipher(7), EVP_EncryptInit(3)

                                                                                                                  "},{"location":"man7/provider-cipher/#history","title":"HISTORY","text":"

                                                                                                                  The provider CIPHER interface was introduced in OpenSSL 3.0.

                                                                                                                  "},{"location":"man7/provider-cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                                  Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                  "},{"location":"man7/provider-decoder/","title":"provider-decoder","text":""},{"location":"man7/provider-decoder/#name","title":"NAME","text":"

                                                                                                                  provider-decoder - The OSSL_DECODER library <-> provider functions

                                                                                                                  "},{"location":"man7/provider-decoder/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                  #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Decoder parameter accessor and descriptor */\nconst OSSL_PARAM *OSSL_FUNC_decoder_gettable_params(void *provctx);\nint OSSL_FUNC_decoder_get_params(OSSL_PARAM params[]);\n\n/* Functions to construct / destruct / manipulate the decoder context */\nvoid *OSSL_FUNC_decoder_newctx(void *provctx);\nvoid OSSL_FUNC_decoder_freectx(void *ctx);\nconst OSSL_PARAM *OSSL_FUNC_decoder_settable_ctx_params(void *provctx);\nint OSSL_FUNC_decoder_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\n\n/* Functions to check selection support */\nint OSSL_FUNC_decoder_does_selection(void *provctx, int selection);\n\n/* Functions to decode object data */\nint OSSL_FUNC_decoder_decode(void *ctx, OSSL_CORE_BIO *in,\n                             int selection,\n                             OSSL_CALLBACK *data_cb, void *data_cbarg,\n                             OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg);\n\n/* Functions to export a decoded object */\nint OSSL_FUNC_decoder_export_object(void *ctx,\n                                      const void *objref, size_t objref_sz,\n                                      OSSL_CALLBACK *export_cb,\n                                      void *export_cbarg);\n
                                                                                                                  "},{"location":"man7/provider-decoder/#description","title":"DESCRIPTION","text":"

                                                                                                                  The term \"decode\" is used throughout this manual. This includes but is not limited to deserialization as individual decoders can also do decoding into intermediate data formats.

                                                                                                                  The DECODER operation is a generic method to create a provider-native object reference or intermediate decoded data from an encoded form read from the given OSSL_CORE_BIO. If the caller wants to decode data from memory, it should provide a BIO_s_mem(3) BIO. The decoded data or object reference is passed along with eventual metadata to the metadata_cb as OSSL_PARAM(3) parameters.

                                                                                                                  The decoder doesn't need to know more about the OSSL_CORE_BIO pointer than being able to pass it to the appropriate BIO upcalls (see \"Core functions\" in provider-base(7)).

                                                                                                                  The DECODER implementation may be part of a chain, where data is passed from one to the next. For example, there may be an implementation to decode an object from PEM to DER, and another one that decodes DER to a provider-native object.

                                                                                                                  The last decoding step in the decoding chain is usually supposed to create a provider-native object referenced by an object reference. To import that object into a different provider the OSSL_FUNC_decoder_export_object() can be called as the final step of the decoding process.

                                                                                                                  All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                  All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_decoder_decode() has these:

                                                                                                                  typedef int\n    (OSSL_FUNC_decoder_decode_fn)(void *ctx, OSSL_CORE_BIO *in,\n                                  int selection,\n                                  OSSL_CALLBACK *data_cb, void *data_cbarg,\n                                  OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg);\nstatic ossl_inline OSSL_FUNC_decoder_decode_fn*\n    OSSL_FUNC_decoder_decode(const OSSL_DISPATCH *opf);\n

                                                                                                                  OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                  OSSL_FUNC_decoder_get_params          OSSL_FUNC_DECODER_GET_PARAMS\nOSSL_FUNC_decoder_gettable_params     OSSL_FUNC_DECODER_GETTABLE_PARAMS\n\nOSSL_FUNC_decoder_newctx              OSSL_FUNC_DECODER_NEWCTX\nOSSL_FUNC_decoder_freectx             OSSL_FUNC_DECODER_FREECTX\nOSSL_FUNC_decoder_set_ctx_params      OSSL_FUNC_DECODER_SET_CTX_PARAMS\nOSSL_FUNC_decoder_settable_ctx_params OSSL_FUNC_DECODER_SETTABLE_CTX_PARAMS\n\nOSSL_FUNC_decoder_does_selection      OSSL_FUNC_DECODER_DOES_SELECTION\n\nOSSL_FUNC_decoder_decode              OSSL_FUNC_DECODER_DECODE\n\nOSSL_FUNC_decoder_export_object       OSSL_FUNC_DECODER_EXPORT_OBJECT\n
                                                                                                                  "},{"location":"man7/provider-decoder/#names-and-properties","title":"Names and properties","text":"

                                                                                                                  The name of an implementation should match the target type of object it decodes. For example, an implementation that decodes an RSA key should be named \"RSA\". Likewise, an implementation that decodes DER data from PEM input should be named \"DER\".

                                                                                                                  Properties can be used to further specify details about an implementation:

                                                                                                                  • input

                                                                                                                    This property is used to specify what format of input the implementation can decode.

                                                                                                                    This property is mandatory.

                                                                                                                    OpenSSL providers recognize the following input types:

                                                                                                                    • pem

                                                                                                                      An implementation with that input type decodes PEM formatted data.

                                                                                                                    • der

                                                                                                                      An implementation with that input type decodes DER formatted data.

                                                                                                                    • msblob

                                                                                                                      An implementation with that input type decodes MSBLOB formatted data.

                                                                                                                    • pvk

                                                                                                                      An implementation with that input type decodes PVK formatted data.

                                                                                                                  • structure

                                                                                                                    This property is used to specify the structure that the decoded data is expected to have.

                                                                                                                    This property is optional.

                                                                                                                    Structures currently recognised by built-in decoders:

                                                                                                                    • \"type-specific\"

                                                                                                                      Type specific structure.

                                                                                                                    • \"pkcs8\"

                                                                                                                      Structure according to the PKCS#8 specification.

                                                                                                                    • \"SubjectPublicKeyInfo\"

                                                                                                                      Encoding of public keys according to the Subject Public Key Info of RFC 5280.

                                                                                                                  The possible values of both these properties is open ended. A provider may very well specify input types and structures that libcrypto doesn't know anything about.

                                                                                                                  "},{"location":"man7/provider-decoder/#subset-selections","title":"Subset selections","text":"

                                                                                                                  Sometimes, an object has more than one subset of data that is interesting to treat separately or together. It's possible to specify what subsets are to be decoded, with a set of bits selection that are passed in an int.

                                                                                                                  This set of bits depend entirely on what kind of provider-side object is to be decoded. For example, those bits are assumed to be the same as those used with provider-keymgmt(7) (see \"Key Objects\" in provider-keymgmt(7)) when the object is an asymmetric keypair - e.g., OSSL_KEYMGMT_SELECT_PRIVATE_KEY if the object to be decoded is supposed to contain private key components.

                                                                                                                  OSSL_FUNC_decoder_does_selection() should tell if a particular implementation supports any of the combinations given by selection.

                                                                                                                  "},{"location":"man7/provider-decoder/#context-functions","title":"Context functions","text":"

                                                                                                                  OSSL_FUNC_decoder_newctx() returns a context to be used with the rest of the functions.

                                                                                                                  OSSL_FUNC_decoder_freectx() frees the given ctx as created by OSSL_FUNC_decoder_newctx().

                                                                                                                  OSSL_FUNC_decoder_set_ctx_params() sets context data according to parameters from params that it recognises. Unrecognised parameters should be ignored. Passing NULL for params should return true.

                                                                                                                  OSSL_FUNC_decoder_settable_ctx_params() returns a constant OSSL_PARAM(3) array describing the parameters that OSSL_FUNC_decoder_set_ctx_params() can handle.

                                                                                                                  See OSSL_PARAM(3) for further details on the parameters structure used by OSSL_FUNC_decoder_set_ctx_params() and OSSL_FUNC_decoder_settable_ctx_params().

                                                                                                                  "},{"location":"man7/provider-decoder/#export-function","title":"Export function","text":"

                                                                                                                  When a provider-native object is created by a decoder it would be unsuitable for direct use with a foreign provider. The export function allows for exporting the object into that foreign provider if the foreign provider supports the type of the object and provides an import function.

                                                                                                                  OSSL_FUNC_decoder_export_object() should export the object of size objref_sz referenced by objref as an OSSL_PARAM(3) array and pass that into the export_cb as well as the given export_cbarg.

                                                                                                                  "},{"location":"man7/provider-decoder/#decoding-functions","title":"Decoding functions","text":"

                                                                                                                  OSSL_FUNC_decoder_decode() should decode the data as read from the OSSL_CORE_BIO in to produce decoded data or an object to be passed as reference in an OSSL_PARAM(3) array along with possible other metadata that was decoded from the input. This OSSL_PARAM(3) array is then passed to the data_cb callback. The selection bits, if relevant, should determine what the input data should contain. The decoding functions also take an OSSL_PASSPHRASE_CALLBACK(3) function pointer along with a pointer to application data cbarg, which should be used when a pass phrase prompt is needed.

                                                                                                                  It's important to understand that the return value from this function is interpreted as follows:

                                                                                                                  • True (1)

                                                                                                                    This means \"carry on the decoding process\", and is meaningful even though this function couldn't decode the input into anything, because there may be another decoder implementation that can decode it into something.

                                                                                                                    The data_cb callback should never be called when this function can't decode the input into anything.

                                                                                                                  • False (0)

                                                                                                                    This means \"stop the decoding process\", and is meaningful when the input could be decoded into some sort of object that this function understands, but further treatment of that object results into errors that won't be possible for some other decoder implementation to get a different result.

                                                                                                                  The conditions to stop the decoding process are at the discretion of the implementation.

                                                                                                                  "},{"location":"man7/provider-decoder/#decoder-operation-parameters","title":"Decoder operation parameters","text":"

                                                                                                                  There are currently no operation parameters currently recognised by the built-in decoders.

                                                                                                                  Parameters currently recognised by the built-in pass phrase callback:

                                                                                                                  • \"info\" (OSSL_PASSPHRASE_PARAM_INFO)

                                                                                                                    A string of information that will become part of the pass phrase prompt. This could be used to give the user information on what kind of object it's being prompted for.

                                                                                                                    "},{"location":"man7/provider-decoder/#return-values","title":"RETURN VALUES","text":"

                                                                                                                    OSSL_FUNC_decoder_newctx() returns a pointer to a context, or NULL on failure.

                                                                                                                    OSSL_FUNC_decoder_set_ctx_params() returns 1, unless a recognised parameter was invalid or caused an error, for which 0 is returned.

                                                                                                                    OSSL_FUNC_decoder_settable_ctx_params() returns a pointer to an array of constant OSSL_PARAM(3) elements.

                                                                                                                    OSSL_FUNC_decoder_does_selection() returns 1 if the decoder implementation supports any of the selection bits, otherwise 0.

                                                                                                                    OSSL_FUNC_decoder_decode() returns 1 to signal that the decoding process should continue, or 0 to signal that it should stop.

                                                                                                                    "},{"location":"man7/provider-decoder/#see-also","title":"SEE ALSO","text":"

                                                                                                                    provider(7)

                                                                                                                    "},{"location":"man7/provider-decoder/#history","title":"HISTORY","text":"

                                                                                                                    The DECODER interface was introduced in OpenSSL 3.0.

                                                                                                                    "},{"location":"man7/provider-decoder/#copyright","title":"COPYRIGHT","text":"

                                                                                                                    Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                    "},{"location":"man7/provider-digest/","title":"provider-digest","text":""},{"location":"man7/provider-digest/#name","title":"NAME","text":"

                                                                                                                    provider-digest - The digest library <-> provider functions

                                                                                                                    "},{"location":"man7/provider-digest/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                    #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * Digests support the following function signatures in OSSL_DISPATCH arrays.\n * (The function signatures are not actual functions).\n */\n\n/* Context management */\nvoid *OSSL_FUNC_digest_newctx(void *provctx);\nvoid OSSL_FUNC_digest_freectx(void *dctx);\nvoid *OSSL_FUNC_digest_dupctx(void *dctx);\n\n/* Digest generation */\nint OSSL_FUNC_digest_init(void *dctx, const OSSL_PARAM params[]);\nint OSSL_FUNC_digest_update(void *dctx, const unsigned char *in, size_t inl);\nint OSSL_FUNC_digest_final(void *dctx, unsigned char *out, size_t *outl,\n                           size_t outsz);\nint OSSL_FUNC_digest_digest(void *provctx, const unsigned char *in, size_t inl,\n                            unsigned char *out, size_t *outl, size_t outsz);\n\n/* Digest parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_digest_gettable_params(void *provctx);\n\n/* Digest operation parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_digest_gettable_ctx_params(void *dctx,\n                                                       void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_digest_settable_ctx_params(void *dctx,\n                                                       void *provctx);\n\n/* Digest parameters */\nint OSSL_FUNC_digest_get_params(OSSL_PARAM params[]);\n\n/* Digest operation parameters */\nint OSSL_FUNC_digest_set_ctx_params(void *dctx, const OSSL_PARAM params[]);\nint OSSL_FUNC_digest_get_ctx_params(void *dctx, OSSL_PARAM params[]);\n
                                                                                                                    "},{"location":"man7/provider-digest/#description","title":"DESCRIPTION","text":"

                                                                                                                    This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                    The DIGEST operation enables providers to implement digest algorithms and make them available to applications via the API functions EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal(3) (and other related functions).

                                                                                                                    All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                    All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_digest_newctx() has these:

                                                                                                                    typedef void *(OSSL_FUNC_digest_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_digest_newctx_fn\n    OSSL_FUNC_digest_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                    OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                    OSSL_FUNC_digest_newctx               OSSL_FUNC_DIGEST_NEWCTX\nOSSL_FUNC_digest_freectx              OSSL_FUNC_DIGEST_FREECTX\nOSSL_FUNC_digest_dupctx               OSSL_FUNC_DIGEST_DUPCTX\n\nOSSL_FUNC_digest_init                 OSSL_FUNC_DIGEST_INIT\nOSSL_FUNC_digest_update               OSSL_FUNC_DIGEST_UPDATE\nOSSL_FUNC_digest_final                OSSL_FUNC_DIGEST_FINAL\nOSSL_FUNC_digest_digest               OSSL_FUNC_DIGEST_DIGEST\n\nOSSL_FUNC_digest_get_params           OSSL_FUNC_DIGEST_GET_PARAMS\nOSSL_FUNC_digest_get_ctx_params       OSSL_FUNC_DIGEST_GET_CTX_PARAMS\nOSSL_FUNC_digest_set_ctx_params       OSSL_FUNC_DIGEST_SET_CTX_PARAMS\n\nOSSL_FUNC_digest_gettable_params      OSSL_FUNC_DIGEST_GETTABLE_PARAMS\nOSSL_FUNC_digest_gettable_ctx_params  OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS\nOSSL_FUNC_digest_settable_ctx_params  OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS\n

                                                                                                                    A digest algorithm implementation may not implement all of these functions. In order to be usable all or none of OSSL_FUNC_digest_newctx, OSSL_FUNC_digest_freectx, OSSL_FUNC_digest_init, OSSL_FUNC_digest_update and OSSL_FUNC_digest_final should be implemented. All other functions are optional.

                                                                                                                    "},{"location":"man7/provider-digest/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                    OSSL_FUNC_digest_newctx() should create and return a pointer to a provider side structure for holding context information during a digest operation. A pointer to this context will be passed back in a number of the other digest operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                    OSSL_FUNC_digest_freectx() is passed a pointer to the provider side digest context in the dctx parameter. This function should free any resources associated with that context.

                                                                                                                    OSSL_FUNC_digest_dupctx() should duplicate the provider side digest context in the dctx parameter and return the duplicate copy.

                                                                                                                    "},{"location":"man7/provider-digest/#digest-generation-functions","title":"Digest Generation Functions","text":"

                                                                                                                    OSSL_FUNC_digest_init() initialises a digest operation given a newly created provider side digest context in the dctx parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_digest_set_ctx_params().

                                                                                                                    OSSL_FUNC_digest_update() is called to supply data to be digested as part of a previously initialised digest operation. The dctx parameter contains a pointer to a previously initialised provider side context. OSSL_FUNC_digest_update() should digest inl bytes of data at the location pointed to by in. OSSL_FUNC_digest_update() may be called multiple times for a single digest operation.

                                                                                                                    OSSL_FUNC_digest_final() generates a digest started through previous OSSL_FUNC_digest_init() and OSSL_FUNC_digest_update() calls. The dctx parameter contains a pointer to the provider side context. The digest should be written to *out and the length of the digest to *outl. The digest should not exceed outsz bytes.

                                                                                                                    OSSL_FUNC_digest_digest() is a \"oneshot\" digest function. No provider side digest context is used. Instead the provider context that was created during provider initialisation is passed in the provctx parameter (see provider(7)). inl bytes at in should be digested and the result should be stored at out. The length of the digest should be stored in *outl which should not exceed outsz bytes.

                                                                                                                    "},{"location":"man7/provider-digest/#digest-parameters","title":"Digest Parameters","text":"

                                                                                                                    See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                    OSSL_FUNC_digest_get_params() gets details of the algorithm implementation and stores them in params.

                                                                                                                    OSSL_FUNC_digest_set_ctx_params() sets digest operation parameters for the provider side digest context dctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                    OSSL_FUNC_digest_get_ctx_params() gets digest operation details details from the given provider side digest context dctx and stores them in params. Passing NULL for params should return true.

                                                                                                                    OSSL_FUNC_digest_gettable_params() returns a constant OSSL_PARAM(3) array containing descriptors of the parameters that OSSL_FUNC_digest_get_params() can handle.

                                                                                                                    OSSL_FUNC_digest_gettable_ctx_params() and OSSL_FUNC_digest_settable_ctx_params() both return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_digest_get_ctx_params() and OSSL_FUNC_digest_set_ctx_params() can handle, respectively. The array is based on the current state of the provider side context if dctx is not NULL and on the provider side algorithm provctx otherwise.

                                                                                                                    Parameters currently recognised by built-in digests with this function are as follows. Not all parameters are relevant to, or are understood by all digests:

                                                                                                                    • \"blocksize\" (OSSL_DIGEST_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                      The digest block size. The length of the \"blocksize\" parameter should not exceed that of a size_t.

                                                                                                                    • \"size\" (OSSL_DIGEST_PARAM_SIZE) <unsigned integer>

                                                                                                                      The digest output size. The length of the \"size\" parameter should not exceed that of a size_t.

                                                                                                                    • \"flags\" (OSSL_DIGEST_PARAM_FLAGS) <unsigned integer>

                                                                                                                      Diverse flags that describe exceptional behaviour for the digest:

                                                                                                                      • EVP_MD_FLAG_ONESHOT

                                                                                                                        This digest method can only handle one block of input.

                                                                                                                      • EVP_MD_FLAG_XOF

                                                                                                                        This digest method is an extensible-output function (XOF) and supports setting the OSSL_DIGEST_PARAM_XOFLEN parameter.

                                                                                                                      • EVP_MD_FLAG_DIGALGID_NULL

                                                                                                                        When setting up a DigestAlgorithmIdentifier, this flag will have the parameter set to NULL by default. Use this for PKCS#1. Note: if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override.

                                                                                                                      • EVP_MD_FLAG_DIGALGID_ABSENT

                                                                                                                        When setting up a DigestAlgorithmIdentifier, this flag will have the parameter be left absent by default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.

                                                                                                                      • EVP_MD_FLAG_DIGALGID_CUSTOM

                                                                                                                        Custom DigestAlgorithmIdentifier handling via ctrl, with EVP_MD_FLAG_DIGALGID_ABSENT as default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. Currently unused.

                                                                                                                      The length of the \"flags\" parameter should equal that of an unsigned long int.

                                                                                                                    "},{"location":"man7/provider-digest/#digest-context-parameters","title":"Digest Context Parameters","text":"

                                                                                                                    OSSL_FUNC_digest_set_ctx_params() sets digest parameters associated with the given provider side digest context dctx to params. Any parameter settings are additional to any that were previously set. See OSSL_PARAM(3) for further details on the parameters structure.

                                                                                                                    OSSL_FUNC_digest_get_ctx_params() gets details of currently set parameters values associated with the give provider side digest context dctx and stores them in params. See OSSL_PARAM(3) for further details on the parameters structure.

                                                                                                                    "},{"location":"man7/provider-digest/#return-values","title":"RETURN VALUES","text":"

                                                                                                                    OSSL_FUNC_digest_newctx() and OSSL_FUNC_digest_dupctx() should return the newly created provider side digest context, or NULL on failure.

                                                                                                                    OSSL_FUNC_digest_init(), OSSL_FUNC_digest_update(), OSSL_FUNC_digest_final(), OSSL_FUNC_digest_digest(), OSSL_FUNC_digest_set_params() and OSSL_FUNC_digest_get_params() should return 1 for success or 0 on error.

                                                                                                                    OSSL_FUNC_digest_size() should return the digest size.

                                                                                                                    OSSL_FUNC_digest_block_size() should return the block size of the underlying digest algorithm.

                                                                                                                    "},{"location":"man7/provider-digest/#bugs","title":"BUGS","text":"

                                                                                                                    The EVP_Q_digest(), EVP_Digest() and EVP_DigestFinal_ex() API calls do not expect the digest size to be larger than EVP_MAX_MD_SIZE. Any algorithm which produces larger digests is unusable with those API calls.

                                                                                                                    "},{"location":"man7/provider-digest/#see-also","title":"SEE ALSO","text":"

                                                                                                                    provider(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-legacy(7), EVP_MD-common(7), EVP_MD-BLAKE2(7), EVP_MD-MD2(7), EVP_MD-MD4(7), EVP_MD-MD5(7), EVP_MD-MD5-SHA1(7), EVP_MD-MDC2(7), EVP_MD-RIPEMD160(7), EVP_MD-SHA1(7), EVP_MD-SHA2(7), EVP_MD-SHA3(7), EVP_MD-SHAKE(7), EVP_MD-SM3(7), EVP_MD-WHIRLPOOL(7), EVP_MD-NULL(7), life_cycle-digest(7), EVP_DigestInit(3)

                                                                                                                    "},{"location":"man7/provider-digest/#history","title":"HISTORY","text":"

                                                                                                                    The provider DIGEST interface was introduced in OpenSSL 3.0.

                                                                                                                    "},{"location":"man7/provider-digest/#copyright","title":"COPYRIGHT","text":"

                                                                                                                    Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                    "},{"location":"man7/provider-encoder/","title":"provider-encoder","text":""},{"location":"man7/provider-encoder/#name","title":"NAME","text":"

                                                                                                                    provider-encoder - The OSSL_ENCODER library <-> provider functions

                                                                                                                    "},{"location":"man7/provider-encoder/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                    #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Encoder parameter accessor and descriptor */\nconst OSSL_PARAM *OSSL_FUNC_encoder_gettable_params(void *provctx);\nint OSSL_FUNC_encoder_get_params(OSSL_PARAM params[]);\n\n/* Functions to construct / destruct / manipulate the encoder context */\nvoid *OSSL_FUNC_encoder_newctx(void *provctx);\nvoid OSSL_FUNC_encoder_freectx(void *ctx);\nint OSSL_FUNC_encoder_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_encoder_settable_ctx_params(void *provctx);\n\n/* Functions to check selection support */\nint OSSL_FUNC_encoder_does_selection(void *provctx, int selection);\n\n/* Functions to encode object data */\nint OSSL_FUNC_encoder_encode(void *ctx, OSSL_CORE_BIO *out,\n                             const void *obj_raw,\n                             const OSSL_PARAM obj_abstract[],\n                             int selection,\n                             OSSL_PASSPHRASE_CALLBACK *cb,\n                             void *cbarg);\n\n/* Functions to import and free a temporary object to be encoded */\nvoid *OSSL_FUNC_encoder_import_object(void *ctx, int selection,\n                                      const OSSL_PARAM params[]);\nvoid OSSL_FUNC_encoder_free_object(void *obj);\n
                                                                                                                    "},{"location":"man7/provider-encoder/#description","title":"DESCRIPTION","text":"

                                                                                                                    We use the wide term \"encode\" in this manual. This includes but is not limited to serialization.

                                                                                                                    The ENCODER operation is a generic method to encode a provider-native object (obj_raw) or an object abstraction (object_abstract, see provider-object(7)) into an encoded form, and write the result to the given OSSL_CORE_BIO. If the caller wants to get the encoded stream to memory, it should provide a BIO_s_mem(3) BIO.

                                                                                                                    The encoder doesn't need to know more about the OSSL_CORE_BIO pointer than being able to pass it to the appropriate BIO upcalls (see \"Core functions\" in provider-base(7)).

                                                                                                                    The ENCODER implementation may be part of a chain, where data is passed from one to the next. For example, there may be an implementation to encode an object to DER (that object is assumed to be provider-native and thereby passed via obj_raw), and another one that encodes DER to PEM (that one would receive the DER encoding via obj_abstract).

                                                                                                                    The encoding using the OSSL_PARAM(3) array form allows a encoder to be used for data that's been exported from another provider, and thereby allow them to exist independently of each other.

                                                                                                                    The encoding using a provider side object can only be safely used with provider data coming from the same provider, for example keys with the KEYMGMT provider.

                                                                                                                    All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                    All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_encoder_encode() has these:

                                                                                                                    typedef int\n    (OSSL_FUNC_encoder_encode_fn)(void *ctx, OSSL_CORE_BIO *out,\n                                  const void *obj_raw,\n                                  const OSSL_PARAM obj_abstract[],\n                                  int selection,\n                                  OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg);\nstatic ossl_inline OSSL_FUNC_encoder_encode_fn\n    OSSL_FUNC_encoder_encode(const OSSL_DISPATCH *opf);\n

                                                                                                                    OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                    OSSL_FUNC_encoder_get_params          OSSL_FUNC_ENCODER_GET_PARAMS\nOSSL_FUNC_encoder_gettable_params     OSSL_FUNC_ENCODER_GETTABLE_PARAMS\n\nOSSL_FUNC_encoder_newctx              OSSL_FUNC_ENCODER_NEWCTX\nOSSL_FUNC_encoder_freectx             OSSL_FUNC_ENCODER_FREECTX\nOSSL_FUNC_encoder_set_ctx_params      OSSL_FUNC_ENCODER_SET_CTX_PARAMS\nOSSL_FUNC_encoder_settable_ctx_params OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS\n\nOSSL_FUNC_encoder_does_selection      OSSL_FUNC_ENCODER_DOES_SELECTION\n\nOSSL_FUNC_encoder_encode              OSSL_FUNC_ENCODER_ENCODE\n\nOSSL_FUNC_encoder_import_object       OSSL_FUNC_ENCODER_IMPORT_OBJECT\nOSSL_FUNC_encoder_free_object         OSSL_FUNC_ENCODER_FREE_OBJECT\n
                                                                                                                    "},{"location":"man7/provider-encoder/#names-and-properties","title":"Names and properties","text":"

                                                                                                                    The name of an implementation should match the type of object it handles. For example, an implementation that encodes an RSA key should be named \"RSA\". Likewise, an implementation that further encodes DER should be named \"DER\".

                                                                                                                    Properties can be used to further specify details about an implementation:

                                                                                                                    • output

                                                                                                                      This property is used to specify what type of output the implementation produces.

                                                                                                                      This property is mandatory.

                                                                                                                      OpenSSL providers recognize the following output types:

                                                                                                                      • text

                                                                                                                        An implementation with that output type outputs human readable text, making that implementation suitable for -text output in diverse openssl(1) commands.

                                                                                                                      • pem

                                                                                                                        An implementation with that output type outputs PEM formatted data.

                                                                                                                      • der

                                                                                                                        An implementation with that output type outputs DER formatted data.

                                                                                                                      • msblob

                                                                                                                        An implementation with that output type outputs MSBLOB formatted data.

                                                                                                                      • pvk

                                                                                                                        An implementation with that output type outputs PVK formatted data.

                                                                                                                    • structure

                                                                                                                      This property is used to specify the structure that is used for the encoded object. An example could be pkcs8, to specify explicitly that an object (presumably an asymmetric key pair, in this case) will be wrapped in a PKCS#8 structure as part of the encoding.

                                                                                                                      This property is optional.

                                                                                                                    The possible values of both these properties is open ended. A provider may very well specify output types and structures that libcrypto doesn't know anything about.

                                                                                                                    "},{"location":"man7/provider-encoder/#subset-selections","title":"Subset selections","text":"

                                                                                                                    Sometimes, an object has more than one subset of data that is interesting to treat separately or together. It's possible to specify what subsets are to be encoded, with a set of bits selection that are passed in an int.

                                                                                                                    This set of bits depend entirely on what kind of provider-side object is passed. For example, those bits are assumed to be the same as those used with provider-keymgmt(7) (see \"Key Objects\" in provider-keymgmt(7)) when the object is an asymmetric keypair.

                                                                                                                    ENCODER implementations are free to regard the selection as a set of hints, but must do so with care. In the end, the output must make sense, and if there's a corresponding decoder, the resulting decoded object must match the original object that was encoded.

                                                                                                                    OSSL_FUNC_encoder_does_selection() should tell if a particular implementation supports any of the combinations given by selection.

                                                                                                                    "},{"location":"man7/provider-encoder/#context-functions","title":"Context functions","text":"

                                                                                                                    OSSL_FUNC_encoder_newctx() returns a context to be used with the rest of the functions.

                                                                                                                    OSSL_FUNC_encoder_freectx() frees the given ctx, if it was created by OSSL_FUNC_encoder_newctx().

                                                                                                                    OSSL_FUNC_encoder_set_ctx_params() sets context data according to parameters from params that it recognises. Unrecognised parameters should be ignored. Passing NULL for params should return true.

                                                                                                                    OSSL_FUNC_encoder_settable_ctx_params() returns a constant OSSL_PARAM(3) array describing the parameters that OSSL_FUNC_encoder_set_ctx_params() can handle.

                                                                                                                    See OSSL_PARAM(3) for further details on the parameters structure used by OSSL_FUNC_encoder_set_ctx_params() and OSSL_FUNC_encoder_settable_ctx_params().

                                                                                                                    "},{"location":"man7/provider-encoder/#import-functions","title":"Import functions","text":"

                                                                                                                    A provider-native object may be associated with a foreign provider, and may therefore be unsuitable for direct use with a given ENCODER implementation. Provided that the foreign provider's implementation to handle the object has a function to export that object in OSSL_PARAM(3) array form, the ENCODER implementation should be able to import that array and create a suitable object to be passed to OSSL_FUNC_encoder_encode()'s obj_raw.

                                                                                                                    OSSL_FUNC_encoder_import_object() should import the subset of params given with selection to create a provider-native object that can be passed as obj_raw to OSSL_FUNC_encoder_encode().

                                                                                                                    OSSL_FUNC_encoder_free_object() should free the object that was created with OSSL_FUNC_encoder_import_object().

                                                                                                                    "},{"location":"man7/provider-encoder/#encoding-functions","title":"Encoding functions","text":"

                                                                                                                    OSSL_FUNC_encoder_encode() should take a provider-native object (in obj_raw) or an object abstraction (in obj_abstract), and should output the object in encoded form to the OSSL_CORE_BIO. The selection bits, if relevant, should determine in greater detail what will be output. The encoding functions also take an OSSL_PASSPHRASE_CALLBACK(3) function pointer along with a pointer to application data cbarg, which should be used when a pass phrase prompt is needed.

                                                                                                                    "},{"location":"man7/provider-encoder/#encoder-operation-parameters","title":"Encoder operation parameters","text":"

                                                                                                                    Operation parameters currently recognised by built-in encoders are as follows:

                                                                                                                    • \"cipher\" (OSSL_ENCODER_PARAM_CIPHER)

                                                                                                                      The name of the encryption cipher to be used when generating encrypted encoding. This is used when encoding private keys, as well as other objects that need protection.

                                                                                                                      If this name is invalid for the encoding implementation, the implementation should refuse to perform the encoding, i.e. OSSL_FUNC_encoder_encode_data() and OSSL_FUNC_encoder_encode_object() should return an error.

                                                                                                                    • \"properties\" (OSSL_ENCODER_PARAM_PROPERTIES)

                                                                                                                      The properties to be queried when trying to fetch the algorithm given with the \"cipher\" parameter. This must be given together with the \"cipher\" parameter to be considered valid.

                                                                                                                      The encoding implementation isn't obligated to use this value. However, it is recommended that implementations that do not handle property strings return an error on receiving this parameter unless its value NULL or the empty string.

                                                                                                                    • \"save-parameters\" (OSSL_ENCODER_PARAM_SAVE_PARAMETERS) <integer>

                                                                                                                      If set to 0 disables saving of key domain parameters. Default is 1. It currently has an effect only on DSA keys.

                                                                                                                    • Parameters currently recognised by the built-in pass phrase callback:

                                                                                                                      • \"info\" (OSSL_PASSPHRASE_PARAM_INFO)

                                                                                                                        A string of information that will become part of the pass phrase prompt. This could be used to give the user information on what kind of object it's being prompted for.

                                                                                                                        "},{"location":"man7/provider-encoder/#return-values","title":"RETURN VALUES","text":"

                                                                                                                        OSSL_FUNC_encoder_newctx() returns a pointer to a context, or NULL on failure.

                                                                                                                        OSSL_FUNC_encoder_set_ctx_params() returns 1, unless a recognised parameter was invalid or caused an error, for which 0 is returned.

                                                                                                                        OSSL_FUNC_encoder_settable_ctx_params() returns a pointer to an array of constant OSSL_PARAM(3) elements.

                                                                                                                        OSSL_FUNC_encoder_does_selection() returns 1 if the encoder implementation supports any of the selection bits, otherwise 0.

                                                                                                                        OSSL_FUNC_encoder_encode() returns 1 on success, or 0 on failure.

                                                                                                                        "},{"location":"man7/provider-encoder/#see-also","title":"SEE ALSO","text":"

                                                                                                                        provider(7)

                                                                                                                        "},{"location":"man7/provider-encoder/#history","title":"HISTORY","text":"

                                                                                                                        The ENCODER interface was introduced in OpenSSL 3.0.

                                                                                                                        "},{"location":"man7/provider-encoder/#copyright","title":"COPYRIGHT","text":"

                                                                                                                        Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                        "},{"location":"man7/provider-kdf/","title":"provider-kdf","text":""},{"location":"man7/provider-kdf/#name","title":"NAME","text":"

                                                                                                                        provider-kdf - The KDF library <-> provider functions

                                                                                                                        "},{"location":"man7/provider-kdf/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                        #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_kdf_newctx(void *provctx);\nvoid OSSL_FUNC_kdf_freectx(void *kctx);\nvoid *OSSL_FUNC_kdf_dupctx(void *src);\n\n/* Encryption/decryption */\nint OSSL_FUNC_kdf_reset(void *kctx);\nint OSSL_FUNC_kdf_derive(void *kctx, unsigned char *key, size_t keylen,\n                         const OSSL_PARAM params[]);\n\n/* KDF parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_kdf_gettable_params(void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_kdf_gettable_ctx_params(void *kcxt, void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_kdf_settable_ctx_params(void *kcxt, void *provctx);\n\n/* KDF parameters */\nint OSSL_FUNC_kdf_get_params(OSSL_PARAM params[]);\nint OSSL_FUNC_kdf_get_ctx_params(void *kctx, OSSL_PARAM params[]);\nint OSSL_FUNC_kdf_set_ctx_params(void *kctx, const OSSL_PARAM params[]);\n
                                                                                                                        "},{"location":"man7/provider-kdf/#description","title":"DESCRIPTION","text":"

                                                                                                                        This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                        The KDF operation enables providers to implement KDF algorithms and make them available to applications via the API functions EVP_KDF_CTX_reset(3), and EVP_KDF_derive(3).

                                                                                                                        All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                        All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_kdf_newctx() has these:

                                                                                                                        typedef void *(OSSL_FUNC_kdf_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_kdf_newctx_fn\n    OSSL_FUNC_kdf_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                        OSSL_DISPATCH(3) array entries are identified by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                        OSSL_FUNC_kdf_newctx               OSSL_FUNC_KDF_NEWCTX\nOSSL_FUNC_kdf_freectx              OSSL_FUNC_KDF_FREECTX\nOSSL_FUNC_kdf_dupctx               OSSL_FUNC_KDF_DUPCTX\n\nOSSL_FUNC_kdf_reset                OSSL_FUNC_KDF_RESET\nOSSL_FUNC_kdf_derive               OSSL_FUNC_KDF_DERIVE\n\nOSSL_FUNC_kdf_get_params           OSSL_FUNC_KDF_GET_PARAMS\nOSSL_FUNC_kdf_get_ctx_params       OSSL_FUNC_KDF_GET_CTX_PARAMS\nOSSL_FUNC_kdf_set_ctx_params       OSSL_FUNC_KDF_SET_CTX_PARAMS\n\nOSSL_FUNC_kdf_gettable_params      OSSL_FUNC_KDF_GETTABLE_PARAMS\nOSSL_FUNC_kdf_gettable_ctx_params  OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS\nOSSL_FUNC_kdf_settable_ctx_params  OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS\n

                                                                                                                        A KDF algorithm implementation may not implement all of these functions. In order to be a consistent set of functions, at least the following functions must be implemented: OSSL_FUNC_kdf_newctx(), OSSL_FUNC_kdf_freectx(), OSSL_FUNC_kdf_set_ctx_params(), OSSL_FUNC_kdf_derive(). All other functions are optional.

                                                                                                                        "},{"location":"man7/provider-kdf/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                        OSSL_FUNC_kdf_newctx() should create and return a pointer to a provider side structure for holding context information during a KDF operation. A pointer to this context will be passed back in a number of the other KDF operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                        OSSL_FUNC_kdf_freectx() is passed a pointer to the provider side KDF context in the kctx parameter. If it receives NULL as kctx value, it should not do anything other than return. This function should free any resources associated with that context.

                                                                                                                        OSSL_FUNC_kdf_dupctx() should duplicate the provider side KDF context in the kctx parameter and return the duplicate copy.

                                                                                                                        "},{"location":"man7/provider-kdf/#encryptiondecryption-functions","title":"Encryption/Decryption Functions","text":"

                                                                                                                        OSSL_FUNC_kdf_reset() initialises a KDF operation given a provider side KDF context in the kctx parameter.

                                                                                                                        OSSL_FUNC_kdf_derive() performs the KDF operation after processing the params as per OSSL_FUNC_kdf_set_ctx_params(). The kctx parameter contains a pointer to the provider side context. The resulting key of the desired keylen should be written to key. If the algorithm does not support the requested keylen the function must return error.

                                                                                                                        "},{"location":"man7/provider-kdf/#kdf-parameters","title":"KDF Parameters","text":"

                                                                                                                        See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                        OSSL_FUNC_kdf_get_params() gets details of parameter values associated with the provider algorithm and stores them in params.

                                                                                                                        OSSL_FUNC_kdf_set_ctx_params() sets KDF parameters associated with the given provider side KDF context kctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                        OSSL_FUNC_kdf_get_ctx_params() retrieves gettable parameter values associated with the given provider side KDF context kctx and stores them in params. Passing NULL for params should return true.

                                                                                                                        OSSL_FUNC_kdf_gettable_params(), OSSL_FUNC_kdf_gettable_ctx_params(), and OSSL_FUNC_kdf_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_kdf_get_params(), OSSL_FUNC_kdf_get_ctx_params(), and OSSL_FUNC_kdf_set_ctx_params() can handle, respectively. OSSL_FUNC_kdf_gettable_ctx_params() and OSSL_FUNC_kdf_settable_ctx_params() will return the parameters associated with the provider side context kctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                        Parameters currently recognised by built-in KDFs are as follows. Not all parameters are relevant to, or are understood by all KDFs:

                                                                                                                        • \"size\" (OSSL_KDF_PARAM_SIZE) <unsigned integer>

                                                                                                                          Gets the output size from the associated KDF ctx. If the algorithm produces a variable amount of output, SIZE_MAX should be returned. If the input parameters required to calculate the fixed output size have not yet been supplied, 0 should be returned indicating an error.

                                                                                                                        • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                                                                                                          Sets the key in the associated KDF ctx.

                                                                                                                        • \"secret\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                                                                                                          Sets the secret in the associated KDF ctx.

                                                                                                                        • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>

                                                                                                                          Sets the password in the associated KDF ctx.

                                                                                                                        • \"cipher\" (OSSL_KDF_PARAM_CIPHER)

                                                                                                                        • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                                                                                                        • \"mac\" (OSSL_KDF_PARAM_MAC)

                                                                                                                          Sets the name of the underlying cipher, digest or MAC to be used. It must name a suitable algorithm for the KDF that's being used.

                                                                                                                        • \"maclen\" (OSSL_KDF_PARAM_MAC_SIZE) <octet string>

                                                                                                                          Sets the length of the MAC in the associated KDF ctx.

                                                                                                                        • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                                                                                                          Sets the properties to be queried when trying to fetch the underlying algorithm. This must be given together with the algorithm naming parameter to be considered valid.

                                                                                                                        • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

                                                                                                                          Sets the number of iterations in the associated KDF ctx.

                                                                                                                        • \"mode\" (OSSL_KDF_PARAM_MODE)

                                                                                                                          Sets the mode in the associated KDF ctx.

                                                                                                                        • \"pkcs5\" (OSSL_KDF_PARAM_PKCS5) <integer>

                                                                                                                          Enables or disables the SP800-132 compliance checks. A mode of 0 enables the compliance checks.

                                                                                                                          The checks performed are:

                                                                                                                            • the iteration count is at least 1000.
                                                                                                                            • the salt length is at least 128 bits.
                                                                                                                            • the derived key length is at least 112 bits.
                                                                                                                        • \"ukm\" (OSSL_KDF_PARAM_UKM) <octet string>

                                                                                                                          Sets an optional random string that is provided by the sender called \"partyAInfo\". In CMS this is the user keying material.

                                                                                                                        • \"cekalg\" (OSSL_KDF_PARAM_CEK_ALG)

                                                                                                                          Sets the CEK wrapping algorithm name in the associated KDF ctx.

                                                                                                                        • \"n\" (OSSL_KDF_PARAM_SCRYPT_N) <unsigned integer>

                                                                                                                          Sets the scrypt work factor parameter N in the associated KDF ctx.

                                                                                                                        • \"r\" (OSSL_KDF_PARAM_SCRYPT_R) <unsigned integer>

                                                                                                                          Sets the scrypt work factor parameter r in the associated KDF ctx.

                                                                                                                        • \"p\" (OSSL_KDF_PARAM_SCRYPT_P) <unsigned integer>

                                                                                                                          Sets the scrypt work factor parameter p in the associated KDF ctx.

                                                                                                                        • \"maxmem_bytes\" (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>

                                                                                                                          Sets the scrypt work factor parameter maxmem in the associated KDF ctx.

                                                                                                                        • \"prefix\" (OSSL_KDF_PARAM_PREFIX) <octet string>

                                                                                                                          Sets the prefix string using by the TLS 1.3 version of HKDF in the associated KDF ctx.

                                                                                                                        • \"label\" (OSSL_KDF_PARAM_LABEL) <octet string>

                                                                                                                          Sets the label string using by the TLS 1.3 version of HKDF in the associated KDF ctx.

                                                                                                                        • \"data\" (OSSL_KDF_PARAM_DATA) <octet string>

                                                                                                                          Sets the context string using by the TLS 1.3 version of HKDF in the associated KDF ctx.

                                                                                                                        • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                                                                                                          Sets the optional shared info in the associated KDF ctx.

                                                                                                                        • \"seed\" (OSSL_KDF_PARAM_SEED) <octet string>

                                                                                                                          Sets the IV in the associated KDF ctx.

                                                                                                                        • \"xcghash\" (OSSL_KDF_PARAM_SSHKDF_XCGHASH) <octet string>

                                                                                                                          Sets the xcghash in the associated KDF ctx.

                                                                                                                        • \"session_id\" (OSSL_KDF_PARAM_SSHKDF_SESSION_ID) <octet string>

                                                                                                                          Sets the session ID in the associated KDF ctx.

                                                                                                                        • \"type\" (OSSL_KDF_PARAM_SSHKDF_TYPE)

                                                                                                                          Sets the SSH KDF type parameter in the associated KDF ctx. There are six supported types:

                                                                                                                          • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV

                                                                                                                            The Initial IV from client to server. A single char of value 65 (ASCII char 'A').

                                                                                                                          • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI

                                                                                                                            The Initial IV from server to client A single char of value 66 (ASCII char 'B').

                                                                                                                          • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV

                                                                                                                            The Encryption Key from client to server A single char of value 67 (ASCII char 'C').

                                                                                                                          • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI

                                                                                                                            The Encryption Key from server to client A single char of value 68 (ASCII char 'D').

                                                                                                                          • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV

                                                                                                                            The Integrity Key from client to server A single char of value 69 (ASCII char 'E').

                                                                                                                          • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI

                                                                                                                            The Integrity Key from client to server A single char of value 70 (ASCII char 'F').

                                                                                                                        • \"constant\" (OSSL_KDF_PARAM_CONSTANT) <octet string>

                                                                                                                          Sets the constant value in the associated KDF ctx.

                                                                                                                        • \"id\" (OSSL_KDF_PARAM_PKCS12_ID) <integer>

                                                                                                                          Sets the intended usage of the output bits in the associated KDF ctx. It is defined as per RFC 7292 section B.3.

                                                                                                                        • "},{"location":"man7/provider-kdf/#return-values","title":"RETURN VALUES","text":"

                                                                                                                          OSSL_FUNC_kdf_newctx() and OSSL_FUNC_kdf_dupctx() should return the newly created provider side KDF context, or NULL on failure.

                                                                                                                          OSSL_FUNC_kdf_derive(), OSSL_FUNC_kdf_get_params(), OSSL_FUNC_kdf_get_ctx_params() and OSSL_FUNC_kdf_set_ctx_params() should return 1 for success or 0 on error.

                                                                                                                          OSSL_FUNC_kdf_gettable_params(), OSSL_FUNC_kdf_gettable_ctx_params() and OSSL_FUNC_kdf_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                          "},{"location":"man7/provider-kdf/#notes","title":"NOTES","text":"

                                                                                                                          The KDF life-cycle is described in life_cycle-kdf(7). Providers should ensure that the various transitions listed there are supported. At some point the EVP layer will begin enforcing the listed transitions.

                                                                                                                          "},{"location":"man7/provider-kdf/#see-also","title":"SEE ALSO","text":"

                                                                                                                          provider(7), life_cycle-kdf(7), EVP_KDF(3).

                                                                                                                          "},{"location":"man7/provider-kdf/#history","title":"HISTORY","text":"

                                                                                                                          The provider KDF interface was introduced in OpenSSL 3.0.

                                                                                                                          "},{"location":"man7/provider-kdf/#copyright","title":"COPYRIGHT","text":"

                                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                          "},{"location":"man7/provider-kem/","title":"provider-kem","text":""},{"location":"man7/provider-kem/#name","title":"NAME","text":"

                                                                                                                          provider-kem - The kem library <-> provider functions

                                                                                                                          "},{"location":"man7/provider-kem/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                          #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_kem_newctx(void *provctx);\nvoid OSSL_FUNC_kem_freectx(void *ctx);\nvoid *OSSL_FUNC_kem_dupctx(void *ctx);\n\n/* Encapsulation */\nint OSSL_FUNC_kem_encapsulate_init(void *ctx, void *provkey, const char *name,\n                                   const OSSL_PARAM params[]);\nint OSSL_FUNC_kem_encapsulate(void *ctx, unsigned char *out, size_t *outlen,\n                              unsigned char *secret, size_t *secretlen);\n\n/* Decapsulation */\nint OSSL_FUNC_kem_decapsulate_init(void *ctx, void *provkey, const char *name);\nint OSSL_FUNC_kem_decapsulate(void *ctx, unsigned char *out, size_t *outlen,\n                              const unsigned char *in, size_t inlen);\n\n/* KEM parameters */\nint OSSL_FUNC_kem_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_kem_gettable_ctx_params(void *ctx, void *provctx);\nint OSSL_FUNC_kem_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_kem_settable_ctx_params(void *ctx, void *provctx);\n
                                                                                                                          "},{"location":"man7/provider-kem/#description","title":"DESCRIPTION","text":"

                                                                                                                          This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                          The asymmetric kem (OSSL_OP_KEM) operation enables providers to implement asymmetric kem algorithms and make them available to applications via the API functions EVP_PKEY_encapsulate(3), EVP_PKEY_decapsulate(3) and other related functions.

                                                                                                                          All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                          All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_kem_newctx() has these:

                                                                                                                          typedef void *(OSSL_FUNC_kem_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_kem_newctx_fn\n    OSSL_FUNC_kem_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                          OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                          OSSL_FUNC_kem_newctx               OSSL_FUNC_KEM_NEWCTX\nOSSL_FUNC_kem_freectx              OSSL_FUNC_KEM_FREECTX\nOSSL_FUNC_kem_dupctx               OSSL_FUNC_KEM_DUPCTX\n\nOSSL_FUNC_kem_encapsulate_init     OSSL_FUNC_KEM_ENCAPSULATE_INIT\nOSSL_FUNC_kem_encapsulate          OSSL_FUNC_KEM_ENCAPSULATE\n\nOSSL_FUNC_kem_decapsulate_init     OSSL_FUNC_KEM_DECAPSULATE_INIT\nOSSL_FUNC_kem_decapsulate          OSSL_FUNC_KEM_DECAPSULATE\n\nOSSL_FUNC_kem_get_ctx_params       OSSL_FUNC_KEM_GET_CTX_PARAMS\nOSSL_FUNC_kem_gettable_ctx_params  OSSL_FUNC_KEM_GETTABLE_CTX_PARAMS\nOSSL_FUNC_kem_set_ctx_params       OSSL_FUNC_KEM_SET_CTX_PARAMS\nOSSL_FUNC_kem_settable_ctx_params  OSSL_FUNC_KEM_SETTABLE_CTX_PARAMS\n

                                                                                                                          An asymmetric kem algorithm implementation may not implement all of these functions. In order to be a consistent set of functions a provider must implement OSSL_FUNC_kem_newctx and OSSL_FUNC_kem_freectx. It must also implement both of OSSL_FUNC_kem_encapsulate_init and OSSL_FUNC_kem_encapsulate, or both of OSSL_FUNC_kem_decapsulate_init and OSSL_FUNC_kem_decapsulate. OSSL_FUNC_kem_get_ctx_params is optional but if it is present then so must OSSL_FUNC_kem_gettable_ctx_params. Similarly, OSSL_FUNC_kem_set_ctx_params is optional but if it is present then so must OSSL_FUNC_kem_settable_ctx_params.

                                                                                                                          An asymmetric kem algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                                          "},{"location":"man7/provider-kem/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                          OSSL_FUNC_kem_newctx() should create and return a pointer to a provider side structure for holding context information during an asymmetric kem operation. A pointer to this context will be passed back in a number of the other asymmetric kem operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                          OSSL_FUNC_kem_freectx() is passed a pointer to the provider side asymmetric kem context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                                          OSSL_FUNC_kem_dupctx() should duplicate the provider side asymmetric kem context in the ctx parameter and return the duplicate copy.

                                                                                                                          "},{"location":"man7/provider-kem/#asymmetric-key-encapsulation-functions","title":"Asymmetric Key Encapsulation Functions","text":"

                                                                                                                          OSSL_FUNC_kem_encapsulate_init() initialises a context for an asymmetric encapsulation given a provider side asymmetric kem context in the ctx parameter, a pointer to a provider key object in the provkey parameter and the name of the algorithm. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_kem_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                          OSSL_FUNC_kem_encapsulate() performs the actual encapsulation itself. A previously initialised asymmetric kem context is passed in the ctx parameter. Unless out is NULL, the data to be encapsulated is internally generated, and returned into the buffer pointed to by the secret parameter and the encapsulated data should also be written to the location pointed to by the out parameter. The length of the encapsulated data should be written to *outlen and the length of the generated secret should be written to *secretlen.

                                                                                                                          If out is NULL then the maximum length of the encapsulated data should be written to *outlen, and the maximum length of the generated secret should be written to *secretlen.

                                                                                                                          "},{"location":"man7/provider-kem/#decapsulation-functions","title":"Decapsulation Functions","text":"

                                                                                                                          OSSL_FUNC_kem_decapsulate_init() initialises a context for an asymmetric decapsulation given a provider side asymmetric kem context in the ctx parameter, a pointer to a provider key object in the provkey parameter, and a name of the algorithm. The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                          OSSL_FUNC_kem_decapsulate() performs the actual decapsulation itself. A previously initialised asymmetric kem context is passed in the ctx parameter. The data to be decapsulated is pointed to by the in parameter which is inlen bytes long. Unless out is NULL, the decapsulated data should be written to the location pointed to by the out parameter. The length of the decapsulated data should be written to *outlen. If out is NULL then the maximum length of the decapsulated data should be written to *outlen.

                                                                                                                          "},{"location":"man7/provider-kem/#asymmetric-key-encapsulation-parameters","title":"Asymmetric Key Encapsulation Parameters","text":"

                                                                                                                          See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_kem_get_ctx_params() and OSSL_FUNC_kem_set_ctx_params() functions.

                                                                                                                          OSSL_FUNC_kem_get_ctx_params() gets asymmetric kem parameters associated with the given provider side asymmetric kem context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                                          OSSL_FUNC_kem_set_ctx_params() sets the asymmetric kem parameters associated with the given provider side asymmetric kem context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                          No parameters are currently recognised by built-in asymmetric kem algorithms.

                                                                                                                          OSSL_FUNC_kem_gettable_ctx_params() and OSSL_FUNC_kem_settable_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters, i.e. parameters that can be used with OSSL_FUNC_kem_get_ctx_params() and OSSL_FUNC_kem_set_ctx_params() respectively.

                                                                                                                          "},{"location":"man7/provider-kem/#return-values","title":"RETURN VALUES","text":"

                                                                                                                          OSSL_FUNC_kem_newctx() and OSSL_FUNC_kem_dupctx() should return the newly created provider side asymmetric kem context, or NULL on failure.

                                                                                                                          All other functions should return 1 for success or 0 on error.

                                                                                                                          "},{"location":"man7/provider-kem/#see-also","title":"SEE ALSO","text":"

                                                                                                                          provider(7)

                                                                                                                          "},{"location":"man7/provider-kem/#history","title":"HISTORY","text":"

                                                                                                                          The provider KEM interface was introduced in OpenSSL 3.0.

                                                                                                                          "},{"location":"man7/provider-kem/#copyright","title":"COPYRIGHT","text":"

                                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                          "},{"location":"man7/provider-keyexch/","title":"provider-keyexch","text":""},{"location":"man7/provider-keyexch/#name","title":"NAME","text":"

                                                                                                                          provider-keyexch - The keyexch library <-> provider functions

                                                                                                                          "},{"location":"man7/provider-keyexch/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                          #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_keyexch_newctx(void *provctx);\nvoid OSSL_FUNC_keyexch_freectx(void *ctx);\nvoid *OSSL_FUNC_keyexch_dupctx(void *ctx);\n\n/* Shared secret derivation */\nint OSSL_FUNC_keyexch_init(void *ctx, void *provkey,\n                           const OSSL_PARAM params[]);\nint OSSL_FUNC_keyexch_set_peer(void *ctx, void *provkey);\nint OSSL_FUNC_keyexch_derive(void *ctx, unsigned char *secret, size_t *secretlen,\n                             size_t outlen);\n\n/* Key Exchange parameters */\nint OSSL_FUNC_keyexch_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keyexch_settable_ctx_params(void *ctx,\n                                                        void *provctx);\nint OSSL_FUNC_keyexch_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keyexch_gettable_ctx_params(void *ctx,\n                                                        void *provctx);\n
                                                                                                                          "},{"location":"man7/provider-keyexch/#description","title":"DESCRIPTION","text":"

                                                                                                                          This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                          The key exchange (OSSL_OP_KEYEXCH) operation enables providers to implement key exchange algorithms and make them available to applications via EVP_PKEY_derive(3) and other related functions).

                                                                                                                          All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                          All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_keyexch_newctx() has these:

                                                                                                                          typedef void *(OSSL_FUNC_keyexch_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_keyexch_newctx_fn\n    OSSL_FUNC_keyexch_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                          OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                          OSSL_FUNC_keyexch_newctx                OSSL_FUNC_KEYEXCH_NEWCTX\nOSSL_FUNC_keyexch_freectx               OSSL_FUNC_KEYEXCH_FREECTX\nOSSL_FUNC_keyexch_dupctx                OSSL_FUNC_KEYEXCH_DUPCTX\n\nOSSL_FUNC_keyexch_init                  OSSL_FUNC_KEYEXCH_INIT\nOSSL_FUNC_keyexch_set_peer              OSSL_FUNC_KEYEXCH_SET_PEER\nOSSL_FUNC_keyexch_derive                OSSL_FUNC_KEYEXCH_DERIVE\n\nOSSL_FUNC_keyexch_set_ctx_params        OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS\nOSSL_FUNC_keyexch_settable_ctx_params   OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS\nOSSL_FUNC_keyexch_get_ctx_params        OSSL_FUNC_KEYEXCH_GET_CTX_PARAMS\nOSSL_FUNC_keyexch_gettable_ctx_params   OSSL_FUNC_KEYEXCH_GETTABLE_CTX_PARAMS\n

                                                                                                                          A key exchange algorithm implementation may not implement all of these functions. In order to be a consistent set of functions a provider must implement OSSL_FUNC_keyexch_newctx, OSSL_FUNC_keyexch_freectx, OSSL_FUNC_keyexch_init and OSSL_FUNC_keyexch_derive. All other functions are optional.

                                                                                                                          A key exchange algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                                          "},{"location":"man7/provider-keyexch/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                          OSSL_FUNC_keyexch_newctx() should create and return a pointer to a provider side structure for holding context information during a key exchange operation. A pointer to this context will be passed back in a number of the other key exchange operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                          OSSL_FUNC_keyexch_freectx() is passed a pointer to the provider side key exchange context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                                          OSSL_FUNC_keyexch_dupctx() should duplicate the provider side key exchange context in the ctx parameter and return the duplicate copy.

                                                                                                                          "},{"location":"man7/provider-keyexch/#shared-secret-derivation-functions","title":"Shared Secret Derivation Functions","text":"

                                                                                                                          OSSL_FUNC_keyexch_init() initialises a key exchange operation given a provider side key exchange context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_keyexch_set_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                          OSSL_FUNC_keyexch_set_peer() is called to supply the peer's public key (in the provkey parameter) to be used when deriving the shared secret. It is also passed a previously initialised key exchange context in the ctx parameter. The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                          OSSL_FUNC_keyexch_derive() performs the actual key exchange itself by deriving a shared secret. A previously initialised key exchange context is passed in the ctx parameter. The derived secret should be written to the location secret which should not exceed outlen bytes. The length of the shared secret should be written to *secretlen. If secret is NULL then the maximum length of the shared secret should be written to *secretlen.

                                                                                                                          "},{"location":"man7/provider-keyexch/#key-exchange-parameters-functions","title":"Key Exchange Parameters Functions","text":"

                                                                                                                          OSSL_FUNC_keyexch_set_ctx_params() sets key exchange parameters associated with the given provider side key exchange context ctx to params, see \"Common Key Exchange parameters\". Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                          OSSL_FUNC_keyexch_get_ctx_params() gets key exchange parameters associated with the given provider side key exchange context ctx into params, see \"Common Key Exchange parameters\". Passing NULL for params should return true.

                                                                                                                          OSSL_FUNC_keyexch_settable_ctx_params() yields a constant OSSL_PARAM(3) array that describes the settable parameters, i.e. parameters that can be used with OP_signature_set_ctx_params(). If OSSL_FUNC_keyexch_settable_ctx_params() is present, OSSL_FUNC_keyexch_set_ctx_params() must also be present, and vice versa. Similarly, OSSL_FUNC_keyexch_gettable_ctx_params() yields a constant OSSL_PARAM(3) array that describes the gettable parameters, i.e. parameters that can be handled by OP_signature_get_ctx_params(). If OSSL_FUNC_keyexch_gettable_ctx_params() is present, OSSL_FUNC_keyexch_get_ctx_params() must also be present, and vice versa.

                                                                                                                          Notice that not all settable parameters are also gettable, and vice versa.

                                                                                                                          "},{"location":"man7/provider-keyexch/#common-key-exchange-parameters","title":"Common Key Exchange parameters","text":"

                                                                                                                          See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_keyexch_set_ctx_params() and OSSL_FUNC_keyexch_get_ctx_params() functions.

                                                                                                                          Common parameters currently recognised by built-in key exchange algorithms are as follows.

                                                                                                                          • \"kdf-type\" (OSSL_EXCHANGE_PARAM_KDF_TYPE)

                                                                                                                            Sets or gets the Key Derivation Function type to apply within the associated key exchange ctx.

                                                                                                                          • \"kdf-digest\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST)

                                                                                                                            Sets or gets the Digest algorithm to be used as part of the Key Derivation Function associated with the given key exchange ctx.

                                                                                                                          • \"kdf-digest-props\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS)

                                                                                                                            Sets properties to be used upon look up of the implementation for the selected Digest algorithm for the Key Derivation Function associated with the given key exchange ctx.

                                                                                                                          • \"kdf-outlen\" (OSSL_EXCHANGE_PARAM_KDF_OUTLEN) <unsigned integer>

                                                                                                                            Sets or gets the desired size for the output of the chosen Key Derivation Function associated with the given key exchange ctx. The length of the \"kdf-outlen\" parameter should not exceed that of a size_t.

                                                                                                                          • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string>

                                                                                                                            Sets the User Key Material to be used as part of the selected Key Derivation Function associated with the given key exchange ctx.

                                                                                                                          • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string ptr>

                                                                                                                            Gets a pointer to the User Key Material to be used as part of the selected Key Derivation Function associated with the given key exchange ctx. Providers usually do not need to support this gettable parameter as its sole purpose is to support functionality of the deprecated EVP_PKEY_CTX_get0_ecdh_kdf_ukm() and EVP_PKEY_CTX_get0_dh_kdf_ukm() functions.

                                                                                                                          • "},{"location":"man7/provider-keyexch/#return-values","title":"RETURN VALUES","text":"

                                                                                                                            OSSL_FUNC_keyexch_newctx() and OSSL_FUNC_keyexch_dupctx() should return the newly created provider side key exchange context, or NULL on failure.

                                                                                                                            OSSL_FUNC_keyexch_init(), OSSL_FUNC_keyexch_set_peer(), OSSL_FUNC_keyexch_derive(), OSSL_FUNC_keyexch_set_params(), and OSSL_FUNC_keyexch_get_params() should return 1 for success or 0 on error.

                                                                                                                            OSSL_FUNC_keyexch_settable_ctx_params() and OSSL_FUNC_keyexch_gettable_ctx_params() should always return a constant OSSL_PARAM(3) array.

                                                                                                                            "},{"location":"man7/provider-keyexch/#see-also","title":"SEE ALSO","text":"

                                                                                                                            provider(7)

                                                                                                                            "},{"location":"man7/provider-keyexch/#history","title":"HISTORY","text":"

                                                                                                                            The provider KEYEXCH interface was introduced in OpenSSL 3.0.

                                                                                                                            "},{"location":"man7/provider-keyexch/#copyright","title":"COPYRIGHT","text":"

                                                                                                                            Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                            "},{"location":"man7/provider-keymgmt/","title":"provider-keymgmt","text":""},{"location":"man7/provider-keymgmt/#name","title":"NAME","text":"

                                                                                                                            provider-keymgmt - The KEYMGMT library <-> provider functions

                                                                                                                            "},{"location":"man7/provider-keymgmt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                            #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Key object (keydata) creation and destruction */\nvoid *OSSL_FUNC_keymgmt_new(void *provctx);\nvoid OSSL_FUNC_keymgmt_free(void *keydata);\n\n/* Generation, a more complex constructor */\nvoid *OSSL_FUNC_keymgmt_gen_init(void *provctx, int selection,\n                                 const OSSL_PARAM params[]);\nint OSSL_FUNC_keymgmt_gen_set_template(void *genctx, void *template);\nint OSSL_FUNC_keymgmt_gen_set_params(void *genctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_gen_settable_params(void *genctx,\n                                                        void *provctx);\nvoid *OSSL_FUNC_keymgmt_gen(void *genctx, OSSL_CALLBACK *cb, void *cbarg);\nvoid OSSL_FUNC_keymgmt_gen_cleanup(void *genctx);\n\n/* Key loading by object reference, also a constructor */\nvoid *OSSL_FUNC_keymgmt_load(const void *reference, size_t *reference_sz);\n\n/* Key object information */\nint OSSL_FUNC_keymgmt_get_params(void *keydata, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_gettable_params(void *provctx);\nint OSSL_FUNC_keymgmt_set_params(void *keydata, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_settable_params(void *provctx);\n\n/* Key object content checks */\nint OSSL_FUNC_keymgmt_has(const void *keydata, int selection);\nint OSSL_FUNC_keymgmt_match(const void *keydata1, const void *keydata2,\n                            int selection);\n\n/* Discovery of supported operations */\nconst char *OSSL_FUNC_keymgmt_query_operation_name(int operation_id);\n\n/* Key object import and export functions */\nint OSSL_FUNC_keymgmt_import(void *keydata, int selection, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_import_types(int selection);\nint OSSL_FUNC_keymgmt_export(void *keydata, int selection,\n                             OSSL_CALLBACK *param_cb, void *cbarg);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_export_types(int selection);\n\n/* Key object duplication, a constructor */\nvoid *OSSL_FUNC_keymgmt_dup(const void *keydata_from, int selection);\n\n/* Key object validation */\nint OSSL_FUNC_keymgmt_validate(const void *keydata, int selection, int checktype);\n
                                                                                                                            "},{"location":"man7/provider-keymgmt/#description","title":"DESCRIPTION","text":"

                                                                                                                            The KEYMGMT operation doesn't have much public visibility in OpenSSL libraries, it's rather an internal operation that's designed to work in tandem with operations that use private/public key pairs.

                                                                                                                            Because the KEYMGMT operation shares knowledge with the operations it works with in tandem, they must belong to the same provider. The OpenSSL libraries will ensure that they do.

                                                                                                                            The primary responsibility of the KEYMGMT operation is to hold the provider side key data for the OpenSSL library EVP_PKEY structure.

                                                                                                                            All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                            All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from a OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_keymgmt_new() has these:

                                                                                                                            typedef void *(OSSL_FUNC_keymgmt_new_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_keymgmt_new_fn\n    OSSL_FUNC_keymgmt_new(const OSSL_DISPATCH *opf);\n

                                                                                                                            OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                            OSSL_FUNC_keymgmt_new                  OSSL_FUNC_KEYMGMT_NEW\nOSSL_FUNC_keymgmt_free                 OSSL_FUNC_KEYMGMT_FREE\n\nOSSL_FUNC_keymgmt_gen_init             OSSL_FUNC_KEYMGMT_GEN_INIT\nOSSL_FUNC_keymgmt_gen_set_template     OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE\nOSSL_FUNC_keymgmt_gen_set_params       OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS\nOSSL_FUNC_keymgmt_gen_settable_params  OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS\nOSSL_FUNC_keymgmt_gen                  OSSL_FUNC_KEYMGMT_GEN\nOSSL_FUNC_keymgmt_gen_cleanup          OSSL_FUNC_KEYMGMT_GEN_CLEANUP\n\nOSSL_FUNC_keymgmt_load                 OSSL_FUNC_KEYMGMT_LOAD\n\nOSSL_FUNC_keymgmt_get_params           OSSL_FUNC_KEYMGMT_GET_PARAMS\nOSSL_FUNC_keymgmt_gettable_params      OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS\nOSSL_FUNC_keymgmt_set_params           OSSL_FUNC_KEYMGMT_SET_PARAMS\nOSSL_FUNC_keymgmt_settable_params      OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS\n\nOSSL_FUNC_keymgmt_query_operation_name OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME\n\nOSSL_FUNC_keymgmt_has                  OSSL_FUNC_KEYMGMT_HAS\nOSSL_FUNC_keymgmt_validate             OSSL_FUNC_KEYMGMT_VALIDATE\nOSSL_FUNC_keymgmt_match                OSSL_FUNC_KEYMGMT_MATCH\n\nOSSL_FUNC_keymgmt_import               OSSL_FUNC_KEYMGMT_IMPORT\nOSSL_FUNC_keymgmt_import_types         OSSL_FUNC_KEYMGMT_IMPORT_TYPES\nOSSL_FUNC_keymgmt_export               OSSL_FUNC_KEYMGMT_EXPORT\nOSSL_FUNC_keymgmt_export_types         OSSL_FUNC_KEYMGMT_EXPORT_TYPES\n\nOSSL_FUNC_keymgmt_dup                  OSSL_FUNC_KEYMGMT_DUP\n
                                                                                                                            "},{"location":"man7/provider-keymgmt/#key-objects","title":"Key Objects","text":"

                                                                                                                            A key object is a collection of data for an asymmetric key, and is represented as keydata in this manual.

                                                                                                                            The exact contents of a key object are defined by the provider, and it is assumed that different operations in one and the same provider use the exact same structure to represent this collection of data, so that for example, a key object that has been created using the KEYMGMT interface that we document here can be passed as is to other provider operations, such as OP_signature_sign_init() (see provider-signature(7)).

                                                                                                                            With some of the KEYMGMT functions, it's possible to select a specific subset of data to handle, governed by the bits in a selection indicator. The bits are:

                                                                                                                            • OSSL_KEYMGMT_SELECT_PRIVATE_KEY

                                                                                                                              Indicating that the private key data in a key object should be considered.

                                                                                                                            • OSSL_KEYMGMT_SELECT_PUBLIC_KEY

                                                                                                                              Indicating that the public key data in a key object should be considered.

                                                                                                                            • OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS

                                                                                                                              Indicating that the domain parameters in a key object should be considered.

                                                                                                                            • OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS

                                                                                                                              Indicating that other parameters in a key object should be considered.

                                                                                                                              Other parameters are key parameters that don't fit any other classification. In other words, this particular selector bit works as a last resort bit bucket selector.

                                                                                                                            Some selector bits have also been combined for easier use:

                                                                                                                            • OSSL_KEYMGMT_SELECT_ALL_PARAMETERS

                                                                                                                              Indicating that all key object parameters should be considered, regardless of their more granular classification.

                                                                                                                              This is a combination of OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS and OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS.

                                                                                                                            • OSSL_KEYMGMT_SELECT_KEYPAIR

                                                                                                                              Indicating that both the whole key pair in a key object should be considered, i.e. the combination of public and private key.

                                                                                                                              This is a combination of OSSL_KEYMGMT_SELECT_PRIVATE_KEY and OSSL_KEYMGMT_SELECT_PUBLIC_KEY.

                                                                                                                            • OSSL_KEYMGMT_SELECT_ALL

                                                                                                                              Indicating that everything in a key object should be considered.

                                                                                                                            The exact interpretation of those bits or how they combine is left to each function where you can specify a selector.

                                                                                                                            It's left to the provider implementation to decide what is reasonable to do with regards to received selector bits and how to do it. Among others, an implementation of OSSL_FUNC_keymgmt_match() might opt to not compare the private half if it has compared the public half, since a match of one half implies a match of the other half.

                                                                                                                            "},{"location":"man7/provider-keymgmt/#constructing-and-destructing-functions","title":"Constructing and Destructing Functions","text":"

                                                                                                                            OSSL_FUNC_keymgmt_new() should create a provider side key object. The provider context provctx is passed and may be incorporated in the key object, but that is not mandatory.

                                                                                                                            OSSL_FUNC_keymgmt_free() should free the passed keydata.

                                                                                                                            OSSL_FUNC_keymgmt_gen_init(), OSSL_FUNC_keymgmt_gen_set_template(), OSSL_FUNC_keymgmt_gen_set_params(), OSSL_FUNC_keymgmt_gen_settable_params(), OSSL_FUNC_keymgmt_gen() and OSSL_FUNC_keymgmt_gen_cleanup() work together as a more elaborate context based key object constructor.

                                                                                                                            OSSL_FUNC_keymgmt_gen_init() should create the key object generation context and initialize it with selections, which will determine what kind of contents the key object to be generated should get. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_keymgmt_set_params().

                                                                                                                            OSSL_FUNC_keymgmt_gen_set_template() should add template to the context genctx. The template is assumed to be a key object constructed with the same KEYMGMT, and from which content that the implementation chooses can be used as a template for the key object to be generated. Typically, the generation of a DSA or DH key would get the domain parameters from this template.

                                                                                                                            OSSL_FUNC_keymgmt_gen_set_params() should set additional parameters from params in the key object generation context genctx.

                                                                                                                            OSSL_FUNC_keymgmt_gen_settable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_keymgmt_gen_set_params() can handle.

                                                                                                                            OSSL_FUNC_keymgmt_gen() should perform the key object generation itself, and return the result. The callback cb should be called at regular intervals with indications on how the key object generation progresses.

                                                                                                                            OSSL_FUNC_keymgmt_gen_cleanup() should clean up and free the key object generation context genctx

                                                                                                                            OSSL_FUNC_keymgmt_load() creates a provider side key object based on a reference object with a size of reference_sz bytes, that only the provider knows how to interpret, but that may come from other operations. Outside the provider, this reference is simply an array of bytes.

                                                                                                                            At least one of OSSL_FUNC_keymgmt_new(), OSSL_FUNC_keymgmt_gen() and OSSL_FUNC_keymgmt_load() are mandatory, as well as OSSL_FUNC_keymgmt_free() and OSSL_FUNC_keymgmt_has(). Additionally, if OSSL_FUNC_keymgmt_gen() is present, OSSL_FUNC_keymgmt_gen_init() and OSSL_FUNC_keymgmt_gen_cleanup() must be present as well.

                                                                                                                            "},{"location":"man7/provider-keymgmt/#key-object-information-functions","title":"Key Object Information Functions","text":"

                                                                                                                            OSSL_FUNC_keymgmt_get_params() should extract information data associated with the given keydata, see \"Common Information Parameters\".

                                                                                                                            OSSL_FUNC_keymgmt_gettable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_keymgmt_get_params() can handle.

                                                                                                                            If OSSL_FUNC_keymgmt_gettable_params() is present, OSSL_FUNC_keymgmt_get_params() must also be present, and vice versa.

                                                                                                                            OSSL_FUNC_keymgmt_set_params() should update information data associated with the given keydata, see \"Common Information Parameters\".

                                                                                                                            OSSL_FUNC_keymgmt_settable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_keymgmt_set_params() can handle.

                                                                                                                            If OSSL_FUNC_keymgmt_settable_params() is present, OSSL_FUNC_keymgmt_set_params() must also be present, and vice versa.

                                                                                                                            "},{"location":"man7/provider-keymgmt/#key-object-checking-functions","title":"Key Object Checking Functions","text":"

                                                                                                                            OSSL_FUNC_keymgmt_query_operation_name() should return the name of the supported algorithm for the operation operation_id. This is similar to provider_query_operation() (see provider-base(7)), but only works as an advisory. If this function is not present, or returns NULL, the caller is free to assume that there's an algorithm from the same provider, of the same name as the one used to fetch the keymgmt and try to use that.

                                                                                                                            OSSL_FUNC_keymgmt_has() should check whether the given keydata contains the subsets of data indicated by the selector. A combination of several selector bits must consider all those subsets, not just one. An implementation is, however, free to consider an empty subset of data to still be a valid subset. For algorithms where some selection is not meaningful such as OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS for RSA keys the function should just return 1 as the selected subset is not really missing in the key.

                                                                                                                            OSSL_FUNC_keymgmt_validate() should check if the keydata contains valid data subsets indicated by selection. Some combined selections of data subsets may cause validation of the combined data. For example, the combination of OSSL_KEYMGMT_SELECT_PRIVATE_KEY and OSSL_KEYMGMT_SELECT_PUBLIC_KEY (or OSSL_KEYMGMT_SELECT_KEYPAIR for short) is expected to check that the pairwise consistency of keydata is valid. The checktype parameter controls what type of check is performed on the subset of data. Two types of check are defined: OSSL_KEYMGMT_VALIDATE_FULL_CHECK and OSSL_KEYMGMT_VALIDATE_QUICK_CHECK. The interpretation of how much checking is performed in a full check versus a quick check is key type specific. Some providers may have no distinction between a full check and a quick check. For algorithms where some selection is not meaningful such as OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS for RSA keys the function should just return 1 as there is nothing to validate for that selection.

                                                                                                                            OSSL_FUNC_keymgmt_match() should check if the data subset indicated by selection in keydata1 and keydata2 match. It is assumed that the caller has ensured that keydata1 and keydata2 are both owned by the implementation of this function.

                                                                                                                            "},{"location":"man7/provider-keymgmt/#key-object-import-export-and-duplication-functions","title":"Key Object Import, Export and Duplication Functions","text":"

                                                                                                                            OSSL_FUNC_keymgmt_import() should import data indicated by selection into keydata with values taken from the OSSL_PARAM(3) array params.

                                                                                                                            OSSL_FUNC_keymgmt_export() should extract values indicated by selection from keydata, create an OSSL_PARAM(3) array with them and call param_cb with that array as well as the given cbarg.

                                                                                                                            OSSL_FUNC_keymgmt_import_types() should return a constant array of descriptor OSSL_PARAM(3) for data indicated by selection, for parameters that OSSL_FUNC_keymgmt_import() can handle.

                                                                                                                            OSSL_FUNC_keymgmt_export_types() should return a constant array of descriptor OSSL_PARAM(3) for data indicated by selection, that the OSSL_FUNC_keymgmt_export() callback can expect to receive.

                                                                                                                            OSSL_FUNC_keymgmt_dup() should duplicate data subsets indicated by selection or the whole key data keydata_from and create a new provider side key object with the data.

                                                                                                                            "},{"location":"man7/provider-keymgmt/#common-information-parameters","title":"Common Information Parameters","text":"

                                                                                                                            See OSSL_PARAM(3) for further details on the parameters structure.

                                                                                                                            Common information parameters currently recognised by all built-in keymgmt algorithms are as follows:

                                                                                                                            • \"bits\" (OSSL_PKEY_PARAM_BITS) <integer>

                                                                                                                              The value should be the cryptographic length of the cryptosystem to which the key belongs, in bits. The definition of cryptographic length is specific to the key cryptosystem.

                                                                                                                            • \"max-size\" (OSSL_PKEY_PARAM_MAX_SIZE) <integer>

                                                                                                                              The value should be the maximum size that a caller should allocate to safely store a signature (called sig in provider-signature(7)), the result of asymmetric encryption / decryption (out in provider-asym_cipher(7), a derived secret (secret in provider-keyexch(7), and similar data).

                                                                                                                              Because an EVP_KEYMGMT method is always tightly bound to another method (signature, asymmetric cipher, key exchange, ...) and must be of the same provider, this number only needs to be synchronised with the dimensions handled in the rest of the same provider.

                                                                                                                            • \"security-bits\" (OSSL_PKEY_PARAM_SECURITY_BITS) <integer>

                                                                                                                              The value should be the number of security bits of the given key. Bits of security is defined in SP800-57.

                                                                                                                            • \"mandatory-digest\" (OSSL_PKEY_PARAM_MANDATORY_DIGEST)

                                                                                                                              If there is a mandatory digest for performing a signature operation with keys from this keymgmt, this parameter should get its name as value.

                                                                                                                              When EVP_PKEY_get_default_digest_name() queries this parameter and it's filled in by the implementation, its return value will be 2.

                                                                                                                              If the keymgmt implementation fills in the value \"\" or \"UNDEF\", EVP_PKEY_get_default_digest_name(3) will place the string \"UNDEF\" into its argument mdname. This signifies that no digest should be specified with the corresponding signature operation.

                                                                                                                            • \"default-digest\" (OSSL_PKEY_PARAM_DEFAULT_DIGEST)

                                                                                                                              If there is a default digest for performing a signature operation with keys from this keymgmt, this parameter should get its name as value.

                                                                                                                              When EVP_PKEY_get_default_digest_name(3) queries this parameter and it's filled in by the implementation, its return value will be 1. Note that if OSSL_PKEY_PARAM_MANDATORY_DIGEST is responded to as well, EVP_PKEY_get_default_digest_name(3) ignores the response to this parameter.

                                                                                                                              If the keymgmt implementation fills in the value \"\" or \"UNDEF\", EVP_PKEY_get_default_digest_name(3) will place the string \"UNDEF\" into its argument mdname. This signifies that no digest has to be specified with the corresponding signature operation, but may be specified as an option.

                                                                                                                              "},{"location":"man7/provider-keymgmt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                              OSSL_FUNC_keymgmt_new() and OSSL_FUNC_keymgmt_dup() should return a valid reference to the newly created provider side key object, or NULL on failure.

                                                                                                                              OSSL_FUNC_keymgmt_import(), OSSL_FUNC_keymgmt_export(), OSSL_FUNC_keymgmt_get_params() and OSSL_FUNC_keymgmt_set_params() should return 1 for success or 0 on error.

                                                                                                                              OSSL_FUNC_keymgmt_validate() should return 1 on successful validation, or 0 on failure.

                                                                                                                              OSSL_FUNC_keymgmt_has() should return 1 if all the selected data subsets are contained in the given keydata or 0 otherwise.

                                                                                                                              OSSL_FUNC_keymgmt_query_operation_name() should return a pointer to a string matching the requested operation, or NULL if the same name used to fetch the keymgmt applies.

                                                                                                                              OSSL_FUNC_keymgmt_gettable_params() and OSSL_FUNC_keymgmt_settable_params() OSSL_FUNC_keymgmt_import_types(), OSSL_FUNC_keymgmt_export_types() should always return a constant OSSL_PARAM(3) array.

                                                                                                                              "},{"location":"man7/provider-keymgmt/#see-also","title":"SEE ALSO","text":"

                                                                                                                              provider(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), EVP_PKEY-ED25519(7), EVP_PKEY-ED448(7), EVP_PKEY-EC(7), EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7)

                                                                                                                              "},{"location":"man7/provider-keymgmt/#history","title":"HISTORY","text":"

                                                                                                                              The KEYMGMT interface was introduced in OpenSSL 3.0.

                                                                                                                              "},{"location":"man7/provider-keymgmt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                              Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                              "},{"location":"man7/provider-mac/","title":"provider-mac","text":""},{"location":"man7/provider-mac/#name","title":"NAME","text":"

                                                                                                                              provider-mac - The mac library <-> provider functions

                                                                                                                              "},{"location":"man7/provider-mac/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                              #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_mac_newctx(void *provctx);\nvoid OSSL_FUNC_mac_freectx(void *mctx);\nvoid *OSSL_FUNC_mac_dupctx(void *src);\n\n/* Encryption/decryption */\nint OSSL_FUNC_mac_init(void *mctx, unsigned char *key, size_t keylen,\n                       const OSSL_PARAM params[]);\nint OSSL_FUNC_mac_update(void *mctx, const unsigned char *in, size_t inl);\nint OSSL_FUNC_mac_final(void *mctx, unsigned char *out, size_t *outl, size_t outsize);\n\n/* MAC parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_mac_gettable_params(void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_mac_gettable_ctx_params(void *mctx, void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_mac_settable_ctx_params(void *mctx, void *provctx);\n\n/* MAC parameters */\nint OSSL_FUNC_mac_get_params(OSSL_PARAM params[]);\nint OSSL_FUNC_mac_get_ctx_params(void *mctx, OSSL_PARAM params[]);\nint OSSL_FUNC_mac_set_ctx_params(void *mctx, const OSSL_PARAM params[]);\n
                                                                                                                              "},{"location":"man7/provider-mac/#description","title":"DESCRIPTION","text":"

                                                                                                                              This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                              The MAC operation enables providers to implement mac algorithms and make them available to applications via the API functions EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3).

                                                                                                                              All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                              All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_mac_newctx() has these:

                                                                                                                              typedef void *(OSSL_FUNC_mac_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_mac_newctx_fn\n    OSSL_FUNC_mac_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                              OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                              OSSL_FUNC_mac_newctx               OSSL_FUNC_MAC_NEWCTX\nOSSL_FUNC_mac_freectx              OSSL_FUNC_MAC_FREECTX\nOSSL_FUNC_mac_dupctx               OSSL_FUNC_MAC_DUPCTX\n\nOSSL_FUNC_mac_init                 OSSL_FUNC_MAC_INIT\nOSSL_FUNC_mac_update               OSSL_FUNC_MAC_UPDATE\nOSSL_FUNC_mac_final                OSSL_FUNC_MAC_FINAL\n\nOSSL_FUNC_mac_get_params           OSSL_FUNC_MAC_GET_PARAMS\nOSSL_FUNC_mac_get_ctx_params       OSSL_FUNC_MAC_GET_CTX_PARAMS\nOSSL_FUNC_mac_set_ctx_params       OSSL_FUNC_MAC_SET_CTX_PARAMS\n\nOSSL_FUNC_mac_gettable_params      OSSL_FUNC_MAC_GETTABLE_PARAMS\nOSSL_FUNC_mac_gettable_ctx_params  OSSL_FUNC_MAC_GETTABLE_CTX_PARAMS\nOSSL_FUNC_mac_settable_ctx_params  OSSL_FUNC_MAC_SETTABLE_CTX_PARAMS\n

                                                                                                                              A mac algorithm implementation may not implement all of these functions. In order to be a consistent set of functions, at least the following functions must be implemented: OSSL_FUNC_mac_newctx(), OSSL_FUNC_mac_freectx(), OSSL_FUNC_mac_init(), OSSL_FUNC_mac_update(), OSSL_FUNC_mac_final(). All other functions are optional.

                                                                                                                              "},{"location":"man7/provider-mac/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                              OSSL_FUNC_mac_newctx() should create and return a pointer to a provider side structure for holding context information during a mac operation. A pointer to this context will be passed back in a number of the other mac operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                              OSSL_FUNC_mac_freectx() is passed a pointer to the provider side mac context in the mctx parameter. If it receives NULL as mctx value, it should not do anything other than return. This function should free any resources associated with that context.

                                                                                                                              OSSL_FUNC_mac_dupctx() should duplicate the provider side mac context in the mctx parameter and return the duplicate copy.

                                                                                                                              "},{"location":"man7/provider-mac/#encryptiondecryption-functions","title":"Encryption/Decryption Functions","text":"

                                                                                                                              OSSL_FUNC_mac_init() initialises a mac operation given a newly created provider side mac context in the mctx parameter. The params are set before setting the MAC key of keylen bytes.

                                                                                                                              OSSL_FUNC_mac_update() is called to supply data for MAC computation of a previously initialised mac operation. The mctx parameter contains a pointer to a previously initialised provider side context. OSSL_FUNC_mac_update() may be called multiple times for a single mac operation.

                                                                                                                              OSSL_FUNC_mac_final() completes the MAC computation started through previous OSSL_FUNC_mac_init() and OSSL_FUNC_mac_update() calls. The mctx parameter contains a pointer to the provider side context. The resulting MAC should be written to out and the amount of data written to *outl, which should not exceed outsize bytes. The same expectations apply to outsize as documented for EVP_MAC_final(3).

                                                                                                                              "},{"location":"man7/provider-mac/#mac-parameters","title":"Mac Parameters","text":"

                                                                                                                              See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                              OSSL_FUNC_mac_get_params() gets details of parameter values associated with the provider algorithm and stores them in params.

                                                                                                                              OSSL_FUNC_mac_set_ctx_params() sets mac parameters associated with the given provider side mac context mctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                              OSSL_FUNC_mac_get_ctx_params() gets details of currently set parameter values associated with the given provider side mac context mctx and stores them in params. Passing NULL for params should return true.

                                                                                                                              OSSL_FUNC_mac_gettable_params(), OSSL_FUNC_mac_gettable_ctx_params(), and OSSL_FUNC_mac_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_mac_get_params(), OSSL_FUNC_mac_get_ctx_params(), and OSSL_FUNC_mac_set_ctx_params() can handle, respectively. OSSL_FUNC_mac_gettable_ctx_params() and OSSL_FUNC_mac_settable_ctx_params() will return the parameters associated with the provider side context mctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                              All MAC implementations are expected to handle the following parameters:

                                                                                                                              • with OSSL_FUNC_set_ctx_params():

                                                                                                                                • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                  Sets the key in the associated MAC ctx. This is identical to passing a key argument to the OSSL_FUNC_mac_init() function. - with OSSL_FUNC_get_params(): - \"size\" (OSSL_MAC_PARAM_SIZE) <integer>

                                                                                                                                  Can be used to get the default MAC size (which might be the only allowable MAC size for the implementation).

                                                                                                                                  Note that some implementations allow setting the size that the resulting MAC should have as well, see the documentation of the implementation.

                                                                                                                                • \"size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <integer>

                                                                                                                                  Can be used to get the MAC block size (if supported by the algorithm).

                                                                                                                              "},{"location":"man7/provider-mac/#notes","title":"NOTES","text":"

                                                                                                                              The MAC life-cycle is described in life_cycle-rand(7). Providers should ensure that the various transitions listed there are supported. At some point the EVP layer will begin enforcing the listed transitions.

                                                                                                                              "},{"location":"man7/provider-mac/#return-values","title":"RETURN VALUES","text":"

                                                                                                                              OSSL_FUNC_mac_newctx() and OSSL_FUNC_mac_dupctx() should return the newly created provider side mac context, or NULL on failure.

                                                                                                                              OSSL_FUNC_mac_init(), OSSL_FUNC_mac_update(), OSSL_FUNC_mac_final(), OSSL_FUNC_mac_get_params(), OSSL_FUNC_mac_get_ctx_params() and OSSL_FUNC_mac_set_ctx_params() should return 1 for success or 0 on error.

                                                                                                                              OSSL_FUNC_mac_gettable_params(), OSSL_FUNC_mac_gettable_ctx_params() and OSSL_FUNC_mac_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                              "},{"location":"man7/provider-mac/#see-also","title":"SEE ALSO","text":"

                                                                                                                              provider(7), EVP_MAC-BLAKE2(7), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-HMAC(7), EVP_MAC-KMAC(7), EVP_MAC-Poly1305(7), EVP_MAC-Siphash(7), life_cycle-mac(7), EVP_MAC(3)

                                                                                                                              "},{"location":"man7/provider-mac/#history","title":"HISTORY","text":"

                                                                                                                              The provider MAC interface was introduced in OpenSSL 3.0.

                                                                                                                              "},{"location":"man7/provider-mac/#copyright","title":"COPYRIGHT","text":"

                                                                                                                              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                              "},{"location":"man7/provider-object/","title":"provider-object","text":""},{"location":"man7/provider-object/#name","title":"NAME","text":"

                                                                                                                              provider-object - A specification for a provider-native object abstraction

                                                                                                                              "},{"location":"man7/provider-object/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                              #include <openssl/core_object.h>\n#include <openssl/core_names.h>\n
                                                                                                                              "},{"location":"man7/provider-object/#description","title":"DESCRIPTION","text":"

                                                                                                                              The provider-native object abstraction is a set of OSSL_PARAM(3) keys and values that can be used to pass provider-native objects to OpenSSL library code or between different provider operation implementations with the help of OpenSSL library code.

                                                                                                                              The intention is that certain provider-native operations can pass any sort of object that belong with other operations, or with OpenSSL library code.

                                                                                                                              An object may be passed in the following manners:

                                                                                                                              1. By value

                                                                                                                                This means that the object data is passed as an octet string or an UTF8 string, which can be handled in diverse ways by other provided implementations. The encoding of the object depends on the context it's used in; for example, OSSL_DECODER(3) allows multiple encodings, depending on existing decoders. If central OpenSSL library functionality is to handle the data directly, it must be encoded in DER for all object types except for OSSL_OBJECT_NAME (see \"Parameter reference\" below), where it's assumed to a plain UTF8 string.

                                                                                                                              2. By reference

                                                                                                                                This means that the object data isn't passed directly, an object reference is passed instead. It's an octet string that only the correct provider understands correctly.

                                                                                                                              Objects by value can be used by anything that handles DER encoded objects.

                                                                                                                              Objects by reference need a higher level of cooperation from the implementation where the object originated (let's call it X) and its target implementation (let's call it Y):

                                                                                                                              1. An object loading function in the target implementation

                                                                                                                                The target implementation (Y) may have a function that can take an object reference. This can only be used if the target implementation is from the same provider as the one originating the object abstraction in question (X).

                                                                                                                                The exact target implementation to use is determined from the object type and possibly the object data type. For example, when the OpenSSL library receives an object abstraction with the object type OSSL_OBJECT_PKEY, it will fetch a provider-keymgmt(7) using the object data type as its key type (the second argument in EVP_KEYMGMT_fetch(3)).

                                                                                                                              2. An object exporter in the originating implementation

                                                                                                                                The originating implementation (X) may have an exporter function. This exporter function can be used to export the object in OSSL_PARAM(3) form, that can then be imported by the target implementation's imported function.

                                                                                                                                This can be used when it's not possible to fetch the target implementation (Y) from the same provider.

                                                                                                                              "},{"location":"man7/provider-object/#parameter-reference","title":"Parameter reference","text":"

                                                                                                                              A provider-native object abstraction is an OSSL_PARAM(3) with a selection of the following parameters:

                                                                                                                              • \"data\" (OSSL_OBJECT_PARAM_DATA) <octet string> or

                                                                                                                                The object data passed by value.

                                                                                                                              • \"reference\" (OSSL_OBJECT_PARAM_REFERENCE) <octet string>

                                                                                                                                The object data passed by reference.

                                                                                                                              • \"type\" (OSSL_OBJECT_PARAM_TYPE) <integer>

                                                                                                                                The object type, a number that may have any of the following values (all defined in <openssl/core_object.h>):

                                                                                                                                • OSSL_OBJECT_NAME

                                                                                                                                  The object data may only be passed by value, and should be a UTF8 string.

                                                                                                                                  This is useful for provider-storemgmt(7) when a URI load results in new URIs.

                                                                                                                                • OSSL_OBJECT_PKEY

                                                                                                                                  The object data is suitable as provider-native EVP_PKEY key data. The object data may be passed by value or passed by reference.

                                                                                                                                • OSSL_OBJECT_CERT

                                                                                                                                  The object data is suitable as X509 data. The object data for this object type can only be passed by value, and should be an octet string.

                                                                                                                                  Since there's no provider-native X.509 object, OpenSSL libraries that receive this object abstraction are expected to convert the data to a X509 object with d2i_X509().

                                                                                                                                • OSSL_OBJECT_CRL

                                                                                                                                  The object data is suitable as X509_CRL data. The object data can only be passed by value, and should be an octet string.

                                                                                                                                  Since there's no provider-native X.509 CRL object, OpenSSL libraries that receive this object abstraction are expected to convert the data to a X509_CRL object with d2i_X509_CRL().

                                                                                                                              • \"data-type\" (OSSL_OBJECT_PARAM_DATA_TYPE)

                                                                                                                                The specific type of the object content. Legitimate values depend on the object type; if it is OSSL_OBJECT_PKEY, the data type is expected to be a key type suitable for fetching a provider-keymgmt(7) that can handle the data.

                                                                                                                              • \"data-structure\" (OSSL_OBJECT_PARAM_DATA_STRUCTURE)

                                                                                                                                The outermost structure of the object content. Legitimate values depend on the object type.

                                                                                                                              • \"desc\" (OSSL_OBJECT_PARAM_DESC)

                                                                                                                                A human readable text that describes extra details on the object.

                                                                                                                                When a provider-native object abstraction is used, it must contain object data in at least one form (object data passed by value, i.e. the \"data\" item, or object data passed by reference, i.e. the \"reference\" item). Both may be present at once, in which case the OpenSSL library code that receives this will use the most optimal variant.

                                                                                                                                For objects with the object type OSSL_OBJECT_NAME, that object type must be given.

                                                                                                                                "},{"location":"man7/provider-object/#see-also","title":"SEE ALSO","text":"

                                                                                                                                provider(7), OSSL_DECODER(3)

                                                                                                                                "},{"location":"man7/provider-object/#history","title":"HISTORY","text":"

                                                                                                                                The concept of providers and everything surrounding them was introduced in OpenSSL 3.0.

                                                                                                                                "},{"location":"man7/provider-object/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                "},{"location":"man7/provider-rand/","title":"provider-rand","text":""},{"location":"man7/provider-rand/#name","title":"NAME","text":"

                                                                                                                                provider-rand - The random number generation library <-> provider functions

                                                                                                                                "},{"location":"man7/provider-rand/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_rand_newctx(void *provctx, void *parent,\n                            const OSSL_DISPATCH *parent_calls);\nvoid OSSL_FUNC_rand_freectx(void *ctx);\n\n/* Random number generator functions: NIST */\nint OSSL_FUNC_rand_instantiate(void *ctx, unsigned int strength,\n                               int prediction_resistance,\n                               const unsigned char *pstr, size_t pstr_len,\n                               const OSSL_PARAM params[]);\nint OSSL_FUNC_rand_uninstantiate(void *ctx);\nint OSSL_FUNC_rand_generate(void *ctx, unsigned char *out, size_t outlen,\n                            unsigned int strength, int prediction_resistance,\n                            const unsigned char *addin, size_t addin_len);\nint OSSL_FUNC_rand_reseed(void *ctx, int prediction_resistance,\n                          const unsigned char *ent, size_t ent_len,\n                          const unsigned char *addin, size_t addin_len);\n\n/* Random number generator functions: additional */\nsize_t OSSL_FUNC_rand_nonce(void *ctx, unsigned char *out, size_t outlen,\n                            int strength, size_t min_noncelen,\n                            size_t max_noncelen);\nsize_t OSSL_FUNC_rand_get_seed(void *ctx, unsigned char **buffer,\n                               int entropy, size_t min_len, size_t max_len,\n                               int prediction_resistance,\n                               const unsigned char *adin, size_t adin_len);\nvoid OSSL_FUNC_rand_clear_seed(void *ctx, unsigned char *buffer, size_t b_len);\nint OSSL_FUNC_rand_verify_zeroization(void *ctx);\n\n/* Context Locking */\nint OSSL_FUNC_rand_enable_locking(void *ctx);\nint OSSL_FUNC_rand_lock(void *ctx);\nvoid OSSL_FUNC_rand_unlock(void *ctx);\n\n/* RAND parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_rand_gettable_params(void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_rand_gettable_ctx_params(void *ctx, void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_rand_settable_ctx_params(void *ctx, void *provctx);\n\n/* RAND parameters */\nint OSSL_FUNC_rand_get_params(OSSL_PARAM params[]);\nint OSSL_FUNC_rand_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nint OSSL_FUNC_rand_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\n
                                                                                                                                "},{"location":"man7/provider-rand/#description","title":"DESCRIPTION","text":"

                                                                                                                                This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                The RAND operation enables providers to implement random number generation algorithms and random number sources and make them available to applications via the API function EVP_RAND(3).

                                                                                                                                "},{"location":"man7/provider-rand/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                OSSL_FUNC_rand_newctx() should create and return a pointer to a provider side structure for holding context information during a rand operation. A pointer to this context will be passed back in a number of the other rand operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)). The parameter parent specifies another rand instance to be used for seeding purposes. If NULL and the specific instance supports it, the operating system will be used for seeding. The parameter parent_calls points to the dispatch table for parent. Thus, the parent need not be from the same provider as the new instance.

                                                                                                                                OSSL_FUNC_rand_freectx() is passed a pointer to the provider side rand context in the mctx parameter. If it receives NULL as ctx value, it should not do anything other than return. This function should free any resources associated with that context.

                                                                                                                                "},{"location":"man7/provider-rand/#random-number-generator-functions-nist","title":"Random Number Generator Functions: NIST","text":"

                                                                                                                                These functions correspond to those defined in NIST SP 800-90A and SP 800-90C.

                                                                                                                                OSSL_FUNC_rand_instantiate() is used to instantiate the DRBG ctx at a requested security strength. In addition, prediction_resistance can be requested. Additional input addin of length addin_len bytes can optionally be provided. The parameters specified in params configure the DRBG and these should be processed before instantiation.

                                                                                                                                OSSL_FUNC_rand_uninstantiate() is used to uninstantiate the DRBG ctx. After being uninstantiated, a DRBG is unable to produce output until it is instantiated anew.

                                                                                                                                OSSL_FUNC_rand_generate() is used to generate random bytes from the DRBG ctx. It will generate outlen bytes placing them into the buffer pointed to by out. The generated bytes will meet the specified security strength and, if prediction_resistance is true, the bytes will be produced after reseeding from a live entropy source. Additional input addin of length addin_len bytes can optionally be provided.

                                                                                                                                "},{"location":"man7/provider-rand/#random-number-generator-functions-additional","title":"Random Number Generator Functions: Additional","text":"

                                                                                                                                OSSL_FUNC_rand_nonce() is used to generate a nonce of the given strength with a length from min_noncelen to max_noncelen. If the output buffer out is NULL, the length of the nonce should be returned.

                                                                                                                                OSSL_FUNC_rand_get_seed() is used by deterministic generators to obtain their seeding material from their parent. The seed bytes will meet the specified security level of entropy bits and there will be between min_len and max_len inclusive bytes in total. If prediction_resistance is true, the bytes will be produced from a live entropy source. Additional input addin of length addin_len bytes can optionally be provided. A pointer to the seed material is returned in *buffer and this must be freed by a later call to OSSL_FUNC_rand_clear_seed().

                                                                                                                                OSSL_FUNC_rand_clear_seed() frees a seed buffer of length b_len bytes which was previously allocated by OSSL_FUNC_rand_get_seed().

                                                                                                                                OSSL_FUNC_rand_verify_zeroization() is used to determine if the internal state of the DRBG is zero. This capability is mandated by NIST as part of the self tests, it is unlikely to be useful in other circumstances.

                                                                                                                                "},{"location":"man7/provider-rand/#context-locking","title":"Context Locking","text":"

                                                                                                                                When DRBGs are used by multiple threads, there must be locking employed to ensure their proper operation. Because locking introduces an overhead, it is disabled by default.

                                                                                                                                OSSL_FUNC_rand_enable_locking() allows locking to be turned on for a DRBG and all of its parent DRBGs. From this call onwards, the DRBG can be used in a thread safe manner.

                                                                                                                                OSSL_FUNC_rand_lock() is used to lock a DRBG. Once locked, exclusive access is guaranteed.

                                                                                                                                OSSL_FUNC_rand_unlock() is used to unlock a DRBG.

                                                                                                                                "},{"location":"man7/provider-rand/#rand-parameters","title":"Rand Parameters","text":"

                                                                                                                                See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                                OSSL_FUNC_rand_get_params() gets details of parameter values associated with the provider algorithm and stores them in params.

                                                                                                                                OSSL_FUNC_rand_set_ctx_params() sets rand parameters associated with the given provider side rand context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                OSSL_FUNC_rand_get_ctx_params() gets details of currently set parameter values associated with the given provider side rand context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                OSSL_FUNC_rand_gettable_params(), OSSL_FUNC_rand_gettable_ctx_params(), and OSSL_FUNC_rand_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_rand_get_params(), OSSL_FUNC_rand_get_ctx_params(), and OSSL_FUNC_rand_set_ctx_params() can handle, respectively. OSSL_FUNC_rand_gettable_ctx_params() and OSSL_FUNC_rand_settable_ctx_params() will return the parameters associated with the provider side context ctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                                Parameters currently recognised by built-in rands are as follows. Not all parameters are relevant to, or are understood by all rands:

                                                                                                                                • \"state\" (OSSL_RAND_PARAM_STATE) <integer>

                                                                                                                                  Returns the state of the random number generator.

                                                                                                                                • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>

                                                                                                                                  Returns the bit strength of the random number generator.

                                                                                                                                For rands that are also deterministic random bit generators (DRBGs), these additional parameters are recognised. Not all parameters are relevant to, or are understood by all DRBG rands:

                                                                                                                                • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

                                                                                                                                  Reads or set the number of generate requests before reseeding the associated RAND ctx.

                                                                                                                                • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>

                                                                                                                                  Reads or set the number of elapsed seconds before reseeding the associated RAND ctx.

                                                                                                                                • \"max_request\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

                                                                                                                                  Specifies the maximum number of bytes that can be generated in a single call to OSSL_FUNC_rand_generate.

                                                                                                                                • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>

                                                                                                                                • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>

                                                                                                                                  Specify the minimum and maximum number of bytes of random material that can be used to seed the DRBG.

                                                                                                                                • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>

                                                                                                                                • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>

                                                                                                                                  Specify the minimum and maximum number of bytes of nonce that can be used to instantiate the DRBG.

                                                                                                                                • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>

                                                                                                                                • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>

                                                                                                                                  Specify the minimum and maximum number of bytes of personalisation string that can be used with the DRBG.

                                                                                                                                • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>

                                                                                                                                  Specifies the number of times the DRBG has been seeded or reseeded.

                                                                                                                                • \"digest\" (OSSL_DRBG_PARAM_DIGEST)

                                                                                                                                • \"cipher\" (OSSL_DRBG_PARAM_CIPHER)
                                                                                                                                • \"mac\" (OSSL_DRBG_PARAM_MAC)

                                                                                                                                  Sets the name of the underlying cipher, digest or MAC to be used. It must name a suitable algorithm for the DRBG that's being used.

                                                                                                                                • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)

                                                                                                                                  Sets the properties to be queried when trying to fetch an underlying algorithm. This must be given together with the algorithm naming parameter to be considered valid.

                                                                                                                                  "},{"location":"man7/provider-rand/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                  OSSL_FUNC_rand_newctx() should return the newly created provider side rand context, or NULL on failure.

                                                                                                                                  OSSL_FUNC_rand_gettable_params(), OSSL_FUNC_rand_gettable_ctx_params() and OSSL_FUNC_rand_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                                  OSSL_FUNC_rand_nonce() returns the size of the generated nonce, or 0 on error.

                                                                                                                                  OSSL_FUNC_rand_get_seed() returns the size of the generated seed, or 0 on error.

                                                                                                                                  All of the remaining functions should return 1 for success or 0 on error.

                                                                                                                                  "},{"location":"man7/provider-rand/#notes","title":"NOTES","text":"

                                                                                                                                  The RAND life-cycle is described in life_cycle-rand(7). Providers should ensure that the various transitions listed there are supported. At some point the EVP layer will begin enforcing the listed transitions.

                                                                                                                                  "},{"location":"man7/provider-rand/#see-also","title":"SEE ALSO","text":"

                                                                                                                                  provider(7), RAND(7), EVP_RAND(7), life_cycle-rand(7), EVP_RAND(3)

                                                                                                                                  "},{"location":"man7/provider-rand/#history","title":"HISTORY","text":"

                                                                                                                                  The provider RAND interface was introduced in OpenSSL 3.0.

                                                                                                                                  "},{"location":"man7/provider-rand/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                  Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                  "},{"location":"man7/provider-signature/","title":"provider-signature","text":""},{"location":"man7/provider-signature/#name","title":"NAME","text":"

                                                                                                                                  provider-signature - The signature library <-> provider functions

                                                                                                                                  "},{"location":"man7/provider-signature/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                  #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_signature_newctx(void *provctx, const char *propq);\nvoid OSSL_FUNC_signature_freectx(void *ctx);\nvoid *OSSL_FUNC_signature_dupctx(void *ctx);\n\n/* Signing */\nint OSSL_FUNC_signature_sign_init(void *ctx, void *provkey,\n                                  const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_sign(void *ctx, unsigned char *sig, size_t *siglen,\n                             size_t sigsize, const unsigned char *tbs, size_t tbslen);\n\n/* Verifying */\nint OSSL_FUNC_signature_verify_init(void *ctx, void *provkey,\n                                    const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_verify(void *ctx, const unsigned char *sig, size_t siglen,\n                               const unsigned char *tbs, size_t tbslen);\n\n/* Verify Recover */\nint OSSL_FUNC_signature_verify_recover_init(void *ctx, void *provkey,\n                                            const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_verify_recover(void *ctx, unsigned char *rout,\n                                       size_t *routlen, size_t routsize,\n                                       const unsigned char *sig, size_t siglen);\n\n/* Digest Sign */\nint OSSL_FUNC_signature_digest_sign_init(void *ctx, const char *mdname,\n                                         void *provkey,\n                                         const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_digest_sign_update(void *ctx, const unsigned char *data,\n                                    size_t datalen);\nint OSSL_FUNC_signature_digest_sign_final(void *ctx, unsigned char *sig,\n                                          size_t *siglen, size_t sigsize);\nint OSSL_FUNC_signature_digest_sign(void *ctx,\n                             unsigned char *sig, size_t *siglen,\n                             size_t sigsize, const unsigned char *tbs,\n                             size_t tbslen);\n\n/* Digest Verify */\nint OSSL_FUNC_signature_digest_verify_init(void *ctx, const char *mdname,\n                                           void *provkey,\n                                           const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_digest_verify_update(void *ctx,\n                                             const unsigned char *data,\n                                             size_t datalen);\nint OSSL_FUNC_signature_digest_verify_final(void *ctx, const unsigned char *sig,\n                                     size_t siglen);\nint OSSL_FUNC_signature_digest_verify(void *ctx, const unsigned char *sig,\n                               size_t siglen, const unsigned char *tbs,\n                               size_t tbslen);\n\n/* Signature parameters */\nint OSSL_FUNC_signature_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_signature_gettable_ctx_params(void *ctx,\n                                                          void *provctx);\nint OSSL_FUNC_signature_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_signature_settable_ctx_params(void *ctx,\n                                                          void *provctx);\n/* MD parameters */\nint OSSL_FUNC_signature_get_ctx_md_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM * OSSL_FUNC_signature_gettable_ctx_md_params(void *ctx);\nint OSSL_FUNC_signature_set_ctx_md_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM * OSSL_FUNC_signature_settable_ctx_md_params(void *ctx);\n
                                                                                                                                  "},{"location":"man7/provider-signature/#description","title":"DESCRIPTION","text":"

                                                                                                                                  This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                  The signature (OSSL_OP_SIGNATURE) operation enables providers to implement signature algorithms and make them available to applications via the API functions EVP_PKEY_sign(3), EVP_PKEY_verify(3), and EVP_PKEY_verify_recover(3) (as well as other related functions).

                                                                                                                                  All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                  All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_signature_newctx() has these:

                                                                                                                                  typedef void *(OSSL_FUNC_signature_newctx_fn)(void *provctx, const char *propq);\nstatic ossl_inline OSSL_FUNC_signature_newctx_fn\n    OSSL_FUNC_signature_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                  OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                  OSSL_FUNC_signature_newctx                 OSSL_FUNC_SIGNATURE_NEWCTX\nOSSL_FUNC_signature_freectx                OSSL_FUNC_SIGNATURE_FREECTX\nOSSL_FUNC_signature_dupctx                 OSSL_FUNC_SIGNATURE_DUPCTX\n\nOSSL_FUNC_signature_sign_init              OSSL_FUNC_SIGNATURE_SIGN_INIT\nOSSL_FUNC_signature_sign                   OSSL_FUNC_SIGNATURE_SIGN\n\nOSSL_FUNC_signature_verify_init            OSSL_FUNC_SIGNATURE_VERIFY_INIT\nOSSL_FUNC_signature_verify                 OSSL_FUNC_SIGNATURE_VERIFY\n\nOSSL_FUNC_signature_verify_recover_init    OSSL_FUNC_SIGNATURE_VERIFY_RECOVER_INIT\nOSSL_FUNC_signature_verify_recover         OSSL_FUNC_SIGNATURE_VERIFY_RECOVER\n\nOSSL_FUNC_signature_digest_sign_init       OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT\nOSSL_FUNC_signature_digest_sign_update     OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE\nOSSL_FUNC_signature_digest_sign_final      OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL\nOSSL_FUNC_signature_digest_sign            OSSL_FUNC_SIGNATURE_DIGEST_SIGN\n\nOSSL_FUNC_signature_digest_verify_init     OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT\nOSSL_FUNC_signature_digest_verify_update   OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE\nOSSL_FUNC_signature_digest_verify_final    OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL\nOSSL_FUNC_signature_digest_verify          OSSL_FUNC_SIGNATURE_DIGEST_VERIFY\n\nOSSL_FUNC_signature_get_ctx_params         OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS\nOSSL_FUNC_signature_gettable_ctx_params    OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS\nOSSL_FUNC_signature_set_ctx_params         OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS\nOSSL_FUNC_signature_settable_ctx_params    OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS\n\nOSSL_FUNC_signature_get_ctx_md_params      OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS\nOSSL_FUNC_signature_gettable_ctx_md_params OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS\nOSSL_FUNC_signature_set_ctx_md_params      OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS\nOSSL_FUNC_signature_settable_ctx_md_params OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS\n

                                                                                                                                  A signature algorithm implementation may not implement all of these functions. In order to be a consistent set of functions we must have at least a set of context functions (OSSL_FUNC_signature_newctx and OSSL_FUNC_signature_freectx) as well as a set of \"signature\" functions, i.e. at least one of:

                                                                                                                                  • OSSL_FUNC_signature_sign_init and OSSL_FUNC_signature_sign
                                                                                                                                  • OSSL_FUNC_signature_verify_init and OSSL_FUNC_signature_verify
                                                                                                                                  • OSSL_FUNC_signature_verify_recover_init and OSSL_FUNC_signature_verify_recover
                                                                                                                                  • OSSL_FUNC_signature_digest_sign_init, OSSL_FUNC_signature_digest_sign_update and OSSL_FUNC_signature_digest_sign_final
                                                                                                                                  • OSSL_FUNC_signature_digest_verify_init, OSSL_FUNC_signature_digest_verify_update and OSSL_FUNC_signature_digest_verify_final
                                                                                                                                  • OSSL_FUNC_signature_digest_sign_init and OSSL_FUNC_signature_digest_sign
                                                                                                                                  • OSSL_FUNC_signature_digest_verify_init and OSSL_FUNC_signature_digest_verify

                                                                                                                                  OSSL_FUNC_signature_set_ctx_params and OSSL_FUNC_signature_settable_ctx_params are optional, but if one of them is present then the other one must also be present. The same applies to OSSL_FUNC_signature_get_ctx_params and OSSL_FUNC_signature_gettable_ctx_params, as well as the \"md_params\" functions. The OSSL_FUNC_signature_dupctx function is optional.

                                                                                                                                  A signature algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                                                  "},{"location":"man7/provider-signature/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                  OSSL_FUNC_signature_newctx() should create and return a pointer to a provider side structure for holding context information during a signature operation. A pointer to this context will be passed back in a number of the other signature operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)). The propq parameter is a property query string that may be (optionally) used by the provider during any \"fetches\" that it may perform (if it performs any).

                                                                                                                                  OSSL_FUNC_signature_freectx() is passed a pointer to the provider side signature context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                                                  OSSL_FUNC_signature_dupctx() should duplicate the provider side signature context in the ctx parameter and return the duplicate copy.

                                                                                                                                  "},{"location":"man7/provider-signature/#signing-functions","title":"Signing Functions","text":"

                                                                                                                                  OSSL_FUNC_signature_sign_init() initialises a context for signing given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                  OSSL_FUNC_signature_sign() performs the actual signing itself. A previously initialised signature context is passed in the ctx parameter. The data to be signed is pointed to be the tbs parameter which is tbslen bytes long. Unless sig is NULL, the signature should be written to the location pointed to by the sig parameter and it should not exceed sigsize bytes in length. The length of the signature should be written to *siglen. If sig is NULL then the maximum length of the signature should be written to *siglen.

                                                                                                                                  "},{"location":"man7/provider-signature/#verify-functions","title":"Verify Functions","text":"

                                                                                                                                  OSSL_FUNC_signature_verify_init() initialises a context for verifying a signature given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                  OSSL_FUNC_signature_verify() performs the actual verification itself. A previously initialised signature context is passed in the ctx parameter. The data that the signature covers is pointed to be the tbs parameter which is tbslen bytes long. The signature is pointed to by the sig parameter which is siglen bytes long.

                                                                                                                                  "},{"location":"man7/provider-signature/#verify-recover-functions","title":"Verify Recover Functions","text":"

                                                                                                                                  OSSL_FUNC_signature_verify_recover_init() initialises a context for recovering the signed data given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                  OSSL_FUNC_signature_verify_recover() performs the actual verify recover itself. A previously initialised signature context is passed in the ctx parameter. The signature is pointed to by the sig parameter which is siglen bytes long. Unless rout is NULL, the recovered data should be written to the location pointed to by rout which should not exceed routsize bytes in length. The length of the recovered data should be written to *routlen. If rout is NULL then the maximum size of the output buffer is written to the routlen parameter.

                                                                                                                                  "},{"location":"man7/provider-signature/#digest-sign-functions","title":"Digest Sign Functions","text":"

                                                                                                                                  OSSL_FUNC_signature_digeset_sign_init() initialises a context for signing given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params() and OSSL_FUNC_signature_set_ctx_md_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>. The name of the digest to be used will be in the mdname parameter.

                                                                                                                                  OSSL_FUNC_signature_digest_sign_update() provides data to be signed in the data parameter which should be of length datalen. A previously initialised signature context is passed in the ctx parameter. This function may be called multiple times to cumulatively add data to be signed.

                                                                                                                                  OSSL_FUNC_signature_digest_sign_final() finalises a signature operation previously started through OSSL_FUNC_signature_digest_sign_init() and OSSL_FUNC_signature_digest_sign_update() calls. Once finalised no more data will be added through OSSL_FUNC_signature_digest_sign_update(). A previously initialised signature context is passed in the ctx parameter. Unless sig is NULL, the signature should be written to the location pointed to by the sig parameter and it should not exceed sigsize bytes in length. The length of the signature should be written to *siglen. If sig is NULL then the maximum length of the signature should be written to *siglen.

                                                                                                                                  OSSL_FUNC_signature_digest_sign() implements a \"one shot\" digest sign operation previously started through OSSL_FUNC_signature_digeset_sign_init(). A previously initialised signature context is passed in the ctx parameter. The data to be signed is in tbs which should be tbslen bytes long. Unless sig is NULL, the signature should be written to the location pointed to by the sig parameter and it should not exceed sigsize bytes in length. The length of the signature should be written to *siglen. If sig is NULL then the maximum length of the signature should be written to *siglen.

                                                                                                                                  "},{"location":"man7/provider-signature/#digest-verify-functions","title":"Digest Verify Functions","text":"

                                                                                                                                  OSSL_FUNC_signature_digeset_verify_init() initialises a context for verifying given a provider side verification context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to OSSL_FUNC_signature_set_ctx_params() and OSSL_FUNC_signature_set_ctx_md_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>. The name of the digest to be used will be in the mdname parameter.

                                                                                                                                  OSSL_FUNC_signature_digest_verify_update() provides data to be verified in the data parameter which should be of length datalen. A previously initialised verification context is passed in the ctx parameter. This function may be called multiple times to cumulatively add data to be verified.

                                                                                                                                  OSSL_FUNC_signature_digest_verify_final() finalises a verification operation previously started through OSSL_FUNC_signature_digest_verify_init() and OSSL_FUNC_signature_digest_verify_update() calls. Once finalised no more data will be added through OSSL_FUNC_signature_digest_verify_update(). A previously initialised verification context is passed in the ctx parameter. The signature to be verified is in sig which is siglen bytes long.

                                                                                                                                  OSSL_FUNC_signature_digest_verify() implements a \"one shot\" digest verify operation previously started through OSSL_FUNC_signature_digeset_verify_init(). A previously initialised verification context is passed in the ctx parameter. The data to be verified is in tbs which should be tbslen bytes long. The signature to be verified is in sig which is siglen bytes long.

                                                                                                                                  "},{"location":"man7/provider-signature/#signature-parameters","title":"Signature parameters","text":"

                                                                                                                                  See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_signature_get_ctx_params() and OSSL_FUNC_signature_set_ctx_params() functions.

                                                                                                                                  OSSL_FUNC_signature_get_ctx_params() gets signature parameters associated with the given provider side signature context ctx and stored them in params. Passing NULL for params should return true.

                                                                                                                                  OSSL_FUNC_signature_set_ctx_params() sets the signature parameters associated with the given provider side signature context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                  Common parameters currently recognised by built-in signature algorithms are as follows.

                                                                                                                                  • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                                                    Get or sets the name of the digest algorithm used for the input to the signature functions. It is required in order to calculate the \"algorithm-id\".

                                                                                                                                  • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                                                    Sets the name of the property query associated with the \"digest\" algorithm. NULL is used if this optional value is not set.

                                                                                                                                  • \"digest-size\" (OSSL_SIGNATURE_PARAM_DIGEST_SIZE) <unsigned integer>

                                                                                                                                    Gets or sets the output size of the digest algorithm used for the input to the signature functions. The length of the \"digest-size\" parameter should not exceed that of a size_t.

                                                                                                                                  • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>

                                                                                                                                    Gets the DER encoded AlgorithmIdentifier that corresponds to the combination of signature algorithm and digest algorithm for the signature operation.

                                                                                                                                  • \"kat\" (OSSL_SIGNATURE_PARAM_KAT) <unsigned integer>

                                                                                                                                    Sets a flag to modify the sign operation to return an error if the initial calculated signature is invalid. In the normal mode of operation - new random values are chosen until the signature operation succeeds. By default it retries until a signature is calculated. Setting the value to 0 causes the sign operation to retry, otherwise the sign operation is only tried once and returns whether or not it was successful. Known answer tests can be performed if the random generator is overridden to supply known values that either pass or fail.

                                                                                                                                  • OSSL_FUNC_signature_gettable_ctx_params() and OSSL_FUNC_signature_settable_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters, i.e. parameters that can be used with OSSL_FUNC_signature_get_ctx_params() and OSSL_FUNC_signature_set_ctx_params() respectively.

                                                                                                                                    "},{"location":"man7/provider-signature/#md-parameters","title":"MD parameters","text":"

                                                                                                                                    See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_signature_get_md_ctx_params() and OSSL_FUNC_signature_set_md_ctx_params() functions.

                                                                                                                                    OSSL_FUNC_signature_get_md_ctx_params() gets digest parameters associated with the given provider side digest signature context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                    OSSL_FUNC_signature_set_ms_ctx_params() sets the digest parameters associated with the given provider side digest signature context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                    Parameters currently recognised by built-in signature algorithms are the same as those for built-in digest algorithms. See \"Digest Parameters\" in provider-digest(7) for further information.

                                                                                                                                    OSSL_FUNC_signature_gettable_md_ctx_params() and OSSL_FUNC_signature_settable_md_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable digest parameters, i.e. parameters that can be used with OSSL_FUNC_signature_get_md_ctx_params() and OSSL_FUNC_signature_set_md_ctx_params() respectively.

                                                                                                                                    "},{"location":"man7/provider-signature/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                    OSSL_FUNC_signature_newctx() and OSSL_FUNC_signature_dupctx() should return the newly created provider side signature context, or NULL on failure.

                                                                                                                                    OSSL_FUNC_signature_gettable_ctx_params(), OSSL_FUNC_signature_settable_ctx_params(), OSSL_FUNC_signature_gettable_md_ctx_params() and OSSL_FUNC_signature_settable_md_ctx_params(), return the gettable or settable parameters in a constant OSSL_PARAM(3) array.

                                                                                                                                    All other functions should return 1 for success or 0 on error.

                                                                                                                                    "},{"location":"man7/provider-signature/#see-also","title":"SEE ALSO","text":"

                                                                                                                                    provider(7)

                                                                                                                                    "},{"location":"man7/provider-signature/#history","title":"HISTORY","text":"

                                                                                                                                    The provider SIGNATURE interface was introduced in OpenSSL 3.0.

                                                                                                                                    "},{"location":"man7/provider-signature/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                    Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                    "},{"location":"man7/provider-storemgmt/","title":"provider-storemgmt","text":""},{"location":"man7/provider-storemgmt/#name","title":"NAME","text":"

                                                                                                                                    provider-storemgmt - The OSSL_STORE library <-> provider functions

                                                                                                                                    "},{"location":"man7/provider-storemgmt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                    #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\nvoid *OSSL_FUNC_store_open(void *provctx, const char *uri);\nvoid *OSSL_FUNC_store_attach(void *provctx, OSSL_CORE_BIO *bio);\nconst OSSL_PARAM *store_settable_ctx_params(void *provctx);\nint OSSL_FUNC_store_set_ctx_params(void *loaderctx, const OSSL_PARAM[]);\nint OSSL_FUNC_store_load(void *loaderctx,\n                         OSSL_CALLBACK *object_cb, void *object_cbarg,\n                         OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg);\nint OSSL_FUNC_store_eof(void *loaderctx);\nint OSSL_FUNC_store_close(void *loaderctx);\n\nint OSSL_FUNC_store_export_object\n    (void *loaderctx, const void *objref, size_t objref_sz,\n     OSSL_CALLBACK *export_cb, void *export_cbarg);\n
                                                                                                                                    "},{"location":"man7/provider-storemgmt/#description","title":"DESCRIPTION","text":"

                                                                                                                                    The STORE operation is the provider side of the ossl_store(7) API.

                                                                                                                                    The primary responsibility of the STORE operation is to load all sorts of objects from a container indicated by URI. These objects are given to the OpenSSL library in provider-native object abstraction form (see provider-object(7)). The OpenSSL library is then responsible for passing on that abstraction to suitable provided functions.

                                                                                                                                    Examples of functions that the OpenSSL library can pass the abstraction to include OSSL_FUNC_keymgmt_load() (provider-keymgmt(7)), OSSL_FUNC_store_export_object() (which exports the object in parameterized form).

                                                                                                                                    All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                    All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from a OSSL_DISPATCH(3) element named OSSL_get_{name}. For example, the \"function\" OSSL_FUNC_store_attach() has these:

                                                                                                                                    typedef void *(OSSL_FUNC_store_attach_fn)(void *provctx,\n                                          OSSL_CORE_BIO * bio);\nstatic ossl_inline OSSL_FUNC_store_attach_fn\n    OSSL_FUNC_store_attach(const OSSL_DISPATCH *opf);\n

                                                                                                                                    OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                    OSSL_FUNC_store_open                 OSSL_FUNC_STORE_OPEN\nOSSL_FUNC_store_attach               OSSL_FUNC_STORE_ATTACH\nOSSL_FUNC_store_settable_ctx_params  OSSL_FUNC_STORE_SETTABLE_CTX_PARAMS\nOSSL_FUNC_store_set_ctx_params       OSSL_FUNC_STORE_SET_CTX_PARAMS\nOSSL_FUNC_store_load                 OSSL_FUNC_STORE_LOAD\nOSSL_FUNC_store_eof                  OSSL_FUNC_STORE_EOF\nOSSL_FUNC_store_close                OSSL_FUNC_STORE_CLOSE\nOSSL_FUNC_store_export_object        OSSL_FUNC_STORE_EXPORT_OBJECT\n
                                                                                                                                    "},{"location":"man7/provider-storemgmt/#functions","title":"Functions","text":"

                                                                                                                                    OSSL_FUNC_store_open() should create a provider side context with data based on the input uri. The implementation is entirely responsible for the interpretation of the URI.

                                                                                                                                    OSSL_FUNC_store_attach() should create a provider side context with the core BIO bio attached. This is an alternative to using a URI to find storage, supporting OSSL_STORE_attach(3).

                                                                                                                                    OSSL_FUNC_store_settable_ctx_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_store_set_ctx_params() can handle.

                                                                                                                                    OSSL_FUNC_store_set_ctx_params() should set additional parameters, such as what kind of data to expect, search criteria, and so on. More on those below, in \"Load Parameters\". Whether unrecognised parameters are an error or simply ignored is at the implementation's discretion. Passing NULL for params should return true.

                                                                                                                                    OSSL_FUNC_store_load() loads the next object from the URI opened by OSSL_FUNC_store_open(), creates an object abstraction for it (see provider-object(7)), and calls object_cb with it as well as object_cbarg. object_cb will then interpret the object abstraction and do what it can to wrap it or decode it into an OpenSSL structure. In case a passphrase needs to be prompted to unlock an object, pw_cb should be called.

                                                                                                                                    OSSL_FUNC_store_eof() indicates if the end of the set of objects from the URI has been reached. When that happens, there's no point trying to do any further loading.

                                                                                                                                    OSSL_FUNC_store_close() frees the provider side context ctx.

                                                                                                                                    When a provider-native object is created by a store manager it would be unsuitable for direct use with a foreign provider. The export function allows for exporting the object to that foreign provider if the foreign provider supports the type of the object and provides an import function.

                                                                                                                                    OSSL_FUNC_store_export_object() should export the object of size objref_sz referenced by objref as an OSSL_PARAM(3) array and pass that to the export_cb as well as the given export_cbarg.

                                                                                                                                    "},{"location":"man7/provider-storemgmt/#load-parameters","title":"Load Parameters","text":"
                                                                                                                                    • \"expect\" (OSSL_STORE_PARAM_EXPECT) <integer>

                                                                                                                                      Is a hint of what type of data the OpenSSL library expects to get. This is only useful for optimization, as the library will check that the object types match the expectation too.

                                                                                                                                      The number that can be given through this parameter is found in <openssl/store.h>, with the macros having names starting with OSSL_STORE_INFO_. These are further described in \"SUPPORTED OBJECTS\" in OSSL_STORE_INFO(3).

                                                                                                                                    • \"subject\" (OSSL_STORE_PARAM_SUBJECT) <octet string>

                                                                                                                                      Indicates that the caller wants to search for an object with the given subject associated. This can be used to select specific certificates by subject.

                                                                                                                                      The contents of the octet string is expected to be in DER form.

                                                                                                                                    • \"issuer\" (OSSL_STORE_PARAM_ISSUER) <octet string>

                                                                                                                                      Indicates that the caller wants to search for an object with the given issuer associated. This can be used to select specific certificates by issuer.

                                                                                                                                      The contents of the octet string is expected to be in DER form.

                                                                                                                                    • \"serial\" (OSSL_STORE_PARAM_SERIAL) <integer>

                                                                                                                                      Indicates that the caller wants to search for an object with the given serial number associated.

                                                                                                                                    • \"digest\" (OSSL_STORE_PARAM_DIGEST)

                                                                                                                                    • \"fingerprint\" (OSSL_STORE_PARAM_FINGERPRINT) <octet string>

                                                                                                                                      Indicates that the caller wants to search for an object with the given fingerprint, computed with the given digest.

                                                                                                                                    • \"alias\" (OSSL_STORE_PARAM_ALIAS)

                                                                                                                                      Indicates that the caller wants to search for an object with the given alias (some call it a \"friendly name\").

                                                                                                                                    • \"properties\" (OSSL_STORE_PARAM_PROPERTIES) <utf8 string>

                                                                                                                                      Property string to use when querying for algorithms such as the OSSL_DECODER decoder implementations.

                                                                                                                                    • \"input-type\" (OSSL_STORE_PARAM_INPUT_TYPE) <utf8 string>

                                                                                                                                      Type of the input format as a hint to use when decoding the objects in the store.

                                                                                                                                    • Several of these search criteria may be combined. For example, to search for a certificate by issuer+serial, both the \"issuer\" and the \"serial\" parameters will be given.

                                                                                                                                      "},{"location":"man7/provider-storemgmt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      provider(7)

                                                                                                                                      "},{"location":"man7/provider-storemgmt/#history","title":"HISTORY","text":"

                                                                                                                                      The STORE interface was introduced in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man7/provider-storemgmt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man7/provider/","title":"provider","text":""},{"location":"man7/provider/#name","title":"NAME","text":"

                                                                                                                                      provider - OpenSSL operation implementation providers

                                                                                                                                      "},{"location":"man7/provider/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      #include <openssl/provider.h>

                                                                                                                                      "},{"location":"man7/provider/#description","title":"DESCRIPTION","text":""},{"location":"man7/provider/#general","title":"General","text":"

                                                                                                                                      This page contains information useful to provider authors.

                                                                                                                                      A provider, in OpenSSL terms, is a unit of code that provides one or more implementations for various operations for diverse algorithms that one might want to perform.

                                                                                                                                      An operation is something one wants to do, such as encryption and decryption, key derivation, MAC calculation, signing and verification, etc.

                                                                                                                                      An algorithm is a named method to perform an operation. Very often, the algorithms revolve around cryptographic operations, but may also revolve around other types of operation, such as managing certain types of objects.

                                                                                                                                      See crypto(7) for further details.

                                                                                                                                      "},{"location":"man7/provider/#provider_1","title":"Provider","text":"

                                                                                                                                      A provider offers an initialization function, as a set of base functions in the form of an OSSL_DISPATCH(3) array, and by extension, a set of OSSL_ALGORITHM(3)s (see openssl-core.h(7)). It may be a dynamically loadable module, or may be built-in, in OpenSSL libraries or in the application. If it's a dynamically loadable module, the initialization function must be named OSSL_provider_init and must be exported. If it's built-in, the initialization function may have any name.

                                                                                                                                      The initialization function must have the following signature:

                                                                                                                                      int NAME(const OSSL_CORE_HANDLE *handle,\n         const OSSL_DISPATCH *in, const OSSL_DISPATCH **out,\n         void **provctx);\n

                                                                                                                                      handle is the OpenSSL library object for the provider, and works as a handle for everything the OpenSSL libraries need to know about the provider. For the provider itself, it is passed to some of the functions given in the dispatch array in.

                                                                                                                                      in is a dispatch array of base functions offered by the OpenSSL libraries, and the available functions are further described in provider-base(7).

                                                                                                                                      *out must be assigned a dispatch array of base functions that the provider offers to the OpenSSL libraries. The functions that may be offered are further described in provider-base(7), and they are the central means of communication between the OpenSSL libraries and the provider.

                                                                                                                                      *provctx should be assigned a provider specific context to allow the provider multiple simultaneous uses. This pointer will be passed to various operation functions offered by the provider.

                                                                                                                                      Note that the provider will not be made available for applications to use until the initialization function has completed and returned successfully.

                                                                                                                                      One of the functions the provider offers to the OpenSSL libraries is the central mechanism for the OpenSSL libraries to get access to operation implementations for diverse algorithms. Its referred to with the number OSSL_FUNC_PROVIDER_QUERY_OPERATION and has the following signature:

                                                                                                                                      const OSSL_ALGORITHM *provider_query_operation(void *provctx,\n                                               int operation_id,\n                                               const int *no_store);\n

                                                                                                                                      provctx is the provider specific context that was passed back by the initialization function.

                                                                                                                                      operation_id is an operation identity (see \"Operations\" below).

                                                                                                                                      no_store is a flag back to the OpenSSL libraries which, when nonzero, signifies that the OpenSSL libraries will not store a reference to the returned data in their internal store of implementations.

                                                                                                                                      The returned OSSL_ALGORITHM(3) is the foundation of any OpenSSL library API that uses providers for their implementation, most commonly in the fetching type of functions (see \"ALGORITHM FETCHING\" in crypto(7)).

                                                                                                                                      "},{"location":"man7/provider/#operations","title":"Operations","text":"

                                                                                                                                      Operations are referred to with numbers, via macros with names starting with OSSL_OP_.

                                                                                                                                      With each operation comes a set of defined function types that a provider may or may not offer, depending on its needs.

                                                                                                                                      Currently available operations are:

                                                                                                                                      • Digests

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is EVP_MD. The number for this operation is OSSL_OP_DIGEST. The functions the provider can offer are described in provider-digest(7).

                                                                                                                                      • Symmetric ciphers

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is EVP_CIPHER. The number for this operation is OSSL_OP_CIPHER. The functions the provider can offer are described in provider-cipher(7).

                                                                                                                                      • Message Authentication Code (MAC)

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is EVP_MAC. The number for this operation is OSSL_OP_MAC. The functions the provider can offer are described in provider-mac(7).

                                                                                                                                      • Key Derivation Function (KDF)

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is EVP_KDF. The number for this operation is OSSL_OP_KDF. The functions the provider can offer are described in provider-kdf(7).

                                                                                                                                      • Key Exchange

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is EVP_KEYEXCH. The number for this operation is OSSL_OP_KEYEXCH. The functions the provider can offer are described in provider-keyexch(7).

                                                                                                                                      • Asymmetric Ciphers

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is EVP_ASYM_CIPHER. The number for this operation is OSSL_OP_ASYM_CIPHER. The functions the provider can offer are described in provider-asym_cipher(7).

                                                                                                                                      • Asymmetric Key Encapsulation

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is EVP_KEM. The number for this operation is OSSL_OP_KEM. The functions the provider can offer are described in provider-kem(7).

                                                                                                                                      • Encoding

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is OSSL_ENCODER. The number for this operation is OSSL_OP_ENCODER. The functions the provider can offer are described in provider-encoder(7).

                                                                                                                                      • Decoding

                                                                                                                                        In the OpenSSL libraries, the corresponding method object is OSSL_DECODER. The number for this operation is OSSL_OP_DECODER. The functions the provider can offer are described in provider-decoder(7).

                                                                                                                                      • Random Number Generation

                                                                                                                                        The number for this operation is OSSL_OP_RAND. The functions the provider can offer for random number generation are described in provider-rand(7).

                                                                                                                                      • Key Management

                                                                                                                                        The number for this operation is OSSL_OP_KEYMGMT. The functions the provider can offer for key management are described in provider-keymgmt(7).

                                                                                                                                      • Signing and Signature Verification

                                                                                                                                        The number for this operation is OSSL_OP_SIGNATURE. The functions the provider can offer for digital signatures are described in provider-signature(7).

                                                                                                                                      • Store Management

                                                                                                                                        The number for this operation is OSSL_OP_STORE. The functions the provider can offer for store management are described in provider-storemgmt(7).

                                                                                                                                      "},{"location":"man7/provider/#algorithm-naming","title":"Algorithm naming","text":"

                                                                                                                                      Algorithm names are case insensitive. Any particular algorithm can have multiple aliases associated with it. The canonical OpenSSL naming scheme follows this format:

                                                                                                                                      ALGNAME[VERSION?][-SUBNAME[VERSION?]?][-SIZE?][-MODE?]

                                                                                                                                      VERSION is only present if there are multiple versions of an algorithm (e.g. MD2, MD4, MD5). It may be omitted if there is only one version.

                                                                                                                                      SUBNAME may be present where multiple algorithms are combined together, e.g. MD5-SHA1.

                                                                                                                                      SIZE is only present if multiple versions of an algorithm exist with different sizes (e.g. AES-128-CBC, AES-256-CBC)

                                                                                                                                      MODE is only present where applicable.

                                                                                                                                      Other aliases may exist for example where standards bodies or common practice use alternative names or names that OpenSSL has used historically.

                                                                                                                                      "},{"location":"man7/provider/#openssl-providers","title":"OPENSSL PROVIDERS","text":"

                                                                                                                                      OpenSSL provides a number of its own providers. These are the default, base, fips, legacy and null providers. See crypto(7) for an overview of these providers.

                                                                                                                                      "},{"location":"man7/provider/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_DigestInit_ex(3), EVP_EncryptInit_ex(3), OSSL_LIB_CTX(3), EVP_set_default_properties(3), EVP_MD_fetch(3), EVP_CIPHER_fetch(3), EVP_KEYMGMT_fetch(3), openssl-core.h(7), provider-base(7), provider-digest(7), provider-cipher(7), provider-keyexch(7)

                                                                                                                                      "},{"location":"man7/provider/#history","title":"HISTORY","text":"

                                                                                                                                      The concept of providers and everything surrounding them was introduced in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man7/provider/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man7/proxy-certificates/","title":"proxy-certificates","text":""},{"location":"man7/proxy-certificates/#name","title":"NAME","text":"

                                                                                                                                      proxy-certificates - Proxy certificates in OpenSSL

                                                                                                                                      "},{"location":"man7/proxy-certificates/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Proxy certificates are defined in RFC 3820. They are used to extend rights to some other entity (a computer process, typically, or sometimes to the user itself). This allows the entity to perform operations on behalf of the owner of the EE (End Entity) certificate.

                                                                                                                                      The requirements for a valid proxy certificate are:

                                                                                                                                      • They are issued by an End Entity, either a normal EE certificate, or another proxy certificate.
                                                                                                                                      • They must not have the subjectAltName or issuerAltName extensions.
                                                                                                                                      • They must have the proxyCertInfo extension.
                                                                                                                                      • They must have the subject of their issuer, with one commonName added.
                                                                                                                                      "},{"location":"man7/proxy-certificates/#enabling-proxy-certificate-verification","title":"Enabling proxy certificate verification","text":"

                                                                                                                                      OpenSSL expects applications that want to use proxy certificates to be specially aware of them, and make that explicit. This is done by setting an X509 verification flag:

                                                                                                                                      X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS);\n

                                                                                                                                      or

                                                                                                                                      X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_ALLOW_PROXY_CERTS);\n

                                                                                                                                      See \"NOTES\" for a discussion on this requirement.

                                                                                                                                      "},{"location":"man7/proxy-certificates/#creating-proxy-certificates","title":"Creating proxy certificates","text":"

                                                                                                                                      Creating proxy certificates can be done using the openssl-x509(1) command, with some extra extensions:

                                                                                                                                      [ proxy ]\n

                                                                                                                                      # # A proxy certificate MUST NEVER be a CA certificate. basicConstraints = CA:FALSE # # Usual authority key ID authorityKeyIdentifier = keyid,issuer:always # # The extension which marks this certificate as a proxy proxyCertInfo = critical,language:id-ppl-anyLanguage,pathlen:1,policy:text:AB

                                                                                                                                      It's also possible to specify the proxy extension in a separate section:

                                                                                                                                      proxyCertInfo = critical,@proxy_ext\n\n[ proxy_ext ]\nlanguage = id-ppl-anyLanguage\npathlen = 0\npolicy = text:BC\n

                                                                                                                                      The policy value has a specific syntax, syntag:string, where the syntag determines what will be done with the string. The following _syntag_s are recognised:

                                                                                                                                      • text

                                                                                                                                        indicates that the string is a byte sequence, without any encoding:

                                                                                                                                        policy=text:r\u00e4ksm\u00f6rg\u00e5s\n
                                                                                                                                      • hex

                                                                                                                                        indicates the string is encoded hexadecimal encoded binary data, with colons between each byte (every second hex digit):

                                                                                                                                        policy=hex:72:E4:6B:73:6D:F6:72:67:E5:73\n
                                                                                                                                      • file

                                                                                                                                        indicates that the text of the policy should be taken from a file. The string is then a filename. This is useful for policies that are more than a few lines, such as XML or other markup.

                                                                                                                                      Note that the proxy policy value is what determines the rights granted to the process during the proxy certificate, and it is up to the application to interpret and combine these policies.>

                                                                                                                                      With a proxy extension, creating a proxy certificate is a matter of two commands:

                                                                                                                                      openssl req -new -config proxy.cnf \\\n    -out proxy.req -keyout proxy.key \\\n    -subj \"/DC=org/DC=openssl/DC=users/CN=proxy\"\n\nopenssl x509 -req -CAcreateserial -in proxy.req -out proxy.crt \\\n    -CA user.crt -CAkey user.key -days 7 \\\n    -extfile proxy.cnf -extensions proxy\n

                                                                                                                                      You can also create a proxy certificate using another proxy certificate as issuer. Note that this example uses a different configuration section for the proxy extensions:

                                                                                                                                      openssl req -new -config proxy.cnf \\\n    -out proxy2.req -keyout proxy2.key \\\n    -subj \"/DC=org/DC=openssl/DC=users/CN=proxy/CN=proxy 2\"\n\nopenssl x509 -req -CAcreateserial -in proxy2.req -out proxy2.crt \\\n    -CA proxy.crt -CAkey proxy.key -days 7 \\\n    -extfile proxy.cnf -extensions proxy_2\n
                                                                                                                                      "},{"location":"man7/proxy-certificates/#using-proxy-certs-in-applications","title":"Using proxy certs in applications","text":"

                                                                                                                                      To interpret proxy policies, the application would normally start with some default rights (perhaps none at all), then compute the resulting rights by checking the rights against the chain of proxy certificates, user certificate and CA certificates.

                                                                                                                                      The complicated part is figuring out how to pass data between your application and the certificate validation procedure.

                                                                                                                                      The following ingredients are needed for such processing:

                                                                                                                                      • a callback function that will be called for every certificate being validated. The callback is called several times for each certificate, so you must be careful to do the proxy policy interpretation at the right time. You also need to fill in the defaults when the EE certificate is checked.
                                                                                                                                      • a data structure that is shared between your application code and the callback.
                                                                                                                                      • a wrapper function that sets it all up.
                                                                                                                                      • an ex_data index function that creates an index into the generic ex_data store that is attached to an X509 validation context.

                                                                                                                                      The following skeleton code can be used as a starting point:

                                                                                                                                      #include <string.h>\n#include <netdb.h>\n#include <openssl/x509.h>\n#include <openssl/x509v3.h>\n\n#define total_rights 25\n\n/*\n * In this example, I will use a view of granted rights as a bit\n * array, one bit for each possible right.\n */\ntypedef struct your_rights {\n    unsigned char rights[(total_rights + 7) / 8];\n} YOUR_RIGHTS;\n\n/*\n * The following procedure will create an index for the ex_data\n * store in the X509 validation context the first time it's\n * called.  Subsequent calls will return the same index.\n */\nstatic int get_proxy_auth_ex_data_idx(X509_STORE_CTX *ctx)\n{\n    static volatile int idx = -1;\n\n    if (idx < 0) {\n        X509_STORE_lock(X509_STORE_CTX_get0_store(ctx));\n        if (idx < 0) {\n            idx = X509_STORE_CTX_get_ex_new_index(0,\n                                                  \"for verify callback\",\n                                                  NULL,NULL,NULL);\n        }\n        X509_STORE_unlock(X509_STORE_CTX_get0_store(ctx));\n    }\n    return idx;\n}\n\n/* Callback to be given to the X509 validation procedure.  */\nstatic int verify_callback(int ok, X509_STORE_CTX *ctx)\n{\n    if (ok == 1) {\n        /*\n         * It's REALLY important you keep the proxy policy check\n         * within this section.  It's important to know that when\n         * ok is 1, the certificates are checked from top to\n         * bottom.  You get the CA root first, followed by the\n         * possible chain of intermediate CAs, followed by the EE\n         * certificate, followed by the possible proxy\n         * certificates.\n         */\n        X509 *xs = X509_STORE_CTX_get_current_cert(ctx);\n\n        if (X509_get_extension_flags(xs) & EXFLAG_PROXY) {\n            YOUR_RIGHTS *rights =\n                (YOUR_RIGHTS *)X509_STORE_CTX_get_ex_data(ctx,\n                    get_proxy_auth_ex_data_idx(ctx));\n            PROXY_CERT_INFO_EXTENSION *pci =\n                X509_get_ext_d2i(xs, NID_proxyCertInfo, NULL, NULL);\n\n            switch (OBJ_obj2nid(pci->proxyPolicy->policyLanguage)) {\n            case NID_Independent:\n                /*\n                 * Do whatever you need to grant explicit rights\n                 * to this particular proxy certificate, usually\n                 * by pulling them from some database.  If there\n                 * are none to be found, clear all rights (making\n                 * this and any subsequent proxy certificate void\n                 * of any rights).\n                 */\n                memset(rights->rights, 0, sizeof(rights->rights));\n                break;\n            case NID_id_ppl_inheritAll:\n                /*\n                 * This is basically a NOP, we simply let the\n                 * current rights stand as they are.\n                 */\n                break;\n            default:\n                /*\n                 * This is usually the most complex section of\n                 * code.  You really do whatever you want as long\n                 * as you follow RFC 3820.  In the example we use\n                 * here, the simplest thing to do is to build\n                 * another, temporary bit array and fill it with\n                 * the rights granted by the current proxy\n                 * certificate, then use it as a mask on the\n                 * accumulated rights bit array, and voil\u00e0, you\n                 * now have a new accumulated rights bit array.\n                 */\n                {\n                    int i;\n                    YOUR_RIGHTS tmp_rights;\n                    memset(tmp_rights.rights, 0,\n                           sizeof(tmp_rights.rights));\n\n                    /*\n                     * process_rights() is supposed to be a\n                     * procedure that takes a string and its\n                     * length, interprets it and sets the bits\n                     * in the YOUR_RIGHTS pointed at by the\n                     * third argument.\n                     */\n                    process_rights((char *) pci->proxyPolicy->policy->data,\n                                   pci->proxyPolicy->policy->length,\n                                   &tmp_rights);\n\n                    for(i = 0; i < total_rights / 8; i++)\n                        rights->rights[i] &= tmp_rights.rights[i];\n                }\n                break;\n            }\n            PROXY_CERT_INFO_EXTENSION_free(pci);\n        } else if (!(X509_get_extension_flags(xs) & EXFLAG_CA)) {\n            /* We have an EE certificate, let's use it to set default! */\n            YOUR_RIGHTS *rights =\n                (YOUR_RIGHTS *)X509_STORE_CTX_get_ex_data(ctx,\n                    get_proxy_auth_ex_data_idx(ctx));\n\n            /*\n             * The following procedure finds out what rights the\n             * owner of the current certificate has, and sets them\n             * in the YOUR_RIGHTS structure pointed at by the\n             * second argument.\n             */\n            set_default_rights(xs, rights);\n        }\n    }\n    return ok;\n}\n\nstatic int my_X509_verify_cert(X509_STORE_CTX *ctx,\n                               YOUR_RIGHTS *needed_rights)\n{\n    int ok;\n    int (*save_verify_cb)(int ok,X509_STORE_CTX *ctx) =\n        X509_STORE_CTX_get_verify_cb(ctx);\n    YOUR_RIGHTS rights;\n\n    X509_STORE_CTX_set_verify_cb(ctx, verify_callback);\n    X509_STORE_CTX_set_ex_data(ctx, get_proxy_auth_ex_data_idx(ctx),\n                               &rights);\n    X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS);\n    ok = X509_verify_cert(ctx);\n\n    if (ok == 1) {\n        ok = check_needed_rights(rights, needed_rights);\n    }\n\n    X509_STORE_CTX_set_verify_cb(ctx, save_verify_cb);\n\n    return ok;\n}\n

                                                                                                                                      If you use SSL or TLS, you can easily set up a callback to have the certificates checked properly, using the code above:

                                                                                                                                      SSL_CTX_set_cert_verify_callback(s_ctx, my_X509_verify_cert,\n                                 &needed_rights);\n
                                                                                                                                      "},{"location":"man7/proxy-certificates/#notes","title":"NOTES","text":"

                                                                                                                                      To this date, it seems that proxy certificates have only been used in environments that are aware of them, and no one seems to have investigated how they can be used or misused outside of such an environment.

                                                                                                                                      For that reason, OpenSSL requires that applications aware of proxy certificates must also make that explicit.

                                                                                                                                      subjectAltName and issuerAltName are forbidden in proxy certificates, and this is enforced in OpenSSL. The subject must be the same as the issuer, with one commonName added on.

                                                                                                                                      "},{"location":"man7/proxy-certificates/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      X509_STORE_CTX_set_flags(3), X509_STORE_CTX_set_verify_cb(3), X509_VERIFY_PARAM_set_flags(3), SSL_CTX_set_cert_verify_callback(3), openssl-req(1), openssl-x509(1), RFC 3820

                                                                                                                                      "},{"location":"man7/proxy-certificates/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man7/ssl/","title":"ssl","text":""},{"location":"man7/ssl/#name","title":"NAME","text":"

                                                                                                                                      ssl - OpenSSL SSL/TLS library

                                                                                                                                      "},{"location":"man7/ssl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      See the individual manual pages for details.

                                                                                                                                      "},{"location":"man7/ssl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The OpenSSL ssl library implements several versions of the Secure Sockets Layer, Transport Layer Security, and Datagram Transport Layer Security protocols. This page gives a brief overview of the extensive API and data types provided by the library.

                                                                                                                                      An SSL_CTX object is created as a framework to establish TLS/SSL enabled connections (see SSL_CTX_new(3)). Various options regarding certificates, algorithms etc. can be set in this object.

                                                                                                                                      When a network connection has been created, it can be assigned to an SSL object. After the SSL object has been created using SSL_new(3), SSL_set_fd(3) or SSL_set_bio(3) can be used to associate the network connection with the object.

                                                                                                                                      When the TLS/SSL handshake is performed using SSL_accept(3) or SSL_connect(3) respectively. SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) and SSL_write(3) are used to read and write data on the TLS/SSL connection. SSL_shutdown(3) can be used to shut down the TLS/SSL connection.

                                                                                                                                      "},{"location":"man7/ssl/#data-structures","title":"DATA STRUCTURES","text":"

                                                                                                                                      Here are some of the main data structures in the library.

                                                                                                                                      • SSL_METHOD (SSL Method)

                                                                                                                                        This is a dispatch structure describing the internal ssl library methods/functions which implement the various protocol versions (SSLv3 TLSv1, ...). It's needed to create an SSL_CTX.

                                                                                                                                      • SSL_CIPHER (SSL Cipher)

                                                                                                                                        This structure holds the algorithm information for a particular cipher which are a core part of the SSL/TLS protocol. The available ciphers are configured on a SSL_CTX basis and the actual ones used are then part of the SSL_SESSION.

                                                                                                                                      • SSL_CTX (SSL Context)

                                                                                                                                        This is the global context structure which is created by a server or client once per program life-time and which holds mainly default values for the SSL structures which are later created for the connections.

                                                                                                                                      • SSL_SESSION (SSL Session)

                                                                                                                                        This is a structure containing the current TLS/SSL session details for a connection: SSL_CIPHERs, client and server certificates, keys, etc.

                                                                                                                                      • SSL (SSL Connection)

                                                                                                                                        This is the main SSL/TLS structure which is created by a server or client per established connection. This actually is the core structure in the SSL API. At run-time the application usually deals with this structure which has links to mostly all other structures.

                                                                                                                                      "},{"location":"man7/ssl/#header-files","title":"HEADER FILES","text":"

                                                                                                                                      Currently the OpenSSL ssl library provides the following C header files containing the prototypes for the data structures and functions:

                                                                                                                                      • <openssl/ssl.h>

                                                                                                                                        This is the common header file for the SSL/TLS API. Include it into your program to make the API of the ssl library available. It internally includes both more private SSL headers and headers from the crypto library. Whenever you need hard-core details on the internals of the SSL API, look inside this header file. This file also includes the others listed below.

                                                                                                                                      • <openssl/ssl2.h>

                                                                                                                                        Unused. Present for backwards compatibility only.

                                                                                                                                      • <openssl/ssl3.h>

                                                                                                                                        This is the sub header file dealing with the SSLv3 protocol only.

                                                                                                                                      • <openssl/tls1.h>

                                                                                                                                        This is the sub header file dealing with the TLSv1 protocol only.

                                                                                                                                      "},{"location":"man7/ssl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man7/x509/","title":"x509","text":""},{"location":"man7/x509/#name","title":"NAME","text":"

                                                                                                                                      x509 - X.509 certificate handling

                                                                                                                                      "},{"location":"man7/x509/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/x509.h>\n
                                                                                                                                      "},{"location":"man7/x509/#description","title":"DESCRIPTION","text":"

                                                                                                                                      An X.509 certificate is a structured grouping of information about an individual, a device, or anything one can imagine. An X.509 CRL (certificate revocation list) is a tool to help determine if a certificate is still valid. The exact definition of those can be found in the X.509 document from ITU-T, or in RFC3280 from PKIX. In OpenSSL, the type X509 is used to express such a certificate, and the type X509_CRL is used to express a CRL.

                                                                                                                                      A related structure is a certificate request, defined in PKCS#10 from RSA Security, Inc, also reflected in RFC2896. In OpenSSL, the type X509_REQ is used to express such a certificate request.

                                                                                                                                      To handle some complex parts of a certificate, there are the types X509_NAME (to express a certificate name), X509_ATTRIBUTE (to express a certificate attribute), X509_EXTENSION (to express a certificate extension) and a few more.

                                                                                                                                      Finally, there's the supertype X509_INFO, which can contain a CRL, a certificate and a corresponding private key.

                                                                                                                                      X509_XXX, d2i_X509_XXX, and i2d_X509_XXX functions handle X.509 certificates, with some exceptions, shown below.

                                                                                                                                      X509_CRL_XXX, d2i_X509_CRL_XXX, and i2d_X509_CRL_XXX functions handle X.509 CRLs.

                                                                                                                                      X509_REQ_XXX, d2i_X509_REQ_XXX, and i2d_X509_REQ_XXX functions handle PKCS#10 certificate requests.

                                                                                                                                      X509_NAME_XXX functions handle certificate names.

                                                                                                                                      X509_ATTRIBUTE_XXX functions handle certificate attributes.

                                                                                                                                      X509_EXTENSION_XXX functions handle certificate extensions.

                                                                                                                                      "},{"location":"man7/x509/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      X509_NAME_ENTRY_get_object(3), X509_NAME_add_entry_by_txt(3), X509_NAME_add_entry_by_NID(3), X509_NAME_print_ex(3), X509_NAME_new(3), PEM_X509_INFO_read(3), d2i_X509(3), d2i_X509_ALGOR(3), d2i_X509_CRL(3), d2i_X509_NAME(3), d2i_X509_REQ(3), d2i_X509_SIG(3), crypto(7)

                                                                                                                                      "},{"location":"man7/x509/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"man1/CA.pl/","title":"CA.pl","text":""},{"location":"man1/CA.pl/#name","title":"NAME","text":"

                                                                                                                                      CA.pl - friendlier interface for OpenSSL certificate programs

                                                                                                                                      "},{"location":"man1/CA.pl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      CA.pl -? | -h | -help

                                                                                                                                      CA.pl -newcert | -newreq | -newreq-nodes | -xsign | -sign | -signCA | -signcert | -crl | -newca [-extra-cmd parameter]

                                                                                                                                      CA.pl -pkcs12 [certname]

                                                                                                                                      CA.pl -verify certfile ...

                                                                                                                                      CA.pl -revoke certfile [reason]

                                                                                                                                      "},{"location":"man1/CA.pl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The CA.pl script is a perl script that supplies the relevant command line arguments to the openssl(1) command for some common certificate operations. It is intended to simplify the process of certificate creation and management by the use of some simple options.

                                                                                                                                      The script is intended as a simple front end for the openssl(1) program for use by a beginner. Its behaviour isn't always what is wanted. For more control over the behaviour of the certificate commands call the openssl(1) command directly.

                                                                                                                                      Most of the filenames mentioned below can be modified by editing the CA.pl script.

                                                                                                                                      Under some environments it may not be possible to run the CA.pl script directly (for example Win32) and the default configuration file location may be wrong. In this case the command:

                                                                                                                                      perl -S CA.pl\n

                                                                                                                                      can be used and the OPENSSL_CONF environment variable can be set to point to the correct path of the configuration file.

                                                                                                                                      "},{"location":"man1/CA.pl/#options","title":"OPTIONS","text":"
                                                                                                                                      • -?, -h, -help

                                                                                                                                        Prints a usage message.

                                                                                                                                      • -newcert

                                                                                                                                        Creates a new self signed certificate. The private key is written to the file newkey.pem and the request written to the file newreq.pem. Invokes openssl-req(1).

                                                                                                                                      • -newreq

                                                                                                                                        Creates a new certificate request. The private key is written to the file newkey.pem and the request written to the file newreq.pem. Executes openssl-req(1) under the hood.

                                                                                                                                      • -newreq-nodes

                                                                                                                                        Is like -newreq except that the private key will not be encrypted. Uses openssl-req(1).

                                                                                                                                      • -newca

                                                                                                                                        Creates a new CA hierarchy for use with the ca program (or the -signcert and -xsign options). The user is prompted to enter the filename of the CA certificates (which should also contain the private key) or by hitting ENTER details of the CA will be prompted for. The relevant files and directories are created in a directory called demoCA in the current directory. Uses openssl-req(1) and openssl-ca(1).

                                                                                                                                        If the demoCA directory already exists then the -newca command will not overwrite it and will do nothing. This can happen if a previous call using the -newca option terminated abnormally. To get the correct behaviour delete the directory if it already exists.

                                                                                                                                      • -pkcs12

                                                                                                                                        Create a PKCS#12 file containing the user certificate, private key and CA certificate. It expects the user certificate and private key to be in the file newcert.pem and the CA certificate to be in the file demoCA/cacert.pem, it creates a file newcert.p12. This command can thus be called after the -sign option. The PKCS#12 file can be imported directly into a browser. If there is an additional argument on the command line it will be used as the \"friendly name\" for the certificate (which is typically displayed in the browser list box), otherwise the name \"My Certificate\" is used. Delegates work to openssl-pkcs12(1).

                                                                                                                                      • -sign, -signcert, -xsign

                                                                                                                                        Calls the openssl-ca(1) command to sign a certificate request. It expects the request to be in the file newreq.pem. The new certificate is written to the file newcert.pem except in the case of the -xsign option when it is written to standard output.

                                                                                                                                      • -signCA

                                                                                                                                        This option is the same as the -sign option except it uses the configuration file section v3_ca and so makes the signed request a valid CA certificate. This is useful when creating intermediate CA from a root CA. Extra params are passed to openssl-ca(1).

                                                                                                                                      • -signcert

                                                                                                                                        This option is the same as -sign except it expects a self signed certificate to be present in the file newreq.pem. Extra params are passed to openssl-x509(1) and openssl-ca(1).

                                                                                                                                      • -crl

                                                                                                                                        Generate a CRL. Executes openssl-ca(1).

                                                                                                                                      • -revoke certfile [reason]

                                                                                                                                        Revoke the certificate contained in the specified certfile. An optional reason may be specified, and must be one of: unspecified, keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold, or removeFromCRL. Leverages openssl-ca(1).

                                                                                                                                      • -verify

                                                                                                                                        Verifies certificates against the CA certificate for demoCA. If no certificates are specified on the command line it tries to verify the file newcert.pem. Invokes openssl-verify(1).

                                                                                                                                      • -extra-cmd parameter

                                                                                                                                        For each option extra-cmd, pass parameter to the openssl(1) sub-command with the same name as cmd, if that sub-command is invoked. For example, if openssl-req(1) is invoked, the parameter given with -extra-req will be passed to it. For multi-word parameters, either repeat the option or quote the parameters so it looks like one word to your shell. See the individual command documentation for more information.

                                                                                                                                      "},{"location":"man1/CA.pl/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create a CA hierarchy:

                                                                                                                                      CA.pl -newca\n

                                                                                                                                      Complete certificate creation example: create a CA, create a request, sign the request and finally create a PKCS#12 file containing it.

                                                                                                                                      CA.pl -newca\nCA.pl -newreq\nCA.pl -sign\nCA.pl -pkcs12 \"My Test Certificate\"\n
                                                                                                                                      "},{"location":"man1/CA.pl/#environment","title":"ENVIRONMENT","text":"

                                                                                                                                      The environment variable OPENSSL may be used to specify the name of the OpenSSL program. It can be a full pathname, or a relative one.

                                                                                                                                      The environment variable OPENSSL_CONFIG may be used to specify a configuration option and value to the req and ca commands invoked by this script. It's value should be the option and pathname, as in -config /path/to/conf-file.

                                                                                                                                      "},{"location":"man1/CA.pl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-x509(1), openssl-ca(1), openssl-req(1), openssl-pkcs12(1), config(5)

                                                                                                                                      "},{"location":"man1/CA.pl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/","title":"openssl-asn1parse","text":""},{"location":"man1/openssl-asn1parse/#name","title":"NAME","text":"

                                                                                                                                      openssl-asn1parse - ASN.1 parsing command

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl asn1parse [-help] [-inform DER|PEM] [-in filename] [-out filename] [-noout] [-offset number] [-length number] [-i] [-oid filename] [-dump] [-dlimit num] [-strparse offset] [-genstr string] [-genconf file] [-strictpem] [-item name]

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is a diagnostic utility that can parse ASN.1 structures. It can also be used to extract data from ASN.1 formatted data.

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The input format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                      • -in filename

                                                                                                                                        The input file, default is standard input.

                                                                                                                                      • -out filename

                                                                                                                                        Output file to place the DER encoded data into. If this option is not present then no data will be output. This is most useful when combined with the -strparse option.

                                                                                                                                      • -noout

                                                                                                                                        Don't output the parsed version of the input file.

                                                                                                                                      • -offset number

                                                                                                                                        Starting offset to begin parsing, default is start of file.

                                                                                                                                      • -length number

                                                                                                                                        Number of bytes to parse, default is until end of file.

                                                                                                                                      • -i

                                                                                                                                        Indents the output according to the \"depth\" of the structures.

                                                                                                                                      • -oid filename

                                                                                                                                        A file containing additional OBJECT IDENTIFIERs (OIDs). The format of this file is described in the NOTES section below.

                                                                                                                                      • -dump

                                                                                                                                        Dump unknown data in hex format.

                                                                                                                                      • -dlimit num

                                                                                                                                        Like -dump, but only the first num bytes are output.

                                                                                                                                      • -strparse offset

                                                                                                                                        Parse the contents octets of the ASN.1 object starting at offset. This option can be used multiple times to \"drill down\" into a nested structure.

                                                                                                                                      • -genstr string, -genconf file

                                                                                                                                        Generate encoded data based on string, file or both using ASN1_generate_nconf(3) format. If file only is present then the string is obtained from the default section using the name asn1. The encoded data is passed through the ASN1 parser and printed out as though it came from a file, the contents can thus be examined and written to a file using the -out option.

                                                                                                                                      • -strictpem

                                                                                                                                        If this option is used then -inform will be ignored. Without this option any data in a PEM format input file will be treated as being base64 encoded and processed whether it has the normal PEM BEGIN and END markers or not. This option will ignore any data prior to the start of the BEGIN marker, or after an END marker in a PEM file.

                                                                                                                                      • -item name

                                                                                                                                        Attempt to decode and print the data as an ASN1_ITEM name. This can be used to print out the fields of any supported ASN.1 structure if the type is known.

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#output","title":"Output","text":"

                                                                                                                                      The output will typically contain lines like this:

                                                                                                                                      0:d=0  hl=4 l= 681 cons: SEQUENCE\n

                                                                                                                                      .....

                                                                                                                                      229:d=3  hl=3 l= 141 prim: BIT STRING\n373:d=2  hl=3 l= 162 cons: cont [ 3 ]\n376:d=3  hl=3 l= 159 cons: SEQUENCE\n379:d=4  hl=2 l=  29 cons: SEQUENCE\n381:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Subject Key Identifier\n386:d=5  hl=2 l=  22 prim: OCTET STRING\n410:d=4  hl=2 l= 112 cons: SEQUENCE\n412:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Authority Key Identifier\n417:d=5  hl=2 l= 105 prim: OCTET STRING\n524:d=4  hl=2 l=  12 cons: SEQUENCE\n

                                                                                                                                      .....

                                                                                                                                      This example is part of a self-signed certificate. Each line starts with the offset in decimal. d=XX specifies the current depth. The depth is increased within the scope of any SET or SEQUENCE. hl=XX gives the header length (tag and length octets) of the current type. l=XX gives the length of the contents octets.

                                                                                                                                      The -i option can be used to make the output more readable.

                                                                                                                                      Some knowledge of the ASN.1 structure is needed to interpret the output.

                                                                                                                                      In this example the BIT STRING at offset 229 is the certificate public key. The contents octets of this will contain the public key information. This can be examined using the option -strparse 229 to yield:

                                                                                                                                        0:d=0  hl=3 l= 137 cons: SEQUENCE\n  3:d=1  hl=3 l= 129 prim: INTEGER           :E5D21E1F5C8D208EA7A2166C7FAF9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A9746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9E1158A56E4A6F47E5897\n135:d=1  hl=2 l=   3 prim: INTEGER           :010001\n
                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#notes","title":"NOTES","text":"

                                                                                                                                      If an OID is not part of OpenSSL's internal table it will be represented in numerical form (for example 1.2.3.4). The file passed to the -oid option allows additional OIDs to be included. Each line consists of three columns, the first column is the OID in numerical format and should be followed by white space. The second column is the \"short name\" which is a single word followed by whitespace. The final column is the rest of the line and is the \"long name\". Example:

                                                                                                                                      1.2.3.4 shortName A long name

                                                                                                                                      For any OID with an associated short and long name, this command will display the long name.

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Parse a file:

                                                                                                                                      openssl asn1parse -in file.pem\n

                                                                                                                                      Parse a DER file:

                                                                                                                                      openssl asn1parse -inform DER -in file.der\n

                                                                                                                                      Generate a simple UTF8String:

                                                                                                                                      openssl asn1parse -genstr 'UTF8:Hello World'\n

                                                                                                                                      Generate and write out a UTF8String, don't print parsed output:

                                                                                                                                      openssl asn1parse -genstr 'UTF8:Hello World' -noout -out utf8.der\n

                                                                                                                                      Generate using a config file:

                                                                                                                                      openssl asn1parse -genconf asn1.cnf -noout -out asn1.der\n

                                                                                                                                      Example config file:

                                                                                                                                      asn1=SEQUENCE:seq_sect\n\n[seq_sect]\n\nfield1=BOOL:TRUE\nfield2=EXP:0, UTF8:some random string\n
                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#bugs","title":"BUGS","text":"

                                                                                                                                      There should be options to change the format of output lines. The output of some ASN.1 types is not well handled (if at all).

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), ASN1_generate_nconf(3)

                                                                                                                                      "},{"location":"man1/openssl-asn1parse/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-ca/","title":"openssl-ca","text":""},{"location":"man1/openssl-ca/#name","title":"NAME","text":"

                                                                                                                                      openssl-ca - sample minimal CA application

                                                                                                                                      "},{"location":"man1/openssl-ca/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl ca [-help] [-verbose] [-config filename] [-name section] [-section section] [-gencrl] [-revoke file] [-valid file] [-status serial] [-updatedb] [-crl_reason reason] [-crl_hold instruction] [-crl_compromise time] [-crl_CA_compromise time] [-crl_lastupdate date] [-crl_nextupdate date] [-crldays days] [-crlhours hours] [-crlsec seconds] [-crlexts section] [-startdate date] [-enddate date] [-days arg] [-md arg] [-policy arg] [-keyfile filename|uri] [-keyform DER|PEM|P12|ENGINE] [-key arg] [-passin arg] [-cert file] [-certform DER|PEM|P12] [-selfsign] [-in file] [-inform DER|] [-out file] [-notext] [-dateopt] [-outdir dir] [-infiles] [-spkac file] [-ss_cert file] [-preserveDN] [-noemailDN] [-batch] [-msie_hack] [-extensions section] [-extfile section] [-subj arg] [-utf8] [-sigopt nm:v] [-vfyopt nm:v] [-create_serial] [-rand_serial] [-multivalue-rdn] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [certreq...]"},{"location":"man1/openssl-ca/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command emulates a CA application. See the WARNINGS especially when considering to use it productively. It can be used to sign certificate requests (CSRs) in a variety of forms and generate certificate revocation lists (CRLs). It also maintains a text database of issued certificates and their status. When signing certificates, a single request can be specified with the -in option, or multiple requests can be processed by specifying a set of certreq files after all options.

                                                                                                                                      Note that there are also very lean ways of generating certificates: the req and x509 commands can be used for directly creating certificates. See openssl-req(1) and openssl-x509(1) for details.

                                                                                                                                      The descriptions of the ca command options are divided into each purpose.

                                                                                                                                      "},{"location":"man1/openssl-ca/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -verbose

                                                                                                                                        This prints extra details about the operations being performed.

                                                                                                                                      • -config filename

                                                                                                                                        Specifies the configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

                                                                                                                                      • -name section, -section section

                                                                                                                                        Specifies the configuration file section to use (overrides default_ca in the ca section).

                                                                                                                                      • -in filename

                                                                                                                                        An input filename containing a single certificate request (CSR) to be signed by the CA.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The format of the data in certificate request input files; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -ss_cert filename

                                                                                                                                        A single self-signed certificate to be signed by the CA.

                                                                                                                                      • -spkac filename

                                                                                                                                        A file containing a single Netscape signed public key and challenge and additional field values to be signed by the CA. See the SPKAC FORMAT section for information on the required input and output format.

                                                                                                                                      • -infiles

                                                                                                                                        If present this should be the last option, all subsequent arguments are taken as the names of files containing certificate requests.

                                                                                                                                      • -out filename

                                                                                                                                        The output file to output certificates to. The default is standard output. The certificate details will also be printed out to this file in PEM format (except that -spkac outputs DER format).

                                                                                                                                      • -outdir directory

                                                                                                                                        The directory to output certificates to. The certificate will be written to a filename consisting of the serial number in hex with .pem appended.

                                                                                                                                      • -cert filename

                                                                                                                                        The CA certificate, which must match with -keyfile.

                                                                                                                                      • -certform DER|PEM|P12

                                                                                                                                        The format of the data in certificate input files; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -keyfile filename|uri

                                                                                                                                        The CA private key to sign certificate requests with. This must match with -cert.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The format of the private key input file; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -sigopt nm:v

                                                                                                                                        Pass options to the signature algorithm during sign operations. Names and values of these options are algorithm-specific.

                                                                                                                                      • -vfyopt nm:v

                                                                                                                                        Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

                                                                                                                                        This often needs to be given while signing too, because the self-signature of a certificate signing request (CSR) is verified against the included public key, and that verification may need its own set of options.

                                                                                                                                      • -key password

                                                                                                                                        The password used to encrypt the private key. Since on some systems the command line arguments are visible (e.g., when using ps(1) on Unix), this option should be used with caution. Better use -passin.

                                                                                                                                      • -passin arg

                                                                                                                                        The key password source for key files and certificate PKCS#12 files. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -selfsign

                                                                                                                                        Indicates the issued certificates are to be signed with the key the certificate requests were signed with (given with -keyfile). Certificate requests signed with a different key are ignored. If -spkac, -ss_cert or -gencrl are given, -selfsign is ignored.

                                                                                                                                        A consequence of using -selfsign is that the self-signed certificate appears among the entries in the certificate database (see the configuration option database), and uses the same serial number counter as all other certificates sign with the self-signed certificate.

                                                                                                                                      • -notext

                                                                                                                                        Don't output the text form of a certificate to the output file.

                                                                                                                                      • -dateopt

                                                                                                                                        Specify the date output format. Values are: rfc_822 and iso_8601. Defaults to rfc_822.

                                                                                                                                      • -startdate date

                                                                                                                                        This allows the start date to be explicitly set. The format of the date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or YYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In both formats, seconds SS and timezone Z must be present.

                                                                                                                                      • -enddate date

                                                                                                                                        This allows the expiry date to be explicitly set. The format of the date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure), or YYYYMMDDHHMMSSZ (the same as an ASN1 GeneralizedTime structure). In both formats, seconds SS and timezone Z must be present.

                                                                                                                                      • -days arg

                                                                                                                                        The number of days to certify the certificate for.

                                                                                                                                      • -md alg

                                                                                                                                        The message digest to use. Any digest supported by the openssl-dgst(1) command can be used. For signing algorithms that do not support a digest (i.e. Ed25519 and Ed448) any message digest that is set is ignored. This option also applies to CRLs.

                                                                                                                                      • -policy arg

                                                                                                                                        This option defines the CA \"policy\" to use. This is a section in the configuration file which decides which fields should be mandatory or match the CA certificate. Check out the POLICY FORMAT section for more information.

                                                                                                                                      • -msie_hack

                                                                                                                                        This is a deprecated option to make this command work with very old versions of the IE certificate enrollment control \"certenr3\". It used UniversalStrings for almost everything. Since the old control has various security bugs its use is strongly discouraged.

                                                                                                                                      • -preserveDN

                                                                                                                                        Normally the DN order of a certificate is the same as the order of the fields in the relevant policy section. When this option is set the order is the same as the request. This is largely for compatibility with the older IE enrollment control which would only accept certificates if their DNs match the order of the request. This is not needed for Xenroll.

                                                                                                                                      • -noemailDN

                                                                                                                                        The DN of a certificate can contain the EMAIL field if present in the request DN, however, it is good policy just having the e-mail set into the altName extension of the certificate. When this option is set the EMAIL field is removed from the certificate' subject and set only in the, eventually present, extensions. The email_in_dn keyword can be used in the configuration file to enable this behaviour.

                                                                                                                                      • -batch

                                                                                                                                        This sets the batch mode. In this mode no questions will be asked and all certificates will be certified automatically.

                                                                                                                                      • -extensions section

                                                                                                                                        The section of the configuration file containing certificate extensions to be added when a certificate is issued (defaults to x509_extensions unless the -extfile option is used). If no X.509 extensions are specified then a V1 certificate is created, else a V3 certificate is created. See the x509v3_config(5) manual page for details of the extension section format.

                                                                                                                                      • -extfile file

                                                                                                                                        An additional configuration file to read certificate extensions from (using the default section unless the -extensions option is also used).

                                                                                                                                      • -subj arg

                                                                                                                                        Supersedes subject name given in the request.

                                                                                                                                        The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted, but the corresponding type will not be included in the resulting certificate. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

                                                                                                                                        /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

                                                                                                                                      • -utf8

                                                                                                                                        This option causes field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.

                                                                                                                                      • -create_serial

                                                                                                                                        If reading serial from the text file as specified in the configuration fails, specifying this option creates a new random serial to be used as next serial number. To get random serial numbers, use the -rand_serial flag instead; this should only be used for simple error-recovery.

                                                                                                                                      • -rand_serial

                                                                                                                                        Generate a large random number to use as the serial number. This overrides any option or configuration to use a serial number file.

                                                                                                                                      • -multivalue-rdn

                                                                                                                                        This option has been deprecated and has no effect.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-ca/#crl-options","title":"CRL OPTIONS","text":"
                                                                                                                                      • -gencrl

                                                                                                                                        This option generates a CRL based on information in the index file.

                                                                                                                                      • -crl_lastupdate time

                                                                                                                                        Allows the value of the CRL's lastUpdate field to be explicitly set; if this option is not present, the current time is used. Accepts times in YYMMDDHHMMSSZ format (the same as an ASN1 UTCTime structure) or YYYYMMDDHHMMSSZ format (the same as an ASN1 GeneralizedTime structure).

                                                                                                                                      • -crl_nextupdate time

                                                                                                                                        Allows the value of the CRL's nextUpdate field to be explicitly set; if this option is present, any values given for -crldays, -crlhours and -crlsec are ignored. Accepts times in the same formats as -crl_lastupdate.

                                                                                                                                      • -crldays num

                                                                                                                                        The number of days before the next CRL is due. That is the days from now to place in the CRL nextUpdate field.

                                                                                                                                      • -crlhours num

                                                                                                                                        The number of hours before the next CRL is due.

                                                                                                                                      • -crlsec num

                                                                                                                                        The number of seconds before the next CRL is due.

                                                                                                                                      • -revoke filename

                                                                                                                                        A filename containing a certificate to revoke.

                                                                                                                                      • -valid filename

                                                                                                                                        A filename containing a certificate to add a Valid certificate entry.

                                                                                                                                      • -status serial

                                                                                                                                        Displays the revocation status of the certificate with the specified serial number and exits.

                                                                                                                                      • -updatedb

                                                                                                                                        Updates the database index to purge expired certificates.

                                                                                                                                      • -crl_reason reason

                                                                                                                                        Revocation reason, where reason is one of: unspecified, keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold or removeFromCRL. The matching of reason is case insensitive. Setting any revocation reason will make the CRL v2.

                                                                                                                                        In practice removeFromCRL is not particularly useful because it is only used in delta CRLs which are not currently implemented.

                                                                                                                                      • -crl_hold instruction

                                                                                                                                        This sets the CRL revocation reason code to certificateHold and the hold instruction to instruction which must be an OID. Although any OID can be used only holdInstructionNone (the use of which is discouraged by RFC2459) holdInstructionCallIssuer or holdInstructionReject will normally be used.

                                                                                                                                      • -crl_compromise time

                                                                                                                                        This sets the revocation reason to keyCompromise and the compromise time to time. time should be in GeneralizedTime format that is YYYYMMDDHHMMSSZ.

                                                                                                                                      • -crl_CA_compromise time

                                                                                                                                        This is the same as crl_compromise except the revocation reason is set to CACompromise.

                                                                                                                                      • -crlexts section

                                                                                                                                        The section of the configuration file containing CRL extensions to include. If no CRL extension section is present then a V1 CRL is created, if the CRL extension section is present (even if it is empty) then a V2 CRL is created. The CRL extensions specified are CRL extensions and not CRL entry extensions. It should be noted that some software (for example Netscape) can't handle V2 CRLs. See x509v3_config(5) manual page for details of the extension section format.

                                                                                                                                      "},{"location":"man1/openssl-ca/#configuration-file-options","title":"CONFIGURATION FILE OPTIONS","text":"

                                                                                                                                      The section of the configuration file containing options for this command is found as follows: If the -name command line option is used, then it names the section to be used. Otherwise the section to be used must be named in the default_ca option of the ca section of the configuration file (or in the default section of the configuration file). Besides default_ca, the following options are read directly from the ca section: RANDFILE preserve msie_hack With the exception of RANDFILE, this is probably a bug and may change in future releases.

                                                                                                                                      Many of the configuration file options are identical to command line options. Where the option is present in the configuration file and the command line the command line value is used. Where an option is described as mandatory then it must be present in the configuration file or the command line equivalent (if any) used.

                                                                                                                                      • oid_file

                                                                                                                                        This specifies a file containing additional OBJECT IDENTIFIERS. Each line of the file should consist of the numerical form of the object identifier followed by whitespace then the short name followed by whitespace and finally the long name.

                                                                                                                                      • oid_section

                                                                                                                                        This specifies a section in the configuration file containing extra object identifiers. Each line should consist of the short name of the object identifier followed by = and the numerical form. The short and long names are the same when this option is used.

                                                                                                                                      • new_certs_dir

                                                                                                                                        The same as the -outdir command line option. It specifies the directory where new certificates will be placed. Mandatory.

                                                                                                                                      • certificate

                                                                                                                                        The same as -cert. It gives the file containing the CA certificate. Mandatory.

                                                                                                                                      • private_key

                                                                                                                                        Same as the -keyfile option. The file containing the CA private key. Mandatory.

                                                                                                                                      • RANDFILE

                                                                                                                                        At startup the specified file is loaded into the random number generator, and at exit 256 bytes will be written to it. (Note: Using a RANDFILE is not necessary anymore, see the \"HISTORY\" section.

                                                                                                                                      • default_days

                                                                                                                                        The same as the -days option. The number of days to certify a certificate for.

                                                                                                                                      • default_startdate

                                                                                                                                        The same as the -startdate option. The start date to certify a certificate for. If not set the current time is used.

                                                                                                                                      • default_enddate

                                                                                                                                        The same as the -enddate option. Either this option or default_days (or the command line equivalents) must be present.

                                                                                                                                      • default_crl_hours default_crl_days

                                                                                                                                        The same as the -crlhours and the -crldays options. These will only be used if neither command line option is present. At least one of these must be present to generate a CRL.

                                                                                                                                      • default_md

                                                                                                                                        The same as the -md option. Mandatory except where the signing algorithm does not require a digest (i.e. Ed25519 and Ed448).

                                                                                                                                      • database

                                                                                                                                        The text database file to use. Mandatory. This file must be present though initially it will be empty.

                                                                                                                                      • unique_subject

                                                                                                                                        If the value yes is given, the valid certificate entries in the database must have unique subjects. if the value no is given, several valid certificate entries may have the exact same subject. The default value is yes, to be compatible with older (pre 0.9.8) versions of OpenSSL. However, to make CA certificate roll-over easier, it's recommended to use the value no, especially if combined with the -selfsign command line option.

                                                                                                                                        Note that it is valid in some circumstances for certificates to be created without any subject. In the case where there are multiple certificates without subjects this does not count as a duplicate.

                                                                                                                                      • serial

                                                                                                                                        A text file containing the next serial number to use in hex. Mandatory. This file must be present and contain a valid serial number.

                                                                                                                                      • crlnumber

                                                                                                                                        A text file containing the next CRL number to use in hex. The crl number will be inserted in the CRLs only if this file exists. If this file is present, it must contain a valid CRL number.

                                                                                                                                      • x509_extensions

                                                                                                                                        A fallback to the -extensions option.

                                                                                                                                      • crl_extensions

                                                                                                                                        A fallback to the -crlexts option.

                                                                                                                                      • preserve

                                                                                                                                        The same as -preserveDN

                                                                                                                                      • email_in_dn

                                                                                                                                        The same as -noemailDN. If you want the EMAIL field to be removed from the DN of the certificate simply set this to 'no'. If not present the default is to allow for the EMAIL filed in the certificate's DN.

                                                                                                                                      • msie_hack

                                                                                                                                        The same as -msie_hack

                                                                                                                                      • policy

                                                                                                                                        The same as -policy. Mandatory. See the POLICY FORMAT section for more information.

                                                                                                                                      • name_opt, cert_opt

                                                                                                                                        These options allow the format used to display the certificate details when asking the user to confirm signing. All the options supported by the x509 utilities -nameopt and -certopt switches can be used here, except the no_signame and no_sigdump are permanently set and cannot be disabled (this is because the certificate signature cannot be displayed because the certificate has not been signed at this point).

                                                                                                                                        For convenience the values ca_default are accepted by both to produce a reasonable output.

                                                                                                                                        If neither option is present the format used in earlier versions of OpenSSL is used. Use of the old format is strongly discouraged because it only displays fields mentioned in the policy section, mishandles multicharacter string types and does not display extensions.

                                                                                                                                      • copy_extensions

                                                                                                                                        Determines how extensions in certificate requests should be handled. If set to none or this option is not present then extensions are ignored and not copied to the certificate. If set to copy then any extensions present in the request that are not already present are copied to the certificate. If set to copyall then all extensions in the request are copied to the certificate: if the extension is already present in the certificate it is deleted first. See the WARNINGS section before using this option.

                                                                                                                                        The main use of this option is to allow a certificate request to supply values for certain extensions such as subjectAltName.

                                                                                                                                      "},{"location":"man1/openssl-ca/#policy-format","title":"POLICY FORMAT","text":"

                                                                                                                                      The policy section consists of a set of variables corresponding to certificate DN fields. If the value is \"match\" then the field value must match the same field in the CA certificate. If the value is \"supplied\" then it must be present. If the value is \"optional\" then it may be present. Any fields not mentioned in the policy section are silently deleted, unless the -preserveDN option is set but this can be regarded more of a quirk than intended behaviour.

                                                                                                                                      "},{"location":"man1/openssl-ca/#spkac-format","title":"SPKAC FORMAT","text":"

                                                                                                                                      The input to the -spkac command line option is a Netscape signed public key and challenge. This will usually come from the KEYGEN tag in an HTML form to create a new private key. It is however possible to create SPKACs using openssl-spkac(1).

                                                                                                                                      The file should contain the variable SPKAC set to the value of the SPKAC and also the required DN components as name value pairs. If you need to include the same component twice then it can be preceded by a number and a '.'.

                                                                                                                                      When processing SPKAC format, the output is DER if the -out flag is used, but PEM format if sending to stdout or the -outdir flag is used.

                                                                                                                                      "},{"location":"man1/openssl-ca/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Note: these examples assume that the directory structure this command assumes is already set up and the relevant files already exist. This usually involves creating a CA certificate and private key with openssl-req(1), a serial number file and an empty index file and placing them in the relevant directories.

                                                                                                                                      To use the sample configuration file below the directories demoCA, demoCA/private and demoCA/newcerts would be created. The CA certificate would be copied to demoCA/cacert.pem and its private key to demoCA/private/cakey.pem. A file demoCA/serial would be created containing for example \"01\" and the empty index file demoCA/index.txt.

                                                                                                                                      Sign a certificate request:

                                                                                                                                      openssl ca -in req.pem -out newcert.pem\n

                                                                                                                                      Sign an SM2 certificate request:

                                                                                                                                      openssl ca -in sm2.csr -out sm2.crt -md sm3 \\\n        -sigopt \"distid:1234567812345678\" \\\n        -vfyopt \"distid:1234567812345678\"\n

                                                                                                                                      Sign a certificate request, using CA extensions:

                                                                                                                                      openssl ca -in req.pem -extensions v3_ca -out newcert.pem\n

                                                                                                                                      Generate a CRL

                                                                                                                                      openssl ca -gencrl -out crl.pem\n

                                                                                                                                      Sign several requests:

                                                                                                                                      openssl ca -infiles req1.pem req2.pem req3.pem\n

                                                                                                                                      Certify a Netscape SPKAC:

                                                                                                                                      openssl ca -spkac spkac.txt\n

                                                                                                                                      A sample SPKAC file (the SPKAC line has been truncated for clarity):

                                                                                                                                      SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5\nCN=Steve Test\nemailAddress=steve@openssl.org\n0.OU=OpenSSL Group\n1.OU=Another Group\n

                                                                                                                                      A sample configuration file with the relevant sections for this command:

                                                                                                                                      [ ca ]\ndefault_ca      = CA_default         #   # The default ca section\n\n[ CA_default ]\n\ndir            = ./demoCA           #   # top dir\ndatabase       = $dir/index.txt     #   # index file.\nnew_certs_dir  = $dir/newcerts      #   # new certs dir\n\ncertificate    = $dir/cacert.pem    #   # The CA cert\nserial         = $dir/serial        #   # serial no file\n#rand_serial    = yes               #   # for random serial#'s\nprivate_key    = $dir/private/cakey.pem## CA private key\n\ndefault_days   = 365                #   # how long to certify for\ndefault_crl_days= 30                #   # how long before next CRL\ndefault_md     = md5                #   # md to use\n\npolicy         = policy_any         #   # default policy\nemail_in_dn    = no                 #   # Don't add the email into cert DN\n\nname_opt       = ca_default         #   # Subject name display option\ncert_opt       = ca_default         #   # Certificate display option\ncopy_extensions = none              #   # Don't copy extensions from request\n\n[ policy_any ]\ncountryName            = supplied\nstateOrProvinceName    = optional\norganizationName       = optional\norganizationalUnitName = optional\ncommonName             = supplied\nemailAddress           = optional\n
                                                                                                                                      "},{"location":"man1/openssl-ca/#files","title":"FILES","text":"

                                                                                                                                      Note: the location of all files can change either by compile time options, configuration file entries, environment variables or command line options. The values below reflect the default values.

                                                                                                                                      /usr/local/ssl/lib/openssl.cnf - master configuration file\n./demoCA                       - main CA directory\n./demoCA/cacert.pem            - CA certificate\n./demoCA/private/cakey.pem     - CA private key\n./demoCA/serial                - CA serial number file\n./demoCA/serial.old            - CA serial number backup file\n./demoCA/index.txt             - CA text database file\n./demoCA/index.txt.old         - CA text database backup file\n./demoCA/certs                 - certificate output file\n
                                                                                                                                      "},{"location":"man1/openssl-ca/#restrictions","title":"RESTRICTIONS","text":"

                                                                                                                                      The text database index file is a critical part of the process and if corrupted it can be difficult to fix. It is theoretically possible to rebuild the index file from all the issued certificates and a current CRL: however there is no option to do this.

                                                                                                                                      V2 CRL features like delta CRLs are not currently supported.

                                                                                                                                      Although several requests can be input and handled at once it is only possible to include one SPKAC or self-signed certificate.

                                                                                                                                      "},{"location":"man1/openssl-ca/#bugs","title":"BUGS","text":"

                                                                                                                                      This command is quirky and at times downright unfriendly.

                                                                                                                                      The use of an in-memory text database can cause problems when large numbers of certificates are present because, as the name implies the database has to be kept in memory.

                                                                                                                                      This command really needs rewriting or the required functionality exposed at either a command or interface level so that a more user-friendly replacement could handle things properly. The script CA.pl helps a little but not very much.

                                                                                                                                      Any fields in a request that are not present in a policy are silently deleted. This does not happen if the -preserveDN option is used. To enforce the absence of the EMAIL field within the DN, as suggested by RFCs, regardless the contents of the request' subject the -noemailDN option can be used. The behaviour should be more friendly and configurable.

                                                                                                                                      Canceling some commands by refusing to certify a certificate can create an empty file.

                                                                                                                                      "},{"location":"man1/openssl-ca/#warnings","title":"WARNINGS","text":"

                                                                                                                                      This command was originally meant as an example of how to do things in a CA. Its code does not have production quality. It was not supposed to be used as a full blown CA itself, nevertheless some people are using it for this purpose at least internally. When doing so, specific care should be taken to properly secure the private key(s) used for signing certificates. It is advisable to keep them in a secure HW storage such as a smart card or HSM and access them via a suitable engine or crypto provider.

                                                                                                                                      This command command is effectively a single user command: no locking is done on the various files and attempts to run more than one openssl ca command on the same database can have unpredictable results.

                                                                                                                                      The copy_extensions option should be used with caution. If care is not taken then it can be a security risk. For example if a certificate request contains a basicConstraints extension with CA:TRUE and the copy_extensions value is set to copyall and the user does not spot this when the certificate is displayed then this will hand the requester a valid CA certificate. This situation can be avoided by setting copy_extensions to copy and including basicConstraints with CA:FALSE in the configuration file. Then if the request contains a basicConstraints extension it will be ignored.

                                                                                                                                      It is advisable to also include values for other extensions such as keyUsage to prevent a request supplying its own values.

                                                                                                                                      Additional restrictions can be placed on the CA certificate itself. For example if the CA certificate has:

                                                                                                                                      basicConstraints = CA:TRUE, pathlen:0\n

                                                                                                                                      then even if a certificate is issued with CA:TRUE it will not be valid.

                                                                                                                                      "},{"location":"man1/openssl-ca/#history","title":"HISTORY","text":"

                                                                                                                                      Since OpenSSL 1.1.1, the program follows RFC5280. Specifically, certificate validity period (specified by any of -startdate, -enddate and -days) and CRL last/next update time (specified by any of -crl_lastupdate, -crl_nextupdate, -crldays, -crlhours and -crlsec) will be encoded as UTCTime if the dates are earlier than year 2049 (included), and as GeneralizedTime if the dates are in year 2050 or later.

                                                                                                                                      OpenSSL 1.1.1 introduced a new random generator (CSPRNG) with an improved seeding mechanism. The new seeding mechanism makes it unnecessary to define a RANDFILE for saving and restoring randomness. This option is retained mainly for compatibility reasons.

                                                                                                                                      The -section option was added in OpenSSL 3.0.0.

                                                                                                                                      The -multivalue-rdn option has become obsolete in OpenSSL 3.0.0 and has no effect.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-ca/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-req(1), openssl-spkac(1), openssl-x509(1), CA.pl(1), config(5), x509v3_config(5)

                                                                                                                                      "},{"location":"man1/openssl-ca/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/","title":"openssl-ciphers","text":""},{"location":"man1/openssl-ciphers/#name","title":"NAME","text":"

                                                                                                                                      openssl-ciphers - SSL cipher display and cipher list command

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl ciphers [-help] [-s] [-v] [-V] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-s] [-psk] [-srp] [-stdname] [-convert name] [-ciphersuites val] [-provider name] [-provider-path path] [-propquery propq] [cipherlist]

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command converts textual OpenSSL cipher lists into ordered SSL cipher preference lists. It can be used to determine the appropriate cipherlist.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print a usage message.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -s

                                                                                                                                        Only list supported ciphers: those consistent with the security level, and minimum and maximum protocol version. This is closer to the actual cipher list an application will support.

                                                                                                                                        PSK and SRP ciphers are not enabled by default: they require -psk or -srp to enable them.

                                                                                                                                        It also does not change the default list of supported signature algorithms.

                                                                                                                                        On a server the list of supported ciphers might also exclude other ciphers depending on the configured certificates and presence of DH parameters.

                                                                                                                                        If this option is not used then all ciphers that match the cipherlist will be listed.

                                                                                                                                      • -psk

                                                                                                                                        When combined with -s includes cipher suites which require PSK.

                                                                                                                                      • -srp

                                                                                                                                        When combined with -s includes cipher suites which require SRP. This option is deprecated.

                                                                                                                                      • -v

                                                                                                                                        Verbose output: For each cipher suite, list details as provided by SSL_CIPHER_description(3).

                                                                                                                                      • -V

                                                                                                                                        Like -v, but include the official cipher suite values in hex.

                                                                                                                                      • -tls1_3, -tls1_2, -tls1_1, -tls1, -ssl3

                                                                                                                                        In combination with the -s option, list the ciphers which could be used if the specified protocol were negotiated. Note that not all protocols and flags may be available, depending on how OpenSSL was built.

                                                                                                                                      • -stdname

                                                                                                                                        Precede each cipher suite by its standard name.

                                                                                                                                      • -convert name

                                                                                                                                        Convert a standard cipher name to its OpenSSL name.

                                                                                                                                      • -ciphersuites val

                                                                                                                                        Sets the list of TLSv1.3 ciphersuites. This list will be combined with any TLSv1.2 and below ciphersuites that have been configured. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names. By default this value is:

                                                                                                                                        TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256\n
                                                                                                                                      • cipherlist

                                                                                                                                        A cipher list of TLSv1.2 and below ciphersuites to convert to a cipher preference list. This list will be combined with any TLSv1.3 ciphersuites that have been configured. If it is not included then the default cipher list will be used. The format is described below.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#cipher-list-format","title":"CIPHER LIST FORMAT","text":"

                                                                                                                                      The cipher list consists of one or more cipher strings separated by colons. Commas or spaces are also acceptable separators but colons are normally used.

                                                                                                                                      The actual cipher string can take several different forms.

                                                                                                                                      It can consist of a single cipher suite such as RC4-SHA.

                                                                                                                                      It can represent a list of cipher suites containing a certain algorithm, or cipher suites of a certain type. For example SHA1 represents all ciphers suites using the digest algorithm SHA1 and SSLv3 represents all SSL v3 algorithms.

                                                                                                                                      Lists of cipher suites can be combined in a single cipher string using the + character. This is used as a logical and operation. For example SHA1+DES represents all cipher suites containing the SHA1 and the DES algorithms.

                                                                                                                                      Each cipher string can be optionally preceded by the characters !, - or +.

                                                                                                                                      If ! is used then the ciphers are permanently deleted from the list. The ciphers deleted can never reappear in the list even if they are explicitly stated.

                                                                                                                                      If - is used then the ciphers are deleted from the list, but some or all of the ciphers can be added again by later options.

                                                                                                                                      If + is used then the ciphers are moved to the end of the list. This option doesn't add any new ciphers it just moves matching existing ones.

                                                                                                                                      If none of these characters is present then the string is just interpreted as a list of ciphers to be appended to the current preference list. If the list includes any ciphers already present they will be ignored: that is they will not moved to the end of the list.

                                                                                                                                      The cipher string @STRENGTH can be used at any point to sort the current cipher list in order of encryption algorithm key length.

                                                                                                                                      The cipher string @SECLEVEL=n can be used at any point to set the security level to n, which should be a number between zero and five, inclusive. See SSL_CTX_set_security_level(3) for a description of what each level means.

                                                                                                                                      The cipher list can be prefixed with the DEFAULT keyword, which enables the default cipher list as defined below. Unlike cipher strings, this prefix may not be combined with other strings using + character. For example, DEFAULT+DES is not valid.

                                                                                                                                      The content of the default list is determined at compile time and normally corresponds to ALL:!COMPLEMENTOFDEFAULT:!eNULL.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#cipher-strings","title":"CIPHER STRINGS","text":"

                                                                                                                                      The following is a list of all permitted cipher strings and their meanings.

                                                                                                                                      • COMPLEMENTOFDEFAULT

                                                                                                                                        The ciphers included in ALL, but not enabled by default. Currently this includes all RC4 and anonymous ciphers. Note that this rule does not cover eNULL, which is not included by ALL (use COMPLEMENTOFALL if necessary). Note that RC4 based cipher suites are not built into OpenSSL by default (see the enable-weak-ssl-ciphers option to Configure).

                                                                                                                                      • ALL

                                                                                                                                        All cipher suites except the eNULL ciphers (which must be explicitly enabled if needed). As of OpenSSL 1.0.0, the ALL cipher suites are sensibly ordered by default.

                                                                                                                                      • COMPLEMENTOFALL

                                                                                                                                        The cipher suites not enabled by ALL, currently eNULL.

                                                                                                                                      • HIGH

                                                                                                                                        \"High\" encryption cipher suites. This currently means those with key lengths larger than 128 bits, and some cipher suites with 128-bit keys.

                                                                                                                                      • MEDIUM

                                                                                                                                        \"Medium\" encryption cipher suites, currently some of those using 128 bit encryption.

                                                                                                                                      • LOW

                                                                                                                                        \"Low\" encryption cipher suites, currently those using 64 or 56 bit encryption algorithms but excluding export cipher suites. All these cipher suites have been removed as of OpenSSL 1.1.0.

                                                                                                                                      • eNULL, NULL

                                                                                                                                        The \"NULL\" ciphers that is those offering no encryption. Because these offer no encryption at all and are a security risk they are not enabled via either the DEFAULT or ALL cipher strings. Be careful when building cipherlists out of lower-level primitives such as kRSA or aECDSA as these do overlap with the eNULL ciphers. When in doubt, include !eNULL in your cipherlist.

                                                                                                                                      • aNULL

                                                                                                                                        The cipher suites offering no authentication. This is currently the anonymous DH algorithms and anonymous ECDH algorithms. These cipher suites are vulnerable to \"man in the middle\" attacks and so their use is discouraged. These are excluded from the DEFAULT ciphers, but included in the ALL ciphers. Be careful when building cipherlists out of lower-level primitives such as kDHE or AES as these do overlap with the aNULL ciphers. When in doubt, include !aNULL in your cipherlist.

                                                                                                                                      • kRSA, aRSA, RSA

                                                                                                                                        Cipher suites using RSA key exchange or authentication. RSA is an alias for kRSA.

                                                                                                                                      • kDHr, kDHd, kDH

                                                                                                                                        Cipher suites using static DH key agreement and DH certificates signed by CAs with RSA and DSS keys or either respectively. All these cipher suites have been removed in OpenSSL 1.1.0.

                                                                                                                                      • kDHE, kEDH, DH

                                                                                                                                        Cipher suites using ephemeral DH key agreement, including anonymous cipher suites.

                                                                                                                                      • DHE, EDH

                                                                                                                                        Cipher suites using authenticated ephemeral DH key agreement.

                                                                                                                                      • ADH

                                                                                                                                        Anonymous DH cipher suites, note that this does not include anonymous Elliptic Curve DH (ECDH) cipher suites.

                                                                                                                                      • kEECDH, kECDHE, ECDH

                                                                                                                                        Cipher suites using ephemeral ECDH key agreement, including anonymous cipher suites.

                                                                                                                                      • ECDHE, EECDH

                                                                                                                                        Cipher suites using authenticated ephemeral ECDH key agreement.

                                                                                                                                      • AECDH

                                                                                                                                        Anonymous Elliptic Curve Diffie-Hellman cipher suites.

                                                                                                                                      • aDSS, DSS

                                                                                                                                        Cipher suites using DSS authentication, i.e. the certificates carry DSS keys.

                                                                                                                                      • aDH

                                                                                                                                        Cipher suites effectively using DH authentication, i.e. the certificates carry DH keys. All these cipher suites have been removed in OpenSSL 1.1.0.

                                                                                                                                      • aECDSA, ECDSA

                                                                                                                                        Cipher suites using ECDSA authentication, i.e. the certificates carry ECDSA keys.

                                                                                                                                      • TLSv1.2, TLSv1.0, SSLv3

                                                                                                                                        Lists cipher suites which are only supported in at least TLS v1.2, TLS v1.0 or SSL v3.0 respectively. Note: there are no cipher suites specific to TLS v1.1. Since this is only the minimum version, if, for example, TLSv1.0 is negotiated then both TLSv1.0 and SSLv3.0 cipher suites are available.

                                                                                                                                        Note: these cipher strings do not change the negotiated version of SSL or TLS, they only affect the list of available cipher suites.

                                                                                                                                      • AES128, AES256, AES

                                                                                                                                        cipher suites using 128 bit AES, 256 bit AES or either 128 or 256 bit AES.

                                                                                                                                      • AESGCM

                                                                                                                                        AES in Galois Counter Mode (GCM): these cipher suites are only supported in TLS v1.2.

                                                                                                                                      • AESCCM, AESCCM8

                                                                                                                                        AES in Cipher Block Chaining - Message Authentication Mode (CCM): these cipher suites are only supported in TLS v1.2. AESCCM references CCM cipher suites using both 16 and 8 octet Integrity Check Value (ICV) while AESCCM8 only references 8 octet ICV.

                                                                                                                                      • ARIA128, ARIA256, ARIA

                                                                                                                                        Cipher suites using 128 bit ARIA, 256 bit ARIA or either 128 or 256 bit ARIA.

                                                                                                                                      • CAMELLIA128, CAMELLIA256, CAMELLIA

                                                                                                                                        Cipher suites using 128 bit CAMELLIA, 256 bit CAMELLIA or either 128 or 256 bit CAMELLIA.

                                                                                                                                      • CHACHA20

                                                                                                                                        Cipher suites using ChaCha20.

                                                                                                                                      • 3DES

                                                                                                                                        Cipher suites using triple DES.

                                                                                                                                      • DES

                                                                                                                                        Cipher suites using DES (not triple DES). All these cipher suites have been removed in OpenSSL 1.1.0.

                                                                                                                                      • RC4

                                                                                                                                        Cipher suites using RC4.

                                                                                                                                      • RC2

                                                                                                                                        Cipher suites using RC2.

                                                                                                                                      • IDEA

                                                                                                                                        Cipher suites using IDEA.

                                                                                                                                      • SEED

                                                                                                                                        Cipher suites using SEED.

                                                                                                                                      • MD5

                                                                                                                                        Cipher suites using MD5.

                                                                                                                                      • SHA1, SHA

                                                                                                                                        Cipher suites using SHA1.

                                                                                                                                      • SHA256, SHA384

                                                                                                                                        Cipher suites using SHA256 or SHA384.

                                                                                                                                      • aGOST

                                                                                                                                        Cipher suites using GOST R 34.10 (either 2001 or 94) for authentication (needs an engine supporting GOST algorithms).

                                                                                                                                      • aGOST01

                                                                                                                                        Cipher suites using GOST R 34.10-2001 authentication.

                                                                                                                                      • kGOST

                                                                                                                                        Cipher suites, using VKO 34.10 key exchange, specified in the RFC 4357.

                                                                                                                                      • GOST94

                                                                                                                                        Cipher suites, using HMAC based on GOST R 34.11-94.

                                                                                                                                      • GOST89MAC

                                                                                                                                        Cipher suites using GOST 28147-89 MAC instead of HMAC.

                                                                                                                                      • PSK

                                                                                                                                        All cipher suites using pre-shared keys (PSK).

                                                                                                                                      • kPSK, kECDHEPSK, kDHEPSK, kRSAPSK

                                                                                                                                        Cipher suites using PSK key exchange, ECDHE_PSK, DHE_PSK or RSA_PSK.

                                                                                                                                      • aPSK

                                                                                                                                        Cipher suites using PSK authentication (currently all PSK modes apart from RSA_PSK).

                                                                                                                                      • SUITEB128, SUITEB128ONLY, SUITEB192

                                                                                                                                        Enables suite B mode of operation using 128 (permitting 192 bit mode by peer) 128 bit (not permitting 192 bit by peer) or 192 bit level of security respectively. If used these cipherstrings should appear first in the cipher list and anything after them is ignored. Setting Suite B mode has additional consequences required to comply with RFC6460. In particular the supported signature algorithms is reduced to support only ECDSA and SHA256 or SHA384, only the elliptic curves P-256 and P-384 can be used and only the two suite B compliant cipher suites (ECDHE-ECDSA-AES128-GCM-SHA256 and ECDHE-ECDSA-AES256-GCM-SHA384) are permissible.

                                                                                                                                      • CBC

                                                                                                                                        All cipher suites using encryption algorithm in Cipher Block Chaining (CBC) mode. These cipher suites are only supported in TLS v1.2 and earlier. Currently it's an alias for the following cipherstrings: SSL_DES, SSL_3DES, SSL_RC2, SSL_IDEA, SSL_AES128, SSL_AES256, SSL_CAMELLIA128, SSL_CAMELLIA256, SSL_SEED.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#cipher-suite-names","title":"CIPHER SUITE NAMES","text":"

                                                                                                                                      The following lists give the SSL or TLS cipher suites names from the relevant specification and their OpenSSL equivalents. It should be noted, that several cipher suite names do not include the authentication used, e.g. DES-CBC3-SHA. In these cases, RSA authentication is used.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#ssl-v30-cipher-suites","title":"SSL v3.0 cipher suites","text":"
                                                                                                                                      SSL_RSA_WITH_NULL_MD5                   NULL-MD5\nSSL_RSA_WITH_NULL_SHA                   NULL-SHA\nSSL_RSA_WITH_RC4_128_MD5                RC4-MD5\nSSL_RSA_WITH_RC4_128_SHA                RC4-SHA\nSSL_RSA_WITH_IDEA_CBC_SHA               IDEA-CBC-SHA\nSSL_RSA_WITH_3DES_EDE_CBC_SHA           DES-CBC3-SHA\n\nSSL_DH_DSS_WITH_3DES_EDE_CBC_SHA        DH-DSS-DES-CBC3-SHA\nSSL_DH_RSA_WITH_3DES_EDE_CBC_SHA        DH-RSA-DES-CBC3-SHA\nSSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA       DHE-DSS-DES-CBC3-SHA\nSSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA       DHE-RSA-DES-CBC3-SHA\n\nSSL_DH_anon_WITH_RC4_128_MD5            ADH-RC4-MD5\nSSL_DH_anon_WITH_3DES_EDE_CBC_SHA       ADH-DES-CBC3-SHA\n\nSSL_FORTEZZA_KEA_WITH_NULL_SHA          Not implemented.\nSSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA  Not implemented.\nSSL_FORTEZZA_KEA_WITH_RC4_128_SHA       Not implemented.\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#tls-v10-cipher-suites","title":"TLS v1.0 cipher suites","text":"
                                                                                                                                      TLS_RSA_WITH_NULL_MD5                   NULL-MD5\nTLS_RSA_WITH_NULL_SHA                   NULL-SHA\nTLS_RSA_WITH_RC4_128_MD5                RC4-MD5\nTLS_RSA_WITH_RC4_128_SHA                RC4-SHA\nTLS_RSA_WITH_IDEA_CBC_SHA               IDEA-CBC-SHA\nTLS_RSA_WITH_3DES_EDE_CBC_SHA           DES-CBC3-SHA\n\nTLS_DH_DSS_WITH_3DES_EDE_CBC_SHA        Not implemented.\nTLS_DH_RSA_WITH_3DES_EDE_CBC_SHA        Not implemented.\nTLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA       DHE-DSS-DES-CBC3-SHA\nTLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA       DHE-RSA-DES-CBC3-SHA\n\nTLS_DH_anon_WITH_RC4_128_MD5            ADH-RC4-MD5\nTLS_DH_anon_WITH_3DES_EDE_CBC_SHA       ADH-DES-CBC3-SHA\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#aes-cipher-suites-from-rfc3268-extending-tls-v10","title":"AES cipher suites from RFC3268, extending TLS v1.0","text":"
                                                                                                                                      TLS_RSA_WITH_AES_128_CBC_SHA            AES128-SHA\nTLS_RSA_WITH_AES_256_CBC_SHA            AES256-SHA\n\nTLS_DH_DSS_WITH_AES_128_CBC_SHA         DH-DSS-AES128-SHA\nTLS_DH_DSS_WITH_AES_256_CBC_SHA         DH-DSS-AES256-SHA\nTLS_DH_RSA_WITH_AES_128_CBC_SHA         DH-RSA-AES128-SHA\nTLS_DH_RSA_WITH_AES_256_CBC_SHA         DH-RSA-AES256-SHA\n\nTLS_DHE_DSS_WITH_AES_128_CBC_SHA        DHE-DSS-AES128-SHA\nTLS_DHE_DSS_WITH_AES_256_CBC_SHA        DHE-DSS-AES256-SHA\nTLS_DHE_RSA_WITH_AES_128_CBC_SHA        DHE-RSA-AES128-SHA\nTLS_DHE_RSA_WITH_AES_256_CBC_SHA        DHE-RSA-AES256-SHA\n\nTLS_DH_anon_WITH_AES_128_CBC_SHA        ADH-AES128-SHA\nTLS_DH_anon_WITH_AES_256_CBC_SHA        ADH-AES256-SHA\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#camellia-cipher-suites-from-rfc4132-extending-tls-v10","title":"Camellia cipher suites from RFC4132, extending TLS v1.0","text":"
                                                                                                                                      TLS_RSA_WITH_CAMELLIA_128_CBC_SHA      CAMELLIA128-SHA\nTLS_RSA_WITH_CAMELLIA_256_CBC_SHA      CAMELLIA256-SHA\n\nTLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA   DH-DSS-CAMELLIA128-SHA\nTLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA   DH-DSS-CAMELLIA256-SHA\nTLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA   DH-RSA-CAMELLIA128-SHA\nTLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA   DH-RSA-CAMELLIA256-SHA\n\nTLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA  DHE-DSS-CAMELLIA128-SHA\nTLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA  DHE-DSS-CAMELLIA256-SHA\nTLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA  DHE-RSA-CAMELLIA128-SHA\nTLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA  DHE-RSA-CAMELLIA256-SHA\n\nTLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA  ADH-CAMELLIA128-SHA\nTLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA  ADH-CAMELLIA256-SHA\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#seed-cipher-suites-from-rfc4162-extending-tls-v10","title":"SEED cipher suites from RFC4162, extending TLS v1.0","text":"
                                                                                                                                      TLS_RSA_WITH_SEED_CBC_SHA              SEED-SHA\n\nTLS_DH_DSS_WITH_SEED_CBC_SHA           DH-DSS-SEED-SHA\nTLS_DH_RSA_WITH_SEED_CBC_SHA           DH-RSA-SEED-SHA\n\nTLS_DHE_DSS_WITH_SEED_CBC_SHA          DHE-DSS-SEED-SHA\nTLS_DHE_RSA_WITH_SEED_CBC_SHA          DHE-RSA-SEED-SHA\n\nTLS_DH_anon_WITH_SEED_CBC_SHA          ADH-SEED-SHA\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#gost-cipher-suites-from-draft-chudov-cryptopro-cptls-extending-tls-v10","title":"GOST cipher suites from draft-chudov-cryptopro-cptls, extending TLS v1.0","text":"

                                                                                                                                      Note: these ciphers require an engine which including GOST cryptographic algorithms, such as the gost engine, which isn't part of the OpenSSL distribution.

                                                                                                                                      TLS_GOSTR341094_WITH_28147_CNT_IMIT GOST94-GOST89-GOST89\nTLS_GOSTR341001_WITH_28147_CNT_IMIT GOST2001-GOST89-GOST89\nTLS_GOSTR341094_WITH_NULL_GOSTR3411 GOST94-NULL-GOST94\nTLS_GOSTR341001_WITH_NULL_GOSTR3411 GOST2001-NULL-GOST94\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#gost-cipher-suites-extending-tls-v12","title":"GOST cipher suites, extending TLS v1.2","text":"

                                                                                                                                      Note: these ciphers require an engine which including GOST cryptographic algorithms, such as the gost engine, which isn't part of the OpenSSL distribution.

                                                                                                                                      TLS_GOSTR341112_256_WITH_28147_CNT_IMIT GOST2012-GOST8912-GOST8912\nTLS_GOSTR341112_256_WITH_NULL_GOSTR3411 GOST2012-NULL-GOST12\n

                                                                                                                                      Note: GOST2012-GOST8912-GOST8912 is an alias for two ciphers ID old LEGACY-GOST2012-GOST8912-GOST8912 and new IANA-GOST2012-GOST8912-GOST8912

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#additional-export-1024-and-other-cipher-suites","title":"Additional Export 1024 and other cipher suites","text":"

                                                                                                                                      Note: these ciphers can also be used in SSL v3.

                                                                                                                                      TLS_DHE_DSS_WITH_RC4_128_SHA            DHE-DSS-RC4-SHA\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#elliptic-curve-cipher-suites","title":"Elliptic curve cipher suites","text":"
                                                                                                                                      TLS_ECDHE_RSA_WITH_NULL_SHA             ECDHE-RSA-NULL-SHA\nTLS_ECDHE_RSA_WITH_RC4_128_SHA          ECDHE-RSA-RC4-SHA\nTLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA     ECDHE-RSA-DES-CBC3-SHA\nTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA      ECDHE-RSA-AES128-SHA\nTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA      ECDHE-RSA-AES256-SHA\n\nTLS_ECDHE_ECDSA_WITH_NULL_SHA           ECDHE-ECDSA-NULL-SHA\nTLS_ECDHE_ECDSA_WITH_RC4_128_SHA        ECDHE-ECDSA-RC4-SHA\nTLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA   ECDHE-ECDSA-DES-CBC3-SHA\nTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA    ECDHE-ECDSA-AES128-SHA\nTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA    ECDHE-ECDSA-AES256-SHA\n\nTLS_ECDH_anon_WITH_NULL_SHA             AECDH-NULL-SHA\nTLS_ECDH_anon_WITH_RC4_128_SHA          AECDH-RC4-SHA\nTLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA     AECDH-DES-CBC3-SHA\nTLS_ECDH_anon_WITH_AES_128_CBC_SHA      AECDH-AES128-SHA\nTLS_ECDH_anon_WITH_AES_256_CBC_SHA      AECDH-AES256-SHA\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#tls-v12-cipher-suites","title":"TLS v1.2 cipher suites","text":"
                                                                                                                                      TLS_RSA_WITH_NULL_SHA256                  NULL-SHA256\n\nTLS_RSA_WITH_AES_128_CBC_SHA256           AES128-SHA256\nTLS_RSA_WITH_AES_256_CBC_SHA256           AES256-SHA256\nTLS_RSA_WITH_AES_128_GCM_SHA256           AES128-GCM-SHA256\nTLS_RSA_WITH_AES_256_GCM_SHA384           AES256-GCM-SHA384\n\nTLS_DH_RSA_WITH_AES_128_CBC_SHA256        DH-RSA-AES128-SHA256\nTLS_DH_RSA_WITH_AES_256_CBC_SHA256        DH-RSA-AES256-SHA256\nTLS_DH_RSA_WITH_AES_128_GCM_SHA256        DH-RSA-AES128-GCM-SHA256\nTLS_DH_RSA_WITH_AES_256_GCM_SHA384        DH-RSA-AES256-GCM-SHA384\n\nTLS_DH_DSS_WITH_AES_128_CBC_SHA256        DH-DSS-AES128-SHA256\nTLS_DH_DSS_WITH_AES_256_CBC_SHA256        DH-DSS-AES256-SHA256\nTLS_DH_DSS_WITH_AES_128_GCM_SHA256        DH-DSS-AES128-GCM-SHA256\nTLS_DH_DSS_WITH_AES_256_GCM_SHA384        DH-DSS-AES256-GCM-SHA384\n\nTLS_DHE_RSA_WITH_AES_128_CBC_SHA256       DHE-RSA-AES128-SHA256\nTLS_DHE_RSA_WITH_AES_256_CBC_SHA256       DHE-RSA-AES256-SHA256\nTLS_DHE_RSA_WITH_AES_128_GCM_SHA256       DHE-RSA-AES128-GCM-SHA256\nTLS_DHE_RSA_WITH_AES_256_GCM_SHA384       DHE-RSA-AES256-GCM-SHA384\n\nTLS_DHE_DSS_WITH_AES_128_CBC_SHA256       DHE-DSS-AES128-SHA256\nTLS_DHE_DSS_WITH_AES_256_CBC_SHA256       DHE-DSS-AES256-SHA256\nTLS_DHE_DSS_WITH_AES_128_GCM_SHA256       DHE-DSS-AES128-GCM-SHA256\nTLS_DHE_DSS_WITH_AES_256_GCM_SHA384       DHE-DSS-AES256-GCM-SHA384\n\nTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256     ECDHE-RSA-AES128-SHA256\nTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384     ECDHE-RSA-AES256-SHA384\nTLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256     ECDHE-RSA-AES128-GCM-SHA256\nTLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384     ECDHE-RSA-AES256-GCM-SHA384\n\nTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256   ECDHE-ECDSA-AES128-SHA256\nTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384   ECDHE-ECDSA-AES256-SHA384\nTLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256   ECDHE-ECDSA-AES128-GCM-SHA256\nTLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384   ECDHE-ECDSA-AES256-GCM-SHA384\n\nTLS_DH_anon_WITH_AES_128_CBC_SHA256       ADH-AES128-SHA256\nTLS_DH_anon_WITH_AES_256_CBC_SHA256       ADH-AES256-SHA256\nTLS_DH_anon_WITH_AES_128_GCM_SHA256       ADH-AES128-GCM-SHA256\nTLS_DH_anon_WITH_AES_256_GCM_SHA384       ADH-AES256-GCM-SHA384\n\nRSA_WITH_AES_128_CCM                      AES128-CCM\nRSA_WITH_AES_256_CCM                      AES256-CCM\nDHE_RSA_WITH_AES_128_CCM                  DHE-RSA-AES128-CCM\nDHE_RSA_WITH_AES_256_CCM                  DHE-RSA-AES256-CCM\nRSA_WITH_AES_128_CCM_8                    AES128-CCM8\nRSA_WITH_AES_256_CCM_8                    AES256-CCM8\nDHE_RSA_WITH_AES_128_CCM_8                DHE-RSA-AES128-CCM8\nDHE_RSA_WITH_AES_256_CCM_8                DHE-RSA-AES256-CCM8\nECDHE_ECDSA_WITH_AES_128_CCM              ECDHE-ECDSA-AES128-CCM\nECDHE_ECDSA_WITH_AES_256_CCM              ECDHE-ECDSA-AES256-CCM\nECDHE_ECDSA_WITH_AES_128_CCM_8            ECDHE-ECDSA-AES128-CCM8\nECDHE_ECDSA_WITH_AES_256_CCM_8            ECDHE-ECDSA-AES256-CCM8\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#aria-cipher-suites-from-rfc6209-extending-tls-v12","title":"ARIA cipher suites from RFC6209, extending TLS v1.2","text":"

                                                                                                                                      Note: the CBC modes mentioned in this RFC are not supported.

                                                                                                                                      TLS_RSA_WITH_ARIA_128_GCM_SHA256          ARIA128-GCM-SHA256\nTLS_RSA_WITH_ARIA_256_GCM_SHA384          ARIA256-GCM-SHA384\nTLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256      DHE-RSA-ARIA128-GCM-SHA256\nTLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384      DHE-RSA-ARIA256-GCM-SHA384\nTLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256      DHE-DSS-ARIA128-GCM-SHA256\nTLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384      DHE-DSS-ARIA256-GCM-SHA384\nTLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256  ECDHE-ECDSA-ARIA128-GCM-SHA256\nTLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384  ECDHE-ECDSA-ARIA256-GCM-SHA384\nTLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256    ECDHE-ARIA128-GCM-SHA256\nTLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384    ECDHE-ARIA256-GCM-SHA384\nTLS_PSK_WITH_ARIA_128_GCM_SHA256          PSK-ARIA128-GCM-SHA256\nTLS_PSK_WITH_ARIA_256_GCM_SHA384          PSK-ARIA256-GCM-SHA384\nTLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256      DHE-PSK-ARIA128-GCM-SHA256\nTLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384      DHE-PSK-ARIA256-GCM-SHA384\nTLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256      RSA-PSK-ARIA128-GCM-SHA256\nTLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384      RSA-PSK-ARIA256-GCM-SHA384\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#camellia-hmac-based-cipher-suites-from-rfc6367-extending-tls-v12","title":"Camellia HMAC-Based cipher suites from RFC6367, extending TLS v1.2","text":"
                                                                                                                                      TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 ECDHE-ECDSA-CAMELLIA128-SHA256\nTLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 ECDHE-ECDSA-CAMELLIA256-SHA384\nTLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256   ECDHE-RSA-CAMELLIA128-SHA256\nTLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384   ECDHE-RSA-CAMELLIA256-SHA384\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#pre-shared-keying-psk-cipher-suites","title":"Pre-shared keying (PSK) cipher suites","text":"
                                                                                                                                      PSK_WITH_NULL_SHA                         PSK-NULL-SHA\nDHE_PSK_WITH_NULL_SHA                     DHE-PSK-NULL-SHA\nRSA_PSK_WITH_NULL_SHA                     RSA-PSK-NULL-SHA\n\nPSK_WITH_RC4_128_SHA                      PSK-RC4-SHA\nPSK_WITH_3DES_EDE_CBC_SHA                 PSK-3DES-EDE-CBC-SHA\nPSK_WITH_AES_128_CBC_SHA                  PSK-AES128-CBC-SHA\nPSK_WITH_AES_256_CBC_SHA                  PSK-AES256-CBC-SHA\n\nDHE_PSK_WITH_RC4_128_SHA                  DHE-PSK-RC4-SHA\nDHE_PSK_WITH_3DES_EDE_CBC_SHA             DHE-PSK-3DES-EDE-CBC-SHA\nDHE_PSK_WITH_AES_128_CBC_SHA              DHE-PSK-AES128-CBC-SHA\nDHE_PSK_WITH_AES_256_CBC_SHA              DHE-PSK-AES256-CBC-SHA\n\nRSA_PSK_WITH_RC4_128_SHA                  RSA-PSK-RC4-SHA\nRSA_PSK_WITH_3DES_EDE_CBC_SHA             RSA-PSK-3DES-EDE-CBC-SHA\nRSA_PSK_WITH_AES_128_CBC_SHA              RSA-PSK-AES128-CBC-SHA\nRSA_PSK_WITH_AES_256_CBC_SHA              RSA-PSK-AES256-CBC-SHA\n\nPSK_WITH_AES_128_GCM_SHA256               PSK-AES128-GCM-SHA256\nPSK_WITH_AES_256_GCM_SHA384               PSK-AES256-GCM-SHA384\nDHE_PSK_WITH_AES_128_GCM_SHA256           DHE-PSK-AES128-GCM-SHA256\nDHE_PSK_WITH_AES_256_GCM_SHA384           DHE-PSK-AES256-GCM-SHA384\nRSA_PSK_WITH_AES_128_GCM_SHA256           RSA-PSK-AES128-GCM-SHA256\nRSA_PSK_WITH_AES_256_GCM_SHA384           RSA-PSK-AES256-GCM-SHA384\n\nPSK_WITH_AES_128_CBC_SHA256               PSK-AES128-CBC-SHA256\nPSK_WITH_AES_256_CBC_SHA384               PSK-AES256-CBC-SHA384\nPSK_WITH_NULL_SHA256                      PSK-NULL-SHA256\nPSK_WITH_NULL_SHA384                      PSK-NULL-SHA384\nDHE_PSK_WITH_AES_128_CBC_SHA256           DHE-PSK-AES128-CBC-SHA256\nDHE_PSK_WITH_AES_256_CBC_SHA384           DHE-PSK-AES256-CBC-SHA384\nDHE_PSK_WITH_NULL_SHA256                  DHE-PSK-NULL-SHA256\nDHE_PSK_WITH_NULL_SHA384                  DHE-PSK-NULL-SHA384\nRSA_PSK_WITH_AES_128_CBC_SHA256           RSA-PSK-AES128-CBC-SHA256\nRSA_PSK_WITH_AES_256_CBC_SHA384           RSA-PSK-AES256-CBC-SHA384\nRSA_PSK_WITH_NULL_SHA256                  RSA-PSK-NULL-SHA256\nRSA_PSK_WITH_NULL_SHA384                  RSA-PSK-NULL-SHA384\nPSK_WITH_AES_128_GCM_SHA256               PSK-AES128-GCM-SHA256\nPSK_WITH_AES_256_GCM_SHA384               PSK-AES256-GCM-SHA384\n\nECDHE_PSK_WITH_RC4_128_SHA                ECDHE-PSK-RC4-SHA\nECDHE_PSK_WITH_3DES_EDE_CBC_SHA           ECDHE-PSK-3DES-EDE-CBC-SHA\nECDHE_PSK_WITH_AES_128_CBC_SHA            ECDHE-PSK-AES128-CBC-SHA\nECDHE_PSK_WITH_AES_256_CBC_SHA            ECDHE-PSK-AES256-CBC-SHA\nECDHE_PSK_WITH_AES_128_CBC_SHA256         ECDHE-PSK-AES128-CBC-SHA256\nECDHE_PSK_WITH_AES_256_CBC_SHA384         ECDHE-PSK-AES256-CBC-SHA384\nECDHE_PSK_WITH_NULL_SHA                   ECDHE-PSK-NULL-SHA\nECDHE_PSK_WITH_NULL_SHA256                ECDHE-PSK-NULL-SHA256\nECDHE_PSK_WITH_NULL_SHA384                ECDHE-PSK-NULL-SHA384\n\nPSK_WITH_CAMELLIA_128_CBC_SHA256          PSK-CAMELLIA128-SHA256\nPSK_WITH_CAMELLIA_256_CBC_SHA384          PSK-CAMELLIA256-SHA384\n\nDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256      DHE-PSK-CAMELLIA128-SHA256\nDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384      DHE-PSK-CAMELLIA256-SHA384\n\nRSA_PSK_WITH_CAMELLIA_128_CBC_SHA256      RSA-PSK-CAMELLIA128-SHA256\nRSA_PSK_WITH_CAMELLIA_256_CBC_SHA384      RSA-PSK-CAMELLIA256-SHA384\n\nECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256    ECDHE-PSK-CAMELLIA128-SHA256\nECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384    ECDHE-PSK-CAMELLIA256-SHA384\n\nPSK_WITH_AES_128_CCM                      PSK-AES128-CCM\nPSK_WITH_AES_256_CCM                      PSK-AES256-CCM\nDHE_PSK_WITH_AES_128_CCM                  DHE-PSK-AES128-CCM\nDHE_PSK_WITH_AES_256_CCM                  DHE-PSK-AES256-CCM\nPSK_WITH_AES_128_CCM_8                    PSK-AES128-CCM8\nPSK_WITH_AES_256_CCM_8                    PSK-AES256-CCM8\nDHE_PSK_WITH_AES_128_CCM_8                DHE-PSK-AES128-CCM8\nDHE_PSK_WITH_AES_256_CCM_8                DHE-PSK-AES256-CCM8\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#chacha20-poly1305-cipher-suites-extending-tls-v12","title":"ChaCha20-Poly1305 cipher suites, extending TLS v1.2","text":"
                                                                                                                                      TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256      ECDHE-RSA-CHACHA20-POLY1305\nTLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256    ECDHE-ECDSA-CHACHA20-POLY1305\nTLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256        DHE-RSA-CHACHA20-POLY1305\nTLS_PSK_WITH_CHACHA20_POLY1305_SHA256            PSK-CHACHA20-POLY1305\nTLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256      ECDHE-PSK-CHACHA20-POLY1305\nTLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256        DHE-PSK-CHACHA20-POLY1305\nTLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256        RSA-PSK-CHACHA20-POLY1305\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#tls-v13-cipher-suites","title":"TLS v1.3 cipher suites","text":"
                                                                                                                                      TLS_AES_128_GCM_SHA256                     TLS_AES_128_GCM_SHA256\nTLS_AES_256_GCM_SHA384                     TLS_AES_256_GCM_SHA384\nTLS_CHACHA20_POLY1305_SHA256               TLS_CHACHA20_POLY1305_SHA256\nTLS_AES_128_CCM_SHA256                     TLS_AES_128_CCM_SHA256\nTLS_AES_128_CCM_8_SHA256                   TLS_AES_128_CCM_8_SHA256\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#older-names-used-by-openssl","title":"Older names used by OpenSSL","text":"

                                                                                                                                      The following names are accepted by older releases:

                                                                                                                                      SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA    EDH-RSA-DES-CBC3-SHA (DHE-RSA-DES-CBC3-SHA)\nSSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA    EDH-DSS-DES-CBC3-SHA (DHE-DSS-DES-CBC3-SHA)\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#notes","title":"NOTES","text":"

                                                                                                                                      Some compiled versions of OpenSSL may not include all the ciphers listed here because some ciphers were excluded at compile time.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Verbose listing of all OpenSSL ciphers including NULL ciphers:

                                                                                                                                      openssl ciphers -v 'ALL:eNULL'\n

                                                                                                                                      Include all ciphers except NULL and anonymous DH then sort by strength:

                                                                                                                                      openssl ciphers -v 'ALL:!ADH:@STRENGTH'\n

                                                                                                                                      Include all ciphers except ones with no encryption (eNULL) or no authentication (aNULL):

                                                                                                                                      openssl ciphers -v 'ALL:!aNULL'\n

                                                                                                                                      Include only 3DES ciphers and then place RSA ciphers last:

                                                                                                                                      openssl ciphers -v '3DES:+RSA'\n

                                                                                                                                      Include all RC4 ciphers but leave out those without authentication:

                                                                                                                                      openssl ciphers -v 'RC4:!COMPLEMENTOFDEFAULT'\n

                                                                                                                                      Include all ciphers with RSA authentication but leave out ciphers without encryption.

                                                                                                                                      openssl ciphers -v 'RSA:!COMPLEMENTOFALL'\n

                                                                                                                                      Set security level to 2 and display all ciphers consistent with level 2:

                                                                                                                                      openssl ciphers -s -v 'ALL:@SECLEVEL=2'\n
                                                                                                                                      "},{"location":"man1/openssl-ciphers/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-s_client(1), openssl-s_server(1), ssl(7)

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#history","title":"HISTORY","text":"

                                                                                                                                      The -V option was added in OpenSSL 1.0.0.

                                                                                                                                      The -stdname is only available if OpenSSL is built with tracing enabled (enable-ssl-trace argument to Configure) before OpenSSL 1.1.1.

                                                                                                                                      The -convert option was added in OpenSSL 1.1.1.

                                                                                                                                      "},{"location":"man1/openssl-ciphers/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-cmds/","title":"openssl-cmds","text":""},{"location":"man1/openssl-cmds/#name","title":"NAME","text":"

                                                                                                                                      asn1parse, ca, ciphers, cmp, cms, crl, crl2pkcs7, dgst, dhparam, dsa, dsaparam, ec, ecparam, enc, engine, errstr, gendsa, genpkey, genrsa, info, kdf, mac, nseq, ocsp, passwd, pkcs12, pkcs7, pkcs8, pkey, pkeyparam, pkeyutl, prime, rand, rehash, req, rsa, rsautl, s_client, s_server, s_time, sess_id, smime, speed, spkac, srp, storeutl, ts, verify, version, x509 - OpenSSL application commands

                                                                                                                                      "},{"location":"man1/openssl-cmds/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl cmd -help | [-option | -option arg] ... [arg] ...

                                                                                                                                      "},{"location":"man1/openssl-cmds/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Every cmd listed above is a (sub-)command of the openssl(1) application. It has its own detailed manual page at openssl-cmd(1). For example, to view the manual page for the openssl dgst command, type man openssl-dgst.

                                                                                                                                      "},{"location":"man1/openssl-cmds/#options","title":"OPTIONS","text":"

                                                                                                                                      Among others, every subcommand has a help option.

                                                                                                                                      • -help

                                                                                                                                        Print out a usage message for the subcommand.

                                                                                                                                      "},{"location":"man1/openssl-cmds/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-asn1parse(1), openssl-ca(1), openssl-ciphers(1), openssl-cmp(1), openssl-cms(1), openssl-crl(1), openssl-crl2pkcs7(1), openssl-dgst(1), openssl-dhparam(1), openssl-dsa(1), openssl-dsaparam(1), openssl-ec(1), openssl-ecparam(1), openssl-enc(1), openssl-engine(1), openssl-errstr(1), openssl-gendsa(1), openssl-genpkey(1), openssl-genrsa(1), openssl-info(1), openssl-kdf(1), openssl-mac(1), openssl-nseq(1), openssl-ocsp(1), openssl-passwd(1), openssl-pkcs12(1), openssl-pkcs7(1), openssl-pkcs8(1), openssl-pkey(1), openssl-pkeyparam(1), openssl-pkeyutl(1), openssl-prime(1), openssl-rand(1), openssl-rehash(1), openssl-req(1), openssl-rsa(1), openssl-rsautl(1), openssl-s_client(1), openssl-s_server(1), openssl-s_time(1), openssl-sess_id(1), openssl-smime(1), openssl-speed(1), openssl-spkac(1), openssl-srp(1), openssl-storeutl(1), openssl-ts(1), openssl-verify(1), openssl-version(1), openssl-x509(1),

                                                                                                                                      "},{"location":"man1/openssl-cmds/#history","title":"HISTORY","text":"

                                                                                                                                      Initially, the manual page entry for the openssl _cmd_ command used to be available at cmd(1). Later, the alias openssl-cmd(1) was introduced, which made it easier to group the openssl commands using the apropos(1) command or the shell's tab completion.

                                                                                                                                      In order to reduce cluttering of the global manual page namespace, the manual page entries without the 'openssl-' prefix have been deprecated in OpenSSL 3.0 and will be removed in OpenSSL 4.0.

                                                                                                                                      "},{"location":"man1/openssl-cmds/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-cmp/","title":"openssl-cmp","text":""},{"location":"man1/openssl-cmp/#name","title":"NAME","text":"

                                                                                                                                      openssl-cmp - Certificate Management Protocol (CMP, RFC 4210) application

                                                                                                                                      "},{"location":"man1/openssl-cmp/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl cmp [-help] [-config filename] [-section names] [-verbosity level]

                                                                                                                                      Generic message options:

                                                                                                                                      [-cmd ir|cr|kur|p10cr|rr|genm] [-infotype name] [-geninfo OID:int:N]

                                                                                                                                      Certificate enrollment options:

                                                                                                                                      [-newkey filename|uri] [-newkeypass arg] [-subject name] [-issuer name] [-days number] [-reqexts name] [-sans spec] [-san_nodefault] [-policies name] [-policy_oids names] [-policy_oids_critical] [-popo number] [-csr filename] [-out_trusted filenames|uris] [-implicit_confirm] [-disable_confirm] [-certout filename] [-chainout filename]

                                                                                                                                      Certificate enrollment and revocation options:

                                                                                                                                      [-oldcert filename|uri] [-revreason number]

                                                                                                                                      Message transfer options:

                                                                                                                                      [-server [http[s]://][userinfo@]host[:port][/path][?query][#fragment]] [-proxy [http[s]://][userinfo@]host[:port][/path][?query][#fragment]] [-no_proxy addresses] [-recipient name] [-path remote_path] [-keep_alive value] [-msg_timeout seconds] [-total_timeout seconds]

                                                                                                                                      Server authentication options:

                                                                                                                                      [-trusted filenames|uris] [-untrusted filenames|uris] [-srvcert filename|uri] [-expect_sender name] [-ignore_keyusage] [-unprotected_errors] [-extracertsout filename] [-cacertsout filename]

                                                                                                                                      Client authentication and protection options:

                                                                                                                                      [-ref value] [-secret arg] [-cert filename|uri] [-own_trusted filenames|uris] [-key filename|uri] [-keypass arg] [-digest name] [-mac name] [-extracerts filenames|uris] [-unprotected_requests]

                                                                                                                                      Credentials format options:

                                                                                                                                      [-certform PEM|DER] [-keyform PEM|DER|P12|ENGINE] [-otherpass arg] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      Random state options:

                                                                                                                                      [-rand files] [-writerand file]

                                                                                                                                      TLS connection options:

                                                                                                                                      [-tls_used] [-tls_cert filename|uri] [-tls_key filename|uri] [-tls_keypass arg] [-tls_extra filenames|uris] [-tls_trusted filenames|uris] [-tls_host name]

                                                                                                                                      Client-side debugging options:

                                                                                                                                      [-batch] [-repeat number] [-reqin filenames] [-reqin_new_tid] [-reqout filenames] [-rspin filenames] [-rspout filenames] [-use_mock_srv]

                                                                                                                                      Mock server options:

                                                                                                                                      [-port number] [-max_msgs number] [-srv_ref value] [-srv_secret arg] [-srv_cert filename|uri] [-srv_key filename|uri] [-srv_keypass arg] [-srv_trusted filenames|uris] [-srv_untrusted filenames|uris] [-rsp_cert filename|uri] [-rsp_extracerts filenames|uris] [-rsp_capubs filenames|uris] [-poll_count number] [-check_after number] [-grant_implicitconf] [-pkistatus number] [-failure number] [-failurebits number] [-statusstring arg] [-send_error] [-send_unprotected] [-send_unprot_err] [-accept_unprotected] [-accept_unprot_err] [-accept_raverified]

                                                                                                                                      Certificate verification options, for both CMP and TLS:

                                                                                                                                      [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks]

                                                                                                                                      "},{"location":"man1/openssl-cmp/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The cmp command is a client implementation for the Certificate Management Protocol (CMP) as defined in RFC4210. It can be used to request certificates from a CA server, update their certificates, request certificates to be revoked, and perform other types of CMP requests.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Display a summary of all options

                                                                                                                                      • -config filename

                                                                                                                                        Configuration file to use. An empty string \"\" means none. Default filename is from the environment variable OPENSSL_CONF.

                                                                                                                                      • -section names

                                                                                                                                        Section(s) to use within config file defining CMP options. An empty string \"\" means no specific section. Default is cmp.

                                                                                                                                        Multiple section names may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Contents of sections named later may override contents of sections named before. In any case, as usual, the [default] section and finally the unnamed section (as far as present) can provide per-option fallback values.

                                                                                                                                      • -verbosity level

                                                                                                                                        Level of verbosity for logging, error output, etc. 0 = EMERG, 1 = ALERT, 2 = CRIT, 3 = ERR, 4 = WARN, 5 = NOTE, 6 = INFO, 7 = DEBUG, 8 = TRACE. Defaults to 6 = INFO.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#generic-message-options","title":"Generic message options","text":"
                                                                                                                                      • -cmd ir|cr|kur|p10cr|rr|genm

                                                                                                                                        CMP command to execute. Currently implemented commands are:

                                                                                                                                        • ir \u00a0 - Initialization Request
                                                                                                                                        • cr \u00a0 - Certificate Request
                                                                                                                                        • p10cr - PKCS#10 Certification Request (for legacy support)
                                                                                                                                        • kur \u00a0\u00a0- Key Update Request
                                                                                                                                        • rr \u00a0 - Revocation Request
                                                                                                                                        • genm - General Message

                                                                                                                                        ir requests initialization of an end entity into a PKI hierarchy by issuing a first certificate.

                                                                                                                                        cr requests issuing an additional certificate for an end entity already initialized to the PKI hierarchy.

                                                                                                                                        p10cr requests issuing an additional certificate similarly to cr but using legacy PKCS#10 CSR format.

                                                                                                                                        kur requests a (key) update for an existing certificate.

                                                                                                                                        rr requests revocation of an existing certificate.

                                                                                                                                        genm requests information using a General Message, where optionally included InfoTypeAndValues may be used to state which info is of interest. Upon receipt of the General Response, information about all received ITAV infoTypes is printed to stdout.

                                                                                                                                      • -infotype name

                                                                                                                                        Set InfoType name to use for requesting specific info in genm, e.g., signKeyPairTypes.

                                                                                                                                      • -geninfo OID:int:N

                                                                                                                                        generalInfo integer values to place in request PKIHeader with given OID, e.g., 1.2.3.4:int:56789.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#certificate-enrollment-options","title":"Certificate enrollment options","text":"
                                                                                                                                      • -newkey filename|uri

                                                                                                                                        The source of the private or public key for the certificate being requested. Defaults to the public key in the PKCS#10 CSR given with the -csr option, the public key of the reference certificate, or the current client key.

                                                                                                                                        The public portion of the key is placed in the certification request.

                                                                                                                                        Unless -cmd p10cr, -popo -1, or -popo 0 is given, the private key will be needed as well to provide the proof of possession (POPO), where the -key option may provide a fallback.

                                                                                                                                      • -newkeypass arg

                                                                                                                                        Pass phrase source for the key given with the -newkey option. If not given here, the password will be prompted for if needed.

                                                                                                                                        For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -subject name

                                                                                                                                        X509 Distinguished Name (DN) of subject to use in the requested certificate template. If the NULL-DN (\"/\") is given then no subject is placed in the template. Default is the subject DN of any PKCS#10 CSR given with the -csr option. For KUR, a further fallback is the subject DN of the reference certificate (see -oldcert) if provided. This fallback is used for IR and CR only if no SANs are set.

                                                                                                                                        If provided and neither -cert nor -oldcert is given, the subject DN is used as fallback sender of outgoing CMP messages.

                                                                                                                                        The argument must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash); whitespace is retained. Empty values are permitted, but the corresponding type will not be included. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

                                                                                                                                        /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

                                                                                                                                      • -issuer name

                                                                                                                                        X509 issuer Distinguished Name (DN) of the CA server to place in the requested certificate template in IR/CR/KUR. If the NULL-DN (\"/\") is given then no issuer is placed in the template.

                                                                                                                                        If provided and neither -recipient nor -srvcert is given, the issuer DN is used as fallback recipient of outgoing CMP messages.

                                                                                                                                        The argument must be formatted as /type0=value0/type1=value1/type2=.... For details see the description of the -subject option.

                                                                                                                                      • -days number

                                                                                                                                        Number of days the new certificate is requested to be valid for, counting from the current time of the host. Also triggers the explicit request that the validity period starts from the current time (as seen by the host).

                                                                                                                                      • -reqexts name

                                                                                                                                        Name of section in OpenSSL config file defining certificate request extensions. If the -csr option is present, these extensions augment the extensions contained the given PKCS#10 CSR, overriding any extensions with same OIDs.

                                                                                                                                      • -sans spec

                                                                                                                                        One or more IP addresses, DNS names, or URIs separated by commas or whitespace (where in the latter case the whole argument must be enclosed in \"...\") to add as Subject Alternative Name(s) (SAN) certificate request extension. If the special element \"critical\" is given the SANs are flagged as critical. Cannot be used if any Subject Alternative Name extension is set via -reqexts.

                                                                                                                                      • -san_nodefault

                                                                                                                                        When Subject Alternative Names are not given via -sans nor defined via -reqexts, they are copied by default from the reference certificate (see -oldcert). This can be disabled by giving the -san_nodefault option.

                                                                                                                                      • -policies name

                                                                                                                                        Name of section in OpenSSL config file defining policies to be set as certificate request extension. This option cannot be used together with -policy_oids.

                                                                                                                                      • -policy_oids names

                                                                                                                                        One or more OID(s), separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\") to add as certificate policies request extension. This option cannot be used together with -policies.

                                                                                                                                      • -policy_oids_critical

                                                                                                                                        Flag the policies given with -policy_oids as critical.

                                                                                                                                      • -popo number

                                                                                                                                        Proof-of-possession (POPO) method to use for IR/CR/KUR; values: -1..<2> where -1 = NONE, 0 = RAVERIFIED, 1 = SIGNATURE (default), 2 = KEYENC.

                                                                                                                                        Note that a signature-based POPO can only be produced if a private key is provided via the -newkey or -key options.

                                                                                                                                      • -csr filename

                                                                                                                                        PKCS#10 CSR in PEM or DER format containing a certificate request. With -cmd p10cr it is used directly in a legacy P10CR message.

                                                                                                                                        When used with -cmd ir, cr, or kur, it is transformed into the respective regular CMP request. In this case, a private key must be provided (with -newkey or -key) for the proof of possession (unless -popo -1 or -popo 0 is used) and the respective public key is placed in the certification request (rather than taking over the public key contained in the PKCS#10 CSR).

                                                                                                                                        PKCS#10 CSR input may also be used with -cmd rr to specify the certificate to be revoked via the included subject name and public key.

                                                                                                                                      • -out_trusted filenames|uris

                                                                                                                                        Trusted certificate(s) to use for validating the newly enrolled certificate. During this verification, any certificate status checking is disabled.

                                                                                                                                        Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

                                                                                                                                        The certificate verification options -verify_hostname, -verify_ip, and -verify_email only affect the certificate verification enabled via this option.

                                                                                                                                      • -implicit_confirm

                                                                                                                                        Request implicit confirmation of newly enrolled certificates.

                                                                                                                                      • -disable_confirm

                                                                                                                                        Do not send certificate confirmation message for newly enrolled certificate without requesting implicit confirmation to cope with broken servers not supporting implicit confirmation correctly. WARNING: This leads to behavior violating RFC 4210.

                                                                                                                                      • -certout filename

                                                                                                                                        The file where the newly enrolled certificate should be saved.

                                                                                                                                      • -chainout filename

                                                                                                                                        The file where the chain of the newly enrolled certificate should be saved.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#certificate-enrollment-and-revocation-options","title":"Certificate enrollment and revocation options","text":"
                                                                                                                                      • -oldcert filename|uri

                                                                                                                                        The certificate to be updated (i.e., renewed or re-keyed) in Key Update Request (KUR) messages or to be revoked in Revocation Request (RR) messages. For KUR the certificate to be updated defaults to -cert, and the resulting certificate is called reference certificate. For RR the certificate to be revoked can also be specified using -csr.

                                                                                                                                        The reference certificate, if any, is also used for deriving default subject DN and Subject Alternative Names and the default issuer entry in the requested certificate template of an IR/CR/KUR. Its public key is used as a fallback in the template of certification requests. Its subject is used as sender of outgoing messages if -cert is not given. Its issuer is used as default recipient in CMP message headers if neither -recipient, -srvcert, nor -issuer is given.

                                                                                                                                      • -revreason number

                                                                                                                                        Set CRLReason to be included in revocation request (RR); values: 0..10 or -1 for none (which is the default).

                                                                                                                                        Reason numbers defined in RFC 5280 are:

                                                                                                                                        CRLReason ::= ENUMERATED {\n     unspecified             (0),\n     keyCompromise           (1),\n     cACompromise            (2),\n     affiliationChanged      (3),\n     superseded              (4),\n     cessationOfOperation    (5),\n     certificateHold         (6),\n     -- value 7 is not used\n     removeFromCRL           (8),\n     privilegeWithdrawn      (9),\n     aACompromise           (10)\n }\n
                                                                                                                                      "},{"location":"man1/openssl-cmp/#message-transfer-options","title":"Message transfer options","text":"
                                                                                                                                      • -server [http[s]://][userinfo@]host[:port][/path][?query][#fragment]

                                                                                                                                        The DNS hostname or IP address and optionally port of the CMP server to connect to using HTTP(S). This option excludes -port and -use_mock_srv. It is ignored if -rspin is given with enough filename arguments.

                                                                                                                                        The scheme https may be given only if the -tls_used option is used. In this case the default port is 443, else 80. The optional userinfo and fragment components are ignored. Any given query component is handled as part of the path component. If a path is included it provides the default value for the -path option.

                                                                                                                                      • -proxy [http[s]://][userinfo@]host[:port][/path][?query][#fragment]

                                                                                                                                        The HTTP(S) proxy server to use for reaching the CMP server unless -no_proxy applies, see below. The proxy port defaults to 80 or 443 if the scheme is https; apart from that the optional http:// or https:// prefix is ignored (note that TLS may be selected by -tls_used), as well as any path, userinfo, and query, and fragment components. Defaults to the environment variable http_proxy if set, else HTTP_PROXY in case no TLS is used, otherwise https_proxy if set, else HTTPS_PROXY. This option is ignored if -server is not given.

                                                                                                                                      • -no_proxy addresses

                                                                                                                                        List of IP addresses and/or DNS names of servers not to use an HTTP(S) proxy for, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Default is from the environment variable no_proxy if set, else NO_PROXY. This option is ignored if -server is not given.

                                                                                                                                      • -recipient name

                                                                                                                                        Distinguished Name (DN) to use in the recipient field of CMP request message headers, i.e., the CMP server (usually the addressed CA).

                                                                                                                                        The recipient field in the header of a CMP message is mandatory. If not given explicitly the recipient is determined in the following order: the subject of the CMP server certificate given with the -srvcert option, the -issuer option, the issuer of the certificate given with the -oldcert option, the issuer of the CMP client certificate (-cert option), as far as any of those is present, else the NULL-DN as last resort.

                                                                                                                                        The argument must be formatted as /type0=value0/type1=value1/type2=.... For details see the description of the -subject option.

                                                                                                                                      • -path remote_path

                                                                                                                                        HTTP path at the CMP server (aka CMP alias) to use for POST requests. Defaults to any path given with -server, else \"/\".

                                                                                                                                      • -keep_alive value

                                                                                                                                        If the given value is 0 then HTTP connections are not kept open after receiving a response, which is the default behavior for HTTP 1.0. If the value is 1 or 2 then persistent connections are requested. If the value is 2 then persistent connections are required, i.e., in case the server does not grant them an error occurs. The default value is 1, which means preferring to keep the connection open.

                                                                                                                                      • -msg_timeout seconds

                                                                                                                                        Number of seconds a CMP request-response message round trip is allowed to take before a timeout error is returned. A value <= 0 means no limitation (waiting indefinitely). Default is to use the -total_timeout setting.

                                                                                                                                      • -total_timeout seconds

                                                                                                                                        Maximum total number of seconds a transaction may take, including polling etc. A value <= 0 means no limitation (waiting indefinitely). Default is 0.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#server-authentication-options","title":"Server authentication options","text":"
                                                                                                                                      • -trusted filenames|uris

                                                                                                                                        The certificate(s), typically of root CAs, the client shall use as trust anchors when validating signature-based protection of CMP response messages. This option is ignored if the -srvcert option is given as well. It provides more flexibility than -srvcert because the CMP protection certificate of the server is not pinned but may be any certificate from which a chain to one of the given trust anchors can be constructed.

                                                                                                                                        If none of -trusted, -srvcert, and -secret is given, message validation errors will be thrown unless -unprotected_errors permits an exception.

                                                                                                                                        Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

                                                                                                                                        The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

                                                                                                                                      • -untrusted filenames|uris

                                                                                                                                        Non-trusted intermediate CA certificate(s). Any extra certificates given with the -cert option are appended to it. All these certificates may be useful for cert path construction for the own CMP signer certificate (to include in the extraCerts field of request messages) and for the TLS client certificate (if TLS is enabled) as well as for chain building when validating server certificates (checking signature-based CMP message protection) and when validating newly enrolled certificates.

                                                                                                                                        Multiple filenames or URLs may be given, separated by commas and/or whitespace. Each source may contain multiple certificates.

                                                                                                                                      • -srvcert filename|uri

                                                                                                                                        The specific CMP server certificate to expect and directly trust (even if it is expired) when verifying signature-based protection of CMP response messages. This pins the accepted server and results in ignoring the -trusted option.

                                                                                                                                        If set, the subject of the certificate is also used as default value for the recipient of CMP requests and as default value for the expected sender of CMP responses.

                                                                                                                                      • -expect_sender name

                                                                                                                                        Distinguished Name (DN) expected in the sender field of incoming CMP messages. Defaults to the subject DN of the pinned -srvcert, if any.

                                                                                                                                        This can be used to make sure that only a particular entity is accepted as CMP message signer, and attackers are not able to use arbitrary certificates of a trusted PKI hierarchy to fraudulently pose as a CMP server. Note that this option gives slightly more freedom than setting the -srvcert, which pins the server to the holder of a particular certificate, while the expected sender name will continue to match after updates of the server cert.

                                                                                                                                        The argument must be formatted as /type0=value0/type1=value1/type2=.... For details see the description of the -subject option.

                                                                                                                                      • -ignore_keyusage

                                                                                                                                        Ignore key usage restrictions in CMP signer certificates when validating signature-based protection of incoming CMP messages. By default, digitalSignature must be allowed by CMP signer certificates.

                                                                                                                                      • -unprotected_errors

                                                                                                                                        Accept missing or invalid protection of negative responses from the server. This applies to the following message types and contents:

                                                                                                                                        • error messages
                                                                                                                                        • negative certificate responses (IP/CP/KUP)
                                                                                                                                        • negative revocation responses (RP)
                                                                                                                                        • negative PKIConf messages

                                                                                                                                        WARNING: This setting leads to unspecified behavior and it is meant exclusively to allow interoperability with server implementations violating RFC 4210, e.g.:

                                                                                                                                        • section 5.1.3.1 allows exceptions from protecting only for special cases: \"There MAY be cases in which the PKIProtection BIT STRING is deliberately not used to protect a message [...] because other protection, external to PKIX, will be applied instead.\"
                                                                                                                                        • section 5.3.21 is clear on ErrMsgContent: \"The CA MUST always sign it with a signature key.\"
                                                                                                                                        • appendix D.4 shows PKIConf message having protection
                                                                                                                                      • -extracertsout filename

                                                                                                                                        The file where to save all certificates contained in the extraCerts field of the last received response message (except for pollRep and PKIConf).

                                                                                                                                      • -cacertsout filename

                                                                                                                                        The file where to save any CA certificates contained in the caPubs field of the last received certificate response (i.e., IP, CP, or KUP) message.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#client-authentication-options","title":"Client authentication options","text":"
                                                                                                                                      • -ref value

                                                                                                                                        Reference number/string/value to use as fallback senderKID; this is required if no sender name can be determined from the -cert or <-subject> options and is typically used when authenticating with pre-shared key (password-based MAC).

                                                                                                                                      • -secret arg

                                                                                                                                        Provides the source of a secret value to use with MAC-based message protection. This takes precedence over the -cert and -key options. The secret is used for creating MAC-based protection of outgoing messages and for validating incoming messages that have MAC-based protection. The algorithm used by default is Password-Based Message Authentication Code (PBM) as defined in RFC 4210 section 5.1.3.1.

                                                                                                                                        For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -cert filename|uri

                                                                                                                                        The client's current CMP signer certificate. Requires the corresponding key to be given with -key.

                                                                                                                                        The subject and the public key contained in this certificate serve as fallback values in the certificate template of IR/CR/KUR messages.

                                                                                                                                        The subject of this certificate will be used as sender of outgoing CMP messages, while the subject of -oldcert or -subjectName may provide fallback values.

                                                                                                                                        The issuer of this certificate is used as one of the recipient fallback values and as fallback issuer entry in the certificate template of IR/CR/KUR messages.

                                                                                                                                        When performing signature-based message protection, this \"protection certificate\", also called \"signer certificate\", will be included first in the extraCerts field of outgoing messages and the signature is done with the corresponding key. In Initialization Request (IR) messages this can be used for authenticating using an external entity certificate as defined in appendix E.7 of RFC 4210.

                                                                                                                                        For Key Update Request (KUR) messages this is also used as the certificate to be updated if the -oldcert option is not given.

                                                                                                                                        If the file includes further certs, they are appended to the untrusted certs because they typically constitute the chain of the client certificate, which is included in the extraCerts field in signature-protected request messages.

                                                                                                                                      • -own_trusted filenames|uris

                                                                                                                                        If this list of certificates is provided then the chain built for the client-side CMP signer certificate given with the -cert option is verified using the given certificates as trust anchors.

                                                                                                                                        Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

                                                                                                                                        The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

                                                                                                                                      • -key filename|uri

                                                                                                                                        The corresponding private key file for the client's current certificate given in the -cert option. This will be used for signature-based message protection unless the -secret option indicating MAC-based protection or -unprotected_requests is given.

                                                                                                                                        It is also used as a fallback for the -newkey option with IR/CR/KUR messages.

                                                                                                                                      • -keypass arg

                                                                                                                                        Pass phrase source for the private key given with the -key option. Also used for -cert and -oldcert in case it is an encrypted PKCS#12 file. If not given here, the password will be prompted for if needed.

                                                                                                                                        For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -digest name

                                                                                                                                        Specifies name of supported digest to use in RFC 4210's MSG_SIG_ALG and as the one-way function (OWF) in MSG_MAC_ALG. If applicable, this is used for message protection and proof-of-possession (POPO) signatures. To see the list of supported digests, use openssl list -digest-commands. Defaults to sha256.

                                                                                                                                      • -mac name

                                                                                                                                        Specifies the name of the MAC algorithm in MSG_MAC_ALG. To get the names of supported MAC algorithms use openssl list -mac-algorithms and possibly combine such a name with the name of a supported digest algorithm, e.g., hmacWithSHA256. Defaults to hmac-sha1 as per RFC 4210.

                                                                                                                                      • -extracerts filenames|uris

                                                                                                                                        Certificates to append in the extraCerts field when sending messages. They can be used as the default CMP signer certificate chain to include.

                                                                                                                                        Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

                                                                                                                                      • -unprotected_requests

                                                                                                                                        Send request messages without CMP-level protection.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#credentials-format-options","title":"Credentials format options","text":"
                                                                                                                                      • -certform PEM|DER

                                                                                                                                        File format to use when saving a certificate to a file. Default value is PEM.

                                                                                                                                      • -keyform PEM|DER|P12|ENGINE

                                                                                                                                        The format of the key input; unspecified by default. See \"Format Options\" in openssl(1) for details.

                                                                                                                                      • -otherpass arg

                                                                                                                                        Pass phrase source for certificate given with the -trusted, -untrusted, -own_trusted, -srvcert, -out_trusted, -extracerts, -srv_trusted, -srv_untrusted, -rsp_extracerts, -rsp_capubs, -tls_extra, and -tls_trusted options. If not given here, the password will be prompted for if needed.

                                                                                                                                        For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                        As an alternative to using this combination:

                                                                                                                                        -engine {engineid} -key {keyid} -keyform ENGINE\n

                                                                                                                                        ... it's also possible to just give the key ID in URI form to -key, like this:

                                                                                                                                        -key org.openssl.engine:{engineid}:{keyid}\n

                                                                                                                                        This applies to all options specifying keys: -key, -newkey, and -tls_key.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#provider-options","title":"Provider options","text":"
                                                                                                                                      • -provider name
                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-cmp/#random-state-options","title":"Random state options","text":"
                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#tls-connection-options","title":"TLS connection options","text":"
                                                                                                                                      • -tls_used

                                                                                                                                        Enable using TLS (even when other TLS-related options are not set) for message exchange with CMP server via HTTP. This option is not supported with the -port option. It is ignored if the -server option is not given or -use_mock_srv is given or -rspin is given with enough filename arguments.

                                                                                                                                        The following TLS-related options are ignored if -tls_used is not given or does not take effect.

                                                                                                                                      • -tls_cert filename|uri

                                                                                                                                        Client's TLS certificate. If the source includes further certs they are used (along with -untrusted certs) for constructing the client cert chain provided to the TLS server.

                                                                                                                                      • -tls_key filename|uri

                                                                                                                                        Private key for the client's TLS certificate.

                                                                                                                                      • -tls_keypass arg

                                                                                                                                        Pass phrase source for client's private TLS key -tls_key. Also used for -tls_cert in case it is an encrypted PKCS#12 file. If not given here, the password will be prompted for if needed.

                                                                                                                                        For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -tls_extra filenames|uris

                                                                                                                                        Extra certificates to provide to TLS server during TLS handshake

                                                                                                                                      • -tls_trusted filenames|uris

                                                                                                                                        Trusted certificate(s) to use for validating the TLS server certificate. This implies hostname validation.

                                                                                                                                        Multiple sources may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Each source may contain multiple certificates.

                                                                                                                                        The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

                                                                                                                                      • -tls_host name

                                                                                                                                        Address to be checked during hostname validation. This may be a DNS name or an IP address. If not given it defaults to the -server address.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#client-side-debugging-options","title":"Client-side debugging options","text":"
                                                                                                                                      • -batch

                                                                                                                                        Do not interactively prompt for input, for instance when a password is needed. This can be useful for batch processing and testing.

                                                                                                                                      • -repeat number

                                                                                                                                        Invoke the command the given positive number of times with the same parameters. Default is one invocation.

                                                                                                                                      • -reqin filenames

                                                                                                                                        Take the sequence of CMP requests to send to the server from the given file(s) rather than from the sequence of requests produced internally.

                                                                                                                                        This option is ignored if the -rspin option is given because in the latter case no requests are actually sent.

                                                                                                                                        Multiple filenames may be given, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\").

                                                                                                                                        The files are read as far as needed to complete the transaction and filenames have been provided. If more requests are needed, the remaining ones are taken from the items at the respective position in the sequence of requests produced internally.

                                                                                                                                        The client needs to update the recipNonce field in the given requests (except for the first one) in order to satisfy the checks to be performed by the server. This causes re-protection (if protecting requests is required).

                                                                                                                                      • -reqin_new_tid

                                                                                                                                        Use a fresh transactionID for CMP request messages read using -reqin, which causes their reprotection (if protecting requests is required). This may be needed in case the sequence of requests is reused and the CMP server complains that the transaction ID has already been used.

                                                                                                                                      • -reqout filenames

                                                                                                                                        Save the sequence of CMP requests created by the client to the given file(s). These requests are not sent to the server if the -reqin option is used, too.

                                                                                                                                        Multiple filenames may be given, separated by commas and/or whitespace.

                                                                                                                                        Files are written as far as needed to save the transaction and filenames have been provided. If the transaction contains more requests, the remaining ones are not saved.

                                                                                                                                      • -rspin filenames

                                                                                                                                        Process the sequence of CMP responses provided in the given file(s), not contacting any given server, as long as enough filenames are provided to complete the transaction.

                                                                                                                                        Multiple filenames may be given, separated by commas and/or whitespace.

                                                                                                                                        Any server specified via the -server or -use_mock_srv options is contacted only if more responses are needed to complete the transaction. In this case the transaction will fail unless the server has been prepared to continue the already started transaction.

                                                                                                                                      • -rspout filenames

                                                                                                                                        Save the sequence of actually used CMP responses to the given file(s). These have been received from the server unless -rspin takes effect.

                                                                                                                                        Multiple filenames may be given, separated by commas and/or whitespace.

                                                                                                                                        Files are written as far as needed to save the responses contained in the transaction and filenames have been provided. If the transaction contains more responses, the remaining ones are not saved.

                                                                                                                                      • -use_mock_srv

                                                                                                                                        Test the client using the internal CMP server mock-up at API level, bypassing socket-based transfer via HTTP. This excludes the -server and -port options.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#mock-server-options","title":"Mock server options","text":"
                                                                                                                                      • -port number

                                                                                                                                        Act as HTTP-based CMP server mock-up listening on the given port. This excludes the -server and -use_mock_srv options. The -rspin, -rspout, -reqin, and -reqout options so far are not supported in this mode.

                                                                                                                                      • -max_msgs number

                                                                                                                                        Maximum number of CMP (request) messages the CMP HTTP server mock-up should handle, which must be nonnegative. The default value is 0, which means that no limit is imposed. In any case the server terminates on internal errors, but not when it detects a CMP-level error that it can successfully answer with an error message.

                                                                                                                                      • -srv_ref value

                                                                                                                                        Reference value to use as senderKID of server in case no -srv_cert is given.

                                                                                                                                      • -srv_secret arg

                                                                                                                                        Password source for server authentication with a pre-shared key (secret).

                                                                                                                                      • -srv_cert filename|uri

                                                                                                                                        Certificate of the server.

                                                                                                                                      • -srv_key filename|uri

                                                                                                                                        Private key used by the server for signing messages.

                                                                                                                                      • -srv_keypass arg

                                                                                                                                        Server private key (and cert) file pass phrase source.

                                                                                                                                      • -srv_trusted filenames|uris

                                                                                                                                        Trusted certificates for client authentication.

                                                                                                                                        The certificate verification options -verify_hostname, -verify_ip, and -verify_email have no effect on the certificate verification enabled via this option.

                                                                                                                                      • -srv_untrusted filenames|uris

                                                                                                                                        Intermediate CA certs that may be useful when validating client certificates.

                                                                                                                                      • -rsp_cert filename|uri

                                                                                                                                        Certificate to be returned as mock enrollment result.

                                                                                                                                      • -rsp_extracerts filenames|uris

                                                                                                                                        Extra certificates to be included in mock certification responses.

                                                                                                                                      • -rsp_capubs filenames|uris

                                                                                                                                        CA certificates to be included in mock Initialization Response (IP) message.

                                                                                                                                      • -poll_count number

                                                                                                                                        Number of times the client must poll before receiving a certificate.

                                                                                                                                      • -check_after number

                                                                                                                                        The checkAfter value (number of seconds to wait) to include in poll response.

                                                                                                                                      • -grant_implicitconf

                                                                                                                                        Grant implicit confirmation of newly enrolled certificate.

                                                                                                                                      • -pkistatus number

                                                                                                                                        PKIStatus to be included in server response. Valid range is 0 (accepted) .. 6 (keyUpdateWarning).

                                                                                                                                      • -failure number

                                                                                                                                        A single failure info bit number to be included in server response. Valid range is 0 (badAlg) .. 26 (duplicateCertReq).

                                                                                                                                      • -failurebits number Number representing failure bits to be included in server response. Valid range is 0 .. 2^27 - 1.

                                                                                                                                      • -statusstring arg

                                                                                                                                        Text to be included as status string in server response.

                                                                                                                                      • -send_error

                                                                                                                                        Force server to reply with error message.

                                                                                                                                      • -send_unprotected

                                                                                                                                        Send response messages without CMP-level protection.

                                                                                                                                      • -send_unprot_err

                                                                                                                                        In case of negative responses, server shall send unprotected error messages, certificate responses (IP/CP/KUP), and revocation responses (RP). WARNING: This setting leads to behavior violating RFC 4210.

                                                                                                                                      • -accept_unprotected

                                                                                                                                        Accept missing or invalid protection of requests.

                                                                                                                                      • -accept_unprot_err

                                                                                                                                        Accept unprotected error messages from client. So far this has no effect because the server does not accept any error messages.

                                                                                                                                      • -accept_raverified

                                                                                                                                        Accept RAVERIFED as proof of possession (POPO).

                                                                                                                                      "},{"location":"man1/openssl-cmp/#certificate-verification-options-for-both-cmp-and-tls","title":"Certificate verification options, for both CMP and TLS","text":"
                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                        The certificate verification options -verify_hostname, -verify_ip, and -verify_email only affect the certificate verification enabled via the -out_trusted option.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#notes","title":"NOTES","text":"

                                                                                                                                      When a client obtains from a CMP server CA certificates that it is going to trust, for instance via the caPubs field of a certificate response, authentication of the CMP server is particularly critical. So special care must be taken setting up server authentication using -trusted and related options for certificate-based authentication or -secret for MAC-based protection.

                                                                                                                                      When setting up CMP configurations and experimenting with enrollment options typically various errors occur until the configuration is correct and complete. When the CMP server reports an error the client will by default check the protection of the CMP response message. Yet some CMP services tend not to protect negative responses. In this case the client will reject them, and thus their contents are not shown although they usually contain hints that would be helpful for diagnostics. For assisting in such cases the CMP client offers a workaround via the -unprotected_errors option, which allows accepting such negative messages.

                                                                                                                                      If OpenSSL was built with trace support enabled and the environment variable OPENSSL_TRACE includes HTTP, the request and response headers of HTTP transfers are printed.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#examples","title":"EXAMPLES","text":""},{"location":"man1/openssl-cmp/#simple-examples-using-the-default-openssl-configuration-file","title":"Simple examples using the default OpenSSL configuration file","text":"

                                                                                                                                      This CMP client implementation comes with demonstrative CMP sections in the example configuration file openssl/apps/openssl.cnf, which can be used to interact conveniently with the Insta Demo CA.

                                                                                                                                      In order to enroll an initial certificate from that CA it is sufficient to issue the following shell commands.

                                                                                                                                      export OPENSSL_CONF=/path/to/openssl/apps/openssl.cnf\n\nopenssl genrsa -out insta.priv.pem\nopenssl cmp -section insta\n

                                                                                                                                      This should produce the file insta.cert.pem containing a new certificate for the private key held in insta.priv.pem. It can be viewed using, e.g.,

                                                                                                                                      openssl x509 -noout -text -in insta.cert.pem\n

                                                                                                                                      In case the network setup requires using an HTTP proxy it may be given as usual via the environment variable http_proxy or via the -proxy option in the configuration file or the CMP command-line argument -proxy, for example

                                                                                                                                      -proxy http://192.168.1.1:8080\n

                                                                                                                                      In the Insta Demo CA scenario both clients and the server may use the pre-shared secret insta and the reference value 3078 to authenticate to each other.

                                                                                                                                      Alternatively, CMP messages may be protected in signature-based manner, where the trust anchor in this case is insta.ca.crt and the client may use any certificate already obtained from that CA, as specified in the [signature] section of the example configuration. This can be used in combination with the [insta] section simply by

                                                                                                                                      openssl cmp -section insta,signature\n

                                                                                                                                      By default the CMP IR message type is used, yet CR works equally here. This may be specified directly at the command line:

                                                                                                                                      openssl cmp -section insta -cmd cr\n

                                                                                                                                      or by referencing in addition the [cr] section of the example configuration:

                                                                                                                                      openssl cmp -section insta,cr\n

                                                                                                                                      In order to update the enrolled certificate one may call

                                                                                                                                      openssl cmp -section insta,kur\n

                                                                                                                                      using MAC-based protection with PBM or

                                                                                                                                      openssl cmp -section insta,kur,signature\n

                                                                                                                                      using signature-based protection.

                                                                                                                                      In a similar way any previously enrolled certificate may be revoked by

                                                                                                                                      openssl cmp -section insta,rr -trusted insta.ca.crt\n

                                                                                                                                      or

                                                                                                                                      openssl cmp -section insta,rr,signature\n

                                                                                                                                      Many more options can be given in the configuration file and/or on the command line. For instance, the -reqexts CLI option may refer to a section in the configuration file defining X.509 extensions to use in certificate requests, such as v3_req in openssl/apps/openssl.cnf:

                                                                                                                                      openssl cmp -section insta,cr -reqexts v3_req\n
                                                                                                                                      "},{"location":"man1/openssl-cmp/#certificate-enrollment","title":"Certificate enrollment","text":"

                                                                                                                                      The following examples do not make use of a configuration file at first. They assume that a CMP server can be contacted on the local TCP port 80 and accepts requests under the alias /pkix/.

                                                                                                                                      For enrolling its very first certificate the client generates a client key and sends an initial request message to the local CMP server using a pre-shared secret key for mutual authentication. In this example the client does not have the CA certificate yet, so we specify the name of the CA with the -recipient option and save any CA certificates that we may receive in the capubs.pem file.

                                                                                                                                      In below command line usage examples the \\ at line ends is used just for formatting; each of the command invocations should be on a single line.

                                                                                                                                      openssl genrsa -out cl_key.pem\nopenssl cmp -cmd ir -server 127.0.0.1:80/pkix/ -recipient \"/CN=CMPserver\" \\\n  -ref 1234 -secret pass:1234-5678 \\\n  -newkey cl_key.pem -subject \"/CN=MyName\" \\\n  -cacertsout capubs.pem -certout cl_cert.pem\n
                                                                                                                                      "},{"location":"man1/openssl-cmp/#certificate-update","title":"Certificate update","text":"

                                                                                                                                      Then, when the client certificate and its related key pair needs to be updated, the client can send a key update request taking the certs in capubs.pem as trusted for authenticating the server and using the previous cert and key for its own authentication. Then it can start using the new cert and key.

                                                                                                                                      openssl genrsa -out cl_key_new.pem\nopenssl cmp -cmd kur -server 127.0.0.1:80/pkix/ \\\n  -trusted capubs.pem \\\n  -cert cl_cert.pem -key cl_key.pem \\\n  -newkey cl_key_new.pem -certout cl_cert.pem\ncp cl_key_new.pem cl_key.pem\n

                                                                                                                                      This command sequence can be repeated as often as needed.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#requesting-information-from-cmp-server","title":"Requesting information from CMP server","text":"

                                                                                                                                      Requesting \"all relevant information\" with an empty General Message. This prints information about all received ITAV infoTypes to stdout.

                                                                                                                                      openssl cmp -cmd genm -server 127.0.0.1/pkix/ -recipient \"/CN=CMPserver\" \\\n  -ref 1234 -secret pass:1234-5678\n
                                                                                                                                      "},{"location":"man1/openssl-cmp/#using-a-custom-configuration-file","title":"Using a custom configuration file","text":"

                                                                                                                                      For CMP client invocations, in particular for certificate enrollment, usually many parameters need to be set, which is tedious and error-prone to do on the command line. Therefore, the client offers the possibility to read options from sections of the OpenSSL config file, usually called openssl.cnf. The values found there can still be extended and even overridden by any subsequently loaded sections and on the command line.

                                                                                                                                      After including in the configuration file the following sections:

                                                                                                                                      [cmp]\nserver = 127.0.0.1\npath = pkix/\ntrusted = capubs.pem\ncert = cl_cert.pem\nkey = cl_key.pem\nnewkey = cl_key.pem\ncertout = cl_cert.pem\n\n[init]\nrecipient = \"/CN=CMPserver\"\ntrusted =\ncert =\nkey =\nref = 1234\nsecret = pass:1234-5678-1234-567\nsubject = \"/CN=MyName\"\ncacertsout = capubs.pem\n

                                                                                                                                      the above enrollment transactions reduce to

                                                                                                                                      openssl cmp -section cmp,init\nopenssl cmp -cmd kur -newkey cl_key_new.pem\n

                                                                                                                                      and the above transaction using a general message reduces to

                                                                                                                                      openssl cmp -section cmp,init -cmd genm\n
                                                                                                                                      "},{"location":"man1/openssl-cmp/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl-genrsa(1), openssl-ecparam(1), openssl-list(1), openssl-req(1), openssl-x509(1), x509v3_config(5)

                                                                                                                                      "},{"location":"man1/openssl-cmp/#history","title":"HISTORY","text":"

                                                                                                                                      The cmp application was added in OpenSSL 3.0.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-cmp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-cms/","title":"openssl-cms","text":""},{"location":"man1/openssl-cms/#name","title":"NAME","text":"

                                                                                                                                      openssl-cms - CMS command

                                                                                                                                      "},{"location":"man1/openssl-cms/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl cms [-help]

                                                                                                                                      General options:

                                                                                                                                      [-in filename] [-out filename] [-config configfile]

                                                                                                                                      Operation options:

                                                                                                                                      [-encrypt] [-decrypt] [-sign] [-verify] [-resign] [-sign_receipt] [-verify_receipt receipt] [-digest_create] [-digest_verify] [-compress] [-uncompress] [-EncryptedData_encrypt] [-EncryptedData_decrypt] [-data_create] [-data_out] [-cmsout]

                                                                                                                                      File format options:

                                                                                                                                      [-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-rctform DER|PEM|SMIME] [-stream] [-indef] [-noindef] [-binary] [-crlfeol] [-asciicrlf]

                                                                                                                                      Keys and password options:

                                                                                                                                      [-pwri_password password] [-secretkey key] [-secretkeyid id] [-inkey filename|uri] [-passin arg] [-keyopt name:parameter] [-keyform DER|PEM|P12|ENGINE] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-rand files] [-writerand file]

                                                                                                                                      Encryption options:

                                                                                                                                      [-originator file] [-recip file] [recipient-cert ...] [-cipher] [-wrap cipher] [-aes128-wrap] [-aes192-wrap] [-aes256-wrap] [-des3-wrap] [-debug_decrypt]

                                                                                                                                      Signing options:

                                                                                                                                      [-md digest] [-signer file] [-certfile file] [-cades] [-nodetach] [-nocerts] [-noattr] [-nosmimecap] [-receipt_request_all] [-receipt_request_first] [-receipt_request_from emailaddress] [-receipt_request_to emailaddress]

                                                                                                                                      Verification options:

                                                                                                                                      [-signer file] [-content filename] [-no_content_verify] [-no_attr_verify] [-nosigs] [-noverify] [-nointern] [-cades] [-verify_retcode] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore]

                                                                                                                                      Output options:

                                                                                                                                      [-keyid] [-econtent_type type] [-text] [-certsout file] [-to addr] [-from addr] [-subject subj]

                                                                                                                                      Printing options:

                                                                                                                                      [-noout] [-print] [-nameopt option] [-receipt_request_print]

                                                                                                                                      Validation options:

                                                                                                                                      [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks]

                                                                                                                                      "},{"location":"man1/openssl-cms/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command handles data in CMS format such as S/MIME v3.1 email messages. It can encrypt, decrypt, sign, verify, compress, uncompress, and print messages.

                                                                                                                                      "},{"location":"man1/openssl-cms/#options","title":"OPTIONS","text":"

                                                                                                                                      There are a number of operation options that set the type of operation to be performed: encrypt, decrypt, sign, verify, resign, sign_receipt, verify_receipt, digest_create, digest_verify, compress, uncompress, EncryptedData_encrypt, EncryptedData_decrypt, data_create, data_out, or cmsout. The relevance of the other options depends on the operation type and their meaning may vary according to it.

                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      "},{"location":"man1/openssl-cms/#general-options","title":"General options","text":"
                                                                                                                                      • -in filename

                                                                                                                                        The input message to be encrypted or signed or the message to be decrypted or verified.

                                                                                                                                      • -out filename

                                                                                                                                        The message text that has been decrypted or verified or the output MIME format message that has been signed or verified.

                                                                                                                                      • -config configfile

                                                                                                                                        See \"Configuration Option\" in openssl(1).

                                                                                                                                      "},{"location":"man1/openssl-cms/#operation-options","title":"Operation options","text":"
                                                                                                                                      • -encrypt

                                                                                                                                        Encrypt data for the given recipient certificates. Input file is the message to be encrypted. The output file is the encrypted data in MIME format. The actual CMS type is EnvelopedData.

                                                                                                                                        Note that no revocation check is done for the recipient cert, so if that key has been compromised, others may be able to decrypt the text.

                                                                                                                                      • -decrypt

                                                                                                                                        Decrypt data using the supplied certificate and private key. Expects encrypted datain MIME format for the input file. The decrypted data is written to the output file.

                                                                                                                                      • -sign

                                                                                                                                        Sign data using the supplied certificate and private key. Input file is the message to be signed. The signed data in MIME format is written to the output file.

                                                                                                                                      • -verify

                                                                                                                                        Verify signed data. Expects a signed data on input and outputs the signed data. Both clear text and opaque signing is supported.

                                                                                                                                      • -resign

                                                                                                                                        Resign a message: take an existing message and one or more new signers.

                                                                                                                                      • -sign_receipt

                                                                                                                                        Generate and output a signed receipt for the supplied message. The input message must contain a signed receipt request. Functionality is otherwise similar to the -sign operation.

                                                                                                                                      • -verify_receipt receipt

                                                                                                                                        Verify a signed receipt in filename receipt. The input message must contain the original receipt request. Functionality is otherwise similar to the -verify operation.

                                                                                                                                      • -digest_create

                                                                                                                                        Create a CMS DigestedData type.

                                                                                                                                      • -digest_verify

                                                                                                                                        Verify a CMS DigestedData type and output the content.

                                                                                                                                      • -compress

                                                                                                                                        Create a CMS CompressedData type. OpenSSL must be compiled with zlib support for this option to work, otherwise it will output an error.

                                                                                                                                      • -uncompress

                                                                                                                                        Uncompress a CMS CompressedData type and output the content. OpenSSL must be compiled with zlib support for this option to work, otherwise it will output an error.

                                                                                                                                      • -EncryptedData_encrypt

                                                                                                                                        Encrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type and output the content.

                                                                                                                                      • -EncryptedData_decrypt

                                                                                                                                        Decrypt content using supplied symmetric key and algorithm using a CMS EncryptedData type and output the content.

                                                                                                                                      • -data_create

                                                                                                                                        Create a CMS Data type.

                                                                                                                                      • -data_out

                                                                                                                                        Data type and output the content.

                                                                                                                                      • -cmsout

                                                                                                                                        Takes an input message and writes out a PEM encoded CMS structure.

                                                                                                                                      "},{"location":"man1/openssl-cms/#file-format-options","title":"File format options","text":"
                                                                                                                                      • -inform DER|PEM|SMIME

                                                                                                                                        The input format of the CMS structure (if one is being read); the default is SMIME. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM|SMIME

                                                                                                                                        The output format of the CMS structure (if one is being written); the default is SMIME. See openssl-format-options(1) for details.

                                                                                                                                      • -rctform DER|PEM|SMIME

                                                                                                                                        The signed receipt format for use with the -receipt_verify; the default is SMIME. See openssl-format-options(1) for details.

                                                                                                                                      • -stream, -indef

                                                                                                                                        The -stream and -indef options are equivalent and enable streaming I/O for encoding operations. This permits single pass processing of data without the need to hold the entire contents in memory, potentially supporting very large files. Streaming is automatically set for S/MIME signing with detached data if the output format is SMIME it is currently off by default for all other operations.

                                                                                                                                      • -noindef

                                                                                                                                        Disable streaming I/O where it would produce and indefinite length constructed encoding. This option currently has no effect. In future streaming will be enabled by default on all relevant operations and this option will disable it.

                                                                                                                                      • -binary

                                                                                                                                        Normally the input message is converted to \"canonical\" format which is effectively using CR and LF as end of line: as required by the S/MIME specification. When this option is present no translation occurs. This is useful when handling binary data which may not be in MIME format.

                                                                                                                                      • -crlfeol

                                                                                                                                        Normally the output file uses a single LF as end of line. When this option is present CRLF is used instead.

                                                                                                                                      • -asciicrlf

                                                                                                                                        When signing use ASCII CRLF format canonicalisation. This strips trailing whitespace from all lines, deletes trailing blank lines at EOF and sets the encapsulated content type. This option is normally used with detached content and an output signature format of DER. This option is not normally needed when verifying as it is enabled automatically if the encapsulated content format is detected.

                                                                                                                                      "},{"location":"man1/openssl-cms/#keys-and-password-options","title":"Keys and password options","text":"
                                                                                                                                      • -pwri_password password

                                                                                                                                        Specify password for recipient.

                                                                                                                                      • -secretkey key

                                                                                                                                        Specify symmetric key to use. The key must be supplied in hex format and be consistent with the algorithm used. Supported by the -EncryptedData_encrypt -EncryptedData_decrypt, -encrypt and -decrypt options. When used with -encrypt or -decrypt the supplied key is used to wrap or unwrap the content encryption key using an AES key in the KEKRecipientInfo type.

                                                                                                                                      • -secretkeyid id

                                                                                                                                        The key identifier for the supplied symmetric key for KEKRecipientInfo type. This option must be present if the -secretkey option is used with -encrypt. With -decrypt operations the id is used to locate the relevant key if it is not supplied then an attempt is used to decrypt any KEKRecipientInfo structures.

                                                                                                                                      • -inkey filename|uri

                                                                                                                                        The private key to use when signing or decrypting. This must match the corresponding certificate. If this option is not specified then the private key must be included in the certificate file specified with the -recip or -signer file. When signing this option can be used multiple times to specify successive keys.

                                                                                                                                      • -passin arg

                                                                                                                                        The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -keyopt name:parameter

                                                                                                                                        For signing and encryption this option can be used multiple times to set customised parameters for the preceding key or certificate. It can currently be used to set RSA-PSS for signing, RSA-OAEP for encryption or to modify default parameters for ECDH.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The format of the private key file; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      "},{"location":"man1/openssl-cms/#encryption-and-decryption-options","title":"Encryption and decryption options","text":"
                                                                                                                                      • -originator file

                                                                                                                                        A certificate of the originator of the encrypted message. Necessary for decryption when Key Agreement is in use for a shared key.

                                                                                                                                      • -recip file

                                                                                                                                        When decrypting a message this specifies the certificate of the recipient. The certificate must match one of the recipients of the message.

                                                                                                                                        When encrypting a message this option may be used multiple times to specify each recipient. This form must be used if customised parameters are required (for example to specify RSA-OAEP).

                                                                                                                                        Only certificates carrying RSA, Diffie-Hellman or EC keys are supported by this option.

                                                                                                                                      • recipient-cert ...

                                                                                                                                        This is an alternative to using the -recip option when encrypting a message. One or more certificate filenames may be given.

                                                                                                                                      • -cipher

                                                                                                                                        The encryption algorithm to use. For example triple DES (168 bits) - -des3 or 256 bit AES - -aes256. Any standard algorithm name (as used by the EVP_get_cipherbyname() function) can also be used preceded by a dash, for example -aes-128-cbc. See openssl-enc(1) for a list of ciphers supported by your version of OpenSSL.

                                                                                                                                        Currently the AES variants with GCM mode are the only supported AEAD algorithms.

                                                                                                                                        If not specified triple DES is used. Only used with -encrypt and -EncryptedData_create commands.

                                                                                                                                      • -wrap cipher

                                                                                                                                        Cipher algorithm to use for key wrap when encrypting the message using Key Agreement for key transport. The algorithm specified should be suitable for key wrap.

                                                                                                                                      • -aes128-wrap, -aes192-wrap, -aes256-wrap, -des3-wrap

                                                                                                                                        Use AES128, AES192, AES256, or 3DES-EDE, respectively, to wrap key. Depending on the OpenSSL build options used, -des3-wrap may not be supported.

                                                                                                                                      • -debug_decrypt

                                                                                                                                        This option sets the CMS_DEBUG_DECRYPT flag. This option should be used with caution: see the notes section below.

                                                                                                                                      "},{"location":"man1/openssl-cms/#signing-options","title":"Signing options","text":"
                                                                                                                                      • -md digest

                                                                                                                                        Digest algorithm to use when signing or resigning. If not present then the default digest algorithm for the signing key will be used (usually SHA1).

                                                                                                                                      • -signer file

                                                                                                                                        A signing certificate. When signing or resigning a message, this option can be used multiple times if more than one signer is required.

                                                                                                                                      • -certfile file

                                                                                                                                        Allows additional certificates to be specified. When signing these will be included with the message. When verifying these will be searched for the signers certificates. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -cades

                                                                                                                                        When used with -sign, add an ESS signingCertificate or ESS signingCertificateV2 signed-attribute to the SignerInfo, in order to make the signature comply with the requirements for a CAdES Basic Electronic Signature (CAdES-BES).

                                                                                                                                      • -nodetach

                                                                                                                                        When signing a message use opaque signing: this form is more resistant to translation by mail relays but it cannot be read by mail agents that do not support S/MIME. Without this option cleartext signing with the MIME type multipart/signed is used.

                                                                                                                                      • -nocerts

                                                                                                                                        When signing a message the signer's certificate is normally included with this option it is excluded. This will reduce the size of the signed message but the verifier must have a copy of the signers certificate available locally (passed using the -certfile option for example).

                                                                                                                                      • -noattr

                                                                                                                                        Normally when a message is signed a set of attributes are included which include the signing time and supported symmetric algorithms. With this option they are not included.

                                                                                                                                      • -nosmimecap

                                                                                                                                        Exclude the list of supported algorithms from signed attributes, other options such as signing time and content type are still included.

                                                                                                                                      • -receipt_request_all, -receipt_request_first

                                                                                                                                        For -sign option include a signed receipt request. Indicate requests should be provided by all recipient or first tier recipients (those mailed directly and not from a mailing list). Ignored it -receipt_request_from is included.

                                                                                                                                      • -receipt_request_from emailaddress

                                                                                                                                        For -sign option include a signed receipt request. Add an explicit email address where receipts should be supplied.

                                                                                                                                      • -receipt_request_to emailaddress

                                                                                                                                        Add an explicit email address where signed receipts should be sent to. This option must but supplied if a signed receipt is requested.

                                                                                                                                      "},{"location":"man1/openssl-cms/#verification-options","title":"Verification options","text":"
                                                                                                                                      • -signer file

                                                                                                                                        If a message has been verified successfully then the signers certificate(s) will be written to this file if the verification was successful.

                                                                                                                                      • -content filename

                                                                                                                                        This specifies a file containing the detached content for operations taking S/MIME input, such as the -verify command. This is only usable if the CMS structure is using the detached signature form where the content is not included. This option will override any content if the input format is S/MIME and it uses the multipart/signed MIME content type.

                                                                                                                                      • -no_content_verify

                                                                                                                                        Do not verify signed content signatures.

                                                                                                                                      • -no_attr_verify

                                                                                                                                        Do not verify signed attribute signatures.

                                                                                                                                      • -nosigs

                                                                                                                                        Don't verify message signature.

                                                                                                                                      • -noverify

                                                                                                                                        Do not verify the signers certificate of a signed message.

                                                                                                                                      • -nointern

                                                                                                                                        When verifying a message normally certificates (if any) included in the message are searched for the signing certificate. With this option only the certificates specified in the -certfile option are used. The supplied certificates can still be used as untrusted CAs however.

                                                                                                                                      • -cades

                                                                                                                                        When used with -verify, require and check signer certificate digest. See the NOTES section for more details.

                                                                                                                                      • -verify_retcode

                                                                                                                                        Exit nonzero on verification failure.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      "},{"location":"man1/openssl-cms/#output-options","title":"Output options","text":"
                                                                                                                                      • -keyid

                                                                                                                                        Use subject key identifier to identify certificates instead of issuer name and serial number. The supplied certificate must include a subject key identifier extension. Supported by -sign and -encrypt options.

                                                                                                                                      • -econtent_type type

                                                                                                                                        Set the encapsulated content type to type if not supplied the Data type is used. The type argument can be any valid OID name in either text or numerical format.

                                                                                                                                      • -text

                                                                                                                                        This option adds plain text (text/plain) MIME headers to the supplied message if encrypting or signing. If decrypting or verifying it strips off text headers: if the decrypted or verified message is not of MIME type text/plain then an error occurs.

                                                                                                                                      • -certsout file

                                                                                                                                        Any certificates contained in the input message are written to file.

                                                                                                                                      • -to, -from, -subject

                                                                                                                                        The relevant email headers. These are included outside the signed portion of a message so they may be included manually. If signing then many S/MIME mail clients check the signers certificate's email address matches that specified in the From: address.

                                                                                                                                      "},{"location":"man1/openssl-cms/#printing-options","title":"Printing options","text":"
                                                                                                                                      • -noout

                                                                                                                                        For the -cmsout operation do not output the parsed CMS structure. This is useful if the syntax of the CMS structure is being checked.

                                                                                                                                      • -print

                                                                                                                                        For the -cmsout operation print out all fields of the CMS structure. This implies -noout. This is mainly useful for testing purposes.

                                                                                                                                      • -nameopt option

                                                                                                                                        For the -cmsout operation when -print option is in use, specifies printing options for string fields. For most cases utf8 is reasonable value. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -receipt_request_print

                                                                                                                                        For the -verify operation print out the contents of any signed receipt requests.

                                                                                                                                      "},{"location":"man1/openssl-cms/#validation-options","title":"Validation options","text":"
                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                        Any validation errors cause the command to exit.

                                                                                                                                      "},{"location":"man1/openssl-cms/#notes","title":"NOTES","text":"

                                                                                                                                      The MIME message must be sent without any blank lines between the headers and the output. Some mail programs will automatically add a blank line. Piping the mail directly to sendmail is one way to achieve the correct format.

                                                                                                                                      The supplied message to be signed or encrypted must include the necessary MIME headers or many S/MIME clients won't display it properly (if at all). You can use the -text option to automatically add plain text headers.

                                                                                                                                      A \"signed and encrypted\" message is one where a signed message is then encrypted. This can be produced by encrypting an already signed message: see the examples section.

                                                                                                                                      This version of the program only allows one signer per message but it will verify multiple signers on received messages. Some S/MIME clients choke if a message contains multiple signers. It is possible to sign messages \"in parallel\" by signing an already signed message.

                                                                                                                                      The options -encrypt and -decrypt reflect common usage in S/MIME clients. Strictly speaking these process CMS enveloped data: CMS encrypted data is used for other purposes.

                                                                                                                                      The -resign option uses an existing message digest when adding a new signer. This means that attributes must be present in at least one existing signer using the same message digest or this operation will fail.

                                                                                                                                      The -stream and -indef options enable streaming I/O support. As a result the encoding is BER using indefinite length constructed encoding and no longer DER. Streaming is supported for the -encrypt operation and the -sign operation if the content is not detached.

                                                                                                                                      Streaming is always used for the -sign operation with detached data but since the content is no longer part of the CMS structure the encoding remains DER.

                                                                                                                                      If the -decrypt option is used without a recipient certificate then an attempt is made to locate the recipient by trying each potential recipient in turn using the supplied private key. To thwart the MMA attack (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all recipients are tried whether they succeed or not and if no recipients match the message is \"decrypted\" using a random key which will typically output garbage. The -debug_decrypt option can be used to disable the MMA attack protection and return an error if no recipient can be found: this option should be used with caution. For a fuller description see CMS_decrypt(3)).

                                                                                                                                      "},{"location":"man1/openssl-cms/#cades-basic-electronic-signature-cades-bes","title":"CADES BASIC ELECTRONIC SIGNATURE (CADES-BES)","text":"

                                                                                                                                      A CAdES Basic Electronic Signature (CAdES-BES), as defined in the European Standard ETSI EN 319 122-1 V1.1.1, contains:

                                                                                                                                      • The signed user data as defined in CMS (RFC 3852);
                                                                                                                                      • Content-type of the EncapsulatedContentInfo value being signed;
                                                                                                                                      • Message-digest of the eContent OCTET STRING within encapContentInfo being signed;
                                                                                                                                      • An ESS signingCertificate or ESS signingCertificateV2 attribute, as defined in Enhanced Security Services (ESS), RFC 2634 and RFC 5035. An ESS signingCertificate attribute only allows for SHA-1 as digest algorithm. An ESS signingCertificateV2 attribute allows for any digest algorithm.
                                                                                                                                      • The digital signature value computed on the user data and, when present, on the signed attributes.

                                                                                                                                        NOTE that the -cades option applies to the -sign or -verify operations. With this option, the -verify operation also requires that the signingCertificate attribute is present and checks that the given identifiers match the verification trust chain built during the verification process.

                                                                                                                                      "},{"location":"man1/openssl-cms/#exit-codes","title":"EXIT CODES","text":"
                                                                                                                                      • 0

                                                                                                                                        The operation was completely successfully.

                                                                                                                                      • 1

                                                                                                                                        An error occurred parsing the command options.

                                                                                                                                      • 2

                                                                                                                                        One of the input files could not be read.

                                                                                                                                      • 3

                                                                                                                                        An error occurred creating the CMS file or when reading the MIME message.

                                                                                                                                      • 4

                                                                                                                                        An error occurred decrypting or verifying the message.

                                                                                                                                      • 5

                                                                                                                                        The message was verified correctly but an error occurred writing out the signers certificates.

                                                                                                                                      "},{"location":"man1/openssl-cms/#compatibility-with-pkcs7-format","title":"COMPATIBILITY WITH PKCS#7 FORMAT","text":"

                                                                                                                                      openssl-smime(1) can only process the older PKCS#7 format. openssl cms supports Cryptographic Message Syntax format. Use of some features will result in messages which cannot be processed by applications which only support the older format. These are detailed below.

                                                                                                                                      The use of the -keyid option with -sign or -encrypt.

                                                                                                                                      The -outform PEM option uses different headers.

                                                                                                                                      The -compress option.

                                                                                                                                      The -secretkey option when used with -encrypt.

                                                                                                                                      The use of PSS with -sign.

                                                                                                                                      The use of OAEP or non-RSA keys with -encrypt.

                                                                                                                                      Additionally the -EncryptedData_create and -data_create type cannot be processed by the older openssl-smime(1) command.

                                                                                                                                      "},{"location":"man1/openssl-cms/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create a cleartext signed message:

                                                                                                                                      openssl cms -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem\n

                                                                                                                                      Create an opaque signed message

                                                                                                                                      openssl cms -sign -in message.txt -text -out mail.msg -nodetach \\\n       -signer mycert.pem\n

                                                                                                                                      Create a signed message, include some additional certificates and read the private key from another file:

                                                                                                                                      openssl cms -sign -in in.txt -text -out mail.msg \\\n       -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem\n

                                                                                                                                      Create a signed message with two signers, use key identifier:

                                                                                                                                      openssl cms -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem -signer othercert.pem -keyid\n

                                                                                                                                      Send a signed message under Unix directly to sendmail, including headers:

                                                                                                                                      openssl cms -sign -in in.txt -text -signer mycert.pem \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed message\" | sendmail someone@somewhere\n

                                                                                                                                      Verify a message and extract the signer's certificate if successful:

                                                                                                                                      openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt\n

                                                                                                                                      Send encrypted mail using triple DES:

                                                                                                                                      openssl cms -encrypt -in in.txt -from steve@openssl.org \\\n       -to someone@somewhere -subject \"Encrypted message\" \\\n       -des3 user.pem -out mail.msg\n

                                                                                                                                      Sign and encrypt mail:

                                                                                                                                      openssl cms -sign -in ml.txt -signer my.pem -text \\\n       | openssl cms -encrypt -out mail.msg \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed and Encrypted message\" -des3 user.pem\n

                                                                                                                                      Note: the encryption command does not include the -text option because the message being encrypted already has MIME headers.

                                                                                                                                      Decrypt a message:

                                                                                                                                      openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem\n

                                                                                                                                      The output from Netscape form signing is a PKCS#7 structure with the detached signature format. You can use this program to verify the signature by line wrapping the base64 encoded structure and surrounding it with:

                                                                                                                                      -----BEGIN PKCS7-----\n-----END PKCS7-----\n

                                                                                                                                      and using the command,

                                                                                                                                      openssl cms -verify -inform PEM -in signature.pem -content content.txt\n

                                                                                                                                      alternatively you can base64 decode the signature and use

                                                                                                                                      openssl cms -verify -inform DER -in signature.der -content content.txt\n

                                                                                                                                      Create an encrypted message using 128 bit Camellia:

                                                                                                                                      openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem\n

                                                                                                                                      Add a signer to an existing message:

                                                                                                                                      openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg\n

                                                                                                                                      Sign a message using RSA-PSS:

                                                                                                                                      openssl cms -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem -keyopt rsa_padding_mode:pss\n

                                                                                                                                      Create an encrypted message using RSA-OAEP:

                                                                                                                                      openssl cms -encrypt -in plain.txt -out mail.msg \\\n       -recip cert.pem -keyopt rsa_padding_mode:oaep\n

                                                                                                                                      Use SHA256 KDF with an ECDH certificate:

                                                                                                                                      openssl cms -encrypt -in plain.txt -out mail.msg \\\n       -recip ecdhcert.pem -keyopt ecdh_kdf_md:sha256\n

                                                                                                                                      Print CMS signed binary data in human-readable form:

                                                                                                                                      openssl cms -in signed.cms -binary -inform DER -cmsout -print

                                                                                                                                      "},{"location":"man1/openssl-cms/#bugs","title":"BUGS","text":"

                                                                                                                                      The MIME parser isn't very clever: it seems to handle most messages that I've thrown at it but it may choke on others.

                                                                                                                                      The code currently will only write out the signer's certificate to a file: if the signer has a separate encryption certificate this must be manually extracted. There should be some heuristic that determines the correct encryption certificate.

                                                                                                                                      Ideally a database should be maintained of a certificates for each email address.

                                                                                                                                      The code doesn't currently take note of the permitted symmetric encryption algorithms as supplied in the SMIMECapabilities signed attribute. this means the user has to manually include the correct encryption algorithm. It should store the list of permitted ciphers in a database and only use those.

                                                                                                                                      No revocation checking is done on the signer's certificate.

                                                                                                                                      "},{"location":"man1/openssl-cms/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-cms/#history","title":"HISTORY","text":"

                                                                                                                                      The use of multiple -signer options and the -resign command were first added in OpenSSL 1.0.0.

                                                                                                                                      The -keyopt option was added in OpenSSL 1.0.2.

                                                                                                                                      Support for RSA-OAEP and RSA-PSS was added in OpenSSL 1.0.2.

                                                                                                                                      The use of non-RSA keys with -encrypt and -decrypt was added in OpenSSL 1.0.2.

                                                                                                                                      The -no_alt_chains option was added in OpenSSL 1.0.2b.

                                                                                                                                      The -nameopt option was added in OpenSSL 3.0.0.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-cms/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-crl/","title":"openssl-crl","text":""},{"location":"man1/openssl-crl/#name","title":"NAME","text":"

                                                                                                                                      openssl-crl - CRL command

                                                                                                                                      "},{"location":"man1/openssl-crl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl crl [-help] [-inform DER|PEM] [-outform DER|PEM] [-key filename] [-keyform DER|PEM|P12] [-dateopt] [-text] [-in filename] [-out filename] [-gendelta filename] [-badsig] [-verify] [-noout] [-hash] [-hash_old] [-fingerprint] [-crlnumber] [-issuer] [-lastupdate] [-nextupdate] [-nameopt option] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-crl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes CRL files in DER or PEM format.

                                                                                                                                      "},{"location":"man1/openssl-crl/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The CRL input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The CRL output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                      • -key filename

                                                                                                                                        The private key to be used to sign the CRL.

                                                                                                                                      • -keyform DER|PEM|P12

                                                                                                                                        The format of the private key file; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read from or standard input if this option is not specified.

                                                                                                                                      • -out filename

                                                                                                                                        Specifies the output filename to write to or standard output by default.

                                                                                                                                      • -gendelta filename

                                                                                                                                        Output a comparison of the main CRL and the one specified here.

                                                                                                                                      • -badsig

                                                                                                                                        Corrupt the signature before writing it; this can be useful for testing.

                                                                                                                                      • -dateopt

                                                                                                                                        Specify the date output format. Values are: rfc_822 and iso_8601. Defaults to rfc_822.

                                                                                                                                      • -text

                                                                                                                                        Print out the CRL in text form.

                                                                                                                                      • -verify

                                                                                                                                        Verify the signature in the CRL.

                                                                                                                                        This option is implicitly enabled if any of -CApath, -CAfile or -CAstore is specified.

                                                                                                                                      • -noout

                                                                                                                                        Don't output the encoded version of the CRL.

                                                                                                                                      • -fingerprint

                                                                                                                                        Output the fingerprint of the CRL.

                                                                                                                                      • -crlnumber

                                                                                                                                        Output the number of the CRL.

                                                                                                                                      • -hash

                                                                                                                                        Output a hash of the issuer name. This can be use to lookup CRLs in a directory by issuer name.

                                                                                                                                      • -hash_old

                                                                                                                                        Outputs the \"hash\" of the CRL issuer name using the older algorithm as used by OpenSSL before version 1.0.0.

                                                                                                                                      • -issuer

                                                                                                                                        Output the issuer name.

                                                                                                                                      • -lastupdate

                                                                                                                                        Output the lastUpdate field.

                                                                                                                                      • -nextupdate

                                                                                                                                        Output the nextUpdate field.

                                                                                                                                      • -nameopt option

                                                                                                                                        This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-crl/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Convert a CRL file from PEM to DER:

                                                                                                                                      openssl crl -in crl.pem -outform DER -out crl.der\n

                                                                                                                                      Output the text form of a DER encoded certificate:

                                                                                                                                      openssl crl -in crl.der -text -noout\n
                                                                                                                                      "},{"location":"man1/openssl-crl/#bugs","title":"BUGS","text":"

                                                                                                                                      Ideally it should be possible to create a CRL using appropriate options and files too.

                                                                                                                                      "},{"location":"man1/openssl-crl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-crl2pkcs7(1), openssl-ca(1), openssl-x509(1), ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-crl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/","title":"openssl-crl2pkcs7","text":""},{"location":"man1/openssl-crl2pkcs7/#name","title":"NAME","text":"

                                                                                                                                      openssl-crl2pkcs7 - Create a PKCS#7 structure from a CRL and certificates

                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl crl2pkcs7 [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-certfile filename] [-nocrl] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command takes an optional CRL and one or more certificates and converts them into a PKCS#7 degenerate \"certificates only\" structure.

                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The input format of the CRL; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The output format of the PKCS#7 object; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read a CRL from or standard input if this option is not specified.

                                                                                                                                      • -out filename

                                                                                                                                        Specifies the output filename to write the PKCS#7 structure to or standard output by default.

                                                                                                                                      • -certfile filename

                                                                                                                                        Specifies a filename containing one or more certificates in PEM format. All certificates in the file will be added to the PKCS#7 structure. This option can be used more than once to read certificates from multiple files.

                                                                                                                                      • -nocrl

                                                                                                                                        Normally a CRL is included in the output file. With this option no CRL is included in the output file and a CRL is not read from the input file.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create a PKCS#7 structure from a certificate and CRL:

                                                                                                                                      openssl crl2pkcs7 -in crl.pem -certfile cert.pem -out p7.pem\n

                                                                                                                                      Creates a PKCS#7 structure in DER format with no CRL from several different certificates:

                                                                                                                                      openssl crl2pkcs7 -nocrl -certfile newcert.pem\n       -certfile demoCA/cacert.pem -outform DER -out p7.der\n
                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/#notes","title":"NOTES","text":"

                                                                                                                                      The output file is a PKCS#7 signed data structure containing no signers and just certificates and an optional CRL.

                                                                                                                                      This command can be used to send certificates and CAs to Netscape as part of the certificate enrollment process. This involves sending the DER encoded output as MIME type application/x-x509-user-cert.

                                                                                                                                      The PEM encoded form with the header and footer lines removed can be used to install user certificates and CAs in MSIE using the Xenroll control.

                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkcs7(1)

                                                                                                                                      "},{"location":"man1/openssl-crl2pkcs7/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-dgst/","title":"openssl-dgst","text":""},{"location":"man1/openssl-dgst/#name","title":"NAME","text":"

                                                                                                                                      openssl-dgst - perform digest operations

                                                                                                                                      "},{"location":"man1/openssl-dgst/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl dgst|digest [-digest] [-list] [-help] [-c] [-d] [-debug] [-hex] [-binary] [-xoflen length] [-r] [-out filename] [-sign filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-verify filename] [-prverify filename] [-signature filename] [-sigopt nm:v] [-hmac key] [-mac alg] [-macopt nm:v] [-fips-fingerprint] [-engine id] [-engine_impl id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [file ...]

                                                                                                                                      "},{"location":"man1/openssl-dgst/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command output the message digest of a supplied file or files in hexadecimal, and also generates and verifies digital signatures using message digests.

                                                                                                                                      The generic name, openssl dgst, may be used with an option specifying the algorithm to be used. The default digest is sha256. A supported digest name may also be used as the sub-command name. To see the list of supported algorithms, use openssl list -digest-algorithms

                                                                                                                                      "},{"location":"man1/openssl-dgst/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -digest

                                                                                                                                        Specifies name of a supported digest to be used. See option -list below :

                                                                                                                                      • -list

                                                                                                                                        Prints out a list of supported message digests.

                                                                                                                                      • -c

                                                                                                                                        Print out the digest in two digit groups separated by colons, only relevant if the -hex option is given as well.

                                                                                                                                      • -d, -debug

                                                                                                                                        Print out BIO debugging information.

                                                                                                                                      • -hex

                                                                                                                                        Digest is to be output as a hex dump. This is the default case for a \"normal\" digest as opposed to a digital signature. See NOTES below for digital signatures using -hex.

                                                                                                                                      • -binary

                                                                                                                                        Output the digest or signature in binary form.

                                                                                                                                      • -xoflen length

                                                                                                                                        Set the output length for XOF algorithms, such as shake128 and shake256. This option is not supported for signing operations.

                                                                                                                                        For OpenSSL providers it is recommended to set this value for shake algorithms, since the default values are set to only supply half of the maximum security strength.

                                                                                                                                        For backwards compatibility reasons the default xoflen length for shake128 is 16 (bytes) which results in a security strength of only 64 bits. To ensure the maximum security strength of 128 bits, the xoflen should be set to at least 32.

                                                                                                                                        For backwards compatibility reasons the default xoflen length for shake256 is 32 (bytes) which results in a security strength of only 128 bits. To ensure the maximum security strength of 256 bits, the xoflen should be set to at least 64.

                                                                                                                                      • -r

                                                                                                                                        Output the digest in the \"coreutils\" format, including newlines. Used by programs like sha1sum(1).

                                                                                                                                      • -out filename

                                                                                                                                        Filename to output to, or standard output by default.

                                                                                                                                      • -sign filename|uri

                                                                                                                                        Digitally sign the digest using the given private key. Note this option does not support Ed25519 or Ed448 private keys. Use the openssl-pkeyutl(1) command instead for this.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The format of the key to sign with; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -sigopt nm:v

                                                                                                                                        Pass options to the signature algorithm during sign or verify operations. Names and values of these options are algorithm-specific.

                                                                                                                                      • -passin arg

                                                                                                                                        The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -verify filename

                                                                                                                                        Verify the signature using the public key in \"filename\". The output is either \"Verified OK\" or \"Verification Failure\".

                                                                                                                                      • -prverify filename

                                                                                                                                        Verify the signature using the private key in \"filename\".

                                                                                                                                      • -signature filename

                                                                                                                                        The actual signature to verify.

                                                                                                                                      • -hmac key

                                                                                                                                        Create a hashed MAC using \"key\".

                                                                                                                                        The openssl-mac(1) command should be preferred to using this command line option.

                                                                                                                                      • -mac alg

                                                                                                                                        Create MAC (keyed Message Authentication Code). The most popular MAC algorithm is HMAC (hash-based MAC), but there are other MAC algorithms which are not based on hash, for instance gost-mac algorithm, supported by the gost engine. MAC keys and other options should be set via -macopt parameter.

                                                                                                                                        The openssl-mac(1) command should be preferred to using this command line option.

                                                                                                                                      • -macopt nm:v

                                                                                                                                        Passes options to MAC algorithm, specified by -mac key. Following options are supported by both by HMAC and gost-mac:

                                                                                                                                        • key:string

                                                                                                                                          Specifies MAC key as alphanumeric string (use if key contain printable characters only). String length must conform to any restrictions of the MAC algorithm for example exactly 32 chars for gost-mac.

                                                                                                                                        • hexkey:string

                                                                                                                                          Specifies MAC key in hexadecimal form (two hex digits per byte). Key length must conform to any restrictions of the MAC algorithm for example exactly 32 chars for gost-mac.

                                                                                                                                        The openssl-mac(1) command should be preferred to using this command line option.

                                                                                                                                      • -fips-fingerprint

                                                                                                                                        Compute HMAC using a specific key for certain OpenSSL-FIPS operations.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                        The engine is not used for digests unless the -engine_impl option is used or it is configured to do so, see \"Engine Configuration Module\" in config(5).

                                                                                                                                      • -engine_impl id

                                                                                                                                        When used with the -engine option, it specifies to also use engine id for digest operations.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • file ...

                                                                                                                                        File or files to digest. If no files are specified then standard input is used.

                                                                                                                                      "},{"location":"man1/openssl-dgst/#examples","title":"EXAMPLES","text":"

                                                                                                                                      To create a hex-encoded message digest of a file:

                                                                                                                                      openssl dgst -md5 -hex file.txt\nor\nopenssl md5 file.txt\n

                                                                                                                                      To sign a file using SHA-256 with binary file output:

                                                                                                                                      openssl dgst -sha256 -sign privatekey.pem -out signature.sign file.txt\nor\nopenssl sha256 -sign privatekey.pem -out signature.sign file.txt\n

                                                                                                                                      To verify a signature:

                                                                                                                                      openssl dgst -sha256 -verify publickey.pem \\\n-signature signature.sign \\\nfile.txt\n
                                                                                                                                      "},{"location":"man1/openssl-dgst/#notes","title":"NOTES","text":"

                                                                                                                                      The digest mechanisms that are available will depend on the options used when building OpenSSL. The openssl list -digest-algorithms command can be used to list them.

                                                                                                                                      New or agile applications should use probably use SHA-256. Other digests, particularly SHA-1 and MD5, are still widely used for interoperating with existing formats and protocols.

                                                                                                                                      When signing a file, this command will automatically determine the algorithm (RSA, ECC, etc) to use for signing based on the private key's ASN.1 info. When verifying signatures, it only handles the RSA, DSA, or ECDSA signature itself, not the related data to identify the signer and algorithm used in formats such as x.509, CMS, and S/MIME.

                                                                                                                                      A source of random numbers is required for certain signing algorithms, in particular ECDSA and DSA.

                                                                                                                                      The signing and verify options should only be used if a single file is being signed or verified.

                                                                                                                                      Hex signatures cannot be verified using openssl. Instead, use \"xxd -r\" or similar program to transform the hex signature into a binary signature prior to verification.

                                                                                                                                      The openssl-mac(1) command is preferred over the -hmac, -mac and -macopt command line options.

                                                                                                                                      "},{"location":"man1/openssl-dgst/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl-mac(1)

                                                                                                                                      "},{"location":"man1/openssl-dgst/#history","title":"HISTORY","text":"

                                                                                                                                      The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0. The FIPS-related options were removed in OpenSSL 1.1.0.

                                                                                                                                      The -engine and -engine_impl options were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-dgst/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-dhparam/","title":"openssl-dhparam","text":""},{"location":"man1/openssl-dhparam/#name","title":"NAME","text":"

                                                                                                                                      openssl-dhparam - DH parameter manipulation and generation

                                                                                                                                      "},{"location":"man1/openssl-dhparam/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl dhparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-dsaparam] [-check] [-noout] [-text] [-2] [-3] [-5] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [numbits]

                                                                                                                                      "},{"location":"man1/openssl-dhparam/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to manipulate DH parameter files.

                                                                                                                                      See \"EXAMPLES\" in openssl-genpkey(1) for examples on how to generate a key using a named safe prime group without generating intermediate parameters.

                                                                                                                                      "},{"location":"man1/openssl-dhparam/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM, -outform DER|PEM

                                                                                                                                        The input format and output format; the default is PEM. The object is compatible with the PKCS#3 DHparameter structure. See openssl-format-options(1) for details.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read parameters from or standard input if this option is not specified.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename parameters to. Standard output is used if this option is not present. The output filename should not be the same as the input filename.

                                                                                                                                      • -dsaparam

                                                                                                                                        If this option is used, DSA rather than DH parameters are read or created; they are converted to DH format. Otherwise, safe primes (such that (p-1)/2 is also prime) will be used for DH parameter generation.

                                                                                                                                        DH parameter generation with the -dsaparam option is much faster. Beware that with such DSA-style DH parameters, a fresh DH key should be created for each use to avoid small-subgroup attacks that may be possible otherwise.

                                                                                                                                      • -check

                                                                                                                                        Performs numerous checks to see if the supplied parameters are valid and displays a warning if not.

                                                                                                                                      • -2, -3, -5

                                                                                                                                        The generator to use, either 2, 3 or 5. If present then the input file is ignored and parameters are generated instead. If not present but numbits is present, parameters are generated with the default generator 2.

                                                                                                                                      • numbits

                                                                                                                                        This option specifies that a parameter set should be generated of size numbits. It must be the last option. If this option is present then the input file is ignored and parameters are generated instead. If this option is not present but a generator (-2, -3 or -5) is present, parameters are generated with a default length of 2048 bits. The minimum length is 512 bits. The maximum length is 10000 bits.

                                                                                                                                      • -noout

                                                                                                                                        This option inhibits the output of the encoded version of the parameters.

                                                                                                                                      • -text

                                                                                                                                        This option prints out the DH parameters in human readable form.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-dhparam/#notes","title":"NOTES","text":"

                                                                                                                                      This command replaces the dh and gendh commands of previous releases.

                                                                                                                                      "},{"location":"man1/openssl-dhparam/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkeyparam(1), openssl-dsaparam(1), openssl-genpkey(1).

                                                                                                                                      "},{"location":"man1/openssl-dhparam/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      The -C option was removed in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-dhparam/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-dsa/","title":"openssl-dsa","text":""},{"location":"man1/openssl-dsa/#name","title":"NAME","text":"

                                                                                                                                      openssl-dsa - DSA key processing

                                                                                                                                      "},{"location":"man1/openssl-dsa/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl dsa [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-passin arg] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-text] [-noout] [-modulus] [-pubin] [-pubout] [-pvk-strong] [-pvk-weak] [-pvk-none] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-dsa/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes DSA keys. They can be converted between various forms and their components printed out. Note This command uses the traditional SSLeay compatible format for private key encryption: newer applications should use the more secure PKCS#8 format using the pkcs8

                                                                                                                                      "},{"location":"man1/openssl-dsa/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The key input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The key output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        Private keys are a sequence of ASN.1 INTEGERS: the version (zero), p, q, g, and the public and private key components. Public keys are a SubjectPublicKeyInfo structure with the DSA type.

                                                                                                                                        The PEM format also accepts PKCS#8 data.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write a key to or standard output by is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

                                                                                                                                      • -passin arg, -passout arg

                                                                                                                                        The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

                                                                                                                                        These options encrypt the private key with the specified cipher before outputting it. A pass phrase is prompted for. If none of these options is specified the key is written in plain text. This means that this command can be used to remove the pass phrase from a key by not giving any encryption option is given, or to add or change the pass phrase by setting them. These options can only be used with PEM format output files.

                                                                                                                                      • -text

                                                                                                                                        Prints out the public, private key components and parameters.

                                                                                                                                      • -noout

                                                                                                                                        This option prevents output of the encoded version of the key.

                                                                                                                                      • -modulus

                                                                                                                                        This option prints out the value of the public key component of the key.

                                                                                                                                      • -pubin

                                                                                                                                        By default, a private key is read from the input file. With this option a public key is read instead.

                                                                                                                                      • -pubout

                                                                                                                                        By default, a private key is output. With this option a public key will be output instead. This option is automatically set if the input is a public key.

                                                                                                                                      • -pvk-strong

                                                                                                                                        Enable 'Strong' PVK encoding level (default).

                                                                                                                                      • -pvk-weak

                                                                                                                                        Enable 'Weak' PVK encoding level.

                                                                                                                                      • -pvk-none

                                                                                                                                        Don't enforce PVK encoding.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      The openssl-pkey(1) command is capable of performing all the operations this command can, as well as supporting other public key types.

                                                                                                                                      "},{"location":"man1/openssl-dsa/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here.

                                                                                                                                      To remove the pass phrase on a DSA private key:

                                                                                                                                      openssl dsa -in key.pem -out keyout.pem\n

                                                                                                                                      To encrypt a private key using triple DES:

                                                                                                                                      openssl dsa -in key.pem -des3 -out keyout.pem\n

                                                                                                                                      To convert a private key from PEM to DER format:

                                                                                                                                      openssl dsa -in key.pem -outform DER -out keyout.der\n

                                                                                                                                      To print out the components of a private key to standard output:

                                                                                                                                      openssl dsa -in key.pem -text -noout\n

                                                                                                                                      To just output the public part of a private key:

                                                                                                                                      openssl dsa -in key.pem -pubout -out pubkey.pem\n
                                                                                                                                      "},{"location":"man1/openssl-dsa/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkey(1), openssl-dsaparam(1), openssl-gendsa(1), openssl-rsa(1), openssl-genrsa(1)

                                                                                                                                      "},{"location":"man1/openssl-dsa/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-dsa/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-dsaparam/","title":"openssl-dsaparam","text":""},{"location":"man1/openssl-dsaparam/#name","title":"NAME","text":"

                                                                                                                                      openssl-dsaparam - DSA parameter manipulation and generation

                                                                                                                                      "},{"location":"man1/openssl-dsaparam/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl dsaparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-noout] [-text] [-genkey] [-verbose] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [numbits]

                                                                                                                                      "},{"location":"man1/openssl-dsaparam/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to manipulate or generate DSA parameter files.

                                                                                                                                      DSA parameter generation can be a slow process and as a result the same set of DSA parameters is often used to generate several distinct keys.

                                                                                                                                      "},{"location":"man1/openssl-dsaparam/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The DSA parameters input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The DSA parameters output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        Parameters are a sequence of ASN.1 INTEGERs: p, q, and g. This is compatible with RFC 2459 DSS-Parms structure.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read parameters from or standard input if this option is not specified. If the numbits parameter is included then this option will be ignored.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename parameters to. Standard output is used if this option is not present. The output filename should not be the same as the input filename.

                                                                                                                                      • -noout

                                                                                                                                        This option inhibits the output of the encoded version of the parameters.

                                                                                                                                      • -text

                                                                                                                                        This option prints out the DSA parameters in human readable form.

                                                                                                                                      • -genkey

                                                                                                                                        This option will generate a DSA either using the specified or generated parameters.

                                                                                                                                      • -verbose

                                                                                                                                        Print extra details about the operations being performed.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • numbits

                                                                                                                                        This option specifies that a parameter set should be generated of size numbits. It must be the last option. If this option is included then the input file (if any) is ignored.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-dsaparam/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkeyparam(1), openssl-gendsa(1), openssl-dsa(1), openssl-genrsa(1), openssl-rsa(1)

                                                                                                                                      "},{"location":"man1/openssl-dsaparam/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      The -C option was removed in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-dsaparam/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-ec/","title":"openssl-ec","text":""},{"location":"man1/openssl-ec/#name","title":"NAME","text":"

                                                                                                                                      openssl-ec - EC key processing

                                                                                                                                      "},{"location":"man1/openssl-ec/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl ec [-help] [-inform DER|PEM|P12|ENGINE] [-outform DER|PEM] [-in filename|uri] [-passin arg] [-out filename] [-passout arg] [-des] [-des3] [-idea] [-text] [-noout] [-param_out] [-pubin] [-pubout] [-conv_form arg] [-param_enc arg] [-no_public] [-check] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-ec/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The openssl-ec(1) command processes EC keys. They can be converted between various forms and their components printed out. Note OpenSSL uses the private key format specified in 'SEC 1: Elliptic Curve Cryptography' (http://www.secg.org/). To convert an OpenSSL EC private key into the PKCS#8 private key format use the openssl-pkcs8(1) command.

                                                                                                                                      "},{"location":"man1/openssl-ec/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM|P12|ENGINE

                                                                                                                                        The key input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The key output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        Private keys are an SEC1 private key or PKCS#8 format. Public keys are a SubjectPublicKeyInfo as specified in IETF RFC 3280.

                                                                                                                                      • -in filename|uri

                                                                                                                                        This specifies the input to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write a key to or standard output by is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

                                                                                                                                      • -passin arg, -passout arg

                                                                                                                                        The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -des|-des3|-idea

                                                                                                                                        These options encrypt the private key with the DES, triple DES, IDEA or any other cipher supported by OpenSSL before outputting it. A pass phrase is prompted for. If none of these options is specified the key is written in plain text. This means that using this command to read in an encrypted key with no encryption option can be used to remove the pass phrase from a key, or by setting the encryption options it can be use to add or change the pass phrase. These options can only be used with PEM format output files.

                                                                                                                                      • -text

                                                                                                                                        Prints out the public, private key components and parameters.

                                                                                                                                      • -noout

                                                                                                                                        This option prevents output of the encoded version of the key.

                                                                                                                                      • -param_out

                                                                                                                                        Print the elliptic curve parameters.

                                                                                                                                      • -pubin

                                                                                                                                        By default, a private key is read from the input file. With this option a public key is read instead.

                                                                                                                                      • -pubout

                                                                                                                                        By default a private key is output. With this option a public key will be output instead. This option is automatically set if the input is a public key.

                                                                                                                                      • -conv_form arg

                                                                                                                                        This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: compressed, uncompressed (the default value) and hybrid. For more information regarding the point conversion forms please read the X9.62 standard. Note Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at compile time.

                                                                                                                                      • -param_enc arg

                                                                                                                                        This specifies how the elliptic curve parameters are encoded. Possible value are: named_curve, i.e. the ec parameters are specified by an OID, or explicit where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is named_curve. Note the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL.

                                                                                                                                      • -no_public

                                                                                                                                        This option omits the public key components from the private key output.

                                                                                                                                      • -check

                                                                                                                                        This option checks the consistency of an EC private or public key.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      The openssl-pkey(1) command is capable of performing all the operations this command can, as well as supporting other public key types.

                                                                                                                                      "},{"location":"man1/openssl-ec/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here.

                                                                                                                                      To encrypt a private key using triple DES:

                                                                                                                                      openssl ec -in key.pem -des3 -out keyout.pem\n

                                                                                                                                      To convert a private key from PEM to DER format:

                                                                                                                                      openssl ec -in key.pem -outform DER -out keyout.der\n

                                                                                                                                      To print out the components of a private key to standard output:

                                                                                                                                      openssl ec -in key.pem -text -noout\n

                                                                                                                                      To just output the public part of a private key:

                                                                                                                                      openssl ec -in key.pem -pubout -out pubkey.pem\n

                                                                                                                                      To change the parameters encoding to explicit:

                                                                                                                                      openssl ec -in key.pem -param_enc explicit -out keyout.pem\n

                                                                                                                                      To change the point conversion form to compressed:

                                                                                                                                      openssl ec -in key.pem -conv_form compressed -out keyout.pem\n
                                                                                                                                      "},{"location":"man1/openssl-ec/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkey(1), openssl-ecparam(1), openssl-dsa(1), openssl-rsa(1)

                                                                                                                                      "},{"location":"man1/openssl-ec/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      The -conv_form and -no_public options are no longer supported with keys loaded from an engine in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-ec/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2003-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-ecparam/","title":"openssl-ecparam","text":""},{"location":"man1/openssl-ecparam/#name","title":"NAME","text":"

                                                                                                                                      openssl-ecparam - EC parameter manipulation and generation

                                                                                                                                      "},{"location":"man1/openssl-ecparam/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl ecparam [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-noout] [-text] [-check] [-check_named] [-name arg] [-list_curves] [-conv_form arg] [-param_enc arg] [-no_seed] [-genkey] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-ecparam/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to manipulate or generate EC parameter files.

                                                                                                                                      OpenSSL is currently not able to generate new groups and therefore this command can only create EC parameters from known (named) curves.

                                                                                                                                      "},{"location":"man1/openssl-ecparam/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The EC parameters input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The EC parameters output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        Parameters are encoded as EcpkParameters as specified in IETF RFC 3279.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read parameters from or standard input if this option is not specified.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename parameters to. Standard output is used if this option is not present. The output filename should not be the same as the input filename.

                                                                                                                                      • -noout

                                                                                                                                        This option inhibits the output of the encoded version of the parameters.

                                                                                                                                      • -text

                                                                                                                                        This option prints out the EC parameters in human readable form.

                                                                                                                                      • -check

                                                                                                                                        Validate the elliptic curve parameters.

                                                                                                                                      • -check_named

                                                                                                                                        Validate the elliptic name curve parameters by checking if the curve parameters match any built-in curves.

                                                                                                                                      • -name arg

                                                                                                                                        Use the EC parameters with the specified 'short' name. Use -list_curves to get a list of all currently implemented EC parameters.

                                                                                                                                      • -list_curves

                                                                                                                                        Print out a list of all currently implemented EC parameters names and exit.

                                                                                                                                      • -conv_form arg

                                                                                                                                        This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: compressed, uncompressed (the default value) and hybrid. For more information regarding the point conversion forms please read the X9.62 standard. Note Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at compile time.

                                                                                                                                      • -param_enc arg

                                                                                                                                        This specifies how the elliptic curve parameters are encoded. Possible value are: named_curve, i.e. the ec parameters are specified by an OID, or explicit where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is named_curve. Note the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL.

                                                                                                                                      • -no_seed

                                                                                                                                        This option inhibits that the 'seed' for the parameter generation is included in the ECParameters structure (see RFC 3279).

                                                                                                                                      • -genkey

                                                                                                                                        This option will generate an EC private key using the specified parameters.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      The openssl-genpkey(1) and openssl-pkeyparam(1) commands are capable of performing all the operations this command can, as well as supporting other public key types.

                                                                                                                                      "},{"location":"man1/openssl-ecparam/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The documentation for the openssl-genpkey(1) and openssl-pkeyparam(1) commands contains examples equivalent to the ones listed here.

                                                                                                                                      To create EC parameters with the group 'prime192v1':

                                                                                                                                      openssl ecparam -out ec_param.pem -name prime192v1\n

                                                                                                                                      To create EC parameters with explicit parameters:

                                                                                                                                      openssl ecparam -out ec_param.pem -name prime192v1 -param_enc explicit\n

                                                                                                                                      To validate given EC parameters:

                                                                                                                                      openssl ecparam -in ec_param.pem -check\n

                                                                                                                                      To create EC parameters and a private key:

                                                                                                                                      openssl ecparam -out ec_key.pem -name prime192v1 -genkey\n

                                                                                                                                      To change the point encoding to 'compressed':

                                                                                                                                      openssl ecparam -in ec_in.pem -out ec_out.pem -conv_form compressed\n

                                                                                                                                      To print out the EC parameters to standard output:

                                                                                                                                      openssl ecparam -in ec_param.pem -noout -text\n
                                                                                                                                      "},{"location":"man1/openssl-ecparam/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkeyparam(1), openssl-genpkey(1), openssl-ec(1), openssl-dsaparam(1)

                                                                                                                                      "},{"location":"man1/openssl-ecparam/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      The -C option was removed in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-ecparam/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-enc/","title":"openssl-enc","text":""},{"location":"man1/openssl-enc/#name","title":"NAME","text":"

                                                                                                                                      openssl-enc - symmetric cipher routines

                                                                                                                                      "},{"location":"man1/openssl-enc/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl enc|cipher [-cipher] [-help] [-list] [-ciphers] [-in filename] [-out filename] [-pass arg] [-e] [-d] [-a] [-base64] [-A] [-k password] [-kfile filename] [-K key] [-iv IV] [-S salt] [-salt] [-nosalt] [-z] [-md digest] [-iter count] [-pbkdf2] [-p] [-P] [-bufsize number] [-nopad] [-v] [-debug] [-none] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      openssl cipher [...]

                                                                                                                                      "},{"location":"man1/openssl-enc/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The symmetric cipher commands allow data to be encrypted or decrypted using various block and stream ciphers using keys based on passwords or explicitly provided. Base64 encoding or decoding can also be performed either by itself or in addition to the encryption or decryption.

                                                                                                                                      "},{"location":"man1/openssl-enc/#options","title":"OPTIONS","text":"
                                                                                                                                      • -cipher

                                                                                                                                        The cipher to use.

                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -list

                                                                                                                                        List all supported ciphers.

                                                                                                                                      • -ciphers

                                                                                                                                        Alias of -list to display all supported ciphers.

                                                                                                                                      • -in filename

                                                                                                                                        The input filename, standard input by default.

                                                                                                                                      • -out filename

                                                                                                                                        The output filename, standard output by default.

                                                                                                                                      • -pass arg

                                                                                                                                        The password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -e

                                                                                                                                        Encrypt the input data: this is the default.

                                                                                                                                      • -d

                                                                                                                                        Decrypt the input data.

                                                                                                                                      • -a

                                                                                                                                        Base64 process the data. This means that if encryption is taking place the data is base64 encoded after encryption. If decryption is set then the input data is base64 decoded before being decrypted.

                                                                                                                                        When the -A option not given, on encoding a newline is inserted after each 64 characters, and on decoding a newline is expected among the first 1024 bytes of input.

                                                                                                                                      • -base64

                                                                                                                                        Same as -a

                                                                                                                                      • -A

                                                                                                                                        If the -a option is set then base64 encoding produces output without any newline character, and base64 decoding does not require any newlines. Therefore it can be helpful to use the -A option when decoding unknown input.

                                                                                                                                      • -k password

                                                                                                                                        The password to derive the key from. This is for compatibility with previous versions of OpenSSL. Superseded by the -pass argument.

                                                                                                                                      • -kfile filename

                                                                                                                                        Read the password to derive the key from the first line of filename. This is for compatibility with previous versions of OpenSSL. Superseded by the -pass argument.

                                                                                                                                      • -md digest

                                                                                                                                        Use the specified digest to create the key from the passphrase. The default algorithm is sha-256.

                                                                                                                                      • -iter count

                                                                                                                                        Use a given number of iterations on the password in deriving the encryption key. High values increase the time required to brute-force the resulting file. This option enables the use of PBKDF2 algorithm to derive the key.

                                                                                                                                      • -pbkdf2

                                                                                                                                        Use PBKDF2 algorithm with a default iteration count of 10000 unless otherwise specified by the -iter command line option.

                                                                                                                                      • -nosalt

                                                                                                                                        Don't use a salt in the key derivation routines. This option SHOULD NOT be used except for test purposes or compatibility with ancient versions of OpenSSL.

                                                                                                                                      • -salt

                                                                                                                                        Use salt (randomly generated or provide with -S option) when encrypting, this is the default.

                                                                                                                                      • -S salt

                                                                                                                                        The actual salt to use: this must be represented as a string of hex digits. If this option is used while encrypting, the same exact value will be needed again during decryption.

                                                                                                                                      • -K key

                                                                                                                                        The actual key to use: this must be represented as a string comprised only of hex digits. If only the key is specified, the IV must additionally specified using the -iv option. When both a key and a password are specified, the key given with the -K option will be used and the IV generated from the password will be taken. It does not make much sense to specify both key and password.

                                                                                                                                      • -iv IV

                                                                                                                                        The actual IV to use: this must be represented as a string comprised only of hex digits. When only the key is specified using the -K option, the IV must explicitly be defined. When a password is being specified using one of the other options, the IV is generated from this password.

                                                                                                                                      • -p

                                                                                                                                        Print out the key and IV used.

                                                                                                                                      • -P

                                                                                                                                        Print out the key and IV used then immediately exit: don't do any encryption or decryption.

                                                                                                                                      • -bufsize number

                                                                                                                                        Set the buffer size for I/O.

                                                                                                                                      • -nopad

                                                                                                                                        Disable standard block padding.

                                                                                                                                      • -v

                                                                                                                                        Verbose print; display some statistics about I/O and buffer sizes.

                                                                                                                                      • -debug

                                                                                                                                        Debug the BIOs used for I/O.

                                                                                                                                      • -z

                                                                                                                                        Compress or decompress encrypted data using zlib after encryption or before decryption. This option exists only if OpenSSL was compiled with the zlib or zlib-dynamic option.

                                                                                                                                      • -none

                                                                                                                                        Use NULL cipher (no encryption or decryption of input).

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      "},{"location":"man1/openssl-enc/#notes","title":"NOTES","text":"

                                                                                                                                      The program can be called either as openssl _cipher_ or openssl enc -_cipher_. The first form doesn't work with engine-provided ciphers, because this form is processed before the configuration file is read and any ENGINEs loaded. Use the openssl-list(1) command to get a list of supported ciphers.

                                                                                                                                      Engines which provide entirely new encryption algorithms (such as the ccgost engine which provides gost89 algorithm) should be configured in the configuration file. Engines specified on the command line using -engine option can only be used for hardware-assisted implementations of ciphers which are supported by the OpenSSL core or another engine specified in the configuration file.

                                                                                                                                      When the enc command lists supported ciphers, ciphers provided by engines, specified in the configuration files are listed too.

                                                                                                                                      A password will be prompted for to derive the key and IV if necessary.

                                                                                                                                      The -salt option should ALWAYS be used if the key is being derived from a password unless you want compatibility with previous versions of OpenSSL.

                                                                                                                                      Without the -salt option it is possible to perform efficient dictionary attacks on the password and to attack stream cipher encrypted data. The reason for this is that without the salt the same password always generates the same encryption key.

                                                                                                                                      When the salt is generated at random (that means when encrypting using a passphrase without explicit salt given using -S option), the first bytes of the encrypted data are reserved to store the salt for later decrypting.

                                                                                                                                      Some of the ciphers do not have large keys and others have security implications if not used correctly. A beginner is advised to just use a strong block cipher, such as AES, in CBC mode.

                                                                                                                                      All the block ciphers normally use PKCS#5 padding, also known as standard block padding. This allows a rudimentary integrity or password check to be performed. However, since the chance of random data passing the test is better than 1 in 256 it isn't a very good test.

                                                                                                                                      If padding is disabled then the input data must be a multiple of the cipher block length.

                                                                                                                                      All RC2 ciphers have the same key and effective key length.

                                                                                                                                      Blowfish and RC5 algorithms use a 128 bit key.

                                                                                                                                      Please note that OpenSSL 3.0 changed the effect of the -S option. Any explicit salt value specified via this option is no longer prepended to the ciphertext when encrypting, and must again be explicitly provided when decrypting. Conversely, when the -S option is used during decryption, the ciphertext is expected to not have a prepended salt value.

                                                                                                                                      When using OpenSSL 3.0 or later to decrypt data that was encrypted with an explicit salt under OpenSSL 1.1.1 do not use the -S option, the salt will then be read from the ciphertext. To generate ciphertext that can be decrypted with OpenSSL 1.1.1 do not use the -S option, the salt will be then be generated randomly and prepended to the output.

                                                                                                                                      "},{"location":"man1/openssl-enc/#supported-ciphers","title":"SUPPORTED CIPHERS","text":"

                                                                                                                                      Note that some of these ciphers can be disabled at compile time and some are available only if an appropriate engine is configured in the configuration file. The output when invoking this command with the -list option (that is openssl enc -list) is a list of ciphers, supported by your version of OpenSSL, including ones provided by configured engines.

                                                                                                                                      This command does not support authenticated encryption modes like CCM and GCM, and will not support such modes in the future. This is due to having to begin streaming output (e.g., to standard output when -out is not used) before the authentication tag could be validated. When this command is used in a pipeline, the receiving end will not be able to roll back upon authentication failure. The AEAD modes currently in common use also suffer from catastrophic failure of confidentiality and/or integrity upon reuse of key/iv/nonce, and since openssl enc places the entire burden of key/iv/nonce management upon the user, the risk of exposing AEAD modes is too great to allow. These key/iv/nonce management issues also affect other modes currently exposed in this command, but the failure modes are less extreme in these cases, and the functionality cannot be removed with a stable release branch. For bulk encryption of data, whether using authenticated encryption modes or other modes, openssl-cms(1) is recommended, as it provides a standard data format and performs the needed key/iv/nonce management.

                                                                                                                                      base64             Base 64\n\nbf-cbc             Blowfish in CBC mode\nbf                 Alias for bf-cbc\nblowfish           Alias for bf-cbc\nbf-cfb             Blowfish in CFB mode\nbf-ecb             Blowfish in ECB mode\nbf-ofb             Blowfish in OFB mode\n\ncast-cbc           CAST in CBC mode\ncast               Alias for cast-cbc\ncast5-cbc          CAST5 in CBC mode\ncast5-cfb          CAST5 in CFB mode\ncast5-ecb          CAST5 in ECB mode\ncast5-ofb          CAST5 in OFB mode\n\nchacha20           ChaCha20 algorithm\n\ndes-cbc            DES in CBC mode\ndes                Alias for des-cbc\ndes-cfb            DES in CFB mode\ndes-ofb            DES in OFB mode\ndes-ecb            DES in ECB mode\n\ndes-ede-cbc        Two key triple DES EDE in CBC mode\ndes-ede            Two key triple DES EDE in ECB mode\ndes-ede-cfb        Two key triple DES EDE in CFB mode\ndes-ede-ofb        Two key triple DES EDE in OFB mode\n\ndes-ede3-cbc       Three key triple DES EDE in CBC mode\ndes-ede3           Three key triple DES EDE in ECB mode\ndes3               Alias for des-ede3-cbc\ndes-ede3-cfb       Three key triple DES EDE CFB mode\ndes-ede3-ofb       Three key triple DES EDE in OFB mode\n\ndesx               DESX algorithm.\n\ngost89             GOST 28147-89 in CFB mode (provided by ccgost engine)\ngost89-cnt         GOST 28147-89 in CNT mode (provided by ccgost engine)\n\nidea-cbc           IDEA algorithm in CBC mode\nidea               same as idea-cbc\nidea-cfb           IDEA in CFB mode\nidea-ecb           IDEA in ECB mode\nidea-ofb           IDEA in OFB mode\n\nrc2-cbc            128 bit RC2 in CBC mode\nrc2                Alias for rc2-cbc\nrc2-cfb            128 bit RC2 in CFB mode\nrc2-ecb            128 bit RC2 in ECB mode\nrc2-ofb            128 bit RC2 in OFB mode\nrc2-64-cbc         64 bit RC2 in CBC mode\nrc2-40-cbc         40 bit RC2 in CBC mode\n\nrc4                128 bit RC4\nrc4-64             64 bit RC4\nrc4-40             40 bit RC4\n\nrc5-cbc            RC5 cipher in CBC mode\nrc5                Alias for rc5-cbc\nrc5-cfb            RC5 cipher in CFB mode\nrc5-ecb            RC5 cipher in ECB mode\nrc5-ofb            RC5 cipher in OFB mode\n\nseed-cbc           SEED cipher in CBC mode\nseed               Alias for seed-cbc\nseed-cfb           SEED cipher in CFB mode\nseed-ecb           SEED cipher in ECB mode\nseed-ofb           SEED cipher in OFB mode\n\nsm4-cbc            SM4 cipher in CBC mode\nsm4                Alias for sm4-cbc\nsm4-cfb            SM4 cipher in CFB mode\nsm4-ctr            SM4 cipher in CTR mode\nsm4-ecb            SM4 cipher in ECB mode\nsm4-ofb            SM4 cipher in OFB mode\n\naes-[128|192|256]-cbc  128/192/256 bit AES in CBC mode\naes[128|192|256]       Alias for aes-[128|192|256]-cbc\naes-[128|192|256]-cfb  128/192/256 bit AES in 128 bit CFB mode\naes-[128|192|256]-cfb1 128/192/256 bit AES in 1 bit CFB mode\naes-[128|192|256]-cfb8 128/192/256 bit AES in 8 bit CFB mode\naes-[128|192|256]-ctr  128/192/256 bit AES in CTR mode\naes-[128|192|256]-ecb  128/192/256 bit AES in ECB mode\naes-[128|192|256]-ofb  128/192/256 bit AES in OFB mode\n\naria-[128|192|256]-cbc  128/192/256 bit ARIA in CBC mode\naria[128|192|256]       Alias for aria-[128|192|256]-cbc\naria-[128|192|256]-cfb  128/192/256 bit ARIA in 128 bit CFB mode\naria-[128|192|256]-cfb1 128/192/256 bit ARIA in 1 bit CFB mode\naria-[128|192|256]-cfb8 128/192/256 bit ARIA in 8 bit CFB mode\naria-[128|192|256]-ctr  128/192/256 bit ARIA in CTR mode\naria-[128|192|256]-ecb  128/192/256 bit ARIA in ECB mode\naria-[128|192|256]-ofb  128/192/256 bit ARIA in OFB mode\n\ncamellia-[128|192|256]-cbc  128/192/256 bit Camellia in CBC mode\ncamellia[128|192|256]       Alias for camellia-[128|192|256]-cbc\ncamellia-[128|192|256]-cfb  128/192/256 bit Camellia in 128 bit CFB mode\ncamellia-[128|192|256]-cfb1 128/192/256 bit Camellia in 1 bit CFB mode\ncamellia-[128|192|256]-cfb8 128/192/256 bit Camellia in 8 bit CFB mode\ncamellia-[128|192|256]-ctr  128/192/256 bit Camellia in CTR mode\ncamellia-[128|192|256]-ecb  128/192/256 bit Camellia in ECB mode\ncamellia-[128|192|256]-ofb  128/192/256 bit Camellia in OFB mode\n
                                                                                                                                      "},{"location":"man1/openssl-enc/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Just base64 encode a binary file:

                                                                                                                                      openssl base64 -in file.bin -out file.b64\n

                                                                                                                                      Decode the same file

                                                                                                                                      openssl base64 -d -in file.b64 -out file.bin\n

                                                                                                                                      Encrypt a file using AES-128 using a prompted password and PBKDF2 key derivation:

                                                                                                                                      openssl enc -aes128 -pbkdf2 -in file.txt -out file.aes128\n

                                                                                                                                      Decrypt a file using a supplied password:

                                                                                                                                      openssl enc -aes128 -pbkdf2 -d -in file.aes128 -out file.txt \\\n   -pass pass:<password>\n

                                                                                                                                      Encrypt a file then base64 encode it (so it can be sent via mail for example) using AES-256 in CTR mode and PBKDF2 key derivation:

                                                                                                                                      openssl enc -aes-256-ctr -pbkdf2 -a -in file.txt -out file.aes256\n

                                                                                                                                      Base64 decode a file then decrypt it using a password supplied in a file:

                                                                                                                                      openssl enc -aes-256-ctr -pbkdf2 -d -a -in file.aes256 -out file.txt \\\n   -pass file:<passfile>\n
                                                                                                                                      "},{"location":"man1/openssl-enc/#bugs","title":"BUGS","text":"

                                                                                                                                      The -A option when used with large files doesn't work properly. On the other hand, when base64 decoding without the -A option, if the first 1024 bytes of input do not include a newline character the first two lines of input are ignored.

                                                                                                                                      The openssl enc command only supports a fixed number of algorithms with certain parameters. So if, for example, you want to use RC2 with a 76 bit key or RC4 with an 84 bit key you can't use this program.

                                                                                                                                      "},{"location":"man1/openssl-enc/#history","title":"HISTORY","text":"

                                                                                                                                      The default digest was changed from MD5 to SHA256 in OpenSSL 1.1.0.

                                                                                                                                      The -list option was added in OpenSSL 1.1.1e.

                                                                                                                                      The -ciphers and -engine options were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-enc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-engine/","title":"openssl-engine","text":""},{"location":"man1/openssl-engine/#name","title":"NAME","text":"

                                                                                                                                      openssl-engine - load and query engines

                                                                                                                                      "},{"location":"man1/openssl-engine/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl engine [-help] [-v] [-vv] [-vvv] [-vvvv] [-c] [-t] [-tt] [-pre command] ... [-post command] ... [engine ...]

                                                                                                                                      "},{"location":"man1/openssl-engine/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command has been deprecated. Providers should be used instead of engines.

                                                                                                                                      This command is used to query the status and capabilities of the specified _engine_s. Engines may be specified before and after all other command-line flags. Only those specified are queried.

                                                                                                                                      "},{"location":"man1/openssl-engine/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Display an option summary.

                                                                                                                                      • -v -vv -vvv -vvvv

                                                                                                                                        Provides information about each specified engine. The first flag lists all the possible run-time control commands; the second adds a description of each command; the third adds the input flags, and the final option adds the internal input flags.

                                                                                                                                      • -c

                                                                                                                                        Lists the capabilities of each engine.

                                                                                                                                      • -t

                                                                                                                                        Tests if each specified engine is available, and displays the answer.

                                                                                                                                      • -tt

                                                                                                                                        Displays an error trace for any unavailable engine.

                                                                                                                                      • -pre command

                                                                                                                                      • -post command

                                                                                                                                        Command-line configuration of engines. The -pre command is given to the engine before it is loaded and the -post command is given after the engine is loaded. The command is of the form cmd:val where cmd is the command, and val is the value for the command. See the example below.

                                                                                                                                        These two options are cumulative, so they may be given more than once in the same command.

                                                                                                                                      "},{"location":"man1/openssl-engine/#examples","title":"EXAMPLES","text":"

                                                                                                                                      To list all the commands available to a dynamic engine:

                                                                                                                                      $ openssl engine -t -tt -vvvv dynamic\n(dynamic) Dynamic engine loading support\n     [ unavailable ]\n     SO_PATH: Specifies the path to the new ENGINE shared library\n          (input flags): STRING\n     NO_VCHECK: Specifies to continue even if version checking fails (boolean)\n          (input flags): NUMERIC\n     ID: Specifies an ENGINE id name for loading\n          (input flags): STRING\n     LIST_ADD: Whether to add a loaded ENGINE to the internal list (0=no,1=yes,2=mandatory)\n          (input flags): NUMERIC\n     DIR_LOAD: Specifies whether to load from 'DIR_ADD' directories (0=no,1=yes,2=mandatory)\n          (input flags): NUMERIC\n     DIR_ADD: Adds a directory from which ENGINEs can be loaded\n          (input flags): STRING\n     LOAD: Load up the ENGINE specified by other settings\n          (input flags): NO_INPUT\n

                                                                                                                                      To list the capabilities of the rsax engine:

                                                                                                                                      $ openssl engine -c\n(rsax) RSAX engine support\n [RSA]\n(dynamic) Dynamic engine loading support\n
                                                                                                                                      "},{"location":"man1/openssl-engine/#environment","title":"ENVIRONMENT","text":"
                                                                                                                                      • OPENSSL_ENGINES

                                                                                                                                        The path to the engines directory.

                                                                                                                                      "},{"location":"man1/openssl-engine/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), config(5)

                                                                                                                                      "},{"location":"man1/openssl-engine/#history","title":"HISTORY","text":"

                                                                                                                                      This command was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-engine/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-errstr/","title":"openssl-errstr","text":""},{"location":"man1/openssl-errstr/#name","title":"NAME","text":"

                                                                                                                                      openssl-errstr - lookup error codes

                                                                                                                                      "},{"location":"man1/openssl-errstr/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl errstr [-help] error_code...

                                                                                                                                      "},{"location":"man1/openssl-errstr/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Sometimes an application will not load error message texts and only numerical forms will be available. This command can be used to display the meaning of the hex code. The hex code is the hex digits after the second colon.

                                                                                                                                      "},{"location":"man1/openssl-errstr/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Display a usage message.

                                                                                                                                      "},{"location":"man1/openssl-errstr/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The error code:

                                                                                                                                      27594:error:2006D080:lib(32)::reason(128)::107:\n

                                                                                                                                      can be displayed with:

                                                                                                                                      openssl errstr 2006D080\n

                                                                                                                                      to produce the error message:

                                                                                                                                      error:2006D080:BIO routines::no such file\n
                                                                                                                                      "},{"location":"man1/openssl-errstr/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/","title":"openssl-fipsinstall","text":""},{"location":"man1/openssl-fipsinstall/#name","title":"NAME","text":"

                                                                                                                                      openssl-fipsinstall - perform FIPS configuration installation

                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl fipsinstall [-help] [-in configfilename] [-out configfilename] [-module modulefilename] [-provider_name providername] [-section_name sectionname] [-verify] [-mac_name macname] [-macopt nm:v] [-noout] [-quiet] [-pedantic] [-no_conditional_errors] [-no_security_checks] [-ems_check] [-no_drbg_truncated_digests] [-self_test_onload] [-self_test_oninstall] [-corrupt_desc selftest_description] [-corrupt_type selftest_type] [-config parent_config]

                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to generate a FIPS module configuration file. This configuration file can be used each time a FIPS module is loaded in order to pass data to the FIPS module self tests. The FIPS module always verifies its MAC, but optionally only needs to run the KAT's once, at installation.

                                                                                                                                      The generated configuration file consists of:

                                                                                                                                        • A MAC of the FIPS module file.
                                                                                                                                        • A test status indicator.

                                                                                                                                        This indicates if the Known Answer Self Tests (KAT's) have successfully run.

                                                                                                                                        • A MAC of the status indicator.
                                                                                                                                        • A control for conditional self tests errors.

                                                                                                                                        By default if a continuous test (e.g a key pair test) fails then the FIPS module will enter an error state, and no services or cryptographic algorithms will be able to be accessed after this point. The default value of '1' will cause the fips module error state to be entered. If the value is '0' then the module error state will not be entered. Regardless of whether the error state is entered or not, the current operation (e.g. key generation) will return an error. The user is responsible for retrying the operation if the module error state is not entered.

                                                                                                                                        • A control to indicate whether run-time security checks are done.

                                                                                                                                        This indicates if run-time checks related to enforcement of security parameters such as minimum security strength of keys and approved curve names are used. The default value of '1' will perform the checks. If the value is '0' the checks are not performed and FIPS compliance must be done by procedures documented in the relevant Security Policy.

                                                                                                                                      This file is described in fips_config(5).

                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print a usage message.

                                                                                                                                      • -module filename

                                                                                                                                        Filename of the FIPS module to perform an integrity check on. The path provided in the filename is used to load the module when it is activated, and this overrides the environment variable OPENSSL_MODULES.

                                                                                                                                      • -out configfilename

                                                                                                                                        Filename to output the configuration data to; the default is standard output.

                                                                                                                                      • -in configfilename

                                                                                                                                        Input filename to load configuration data from. Must be used if the -verify option is specified.

                                                                                                                                      • -verify

                                                                                                                                        Verify that the input configuration file contains the correct information.

                                                                                                                                      • -provider_name providername

                                                                                                                                        Name of the provider inside the configuration file. The default value is fips.

                                                                                                                                      • -section_name sectionname

                                                                                                                                        Name of the section inside the configuration file. The default value is fips_sect.

                                                                                                                                      • -mac_name name

                                                                                                                                        Specifies the name of a supported MAC algorithm which will be used. The MAC mechanisms that are available will depend on the options used when building OpenSSL. To see the list of supported MAC's use the command openssl list -mac-algorithms. The default is HMAC.

                                                                                                                                      • -macopt nm:v

                                                                                                                                        Passes options to the MAC algorithm. A comprehensive list of controls can be found in the EVP_MAC implementation documentation. Common control strings used for this command are:

                                                                                                                                        • key:string

                                                                                                                                          Specifies the MAC key as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm. If no key is provided, the default that was specified when OpenSSL was configured is used.

                                                                                                                                        • hexkey:string

                                                                                                                                          Specifies the MAC key in hexadecimal form (two hex digits per byte). The key length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm. If no key is provided, the default that was specified when OpenSSL was configured is used.

                                                                                                                                        • digest:string

                                                                                                                                          Used by HMAC as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. To see the list of supported digests, use the command openssl list -digest-commands. The default digest is SHA-256.

                                                                                                                                      • -noout

                                                                                                                                        Disable logging of the self tests.

                                                                                                                                      • -pedantic

                                                                                                                                        Configure the module so that it is strictly FIPS compliant rather than being backwards compatible. This enables conditional errors, security checks etc. Note that any previous configuration options will be overwritten and any subsequent configuration options that violate FIPS compliance will result in an error.

                                                                                                                                      • -no_conditional_errors

                                                                                                                                        Configure the module to not enter an error state if a conditional self test fails as described above.

                                                                                                                                      • -no_security_checks

                                                                                                                                        Configure the module to not perform run-time security checks as described above.

                                                                                                                                        Enabling the configuration option \"no-fips-securitychecks\" provides another way to turn off the check at compile time.

                                                                                                                                      • -ems_check

                                                                                                                                        Configure the module to enable a run-time Extended Master Secret (EMS) check when using the TLS1_PRF KDF algorithm. This check is disabled by default. See RFC 7627 for information related to EMS.

                                                                                                                                      • -no_drbg_truncated_digests

                                                                                                                                        Configure the module to not allow truncated digests to be used with Hash and HMAC DRBGs. See FIPS 140-3 IG D.R for details.

                                                                                                                                      • -self_test_onload

                                                                                                                                        Do not write the two fields related to the \"test status indicator\" and \"MAC status indicator\" to the output configuration file. Without these fields the self tests KATS will run each time the module is loaded. This option could be used for cross compiling, since the self tests need to run at least once on each target machine. Once the self tests have run on the target machine the user could possibly then add the 2 fields into the configuration using some other mechanism.

                                                                                                                                        This is the default.

                                                                                                                                      • -self_test_oninstall

                                                                                                                                        The converse of -self_test_oninstall. The two fields related to the \"test status indicator\" and \"MAC status indicator\" are written to the output configuration file.

                                                                                                                                      • -quiet

                                                                                                                                        Do not output pass/fail messages. Implies -noout.

                                                                                                                                      • -corrupt_desc selftest_description, -corrupt_type selftest_type

                                                                                                                                        The corrupt options can be used to test failure of one or more self tests by name. Either option or both may be used to select the tests to corrupt. Refer to the entries for st-desc and st-type in OSSL_PROVIDER-FIPS(7) for values that can be used.

                                                                                                                                      • -config parent_config

                                                                                                                                        Test that a FIPS provider can be loaded from the specified configuration file. A previous call to this application needs to generate the extra configuration data that is included by the base parent_config configuration file. See config(5) for further information on how to set up a provider section. All other options are ignored if '-config' is used.

                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/#notes","title":"NOTES","text":"

                                                                                                                                      Self tests results are logged by default if the options -quiet and -noout are not specified, or if either of the options -corrupt_desc or -corrupt_type are used. If the base configuration file is set up to autoload the fips module, then the fips module will be loaded and self tested BEFORE the fipsinstall application has a chance to set up its own self test callback. As a result of this the self test output and the options -corrupt_desc and -corrupt_type will be ignored. For normal usage the base configuration file should use the default provider when generating the fips configuration file.

                                                                                                                                      The -self_test_oninstall option was added and the -self_test_onload option was made the default in OpenSSL 3.1.

                                                                                                                                      The command and all remaining options were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Calculate the mac of a FIPS module fips.so and run a FIPS self test for the module, and save the fips.cnf configuration file:

                                                                                                                                      openssl fipsinstall -module ./fips.so -out fips.cnf -provider_name fips\n

                                                                                                                                      Verify that the configuration file fips.cnf contains the correct info:

                                                                                                                                      openssl fipsinstall -module ./fips.so -in fips.cnf  -provider_name fips -verify\n

                                                                                                                                      Corrupt any self tests which have the description SHA1:

                                                                                                                                      openssl fipsinstall -module ./fips.so -out fips.cnf -provider_name fips \\\n        -corrupt_desc 'SHA1'\n

                                                                                                                                      Validate that the fips module can be loaded from a base configuration file:

                                                                                                                                      export OPENSSL_CONF_INCLUDE=<path of configuration files>\nexport OPENSSL_MODULES=<provider-path>\nopenssl fipsinstall -config' 'default.cnf'\n
                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      config(5), fips_config(5), OSSL_PROVIDER-FIPS(7), EVP_MAC(3)

                                                                                                                                      "},{"location":"man1/openssl-fipsinstall/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-format-options/","title":"openssl-format-options","text":""},{"location":"man1/openssl-format-options/#name","title":"NAME","text":"

                                                                                                                                      openssl-format-options - OpenSSL command input and output format options

                                                                                                                                      "},{"location":"man1/openssl-format-options/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl command [ options ... ] [ parameters ... ]

                                                                                                                                      "},{"location":"man1/openssl-format-options/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Several OpenSSL commands can take input or generate output in a variety of formats.

                                                                                                                                      Since OpenSSL 3.0 keys, single certificates, and CRLs can be read from files in any of the DER, PEM or P12 formats. Specifying their input format is no more needed and the openssl commands will automatically try all the possible formats. However if the DER or PEM input format is specified it will be enforced.

                                                                                                                                      In order to access a key via an engine the input format ENGINE may be used; alternatively the key identifier in the <uri> argument of the respective key option may be preceded by org.openssl.engine:. See \"Engine Options\" in openssl(1) for an example usage of the latter.

                                                                                                                                      "},{"location":"man1/openssl-format-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-format-options/#format-options","title":"Format Options","text":"

                                                                                                                                      The options to specify the format are as follows. Refer to the individual man page to see which options are accepted.

                                                                                                                                      • -inform format, -outform format

                                                                                                                                        The format of the input or output streams.

                                                                                                                                      • -keyform format

                                                                                                                                        Format of a private key input source.

                                                                                                                                      • -CRLform format

                                                                                                                                        Format of a CRL input source.

                                                                                                                                      "},{"location":"man1/openssl-format-options/#format-option-arguments","title":"Format Option Arguments","text":"

                                                                                                                                      The possible format arguments are described below. Both uppercase and lowercase are accepted.

                                                                                                                                      The list of acceptable format arguments, and the default, is described in each command documentation.

                                                                                                                                      • DER

                                                                                                                                        A binary format, encoded or parsed according to Distinguished Encoding Rules (DER) of the ASN.1 data language.

                                                                                                                                      • ENGINE

                                                                                                                                        Used to specify that the cryptographic material is in an OpenSSL engine. An engine must be configured or specified using the -engine option. A password or PIN may be supplied to the engine using the -passin option.

                                                                                                                                      • P12

                                                                                                                                        A DER-encoded file containing a PKCS#12 object. It might be necessary to provide a decryption password to retrieve the private key.

                                                                                                                                      • PEM

                                                                                                                                        A text format defined in IETF RFC 1421 and IETF RFC 7468. Briefly, this is a block of base-64 encoding (defined in IETF RFC 4648), with specific lines used to mark the start and end:

                                                                                                                                        Text before the BEGIN line is ignored.\n----- BEGIN object-type -----\nOT43gQKBgQC/2OHZoko6iRlNOAQ/tMVFNq7fL81GivoQ9F1U0Qr+DH3ZfaH8eIkX\nxT0ToMPJUzWAn8pZv0snA0um6SIgvkCuxO84OkANCVbttzXImIsL7pFzfcwV/ERK\nUM6j0ZuSMFOCr/lGPAoOQU0fskidGEHi1/kW+suSr28TqsyYZpwBDQ==\n----- END object-type -----\nText after the END line is also ignored\n

                                                                                                                                        The object-type must match the type of object that is expected. For example a BEGIN X509 CERTIFICATE will not match if the command is trying to read a private key. The types supported include:

                                                                                                                                        ANY PRIVATE KEY\nCERTIFICATE\nCERTIFICATE REQUEST\nCMS\nDH PARAMETERS\nDSA PARAMETERS\nDSA PUBLIC KEY\nEC PARAMETERS\nEC PRIVATE KEY\nECDSA PUBLIC KEY\nENCRYPTED PRIVATE KEY\nPARAMETERS\nPKCS #7 SIGNED DATA\nPKCS7\nPRIVATE KEY\nPUBLIC KEY\nRSA PRIVATE KEY\nSSL SESSION PARAMETERS\nTRUSTED CERTIFICATE\nX509 CRL\nX9.42 DH PARAMETERS\n

                                                                                                                                        The following legacy object-type's are also supported for compatibility with earlier releases:

                                                                                                                                        DSA PRIVATE KEY\nNEW CERTIFICATE REQUEST\nRSA PUBLIC KEY\nX509 CERTIFICATE\n
                                                                                                                                      • SMIME

                                                                                                                                        An S/MIME object as described in IETF RFC 8551. Earlier versions were known as CMS and are compatible. Note that the parsing is simple and might fail to parse some legal data.

                                                                                                                                      "},{"location":"man1/openssl-format-options/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-gendsa/","title":"openssl-gendsa","text":""},{"location":"man1/openssl-gendsa/#name","title":"NAME","text":"

                                                                                                                                      openssl-gendsa - generate a DSA private key from a set of parameters

                                                                                                                                      "},{"location":"man1/openssl-gendsa/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl gendsa [-help] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-verbose] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [paramfile]

                                                                                                                                      "},{"location":"man1/openssl-gendsa/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command generates a DSA private key from a DSA parameter file (which will be typically generated by the openssl-dsaparam(1) command).

                                                                                                                                      "},{"location":"man1/openssl-gendsa/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -out filename

                                                                                                                                        Output the key to the specified file. If this argument is not specified then standard output is used.

                                                                                                                                      • -passout arg

                                                                                                                                        The passphrase used for the output file. See openssl-passphrase-options(1).

                                                                                                                                      • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

                                                                                                                                        These options encrypt the private key with specified cipher before outputting it. A pass phrase is prompted for. If none of these options is specified no encryption is used.

                                                                                                                                        Note that all options must be given before the paramfile argument. Otherwise they are ignored.

                                                                                                                                      • -verbose

                                                                                                                                        Print extra details about the operations being performed.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • paramfile

                                                                                                                                        The DSA parameter file to use. The parameters in this file determine the size of the private key. DSA parameters can be generated and examined using the openssl-dsaparam(1) command.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-gendsa/#notes","title":"NOTES","text":"

                                                                                                                                      DSA key generation is little more than random number generation so it is much quicker that RSA key generation for example.

                                                                                                                                      "},{"location":"man1/openssl-gendsa/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-genpkey(1), openssl-dsaparam(1), openssl-dsa(1), openssl-genrsa(1), openssl-rsa(1)

                                                                                                                                      "},{"location":"man1/openssl-gendsa/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-gendsa/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/","title":"openssl-genpkey","text":""},{"location":"man1/openssl-genpkey/#name","title":"NAME","text":"

                                                                                                                                      openssl-genpkey - generate a private key

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl genpkey [-help] [-out filename] [-outform DER|PEM] [-quiet] [-pass arg] [-cipher] [-paramfile file] [-algorithm alg] [-pkeyopt opt:value] [-genparam] [-text] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-config configfile]

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command generates a private key.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -out filename

                                                                                                                                        Output the key to the specified file. If this argument is not specified then standard output is used.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The output format, except when -genparam is given; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        When -genparam is given, -outform is ignored.

                                                                                                                                      • -quiet

                                                                                                                                        Do not output \"status dots\" while generating keys.

                                                                                                                                      • -pass arg

                                                                                                                                        The output file password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -cipher

                                                                                                                                        This option encrypts the private key with the supplied cipher. Any algorithm name accepted by EVP_get_cipherbyname() is acceptable such as des3.

                                                                                                                                      • -algorithm alg

                                                                                                                                        Public key algorithm to use such as RSA, DSA, DH or DHX. If used this option must precede any -pkeyopt options. The options -paramfile and -algorithm are mutually exclusive. Engines may add algorithms in addition to the standard built-in ones.

                                                                                                                                        Valid built-in algorithm names for private key generation are RSA, RSA-PSS, EC, X25519, X448, ED25519 and ED448.

                                                                                                                                        Valid built-in algorithm names for parameter generation (see the -genparam option) are DH, DSA and EC.

                                                                                                                                        Note that the algorithm name X9.42 DH may be used as a synonym for DHX keys and PKCS#3 refers to DH Keys. Some options are not shared between DH and DHX keys.

                                                                                                                                      • -pkeyopt opt:value

                                                                                                                                        Set the public key algorithm option opt to value. The precise set of options supported depends on the public key algorithm used and its implementation. See \"KEY GENERATION OPTIONS\" and \"PARAMETER GENERATION OPTIONS\" below for more details.

                                                                                                                                      • -genparam

                                                                                                                                        Generate a set of parameters instead of a private key. If used this option must precede any -algorithm, -paramfile or -pkeyopt options.

                                                                                                                                      • -paramfile filename

                                                                                                                                        Some public key algorithms generate a private key based on a set of parameters. They can be supplied using this option. If this option is used the public key algorithm used is determined by the parameters. If used this option must precede any -pkeyopt options. The options -paramfile and -algorithm are mutually exclusive.

                                                                                                                                      • -text

                                                                                                                                        Print an (unencrypted) text representation of private and public keys and parameters along with the PEM or DER structure.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -config configfile

                                                                                                                                        See \"Configuration Option\" in openssl(1).

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#key-generation-options","title":"KEY GENERATION OPTIONS","text":"

                                                                                                                                      The options supported by each algorithm and indeed each implementation of an algorithm can vary. The options for the OpenSSL implementations are detailed below. There are no key generation options defined for the X25519, X448, ED25519 or ED448 algorithms.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#rsa-key-generation-options","title":"RSA Key Generation Options","text":"
                                                                                                                                      • rsa_keygen_bits:numbits

                                                                                                                                        The number of bits in the generated key. If not specified 2048 is used.

                                                                                                                                      • rsa_keygen_primes:numprimes

                                                                                                                                        The number of primes in the generated key. If not specified 2 is used.

                                                                                                                                      • rsa_keygen_pubexp:value

                                                                                                                                        The RSA public exponent value. This can be a large decimal or hexadecimal value if preceded by 0x. Default value is 65537.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#rsa-pss-key-generation-options","title":"RSA-PSS Key Generation Options","text":"

                                                                                                                                      Note: by default an RSA-PSS key has no parameter restrictions.

                                                                                                                                      • rsa_keygen_bits:numbits, rsa_keygen_primes:numprimes, rsa_keygen_pubexp:value

                                                                                                                                        These options have the same meaning as the RSA algorithm.

                                                                                                                                      • rsa_pss_keygen_md:digest

                                                                                                                                        If set the key is restricted and can only use digest for signing.

                                                                                                                                      • rsa_pss_keygen_mgf1_md:digest

                                                                                                                                        If set the key is restricted and can only use digest as it's MGF1 parameter.

                                                                                                                                      • rsa_pss_keygen_saltlen:len

                                                                                                                                        If set the key is restricted and len specifies the minimum salt length.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#ec-key-generation-options","title":"EC Key Generation Options","text":"

                                                                                                                                      The EC key generation options can also be used for parameter generation.

                                                                                                                                      • ec_paramgen_curve:curve

                                                                                                                                        The EC curve to use. OpenSSL supports NIST curve names such as \"P-256\".

                                                                                                                                      • ec_param_enc:encoding

                                                                                                                                        The encoding to use for parameters. The encoding parameter must be either named_curve or explicit. The default value is named_curve.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#dh-key-generation-options","title":"DH Key Generation Options","text":"
                                                                                                                                      • group:name

                                                                                                                                        The paramfile option is not required if a named group is used here. See the \"DH Parameter Generation Options\" section below.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#parameter-generation-options","title":"PARAMETER GENERATION OPTIONS","text":"

                                                                                                                                      The options supported by each algorithm and indeed each implementation of an algorithm can vary. The options for the OpenSSL implementations are detailed below.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#dsa-parameter-generation-options","title":"DSA Parameter Generation Options","text":"
                                                                                                                                      • dsa_paramgen_bits:numbits

                                                                                                                                        The number of bits in the generated prime. If not specified 2048 is used.

                                                                                                                                      • dsa_paramgen_q_bits:numbits

                                                                                                                                      • qbits:numbits

                                                                                                                                        The number of bits in the q parameter. Must be one of 160, 224 or 256. If not specified 224 is used.

                                                                                                                                      • dsa_paramgen_md:digest

                                                                                                                                      • digest:digest

                                                                                                                                        The digest to use during parameter generation. Must be one of sha1, sha224 or sha256. If set, then the number of bits in q will match the output size of the specified digest and the dsa_paramgen_q_bits parameter will be ignored. If not set, then a digest will be used that gives an output matching the number of bits in q, i.e. sha1 if q length is 160, sha224 if it 224 or sha256 if it is 256.

                                                                                                                                      • properties:query

                                                                                                                                        The digest property query string to use when fetching a digest from a provider.

                                                                                                                                      • type:type

                                                                                                                                        The type of generation to use. Set this to 1 to use legacy FIPS186-2 parameter generation. The default of 0 uses FIPS186-4 parameter generation.

                                                                                                                                      • gindex:index

                                                                                                                                        The index to use for canonical generation and verification of the generator g. Set this to a positive value ranging from 0..255 to use this mode. Larger values will only use the bottom byte. This index must then be reused during key validation to verify the value of g. If this value is not set then g is not verifiable. The default value is -1.

                                                                                                                                      • hexseed:seed

                                                                                                                                        The seed seed data to use instead of generating a random seed internally. This should be used for testing purposes only. This will either produced fixed values for the generated parameters OR it will fail if the seed did not generate valid primes.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#dh-parameter-generation-options","title":"DH Parameter Generation Options","text":"

                                                                                                                                      For most use cases it is recommended to use the group option rather than the type options. Note that the group option is not used by default if no parameter generation options are specified.

                                                                                                                                      • group:name
                                                                                                                                      • dh_param:name

                                                                                                                                        Use a named DH group to select constant values for the DH parameters. All other options will be ignored if this value is set.

                                                                                                                                        Valid values that are associated with the algorithm of \"DH\" are: \"ffdhe2048\", \"ffdhe3072\", \"ffdhe4096\", \"ffdhe6144\", \"ffdhe8192\", \"modp_1536\", \"modp_2048\", \"modp_3072\", \"modp_4096\", \"modp_6144\", \"modp_8192\".

                                                                                                                                        Valid values that are associated with the algorithm of \"DHX\" are the RFC5114 names \"dh_1024_160\", \"dh_2048_224\", \"dh_2048_256\".

                                                                                                                                      • dh_rfc5114:num

                                                                                                                                        If this option is set, then the appropriate RFC5114 parameters are used instead of generating new parameters. The value num can be one of 1, 2 or 3 that are equivalent to using the option group with one of \"dh_1024_160\", \"dh_2048_224\" or \"dh_2048_256\". All other options will be ignored if this value is set.

                                                                                                                                      • pbits:numbits

                                                                                                                                      • dh_paramgen_prime_len:numbits

                                                                                                                                        The number of bits in the prime parameter p. The default is 2048.

                                                                                                                                      • qbits:numbits

                                                                                                                                      • dh_paramgen_subprime_len:numbits

                                                                                                                                        The number of bits in the sub prime parameter q. The default is 224. Only relevant if used in conjunction with the dh_paramgen_type option to generate DHX parameters.

                                                                                                                                      • safeprime-generator:value

                                                                                                                                      • dh_paramgen_generator:value

                                                                                                                                        The value to use for the generator g. The default is 2. The algorithm option must be \"DH\" for this parameter to be used.

                                                                                                                                      • type:string

                                                                                                                                        The type name of DH parameters to generate. Valid values are:

                                                                                                                                        • \"generator\"

                                                                                                                                          Use a safe prime generator with the option safeprime_generator The algorithm option must be \"DH\".

                                                                                                                                        • \"fips186_4\"

                                                                                                                                          FIPS186-4 parameter generation. The algorithm option must be \"DHX\".

                                                                                                                                        • \"fips186_2\"

                                                                                                                                          FIPS186-4 parameter generation. The algorithm option must be \"DHX\".

                                                                                                                                        • \"group\"

                                                                                                                                          Can be used with the option pbits to select one of \"ffdhe2048\", \"ffdhe3072\", \"ffdhe4096\", \"ffdhe6144\" or \"ffdhe8192\". The algorithm option must be \"DH\".

                                                                                                                                        • \"default\"

                                                                                                                                          Selects a default type based on the algorithm. This is used by the OpenSSL default provider to set the type for backwards compatibility. If algorithm is \"DH\" then \"generator\" is used. If algorithm is \"DHX\" then \"fips186_2\" is used.

                                                                                                                                      • dh_paramgen_type:value

                                                                                                                                        The type of DH parameters to generate. Valid values are 0, 1, 2 or 3 which correspond to setting the option type to \"generator\", \"fips186_2\", \"fips186_4\" or \"group\".

                                                                                                                                      • digest:digest

                                                                                                                                        The digest to use during parameter generation. Must be one of sha1, sha224 or sha256. If set, then the number of bits in qbits will match the output size of the specified digest and the qbits parameter will be ignored. If not set, then a digest will be used that gives an output matching the number of bits in q, i.e. sha1 if q length is 160, sha224 if it is 224 or sha256 if it is 256. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

                                                                                                                                      • properties:query

                                                                                                                                        The digest property query string to use when fetching a digest from a provider. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

                                                                                                                                      • gindex:index

                                                                                                                                        The index to use for canonical generation and verification of the generator g. Set this to a positive value ranging from 0..255 to use this mode. Larger values will only use the bottom byte. This index must then be reused during key validation to verify the value of g. If this value is not set then g is not verifiable. The default value is -1. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

                                                                                                                                      • hexseed:seed

                                                                                                                                        The seed seed data to use instead of generating a random seed internally. This should be used for testing purposes only. This will either produced fixed values for the generated parameters OR it will fail if the seed did not generate valid primes. This is only used by \"fips186_4\" and \"fips186_2\" key generation.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#ec-parameter-generation-options","title":"EC Parameter Generation Options","text":"

                                                                                                                                      The EC parameter generation options are the same as for key generation. See \"EC Key Generation Options\" above.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#notes","title":"NOTES","text":"

                                                                                                                                      The use of the genpkey program is encouraged over the algorithm specific utilities because additional algorithm options and ENGINE provided algorithms can be used.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Generate an RSA private key using default parameters:

                                                                                                                                      openssl genpkey -algorithm RSA -out key.pem\n

                                                                                                                                      Encrypt output private key using 128 bit AES and the passphrase \"hello\":

                                                                                                                                      openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello\n

                                                                                                                                      Generate a 2048 bit RSA key using 3 as the public exponent:

                                                                                                                                      openssl genpkey -algorithm RSA -out key.pem \\\n    -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:3\n

                                                                                                                                      Generate 2048 bit DSA parameters that can be validated: The output values for gindex and seed are required for key validation purposes and are not saved to the output pem file).

                                                                                                                                      openssl genpkey -genparam -algorithm DSA -out dsap.pem -pkeyopt pbits:2048 \\\n    -pkeyopt qbits:224 -pkeyopt digest:SHA256 -pkeyopt gindex:1 -text\n

                                                                                                                                      Generate DSA key from parameters:

                                                                                                                                      openssl genpkey -paramfile dsap.pem -out dsakey.pem\n

                                                                                                                                      Generate 4096 bit DH Key using safe prime group ffdhe4096:

                                                                                                                                      openssl genpkey -algorithm DH -out dhkey.pem -pkeyopt group:ffdhe4096\n

                                                                                                                                      Generate 2048 bit X9.42 DH key with 256 bit subgroup using RFC5114 group3:

                                                                                                                                      openssl genpkey -algorithm DHX -out dhkey.pem -pkeyopt dh_rfc5114:3\n

                                                                                                                                      Generate a DH key using a DH parameters file:

                                                                                                                                      openssl genpkey -paramfile dhp.pem -out dhkey.pem\n

                                                                                                                                      Output DH parameters for safe prime group ffdhe2048:

                                                                                                                                      openssl genpkey -genparam -algorithm DH -out dhp.pem -pkeyopt group:ffdhe2048\n

                                                                                                                                      Output 2048 bit X9.42 DH parameters with 224 bit subgroup using RFC5114 group2:

                                                                                                                                      openssl genpkey -genparam -algorithm DHX -out dhp.pem -pkeyopt dh_rfc5114:2\n

                                                                                                                                      Output 2048 bit X9.42 DH parameters with 224 bit subgroup using FIP186-4 keygen:

                                                                                                                                      openssl genpkey -genparam -algorithm DHX -out dhp.pem -text \\\n    -pkeyopt pbits:2048 -pkeyopt qbits:224 -pkeyopt digest:SHA256 \\\n    -pkeyopt gindex:1 -pkeyopt dh_paramgen_type:2\n

                                                                                                                                      Output 1024 bit X9.42 DH parameters with 160 bit subgroup using FIP186-2 keygen:

                                                                                                                                      openssl genpkey -genparam -algorithm DHX -out dhp.pem -text \\\n    -pkeyopt pbits:1024 -pkeyopt qbits:160 -pkeyopt digest:SHA1 \\\n    -pkeyopt gindex:1 -pkeyopt dh_paramgen_type:1\n

                                                                                                                                      Output 2048 bit DH parameters:

                                                                                                                                      openssl genpkey -genparam -algorithm DH -out dhp.pem \\\n    -pkeyopt dh_paramgen_prime_len:2048\n

                                                                                                                                      Output 2048 bit DH parameters using a generator:

                                                                                                                                      openssl genpkey -genparam -algorithm DH -out dhpx.pem \\\n    -pkeyopt dh_paramgen_prime_len:2048 \\\n    -pkeyopt dh_paramgen_type:1\n

                                                                                                                                      Generate EC parameters:

                                                                                                                                      openssl genpkey -genparam -algorithm EC -out ecp.pem \\\n       -pkeyopt ec_paramgen_curve:secp384r1 \\\n       -pkeyopt ec_param_enc:named_curve\n

                                                                                                                                      Generate EC key from parameters:

                                                                                                                                      openssl genpkey -paramfile ecp.pem -out eckey.pem\n

                                                                                                                                      Generate EC key directly:

                                                                                                                                      openssl genpkey -algorithm EC -out eckey.pem \\\n       -pkeyopt ec_paramgen_curve:P-384 \\\n       -pkeyopt ec_param_enc:named_curve\n

                                                                                                                                      Generate an X25519 private key:

                                                                                                                                      openssl genpkey -algorithm X25519 -out xkey.pem\n

                                                                                                                                      Generate an ED448 private key:

                                                                                                                                      openssl genpkey -algorithm ED448 -out xkey.pem\n
                                                                                                                                      "},{"location":"man1/openssl-genpkey/#history","title":"HISTORY","text":"

                                                                                                                                      The ability to use NIST curve names, and to generate an EC key directly, were added in OpenSSL 1.0.2. The ability to generate X25519 keys was added in OpenSSL 1.1.0. The ability to generate X448, ED25519 and ED448 keys was added in OpenSSL 1.1.1.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-genpkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-genrsa/","title":"openssl-genrsa","text":""},{"location":"man1/openssl-genrsa/#name","title":"NAME","text":"

                                                                                                                                      openssl-genrsa - generate an RSA private key

                                                                                                                                      "},{"location":"man1/openssl-genrsa/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl genrsa [-help] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-F4] [-f4] [-3] [-primes num] [-verbose] [-traditional] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [numbits]

                                                                                                                                      "},{"location":"man1/openssl-genrsa/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command generates an RSA private key.

                                                                                                                                      "},{"location":"man1/openssl-genrsa/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -out filename

                                                                                                                                        Output the key to the specified file. If this argument is not specified then standard output is used.

                                                                                                                                      • -passout arg

                                                                                                                                        The output file password source. For more information about the format see openssl-passphrase-options(1).

                                                                                                                                      • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

                                                                                                                                        These options encrypt the private key with specified cipher before outputting it. If none of these options is specified no encryption is used. If encryption is used a pass phrase is prompted for if it is not supplied via the -passout argument.

                                                                                                                                      • -F4, -f4, -3

                                                                                                                                        The public exponent to use, either 65537 or 3. The default is 65537. The -3 option has been deprecated.

                                                                                                                                      • -primes num

                                                                                                                                        Specify the number of primes to use while generating the RSA key. The num parameter must be a positive integer that is greater than 1 and less than 16. If num is greater than 2, then the generated key is called a 'multi-prime' RSA key, which is defined in RFC 8017.

                                                                                                                                      • -verbose

                                                                                                                                        Print extra details about the operations being performed.

                                                                                                                                      • -traditional

                                                                                                                                        Write the key using the traditional PKCS#1 format instead of the PKCS#8 format.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • numbits

                                                                                                                                        The size of the private key to generate in bits. This must be the last option specified. The default is 2048 and values less than 512 are not allowed.

                                                                                                                                      "},{"location":"man1/openssl-genrsa/#notes","title":"NOTES","text":"

                                                                                                                                      RSA private key generation essentially involves the generation of two or more prime numbers. When generating a private key various symbols will be output to indicate the progress of the generation. A . represents each number which has passed an initial sieve test, + means a number has passed a single round of the Miller-Rabin primality test, * means the current prime starts a regenerating progress due to some failed tests. A newline means that the number has passed all the prime tests (the actual number depends on the key size).

                                                                                                                                      Because key generation is a random process the time taken to generate a key may vary somewhat. But in general, more primes lead to less generation time of a key.

                                                                                                                                      "},{"location":"man1/openssl-genrsa/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-genpkey(1), openssl-gendsa(1)

                                                                                                                                      "},{"location":"man1/openssl-genrsa/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-info/","title":"openssl-info","text":""},{"location":"man1/openssl-info/#name","title":"NAME","text":"

                                                                                                                                      openssl-info - print OpenSSL built-in information

                                                                                                                                      "},{"location":"man1/openssl-info/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl info [-help] [-configdir] [-enginesdir] [-modulesdir ] [-dsoext] [-dirnamesep] [-listsep] [-seeds] [-cpusettings]

                                                                                                                                      "},{"location":"man1/openssl-info/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to print out information about OpenSSL. The information is written exactly as it is with no extra text, which makes useful for scripts.

                                                                                                                                      As a consequence, only one item may be chosen for each run of this command.

                                                                                                                                      "},{"location":"man1/openssl-info/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -configdir

                                                                                                                                        Outputs the default directory for OpenSSL configuration files.

                                                                                                                                      • -enginesdir

                                                                                                                                        Outputs the default directory for OpenSSL engine modules.

                                                                                                                                      • -modulesdir

                                                                                                                                        Outputs the default directory for OpenSSL dynamically loadable modules other than engine modules.

                                                                                                                                      • -dsoext

                                                                                                                                        Outputs the DSO extension OpenSSL uses.

                                                                                                                                      • -dirnamesep

                                                                                                                                        Outputs the separator character between a directory specification and a filename. Note that on some operating systems, this is not the same as the separator between directory elements.

                                                                                                                                      • -listsep

                                                                                                                                        Outputs the OpenSSL list separator character. This is typically used to construct $PATH (%PATH% on Windows) style lists.

                                                                                                                                      • -seeds

                                                                                                                                        Outputs the randomness seed sources.

                                                                                                                                      • -cpusettings

                                                                                                                                        Outputs the OpenSSL CPU settings info.

                                                                                                                                      "},{"location":"man1/openssl-info/#history","title":"HISTORY","text":"

                                                                                                                                      This command was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-info/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-kdf/","title":"openssl-kdf","text":""},{"location":"man1/openssl-kdf/#name","title":"NAME","text":"

                                                                                                                                      openssl-kdf - perform Key Derivation Function operations

                                                                                                                                      "},{"location":"man1/openssl-kdf/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl kdf [-help] [-cipher] [-digest] [-mac] [-kdfopt nm:v] [-keylen num] [-out filename] [-binary] [-provider name] [-provider-path path] [-propquery propq] kdf_name

                                                                                                                                      "},{"location":"man1/openssl-kdf/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The key derivation functions generate a derived key from either a secret or password.

                                                                                                                                      "},{"location":"man1/openssl-kdf/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print a usage message.

                                                                                                                                      • -keylen num

                                                                                                                                        The output size of the derived key. This field is required.

                                                                                                                                      • -out filename

                                                                                                                                        Filename to output to, or standard output by default.

                                                                                                                                      • -binary

                                                                                                                                        Output the derived key in binary form. Uses hexadecimal text format if not specified.

                                                                                                                                      • -cipher name

                                                                                                                                        Specify the cipher to be used by the KDF. Not all KDFs require a cipher and it is an error to use this option in such cases.

                                                                                                                                      • -digest name

                                                                                                                                        Specify the digest to be used by the KDF. Not all KDFs require a digest and it is an error to use this option in such cases. To see the list of supported digests, use openssl list -digest-commands.

                                                                                                                                      • -mac name

                                                                                                                                        Specify the MAC to be used by the KDF. Not all KDFs require a MAC and it is an error to use this option in such cases.

                                                                                                                                      • -kdfopt nm:v

                                                                                                                                        Passes options to the KDF algorithm. A comprehensive list of parameters can be found in \"PARAMETERS\" in EVP_KDF(3). Common parameter names used by EVP_KDF_CTX_set_params() are:

                                                                                                                                        • key:string

                                                                                                                                          Specifies the secret key as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the KDF algorithm. A key must be specified for most KDF algorithms.

                                                                                                                                        • hexkey:string

                                                                                                                                          Alternative to the key: option where the secret key is specified in hexadecimal form (two hex digits per byte).

                                                                                                                                        • pass:string

                                                                                                                                          Specifies the password as an alphanumeric string (use if the password contains printable characters only). The password must be specified for PBKDF2 and scrypt.

                                                                                                                                        • hexpass:string

                                                                                                                                          Alternative to the pass: option where the password is specified in hexadecimal form (two hex digits per byte).

                                                                                                                                        • salt:string

                                                                                                                                          Specifies a non-secret unique cryptographic salt as an alphanumeric string (use if it contains printable characters only). The length must conform to any restrictions of the KDF algorithm. A salt parameter is required for several KDF algorithms, such as EVP_KDF-PBKDF2(7).

                                                                                                                                        • hexsalt:string

                                                                                                                                          Alternative to the salt: option where the salt is specified in hexadecimal form (two hex digits per byte).

                                                                                                                                        • info:string

                                                                                                                                          Some KDF implementations, such as EVP_KDF-HKDF(7), take an 'info' parameter for binding the derived key material to application- and context-specific information. Specifies the info, fixed info, other info or shared info argument as an alphanumeric string (use if it contains printable characters only). The length must conform to any restrictions of the KDF algorithm.

                                                                                                                                        • hexinfo:string

                                                                                                                                          Alternative to the info: option where the info is specified in hexadecimal form (two hex digits per byte).

                                                                                                                                        • digest:string

                                                                                                                                          This option is identical to the -digest option.

                                                                                                                                        • cipher:string

                                                                                                                                          This option is identical to the -cipher option.

                                                                                                                                        • mac:string

                                                                                                                                          This option is identical to the -mac option.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • kdf_name

                                                                                                                                        Specifies the name of a supported KDF algorithm which will be used. The supported algorithms names include TLS1-PRF, HKDF, SSKDF, PBKDF2, SSHKDF, X942KDF-ASN1, X942KDF-CONCAT, X963KDF and SCRYPT.

                                                                                                                                      "},{"location":"man1/openssl-kdf/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Use TLS1-PRF to create a hex-encoded derived key from a secret key and seed:

                                                                                                                                      openssl kdf -keylen 16 -kdfopt digest:SHA2-256 -kdfopt key:secret \\\n            -kdfopt seed:seed TLS1-PRF\n

                                                                                                                                      Use HKDF to create a hex-encoded derived key from a secret key, salt and info:

                                                                                                                                      openssl kdf -keylen 10 -kdfopt digest:SHA2-256 -kdfopt key:secret \\\n            -kdfopt salt:salt -kdfopt info:label HKDF\n

                                                                                                                                      Use SSKDF with KMAC to create a hex-encoded derived key from a secret key, salt and info:

                                                                                                                                      openssl kdf -keylen 64 -kdfopt mac:KMAC-128 -kdfopt maclen:20 \\\n            -kdfopt hexkey:b74a149a161545 -kdfopt hexinfo:348a37a2 \\\n            -kdfopt hexsalt:3638271ccd68a2 SSKDF\n

                                                                                                                                      Use SSKDF with HMAC to create a hex-encoded derived key from a secret key, salt and info:

                                                                                                                                      openssl kdf -keylen 16 -kdfopt mac:HMAC -kdfopt digest:SHA2-256 \\\n            -kdfopt hexkey:b74a149a -kdfopt hexinfo:348a37a2 \\\n            -kdfopt hexsalt:3638271c SSKDF\n

                                                                                                                                      Use SSKDF with Hash to create a hex-encoded derived key from a secret key, salt and info:

                                                                                                                                      openssl kdf -keylen 14 -kdfopt digest:SHA2-256 \\\n            -kdfopt hexkey:6dbdc23f045488 \\\n            -kdfopt hexinfo:a1b2c3d4 SSKDF\n

                                                                                                                                      Use SSHKDF to create a hex-encoded derived key from a secret key, hash and session_id:

                                                                                                                                      openssl kdf -keylen 16 -kdfopt digest:SHA2-256 \\\n            -kdfopt hexkey:0102030405 \\\n            -kdfopt hexxcghash:06090A \\\n            -kdfopt hexsession_id:01020304 \\\n            -kdfopt type:A SSHKDF\n

                                                                                                                                      Use PBKDF2 to create a hex-encoded derived key from a password and salt:

                                                                                                                                      openssl kdf -keylen 32 -kdfopt digest:SHA256 -kdfopt pass:password \\\n            -kdfopt salt:salt -kdfopt iter:2 PBKDF2\n

                                                                                                                                      Use scrypt to create a hex-encoded derived key from a password and salt:

                                                                                                                                      openssl kdf -keylen 64 -kdfopt pass:password -kdfopt salt:NaCl \\\n            -kdfopt n:1024 -kdfopt r:8 -kdfopt p:16 \\\n            -kdfopt maxmem_bytes:10485760 SCRYPT\n
                                                                                                                                      "},{"location":"man1/openssl-kdf/#notes","title":"NOTES","text":"

                                                                                                                                      The KDF mechanisms that are available will depend on the options used when building OpenSSL.

                                                                                                                                      "},{"location":"man1/openssl-kdf/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkeyutl(1), EVP_KDF(3), EVP_KDF-SCRYPT(7), EVP_KDF-TLS1_PRF(7), EVP_KDF-PBKDF2(7), EVP_KDF-HKDF(7), EVP_KDF-SS(7), EVP_KDF-SSHKDF(7), EVP_KDF-X942-ASN1(7), EVP_KDF-X942-CONCAT(7), EVP_KDF-X963(7)

                                                                                                                                      "},{"location":"man1/openssl-kdf/#history","title":"HISTORY","text":"

                                                                                                                                      Added in OpenSSL 3.0

                                                                                                                                      "},{"location":"man1/openssl-kdf/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-list/","title":"openssl-list","text":""},{"location":"man1/openssl-list/#name","title":"NAME","text":"

                                                                                                                                      openssl-list - list algorithms and features

                                                                                                                                      "},{"location":"man1/openssl-list/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl list [-help] [-verbose] [-select name] [-1] [-commands] [-standard-commands] [-digest-algorithms] [-digest-commands] [-kdf-algorithms] [-mac-algorithms] [-random-instances] [-random-generators] [-cipher-algorithms] [-cipher-commands] [-encoders] [-decoders] [-key-managers] [-key-exchange-algorithms] [-kem-algorithms] [-signature-algorithms] [-asymcipher-algorithms] [-public-key-algorithms] [-public-key-methods] [-store-loaders] [-providers] [-engines] [-disabled] [-objects] [-options command] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-list/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to generate list of algorithms or disabled features.

                                                                                                                                      "},{"location":"man1/openssl-list/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Display a usage message.

                                                                                                                                      • -verbose

                                                                                                                                        Displays extra information. The options below where verbosity applies say a bit more about what that means.

                                                                                                                                      • -select name

                                                                                                                                        Only list algorithms that match this name.

                                                                                                                                      • -1

                                                                                                                                        List the commands, digest-commands, or cipher-commands in a single column. If used, this option must be given first.

                                                                                                                                      • -commands

                                                                                                                                        Display a list of standard commands.

                                                                                                                                      • -standard-commands

                                                                                                                                        List of standard commands.

                                                                                                                                      • -digest-commands

                                                                                                                                        This option is deprecated. Use digest-algorithms instead.

                                                                                                                                        Display a list of message digest commands, which are typically used as input to the openssl-dgst(1) or openssl-speed(1) commands.

                                                                                                                                      • -cipher-commands

                                                                                                                                        This option is deprecated. Use cipher-algorithms instead.

                                                                                                                                        Display a list of cipher commands, which are typically used as input to the openssl-enc(1) or openssl-speed(1) commands.

                                                                                                                                      • -cipher-algorithms, -digest-algorithms, -kdf-algorithms, -mac-algorithms,

                                                                                                                                        Display a list of symmetric cipher, digest, kdf and mac algorithms. See \"Display of algorithm names\" for a description of how names are displayed.

                                                                                                                                        In verbose mode, the algorithms provided by a provider will get additional information on what parameters each implementation supports.

                                                                                                                                      • -random-instances

                                                                                                                                        List the primary, public and private random number generator details.

                                                                                                                                      • -random-generators

                                                                                                                                        Display a list of random number generators. See \"Display of algorithm names\" for a description of how names are displayed.

                                                                                                                                      • -encoders

                                                                                                                                        Display a list of encoders. See \"Display of algorithm names\" for a description of how names are displayed.

                                                                                                                                        In verbose mode, the algorithms provided by a provider will get additional information on what parameters each implementation supports.

                                                                                                                                      • -decoders

                                                                                                                                        Display a list of decoders. See \"Display of algorithm names\" for a description of how names are displayed.

                                                                                                                                        In verbose mode, the algorithms provided by a provider will get additional information on what parameters each implementation supports.

                                                                                                                                      • -public-key-algorithms

                                                                                                                                        Display a list of public key algorithms, with each algorithm as a block of multiple lines, all but the first are indented. The options key-exchange-algorithms, kem-algorithms, signature-algorithms, and asymcipher-algorithms will display similar info.

                                                                                                                                      • -public-key-methods

                                                                                                                                        Display a list of public key methods.

                                                                                                                                      • -key-managers

                                                                                                                                        Display a list of key managers.

                                                                                                                                      • -key-exchange-algorithms

                                                                                                                                        Display a list of key exchange algorithms.

                                                                                                                                      • -kem-algorithms

                                                                                                                                        Display a list of key encapsulation algorithms.

                                                                                                                                      • -signature-algorithms

                                                                                                                                        Display a list of signature algorithms.

                                                                                                                                      • -asymcipher-algorithms

                                                                                                                                        Display a list of asymmetric cipher algorithms.

                                                                                                                                      • -store-loaders

                                                                                                                                        Display a list of store loaders.

                                                                                                                                      • -providers

                                                                                                                                        Display a list of all loaded providers with their names, version and status.

                                                                                                                                        In verbose mode, the full version and all provider parameters will additionally be displayed.

                                                                                                                                      • -engines

                                                                                                                                        This option is deprecated.

                                                                                                                                        Display a list of loaded engines.

                                                                                                                                      • -disabled

                                                                                                                                        Display a list of disabled features, those that were compiled out of the installation.

                                                                                                                                      • -objects

                                                                                                                                        Display a list of built in objects, i.e. OIDs with names. They're listed in the format described in \"ASN1 Object Configuration Module\" in config(5).

                                                                                                                                      • -options command

                                                                                                                                        Output a two-column list of the options accepted by the specified command. The first is the option name, and the second is a one-character indication of what type of parameter it takes, if any. This is an internal option, used for checking that the documentation is complete.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-list/#display-of-algorithm-names","title":"Display of algorithm names","text":"

                                                                                                                                      Algorithm names may be displayed in one of two manners:

                                                                                                                                      • Legacy implementations

                                                                                                                                        Legacy implementations will simply display the main name of the algorithm on a line of its own, or in the form <foo bar>> to show that foo is an alias for the main name, bar

                                                                                                                                      • Provided implementations

                                                                                                                                        Implementations from a provider are displayed like this if the implementation is labeled with a single name:

                                                                                                                                        foo @ bar\n

                                                                                                                                        or like this if it's labeled with multiple names:

                                                                                                                                        { foo1, foo2 } @bar\n

                                                                                                                                        In both cases, bar is the name of the provider.

                                                                                                                                      "},{"location":"man1/openssl-list/#history","title":"HISTORY","text":"

                                                                                                                                      The -engines, -digest-commands, and -cipher-commands options were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-list/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-mac/","title":"openssl-mac","text":""},{"location":"man1/openssl-mac/#name","title":"NAME","text":"

                                                                                                                                      openssl-mac - perform Message Authentication Code operations

                                                                                                                                      "},{"location":"man1/openssl-mac/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl mac [-help] [-cipher] [-digest] [-macopt] [-in filename] [-out filename] [-binary] [-provider name] [-provider-path path] [-propquery propq] mac_name

                                                                                                                                      "},{"location":"man1/openssl-mac/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The message authentication code functions output the MAC of a supplied input file.

                                                                                                                                      "},{"location":"man1/openssl-mac/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print a usage message.

                                                                                                                                      • -in filename

                                                                                                                                        Input filename to calculate a MAC for, or standard input by default. Standard input is used if the filename is '-'. Files and standard input are expected to be in binary format.

                                                                                                                                      • -out filename

                                                                                                                                        Filename to output to, or standard output by default.

                                                                                                                                      • -binary

                                                                                                                                        Output the MAC in binary form. Uses hexadecimal text format if not specified.

                                                                                                                                      • -cipher name

                                                                                                                                        Used by CMAC and GMAC to specify the cipher algorithm. For CMAC it must be one of AES-128-CBC, AES-192-CBC, AES-256-CBC or DES-EDE3-CBC. For GMAC it should be a GCM mode cipher e.g. AES-128-GCM.

                                                                                                                                      • -digest name

                                                                                                                                        Used by HMAC as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. To see the list of supported digests, use openssl list -digest-commands.

                                                                                                                                      • -macopt nm:v

                                                                                                                                        Passes options to the MAC algorithm. A comprehensive list of controls can be found in the EVP_MAC implementation documentation. Common parameter names used by EVP_MAC_CTX_get_params() are:

                                                                                                                                        • key:string

                                                                                                                                          Specifies the MAC key as an alphanumeric string (use if the key contains printable characters only). The string length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm.

                                                                                                                                        • hexkey:string

                                                                                                                                          Specifies the MAC key in hexadecimal form (two hex digits per byte). The key length must conform to any restrictions of the MAC algorithm. A key must be specified for every MAC algorithm.

                                                                                                                                        • iv:string

                                                                                                                                          Used by GMAC to specify an IV as an alphanumeric string (use if the IV contains printable characters only).

                                                                                                                                        • hexiv:string

                                                                                                                                          Used by GMAC to specify an IV in hexadecimal form (two hex digits per byte).

                                                                                                                                        • size:int

                                                                                                                                          Used by KMAC128 or KMAC256 to specify an output length. The default sizes are 32 or 64 bytes respectively.

                                                                                                                                        • custom:string

                                                                                                                                          Used by KMAC128 or KMAC256 to specify a customization string. The default is the empty string \"\".

                                                                                                                                        • digest:string

                                                                                                                                          This option is identical to the -digest option.

                                                                                                                                        • cipher:string

                                                                                                                                          This option is identical to the -cipher option.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • mac_name

                                                                                                                                        Specifies the name of a supported MAC algorithm which will be used. To see the list of supported MAC's use the command openssl list \\-mac-algorithms.

                                                                                                                                      "},{"location":"man1/openssl-mac/#examples","title":"EXAMPLES","text":"

                                                                                                                                      To create a hex-encoded HMAC-SHA1 MAC of a file and write to stdout:

                                                                                                                                      openssl mac -digest SHA1 \\\n        -macopt hexkey:000102030405060708090A0B0C0D0E0F10111213 \\\n        -in msg.bin HMAC\n

                                                                                                                                      To create a SipHash MAC from a file with a binary file output:

                                                                                                                                      openssl mac -macopt hexkey:000102030405060708090A0B0C0D0E0F \\\n        -in msg.bin -out out.bin -binary SipHash\n

                                                                                                                                      To create a hex-encoded CMAC-AES-128-CBC MAC from a file:

                                                                                                                                      openssl mac -cipher AES-128-CBC \\\n        -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B \\\n        -in msg.bin CMAC\n

                                                                                                                                      To create a hex-encoded KMAC128 MAC from a file with a Customisation String 'Tag' and output length of 16:

                                                                                                                                      openssl mac -macopt custom:Tag -macopt hexkey:40414243444546 \\\n        -macopt size:16 -in msg.bin KMAC128\n

                                                                                                                                      To create a hex-encoded GMAC-AES-128-GCM with a IV from a file:

                                                                                                                                      openssl mac -cipher AES-128-GCM -macopt hexiv:E0E00F19FED7BA0136A797F3 \\\n        -macopt hexkey:77A77FAF290C1FA30C683DF16BA7A77B -in msg.bin GMAC\n
                                                                                                                                      "},{"location":"man1/openssl-mac/#notes","title":"NOTES","text":"

                                                                                                                                      The MAC mechanisms that are available will depend on the options used when building OpenSSL. Use openssl list -mac-algorithms to list them.

                                                                                                                                      "},{"location":"man1/openssl-mac/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), EVP_MAC(3), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-HMAC(7), EVP_MAC-KMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7)

                                                                                                                                      "},{"location":"man1/openssl-mac/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-namedisplay-options/","title":"openssl-namedisplay-options","text":""},{"location":"man1/openssl-namedisplay-options/#name","title":"NAME","text":"

                                                                                                                                      openssl-namedisplay-options - Distinguished name display options

                                                                                                                                      "},{"location":"man1/openssl-namedisplay-options/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl command [ options ... ] [ parameters ... ]

                                                                                                                                      "},{"location":"man1/openssl-namedisplay-options/#description","title":"DESCRIPTION","text":"

                                                                                                                                      OpenSSL provides fine-grain control over how the subject and issuer DN's are displayed. This is specified by using the -nameopt option, which takes a comma-separated list of options from the following set. An option may be preceded by a minus sign, -, to turn it off. The default value is oneline. The first four are the most commonly used.

                                                                                                                                      "},{"location":"man1/openssl-namedisplay-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-namedisplay-options/#name-format-option-arguments","title":"Name Format Option Arguments","text":"

                                                                                                                                      The DN output format can be fine tuned with the following flags.

                                                                                                                                      • compat

                                                                                                                                        Display the name using an old format from previous OpenSSL versions.

                                                                                                                                      • RFC2253

                                                                                                                                        Display the name using the format defined in RFC 2253. It is equivalent to esc_2253, esc_ctrl, esc_msb, utf8, dump_nostr, dump_unknown, dump_der, sep_comma_plus, dn_rev and sname.

                                                                                                                                      • oneline

                                                                                                                                        Display the name in one line, using a format that is more readable RFC 2253. It is equivalent to esc_2253, esc_ctrl, esc_msb, utf8, dump_nostr, dump_der, use_quote, sep_comma_plus_space, space_eq and sname options.

                                                                                                                                      • multiline

                                                                                                                                        Display the name using multiple lines. It is equivalent to esc_ctrl, esc_msb, sep_multiline, space_eq, lname and align.

                                                                                                                                      • esc_2253

                                                                                                                                        Escape the \"special\" characters in a field, as required by RFC 2253. That is, any of the characters ,+\"<>;, # at the beginning of a string and leading or trailing spaces.

                                                                                                                                      • esc_2254

                                                                                                                                        Escape the \"special\" characters in a field as required by RFC 2254 in a field. That is, the NUL character and of ()*.

                                                                                                                                      • esc_ctrl

                                                                                                                                        Escape non-printable ASCII characters, codes less than 0x20 (space) or greater than 0x7F (DELETE). They are displayed using RFC 2253 \\XX notation where XX are the two hex digits representing the character value.

                                                                                                                                      • esc_msb

                                                                                                                                        Escape any characters with the most significant bit set, that is with values larger than 127, as described in esc_ctrl.

                                                                                                                                      • use_quote

                                                                                                                                        Escapes some characters by surrounding the entire string with quotation marks, \". Without this option, individual special characters are preceded with a backslash character, \\.

                                                                                                                                      • utf8

                                                                                                                                        Convert all strings to UTF-8 format first as required by RFC 2253. If the output device is UTF-8 compatible, then using this option (and not setting esc_msb) may give the correct display of multibyte characters. If this option is not set, then multibyte characters larger than 0xFF will be output as \\UXXXX for 16 bits or \\WXXXXXXXX for 32 bits. In addition, any UTF8Strings will be converted to their character form first.

                                                                                                                                      • ignore_type

                                                                                                                                        This option does not attempt to interpret multibyte characters in any way. That is, the content octets are merely dumped as though one octet represents each character. This is useful for diagnostic purposes but will result in rather odd looking output.

                                                                                                                                      • show_type

                                                                                                                                        Display the type of the ASN1 character string before the value, such as BMPSTRING: Hello World.

                                                                                                                                      • dump_der

                                                                                                                                        Any fields that would be output in hex format are displayed using the DER encoding of the field. If not set, just the content octets are displayed. Either way, the #XXXX... format of RFC 2253 is used.

                                                                                                                                      • dump_nostr

                                                                                                                                        Dump non-character strings, such as ASN.1 OCTET STRING. If this option is not set, then non character string types will be displayed as though each content octet represents a single character.

                                                                                                                                      • dump_all

                                                                                                                                        Dump all fields. When this used with dump_der, this allows the DER encoding of the structure to be unambiguously determined.

                                                                                                                                      • dump_unknown

                                                                                                                                        Dump any field whose OID is not recognised by OpenSSL.

                                                                                                                                      • sep_comma_plus, sep_comma_plus_space, sep_semi_plus_space, sep_multiline

                                                                                                                                        Specify the field separators. The first word is used between the Relative Distinguished Names (RDNs) and the second is between multiple Attribute Value Assertions (AVAs). Multiple AVAs are very rare and their use is discouraged. The options ending in \"space\" additionally place a space after the separator to make it more readable. The sep_multiline starts each field on its own line, and uses \"plus space\" for the AVA separator. It also indents the fields by four characters. The default value is sep_comma_plus_space.

                                                                                                                                      • dn_rev

                                                                                                                                        Reverse the fields of the DN as required by RFC 2253. This also reverses the order of multiple AVAs in a field, but this is permissible as there is no ordering on values.

                                                                                                                                      • nofname, sname, lname, oid

                                                                                                                                        Specify how the field name is displayed. nofname does not display the field at all. sname uses the \"short name\" form (CN for commonName for example). lname uses the long form. oid represents the OID in numerical form and is useful for diagnostic purpose.

                                                                                                                                      • align

                                                                                                                                        Align field values for a more readable output. Only usable with sep_multiline.

                                                                                                                                      • space_eq

                                                                                                                                        Places spaces round the equal sign, =, character which follows the field name.

                                                                                                                                      "},{"location":"man1/openssl-namedisplay-options/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-nseq/","title":"openssl-nseq","text":""},{"location":"man1/openssl-nseq/#name","title":"NAME","text":"

                                                                                                                                      openssl-nseq - create or examine a Netscape certificate sequence

                                                                                                                                      "},{"location":"man1/openssl-nseq/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl nseq [-help] [-in filename] [-out filename] [-toseq] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-nseq/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command takes a file containing a Netscape certificate sequence and prints out the certificates contained in it or takes a file of certificates and converts it into a Netscape certificate sequence.

                                                                                                                                      A Netscape certificate sequence is an old Netscape-specific format that can be sometimes be sent to browsers as an alternative to the standard PKCS#7 format when several certificates are sent to the browser, for example during certificate enrollment. It was also used by Netscape certificate server.

                                                                                                                                      "},{"location":"man1/openssl-nseq/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read or standard input if this option is not specified.

                                                                                                                                      • -out filename

                                                                                                                                        Specifies the output filename or standard output by default.

                                                                                                                                      • -toseq

                                                                                                                                        Normally a Netscape certificate sequence will be input and the output is the certificates contained in it. With the -toseq option the situation is reversed: a Netscape certificate sequence is created from a file of certificates.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-nseq/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Output the certificates in a Netscape certificate sequence

                                                                                                                                      openssl nseq -in nseq.pem -out certs.pem\n

                                                                                                                                      Create a Netscape certificate sequence

                                                                                                                                      openssl nseq -in certs.pem -toseq -out nseq.pem\n
                                                                                                                                      "},{"location":"man1/openssl-nseq/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-ocsp/","title":"openssl-ocsp","text":""},{"location":"man1/openssl-ocsp/#name","title":"NAME","text":"

                                                                                                                                      openssl-ocsp - Online Certificate Status Protocol command

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#synopsis","title":"SYNOPSIS","text":""},{"location":"man1/openssl-ocsp/#ocsp-client","title":"OCSP Client","text":"

                                                                                                                                      openssl ocsp [-help] [-out file] [-issuer file] [-cert file] [-no_certs] [-serial n] [-signer file] [-signkey file] [-sign_other file] [-nonce] [-no_nonce] [-req_text] [-resp_text] [-text] [-reqout file] [-respout file] [-reqin file] [-respin file] [-url URL] [-host host:port] [-path] [-proxy [http[s]://][userinfo@]host[:port][/path]] [-no_proxy addresses] [-header] [-timeout seconds] [-VAfile file] [-validity_period n] [-status_age n] [-noverify] [-verify_other file] [-trust_other] [-no_intern] [-no_signature_verify] [-no_cert_verify] [-no_chain] [-no_cert_checks] [-no_explicit] [-port num] [-ignore_err]

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#ocsp-server","title":"OCSP Server","text":"

                                                                                                                                      openssl ocsp [-index file] [-CA file] [-rsigner file] [-rkey file] [-passin arg] [-rother file] [-rsigopt nm:v] [-rmd digest] [-badsig] [-resp_no_certs] [-nmin n] [-ndays n] [-resp_key_id] [-nrequest n] [-multi process-count] [-rcid digest] [-digest] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The Online Certificate Status Protocol (OCSP) enables applications to determine the (revocation) state of an identified certificate (RFC 2560).

                                                                                                                                      This command performs many common OCSP tasks. It can be used to print out requests and responses, create requests and send queries to an OCSP responder and behave like a mini OCSP server itself.

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#options","title":"OPTIONS","text":"

                                                                                                                                      This command operates as either a client or a server. The options are described below, divided into those two modes.

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#ocsp-client-options","title":"OCSP Client Options","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -out filename

                                                                                                                                        specify output filename, default is standard output.

                                                                                                                                      • -issuer filename

                                                                                                                                        This specifies the current issuer certificate. This option can be used multiple times. This option MUST come before any -cert options.

                                                                                                                                      • -cert filename

                                                                                                                                        Add the certificate filename to the request. The issuer certificate is taken from the previous -issuer option, or an error occurs if no issuer certificate is specified.

                                                                                                                                      • -no_certs

                                                                                                                                        Don't include any certificates in signed request.

                                                                                                                                      • -serial num

                                                                                                                                        Same as the -cert option except the certificate with serial number num is added to the request. The serial number is interpreted as a decimal integer unless preceded by 0x. Negative integers can also be specified by preceding the value by a - sign.

                                                                                                                                      • -signer filename, -signkey filename

                                                                                                                                        Sign the OCSP request using the certificate specified in the -signer option and the private key specified by the -signkey option. If the -signkey option is not present then the private key is read from the same file as the certificate. If neither option is specified then the OCSP request is not signed.

                                                                                                                                      • -sign_other filename

                                                                                                                                        Additional certificates to include in the signed request. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -nonce, -no_nonce

                                                                                                                                        Add an OCSP nonce extension to a request or disable OCSP nonce addition. Normally if an OCSP request is input using the -reqin option no nonce is added: using the -nonce option will force addition of a nonce. If an OCSP request is being created (using -cert and -serial options) a nonce is automatically added specifying -no_nonce overrides this.

                                                                                                                                      • -req_text, -resp_text, -text

                                                                                                                                        Print out the text form of the OCSP request, response or both respectively.

                                                                                                                                      • -reqout file, -respout file

                                                                                                                                        Write out the DER encoded certificate request or response to file.

                                                                                                                                      • -reqin file, -respin file

                                                                                                                                        Read OCSP request or response file from file. These option are ignored if OCSP request or response creation is implied by other options (for example with -serial, -cert and -host options).

                                                                                                                                      • -url responder_url

                                                                                                                                        Specify the responder URL. Both HTTP and HTTPS (SSL/TLS) URLs can be specified. The optional userinfo and fragment components are ignored. Any given query component is handled as part of the path component.

                                                                                                                                      • -host hostname:port, -path pathname

                                                                                                                                        If the -host option is present then the OCSP request is sent to the host hostname on port port. The -path option specifies the HTTP pathname to use or \"/\" by default. This is equivalent to specifying -url with scheme http:// and the given hostname, port, and pathname.

                                                                                                                                      • -proxy [http[s]://][userinfo@]host[:port][/path]

                                                                                                                                        The HTTP(S) proxy server to use for reaching the OCSP server unless -no_proxy applies, see below. The proxy port defaults to 80 or 443 if the scheme is https; apart from that the optional http:// or https:// prefix is ignored, as well as any userinfo and path components. Defaults to the environment variable http_proxy if set, else HTTP_PROXY in case no TLS is used, otherwise https_proxy if set, else HTTPS_PROXY.

                                                                                                                                      • -no_proxy addresses

                                                                                                                                        List of IP addresses and/or DNS names of servers not to use an HTTP(S) proxy for, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Default is from the environment variable no_proxy if set, else NO_PROXY.

                                                                                                                                      • -header name=value

                                                                                                                                        Adds the header name with the specified value to the OCSP request that is sent to the responder. This may be repeated.

                                                                                                                                      • -timeout seconds

                                                                                                                                        Connection timeout to the OCSP responder in seconds. On POSIX systems, when running as an OCSP responder, this option also limits the time that the responder is willing to wait for the client request. This time is measured from the time the responder accepts the connection until the complete request is received.

                                                                                                                                      • -verify_other file

                                                                                                                                        File or URI containing additional certificates to search when attempting to locate the OCSP response signing certificate. Some responders omit the actual signer's certificate from the response: this option can be used to supply the necessary certificate in such cases. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -trust_other

                                                                                                                                        The certificates specified by the -verify_other option should be explicitly trusted and no additional checks will be performed on them. This is useful when the complete responder certificate chain is not available or trusting a root CA is not appropriate.

                                                                                                                                      • -VAfile file

                                                                                                                                        File or URI containing explicitly trusted responder certificates. Equivalent to the -verify_other and -trust_other options. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -noverify

                                                                                                                                        Don't attempt to verify the OCSP response signature or the nonce values. This option will normally only be used for debugging since it disables all verification of the responders certificate.

                                                                                                                                      • -no_intern

                                                                                                                                        Ignore certificates contained in the OCSP response when searching for the signers certificate. With this option the signers certificate must be specified with either the -verify_other or -VAfile options.

                                                                                                                                      • -no_signature_verify

                                                                                                                                        Don't check the signature on the OCSP response. Since this option tolerates invalid signatures on OCSP responses it will normally only be used for testing purposes.

                                                                                                                                      • -no_cert_verify

                                                                                                                                        Don't verify the OCSP response signers certificate at all. Since this option allows the OCSP response to be signed by any certificate it should only be used for testing purposes.

                                                                                                                                      • -no_chain

                                                                                                                                        Do not use certificates in the response as additional untrusted CA certificates.

                                                                                                                                      • -no_explicit

                                                                                                                                        Do not explicitly trust the root CA if it is set to be trusted for OCSP signing.

                                                                                                                                      • -no_cert_checks

                                                                                                                                        Don't perform any additional checks on the OCSP response signers certificate. That is do not make any checks to see if the signers certificate is authorised to provide the necessary status information: as a result this option should only be used for testing purposes.

                                                                                                                                      • -validity_period nsec, -status_age age

                                                                                                                                        These options specify the range of times, in seconds, which will be tolerated in an OCSP response. Each certificate status response includes a notBefore time and an optional notAfter time. The current time should fall between these two values, but the interval between the two times may be only a few seconds. In practice the OCSP responder and clients clocks may not be precisely synchronised and so such a check may fail. To avoid this the -validity_period option can be used to specify an acceptable error range in seconds, the default value is 5 minutes.

                                                                                                                                        If the notAfter time is omitted from a response then this means that new status information is immediately available. In this case the age of the notBefore field is checked to see it is not older than age seconds old. By default this additional check is not performed.

                                                                                                                                      • -rcid digest

                                                                                                                                        This option sets the digest algorithm to use for certificate identification in the OCSP response. Any digest supported by the openssl-dgst(1) command can be used. The default is the same digest algorithm used in the request.

                                                                                                                                      • -digest

                                                                                                                                        This option sets digest algorithm to use for certificate identification in the OCSP request. Any digest supported by the OpenSSL dgst command can be used. The default is SHA-1. This option may be used multiple times to specify the digest used by subsequent certificate identifiers.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#ocsp-server-options","title":"OCSP Server Options","text":"
                                                                                                                                      • -index indexfile

                                                                                                                                        The indexfile parameter is the name of a text index file in ca format containing certificate revocation information.

                                                                                                                                        If the -index option is specified then this command switches to responder mode, otherwise it is in client mode. The request(s) the responder processes can be either specified on the command line (using -issuer and -serial options), supplied in a file (using the -reqin option) or via external OCSP clients (if -port or -url is specified).

                                                                                                                                        If the -index option is present then the -CA and -rsigner options must also be present.

                                                                                                                                      • -CA file

                                                                                                                                        CA certificate corresponding to the revocation information in the index file given with -index. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -rsigner file

                                                                                                                                        The certificate to sign OCSP responses with.

                                                                                                                                      • -rkey file

                                                                                                                                        The private key to sign OCSP responses with: if not present the file specified in the -rsigner option is used.

                                                                                                                                      • -passin arg

                                                                                                                                        The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -rother file

                                                                                                                                        Additional certificates to include in the OCSP response. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -rsigopt nm:v

                                                                                                                                        Pass options to the signature algorithm when signing OCSP responses. Names and values of these options are algorithm-specific.

                                                                                                                                      • -rmd digest

                                                                                                                                        The digest to use when signing the response.

                                                                                                                                      • -badsig

                                                                                                                                        Corrupt the response signature before writing it; this can be useful for testing.

                                                                                                                                      • -resp_no_certs

                                                                                                                                        Don't include any certificates in the OCSP response.

                                                                                                                                      • -resp_key_id

                                                                                                                                        Identify the signer certificate using the key ID, default is to use the subject name.

                                                                                                                                      • -port portnum

                                                                                                                                        Port to listen for OCSP requests on. The port may also be specified using the url option. A 0 argument indicates that any available port shall be chosen automatically.

                                                                                                                                      • -ignore_err

                                                                                                                                        Ignore malformed requests or responses: When acting as an OCSP client, retry if a malformed response is received. When acting as an OCSP responder, continue running instead of terminating upon receiving a malformed request.

                                                                                                                                      • -nrequest number

                                                                                                                                        The OCSP server will exit after receiving number requests, default unlimited.

                                                                                                                                      • -multi process-count

                                                                                                                                        Run the specified number of OCSP responder child processes, with the parent process respawning child processes as needed. Child processes will detect changes in the CA index file and automatically reload it. When running as a responder -timeout option is recommended to limit the time each child is willing to wait for the client's OCSP response. This option is available on POSIX systems (that support the fork() and other required unix system-calls).

                                                                                                                                      • -nmin minutes, -ndays days

                                                                                                                                        Number of minutes or days when fresh revocation information is available: used in the nextUpdate field. If neither option is present then the nextUpdate field is omitted meaning fresh revocation information is immediately available.

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#ocsp-response-verification","title":"OCSP RESPONSE VERIFICATION","text":"

                                                                                                                                      OCSP Response follows the rules specified in RFC2560.

                                                                                                                                      Initially the OCSP responder certificate is located and the signature on the OCSP request checked using the responder certificate's public key.

                                                                                                                                      Then a normal certificate verify is performed on the OCSP responder certificate building up a certificate chain in the process. The locations of the trusted certificates used to build the chain can be specified by the -CAfile, -CApath or -CAstore options or they will be looked for in the standard OpenSSL certificates directory.

                                                                                                                                      If the initial verify fails then the OCSP verify process halts with an error.

                                                                                                                                      Otherwise the issuing CA certificate in the request is compared to the OCSP responder certificate: if there is a match then the OCSP verify succeeds.

                                                                                                                                      Otherwise the OCSP responder certificate's CA is checked against the issuing CA certificate in the request. If there is a match and the OCSPSigning extended key usage is present in the OCSP responder certificate then the OCSP verify succeeds.

                                                                                                                                      Otherwise, if -no_explicit is not set the root CA of the OCSP responders CA is checked to see if it is trusted for OCSP signing. If it is the OCSP verify succeeds.

                                                                                                                                      If none of these checks is successful then the OCSP verify fails.

                                                                                                                                      What this effectively means if that if the OCSP responder certificate is authorised directly by the CA it is issuing revocation information about (and it is correctly configured) then verification will succeed.

                                                                                                                                      If the OCSP responder is a \"global responder\" which can give details about multiple CAs and has its own separate certificate chain then its root CA can be trusted for OCSP signing. For example:

                                                                                                                                      openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem\n

                                                                                                                                      Alternatively the responder certificate itself can be explicitly trusted with the -VAfile option.

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#notes","title":"NOTES","text":"

                                                                                                                                      As noted, most of the verify options are for testing or debugging purposes. Normally only the -CApath, -CAfile, -CAstore and (if the responder is a 'global VA') -VAfile options need to be used.

                                                                                                                                      The OCSP server is only useful for test and demonstration purposes: it is not really usable as a full OCSP responder. It contains only a very simple HTTP request handling and can only handle the POST form of OCSP queries. It also handles requests serially meaning it cannot respond to new requests until it has processed the current one. The text index file format of revocation is also inefficient for large quantities of revocation data.

                                                                                                                                      It is possible to run this command in responder mode via a CGI script using the -reqin and -respout options.

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create an OCSP request and write it to a file:

                                                                                                                                      openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der\n

                                                                                                                                      Send a query to an OCSP responder with URL http://ocsp.myhost.com/ save the response to a file, print it out in text form, and verify the response:

                                                                                                                                      openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \\\n    -url http://ocsp.myhost.com/ -resp_text -respout resp.der\n

                                                                                                                                      Read in an OCSP response and print out text form:

                                                                                                                                      openssl ocsp -respin resp.der -text -noverify\n

                                                                                                                                      OCSP server on port 8888 using a standard ca configuration, and a separate responder certificate. All requests and responses are printed to a file.

                                                                                                                                      openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem\n       -text -out log.txt\n

                                                                                                                                      As above but exit after processing one request:

                                                                                                                                      openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem\n    -nrequest 1\n

                                                                                                                                      Query status information using an internally generated request:

                                                                                                                                      openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem\n    -issuer demoCA/cacert.pem -serial 1\n

                                                                                                                                      Query status information using request read from a file, and write the response to a second file.

                                                                                                                                      openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem\n    -reqin req.der -respout resp.der\n
                                                                                                                                      "},{"location":"man1/openssl-ocsp/#history","title":"HISTORY","text":"

                                                                                                                                      The -no_alt_chains option was added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man1/openssl-ocsp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-passphrase-options/","title":"openssl-passphrase-options","text":""},{"location":"man1/openssl-passphrase-options/#name","title":"NAME","text":"

                                                                                                                                      openssl-passphrase-options - Pass phrase options

                                                                                                                                      "},{"location":"man1/openssl-passphrase-options/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl command [ options ... ] [ parameters ... ]

                                                                                                                                      "},{"location":"man1/openssl-passphrase-options/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Several OpenSSL commands accept password arguments, typically using -passin and -passout for input and output passwords respectively. These allow the password to be obtained from a variety of sources. Both of these options take a single argument whose format is described below. If no password argument is given and a password is required then the user is prompted to enter one: this will typically be read from the current terminal with echoing turned off.

                                                                                                                                      Note that character encoding may be relevant, please see passphrase-encoding(7).

                                                                                                                                      "},{"location":"man1/openssl-passphrase-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-passphrase-options/#pass-phrase-option-arguments","title":"Pass Phrase Option Arguments","text":"

                                                                                                                                      Pass phrase arguments can be formatted as follows.

                                                                                                                                      • pass:password

                                                                                                                                        The actual password is password. Since the password is visible to utilities (like 'ps' under Unix) this form should only be used where security is not important.

                                                                                                                                      • env:var

                                                                                                                                        Obtain the password from the environment variable var. Since the environment of other processes is visible on certain platforms (e.g. ps under certain Unix OSes) this option should be used with caution.

                                                                                                                                      • file:pathname

                                                                                                                                        The first line of pathname is the password. If the same pathname argument is supplied to -passin and -passout arguments then the first line will be used for the input password and the next line for the output password. pathname need not refer to a regular file: it could for example refer to a device or named pipe.

                                                                                                                                      • fd:number

                                                                                                                                        Read the password from the file descriptor number. This can be used to send the data via a pipe for example.

                                                                                                                                      • stdin

                                                                                                                                        Read the password from standard input.

                                                                                                                                      "},{"location":"man1/openssl-passphrase-options/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-passwd/","title":"openssl-passwd","text":""},{"location":"man1/openssl-passwd/#name","title":"NAME","text":"

                                                                                                                                      openssl-passwd - compute password hashes

                                                                                                                                      "},{"location":"man1/openssl-passwd/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl passwd [-help] [-1] [-apr1] [-aixmd5] [-5] [-6] [-salt string] [-in file] [-stdin] [-noverify] [-quiet] [-table] [-reverse] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [password]

                                                                                                                                      "},{"location":"man1/openssl-passwd/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command computes the hash of a password typed at run-time or the hash of each password in a list. The password list is taken from the named file for option -in, from stdin for option -stdin, or from the command line, or from the terminal otherwise.

                                                                                                                                      "},{"location":"man1/openssl-passwd/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -1

                                                                                                                                        Use the MD5 based BSD password algorithm 1 (default).

                                                                                                                                      • -apr1

                                                                                                                                        Use the apr1 algorithm (Apache variant of the BSD algorithm).

                                                                                                                                      • -aixmd5

                                                                                                                                        Use the AIX MD5 algorithm (AIX variant of the BSD algorithm).

                                                                                                                                      • -5

                                                                                                                                      • -6

                                                                                                                                        Use the SHA256 / SHA512 based algorithms defined by Ulrich Drepper. See https://www.akkadia.org/drepper/SHA-crypt.txt.

                                                                                                                                      • -salt string

                                                                                                                                        Use the specified salt. When reading a password from the terminal, this implies -noverify.

                                                                                                                                      • -in file

                                                                                                                                        Read passwords from file.

                                                                                                                                      • -stdin

                                                                                                                                        Read passwords from stdin.

                                                                                                                                      • -noverify

                                                                                                                                        Don't verify when reading a password from the terminal.

                                                                                                                                      • -quiet

                                                                                                                                        Don't output warnings when passwords given at the command line are truncated.

                                                                                                                                      • -table

                                                                                                                                        In the output list, prepend the cleartext password and a TAB character to each password hash.

                                                                                                                                      • -reverse

                                                                                                                                        When the -table option is used, reverse the order of cleartext and hash.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-passwd/#examples","title":"EXAMPLES","text":"
                                                                                                                                      % openssl passwd -1 -salt xxxxxxxx password\n$1$xxxxxxxx$UYCIxa628.9qXjpQCjM4a.\n\n% openssl passwd -apr1 -salt xxxxxxxx password\n$apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0\n\n% openssl passwd -aixmd5 -salt xxxxxxxx password\nxxxxxxxx$8Oaipk/GPKhC64w/YVeFD/\n
                                                                                                                                      "},{"location":"man1/openssl-passwd/#history","title":"HISTORY","text":"

                                                                                                                                      The -crypt option was removed in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-passwd/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/","title":"openssl-pkcs12","text":""},{"location":"man1/openssl-pkcs12/#name","title":"NAME","text":"

                                                                                                                                      openssl-pkcs12 - PKCS#12 file command

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl pkcs12 [-help] [-passin arg] [-passout arg] [-password arg] [-twopass] [-in filename|uri] [-out filename] [-nokeys] [-nocerts] [-noout] [-legacy] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-rand files] [-writerand file]

                                                                                                                                      PKCS#12 input (parsing) options: [-info] [-nomacver] [-clcerts] [-cacerts]

                                                                                                                                      [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-noenc] [-nodes]

                                                                                                                                      PKCS#12 output (export) options:

                                                                                                                                      [-export] [-inkey filename|uri] [-certfile filename] [-passcerts arg] [-chain] [-untrusted filename] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-name name] [-caname name] [-CSP name] [-LMK] [-keyex] [-keysig] [-keypbe cipher] [-certpbe cipher] [-descert] [-macalg digest] [-iter count] [-noiter] [-nomaciter] [-maciter] [-nomac]

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command allows PKCS#12 files (sometimes referred to as PFX files) to be created and parsed. PKCS#12 files are used by several programs including Netscape, MSIE and MS Outlook.

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#options","title":"OPTIONS","text":"

                                                                                                                                      There are a lot of options the meaning of some depends of whether a PKCS#12 file is being created or parsed. By default a PKCS#12 file is parsed. A PKCS#12 file can be created by using the -export option (see below). The PKCS#12 export encryption and MAC options such as -certpbe and -iter and many further options such as -chain are relevant only with -export. Conversely, the options regarding encryption of private keys when outputting PKCS#12 input are relevant only when the -export option is not given.

                                                                                                                                      The default encryption algorithm is AES-256-CBC with PBKDF2 for key derivation.

                                                                                                                                      When encountering problems loading legacy PKCS#12 files that involve, for example, RC2-40-CBC, try using the -legacy option and, if needed, the -provider-path option.

                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -passin arg

                                                                                                                                        The password source for the input, and for encrypting any private keys that are output. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -passout arg

                                                                                                                                        The password source for output files.

                                                                                                                                      • -password arg

                                                                                                                                        With -export, -password is equivalent to -passout, otherwise it is equivalent to -passin.

                                                                                                                                      • -twopass

                                                                                                                                        Prompt for separate integrity and encryption passwords: most software always assumes these are the same so this option will render such PKCS#12 files unreadable. Cannot be used in combination with the options -password, -passin if importing from PKCS#12, or -passout if exporting.

                                                                                                                                      • -nokeys

                                                                                                                                        No private keys will be output.

                                                                                                                                      • -nocerts

                                                                                                                                        No certificates will be output.

                                                                                                                                      • -noout

                                                                                                                                        This option inhibits all credentials output, and so the input is just verified.

                                                                                                                                      • -legacy

                                                                                                                                        Use legacy mode of operation and automatically load the legacy provider. If OpenSSL is not installed system-wide, it is necessary to also use, for example, -provider-path ./providers or to set the environment variable OPENSSL_MODULES to point to the directory where the providers can be found.

                                                                                                                                        In the legacy mode, the default algorithm for certificate encryption is RC2_CBC or 3DES_CBC depending on whether the RC2 cipher is enabled in the build. The default algorithm for private key encryption is 3DES_CBC. If the legacy option is not specified, then the legacy provider is not loaded and the default encryption algorithm for both certificates and private keys is AES_256_CBC with PBKDF2 for key derivation.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#pkcs12-input-parsing-options","title":"PKCS#12 input (parsing) options","text":"
                                                                                                                                      • -in filename|uri

                                                                                                                                        This specifies the input filename or URI. Standard input is used by default. Without the -export option this must be PKCS#12 file to be parsed. For use with the -export option see the \"PKCS#12 output (export) options\" section.

                                                                                                                                      • -out filename

                                                                                                                                        The filename to write certificates and private keys to, standard output by default. They are all written in PEM format.

                                                                                                                                      • -info

                                                                                                                                        Output additional information about the PKCS#12 file structure, algorithms used and iteration counts.

                                                                                                                                      • -nomacver

                                                                                                                                        Don't attempt to verify the integrity MAC.

                                                                                                                                      • -clcerts

                                                                                                                                        Only output client certificates (not CA certificates).

                                                                                                                                      • -cacerts

                                                                                                                                        Only output CA certificates (not client certificates).

                                                                                                                                      • -aes128, -aes192, -aes256

                                                                                                                                        Use AES to encrypt private keys before outputting.

                                                                                                                                      • -aria128, -aria192, -aria256

                                                                                                                                        Use ARIA to encrypt private keys before outputting.

                                                                                                                                      • -camellia128, -camellia192, -camellia256

                                                                                                                                        Use Camellia to encrypt private keys before outputting.

                                                                                                                                      • -des

                                                                                                                                        Use DES to encrypt private keys before outputting.

                                                                                                                                      • -des3

                                                                                                                                        Use triple DES to encrypt private keys before outputting.

                                                                                                                                      • -idea

                                                                                                                                        Use IDEA to encrypt private keys before outputting.

                                                                                                                                      • -noenc

                                                                                                                                        Don't encrypt private keys at all.

                                                                                                                                      • -nodes

                                                                                                                                        This option is deprecated since OpenSSL 3.0; use -noenc instead.

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#pkcs12-output-export-options","title":"PKCS#12 output (export) options","text":"
                                                                                                                                      • -export

                                                                                                                                        This option specifies that a PKCS#12 file will be created rather than parsed.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies filename to write the PKCS#12 file to. Standard output is used by default.

                                                                                                                                      • -in filename|uri

                                                                                                                                        This specifies the input filename or URI. Standard input is used by default. With the -export option this is a file with certificates and a key, or a URI that refers to a key accessed via an engine. The order of credentials in a file doesn't matter but one private key and its corresponding certificate should be present. If additional certificates are present they will also be included in the PKCS#12 output file.

                                                                                                                                      • -inkey filename|uri

                                                                                                                                        The private key input for PKCS12 output. If this option is not specified then the input file (-in argument) must contain a private key. If no engine is used, the argument is taken as a file. If the -engine option is used or the URI has prefix org.openssl.engine: then the rest of the URI is taken as key identifier for the given engine.

                                                                                                                                      • -certfile filename

                                                                                                                                        An input file with extra certificates to be added to the PKCS#12 output if the -export option is given.

                                                                                                                                      • -passcerts arg

                                                                                                                                        The password source for certificate input such as -certfile and -untrusted. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -chain

                                                                                                                                        If this option is present then the certificate chain of the end entity certificate is built and included in the PKCS#12 output file. The end entity certificate is the first one read from the -in file if no key is given, else the first certificate matching the given key. The standard CA trust store is used for chain building, as well as any untrusted CA certificates given with the -untrusted option.

                                                                                                                                      • -untrusted filename

                                                                                                                                        An input file of untrusted certificates that may be used for chain building, which is relevant only when a PKCS#12 file is created with the -export option and the -chain option is given as well. Any certificates that are actually part of the chain are added to the output.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -name friendlyname

                                                                                                                                        This specifies the \"friendly name\" for the certificates and private key. This name is typically displayed in list boxes by software importing the file.

                                                                                                                                      • -caname friendlyname

                                                                                                                                        This specifies the \"friendly name\" for other certificates. This option may be used multiple times to specify names for all certificates in the order they appear. Netscape ignores friendly names on other certificates whereas MSIE displays them.

                                                                                                                                      • -CSP name

                                                                                                                                        Write name as a Microsoft CSP name. The password source for the input, and for encrypting any private keys that are output. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -LMK

                                                                                                                                        Add the \"Local Key Set\" identifier to the attributes.

                                                                                                                                      • -keyex|-keysig

                                                                                                                                        Specifies that the private key is to be used for key exchange or just signing. This option is only interpreted by MSIE and similar MS software. Normally \"export grade\" software will only allow 512 bit RSA keys to be used for encryption purposes but arbitrary length keys for signing. The -keysig option marks the key for signing only. Signing only keys can be used for S/MIME signing, authenticode (ActiveX control signing) and SSL client authentication, however, due to a bug only MSIE 5.0 and later support the use of signing only keys for SSL client authentication.

                                                                                                                                      • -keypbe alg, -certpbe alg

                                                                                                                                        These options allow the algorithm used to encrypt the private key and certificates to be selected. Any PKCS#5 v1.5 or PKCS#12 PBE algorithm name can be used (see \"NOTES\" section for more information). If a cipher name (as output by openssl list -cipher-algorithms) is specified then it is used with PKCS#5 v2.0. For interoperability reasons it is advisable to only use PKCS#12 algorithms.

                                                                                                                                        Special value NONE disables encryption of the private key and certificates.

                                                                                                                                      • -descert

                                                                                                                                        Encrypt the certificates using triple DES. By default the private key and the certificates are encrypted using AES-256-CBC unless the '-legacy' option is used. If '-descert' is used with the '-legacy' then both, the private key and the certificates are encrypted using triple DES.

                                                                                                                                      • -macalg digest

                                                                                                                                        Specify the MAC digest algorithm. If not included SHA256 will be used.

                                                                                                                                      • -iter count

                                                                                                                                        This option specifies the iteration count for the encryption key and MAC. The default value is 2048.

                                                                                                                                        To discourage attacks by using large dictionaries of common passwords the algorithm that derives keys from passwords can have an iteration count applied to it: this causes a certain part of the algorithm to be repeated and slows it down. The MAC is used to check the file integrity but since it will normally have the same password as the keys and certificates it could also be attacked.

                                                                                                                                      • -noiter, -nomaciter

                                                                                                                                        By default both encryption and MAC iteration counts are set to 2048, using these options the MAC and encryption iteration counts can be set to 1, since this reduces the file security you should not use these options unless you really have to. Most software supports both MAC and encryption iteration counts. MSIE 4.0 doesn't support MAC iteration counts so it needs the -nomaciter option.

                                                                                                                                      • -maciter

                                                                                                                                        This option is included for compatibility with previous versions, it used to be needed to use MAC iterations counts but they are now used by default.

                                                                                                                                      • -nomac

                                                                                                                                        Do not attempt to provide the MAC integrity. This can be useful with the FIPS provider as the PKCS12 MAC requires PKCS12KDF which is not an approved FIPS algorithm and cannot be supported by the FIPS provider.

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#notes","title":"NOTES","text":"

                                                                                                                                      Although there are a large number of options most of them are very rarely used. For PKCS#12 file parsing only -in and -out need to be used for PKCS#12 file creation -export and -name are also used.

                                                                                                                                      If none of the -clcerts, -cacerts or -nocerts options are present then all certificates will be output in the order they appear in the input PKCS#12 files. There is no guarantee that the first certificate present is the one corresponding to the private key. Certain software which tries to get a private key and the corresponding certificate might assume that the first certificate in the file is the one corresponding to the private key, but that may not always be the case. Using the -clcerts option will solve this problem by only outputting the certificate corresponding to the private key. If the CA certificates are required then they can be output to a separate file using the -nokeys -cacerts options to just output CA certificates.

                                                                                                                                      The -keypbe and -certpbe algorithms allow the precise encryption algorithms for private keys and certificates to be specified. Normally the defaults are fine but occasionally software can't handle triple DES encrypted private keys, then the option -keypbe PBE-SHA1-RC2-40 can be used to reduce the private key encryption to 40 bit RC2. A complete description of all algorithms is contained in openssl-pkcs8(1).

                                                                                                                                      Prior 1.1 release passwords containing non-ASCII characters were encoded in non-compliant manner, which limited interoperability, in first hand with Windows. But switching to standard-compliant password encoding poses problem accessing old data protected with broken encoding. For this reason even legacy encodings is attempted when reading the data. If you use PKCS#12 files in production application you are advised to convert the data, because implemented heuristic approach is not MT-safe, its sole goal is to facilitate the data upgrade with this command.

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Parse a PKCS#12 file and output it to a PEM file:

                                                                                                                                      openssl pkcs12 -in file.p12 -out file.pem\n

                                                                                                                                      Output only client certificates to a file:

                                                                                                                                      openssl pkcs12 -in file.p12 -clcerts -out file.pem\n

                                                                                                                                      Don't encrypt the private key:

                                                                                                                                      openssl pkcs12 -in file.p12 -out file.pem -noenc\n

                                                                                                                                      Print some info about a PKCS#12 file:

                                                                                                                                      openssl pkcs12 -in file.p12 -info -noout\n

                                                                                                                                      Print some info about a PKCS#12 file in legacy mode:

                                                                                                                                      openssl pkcs12 -in file.p12 -info -noout -legacy\n

                                                                                                                                      Create a PKCS#12 file from a PEM file that may contain a key and certificates:

                                                                                                                                      openssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\"\n

                                                                                                                                      Include some extra certificates:

                                                                                                                                      openssl pkcs12 -export -in file.pem -out file.p12 -name \"My PSE\" \\\n -certfile othercerts.pem\n

                                                                                                                                      Export a PKCS#12 file with data from a certificate PEM file and from a further PEM file containing a key, with default algorithms as in the legacy provider:

                                                                                                                                      openssl pkcs12 -export -in cert.pem -inkey key.pem -out file.p12 -legacy\n
                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkcs8(1), ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0. The -nodes option was deprecated in OpenSSL 3.0, too; use -noenc instead.

                                                                                                                                      "},{"location":"man1/openssl-pkcs12/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-pkcs7/","title":"openssl-pkcs7","text":""},{"location":"man1/openssl-pkcs7/#name","title":"NAME","text":"

                                                                                                                                      openssl-pkcs7 - PKCS#7 command

                                                                                                                                      "},{"location":"man1/openssl-pkcs7/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl pkcs7 [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-out filename] [-print] [-print_certs] [-text] [-noout] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-pkcs7/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes PKCS#7 files. Note that it only understands PKCS#7 v 1.5 as specified in IETF RFC 2315. It cannot currently parse CMS as described in IETF RFC 2630.

                                                                                                                                      "},{"location":"man1/openssl-pkcs7/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM, -outform DER|PEM

                                                                                                                                        The input and formats; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        The data is a PKCS#7 Version 1.5 structure.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read from or standard input if this option is not specified.

                                                                                                                                      • -out filename

                                                                                                                                        Specifies the output filename to write to or standard output by default.

                                                                                                                                      • -print

                                                                                                                                        Print out the full PKCS7 object.

                                                                                                                                      • -print_certs

                                                                                                                                        Prints out any certificates or CRLs contained in the file. They are preceded by their subject and issuer names in one line format.

                                                                                                                                      • -text

                                                                                                                                        Prints out certificate details in full rather than just subject and issuer names.

                                                                                                                                      • -noout

                                                                                                                                        Don't output the encoded version of the PKCS#7 structure (or certificates if -print_certs is set).

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-pkcs7/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Convert a PKCS#7 file from PEM to DER:

                                                                                                                                      openssl pkcs7 -in file.pem -outform DER -out file.der\n

                                                                                                                                      Output all certificates in a file:

                                                                                                                                      openssl pkcs7 -in file.pem -print_certs -out certs.pem\n
                                                                                                                                      "},{"location":"man1/openssl-pkcs7/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-crl2pkcs7(1)

                                                                                                                                      "},{"location":"man1/openssl-pkcs7/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-pkcs7/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/","title":"openssl-pkcs8","text":""},{"location":"man1/openssl-pkcs8/#name","title":"NAME","text":"

                                                                                                                                      openssl-pkcs8 - PKCS#8 format private key conversion command

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl pkcs8 [-help] [-topk8] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-passin arg] [-out filename] [-passout arg] [-iter count] [-noiter] [-nocrypt] [-traditional] [-v2 alg] [-v2prf alg] [-v1 alg] [-scrypt] [-scrypt_N N] [-scrypt_r r] [-scrypt_p p] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes private keys in PKCS#8 format. It can handle both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo format with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms.

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -topk8

                                                                                                                                        Normally a PKCS#8 private key is expected on input and a private key will be written to the output file. With the -topk8 option the situation is reversed: it reads a private key and writes a PKCS#8 format key.

                                                                                                                                      • -inform DER|PEM, -outform DER|PEM

                                                                                                                                        The input and formats; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        If a key is being converted from PKCS#8 form (i.e. the -topk8 option is not used) then the input file must be in PKCS#8 format. An encrypted key is expected unless -nocrypt is included.

                                                                                                                                        If -topk8 is not used and PEM mode is set the output file will be an unencrypted private key in PKCS#8 format. If the -traditional option is used then a traditional format private key is written instead.

                                                                                                                                        If -topk8 is not used and DER mode is set the output file will be an unencrypted private key in traditional DER format.

                                                                                                                                        If -topk8 is used then any supported private key can be used for the input file in a format specified by -inform. The output file will be encrypted PKCS#8 format using the specified encryption parameters unless -nocrypt is included.

                                                                                                                                      • -traditional

                                                                                                                                        When this option is present and -topk8 is not a traditional format private key is written.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

                                                                                                                                      • -passin arg, -passout arg

                                                                                                                                        The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write a key to or standard output by default. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

                                                                                                                                      • -iter count

                                                                                                                                        When creating new PKCS#8 containers, use a given number of iterations on the password in deriving the encryption key for the PKCS#8 output. High values increase the time required to brute-force a PKCS#8 container.

                                                                                                                                      • -noiter

                                                                                                                                        When creating new PKCS#8 containers, use 1 as iteration count.

                                                                                                                                      • -nocrypt

                                                                                                                                        PKCS#8 keys generated or input are normally PKCS#8 EncryptedPrivateKeyInfo structures using an appropriate password based encryption algorithm. With this option an unencrypted PrivateKeyInfo structure is expected or output. This option does not encrypt private keys at all and should only be used when absolutely necessary. Certain software such as some versions of Java code signing software used unencrypted private keys.

                                                                                                                                      • -v2 alg

                                                                                                                                        This option sets the PKCS#5 v2.0 algorithm.

                                                                                                                                        The alg argument is the encryption algorithm to use, valid values include aes128, aes256 and des3. If this option isn't specified then aes256 is used.

                                                                                                                                      • -v2prf alg

                                                                                                                                        This option sets the PRF algorithm to use with PKCS#5 v2.0. A typical value value would be hmacWithSHA256. If this option isn't set then the default for the cipher is used or hmacWithSHA256 if there is no default.

                                                                                                                                        Some implementations may not support custom PRF algorithms and may require the hmacWithSHA1 option to work.

                                                                                                                                      • -v1 alg

                                                                                                                                        This option indicates a PKCS#5 v1.5 or PKCS#12 algorithm should be used. Some older implementations may not support PKCS#5 v2.0 and may require this option. If not specified PKCS#5 v2.0 form is used.

                                                                                                                                      • -scrypt

                                                                                                                                        Uses the scrypt algorithm for private key encryption using default parameters: currently N=16384, r=8 and p=1 and AES in CBC mode with a 256 bit key. These parameters can be modified using the -scrypt_N, -scrypt_r, -scrypt_p and -v2 options.

                                                                                                                                      • -scrypt_N N, -scrypt_r r, -scrypt_p p

                                                                                                                                        Sets the scrypt N, r or p parameters.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#notes","title":"NOTES","text":"

                                                                                                                                      By default, when converting a key to PKCS#8 format, PKCS#5 v2.0 using 256 bit AES with HMAC and SHA256 is used.

                                                                                                                                      Some older implementations do not support PKCS#5 v2.0 format and require the older PKCS#5 v1.5 form instead, possibly also requiring insecure weak encryption algorithms such as 56 bit DES.

                                                                                                                                      Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration counts are more secure that those encrypted using the traditional SSLeay compatible formats. So if additional security is considered important the keys should be converted.

                                                                                                                                      It is possible to write out DER encoded encrypted private keys in PKCS#8 format because the encryption details are included at an ASN1 level whereas the traditional format includes them at a PEM level.

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#pkcs5-v15-and-pkcs12-algorithms","title":"PKCS#5 V1.5 AND PKCS#12 ALGORITHMS","text":"

                                                                                                                                      Various algorithms can be used with the -v1 command line option, including PKCS#5 v1.5 and PKCS#12. These are described in more detail below.

                                                                                                                                      • PBE-MD2-DES PBE-MD5-DES

                                                                                                                                        These algorithms were included in the original PKCS#5 v1.5 specification. They only offer 56 bits of protection since they both use DES.

                                                                                                                                      • PBE-SHA1-RC2-64, PBE-MD2-RC2-64, PBE-MD5-RC2-64, PBE-SHA1-DES

                                                                                                                                        These algorithms are not mentioned in the original PKCS#5 v1.5 specification but they use the same key derivation algorithm and are supported by some software. They are mentioned in PKCS#5 v2.0. They use either 64 bit RC2 or 56 bit DES.

                                                                                                                                      • PBE-SHA1-RC4-128, PBE-SHA1-RC4-40, PBE-SHA1-3DES, PBE-SHA1-2DES, PBE-SHA1-RC2-128, PBE-SHA1-RC2-40

                                                                                                                                        These algorithms use the PKCS#12 password based encryption algorithm and allow strong encryption algorithms like triple DES or 128 bit RC2 to be used.

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Convert a private key to PKCS#8 format using default parameters (AES with 256 bit key and hmacWithSHA256):

                                                                                                                                      openssl pkcs8 -in key.pem -topk8 -out enckey.pem\n

                                                                                                                                      Convert a private key to PKCS#8 unencrypted format:

                                                                                                                                      openssl pkcs8 -in key.pem -topk8 -nocrypt -out enckey.pem\n

                                                                                                                                      Convert a private key to PKCS#5 v2.0 format using triple DES:

                                                                                                                                      openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem\n

                                                                                                                                      Convert a private key to PKCS#5 v2.0 format using AES with 256 bits in CBC mode and hmacWithSHA512 PRF:

                                                                                                                                      openssl pkcs8 -in key.pem -topk8 -v2 aes-256-cbc -v2prf hmacWithSHA512 -out enckey.pem\n

                                                                                                                                      Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm (DES):

                                                                                                                                      openssl pkcs8 -in key.pem -topk8 -v1 PBE-MD5-DES -out enckey.pem\n

                                                                                                                                      Convert a private key to PKCS#8 using a PKCS#12 compatible algorithm (3DES):

                                                                                                                                      openssl pkcs8 -in key.pem -topk8 -out enckey.pem -v1 PBE-SHA1-3DES\n

                                                                                                                                      Read a DER unencrypted PKCS#8 format private key:

                                                                                                                                      openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem\n

                                                                                                                                      Convert a private key from any PKCS#8 encrypted format to traditional format:

                                                                                                                                      openssl pkcs8 -in pk8.pem -traditional -out key.pem\n

                                                                                                                                      Convert a private key to PKCS#8 format, encrypting with AES-256 and with one million iterations of the password:

                                                                                                                                      openssl pkcs8 -in key.pem -topk8 -v2 aes-256-cbc -iter 1000000 -out pk8.pem\n
                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#standards","title":"STANDARDS","text":"

                                                                                                                                      Test vectors from this PKCS#5 v2.0 implementation were posted to the pkcs-tng mailing list using triple DES, DES and RC2 with high iteration counts, several people confirmed that they could decrypt the private keys produced and therefore, it can be assumed that the PKCS#5 v2.0 implementation is reasonably accurate at least as far as these algorithms are concerned.

                                                                                                                                      The format of PKCS#8 DSA (and other) private keys is not well documented: it is hidden away in PKCS#11 v2.01, section 11.9. OpenSSL's default DSA PKCS#8 private key format complies with this standard.

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#bugs","title":"BUGS","text":"

                                                                                                                                      There should be an option that prints out the encryption algorithm in use and other details such as the iteration count.

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-dsa(1), openssl-rsa(1), openssl-genrsa(1), openssl-gendsa(1)

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#history","title":"HISTORY","text":"

                                                                                                                                      The -iter option was added in OpenSSL 1.1.0.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-pkcs8/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-pkey/","title":"openssl-pkey","text":""},{"location":"man1/openssl-pkey/#name","title":"NAME","text":"

                                                                                                                                      openssl-pkey - public or private key processing command

                                                                                                                                      "},{"location":"man1/openssl-pkey/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl pkey [-help] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [-check] [-pubcheck] [-in filename|uri] [-inform DER|PEM|P12|ENGINE] [-passin arg] [-pubin] [-out filename] [-outform DER|PEM] [-cipher] [-passout arg] [-traditional] [-pubout] [-noout] [-text] [-text_pub] [-ec_conv_form arg] [-ec_param_enc arg]

                                                                                                                                      "},{"location":"man1/openssl-pkey/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes public or private keys. They can be converted between various forms and their components printed.

                                                                                                                                      "},{"location":"man1/openssl-pkey/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-pkey/#general-options","title":"General options","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -check

                                                                                                                                        This option checks the consistency of a key pair for both public and private components.

                                                                                                                                      • -pubcheck

                                                                                                                                        This option checks the correctness of either a public key or the public component of a key pair.

                                                                                                                                      "},{"location":"man1/openssl-pkey/#input-options","title":"Input options","text":"
                                                                                                                                      • -in filename|uri

                                                                                                                                        This specifies the input to read a key from or standard input if this option is not specified. If the key input is encrypted and -passin is not given a pass phrase will be prompted for.

                                                                                                                                      • -inform DER|PEM|P12|ENGINE

                                                                                                                                        The key input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -passin arg

                                                                                                                                        The password source for the key input.

                                                                                                                                        For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -pubin

                                                                                                                                        By default a private key is read from the input. With this option only the public components are read.

                                                                                                                                      "},{"location":"man1/openssl-pkey/#output-options","title":"Output options","text":"
                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to save the encoded and/or text output of key or standard output if this option is not specified. If any cipher option is set but no -passout is given then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The key output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                      • -cipher

                                                                                                                                        Encrypt the PEM encoded private key with the supplied cipher. Any algorithm name accepted by EVP_get_cipherbyname() is acceptable such as aes128. Encryption is not supported for DER output.

                                                                                                                                      • -passout arg

                                                                                                                                        The password source for the output file.

                                                                                                                                        For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -traditional

                                                                                                                                        Normally a private key is written using standard format: this is PKCS#8 form with the appropriate encryption algorithm (if any). If the -traditional option is specified then the older \"traditional\" format is used instead.

                                                                                                                                      • -pubout

                                                                                                                                        By default the private and public key is output; this option restricts the output to the public components. This option is automatically set if the input is a public key.

                                                                                                                                        When combined with -text, this is equivalent to -text_pub.

                                                                                                                                      • -noout

                                                                                                                                        Do not output the key in encoded form.

                                                                                                                                      • -text

                                                                                                                                        Output the various key components in plain text (possibly in addition to the PEM encoded form). This cannot be combined with encoded output in DER format.

                                                                                                                                      • -text_pub

                                                                                                                                        Output in text form only the public key components (also for private keys). This cannot be combined with encoded output in DER format.

                                                                                                                                      • -ec_conv_form arg

                                                                                                                                        This option only applies to elliptic-curve based keys.

                                                                                                                                        This specifies how the points on the elliptic curve are converted into octet strings. Possible values are: compressed (the default value), uncompressed and hybrid. For more information regarding the point conversion forms please read the X9.62 standard. Note Due to patent issues the compressed option is disabled by default for binary curves and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at compile time.

                                                                                                                                      • -ec_param_enc arg

                                                                                                                                        This option only applies to elliptic curve based public and private keys.

                                                                                                                                        This specifies how the elliptic curve parameters are encoded. Possible value are: named_curve, i.e. the ec parameters are specified by an OID, or explicit where the ec parameters are explicitly given (see RFC 3279 for the definition of the EC parameters structures). The default value is named_curve. Note the implicitlyCA alternative, as specified in RFC 3279, is currently not implemented in OpenSSL.

                                                                                                                                      "},{"location":"man1/openssl-pkey/#examples","title":"EXAMPLES","text":"

                                                                                                                                      To remove the pass phrase on a private key:

                                                                                                                                      openssl pkey -in key.pem -out keyout.pem\n

                                                                                                                                      To encrypt a private key using triple DES:

                                                                                                                                      openssl pkey -in key.pem -des3 -out keyout.pem\n

                                                                                                                                      To convert a private key from PEM to DER format:

                                                                                                                                      openssl pkey -in key.pem -outform DER -out keyout.der\n

                                                                                                                                      To print out the components of a private key to standard output:

                                                                                                                                      openssl pkey -in key.pem -text -noout\n

                                                                                                                                      To print out the public components of a private key to standard output:

                                                                                                                                      openssl pkey -in key.pem -text_pub -noout\n

                                                                                                                                      To just output the public part of a private key:

                                                                                                                                      openssl pkey -in key.pem -pubout -out pubkey.pem\n

                                                                                                                                      To change the EC parameters encoding to explicit:

                                                                                                                                      openssl pkey -in key.pem -ec_param_enc explicit -out keyout.pem\n

                                                                                                                                      To change the EC point conversion form to compressed:

                                                                                                                                      openssl pkey -in key.pem -ec_conv_form compressed -out keyout.pem\n
                                                                                                                                      "},{"location":"man1/openssl-pkey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-genpkey(1), openssl-rsa(1), openssl-pkcs8(1), openssl-dsa(1), openssl-genrsa(1), openssl-gendsa(1)

                                                                                                                                      "},{"location":"man1/openssl-pkey/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-pkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/","title":"openssl-pkeyparam","text":""},{"location":"man1/openssl-pkeyparam/#name","title":"NAME","text":"

                                                                                                                                      openssl-pkeyparam - public key algorithm parameter processing command

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl pkeyparam [-help] [-in filename] [-out filename] [-text] [-noout] [-check] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes public key algorithm parameters. They can be checked for correctness and their components printed out.

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read parameters from or standard input if this option is not specified.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write parameters to or standard output if this option is not specified.

                                                                                                                                      • -text

                                                                                                                                        Prints out the parameters in plain text in addition to the encoded version.

                                                                                                                                      • -noout

                                                                                                                                        Do not output the encoded version of the parameters.

                                                                                                                                      • -check

                                                                                                                                        This option checks the correctness of parameters.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Print out text version of parameters:

                                                                                                                                      openssl pkeyparam -in param.pem -text\n
                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#notes","title":"NOTES","text":"

                                                                                                                                      There are no -inform or -outform options for this command because only PEM format is supported because the key type is determined by the PEM headers.

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-genpkey(1), openssl-rsa(1), openssl-pkcs8(1), openssl-dsa(1), openssl-genrsa(1), openssl-gendsa(1)

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-pkeyparam/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/","title":"openssl-pkeyutl","text":""},{"location":"man1/openssl-pkeyutl/#name","title":"NAME","text":"

                                                                                                                                      openssl-pkeyutl - public key algorithm command

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl pkeyutl [-help] [-in file] [-rawin] [-digest algorithm] [-out file] [-sigfile file] [-inkey filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-peerkey file] [-peerform DER|PEM|P12|ENGINE] [-pubin] [-certin] [-rev] [-sign] [-verify] [-verifyrecover] [-encrypt] [-decrypt] [-derive] [-kdf algorithm] [-kdflen length] [-pkeyopt opt:value] [-pkeyopt_passin opt[:passarg]] [-hexdump] [-asn1parse] [-engine id] [-engine_impl] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [-config configfile]

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command can be used to perform low-level public key operations using any supported algorithm.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read data from or standard input if this option is not specified.

                                                                                                                                      • -rawin

                                                                                                                                        This indicates that the input data is raw data, which is not hashed by any message digest algorithm. The user can specify a digest algorithm by using the -digest option. This option can only be used with -sign and -verify and must be used with the Ed25519 and Ed448 algorithms.

                                                                                                                                      • -digest algorithm

                                                                                                                                        This specifies the digest algorithm which is used to hash the input data before signing or verifying it with the input key. This option could be omitted if the signature algorithm does not require one (for instance, EdDSA). If this option is omitted but the signature algorithm requires one, a default value will be used. For signature algorithms like RSA, DSA and ECDSA, SHA-256 will be the default digest algorithm. For SM2, it will be SM3. If this option is present, then the -rawin option must be also specified.

                                                                                                                                      • -out filename

                                                                                                                                        Specifies the output filename to write to or standard output by default.

                                                                                                                                      • -sigfile file

                                                                                                                                        Signature file, required for -verify operations only

                                                                                                                                      • -inkey filename|uri

                                                                                                                                        The input key, by default it should be a private key.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The key format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -passin arg

                                                                                                                                        The input key password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -peerkey file

                                                                                                                                        The peer key file, used by key derivation (agreement) operations.

                                                                                                                                      • -peerform DER|PEM|P12|ENGINE

                                                                                                                                        The peer key format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -pubin

                                                                                                                                        The input file is a public key.

                                                                                                                                      • -certin

                                                                                                                                        The input is a certificate containing a public key.

                                                                                                                                      • -rev

                                                                                                                                        Reverse the order of the input buffer. This is useful for some libraries (such as CryptoAPI) which represent the buffer in little endian format.

                                                                                                                                      • -sign

                                                                                                                                        Sign the input data (which must be a hash) and output the signed result. This requires a private key.

                                                                                                                                      • -verify

                                                                                                                                        Verify the input data (which must be a hash) against the signature file and indicate if the verification succeeded or failed.

                                                                                                                                      • -verifyrecover

                                                                                                                                        Verify the input data (which must be a hash) and output the recovered data.

                                                                                                                                      • -encrypt

                                                                                                                                        Encrypt the input data using a public key.

                                                                                                                                      • -decrypt

                                                                                                                                        Decrypt the input data using a private key.

                                                                                                                                      • -derive

                                                                                                                                        Derive a shared secret using the peer key.

                                                                                                                                      • -kdf algorithm

                                                                                                                                        Use key derivation function algorithm. The supported algorithms are at present TLS1-PRF and HKDF. Note: additional parameters and the KDF output length will normally have to be set for this to work. See EVP_PKEY_CTX_set_hkdf_md(3) and EVP_PKEY_CTX_set_tls1_prf_md(3) for the supported string parameters of each algorithm.

                                                                                                                                      • -kdflen length

                                                                                                                                        Set the output length for KDF.

                                                                                                                                      • -pkeyopt opt:value

                                                                                                                                        Public key options specified as opt:value. See NOTES below for more details.

                                                                                                                                      • -pkeyopt_passin opt[:passarg]

                                                                                                                                        Allows reading a public key option opt from stdin or a password source. If only opt is specified, the user will be prompted to enter a password on stdin. Alternatively, passarg can be specified which can be any value supported by openssl-passphrase-options(1).

                                                                                                                                      • -hexdump

                                                                                                                                        hex dump the output data.

                                                                                                                                      • -asn1parse

                                                                                                                                        Parse the ASN.1 output data, this is useful when combined with the -verifyrecover option when an ASN1 structure is signed.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -engine_impl

                                                                                                                                        When used with the -engine option, it specifies to also use engine id for crypto operations.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -config configfile

                                                                                                                                        See \"Configuration Option\" in openssl(1).

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#notes","title":"NOTES","text":"

                                                                                                                                      The operations and options supported vary according to the key algorithm and its implementation. The OpenSSL operations and options are indicated below.

                                                                                                                                      Unless otherwise mentioned all algorithms support the digest:alg option which specifies the digest in use for sign, verify and verifyrecover operations. The value alg should represent a digest name as used in the EVP_get_digestbyname() function for example sha1. This value is not used to hash the input data. It is used (by some algorithms) for sanity-checking the lengths of data passed in and for creating the structures that make up the signature (e.g. DigestInfo in RSASSA PKCS#1 v1.5 signatures).

                                                                                                                                      This command does not hash the input data (except where -rawin is used) but rather it will use the data directly as input to the signature algorithm. Depending on the key type, signature type, and mode of padding, the maximum acceptable lengths of input data differ. The signed data can't be longer than the key modulus with RSA. In case of ECDSA and DSA the data shouldn't be longer than the field size, otherwise it will be silently truncated to the field size. In any event the input size must not be larger than the largest supported digest size.

                                                                                                                                      In other words, if the value of digest is sha1 the input should be the 20 bytes long binary encoding of the SHA-1 hash function output.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#rsa-algorithm","title":"RSA ALGORITHM","text":"

                                                                                                                                      The RSA algorithm generally supports the encrypt, decrypt, sign, verify and verifyrecover operations. However, some padding modes support only a subset of these operations. The following additional pkeyopt values are supported:

                                                                                                                                      • rsa_padding_mode:mode

                                                                                                                                        This sets the RSA padding mode. Acceptable values for mode are pkcs1 for PKCS#1 padding, none for no padding, oaep for OAEP mode, x931 for X9.31 mode and pss for PSS.

                                                                                                                                        In PKCS#1 padding, if the message digest is not set, then the supplied data is signed or verified directly instead of using a DigestInfo structure. If a digest is set, then the DigestInfo structure is used and its length must correspond to the digest type.

                                                                                                                                        For oaep mode only encryption and decryption is supported.

                                                                                                                                        For x931 if the digest type is set it is used to format the block data otherwise the first byte is used to specify the X9.31 digest ID. Sign, verify and verifyrecover are can be performed in this mode.

                                                                                                                                        For pss mode only sign and verify are supported and the digest type must be specified.

                                                                                                                                      • rsa_pss_saltlen:len

                                                                                                                                        For pss mode only this option specifies the salt length. Three special values are supported: digest sets the salt length to the digest length, max sets the salt length to the maximum permissible value. When verifying auto causes the salt length to be automatically determined based on the PSS block structure.

                                                                                                                                      • rsa_mgf1_md:digest

                                                                                                                                        For PSS and OAEP padding sets the MGF1 digest. If the MGF1 digest is not explicitly set in PSS mode then the signing digest is used.

                                                                                                                                      • rsa_oaep_md:digest

                                                                                                                                        Sets the digest used for the OAEP hash function. If not explicitly set then SHA1 is used.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#rsa-pss-algorithm","title":"RSA-PSS ALGORITHM","text":"

                                                                                                                                      The RSA-PSS algorithm is a restricted version of the RSA algorithm which only supports the sign and verify operations with PSS padding. The following additional -pkeyopt values are supported:

                                                                                                                                      • rsa_padding_mode:mode, rsa_pss_saltlen:len, rsa_mgf1_md:digest

                                                                                                                                        These have the same meaning as the RSA algorithm with some additional restrictions. The padding mode can only be set to pss which is the default value.

                                                                                                                                        If the key has parameter restrictions than the digest, MGF1 digest and salt length are set to the values specified in the parameters. The digest and MG cannot be changed and the salt length cannot be set to a value less than the minimum restriction.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#dsa-algorithm","title":"DSA ALGORITHM","text":"

                                                                                                                                      The DSA algorithm supports signing and verification operations only. Currently there are no additional -pkeyopt options other than digest. The SHA1 digest is assumed by default.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#dh-algorithm","title":"DH ALGORITHM","text":"

                                                                                                                                      The DH algorithm only supports the derivation operation and no additional -pkeyopt options.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#ec-algorithm","title":"EC ALGORITHM","text":"

                                                                                                                                      The EC algorithm supports sign, verify and derive operations. The sign and verify operations use ECDSA and derive uses ECDH. SHA1 is assumed by default for the -pkeyopt digest option.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#x25519-and-x448-algorithms","title":"X25519 AND X448 ALGORITHMS","text":"

                                                                                                                                      The X25519 and X448 algorithms support key derivation only. Currently there are no additional options.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#ed25519-and-ed448-algorithms","title":"ED25519 AND ED448 ALGORITHMS","text":"

                                                                                                                                      These algorithms only support signing and verifying. OpenSSL only implements the \"pure\" variants of these algorithms so raw data can be passed directly to them without hashing them first. The option -rawin must be used with these algorithms with no -digest specified. Additionally OpenSSL only supports \"oneshot\" operation with these algorithms. This means that the entire file to be signed/verified must be read into memory before processing it. Signing or Verifying very large files should be avoided. Additionally the size of the file must be known for this to work. If the size of the file cannot be determined (for example if the input is stdin) then the sign or verify operation will fail.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#sm2","title":"SM2","text":"

                                                                                                                                      The SM2 algorithm supports sign, verify, encrypt and decrypt operations. For the sign and verify operations, SM2 requires an Distinguishing ID string to be passed in. The following -pkeyopt value is supported:

                                                                                                                                      • distid:string

                                                                                                                                        This sets the ID string used in SM2 sign or verify operations. While verifying an SM2 signature, the ID string must be the same one used when signing the data. Otherwise the verification will fail.

                                                                                                                                      • hexdistid:hex_string

                                                                                                                                        This sets the ID string used in SM2 sign or verify operations. While verifying an SM2 signature, the ID string must be the same one used when signing the data. Otherwise the verification will fail. The ID string provided with this option should be a valid hexadecimal value.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Sign some data using a private key:

                                                                                                                                      openssl pkeyutl -sign -in file -inkey key.pem -out sig\n

                                                                                                                                      Recover the signed data (e.g. if an RSA key is used):

                                                                                                                                      openssl pkeyutl -verifyrecover -in sig -inkey key.pem\n

                                                                                                                                      Verify the signature (e.g. a DSA key):

                                                                                                                                      openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem\n

                                                                                                                                      Sign data using a message digest value (this is currently only valid for RSA):

                                                                                                                                      openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256\n

                                                                                                                                      Derive a shared secret value:

                                                                                                                                      openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret\n

                                                                                                                                      Hexdump 48 bytes of TLS1 PRF using digest SHA256 and shared secret and seed consisting of the single byte 0xFF:

                                                                                                                                      openssl pkeyutl -kdf TLS1-PRF -kdflen 48 -pkeyopt md:SHA256 \\\n   -pkeyopt hexsecret:ff -pkeyopt hexseed:ff -hexdump\n

                                                                                                                                      Derive a key using scrypt where the password is read from command line:

                                                                                                                                      openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyopt_passin pass \\\n   -pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1\n

                                                                                                                                      Derive using the same algorithm, but read key from environment variable MYPASS:

                                                                                                                                      openssl pkeyutl -kdf scrypt -kdflen 16 -pkeyopt_passin pass:env:MYPASS \\\n   -pkeyopt hexsalt:aabbcc -pkeyopt N:16384 -pkeyopt r:8 -pkeyopt p:1\n

                                                                                                                                      Sign some data using an SM2(7) private key and a specific ID:

                                                                                                                                      openssl pkeyutl -sign -in file -inkey sm2.key -out sig -rawin -digest sm3 \\\n   -pkeyopt distid:someid\n

                                                                                                                                      Verify some data using an SM2(7) certificate and a specific ID:

                                                                                                                                      openssl pkeyutl -verify -certin -in file -inkey sm2.cert -sigfile sig \\\n   -rawin -digest sm3 -pkeyopt distid:someid\n

                                                                                                                                      Decrypt some data using a private key with OAEP padding using SHA256:

                                                                                                                                      openssl pkeyutl -decrypt -in file -inkey key.pem -out secret \\\n   -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256\n
                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-genpkey(1), openssl-pkey(1), openssl-rsautl(1) openssl-dgst(1), openssl-rsa(1), openssl-genrsa(1), openssl-kdf(1) EVP_PKEY_CTX_set_hkdf_md(3), EVP_PKEY_CTX_set_tls1_prf_md(3),

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-pkeyutl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-prime/","title":"openssl-prime","text":""},{"location":"man1/openssl-prime/#name","title":"NAME","text":"

                                                                                                                                      openssl-prime - compute prime numbers

                                                                                                                                      "},{"location":"man1/openssl-prime/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl prime [-help] [-hex] [-generate] [-bits num] [-safe] [-provider name] [-provider-path path] [-propquery propq] [-checks num] [number ...]

                                                                                                                                      "},{"location":"man1/openssl-prime/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command checks if the specified numbers are prime.

                                                                                                                                      If no numbers are given on the command line, the -generate flag should be used to generate primes according to the requirements specified by the rest of the flags.

                                                                                                                                      "},{"location":"man1/openssl-prime/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Display an option summary.

                                                                                                                                      • -hex

                                                                                                                                        Generate hex output.

                                                                                                                                      • -generate

                                                                                                                                        Generate a prime number.

                                                                                                                                      • -bits num

                                                                                                                                        Generate a prime with num bits.

                                                                                                                                      • -safe

                                                                                                                                        When used with -generate, generates a \"safe\" prime. If the number generated is n, then check that (_n_-1)/2 is also prime.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -checks num

                                                                                                                                        This parameter is ignored.

                                                                                                                                      "},{"location":"man1/openssl-prime/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-rand/","title":"openssl-rand","text":""},{"location":"man1/openssl-rand/#name","title":"NAME","text":"

                                                                                                                                      openssl-rand - generate pseudo-random bytes

                                                                                                                                      "},{"location":"man1/openssl-rand/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl rand [-help] [-out file] [-base64] [-hex] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] num

                                                                                                                                      "},{"location":"man1/openssl-rand/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command generates num random bytes using a cryptographically secure pseudo random number generator (CSPRNG).

                                                                                                                                      The random bytes are generated using the RAND_bytes(3) function, which provides a security level of 256 bits, provided it managed to seed itself successfully from a trusted operating system entropy source. Otherwise, the command will fail with a nonzero error code. For more details, see RAND_bytes(3), RAND(7), and EVP_RAND(7).

                                                                                                                                      "},{"location":"man1/openssl-rand/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -out file

                                                                                                                                        Write to file instead of standard output.

                                                                                                                                      • -base64

                                                                                                                                        Perform base64 encoding on the output.

                                                                                                                                      • -hex

                                                                                                                                        Show the output as a hex string.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-rand/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), RAND_bytes(3), RAND(7), EVP_RAND(7)

                                                                                                                                      "},{"location":"man1/openssl-rand/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-rand/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-rehash/","title":"openssl-rehash","text":""},{"location":"man1/openssl-rehash/#name","title":"NAME","text":"

                                                                                                                                      openssl-rehash, c_rehash - Create symbolic links to files named by the hash values

                                                                                                                                      "},{"location":"man1/openssl-rehash/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl rehash [-h] [-help] [-old] [-compat] [-n] [-v] [-provider name] [-provider-path path] [-propquery propq] [directory] ...

                                                                                                                                      c_rehash [-h] [-help] [-old] [-n] [-v] [-provider name] [-provider-path path] [-propquery propq] [directory] ...

                                                                                                                                      "},{"location":"man1/openssl-rehash/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is generally equivalent to the external script c_rehash, except for minor differences noted below.

                                                                                                                                      openssl rehash scans directories and calculates a hash value of each .pem, .crt, .cer, or .crl file in the specified directory list and creates symbolic links for each file, where the name of the link is the hash value. (If the platform does not support symbolic links, a copy is made.) This command is useful as many programs that use OpenSSL require directories to be set up like this in order to find certificates.

                                                                                                                                      If any directories are named on the command line, then those are processed in turn. If not, then the SSL_CERT_DIR environment variable is consulted; this should be a colon-separated list of directories, like the Unix PATH variable. If that is not set then the default directory (installation-specific but often /usr/local/ssl/certs) is processed.

                                                                                                                                      In order for a directory to be processed, the user must have write permissions on that directory, otherwise an error will be generated.

                                                                                                                                      The links created are of the form HHHHHHHH.D, where each H is a hexadecimal character and D is a single decimal digit. When a directory is processed, all links in it that have a name in that syntax are first removed, even if they are being used for some other purpose. To skip the removal step, use the -n flag. Hashes for CRL's look similar except the letter r appears after the period, like this: HHHHHHHH.rD.

                                                                                                                                      Multiple objects may have the same hash; they will be indicated by incrementing the D value. Duplicates are found by comparing the full SHA-1 fingerprint. A warning will be displayed if a duplicate is found.

                                                                                                                                      A warning will also be displayed if there are files that cannot be parsed as either a certificate or a CRL or if more than one such object appears in the file.

                                                                                                                                      "},{"location":"man1/openssl-rehash/#script-configuration","title":"Script Configuration","text":"

                                                                                                                                      The c_rehash script uses the openssl program to compute the hashes and fingerprints. If not found in the user's PATH, then set the OPENSSL environment variable to the full pathname. Any program can be used, it will be invoked as follows for either a certificate or CRL:

                                                                                                                                      $OPENSSL x509 -hash -fingerprint -noout -in FILENAME\n$OPENSSL crl -hash -fingerprint -noout -in FILENAME\n

                                                                                                                                      where FILENAME is the filename. It must output the hash of the file on the first line, and the fingerprint on the second, optionally prefixed with some text and an equals sign.

                                                                                                                                      "},{"location":"man1/openssl-rehash/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help -h

                                                                                                                                        Display a brief usage message.

                                                                                                                                      • -old

                                                                                                                                        Use old-style hashing (MD5, as opposed to SHA-1) for generating links to be used for releases before 1.0.0. Note that current versions will not use the old style.

                                                                                                                                      • -n

                                                                                                                                        Do not remove existing links. This is needed when keeping new and old-style links in the same directory.

                                                                                                                                      • -compat

                                                                                                                                        Generate links for both old-style (MD5) and new-style (SHA1) hashing. This allows releases before 1.0.0 to use these links along-side newer releases.

                                                                                                                                      • -v

                                                                                                                                        Print messages about old links removed and new links created. By default, this command only lists each directory as it is processed.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-rehash/#environment","title":"ENVIRONMENT","text":"
                                                                                                                                      • OPENSSL

                                                                                                                                        The path to an executable to use to generate hashes and fingerprints (see above).

                                                                                                                                      • SSL_CERT_DIR

                                                                                                                                        Colon separated list of directories to operate on. Ignored if directories are listed on the command line.

                                                                                                                                      "},{"location":"man1/openssl-rehash/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-crl(1), openssl-x509(1)

                                                                                                                                      "},{"location":"man1/openssl-rehash/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-req/","title":"openssl-req","text":""},{"location":"man1/openssl-req/#name","title":"NAME","text":"

                                                                                                                                      openssl-req - PKCS#10 certificate request and certificate generating command

                                                                                                                                      "},{"location":"man1/openssl-req/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl req [-help] [-inform DER|PEM] [-outform DER|PEM] [-in filename] [-passin arg] [-out filename] [-passout arg] [-text] [-pubkey] [-noout] [-verify] [-modulus] [-new] [-newkey arg] [-pkeyopt opt:value] [-noenc] [-nodes] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-keyout filename] [-keygen_engine id] [-digest] [-config filename] [-section name] [-x509] [-CA filename|uri] [-CAkey filename|uri] [-days n] [-set_serial n] [-newhdr] [-copy_extensions arg] [-addext ext] [-extensions section] [-reqexts section] [-precert] [-utf8] [-reqopt] [-subject] [-subj arg] [-multivalue-rdn] [-sigopt nm:v] [-vfyopt nm:v] [-batch] [-verbose] [-nameopt option] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-req/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command primarily creates and processes certificate requests (CSRs) in PKCS#10 format. It can additionally create self-signed certificates for use as root CAs for example.

                                                                                                                                      "},{"location":"man1/openssl-req/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM, -outform DER|PEM

                                                                                                                                        The input and output formats; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                        The data is a PKCS#10 object.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read a request from. This defaults to standard input unless -x509 or -CA is specified. A request is only read if the creation options (-new or -newkey or -precert) are not specified.

                                                                                                                                      • -sigopt nm:v

                                                                                                                                        Pass options to the signature algorithm during sign operations. Names and values of these options are algorithm-specific.

                                                                                                                                      • -vfyopt nm:v

                                                                                                                                        Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

                                                                                                                                      • -passin arg

                                                                                                                                        The password source for private key and certificate input. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -passout arg

                                                                                                                                        The password source for the output file. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write to or standard output by default.

                                                                                                                                      • -text

                                                                                                                                        Prints out the certificate request in text form.

                                                                                                                                      • -subject

                                                                                                                                        Prints out the certificate request subject (or certificate subject if -x509 is in use).

                                                                                                                                      • -pubkey

                                                                                                                                        Prints out the public key.

                                                                                                                                      • -noout

                                                                                                                                        This option prevents output of the encoded version of the certificate request.

                                                                                                                                      • -modulus

                                                                                                                                        Prints out the value of the modulus of the public key contained in the request.

                                                                                                                                      • -verify

                                                                                                                                        Verifies the self-signature on the request.

                                                                                                                                      • -new

                                                                                                                                        This option generates a new certificate request. It will prompt the user for the relevant field values. The actual fields prompted for and their maximum and minimum sizes are specified in the configuration file and any requested extensions.

                                                                                                                                        If the -key option is not given it will generate a new private key using information specified in the configuration file or given with the -newkey and -pkeyopt options, else by default an RSA key with 2048 bits length.

                                                                                                                                      • -newkey arg

                                                                                                                                        This option is used to generate a new private key unless -key is given. It is subsequently used as if it was given using the -key option.

                                                                                                                                        This option implies the -new flag to create a new certificate request or a new certificate in case -x509 is given.

                                                                                                                                        The argument takes one of several forms.

                                                                                                                                        [rsa:]nbits generates an RSA key nbits in size. If nbits is omitted, i.e., -newkey rsa is specified, the default key size specified in the configuration file with the default_bits option is used if present, else 2048.

                                                                                                                                        All other algorithms support the -newkey algname:file form, where file is an algorithm parameter file, created with openssl genpkey -genparam or an X.509 certificate for a key with appropriate algorithm.

                                                                                                                                        param:file generates a key using the parameter file or certificate file, the algorithm is determined by the parameters.

                                                                                                                                        algname[:file] generates a key using the given algorithm algname. If a parameter file file is given then the parameters specified there are used, where the algorithm parameters must match algname. If algorithm parameters are not given, any necessary parameters should be specified via the -pkeyopt option.

                                                                                                                                        dsa:filename generates a DSA key using the parameters in the file filename. ec:filename generates EC key (usable both with ECDSA or ECDH algorithms), gost2001:filename generates GOST R 34.10-2001 key (requires gost engine configured in the configuration file). If just gost2001 is specified a parameter set should be specified by -pkeyopt paramset:X

                                                                                                                                      • -pkeyopt opt:value

                                                                                                                                        Set the public key algorithm option opt to value. The precise set of options supported depends on the public key algorithm used and its implementation. See \"KEY GENERATION OPTIONS\" in openssl-genpkey(1) for more details.

                                                                                                                                      • -key filename|uri

                                                                                                                                        This option provides the private key for signing a new certificate or certificate request. Unless -in is given, the corresponding public key is placed in the new certificate or certificate request, resulting in a self-signature.

                                                                                                                                        For certificate signing this option is overridden by the -CA option.

                                                                                                                                        This option also accepts PKCS#8 format private keys for PEM format files.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The format of the private key; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -keyout filename

                                                                                                                                        This gives the filename to write any private key to that has been newly created or read from -key. If neither the -keyout option nor the -key option are given then the filename specified in the configuration file with the default_keyfile option is used, if present. Thus, if you want to write the private key and the -key option is provided, you should provide the -keyout option explicitly. If a new key is generated and no filename is specified the key is written to standard output.

                                                                                                                                      • -noenc

                                                                                                                                        If this option is specified then if a private key is created it will not be encrypted.

                                                                                                                                      • -nodes

                                                                                                                                        This option is deprecated since OpenSSL 3.0; use -noenc instead.

                                                                                                                                      • -digest

                                                                                                                                        This specifies the message digest to sign the request. Any digest supported by the OpenSSL dgst command can be used. This overrides the digest algorithm specified in the configuration file.

                                                                                                                                        Some public key algorithms may override this choice. For instance, DSA signatures always use SHA1, GOST R 34.10 signatures always use GOST R 34.11-94 (-md_gost94), Ed25519 and Ed448 never use any digest.

                                                                                                                                      • -config filename

                                                                                                                                        This allows an alternative configuration file to be specified. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

                                                                                                                                      • -section name

                                                                                                                                        Specifies the name of the section to use; the default is req.

                                                                                                                                      • -subj arg

                                                                                                                                        Sets subject name for new request or supersedes the subject name when processing a certificate request.

                                                                                                                                        The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted, but the corresponding type will not be included in the request. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

                                                                                                                                        /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

                                                                                                                                      • -multivalue-rdn

                                                                                                                                        This option has been deprecated and has no effect.

                                                                                                                                      • -x509

                                                                                                                                        This option outputs a certificate instead of a certificate request. This is typically used to generate test certificates. It is implied by the -CA option.

                                                                                                                                        This option implies the -new flag if -in is not given.

                                                                                                                                        If an existing request is specified with the -in option, it is converted to a certificate; otherwise a request is created from scratch.

                                                                                                                                        Unless specified using the -set_serial option, a large random number will be used for the serial number.

                                                                                                                                        Unless the -copy_extensions option is used, X.509 extensions are not copied from any provided request input file.

                                                                                                                                        X.509 extensions to be added can be specified in the configuration file or using the -addext option.

                                                                                                                                      • -CA filename|uri

                                                                                                                                        Specifies the \"CA\" certificate to be used for signing a new certificate and implies use of -x509. When present, this behaves like a \"micro CA\" as follows: The subject name of the \"CA\" certificate is placed as issuer name in the new certificate, which is then signed using the \"CA\" key given as specified below.

                                                                                                                                      • -CAkey filename|uri

                                                                                                                                        Sets the \"CA\" private key to sign a certificate with. The private key must match the public key of the certificate given with -CA. If this option is not provided then the key must be present in the -CA input.

                                                                                                                                      • -days n

                                                                                                                                        When -x509 is in use this specifies the number of days to certify the certificate for, otherwise it is ignored. n should be a positive integer. The default is 30 days.

                                                                                                                                      • -set_serial n

                                                                                                                                        Serial number to use when outputting a self-signed certificate. This may be specified as a decimal value or a hex value if preceded by 0x. If not given, a large random number will be used.

                                                                                                                                      • -copy_extensions arg

                                                                                                                                        Determines how X.509 extensions in certificate requests should be handled when -x509 is in use. If arg is none or this option is not present then extensions are ignored. If arg is copy or copyall then all extensions in the request are copied to the certificate.

                                                                                                                                        The main use of this option is to allow a certificate request to supply values for certain extensions such as subjectAltName.

                                                                                                                                      • -addext ext

                                                                                                                                        Add a specific extension to the certificate (if -x509 is in use) or certificate request. The argument must have the form of a key=value pair as it would appear in a config file.

                                                                                                                                        This option can be given multiple times.

                                                                                                                                      • -extensions section

                                                                                                                                      • -reqexts section

                                                                                                                                        These options specify alternative sections to include certificate extensions (if -x509 is in use) or certificate request extensions. This allows several different sections to be used in the same configuration file to specify requests for a variety of purposes.

                                                                                                                                      • -precert

                                                                                                                                        A poison extension will be added to the certificate, making it a \"pre-certificate\" (see RFC6962). This can be submitted to Certificate Transparency logs in order to obtain signed certificate timestamps (SCTs). These SCTs can then be embedded into the pre-certificate as an extension, before removing the poison and signing the certificate.

                                                                                                                                        This implies the -new flag.

                                                                                                                                      • -utf8

                                                                                                                                        This option causes field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.

                                                                                                                                      • -reqopt option

                                                                                                                                        Customise the printing format used with -text. The option argument can be a single option or multiple options separated by commas.

                                                                                                                                        See discussion of the -certopt parameter in the openssl-x509(1) command.

                                                                                                                                      • -newhdr

                                                                                                                                        Adds the word NEW to the PEM file header and footer lines on the outputted request. Some software (Netscape certificate server) and some CAs need this.

                                                                                                                                      • -batch

                                                                                                                                        Non-interactive mode.

                                                                                                                                      • -verbose

                                                                                                                                        Print extra details about the operations being performed.

                                                                                                                                      • -keygen_engine id

                                                                                                                                        Specifies an engine (by its unique id string) which would be used for key generation operations.

                                                                                                                                      • -nameopt option

                                                                                                                                        This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-req/#configuration-file-format","title":"CONFIGURATION FILE FORMAT","text":"

                                                                                                                                      The configuration options are specified in the req section of the configuration file. An alternate name be specified by using the -section option. As with all configuration files, if no value is specified in the specific section then the initial unnamed or default section is searched too.

                                                                                                                                      The options available are described in detail below.

                                                                                                                                      • input_password, output_password

                                                                                                                                        The passwords for the input private key file (if present) and the output private key file (if one will be created). The command line options passin and passout override the configuration file values.

                                                                                                                                      • default_bits

                                                                                                                                        Specifies the default key size in bits.

                                                                                                                                        This option is used in conjunction with the -new option to generate a new key. It can be overridden by specifying an explicit key size in the -newkey option. The smallest accepted key size is 512 bits. If no key size is specified then 2048 bits is used.

                                                                                                                                      • default_keyfile

                                                                                                                                        This is the default filename to write a private key to. If not specified the key is written to standard output. This can be overridden by the -keyout option.

                                                                                                                                      • oid_file

                                                                                                                                        This specifies a file containing additional OBJECT IDENTIFIERS. Each line of the file should consist of the numerical form of the object identifier followed by whitespace then the short name followed by whitespace and finally the long name.

                                                                                                                                      • oid_section

                                                                                                                                        This specifies a section in the configuration file containing extra object identifiers. Each line should consist of the short name of the object identifier followed by = and the numerical form. The short and long names are the same when this option is used.

                                                                                                                                      • RANDFILE

                                                                                                                                        At startup the specified file is loaded into the random number generator, and at exit 256 bytes will be written to it. It is used for private key generation.

                                                                                                                                      • encrypt_key

                                                                                                                                        If this is set to no then if a private key is generated it is not encrypted. This is equivalent to the -noenc command line option. For compatibility encrypt_rsa_key is an equivalent option.

                                                                                                                                      • default_md

                                                                                                                                        This option specifies the digest algorithm to use. Any digest supported by the OpenSSL dgst command can be used. This option can be overridden on the command line. Certain signing algorithms (i.e. Ed25519 and Ed448) will ignore any digest that has been set.

                                                                                                                                      • string_mask

                                                                                                                                        This option masks out the use of certain string types in certain fields. Most users will not need to change this option. It can be set to several values:

                                                                                                                                        • utf8only
                                                                                                                                        • only UTF8Strings are used (this is the default value)
                                                                                                                                        • pkix
                                                                                                                                        • any string type except T61Strings
                                                                                                                                        • nombstr
                                                                                                                                        • any string type except BMPStrings and UTF8Strings
                                                                                                                                        • default
                                                                                                                                        • any kind of string type

                                                                                                                                        Note that utf8only is the PKIX recommendation in RFC2459 after 2003, and the default string_mask; default is not the default option. The nombstr value is a workaround for some software that has problems with variable-sized BMPStrings and UTF8Strings.

                                                                                                                                      • req_extensions

                                                                                                                                        This specifies the configuration file section containing a list of extensions to add to the certificate request. It can be overridden by the -reqexts command line switch. See the x509v3_config(5) manual page for details of the extension section format.

                                                                                                                                      • x509_extensions

                                                                                                                                        This specifies the configuration file section containing a list of extensions to add to certificate generated when -x509 is in use. It can be overridden by the -extensions command line switch.

                                                                                                                                      • prompt

                                                                                                                                        If set to the value no this disables prompting of certificate fields and just takes values from the config file directly. It also changes the expected format of the distinguished_name and attributes sections.

                                                                                                                                      • utf8

                                                                                                                                        If set to the value yes then field values to be interpreted as UTF8 strings, by default they are interpreted as ASCII. This means that the field values, whether prompted from a terminal or obtained from a configuration file, must be valid UTF8 strings.

                                                                                                                                      • attributes

                                                                                                                                        This specifies the section containing any request attributes: its format is the same as distinguished_name. Typically these may contain the challengePassword or unstructuredName types. They are currently ignored by OpenSSL's request signing utilities but some CAs might want them.

                                                                                                                                      • distinguished_name

                                                                                                                                        This specifies the section containing the distinguished name fields to prompt for when generating a certificate or certificate request. The format is described in the next section.

                                                                                                                                      "},{"location":"man1/openssl-req/#distinguished-name-and-attribute-section-format","title":"DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT","text":"

                                                                                                                                      There are two separate formats for the distinguished name and attribute sections. If the prompt option is set to no then these sections just consist of field names and values: for example,

                                                                                                                                      CN=My Name\nOU=My Organization\nemailAddress=someone@somewhere.org\n

                                                                                                                                      This allows external programs (e.g. GUI based) to generate a template file with all the field names and values and just pass it to this command. An example of this kind of configuration file is contained in the EXAMPLES section.

                                                                                                                                      Alternatively if the prompt option is absent or not set to no then the file contains field prompting information. It consists of lines of the form:

                                                                                                                                      fieldName=\"prompt\"\nfieldName_default=\"default field value\"\nfieldName_min= 2\nfieldName_max= 4\n

                                                                                                                                      \"fieldName\" is the field name being used, for example commonName (or CN). The \"prompt\" string is used to ask the user to enter the relevant details. If the user enters nothing then the default value is used if no default value is present then the field is omitted. A field can still be omitted if a default value is present if the user just enters the '.' character.

                                                                                                                                      The number of characters entered must be between the fieldName_min and fieldName_max limits: there may be additional restrictions based on the field being used (for example countryName can only ever be two characters long and must fit in a PrintableString).

                                                                                                                                      Some fields (such as organizationName) can be used more than once in a DN. This presents a problem because configuration files will not recognize the same name occurring twice. To avoid this problem if the fieldName contains some characters followed by a full stop they will be ignored. So for example a second organizationName can be input by calling it \"1.organizationName\".

                                                                                                                                      The actual permitted field names are any object identifier short or long names. These are compiled into OpenSSL and include the usual values such as commonName, countryName, localityName, organizationName, organizationalUnitName, stateOrProvinceName. Additionally emailAddress is included as well as name, surname, givenName, initials, and dnQualifier.

                                                                                                                                      Additional object identifiers can be defined with the oid_file or oid_section options in the configuration file. Any additional fields will be treated as though they were a DirectoryString.

                                                                                                                                      "},{"location":"man1/openssl-req/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Examine and verify certificate request:

                                                                                                                                      openssl req -in req.pem -text -verify -noout\n

                                                                                                                                      Create a private key and then generate a certificate request from it:

                                                                                                                                      openssl genrsa -out key.pem 2048\nopenssl req -new -key key.pem -out req.pem\n

                                                                                                                                      The same but just using req:

                                                                                                                                      openssl req -newkey rsa:2048 -keyout key.pem -out req.pem\n

                                                                                                                                      Generate a self-signed root certificate:

                                                                                                                                      openssl req -x509 -newkey rsa:2048 -keyout key.pem -out req.pem\n

                                                                                                                                      Create an SM2 private key and then generate a certificate request from it:

                                                                                                                                      openssl ecparam -genkey -name SM2 -out sm2.key\nopenssl req -new -key sm2.key -out sm2.csr -sm3 -sigopt \"distid:1234567812345678\"\n

                                                                                                                                      Examine and verify an SM2 certificate request:

                                                                                                                                      openssl req -verify -in sm2.csr -sm3 -vfyopt \"distid:1234567812345678\"\n

                                                                                                                                      Example of a file pointed to by the oid_file option:

                                                                                                                                      1.2.3.4        shortName       A longer Name\n1.2.3.6        otherName       Other longer Name\n

                                                                                                                                      Example of a section pointed to by oid_section making use of variable expansion:

                                                                                                                                      testoid1=1.2.3.5\ntestoid2=${testoid1}.6\n

                                                                                                                                      Sample configuration file prompting for field values:

                                                                                                                                      [ req ]\ndefault_bits           = 2048\ndefault_keyfile        = privkey.pem\ndistinguished_name     = req_distinguished_name\nattributes             = req_attributes\nreq_extensions         = v3_ca\n\ndirstring_type = nobmp\n\n[ req_distinguished_name ]\ncountryName                    = Country Name (2 letter code)\ncountryName_default            = AU\ncountryName_min                = 2\ncountryName_max                = 2\n\nlocalityName                   = Locality Name (eg, city)\n\norganizationalUnitName         = Organizational Unit Name (eg, section)\n\ncommonName                     = Common Name (eg, YOUR name)\ncommonName_max                 = 64\n\nemailAddress                   = Email Address\nemailAddress_max               = 40\n\n[ req_attributes ]\nchallengePassword              = A challenge password\nchallengePassword_min          = 4\nchallengePassword_max          = 20\n\n[ v3_ca ]\n\nsubjectKeyIdentifier=hash\nauthorityKeyIdentifier=keyid:always,issuer:always\nbasicConstraints = critical, CA:true\n

                                                                                                                                      Sample configuration containing all field values:

                                                                                                                                      [ req ]\ndefault_bits           = 2048\ndefault_keyfile        = keyfile.pem\ndistinguished_name     = req_distinguished_name\nattributes             = req_attributes\nprompt                 = no\noutput_password        = mypass\n\n[ req_distinguished_name ]\nC                      = GB\nST                     = Test State or Province\nL                      = Test Locality\nO                      = Organization Name\nOU                     = Organizational Unit Name\nCN                     = Common Name\nemailAddress           = test@email.address\n\n[ req_attributes ]\nchallengePassword              = A challenge password\n

                                                                                                                                      Example of giving the most common attributes (subject and extensions) on the command line:

                                                                                                                                      openssl req -new -subj \"/C=GB/CN=foo\" \\\n                 -addext \"subjectAltName = DNS:foo.co.uk\" \\\n                 -addext \"certificatePolicies = 1.2.3.4\" \\\n                 -newkey rsa:2048 -keyout key.pem -out req.pem\n
                                                                                                                                      "},{"location":"man1/openssl-req/#notes","title":"NOTES","text":"

                                                                                                                                      The certificate requests generated by Xenroll with MSIE have extensions added. It includes the keyUsage extension which determines the type of key (signature only or general purpose) and any additional OIDs entered by the script in an extendedKeyUsage extension.

                                                                                                                                      "},{"location":"man1/openssl-req/#diagnostics","title":"DIAGNOSTICS","text":"

                                                                                                                                      The following messages are frequently asked about:

                                                                                                                                          Using configuration from /some/path/openssl.cnf\n    Unable to load config info\n

                                                                                                                                      This is followed some time later by:

                                                                                                                                          unable to find 'distinguished_name' in config\n    problems making Certificate Request\n

                                                                                                                                      The first error message is the clue: it can't find the configuration file! Certain operations (like examining a certificate request) don't need a configuration file so its use isn't enforced. Generation of certificates or requests however does need a configuration file. This could be regarded as a bug.

                                                                                                                                      Another puzzling message is this:

                                                                                                                                          Attributes:\n        a0:00\n

                                                                                                                                      this is displayed when no attributes are present and the request includes the correct empty SET OF structure (the DER encoding of which is 0xa0 0x00). If you just see:

                                                                                                                                          Attributes:\n

                                                                                                                                      then the SET OF is missing and the encoding is technically invalid (but it is tolerated). See the description of the command line option -asn1-kludge for more information.

                                                                                                                                      "},{"location":"man1/openssl-req/#bugs","title":"BUGS","text":"

                                                                                                                                      OpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively treats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour. This can cause problems if you need characters that aren't available in PrintableStrings and you don't want to or can't use BMPStrings.

                                                                                                                                      As a consequence of the T61String handling the only correct way to represent accented characters in OpenSSL is to use a BMPString: unfortunately Netscape currently chokes on these. If you have to use accented characters with Netscape and MSIE then you currently need to use the invalid T61String form.

                                                                                                                                      The current prompting is not very friendly. It doesn't allow you to confirm what you've just entered. Other things like extensions in certificate requests are statically defined in the configuration file. Some of these: like an email address in subjectAltName should be input by the user.

                                                                                                                                      "},{"location":"man1/openssl-req/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-x509(1), openssl-ca(1), openssl-genrsa(1), openssl-gendsa(1), config(5), x509v3_config(5)

                                                                                                                                      "},{"location":"man1/openssl-req/#history","title":"HISTORY","text":"

                                                                                                                                      The -section option was added in OpenSSL 3.0.0.

                                                                                                                                      The -multivalue-rdn option has become obsolete in OpenSSL 3.0.0 and has no effect.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0. The <-nodes> option was deprecated in OpenSSL 3.0, too; use -noenc instead.

                                                                                                                                      "},{"location":"man1/openssl-req/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-rsa/","title":"openssl-rsa","text":""},{"location":"man1/openssl-rsa/#name","title":"NAME","text":"

                                                                                                                                      openssl-rsa - RSA key processing command

                                                                                                                                      "},{"location":"man1/openssl-rsa/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl rsa [-help] [-inform DER|PEM|P12|ENGINE] [-outform DER|PEM] [-in filename|uri] [-passin arg] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-aria128] [-aria192] [-aria256] [-camellia128] [-camellia192] [-camellia256] [-des] [-des3] [-idea] [-text] [-noout] [-modulus] [-traditional] [-check] [-pubin] [-pubout] [-RSAPublicKey_in] [-RSAPublicKey_out] [-pvk-strong] [-pvk-weak] [-pvk-none] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-rsa/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes RSA keys. They can be converted between various forms and their components printed out.

                                                                                                                                      "},{"location":"man1/openssl-rsa/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM|P12|ENGINE

                                                                                                                                        The key input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The key output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                      • -traditional

                                                                                                                                        When writing a private key, use the traditional PKCS#1 format instead of the PKCS#8 format.

                                                                                                                                      • -in filename|uri

                                                                                                                                        This specifies the input to read a key from or standard input if this option is not specified. If the key is encrypted a pass phrase will be prompted for.

                                                                                                                                      • -passin arg, -passout arg

                                                                                                                                        The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write a key to or standard output if this option is not specified. If any encryption options are set then a pass phrase will be prompted for. The output filename should not be the same as the input filename.

                                                                                                                                      • -aes128, -aes192, -aes256, -aria128, -aria192, -aria256, -camellia128, -camellia192, -camellia256, -des, -des3, -idea

                                                                                                                                        These options encrypt the private key with the specified cipher before outputting it. A pass phrase is prompted for. If none of these options is specified the key is written in plain text. This means that this command can be used to remove the pass phrase from a key by not giving any encryption option is given, or to add or change the pass phrase by setting them. These options can only be used with PEM format output files.

                                                                                                                                      • -text

                                                                                                                                        Prints out the various public or private key components in plain text in addition to the encoded version.

                                                                                                                                      • -noout

                                                                                                                                        This option prevents output of the encoded version of the key.

                                                                                                                                      • -modulus

                                                                                                                                        This option prints out the value of the modulus of the key.

                                                                                                                                      • -check

                                                                                                                                        This option checks the consistency of an RSA private key.

                                                                                                                                      • -pubin

                                                                                                                                        By default a private key is read from the input file: with this option a public key is read instead.

                                                                                                                                      • -pubout

                                                                                                                                        By default a private key is output: with this option a public key will be output instead. This option is automatically set if the input is a public key.

                                                                                                                                      • -RSAPublicKey_in, -RSAPublicKey_out

                                                                                                                                        Like -pubin and -pubout except RSAPublicKey format is used instead.

                                                                                                                                      • -pvk-strong

                                                                                                                                        Enable 'Strong' PVK encoding level (default).

                                                                                                                                      • -pvk-weak

                                                                                                                                        Enable 'Weak' PVK encoding level.

                                                                                                                                      • -pvk-none

                                                                                                                                        Don't enforce PVK encoding.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-rsa/#notes","title":"NOTES","text":"

                                                                                                                                      The openssl-pkey(1) command is capable of performing all the operations this command can, as well as supporting other public key types.

                                                                                                                                      "},{"location":"man1/openssl-rsa/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The documentation for the openssl-pkey(1) command contains examples equivalent to the ones listed here.

                                                                                                                                      To remove the pass phrase on an RSA private key:

                                                                                                                                      openssl rsa -in key.pem -out keyout.pem\n

                                                                                                                                      To encrypt a private key using triple DES:

                                                                                                                                      openssl rsa -in key.pem -des3 -out keyout.pem\n

                                                                                                                                      To convert a private key from PEM to DER format:

                                                                                                                                      openssl rsa -in key.pem -outform DER -out keyout.der\n

                                                                                                                                      To print out the components of a private key to standard output:

                                                                                                                                      openssl rsa -in key.pem -text -noout\n

                                                                                                                                      To just output the public part of a private key:

                                                                                                                                      openssl rsa -in key.pem -pubout -out pubkey.pem\n

                                                                                                                                      Output the public part of a private key in RSAPublicKey format:

                                                                                                                                      openssl rsa -in key.pem -RSAPublicKey_out -out pubkey.pem\n
                                                                                                                                      "},{"location":"man1/openssl-rsa/#bugs","title":"BUGS","text":"

                                                                                                                                      There should be an option that automatically handles .key files, without having to manually edit them.

                                                                                                                                      "},{"location":"man1/openssl-rsa/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkey(1), openssl-pkcs8(1), openssl-dsa(1), openssl-genrsa(1), openssl-gendsa(1)

                                                                                                                                      "},{"location":"man1/openssl-rsa/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-rsa/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-rsautl/","title":"openssl-rsautl","text":""},{"location":"man1/openssl-rsautl/#name","title":"NAME","text":"

                                                                                                                                      openssl-rsautl - RSA command

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl rsautl [-help] [-in file] [-passin arg] [-rev] [-out file] [-inkey filename|uri] [-keyform DER|PEM|P12|ENGINE] [-pubin] [-certin] [-sign] [-verify] [-encrypt] [-decrypt] [-pkcs] [-x931] [-oaep] [-raw] [-hexdump] [-asn1parse] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command has been deprecated. The openssl-pkeyutl(1) command should be used instead.

                                                                                                                                      This command can be used to sign, verify, encrypt and decrypt data using the RSA algorithm.

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read data from or standard input if this option is not specified.

                                                                                                                                      • -passin arg

                                                                                                                                        The passphrase used in the output file. See see openssl-passphrase-options(1).

                                                                                                                                      • -rev

                                                                                                                                        Reverse the order of the input.

                                                                                                                                      • -out filename

                                                                                                                                        Specifies the output filename to write to or standard output by default.

                                                                                                                                      • -inkey filename|uri

                                                                                                                                        The input key, by default it should be an RSA private key.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The key format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -pubin

                                                                                                                                        The input file is an RSA public key.

                                                                                                                                      • -certin

                                                                                                                                        The input is a certificate containing an RSA public key.

                                                                                                                                      • -sign

                                                                                                                                        Sign the input data and output the signed result. This requires an RSA private key.

                                                                                                                                      • -verify

                                                                                                                                        Verify the input data and output the recovered data.

                                                                                                                                      • -encrypt

                                                                                                                                        Encrypt the input data using an RSA public key.

                                                                                                                                      • -decrypt

                                                                                                                                        Decrypt the input data using an RSA private key.

                                                                                                                                      • -pkcs, -oaep, -x931, -raw

                                                                                                                                        The padding to use: PKCS#1 v1.5 (the default), PKCS#1 OAEP, ANSI X9.31, or no padding, respectively. For signatures, only -pkcs and -raw can be used.

                                                                                                                                      • -hexdump

                                                                                                                                        Hex dump the output data.

                                                                                                                                      • -asn1parse

                                                                                                                                        Parse the ASN.1 output data, this is useful when combined with the -verify option.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#notes","title":"NOTES","text":"

                                                                                                                                      Since this command uses the RSA algorithm directly, it can only be used to sign or verify small pieces of data.

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Examples equivalent to these can be found in the documentation for the non-deprecated openssl-pkeyutl(1) command.

                                                                                                                                      Sign some data using a private key:

                                                                                                                                      openssl rsautl -sign -in file -inkey key.pem -out sig\n

                                                                                                                                      Recover the signed data

                                                                                                                                      openssl rsautl -verify -in sig -inkey key.pem\n

                                                                                                                                      Examine the raw signed data:

                                                                                                                                      openssl rsautl -verify -in sig -inkey key.pem -raw -hexdump\n\n0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff   ................\n0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64   .....hello world\n

                                                                                                                                      The PKCS#1 block formatting is evident from this. If this was done using encrypt and decrypt the block would have been of type 2 (the second byte) and random padding data visible instead of the 0xff bytes.

                                                                                                                                      It is possible to analyse the signature of certificates using this command in conjunction with openssl-asn1parse(1). Consider the self signed example in certs/pca-cert.pem. Running openssl-asn1parse(1) as follows yields:

                                                                                                                                      openssl asn1parse -in pca-cert.pem\n\n   0:d=0  hl=4 l= 742 cons: SEQUENCE\n   4:d=1  hl=4 l= 591 cons:  SEQUENCE\n   8:d=2  hl=2 l=   3 cons:   cont [ 0 ]\n  10:d=3  hl=2 l=   1 prim:    INTEGER           :02\n  13:d=2  hl=2 l=   1 prim:   INTEGER           :00\n  16:d=2  hl=2 l=  13 cons:   SEQUENCE\n  18:d=3  hl=2 l=   9 prim:    OBJECT            :md5WithRSAEncryption\n  29:d=3  hl=2 l=   0 prim:    NULL\n  31:d=2  hl=2 l=  92 cons:   SEQUENCE\n  33:d=3  hl=2 l=  11 cons:    SET\n  35:d=4  hl=2 l=   9 cons:     SEQUENCE\n  37:d=5  hl=2 l=   3 prim:      OBJECT            :countryName\n  42:d=5  hl=2 l=   2 prim:      PRINTABLESTRING   :AU\n ....\n 599:d=1  hl=2 l=  13 cons:  SEQUENCE\n 601:d=2  hl=2 l=   9 prim:   OBJECT            :md5WithRSAEncryption\n 612:d=2  hl=2 l=   0 prim:   NULL\n 614:d=1  hl=3 l= 129 prim:  BIT STRING\n

                                                                                                                                      The final BIT STRING contains the actual signature. It can be extracted with:

                                                                                                                                      openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614\n

                                                                                                                                      The certificate public key can be extracted with:

                                                                                                                                      openssl x509 -in test/testx509.pem -pubkey -noout >pubkey.pem\n

                                                                                                                                      The signature can be analysed with:

                                                                                                                                      openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin\n\n   0:d=0  hl=2 l=  32 cons: SEQUENCE\n   2:d=1  hl=2 l=  12 cons:  SEQUENCE\n   4:d=2  hl=2 l=   8 prim:   OBJECT            :md5\n  14:d=2  hl=2 l=   0 prim:   NULL\n  16:d=1  hl=2 l=  16 prim:  OCTET STRING\n     0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5   .F...Js.7...H%..\n

                                                                                                                                      This is the parsed version of an ASN1 DigestInfo structure. It can be seen that the digest used was md5. The actual part of the certificate that was signed can be extracted with:

                                                                                                                                      openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4\n

                                                                                                                                      and its digest computed with:

                                                                                                                                      openssl md5 -c tbs\nMD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5\n

                                                                                                                                      which it can be seen agrees with the recovered value above.

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-pkeyutl(1), openssl-dgst(1), openssl-rsa(1), openssl-genrsa(1)

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#history","title":"HISTORY","text":"

                                                                                                                                      This command was deprecated in OpenSSL 3.0.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-rsautl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-s_client/","title":"openssl-s_client","text":""},{"location":"man1/openssl-s_client/#name","title":"NAME","text":"

                                                                                                                                      openssl-s_client - SSL/TLS client program

                                                                                                                                      "},{"location":"man1/openssl-s_client/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl s_client [-help] [-ssl_config section] [-connect host:port] [-host hostname] [-port port] [-bind host:port] [-proxy host:port] [-proxy_user userid] [-proxy_pass arg] [-unix path] [-4] [-6] [-servername name] [-noservername] [-verify depth] [-verify_return_error] [-verify_quiet] [-verifyCAfile filename] [-verifyCApath dir] [-verifyCAstore uri] [-cert filename] [-certform DER|PEM|P12] [-cert_chain filename] [-build_chain] [-CRL filename] [-CRLform DER|PEM] [-crl_download] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-pass arg] [-chainCAfile filename] [-chainCApath directory] [-chainCAstore uri] [-requestCAfile filename] [-dane_tlsa_domain domain] [-dane_tlsa_rrdata rrdata] [-dane_ee_no_namechecks] [-reconnect] [-showcerts] [-prexit] [-debug] [-trace] [-nocommands] [-security_debug] [-security_debug_verbose] [-msg] [-timeout] [-mtu size] [-no_etm] [-keymatexport label] [-keymatexportlen len] [-msgfile filename] [-nbio_test] [-state] [-nbio] [-crlf] [-ign_eof] [-no_ign_eof] [-psk_identity identity] [-psk key] [-psk_session file] [-quiet] [-sctp] [-sctp_label_bug] [-fallback_scsv] [-async] [-maxfraglen len] [-max_send_frag] [-split_send_frag] [-max_pipelines] [-read_buf] [-ignore_unexpected_eof] [-bugs] [-comp] [-no_comp] [-brief] [-legacy_server_connect] [-no_legacy_server_connect] [-allow_no_dhe_kex] [-sigalgs sigalglist] [-curves curvelist] [-cipher cipherlist] [-ciphersuites val] [-serverpref] [-starttls protocol] [-name hostname] [-xmpphost hostname] [-name hostname] [-tlsextdebug] [-no_ticket] [-sess_out filename] [-serverinfo types] [-sess_in filename] [-serverinfo types] [-status] [-alpn protocols] [-nextprotoneg protocols] [-ct] [-noct] [-ctlogfile] [-keylogfile file] [-early_data file] [-enable_pha] [-use_srtp value] [-srpuser value] [-srppass value] [-srp_lateuser] [-srp_moregroups] [-srp_strength number] [-nameopt option] [-no_ssl3] [-no_tls1] [-no_tls1_1] [-no_tls1_2] [-no_tls1_3] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-dtls] [-dtls1] [-dtls1_2] [-xkey infile] [-xcert file] [-xchain file] [-xchain_build file] [-xcertform DER|PEM]> [-xkeyform DER|PEM]> [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-bugs] [-no_comp] [-comp] [-no_ticket] [-serverpref] [-client_renegotiation] [-legacy_renegotiation] [-no_renegotiation] [-no_resumption_on_reneg] [-legacy_server_connect] [-no_legacy_server_connect] [-no_etm] [-allow_no_dhe_kex] [-prioritize_chacha] [-strict] [-sigalgs algs] [-client_sigalgs algs] [-groups groups] [-curves curves] [-named_curve curve] [-cipher ciphers] [-ciphersuites 1.3ciphers] [-min_protocol minprot] [-max_protocol maxprot] [-record_padding padding] [-debug_broken_protocol] [-no_middlebox] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [-engine id] [-ssl_client_engine id] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [host:port]

                                                                                                                                      "},{"location":"man1/openssl-s_client/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command implements a generic SSL/TLS client which connects to a remote host using SSL/TLS. It is a very useful diagnostic tool for SSL servers.

                                                                                                                                      "},{"location":"man1/openssl-s_client/#options","title":"OPTIONS","text":"

                                                                                                                                      In addition to the options below, this command also supports the common and client only options documented in the \"Supported Command Line Commands\" section of the SSL_CONF_cmd(3) manual page.

                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -ssl_config section

                                                                                                                                        Use the specified section of the configuration file to configure the SSL_CTX object.

                                                                                                                                      • -connect host:port

                                                                                                                                        This specifies the host and optional port to connect to. It is possible to select the host and port using the optional target positional argument instead. If neither this nor the target positional argument are specified then an attempt is made to connect to the local host on port 4433.

                                                                                                                                      • -host hostname

                                                                                                                                        Host to connect to; use -connect instead.

                                                                                                                                      • -port port

                                                                                                                                        Connect to the specified port; use -connect instead.

                                                                                                                                      • -bind host:port

                                                                                                                                        This specifies the host address and or port to bind as the source for the connection. For Unix-domain sockets the port is ignored and the host is used as the source socket address.

                                                                                                                                      • -proxy host:port

                                                                                                                                        When used with the -connect flag, the program uses the host and port specified with this flag and issues an HTTP CONNECT command to connect to the desired server.

                                                                                                                                      • -proxy_user userid

                                                                                                                                        When used with the -proxy flag, the program will attempt to authenticate with the specified proxy using basic (base64) authentication. NB: Basic authentication is insecure; the credentials are sent to the proxy in easily reversible base64 encoding before any TLS/SSL session is established. Therefore, these credentials are easily recovered by anyone able to sniff/trace the network. Use with caution.

                                                                                                                                      • -proxy_pass arg

                                                                                                                                        The proxy password source, used with the -proxy_user flag. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -unix path

                                                                                                                                        Connect over the specified Unix-domain socket.

                                                                                                                                      • -4

                                                                                                                                        Use IPv4 only.

                                                                                                                                      • -6

                                                                                                                                        Use IPv6 only.

                                                                                                                                      • -servername name

                                                                                                                                        Set the TLS SNI (Server Name Indication) extension in the ClientHello message to the given value. If -servername is not provided, the TLS SNI extension will be populated with the name given to -connect if it follows a DNS name format. If -connect is not provided either, the SNI is set to \"localhost\". This is the default since OpenSSL 1.1.1.

                                                                                                                                        Even though SNI should normally be a DNS name and not an IP address, if -servername is provided then that name will be sent, regardless of whether it is a DNS name or not.

                                                                                                                                        This option cannot be used in conjunction with -noservername.

                                                                                                                                      • -noservername

                                                                                                                                        Suppresses sending of the SNI (Server Name Indication) extension in the ClientHello message. Cannot be used in conjunction with the -servername or -dane_tlsa_domain options.

                                                                                                                                      • -cert filename

                                                                                                                                        The client certificate to use, if one is requested by the server. The default is not to use a certificate.

                                                                                                                                        The chain for the client certificate may be specified using -cert_chain.

                                                                                                                                      • -certform DER|PEM|P12

                                                                                                                                        The client certificate file format to use; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -cert_chain

                                                                                                                                        A file or URI of untrusted certificates to use when attempting to build the certificate chain related to the certificate specified via the -cert option. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -build_chain

                                                                                                                                        Specify whether the application should build the client certificate chain to be provided to the server.

                                                                                                                                      • -CRL filename

                                                                                                                                        CRL file to use to check the server's certificate.

                                                                                                                                      • -CRLform DER|PEM

                                                                                                                                        The CRL file format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -crl_download

                                                                                                                                        Download CRL from distribution points in the certificate.

                                                                                                                                      • -key filename|uri

                                                                                                                                        The client private key to use. If not specified then the certificate file will be used to read also the key.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The key format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -pass arg

                                                                                                                                        the private key and certificate file password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -verify depth

                                                                                                                                        The verify depth to use. This specifies the maximum length of the server certificate chain and turns on server certificate verification. Currently the verify operation continues after errors so all the problems with a certificate chain can be seen. As a side effect the connection will never fail due to a server certificate verify failure.

                                                                                                                                      • -verify_return_error

                                                                                                                                        Return verification errors instead of continuing. This will typically abort the handshake with a fatal error.

                                                                                                                                      • -verify_quiet

                                                                                                                                        Limit verify output to only errors.

                                                                                                                                      • -verifyCAfile filename

                                                                                                                                        A file in PEM format containing trusted certificates to use for verifying the server's certificate.

                                                                                                                                      • -verifyCApath dir

                                                                                                                                        A directory containing trusted certificates to use for verifying the server's certificate. This directory must be in \"hash format\", see openssl-verify(1) for more information.

                                                                                                                                      • -verifyCAstore uri

                                                                                                                                        The URI of a store containing trusted certificates to use for verifying the server's certificate.

                                                                                                                                      • -chainCAfile file

                                                                                                                                        A file in PEM format containing trusted certificates to use when attempting to build the client certificate chain.

                                                                                                                                      • -chainCApath directory

                                                                                                                                        A directory containing trusted certificates to use for building the client certificate chain provided to the server. This directory must be in \"hash format\", see openssl-verify(1) for more information.

                                                                                                                                      • -chainCAstore uri

                                                                                                                                        The URI of a store containing trusted certificates to use when attempting to build the client certificate chain. The URI may indicate a single certificate, as well as a collection of them. With URIs in the file: scheme, this acts as -chainCAfile or -chainCApath, depending on if the URI indicates a directory or a single file. See ossl_store-file(7) for more information on the file: scheme.

                                                                                                                                      • -requestCAfile file

                                                                                                                                        A file containing a list of certificates whose subject names will be sent to the server in the certificate_authorities extension. Only supported for TLS 1.3

                                                                                                                                      • -dane_tlsa_domain domain

                                                                                                                                        Enable RFC6698/RFC7671 DANE TLSA authentication and specify the TLSA base domain which becomes the default SNI hint and the primary reference identifier for hostname checks. This must be used in combination with at least one instance of the -dane_tlsa_rrdata option below.

                                                                                                                                        When DANE authentication succeeds, the diagnostic output will include the lowest (closest to 0) depth at which a TLSA record authenticated a chain certificate. When that TLSA record is a \"2 1 0\" trust anchor public key that signed (rather than matched) the top-most certificate of the chain, the result is reported as \"TA public key verified\". Otherwise, either the TLSA record \"matched TA certificate\" at a positive depth or else \"matched EE certificate\" at depth 0.

                                                                                                                                      • -dane_tlsa_rrdata rrdata

                                                                                                                                        Use one or more times to specify the RRDATA fields of the DANE TLSA RRset associated with the target service. The rrdata value is specified in \"presentation form\", that is four whitespace separated fields that specify the usage, selector, matching type and associated data, with the last of these encoded in hexadecimal. Optional whitespace is ignored in the associated data field. For example:

                                                                                                                                        $ openssl s_client -brief -starttls smtp \\\n  -connect smtp.example.com:25 \\\n  -dane_tlsa_domain smtp.example.com \\\n  -dane_tlsa_rrdata \"2 1 1\n    B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B\" \\\n  -dane_tlsa_rrdata \"2 1 1\n    60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18\"\n...\nVerification: OK\nVerified peername: smtp.example.com\nDANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1\n...\n
                                                                                                                                      • -dane_ee_no_namechecks

                                                                                                                                        This disables server name checks when authenticating via DANE-EE(3) TLSA records. For some applications, primarily web browsers, it is not safe to disable name checks due to \"unknown key share\" attacks, in which a malicious server can convince a client that a connection to a victim server is instead a secure connection to the malicious server. The malicious server may then be able to violate cross-origin scripting restrictions. Thus, despite the text of RFC7671, name checks are by default enabled for DANE-EE(3) TLSA records, and can be disabled in applications where it is safe to do so. In particular, SMTP and XMPP clients should set this option as SRV and MX records already make it possible for a remote domain to redirect client connections to any server of its choice, and in any case SMTP and XMPP clients do not execute scripts downloaded from remote servers.

                                                                                                                                      • -reconnect

                                                                                                                                        Reconnects to the same server 5 times using the same session ID, this can be used as a test that session caching is working.

                                                                                                                                      • -showcerts

                                                                                                                                        Displays the server certificate list as sent by the server: it only consists of certificates the server has sent (in the order the server has sent them). It is not a verified chain.

                                                                                                                                      • -prexit

                                                                                                                                        Print session information when the program exits. This will always attempt to print out information even if the connection fails. Normally information will only be printed out once if the connection succeeds. This option is useful because the cipher in use may be renegotiated or the connection may fail because a client certificate is required or is requested only after an attempt is made to access a certain URL. Note: the output produced by this option is not always accurate because a connection might never have been established.

                                                                                                                                      • -state

                                                                                                                                        Prints out the SSL session states.

                                                                                                                                      • -debug

                                                                                                                                        Print extensive debugging information including a hex dump of all traffic.

                                                                                                                                      • -nocommands

                                                                                                                                        Do not use interactive command letters.

                                                                                                                                      • -security_debug

                                                                                                                                        Enable security debug messages.

                                                                                                                                      • -security_debug_verbose

                                                                                                                                        Output more security debug output.

                                                                                                                                      • -msg

                                                                                                                                        Show protocol messages.

                                                                                                                                      • -timeout

                                                                                                                                        Enable send/receive timeout on DTLS connections.

                                                                                                                                      • -mtu size

                                                                                                                                        Set MTU of the link layer to the specified size.

                                                                                                                                      • -no_etm

                                                                                                                                        Disable Encrypt-then-MAC negotiation.

                                                                                                                                      • -keymatexport label

                                                                                                                                        Export keying material using the specified label.

                                                                                                                                      • -keymatexportlen len

                                                                                                                                        Export the specified number of bytes of keying material; default is 20.

                                                                                                                                        Show all protocol messages with hex dump.

                                                                                                                                      • -trace

                                                                                                                                        Show verbose trace output of protocol messages.

                                                                                                                                      • -msgfile filename

                                                                                                                                        File to send output of -msg or -trace to, default standard output.

                                                                                                                                      • -nbio_test

                                                                                                                                        Tests nonblocking I/O

                                                                                                                                      • -nbio

                                                                                                                                        Turns on nonblocking I/O

                                                                                                                                      • -crlf

                                                                                                                                        This option translated a line feed from the terminal into CR+LF as required by some servers.

                                                                                                                                      • -ign_eof

                                                                                                                                        Inhibit shutting down the connection when end of file is reached in the input.

                                                                                                                                      • -quiet

                                                                                                                                        Inhibit printing of session and certificate information. This implicitly turns on -ign_eof as well.

                                                                                                                                      • -no_ign_eof

                                                                                                                                        Shut down the connection when end of file is reached in the input. Can be used to override the implicit -ign_eof after -quiet.

                                                                                                                                      • -psk_identity identity

                                                                                                                                        Use the PSK identity identity when using a PSK cipher suite. The default value is \"Client_identity\" (without the quotes).

                                                                                                                                      • -psk key

                                                                                                                                        Use the PSK key key when using a PSK cipher suite. The key is given as a hexadecimal number without leading 0x, for example -psk 1a2b3c4d. This option must be provided in order to use a PSK cipher.

                                                                                                                                      • -psk_session file

                                                                                                                                        Use the pem encoded SSL_SESSION data stored in file as the basis of a PSK. Note that this will only work if TLSv1.3 is negotiated.

                                                                                                                                      • -sctp

                                                                                                                                        Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in conjunction with -dtls, -dtls1 or -dtls1_2. This option is only available where OpenSSL has support for SCTP enabled.

                                                                                                                                      • -sctp_label_bug

                                                                                                                                        Use the incorrect behaviour of older OpenSSL implementations when computing endpoint-pair shared secrets for DTLS/SCTP. This allows communication with older broken implementations but breaks interoperability with correct implementations. Must be used in conjunction with -sctp. This option is only available where OpenSSL has support for SCTP enabled.

                                                                                                                                      • -fallback_scsv

                                                                                                                                        Send TLS_FALLBACK_SCSV in the ClientHello.

                                                                                                                                      • -async

                                                                                                                                        Switch on asynchronous mode. Cryptographic operations will be performed asynchronously. This will only have an effect if an asynchronous capable engine is also used via the -engine option. For test purposes the dummy async engine (dasync) can be used (if available).

                                                                                                                                      • -maxfraglen len

                                                                                                                                        Enable Maximum Fragment Length Negotiation; allowed values are 512, 1024, 2048, and 4096.

                                                                                                                                      • -max_send_frag int

                                                                                                                                        The maximum size of data fragment to send. See SSL_CTX_set_max_send_fragment(3) for further information.

                                                                                                                                      • -split_send_frag int

                                                                                                                                        The size used to split data for encrypt pipelines. If more data is written in one go than this value then it will be split into multiple pipelines, up to the maximum number of pipelines defined by max_pipelines. This only has an effect if a suitable cipher suite has been negotiated, an engine that supports pipelining has been loaded, and max_pipelines is greater than 1. See SSL_CTX_set_split_send_fragment(3) for further information.

                                                                                                                                      • -max_pipelines int

                                                                                                                                        The maximum number of encrypt/decrypt pipelines to be used. This will only have an effect if an engine has been loaded that supports pipelining (e.g. the dasync engine) and a suitable cipher suite has been negotiated. The default value is 1. See SSL_CTX_set_max_pipelines(3) for further information.

                                                                                                                                      • -read_buf int

                                                                                                                                        The default read buffer size to be used for connections. This will only have an effect if the buffer size is larger than the size that would otherwise be used and pipelining is in use (see SSL_CTX_set_default_read_buffer_len(3) for further information).

                                                                                                                                      • -ignore_unexpected_eof

                                                                                                                                        Some TLS implementations do not send the mandatory close_notify alert on shutdown. If the application tries to wait for the close_notify alert but the peer closes the connection without sending it, an error is generated. When this option is enabled the peer does not need to send the close_notify alert and a closed connection will be treated as if the close_notify alert was received. For more information on shutting down a connection, see SSL_shutdown(3).

                                                                                                                                      • -bugs

                                                                                                                                        There are several known bugs in SSL and TLS implementations. Adding this option enables various workarounds.

                                                                                                                                      • -comp

                                                                                                                                        Enables support for SSL/TLS compression. This option was introduced in OpenSSL 1.1.0. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

                                                                                                                                      • -no_comp

                                                                                                                                        Disables support for SSL/TLS compression. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

                                                                                                                                      • -brief

                                                                                                                                        Only provide a brief summary of connection parameters instead of the normal verbose output.

                                                                                                                                      • -sigalgs sigalglist

                                                                                                                                        Specifies the list of signature algorithms that are sent by the client. The server selects one entry in the list based on its preferences. For example strings, see SSL_CTX_set1_sigalgs(3)

                                                                                                                                      • -curves curvelist

                                                                                                                                        Specifies the list of supported curves to be sent by the client. The curve is ultimately selected by the server.

                                                                                                                                        The list of all supported groups includes named EC parameters as well as X25519 and X448 or FFDHE groups, and may also include groups implemented in 3rd-party providers. For a list of named EC parameters, use:

                                                                                                                                        $ openssl ecparam -list_curves\n
                                                                                                                                      • -cipher cipherlist

                                                                                                                                        This allows the TLSv1.2 and below cipher list sent by the client to be modified. This list will be combined with any TLSv1.3 ciphersuites that have been configured. Although the server determines which ciphersuite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information.

                                                                                                                                      • -ciphersuites val

                                                                                                                                        This allows the TLSv1.3 ciphersuites sent by the client to be modified. This list will be combined with any TLSv1.2 and below ciphersuites that have been configured. Although the server determines which cipher suite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names.

                                                                                                                                      • -starttls protocol

                                                                                                                                        Send the protocol-specific message(s) to switch to TLS for communication. protocol is a keyword for the intended protocol. Currently, the only supported keywords are \"smtp\", \"pop3\", \"imap\", \"ftp\", \"xmpp\", \"xmpp-server\", \"irc\", \"postgres\", \"mysql\", \"lmtp\", \"nntp\", \"sieve\" and \"ldap\".

                                                                                                                                      • -xmpphost hostname

                                                                                                                                        This option, when used with \"-starttls xmpp\" or \"-starttls xmpp-server\", specifies the host for the \"to\" attribute of the stream element. If this option is not specified, then the host specified with \"-connect\" will be used.

                                                                                                                                        This option is an alias of the -name option for \"xmpp\" and \"xmpp-server\".

                                                                                                                                      • -name hostname

                                                                                                                                        This option is used to specify hostname information for various protocols used with -starttls option. Currently only \"xmpp\", \"xmpp-server\", \"smtp\" and \"lmtp\" can utilize this -name option.

                                                                                                                                        If this option is used with \"-starttls xmpp\" or \"-starttls xmpp-server\", if specifies the host for the \"to\" attribute of the stream element. If this option is not specified, then the host specified with \"-connect\" will be used.

                                                                                                                                        If this option is used with \"-starttls lmtp\" or \"-starttls smtp\", it specifies the name to use in the \"LMTP LHLO\" or \"SMTP EHLO\" message, respectively. If this option is not specified, then \"mail.example.com\" will be used.

                                                                                                                                      • -tlsextdebug

                                                                                                                                        Print out a hex dump of any TLS extensions received from the server.

                                                                                                                                      • -no_ticket

                                                                                                                                        Disable RFC4507bis session ticket support.

                                                                                                                                      • -sess_out filename

                                                                                                                                        Output SSL session to filename.

                                                                                                                                      • -sess_in filename

                                                                                                                                        Load SSL session from filename. The client will attempt to resume a connection from this session.

                                                                                                                                      • -serverinfo types

                                                                                                                                        A list of comma-separated TLS Extension Types (numbers between 0 and 65535). Each type will be sent as an empty ClientHello TLS Extension. The server's response (if any) will be encoded and displayed as a PEM file.

                                                                                                                                      • -status

                                                                                                                                        Sends a certificate status request to the server (OCSP stapling). The server response (if any) is printed out.

                                                                                                                                      • -alpn protocols, -nextprotoneg protocols

                                                                                                                                        These flags enable the Enable the Application-Layer Protocol Negotiation or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the IETF standard and replaces NPN. The protocols list is a comma-separated list of protocol names that the client should advertise support for. The list should contain the most desirable protocols first. Protocol names are printable ASCII strings, for example \"http/1.1\" or \"spdy/3\". An empty list of protocols is treated specially and will cause the client to advertise support for the TLS extension but disconnect just after receiving ServerHello with a list of server supported protocols. The flag -nextprotoneg cannot be specified if -tls1_3 is used.

                                                                                                                                      • -ct, -noct

                                                                                                                                        Use one of these two options to control whether Certificate Transparency (CT) is enabled (-ct) or disabled (-noct). If CT is enabled, signed certificate timestamps (SCTs) will be requested from the server and reported at handshake completion.

                                                                                                                                        Enabling CT also enables OCSP stapling, as this is one possible delivery method for SCTs.

                                                                                                                                      • -ctlogfile

                                                                                                                                        A file containing a list of known Certificate Transparency logs. See SSL_CTX_set_ctlog_list_file(3) for the expected file format.

                                                                                                                                      • -keylogfile file

                                                                                                                                        Appends TLS secrets to the specified keylog file such that external programs (like Wireshark) can decrypt TLS connections.

                                                                                                                                      • -early_data file

                                                                                                                                        Reads the contents of the specified file and attempts to send it as early data to the server. This will only work with resumed sessions that support early data and when the server accepts the early data.

                                                                                                                                      • -enable_pha

                                                                                                                                        For TLSv1.3 only, send the Post-Handshake Authentication extension. This will happen whether or not a certificate has been provided via -cert.

                                                                                                                                      • -use_srtp value

                                                                                                                                        Offer SRTP key management, where value is a colon-separated profile list.

                                                                                                                                      • -srpuser value

                                                                                                                                        Set the SRP username to the specified value. This option is deprecated.

                                                                                                                                      • -srppass value

                                                                                                                                        Set the SRP password to the specified value. This option is deprecated.

                                                                                                                                      • -srp_lateuser

                                                                                                                                        SRP username for the second ClientHello message. This option is deprecated.

                                                                                                                                      • -srp_moregroups This option is deprecated.

                                                                                                                                        Tolerate other than the known g and N values.

                                                                                                                                      • -srp_strength number

                                                                                                                                        Set the minimal acceptable length, in bits, for N. This option is deprecated.

                                                                                                                                      • -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3, -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3

                                                                                                                                        See \"TLS Version Options\" in openssl(1).

                                                                                                                                      • -dtls, -dtls1, -dtls1_2

                                                                                                                                        These specify the use of DTLS instead of TLS. See \"TLS Version Options\" in openssl(1).

                                                                                                                                      • -nameopt option

                                                                                                                                        This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -xkey infile, -xcert file, -xchain file, -xchain_build file, -xcertform DER|PEM, -xkeyform DER|PEM

                                                                                                                                        Set extended certificate verification options. See \"Extended Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -bugs, -comp, -no_comp, -no_ticket, -serverpref, -client_renegotiation, -legacy_renegotiation, -no_renegotiation, -no_resumption_on_reneg, -legacy_server_connect, -no_legacy_server_connect, -no_etm -allow_no_dhe_kex, -prioritize_chacha, -strict, -sigalgs algs, -client_sigalgs algs, -groups groups, -curves curves, -named_curve curve, -cipher ciphers, -ciphersuites 1.3ciphers, -min_protocol minprot, -max_protocol maxprot, -record_padding padding, -debug_broken_protocol, -no_middlebox

                                                                                                                                        See \"SUPPORTED COMMAND LINE COMMANDS\" in SSL_CONF_cmd(3) for details.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -ssl_client_engine id

                                                                                                                                        Specify engine to be used for client certificate operations.

                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                        Verification errors are displayed, for debugging, but the command will proceed unless the -verify_return_error option is used.

                                                                                                                                      • host:port

                                                                                                                                        Rather than providing -connect, the target hostname and optional port may be provided as a single positional argument after all options. If neither this nor -connect are provided, falls back to attempting to connect to localhost on port 4433.

                                                                                                                                      "},{"location":"man1/openssl-s_client/#connected-commands","title":"CONNECTED COMMANDS","text":"

                                                                                                                                      If a connection is established with an SSL server then any data received from the server is displayed and any key presses will be sent to the server. If end of file is reached then the connection will be closed down. When used interactively (which means neither -quiet nor -ign_eof have been given), then certain commands are also recognized which perform special operations. These commands are a letter which must appear at the start of a line. They are listed below.

                                                                                                                                      • Q

                                                                                                                                        End the current SSL connection and exit.

                                                                                                                                      • R

                                                                                                                                        Renegotiate the SSL session (TLSv1.2 and below only).

                                                                                                                                      • k

                                                                                                                                        Send a key update message to the server (TLSv1.3 only)

                                                                                                                                      • K

                                                                                                                                        Send a key update message to the server and request one back (TLSv1.3 only)

                                                                                                                                      "},{"location":"man1/openssl-s_client/#notes","title":"NOTES","text":"

                                                                                                                                      This command can be used to debug SSL servers. To connect to an SSL HTTP server the command:

                                                                                                                                      openssl s_client -connect servername:443\n

                                                                                                                                      would typically be used (https uses port 443). If the connection succeeds then an HTTP command can be given such as \"GET /\" to retrieve a web page.

                                                                                                                                      If the handshake fails then there are several possible causes, if it is nothing obvious like no client certificate then the -bugs, -ssl3, -tls1, -no_ssl3, -no_tls1 options can be tried in case it is a buggy server. In particular you should play with these options before submitting a bug report to an OpenSSL mailing list.

                                                                                                                                      A frequent problem when attempting to get client certificates working is that a web client complains it has no certificates or gives an empty list to choose from. This is normally because the server is not sending the clients certificate authority in its \"acceptable CA list\" when it requests a certificate. By using this command, the CA list can be viewed and checked. However, some servers only request client authentication after a specific URL is requested. To obtain the list in this case it is necessary to use the -prexit option and send an HTTP request for an appropriate page.

                                                                                                                                      If a certificate is specified on the command line using the -cert option it will not be used unless the server specifically requests a client certificate. Therefore, merely including a client certificate on the command line is no guarantee that the certificate works.

                                                                                                                                      If there are problems verifying a server certificate then the -showcerts option can be used to show all the certificates sent by the server.

                                                                                                                                      This command is a test tool and is designed to continue the handshake after any certificate verification errors. As a result it will accept any certificate chain (trusted or not) sent by the peer. Non-test applications should not do this as it makes them vulnerable to a MITM attack. This behaviour can be changed by with the -verify_return_error option: any verify errors are then returned aborting the handshake.

                                                                                                                                      The -bind option may be useful if the server or a firewall requires connections to come from some particular address and or port.

                                                                                                                                      "},{"location":"man1/openssl-s_client/#bugs","title":"BUGS","text":"

                                                                                                                                      Because this program has a lot of options and also because some of the techniques used are rather old, the C source for this command is rather hard to read and not a model of how things should be done. A typical SSL client program would be much simpler.

                                                                                                                                      The -prexit option is a bit of a hack. We should really report information whenever a session is renegotiated.

                                                                                                                                      "},{"location":"man1/openssl-s_client/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-sess_id(1), openssl-s_server(1), openssl-ciphers(1), SSL_CONF_cmd(3), SSL_CTX_set_max_send_fragment(3), SSL_CTX_set_split_send_fragment(3), SSL_CTX_set_max_pipelines(3), ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-s_client/#history","title":"HISTORY","text":"

                                                                                                                                      The -no_alt_chains option was added in OpenSSL 1.1.0. The -name option was added in OpenSSL 1.1.1.

                                                                                                                                      The -certform option has become obsolete in OpenSSL 3.0.0 and has no effect.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-s_client/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-s_server/","title":"openssl-s_server","text":""},{"location":"man1/openssl-s_server/#name","title":"NAME","text":"

                                                                                                                                      openssl-s_server - SSL/TLS server program

                                                                                                                                      "},{"location":"man1/openssl-s_server/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl s_server [-help] [-port +int] [-accept val] [-unix val] [-4] [-6] [-unlink] [-context val] [-verify int] [-Verify int] [-cert infile] [-cert2 infile] [-certform DER|PEM|P12] [-cert_chain infile] [-build_chain] [-serverinfo val] [-key filename|uri] [-key2 filename|uri] [-keyform DER|PEM|P12|ENGINE] [-pass val] [-dcert infile] [-dcertform DER|PEM|P12] [-dcert_chain infile] [-dkey filename|uri] [-dkeyform DER|PEM|P12|ENGINE] [-dpass val] [-nbio_test] [-crlf] [-debug] [-msg] [-msgfile outfile] [-state] [-nocert] [-quiet] [-no_resume_ephemeral] [-www] [-WWW] [-http_server_binmode] [-no_ca_names] [-ignore_unexpected_eof] [-servername] [-servername_fatal] [-tlsextdebug] [-HTTP] [-id_prefix val] [-keymatexport val] [-keymatexportlen +int] [-CRL infile] [-CRLform DER|PEM] [-crl_download] [-chainCAfile infile] [-chainCApath dir] [-chainCAstore uri] [-verifyCAfile infile] [-verifyCApath dir] [-verifyCAstore uri] [-no_cache] [-ext_cache] [-verify_return_error] [-verify_quiet] [-ign_eof] [-no_ign_eof] [-no_etm] [-status] [-status_verbose] [-status_timeout int] [-proxy [http[s]://][userinfo@]host[:port][/path]] [-no_proxy addresses] [-status_url val] [-status_file infile] [-ssl_config val] [-trace] [-security_debug] [-security_debug_verbose] [-brief] [-rev] [-async] [-max_send_frag +int] [-split_send_frag +int] [-max_pipelines +int] [-naccept +int] [-read_buf +int] [-bugs] [-no_comp] [-comp] [-no_ticket] [-serverpref] [-legacy_renegotiation] [-no_renegotiation] [-no_resumption_on_reneg] [-allow_no_dhe_kex] [-prioritize_chacha] [-strict] [-sigalgs val] [-client_sigalgs val] [-groups val] [-curves val] [-named_curve val] [-cipher val] [-ciphersuites val] [-dhparam infile] [-record_padding val] [-debug_broken_protocol] [-nbio] [-psk_identity val] [-psk_hint val] [-psk val] [-psk_session file] [-srpvfile infile] [-srpuserseed val] [-timeout] [-mtu +int] [-listen] [-sctp] [-sctp_label_bug] [-use_srtp val] [-no_dhe] [-nextprotoneg val] [-alpn val] [-sendfile] [-keylogfile outfile] [-recv_max_early_data int] [-max_early_data int] [-early_data] [-stateless] [-anti_replay] [-no_anti_replay] [-num_tickets] [-nameopt option] [-no_ssl3] [-no_tls1] [-no_tls1_1] [-no_tls1_2] [-no_tls1_3] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-dtls] [-dtls1] [-dtls1_2] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-bugs] [-no_comp] [-comp] [-no_ticket] [-serverpref] [-client_renegotiation] [-legacy_renegotiation] [-no_renegotiation] [-no_resumption_on_reneg] [-legacy_server_connect] [-no_legacy_server_connect] [-no_etm] [-allow_no_dhe_kex] [-prioritize_chacha] [-strict] [-sigalgs algs] [-client_sigalgs algs] [-groups groups] [-curves curves] [-named_curve curve] [-cipher ciphers] [-ciphersuites 1.3ciphers] [-min_protocol minprot] [-max_protocol maxprot] [-record_padding padding] [-debug_broken_protocol] [-no_middlebox] [-xkey infile] [-xcert file] [-xchain file] [-xchain_build file] [-xcertform DER|PEM]> [-xkeyform DER|PEM]> [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-s_server/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command implements a generic SSL/TLS server which listens for connections on a given port using SSL/TLS.

                                                                                                                                      "},{"location":"man1/openssl-s_server/#options","title":"OPTIONS","text":"

                                                                                                                                      In addition to the options below, this command also supports the common and server only options documented \"Supported Command Line Commands\" in SSL_CONF_cmd(3)

                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -port +int

                                                                                                                                        The TCP port to listen on for connections. If not specified 4433 is used.

                                                                                                                                      • -accept val

                                                                                                                                        The optional TCP host and port to listen on for connections. If not specified, *:4433 is used.

                                                                                                                                      • -unix val

                                                                                                                                        Unix domain socket to accept on.

                                                                                                                                      • -4

                                                                                                                                        Use IPv4 only.

                                                                                                                                      • -6

                                                                                                                                        Use IPv6 only.

                                                                                                                                      • -unlink

                                                                                                                                        For -unix, unlink any existing socket first.

                                                                                                                                      • -context val

                                                                                                                                        Sets the SSL context id. It can be given any string value. If this option is not present a default value will be used.

                                                                                                                                      • -verify int, -Verify int

                                                                                                                                        The verify depth to use. This specifies the maximum length of the client certificate chain and makes the server request a certificate from the client. With the -verify option a certificate is requested but the client does not have to send one, with the -Verify option the client must supply a certificate or an error occurs.

                                                                                                                                        If the cipher suite cannot request a client certificate (for example an anonymous cipher suite or PSK) this option has no effect.

                                                                                                                                      • -cert infile

                                                                                                                                        The certificate to use, most servers cipher suites require the use of a certificate and some require a certificate with a certain public key type: for example the DSS cipher suites require a certificate containing a DSS (DSA) key. If not specified then the filename server.pem will be used.

                                                                                                                                      • -cert2 infile

                                                                                                                                        The certificate file to use for servername; default is server2.pem.

                                                                                                                                      • -certform DER|PEM|P12

                                                                                                                                        The server certificate file format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -cert_chain

                                                                                                                                        A file or URI of untrusted certificates to use when attempting to build the certificate chain related to the certificate specified via the -cert option. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -build_chain

                                                                                                                                        Specify whether the application should build the server certificate chain to be provided to the client.

                                                                                                                                      • -serverinfo val

                                                                                                                                        A file containing one or more blocks of PEM data. Each PEM block must encode a TLS ServerHello extension (2 bytes type, 2 bytes length, followed by \"length\" bytes of extension data). If the client sends an empty TLS ClientHello extension matching the type, the corresponding ServerHello extension will be returned.

                                                                                                                                      • -key filename|uri

                                                                                                                                        The private key to use. If not specified then the certificate file will be used.

                                                                                                                                      • -key2 filename|uri

                                                                                                                                        The private Key file to use for servername if not given via -cert2.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The key format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -pass val

                                                                                                                                        The private key and certificate file password source. For more information about the format of val, see openssl-passphrase-options(1).

                                                                                                                                      • -dcert infile, -dkey filename|uri

                                                                                                                                        Specify an additional certificate and private key, these behave in the same manner as the -cert and -key options except there is no default if they are not specified (no additional certificate and key is used). As noted above some cipher suites require a certificate containing a key of a certain type. Some cipher suites need a certificate carrying an RSA key and some a DSS (DSA) key. By using RSA and DSS certificates and keys a server can support clients which only support RSA or DSS cipher suites by using an appropriate certificate.

                                                                                                                                      • -dcert_chain

                                                                                                                                        A file or URI of untrusted certificates to use when attempting to build the server certificate chain when a certificate specified via the -dcert option is in use. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -dcertform DER|PEM|P12

                                                                                                                                        The format of the additional certificate file; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -dkeyform DER|PEM|P12|ENGINE

                                                                                                                                        The format of the additional private key; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -dpass val

                                                                                                                                        The passphrase for the additional private key and certificate. For more information about the format of val, see openssl-passphrase-options(1).

                                                                                                                                      • -nbio_test

                                                                                                                                        Tests non blocking I/O.

                                                                                                                                      • -crlf

                                                                                                                                        This option translated a line feed from the terminal into CR+LF.

                                                                                                                                      • -debug

                                                                                                                                        Print extensive debugging information including a hex dump of all traffic.

                                                                                                                                      • -security_debug

                                                                                                                                        Print output from SSL/TLS security framework.

                                                                                                                                      • -security_debug_verbose

                                                                                                                                        Print more output from SSL/TLS security framework

                                                                                                                                      • -msg

                                                                                                                                        Show all protocol messages with hex dump.

                                                                                                                                      • -msgfile outfile

                                                                                                                                        File to send output of -msg or -trace to, default standard output.

                                                                                                                                      • -state

                                                                                                                                        Prints the SSL session states.

                                                                                                                                      • -CRL infile

                                                                                                                                        The CRL file to use.

                                                                                                                                      • -CRLform DER|PEM

                                                                                                                                        The CRL file format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -crl_download

                                                                                                                                        Download CRLs from distribution points given in CDP extensions of certificates

                                                                                                                                      • -verifyCAfile filename

                                                                                                                                        A file in PEM format CA containing trusted certificates to use for verifying client certificates.

                                                                                                                                      • -verifyCApath dir

                                                                                                                                        A directory containing trusted certificates to use for verifying client certificates. This directory must be in \"hash format\", see openssl-verify(1) for more information.

                                                                                                                                      • -verifyCAstore uri

                                                                                                                                        The URI of a store containing trusted certificates to use for verifying client certificates.

                                                                                                                                      • -chainCAfile file

                                                                                                                                        A file in PEM format containing trusted certificates to use when attempting to build the server certificate chain.

                                                                                                                                      • -chainCApath dir

                                                                                                                                        A directory containing trusted certificates to use for building the server certificate chain provided to the client. This directory must be in \"hash format\", see openssl-verify(1) for more information.

                                                                                                                                      • -chainCAstore uri

                                                                                                                                        The URI of a store containing trusted certificates to use for building the server certificate chain provided to the client. The URI may indicate a single certificate, as well as a collection of them. With URIs in the file: scheme, this acts as -chainCAfile or -chainCApath, depending on if the URI indicates a directory or a single file. See ossl_store-file(7) for more information on the file: scheme.

                                                                                                                                      • -nocert

                                                                                                                                        If this option is set then no certificate is used. This restricts the cipher suites available to the anonymous ones (currently just anonymous DH).

                                                                                                                                      • -quiet

                                                                                                                                        Inhibit printing of session and certificate information.

                                                                                                                                      • -no_resume_ephemeral

                                                                                                                                        Disable caching and tickets if ephemeral (EC)DH is used.

                                                                                                                                      • -tlsextdebug

                                                                                                                                        Print a hex dump of any TLS extensions received from the server.

                                                                                                                                      • -www

                                                                                                                                        Sends a status message back to the client when it connects. This includes information about the ciphers used and various session parameters. The output is in HTML format so this option can be used with a web browser. The special URL /renegcert turns on client cert validation, and /reneg tells the server to request renegotiation. The -early_data option cannot be used with this option.

                                                                                                                                      • -WWW, -HTTP

                                                                                                                                        Emulates a simple web server. Pages will be resolved relative to the current directory, for example if the URL https://myhost/page.html is requested the file ./page.html will be sent. If the -HTTP flag is used, the files are sent directly, and should contain any HTTP response headers (including status response line). If the -WWW option is used, the response headers are generated by the server, and the file extension is examined to determine the Content-Type header. Extensions of html, htm, and php are text/html and all others are text/plain. In addition, the special URL /stats will return status information like the -www option. Neither of these options can be used in conjunction with -early_data.

                                                                                                                                      • -http_server_binmode

                                                                                                                                        When acting as web-server (using option -WWW or -HTTP) open files requested by the client in binary mode.

                                                                                                                                      • -no_ca_names

                                                                                                                                        Disable TLS Extension CA Names. You may want to disable it for security reasons or for compatibility with some Windows TLS implementations crashing when this extension is larger than 1024 bytes.

                                                                                                                                      • -ignore_unexpected_eof

                                                                                                                                        Some TLS implementations do not send the mandatory close_notify alert on shutdown. If the application tries to wait for the close_notify alert but the peer closes the connection without sending it, an error is generated. When this option is enabled the peer does not need to send the close_notify alert and a closed connection will be treated as if the close_notify alert was received. For more information on shutting down a connection, see SSL_shutdown(3).

                                                                                                                                      • -servername

                                                                                                                                        Servername for HostName TLS extension.

                                                                                                                                      • -servername_fatal

                                                                                                                                        On servername mismatch send fatal alert (default: warning alert).

                                                                                                                                      • -id_prefix val

                                                                                                                                        Generate SSL/TLS session IDs prefixed by val. This is mostly useful for testing any SSL/TLS code (e.g. proxies) that wish to deal with multiple servers, when each of which might be generating a unique range of session IDs (e.g. with a certain prefix).

                                                                                                                                      • -keymatexport

                                                                                                                                        Export keying material using label.

                                                                                                                                      • -keymatexportlen

                                                                                                                                        Export the given number of bytes of keying material; default 20.

                                                                                                                                      • -no_cache

                                                                                                                                        Disable session cache.

                                                                                                                                      • -ext_cache.

                                                                                                                                        Disable internal cache, set up and use external cache.

                                                                                                                                      • -verify_return_error

                                                                                                                                        Verification errors normally just print a message but allow the connection to continue, for debugging purposes. If this option is used, then verification errors close the connection.

                                                                                                                                      • -verify_quiet

                                                                                                                                        No verify output except verify errors.

                                                                                                                                      • -ign_eof

                                                                                                                                        Ignore input EOF (default: when -quiet).

                                                                                                                                      • -no_ign_eof

                                                                                                                                        Do not ignore input EOF.

                                                                                                                                      • -no_etm

                                                                                                                                        Disable Encrypt-then-MAC negotiation.

                                                                                                                                      • -status

                                                                                                                                        Enables certificate status request support (aka OCSP stapling).

                                                                                                                                      • -status_verbose

                                                                                                                                        Enables certificate status request support (aka OCSP stapling) and gives a verbose printout of the OCSP response.

                                                                                                                                      • -status_timeout int

                                                                                                                                        Sets the timeout for OCSP response to int seconds.

                                                                                                                                      • -proxy [http[s]://][userinfo@]host[:port][/path]

                                                                                                                                        The HTTP(S) proxy server to use for reaching the OCSP server unless -no_proxy applies, see below. The proxy port defaults to 80 or 443 if the scheme is https; apart from that the optional http:// or https:// prefix is ignored, as well as any userinfo and path components. Defaults to the environment variable http_proxy if set, else HTTP_PROXY in case no TLS is used, otherwise https_proxy if set, else HTTPS_PROXY.

                                                                                                                                      • -no_proxy addresses

                                                                                                                                        List of IP addresses and/or DNS names of servers not to use an HTTP(S) proxy for, separated by commas and/or whitespace (where in the latter case the whole argument must be enclosed in \"...\"). Default is from the environment variable no_proxy if set, else NO_PROXY.

                                                                                                                                      • -status_url val

                                                                                                                                        Sets a fallback responder URL to use if no responder URL is present in the server certificate. Without this option an error is returned if the server certificate does not contain a responder address. The optional userinfo and fragment URL components are ignored. Any given query component is handled as part of the path component.

                                                                                                                                      • -status_file infile

                                                                                                                                        Overrides any OCSP responder URLs from the certificate and always provides the OCSP Response stored in the file. The file must be in DER format.

                                                                                                                                      • -ssl_config val

                                                                                                                                        Configure SSL_CTX using the given configuration value.

                                                                                                                                      • -trace

                                                                                                                                        Show verbose trace output of protocol messages.

                                                                                                                                      • -brief

                                                                                                                                        Provide a brief summary of connection parameters instead of the normal verbose output.

                                                                                                                                      • -rev

                                                                                                                                        Simple echo server that sends back received text reversed. Also sets -brief. Cannot be used in conjunction with -early_data.

                                                                                                                                      • -async

                                                                                                                                        Switch on asynchronous mode. Cryptographic operations will be performed asynchronously. This will only have an effect if an asynchronous capable engine is also used via the -engine option. For test purposes the dummy async engine (dasync) can be used (if available).

                                                                                                                                      • -max_send_frag +int

                                                                                                                                        The maximum size of data fragment to send. See SSL_CTX_set_max_send_fragment(3) for further information.

                                                                                                                                      • -split_send_frag +int

                                                                                                                                        The size used to split data for encrypt pipelines. If more data is written in one go than this value then it will be split into multiple pipelines, up to the maximum number of pipelines defined by max_pipelines. This only has an effect if a suitable cipher suite has been negotiated, an engine that supports pipelining has been loaded, and max_pipelines is greater than 1. See SSL_CTX_set_split_send_fragment(3) for further information.

                                                                                                                                      • -max_pipelines +int

                                                                                                                                        The maximum number of encrypt/decrypt pipelines to be used. This will only have an effect if an engine has been loaded that supports pipelining (e.g. the dasync engine) and a suitable cipher suite has been negotiated. The default value is 1. See SSL_CTX_set_max_pipelines(3) for further information.

                                                                                                                                      • -naccept +int

                                                                                                                                        The server will exit after receiving the specified number of connections, default unlimited.

                                                                                                                                      • -read_buf +int

                                                                                                                                        The default read buffer size to be used for connections. This will only have an effect if the buffer size is larger than the size that would otherwise be used and pipelining is in use (see SSL_CTX_set_default_read_buffer_len(3) for further information).

                                                                                                                                      • -bugs

                                                                                                                                        There are several known bugs in SSL and TLS implementations. Adding this option enables various workarounds.

                                                                                                                                      • -no_comp

                                                                                                                                        Disable negotiation of TLS compression. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

                                                                                                                                      • -comp

                                                                                                                                        Enable negotiation of TLS compression. This option was introduced in OpenSSL 1.1.0. TLS compression is not recommended and is off by default as of OpenSSL 1.1.0.

                                                                                                                                      • -no_ticket

                                                                                                                                        Disable RFC4507bis session ticket support. This option has no effect if TLSv1.3 is negotiated. See -num_tickets.

                                                                                                                                      • -num_tickets

                                                                                                                                        Control the number of tickets that will be sent to the client after a full handshake in TLSv1.3. The default number of tickets is 2. This option does not affect the number of tickets sent after a resumption handshake.

                                                                                                                                      • -serverpref

                                                                                                                                        Use the server's cipher preferences, rather than the client's preferences.

                                                                                                                                      • -prioritize_chacha

                                                                                                                                        Prioritize ChaCha ciphers when preferred by clients. Requires -serverpref.

                                                                                                                                      • -no_resumption_on_reneg

                                                                                                                                        Set the SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION option.

                                                                                                                                      • -client_sigalgs val

                                                                                                                                        Signature algorithms to support for client certificate authentication (colon-separated list).

                                                                                                                                      • -named_curve val

                                                                                                                                        Specifies the elliptic curve to use. NOTE: this is single curve, not a list.

                                                                                                                                        The list of all supported groups includes named EC parameters as well as X25519 and X448 or FFDHE groups, and may also include groups implemented in 3rd-party providers. For a list of named EC parameters, use:

                                                                                                                                        $ openssl ecparam -list_curves\n
                                                                                                                                      • -cipher val

                                                                                                                                        This allows the list of TLSv1.2 and below ciphersuites used by the server to be modified. This list is combined with any TLSv1.3 ciphersuites that have been configured. When the client sends a list of supported ciphers the first client cipher also included in the server list is used. Because the client specifies the preference order, the order of the server cipherlist is irrelevant. See openssl-ciphers(1) for more information.

                                                                                                                                      • -ciphersuites val

                                                                                                                                        This allows the list of TLSv1.3 ciphersuites used by the server to be modified. This list is combined with any TLSv1.2 and below ciphersuites that have been configured. When the client sends a list of supported ciphers the first client cipher also included in the server list is used. Because the client specifies the preference order, the order of the server cipherlist is irrelevant. See openssl-ciphers(1) command for more information. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names.

                                                                                                                                      • -dhparam infile

                                                                                                                                        The DH parameter file to use. The ephemeral DH cipher suites generate keys using a set of DH parameters. If not specified then an attempt is made to load the parameters from the server certificate file. If this fails then a static set of parameters hard coded into this command will be used.

                                                                                                                                      • -nbio

                                                                                                                                        Turns on non blocking I/O.

                                                                                                                                      • -timeout

                                                                                                                                        Enable timeouts.

                                                                                                                                      • -mtu

                                                                                                                                        Set link-layer MTU.

                                                                                                                                      • -psk_identity val

                                                                                                                                        Expect the client to send PSK identity val when using a PSK cipher suite, and warn if they do not. By default, the expected PSK identity is the string \"Client_identity\".

                                                                                                                                      • -psk_hint val

                                                                                                                                        Use the PSK identity hint val when using a PSK cipher suite.

                                                                                                                                      • -psk val

                                                                                                                                        Use the PSK key val when using a PSK cipher suite. The key is given as a hexadecimal number without leading 0x, for example -psk 1a2b3c4d. This option must be provided in order to use a PSK cipher.

                                                                                                                                      • -psk_session file

                                                                                                                                        Use the pem encoded SSL_SESSION data stored in file as the basis of a PSK. Note that this will only work if TLSv1.3 is negotiated.

                                                                                                                                      • -srpvfile

                                                                                                                                        The verifier file for SRP. This option is deprecated.

                                                                                                                                      • -srpuserseed

                                                                                                                                        A seed string for a default user salt. This option is deprecated.

                                                                                                                                      • -listen

                                                                                                                                        This option can only be used in conjunction with one of the DTLS options above. With this option, this command will listen on a UDP port for incoming connections. Any ClientHellos that arrive will be checked to see if they have a cookie in them or not. Any without a cookie will be responded to with a HelloVerifyRequest. If a ClientHello with a cookie is received then this command will connect to that peer and complete the handshake.

                                                                                                                                      • -sctp

                                                                                                                                        Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in conjunction with -dtls, -dtls1 or -dtls1_2. This option is only available where OpenSSL has support for SCTP enabled.

                                                                                                                                      • -sctp_label_bug

                                                                                                                                        Use the incorrect behaviour of older OpenSSL implementations when computing endpoint-pair shared secrets for DTLS/SCTP. This allows communication with older broken implementations but breaks interoperability with correct implementations. Must be used in conjunction with -sctp. This option is only available where OpenSSL has support for SCTP enabled.

                                                                                                                                      • -use_srtp

                                                                                                                                        Offer SRTP key management with a colon-separated profile list.

                                                                                                                                      • -no_dhe

                                                                                                                                        If this option is set then no DH parameters will be loaded effectively disabling the ephemeral DH cipher suites.

                                                                                                                                      • -alpn val, -nextprotoneg val

                                                                                                                                        These flags enable the Application-Layer Protocol Negotiation or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the IETF standard and replaces NPN. The val list is a comma-separated list of supported protocol names. The list should contain the most desirable protocols first. Protocol names are printable ASCII strings, for example \"http/1.1\" or \"spdy/3\". The flag -nextprotoneg cannot be specified if -tls1_3 is used.

                                                                                                                                      • -sendfile

                                                                                                                                        If this option is set and KTLS is enabled, SSL_sendfile() will be used instead of BIO_write() to send the HTTP response requested by a client. This option is only valid if -WWW or -HTTP is specified.

                                                                                                                                      • -keylogfile outfile

                                                                                                                                        Appends TLS secrets to the specified keylog file such that external programs (like Wireshark) can decrypt TLS connections.

                                                                                                                                      • -max_early_data int

                                                                                                                                        Change the default maximum early data bytes that are specified for new sessions and any incoming early data (when used in conjunction with the -early_data flag). The default value is approximately 16k. The argument must be an integer greater than or equal to 0.

                                                                                                                                      • -recv_max_early_data int

                                                                                                                                        Specify the hard limit on the maximum number of early data bytes that will be accepted.

                                                                                                                                      • -early_data

                                                                                                                                        Accept early data where possible. Cannot be used in conjunction with -www, -WWW, -HTTP or -rev.

                                                                                                                                      • -stateless

                                                                                                                                        Require TLSv1.3 cookies.

                                                                                                                                      • -anti_replay, -no_anti_replay

                                                                                                                                        Switches replay protection on or off, respectively. Replay protection is on by default unless overridden by a configuration file. When it is on, OpenSSL will automatically detect if a session ticket has been used more than once, TLSv1.3 has been negotiated, and early data is enabled on the server. A full handshake is forced if a session ticket is used a second or subsequent time. Any early data that was sent will be rejected.

                                                                                                                                      • -nameopt option

                                                                                                                                        This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3, -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3

                                                                                                                                        See \"TLS Version Options\" in openssl(1).

                                                                                                                                      • -dtls, -dtls1, -dtls1_2

                                                                                                                                        These specify the use of DTLS instead of TLS. See \"TLS Version Options\" in openssl(1).

                                                                                                                                      • -bugs, -comp, -no_comp, -no_ticket, -serverpref, -client_renegotiation, -legacy_renegotiation, -no_renegotiation, -no_resumption_on_reneg, -legacy_server_connect, -no_legacy_server_connect, -no_etm -allow_no_dhe_kex, -prioritize_chacha, -strict, -sigalgs algs, -client_sigalgs algs, -groups groups, -curves curves, -named_curve curve, -cipher ciphers, -ciphersuites 1.3ciphers, -min_protocol minprot, -max_protocol maxprot, -record_padding padding, -debug_broken_protocol, -no_middlebox

                                                                                                                                        See \"SUPPORTED COMMAND LINE COMMANDS\" in SSL_CONF_cmd(3) for details.

                                                                                                                                      • -xkey infile, -xcert file, -xchain file, -xchain_build file, -xcertform DER|PEM, -xkeyform DER|PEM

                                                                                                                                        Set extended certificate verification options. See \"Extended Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                        If the server requests a client certificate, then verification errors are displayed, for debugging, but the command will proceed unless the -verify_return_error option is used.

                                                                                                                                      "},{"location":"man1/openssl-s_server/#connected-commands","title":"CONNECTED COMMANDS","text":"

                                                                                                                                      If a connection request is established with an SSL client and neither the -www nor the -WWW option has been used then normally any data received from the client is displayed and any key presses will be sent to the client.

                                                                                                                                      Certain commands are also recognized which perform special operations. These commands are a letter which must appear at the start of a line. They are listed below.

                                                                                                                                      • q

                                                                                                                                        End the current SSL connection but still accept new connections.

                                                                                                                                      • Q

                                                                                                                                        End the current SSL connection and exit.

                                                                                                                                      • r

                                                                                                                                        Renegotiate the SSL session (TLSv1.2 and below only).

                                                                                                                                      • R

                                                                                                                                        Renegotiate the SSL session and request a client certificate (TLSv1.2 and below only).

                                                                                                                                      • P

                                                                                                                                        Send some plain text down the underlying TCP connection: this should cause the client to disconnect due to a protocol violation.

                                                                                                                                      • S

                                                                                                                                        Print out some session cache status information.

                                                                                                                                      • k

                                                                                                                                        Send a key update message to the client (TLSv1.3 only)

                                                                                                                                      • K

                                                                                                                                        Send a key update message to the client and request one back (TLSv1.3 only)

                                                                                                                                      • c

                                                                                                                                        Send a certificate request to the client (TLSv1.3 only)

                                                                                                                                      "},{"location":"man1/openssl-s_server/#notes","title":"NOTES","text":"

                                                                                                                                      This command can be used to debug SSL clients. To accept connections from a web browser the command:

                                                                                                                                      openssl s_server -accept 443 -www\n

                                                                                                                                      can be used for example.

                                                                                                                                      Although specifying an empty list of CAs when requesting a client certificate is strictly speaking a protocol violation, some SSL clients interpret this to mean any CA is acceptable. This is useful for debugging purposes.

                                                                                                                                      The session parameters can printed out using the openssl-sess_id(1) command.

                                                                                                                                      "},{"location":"man1/openssl-s_server/#bugs","title":"BUGS","text":"

                                                                                                                                      Because this program has a lot of options and also because some of the techniques used are rather old, the C source for this command is rather hard to read and not a model of how things should be done. A typical SSL server program would be much simpler.

                                                                                                                                      The output of common ciphers is wrong: it just gives the list of ciphers that OpenSSL recognizes and the client supports.

                                                                                                                                      There should be a way for this command to print out details of any unknown cipher suites a client says it supports.

                                                                                                                                      "},{"location":"man1/openssl-s_server/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-sess_id(1), openssl-s_client(1), openssl-ciphers(1), SSL_CONF_cmd(3), SSL_CTX_set_max_send_fragment(3), SSL_CTX_set_split_send_fragment(3), SSL_CTX_set_max_pipelines(3), ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-s_server/#history","title":"HISTORY","text":"

                                                                                                                                      The -no_alt_chains option was added in OpenSSL 1.1.0.

                                                                                                                                      The -allow-no-dhe-kex and -prioritize_chacha options were added in OpenSSL 1.1.1.

                                                                                                                                      The -srpvfile, -srpuserseed, and -engine option were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-s_server/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-s_time/","title":"openssl-s_time","text":""},{"location":"man1/openssl-s_time/#name","title":"NAME","text":"

                                                                                                                                      openssl-s_time - SSL/TLS performance timing program

                                                                                                                                      "},{"location":"man1/openssl-s_time/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl s_time [-help] [-connect host:port] [-www page] [-cert filename] [-key filename] [-reuse] [-new] [-verify depth] [-time seconds] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-bugs] [-cipher cipherlist] [-ciphersuites val] [-nameopt option] [-cafile file] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-s_time/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command implements a generic SSL/TLS client which connects to a remote host using SSL/TLS. It can request a page from the server and includes the time to transfer the payload data in its timing measurements. It measures the number of connections within a given timeframe, the amount of data transferred (if any), and calculates the average time spent for one connection.

                                                                                                                                      "},{"location":"man1/openssl-s_time/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -connect host:port

                                                                                                                                        This specifies the host and optional port to connect to.

                                                                                                                                      • -www page

                                                                                                                                        This specifies the page to GET from the server. A value of '/' gets the index.html page. If this parameter is not specified, then this command will only perform the handshake to establish SSL connections but not transfer any payload data.

                                                                                                                                      • -cert certname

                                                                                                                                        The certificate to use, if one is requested by the server. The default is not to use a certificate. The file is in PEM format.

                                                                                                                                      • -key keyfile

                                                                                                                                        The private key to use. If not specified then the certificate file will be used. The file is in PEM format.

                                                                                                                                      • -verify depth

                                                                                                                                        The verify depth to use. This specifies the maximum length of the server certificate chain and turns on server certificate verification. Currently the verify operation continues after errors so all the problems with a certificate chain can be seen. As a side effect the connection will never fail due to a server certificate verify failure.

                                                                                                                                      • -new

                                                                                                                                        Performs the timing test using a new session ID for each connection. If neither -new nor -reuse are specified, they are both on by default and executed in sequence.

                                                                                                                                      • -reuse

                                                                                                                                        Performs the timing test using the same session ID; this can be used as a test that session caching is working. If neither -new nor -reuse are specified, they are both on by default and executed in sequence.

                                                                                                                                      • -bugs

                                                                                                                                        There are several known bugs in SSL and TLS implementations. Adding this option enables various workarounds.

                                                                                                                                      • -cipher cipherlist

                                                                                                                                        This allows the TLSv1.2 and below cipher list sent by the client to be modified. This list will be combined with any TLSv1.3 ciphersuites that have been configured. Although the server determines which cipher suite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information.

                                                                                                                                      • -ciphersuites val

                                                                                                                                        This allows the TLSv1.3 ciphersuites sent by the client to be modified. This list will be combined with any TLSv1.2 and below ciphersuites that have been configured. Although the server determines which cipher suite is used it should take the first supported cipher in the list sent by the client. See openssl-ciphers(1) for more information. The format for this list is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names.

                                                                                                                                      • -time length

                                                                                                                                        Specifies how long (in seconds) this command should establish connections and optionally transfer payload data from a server. Server and client performance and the link speed determine how many connections it can establish.

                                                                                                                                      • -nameopt option

                                                                                                                                        This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -cafile file

                                                                                                                                        This is an obsolete synonym for -CAfile.

                                                                                                                                      • -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3

                                                                                                                                        See \"TLS Version Options\" in openssl(1).

                                                                                                                                      "},{"location":"man1/openssl-s_time/#notes","title":"NOTES","text":"

                                                                                                                                      This command can be used to measure the performance of an SSL connection. To connect to an SSL HTTP server and get the default page the command

                                                                                                                                      openssl s_time -connect servername:443 -www / -CApath yourdir -CAfile yourfile.pem -cipher commoncipher [-ssl3]\n

                                                                                                                                      would typically be used (https uses port 443). commoncipher is a cipher to which both client and server can agree, see the openssl-ciphers(1) command for details.

                                                                                                                                      If the handshake fails then there are several possible causes, if it is nothing obvious like no client certificate then the -bugs and -ssl3 options can be tried in case it is a buggy server. In particular you should play with these options before submitting a bug report to an OpenSSL mailing list.

                                                                                                                                      A frequent problem when attempting to get client certificates working is that a web client complains it has no certificates or gives an empty list to choose from. This is normally because the server is not sending the clients certificate authority in its \"acceptable CA list\" when it requests a certificate. By using openssl-s_client(1) the CA list can be viewed and checked. However, some servers only request client authentication after a specific URL is requested. To obtain the list in this case it is necessary to use the -prexit option of openssl-s_client(1) and send an HTTP request for an appropriate page.

                                                                                                                                      If a certificate is specified on the command line using the -cert option it will not be used unless the server specifically requests a client certificate. Therefore, merely including a client certificate on the command line is no guarantee that the certificate works.

                                                                                                                                      "},{"location":"man1/openssl-s_time/#bugs","title":"BUGS","text":"

                                                                                                                                      Because this program does not have all the options of the openssl-s_client(1) program to turn protocols on and off, you may not be able to measure the performance of all protocols with all servers.

                                                                                                                                      The -verify option should really exit if the server verification fails.

                                                                                                                                      "},{"location":"man1/openssl-s_time/#history","title":"HISTORY","text":"

                                                                                                                                      The -cafile option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-s_time/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-s_client(1), openssl-s_server(1), openssl-ciphers(1), ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-s_time/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-sess_id/","title":"openssl-sess_id","text":""},{"location":"man1/openssl-sess_id/#name","title":"NAME","text":"

                                                                                                                                      openssl-sess_id - SSL/TLS session handling command

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl sess_id [-help] [-inform DER|PEM] [-outform DER|PEM|NSS] [-in filename] [-out filename] [-text] [-cert] [-noout] [-context ID]

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes the encoded version of the SSL session structure and optionally prints out SSL session details (for example the SSL session master key) in human readable format. Since this is a diagnostic tool that needs some knowledge of the SSL protocol to use properly, most users will not need to use it.

                                                                                                                                      The precise format of the data can vary across OpenSSL versions and is not documented.

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -inform DER|PEM, -outform DER|PEM|NSS

                                                                                                                                        The input and output formats; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                        For NSS output, the session ID and master key are reported in NSS \"keylog\" format.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read session information from or standard input by default.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write session information to or standard output if this option is not specified.

                                                                                                                                      • -text

                                                                                                                                        Prints out the various public or private key components in plain text in addition to the encoded version.

                                                                                                                                      • -cert

                                                                                                                                        If a certificate is present in the session it will be output using this option, if the -text option is also present then it will be printed out in text form.

                                                                                                                                      • -noout

                                                                                                                                        This option prevents output of the encoded version of the session.

                                                                                                                                      • -context ID

                                                                                                                                        This option can set the session id so the output session information uses the supplied ID. The ID can be any string of characters. This option won't normally be used.

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#output","title":"OUTPUT","text":"

                                                                                                                                      Typical output:

                                                                                                                                      SSL-Session:\n    Protocol  : TLSv1\n    Cipher    : 0016\n    Session-ID: 871E62626C554CE95488823752CBD5F3673A3EF3DCE9C67BD916C809914B40ED\n    Session-ID-ctx: 01000000\n    Master-Key: A7CEFC571974BE02CAC305269DC59F76EA9F0B180CB6642697A68251F2D2BB57E51DBBB4C7885573192AE9AEE220FACD\n    Key-Arg   : None\n    Start Time: 948459261\n    Timeout   : 300 (sec)\n    Verify return code 0 (ok)\n

                                                                                                                                      These are described below in more detail.

                                                                                                                                      • Protocol

                                                                                                                                        This is the protocol in use TLSv1.3, TLSv1.2, TLSv1.1, TLSv1 or SSLv3.

                                                                                                                                      • Cipher

                                                                                                                                        The cipher used this is the actual raw SSL or TLS cipher code, see the SSL or TLS specifications for more information.

                                                                                                                                      • Session-ID

                                                                                                                                        The SSL session ID in hex format.

                                                                                                                                      • Session-ID-ctx

                                                                                                                                        The session ID context in hex format.

                                                                                                                                      • Master-Key

                                                                                                                                        This is the SSL session master key.

                                                                                                                                      • Start Time

                                                                                                                                        This is the session start time represented as an integer in standard Unix format.

                                                                                                                                      • Timeout

                                                                                                                                        The timeout in seconds.

                                                                                                                                      • Verify return code

                                                                                                                                        This is the return code when an SSL client certificate is verified.

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#notes","title":"NOTES","text":"

                                                                                                                                      Since the SSL session output contains the master key it is possible to read the contents of an encrypted session using this information. Therefore, appropriate security precautions should be taken if the information is being output by a \"real\" application. This is however strongly discouraged and should only be used for debugging purposes.

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#bugs","title":"BUGS","text":"

                                                                                                                                      The cipher and start time should be printed out in human readable form.

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-ciphers(1), openssl-s_server(1)

                                                                                                                                      "},{"location":"man1/openssl-sess_id/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-smime/","title":"openssl-smime","text":""},{"location":"man1/openssl-smime/#name","title":"NAME","text":"

                                                                                                                                      openssl-smime - S/MIME command

                                                                                                                                      "},{"location":"man1/openssl-smime/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl smime [-help] [-encrypt] [-decrypt] [-sign] [-resign] [-verify] [-pk7out] [-binary] [-crlfeol] [-cipher] [-in file] [-certfile file] [-signer file] [-nointern] [-noverify] [-nochain] [-nosigs] [-nocerts] [-noattr] [-nodetach] [-nosmimecap] [-recip _ file_] [-inform DER|PEM|SMIME] [-outform DER|PEM|SMIME] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-inkey filename|uri] [-out file] [-content file] [-to addr] [-from ad] [-subject s] [-text] [-indef] [-noindef] [-stream] [-md digest] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-engine id] [-rand files] [-writerand file] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq] [-config configfile] recipcert ...

                                                                                                                                      "},{"location":"man1/openssl-smime/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command handles S/MIME mail. It can encrypt, decrypt, sign and verify S/MIME messages.

                                                                                                                                      "},{"location":"man1/openssl-smime/#options","title":"OPTIONS","text":"

                                                                                                                                      There are six operation options that set the type of operation to be performed. The meaning of the other options varies according to the operation type.

                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -encrypt

                                                                                                                                        Encrypt mail for the given recipient certificates. Input file is the message to be encrypted. The output file is the encrypted mail in MIME format.

                                                                                                                                        Note that no revocation check is done for the recipient cert, so if that key has been compromised, others may be able to decrypt the text.

                                                                                                                                      • -decrypt

                                                                                                                                        Decrypt mail using the supplied certificate and private key. Expects an encrypted mail message in MIME format for the input file. The decrypted mail is written to the output file.

                                                                                                                                      • -sign

                                                                                                                                        Sign mail using the supplied certificate and private key. Input file is the message to be signed. The signed message in MIME format is written to the output file.

                                                                                                                                      • -verify

                                                                                                                                        Verify signed mail. Expects a signed mail message on input and outputs the signed data. Both clear text and opaque signing is supported.

                                                                                                                                      • -pk7out

                                                                                                                                        Takes an input message and writes out a PEM encoded PKCS#7 structure.

                                                                                                                                      • -resign

                                                                                                                                        Resign a message: take an existing message and one or more new signers.

                                                                                                                                      • -in filename

                                                                                                                                        The input message to be encrypted or signed or the MIME message to be decrypted or verified.

                                                                                                                                      • -out filename

                                                                                                                                        The message text that has been decrypted or verified or the output MIME format message that has been signed or verified.

                                                                                                                                      • -inform DER|PEM|SMIME

                                                                                                                                        The input format of the PKCS#7 (S/MIME) structure (if one is being read); the default is SMIME. See openssl-format-options(1) for details.

                                                                                                                                      • -outform DER|PEM|SMIME

                                                                                                                                        The output format of the PKCS#7 (S/MIME) structure (if one is being written); the default is SMIME. See openssl-format-options(1) for details.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The key format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -stream, -indef, -noindef

                                                                                                                                        The -stream and -indef options are equivalent and enable streaming I/O for encoding operations. This permits single pass processing of data without the need to hold the entire contents in memory, potentially supporting very large files. Streaming is automatically set for S/MIME signing with detached data if the output format is SMIME it is currently off by default for all other operations.

                                                                                                                                      • -noindef

                                                                                                                                        Disable streaming I/O where it would produce and indefinite length constructed encoding. This option currently has no effect. In future streaming will be enabled by default on all relevant operations and this option will disable it.

                                                                                                                                      • -content filename

                                                                                                                                        This specifies a file containing the detached content, this is only useful with the -verify command. This is only usable if the PKCS#7 structure is using the detached signature form where the content is not included. This option will override any content if the input format is S/MIME and it uses the multipart/signed MIME content type.

                                                                                                                                      • -text

                                                                                                                                        This option adds plain text (text/plain) MIME headers to the supplied message if encrypting or signing. If decrypting or verifying it strips off text headers: if the decrypted or verified message is not of MIME type text/plain then an error occurs.

                                                                                                                                      • -md digest

                                                                                                                                        Digest algorithm to use when signing or resigning. If not present then the default digest algorithm for the signing key will be used (usually SHA1).

                                                                                                                                      • -cipher

                                                                                                                                        The encryption algorithm to use. For example DES (56 bits) - -des, triple DES (168 bits) - -des3, EVP_get_cipherbyname() function) can also be used preceded by a dash, for example -aes-128-cbc. See openssl-enc(1) for list of ciphers supported by your version of OpenSSL.

                                                                                                                                        If not specified triple DES is used. Only used with -encrypt.

                                                                                                                                      • -nointern

                                                                                                                                        When verifying a message normally certificates (if any) included in the message are searched for the signing certificate. With this option only the certificates specified in the -certfile option are used. The supplied certificates can still be used as untrusted CAs however.

                                                                                                                                      • -noverify

                                                                                                                                        Do not verify the signers certificate of a signed message.

                                                                                                                                      • -nochain

                                                                                                                                        Do not do chain verification of signers certificates; that is, do not use the certificates in the signed message as untrusted CAs.

                                                                                                                                      • -nosigs

                                                                                                                                        Don't try to verify the signatures on the message.

                                                                                                                                      • -nocerts

                                                                                                                                        When signing a message, the signer's certificate is normally included. With this option it is excluded. This will reduce the size of the signed message, but the verifier must have a copy of the signers certificate available locally (passed using the -certfile option for example).

                                                                                                                                      • -noattr

                                                                                                                                        Normally, when a message is signed, a set of attributes are included which include the signing time and supported symmetric algorithms. With this option they are not included.

                                                                                                                                      • -nodetach

                                                                                                                                        When signing a message use opaque signing. This form is more resistant to translation by mail relays but it cannot be read by mail agents that do not support S/MIME. Without this option cleartext signing with the MIME type multipart/signed is used.

                                                                                                                                      • -nosmimecap

                                                                                                                                        When signing a message, do not include the SMIMECapabilities attribute.

                                                                                                                                      • -binary

                                                                                                                                        Normally the input message is converted to \"canonical\" format which is effectively using CR and LF as end of line: as required by the S/MIME specification. When this option is present no translation occurs. This is useful when handling binary data which may not be in MIME format.

                                                                                                                                      • -crlfeol

                                                                                                                                        Normally the output file uses a single LF as end of line. When this option is present CRLF is used instead.

                                                                                                                                      • -certfile file

                                                                                                                                        Allows additional certificates to be specified. When signing these will be included with the message. When verifying these will be searched for the signers certificates. The input can be in PEM, DER, or PKCS#12 format.

                                                                                                                                      • -signer file

                                                                                                                                        A signing certificate when signing or resigning a message, this option can be used multiple times if more than one signer is required. If a message is being verified then the signers certificates will be written to this file if the verification was successful.

                                                                                                                                      • -recip file

                                                                                                                                        The recipients certificate when decrypting a message. This certificate must match one of the recipients of the message or an error occurs.

                                                                                                                                      • -inkey filename|uri

                                                                                                                                        The private key to use when signing or decrypting. This must match the corresponding certificate. If this option is not specified then the private key must be included in the certificate file specified with the -recip or -signer file. When signing this option can be used multiple times to specify successive keys.

                                                                                                                                      • -passin arg

                                                                                                                                        The private key password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -to, -from, -subject

                                                                                                                                        The relevant mail headers. These are included outside the signed portion of a message so they may be included manually. If signing then many S/MIME mail clients check the signers certificate's email address matches that specified in the From: address.

                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                        Any verification errors cause the command to exit.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -config configfile

                                                                                                                                        See \"Configuration Option\" in openssl(1).

                                                                                                                                      • recipcert ...

                                                                                                                                        One or more certificates of message recipients, used when encrypting a message.

                                                                                                                                      "},{"location":"man1/openssl-smime/#notes","title":"NOTES","text":"

                                                                                                                                      The MIME message must be sent without any blank lines between the headers and the output. Some mail programs will automatically add a blank line. Piping the mail directly to sendmail is one way to achieve the correct format.

                                                                                                                                      The supplied message to be signed or encrypted must include the necessary MIME headers or many S/MIME clients won't display it properly (if at all). You can use the -text option to automatically add plain text headers.

                                                                                                                                      A \"signed and encrypted\" message is one where a signed message is then encrypted. This can be produced by encrypting an already signed message: see the examples section.

                                                                                                                                      This version of the program only allows one signer per message but it will verify multiple signers on received messages. Some S/MIME clients choke if a message contains multiple signers. It is possible to sign messages \"in parallel\" by signing an already signed message.

                                                                                                                                      The options -encrypt and -decrypt reflect common usage in S/MIME clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7 encrypted data is used for other purposes.

                                                                                                                                      The -resign option uses an existing message digest when adding a new signer. This means that attributes must be present in at least one existing signer using the same message digest or this operation will fail.

                                                                                                                                      The -stream and -indef options enable streaming I/O support. As a result the encoding is BER using indefinite length constructed encoding and no longer DER. Streaming is supported for the -encrypt operation and the -sign operation if the content is not detached.

                                                                                                                                      Streaming is always used for the -sign operation with detached data but since the content is no longer part of the PKCS#7 structure the encoding remains DER.

                                                                                                                                      "},{"location":"man1/openssl-smime/#exit-codes","title":"EXIT CODES","text":"
                                                                                                                                      • 0

                                                                                                                                        The operation was completely successfully.

                                                                                                                                      • 1

                                                                                                                                        An error occurred parsing the command options.

                                                                                                                                      • 2

                                                                                                                                        One of the input files could not be read.

                                                                                                                                      • 3

                                                                                                                                        An error occurred creating the PKCS#7 file or when reading the MIME message.

                                                                                                                                      • 4

                                                                                                                                        An error occurred decrypting or verifying the message.

                                                                                                                                      • 5

                                                                                                                                        The message was verified correctly but an error occurred writing out the signers certificates.

                                                                                                                                      "},{"location":"man1/openssl-smime/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create a cleartext signed message:

                                                                                                                                      openssl smime -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem\n

                                                                                                                                      Create an opaque signed message:

                                                                                                                                      openssl smime -sign -in message.txt -text -out mail.msg -nodetach \\\n       -signer mycert.pem\n

                                                                                                                                      Create a signed message, include some additional certificates and read the private key from another file:

                                                                                                                                      openssl smime -sign -in in.txt -text -out mail.msg \\\n       -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem\n

                                                                                                                                      Create a signed message with two signers:

                                                                                                                                      openssl smime -sign -in message.txt -text -out mail.msg \\\n       -signer mycert.pem -signer othercert.pem\n

                                                                                                                                      Send a signed message under Unix directly to sendmail, including headers:

                                                                                                                                      openssl smime -sign -in in.txt -text -signer mycert.pem \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed message\" | sendmail someone@somewhere\n

                                                                                                                                      Verify a message and extract the signer's certificate if successful:

                                                                                                                                      openssl smime -verify -in mail.msg -signer user.pem -out signedtext.txt\n

                                                                                                                                      Send encrypted mail using triple DES:

                                                                                                                                      openssl smime -encrypt -in in.txt -from steve@openssl.org \\\n       -to someone@somewhere -subject \"Encrypted message\" \\\n       -des3 user.pem -out mail.msg\n

                                                                                                                                      Sign and encrypt mail:

                                                                                                                                      openssl smime -sign -in ml.txt -signer my.pem -text \\\n       | openssl smime -encrypt -out mail.msg \\\n       -from steve@openssl.org -to someone@somewhere \\\n       -subject \"Signed and Encrypted message\" -des3 user.pem\n

                                                                                                                                      Note: the encryption command does not include the -text option because the message being encrypted already has MIME headers.

                                                                                                                                      Decrypt mail:

                                                                                                                                      openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem\n

                                                                                                                                      The output from Netscape form signing is a PKCS#7 structure with the detached signature format. You can use this program to verify the signature by line wrapping the base64 encoded structure and surrounding it with:

                                                                                                                                      -----BEGIN PKCS7-----\n-----END PKCS7-----\n

                                                                                                                                      and using the command:

                                                                                                                                      openssl smime -verify -inform PEM -in signature.pem -content content.txt\n

                                                                                                                                      Alternatively you can base64 decode the signature and use:

                                                                                                                                      openssl smime -verify -inform DER -in signature.der -content content.txt\n

                                                                                                                                      Create an encrypted message using 128 bit Camellia:

                                                                                                                                      openssl smime -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem\n

                                                                                                                                      Add a signer to an existing message:

                                                                                                                                      openssl smime -resign -in mail.msg -signer newsign.pem -out mail2.msg\n
                                                                                                                                      "},{"location":"man1/openssl-smime/#bugs","title":"BUGS","text":"

                                                                                                                                      The MIME parser isn't very clever: it seems to handle most messages that I've thrown at it but it may choke on others.

                                                                                                                                      The code currently will only write out the signer's certificate to a file: if the signer has a separate encryption certificate this must be manually extracted. There should be some heuristic that determines the correct encryption certificate.

                                                                                                                                      Ideally a database should be maintained of a certificates for each email address.

                                                                                                                                      The code doesn't currently take note of the permitted symmetric encryption algorithms as supplied in the SMIMECapabilities signed attribute. This means the user has to manually include the correct encryption algorithm. It should store the list of permitted ciphers in a database and only use those.

                                                                                                                                      No revocation checking is done on the signer's certificate.

                                                                                                                                      The current code can only handle S/MIME v2 messages, the more complex S/MIME v3 structures may cause parsing errors.

                                                                                                                                      "},{"location":"man1/openssl-smime/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-smime/#history","title":"HISTORY","text":"

                                                                                                                                      The use of multiple -signer options and the -resign command were first added in OpenSSL 1.0.0

                                                                                                                                      The -no_alt_chains option was added in OpenSSL 1.1.0.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-smime/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-speed/","title":"openssl-speed","text":""},{"location":"man1/openssl-speed/#name","title":"NAME","text":"

                                                                                                                                      openssl-speed - test library performance

                                                                                                                                      "},{"location":"man1/openssl-speed/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl speed [-help] [-config filename] [-elapsed] [-evp algo] [-hmac algo] [-cmac algo] [-mb] [-aead] [-multi num] [-async_jobs num] [-misalign num] [-decrypt] [-primes num] [-seconds num] [-bytes num] [-mr] [-mlock] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq] [algorithm ...]

                                                                                                                                      "},{"location":"man1/openssl-speed/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to test the performance of cryptographic algorithms.

                                                                                                                                      "},{"location":"man1/openssl-speed/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -config filename

                                                                                                                                        Specifies the configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

                                                                                                                                      • -elapsed

                                                                                                                                        When calculating operations- or bytes-per-second, use wall-clock time instead of CPU user time as divisor. It can be useful when testing speed of hardware engines.

                                                                                                                                      • -evp algo

                                                                                                                                        Use the specified cipher or message digest algorithm via the EVP interface. If algo is an AEAD cipher, then you can pass -aead to benchmark a TLS-like sequence. And if algo is a multi-buffer capable cipher, e.g. aes-128-cbc-hmac-sha1, then -mb will time multi-buffer operation.

                                                                                                                                        To see the algorithms supported with this option, use openssl list -digest-algorithms or openssl list -cipher-algorithms command.

                                                                                                                                      • -multi num

                                                                                                                                        Run multiple operations in parallel.

                                                                                                                                      • -async_jobs num

                                                                                                                                        Enable async mode and start specified number of jobs.

                                                                                                                                      • -misalign num

                                                                                                                                        Misalign the buffers by the specified number of bytes.

                                                                                                                                      • -hmac digest

                                                                                                                                        Time the HMAC algorithm using the specified message digest.

                                                                                                                                      • -cmac cipher

                                                                                                                                        Time the CMAC algorithm using the specified cipher e.g. openssl speed -cmac aes128.

                                                                                                                                      • -decrypt

                                                                                                                                        Time the decryption instead of encryption. Affects only the EVP testing.

                                                                                                                                      • -mb

                                                                                                                                        Enable multi-block mode on EVP-named cipher.

                                                                                                                                      • -aead

                                                                                                                                        Benchmark EVP-named AEAD cipher in TLS-like sequence.

                                                                                                                                      • -primes num

                                                                                                                                        Generate a num-prime RSA key and use it to run the benchmarks. This option is only effective if RSA algorithm is specified to test.

                                                                                                                                      • -seconds num

                                                                                                                                        Run benchmarks for num seconds.

                                                                                                                                      • -bytes num

                                                                                                                                        Run benchmarks on num-byte buffers. Affects ciphers, digests and the CSPRNG. The limit on the size of the buffer is INT_MAX - 64 bytes, which for a 32-bit int would be 2147483583 bytes.

                                                                                                                                      • -mr

                                                                                                                                        Produce the summary in a mechanical, machine-readable, format.

                                                                                                                                      • -mlock

                                                                                                                                        Lock memory into RAM for more deterministic measurements.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • algorithm ...

                                                                                                                                        If any algorithm is given, then those algorithms are tested, otherwise a pre-compiled grand selection is tested.

                                                                                                                                      "},{"location":"man1/openssl-speed/#bugs","title":"BUGS","text":"

                                                                                                                                      The algorithm can be selected only from a pre-compiled subset of things that the openssl speed command knows about. To test any additional digest or cipher algorithm supported by OpenSSL use the -evp option.

                                                                                                                                      There is no way to test the speed of any additional public key algorithms supported by third party providers with the openssl speed command.

                                                                                                                                      "},{"location":"man1/openssl-speed/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-speed/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-spkac/","title":"openssl-spkac","text":""},{"location":"man1/openssl-spkac/#name","title":"NAME","text":"

                                                                                                                                      openssl-spkac - SPKAC printing and generating command

                                                                                                                                      "},{"location":"man1/openssl-spkac/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl spkac [-help] [-in filename] [-out filename] [-digest digest] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-passin arg] [-challenge string] [-pubkey] [-spkac spkacname] [-spksect section] [-noout] [-verify] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-spkac/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command processes Netscape signed public key and challenge (SPKAC) files. It can print out their contents, verify the signature and produce its own SPKACs from a supplied private key.

                                                                                                                                      "},{"location":"man1/openssl-spkac/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -in filename

                                                                                                                                        This specifies the input filename to read from or standard input if this option is not specified. Ignored if the -key option is used.

                                                                                                                                      • -out filename

                                                                                                                                        Specifies the output filename to write to or standard output by default.

                                                                                                                                      • -digest digest

                                                                                                                                        Use the specified digest to sign a created SPKAC file. The default digest algorithm is MD5.

                                                                                                                                      • -key filename|uri

                                                                                                                                        Create an SPKAC file using the private key specified by filename or uri. The -in, -noout, -spksect and -verify options are ignored if present.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The key format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -passin arg

                                                                                                                                        The input file password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -challenge string

                                                                                                                                        Specifies the challenge string if an SPKAC is being created.

                                                                                                                                      • -spkac spkacname

                                                                                                                                        Allows an alternative name form the variable containing the SPKAC. The default is \"SPKAC\". This option affects both generated and input SPKAC files.

                                                                                                                                      • -spksect section

                                                                                                                                        Allows an alternative name form the section containing the SPKAC. The default is the default section.

                                                                                                                                      • -noout

                                                                                                                                        Don't output the text version of the SPKAC (not used if an SPKAC is being created).

                                                                                                                                      • -pubkey

                                                                                                                                        Output the public key of an SPKAC (not used if an SPKAC is being created).

                                                                                                                                      • -verify

                                                                                                                                        Verifies the digital signature on the supplied SPKAC.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-spkac/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Print out the contents of an SPKAC:

                                                                                                                                      openssl spkac -in spkac.cnf\n

                                                                                                                                      Verify the signature of an SPKAC:

                                                                                                                                      openssl spkac -in spkac.cnf -noout -verify\n

                                                                                                                                      Create an SPKAC using the challenge string \"hello\":

                                                                                                                                      openssl spkac -key key.pem -challenge hello -out spkac.cnf\n

                                                                                                                                      Example of an SPKAC, (long lines split up for clarity):

                                                                                                                                      SPKAC=MIG5MGUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA\\\n1cCoq2Wa3Ixs47uI7FPVwHVIPDx5yso105Y6zpozam135a\\\n8R0CpoRvkkigIyXfcCjiVi5oWk+6FfPaD03uPFoQIDAQAB\\\nFgVoZWxsbzANBgkqhkiG9w0BAQQFAANBAFpQtY/FojdwkJ\\\nh1bEIYuc2EeM2KHTWPEepWYeawvHD0gQ3DngSC75YCWnnD\\\ndq+NQ3F+X4deMx9AaEglZtULwV4=\n
                                                                                                                                      "},{"location":"man1/openssl-spkac/#notes","title":"NOTES","text":"

                                                                                                                                      A created SPKAC with suitable DN components appended can be fed to openssl-ca(1).

                                                                                                                                      SPKACs are typically generated by Netscape when a form is submitted containing the KEYGEN tag as part of the certificate enrollment process.

                                                                                                                                      The challenge string permits a primitive form of proof of possession of private key. By checking the SPKAC signature and a random challenge string some guarantee is given that the user knows the private key corresponding to the public key being certified. This is important in some applications. Without this it is possible for a previous SPKAC to be used in a \"replay attack\".

                                                                                                                                      "},{"location":"man1/openssl-spkac/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-ca(1)

                                                                                                                                      "},{"location":"man1/openssl-spkac/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      The -digest option was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-spkac/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-srp/","title":"openssl-srp","text":""},{"location":"man1/openssl-srp/#name","title":"NAME","text":"

                                                                                                                                      openssl-srp - maintain SRP password file

                                                                                                                                      "},{"location":"man1/openssl-srp/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl srp [-help] [-verbose] [-add] [-modify] [-delete] [-list] [-name section] [-srpvfile file] [-gn identifier] [-userinfo text] [-passin arg] [-passout arg] [-engine id] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq] [-config configfile] [user ...]

                                                                                                                                      "},{"location":"man1/openssl-srp/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is deprecated. It is used to maintain an SRP (secure remote password) file. At most one of the -add, -modify, -delete, and -list options can be specified. These options take zero or more usernames as parameters and perform the appropriate operation on the SRP file. For -list, if no user is given then all users are displayed.

                                                                                                                                      The configuration file to use, and the section within the file, can be specified with the -config and -name flags, respectively.

                                                                                                                                      "},{"location":"man1/openssl-srp/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Display an option summary.

                                                                                                                                      • -verbose

                                                                                                                                        Generate verbose output while processing.

                                                                                                                                      • -add

                                                                                                                                        Add a user and SRP verifier.

                                                                                                                                      • -modify

                                                                                                                                        Modify the SRP verifier of an existing user.

                                                                                                                                      • -delete

                                                                                                                                        Delete user from verifier file.

                                                                                                                                      • -list

                                                                                                                                        List users.

                                                                                                                                      • -name

                                                                                                                                        The particular SRP definition to use.

                                                                                                                                      • -srpvfile file

                                                                                                                                        If the config file is not specified, -srpvfile can be used to specify the file to operate on.

                                                                                                                                      • -gn

                                                                                                                                        Specifies the g and N values, using one of the strengths defined in IETF RFC 5054.

                                                                                                                                      • -userinfo

                                                                                                                                        specifies additional information to add when adding or modifying a user.

                                                                                                                                      • -passin arg, -passout arg

                                                                                                                                        The password source for the input and output file. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • -config configfile

                                                                                                                                        See \"Configuration Option\" in openssl(1).

                                                                                                                                        [-rand files] [-writerand file]

                                                                                                                                      "},{"location":"man1/openssl-srp/#history","title":"HISTORY","text":"

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-srp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-storeutl/","title":"openssl-storeutl","text":""},{"location":"man1/openssl-storeutl/#name","title":"NAME","text":"

                                                                                                                                      openssl-storeutl - STORE command

                                                                                                                                      "},{"location":"man1/openssl-storeutl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl storeutl [-help] [-out file] [-noout] [-passin arg] [-text arg] [-r] [-certs] [-keys] [-crls] [-subject arg] [-issuer arg] [-serial arg] [-alias arg] [-fingerprint arg] [-digest] [-engine id] [-provider name] [-provider-path path] [-propquery propq] uri

                                                                                                                                      "},{"location":"man1/openssl-storeutl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command can be used to display the contents (after decryption as the case may be) fetched from the given URI.

                                                                                                                                      "},{"location":"man1/openssl-storeutl/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -out filename

                                                                                                                                        specifies the output filename to write to or standard output by default.

                                                                                                                                      • -noout

                                                                                                                                        this option prevents output of the PEM data.

                                                                                                                                      • -passin arg

                                                                                                                                        the key password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -text

                                                                                                                                        Prints out the objects in text form, similarly to the -text output from openssl-x509(1), openssl-pkey(1), etc.

                                                                                                                                      • -r

                                                                                                                                        Fetch objects recursively when possible.

                                                                                                                                      • -certs

                                                                                                                                      • -keys
                                                                                                                                      • -crls

                                                                                                                                        Only select the certificates, keys or CRLs from the given URI. However, if this URI would return a set of names (URIs), those are always returned.

                                                                                                                                        Note that all options must be given before the uri argument. Otherwise they are ignored.

                                                                                                                                        Note -keys selects exclusively private keys, there is no selector for public keys only.

                                                                                                                                      • -subject arg

                                                                                                                                        Search for an object having the subject name arg.

                                                                                                                                        The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted but are ignored for the search. That is, a search with an empty value will have the same effect as not specifying the type at all. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set.

                                                                                                                                        Example:

                                                                                                                                        /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

                                                                                                                                      • -issuer arg

                                                                                                                                      • -serial arg

                                                                                                                                        Search for an object having the given issuer name and serial number. These two options must be used together. The issuer arg must be formatted as /type0=value0/type1=value1/type2=..., characters may be escaped by \\ (backslash), no spaces are skipped. The serial arg may be specified as a decimal value or a hex value if preceded by 0x.

                                                                                                                                      • -alias arg

                                                                                                                                        Search for an object having the given alias.

                                                                                                                                      • -fingerprint arg

                                                                                                                                        Search for an object having the given fingerprint.

                                                                                                                                      • -digest

                                                                                                                                        The digest that was used to compute the fingerprint given with -fingerprint.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-storeutl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1)

                                                                                                                                      "},{"location":"man1/openssl-storeutl/#history","title":"HISTORY","text":"

                                                                                                                                      This command was added in OpenSSL 1.1.1.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-storeutl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-ts/","title":"openssl-ts","text":""},{"location":"man1/openssl-ts/#name","title":"NAME","text":"

                                                                                                                                      openssl-ts - Time Stamping Authority command

                                                                                                                                      "},{"location":"man1/openssl-ts/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl ts -help

                                                                                                                                      openssl ts -query [-config configfile] [-data file_to_hash] [-digest digest_bytes] [-digest] [-tspolicy object_id] [-no_nonce] [-cert] [-in request.tsq] [-out request.tsq] [-text] [-rand files] [-writerand file] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      openssl ts -reply [-config configfile] [-section tsa_section] [-queryfile request.tsq] [-passin password_src] [-signer tsa_cert.pem] [-inkey filename|uri] [-digest] [-chain certs_file.pem] [-tspolicy object_id] [-in response.tsr] [-token_in] [-out response.tsr] [-token_out] [-text] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      openssl ts -verify [-data file_to_hash] [-digest digest_bytes] [-queryfile request.tsq] [-in response.tsr] [-token_in] [-untrusted files|uris] [-CAfile file] [-CApath dir] [-CAstore uri] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-ts/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is a basic Time Stamping Authority (TSA) client and server application as specified in RFC 3161 (Time-Stamp Protocol, TSP). A TSA can be part of a PKI deployment and its role is to provide long term proof of the existence of a certain datum before a particular time. Here is a brief description of the protocol:

                                                                                                                                      1. The TSA client computes a one-way hash value for a data file and sends the hash to the TSA.
                                                                                                                                      2. The TSA attaches the current date and time to the received hash value, signs them and sends the timestamp token back to the client. By creating this token the TSA certifies the existence of the original data file at the time of response generation.
                                                                                                                                      3. The TSA client receives the timestamp token and verifies the signature on it. It also checks if the token contains the same hash value that it had sent to the TSA.

                                                                                                                                      There is one DER encoded protocol data unit defined for transporting a timestamp request to the TSA and one for sending the timestamp response back to the client. This command has three main functions: creating a timestamp request based on a data file, creating a timestamp response based on a request, verifying if a response corresponds to a particular request or a data file.

                                                                                                                                      There is no support for sending the requests/responses automatically over HTTP or TCP yet as suggested in RFC 3161. The users must send the requests either by ftp or e-mail.

                                                                                                                                      "},{"location":"man1/openssl-ts/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -query

                                                                                                                                        Generate a TS query. For details see \"Timestamp Request generation\".

                                                                                                                                      • -reply

                                                                                                                                        Generate a TS reply. For details see \"Timestamp Response generation\".

                                                                                                                                      • -verify

                                                                                                                                        Verify a TS response. For details see \"Timestamp Response verification\".

                                                                                                                                      "},{"location":"man1/openssl-ts/#timestamp-request-generation","title":"Timestamp Request generation","text":"

                                                                                                                                      The -query command can be used for creating and printing a timestamp request with the following options:

                                                                                                                                      • -config configfile

                                                                                                                                        The configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1).

                                                                                                                                      • -data file_to_hash

                                                                                                                                        The data file for which the timestamp request needs to be created. stdin is the default if neither the -data nor the -digest parameter is specified. (Optional)

                                                                                                                                      • -digest digest_bytes

                                                                                                                                        It is possible to specify the message imprint explicitly without the data file. The imprint must be specified in a hexadecimal format, two characters per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or 1AF601...). The number of bytes must match the message digest algorithm in use. (Optional)

                                                                                                                                      • -digest

                                                                                                                                        The message digest to apply to the data file. Any digest supported by the openssl-dgst(1) command can be used. The default is SHA-256. (Optional)

                                                                                                                                      • -tspolicy object_id

                                                                                                                                        The policy that the client expects the TSA to use for creating the timestamp token. Either the dotted OID notation or OID names defined in the config file can be used. If no policy is requested the TSA will use its own default policy. (Optional)

                                                                                                                                      • -no_nonce

                                                                                                                                        No nonce is specified in the request if this option is given. Otherwise, a 64-bit long pseudo-random nonce is included in the request. It is recommended to use a nonce to protect against replay attacks. (Optional)

                                                                                                                                      • -cert

                                                                                                                                        The TSA is expected to include its signing certificate in the response. (Optional)

                                                                                                                                      • -in request.tsq

                                                                                                                                        This option specifies a previously created timestamp request in DER format that will be printed into the output file. Useful when you need to examine the content of a request in human-readable format. (Optional)

                                                                                                                                      • -out request.tsq

                                                                                                                                        Name of the output file to which the request will be written. Default is stdout. (Optional)

                                                                                                                                      • -text

                                                                                                                                        If this option is specified the output is human-readable text format instead of DER. (Optional)

                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      "},{"location":"man1/openssl-ts/#timestamp-response-generation","title":"Timestamp Response generation","text":"

                                                                                                                                      A timestamp response (TimeStampResp) consists of a response status and the timestamp token itself (ContentInfo), if the token generation was successful. The -reply command is for creating a timestamp response or timestamp token based on a request and printing the response/token in human-readable format. If -token_out is not specified the output is always a timestamp response (TimeStampResp), otherwise it is a timestamp token (ContentInfo).

                                                                                                                                      • -config configfile

                                                                                                                                        The configuration file to use. Optional; for a description of the default value, see \"COMMAND SUMMARY\" in openssl(1). See \"CONFIGURATION FILE OPTIONS\" for configurable variables.

                                                                                                                                      • -section tsa_section

                                                                                                                                        The name of the config file section containing the settings for the response generation. If not specified the default TSA section is used, see \"CONFIGURATION FILE OPTIONS\" for details. (Optional)

                                                                                                                                      • -queryfile request.tsq

                                                                                                                                        The name of the file containing a DER encoded timestamp request. (Optional)

                                                                                                                                      • -passin password_src

                                                                                                                                        Specifies the password source for the private key of the TSA. See description in openssl(1). (Optional)

                                                                                                                                      • -signer tsa_cert.pem

                                                                                                                                        The signer certificate of the TSA in PEM format. The TSA signing certificate must have exactly one extended key usage assigned to it: timeStamping. The extended key usage must also be critical, otherwise the certificate is going to be refused. Overrides the signer_cert variable of the config file. (Optional)

                                                                                                                                      • -inkey filename|uri

                                                                                                                                        The signer private key of the TSA in PEM format. Overrides the signer_key config file option. (Optional)

                                                                                                                                      • -digest

                                                                                                                                        Signing digest to use. Overrides the signer_digest config file option. (Mandatory unless specified in the config file)

                                                                                                                                      • -chain certs_file.pem

                                                                                                                                        The collection of certificates in PEM format that will all be included in the response in addition to the signer certificate if the -cert option was used for the request. This file is supposed to contain the certificate chain for the signer certificate from its issuer upwards. The -reply command does not build a certificate chain automatically. (Optional)

                                                                                                                                      • -tspolicy object_id

                                                                                                                                        The default policy to use for the response unless the client explicitly requires a particular TSA policy. The OID can be specified either in dotted notation or with its name. Overrides the default_policy config file option. (Optional)

                                                                                                                                      • -in response.tsr

                                                                                                                                        Specifies a previously created timestamp response or timestamp token (if -token_in is also specified) in DER format that will be written to the output file. This option does not require a request, it is useful e.g. when you need to examine the content of a response or token or you want to extract the timestamp token from a response. If the input is a token and the output is a timestamp response a default 'granted' status info is added to the token. (Optional)

                                                                                                                                      • -token_in

                                                                                                                                        This flag can be used together with the -in option and indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)

                                                                                                                                      • -out response.tsr

                                                                                                                                        The response is written to this file. The format and content of the file depends on other options (see -text, -token_out). The default is stdout. (Optional)

                                                                                                                                      • -token_out

                                                                                                                                        The output is a timestamp token (ContentInfo) instead of timestamp response (TimeStampResp). (Optional)

                                                                                                                                      • -text

                                                                                                                                        If this option is specified the output is human-readable text format instead of DER. (Optional)

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-ts/#timestamp-response-verification","title":"Timestamp Response verification","text":"

                                                                                                                                      The -verify command is for verifying if a timestamp response or timestamp token is valid and matches a particular timestamp request or data file. The -verify command does not use the configuration file.

                                                                                                                                      • -data file_to_hash

                                                                                                                                        The response or token must be verified against file_to_hash. The file is hashed with the message digest algorithm specified in the token. The -digest and -queryfile options must not be specified with this one. (Optional)

                                                                                                                                      • -digest digest_bytes

                                                                                                                                        The response or token must be verified against the message digest specified with this option. The number of bytes must match the message digest algorithm specified in the token. The -data and -queryfile options must not be specified with this one. (Optional)

                                                                                                                                      • -queryfile request.tsq

                                                                                                                                        The original timestamp request in DER format. The -data and -digest options must not be specified with this one. (Optional)

                                                                                                                                      • -in response.tsr

                                                                                                                                        The timestamp response that needs to be verified in DER format. (Mandatory)

                                                                                                                                      • -token_in

                                                                                                                                        This flag can be used together with the -in option and indicates that the input is a DER encoded timestamp token (ContentInfo) instead of a timestamp response (TimeStampResp). (Optional)

                                                                                                                                      • -untrusted files|uris

                                                                                                                                        A set of additional untrusted certificates which may be needed when building the certificate chain for the TSA's signing certificate. These do not need to contain the TSA signing certificate and intermediate CA certificates as far as the response already includes them. (Optional)

                                                                                                                                        Multiple sources may be given, separated by commas and/or whitespace. Each file may contain multiple certificates.

                                                                                                                                      • -CAfile file, -CApath dir, -CAstore uri

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details. At least one of -CAfile, -CApath or -CAstore must be specified.

                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                        Any verification errors cause the command to exit.

                                                                                                                                      "},{"location":"man1/openssl-ts/#configuration-file-options","title":"CONFIGURATION FILE OPTIONS","text":"

                                                                                                                                      The -query and -reply commands make use of a configuration file. See config(5) for a general description of the syntax of the config file. The -query command uses only the symbolic OID names section and it can work without it. However, the -reply command needs the config file for its operation.

                                                                                                                                      When there is a command line switch equivalent of a variable the switch always overrides the settings in the config file.

                                                                                                                                      • tsa section, default_tsa

                                                                                                                                        This is the main section and it specifies the name of another section that contains all the options for the -reply command. This default section can be overridden with the -section command line switch. (Optional)

                                                                                                                                      • oid_file

                                                                                                                                        This specifies a file containing additional OBJECT IDENTIFIERS. Each line of the file should consist of the numerical form of the object identifier followed by whitespace then the short name followed by whitespace and finally the long name. (Optional)

                                                                                                                                      • oid_section

                                                                                                                                        This specifies a section in the configuration file containing extra object identifiers. Each line should consist of the short name of the object identifier followed by = and the numerical form. The short and long names are the same when this option is used. (Optional)

                                                                                                                                      • RANDFILE

                                                                                                                                        At startup the specified file is loaded into the random number generator, and at exit 256 bytes will be written to it. (Note: Using a RANDFILE is not necessary anymore, see the \"HISTORY\" section.

                                                                                                                                      • serial

                                                                                                                                        The name of the file containing the hexadecimal serial number of the last timestamp response created. This number is incremented by 1 for each response. If the file does not exist at the time of response generation a new file is created with serial number 1. (Mandatory)

                                                                                                                                      • crypto_device

                                                                                                                                        Specifies the OpenSSL engine that will be set as the default for all available algorithms. The default value is built-in, you can specify any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM). (Optional)

                                                                                                                                      • signer_cert

                                                                                                                                        TSA signing certificate in PEM format. The same as the -signer command line option. (Optional)

                                                                                                                                      • certs

                                                                                                                                        A file containing a set of PEM encoded certificates that need to be included in the response. The same as the -chain command line option. (Optional)

                                                                                                                                      • signer_key

                                                                                                                                        The private key of the TSA in PEM format. The same as the -inkey command line option. (Optional)

                                                                                                                                      • signer_digest

                                                                                                                                        Signing digest to use. The same as the -digest command line option. (Mandatory unless specified on the command line)

                                                                                                                                      • default_policy

                                                                                                                                        The default policy to use when the request does not mandate any policy. The same as the -tspolicy command line option. (Optional)

                                                                                                                                      • other_policies

                                                                                                                                        Comma separated list of policies that are also acceptable by the TSA and used only if the request explicitly specifies one of them. (Optional)

                                                                                                                                      • digests

                                                                                                                                        The list of message digest algorithms that the TSA accepts. At least one algorithm must be specified. (Mandatory)

                                                                                                                                      • accuracy

                                                                                                                                        The accuracy of the time source of the TSA in seconds, milliseconds and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of the components is missing zero is assumed for that field. (Optional)

                                                                                                                                      • clock_precision_digits

                                                                                                                                        Specifies the maximum number of digits, which represent the fraction of seconds, that need to be included in the time field. The trailing zeros must be removed from the time, so there might actually be fewer digits, or no fraction of seconds at all. Supported only on UNIX platforms. The maximum value is 6, default is 0. (Optional)

                                                                                                                                      • ordering

                                                                                                                                        If this option is yes the responses generated by this TSA can always be ordered, even if the time difference between two responses is less than the sum of their accuracies. Default is no. (Optional)

                                                                                                                                      • tsa_name

                                                                                                                                        Set this option to yes if the subject name of the TSA must be included in the TSA name field of the response. Default is no. (Optional)

                                                                                                                                      • ess_cert_id_chain

                                                                                                                                        The SignedData objects created by the TSA always contain the certificate identifier of the signing certificate in a signed attribute (see RFC 2634, Enhanced Security Services). If this variable is set to no, only this signing certificate identifier is included in the SigningCertificate signed attribute. If this variable is set to yes and the certs variable or the -chain option is specified then the certificate identifiers of the chain will also be included, where the -chain option overrides the certs variable. Default is no. (Optional)

                                                                                                                                      • ess_cert_id_alg

                                                                                                                                        This option specifies the hash function to be used to calculate the TSA's public key certificate identifier. Default is sha1. (Optional)

                                                                                                                                      "},{"location":"man1/openssl-ts/#examples","title":"EXAMPLES","text":"

                                                                                                                                      All the examples below presume that OPENSSL_CONF is set to a proper configuration file, e.g. the example configuration file openssl/apps/openssl.cnf will do.

                                                                                                                                      "},{"location":"man1/openssl-ts/#timestamp-request","title":"Timestamp Request","text":"

                                                                                                                                      To create a timestamp request for design1.txt with SHA-256 digest, without nonce and policy, and without requirement for a certificate in the response:

                                                                                                                                      openssl ts -query -data design1.txt -no_nonce \\\n      -out design1.tsq\n

                                                                                                                                      To create a similar timestamp request with specifying the message imprint explicitly:

                                                                                                                                      openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \\\n       -no_nonce -out design1.tsq\n

                                                                                                                                      To print the content of the previous request in human readable format:

                                                                                                                                      openssl ts -query -in design1.tsq -text\n

                                                                                                                                      To create a timestamp request which includes the SHA-512 digest of design2.txt, requests the signer certificate and nonce, and specifies a policy id (assuming the tsa_policy1 name is defined in the OID section of the config file):

                                                                                                                                      openssl ts -query -data design2.txt -sha512 \\\n      -tspolicy tsa_policy1 -cert -out design2.tsq\n
                                                                                                                                      "},{"location":"man1/openssl-ts/#timestamp-response","title":"Timestamp Response","text":"

                                                                                                                                      Before generating a response a signing certificate must be created for the TSA that contains the timeStamping critical extended key usage extension without any other key usage extensions. You can add this line to the user certificate section of the config file to generate a proper certificate;

                                                                                                                                      extendedKeyUsage = critical,timeStamping\n

                                                                                                                                      See openssl-req(1), openssl-ca(1), and openssl-x509(1) for instructions. The examples below assume that cacert.pem contains the certificate of the CA, tsacert.pem is the signing certificate issued by cacert.pem and tsakey.pem is the private key of the TSA.

                                                                                                                                      To create a timestamp response for a request:

                                                                                                                                      openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \\\n      -signer tsacert.pem -out design1.tsr\n

                                                                                                                                      If you want to use the settings in the config file you could just write:

                                                                                                                                      openssl ts -reply -queryfile design1.tsq -out design1.tsr\n

                                                                                                                                      To print a timestamp reply to stdout in human readable format:

                                                                                                                                      openssl ts -reply -in design1.tsr -text\n

                                                                                                                                      To create a timestamp token instead of timestamp response:

                                                                                                                                      openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_out\n

                                                                                                                                      To print a timestamp token to stdout in human readable format:

                                                                                                                                      openssl ts -reply -in design1_token.der -token_in -text -token_out\n

                                                                                                                                      To extract the timestamp token from a response:

                                                                                                                                      openssl ts -reply -in design1.tsr -out design1_token.der -token_out\n

                                                                                                                                      To add 'granted' status info to a timestamp token thereby creating a valid response:

                                                                                                                                      openssl ts -reply -in design1_token.der -token_in -out design1.tsr\n
                                                                                                                                      "},{"location":"man1/openssl-ts/#timestamp-verification","title":"Timestamp Verification","text":"

                                                                                                                                      To verify a timestamp reply against a request:

                                                                                                                                      openssl ts -verify -queryfile design1.tsq -in design1.tsr \\\n      -CAfile cacert.pem -untrusted tsacert.pem\n

                                                                                                                                      To verify a timestamp reply that includes the certificate chain:

                                                                                                                                      openssl ts -verify -queryfile design2.tsq -in design2.tsr \\\n      -CAfile cacert.pem\n

                                                                                                                                      To verify a timestamp token against the original data file: openssl ts -verify -data design2.txt -in design2.tsr \\ -CAfile cacert.pem

                                                                                                                                      To verify a timestamp token against a message imprint: openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \\ -in design2.tsr -CAfile cacert.pem

                                                                                                                                      You could also look at the 'test' directory for more examples.

                                                                                                                                      "},{"location":"man1/openssl-ts/#bugs","title":"BUGS","text":"
                                                                                                                                      • No support for timestamps over SMTP, though it is quite easy to implement an automatic e-mail based TSA with procmail(1) and perl(1). HTTP server support is provided in the form of a separate apache module. HTTP client support is provided by tsget(1). Pure TCP/IP protocol is not supported.
                                                                                                                                      • The file containing the last serial number of the TSA is not locked when being read or written. This is a problem if more than one instance of openssl(1) is trying to create a timestamp response at the same time. This is not an issue when using the apache server module, it does proper locking.
                                                                                                                                      • Look for the FIXME word in the source files.
                                                                                                                                      • The source code should really be reviewed by somebody else, too.
                                                                                                                                      • More testing is needed, I have done only some basic tests (see test/testtsa).
                                                                                                                                      "},{"location":"man1/openssl-ts/#history","title":"HISTORY","text":"

                                                                                                                                      OpenSSL 1.1.1 introduced a new random generator (CSPRNG) with an improved seeding mechanism. The new seeding mechanism makes it unnecessary to define a RANDFILE for saving and restoring randomness. This option is retained mainly for compatibility reasons.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-ts/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), tsget(1), openssl-req(1), openssl-x509(1), openssl-ca(1), openssl-genrsa(1), config(5), ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-ts/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/","title":"openssl-verification-options","text":""},{"location":"man1/openssl-verification-options/#name","title":"NAME","text":"

                                                                                                                                      openssl-verification-options - generic X.509 certificate verification options

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl command [ options ... ] [ parameters ... ]

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#description","title":"DESCRIPTION","text":"

                                                                                                                                      There are many situations where X.509 certificates are verified within the OpenSSL libraries and in various OpenSSL commands.

                                                                                                                                      Certificate verification is implemented by X509_verify_cert(3). It is a complicated process consisting of a number of steps and depending on numerous options. The most important of them are detailed in the following sections.

                                                                                                                                      In a nutshell, a valid chain of certificates needs to be built up and verified starting from the target certificate that is to be verified and ending in a certificate that due to some policy is trusted. Verification is done relative to the given purpose, which is the intended use of the target certificate, such as SSL server, or by default for any purpose.

                                                                                                                                      The details of how each OpenSSL command handles errors are documented on the specific command page.

                                                                                                                                      DANE support is documented in openssl-s_client(1), SSL_CTX_dane_enable(3), SSL_set1_host(3), X509_VERIFY_PARAM_set_flags(3), and X509_check_host(3).

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#trust-anchors","title":"Trust Anchors","text":"

                                                                                                                                      In general, according to RFC 4158 and RFC 5280, a trust anchor is any public key and related subject distinguished name (DN) that for some reason is considered trusted and thus is acceptable as the root of a chain of certificates.

                                                                                                                                      In practice, trust anchors are given in the form of certificates, where their essential fields are the public key and the subject DN. In addition to the requirements in RFC 5280, OpenSSL checks the validity period of such certificates and makes use of some further fields. In particular, the subject key identifier extension, if present, is used for matching trust anchors during chain building.

                                                                                                                                      In the most simple and common case, trust anchors are by default all self-signed \"root\" CA certificates that are placed in the trust store, which is a collection of certificates that are trusted for certain uses. This is akin to what is used in the trust stores of Mozilla Firefox, or Apple's and Microsoft's certificate stores, ...

                                                                                                                                      From the OpenSSL perspective, a trust anchor is a certificate that should be augmented with an explicit designation for which uses of a target certificate the certificate may serve as a trust anchor. In PEM encoding, this is indicated by the TRUSTED CERTIFICATE string. Such a designation provides a set of positive trust attributes explicitly stating trust for the listed purposes and/or a set of negative trust attributes explicitly rejecting the use for the listed purposes. The purposes are encoded using the values defined for the extended key usages (EKUs) that may be given in X.509 extensions of end-entity certificates. See also the \"Extended Key Usage\" section below.

                                                                                                                                      The currently recognized uses are clientAuth (SSL client use), serverAuth (SSL server use), emailProtection (S/MIME email use), codeSigning (object signer use), OCSPSigning (OCSP responder use), OCSP (OCSP request use), timeStamping (TSA server use), and anyExtendedKeyUsage. As of OpenSSL 1.1.0, the last of these blocks all uses when rejected or enables all uses when trusted.

                                                                                                                                      A certificate, which may be CA certificate or an end-entity certificate, is considered a trust anchor for the given use if and only if all the following conditions hold:

                                                                                                                                      • It is an an element of the trust store.
                                                                                                                                      • It does not have a negative trust attribute rejecting the given use.
                                                                                                                                      • It has a positive trust attribute accepting the given use or (by default) one of the following compatibility conditions apply: It is self-signed or the -partial_chain option is given (which corresponds to the X509_V_FLAG_PARTIAL_CHAIN flag being set).
                                                                                                                                      "},{"location":"man1/openssl-verification-options/#certification-path-building","title":"Certification Path Building","text":"

                                                                                                                                      First, a certificate chain is built up starting from the target certificate and ending in a trust anchor.

                                                                                                                                      The chain is built up iteratively, looking up in turn a certificate with suitable key usage that matches as an issuer of the current \"subject\" certificate as described below. If there is such a certificate, the first one found that is currently valid is taken, otherwise the one that expired most recently of all such certificates. For efficiency, no backtracking is performed, thus any further candidate issuer certificates that would match equally are ignored.

                                                                                                                                      When a self-signed certificate has been added, chain construction stops. In this case it must fully match a trust anchor, otherwise chain building fails.

                                                                                                                                      A candidate issuer certificate matches a subject certificate if all of the following conditions hold:

                                                                                                                                      • Its subject name matches the issuer name of the subject certificate.
                                                                                                                                      • If the subject certificate has an authority key identifier extension, each of its sub-fields equals the corresponding subject key identifier, serial number, and issuer field of the candidate issuer certificate, as far as the respective fields are present in both certificates.
                                                                                                                                      • The certificate signature algorithm used to sign the subject certificate is supported and equals the public key algorithm of the candidate issuer certificate.

                                                                                                                                      The lookup first searches for issuer certificates in the trust store. If it does not find a match there it consults the list of untrusted (\"intermediate\" CA) certificates, if provided.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#certification-path-validation","title":"Certification Path Validation","text":"

                                                                                                                                      When the certificate chain building process was successful the chain components and their links are checked thoroughly.

                                                                                                                                      The first step is to check that each certificate is well-formed. Part of these checks are enabled only if the -x509_strict option is given.

                                                                                                                                      The second step is to check the extensions of every untrusted certificate for consistency with the supplied purpose. If the -purpose option is not given then no such checks are done except for SSL/TLS connection setup, where by default sslserver or sslclient, are checked. The target or \"leaf\" certificate, as well as any other untrusted certificates, must have extensions compatible with the specified purpose. All certificates except the target or \"leaf\" must also be valid CA certificates. The precise extensions required are described in more detail in \"CERTIFICATE EXTENSIONS\" in openssl-x509(1).

                                                                                                                                      The third step is to check the trust settings on the last certificate (which typically is a self-signed root CA certificate). It must be trusted for the given use. For compatibility with previous versions of OpenSSL, a self-signed certificate with no trust attributes is considered to be valid for all uses.

                                                                                                                                      The fourth, and final, step is to check the validity of the certificate chain. For each element in the chain, including the root CA certificate, the validity period as specified by the notBefore and notAfter fields is checked against the current system time. The -attime flag may be used to use a reference time other than \"now.\" The certificate signature is checked as well (except for the signature of the typically self-signed root CA certificate, which is verified only if the -check_ss_sig option is given). When verifying a certificate signature the keyUsage extension (if present) of the candidate issuer certificate is checked to permit digitalSignature for signing proxy certificates or to permit keyCertSign for signing other certificates, respectively. If all operations complete successfully then certificate is considered valid. If any operation fails then the certificate is not valid.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-verification-options/#trusted-certificate-options","title":"Trusted Certificate Options","text":"

                                                                                                                                      The following options specify how to supply the certificates that can be used as trust anchors for certain uses. As mentioned, a collection of such certificates is called a trust store.

                                                                                                                                      Note that OpenSSL does not provide a default set of trust anchors. Many Linux distributions include a system default and configure OpenSSL to point to that. Mozilla maintains an influential trust store that can be found at https://www.mozilla.org/en-US/about/governance/policies/security-group/certs/.

                                                                                                                                      The certificates to add to the trust store can be specified using following options.

                                                                                                                                      • -CAfile file

                                                                                                                                        Load the specified file which contains a certificate or several of them in case the input is in PEM or PKCS#12 format. PEM-encoded certificates may also have trust attributes set.

                                                                                                                                      • -no-CAfile

                                                                                                                                        Do not load the default file of trusted certificates.

                                                                                                                                      • -CApath dir

                                                                                                                                        Use the specified directory as a collection of trusted certificates, i.e., a trust store. Files should be named with the hash value of the X.509 SubjectName of each certificate. This is so that the library can extract the IssuerName, hash it, and directly lookup the file to get the issuer certificate. See openssl-rehash(1) for information on creating this type of directory.

                                                                                                                                      • -no-CApath

                                                                                                                                        Do not use the default directory of trusted certificates.

                                                                                                                                      • -CAstore uri

                                                                                                                                        Use uri as a store of CA certificates. The URI may indicate a single certificate, as well as a collection of them. With URIs in the file: scheme, this acts as -CAfile or -CApath, depending on if the URI indicates a single file or directory. See ossl_store-file(7) for more information on the file: scheme.

                                                                                                                                        These certificates are also used when building the server certificate chain (for example with openssl-s_server(1)) or client certificate chain (for example with openssl-s_time(1)).

                                                                                                                                      • -no-CAstore

                                                                                                                                        Do not use the default store of trusted CA certificates.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#verification-options","title":"Verification Options","text":"

                                                                                                                                      The certificate verification can be fine-tuned with the following flags.

                                                                                                                                      • -verbose

                                                                                                                                        Print extra information about the operations being performed.

                                                                                                                                      • -attime timestamp

                                                                                                                                        Perform validation checks using time specified by timestamp and not current system time. timestamp is the number of seconds since January 1, 1970 (i.e., the Unix Epoch).

                                                                                                                                      • -no_check_time

                                                                                                                                        This option suppresses checking the validity period of certificates and CRLs against the current time. If option -attime is used to specify a verification time, the check is not suppressed.

                                                                                                                                      • -x509_strict

                                                                                                                                        This disables non-compliant workarounds for broken certificates. Thus errors are thrown on certificates not compliant with RFC 5280.

                                                                                                                                        When this option is set, among others, the following certificate well-formedness conditions are checked:

                                                                                                                                        • The basicConstraints of CA certificates must be marked critical.
                                                                                                                                        • CA certificates must explicitly include the keyUsage extension.
                                                                                                                                        • If a pathlenConstraint is given the key usage keyCertSign must be allowed.
                                                                                                                                        • The pathlenConstraint must not be given for non-CA certificates.
                                                                                                                                        • The issuer name of any certificate must not be empty.
                                                                                                                                        • The subject name of CA certs, certs with keyUsage crlSign, and certs without subjectAlternativeName must not be empty.
                                                                                                                                        • If a subjectAlternativeName extension is given it must not be empty.
                                                                                                                                        • The signatureAlgorithm field and the cert signature must be consistent.
                                                                                                                                        • Any given authorityKeyIdentifier and any given subjectKeyIdentifier must not be marked critical.
                                                                                                                                        • The authorityKeyIdentifier must be given for X.509v3 certs unless they are self-signed.
                                                                                                                                        • The subjectKeyIdentifier must be given for all X.509v3 CA certs.
                                                                                                                                      • -ignore_critical

                                                                                                                                        Normally if an unhandled critical extension is present that is not supported by OpenSSL the certificate is rejected (as required by RFC5280). If this option is set critical extensions are ignored.

                                                                                                                                      • -issuer_checks

                                                                                                                                        Ignored.

                                                                                                                                      • -crl_check

                                                                                                                                        Checks end entity certificate validity by attempting to look up a valid CRL. If a valid CRL cannot be found an error occurs.

                                                                                                                                      • -crl_check_all

                                                                                                                                        Checks the validity of all certificates in the chain by attempting to look up valid CRLs.

                                                                                                                                      • -use_deltas

                                                                                                                                        Enable support for delta CRLs.

                                                                                                                                      • -extended_crl

                                                                                                                                        Enable extended CRL features such as indirect CRLs and alternate CRL signing keys.

                                                                                                                                      • -suiteB_128_only, -suiteB_128, -suiteB_192

                                                                                                                                        Enable the Suite B mode operation at 128 bit Level of Security, 128 bit or 192 bit, or only 192 bit Level of Security respectively. See RFC6460 for details. In particular the supported signature algorithms are reduced to support only ECDSA and SHA256 or SHA384 and only the elliptic curves P-256 and P-384.

                                                                                                                                      • -auth_level level

                                                                                                                                        Set the certificate chain authentication security level to level. The authentication security level determines the acceptable signature and public key strength when verifying certificate chains. For a certificate chain to validate, the public keys of all the certificates must meet the specified security level. The signature algorithm security level is enforced for all the certificates in the chain except for the chain's trust anchor, which is either directly trusted or validated by means other than its signature. See SSL_CTX_set_security_level(3) for the definitions of the available levels. The default security level is -1, or \"not set\". At security level 0 or lower all algorithms are acceptable. Security level 1 requires at least 80-bit-equivalent security and is broadly interoperable, though it will, for example, reject MD5 signatures or RSA keys shorter than 1024 bits.

                                                                                                                                      • -partial_chain

                                                                                                                                        Allow verification to succeed if an incomplete chain can be built. That is, a chain ending in a certificate that normally would not be trusted (because it has no matching positive trust attributes and is not self-signed) but is an element of the trust store. This certificate may be self-issued or belong to an intermediate CA.

                                                                                                                                      • -check_ss_sig

                                                                                                                                        Verify the signature of the last certificate in a chain if the certificate is supposedly self-signed. This is prohibited and will result in an error if it is a non-conforming CA certificate with key usage restrictions not including the keyCertSign bit. This verification is disabled by default because it doesn't add any security.

                                                                                                                                      • -allow_proxy_certs

                                                                                                                                        Allow the verification of proxy certificates.

                                                                                                                                      • -trusted_first

                                                                                                                                        As of OpenSSL 1.1.0 this option is on by default and cannot be disabled.

                                                                                                                                        When constructing the certificate chain, the trusted certificates specified via -CAfile, -CApath, -CAstore or -trusted are always used before any certificates specified via -untrusted.

                                                                                                                                      • -no_alt_chains

                                                                                                                                        As of OpenSSL 1.1.0, since -trusted_first always on, this option has no effect.

                                                                                                                                      • -trusted file

                                                                                                                                        Parse file as a set of one or more certificates. Each of them qualifies as trusted if has a suitable positive trust attribute or it is self-signed or the -partial_chain option is specified. This option implies the -no-CAfile, -no-CApath, and -no-CAstore options and it cannot be used with the -CAfile, -CApath or -CAstore options, so only certificates specified using the -trusted option are trust anchors. This option may be used multiple times.

                                                                                                                                      • -untrusted file

                                                                                                                                        Parse file as a set of one or more certificates. All certificates (typically of intermediate CAs) are considered untrusted and may be used to construct a certificate chain from the target certificate to a trust anchor. This option may be used multiple times.

                                                                                                                                      • -policy arg

                                                                                                                                        Enable policy processing and add arg to the user-initial-policy-set (see RFC5280). The policy arg can be an object name or an OID in numeric form. This argument can appear more than once.

                                                                                                                                      • -explicit_policy

                                                                                                                                        Set policy variable require-explicit-policy (see RFC5280).

                                                                                                                                      • -policy_check

                                                                                                                                        Enables certificate policy processing.

                                                                                                                                      • -policy_print

                                                                                                                                        Print out diagnostics related to policy processing.

                                                                                                                                      • -inhibit_any

                                                                                                                                        Set policy variable inhibit-any-policy (see RFC5280).

                                                                                                                                      • -inhibit_map

                                                                                                                                        Set policy variable inhibit-policy-mapping (see RFC5280).

                                                                                                                                      • -purpose purpose

                                                                                                                                        The intended use for the certificate. Currently defined purposes are sslclient, sslserver, nssslserver, smimesign, smimeencrypt, crlsign, ocsphelper, timestampsign, and any. If peer certificate verification is enabled, by default the TLS implementation as well as the commands s_client and s_server check for consistency with TLS server or TLS client use, respectively.

                                                                                                                                        While IETF RFC 5280 says that id-kp-serverAuth and id-kp-clientAuth are only for WWW use, in practice they are used for all kinds of TLS clients and servers, and this is what OpenSSL assumes as well.

                                                                                                                                      • -verify_depth num

                                                                                                                                        Limit the certificate chain to num intermediate CA certificates. A maximal depth chain can have up to num+2 certificates, since neither the end-entity certificate nor the trust-anchor certificate count against the -verify_depth limit.

                                                                                                                                      • -verify_email email

                                                                                                                                        Verify if email matches the email address in Subject Alternative Name or the email in the subject Distinguished Name.

                                                                                                                                      • -verify_hostname hostname

                                                                                                                                        Verify if hostname matches DNS name in Subject Alternative Name or Common Name in the subject certificate.

                                                                                                                                      • -verify_ip ip

                                                                                                                                        Verify if ip matches the IP address in Subject Alternative Name of the subject certificate.

                                                                                                                                      • -verify_name name

                                                                                                                                        Use default verification policies like trust model and required certificate policies identified by name. The trust model determines which auxiliary trust or reject OIDs are applicable to verifying the given certificate chain. They can be given using the -addtrust and -addreject options for openssl-x509(1). Supported policy names include: default, pkcs7, smime_sign, ssl_client, ssl_server. These mimics the combinations of purpose and trust settings used in SSL, CMS and S/MIME. As of OpenSSL 1.1.0, the trust model is inferred from the purpose when not specified, so the -verify_name options are functionally equivalent to the corresponding -purpose settings.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#extended-verification-options","title":"Extended Verification Options","text":"

                                                                                                                                      Sometimes there may be more than one certificate chain leading to an end-entity certificate. This usually happens when a root or intermediate CA signs a certificate for another a CA in other organization. Another reason is when a CA might have intermediates that use two different signature formats, such as a SHA-1 and a SHA-256 digest.

                                                                                                                                      The following options can be used to provide data that will allow the OpenSSL command to generate an alternative chain.

                                                                                                                                      • -xkey infile, -xcert infile, -xchain

                                                                                                                                        Specify an extra certificate, private key and certificate chain. These behave in the same manner as the -cert, -key and -cert_chain options. When specified, the callback returning the first valid chain will be in use by the client.

                                                                                                                                      • -xchain_build

                                                                                                                                        Specify whether the application should build the certificate chain to be provided to the server for the extra certificates via the -xkey, -xcert, and -xchain options.

                                                                                                                                      • -xcertform DER|PEM|P12

                                                                                                                                        The input format for the extra certificate. This option has no effect and is retained for backward compatibility only.

                                                                                                                                      • -xkeyform DER|PEM|P12

                                                                                                                                        The input format for the extra key. This option has no effect and is retained for backward compatibility only.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#certificate-extensions","title":"Certificate Extensions","text":"

                                                                                                                                      Options like -purpose lead to checking the certificate extensions, which determine what the target certificate and intermediate CA certificates can be used for.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#basic-constraints","title":"Basic Constraints","text":"

                                                                                                                                      The basicConstraints extension CA flag is used to determine whether the certificate can be used as a CA. If the CA flag is true then it is a CA, if the CA flag is false then it is not a CA. All CAs should have the CA flag set to true.

                                                                                                                                      If the basicConstraints extension is absent, which includes the case that it is an X.509v1 certificate, then the certificate is considered to be a \"possible CA\" and other extensions are checked according to the intended use of the certificate. The treatment of certificates without basicConstraints as a CA is presently supported, but this could change in the future.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#key-usage","title":"Key Usage","text":"

                                                                                                                                      If the keyUsage extension is present then additional restraints are made on the uses of the certificate. A CA certificate must have the keyCertSign bit set if the keyUsage extension is present.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#extended-key-usage","title":"Extended Key Usage","text":"

                                                                                                                                      The extKeyUsage (EKU) extension places additional restrictions on the certificate uses. If this extension is present (whether critical or not) the key can only be used for the purposes specified.

                                                                                                                                      A complete description of each check is given below. The comments about basicConstraints and keyUsage and X.509v1 certificates above apply to all CA certificates.

                                                                                                                                      • SSL Client

                                                                                                                                        The extended key usage extension must be absent or include the \"web client authentication\" OID. The keyUsage extension must be absent or it must have the digitalSignature bit set. The Netscape certificate type must be absent or it must have the SSL client bit set.

                                                                                                                                      • SSL Client CA

                                                                                                                                        The extended key usage extension must be absent or include the \"web client authentication\" OID. The Netscape certificate type must be absent or it must have the SSL CA bit set. This is used as a work around if the basicConstraints extension is absent.

                                                                                                                                      • SSL Server

                                                                                                                                        The extended key usage extension must be absent or include the \"web server authentication\" and/or one of the SGC OIDs. The keyUsage extension must be absent or it must have the digitalSignature, the keyEncipherment set or both bits set. The Netscape certificate type must be absent or have the SSL server bit set.

                                                                                                                                      • SSL Server CA

                                                                                                                                        The extended key usage extension must be absent or include the \"web server authentication\" and/or one of the SGC OIDs. The Netscape certificate type must be absent or the SSL CA bit must be set. This is used as a work around if the basicConstraints extension is absent.

                                                                                                                                      • Netscape SSL Server

                                                                                                                                        For Netscape SSL clients to connect to an SSL server it must have the keyEncipherment bit set if the keyUsage extension is present. This isn't always valid because some cipher suites use the key for digital signing. Otherwise it is the same as a normal SSL server.

                                                                                                                                      • Common S/MIME Client Tests

                                                                                                                                        The extended key usage extension must be absent or include the \"email protection\" OID. The Netscape certificate type must be absent or should have the S/MIME bit set. If the S/MIME bit is not set in the Netscape certificate type then the SSL client bit is tolerated as an alternative but a warning is shown. This is because some Verisign certificates don't set the S/MIME bit.

                                                                                                                                      • S/MIME Signing

                                                                                                                                        In addition to the common S/MIME client tests the digitalSignature bit or the nonRepudiation bit must be set if the keyUsage extension is present.

                                                                                                                                      • S/MIME Encryption

                                                                                                                                        In addition to the common S/MIME tests the keyEncipherment bit must be set if the keyUsage extension is present.

                                                                                                                                      • S/MIME CA

                                                                                                                                        The extended key usage extension must be absent or include the \"email protection\" OID. The Netscape certificate type must be absent or must have the S/MIME CA bit set. This is used as a work around if the basicConstraints extension is absent.

                                                                                                                                      • CRL Signing

                                                                                                                                        The keyUsage extension must be absent or it must have the CRL signing bit set.

                                                                                                                                      • CRL Signing CA

                                                                                                                                        The normal CA tests apply. Except in this case the basicConstraints extension must be present.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#bugs","title":"BUGS","text":"

                                                                                                                                      The issuer checks still suffer from limitations in the underlying X509_LOOKUP API. One consequence of this is that trusted certificates with matching subject name must appear in a file (as specified by the -CAfile option), a directory (as specified by -CApath), or a store (as specified by -CAstore). If there are multiple such matches, possibly in multiple locations, only the first one (in the mentioned order of locations) is recognised.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      X509_verify_cert(3), openssl-verify(1), openssl-ocsp(1), openssl-ts(1), openssl-s_client(1), openssl-s_server(1), openssl-smime(1), openssl-cmp(1), openssl-cms(1)

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#history","title":"HISTORY","text":"

                                                                                                                                      The checks enabled by -x509_strict have been extended in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-verification-options/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-verify/","title":"openssl-verify","text":""},{"location":"man1/openssl-verify/#name","title":"NAME","text":"

                                                                                                                                      openssl-verify - certificate verification command

                                                                                                                                      "},{"location":"man1/openssl-verify/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl verify [-help] [-CRLfile filename|uri] [-crl_download] [-show_chain] [-verbose] [-trusted filename|uri] [-untrusted filename|uri] [-vfyopt nm:v] [-nameopt option] [-CAfile file] [-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore] [-engine id] [-allow_proxy_certs] [-attime timestamp] [-no_check_time] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-x509_strict] [-issuer_checks] [-provider name] [-provider-path path] [-propquery propq] [--] [certificate ...]

                                                                                                                                      "},{"location":"man1/openssl-verify/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command verifies certificate chains. If a certificate chain has multiple problems, this program attempts to display all of them.

                                                                                                                                      "},{"location":"man1/openssl-verify/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -CRLfile filename|uri

                                                                                                                                        The file or URI should contain one or more CRLs in PEM or DER format. This option can be specified more than once to include CRLs from multiple sources.

                                                                                                                                      • -crl_download

                                                                                                                                        Attempt to download CRL information for certificates via their CDP entries.

                                                                                                                                      • -show_chain

                                                                                                                                        Display information about the certificate chain that has been built (if successful). Certificates in the chain that came from the untrusted list will be flagged as \"untrusted\".

                                                                                                                                      • -verbose

                                                                                                                                        Print extra information about the operations being performed.

                                                                                                                                      • -trusted filename|uri

                                                                                                                                        A file or URI of (more or less) trusted certificates. See openssl-verification-options(1) for more information on trust settings.

                                                                                                                                        This option can be specified more than once to load certificates from multiple sources.

                                                                                                                                      • -untrusted filename|uri

                                                                                                                                        A file or URI of untrusted certificates to use for chain building. This option can be specified more than once to load certificates from multiple sources.

                                                                                                                                      • -vfyopt nm:v

                                                                                                                                        Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

                                                                                                                                      • -nameopt option

                                                                                                                                        This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                        To load certificates or CRLs that require engine support, specify the -engine option before any of the -trusted, -untrusted or -CRLfile options.

                                                                                                                                      • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore

                                                                                                                                        See \"Trusted Certificate Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict -issuer_checks

                                                                                                                                        Set various options of certificate chain verification. See \"Verification Options\" in openssl-verification-options(1) for details.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      • --

                                                                                                                                        Indicates the last option. All arguments following this are assumed to be certificate files. This is useful if the first certificate filename begins with a -.

                                                                                                                                      • certificate ...

                                                                                                                                        One or more target certificates to verify, one per file. If no certificates are given, this command will attempt to read a single certificate from standard input.

                                                                                                                                      "},{"location":"man1/openssl-verify/#diagnostics","title":"DIAGNOSTICS","text":"

                                                                                                                                      When a verify operation fails the output messages can be somewhat cryptic. The general form of the error message is:

                                                                                                                                      server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit)\nerror 24 at 1 depth lookup:invalid CA certificate\n

                                                                                                                                      The first line contains the name of the certificate being verified followed by the subject name of the certificate. The second line contains the error number and the depth. The depth is number of the certificate being verified when a problem was detected starting with zero for the target (\"leaf\") certificate itself then 1 for the CA that signed the target certificate and so on. Finally a textual version of the error number is presented.

                                                                                                                                      A list of the error codes and messages can be found in X509_STORE_CTX_get_error(3); the full list is defined in the header file <openssl/x509_vfy.h>.

                                                                                                                                      This command ignores many errors, in order to allow all the problems with a certificate chain to be determined.

                                                                                                                                      "},{"location":"man1/openssl-verify/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl-verification-options(1), openssl-x509(1), ossl_store-file(7)

                                                                                                                                      "},{"location":"man1/openssl-verify/#history","title":"HISTORY","text":"

                                                                                                                                      The -show_chain option was added in OpenSSL 1.1.0.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-verify/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-version/","title":"openssl-version","text":""},{"location":"man1/openssl-version/#name","title":"NAME","text":"

                                                                                                                                      openssl-version - print OpenSSL version information

                                                                                                                                      "},{"location":"man1/openssl-version/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl version [-help] [-a] [-v] [-b] [-o] [-f] [-p] [-d] [-e] [-m] [-r] [-c]

                                                                                                                                      "},{"location":"man1/openssl-version/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is used to print out version information about OpenSSL.

                                                                                                                                      "},{"location":"man1/openssl-version/#options","title":"OPTIONS","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -a

                                                                                                                                        All information, this is the same as setting all the other flags.

                                                                                                                                      • -v

                                                                                                                                        The current OpenSSL version.

                                                                                                                                      • -b

                                                                                                                                        The date the current version of OpenSSL was built.

                                                                                                                                      • -o

                                                                                                                                        Option information: various options set when the library was built.

                                                                                                                                      • -f

                                                                                                                                        Compilation flags.

                                                                                                                                      • -p

                                                                                                                                        Platform setting.

                                                                                                                                      • -d

                                                                                                                                        OPENSSLDIR setting.

                                                                                                                                      • -e

                                                                                                                                        ENGINESDIR settings.

                                                                                                                                      • -m

                                                                                                                                        MODULESDIR settings.

                                                                                                                                      • -r

                                                                                                                                        The random number generator source settings.

                                                                                                                                      • -c

                                                                                                                                        The OpenSSL CPU settings info.

                                                                                                                                      "},{"location":"man1/openssl-version/#notes","title":"NOTES","text":"

                                                                                                                                      The output of openssl version -a would typically be used when sending in a bug report.

                                                                                                                                      "},{"location":"man1/openssl-version/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl-x509/","title":"openssl-x509","text":""},{"location":"man1/openssl-x509/#name","title":"NAME","text":"

                                                                                                                                      openssl-x509 - Certificate display and signing command

                                                                                                                                      "},{"location":"man1/openssl-x509/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl x509 [-help] [-in filename|uri] [-passin arg] [-new] [-x509toreq] [-req] [-copy_extensions arg] [-inform DER|PEM] [-vfyopt nm:v] [-key filename|uri] [-keyform DER|PEM|P12|ENGINE] [-signkey filename|uri] [-out filename] [-outform DER|PEM] [-nocert] [-noout] [-dateopt] [-text] [-certopt option] [-fingerprint] [-alias] [-serial] [-startdate] [-enddate] [-dates] [-subject] [-issuer] [-nameopt option] [-email] [-hash] [-subject_hash] [-subject_hash_old] [-issuer_hash] [-issuer_hash_old] [-ext extensions] [-ocspid] [-ocsp_uri] [-purpose] [-pubkey] [-modulus] [-checkend num] [-checkhost host] [-checkemail host] [-checkip ipaddr] [-set_serial n] [-next_serial] [-days arg] [-preserve_dates] [-subj arg] [-force_pubkey filename] [-clrext] [-extfile filename] [-extensions section] [-sigopt nm:v] [-badsig] [-digest] [-CA filename|uri] [-CAform DER|PEM|P12] [-CAkey filename|uri] [-CAkeyform DER|PEM|P12|ENGINE] [-CAserial filename] [-CAcreateserial] [-trustout] [-setalias arg] [-clrtrust] [-addtrust arg] [-clrreject] [-addreject arg] [-rand files] [-writerand file] [-engine id] [-provider name] [-provider-path path] [-propquery propq]

                                                                                                                                      "},{"location":"man1/openssl-x509/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command is a multi-purposes certificate handling command. It can be used to print certificate information, convert certificates to various forms, edit certificate trust settings, generate certificates from scratch or from certificating requests and then self-signing them or signing them like a \"micro CA\".

                                                                                                                                      Since there are a large number of options they will split up into various sections.

                                                                                                                                      "},{"location":"man1/openssl-x509/#options","title":"OPTIONS","text":""},{"location":"man1/openssl-x509/#input-output-and-general-purpose-options","title":"Input, Output, and General Purpose Options","text":"
                                                                                                                                      • -help

                                                                                                                                        Print out a usage message.

                                                                                                                                      • -in filename|uri

                                                                                                                                        This specifies the input to read a certificate from or the input file for reading a certificate request if the -req flag is used. In both cases this defaults to standard input.

                                                                                                                                        This option cannot be combined with the -new flag.

                                                                                                                                      • -passin arg

                                                                                                                                        The key and certificate file password source. For more information about the format of arg see openssl-passphrase-options(1).

                                                                                                                                      • -new

                                                                                                                                        Generate a certificate from scratch, not using an input certificate or certificate request. So the -in option must not be used in this case. Instead, the -subj option needs to be given. The public key to include can be given with the -force_pubkey option and defaults to the key given with the -key (or -signkey) option, which implies self-signature.

                                                                                                                                      • -x509toreq

                                                                                                                                        Output a PKCS#10 certificate request (rather than a certificate). The -key (or -signkey) option must be used to provide the private key for self-signing; the corresponding public key is placed in the subjectPKInfo field.

                                                                                                                                        X.509 extensions included in a certificate input are not copied by default. X.509 extensions to be added can be specified using the -extfile option.

                                                                                                                                      • -req

                                                                                                                                        By default a certificate is expected on input. With this option a PKCS#10 certificate request is expected instead, which must be correctly self-signed.

                                                                                                                                        X.509 extensions included in the request are not copied by default. X.509 extensions to be added can be specified using the -extfile option.

                                                                                                                                      • -copy_extensions arg

                                                                                                                                        Determines how to handle X.509 extensions when converting from a certificate to a request using the -x509toreq option or converting from a request to a certificate using the -req option. If arg is none or this option is not present then extensions are ignored. If arg is copy or copyall then all extensions are copied, except that subject identifier and authority key identifier extensions are not taken over when producing a certificate request.

                                                                                                                                        The -ext option can be used to further restrict which extensions to copy.

                                                                                                                                      • -inform DER|PEM

                                                                                                                                        The input file format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -vfyopt nm:v

                                                                                                                                        Pass options to the signature algorithm during verify operations. Names and values of these options are algorithm-specific.

                                                                                                                                      • -key filename|uri

                                                                                                                                        This option provides the private key for signing a new certificate or certificate request. Unless -force_pubkey is given, the corresponding public key is placed in the new certificate or certificate request, resulting in a self-signature.

                                                                                                                                        This option cannot be used in conjunction with the -CA option.

                                                                                                                                        It sets the issuer name to the subject name (i.e., makes it self-issued) and changes the public key to the supplied value (unless overridden by -force_pubkey). Unless the -preserve_dates option is supplied, it sets the validity start date to the current time and the end date to a value determined by the -days option.

                                                                                                                                      • -signkey filename|uri

                                                                                                                                        This option is an alias of -key.

                                                                                                                                      • -keyform DER|PEM|P12|ENGINE

                                                                                                                                        The key input format; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -out filename

                                                                                                                                        This specifies the output filename to write to or standard output by default.

                                                                                                                                      • -outform DER|PEM

                                                                                                                                        The output format; the default is PEM. See openssl-format-options(1) for details.

                                                                                                                                      • -nocert

                                                                                                                                        Do not output a certificate (except for printing as requested by below options).

                                                                                                                                      • -noout

                                                                                                                                        This option prevents output except for printing as requested by below options.

                                                                                                                                      "},{"location":"man1/openssl-x509/#certificate-printing-options","title":"Certificate Printing Options","text":"

                                                                                                                                      Note: the -alias and -purpose options are also printing options but are described in the \"Trust Settings\" section.

                                                                                                                                      • -dateopt

                                                                                                                                        Specify the date output format. Values are: rfc_822 and iso_8601. Defaults to rfc_822.

                                                                                                                                      • -text

                                                                                                                                        Prints out the certificate in text form. Full details are printed including the public key, signature algorithms, issuer and subject names, serial number any extensions present and any trust settings.

                                                                                                                                      • -certopt option

                                                                                                                                        Customise the print format used with -text. The option argument can be a single option or multiple options separated by commas. The -certopt switch may be also be used more than once to set multiple options. See the \"Text Printing Flags\" section for more information.

                                                                                                                                      • -fingerprint

                                                                                                                                        Calculates and prints the digest of the DER encoded version of the entire certificate (see digest options). This is commonly called a \"fingerprint\". Because of the nature of message digests, the fingerprint of a certificate is unique to that certificate and two certificates with the same fingerprint can be considered to be the same.

                                                                                                                                      • -alias

                                                                                                                                        Prints the certificate \"alias\" (nickname), if any.

                                                                                                                                      • -serial

                                                                                                                                        Prints the certificate serial number.

                                                                                                                                      • -startdate

                                                                                                                                        Prints out the start date of the certificate, that is the notBefore date.

                                                                                                                                      • -enddate

                                                                                                                                        Prints out the expiry date of the certificate, that is the notAfter date.

                                                                                                                                      • -dates

                                                                                                                                        Prints out the start and expiry dates of a certificate.

                                                                                                                                      • -subject

                                                                                                                                        Prints the subject name.

                                                                                                                                      • -issuer

                                                                                                                                        Prints the issuer name.

                                                                                                                                      • -nameopt option

                                                                                                                                        This specifies how the subject or issuer names are displayed. See openssl-namedisplay-options(1) for details.

                                                                                                                                      • -email

                                                                                                                                        Prints the email address(es) if any.

                                                                                                                                      • -hash

                                                                                                                                        Synonym for \"-subject_hash\" for backward compatibility reasons.

                                                                                                                                      • -subject_hash

                                                                                                                                        Prints the \"hash\" of the certificate subject name. This is used in OpenSSL to form an index to allow certificates in a directory to be looked up by subject name.

                                                                                                                                      • -subject_hash_old

                                                                                                                                        Prints the \"hash\" of the certificate subject name using the older algorithm as used by OpenSSL before version 1.0.0.

                                                                                                                                      • -issuer_hash

                                                                                                                                        Prints the \"hash\" of the certificate issuer name.

                                                                                                                                      • -issuer_hash_old

                                                                                                                                        Prints the \"hash\" of the certificate issuer name using the older algorithm as used by OpenSSL before version 1.0.0.

                                                                                                                                      • -ext extensions

                                                                                                                                        Prints out the certificate extensions in text form. Can also be used to restrict which extensions to copy. Extensions are specified with a comma separated string, e.g., \"subjectAltName,subjectKeyIdentifier\". See the x509v3_config(5) manual page for the extension names.

                                                                                                                                      • -ocspid

                                                                                                                                        Prints the OCSP hash values for the subject name and public key.

                                                                                                                                      • -ocsp_uri

                                                                                                                                        Prints the OCSP responder address(es) if any.

                                                                                                                                      • -purpose

                                                                                                                                        This option performs tests on the certificate extensions and outputs the results. For a more complete description see \"Certificate Extensions\" in openssl-verification-options(1).

                                                                                                                                      • -pubkey

                                                                                                                                        Prints the certificate's SubjectPublicKeyInfo block in PEM format.

                                                                                                                                      • -modulus

                                                                                                                                        This option prints out the value of the modulus of the public key contained in the certificate.

                                                                                                                                      "},{"location":"man1/openssl-x509/#certificate-checking-options","title":"Certificate Checking Options","text":"
                                                                                                                                      • -checkend arg

                                                                                                                                        Checks if the certificate expires within the next arg seconds and exits nonzero if yes it will expire or zero if not.

                                                                                                                                      • -checkhost host

                                                                                                                                        Check that the certificate matches the specified host.

                                                                                                                                      • -checkemail email

                                                                                                                                        Check that the certificate matches the specified email address.

                                                                                                                                      • -checkip ipaddr

                                                                                                                                        Check that the certificate matches the specified IP address.

                                                                                                                                      "},{"location":"man1/openssl-x509/#certificate-output-options","title":"Certificate Output Options","text":"
                                                                                                                                      • -set_serial n

                                                                                                                                        Specifies the serial number to use. This option can be used with the -key, -signkey, or -CA options. If used in conjunction with the -CA option the serial number file (as specified by the -CAserial option) is not used.

                                                                                                                                        The serial number can be decimal or hex (if preceded by 0x).

                                                                                                                                      • -next_serial

                                                                                                                                        Set the serial to be one more than the number in the certificate.

                                                                                                                                      • -days arg

                                                                                                                                        Specifies the number of days until a newly generated certificate expires. The default is 30. Cannot be used together with the -preserve_dates option.

                                                                                                                                      • -preserve_dates

                                                                                                                                        When signing a certificate, preserve \"notBefore\" and \"notAfter\" dates of any input certificate instead of adjusting them to current time and duration. Cannot be used together with the -days option.

                                                                                                                                      • -subj arg

                                                                                                                                        When a certificate is created set its subject name to the given value. When the certificate is self-signed the issuer name is set to the same value.

                                                                                                                                        The arg must be formatted as /type0=value0/type1=value1/type2=.... Special characters may be escaped by \\ (backslash), whitespace is retained. Empty values are permitted, but the corresponding type will not be included in the certificate. Giving a single / will lead to an empty sequence of RDNs (a NULL-DN). Multi-valued RDNs can be formed by placing a + character instead of a / between the AttributeValueAssertions (AVAs) that specify the members of the set. Example:

                                                                                                                                        /DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe

                                                                                                                                        This option can be used in conjunction with the -force_pubkey option to create a certificate even without providing an input certificate or certificate request.

                                                                                                                                      • -force_pubkey filename

                                                                                                                                        When a certificate is created set its public key to the key in filename instead of the key contained in the input or given with the -key (or -signkey) option.

                                                                                                                                        This option is useful for creating self-issued certificates that are not self-signed, for instance when the key cannot be used for signing, such as DH. It can also be used in conjunction with -new and -subj to directly generate a certificate containing any desired public key.

                                                                                                                                      • -clrext

                                                                                                                                        When transforming a certificate to a new certificate by default all certificate extensions are retained.

                                                                                                                                        When transforming a certificate or certificate request, the -clrext option prevents taking over any extensions from the source. In any case, when producing a certificate request, neither subject identifier nor authority key identifier extensions are included.

                                                                                                                                      • -extfile filename

                                                                                                                                        Configuration file containing certificate and request X.509 extensions to add.

                                                                                                                                      • -extensions section

                                                                                                                                        The section in the extfile to add X.509 extensions from. If this option is not specified then the extensions should either be contained in the unnamed (default) section or the default section should contain a variable called \"extensions\" which contains the section to use. See the x509v3_config(5) manual page for details of the extension section format.

                                                                                                                                      • -sigopt nm:v

                                                                                                                                        Pass options to the signature algorithm during sign operations. This option may be given multiple times. Names and values provided using this option are algorithm-specific.

                                                                                                                                      • -badsig

                                                                                                                                        Corrupt the signature before writing it; this can be useful for testing.

                                                                                                                                      • -digest

                                                                                                                                        The digest to use. This affects any signing or printing option that uses a message digest, such as the -fingerprint, -key, and -CA options. Any digest supported by the openssl-dgst(1) command can be used. If not specified then SHA1 is used with -fingerprint or the default digest for the signing algorithm is used, typically SHA256.

                                                                                                                                      "},{"location":"man1/openssl-x509/#micro-ca-options","title":"Micro-CA Options","text":"
                                                                                                                                      • -CA filename|uri

                                                                                                                                        Specifies the \"CA\" certificate to be used for signing. When present, this behaves like a \"micro CA\" as follows: The subject name of the \"CA\" certificate is placed as issuer name in the new certificate, which is then signed using the \"CA\" key given as detailed below.

                                                                                                                                        This option cannot be used in conjunction with -key (or -signkey). This option is normally combined with the -req option referencing a CSR. Without the -req option the input must be an existing certificate unless the -new option is given, which generates a certificate from scratch.

                                                                                                                                      • -CAform DER|PEM|P12,

                                                                                                                                        The format for the CA certificate; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -CAkey filename|uri

                                                                                                                                        Sets the CA private key to sign a certificate with. The private key must match the public key of the certificate given with -CA. If this option is not provided then the key must be present in the -CA input.

                                                                                                                                      • -CAkeyform DER|PEM|P12|ENGINE

                                                                                                                                        The format for the CA key; unspecified by default. See openssl-format-options(1) for details.

                                                                                                                                      • -CAserial filename

                                                                                                                                        Sets the CA serial number file to use.

                                                                                                                                        When creating a certificate with this option and with the -CA option, the certificate serial number is stored in the given file. This file consists of one line containing an even number of hex digits with the serial number used last time. After reading this number, it is incremented and used, and the file is updated.

                                                                                                                                        The default filename consists of the CA certificate file base name with .srl appended. For example if the CA certificate file is called mycacert.pem it expects to find a serial number file called mycacert.srl.

                                                                                                                                        If the -CA option is specified and neither <-CAserial> or <-CAcreateserial> is given and the default serial number file does not exist, a random number is generated; this is the recommended practice.

                                                                                                                                      • -CAcreateserial

                                                                                                                                        With this option and the -CA option the CA serial number file is created if it does not exist. A random number is generated, used for the certificate, and saved into the serial number file determined as described above.

                                                                                                                                      "},{"location":"man1/openssl-x509/#trust-settings","title":"Trust Settings","text":"

                                                                                                                                      A trusted certificate is an ordinary certificate which has several additional pieces of information attached to it such as the permitted and prohibited uses of the certificate and possibly an \"alias\" (nickname).

                                                                                                                                      Normally when a certificate is being verified at least one certificate must be \"trusted\". By default a trusted certificate must be stored locally and must be a root CA: any certificate chain ending in this CA is then usable for any purpose.

                                                                                                                                      Trust settings currently are only used with a root CA. They allow a finer control over the purposes the root CA can be used for. For example, a CA may be trusted for SSL client but not SSL server use.

                                                                                                                                      See openssl-verification-options(1) for more information on the meaning of trust settings.

                                                                                                                                      Future versions of OpenSSL will recognize trust settings on any certificate: not just root CAs.

                                                                                                                                      • -trustout

                                                                                                                                        Mark any certificate PEM output as <trusted> certificate rather than ordinary. An ordinary or trusted certificate can be input but by default an ordinary certificate is output and any trust settings are discarded. With the -trustout option a trusted certificate is output. A trusted certificate is automatically output if any trust settings are modified.

                                                                                                                                      • -setalias arg

                                                                                                                                        Sets the \"alias\" of the certificate. This will allow the certificate to be referred to using a nickname for example \"Steve's Certificate\".

                                                                                                                                      • -clrtrust

                                                                                                                                        Clears all the permitted or trusted uses of the certificate.

                                                                                                                                      • -addtrust arg

                                                                                                                                        Adds a trusted certificate use. Any object name can be used here but currently only clientAuth, serverAuth, emailProtection, and anyExtendedKeyUsage are defined. As of OpenSSL 1.1.0, the last of these blocks all purposes when rejected or enables all purposes when trusted. Other OpenSSL applications may define additional uses.

                                                                                                                                      • -clrreject

                                                                                                                                        Clears all the prohibited or rejected uses of the certificate.

                                                                                                                                      • -addreject arg

                                                                                                                                        Adds a prohibited trust anchor purpose. It accepts the same values as the -addtrust option.

                                                                                                                                      "},{"location":"man1/openssl-x509/#generic-options","title":"Generic options","text":"
                                                                                                                                      • -rand files, -writerand file

                                                                                                                                        See \"Random State Options\" in openssl(1) for details.

                                                                                                                                      • -engine id

                                                                                                                                        See \"Engine Options\" in openssl(1). This option is deprecated.

                                                                                                                                      • -provider name

                                                                                                                                      • -provider-path path
                                                                                                                                      • -propquery propq

                                                                                                                                        See \"Provider Options\" in openssl(1), provider(7), and property(7).

                                                                                                                                      "},{"location":"man1/openssl-x509/#text-printing-flags","title":"Text Printing Flags","text":"

                                                                                                                                      As well as customising the name printing format, it is also possible to customise the actual fields printed using the certopt option when the text option is present. The default behaviour is to print all fields.

                                                                                                                                      • compatible

                                                                                                                                        Use the old format. This is equivalent to specifying no printing options at all.

                                                                                                                                      • no_header

                                                                                                                                        Don't print header information: that is the lines saying \"Certificate\" and \"Data\".

                                                                                                                                      • no_version

                                                                                                                                        Don't print out the version number.

                                                                                                                                      • no_serial

                                                                                                                                        Don't print out the serial number.

                                                                                                                                      • no_signame

                                                                                                                                        Don't print out the signature algorithm used.

                                                                                                                                      • no_validity

                                                                                                                                        Don't print the validity, that is the notBefore and notAfter fields.

                                                                                                                                      • no_subject

                                                                                                                                        Don't print out the subject name.

                                                                                                                                      • no_issuer

                                                                                                                                        Don't print out the issuer name.

                                                                                                                                      • no_pubkey

                                                                                                                                        Don't print out the public key.

                                                                                                                                      • no_sigdump

                                                                                                                                        Don't give a hexadecimal dump of the certificate signature.

                                                                                                                                      • no_aux

                                                                                                                                        Don't print out certificate trust information.

                                                                                                                                      • no_extensions

                                                                                                                                        Don't print out any X509V3 extensions.

                                                                                                                                      • ext_default

                                                                                                                                        Retain default extension behaviour: attempt to print out unsupported certificate extensions.

                                                                                                                                      • ext_error

                                                                                                                                        Print an error message for unsupported certificate extensions.

                                                                                                                                      • ext_parse

                                                                                                                                        ASN1 parse unsupported extensions.

                                                                                                                                      • ext_dump

                                                                                                                                        Hex dump unsupported extensions.

                                                                                                                                      • ca_default

                                                                                                                                        The value used by openssl-ca(1), equivalent to no_issuer, no_pubkey, no_header, and no_version.

                                                                                                                                      "},{"location":"man1/openssl-x509/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Note: in these examples the '\\' means the example should be all on one line.

                                                                                                                                      Print the contents of a certificate:

                                                                                                                                      openssl x509 -in cert.pem -noout -text\n

                                                                                                                                      Print the \"Subject Alternative Name\" extension of a certificate:

                                                                                                                                      openssl x509 -in cert.pem -noout -ext subjectAltName\n

                                                                                                                                      Print more extensions of a certificate:

                                                                                                                                      openssl x509 -in cert.pem -noout -ext subjectAltName,nsCertType\n

                                                                                                                                      Print the certificate serial number:

                                                                                                                                      openssl x509 -in cert.pem -noout -serial\n

                                                                                                                                      Print the certificate subject name:

                                                                                                                                      openssl x509 -in cert.pem -noout -subject\n

                                                                                                                                      Print the certificate subject name in RFC2253 form:

                                                                                                                                      openssl x509 -in cert.pem -noout -subject -nameopt RFC2253\n

                                                                                                                                      Print the certificate subject name in oneline form on a terminal supporting UTF8:

                                                                                                                                      openssl x509 -in cert.pem -noout -subject -nameopt oneline,-esc_msb\n

                                                                                                                                      Print the certificate SHA1 fingerprint:

                                                                                                                                      openssl x509 -sha1 -in cert.pem -noout -fingerprint\n

                                                                                                                                      Convert a certificate from PEM to DER format:

                                                                                                                                      openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER\n

                                                                                                                                      Convert a certificate to a certificate request:

                                                                                                                                      openssl x509 -x509toreq -in cert.pem -out req.pem -key key.pem\n

                                                                                                                                      Convert a certificate request into a self-signed certificate using extensions for a CA:

                                                                                                                                      openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \\\n       -key key.pem -out cacert.pem\n

                                                                                                                                      Sign a certificate request using the CA certificate above and add user certificate extensions:

                                                                                                                                      openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \\\n       -CA cacert.pem -CAkey key.pem -CAcreateserial\n

                                                                                                                                      Set a certificate to be trusted for SSL client use and change set its alias to \"Steve's Class 1 CA\"

                                                                                                                                      openssl x509 -in cert.pem -addtrust clientAuth \\\n       -setalias \"Steve's Class 1 CA\" -out trust.pem\n
                                                                                                                                      "},{"location":"man1/openssl-x509/#notes","title":"NOTES","text":"

                                                                                                                                      The conversion to UTF8 format used with the name options assumes that T61Strings use the ISO8859-1 character set. This is wrong but Netscape and MSIE do this as do many certificates. So although this is incorrect it is more likely to print the majority of certificates correctly.

                                                                                                                                      The -email option searches the subject name and the subject alternative name extension. Only unique email addresses will be printed out: it will not print the same address more than once.

                                                                                                                                      "},{"location":"man1/openssl-x509/#bugs","title":"BUGS","text":"

                                                                                                                                      It is possible to produce invalid certificates or requests by specifying the wrong private key, using unsuitable X.509 extensions, or using inconsistent options in some cases: these should be checked.

                                                                                                                                      There should be options to explicitly set such things as start and end dates rather than an offset from the current time.

                                                                                                                                      "},{"location":"man1/openssl-x509/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-req(1), openssl-ca(1), openssl-genrsa(1), openssl-gendsa(1), openssl-verify(1), x509v3_config(5)

                                                                                                                                      "},{"location":"man1/openssl-x509/#history","title":"HISTORY","text":"

                                                                                                                                      The hash algorithm used in the -subject_hash and -issuer_hash options before OpenSSL 1.0.0 was based on the deprecated MD5 algorithm and the encoding of the distinguished name. In OpenSSL 1.0.0 and later it is based on a canonical version of the DN using SHA1. This means that any directories using the old form must have their links rebuilt using openssl-rehash(1) or similar.

                                                                                                                                      The -signkey option has been renamed to -key in OpenSSL 3.0, keeping the old name as an alias.

                                                                                                                                      The -engine option was deprecated in OpenSSL 3.0.

                                                                                                                                      The -C option was removed in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man1/openssl-x509/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/openssl/","title":"openssl","text":""},{"location":"man1/openssl/#name","title":"NAME","text":"

                                                                                                                                      openssl - OpenSSL command line program

                                                                                                                                      "},{"location":"man1/openssl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      openssl command [ options ... ] [ parameters ... ]

                                                                                                                                      openssl no-XXX [ options ]

                                                                                                                                      "},{"location":"man1/openssl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them.

                                                                                                                                      The openssl program is a command line program for using the various cryptography functions of OpenSSL's crypto library from the shell. It can be used for

                                                                                                                                      o  Creation and management of private keys, public keys and parameters\no  Public key cryptographic operations\no  Creation of X.509 certificates, CSRs and CRLs\no  Calculation of Message Digests and Message Authentication Codes\no  Encryption and Decryption with Ciphers\no  SSL/TLS Client and Server Tests\no  Handling of S/MIME signed or encrypted mail\no  Timestamp requests, generation and verification\n
                                                                                                                                      "},{"location":"man1/openssl/#command-summary","title":"COMMAND SUMMARY","text":"

                                                                                                                                      The openssl program provides a rich variety of commands (command in the \"SYNOPSIS\" above). Each command can have many options and argument parameters, shown above as options and parameters.

                                                                                                                                      Detailed documentation and use cases for most standard subcommands are available (e.g., openssl-x509(1)). The subcommand openssl-list(1) may be used to list subcommands.

                                                                                                                                      The command no-XXX tests whether a command of the specified name is available. If no command named XXX exists, it returns 0 (success) and prints no-XXX; otherwise it returns 1 and prints XXX. In both cases, the output goes to stdout and nothing is printed to stderr. Additional command line arguments are always ignored. Since for each cipher there is a command of the same name, this provides an easy way for shell scripts to test for the availability of ciphers in the openssl program. (no-XXX is not able to detect pseudo-commands such as quit, list, or no-XXX itself.)

                                                                                                                                      "},{"location":"man1/openssl/#configuration-option","title":"Configuration Option","text":"

                                                                                                                                      Many commands use an external configuration file for some or all of their arguments and have a -config option to specify that file. The default name of the file is openssl.cnf in the default certificate storage area, which can be determined from the openssl-version(1) command using the -d or -a option. The environment variable OPENSSL_CONF can be used to specify a different file location or to disable loading a configuration (using the empty string).

                                                                                                                                      Among others, the configuration file can be used to load modules and to specify parameters for generating certificates and random numbers. See config(5) for details.

                                                                                                                                      "},{"location":"man1/openssl/#standard-commands","title":"Standard Commands","text":"
                                                                                                                                      • asn1parse

                                                                                                                                        Parse an ASN.1 sequence.

                                                                                                                                      • ca

                                                                                                                                        Certificate Authority (CA) Management.

                                                                                                                                      • ciphers

                                                                                                                                        Cipher Suite Description Determination.

                                                                                                                                      • cms

                                                                                                                                        CMS (Cryptographic Message Syntax) command.

                                                                                                                                      • crl

                                                                                                                                        Certificate Revocation List (CRL) Management.

                                                                                                                                      • crl2pkcs7

                                                                                                                                        CRL to PKCS#7 Conversion.

                                                                                                                                      • dgst

                                                                                                                                        Message Digest calculation. MAC calculations are superseded by openssl-mac(1).

                                                                                                                                      • dhparam

                                                                                                                                        Generation and Management of Diffie-Hellman Parameters. Superseded by openssl-genpkey(1) and openssl-pkeyparam(1).

                                                                                                                                      • dsa

                                                                                                                                        DSA Data Management.

                                                                                                                                      • dsaparam

                                                                                                                                        DSA Parameter Generation and Management. Superseded by openssl-genpkey(1) and openssl-pkeyparam(1).

                                                                                                                                      • ec

                                                                                                                                        EC (Elliptic curve) key processing.

                                                                                                                                      • ecparam

                                                                                                                                        EC parameter manipulation and generation.

                                                                                                                                      • enc

                                                                                                                                        Encryption, decryption, and encoding.

                                                                                                                                      • engine

                                                                                                                                        Engine (loadable module) information and manipulation.

                                                                                                                                      • errstr

                                                                                                                                        Error Number to Error String Conversion.

                                                                                                                                      • fipsinstall

                                                                                                                                        FIPS configuration installation.

                                                                                                                                      • gendsa

                                                                                                                                        Generation of DSA Private Key from Parameters. Superseded by openssl-genpkey(1) and openssl-pkey(1).

                                                                                                                                      • genpkey

                                                                                                                                        Generation of Private Key or Parameters.

                                                                                                                                      • genrsa

                                                                                                                                        Generation of RSA Private Key. Superseded by openssl-genpkey(1).

                                                                                                                                      • help

                                                                                                                                        Display information about a command's options.

                                                                                                                                      • info

                                                                                                                                        Display diverse information built into the OpenSSL libraries.

                                                                                                                                      • kdf

                                                                                                                                        Key Derivation Functions.

                                                                                                                                      • list

                                                                                                                                        List algorithms and features.

                                                                                                                                      • mac

                                                                                                                                        Message Authentication Code Calculation.

                                                                                                                                      • nseq

                                                                                                                                        Create or examine a Netscape certificate sequence.

                                                                                                                                      • ocsp

                                                                                                                                        Online Certificate Status Protocol command.

                                                                                                                                      • passwd

                                                                                                                                        Generation of hashed passwords.

                                                                                                                                      • pkcs12

                                                                                                                                        PKCS#12 Data Management.

                                                                                                                                      • pkcs7

                                                                                                                                        PKCS#7 Data Management.

                                                                                                                                      • pkcs8

                                                                                                                                        PKCS#8 format private key conversion command.

                                                                                                                                      • pkey

                                                                                                                                        Public and private key management.

                                                                                                                                      • pkeyparam

                                                                                                                                        Public key algorithm parameter management.

                                                                                                                                      • pkeyutl

                                                                                                                                        Public key algorithm cryptographic operation command.

                                                                                                                                      • prime

                                                                                                                                        Compute prime numbers.

                                                                                                                                      • rand

                                                                                                                                        Generate pseudo-random bytes.

                                                                                                                                      • rehash

                                                                                                                                        Create symbolic links to certificate and CRL files named by the hash values.

                                                                                                                                      • req

                                                                                                                                        PKCS#10 X.509 Certificate Signing Request (CSR) Management.

                                                                                                                                      • rsa

                                                                                                                                        RSA key management.

                                                                                                                                      • rsautl

                                                                                                                                        RSA command for signing, verification, encryption, and decryption. Superseded by openssl-pkeyutl(1).

                                                                                                                                      • s_client

                                                                                                                                        This implements a generic SSL/TLS client which can establish a transparent connection to a remote server speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library.

                                                                                                                                      • s_server

                                                                                                                                        This implements a generic SSL/TLS server which accepts connections from remote clients speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library. It provides both an own command line oriented protocol for testing SSL functions and a simple HTTP response facility to emulate an SSL/TLS-aware webserver.

                                                                                                                                      • s_time

                                                                                                                                        SSL Connection Timer.

                                                                                                                                      • sess_id

                                                                                                                                        SSL Session Data Management.

                                                                                                                                      • smime

                                                                                                                                        S/MIME mail processing.

                                                                                                                                      • speed

                                                                                                                                        Algorithm Speed Measurement.

                                                                                                                                      • spkac

                                                                                                                                        SPKAC printing and generating command.

                                                                                                                                      • srp

                                                                                                                                        Maintain SRP password file. This command is deprecated.

                                                                                                                                      • storeutl

                                                                                                                                        Command to list and display certificates, keys, CRLs, etc.

                                                                                                                                      • ts

                                                                                                                                        Time Stamping Authority command.

                                                                                                                                      • verify

                                                                                                                                        X.509 Certificate Verification. See also the openssl-verification-options(1) manual page.

                                                                                                                                      • version

                                                                                                                                        OpenSSL Version Information.

                                                                                                                                      • x509

                                                                                                                                        X.509 Certificate Data Management.

                                                                                                                                      "},{"location":"man1/openssl/#message-digest-commands","title":"Message Digest Commands","text":"
                                                                                                                                      • blake2b512

                                                                                                                                        BLAKE2b-512 Digest

                                                                                                                                      • blake2s256

                                                                                                                                        BLAKE2s-256 Digest

                                                                                                                                      • md2

                                                                                                                                        MD2 Digest

                                                                                                                                      • md4

                                                                                                                                        MD4 Digest

                                                                                                                                      • md5

                                                                                                                                        MD5 Digest

                                                                                                                                      • mdc2

                                                                                                                                        MDC2 Digest

                                                                                                                                      • rmd160

                                                                                                                                        RMD-160 Digest

                                                                                                                                      • sha1

                                                                                                                                        SHA-1 Digest

                                                                                                                                      • sha224

                                                                                                                                        SHA-2 224 Digest

                                                                                                                                      • sha256

                                                                                                                                        SHA-2 256 Digest

                                                                                                                                      • sha384

                                                                                                                                        SHA-2 384 Digest

                                                                                                                                      • sha512

                                                                                                                                        SHA-2 512 Digest

                                                                                                                                      • sha3-224

                                                                                                                                        SHA-3 224 Digest

                                                                                                                                      • sha3-256

                                                                                                                                        SHA-3 256 Digest

                                                                                                                                      • sha3-384

                                                                                                                                        SHA-3 384 Digest

                                                                                                                                      • sha3-512

                                                                                                                                        SHA-3 512 Digest

                                                                                                                                      • shake128

                                                                                                                                        SHA-3 SHAKE128 Digest

                                                                                                                                      • shake256

                                                                                                                                        SHA-3 SHAKE256 Digest

                                                                                                                                      • sm3

                                                                                                                                        SM3 Digest

                                                                                                                                      "},{"location":"man1/openssl/#encryption-decryption-and-encoding-commands","title":"Encryption, Decryption, and Encoding Commands","text":"

                                                                                                                                      The following aliases provide convenient access to the most used encodings and ciphers.

                                                                                                                                      Depending on how OpenSSL was configured and built, not all ciphers listed here may be present. See openssl-enc(1) for more information.

                                                                                                                                      • aes128, aes-128-cbc, aes-128-cfb, aes-128-ctr, aes-128-ecb, aes-128-ofb

                                                                                                                                        AES-128 Cipher

                                                                                                                                      • aes192, aes-192-cbc, aes-192-cfb, aes-192-ctr, aes-192-ecb, aes-192-ofb

                                                                                                                                        AES-192 Cipher

                                                                                                                                      • aes256, aes-256-cbc, aes-256-cfb, aes-256-ctr, aes-256-ecb, aes-256-ofb

                                                                                                                                        AES-256 Cipher

                                                                                                                                      • aria128, aria-128-cbc, aria-128-cfb, aria-128-ctr, aria-128-ecb, aria-128-ofb

                                                                                                                                        Aria-128 Cipher

                                                                                                                                      • aria192, aria-192-cbc, aria-192-cfb, aria-192-ctr, aria-192-ecb, aria-192-ofb

                                                                                                                                        Aria-192 Cipher

                                                                                                                                      • aria256, aria-256-cbc, aria-256-cfb, aria-256-ctr, aria-256-ecb, aria-256-ofb

                                                                                                                                        Aria-256 Cipher

                                                                                                                                      • base64

                                                                                                                                        Base64 Encoding

                                                                                                                                      • bf, bf-cbc, bf-cfb, bf-ecb, bf-ofb

                                                                                                                                        Blowfish Cipher

                                                                                                                                      • camellia128, camellia-128-cbc, camellia-128-cfb, camellia-128-ctr, camellia-128-ecb, camellia-128-ofb

                                                                                                                                        Camellia-128 Cipher

                                                                                                                                      • camellia192, camellia-192-cbc, camellia-192-cfb, camellia-192-ctr, camellia-192-ecb, camellia-192-ofb

                                                                                                                                        Camellia-192 Cipher

                                                                                                                                      • camellia256, camellia-256-cbc, camellia-256-cfb, camellia-256-ctr, camellia-256-ecb, camellia-256-ofb

                                                                                                                                        Camellia-256 Cipher

                                                                                                                                      • cast, cast-cbc

                                                                                                                                        CAST Cipher

                                                                                                                                      • cast5-cbc, cast5-cfb, cast5-ecb, cast5-ofb

                                                                                                                                        CAST5 Cipher

                                                                                                                                      • chacha20

                                                                                                                                        Chacha20 Cipher

                                                                                                                                      • des, des-cbc, des-cfb, des-ecb, des-ede, des-ede-cbc, des-ede-cfb, des-ede-ofb, des-ofb

                                                                                                                                        DES Cipher

                                                                                                                                      • des3, desx, des-ede3, des-ede3-cbc, des-ede3-cfb, des-ede3-ofb

                                                                                                                                        Triple-DES Cipher

                                                                                                                                      • idea, idea-cbc, idea-cfb, idea-ecb, idea-ofb

                                                                                                                                        IDEA Cipher

                                                                                                                                      • rc2, rc2-cbc, rc2-cfb, rc2-ecb, rc2-ofb

                                                                                                                                        RC2 Cipher

                                                                                                                                      • rc4

                                                                                                                                        RC4 Cipher

                                                                                                                                      • rc5, rc5-cbc, rc5-cfb, rc5-ecb, rc5-ofb

                                                                                                                                        RC5 Cipher

                                                                                                                                      • seed, seed-cbc, seed-cfb, seed-ecb, seed-ofb

                                                                                                                                        SEED Cipher

                                                                                                                                      • sm4, sm4-cbc, sm4-cfb, sm4-ctr, sm4-ecb, sm4-ofb

                                                                                                                                        SM4 Cipher

                                                                                                                                      "},{"location":"man1/openssl/#options","title":"OPTIONS","text":"

                                                                                                                                      Details of which options are available depend on the specific command. This section describes some common options with common behavior.

                                                                                                                                      "},{"location":"man1/openssl/#common-options","title":"Common Options","text":"
                                                                                                                                      • -help

                                                                                                                                        Provides a terse summary of all options. If an option takes an argument, the \"type\" of argument is also given.

                                                                                                                                      • --

                                                                                                                                        This terminates the list of options. It is mostly useful if any filename parameters start with a minus sign:

                                                                                                                                        openssl verify [flags...] -- -cert1.pem...\n
                                                                                                                                      "},{"location":"man1/openssl/#format-options","title":"Format Options","text":"

                                                                                                                                      See openssl-format-options(1) for manual page.

                                                                                                                                      "},{"location":"man1/openssl/#pass-phrase-options","title":"Pass Phrase Options","text":"

                                                                                                                                      See the openssl-passphrase-options(1) manual page.

                                                                                                                                      "},{"location":"man1/openssl/#random-state-options","title":"Random State Options","text":"

                                                                                                                                      Prior to OpenSSL 1.1.1, it was common for applications to store information about the state of the random-number generator in a file that was loaded at startup and rewritten upon exit. On modern operating systems, this is generally no longer necessary as OpenSSL will seed itself from a trusted entropy source provided by the operating system. These flags are still supported for special platforms or circumstances that might require them.

                                                                                                                                      It is generally an error to use the same seed file more than once and every use of -rand should be paired with -writerand.

                                                                                                                                      • -rand files

                                                                                                                                        A file or files containing random data used to seed the random number generator. Multiple files can be specified separated by an OS-dependent character. The separator is ; for MS-Windows, , for OpenVMS, and : for all others. Another way to specify multiple files is to repeat this flag with different filenames.

                                                                                                                                      • -writerand file

                                                                                                                                        Writes the seed data to the specified file upon exit. This file can be used in a subsequent command invocation.

                                                                                                                                      "},{"location":"man1/openssl/#certificate-verification-options","title":"Certificate Verification Options","text":"

                                                                                                                                      See the openssl-verification-options(1) manual page.

                                                                                                                                      "},{"location":"man1/openssl/#name-format-options","title":"Name Format Options","text":"

                                                                                                                                      See the openssl-namedisplay-options(1) manual page.

                                                                                                                                      "},{"location":"man1/openssl/#tls-version-options","title":"TLS Version Options","text":"

                                                                                                                                      Several commands use SSL, TLS, or DTLS. By default, the commands use TLS and clients will offer the lowest and highest protocol version they support, and servers will pick the highest version that the client offers that is also supported by the server.

                                                                                                                                      The options below can be used to limit which protocol versions are used, and whether TCP (SSL and TLS) or UDP (DTLS) is used. Note that not all protocols and flags may be available, depending on how OpenSSL was built.

                                                                                                                                      • -ssl3, -tls1, -tls1_1, -tls1_2, -tls1_3, -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3

                                                                                                                                        These options require or disable the use of the specified SSL or TLS protocols. When a specific TLS version is required, only that version will be offered or accepted. Only one specific protocol can be given and it cannot be combined with any of the no_ options. The no_* options do not work with s_time and ciphers commands but work with s_client and s_server commands.

                                                                                                                                      • -dtls, -dtls1, -dtls1_2

                                                                                                                                        These options specify to use DTLS instead of TLS. With -dtls, clients will negotiate any supported DTLS protocol version. Use the -dtls1 or -dtls1_2 options to support only DTLS1.0 or DTLS1.2, respectively.

                                                                                                                                      "},{"location":"man1/openssl/#engine-options","title":"Engine Options","text":"
                                                                                                                                      • -engine id

                                                                                                                                        Load the engine identified by id and use all the methods it implements (algorithms, key storage, etc.), unless specified otherwise in the command-specific documentation or it is configured to do so, as described in \"Engine Configuration\" in config(5).

                                                                                                                                        The engine will be used for key ids specified with -key and similar options when an option like -keyform engine is given.

                                                                                                                                        A special case is the loader_attic engine, which is meant just for internal OpenSSL testing purposes and supports loading keys, parameters, certificates, and CRLs from files. When this engine is used, files with such credentials are read via this engine. Using the file: schema is optional; a plain file (path) name will do.

                                                                                                                                      Options specifying keys, like -key and similar, can use the generic OpenSSL engine key loading URI scheme org.openssl.engine: to retrieve private keys and public keys. The URI syntax is as follows, in simplified form:

                                                                                                                                      org.openssl.engine:{engineid}:{keyid}\n

                                                                                                                                      Where {engineid} is the identity/name of the engine, and {keyid} is a key identifier that's acceptable by that engine. For example, when using an engine that interfaces against a PKCS#11 implementation, the generic key URI would be something like this (this happens to be an example for the PKCS#11 engine that's part of OpenSC):

                                                                                                                                      -key org.openssl.engine:pkcs11:label_some-private-key\n

                                                                                                                                      As a third possibility, for engines and providers that have implemented their own OSSL_STORE_LOADER(3), org.openssl.engine: should not be necessary. For a PKCS#11 implementation that has implemented such a loader, the PKCS#11 URI as defined in RFC 7512 should be possible to use directly:

                                                                                                                                      -key pkcs11:object=some-private-key;pin-value=1234\n
                                                                                                                                      "},{"location":"man1/openssl/#provider-options","title":"Provider Options","text":"
                                                                                                                                      • -provider name

                                                                                                                                        Load and initialize the provider identified by name. The name can be also a path to the provider module. In that case the provider name will be the specified path and not just the provider module name. Interpretation of relative paths is platform specific. The configured \"MODULESDIR\" path, OPENSSL_MODULES environment variable, or the path specified by -provider-path is prepended to relative paths. See provider(7) for a more detailed description.

                                                                                                                                      • -provider-path path

                                                                                                                                        Specifies the search path that is to be used for looking for providers. Equivalently, the OPENSSL_MODULES environment variable may be set.

                                                                                                                                      • -propquery propq

                                                                                                                                        Specifies the property query clause to be used when fetching algorithms from the loaded providers. See property(7) for a more detailed description.

                                                                                                                                      "},{"location":"man1/openssl/#environment","title":"ENVIRONMENT","text":"

                                                                                                                                      The OpenSSL library can be take some configuration parameters from the environment. Some of these variables are listed below. For information about specific commands, see openssl-engine(1), openssl-rehash(1), and tsget(1).

                                                                                                                                      For information about the use of environment variables in configuration, see \"ENVIRONMENT\" in config(5).

                                                                                                                                      For information about querying or specifying CPU architecture flags, see OPENSSL_ia32cap(3), and OPENSSL_s390xcap(3).

                                                                                                                                      For information about all environment variables used by the OpenSSL libraries, see openssl-env(7).

                                                                                                                                      • OPENSSL_TRACE=name[,...]

                                                                                                                                        Enable tracing output of OpenSSL library, by name. This output will only make sense if you know OpenSSL internals well. Also, it might not give you any output at all if OpenSSL was built without tracing support.

                                                                                                                                        The value is a comma separated list of names, with the following available:

                                                                                                                                        • TRACE

                                                                                                                                          Traces the OpenSSL trace API itself.

                                                                                                                                        • INIT

                                                                                                                                          Traces OpenSSL library initialization and cleanup.

                                                                                                                                        • TLS

                                                                                                                                          Traces the TLS/SSL protocol.

                                                                                                                                        • TLS_CIPHER

                                                                                                                                          Traces the ciphers used by the TLS/SSL protocol.

                                                                                                                                        • CONF

                                                                                                                                          Show details about provider and engine configuration.

                                                                                                                                        • ENGINE_TABLE

                                                                                                                                          The function that is used by RSA, DSA (etc) code to select registered ENGINEs, cache defaults and functional references (etc), will generate debugging summaries.

                                                                                                                                        • ENGINE_REF_COUNT

                                                                                                                                          Reference counts in the ENGINE structure will be monitored with a line of generated for each change.

                                                                                                                                        • PKCS5V2

                                                                                                                                          Traces PKCS#5 v2 key generation.

                                                                                                                                        • PKCS12_KEYGEN

                                                                                                                                          Traces PKCS#12 key generation.

                                                                                                                                        • PKCS12_DECRYPT

                                                                                                                                          Traces PKCS#12 decryption.

                                                                                                                                        • X509V3_POLICY

                                                                                                                                          Generates the complete policy tree at various points during X.509 v3 policy evaluation.

                                                                                                                                        • BN_CTX

                                                                                                                                          Traces BIGNUM context operations.

                                                                                                                                        • CMP

                                                                                                                                          Traces CMP client and server activity.

                                                                                                                                        • STORE

                                                                                                                                          Traces STORE operations.

                                                                                                                                        • DECODER

                                                                                                                                          Traces decoder operations.

                                                                                                                                        • ENCODER

                                                                                                                                          Traces encoder operations.

                                                                                                                                        • REF_COUNT

                                                                                                                                          Traces decrementing certain ASN.1 structure references.

                                                                                                                                        • HTTP

                                                                                                                                          HTTP client diagnostics

                                                                                                                                      "},{"location":"man1/openssl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl-asn1parse(1), openssl-ca(1), openssl-ciphers(1), openssl-cms(1), openssl-crl(1), openssl-crl2pkcs7(1), openssl-dgst(1), openssl-dhparam(1), openssl-dsa(1), openssl-dsaparam(1), openssl-ec(1), openssl-ecparam(1), openssl-enc(1), openssl-engine(1), openssl-errstr(1), openssl-gendsa(1), openssl-genpkey(1), openssl-genrsa(1), openssl-kdf(1), openssl-list(1), openssl-mac(1), openssl-nseq(1), openssl-ocsp(1), openssl-passwd(1), openssl-pkcs12(1), openssl-pkcs7(1), openssl-pkcs8(1), openssl-pkey(1), openssl-pkeyparam(1), openssl-pkeyutl(1), openssl-prime(1), openssl-rand(1), openssl-rehash(1), openssl-req(1), openssl-rsa(1), openssl-rsautl(1), openssl-s_client(1), openssl-s_server(1), openssl-s_time(1), openssl-sess_id(1), openssl-smime(1), openssl-speed(1), openssl-spkac(1), openssl-srp(1), openssl-storeutl(1), openssl-ts(1), openssl-verify(1), openssl-version(1), openssl-x509(1), config(5), crypto(7), openssl-env(7). ssl(7), x509v3_config(5)

                                                                                                                                      "},{"location":"man1/openssl/#history","title":"HISTORY","text":"

                                                                                                                                      The list -XXX-algorithms options were added in OpenSSL 1.0.0; For notes on the availability of other commands, see their individual manual pages.

                                                                                                                                      The -issuer_checks option is deprecated as of OpenSSL 1.1.0 and is silently ignored.

                                                                                                                                      The -xcertform and -xkeyform options are obsolete since OpenSSL 3.0 and have no effect.

                                                                                                                                      The interactive mode, which could be invoked by running openssl with no further arguments, was removed in OpenSSL 3.0, and running that program with no arguments is now equivalent to openssl help.

                                                                                                                                      "},{"location":"man1/openssl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man1/tsget/","title":"tsget","text":""},{"location":"man1/tsget/#name","title":"NAME","text":"

                                                                                                                                      tsget - Time Stamping HTTP/HTTPS client

                                                                                                                                      "},{"location":"man1/tsget/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      tsget -h server_url [-e extension] [-o output] [-v] [-d] [-k private_key.pem] [-p key_password] [-c client_cert.pem] [-C CA_certs.pem] [-P CA_path] [-r files] [-g EGD_socket] [request ...]

                                                                                                                                      "},{"location":"man1/tsget/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This command can be used for sending a timestamp request, as specified in RFC 3161, to a timestamp server over HTTP or HTTPS and storing the timestamp response in a file. It cannot be used for creating the requests and verifying responses, you have to use openssl-ts(1) to do that. This command can send several requests to the server without closing the TCP connection if more than one requests are specified on the command line.

                                                                                                                                      This command sends the following HTTP request for each timestamp request:

                                                                                                                                          POST url HTTP/1.1\n    User-Agent: OpenTSA tsget.pl/<version>\n    Host: <host>:<port>\n    Pragma: no-cache\n    Content-Type: application/timestamp-query\n    Accept: application/timestamp-reply\n    Content-Length: length of body\n\n    ...binary request specified by the user...\n

                                                                                                                                      It expects a response of type application/timestamp-reply, which is written to a file without any interpretation.

                                                                                                                                      "},{"location":"man1/tsget/#options","title":"OPTIONS","text":"
                                                                                                                                      • -h server_url

                                                                                                                                        The URL of the HTTP/HTTPS server listening for timestamp requests.

                                                                                                                                      • -e extension

                                                                                                                                        If the -o option is not given this argument specifies the extension of the output files. The base name of the output file will be the same as those of the input files. Default extension is .tsr. (Optional)

                                                                                                                                      • -o output

                                                                                                                                        This option can be specified only when just one request is sent to the server. The timestamp response will be written to the given output file. '-' means standard output. In case of multiple timestamp requests or the absence of this argument the names of the output files will be derived from the names of the input files and the default or specified extension argument. (Optional)

                                                                                                                                      • -v

                                                                                                                                        The name of the currently processed request is printed on standard error. (Optional)

                                                                                                                                      • -d

                                                                                                                                        Switches on verbose mode for the underlying perl module WWW::Curl::Easy. You can see detailed debug messages for the connection. (Optional)

                                                                                                                                      • -k private_key.pem

                                                                                                                                        (HTTPS) In case of certificate-based client authentication over HTTPS private_key.pem must contain the private key of the user. The private key file can optionally be protected by a passphrase. The -c option must also be specified. (Optional)

                                                                                                                                      • -p key_password

                                                                                                                                        (HTTPS) Specifies the passphrase for the private key specified by the -k argument. If this option is omitted and the key is passphrase protected, it will be prompted for. (Optional)

                                                                                                                                      • -c client_cert.pem

                                                                                                                                        (HTTPS) In case of certificate-based client authentication over HTTPS client_cert.pem must contain the X.509 certificate of the user. The -k option must also be specified. If this option is not specified no certificate-based client authentication will take place. (Optional)

                                                                                                                                      • -C CA_certs.pem

                                                                                                                                        (HTTPS) The trusted CA certificate store. The certificate chain of the peer's certificate must include one of the CA certificates specified in this file. Either option -C or option -P must be given in case of HTTPS. (Optional)

                                                                                                                                      • -P CA_path

                                                                                                                                        (HTTPS) The path containing the trusted CA certificates to verify the peer's certificate. The directory must be prepared with openssl-rehash(1). Either option -C or option -P must be given in case of HTTPS. (Optional)

                                                                                                                                      • -r files

                                                                                                                                        See \"Random State Options\" in openssl(1) for more information.

                                                                                                                                      • -g EGD_socket

                                                                                                                                        The name of an EGD socket to get random data from. (Optional)

                                                                                                                                      • request ...

                                                                                                                                        List of files containing RFC 3161 DER-encoded timestamp requests. If no requests are specified only one request will be sent to the server and it will be read from the standard input. (Optional)

                                                                                                                                      "},{"location":"man1/tsget/#environment-variables","title":"ENVIRONMENT VARIABLES","text":"

                                                                                                                                      The TSGET environment variable can optionally contain default arguments. The content of this variable is added to the list of command line arguments.

                                                                                                                                      "},{"location":"man1/tsget/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The examples below presume that file1.tsq and file2.tsq contain valid timestamp requests, tsa.opentsa.org listens at port 8080 for HTTP requests and at port 8443 for HTTPS requests, the TSA service is available at the /tsa absolute path.

                                                                                                                                      Get a timestamp response for file1.tsq over HTTP, output is written to file1.tsr:

                                                                                                                                      tsget -h http://tsa.opentsa.org:8080/tsa file1.tsq\n

                                                                                                                                      Get a timestamp response for file1.tsq and file2.tsq over HTTP showing progress, output is written to file1.reply and file2.reply respectively:

                                                                                                                                      tsget -h http://tsa.opentsa.org:8080/tsa -v -e .reply \\\n      file1.tsq file2.tsq\n

                                                                                                                                      Create a timestamp request, write it to file3.tsq, send it to the server and write the response to file3.tsr:

                                                                                                                                      openssl ts -query -data file3.txt -cert | tee file3.tsq \\\n      | tsget -h http://tsa.opentsa.org:8080/tsa \\\n      -o file3.tsr\n

                                                                                                                                      Get a timestamp response for file1.tsq over HTTPS without client authentication:

                                                                                                                                      tsget -h https://tsa.opentsa.org:8443/tsa \\\n      -C cacerts.pem file1.tsq\n

                                                                                                                                      Get a timestamp response for file1.tsq over HTTPS with certificate-based client authentication (it will ask for the passphrase if client_key.pem is protected):

                                                                                                                                      tsget -h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \\\n      -k client_key.pem -c client_cert.pem file1.tsq\n

                                                                                                                                      You can shorten the previous command line if you make use of the TSGET environment variable. The following commands do the same as the previous example:

                                                                                                                                      TSGET='-h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \\\n      -k client_key.pem -c client_cert.pem'\nexport TSGET\ntsget file1.tsq\n
                                                                                                                                      "},{"location":"man1/tsget/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      openssl(1), openssl-ts(1), WWW::Curl::Easy, https://www.rfc-editor.org/rfc/rfc3161.html

                                                                                                                                      "},{"location":"man1/tsget/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ADMISSIONS/","title":"ADMISSIONS","text":""},{"location":"man3/ADMISSIONS/#name","title":"NAME","text":"

                                                                                                                                      ADMISSIONS, ADMISSIONS_get0_admissionAuthority, ADMISSIONS_get0_namingAuthority, ADMISSIONS_get0_professionInfos, ADMISSIONS_set0_admissionAuthority, ADMISSIONS_set0_namingAuthority, ADMISSIONS_set0_professionInfos, ADMISSION_SYNTAX, ADMISSION_SYNTAX_get0_admissionAuthority, ADMISSION_SYNTAX_get0_contentsOfAdmissions, ADMISSION_SYNTAX_set0_admissionAuthority, ADMISSION_SYNTAX_set0_contentsOfAdmissions, NAMING_AUTHORITY, NAMING_AUTHORITY_get0_authorityId, NAMING_AUTHORITY_get0_authorityURL, NAMING_AUTHORITY_get0_authorityText, NAMING_AUTHORITY_set0_authorityId, NAMING_AUTHORITY_set0_authorityURL, NAMING_AUTHORITY_set0_authorityText, PROFESSION_INFO, PROFESSION_INFOS, PROFESSION_INFO_get0_addProfessionInfo, PROFESSION_INFO_get0_namingAuthority, PROFESSION_INFO_get0_professionItems, PROFESSION_INFO_get0_professionOIDs, PROFESSION_INFO_get0_registrationNumber, PROFESSION_INFO_set0_addProfessionInfo, PROFESSION_INFO_set0_namingAuthority, PROFESSION_INFO_set0_professionItems, PROFESSION_INFO_set0_professionOIDs, PROFESSION_INFO_set0_registrationNumber - Accessors and settors for ADMISSION_SYNTAX

                                                                                                                                      "},{"location":"man3/ADMISSIONS/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      typedef struct NamingAuthority_st NAMING_AUTHORITY;\ntypedef struct ProfessionInfo_st PROFESSION_INFO;\ntypedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS;\ntypedef struct Admissions_st ADMISSIONS;\ntypedef struct AdmissionSyntax_st ADMISSION_SYNTAX;\n\nconst ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId(\n    const NAMING_AUTHORITY *n);\nvoid NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n,\n    ASN1_OBJECT* namingAuthorityId);\nconst ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL(\n    const NAMING_AUTHORITY *n);\nvoid NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n,\n    ASN1_IA5STRING* namingAuthorityUrl);\nconst ASN1_STRING *NAMING_AUTHORITY_get0_authorityText(\n    const NAMING_AUTHORITY *n);\nvoid NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n,\n    ASN1_STRING* namingAuthorityText);\n\nconst GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority(\n    const ADMISSION_SYNTAX *as);\nvoid ADMISSION_SYNTAX_set0_admissionAuthority(\n    ADMISSION_SYNTAX *as, GENERAL_NAME *aa);\nconst STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions(\n    const ADMISSION_SYNTAX *as);\nvoid ADMISSION_SYNTAX_set0_contentsOfAdmissions(\n    ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a);\n\nconst GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a);\nvoid ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa);\nconst NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a);\nvoid ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na);\nconst PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a);\nvoid ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi);\n\nconst ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_addProfessionInfo(\n    PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos);\nconst NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_namingAuthority(\n    PROFESSION_INFO *pi, NAMING_AUTHORITY *na);\nconst STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_professionItems(\n    PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as);\nconst STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_professionOIDs(\n    PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po);\nconst ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber(\n    const PROFESSION_INFO *pi);\nvoid PROFESSION_INFO_set0_registrationNumber(\n    PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn);\n
                                                                                                                                      "},{"location":"man3/ADMISSIONS/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The PROFESSION_INFOS, ADMISSION_SYNTAX, ADMISSIONS, and PROFESSION_INFO types are opaque structures representing the analogous types defined in the Common PKI Specification published by https://www.t7ev.org. Knowledge of those structures and their semantics is assumed.

                                                                                                                                      The conventional routines to convert between DER and the local format are described in d2i_X509(3). The conventional routines to allocate and free the types are defined in X509_dup(3).

                                                                                                                                      The PROFESSION_INFOS type is a stack of PROFESSION_INFO; see DEFINE_STACK_OF(3) for details.

                                                                                                                                      The NAMING_AUTHORITY type has an authority ID and URL, and text fields. The NAMING_AUTHORITY_get0_authorityId(), NAMING_AUTHORITY_get0_get0_authorityURL(), and NAMING_AUTHORITY_get0_get0_authorityText(), functions return pointers to those values within the object. The NAMING_AUTHORITY_set0_authorityId(), NAMING_AUTHORITY_set0_get0_authorityURL(), and NAMING_AUTHORITY_set0_get0_authorityText(), functions free any existing value and set the pointer to the specified value.

                                                                                                                                      The ADMISSION_SYNTAX type has an authority name and a stack of ADMISSION objects. The ADMISSION_SYNTAX_get0_admissionAuthority() and ADMISSION_SYNTAX_get0_contentsOfAdmissions() functions return pointers to those values within the object. The ADMISSION_SYNTAX_set0_admissionAuthority() and ADMISSION_SYNTAX_set0_contentsOfAdmissions() functions free any existing value and set the pointer to the specified value.

                                                                                                                                      The ADMISSION type has an authority name, authority object, and a stack of PROFESSION_INFO items. The ADMISSIONS_get0_admissionAuthority(), ADMISSIONS_get0_namingAuthority(), and ADMISSIONS_get0_professionInfos() functions return pointers to those values within the object. The ADMISSIONS_set0_admissionAuthority(), ADMISSIONS_set0_namingAuthority(), and ADMISSIONS_set0_professionInfos() functions free any existing value and set the pointer to the specified value.

                                                                                                                                      The PROFESSION_INFO type has a name authority, stacks of profession Items and OIDs, a registration number, and additional profession info. The functions PROFESSION_INFO_get0_addProfessionInfo(), PROFESSION_INFO_get0_namingAuthority(), PROFESSION_INFO_get0_professionItems(), PROFESSION_INFO_get0_professionOIDs(), and PROFESSION_INFO_get0_registrationNumber() functions return pointers to those values within the object. The PROFESSION_INFO_set0_addProfessionInfo(), PROFESSION_INFO_set0_namingAuthority(), PROFESSION_INFO_set0_professionItems(), PROFESSION_INFO_set0_professionOIDs(), and PROFESSION_INFO_set0_registrationNumber() functions free any existing value and set the pointer to the specified value.

                                                                                                                                      "},{"location":"man3/ADMISSIONS/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      Described above. Note that all of the get0 functions return a pointer to the internal data structure and must not be freed.

                                                                                                                                      "},{"location":"man3/ADMISSIONS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      X509_dup(3), d2i_X509(3),

                                                                                                                                      "},{"location":"man3/ADMISSIONS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_EXTERN_FUNCS/","title":"ASN1_EXTERN_FUNCS","text":""},{"location":"man3/ASN1_EXTERN_FUNCS/#name","title":"NAME","text":"

                                                                                                                                      ASN1_EXTERN_FUNCS, ASN1_ex_d2i, ASN1_ex_d2i_ex, ASN1_ex_i2d, ASN1_ex_new_func, ASN1_ex_new_ex_func, ASN1_ex_free_func, ASN1_ex_print_func, IMPLEMENT_EXTERN_ASN1 - ASN.1 external function support

                                                                                                                                      "},{"location":"man3/ASN1_EXTERN_FUNCS/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1t.h>\n\ntypedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,\n                        const ASN1_ITEM *it, int tag, int aclass, char opt,\n                        ASN1_TLC *ctx);\ntypedef int ASN1_ex_d2i_ex(ASN1_VALUE **pval, const unsigned char **in, long len,\n                           const ASN1_ITEM *it, int tag, int aclass, char opt,\n                           ASN1_TLC *ctx, OSSL_LIB_CTX *libctx,\n                           const char *propq);\ntypedef int ASN1_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,\n                        const ASN1_ITEM *it, int tag, int aclass);\ntypedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\ntypedef int ASN1_ex_new_ex_func(ASN1_VALUE **pval, const ASN1_ITEM *it,\n                                OSSL_LIB_CTX *libctx, const char *propq);\ntypedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\ntypedef int ASN1_ex_print_func(BIO *out, const ASN1_VALUE **pval,\n                               int indent, const char *fname,\n                               const ASN1_PCTX *pctx);\n\nstruct ASN1_EXTERN_FUNCS_st {\n   void *app_data;\n   ASN1_ex_new_func *asn1_ex_new;\n   ASN1_ex_free_func *asn1_ex_free;\n   ASN1_ex_free_func *asn1_ex_clear;\n   ASN1_ex_d2i *asn1_ex_d2i;\n   ASN1_ex_i2d *asn1_ex_i2d;\n   ASN1_ex_print_func *asn1_ex_print;\n   ASN1_ex_new_ex_func *asn1_ex_new_ex;\n   ASN1_ex_d2i_ex *asn1_ex_d2i_ex;\n};\ntypedef struct ASN1_EXTERN_FUNCS_st ASN1_EXTERN_FUNCS;\n\n#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs)\n
                                                                                                                                      "},{"location":"man3/ASN1_EXTERN_FUNCS/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN.1 data structures templates are typically defined in OpenSSL using a series of macros such as ASN1_SEQUENCE(), ASN1_SEQUENCE_END() and so on. Instead templates can also be defined based entirely on external functions. These external functions are called to perform operations such as creating a new ASN1_VALUE or converting an ASN1_VALUE to or from DER encoding.

                                                                                                                                      The macro IMPLEMENT_EXTERN_ASN1() can be used to create such an externally defined structure. The name of the structure should be supplied in the sname parameter. The tag for the structure (e.g. typically V_ASN1_SEQUENCE) should be supplied in the tag parameter. Finally a pointer to an ASN1_EXTERN_FUNCS structure should be supplied in the fptrs parameter.

                                                                                                                                      The ASN1_EXTERN_FUNCS structure has the following entries.

                                                                                                                                      • app_data

                                                                                                                                        A pointer to arbitrary application specific data.

                                                                                                                                      • asn1_ex_new

                                                                                                                                        A \"new\" function responsible for constructing a new ASN1_VALUE object. The newly constructed value should be stored in *pval. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro.

                                                                                                                                        Returns a positive value on success or 0 on error.

                                                                                                                                      • asn1_ex_free

                                                                                                                                        A \"free\" function responsible for freeing the ASN1_VALUE passed in *pval that was previously allocated via a \"new\" function. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro.

                                                                                                                                      • asn1_ex_clear

                                                                                                                                        A \"clear\" function responsible for clearing any data in the ASN1_VALUE passed in *pval and making it suitable for reuse. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro.

                                                                                                                                      • asn1_ex_d2i

                                                                                                                                        A \"d2i\" function responsible for converting DER data with the tag tag and class class into an ASN1_VALUE. If *pval is non-NULL then the ASN_VALUE it points to should be reused. Otherwise a new ASN1_VALUE should be allocated and stored in *pval. *in points to the DER data to be decoded and len is the length of that data. After decoding *in should be updated to point at the next byte after the decoded data. If the ASN1_VALUE is considered optional in this context then opt will be nonzero. Otherwise it will be zero. The it parameter is a pointer to the ASN1_ITEM template object created via the IMPLEMENT_EXTERN_ASN1() macro. A pointer to the current ASN1_TLC context (which may be required for other ASN1 function calls) is passed in the ctx parameter.

                                                                                                                                        The asn1_ex_d2i entry may be NULL if asn1_ex_d2i_ex has been specified instead.

                                                                                                                                        Returns <= 0 on error or a positive value on success.

                                                                                                                                      • asn1_ex_i2d

                                                                                                                                        An \"i2d\" function responsible for converting an ASN1_VALUE into DER encoding. On entry *pval will contain the ASN1_VALUE to be encoded. If default tagging is to be used then tag will be -1 on entry. Otherwise if implicit tagging should be used then tag and aclass will be the tag and associated class.

                                                                                                                                        If out is not NULL then this function should write the DER encoded data to the buffer in *out, and then increment *out to point to immediately after the data just written.

                                                                                                                                        If out is NULL then no data should be written but the length calculated and returned as if it were.

                                                                                                                                        The asn1_ex_i2d entry may be NULL if asn1_ex_i2d_ex has been specified instead.

                                                                                                                                        The return value should be negative if a fatal error occurred, or 0 if a non-fatal error occurred. Otherwise it should return the length of the encoded data.

                                                                                                                                      • asn1_ex_print

                                                                                                                                        A \"print\" function. out is the BIO to print the output to. *pval is the ASN1_VALUE to be printed. indent is the number of spaces of indenting to be printed before any data is printed. fname is currently unused and is always \"\". pctx is a pointer to the ASN1_PCTX for the print operation.

                                                                                                                                        Returns 0 on error or a positive value on success. If the return value is 2 then an additional newline will be printed after the data printed by this function.

                                                                                                                                      • asn1_ex_new_ex

                                                                                                                                        This is the same as asn1_ex_new except that it is additionally passed the OSSL_LIB_CTX to be used in libctx and any property query string to be used for algorithm fetching in the propq parameter. See \"ALGORITHM FETCHING\" in crypto(7) for further details. If asn1_ex_new_ex is non NULL, then it will always be called in preference to asn1_ex_new.

                                                                                                                                      • asn1_ex_d2i_ex

                                                                                                                                        This is the same as asn1_ex_d2i except that it is additionally passed the OSSL_LIB_CTX to be used in libctx and any property query string to be used for algorithm fetching in the propq parameter. See \"ALGORITHM FETCHING\" in crypto(7) for further details. If asn1_ex_d2i_ex is non NULL, then it will always be called in preference to asn1_ex_d2i.

                                                                                                                                      "},{"location":"man3/ASN1_EXTERN_FUNCS/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      Return values for the various callbacks are as described above.

                                                                                                                                      "},{"location":"man3/ASN1_EXTERN_FUNCS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ASN1_item_new_ex(3)

                                                                                                                                      "},{"location":"man3/ASN1_EXTERN_FUNCS/#history","title":"HISTORY","text":"

                                                                                                                                      The asn1_ex_new_ex and asn1_ex_d2i_ex callbacks were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ASN1_EXTERN_FUNCS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/","title":"ASN1_INTEGER_get_int64","text":""},{"location":"man3/ASN1_INTEGER_get_int64/#name","title":"NAME","text":"

                                                                                                                                      ASN1_INTEGER_get_uint64, ASN1_INTEGER_set_uint64, ASN1_INTEGER_get_int64, ASN1_INTEGER_get, ASN1_INTEGER_set_int64, ASN1_INTEGER_set, BN_to_ASN1_INTEGER, ASN1_INTEGER_to_BN, ASN1_ENUMERATED_get_int64, ASN1_ENUMERATED_get, ASN1_ENUMERATED_set_int64, ASN1_ENUMERATED_set, BN_to_ASN1_ENUMERATED, ASN1_ENUMERATED_to_BN - ASN.1 INTEGER and ENUMERATED utilities

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nint ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a);\nlong ASN1_INTEGER_get(const ASN1_INTEGER *a);\n\nint ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r);\nint ASN1_INTEGER_set(ASN1_INTEGER *a, long v);\n\nint ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a);\nint ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r);\n\nASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);\nBIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);\n\nint ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a);\nlong ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);\n\nint ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r);\nint ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);\n\nASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);\nBIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);\n
                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions convert to and from ASN1_INTEGER and ASN1_ENUMERATED structures.

                                                                                                                                      ASN1_INTEGER_get_int64() converts an ASN1_INTEGER into an int64_t type If successful it returns 1 and sets *pr to the value of a. If it fails (due to invalid type or the value being too big to fit into an int64_t type) it returns 0.

                                                                                                                                      ASN1_INTEGER_get_uint64() is similar to ASN1_INTEGER_get_int64_t() except it converts to a uint64_t type and an error is returned if the passed integer is negative.

                                                                                                                                      ASN1_INTEGER_get() also returns the value of a but it returns 0 if a is NULL and -1 on error (which is ambiguous because -1 is a legitimate value for an ASN1_INTEGER). New applications should use ASN1_INTEGER_get_int64() instead.

                                                                                                                                      ASN1_INTEGER_set_int64() sets the value of ASN1_INTEGER a to the int64_t value r.

                                                                                                                                      ASN1_INTEGER_set_uint64() sets the value of ASN1_INTEGER a to the uint64_t value r.

                                                                                                                                      ASN1_INTEGER_set() sets the value of ASN1_INTEGER a to the long value v.

                                                                                                                                      BN_to_ASN1_INTEGER() converts BIGNUM bn to an ASN1_INTEGER. If ai is NULL a new ASN1_INTEGER structure is returned. If ai is not NULL then the existing structure will be used instead.

                                                                                                                                      ASN1_INTEGER_to_BN() converts ASN1_INTEGER ai into a BIGNUM. If bn is NULL a new BIGNUM structure is returned. If bn is not NULL then the existing structure will be used instead.

                                                                                                                                      ASN1_ENUMERATED_get_int64(), ASN1_ENUMERATED_set_int64(), ASN1_ENUMERATED_set(), BN_to_ASN1_ENUMERATED() and ASN1_ENUMERATED_to_BN() behave in an identical way to their ASN1_INTEGER counterparts except they operate on an ASN1_ENUMERATED value.

                                                                                                                                      ASN1_ENUMERATED_get() returns the value of a in a similar way to ASN1_INTEGER_get() but it returns 0xffffffffL if the value of a will not fit in a long type. New applications should use ASN1_ENUMERATED_get_int64() instead.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#notes","title":"NOTES","text":"

                                                                                                                                      In general an ASN1_INTEGER or ASN1_ENUMERATED type can contain an integer of almost arbitrary size and so cannot always be represented by a C int64_t type. However, in many cases (for example version numbers) they represent small integers which can be more easily manipulated if converted to an appropriate C integer type.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#bugs","title":"BUGS","text":"

                                                                                                                                      The ambiguous return values of ASN1_INTEGER_get() and ASN1_ENUMERATED_get() mean these functions should be avoided if possible. They are retained for compatibility. Normally the ambiguous return values are not legitimate values for the fields they represent.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_INTEGER_set_int64(), ASN1_INTEGER_set(), ASN1_ENUMERATED_set_int64() and ASN1_ENUMERATED_set() return 1 for success and 0 for failure. They will only fail if a memory allocation error occurs.

                                                                                                                                      ASN1_INTEGER_get_int64() and ASN1_ENUMERATED_get_int64() return 1 for success and 0 for failure. They will fail if the passed type is incorrect (this will only happen if there is a programming error) or if the value exceeds the range of an int64_t type.

                                                                                                                                      BN_to_ASN1_INTEGER() and BN_to_ASN1_ENUMERATED() return an ASN1_INTEGER or ASN1_ENUMERATED structure respectively or NULL if an error occurs. They will only fail due to a memory allocation error.

                                                                                                                                      ASN1_INTEGER_to_BN() and ASN1_ENUMERATED_to_BN() return a BIGNUM structure of NULL if an error occurs. They can fail if the passed type is incorrect (due to programming error) or due to a memory allocation failure.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#history","title":"HISTORY","text":"

                                                                                                                                      ASN1_INTEGER_set_int64(), ASN1_INTEGER_get_int64(), ASN1_ENUMERATED_set_int64() and ASN1_ENUMERATED_get_int64() were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_get_int64/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_new/","title":"ASN1_INTEGER_new","text":""},{"location":"man3/ASN1_INTEGER_new/#name","title":"NAME","text":"

                                                                                                                                      ASN1_INTEGER_new, ASN1_INTEGER_free - ASN1_INTEGER allocation functions

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nASN1_INTEGER *ASN1_INTEGER_new(void);\nvoid ASN1_INTEGER_free(ASN1_INTEGER *a);\n
                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN1_INTEGER_new() returns an allocated ASN1_INTEGER structure.

                                                                                                                                      ASN1_INTEGER_free() frees up a single ASN1_INTEGER object. If the argument is NULL, nothing is done.

                                                                                                                                      ASN1_INTEGER structure representing the ASN.1 INTEGER type

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_INTEGER_new() return a valid ASN1_INTEGER structure or NULL if an error occurred.

                                                                                                                                      ASN1_INTEGER_free() does not return a value.

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ASN1_INTEGER_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_ITEM_lookup/","title":"ASN1_ITEM_lookup","text":""},{"location":"man3/ASN1_ITEM_lookup/#name","title":"NAME","text":"

                                                                                                                                      ASN1_ITEM_lookup, ASN1_ITEM_get - lookup ASN.1 structures

                                                                                                                                      "},{"location":"man3/ASN1_ITEM_lookup/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nconst ASN1_ITEM *ASN1_ITEM_lookup(const char *name);\nconst ASN1_ITEM *ASN1_ITEM_get(size_t i);\n
                                                                                                                                      "},{"location":"man3/ASN1_ITEM_lookup/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN1_ITEM_lookup() returns the ASN1_ITEM named name.

                                                                                                                                      ASN1_ITEM_get() returns the ASN1_ITEM with index i. This function returns NULL if the index i is out of range.

                                                                                                                                      "},{"location":"man3/ASN1_ITEM_lookup/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_ITEM_lookup() and ASN1_ITEM_get() return a valid ASN1_ITEM structure or NULL if an error occurred.

                                                                                                                                      "},{"location":"man3/ASN1_ITEM_lookup/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ASN1_ITEM_lookup/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_OBJECT_new/","title":"ASN1_OBJECT_new","text":""},{"location":"man3/ASN1_OBJECT_new/#name","title":"NAME","text":"

                                                                                                                                      ASN1_OBJECT_new, ASN1_OBJECT_free - object allocation functions

                                                                                                                                      "},{"location":"man3/ASN1_OBJECT_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nASN1_OBJECT *ASN1_OBJECT_new(void);\nvoid ASN1_OBJECT_free(ASN1_OBJECT *a);\n
                                                                                                                                      "},{"location":"man3/ASN1_OBJECT_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The ASN1_OBJECT allocation routines, allocate and free an ASN1_OBJECT structure, which represents an ASN1 OBJECT IDENTIFIER.

                                                                                                                                      ASN1_OBJECT_new() allocates and initializes an ASN1_OBJECT structure.

                                                                                                                                      ASN1_OBJECT_free() frees up the ASN1_OBJECT structure a. If a is NULL, nothing is done.

                                                                                                                                      "},{"location":"man3/ASN1_OBJECT_new/#notes","title":"NOTES","text":"

                                                                                                                                      Although ASN1_OBJECT_new() allocates a new ASN1_OBJECT structure it is almost never used in applications. The ASN1 object utility functions such as OBJ_nid2obj() are used instead.

                                                                                                                                      "},{"location":"man3/ASN1_OBJECT_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, ASN1_OBJECT_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                      ASN1_OBJECT_free() returns no value.

                                                                                                                                      "},{"location":"man3/ASN1_OBJECT_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), d2i_ASN1_OBJECT(3)

                                                                                                                                      "},{"location":"man3/ASN1_OBJECT_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_TABLE_add/","title":"ASN1_STRING_TABLE_add","text":""},{"location":"man3/ASN1_STRING_TABLE_add/#name","title":"NAME","text":"

                                                                                                                                      ASN1_STRING_TABLE, ASN1_STRING_TABLE_add, ASN1_STRING_TABLE_get, ASN1_STRING_TABLE_cleanup - ASN1_STRING_TABLE manipulation functions

                                                                                                                                      "},{"location":"man3/ASN1_STRING_TABLE_add/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\ntypedef struct asn1_string_table_st ASN1_STRING_TABLE;\n\nint ASN1_STRING_TABLE_add(int nid, long minsize, long maxsize,\n                          unsigned long mask, unsigned long flags);\nASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);\nvoid ASN1_STRING_TABLE_cleanup(void);\n
                                                                                                                                      "},{"location":"man3/ASN1_STRING_TABLE_add/#description","title":"DESCRIPTION","text":""},{"location":"man3/ASN1_STRING_TABLE_add/#types","title":"Types","text":"

                                                                                                                                      ASN1_STRING_TABLE is a table which holds string information (basically minimum size, maximum size, type and etc) for a NID object.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_TABLE_add/#functions","title":"Functions","text":"

                                                                                                                                      ASN1_STRING_TABLE_add() adds a new ASN1_STRING_TABLE item into the local ASN1 string table based on the nid along with other parameters.

                                                                                                                                      If the item is already in the table, fields of ASN1_STRING_TABLE are updated (depending on the values of those parameters, e.g., minsize and maxsize >= 0, mask and flags != 0). If the nid is standard, a copy of the standard ASN1_STRING_TABLE is created and updated with other parameters.

                                                                                                                                      ASN1_STRING_TABLE_get() searches for an ASN1_STRING_TABLE item based on nid. It will search the local table first, then the standard one.

                                                                                                                                      ASN1_STRING_TABLE_cleanup() frees all ASN1_STRING_TABLE items added by ASN1_STRING_TABLE_add().

                                                                                                                                      "},{"location":"man3/ASN1_STRING_TABLE_add/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_STRING_TABLE_add() returns 1 on success, 0 if an error occurred.

                                                                                                                                      ASN1_STRING_TABLE_get() returns a valid ASN1_STRING_TABLE structure or NULL if nothing is found.

                                                                                                                                      ASN1_STRING_TABLE_cleanup() does not return a value.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_TABLE_add/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ASN1_STRING_TABLE_add/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_length/","title":"ASN1_STRING_length","text":""},{"location":"man3/ASN1_STRING_length/#name","title":"NAME","text":"

                                                                                                                                      ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length, ASN1_STRING_type, ASN1_STRING_get0_data, ASN1_STRING_data, ASN1_STRING_to_UTF8 - ASN1_STRING utility functions

                                                                                                                                      "},{"location":"man3/ASN1_STRING_length/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nint ASN1_STRING_length(ASN1_STRING *x);\nconst unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);\nunsigned char *ASN1_STRING_data(ASN1_STRING *x);\n\nASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);\n\nint ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);\n\nint ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);\n\nint ASN1_STRING_type(const ASN1_STRING *x);\n\nint ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in);\n
                                                                                                                                      "},{"location":"man3/ASN1_STRING_length/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions allow an ASN1_STRING structure to be manipulated.

                                                                                                                                      ASN1_STRING_length() returns the length of the content of x.

                                                                                                                                      ASN1_STRING_get0_data() returns an internal pointer to the data of x. Since this is an internal pointer it should not be freed or modified in any way.

                                                                                                                                      ASN1_STRING_data() is similar to ASN1_STRING_get0_data() except the returned value is not constant. This function is deprecated: applications should use ASN1_STRING_get0_data() instead.

                                                                                                                                      ASN1_STRING_dup() returns a copy of the structure a.

                                                                                                                                      ASN1_STRING_cmp() compares a and b returning 0 if the two are identical. The string types and content are compared.

                                                                                                                                      ASN1_STRING_set() sets the data of string str to the buffer data or length len. The supplied data is copied. If len is -1 then the length is determined by strlen(data).

                                                                                                                                      ASN1_STRING_type() returns the type of x, using standard constants such as V_ASN1_OCTET_STRING.

                                                                                                                                      ASN1_STRING_to_UTF8() converts the string in to UTF8 format, the converted data is allocated in a buffer in *out. The length of out is returned or a negative error code. The buffer *out should be freed using OPENSSL_free().

                                                                                                                                      "},{"location":"man3/ASN1_STRING_length/#notes","title":"NOTES","text":"

                                                                                                                                      Almost all ASN1 types in OpenSSL are represented as an ASN1_STRING structure. Other types such as ASN1_OCTET_STRING are simply typedef'ed to ASN1_STRING and the functions call the ASN1_STRING equivalents. ASN1_STRING is also used for some CHOICE types which consist entirely of primitive string types such as DirectoryString and Time.

                                                                                                                                      These functions should not be used to examine or modify ASN1_INTEGER or ASN1_ENUMERATED types: the relevant INTEGER or ENUMERATED utility functions should be used instead.

                                                                                                                                      In general it cannot be assumed that the data returned by ASN1_STRING_data() is null terminated or does not contain embedded nulls. The actual format of the data will depend on the actual string type itself: for example for an IA5String the data will be ASCII, for a BMPString two bytes per character in big endian format, and for a UTF8String it will be in UTF8 format.

                                                                                                                                      Similar care should be take to ensure the data is in the correct format when calling ASN1_STRING_set().

                                                                                                                                      "},{"location":"man3/ASN1_STRING_length/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_STRING_length() returns the length of the content of x.

                                                                                                                                      ASN1_STRING_get0_data() and ASN1_STRING_data() return an internal pointer to the data of x.

                                                                                                                                      ASN1_STRING_dup() returns a valid ASN1_STRING structure or NULL if an error occurred.

                                                                                                                                      ASN1_STRING_cmp() returns an integer greater than, equal to, or less than 0, according to whether a is greater than, equal to, or less than b.

                                                                                                                                      ASN1_STRING_set() returns 1 on success or 0 on error.

                                                                                                                                      ASN1_STRING_type() returns the type of x.

                                                                                                                                      ASN1_STRING_to_UTF8() returns the number of bytes in output string out or a negative value if an error occurred.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_length/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ASN1_STRING_length/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_new/","title":"ASN1_STRING_new","text":""},{"location":"man3/ASN1_STRING_new/#name","title":"NAME","text":"

                                                                                                                                      ASN1_STRING_new, ASN1_STRING_type_new, ASN1_STRING_free - ASN1_STRING allocation functions

                                                                                                                                      "},{"location":"man3/ASN1_STRING_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nASN1_STRING *ASN1_STRING_new(void);\nASN1_STRING *ASN1_STRING_type_new(int type);\nvoid ASN1_STRING_free(ASN1_STRING *a);\n
                                                                                                                                      "},{"location":"man3/ASN1_STRING_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN1_STRING_new() returns an allocated ASN1_STRING structure. Its type is undefined.

                                                                                                                                      ASN1_STRING_type_new() returns an allocated ASN1_STRING structure of type type.

                                                                                                                                      ASN1_STRING_free() frees up a. If a is NULL nothing is done.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_new/#notes","title":"NOTES","text":"

                                                                                                                                      Other string types call the ASN1_STRING functions. For example ASN1_OCTET_STRING_new() calls ASN1_STRING_type_new(V_ASN1_OCTET_STRING).

                                                                                                                                      "},{"location":"man3/ASN1_STRING_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_STRING_new() and ASN1_STRING_type_new() return a valid ASN1_STRING structure or NULL if an error occurred.

                                                                                                                                      ASN1_STRING_free() does not return a value.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ASN1_STRING_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_print_ex/","title":"ASN1_STRING_print_ex","text":""},{"location":"man3/ASN1_STRING_print_ex/#name","title":"NAME","text":"

                                                                                                                                      ASN1_tag2str, ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp, ASN1_STRING_print - ASN1_STRING output routines

                                                                                                                                      "},{"location":"man3/ASN1_STRING_print_ex/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nint ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);\nint ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags);\nint ASN1_STRING_print(BIO *out, const ASN1_STRING *str);\n\nconst char *ASN1_tag2str(int tag);\n
                                                                                                                                      "},{"location":"man3/ASN1_STRING_print_ex/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions output an ASN1_STRING structure. ASN1_STRING is used to represent all the ASN1 string types.

                                                                                                                                      ASN1_STRING_print_ex() outputs str to out, the format is determined by the options flags. ASN1_STRING_print_ex_fp() is identical except it outputs to fp instead.

                                                                                                                                      ASN1_STRING_print() prints str to out but using a different format to ASN1_STRING_print_ex(). It replaces unprintable characters (other than CR, LF) with '.'.

                                                                                                                                      ASN1_tag2str() returns a human-readable name of the specified ASN.1 tag.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_print_ex/#notes","title":"NOTES","text":"

                                                                                                                                      ASN1_STRING_print() is a deprecated function which should be avoided; use ASN1_STRING_print_ex() instead.

                                                                                                                                      Although there are a large number of options frequently ASN1_STRFLGS_RFC2253 is suitable, or on UTF8 terminals ASN1_STRFLGS_RFC2253 & ~ASN1_STRFLGS_ESC_MSB.

                                                                                                                                      The complete set of supported options for flags is listed below.

                                                                                                                                      Various characters can be escaped. If ASN1_STRFLGS_ESC_2253 is set the characters determined by RFC2253 are escaped. If ASN1_STRFLGS_ESC_CTRL is set control characters are escaped. If ASN1_STRFLGS_ESC_MSB is set characters with the MSB set are escaped: this option should not be used if the terminal correctly interprets UTF8 sequences.

                                                                                                                                      Escaping takes several forms.

                                                                                                                                      If the character being escaped is a 16 bit character then the form \"\\UXXXX\" is used using exactly four characters for the hex representation. If it is 32 bits then \"\\WXXXXXXXX\" is used using eight characters of its hex representation. These forms will only be used if UTF8 conversion is not set (see below).

                                                                                                                                      Printable characters are normally escaped using the backslash '\\' character. If ASN1_STRFLGS_ESC_QUOTE is set then the whole string is instead surrounded by double quote characters: this is arguably more readable than the backslash notation. Other characters use the \"\\XX\" using exactly two characters of the hex representation.

                                                                                                                                      If ASN1_STRFLGS_UTF8_CONVERT is set then characters are converted to UTF8 format first. If the terminal supports the display of UTF8 sequences then this option will correctly display multi byte characters.

                                                                                                                                      If ASN1_STRFLGS_IGNORE_TYPE is set then the string type is not interpreted at all: everything is assumed to be one byte per character. This is primarily for debugging purposes and can result in confusing output in multi character strings.

                                                                                                                                      If ASN1_STRFLGS_SHOW_TYPE is set then the string type itself is printed out before its value (for example \"BMPSTRING\"), this actually uses ASN1_tag2str().

                                                                                                                                      The content of a string instead of being interpreted can be \"dumped\": this just outputs the value of the string using the form #XXXX using hex format for each octet.

                                                                                                                                      If ASN1_STRFLGS_DUMP_ALL is set then any type is dumped.

                                                                                                                                      Normally non character string types (such as OCTET STRING) are assumed to be one byte per character, if ASN1_STRFLGS_DUMP_UNKNOWN is set then they will be dumped instead.

                                                                                                                                      When a type is dumped normally just the content octets are printed, if ASN1_STRFLGS_DUMP_DER is set then the complete encoding is dumped instead (including tag and length octets).

                                                                                                                                      ASN1_STRFLGS_RFC2253 includes all the flags required by RFC2253. It is equivalent to: ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER

                                                                                                                                      "},{"location":"man3/ASN1_STRING_print_ex/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_STRING_print_ex() and ASN1_STRING_print_ex_fp() return the number of characters written or -1 if an error occurred.

                                                                                                                                      ASN1_STRING_print() returns 1 on success or 0 on error.

                                                                                                                                      ASN1_tag2str() returns a human-readable name of the specified ASN.1 tag.

                                                                                                                                      "},{"location":"man3/ASN1_STRING_print_ex/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      X509_NAME_print_ex(3), ASN1_tag2str(3)

                                                                                                                                      "},{"location":"man3/ASN1_STRING_print_ex/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/","title":"ASN1_TIME_set","text":""},{"location":"man3/ASN1_TIME_set/#name","title":"NAME","text":"

                                                                                                                                      ASN1_TIME_set, ASN1_UTCTIME_set, ASN1_GENERALIZEDTIME_set, ASN1_TIME_adj, ASN1_UTCTIME_adj, ASN1_GENERALIZEDTIME_adj, ASN1_TIME_check, ASN1_UTCTIME_check, ASN1_GENERALIZEDTIME_check, ASN1_TIME_set_string, ASN1_UTCTIME_set_string, ASN1_GENERALIZEDTIME_set_string, ASN1_TIME_set_string_X509, ASN1_TIME_normalize, ASN1_TIME_to_tm, ASN1_TIME_print, ASN1_TIME_print_ex, ASN1_UTCTIME_print, ASN1_GENERALIZEDTIME_print, ASN1_TIME_diff, ASN1_TIME_cmp_time_t, ASN1_UTCTIME_cmp_time_t, ASN1_TIME_compare, ASN1_TIME_to_generalizedtime, ASN1_TIME_dup, ASN1_UTCTIME_dup, ASN1_GENERALIZEDTIME_dup - ASN.1 Time functions

                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);\nASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,\n                                               time_t t);\n\nASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,\n                         long offset_sec);\nASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,\n                               int offset_day, long offset_sec);\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,\n                                               time_t t, int offset_day,\n                                               long offset_sec);\n\nint ASN1_TIME_set_string(ASN1_TIME *s, const char *str);\nint ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str);\nint ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);\nint ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s,\n                                    const char *str);\n\nint ASN1_TIME_normalize(ASN1_TIME *s);\n\nint ASN1_TIME_check(const ASN1_TIME *t);\nint ASN1_UTCTIME_check(const ASN1_UTCTIME *t);\nint ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *t);\n\nint ASN1_TIME_print(BIO *b, const ASN1_TIME *s);\nint ASN1_TIME_print_ex(BIO *bp, const ASN1_TIME *tm, unsigned long flags);\nint ASN1_UTCTIME_print(BIO *b, const ASN1_UTCTIME *s);\nint ASN1_GENERALIZEDTIME_print(BIO *b, const ASN1_GENERALIZEDTIME *s);\n\nint ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm);\nint ASN1_TIME_diff(int *pday, int *psec, const ASN1_TIME *from,\n                   const ASN1_TIME *to);\n\nint ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t);\nint ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);\n\nint ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b);\n\nASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,\n                                                   ASN1_GENERALIZEDTIME **out);\n\nASN1_TIME *ASN1_TIME_dup(const ASN1_TIME *t);\nASN1_UTCTIME *ASN1_UTCTIME_dup(const ASN1_UTCTIME *t);\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_dup(const ASN1_GENERALIZEDTIME *t);\n
                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The ASN1_TIME_set(), ASN1_UTCTIME_set() and ASN1_GENERALIZEDTIME_set() functions set the structure s to the time represented by the time_t value t. If s is NULL a new time structure is allocated and returned.

                                                                                                                                      The ASN1_TIME_adj(), ASN1_UTCTIME_adj() and ASN1_GENERALIZEDTIME_adj() functions set the time structure s to the time represented by the time offset_day and offset_sec after the time_t value t. The values of offset_day or offset_sec can be negative to set a time before t. The offset_sec value can also exceed the number of seconds in a day. If s is NULL a new structure is allocated and returned.

                                                                                                                                      The ASN1_TIME_set_string(), ASN1_UTCTIME_set_string() and ASN1_GENERALIZEDTIME_set_string() functions set the time structure s to the time represented by string str which must be in appropriate ASN.1 time format (for example YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ). If s is NULL this function performs a format check on str only. The string str is copied into s.

                                                                                                                                      ASN1_TIME_set_string_X509() sets ASN1_TIME structure s to the time represented by string str which must be in appropriate time format that RFC 5280 requires, which means it only allows YYMMDDHHMMSSZ and YYYYMMDDHHMMSSZ (leap second is rejected), all other ASN.1 time format are not allowed. If s is NULL this function performs a format check on str only.

                                                                                                                                      The ASN1_TIME_normalize() function converts an ASN1_GENERALIZEDTIME or ASN1_UTCTIME into a time value that can be used in a certificate. It should be used after the ASN1_TIME_set_string() functions and before ASN1_TIME_print() functions to get consistent (i.e. GMT) results.

                                                                                                                                      The ASN1_TIME_check(), ASN1_UTCTIME_check() and ASN1_GENERALIZEDTIME_check() functions check the syntax of the time structure s.

                                                                                                                                      The ASN1_TIME_print(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() functions print the time structure s to BIO b in human readable format. It will be of the format MMM DD HH:MM:SS YYYY [GMT], for example \"Feb 3 00:55:52 2015 GMT\", which does not include a newline. If the time structure has invalid format it prints out \"Bad time value\" and returns an error. The output for generalized time may include a fractional part following the second.

                                                                                                                                      ASN1_TIME_print_ex() provides flags to specify the output format of the datetime. This can be either ASN1_DTFLGS_RFC822 or ASN1_DTFLGS_ISO8601.

                                                                                                                                      ASN1_TIME_to_tm() converts the time s to the standard tm structure. If s is NULL, then the current time is converted. The output time is GMT. The tm_sec, tm_min, tm_hour, tm_mday, tm_wday, tm_yday, tm_mon and tm_year fields of tm structure are set to proper values, whereas all other fields are set to 0. If tm is NULL this function performs a format check on s only. If s is in Generalized format with fractional seconds, e.g. YYYYMMDDHHMMSS.SSSZ, the fractional seconds will be lost while converting s to tm structure.

                                                                                                                                      ASN1_TIME_diff() sets *pday and *psec to the time difference between from and to. If to represents a time later than from then one or both (depending on the time difference) of *pday and *psec will be positive. If to represents a time earlier than from then one or both of *pday and *psec will be negative. If to and from represent the same time then *pday and *psec will both be zero. If both *pday and *psec are nonzero they will always have the same sign. The value of *psec will always be less than the number of seconds in a day. If from or to is NULL the current time is used.

                                                                                                                                      The ASN1_TIME_cmp_time_t() and ASN1_UTCTIME_cmp_time_t() functions compare the two times represented by the time structure s and the time_t t.

                                                                                                                                      The ASN1_TIME_compare() function compares the two times represented by the time structures a and b.

                                                                                                                                      The ASN1_TIME_to_generalizedtime() function converts an ASN1_TIME to an ASN1_GENERALIZEDTIME, regardless of year. If either out or *out are NULL, then a new object is allocated and must be freed after use.

                                                                                                                                      The ASN1_TIME_dup(), ASN1_UTCTIME_dup() and ASN1_GENERALIZEDTIME_dup() functions duplicate the time structure t and return the duplicated result correspondingly.

                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#notes","title":"NOTES","text":"

                                                                                                                                      The ASN1_TIME structure corresponds to the ASN.1 structure Time defined in RFC5280 et al. The time setting functions obey the rules outlined in RFC5280: if the date can be represented by UTCTime it is used, else GeneralizedTime is used.

                                                                                                                                      The ASN1_TIME, ASN1_UTCTIME and ASN1_GENERALIZEDTIME structures are represented as an ASN1_STRING internally and can be freed up using ASN1_STRING_free().

                                                                                                                                      The ASN1_TIME structure can represent years from 0000 to 9999 but no attempt is made to correct ancient calendar changes (for example from Julian to Gregorian calendars).

                                                                                                                                      ASN1_UTCTIME is limited to a year range of 1950 through 2049.

                                                                                                                                      Some applications add offset times directly to a time_t value and pass the results to ASN1_TIME_set() (or equivalent). This can cause problems as the time_t value can overflow on some systems resulting in unexpected results. New applications should use ASN1_TIME_adj() instead and pass the offset value in the offset_sec and offset_day parameters instead of directly manipulating a time_t value.

                                                                                                                                      ASN1_TIME_adj() may change the type from ASN1_GENERALIZEDTIME to ASN1_UTCTIME, or vice versa, based on the resulting year. ASN1_GENERALIZEDTIME_adj() and ASN1_UTCTIME_adj() will not modify the type of the return structure.

                                                                                                                                      It is recommended that functions starting with ASN1_TIME be used instead of those starting with ASN1_UTCTIME or ASN1_GENERALIZEDTIME. The functions starting with ASN1_UTCTIME and ASN1_GENERALIZEDTIME act only on that specific time format. The functions starting with ASN1_TIME will operate on either format.

                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#bugs","title":"BUGS","text":"

                                                                                                                                      ASN1_TIME_print(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() do not print out the timezone: it either prints out \"GMT\" or nothing. But all certificates complying with RFC5280 et al use GMT anyway.

                                                                                                                                      ASN1_TIME_print(), ASN1_TIME_print_ex(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() do not distinguish if they fail because of an I/O error or invalid time format.

                                                                                                                                      Use the ASN1_TIME_normalize() function to normalize the time value before printing to get GMT results.

                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_TIME_set(), ASN1_UTCTIME_set(), ASN1_GENERALIZEDTIME_set(), ASN1_TIME_adj(), ASN1_UTCTIME_adj() and ASN1_GENERALIZEDTIME_set() return a pointer to a time structure or NULL if an error occurred.

                                                                                                                                      ASN1_TIME_set_string(), ASN1_UTCTIME_set_string(), ASN1_GENERALIZEDTIME_set_string() and ASN1_TIME_set_string_X509() return 1 if the time value is successfully set and 0 otherwise.

                                                                                                                                      ASN1_TIME_normalize() returns 1 on success, and 0 on error.

                                                                                                                                      ASN1_TIME_check(), ASN1_UTCTIME_check and ASN1_GENERALIZEDTIME_check() return 1 if the structure is syntactically correct and 0 otherwise.

                                                                                                                                      ASN1_TIME_print(), ASN1_UTCTIME_print() and ASN1_GENERALIZEDTIME_print() return 1 if the time is successfully printed out and 0 if an I/O error occurred an error occurred (I/O error or invalid time format).

                                                                                                                                      ASN1_TIME_to_tm() returns 1 if the time is successfully parsed and 0 if an error occurred (invalid time format).

                                                                                                                                      ASN1_TIME_diff() returns 1 for success and 0 for failure. It can fail if the passed-in time structure has invalid syntax, for example.

                                                                                                                                      ASN1_TIME_cmp_time_t() and ASN1_UTCTIME_cmp_time_t() return -1 if s is before t, 0 if s equals t, or 1 if s is after t. -2 is returned on error.

                                                                                                                                      ASN1_TIME_compare() returns -1 if a is before b, 0 if a equals b, or 1 if a is after b. -2 is returned on error.

                                                                                                                                      ASN1_TIME_to_generalizedtime() returns a pointer to the appropriate time structure on success or NULL if an error occurred.

                                                                                                                                      ASN1_TIME_dup(), ASN1_UTCTIME_dup() and ASN1_GENERALIZEDTIME_dup() return a pointer to a time structure or NULL if an error occurred.

                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Set a time structure to one hour after the current time and print it out:

                                                                                                                                      #include <time.h>\n#include <openssl/asn1.h>\n\nASN1_TIME *tm;\ntime_t t;\nBIO *b;\n\nt = time(NULL);\ntm = ASN1_TIME_adj(NULL, t, 0, 60 * 60);\nb = BIO_new_fp(stdout, BIO_NOCLOSE);\nASN1_TIME_print(b, tm);\nASN1_STRING_free(tm);\nBIO_free(b);\n

                                                                                                                                      Determine if one time is later or sooner than the current time:

                                                                                                                                      int day, sec;\n\nif (!ASN1_TIME_diff(&day, &sec, NULL, to))\n    /* Invalid time format */\n\nif (day > 0 || sec > 0)\n    printf(\"Later\\n\");\nelse if (day < 0 || sec < 0)\n    printf(\"Sooner\\n\");\nelse\n    printf(\"Same\\n\");\n
                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#history","title":"HISTORY","text":"

                                                                                                                                      The ASN1_TIME_to_tm() function was added in OpenSSL 1.1.1. The ASN1_TIME_set_string_X509() function was added in OpenSSL 1.1.1. The ASN1_TIME_normalize() function was added in OpenSSL 1.1.1. The ASN1_TIME_cmp_time_t() function was added in OpenSSL 1.1.1. The ASN1_TIME_compare() function was added in OpenSSL 1.1.1.

                                                                                                                                      "},{"location":"man3/ASN1_TIME_set/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_TYPE_get/","title":"ASN1_TYPE_get","text":""},{"location":"man3/ASN1_TYPE_get/#name","title":"NAME","text":"

                                                                                                                                      ASN1_TYPE_get, ASN1_TYPE_set, ASN1_TYPE_set1, ASN1_TYPE_cmp, ASN1_TYPE_unpack_sequence, ASN1_TYPE_pack_sequence - ASN1_TYPE utility functions

                                                                                                                                      "},{"location":"man3/ASN1_TYPE_get/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nint ASN1_TYPE_get(const ASN1_TYPE *a);\nvoid ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);\nint ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);\nint ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);\n\nvoid *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t);\nASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s,\n                                   ASN1_TYPE **t);\n
                                                                                                                                      "},{"location":"man3/ASN1_TYPE_get/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions allow an ASN1_TYPE structure to be manipulated. The ASN1_TYPE structure can contain any ASN.1 type or constructed type such as a SEQUENCE: it is effectively equivalent to the ASN.1 ANY type.

                                                                                                                                      ASN1_TYPE_get() returns the type of a or 0 if it fails.

                                                                                                                                      ASN1_TYPE_set() sets the value of a to type and value. This function uses the pointer value internally so it must not be freed up after the call.

                                                                                                                                      ASN1_TYPE_set1() sets the value of a to type a copy of value.

                                                                                                                                      ASN1_TYPE_cmp() compares ASN.1 types a and b and returns 0 if they are identical and nonzero otherwise.

                                                                                                                                      ASN1_TYPE_unpack_sequence() attempts to parse the SEQUENCE present in t using the ASN.1 structure it. If successful it returns a pointer to the ASN.1 structure corresponding to it which must be freed by the caller. If it fails it return NULL.

                                                                                                                                      ASN1_TYPE_pack_sequence() attempts to encode the ASN.1 structure s corresponding to it into an ASN1_TYPE. If successful the encoded ASN1_TYPE is returned. If t and *t are not NULL the encoded type is written to t overwriting any existing data. If t is not NULL but *t is NULL the returned ASN1_TYPE is written to *t.

                                                                                                                                      "},{"location":"man3/ASN1_TYPE_get/#notes","title":"NOTES","text":"

                                                                                                                                      The type and meaning of the value parameter for ASN1_TYPE_set() and ASN1_TYPE_set1() is determined by the type parameter. If type is V_ASN1_NULL value is ignored. If type is V_ASN1_BOOLEAN then the boolean is set to TRUE if value is not NULL. If type is V_ASN1_OBJECT then value is an ASN1_OBJECT structure. Otherwise type is and ASN1_STRING structure. If type corresponds to a primitive type (or a string type) then the contents of the ASN1_STRING contain the content octets of the type. If type corresponds to a constructed type or a tagged type (V_ASN1_SEQUENCE, V_ASN1_SET or V_ASN1_OTHER) then the ASN1_STRING contains the entire ASN.1 encoding verbatim (including tag and length octets).

                                                                                                                                      ASN1_TYPE_cmp() may not return zero if two types are equivalent but have different encodings. For example the single content octet of the boolean TRUE value under BER can have any nonzero encoding but ASN1_TYPE_cmp() will only return zero if the values are the same.

                                                                                                                                      If either or both of the parameters passed to ASN1_TYPE_cmp() is NULL the return value is nonzero. Technically if both parameters are NULL the two types could be absent OPTIONAL fields and so should match, however, passing NULL values could also indicate a programming error (for example an unparsable type which returns NULL) for types which do not match. So applications should handle the case of two absent values separately.

                                                                                                                                      "},{"location":"man3/ASN1_TYPE_get/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_TYPE_get() returns the type of the ASN1_TYPE argument.

                                                                                                                                      ASN1_TYPE_set() does not return a value.

                                                                                                                                      ASN1_TYPE_set1() returns 1 for success and 0 for failure.

                                                                                                                                      ASN1_TYPE_cmp() returns 0 if the types are identical and nonzero otherwise.

                                                                                                                                      ASN1_TYPE_unpack_sequence() returns a pointer to an ASN.1 structure or NULL on failure.

                                                                                                                                      ASN1_TYPE_pack_sequence() return an ASN1_TYPE structure if it succeeds or NULL on failure.

                                                                                                                                      "},{"location":"man3/ASN1_TYPE_get/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_aux_cb/","title":"ASN1_aux_cb","text":""},{"location":"man3/ASN1_aux_cb/#name","title":"NAME","text":"

                                                                                                                                      ASN1_AUX, ASN1_PRINT_ARG, ASN1_STREAM_ARG, ASN1_aux_cb, ASN1_aux_const_cb - ASN.1 auxiliary data

                                                                                                                                      "},{"location":"man3/ASN1_aux_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1t.h>\n\nstruct ASN1_AUX_st {\n    void *app_data;\n    int flags;\n    int ref_offset;             /* Offset of reference value */\n    int ref_lock;               /* Offset to an CRYPTO_RWLOCK */\n    ASN1_aux_cb *asn1_cb;\n    int enc_offset;             /* Offset of ASN1_ENCODING structure */\n    ASN1_aux_const_cb *asn1_const_cb; /* for ASN1_OP_I2D_ and ASN1_OP_PRINT_ */\n};\ntypedef struct ASN1_AUX_st ASN1_AUX;\n\nstruct ASN1_PRINT_ARG_st {\n    BIO *out;\n    int indent;\n    const ASN1_PCTX *pctx;\n};\ntypedef struct ASN1_PRINT_ARG_st ASN1_PRINT_ARG;\n\nstruct ASN1_STREAM_ARG_st {\n    BIO *out;\n    BIO *ndef_bio;\n    unsigned char **boundary;\n};\ntypedef struct ASN1_STREAM_ARG_st ASN1_STREAM_ARG;\n\ntypedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,\n                        void *exarg);\ntypedef int ASN1_aux_const_cb(int operation, const ASN1_VALUE **in,\n                              const ASN1_ITEM *it, void *exarg);\n
                                                                                                                                      "},{"location":"man3/ASN1_aux_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN.1 data structures can be associated with an ASN1_AUX object to supply additional information about the ASN.1 structure. An ASN1_AUX structure is associated with the structure during the definition of the ASN.1 template. For example an ASN1_AUX structure will be associated by using one of the various ASN.1 template definition macros that supply auxiliary information such as ASN1_SEQUENCE_enc(), ASN1_SEQUENCE_ref(), ASN1_SEQUENCE_cb_const_cb(), ASN1_SEQUENCE_const_cb(), ASN1_SEQUENCE_cb() or ASN1_NDEF_SEQUENCE_cb().

                                                                                                                                      An ASN1_AUX structure contains the following information.

                                                                                                                                      • app_data

                                                                                                                                        Arbitrary application data

                                                                                                                                      • flags

                                                                                                                                        Flags which indicate the auxiliarly functionality supported.

                                                                                                                                        The ASN1_AFLG_REFCOUNT flag indicates that objects support reference counting.

                                                                                                                                        The ASN1_AFLG_ENCODING flag indicates that the original encoding of the object will be saved.

                                                                                                                                        The ASN1_AFLG_BROKEN flag is a work around for broken encoders where the sequence length value may not be correct. This should generally not be used.

                                                                                                                                        The ASN1_AFLG_CONST_CB flag indicates that the \"const\" form of the ASN1_AUX callback should be used in preference to the non-const form.

                                                                                                                                      • ref_offset

                                                                                                                                        If the ASN1_AFLG_REFCOUNT flag is set then this value is assumed to be an offset into the ASN1_VALUE structure where a CRYPTO_REF_COUNT may be found for the purposes of reference counting.

                                                                                                                                      • ref_lock

                                                                                                                                        If the ASN1_AFLG_REFCOUNT flag is set then this value is assumed to be an offset into the ASN1_VALUE structure where a CRYPTO_RWLOCK may be found for the purposes of reference counting.

                                                                                                                                      • asn1_cb

                                                                                                                                        A callback that will be invoked at various points during the processing of the the ASN1_VALLUE. See below for further details.

                                                                                                                                      • enc_offset

                                                                                                                                        Offset into the ASN1_VALUE object where the original encoding of the object will be saved if the ASN1_AFLG_ENCODING flag has been set.

                                                                                                                                      • asn1_const_cb

                                                                                                                                        A callback that will be invoked at various points during the processing of the the ASN1_VALLUE. This is used in preference to the asn1_cb callback if the ASN1_AFLG_CONST_CB flag is set. See below for further details.

                                                                                                                                      During the processing of an ASN1_VALUE object the callbacks set via asn1_cb or asn1_const_cb will be invoked as a result of various events indicated via the operation parameter. The value of *in will be the ASN1_VALUE object being processed based on the template in it. An additional operation specific parameter may be passed in exarg. The currently supported operations are as follows. The callbacks should return a positive value on success or zero on error, unless otherwise noted below.

                                                                                                                                      • ASN1_OP_NEW_PRE

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure prior to an ASN1_VALUE object being allocated. The callback may allocate the ASN1_VALUE itself and store it in *pval. If it does so it should return 2 from the callback. On error it should return 0.

                                                                                                                                      • ASN1_OP_NEW_POST

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure after an ASN1_VALUE object has been allocated. The allocated object is in *pval.

                                                                                                                                      • ASN1_OP_FREE_PRE

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately before an ASN1_VALUE is freed. If the callback originally constructed the ASN1_VALUE via ASN1_OP_NEW_PRE then it should free it at this point and return 2 from the callback. Otherwise it should return 1 for success or 0 on error.

                                                                                                                                      • ASN1_OP_FREE_POST

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately after ASN1_VALUE sub-structures are freed.

                                                                                                                                      • ASN1_OP_D2I_PRE

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately before a \"d2i\" operation for the ASN1_VALUE.

                                                                                                                                      • ASN1_OP_D2I_POST

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately after a \"d2i\" operation for the ASN1_VALUE.

                                                                                                                                      • ASN1_OP_I2D_PRE

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately before a \"i2d\" operation for the ASN1_VALUE.

                                                                                                                                      • ASN1_OP_I2D_POST

                                                                                                                                        Invoked when processing a CHOICE, SEQUENCE or NDEF_SEQUENCE structure immediately after a \"i2d\" operation for the ASN1_VALUE.

                                                                                                                                      • ASN1_OP_PRINT_PRE

                                                                                                                                        Invoked when processing a SEQUENCE or NDEF_SEQUENCE structure immediately before printing the ASN1_VALUE. The exarg argument will be a pointer to an ASN1_PRINT_ARG structure (see below).

                                                                                                                                      • ASN1_OP_PRINT_POST

                                                                                                                                        Invoked when processing a SEQUENCE or NDEF_SEQUENCE structure immediately after printing the ASN1_VALUE. The exarg argument will be a pointer to an ASN1_PRINT_ARG structure (see below).

                                                                                                                                      • ASN1_OP_STREAM_PRE

                                                                                                                                        Invoked immediately prior to streaming the ASN1_VALUE data using indefinite length encoding. The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

                                                                                                                                      • ASN1_OP_STREAM_POST

                                                                                                                                        Invoked immediately after streaming the ASN1_VALUE data using indefinite length encoding. The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

                                                                                                                                      • ASN1_OP_DETACHED_PRE

                                                                                                                                        Invoked immediately prior to processing the ASN1_VALUE data as a \"detached\" value (as used in CMS and PKCS7). The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

                                                                                                                                      • ASN1_OP_DETACHED_POST

                                                                                                                                        Invoked immediately after processing the ASN1_VALUE data as a \"detached\" value (as used in CMS and PKCS7). The exarg argument will be a pointer to a ASN1_STREAM_ARG structure (see below).

                                                                                                                                      • ASN1_OP_DUP_PRE

                                                                                                                                        Invoked immediate prior to an ASN1_VALUE being duplicated via a call to ASN1_item_dup().

                                                                                                                                      • ASN1_OP_DUP_POST

                                                                                                                                        Invoked immediate after to an ASN1_VALUE has been duplicated via a call to ASN1_item_dup().

                                                                                                                                      • ASN1_OP_GET0_LIBCTX

                                                                                                                                        Invoked in order to obtain the OSSL_LIB_CTX associated with an ASN1_VALUE if any. A pointer to an OSSL_LIB_CTX should be stored in *exarg if such a value exists.

                                                                                                                                      • ASN1_OP_GET0_PROPQ

                                                                                                                                        Invoked in order to obtain the property query string associated with an ASN1_VALUE if any. A pointer to the property query string should be stored in *exarg if such a value exists.

                                                                                                                                      An ASN1_PRINT_ARG object is used during processing of ASN1_OP_PRINT_PRE and ASN1_OP_PRINT_POST callback operations. It contains the following information.

                                                                                                                                      • out

                                                                                                                                        The BIO being used to print the data out.

                                                                                                                                      • ndef_bio

                                                                                                                                        The current number of indent spaces that should be used for printing this data.

                                                                                                                                      • pctx

                                                                                                                                        The context for the ASN1_PCTX operation.

                                                                                                                                      An ASN1_STREAM_ARG object is used during processing of ASN1_OP_STREAM_PRE, ASN1_OP_STREAM_POST, ASN1_OP_DETACHED_PRE and ASN1_OP_DETACHED_POST callback operations. It contains the following information.

                                                                                                                                      • out

                                                                                                                                        The BIO to stream through

                                                                                                                                      • ndef_bio

                                                                                                                                        The BIO with filters appended

                                                                                                                                      • boundary

                                                                                                                                        The streaming I/O boundary.

                                                                                                                                      "},{"location":"man3/ASN1_aux_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The callbacks return 0 on error and a positive value on success. Some operations require specific positive success values as noted above.

                                                                                                                                      "},{"location":"man3/ASN1_aux_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ASN1_item_new_ex(3)

                                                                                                                                      "},{"location":"man3/ASN1_aux_cb/#history","title":"HISTORY","text":"

                                                                                                                                      The ASN1_aux_const_cb() callback and the ASN1_OP_GET0_LIBCTX and ASN1_OP_GET0_PROPQ operation types were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ASN1_aux_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/","title":"ASN1_generate_nconf","text":""},{"location":"man3/ASN1_generate_nconf/#name","title":"NAME","text":"

                                                                                                                                      ASN1_generate_nconf, ASN1_generate_v3 - ASN1 string generation functions

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf);\nASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf);\n
                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions generate the ASN1 encoding of a string in an ASN1_TYPE structure.

                                                                                                                                      str contains the string to encode. nconf or cnf contains the optional configuration information where additional strings will be read from. nconf will typically come from a config file whereas cnf is obtained from an X509V3_CTX structure, which will typically be used by X509 v3 certificate extension functions. cnf or nconf can be set to NULL if no additional configuration will be used.

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#generation-string-format","title":"GENERATION STRING FORMAT","text":"

                                                                                                                                      The actual data encoded is determined by the string str and the configuration information. The general format of the string is:

                                                                                                                                      • [modifier,]type[:value]

                                                                                                                                      That is zero or more comma separated modifiers followed by a type followed by an optional colon and a value. The formats of type, value and modifier are explained below.

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#supported-types","title":"Supported Types","text":"

                                                                                                                                      The supported types are listed below. Case is not significant in the type names. Unless otherwise specified only the ASCII format is permissible.

                                                                                                                                      • BOOLEAN, BOOL

                                                                                                                                        This encodes a boolean type. The value string is mandatory and should be TRUE or FALSE. Additionally TRUE, true, Y, y, YES, yes, FALSE, false, N, n, NO and no are acceptable.

                                                                                                                                      • NULL

                                                                                                                                        Encode the NULL type, the value string must not be present.

                                                                                                                                      • INTEGER, INT

                                                                                                                                        Encodes an ASN1 INTEGER type. The value string represents the value of the integer, it can be prefaced by a minus sign and is normally interpreted as a decimal value unless the prefix 0x is included.

                                                                                                                                      • ENUMERATED, ENUM

                                                                                                                                        Encodes the ASN1 ENUMERATED type, it is otherwise identical to INTEGER.

                                                                                                                                      • OBJECT, OID

                                                                                                                                        Encodes an ASN1 OBJECT IDENTIFIER, the value string can be a short name, a long name or numerical format.

                                                                                                                                      • UTCTIME, UTC

                                                                                                                                        Encodes an ASN1 UTCTime structure, the value should be in the format YYMMDDHHMMSSZ.

                                                                                                                                      • GENERALIZEDTIME, GENTIME

                                                                                                                                        Encodes an ASN1 GeneralizedTime structure, the value should be in the format YYYYMMDDHHMMSSZ.

                                                                                                                                      • OCTETSTRING, OCT

                                                                                                                                        Encodes an ASN1 OCTET STRING. value represents the contents of this structure, the format strings ASCII and HEX can be used to specify the format of value.

                                                                                                                                      • BITSTRING, BITSTR

                                                                                                                                        Encodes an ASN1 BIT STRING. value represents the contents of this structure, the format strings ASCII, HEX and BITLIST can be used to specify the format of value.

                                                                                                                                        If the format is anything other than BITLIST the number of unused bits is set to zero.

                                                                                                                                      • UNIVERSALSTRING, UNIV, IA5, IA5STRING, UTF8, UTF8String, BMP, BMPSTRING, VISIBLESTRING, VISIBLE, PRINTABLESTRING, PRINTABLE, T61, T61STRING, TELETEXSTRING, GeneralString, NUMERICSTRING, NUMERIC

                                                                                                                                        These encode the corresponding string types. value represents the contents of this structure. The format can be ASCII or UTF8.

                                                                                                                                      • SEQUENCE, SEQ, SET

                                                                                                                                        Formats the result as an ASN1 SEQUENCE or SET type. value should be a section name which will contain the contents. The field names in the section are ignored and the values are in the generated string format. If value is absent then an empty SEQUENCE will be encoded.

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#modifiers","title":"Modifiers","text":"

                                                                                                                                      Modifiers affect the following structure, they can be used to add EXPLICIT or IMPLICIT tagging, add wrappers or to change the string format of the final type and value. The supported formats are documented below.

                                                                                                                                      • EXPLICIT, EXP

                                                                                                                                        Add an explicit tag to the following structure. This string should be followed by a colon and the tag value to use as a decimal value.

                                                                                                                                        By following the number with U, A, P or C UNIVERSAL, APPLICATION, PRIVATE or CONTEXT SPECIFIC tagging can be used, the default is CONTEXT SPECIFIC.

                                                                                                                                      • IMPLICIT, IMP

                                                                                                                                        This is the same as EXPLICIT except IMPLICIT tagging is used instead.

                                                                                                                                      • OCTWRAP, SEQWRAP, SETWRAP, BITWRAP

                                                                                                                                        The following structure is surrounded by an OCTET STRING, a SEQUENCE, a SET or a BIT STRING respectively. For a BIT STRING the number of unused bits is set to zero.

                                                                                                                                      • FORMAT

                                                                                                                                        This specifies the format of the ultimate value. It should be followed by a colon and one of the strings ASCII, UTF8, HEX or BITLIST.

                                                                                                                                        If no format specifier is included then ASCII is used. If UTF8 is specified then the value string must be a valid UTF8 string. For HEX the output must be a set of hex digits. BITLIST (which is only valid for a BIT STRING) is a comma separated list of the indices of the set bits, all other bits are zero.

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_generate_nconf() and ASN1_generate_v3() return the encoded data as an ASN1_TYPE structure or NULL if an error occurred.

                                                                                                                                      The error codes that can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#examples","title":"EXAMPLES","text":"

                                                                                                                                      A simple IA5String:

                                                                                                                                      IA5STRING:Hello World\n

                                                                                                                                      An IA5String explicitly tagged:

                                                                                                                                      EXPLICIT:0,IA5STRING:Hello World\n

                                                                                                                                      An IA5String explicitly tagged using APPLICATION tagging:

                                                                                                                                      EXPLICIT:0A,IA5STRING:Hello World\n

                                                                                                                                      A BITSTRING with bits 1 and 5 set and all others zero:

                                                                                                                                      FORMAT:BITLIST,BITSTRING:1,5\n

                                                                                                                                      A more complex example using a config file to produce a SEQUENCE consisting of a BOOL an OID and a UTF8String:

                                                                                                                                      asn1 = SEQUENCE:seq_section\n\n[seq_section]\n\nfield1 = BOOLEAN:TRUE\nfield2 = OID:commonName\nfield3 = UTF8:Third field\n

                                                                                                                                      This example produces an RSAPrivateKey structure, this is the key contained in the file client.pem in all OpenSSL distributions (note: the field names such as 'coeff' are ignored and are present just for clarity):

                                                                                                                                      asn1=SEQUENCE:private_key\n[private_key]\nversion=INTEGER:0\n\nn=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\\\nD4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9\n\ne=INTEGER:0x010001\n\nd=INTEGER:0x6F05EAD2F27FFAEC84BEC360C4B928FD5F3A9865D0FCAAD291E2A52F4A\\\nF810DC6373278C006A0ABBA27DC8C63BF97F7E666E27C5284D7D3B1FFFE16B7A87B51D\n\np=INTEGER:0xF3929B9435608F8A22C208D86795271D54EBDFB09DDEF539AB083DA912\\\nD4BD57\n\nq=INTEGER:0xC50016F89DFF2561347ED1186A46E150E28BF2D0F539A1594BBD7FE467\\\n46EC4F\n\nexp1=INTEGER:0x9E7D4326C924AFC1DEA40B45650134966D6F9DFA3A7F9D698CD4ABEA\\\n9C0A39B9\n\nexp2=INTEGER:0xBA84003BB95355AFB7C50DF140C60513D0BA51D637272E355E397779\\\nE7B2458F\n\ncoeff=INTEGER:0x30B9E4F2AFA5AC679F920FC83F1F2DF1BAF1779CF989447FABC2F5\\\n628657053A\n

                                                                                                                                      This example is the corresponding public key in a SubjectPublicKeyInfo structure:

                                                                                                                                      # # Start with a SEQUENCE asn1=SEQUENCE:pubkeyinfo

                                                                                                                                      # # pubkeyinfo contains an algorithm identifier and the public key wrapped # # in a BIT STRING [pubkeyinfo] algorithm=SEQUENCE:rsa_alg pubkey=BITWRAP,SEQUENCE:rsapubkey

                                                                                                                                      # # algorithm ID for RSA is just an OID and a NULL [rsa_alg] algorithm=OID:rsaEncryption parameter=NULL

                                                                                                                                      # # Actual public key: modulus and exponent [rsapubkey] n=INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB93644\\ D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9

                                                                                                                                      e=INTEGER:0x010001\n
                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ASN1_generate_nconf/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_item_d2i_bio/","title":"ASN1_item_d2i_bio","text":""},{"location":"man3/ASN1_item_d2i_bio/#name","title":"NAME","text":"

                                                                                                                                      ASN1_item_d2i_ex, ASN1_item_d2i, ASN1_item_d2i_bio_ex, ASN1_item_d2i_bio, ASN1_item_d2i_fp_ex, ASN1_item_d2i_fp, ASN1_item_i2d_mem_bio - decode and encode DER-encoded ASN.1 structures

                                                                                                                                      "},{"location":"man3/ASN1_item_d2i_bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nASN1_VALUE *ASN1_item_d2i_ex(ASN1_VALUE **pval, const unsigned char **in,\n                             long len, const ASN1_ITEM *it,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, const unsigned char **in,\n                          long len, const ASN1_ITEM *it);\n\nvoid *ASN1_item_d2i_bio_ex(const ASN1_ITEM *it, BIO *in, void *x,\n                           OSSL_LIB_CTX *libctx, const char *propq);\nvoid *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);\n\nvoid *ASN1_item_d2i_fp_ex(const ASN1_ITEM *it, FILE *in, void *x,\n                          OSSL_LIB_CTX *libctx, const char *propq);\nvoid *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);\n\nBIO *ASN1_item_i2d_mem_bio(const ASN1_ITEM *it, const ASN1_VALUE *val);\n
                                                                                                                                      "},{"location":"man3/ASN1_item_d2i_bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN1_item_d2i_ex() decodes the contents of the data stored in *in of length len which must be a DER-encoded ASN.1 structure, using the ASN.1 template it. It places the result in *pval unless pval is NULL. If *pval is non-NULL on entry then the ASN1_VALUE present there will be reused. Otherwise a new ASN1_VALUE will be allocated. If any algorithm fetches are required during the process then they will use the OSSL_LIB_CTXprovided in the libctx parameter and the property query string in propq. See \"ALGORITHM FETCHING\" in crypto(7) for more information about algorithm fetching. On exit *in will be updated to point to the next byte in the buffer after the decoded structure.

                                                                                                                                      ASN1_item_d2i() is the same as ASN1_item_d2i_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

                                                                                                                                      ASN1_item_d2i_bio_ex() decodes the contents of its input BIO in, which must be a DER-encoded ASN.1 structure, using the ASN.1 template it and places the result in *pval unless pval is NULL. If in is NULL it returns NULL, else a pointer to the parsed structure. If any algorithm fetches are required during the process then they will use the OSSL_LIB_CTX provided in the libctx parameter and the property query string in propq. See \"ALGORITHM FETCHING\" in crypto(7) for more information about algorithm fetching.

                                                                                                                                      ASN1_item_d2i_bio() is the same as ASN1_item_d2i_bio_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

                                                                                                                                      ASN1_item_d2i_fp_ex() is the same as ASN1_item_d2i_bio_ex() except that a FILE pointer is provided instead of a BIO.

                                                                                                                                      ASN1_item_d2i_fp() is the same as ASN1_item_d2i_fp_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

                                                                                                                                      ASN1_item_i2d_mem_bio() encodes the given ASN.1 value val using the ASN.1 template it and returns the result in a memory BIO.

                                                                                                                                      "},{"location":"man3/ASN1_item_d2i_bio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_item_d2i_bio() returns a pointer to an ASN1_VALUE or NULL.

                                                                                                                                      ASN1_item_i2d_mem_bio() returns a pointer to a memory BIO or NULL on error.

                                                                                                                                      "},{"location":"man3/ASN1_item_d2i_bio/#history","title":"HISTORY","text":"

                                                                                                                                      The functions ASN1_item_d2i_ex(), ASN1_item_d2i_bio_ex(), ASN1_item_d2i_fp_ex() and ASN1_item_i2d_mem_bio() were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ASN1_item_d2i_bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_item_new/","title":"ASN1_item_new","text":""},{"location":"man3/ASN1_item_new/#name","title":"NAME","text":"

                                                                                                                                      ASN1_item_new_ex, ASN1_item_new - create new ASN.1 values

                                                                                                                                      "},{"location":"man3/ASN1_item_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/asn1.h>\n\nASN1_VALUE *ASN1_item_new_ex(const ASN1_ITEM *it, OSSL_LIB_CTX *libctx,\n                             const char *propq);\nASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);\n
                                                                                                                                      "},{"location":"man3/ASN1_item_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN1_item_new_ex() creates a new ASN1_VALUE structure based on the ASN1_ITEM template given in the it parameter. If any algorithm fetches are required during the process then they will use the OSSL_LIB_CTX provided in the libctx parameter and the property query string in propq. See \"ALGORITHM FETCHING\" in crypto(7) for more information about algorithm fetching.

                                                                                                                                      ASN1_item_new() is the same as ASN1_item_new_ex() except that the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query string.

                                                                                                                                      "},{"location":"man3/ASN1_item_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASN1_item_new_ex() and ASN1_item_new() return a pointer to the newly created ASN1_VALUE or NULL on error.

                                                                                                                                      "},{"location":"man3/ASN1_item_new/#history","title":"HISTORY","text":"

                                                                                                                                      The function ASN1_item_new_ex() was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ASN1_item_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASN1_item_sign/","title":"ASN1_item_sign","text":""},{"location":"man3/ASN1_item_sign/#name","title":"NAME","text":"

                                                                                                                                      ASN1_item_sign, ASN1_item_sign_ex, ASN1_item_sign_ctx, ASN1_item_verify, ASN1_item_verify_ex, ASN1_item_verify_ctx - ASN1 sign and verify

                                                                                                                                      "},{"location":"man3/ASN1_item_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/x509.h>\n\nint ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1,\n                      X509_ALGOR *algor2, ASN1_BIT_STRING *signature,\n                      const void *data, const ASN1_OCTET_STRING *id,\n                      EVP_PKEY *pkey, const EVP_MD *md, OSSL_LIB_CTX *libctx,\n                      const char *propq);\n\nint ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,\n                   ASN1_BIT_STRING *signature, const void *data,\n                   EVP_PKEY *pkey, const EVP_MD *md);\n\nint ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,\n                       X509_ALGOR *algor2, ASN1_BIT_STRING *signature,\n                       const void *data, EVP_MD_CTX *ctx);\n\nint ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg,\n                        const ASN1_BIT_STRING *signature, const void *data,\n                        const ASN1_OCTET_STRING *id, EVP_PKEY *pkey,\n                        OSSL_LIB_CTX *libctx, const char *propq);\n\nint ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg,\n                     const ASN1_BIT_STRING *signature, const void *data,\n                     EVP_PKEY *pkey);\n\nint ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg,\n                         const ASN1_BIT_STRING *signature, const void *data,\n                         EVP_MD_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/ASN1_item_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ASN1_item_sign_ex() is used to sign arbitrary ASN1 data using a data object data, the ASN.1 structure it, private key pkey and message digest md. The data that is signed is formed by taking the data object in data and converting it to der format using the ASN.1 structure it. The data that will be signed, and a structure containing the signature may both have a copy of the X509_ALGOR. The ASN1_item_sign_ex() function will write the correct X509_ALGOR to the structs based on the algorithms and parameters that have been set up. If one of algor1 or algor2 points to the X509_ALGOR of the data to be signed, then that X509_ALGOR will first be written before the signature is generated. Examples of valid values that can be used by the ASN.1 structure it are ASN1_ITEM_rptr(X509_CINF), ASN1_ITEM_rptr(X509_REQ_INFO) and ASN1_ITEM_rptr(X509_CRL_INFO). The OSSL_LIB_CTX specified in libctx and the property query string specified in props are used when searching for algorithms in providers. The generated signature is set into signature. The optional parameter id can be NULL, but can be set for special key types. See EVP_PKEY_CTX_set1_id() for further info. The output parameters <algor1> and algor2 are ignored if they are NULL.

                                                                                                                                      ASN1_item_sign() is similar to ASN1_item_sign_ex() but uses default values of NULL for the id, libctx and propq.

                                                                                                                                      ASN1_item_sign_ctx() is similar to ASN1_item_sign() but uses the parameters contained in digest context ctx.

                                                                                                                                      ASN1_item_verify_ex() is used to verify the signature signature of internal data data using the public key pkey and algorithm identifier alg. The data that is verified is formed by taking the data object in data and converting it to der format using the ASN.1 structure it. The OSSL_LIB_CTX specified in libctx and the property query string specified in props are used when searching for algorithms in providers. The optional parameter id can be NULL, but can be set for special key types. See EVP_PKEY_CTX_set1_id() for further info.

                                                                                                                                      ASN1_item_verify() is similar to ASN1_item_verify_ex() but uses default values of NULL for the id, libctx and propq.

                                                                                                                                      ASN1_item_verify_ctx() is similar to ASN1_item_verify() but uses the parameters contained in digest context ctx.

                                                                                                                                      "},{"location":"man3/ASN1_item_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      All sign functions return the size of the signature in bytes for success and zero for failure.

                                                                                                                                      All verify functions return 1 if the signature is valid and 0 if the signature check fails. If the signature could not be checked at all because it was ill-formed or some other error occurred then -1 is returned.

                                                                                                                                      "},{"location":"man3/ASN1_item_sign/#examples","title":"EXAMPLES","text":"

                                                                                                                                      In the following example a 'MyObject' object is signed using the key contained in an EVP_MD_CTX. The signature is written to MyObject.signature. The object is then output in DER format and then loaded back in and verified.

                                                                                                                                      #include <openssl/x509.h>\n#include <openssl/asn1t.h>\n\n/* An object used to store the ASN1 data fields that will be signed */\ntypedef struct MySignInfoObject_st\n{\n    ASN1_INTEGER *version;\n    X509_ALGOR sig_alg;\n} MySignInfoObject;\n\nDECLARE_ASN1_FUNCTIONS(MySignInfoObject)\n/*\n * A higher level object containing the ASN1 fields, signature alg and\n * output signature.\n */\ntypedef struct MyObject_st\n{\n    MySignInfoObject info;\n    X509_ALGOR sig_alg;\n    ASN1_BIT_STRING *signature;\n} MyObject;\n\nDECLARE_ASN1_FUNCTIONS(MyObject)\n\n/* The ASN1 definition of MySignInfoObject */\nASN1_SEQUENCE_cb(MySignInfoObject, NULL) = {\n    ASN1_SIMPLE(MySignInfoObject, version, ASN1_INTEGER)\n    ASN1_EMBED(MySignInfoObject, sig_alg, X509_ALGOR),\n} ASN1_SEQUENCE_END_cb(MySignInfoObject, MySignInfoObject)\n\n/* new, free, d2i & i2d functions for MySignInfoObject */\nIMPLEMENT_ASN1_FUNCTIONS(MySignInfoObject)\n\n/* The ASN1 definition of MyObject */\nASN1_SEQUENCE_cb(MyObject, NULL) = {\n    ASN1_EMBED(MyObject, info, MySignInfoObject),\n    ASN1_EMBED(MyObject, sig_alg, X509_ALGOR),\n    ASN1_SIMPLE(MyObject, signature, ASN1_BIT_STRING)\n} ASN1_SEQUENCE_END_cb(MyObject, MyObject)\n\n/* new, free, d2i & i2d functions for MyObject */\nIMPLEMENT_ASN1_FUNCTIONS(MyObject)\n\nint test_asn1_item_sign_verify(const char *mdname, EVP_PKEY *pkey, long version)\n{\n   int ret = 0;\n   unsigned char *obj_der = NULL;\n   const unsigned char *p = NULL;\n   MyObject *obj = NULL, *loaded_obj = NULL;\n   const ASN1_ITEM *it = ASN1_ITEM_rptr(MySignInfoObject);\n   EVP_MD_CTX *sctx = NULL, *vctx = NULL;\n   int len;\n\n   /* Create MyObject and set its version */\n   obj = MyObject_new();\n   if (obj == NULL)\n       goto err;\n   if (!ASN1_INTEGER_set(obj->info.version, version))\n       goto err;\n\n   /* Set the key and digest used for signing */\n   sctx = EVP_MD_CTX_new();\n   if (sctx == NULL\n       || !EVP_DigestSignInit_ex(sctx, NULL, mdname, NULL, NULL, pkey))\n       goto err;\n\n   /*\n    * it contains the mapping between ASN.1 data and an object MySignInfoObject\n    * obj->info is the 'MySignInfoObject' object that will be\n    *   converted into DER data and then signed.\n    * obj->signature will contain the output signature.\n    * obj->sig_alg is filled with the private key's signing algorithm id.\n    * obj->info.sig_alg is another copy of the signing algorithm id that sits\n    * within MyObject.\n    */\n   len = ASN1_item_sign_ctx(it, &obj->sig_alg, &obj->info.sig_alg,\n                            obj->signature, &obj->info, sctx);\n   if (len <= 0\n       || X509_ALGOR_cmp(&obj->sig_alg, &obj->info.sig_alg) != 0)\n       goto err;\n\n   /* Output MyObject in der form */\n   len = i2d_MyObject(obj, &obj_der);\n   if (len <= 0)\n       goto err;\n\n   /* Set the key and digest used for verifying */\n   vctx = EVP_MD_CTX_new();\n   if (vctx == NULL\n       || !EVP_DigestVerifyInit_ex(vctx, NULL, mdname, NULL, NULL, pkey))\n       goto err;\n\n   /* Load the der data back into an object */\n   p = obj_der;\n   loaded_obj = d2i_MyObject(NULL, &p, len);\n   if (loaded_obj == NULL)\n       goto err;\n   /* Verify the loaded object */\n   ret = ASN1_item_verify_ctx(it, &loaded_obj->sig_alg, loaded_obj->signature,\n                              &loaded_obj->info, vctx);\n

                                                                                                                                      err: OPENSSL_free(obj_der); MyObject_free(loaded_obj); MyObject_free(obj); EVP_MD_CTX_free(sctx); EVP_MD_CTX_free(vctx); return ret; }

                                                                                                                                      "},{"location":"man3/ASN1_item_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      X509_sign(3), X509_verify(3)

                                                                                                                                      "},{"location":"man3/ASN1_item_sign/#history","title":"HISTORY","text":"

                                                                                                                                      ASN1_item_sign_ex() and ASN1_item_verify_ex() were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ASN1_item_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/","title":"ASYNC_WAIT_CTX_new","text":""},{"location":"man3/ASYNC_WAIT_CTX_new/#name","title":"NAME","text":"

                                                                                                                                      ASYNC_WAIT_CTX_new, ASYNC_WAIT_CTX_free, ASYNC_WAIT_CTX_set_wait_fd, ASYNC_WAIT_CTX_get_fd, ASYNC_WAIT_CTX_get_all_fds, ASYNC_WAIT_CTX_get_changed_fds, ASYNC_WAIT_CTX_clear_fd, ASYNC_WAIT_CTX_set_callback, ASYNC_WAIT_CTX_get_callback, ASYNC_WAIT_CTX_set_status, ASYNC_WAIT_CTX_get_status, ASYNC_callback_fn, ASYNC_STATUS_UNSUPPORTED, ASYNC_STATUS_ERR, ASYNC_STATUS_OK, ASYNC_STATUS_EAGAIN - functions to manage waiting for asynchronous jobs to complete

                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/async.h>\n\n#define ASYNC_STATUS_UNSUPPORTED    0\n#define ASYNC_STATUS_ERR            1\n#define ASYNC_STATUS_OK             2\n#define ASYNC_STATUS_EAGAIN         3\ntypedef int (*ASYNC_callback_fn)(void *arg);\nASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);\nvoid ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);\nint ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,\n                               OSSL_ASYNC_FD fd,\n                               void *custom_data,\n                               void (*cleanup)(ASYNC_WAIT_CTX *, const void *,\n                                               OSSL_ASYNC_FD, void *));\nint ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,\n                          OSSL_ASYNC_FD *fd, void **custom_data);\nint ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,\n                               size_t *numfds);\nint ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,\n                                   size_t *numaddfds, OSSL_ASYNC_FD *delfd,\n                                   size_t *numdelfds);\nint ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);\nint ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx,\n                                ASYNC_callback_fn callback,\n                                void *callback_arg);\nint ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx,\n                                ASYNC_callback_fn *callback,\n                                void **callback_arg);\nint ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status);\nint ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      For an overview of how asynchronous operations are implemented in OpenSSL see ASYNC_start_job(3). An ASYNC_WAIT_CTX object represents an asynchronous \"session\", i.e. a related set of crypto operations. For example in SSL terms this would have a one-to-one correspondence with an SSL connection.

                                                                                                                                      Application code must create an ASYNC_WAIT_CTX using the ASYNC_WAIT_CTX_new() function prior to calling ASYNC_start_job() (see ASYNC_start_job(3)). When the job is started it is associated with the ASYNC_WAIT_CTX for the duration of that job. An ASYNC_WAIT_CTX should only be used for one ASYNC_JOB at any one time, but can be reused after an ASYNC_JOB has finished for a subsequent ASYNC_JOB. When the session is complete (e.g. the SSL connection is closed), application code cleans up with ASYNC_WAIT_CTX_free().

                                                                                                                                      ASYNC_WAIT_CTXs can have \"wait\" file descriptors associated with them. Calling ASYNC_WAIT_CTX_get_all_fds() and passing in a pointer to an ASYNC_WAIT_CTX in the ctx parameter will return the wait file descriptors associated with that job in *fd. The number of file descriptors returned will be stored in *numfds. It is the caller's responsibility to ensure that sufficient memory has been allocated in *fd to receive all the file descriptors. Calling ASYNC_WAIT_CTX_get_all_fds() with a NULL fd value will return no file descriptors but will still populate *numfds. Therefore, application code is typically expected to call this function twice: once to get the number of fds, and then again when sufficient memory has been allocated. If only one asynchronous engine is being used then normally this call will only ever return one fd. If multiple asynchronous engines are being used then more could be returned.

                                                                                                                                      The function ASYNC_WAIT_CTX_get_changed_fds() can be used to detect if any fds have changed since the last call time ASYNC_start_job() returned ASYNC_PAUSE (or since the ASYNC_WAIT_CTX was created if no ASYNC_PAUSE result has been received). The numaddfds and numdelfds parameters will be populated with the number of fds added or deleted respectively. *addfd and *delfd will be populated with the list of added and deleted fds respectively. Similarly to ASYNC_WAIT_CTX_get_all_fds() either of these can be NULL, but if they are not NULL then the caller is responsible for ensuring sufficient memory is allocated.

                                                                                                                                      Implementers of async aware code (e.g. engines) are encouraged to return a stable fd for the lifetime of the ASYNC_WAIT_CTX in order to reduce the \"churn\" of regularly changing fds - although no guarantees of this are provided to applications.

                                                                                                                                      Applications can wait for the file descriptor to be ready for \"read\" using a system function call such as select or poll (being ready for \"read\" indicates that the job should be resumed). If no file descriptor is made available then an application will have to periodically \"poll\" the job by attempting to restart it to see if it is ready to continue.

                                                                                                                                      Async aware code (e.g. engines) can get the current ASYNC_WAIT_CTX from the job via ASYNC_get_wait_ctx(3) and provide a file descriptor to use for waiting on by calling ASYNC_WAIT_CTX_set_wait_fd(). Typically this would be done by an engine immediately prior to calling ASYNC_pause_job() and not by end user code. An existing association with a file descriptor can be obtained using ASYNC_WAIT_CTX_get_fd() and cleared using ASYNC_WAIT_CTX_clear_fd(). Both of these functions requires a key value which is unique to the async aware code. This could be any unique value but a good candidate might be the ENGINE * for the engine. The custom_data parameter can be any value, and will be returned in a subsequent call to ASYNC_WAIT_CTX_get_fd(). The ASYNC_WAIT_CTX_set_wait_fd() function also expects a pointer to a \"cleanup\" routine. This can be NULL but if provided will automatically get called when the ASYNC_WAIT_CTX is freed, and gives the engine the opportunity to close the fd or any other resources. Note: The \"cleanup\" routine does not get called if the fd is cleared directly via a call to ASYNC_WAIT_CTX_clear_fd().

                                                                                                                                      An example of typical usage might be an async capable engine. User code would initiate cryptographic operations. The engine would initiate those operations asynchronously and then call ASYNC_WAIT_CTX_set_wait_fd() followed by ASYNC_pause_job() to return control to the user code. The user code can then perform other tasks or wait for the job to be ready by calling \"select\" or other similar function on the wait file descriptor. The engine can signal to the user code that the job should be resumed by making the wait file descriptor \"readable\". Once resumed the engine should clear the wake signal on the wait file descriptor.

                                                                                                                                      As well as a file descriptor, user code may also be notified via a callback. The callback and data pointers are stored within the ASYNC_WAIT_CTX along with an additional status field that can be used for the notification of retries from an engine. This additional method can be used when the user thinks that a file descriptor is too costly in terms of CPU cycles or in some context where a file descriptor is not appropriate.

                                                                                                                                      ASYNC_WAIT_CTX_set_callback() sets the callback and the callback argument. The callback will be called to notify user code when an engine completes a cryptography operation. It is a requirement that the callback function is small and nonblocking as it will be run in the context of a polling mechanism or an interrupt.

                                                                                                                                      ASYNC_WAIT_CTX_get_callback() returns the callback set in the ASYNC_WAIT_CTX structure.

                                                                                                                                      ASYNC_WAIT_CTX_set_status() allows an engine to set the current engine status. The possible status values are the following:

                                                                                                                                      • ASYNC_STATUS_UNSUPPORTED

                                                                                                                                        The engine does not support the callback mechanism. This is the default value. The engine must call ASYNC_WAIT_CTX_set_status() to set the status to some value other than ASYNC_STATUS_UNSUPPORTED if it intends to enable the callback mechanism.

                                                                                                                                      • ASYNC_STATUS_ERR

                                                                                                                                        The engine has a fatal problem with this request. The user code should clean up this session.

                                                                                                                                      • ASYNC_STATUS_OK

                                                                                                                                        The request has been successfully submitted.

                                                                                                                                      • ASYNC_STATUS_EAGAIN

                                                                                                                                        The engine has some problem which will be recovered soon, such as a buffer is full, so user code should resume the job.

                                                                                                                                      ASYNC_WAIT_CTX_get_status() allows user code to obtain the current status value. If the status is any value other than ASYNC_STATUS_OK then the user code should not expect to receive a callback from the engine even if one has been set.

                                                                                                                                      An example of the usage of the callback method might be the following. User code would initiate cryptographic operations, and the engine code would dispatch this operation to hardware, and if the dispatch is successful, then the engine code would call ASYNC_pause_job() to return control to the user code. After that, user code can perform other tasks. When the hardware completes the operation, normally it is detected by a polling function or an interrupt, as the user code set a callback by calling ASYNC_WAIT_CTX_set_callback() previously, then the registered callback will be called.

                                                                                                                                      ASYNC_WAIT_CTX_free() frees up a single ASYNC_WAIT_CTX object. If the argument is NULL, nothing is done.

                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASYNC_WAIT_CTX_new() returns a pointer to the newly allocated ASYNC_WAIT_CTX or NULL on error.

                                                                                                                                      ASYNC_WAIT_CTX_set_wait_fd, ASYNC_WAIT_CTX_get_fd, ASYNC_WAIT_CTX_get_all_fds, ASYNC_WAIT_CTX_get_changed_fds, ASYNC_WAIT_CTX_clear_fd, ASYNC_WAIT_CTX_set_callback, ASYNC_WAIT_CTX_get_callback and ASYNC_WAIT_CTX_set_status all return 1 on success or 0 on error. ASYNC_WAIT_CTX_get_status() returns the engine status.

                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/#notes","title":"NOTES","text":"

                                                                                                                                      On Windows platforms the <openssl/async.h> header is dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/async.h>.

                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), ASYNC_start_job(3)

                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                      ASYNC_WAIT_CTX_new(), ASYNC_WAIT_CTX_free(), ASYNC_WAIT_CTX_set_wait_fd(), ASYNC_WAIT_CTX_get_fd(), ASYNC_WAIT_CTX_get_all_fds(), ASYNC_WAIT_CTX_get_changed_fds() and ASYNC_WAIT_CTX_clear_fd() were added in OpenSSL 1.1.0.

                                                                                                                                      ASYNC_WAIT_CTX_set_callback(), ASYNC_WAIT_CTX_get_callback(), ASYNC_WAIT_CTX_set_status(), and ASYNC_WAIT_CTX_get_status() were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ASYNC_WAIT_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ASYNC_start_job/","title":"ASYNC_start_job","text":""},{"location":"man3/ASYNC_start_job/#name","title":"NAME","text":"

                                                                                                                                      ASYNC_get_wait_ctx, ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_current_job, ASYNC_block_pause, ASYNC_unblock_pause, ASYNC_is_capable - asynchronous job management functions

                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/async.h>\n\nint ASYNC_init_thread(size_t max_size, size_t init_size);\nvoid ASYNC_cleanup_thread(void);\n\nint ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,\n                    int (*func)(void *), void *args, size_t size);\nint ASYNC_pause_job(void);\n\nASYNC_JOB *ASYNC_get_current_job(void);\nASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);\nvoid ASYNC_block_pause(void);\nvoid ASYNC_unblock_pause(void);\n\nint ASYNC_is_capable(void);\n
                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#description","title":"DESCRIPTION","text":"

                                                                                                                                      OpenSSL implements asynchronous capabilities through an ASYNC_JOB. This represents code that can be started and executes until some event occurs. At that point the code can be paused and control returns to user code until some subsequent event indicates that the job can be resumed.

                                                                                                                                      The creation of an ASYNC_JOB is a relatively expensive operation. Therefore, for efficiency reasons, jobs can be created up front and reused many times. They are held in a pool until they are needed, at which point they are removed from the pool, used, and then returned to the pool when the job completes. If the user application is multi-threaded, then ASYNC_init_thread() may be called for each thread that will initiate asynchronous jobs. Before user code exits per-thread resources need to be cleaned up. This will normally occur automatically (see OPENSSL_init_crypto(3)) but may be explicitly initiated by using ASYNC_cleanup_thread(). No asynchronous jobs must be outstanding for the thread when ASYNC_cleanup_thread() is called. Failing to ensure this will result in memory leaks.

                                                                                                                                      The max_size argument limits the number of ASYNC_JOBs that will be held in the pool. If max_size is set to 0 then no upper limit is set. When an ASYNC_JOB is needed but there are none available in the pool already then one will be automatically created, as long as the total of ASYNC_JOBs managed by the pool does not exceed max_size. When the pool is first initialised init_size ASYNC_JOBs will be created immediately. If ASYNC_init_thread() is not called before the pool is first used then it will be called automatically with a max_size of 0 (no upper limit) and an init_size of 0 (no ASYNC_JOBs created up front).

                                                                                                                                      An asynchronous job is started by calling the ASYNC_start_job() function. Initially *job should be NULL. ctx should point to an ASYNC_WAIT_CTX object created through the ASYNC_WAIT_CTX_new(3) function. ret should point to a location where the return value of the asynchronous function should be stored on completion of the job. func represents the function that should be started asynchronously. The data pointed to by args and of size size will be copied and then passed as an argument to func when the job starts. ASYNC_start_job will return one of the following values:

                                                                                                                                      • ASYNC_ERR

                                                                                                                                        An error occurred trying to start the job. Check the OpenSSL error queue (e.g. see ERR_print_errors(3)) for more details.

                                                                                                                                      • ASYNC_NO_JOBS

                                                                                                                                        There are no jobs currently available in the pool. This call can be retried again at a later time.

                                                                                                                                      • ASYNC_PAUSE

                                                                                                                                        The job was successfully started but was \"paused\" before it completed (see ASYNC_pause_job() below). A handle to the job is placed in *job. Other work can be performed (if desired) and the job restarted at a later time. To restart a job call ASYNC_start_job() again passing the job handle in *job. The func, args and size parameters will be ignored when restarting a job. When restarting a job ASYNC_start_job() must be called from the same thread that the job was originally started from.

                                                                                                                                      • ASYNC_FINISH

                                                                                                                                        The job completed. *job will be NULL and the return value from func will be placed in *ret.

                                                                                                                                      At any one time there can be a maximum of one job actively running per thread (you can have many that are paused). ASYNC_get_current_job() can be used to get a pointer to the currently executing ASYNC_JOB. If no job is currently executing then this will return NULL.

                                                                                                                                      If executing within the context of a job (i.e. having been called directly or indirectly by the function \"func\" passed as an argument to ASYNC_start_job()) then ASYNC_pause_job() will immediately return control to the calling application with ASYNC_PAUSE returned from the ASYNC_start_job() call. A subsequent call to ASYNC_start_job passing in the relevant ASYNC_JOB in the *job parameter will resume execution from the ASYNC_pause_job() call. If ASYNC_pause_job() is called whilst not within the context of a job then no action is taken and ASYNC_pause_job() returns immediately.

                                                                                                                                      ASYNC_get_wait_ctx() can be used to get a pointer to the ASYNC_WAIT_CTX for the job. ASYNC_WAIT_CTXs contain two different ways to notify applications that a job is ready to be resumed. One is a \"wait\" file descriptor, and the other is a \"callback\" mechanism.

                                                                                                                                      The \"wait\" file descriptor associated with ASYNC_WAIT_CTX is used for applications to wait for the file descriptor to be ready for \"read\" using a system function call such as select or poll (being ready for \"read\" indicates that the job should be resumed). If no file descriptor is made available then an application will have to periodically \"poll\" the job by attempting to restart it to see if it is ready to continue.

                                                                                                                                      ASYNC_WAIT_CTXs also have a \"callback\" mechanism to notify applications. The callback is set by an application, and it will be automatically called when an engine completes a cryptography operation, so that the application can resume the paused work flow without polling. An engine could be written to look whether the callback has been set. If it has then it would use the callback mechanism in preference to the file descriptor notifications. If a callback is not set then the engine may use file descriptor based notifications. Please note that not all engines may support the callback mechanism, so the callback may not be used even if it has been set. See ASYNC_WAIT_CTX_new() for more details.

                                                                                                                                      The ASYNC_block_pause() function will prevent the currently active job from pausing. The block will remain in place until a subsequent call to ASYNC_unblock_pause(). These functions can be nested, e.g. if you call ASYNC_block_pause() twice then you must call ASYNC_unblock_pause() twice in order to re-enable pausing. If these functions are called while there is no currently active job then they have no effect. This functionality can be useful to avoid deadlock scenarios. For example during the execution of an ASYNC_JOB an application acquires a lock. It then calls some cryptographic function which invokes ASYNC_pause_job(). This returns control back to the code that created the ASYNC_JOB. If that code then attempts to acquire the same lock before resuming the original job then a deadlock can occur. By calling ASYNC_block_pause() immediately after acquiring the lock and ASYNC_unblock_pause() immediately before releasing it then this situation cannot occur.

                                                                                                                                      Some platforms cannot support async operations. The ASYNC_is_capable() function can be used to detect whether the current platform is async capable or not.

                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ASYNC_init_thread returns 1 on success or 0 otherwise.

                                                                                                                                      ASYNC_start_job returns one of ASYNC_ERR, ASYNC_NO_JOBS, ASYNC_PAUSE or ASYNC_FINISH as described above.

                                                                                                                                      ASYNC_pause_job returns 0 if an error occurred or 1 on success. If called when not within the context of an ASYNC_JOB then this is counted as success so 1 is returned.

                                                                                                                                      ASYNC_get_current_job returns a pointer to the currently executing ASYNC_JOB or NULL if not within the context of a job.

                                                                                                                                      ASYNC_get_wait_ctx() returns a pointer to the ASYNC_WAIT_CTX for the job.

                                                                                                                                      ASYNC_is_capable() returns 1 if the current platform is async capable or 0 otherwise.

                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#notes","title":"NOTES","text":"

                                                                                                                                      On Windows platforms the <openssl/async.h> header is dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/async.h>.

                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The following example demonstrates how to use most of the core async APIs:

                                                                                                                                      #ifdef _WIN32\n

                                                                                                                                      # # include #endif #include #include #include #include

                                                                                                                                      int unique = 0;\n\nvoid cleanup(ASYNC_WAIT_CTX *ctx, const void *key, OSSL_ASYNC_FD r, void *vw)\n{\n    OSSL_ASYNC_FD *w = (OSSL_ASYNC_FD *)vw;\n\n    close(r);\n    close(*w);\n    OPENSSL_free(w);\n}\n\nint jobfunc(void *arg)\n{\n    ASYNC_JOB *currjob;\n    unsigned char *msg;\n    int pipefds[2] = {0, 0};\n    OSSL_ASYNC_FD *wptr;\n    char buf = 'X';\n\n    currjob = ASYNC_get_current_job();\n    if (currjob != NULL) {\n        printf(\"Executing within a job\\n\");\n    } else {\n        printf(\"Not executing within a job - should not happen\\n\");\n        return 0;\n    }\n\n    msg = (unsigned char *)arg;\n    printf(\"Passed in message is: %s\\n\", msg);\n\n    if (pipe(pipefds) != 0) {\n        printf(\"Failed to create pipe\\n\");\n        return 0;\n    }\n    wptr = OPENSSL_malloc(sizeof(OSSL_ASYNC_FD));\n    if (wptr == NULL) {\n        printf(\"Failed to malloc\\n\");\n        return 0;\n    }\n    *wptr = pipefds[1];\n    ASYNC_WAIT_CTX_set_wait_fd(ASYNC_get_wait_ctx(currjob), &unique,\n                               pipefds[0], wptr, cleanup);\n\n    /*\n     * Normally some external event would cause this to happen at some\n     * later point - but we do it here for demo purposes, i.e.\n     * immediately signalling that the job is ready to be woken up after\n     * we return to main via ASYNC_pause_job().\n     */\n    write(pipefds[1], &buf, 1);\n\n    /* Return control back to main */\n    ASYNC_pause_job();\n\n    /* Clear the wake signal */\n    read(pipefds[0], &buf, 1);\n\n    printf (\"Resumed the job after a pause\\n\");\n\n    return 1;\n}\n\nint main(void)\n{\n    ASYNC_JOB *job = NULL;\n    ASYNC_WAIT_CTX *ctx = NULL;\n    int ret;\n    OSSL_ASYNC_FD waitfd;\n    fd_set waitfdset;\n    size_t numfds;\n    unsigned char msg[13] = \"Hello world!\";\n\n    printf(\"Starting...\\n\");\n\n    ctx = ASYNC_WAIT_CTX_new();\n    if (ctx == NULL) {\n        printf(\"Failed to create ASYNC_WAIT_CTX\\n\");\n        abort();\n    }\n\n    for (;;) {\n        switch (ASYNC_start_job(&job, ctx, &ret, jobfunc, msg, sizeof(msg))) {\n        case ASYNC_ERR:\n        case ASYNC_NO_JOBS:\n            printf(\"An error occurred\\n\");\n            goto end;\n        case ASYNC_PAUSE:\n            printf(\"Job was paused\\n\");\n            break;\n        case ASYNC_FINISH:\n            printf(\"Job finished with return value %d\\n\", ret);\n            goto end;\n        }\n\n        /* Wait for the job to be woken */\n        printf(\"Waiting for the job to be woken up\\n\");\n\n        if (!ASYNC_WAIT_CTX_get_all_fds(ctx, NULL, &numfds)\n                || numfds > 1) {\n            printf(\"Unexpected number of fds\\n\");\n            abort();\n        }\n        ASYNC_WAIT_CTX_get_all_fds(ctx, &waitfd, &numfds);\n        FD_ZERO(&waitfdset);\n        FD_SET(waitfd, &waitfdset);\n        select(waitfd + 1, &waitfdset, NULL, NULL, NULL);\n    }\n\nend:\n    ASYNC_WAIT_CTX_free(ctx);\n    printf(\"Finishing\\n\");\n\n    return 0;\n}\n

                                                                                                                                      The expected output from executing the above example program is:

                                                                                                                                      Starting...\nExecuting within a job\nPassed in message is: Hello world!\nJob was paused\nWaiting for the job to be woken up\nResumed the job after a pause\nJob finished with return value 1\nFinishing\n
                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), ERR_print_errors(3)

                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#history","title":"HISTORY","text":"

                                                                                                                                      ASYNC_init_thread, ASYNC_cleanup_thread, ASYNC_start_job, ASYNC_pause_job, ASYNC_get_current_job, ASYNC_get_wait_ctx(), ASYNC_block_pause(), ASYNC_unblock_pause() and ASYNC_is_capable() were first added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/ASYNC_start_job/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BF_encrypt/","title":"BF_encrypt","text":""},{"location":"man3/BF_encrypt/#name","title":"NAME","text":"

                                                                                                                                      BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt, BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption

                                                                                                                                      "},{"location":"man3/BF_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/blowfish.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void BF_set_key(BF_KEY *key, int len, const unsigned char *data);\n\nvoid BF_ecb_encrypt(const unsigned char *in, unsigned char *out,\n                    BF_KEY *key, int enc);\nvoid BF_cbc_encrypt(const unsigned char *in, unsigned char *out,\n                    long length, BF_KEY *schedule,\n                    unsigned char *ivec, int enc);\nvoid BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                      long length, BF_KEY *schedule,\n                      unsigned char *ivec, int *num, int enc);\nvoid BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                      long length, BF_KEY *schedule,\n                      unsigned char *ivec, int *num);\nconst char *BF_options(void);\n\nvoid BF_encrypt(BF_LONG *data, const BF_KEY *key);\nvoid BF_decrypt(BF_LONG *data, const BF_KEY *key);\n
                                                                                                                                      "},{"location":"man3/BF_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) or the equivalently named decrypt functions.

                                                                                                                                      This library implements the Blowfish cipher, which was invented and described by Counterpane (see http://www.counterpane.com/blowfish.html ).

                                                                                                                                      Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. It uses a variable size key, but typically, 128 bit (16 byte) keys are considered good for strong encryption. Blowfish can be used in the same modes as DES (see des_modes(7)). Blowfish is currently one of the faster block ciphers. It is quite a bit faster than DES, and much faster than IDEA or RC2.

                                                                                                                                      Blowfish consists of a key setup phase and the actual encryption or decryption phase.

                                                                                                                                      BF_set_key() sets up the BF_KEY key using the len bytes long key at data.

                                                                                                                                      BF_ecb_encrypt() is the basic Blowfish encryption and decryption function. It encrypts or decrypts the first 64 bits of in using the key key, putting the result in out. enc decides if encryption (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed. The vector pointed at by in and out must be 64 bits in length, no less. If they are larger, everything after the first 64 bits is ignored.

                                                                                                                                      The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt() all operate on variable length data. They all take an initialization vector ivec which needs to be passed along into the next call of the same function for the same message. ivec may be initialized with anything, but the recipient needs to know what it was initialized with, or it won't be able to decrypt. Some programs and protocols simplify this, like SSH, where ivec is simply initialized to zero. BF_cbc_encrypt() operates on data that is a multiple of 8 bytes long, while BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt a variable number of bytes (the amount does not have to be an exact multiple of 8). The purpose of the latter two is to simulate stream ciphers, and therefore, they need the parameter num, which is a pointer to an integer where the current offset in ivec is stored between calls. This integer must be initialized to zero when ivec is initialized.

                                                                                                                                      BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It encrypts or decrypts the 64 bits chunks of in using the key schedule, putting the result in out. enc decides if encryption (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed. ivec must point at an 8 byte long initialization vector.

                                                                                                                                      BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback. It encrypts or decrypts the bytes in in using the key schedule, putting the result in out. enc decides if encryption (BF_ENCRYPT) or decryption (BF_DECRYPT) shall be performed. ivec must point at an 8 byte long initialization vector. num must point at an integer which must be initially zero.

                                                                                                                                      BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback. It uses the same parameters as BF_cfb64_encrypt(), which must be initialized the same way.

                                                                                                                                      BF_encrypt() and BF_decrypt() are the lowest level functions for Blowfish encryption. They encrypt/decrypt the first 64 bits of the vector pointed by data, using the key key. These functions should not be used unless you implement 'modes' of Blowfish. The alternative is to use BF_ecb_encrypt(). If you still want to use these functions, you should be aware that they take each 32-bit chunk in host-byte order, which is little-endian on little-endian platforms and big-endian on big-endian ones.

                                                                                                                                      "},{"location":"man3/BF_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      None of the functions presented here return any value.

                                                                                                                                      "},{"location":"man3/BF_encrypt/#note","title":"NOTE","text":"

                                                                                                                                      Applications should use the higher level functions EVP_EncryptInit(3) etc. instead of calling these functions directly.

                                                                                                                                      "},{"location":"man3/BF_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_EncryptInit(3), des_modes(7)

                                                                                                                                      "},{"location":"man3/BF_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/BF_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_ADDR/","title":"BIO_ADDR","text":""},{"location":"man3/BIO_ADDR/#name","title":"NAME","text":"

                                                                                                                                      BIO_ADDR, BIO_ADDR_new, BIO_ADDR_clear, BIO_ADDR_free, BIO_ADDR_rawmake, BIO_ADDR_family, BIO_ADDR_rawaddress, BIO_ADDR_rawport, BIO_ADDR_hostname_string, BIO_ADDR_service_string, BIO_ADDR_path_string - BIO_ADDR routines

                                                                                                                                      "},{"location":"man3/BIO_ADDR/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <sys/types.h>\n#include <openssl/bio.h>\n\ntypedef union bio_addr_st BIO_ADDR;\n\nBIO_ADDR *BIO_ADDR_new(void);\nvoid BIO_ADDR_free(BIO_ADDR *);\nvoid BIO_ADDR_clear(BIO_ADDR *ap);\nint BIO_ADDR_rawmake(BIO_ADDR *ap, int family,\n                     const void *where, size_t wherelen, unsigned short port);\nint BIO_ADDR_family(const BIO_ADDR *ap);\nint BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l);\nunsigned short BIO_ADDR_rawport(const BIO_ADDR *ap);\nchar *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric);\nchar *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric);\nchar *BIO_ADDR_path_string(const BIO_ADDR *ap);\n
                                                                                                                                      "},{"location":"man3/BIO_ADDR/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The BIO_ADDR type is a wrapper around all types of socket addresses that OpenSSL deals with, currently transparently supporting AF_INET, AF_INET6 and AF_UNIX according to what's available on the platform at hand.

                                                                                                                                      BIO_ADDR_new() creates a new unfilled BIO_ADDR, to be used with routines that will fill it with information, such as BIO_accept_ex().

                                                                                                                                      BIO_ADDR_free() frees a BIO_ADDR created with BIO_ADDR_new(). If the argument is NULL, nothing is done.

                                                                                                                                      BIO_ADDR_clear() clears any data held within the provided BIO_ADDR and sets it back to an uninitialised state.

                                                                                                                                      BIO_ADDR_rawmake() takes a protocol family, a byte array of size wherelen with an address in network byte order pointed at by where and a port number in network byte order in port (except for the AF_UNIX protocol family, where port is meaningless and therefore ignored) and populates the given BIO_ADDR with them. In case this creates a AF_UNIX BIO_ADDR, wherelen is expected to be the length of the path string (not including the terminating NUL, such as the result of a call to strlen()). Read on about the addresses in \"RAW ADDRESSES\" below.

                                                                                                                                      BIO_ADDR_family() returns the protocol family of the given BIO_ADDR. The possible non-error results are one of the constants AF_INET, AF_INET6 and AF_UNIX. It will also return AF_UNSPEC if the BIO_ADDR has not been initialised.

                                                                                                                                      BIO_ADDR_rawaddress() will write the raw address of the given BIO_ADDR in the area pointed at by p if p is non-NULL, and will set *l to be the amount of bytes the raw address takes up if l is non-NULL. A technique to only find out the size of the address is a call with p set to NULL. The raw address will be in network byte order, most significant byte first. In case this is a AF_UNIX BIO_ADDR, l gets the length of the path string (not including the terminating NUL, such as the result of a call to strlen()). Read on about the addresses in \"RAW ADDRESSES\" below.

                                                                                                                                      BIO_ADDR_rawport() returns the raw port of the given BIO_ADDR. The raw port will be in network byte order.

                                                                                                                                      BIO_ADDR_hostname_string() returns a character string with the hostname of the given BIO_ADDR. If numeric is 1, the string will contain the numerical form of the address. This only works for BIO_ADDR of the protocol families AF_INET and AF_INET6. The returned string has been allocated on the heap and must be freed with OPENSSL_free().

                                                                                                                                      BIO_ADDR_service_string() returns a character string with the service name of the port of the given BIO_ADDR. If numeric is 1, the string will contain the port number. This only works for BIO_ADDR of the protocol families AF_INET and AF_INET6. The returned string has been allocated on the heap and must be freed with OPENSSL_free().

                                                                                                                                      BIO_ADDR_path_string() returns a character string with the path of the given BIO_ADDR. This only works for BIO_ADDR of the protocol family AF_UNIX. The returned string has been allocated on the heap and must be freed with OPENSSL_free().

                                                                                                                                      "},{"location":"man3/BIO_ADDR/#raw-addresses","title":"RAW ADDRESSES","text":"

                                                                                                                                      Both BIO_ADDR_rawmake() and BIO_ADDR_rawaddress() take a pointer to a network byte order address of a specific site. Internally, those are treated as a pointer to struct in_addr (for AF_INET), struct in6_addr (for AF_INET6) or char * (for AF_UNIX), all depending on the protocol family the address is for.

                                                                                                                                      "},{"location":"man3/BIO_ADDR/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The string producing functions BIO_ADDR_hostname_string(), BIO_ADDR_service_string() and BIO_ADDR_path_string() will return NULL on error and leave an error indication on the OpenSSL error stack.

                                                                                                                                      All other functions described here return 0 or NULL when the information they should return isn't available.

                                                                                                                                      "},{"location":"man3/BIO_ADDR/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_connect(3), BIO_s_connect(3)

                                                                                                                                      "},{"location":"man3/BIO_ADDR/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_ADDRINFO/","title":"BIO_ADDRINFO","text":""},{"location":"man3/BIO_ADDRINFO/#name","title":"NAME","text":"

                                                                                                                                      BIO_lookup_type, BIO_ADDRINFO, BIO_ADDRINFO_next, BIO_ADDRINFO_free, BIO_ADDRINFO_family, BIO_ADDRINFO_socktype, BIO_ADDRINFO_protocol, BIO_ADDRINFO_address, BIO_lookup_ex, BIO_lookup - BIO_ADDRINFO type and routines

                                                                                                                                      "},{"location":"man3/BIO_ADDRINFO/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <sys/types.h>\n#include <openssl/bio.h>\n\ntypedef union bio_addrinfo_st BIO_ADDRINFO;\n\nenum BIO_lookup_type {\n    BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER\n};\n\nint BIO_lookup_ex(const char *host, const char *service, int lookup_type,\n                  int family, int socktype, int protocol, BIO_ADDRINFO **res);\nint BIO_lookup(const char *host, const char *service,\n               enum BIO_lookup_type lookup_type,\n               int family, int socktype, BIO_ADDRINFO **res);\n\nconst BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai);\nint BIO_ADDRINFO_family(const BIO_ADDRINFO *bai);\nint BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai);\nint BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai);\nconst BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai);\nvoid BIO_ADDRINFO_free(BIO_ADDRINFO *bai);\n
                                                                                                                                      "},{"location":"man3/BIO_ADDRINFO/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The BIO_ADDRINFO type is a wrapper for address information types provided on your platform.

                                                                                                                                      BIO_ADDRINFO normally forms a chain of several that can be picked at one by one.

                                                                                                                                      BIO_lookup_ex() looks up a specified host and service, and uses lookup_type to determine what the default address should be if host is NULL. family, socktype and protocol are used to determine what protocol family, socket type and protocol should be used for the lookup. family can be any of AF_INET, AF_INET6, AF_UNIX and AF_UNSPEC. socktype can be SOCK_STREAM, SOCK_DGRAM or 0. Specifying 0 indicates that any type can be used. protocol specifies a protocol such as IPPROTO_TCP, IPPROTO_UDP or IPPORTO_SCTP. If set to 0 than any protocol can be used. res points at a pointer to hold the start of a BIO_ADDRINFO chain.

                                                                                                                                      For the family AF_UNIX, BIO_lookup_ex() will ignore the service parameter and expects the host parameter to hold the path to the socket file.

                                                                                                                                      BIO_lookup() does the same as BIO_lookup_ex() but does not provide the ability to select based on the protocol (any protocol may be returned).

                                                                                                                                      BIO_ADDRINFO_family() returns the family of the given BIO_ADDRINFO. The result will be one of the constants AF_INET, AF_INET6 and AF_UNIX.

                                                                                                                                      BIO_ADDRINFO_socktype() returns the socket type of the given BIO_ADDRINFO. The result will be one of the constants SOCK_STREAM and SOCK_DGRAM.

                                                                                                                                      BIO_ADDRINFO_protocol() returns the protocol id of the given BIO_ADDRINFO. The result will be one of the constants IPPROTO_TCP and IPPROTO_UDP.

                                                                                                                                      BIO_ADDRINFO_address() returns the underlying BIO_ADDR of the given BIO_ADDRINFO.

                                                                                                                                      BIO_ADDRINFO_next() returns the next BIO_ADDRINFO in the chain from the given one.

                                                                                                                                      BIO_ADDRINFO_free() frees the chain of BIO_ADDRINFO starting with the given one. If the argument is NULL, nothing is done.

                                                                                                                                      "},{"location":"man3/BIO_ADDRINFO/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_lookup_ex() and BIO_lookup() return 1 on success and 0 when an error occurred, and will leave an error indication on the OpenSSL error stack in that case.

                                                                                                                                      All other functions described here return 0 or NULL when the information they should return isn't available.

                                                                                                                                      "},{"location":"man3/BIO_ADDRINFO/#notes","title":"NOTES","text":"

                                                                                                                                      The BIO_lookup_ex() implementation uses the platform provided getaddrinfo() function. On Linux it is known that specifying 0 for the protocol will not return any SCTP based addresses when calling getaddrinfo(). Therefore, if an SCTP address is required then the protocol parameter to BIO_lookup_ex() should be explicitly set to IPPROTO_SCTP. The same may be true on other platforms.

                                                                                                                                      "},{"location":"man3/BIO_ADDRINFO/#history","title":"HISTORY","text":"

                                                                                                                                      The BIO_lookup_ex() function was added in OpenSSL 1.1.1.

                                                                                                                                      "},{"location":"man3/BIO_ADDRINFO/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_connect/","title":"BIO_connect","text":""},{"location":"man3/BIO_connect/#name","title":"NAME","text":"

                                                                                                                                      BIO_socket, BIO_bind, BIO_connect, BIO_listen, BIO_accept_ex, BIO_closesocket - BIO socket communication setup routines

                                                                                                                                      "},{"location":"man3/BIO_connect/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nint BIO_socket(int domain, int socktype, int protocol, int options);\nint BIO_bind(int sock, const BIO_ADDR *addr, int options);\nint BIO_connect(int sock, const BIO_ADDR *addr, int options);\nint BIO_listen(int sock, const BIO_ADDR *addr, int options);\nint BIO_accept_ex(int accept_sock, BIO_ADDR *peer, int options);\nint BIO_closesocket(int sock);\n
                                                                                                                                      "},{"location":"man3/BIO_connect/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_socket() creates a socket in the domain domain, of type socktype and protocol. Socket options are currently unused, but is present for future use.

                                                                                                                                      BIO_bind() binds the source address and service to a socket and may be useful before calling BIO_connect(). The options may include BIO_SOCK_REUSEADDR, which is described in \"FLAGS\" below.

                                                                                                                                      BIO_connect() connects sock to the address and service given by addr. Connection options may be zero or any combination of BIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK and BIO_SOCK_NODELAY. The flags are described in \"FLAGS\" below.

                                                                                                                                      BIO_listen() has sock start listening on the address and service given by addr. Connection options may be zero or any combination of BIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK, BIO_SOCK_NODELAY, BIO_SOCK_REUSEADDR and BIO_SOCK_V6_ONLY. The flags are described in \"FLAGS\" below.

                                                                                                                                      BIO_accept_ex() waits for an incoming connections on the given socket accept_sock. When it gets a connection, the address and port of the peer gets stored in peer if that one is non-NULL. Accept options may be zero or BIO_SOCK_NONBLOCK, and is applied on the accepted socket. The flags are described in \"FLAGS\" below.

                                                                                                                                      BIO_closesocket() closes sock.

                                                                                                                                      "},{"location":"man3/BIO_connect/#flags","title":"FLAGS","text":"
                                                                                                                                      • BIO_SOCK_KEEPALIVE

                                                                                                                                        Enables regular sending of keep-alive messages.

                                                                                                                                      • BIO_SOCK_NONBLOCK

                                                                                                                                        Sets the socket to nonblocking mode.

                                                                                                                                      • BIO_SOCK_NODELAY

                                                                                                                                        Corresponds to TCP_NODELAY, and disables the Nagle algorithm. With this set, any data will be sent as soon as possible instead of being buffered until there's enough for the socket to send out in one go.

                                                                                                                                      • BIO_SOCK_REUSEADDR

                                                                                                                                        Try to reuse the address and port combination for a recently closed port.

                                                                                                                                      • BIO_SOCK_V6_ONLY

                                                                                                                                        When creating an IPv6 socket, make it only listen for IPv6 addresses and not IPv4 addresses mapped to IPv6.

                                                                                                                                      These flags are bit flags, so they are to be combined with the | operator, for example:

                                                                                                                                      BIO_connect(sock, addr, BIO_SOCK_KEEPALIVE | BIO_SOCK_NONBLOCK);\n
                                                                                                                                      "},{"location":"man3/BIO_connect/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_socket() returns the socket number on success or INVALID_SOCKET (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

                                                                                                                                      BIO_bind(), BIO_connect() and BIO_listen() return 1 on success or 0 on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

                                                                                                                                      BIO_accept_ex() returns the accepted socket on success or INVALID_SOCKET (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

                                                                                                                                      "},{"location":"man3/BIO_connect/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_ADDR(3)

                                                                                                                                      "},{"location":"man3/BIO_connect/#history","title":"HISTORY","text":"

                                                                                                                                      BIO_gethostname(), BIO_get_port(), BIO_get_host_ip(), BIO_get_accept_socket() and BIO_accept() were deprecated in OpenSSL 1.1.0. Use the functions described above instead.

                                                                                                                                      "},{"location":"man3/BIO_connect/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_ctrl/","title":"BIO_ctrl","text":""},{"location":"man3/BIO_ctrl/#name","title":"NAME","text":"

                                                                                                                                      BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send, BIO_get_ktls_recv - BIO control operations

                                                                                                                                      "},{"location":"man3/BIO_ctrl/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\ntypedef int BIO_info_cb(BIO *b, int state, int res);\n\nlong BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);\nlong BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *cb);\nvoid *BIO_ptr_ctrl(BIO *bp, int cmd, long larg);\nlong BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);\n\nint BIO_reset(BIO *b);\nint BIO_seek(BIO *b, int ofs);\nint BIO_tell(BIO *b);\nint BIO_flush(BIO *b);\nint BIO_eof(BIO *b);\nint BIO_set_close(BIO *b, long flag);\nint BIO_get_close(BIO *b);\nint BIO_pending(BIO *b);\nint BIO_wpending(BIO *b);\nsize_t BIO_ctrl_pending(BIO *b);\nsize_t BIO_ctrl_wpending(BIO *b);\n\nint BIO_get_info_callback(BIO *b, BIO_info_cb **cbp);\nint BIO_set_info_callback(BIO *b, BIO_info_cb *cb);\n\nint BIO_get_ktls_send(BIO *b);\nint BIO_get_ktls_recv(BIO *b);\n
                                                                                                                                      "},{"location":"man3/BIO_ctrl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_ctrl(), BIO_callback_ctrl(), BIO_ptr_ctrl() and BIO_int_ctrl() are BIO \"control\" operations taking arguments of various types. These functions are not normally called directly, various macros are used instead. The standard macros are described below, macros specific to a particular type of BIO are described in the specific BIOs manual page as well as any special features of the standard calls.

                                                                                                                                      BIO_reset() typically resets a BIO to some initial state, in the case of file related BIOs for example it rewinds the file pointer to the start of the file.

                                                                                                                                      BIO_seek() resets a file related BIO's (that is file descriptor and FILE BIOs) file position pointer to ofs bytes from start of file.

                                                                                                                                      BIO_tell() returns the current file position of a file related BIO.

                                                                                                                                      BIO_flush() normally writes out any internally buffered data, in some cases it is used to signal EOF and that no more data will be written.

                                                                                                                                      BIO_eof() returns 1 if the BIO has read EOF, the precise meaning of \"EOF\" varies according to the BIO type.

                                                                                                                                      BIO_set_close() sets the BIO b close flag to flag. flag can take the value BIO_CLOSE or BIO_NOCLOSE. Typically BIO_CLOSE is used in a source/sink BIO to indicate that the underlying I/O stream should be closed when the BIO is freed.

                                                                                                                                      BIO_get_close() returns the BIOs close flag.

                                                                                                                                      BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() return the number of pending characters in the BIOs read and write buffers. Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending() return a size_t type and are functions, BIO_pending() and BIO_wpending() are macros which call BIO_ctrl().

                                                                                                                                      BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for sending. Otherwise, it returns zero. BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for receiving. Otherwise, it returns zero.

                                                                                                                                      "},{"location":"man3/BIO_ctrl/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_reset() normally returns 1 for success and <=0 for failure. File BIOs are an exception, they return 0 for success and -1 for failure.

                                                                                                                                      BIO_seek() and BIO_tell() both return the current file position on success and -1 for failure, except file BIOs which for BIO_seek() always return 0 for success and -1 for failure.

                                                                                                                                      BIO_flush() returns 1 for success and <=0 for failure.

                                                                                                                                      BIO_eof() returns 1 if EOF has been reached, 0 if not, or negative values for failure.

                                                                                                                                      BIO_set_close() returns 1 on success or <=0 for failure.

                                                                                                                                      BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE. It also returns other negative values if an error occurs.

                                                                                                                                      BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() return the amount of pending data. BIO_pending() and BIO_wpending() return negative value or 0 on error. BIO_ctrl_pending() and BIO_ctrl_wpending() return 0 on error.

                                                                                                                                      BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for sending. Otherwise, it returns zero. BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for receiving. Otherwise, it returns zero.

                                                                                                                                      "},{"location":"man3/BIO_ctrl/#notes","title":"NOTES","text":"

                                                                                                                                      BIO_flush(), because it can write data may return 0 or -1 indicating that the call should be retried later in a similar manner to BIO_write_ex(). The BIO_should_retry() call should be used and appropriate action taken is the call fails.

                                                                                                                                      The return values of BIO_pending() and BIO_wpending() may not reliably determine the amount of pending data in all cases. For example in the case of a file BIO some data may be available in the FILE structures internal buffers but it is not possible to determine this in a portably way. For other types of BIO they may not be supported.

                                                                                                                                      Filter BIOs if they do not internally handle a particular BIO_ctrl() operation usually pass the operation to the next BIO in the chain. This often means there is no need to locate the required BIO for a particular operation, it can be called on a chain and it will be automatically passed to the relevant BIO. However, this can cause unexpected results: for example no current filter BIOs implement BIO_seek(), but this may still succeed if the chain ends in a FILE or file descriptor BIO.

                                                                                                                                      Source/sink BIOs return an 0 if they do not recognize the BIO_ctrl() operation.

                                                                                                                                      "},{"location":"man3/BIO_ctrl/#bugs","title":"BUGS","text":"

                                                                                                                                      Some of the return values are ambiguous and care should be taken. In particular a return value of 0 can be returned if an operation is not supported, if an error occurred, if EOF has not been reached and in the case of BIO_seek() on a file BIO for a successful operation.

                                                                                                                                      In older versions of OpenSSL the BIO_ctrl_pending() and BIO_ctrl_wpending() could return values greater than INT_MAX on error.

                                                                                                                                      "},{"location":"man3/BIO_ctrl/#history","title":"HISTORY","text":"

                                                                                                                                      The BIO_get_ktls_send() and BIO_get_ktls_recv() macros were added in OpenSSL 3.0. They were modified to never return -1 in OpenSSL 3.0.4.

                                                                                                                                      "},{"location":"man3/BIO_ctrl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_base64/","title":"BIO_f_base64","text":""},{"location":"man3/BIO_f_base64/#name","title":"NAME","text":"

                                                                                                                                      BIO_f_base64 - base64 BIO filter

                                                                                                                                      "},{"location":"man3/BIO_f_base64/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n#include <openssl/evp.h>\n\nconst BIO_METHOD *BIO_f_base64(void);\n
                                                                                                                                      "},{"location":"man3/BIO_f_base64/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_base64() returns the base64 BIO method. This is a filter BIO that base64 encodes any data written through it and decodes any data read through it.

                                                                                                                                      Base64 BIOs do not support BIO_gets() or BIO_puts().

                                                                                                                                      For writing, by default output is divided to lines of length 64 characters and there is a newline at the end of output. This behavior can be changed with BIO_FLAGS_BASE64_NO_NL flag.

                                                                                                                                      For reading, first line should be at most 1024 bytes long including newline unless the flag BIO_FLAGS_BASE64_NO_NL is set. Further input lines can be of any length (i.e., newlines may appear anywhere in the input) and a newline at the end of input is not needed.

                                                                                                                                      BIO_flush() on a base64 BIO that is being written through is used to signal that no more data is to be encoded: this is used to flush the final block through the BIO.

                                                                                                                                      The flag BIO_FLAGS_BASE64_NO_NL can be set with BIO_set_flags(). For writing, it causes all data to be written on one line without newline at the end. For reading, it removes all expectations on newlines in the input data.

                                                                                                                                      "},{"location":"man3/BIO_f_base64/#notes","title":"NOTES","text":"

                                                                                                                                      Because of the format of base64 encoding the end of the encoded block cannot always be reliably determined.

                                                                                                                                      "},{"location":"man3/BIO_f_base64/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_base64() returns the base64 BIO method.

                                                                                                                                      "},{"location":"man3/BIO_f_base64/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Base64 encode the string \"Hello World\\n\" and write the result to standard output:

                                                                                                                                      BIO *bio, *b64;\nchar message[] = \"Hello World \\n\";\n\nb64 = BIO_new(BIO_f_base64());\nbio = BIO_new_fp(stdout, BIO_NOCLOSE);\nBIO_push(b64, bio);\nBIO_write(b64, message, strlen(message));\nBIO_flush(b64);\n\nBIO_free_all(b64);\n

                                                                                                                                      Read Base64 encoded data from standard input and write the decoded data to standard output:

                                                                                                                                      BIO *bio, *b64, *bio_out;\nchar inbuf[512];\nint inlen;\n\nb64 = BIO_new(BIO_f_base64());\nbio = BIO_new_fp(stdin, BIO_NOCLOSE);\nbio_out = BIO_new_fp(stdout, BIO_NOCLOSE);\nBIO_push(b64, bio);\nwhile ((inlen = BIO_read(b64, inbuf, 512)) > 0)\n    BIO_write(bio_out, inbuf, inlen);\n\nBIO_flush(bio_out);\nBIO_free_all(b64);\n
                                                                                                                                      "},{"location":"man3/BIO_f_base64/#bugs","title":"BUGS","text":"

                                                                                                                                      On decoding, if the flag BIO_FLAGS_BASE64_NO_NL is not set and the first 1024 bytes of input do not include a newline character the first two lines of input are ignored.

                                                                                                                                      The ambiguity of EOF in base64 encoded data can cause additional data following the base64 encoded block to be misinterpreted.

                                                                                                                                      There should be some way of specifying a test that the BIO can perform to reliably determine EOF (for example a MIME boundary).

                                                                                                                                      "},{"location":"man3/BIO_f_base64/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_buffer/","title":"BIO_f_buffer","text":""},{"location":"man3/BIO_f_buffer/#name","title":"NAME","text":"

                                                                                                                                      BIO_get_buffer_num_lines, BIO_set_read_buffer_size, BIO_set_write_buffer_size, BIO_set_buffer_size, BIO_set_buffer_read_data, BIO_f_buffer - buffering BIO

                                                                                                                                      "},{"location":"man3/BIO_f_buffer/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_buffer(void);\n\nlong BIO_get_buffer_num_lines(BIO *b);\nlong BIO_set_read_buffer_size(BIO *b, long size);\nlong BIO_set_write_buffer_size(BIO *b, long size);\nlong BIO_set_buffer_size(BIO *b, long size);\nlong BIO_set_buffer_read_data(BIO *b, void *buf, long num);\n
                                                                                                                                      "},{"location":"man3/BIO_f_buffer/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_buffer() returns the buffering BIO method.

                                                                                                                                      Data written to a buffering BIO is buffered and periodically written to the next BIO in the chain. Data read from a buffering BIO comes from an internal buffer which is filled from the next BIO in the chain. Both BIO_gets() and BIO_puts() are supported.

                                                                                                                                      Calling BIO_reset() on a buffering BIO clears any buffered data.

                                                                                                                                      BIO_get_buffer_num_lines() returns the number of lines currently buffered.

                                                                                                                                      BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() set the read, write or both read and write buffer sizes to size. The initial buffer size is DEFAULT_BUFFER_SIZE, currently 4096. Any attempt to reduce the buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared when the buffer is resized.

                                                                                                                                      BIO_set_buffer_read_data() clears the read buffer and fills it with num bytes of buf. If num is larger than the current buffer size the buffer is expanded.

                                                                                                                                      "},{"location":"man3/BIO_f_buffer/#notes","title":"NOTES","text":"

                                                                                                                                      These functions, other than BIO_f_buffer(), are implemented as macros.

                                                                                                                                      Buffering BIOs implement BIO_read_ex() and BIO_gets() by using BIO_read_ex() operations on the next BIO in the chain and storing the result in an internal buffer, from which bytes are given back to the caller as appropriate for the call; a BIO_gets() is guaranteed to give the caller a whole line, and BIO_read_ex() is guaranteed to give the caller the number of bytes it asks for, unless there's an error or end of communication is reached in the next BIO. By prepending a buffering BIO to a chain it is therefore possible to provide BIO_gets() or exact size BIO_read_ex() functionality if the following BIOs do not support it.

                                                                                                                                      Do not add more than one BIO_f_buffer() to a BIO chain. The result of doing so will force a full read of the size of the internal buffer of the top BIO_f_buffer(), which is 4 KiB at a minimum.

                                                                                                                                      Data is only written to the next BIO in the chain when the write buffer fills or when BIO_flush() is called. It is therefore important to call BIO_flush() whenever any pending data should be written such as when removing a buffering BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate source/sink BIO is non blocking.

                                                                                                                                      "},{"location":"man3/BIO_f_buffer/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_buffer() returns the buffering BIO method.

                                                                                                                                      BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0) or a negative value in case of errors.

                                                                                                                                      BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() return 1 if the buffer was successfully resized or <=0 for failure.

                                                                                                                                      BIO_set_buffer_read_data() returns 1 if the data was set correctly or <=0 if there was an error.

                                                                                                                                      "},{"location":"man3/BIO_f_buffer/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7), BIO_reset(3), BIO_flush(3), BIO_pop(3), BIO_ctrl(3).

                                                                                                                                      "},{"location":"man3/BIO_f_buffer/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_cipher/","title":"BIO_f_cipher","text":""},{"location":"man3/BIO_f_cipher/#name","title":"NAME","text":"

                                                                                                                                      BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx - cipher BIO filter

                                                                                                                                      "},{"location":"man3/BIO_f_cipher/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n#include <openssl/evp.h>\n\nconst BIO_METHOD *BIO_f_cipher(void);\nint BIO_set_cipher(BIO *b, const EVP_CIPHER *cipher,\n                   const unsigned char *key, const unsigned char *iv, int enc);\nint BIO_get_cipher_status(BIO *b);\nint BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx);\n
                                                                                                                                      "},{"location":"man3/BIO_f_cipher/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_cipher() returns the cipher BIO method. This is a filter BIO that encrypts any data written through it, and decrypts any data read from it. It is a BIO wrapper for the cipher routines EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal().

                                                                                                                                      Cipher BIOs do not support BIO_gets() or BIO_puts().

                                                                                                                                      BIO_flush() on an encryption BIO that is being written through is used to signal that no more data is to be encrypted: this is used to flush and possibly pad the final block through the BIO.

                                                                                                                                      BIO_set_cipher() sets the cipher of BIO b to cipher using key key and IV iv. enc should be set to 1 for encryption and zero for decryption.

                                                                                                                                      When reading from an encryption BIO the final block is automatically decrypted and checked when EOF is detected. BIO_get_cipher_status() is a BIO_ctrl() macro which can be called to determine whether the decryption operation was successful.

                                                                                                                                      BIO_get_cipher_ctx() is a BIO_ctrl() macro which retrieves the internal BIO cipher context. The retrieved context can be used in conjunction with the standard cipher routines to set it up. This is useful when BIO_set_cipher() is not flexible enough for the applications needs.

                                                                                                                                      "},{"location":"man3/BIO_f_cipher/#notes","title":"NOTES","text":"

                                                                                                                                      When encrypting BIO_flush() must be called to flush the final block through the BIO. If it is not then the final block will fail a subsequent decrypt.

                                                                                                                                      When decrypting an error on the final block is signaled by a zero return value from the read operation. A successful decrypt followed by EOF will also return zero for the final read. BIO_get_cipher_status() should be called to determine if the decrypt was successful.

                                                                                                                                      As always, if BIO_gets() or BIO_puts() support is needed then it can be achieved by preceding the cipher BIO with a buffering BIO.

                                                                                                                                      "},{"location":"man3/BIO_f_cipher/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_cipher() returns the cipher BIO method.

                                                                                                                                      BIO_set_cipher() returns 1 for success and 0 for failure.

                                                                                                                                      BIO_get_cipher_status() returns 1 for a successful decrypt and <=0 for failure.

                                                                                                                                      BIO_get_cipher_ctx() returns 1 for success and <=0 for failure.

                                                                                                                                      "},{"location":"man3/BIO_f_cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_md/","title":"BIO_f_md","text":""},{"location":"man3/BIO_f_md/#name","title":"NAME","text":"

                                                                                                                                      BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx - message digest BIO filter

                                                                                                                                      "},{"location":"man3/BIO_f_md/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n#include <openssl/evp.h>\n\nconst BIO_METHOD *BIO_f_md(void);\nint BIO_set_md(BIO *b, EVP_MD *md);\nint BIO_get_md(BIO *b, EVP_MD **mdp);\nint BIO_get_md_ctx(BIO *b, EVP_MD_CTX **mdcp);\n
                                                                                                                                      "},{"location":"man3/BIO_f_md/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_md() returns the message digest BIO method. This is a filter BIO that digests any data passed through it. It is a BIO wrapper for the digest routines EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal().

                                                                                                                                      Any data written or read through a digest BIO using BIO_read_ex() and BIO_write_ex() is digested.

                                                                                                                                      BIO_gets(), if its size parameter is large enough finishes the digest calculation and returns the digest value. BIO_puts() is not supported.

                                                                                                                                      BIO_reset() reinitialises a digest BIO.

                                                                                                                                      BIO_set_md() sets the message digest of BIO b to md: this must be called to initialize a digest BIO before any data is passed through it. It is a BIO_ctrl() macro.

                                                                                                                                      BIO_get_md() places a pointer to the digest BIOs digest method in mdp. It is a BIO_ctrl() macro.

                                                                                                                                      BIO_get_md_ctx() returns the digest BIOs context into mdcp.

                                                                                                                                      "},{"location":"man3/BIO_f_md/#notes","title":"NOTES","text":"

                                                                                                                                      The context returned by BIO_get_md_ctx() can be used in calls to EVP_DigestFinal() and also the signature routines EVP_SignFinal() and EVP_VerifyFinal().

                                                                                                                                      The context returned by BIO_get_md_ctx() is an internal context structure. Changes made to this context will affect the digest BIO itself and the context pointer will become invalid when the digest BIO is freed.

                                                                                                                                      After the digest has been retrieved from a digest BIO it must be reinitialized by calling BIO_reset(), or BIO_set_md() before any more data is passed through it.

                                                                                                                                      If an application needs to call BIO_gets() or BIO_puts() through a chain containing digest BIOs then this can be done by prepending a buffering BIO.

                                                                                                                                      Calling BIO_get_md_ctx() will return the context and initialize the BIO state. This allows applications to initialize the context externally if the standard calls such as BIO_set_md() are not sufficiently flexible.

                                                                                                                                      "},{"location":"man3/BIO_f_md/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_md() returns the digest BIO method.

                                                                                                                                      BIO_set_md(), BIO_get_md() and BIO_md_ctx() return 1 for success and <=0 for failure.

                                                                                                                                      "},{"location":"man3/BIO_f_md/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The following example creates a BIO chain containing an SHA1 and MD5 digest BIO and passes the string \"Hello World\" through it. Error checking has been omitted for clarity.

                                                                                                                                      BIO *bio, *mdtmp;\nchar message[] = \"Hello World\";\n\nbio = BIO_new(BIO_s_null());\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_sha1());\n/*\n * For BIO_push() we want to append the sink BIO and keep a note of\n * the start of the chain.\n */\nbio = BIO_push(mdtmp, bio);\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_md5());\nbio = BIO_push(mdtmp, bio);\n/* Note: mdtmp can now be discarded */\nBIO_write(bio, message, strlen(message));\n

                                                                                                                                      The next example digests data by reading through a chain instead:

                                                                                                                                      BIO *bio, *mdtmp;\nchar buf[1024];\nint rdlen;\n\nbio = BIO_new_file(file, \"rb\");\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_sha1());\nbio = BIO_push(mdtmp, bio);\nmdtmp = BIO_new(BIO_f_md());\nBIO_set_md(mdtmp, EVP_md5());\nbio = BIO_push(mdtmp, bio);\ndo {\n    rdlen = BIO_read(bio, buf, sizeof(buf));\n    /* Might want to do something with the data here */\n} while (rdlen > 0);\n

                                                                                                                                      This next example retrieves the message digests from a BIO chain and outputs them. This could be used with the examples above.

                                                                                                                                      BIO *mdtmp;\nunsigned char mdbuf[EVP_MAX_MD_SIZE];\nint mdlen;\nint i;\n\nmdtmp = bio;   /* Assume bio has previously been set up */\ndo {\n    EVP_MD *md;\n\n    mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);\n    if (!mdtmp)\n        break;\n    BIO_get_md(mdtmp, &md);\n    printf(\"%s digest\", OBJ_nid2sn(EVP_MD_get_type(md)));\n    mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE);\n    for (i = 0; i < mdlen; i++) printf(\":%02X\", mdbuf[i]);\n    printf(\"\\n\");\n    mdtmp = BIO_next(mdtmp);\n} while (mdtmp);\n\nBIO_free_all(bio);\n
                                                                                                                                      "},{"location":"man3/BIO_f_md/#bugs","title":"BUGS","text":"

                                                                                                                                      The lack of support for BIO_puts() and the non standard behaviour of BIO_gets() could be regarded as anomalous. It could be argued that BIO_gets() and BIO_puts() should be passed to the next BIO in the chain and digest the data passed through and that digests should be retrieved using a separate BIO_ctrl() call.

                                                                                                                                      "},{"location":"man3/BIO_f_md/#history","title":"HISTORY","text":"

                                                                                                                                      Before OpenSSL 1.0.0., the call to BIO_get_md_ctx() would only work if the BIO was initialized first.

                                                                                                                                      "},{"location":"man3/BIO_f_md/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_null/","title":"BIO_f_null","text":""},{"location":"man3/BIO_f_null/#name","title":"NAME","text":"

                                                                                                                                      BIO_f_null - null filter

                                                                                                                                      "},{"location":"man3/BIO_f_null/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_null(void);\n
                                                                                                                                      "},{"location":"man3/BIO_f_null/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_null() returns the null filter BIO method. This is a filter BIO that does nothing.

                                                                                                                                      All requests to a null filter BIO are passed through to the next BIO in the chain: this means that a BIO chain containing a null filter BIO behaves just as though the BIO was not there.

                                                                                                                                      "},{"location":"man3/BIO_f_null/#notes","title":"NOTES","text":"

                                                                                                                                      As may be apparent a null filter BIO is not particularly useful.

                                                                                                                                      "},{"location":"man3/BIO_f_null/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_null() returns the null filter BIO method.

                                                                                                                                      "},{"location":"man3/BIO_f_null/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_prefix/","title":"BIO_f_prefix","text":""},{"location":"man3/BIO_f_prefix/#name","title":"NAME","text":"

                                                                                                                                      BIO_f_prefix, BIO_set_prefix, BIO_set_indent, BIO_get_indent - prefix BIO filter

                                                                                                                                      "},{"location":"man3/BIO_f_prefix/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_prefix(void);\nlong BIO_set_prefix(BIO *b, const char *prefix);\nlong BIO_set_indent(BIO *b, long indent);\nlong BIO_get_indent(BIO *b);\n
                                                                                                                                      "},{"location":"man3/BIO_f_prefix/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_cipher() returns the prefix BIO method. This is a filter for text output, where each line gets automatically prefixed and indented according to user input.

                                                                                                                                      The prefix and the indentation are combined. For each line of output going through this filter, the prefix is output first, then the amount of additional spaces indicated by the indentation, and then the line itself.

                                                                                                                                      By default, there is no prefix, and indentation is set to 0.

                                                                                                                                      BIO_set_prefix() sets the prefix to be used for future lines of text, using prefix. prefix may be NULL, signifying that there should be no prefix. If prefix isn't NULL, this function makes a copy of it.

                                                                                                                                      BIO_set_indent() sets the indentation to be used for future lines of text, using indent. Negative values are not allowed.

                                                                                                                                      BIO_get_indent() gets the current indentation.

                                                                                                                                      "},{"location":"man3/BIO_f_prefix/#notes","title":"NOTES","text":"

                                                                                                                                      BIO_set_prefix(), BIO_set_indent() and BIO_get_indent() are implemented as macros.

                                                                                                                                      "},{"location":"man3/BIO_f_prefix/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_prefix() returns the prefix BIO method.

                                                                                                                                      BIO_set_prefix() returns 1 if the prefix was correctly set, or <=0 on failure.

                                                                                                                                      BIO_set_indent() returns 1 if the prefix was correctly set, or <=0 on failure.

                                                                                                                                      BIO_get_indent() returns the current indentation, or a negative value for failure.

                                                                                                                                      "},{"location":"man3/BIO_f_prefix/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7)

                                                                                                                                      "},{"location":"man3/BIO_f_prefix/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_readbuffer/","title":"BIO_f_readbuffer","text":""},{"location":"man3/BIO_f_readbuffer/#name","title":"NAME","text":"

                                                                                                                                      BIO_f_readbuffer - read only buffering BIO that supports BIO_tell() and BIO_seek()

                                                                                                                                      "},{"location":"man3/BIO_f_readbuffer/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_f_readbuffer(void);\n
                                                                                                                                      "},{"location":"man3/BIO_f_readbuffer/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_readbuffer() returns the read buffering BIO method.

                                                                                                                                      This BIO filter can be inserted on top of BIO's that do not support BIO_tell() or BIO_seek() (e.g. A file BIO that uses stdin).

                                                                                                                                      Data read from a read buffering BIO comes from an internal buffer which is filled from the next BIO in the chain.

                                                                                                                                      BIO_gets() is supported for read buffering BIOs. Writing data to a read buffering BIO is not supported.

                                                                                                                                      Calling BIO_reset() on a read buffering BIO does not clear any buffered data.

                                                                                                                                      "},{"location":"man3/BIO_f_readbuffer/#notes","title":"NOTES","text":"

                                                                                                                                      Read buffering BIOs implement BIO_read_ex() by using BIO_read_ex() operations on the next BIO (e.g. a file BIO) in the chain and storing the result in an internal buffer, from which bytes are given back to the caller as appropriate for the call. BIO_read_ex() is guaranteed to give the caller the number of bytes it asks for, unless there's an error or end of communication is reached in the next BIO. The internal buffer can grow to cache the entire contents of the next BIO in the chain. BIO_seek() uses the internal buffer, so that it can only seek into data that is already read.

                                                                                                                                      "},{"location":"man3/BIO_f_readbuffer/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_readbuffer() returns the read buffering BIO method.

                                                                                                                                      "},{"location":"man3/BIO_f_readbuffer/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7), BIO_read(3), BIO_gets(3), BIO_reset(3), BIO_ctrl(3).

                                                                                                                                      "},{"location":"man3/BIO_f_readbuffer/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_f_ssl/","title":"BIO_f_ssl","text":""},{"location":"man3/BIO_f_ssl/#name","title":"NAME","text":"

                                                                                                                                      BIO_do_handshake, BIO_f_ssl, BIO_set_ssl, BIO_get_ssl, BIO_set_ssl_mode, BIO_set_ssl_renegotiate_bytes, BIO_get_num_renegotiates, BIO_set_ssl_renegotiate_timeout, BIO_new_ssl, BIO_new_ssl_connect, BIO_new_buffer_ssl_connect, BIO_ssl_copy_session_id, BIO_ssl_shutdown - SSL BIO

                                                                                                                                      "},{"location":"man3/BIO_f_ssl/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n#include <openssl/ssl.h>\n\nconst BIO_METHOD *BIO_f_ssl(void);\n\nlong BIO_set_ssl(BIO *b, SSL *ssl, long c);\nlong BIO_get_ssl(BIO *b, SSL **sslp);\nlong BIO_set_ssl_mode(BIO *b, long client);\nlong BIO_set_ssl_renegotiate_bytes(BIO *b, long num);\nlong BIO_set_ssl_renegotiate_timeout(BIO *b, long seconds);\nlong BIO_get_num_renegotiates(BIO *b);\n\nBIO *BIO_new_ssl(SSL_CTX *ctx, int client);\nBIO *BIO_new_ssl_connect(SSL_CTX *ctx);\nBIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);\nint BIO_ssl_copy_session_id(BIO *to, BIO *from);\nvoid BIO_ssl_shutdown(BIO *bio);\n\nlong BIO_do_handshake(BIO *b);\n
                                                                                                                                      "},{"location":"man3/BIO_f_ssl/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_f_ssl() returns the SSL BIO method. This is a filter BIO which is a wrapper round the OpenSSL SSL routines adding a BIO \"flavour\" to SSL I/O.

                                                                                                                                      I/O performed on an SSL BIO communicates using the SSL protocol with the SSLs read and write BIOs. If an SSL connection is not established then an attempt is made to establish one on the first I/O call.

                                                                                                                                      If a BIO is appended to an SSL BIO using BIO_push() it is automatically used as the SSL BIOs read and write BIOs.

                                                                                                                                      Calling BIO_reset() on an SSL BIO closes down any current SSL connection by calling SSL_shutdown(). BIO_reset() is then sent to the next BIO in the chain: this will typically disconnect the underlying transport. The SSL BIO is then reset to the initial accept or connect state.

                                                                                                                                      If the close flag is set when an SSL BIO is freed then the internal SSL structure is also freed using SSL_free().

                                                                                                                                      BIO_set_ssl() sets the internal SSL pointer of SSL BIO b to ssl using the close flag c.

                                                                                                                                      BIO_get_ssl() retrieves the SSL pointer of SSL BIO b, it can then be manipulated using the standard SSL library functions.

                                                                                                                                      BIO_set_ssl_mode() sets the SSL BIO mode to client. If client is 1 client mode is set. If client is 0 server mode is set.

                                                                                                                                      BIO_set_ssl_renegotiate_bytes() sets the renegotiate byte count of SSL BIO b to num. When set after every num bytes of I/O (read and write) the SSL session is automatically renegotiated. num must be at least 512 bytes.

                                                                                                                                      BIO_set_ssl_renegotiate_timeout() sets the renegotiate timeout of SSL BIO b to seconds. When the renegotiate timeout elapses the session is automatically renegotiated.

                                                                                                                                      BIO_get_num_renegotiates() returns the total number of session renegotiations due to I/O or timeout of SSL BIO b.

                                                                                                                                      BIO_new_ssl() allocates an SSL BIO using SSL_CTX ctx and using client mode if client is non zero.

                                                                                                                                      BIO_new_ssl_connect() creates a new BIO chain consisting of an SSL BIO (using ctx) followed by a connect BIO.

                                                                                                                                      BIO_new_buffer_ssl_connect() creates a new BIO chain consisting of a buffering BIO, an SSL BIO (using ctx), and a connect BIO.

                                                                                                                                      BIO_ssl_copy_session_id() copies an SSL session id between BIO chains from and to. It does this by locating the SSL BIOs in each chain and calling SSL_copy_session_id() on the internal SSL pointer.

                                                                                                                                      BIO_ssl_shutdown() closes down an SSL connection on BIO chain bio. It does this by locating the SSL BIO in the chain and calling SSL_shutdown() on its internal SSL pointer.

                                                                                                                                      BIO_do_handshake() attempts to complete an SSL handshake on the supplied BIO and establish the SSL connection. For non-SSL BIOs the connection is done typically at TCP level. If domain name resolution yields multiple IP addresses all of them are tried after connect() failures. The function returns 1 if the connection was established successfully. A zero or negative value is returned if the connection could not be established. The call BIO_should_retry() should be used for nonblocking connect BIOs to determine if the call should be retried. If a connection has already been established this call has no effect.

                                                                                                                                      "},{"location":"man3/BIO_f_ssl/#notes","title":"NOTES","text":"

                                                                                                                                      SSL BIOs are exceptional in that if the underlying transport is non blocking they can still request a retry in exceptional circumstances. Specifically this will happen if a session renegotiation takes place during a BIO_read_ex() operation, one case where this happens is when step up occurs.

                                                                                                                                      The SSL flag SSL_AUTO_RETRY can be set to disable this behaviour. That is when this flag is set an SSL BIO using a blocking transport will never request a retry.

                                                                                                                                      Since unknown BIO_ctrl() operations are sent through filter BIOs the servers name and port can be set using BIO_set_host() on the BIO returned by BIO_new_ssl_connect() without having to locate the connect BIO first.

                                                                                                                                      Applications do not have to call BIO_do_handshake() but may wish to do so to separate the handshake process from other I/O processing.

                                                                                                                                      BIO_set_ssl(), BIO_get_ssl(), BIO_set_ssl_mode(), BIO_set_ssl_renegotiate_bytes(), BIO_set_ssl_renegotiate_timeout(), BIO_get_num_renegotiates(), and BIO_do_handshake() are implemented as macros.

                                                                                                                                      "},{"location":"man3/BIO_f_ssl/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_f_ssl() returns the SSL BIO_METHOD structure.

                                                                                                                                      BIO_set_ssl(), BIO_get_ssl(), BIO_set_ssl_mode(), BIO_set_ssl_renegotiate_bytes(), BIO_set_ssl_renegotiate_timeout() and BIO_get_num_renegotiates() return 1 on success or a value which is less than or equal to 0 if an error occurred.

                                                                                                                                      BIO_new_ssl(), BIO_new_ssl_connect() and BIO_new_buffer_ssl_connect() return a valid BIO structure on success or NULL if an error occurred.

                                                                                                                                      BIO_ssl_copy_session_id() returns 1 on success or 0 on error.

                                                                                                                                      BIO_do_handshake() returns 1 if the connection was established successfully. A zero or negative value is returned if the connection could not be established.

                                                                                                                                      "},{"location":"man3/BIO_f_ssl/#examples","title":"EXAMPLES","text":"

                                                                                                                                      This SSL/TLS client example attempts to retrieve a page from an SSL/TLS web server. The I/O routines are identical to those of the unencrypted example in BIO_s_connect(3).

                                                                                                                                      BIO *sbio, *out;\nint len;\nchar tmpbuf[1024];\nSSL_CTX *ctx;\nSSL *ssl;\n\n/* XXX Seed the PRNG if needed. */\n\nctx = SSL_CTX_new(TLS_client_method());\n\n/* XXX Set verify paths and mode here. */\n\nsbio = BIO_new_ssl_connect(ctx);\nBIO_get_ssl(sbio, &ssl);\nif (ssl == NULL) {\n    fprintf(stderr, \"Can't locate SSL pointer\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* XXX We might want to do other things with ssl here */\n\n/* An empty host part means the loopback address */\nBIO_set_conn_hostname(sbio, \":https\");\n\nout = BIO_new_fp(stdout, BIO_NOCLOSE);\nif (BIO_do_connect(sbio) <= 0) {\n    fprintf(stderr, \"Error connecting to server\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* XXX Could examine ssl here to get connection info */\n\nBIO_puts(sbio, \"GET / HTTP/1.0\\n\\n\");\nfor (;;) {\n    len = BIO_read(sbio, tmpbuf, 1024);\n    if (len <= 0)\n        break;\n    BIO_write(out, tmpbuf, len);\n}\nBIO_free_all(sbio);\nBIO_free(out);\n

                                                                                                                                      Here is a simple server example. It makes use of a buffering BIO to allow lines to be read from the SSL BIO using BIO_gets. It creates a pseudo web page containing the actual request from a client and also echoes the request to standard output.

                                                                                                                                      BIO *sbio, *bbio, *acpt, *out;\nint len;\nchar tmpbuf[1024];\nSSL_CTX *ctx;\nSSL *ssl;\n\n/* XXX Seed the PRNG if needed. */\n\nctx = SSL_CTX_new(TLS_server_method());\nif (!SSL_CTX_use_certificate_file(ctx, \"server.pem\", SSL_FILETYPE_PEM)\n        || !SSL_CTX_use_PrivateKey_file(ctx, \"server.pem\", SSL_FILETYPE_PEM)\n        || !SSL_CTX_check_private_key(ctx)) {\n    fprintf(stderr, \"Error setting up SSL_CTX\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* XXX Other things like set verify locations, EDH temp callbacks. */\n\n/* New SSL BIO setup as server */\nsbio = BIO_new_ssl(ctx, 0);\nBIO_get_ssl(sbio, &ssl);\nif (ssl == NULL) {\n    fprintf(stderr, \"Can't locate SSL pointer\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\nbbio = BIO_new(BIO_f_buffer());\nsbio = BIO_push(bbio, sbio);\nacpt = BIO_new_accept(\"4433\");\n\n/*\n * By doing this when a new connection is established\n * we automatically have sbio inserted into it. The\n * BIO chain is now 'swallowed' by the accept BIO and\n * will be freed when the accept BIO is freed.\n */\nBIO_set_accept_bios(acpt, sbio);\nout = BIO_new_fp(stdout, BIO_NOCLOSE);\n\n/* First call to BIO_do_accept() sets up accept BIO */\nif (BIO_do_accept(acpt) <= 0) {\n    fprintf(stderr, \"Error setting up accept BIO\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n

                                                                                                                                      /* Second call to BIO_do_accept() waits for incoming connection */ if (BIO_do_accept(acpt) <= 0) { fprintf(stderr, \"Error accepting connection\\n\"); ERR_print_errors_fp(stderr); exit(1); }

                                                                                                                                      /* We only want one connection so remove and free accept BIO */\nsbio = BIO_pop(acpt);\nBIO_free_all(acpt);\n\nif (BIO_do_handshake(sbio) <= 0) {\n    fprintf(stderr, \"Error in SSL handshake\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\nBIO_puts(sbio, \"HTTP/1.0 200 OK\\r\\nContent-type: text/plain\\r\\n\\r\\n\");\nBIO_puts(sbio, \"\\r\\nConnection Established\\r\\nRequest headers:\\r\\n\");\nBIO_puts(sbio, \"--------------------------------------------------\\r\\n\");\n\nfor (;;) {\n    len = BIO_gets(sbio, tmpbuf, 1024);\n    if (len <= 0)\n        break;\n    BIO_write(sbio, tmpbuf, len);\n    BIO_write(out, tmpbuf, len);\n    /* Look for blank line signifying end of headers*/\n    if (tmpbuf[0] == '\\r' || tmpbuf[0] == '\\n')\n        break;\n}\n\nBIO_puts(sbio, \"--------------------------------------------------\\r\\n\");\nBIO_puts(sbio, \"\\r\\n\");\nBIO_flush(sbio);\nBIO_free_all(sbio);\n
                                                                                                                                      "},{"location":"man3/BIO_f_ssl/#history","title":"HISTORY","text":"

                                                                                                                                      In OpenSSL before 1.0.0 the BIO_pop() call was handled incorrectly, the I/O BIO reference count was incorrectly incremented (instead of decremented) and dissociated with the SSL BIO even if the SSL BIO was not explicitly being popped (e.g. a pop higher up the chain). Applications which included workarounds for this bug (e.g. freeing BIOs more than once) should be modified to handle this fix or they may free up an already freed BIO.

                                                                                                                                      "},{"location":"man3/BIO_f_ssl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_find_type/","title":"BIO_find_type","text":""},{"location":"man3/BIO_find_type/#name","title":"NAME","text":"

                                                                                                                                      BIO_find_type, BIO_next, BIO_method_type - BIO chain traversal

                                                                                                                                      "},{"location":"man3/BIO_find_type/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nBIO *BIO_find_type(BIO *b, int bio_type);\nBIO *BIO_next(BIO *b);\nint BIO_method_type(const BIO *b);\n
                                                                                                                                      "},{"location":"man3/BIO_find_type/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The BIO_find_type() searches for a BIO of a given type in a chain, starting at BIO b. If type is a specific type (such as BIO_TYPE_MEM) then a search is made for a BIO of that type. If type is a general type (such as BIO_TYPE_SOURCE_SINK) then the next matching BIO of the given general type is searched for. BIO_find_type() returns the next matching BIO or NULL if none is found.

                                                                                                                                      The following general types are defined: BIO_TYPE_DESCRIPTOR, BIO_TYPE_FILTER, and BIO_TYPE_SOURCE_SINK.

                                                                                                                                      For a list of the specific types, see the <openssl/bio.h> header file.

                                                                                                                                      BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs in a chain or used in conjunction with BIO_find_type() to find all BIOs of a certain type.

                                                                                                                                      BIO_method_type() returns the type of a BIO.

                                                                                                                                      "},{"location":"man3/BIO_find_type/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_find_type() returns a matching BIO or NULL for no match.

                                                                                                                                      BIO_next() returns the next BIO in a chain.

                                                                                                                                      BIO_method_type() returns the type of the BIO b.

                                                                                                                                      "},{"location":"man3/BIO_find_type/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Traverse a chain looking for digest BIOs:

                                                                                                                                      BIO *btmp;\n\nbtmp = in_bio; /* in_bio is chain to search through */\ndo {\n    btmp = BIO_find_type(btmp, BIO_TYPE_MD);\n    if (btmp == NULL)\n        break; /* Not found */\n    /* btmp is a digest BIO, do something with it ...*/\n    ...\n\n    btmp = BIO_next(btmp);\n} while (btmp);\n
                                                                                                                                      "},{"location":"man3/BIO_find_type/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_get_data/","title":"BIO_get_data","text":""},{"location":"man3/BIO_get_data/#name","title":"NAME","text":"

                                                                                                                                      BIO_set_data, BIO_get_data, BIO_set_init, BIO_get_init, BIO_set_shutdown, BIO_get_shutdown - functions for managing BIO state information

                                                                                                                                      "},{"location":"man3/BIO_get_data/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nvoid BIO_set_data(BIO *a, void *ptr);\nvoid *BIO_get_data(BIO *a);\nvoid BIO_set_init(BIO *a, int init);\nint BIO_get_init(BIO *a);\nvoid BIO_set_shutdown(BIO *a, int shut);\nint BIO_get_shutdown(BIO *a);\n
                                                                                                                                      "},{"location":"man3/BIO_get_data/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions are mainly useful when implementing a custom BIO.

                                                                                                                                      The BIO_set_data() function associates the custom data pointed to by ptr with the BIO. This data can subsequently be retrieved via a call to BIO_get_data(). This can be used by custom BIOs for storing implementation specific information.

                                                                                                                                      The BIO_set_init() function sets the value of the BIO's \"init\" flag to indicate whether initialisation has been completed for this BIO or not. A nonzero value indicates that initialisation is complete, whilst zero indicates that it is not. Often initialisation will complete during initial construction of the BIO. For some BIOs however, initialisation may not complete until after additional steps have occurred (for example through calling custom ctrls). The BIO_get_init() function returns the value of the \"init\" flag.

                                                                                                                                      The BIO_set_shutdown() and BIO_get_shutdown() functions set and get the state of this BIO's shutdown (i.e. BIO_CLOSE) flag. If set then the underlying resource is also closed when the BIO is freed.

                                                                                                                                      "},{"location":"man3/BIO_get_data/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_get_data() returns a pointer to the implementation specific custom data associated with this BIO, or NULL if none has been set.

                                                                                                                                      BIO_get_init() returns the state of the BIO's init flag.

                                                                                                                                      BIO_get_shutdown() returns the stat of the BIO's shutdown (i.e. BIO_CLOSE) flag.

                                                                                                                                      "},{"location":"man3/BIO_get_data/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7), BIO_meth_new(3)

                                                                                                                                      "},{"location":"man3/BIO_get_data/#history","title":"HISTORY","text":"

                                                                                                                                      The functions described here were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/BIO_get_data/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_get_ex_new_index/","title":"BIO_get_ex_new_index","text":""},{"location":"man3/BIO_get_ex_new_index/#name","title":"NAME","text":"

                                                                                                                                      BIO_get_ex_new_index, BIO_set_ex_data, BIO_get_ex_data, BIO_set_app_data, BIO_get_app_data, DH_get_ex_new_index, DH_set_ex_data, DH_get_ex_data, DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data, EC_KEY_get_ex_new_index, EC_KEY_set_ex_data, EC_KEY_get_ex_data, ENGINE_get_ex_new_index, ENGINE_set_ex_data, ENGINE_get_ex_data, EVP_PKEY_get_ex_new_index, EVP_PKEY_set_ex_data, EVP_PKEY_get_ex_data, RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data, RSA_set_app_data, RSA_get_app_data, SSL_get_ex_new_index, SSL_set_ex_data, SSL_get_ex_data, SSL_set_app_data, SSL_get_app_data, SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data, SSL_CTX_set_app_data, SSL_CTX_get_app_data, SSL_SESSION_get_ex_new_index, SSL_SESSION_set_ex_data, SSL_SESSION_get_ex_data, SSL_SESSION_set_app_data, SSL_SESSION_get_app_data, UI_get_ex_new_index, UI_set_ex_data, UI_get_ex_data, UI_set_app_data, UI_get_app_data, X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ex_data, X509_STORE_CTX_set_app_data, X509_STORE_CTX_get_app_data, X509_STORE_get_ex_new_index, X509_STORE_set_ex_data, X509_STORE_get_ex_data, X509_get_ex_new_index, X509_set_ex_data, X509_get_ex_data - application-specific data

                                                                                                                                      "},{"location":"man3/BIO_get_ex_new_index/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/x509.h>\n\nint TYPE_get_ex_new_index(long argl, void *argp,\n                          CRYPTO_EX_new *new_func,\n                          CRYPTO_EX_dup *dup_func,\n                          CRYPTO_EX_free *free_func);\n\nint TYPE_set_ex_data(TYPE *d, int idx, void *arg);\n\nvoid *TYPE_get_ex_data(const TYPE *d, int idx);\n\n#define TYPE_set_app_data(TYPE *d, void *arg)\n#define TYPE_get_app_data(TYPE *d)\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                        CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint DH_set_ex_data(DH *type, int idx, void *arg);\nvoid *DH_get_ex_data(DH *type, int idx);\nint DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint DSA_set_ex_data(DSA *type, int idx, void *arg);\nvoid *DSA_get_ex_data(DSA *type, int idx);\nint EC_KEY_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                            CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint EC_KEY_set_ex_data(EC_KEY *type, int idx, void *arg);\nvoid *EC_KEY_get_ex_data(EC_KEY *type, int idx);\nint RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                         CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint RSA_set_ex_data(RSA *type, int idx, void *arg);\nvoid *RSA_get_ex_data(RSA *type, int idx);\nint RSA_set_app_data(RSA *type, void *arg);\nvoid *RSA_get_app_data(RSA *type);\nint ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n                            CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint ENGINE_set_ex_data(ENGINE *type, int idx, void *arg);\nvoid *ENGINE_get_ex_data(ENGINE *type, int idx);\n
                                                                                                                                      "},{"location":"man3/BIO_get_ex_new_index/#description","title":"DESCRIPTION","text":"

                                                                                                                                      In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes listed in CRYPTO_get_ex_new_index(3).

                                                                                                                                      All functions with a TYPE of DH, DSA, RSA and EC_KEY are deprecated. Applications should instead use EVP_PKEY_set_ex_data(), EVP_PKEY_get_ex_data() and EVP_PKEY_get_ex_new_index().

                                                                                                                                      All functions with a TYPE of ENGINE are deprecated. Applications using engines should be replaced by providers.

                                                                                                                                      These functions handle application-specific data for OpenSSL data structures.

                                                                                                                                      TYPE_get_ex_new_index() is a macro that calls CRYPTO_get_ex_new_index() with the correct index value.

                                                                                                                                      TYPE_set_ex_data() is a function that calls CRYPTO_set_ex_data() with an offset into the opaque exdata part of the TYPE object.

                                                                                                                                      TYPE_get_ex_data() is a function that calls CRYPTO_get_ex_data() with an offset into the opaque exdata part of the TYPE object.

                                                                                                                                      For compatibility with previous releases, the exdata index of zero is reserved for \"application data.\" There are two convenience functions for this. TYPE_set_app_data() is a macro that invokes TYPE_set_ex_data() with idx set to zero. TYPE_get_app_data() is a macro that invokes TYPE_get_ex_data() with idx set to zero.

                                                                                                                                      "},{"location":"man3/BIO_get_ex_new_index/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      TYPE_get_ex_new_index() returns a new index on success or -1 on error.

                                                                                                                                      TYPE_set_ex_data() returns 1 on success or 0 on error.

                                                                                                                                      TYPE_get_ex_data() returns the application data or NULL if an error occurred.

                                                                                                                                      "},{"location":"man3/BIO_get_ex_new_index/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      CRYPTO_get_ex_new_index(3).

                                                                                                                                      "},{"location":"man3/BIO_get_ex_new_index/#history","title":"HISTORY","text":"

                                                                                                                                      The functions DH_get_ex_new_index(), DH_set_ex_data(), DH_get_ex_data(), DSA_get_ex_new_index(), DSA_set_ex_data(), DSA_get_ex_data(), EC_KEY_get_ex_new_index(), EC_KEY_set_ex_data(), EC_KEY_get_ex_data(), ENGINE_get_ex_new_index(), ENGINE_set_ex_data(), ENGINE_get_ex_data(), RSA_get_ex_new_index(), RSA_set_ex_data(), RSA_get_ex_data(), RSA_set_app_data() and RSA_get_app_data() were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/BIO_get_ex_new_index/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_meth_new/","title":"BIO_meth_new","text":""},{"location":"man3/BIO_meth_new/#name","title":"NAME","text":"

                                                                                                                                      BIO_get_new_index, BIO_meth_new, BIO_meth_free, BIO_meth_get_read_ex, BIO_meth_set_read_ex, BIO_meth_get_write_ex, BIO_meth_set_write_ex, BIO_meth_get_write, BIO_meth_set_write, BIO_meth_get_read, BIO_meth_set_read, BIO_meth_get_puts, BIO_meth_set_puts, BIO_meth_get_gets, BIO_meth_set_gets, BIO_meth_get_ctrl, BIO_meth_set_ctrl, BIO_meth_get_create, BIO_meth_set_create, BIO_meth_get_destroy, BIO_meth_set_destroy, BIO_meth_get_callback_ctrl, BIO_meth_set_callback_ctrl - Routines to build up BIO methods

                                                                                                                                      "},{"location":"man3/BIO_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nint BIO_get_new_index(void);\n\nBIO_METHOD *BIO_meth_new(int type, const char *name);\n\nvoid BIO_meth_free(BIO_METHOD *biom);\n\nint (*BIO_meth_get_write_ex(const BIO_METHOD *biom))(BIO *, const char *, size_t,\n                                               size_t *);\nint (*BIO_meth_get_write(const BIO_METHOD *biom))(BIO *, const char *, int);\nint BIO_meth_set_write_ex(BIO_METHOD *biom,\n                          int (*bwrite)(BIO *, const char *, size_t, size_t *));\nint BIO_meth_set_write(BIO_METHOD *biom,\n                       int (*write)(BIO *, const char *, int));\n\nint (*BIO_meth_get_read_ex(const BIO_METHOD *biom))(BIO *, char *, size_t, size_t *);\nint (*BIO_meth_get_read(const BIO_METHOD *biom))(BIO *, char *, int);\nint BIO_meth_set_read_ex(BIO_METHOD *biom,\n                         int (*bread)(BIO *, char *, size_t, size_t *));\nint BIO_meth_set_read(BIO_METHOD *biom, int (*read)(BIO *, char *, int));\n\nint (*BIO_meth_get_puts(const BIO_METHOD *biom))(BIO *, const char *);\nint BIO_meth_set_puts(BIO_METHOD *biom, int (*puts)(BIO *, const char *));\n\nint (*BIO_meth_get_gets(const BIO_METHOD *biom))(BIO *, char *, int);\nint BIO_meth_set_gets(BIO_METHOD *biom,\n                      int (*gets)(BIO *, char *, int));\n\nlong (*BIO_meth_get_ctrl(const BIO_METHOD *biom))(BIO *, int, long, void *);\nint BIO_meth_set_ctrl(BIO_METHOD *biom,\n                      long (*ctrl)(BIO *, int, long, void *));\n\nint (*BIO_meth_get_create(const BIO_METHOD *bion))(BIO *);\nint BIO_meth_set_create(BIO_METHOD *biom, int (*create)(BIO *));\n\nint (*BIO_meth_get_destroy(const BIO_METHOD *biom))(BIO *);\nint BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy)(BIO *));\n\nlong (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom))(BIO *, int, BIO_info_cb *);\nint BIO_meth_set_callback_ctrl(BIO_METHOD *biom,\n                               long (*callback_ctrl)(BIO *, int, BIO_info_cb *));\n
                                                                                                                                      "},{"location":"man3/BIO_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The BIO_METHOD type is a structure used for the implementation of new BIO types. It provides a set of functions used by OpenSSL for the implementation of the various BIO capabilities. See the bio(7) page for more information.

                                                                                                                                      BIO_meth_new() creates a new BIO_METHOD structure. It should be given a unique integer type and a string that represents its name. Use BIO_get_new_index() to get the value for type.

                                                                                                                                      The set of standard OpenSSL provided BIO types is provided in <openssl/bio.h>. Some examples include BIO_TYPE_BUFFER and BIO_TYPE_CIPHER. Filter BIOs should have a type which have the \"filter\" bit set (BIO_TYPE_FILTER). Source/sink BIOs should have the \"source/sink\" bit set (BIO_TYPE_SOURCE_SINK). File descriptor based BIOs (e.g. socket, fd, connect, accept etc) should additionally have the \"descriptor\" bit set (BIO_TYPE_DESCRIPTOR). See the BIO_find_type(3) page for more information.

                                                                                                                                      BIO_meth_free() destroys a BIO_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

                                                                                                                                      BIO_meth_get_write_ex() and BIO_meth_set_write_ex() get and set the function used for writing arbitrary length data to the BIO respectively. This function will be called in response to the application calling BIO_write_ex() or BIO_write(). The parameters for the function have the same meaning as for BIO_write_ex(). Older code may call BIO_meth_get_write() and BIO_meth_set_write() instead. Applications should not call both BIO_meth_set_write_ex() and BIO_meth_set_write() or call BIO_meth_get_write() when the function was set with BIO_meth_set_write_ex().

                                                                                                                                      BIO_meth_get_read_ex() and BIO_meth_set_read_ex() get and set the function used for reading arbitrary length data from the BIO respectively. This function will be called in response to the application calling BIO_read_ex() or BIO_read(). The parameters for the function have the same meaning as for BIO_read_ex(). Older code may call BIO_meth_get_read() and BIO_meth_set_read() instead. Applications should not call both BIO_meth_set_read_ex() and BIO_meth_set_read() or call BIO_meth_get_read() when the function was set with BIO_meth_set_read_ex().

                                                                                                                                      BIO_meth_get_puts() and BIO_meth_set_puts() get and set the function used for writing a NULL terminated string to the BIO respectively. This function will be called in response to the application calling BIO_puts(). The parameters for the function have the same meaning as for BIO_puts().

                                                                                                                                      BIO_meth_get_gets() and BIO_meth_set_gets() get and set the function typically used for reading a line of data from the BIO respectively (see the BIO_gets(3) page for more information). This function will be called in response to the application calling BIO_gets(). The parameters for the function have the same meaning as for BIO_gets().

                                                                                                                                      BIO_meth_get_ctrl() and BIO_meth_set_ctrl() get and set the function used for processing ctrl messages in the BIO respectively. See the BIO_ctrl(3) page for more information. This function will be called in response to the application calling BIO_ctrl(). The parameters for the function have the same meaning as for BIO_ctrl().

                                                                                                                                      BIO_meth_get_create() and BIO_meth_set_create() get and set the function used for creating a new instance of the BIO respectively. This function will be called in response to the application calling BIO_new() and passing in a pointer to the current BIO_METHOD. The BIO_new() function will allocate the memory for the new BIO, and a pointer to this newly allocated structure will be passed as a parameter to the function. If a create function is set, BIO_new() will not mark the BIO as initialised on allocation. BIO_set_init(3) must then be called either by the create function, or later, by a BIO ctrl function, once BIO initialisation is complete.

                                                                                                                                      BIO_meth_get_destroy() and BIO_meth_set_destroy() get and set the function used for destroying an instance of a BIO respectively. This function will be called in response to the application calling BIO_free(). A pointer to the BIO to be destroyed is passed as a parameter. The destroy function should be used for BIO specific clean up. The memory for the BIO itself should not be freed by this function.

                                                                                                                                      BIO_meth_get_callback_ctrl() and BIO_meth_set_callback_ctrl() get and set the function used for processing callback ctrl messages in the BIO respectively. See the BIO_callback_ctrl(3) page for more information. This function will be called in response to the application calling BIO_callback_ctrl(). The parameters for the function have the same meaning as for BIO_callback_ctrl().

                                                                                                                                      "},{"location":"man3/BIO_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_get_new_index() returns the new BIO type value or -1 if an error occurred.

                                                                                                                                      BIO_meth_new(int type, const char *name) returns a valid BIO_METHOD or NULL if an error occurred.

                                                                                                                                      The BIO_meth_set functions return 1 on success or 0 on error.

                                                                                                                                      The BIO_meth_get functions return the corresponding function pointers.

                                                                                                                                      "},{"location":"man3/BIO_meth_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7), BIO_find_type(3), BIO_ctrl(3), BIO_read_ex(3), BIO_new(3)

                                                                                                                                      "},{"location":"man3/BIO_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                      The functions described here were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/BIO_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_new/","title":"BIO_new","text":""},{"location":"man3/BIO_new/#name","title":"NAME","text":"

                                                                                                                                      BIO_new_ex, BIO_new, BIO_up_ref, BIO_free, BIO_vfree, BIO_free_all - BIO allocation and freeing functions

                                                                                                                                      "},{"location":"man3/BIO_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nBIO *BIO_new_ex(OSSL_LIB_CTX *libctx, const BIO_METHOD *type);\nBIO *BIO_new(const BIO_METHOD *type);\nint BIO_up_ref(BIO *a);\nint BIO_free(BIO *a);\nvoid BIO_vfree(BIO *a);\nvoid BIO_free_all(BIO *a);\n
                                                                                                                                      "},{"location":"man3/BIO_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The BIO_new_ex() function returns a new BIO using method type associated with the library context libctx (see OSSL_LIB_CTX(3)). The library context may be NULL to indicate the default library context.

                                                                                                                                      The BIO_new() is the same as BIO_new_ex() except the default library context is always used.

                                                                                                                                      BIO_up_ref() increments the reference count associated with the BIO object.

                                                                                                                                      BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO but it does not return a value. If a is NULL nothing is done. Calling BIO_free() may also have some effect on the underlying I/O structure, for example it may close the file being referred to under certain circumstances. For more details see the individual BIO_METHOD descriptions.

                                                                                                                                      BIO_free_all() frees up an entire BIO chain, it does not halt if an error occurs freeing up an individual BIO in the chain. If a is NULL nothing is done.

                                                                                                                                      "},{"location":"man3/BIO_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_new_ex() and BIO_new() return a newly created BIO or NULL if the call fails.

                                                                                                                                      BIO_up_ref() and BIO_free() return 1 for success and 0 for failure.

                                                                                                                                      BIO_free_all() and BIO_vfree() do not return values.

                                                                                                                                      "},{"location":"man3/BIO_new/#notes","title":"NOTES","text":"

                                                                                                                                      If BIO_free() is called on a BIO chain it will only free one BIO resulting in a memory leak.

                                                                                                                                      Calling BIO_free_all() on a single BIO has the same effect as calling BIO_free() on it other than the discarded return value.

                                                                                                                                      "},{"location":"man3/BIO_new/#history","title":"HISTORY","text":"

                                                                                                                                      BIO_set() was removed in OpenSSL 1.1.0 as BIO type is now opaque.

                                                                                                                                      BIO_new_ex() was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/BIO_new/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create a memory BIO:

                                                                                                                                      BIO *mem = BIO_new(BIO_s_mem());\n
                                                                                                                                      "},{"location":"man3/BIO_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/","title":"BIO_new_CMS","text":""},{"location":"man3/BIO_new_CMS/#name","title":"NAME","text":"

                                                                                                                                      BIO_new_CMS - CMS streaming filter BIO

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nBIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);\n
                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_new_CMS() returns a streaming filter BIO chain based on cms. The output of the filter is written to out. Any data written to the chain is automatically translated to a BER format CMS structure of the appropriate type.

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#notes","title":"NOTES","text":"

                                                                                                                                      The chain returned by this function behaves like a standard filter BIO. It supports non blocking I/O. Content is processed and streamed on the fly and not all held in memory at once: so it is possible to encode very large structures. After all content has been written through the chain BIO_flush() must be called to finalise the structure.

                                                                                                                                      The CMS_STREAM flag must be included in the corresponding flags parameter of the cms creation function.

                                                                                                                                      If an application wishes to write additional data to out BIOs should be removed from the chain using BIO_pop() and freed with BIO_free() until out is reached. If no additional data needs to be written BIO_free_all() can be called to free up the whole chain.

                                                                                                                                      Any content written through the filter is used verbatim: no canonical translation is performed.

                                                                                                                                      It is possible to chain multiple BIOs to, for example, create a triple wrapped signed, enveloped, signed structure. In this case it is the applications responsibility to set the inner content type of any outer CMS_ContentInfo structures.

                                                                                                                                      Large numbers of small writes through the chain should be avoided as this will produce an output consisting of lots of OCTET STRING structures. Prepending a BIO_f_buffer() buffering BIO will prevent this.

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#bugs","title":"BUGS","text":"

                                                                                                                                      There is currently no corresponding inverse BIO: i.e. one which can decode a CMS structure on the fly.

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_new_CMS() returns a BIO chain when successful or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_sign(3), CMS_encrypt(3)

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#history","title":"HISTORY","text":"

                                                                                                                                      The BIO_new_CMS() function was added in OpenSSL 1.0.0.

                                                                                                                                      "},{"location":"man3/BIO_new_CMS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_parse_hostserv/","title":"BIO_parse_hostserv","text":""},{"location":"man3/BIO_parse_hostserv/#name","title":"NAME","text":"

                                                                                                                                      BIO_hostserv_priorities, BIO_parse_hostserv - utility routines to parse a standard host and service string

                                                                                                                                      "},{"location":"man3/BIO_parse_hostserv/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nenum BIO_hostserv_priorities {\n    BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV\n};\nint BIO_parse_hostserv(const char *hostserv, char **host, char **service,\n                       enum BIO_hostserv_priorities hostserv_prio);\n
                                                                                                                                      "},{"location":"man3/BIO_parse_hostserv/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_parse_hostserv() will parse the information given in hostserv, create strings with the hostname and service name and give those back via host and service. Those will need to be freed after they are used. hostserv_prio helps determine if hostserv shall be interpreted primarily as a hostname or a service name in ambiguous cases.

                                                                                                                                      The syntax the BIO_parse_hostserv() recognises is:

                                                                                                                                      host + ':' + service\nhost + ':' + '*'\nhost + ':'\n       ':' + service\n'*'  + ':' + service\nhost\nservice\n

                                                                                                                                      The host part can be a name or an IP address. If it's a IPv6 address, it MUST be enclosed in brackets, such as '[::1]'.

                                                                                                                                      The service part can be a service name or its port number. A service name will be mapped to a port number using the system function getservbyname().

                                                                                                                                      The returned values will depend on the given hostserv string and hostserv_prio, as follows:

                                                                                                                                      host + ':' + service  => *host = \"host\", *service = \"service\"\nhost + ':' + '*'      => *host = \"host\", *service = NULL\nhost + ':'            => *host = \"host\", *service = NULL\n       ':' + service  => *host = NULL, *service = \"service\"\n '*' + ':' + service  => *host = NULL, *service = \"service\"\n\nin case no ':' is present in the string, the result depends on\nhostserv_prio, as follows:\n\nwhen hostserv_prio == BIO_PARSE_PRIO_HOST\nhost                 => *host = \"host\", *service untouched\n\nwhen hostserv_prio == BIO_PARSE_PRIO_SERV\nservice              => *host untouched, *service = \"service\"\n
                                                                                                                                      "},{"location":"man3/BIO_parse_hostserv/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_parse_hostserv() returns 1 on success or 0 on error.

                                                                                                                                      "},{"location":"man3/BIO_parse_hostserv/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_ADDRINFO(3)

                                                                                                                                      "},{"location":"man3/BIO_parse_hostserv/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_printf/","title":"BIO_printf","text":""},{"location":"man3/BIO_printf/#name","title":"NAME","text":"

                                                                                                                                      BIO_printf, BIO_vprintf, BIO_snprintf, BIO_vsnprintf - formatted output to a BIO

                                                                                                                                      "},{"location":"man3/BIO_printf/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nint BIO_printf(BIO *bio, const char *format, ...);\nint BIO_vprintf(BIO *bio, const char *format, va_list args);\n\nint BIO_snprintf(char *buf, size_t n, const char *format, ...);\nint BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);\n
                                                                                                                                      "},{"location":"man3/BIO_printf/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_printf() is similar to the standard C printf() function, except that the output is sent to the specified BIO, bio, rather than standard output. All common format specifiers are supported.

                                                                                                                                      BIO_vprintf() is similar to the vprintf() function found on many platforms, the output is sent to the specified BIO, bio, rather than standard output. All common format specifiers are supported. The argument list args is a stdarg argument list.

                                                                                                                                      BIO_snprintf() is for platforms that do not have the common snprintf() function. It is like sprintf() except that the size parameter, n, specifies the size of the output buffer.

                                                                                                                                      BIO_vsnprintf() is to BIO_snprintf() as BIO_vprintf() is to BIO_printf().

                                                                                                                                      "},{"location":"man3/BIO_printf/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      All functions return the number of bytes written, or -1 on error. For BIO_snprintf() and BIO_vsnprintf() this includes when the output buffer is too small.

                                                                                                                                      "},{"location":"man3/BIO_printf/#notes","title":"NOTES","text":"

                                                                                                                                      Except when n is 0, both BIO_snprintf() and BIO_vsnprintf() always terminate their output with '\\0'. This includes cases where -1 is returned, such as when there is insufficient space to output the whole string.

                                                                                                                                      "},{"location":"man3/BIO_printf/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_push/","title":"BIO_push","text":""},{"location":"man3/BIO_push/#name","title":"NAME","text":"

                                                                                                                                      BIO_push, BIO_pop, BIO_set_next - add and remove BIOs from a chain

                                                                                                                                      "},{"location":"man3/BIO_push/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nBIO *BIO_push(BIO *b, BIO *next);\nBIO *BIO_pop(BIO *b);\nvoid BIO_set_next(BIO *b, BIO *next);\n
                                                                                                                                      "},{"location":"man3/BIO_push/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_push() pushes b on next. If b is NULL the function does nothing and returns next. Otherwise it prepends b, which may be a single BIO or a chain of BIOs, to next (unless next is NULL). It then makes a control call on b and returns b.

                                                                                                                                      BIO_pop() removes the BIO b from any chain is is part of. If b is NULL the function does nothing and returns NULL. Otherwise it makes a control call on b and returns the next BIO in the chain, or NULL if there is no next BIO. The removed BIO becomes a single BIO with no association with the original chain, it can thus be freed or be made part of a different chain.

                                                                                                                                      BIO_set_next() replaces the existing next BIO in a chain with the BIO pointed to by next. The new chain may include some of the same BIOs from the old chain or it may be completely different.

                                                                                                                                      "},{"location":"man3/BIO_push/#notes","title":"NOTES","text":"

                                                                                                                                      The names of these functions are perhaps a little misleading. BIO_push() joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain, the deleted BIO does not need to be at the end of a chain.

                                                                                                                                      The process of calling BIO_push() and BIO_pop() on a BIO may have additional consequences (a control call is made to the affected BIOs). Any effects will be noted in the descriptions of individual BIOs.

                                                                                                                                      "},{"location":"man3/BIO_push/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_push() returns the head of the chain, which usually is b, or next if b is NULL.

                                                                                                                                      BIO_pop() returns the next BIO in the chain, or NULL if there is no next BIO.

                                                                                                                                      "},{"location":"man3/BIO_push/#examples","title":"EXAMPLES","text":"

                                                                                                                                      For these examples suppose md1 and md2 are digest BIOs, b64 is a base64 BIO and f is a file BIO.

                                                                                                                                      If the call:

                                                                                                                                      BIO_push(b64, f);\n

                                                                                                                                      is made then the new chain will be b64-f. After making the calls

                                                                                                                                      BIO_push(md2, b64);\nBIO_push(md1, md2);\n

                                                                                                                                      the new chain is md1-md2-b64-f. Data written to md1 will be digested by md1 and md2, base64 encoded, and finally written to f.

                                                                                                                                      It should be noted that reading causes data to pass in the reverse direction, that is data is read from f, base64 decoded, and digested by md2 and then md1.

                                                                                                                                      The call:

                                                                                                                                      BIO_pop(md2);\n

                                                                                                                                      will return b64 and the new chain will be md1-b64-f. Data can be written to and read from md1 as before, except that md2 will no more be applied.

                                                                                                                                      "},{"location":"man3/BIO_push/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7)

                                                                                                                                      "},{"location":"man3/BIO_push/#history","title":"HISTORY","text":"

                                                                                                                                      The BIO_set_next() function was added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/BIO_push/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_read/","title":"BIO_read","text":""},{"location":"man3/BIO_read/#name","title":"NAME","text":"

                                                                                                                                      BIO_read_ex, BIO_write_ex, BIO_read, BIO_write, BIO_gets, BIO_get_line, BIO_puts - BIO I/O functions

                                                                                                                                      "},{"location":"man3/BIO_read/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nint BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes);\nint BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written);\n\nint BIO_read(BIO *b, void *data, int dlen);\nint BIO_gets(BIO *b, char *buf, int size);\nint BIO_get_line(BIO *b, char *buf, int size);\nint BIO_write(BIO *b, const void *data, int dlen);\nint BIO_puts(BIO *b, const char *buf);\n
                                                                                                                                      "},{"location":"man3/BIO_read/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_read_ex() attempts to read dlen bytes from BIO b and places the data in data. If any bytes were successfully read then the number of bytes read is stored in *readbytes.

                                                                                                                                      BIO_write_ex() attempts to write dlen bytes from data to BIO b. If successful then the number of bytes written is stored in *written unless written is NULL.

                                                                                                                                      BIO_read() attempts to read len bytes from BIO b and places the data in buf.

                                                                                                                                      BIO_gets() performs the BIOs \"gets\" operation and places the data in buf. Usually this operation will attempt to read a line of data from the BIO of maximum length size-1. There are exceptions to this, however; for example, BIO_gets() on a digest BIO will calculate and return the digest and other BIOs may not support BIO_gets() at all. The returned string is always NUL-terminated and the '\\n' is preserved if present in the input data. On binary input there may be NUL characters within the string; in this case the return value (if nonnegative) may give an incorrect length.

                                                                                                                                      BIO_get_line() attempts to read from BIO b a line of data up to the next '\\n' or the maximum length size-1 is reached and places the data in buf. The returned string is always NUL-terminated and the '\\n' is preserved if present in the input data. On binary input there may be NUL characters within the string; in this case the return value (if nonnegative) gives the actual length read. For implementing this, unfortunately the data needs to be read byte-by-byte.

                                                                                                                                      BIO_write() attempts to write len bytes from buf to BIO b.

                                                                                                                                      BIO_puts() attempts to write a NUL-terminated string buf to BIO b.

                                                                                                                                      "},{"location":"man3/BIO_read/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_read_ex() returns 1 if data was successfully read, and 0 otherwise.

                                                                                                                                      BIO_write_ex() returns 1 if no error was encountered writing data, 0 otherwise. Requesting to write 0 bytes is not considered an error.

                                                                                                                                      BIO_write() returns -2 if the \"write\" operation is not implemented by the BIO or -1 on other errors. Otherwise it returns the number of bytes written. This may be 0 if the BIO b is NULL or dlen <= 0.

                                                                                                                                      BIO_gets() returns -2 if the \"gets\" operation is not implemented by the BIO or -1 on other errors. Otherwise it typically returns the amount of data read, but depending on the implementation it may return only the length up to the first NUL character contained in the data read. In any case the trailing NUL that is added after the data read is not included in the length returned.

                                                                                                                                      All other functions return either the amount of data successfully read or written (if the return value is positive) or that no data was successfully read or written if the result is 0 or -1. If the return value is -2 then the operation is not implemented in the specific BIO type.

                                                                                                                                      "},{"location":"man3/BIO_read/#notes","title":"NOTES","text":"

                                                                                                                                      A 0 or -1 return is not necessarily an indication of an error. In particular when the source/sink is nonblocking or of a certain type it may merely be an indication that no data is currently available and that the application should retry the operation later.

                                                                                                                                      One technique sometimes used with blocking sockets is to use a system call (such as select(), poll() or equivalent) to determine when data is available and then call read() to read the data. The equivalent with BIOs (that is call select() on the underlying I/O structure and then call BIO_read() to read the data) should not be used because a single call to BIO_read() can cause several reads (and writes in the case of SSL BIOs) on the underlying I/O structure and may block as a result. Instead select() (or equivalent) should be combined with non blocking I/O so successive reads will request a retry instead of blocking.

                                                                                                                                      See BIO_should_retry(3) for details of how to determine the cause of a retry and other I/O issues.

                                                                                                                                      If the \"gets\" method is not supported by a BIO then BIO_get_line() can be used. It is also possible to make BIO_gets() usable even if the \"gets\" method is not supported by adding a buffering BIO BIO_f_buffer(3) to the chain.

                                                                                                                                      "},{"location":"man3/BIO_read/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_should_retry(3)

                                                                                                                                      "},{"location":"man3/BIO_read/#history","title":"HISTORY","text":"

                                                                                                                                      BIO_gets() on 1.1.0 and older when called on BIO_fd() based BIO did not keep the '\\n' at the end of the line in the buffer.

                                                                                                                                      BIO_get_line() was added in OpenSSL 3.0.

                                                                                                                                      BIO_write_ex() returns 1 if the size of the data to write is 0 and the written parameter of the function can be NULL since OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/BIO_read/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_accept/","title":"BIO_s_accept","text":""},{"location":"man3/BIO_s_accept/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_accept, BIO_set_accept_name, BIO_set_accept_port, BIO_get_accept_name, BIO_get_accept_port, BIO_new_accept, BIO_set_nbio_accept, BIO_set_accept_bios, BIO_get_peer_name, BIO_get_peer_port, BIO_get_accept_ip_family, BIO_set_accept_ip_family, BIO_set_bind_mode, BIO_get_bind_mode, BIO_do_accept - accept BIO

                                                                                                                                      "},{"location":"man3/BIO_s_accept/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_accept(void);\n\nlong BIO_set_accept_name(BIO *b, char *name);\nchar *BIO_get_accept_name(BIO *b);\n\nlong BIO_set_accept_port(BIO *b, char *port);\nchar *BIO_get_accept_port(BIO *b);\n\nBIO *BIO_new_accept(char *host_port);\n\nlong BIO_set_nbio_accept(BIO *b, int n);\nlong BIO_set_accept_bios(BIO *b, char *bio);\n\nchar *BIO_get_peer_name(BIO *b);\nchar *BIO_get_peer_port(BIO *b);\nlong BIO_get_accept_ip_family(BIO *b);\nlong BIO_set_accept_ip_family(BIO *b, long family);\n\nlong BIO_set_bind_mode(BIO *b, long mode);\nlong BIO_get_bind_mode(BIO *b);\n\nint BIO_do_accept(BIO *b);\n
                                                                                                                                      "},{"location":"man3/BIO_s_accept/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_accept() returns the accept BIO method. This is a wrapper round the platform's TCP/IP socket accept routines.

                                                                                                                                      Using accept BIOs, TCP/IP connections can be accepted and data transferred using only BIO routines. In this way any platform specific operations are hidden by the BIO abstraction.

                                                                                                                                      Read and write operations on an accept BIO will perform I/O on the underlying connection. If no connection is established and the port (see below) is set up properly then the BIO waits for an incoming connection.

                                                                                                                                      Accept BIOs support BIO_puts() but not BIO_gets().

                                                                                                                                      If the close flag is set on an accept BIO then any active connection on that chain is shutdown and the socket closed when the BIO is freed.

                                                                                                                                      Calling BIO_reset() on an accept BIO will close any active connection and reset the BIO into a state where it awaits another incoming connection.

                                                                                                                                      BIO_get_fd() and BIO_set_fd() can be called to retrieve or set the accept socket. See BIO_s_fd(3)

                                                                                                                                      BIO_set_accept_name() uses the string name to set the accept name. The name is represented as a string of the form \"host:port\", where \"host\" is the interface to use and \"port\" is the port. The host can be \"*\" or empty which is interpreted as meaning any interface. If the host is an IPv6 address, it has to be enclosed in brackets, for example \"[::1]:https\". \"port\" has the same syntax as the port specified in BIO_set_conn_port() for connect BIOs, that is it can be a numerical port string or a string to lookup using getservbyname() and a string table.

                                                                                                                                      BIO_set_accept_port() uses the string port to set the accept port of BIO b. \"port\" has the same syntax as the port specified in BIO_set_conn_port() for connect BIOs, that is it can be a numerical port string or a string to lookup using getservbyname() and a string table. If the given port is 0 then a random available port is chosen. It may be queried using BIO_sock_info() and BIO_ADDR_service_string(3).

                                                                                                                                      BIO_new_accept() combines BIO_new() and BIO_set_accept_name() into a single call: that is it creates a new accept BIO with port host_port.

                                                                                                                                      BIO_set_nbio_accept() sets the accept socket to blocking mode (the default) if n is 0 or non blocking mode if n is 1.

                                                                                                                                      BIO_set_accept_bios() can be used to set a chain of BIOs which will be duplicated and prepended to the chain when an incoming connection is received. This is useful if, for example, a buffering or SSL BIO is required for each connection. The chain of BIOs must not be freed after this call, they will be automatically freed when the accept BIO is freed.

                                                                                                                                      BIO_get_accept_ip_family() returns the IP family accepted by the BIO b, which may be BIO_FAMILY_IPV4, BIO_FAMILY_IPV6, or BIO_FAMILY_IPANY.

                                                                                                                                      BIO_set_accept_ip_family() sets the IP family family accepted by BIO b. The default is BIO_FAMILY_IPANY.

                                                                                                                                      BIO_set_bind_mode() and BIO_get_bind_mode() set and retrieve the current bind mode. If BIO_BIND_NORMAL (the default) is set then another socket cannot be bound to the same port. If BIO_BIND_REUSEADDR is set then other sockets can bind to the same port. If BIO_BIND_REUSEADDR_IF_UNUSED is set then and attempt is first made to use BIO_BIN_NORMAL, if this fails and the port is not in use then a second attempt is made using BIO_BIND_REUSEADDR.

                                                                                                                                      BIO_do_accept() serves two functions. When it is first called, after the accept BIO has been setup, it will attempt to create the accept socket and bind an address to it. Second and subsequent calls to BIO_do_accept() will await an incoming connection, or request a retry in non blocking mode.

                                                                                                                                      "},{"location":"man3/BIO_s_accept/#notes","title":"NOTES","text":"

                                                                                                                                      When an accept BIO is at the end of a chain it will await an incoming connection before processing I/O calls. When an accept BIO is not at then end of a chain it passes I/O calls to the next BIO in the chain.

                                                                                                                                      When a connection is established a new socket BIO is created for the connection and appended to the chain. That is the chain is now accept->socket. This effectively means that attempting I/O on an initial accept socket will await an incoming connection then perform I/O on it.

                                                                                                                                      If any additional BIOs have been set using BIO_set_accept_bios() then they are placed between the socket and the accept BIO, that is the chain will be accept->otherbios->socket.

                                                                                                                                      If a server wishes to process multiple connections (as is normally the case) then the accept BIO must be made available for further incoming connections. This can be done by waiting for a connection and then calling:

                                                                                                                                      connection = BIO_pop(accept);\n

                                                                                                                                      After this call connection will contain a BIO for the recently established connection and accept will now be a single BIO again which can be used to await further incoming connections. If no further connections will be accepted the accept can be freed using BIO_free().

                                                                                                                                      If only a single connection will be processed it is possible to perform I/O using the accept BIO itself. This is often undesirable however because the accept BIO will still accept additional incoming connections. This can be resolved by using BIO_pop() (see above) and freeing up the accept BIO after the initial connection.

                                                                                                                                      If the underlying accept socket is nonblocking and BIO_do_accept() is called to await an incoming connection it is possible for BIO_should_io_special() with the reason BIO_RR_ACCEPT. If this happens then it is an indication that an accept attempt would block: the application should take appropriate action to wait until the underlying socket has accepted a connection and retry the call.

                                                                                                                                      BIO_set_accept_name(), BIO_get_accept_name(), BIO_set_accept_port(), BIO_get_accept_port(), BIO_set_nbio_accept(), BIO_set_accept_bios(), BIO_get_peer_name(), BIO_get_peer_port(), BIO_get_accept_ip_family(), BIO_set_accept_ip_family(), BIO_set_bind_mode(), BIO_get_bind_mode() and BIO_do_accept() are macros.

                                                                                                                                      "},{"location":"man3/BIO_s_accept/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_do_accept(), BIO_set_accept_name(), BIO_set_accept_port(), BIO_set_nbio_accept(), BIO_set_accept_bios(), BIO_set_accept_ip_family(), and BIO_set_bind_mode() return 1 for success and <=0 for failure.

                                                                                                                                      BIO_get_accept_name() returns the accept name or NULL on error. BIO_get_peer_name() returns the peer name or NULL on error.

                                                                                                                                      BIO_get_accept_port() returns the accept port as a string or NULL on error. BIO_get_peer_port() returns the peer port as a string or NULL on error. BIO_get_accept_ip_family() returns the IP family or <=0 on error.

                                                                                                                                      BIO_get_bind_mode() returns the set of BIO_BIND flags, or <=0 on failure.

                                                                                                                                      BIO_new_accept() returns a BIO or NULL on error.

                                                                                                                                      "},{"location":"man3/BIO_s_accept/#examples","title":"EXAMPLES","text":"

                                                                                                                                      This example accepts two connections on port 4444, sends messages down each and finally closes both down.

                                                                                                                                      BIO *abio, *cbio, *cbio2;\n\n/* First call to BIO_do_accept() sets up accept BIO */\nabio = BIO_new_accept(\"4444\");\nif (BIO_do_accept(abio) <= 0) {\n    fprintf(stderr, \"Error setting up accept\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n\n/* Wait for incoming connection */\nif (BIO_do_accept(abio) <= 0) {\n    fprintf(stderr, \"Error accepting connection\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\nfprintf(stderr, \"Connection 1 established\\n\");\n\n/* Retrieve BIO for connection */\ncbio = BIO_pop(abio);\nBIO_puts(cbio, \"Connection 1: Sending out Data on initial connection\\n\");\nfprintf(stderr, \"Sent out data on connection 1\\n\");\n\n/* Wait for another connection */\nif (BIO_do_accept(abio) <= 0) {\n    fprintf(stderr, \"Error accepting connection\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\nfprintf(stderr, \"Connection 2 established\\n\");\n\n/* Close accept BIO to refuse further connections */\ncbio2 = BIO_pop(abio);\nBIO_free(abio);\nBIO_puts(cbio2, \"Connection 2: Sending out Data on second\\n\");\nfprintf(stderr, \"Sent out data on connection 2\\n\");\n\nBIO_puts(cbio, \"Connection 1: Second connection established\\n\");\n\n/* Close the two established connections */\nBIO_free(cbio);\nBIO_free(cbio2);\n
                                                                                                                                      "},{"location":"man3/BIO_s_accept/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_bio/","title":"BIO_s_bio","text":""},{"location":"man3/BIO_s_bio/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_bio, BIO_make_bio_pair, BIO_destroy_bio_pair, BIO_shutdown_wr, BIO_set_write_buf_size, BIO_get_write_buf_size, BIO_new_bio_pair, BIO_get_write_guarantee, BIO_ctrl_get_write_guarantee, BIO_get_read_request, BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request - BIO pair BIO

                                                                                                                                      "},{"location":"man3/BIO_s_bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_bio(void);\n\nint BIO_make_bio_pair(BIO *b1, BIO *b2);\nint BIO_destroy_bio_pair(BIO *b);\nint BIO_shutdown_wr(BIO *b);\n\nint BIO_set_write_buf_size(BIO *b, long size);\nsize_t BIO_get_write_buf_size(BIO *b, long size);\n\nint BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2);\n\nint BIO_get_write_guarantee(BIO *b);\nsize_t BIO_ctrl_get_write_guarantee(BIO *b);\nint BIO_get_read_request(BIO *b);\nsize_t BIO_ctrl_get_read_request(BIO *b);\nint BIO_ctrl_reset_read_request(BIO *b);\n
                                                                                                                                      "},{"location":"man3/BIO_s_bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_bio() returns the method for a BIO pair. A BIO pair is a pair of source/sink BIOs where data written to either half of the pair is buffered and can be read from the other half. Both halves must usually by handled by the same application thread since no locking is done on the internal data structures.

                                                                                                                                      Since BIO chains typically end in a source/sink BIO it is possible to make this one half of a BIO pair and have all the data processed by the chain under application control.

                                                                                                                                      One typical use of BIO pairs is to place TLS/SSL I/O under application control, this can be used when the application wishes to use a non standard transport for TLS/SSL or the normal socket routines are inappropriate.

                                                                                                                                      Calls to BIO_read_ex() will read data from the buffer or request a retry if no data is available.

                                                                                                                                      Calls to BIO_write_ex() will place data in the buffer or request a retry if the buffer is full.

                                                                                                                                      The standard calls BIO_ctrl_pending() and BIO_ctrl_wpending() can be used to determine the amount of pending data in the read or write buffer.

                                                                                                                                      BIO_reset() clears any data in the write buffer.

                                                                                                                                      BIO_make_bio_pair() joins two separate BIOs into a connected pair.

                                                                                                                                      BIO_destroy_pair() destroys the association between two connected BIOs. Freeing up any half of the pair will automatically destroy the association.

                                                                                                                                      BIO_shutdown_wr() is used to close down a BIO b. After this call no further writes on BIO b are allowed (they will return an error). Reads on the other half of the pair will return any pending data or EOF when all pending data has been read.

                                                                                                                                      BIO_set_write_buf_size() sets the write buffer size of BIO b to size. If the size is not initialized a default value is used. This is currently 17K, sufficient for a maximum size TLS record.

                                                                                                                                      BIO_get_write_buf_size() returns the size of the write buffer.

                                                                                                                                      BIO_new_bio_pair() combines the calls to BIO_new(), BIO_make_bio_pair() and BIO_set_write_buf_size() to create a connected pair of BIOs bio1, bio2 with write buffer sizes writebuf1 and writebuf2. If either size is zero then the default size is used. BIO_new_bio_pair() does not check whether bio1 or bio2 do point to some other BIO, the values are overwritten, BIO_free() is not called.

                                                                                                                                      BIO_get_write_guarantee() and BIO_ctrl_get_write_guarantee() return the maximum length of data that can be currently written to the BIO. Writes larger than this value will return a value from BIO_write_ex() less than the amount requested or if the buffer is full request a retry. BIO_ctrl_get_write_guarantee() is a function whereas BIO_get_write_guarantee() is a macro.

                                                                                                                                      BIO_get_read_request() and BIO_ctrl_get_read_request() return the amount of data requested, or the buffer size if it is less, if the last read attempt at the other half of the BIO pair failed due to an empty buffer. This can be used to determine how much data should be written to the BIO so the next read will succeed: this is most useful in TLS/SSL applications where the amount of data read is usually meaningful rather than just a buffer size. After a successful read this call will return zero. It also will return zero once new data has been written satisfying the read request or part of it. Note that BIO_get_read_request() never returns an amount larger than that returned by BIO_get_write_guarantee().

                                                                                                                                      BIO_ctrl_reset_read_request() can also be used to reset the value returned by BIO_get_read_request() to zero.

                                                                                                                                      "},{"location":"man3/BIO_s_bio/#notes","title":"NOTES","text":"

                                                                                                                                      Both halves of a BIO pair should be freed. That is even if one half is implicit freed due to a BIO_free_all() or SSL_free() call the other half needs to be freed.

                                                                                                                                      When used in bidirectional applications (such as TLS/SSL) care should be taken to flush any data in the write buffer. This can be done by calling BIO_pending() on the other half of the pair and, if any data is pending, reading it and sending it to the underlying transport. This must be done before any normal processing (such as calling select() ) due to a request and BIO_should_read() being true.

                                                                                                                                      To see why this is important consider a case where a request is sent using BIO_write_ex() and a response read with BIO_read_ex(), this can occur during an TLS/SSL handshake for example. BIO_write_ex() will succeed and place data in the write buffer. BIO_read_ex() will initially fail and BIO_should_read() will be true. If the application then waits for data to be available on the underlying transport before flushing the write buffer it will never succeed because the request was never sent!

                                                                                                                                      BIO_eof() is true if no data is in the peer BIO and the peer BIO has been shutdown.

                                                                                                                                      BIO_make_bio_pair(), BIO_destroy_bio_pair(), BIO_shutdown_wr(), BIO_set_write_buf_size(), BIO_get_write_buf_size(), BIO_get_write_guarantee(), and BIO_get_read_request() are implemented as macros.

                                                                                                                                      "},{"location":"man3/BIO_s_bio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_new_bio_pair() returns 1 on success, with the new BIOs available in bio1 and bio2, or 0 on failure, with NULL pointers stored into the locations for bio1 and bio2. Check the error stack for more information.

                                                                                                                                      [XXXXX: More return values need to be added here]

                                                                                                                                      "},{"location":"man3/BIO_s_bio/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The BIO pair can be used to have full control over the network access of an application. The application can call select() on the socket as required without having to go through the SSL-interface.

                                                                                                                                      BIO *internal_bio, *network_bio;\n\n...\nBIO_new_bio_pair(&internal_bio, 0, &network_bio, 0);\nSSL_set_bio(ssl, internal_bio, internal_bio);\nSSL_operations(); /* e.g. SSL_read and SSL_write */\n...\n\napplication |   TLS-engine\n   |        |\n   +----------> SSL_operations()\n            |     /\\    ||\n            |     ||    \\/\n            |   BIO-pair (internal_bio)\n            |   BIO-pair (network_bio)\n            |     ||     /\\\n            |     \\/     ||\n   +-----------< BIO_operations()\n   |        |\n   |        |\n  socket\n\n ...\n SSL_free(ssl);                /* implicitly frees internal_bio */\n BIO_free(network_bio);\n ...\n

                                                                                                                                      As the BIO pair will only buffer the data and never directly access the connection, it behaves nonblocking and will return as soon as the write buffer is full or the read buffer is drained. Then the application has to flush the write buffer and/or fill the read buffer.

                                                                                                                                      Use the BIO_ctrl_pending(), to find out whether data is buffered in the BIO and must be transferred to the network. Use BIO_ctrl_get_read_request() to find out, how many bytes must be written into the buffer before the SSL_operation() can successfully be continued.

                                                                                                                                      "},{"location":"man3/BIO_s_bio/#warnings","title":"WARNINGS","text":"

                                                                                                                                      As the data is buffered, SSL_operation() may return with an ERROR_SSL_WANT_READ condition, but there is still data in the write buffer. An application must not rely on the error value of SSL_operation() but must assure that the write buffer is always flushed first. Otherwise a deadlock may occur as the peer might be waiting for the data before being able to continue.

                                                                                                                                      "},{"location":"man3/BIO_s_bio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      SSL_set_bio(3), ssl(7), bio(7), BIO_should_retry(3), BIO_read_ex(3)

                                                                                                                                      "},{"location":"man3/BIO_s_bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_connect/","title":"BIO_s_connect","text":""},{"location":"man3/BIO_s_connect/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_connect, BIO_new_connect, BIO_set_conn_hostname, BIO_set_conn_port, BIO_set_conn_address, BIO_set_conn_ip_family, BIO_get_conn_hostname, BIO_get_conn_port, BIO_get_conn_address, BIO_get_conn_ip_family, BIO_set_nbio, BIO_do_connect - connect BIO

                                                                                                                                      "},{"location":"man3/BIO_s_connect/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_connect(void);\n\nBIO *BIO_new_connect(const char *name);\n\nlong BIO_set_conn_hostname(BIO *b, char *name);\nlong BIO_set_conn_port(BIO *b, char *port);\nlong BIO_set_conn_address(BIO *b, BIO_ADDR *addr);\nlong BIO_set_conn_ip_family(BIO *b, long family);\nconst char *BIO_get_conn_hostname(BIO *b);\nconst char *BIO_get_conn_port(BIO *b);\nconst BIO_ADDR *BIO_get_conn_address(BIO *b);\nconst long BIO_get_conn_ip_family(BIO *b);\n\nlong BIO_set_nbio(BIO *b, long n);\n\nlong BIO_do_connect(BIO *b);\n
                                                                                                                                      "},{"location":"man3/BIO_s_connect/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_connect() returns the connect BIO method. This is a wrapper round the platform's TCP/IP socket connection routines.

                                                                                                                                      Using connect BIOs, TCP/IP connections can be made and data transferred using only BIO routines. In this way any platform specific operations are hidden by the BIO abstraction.

                                                                                                                                      Read and write operations on a connect BIO will perform I/O on the underlying connection. If no connection is established and the port and hostname (see below) is set up properly then a connection is established first.

                                                                                                                                      Connect BIOs support BIO_puts() but not BIO_gets().

                                                                                                                                      If the close flag is set on a connect BIO then any active connection is shutdown and the socket closed when the BIO is freed.

                                                                                                                                      Calling BIO_reset() on a connect BIO will close any active connection and reset the BIO into a state where it can connect to the same host again.

                                                                                                                                      BIO_new_connect() combines BIO_new() and BIO_set_conn_hostname() into a single call: that is it creates a new connect BIO with hostname name.

                                                                                                                                      BIO_set_conn_hostname() uses the string name to set the hostname. The hostname can be an IP address; if the address is an IPv6 one, it must be enclosed with brackets [ and ]. The hostname can also include the port in the form hostname:port; see BIO_parse_hostserv(3) and BIO_set_conn_port() for details.

                                                                                                                                      BIO_set_conn_port() sets the port to port. port can be the numerical form or a service string such as \"http\", which will be mapped to a port number using the system function getservbyname().

                                                                                                                                      BIO_set_conn_address() sets the address and port information using a BIO_ADDR(3ssl).

                                                                                                                                      BIO_set_conn_ip_family() sets the IP family.

                                                                                                                                      BIO_get_conn_hostname() returns the hostname of the connect BIO or NULL if the BIO is initialized but no hostname is set. This return value is an internal pointer which should not be modified.

                                                                                                                                      BIO_get_conn_port() returns the port as a string. This return value is an internal pointer which should not be modified.

                                                                                                                                      BIO_get_conn_address() returns the address information as a BIO_ADDR. This return value is an internal pointer which should not be modified.

                                                                                                                                      BIO_get_conn_ip_family() returns the IP family of the connect BIO.

                                                                                                                                      BIO_set_nbio() sets the non blocking I/O flag to n. If n is zero then blocking I/O is set. If n is 1 then non blocking I/O is set. Blocking I/O is the default. The call to BIO_set_nbio() should be made before the connection is established because non blocking I/O is set during the connect process.

                                                                                                                                      BIO_do_connect() attempts to connect the supplied BIO. This performs an SSL/TLS handshake as far as supported by the BIO. For non-SSL BIOs the connection is done typically at TCP level. If domain name resolution yields multiple IP addresses all of them are tried after connect() failures. The function returns 1 if the connection was established successfully. A zero or negative value is returned if the connection could not be established. The call BIO_should_retry() should be used for non blocking connect BIOs to determine if the call should be retried. If a connection has already been established this call has no effect.

                                                                                                                                      "},{"location":"man3/BIO_s_connect/#notes","title":"NOTES","text":"

                                                                                                                                      If blocking I/O is set then a non positive return value from any I/O call is caused by an error condition, although a zero return will normally mean that the connection was closed.

                                                                                                                                      If the port name is supplied as part of the hostname then this will override any value set with BIO_set_conn_port(). This may be undesirable if the application does not wish to allow connection to arbitrary ports. This can be avoided by checking for the presence of the ':' character in the passed hostname and either indicating an error or truncating the string at that point.

                                                                                                                                      The values returned by BIO_get_conn_hostname(), BIO_get_conn_address(), and BIO_get_conn_port() are updated when a connection attempt is made. Before any connection attempt the values returned are those set by the application itself.

                                                                                                                                      Applications do not have to call BIO_do_connect() but may wish to do so to separate the connection process from other I/O processing.

                                                                                                                                      If non blocking I/O is set then retries will be requested as appropriate.

                                                                                                                                      It addition to BIO_should_read() and BIO_should_write() it is also possible for BIO_should_io_special() to be true during the initial connection process with the reason BIO_RR_CONNECT. If this is returned then this is an indication that a connection attempt would block, the application should then take appropriate action to wait until the underlying socket has connected and retry the call.

                                                                                                                                      BIO_set_conn_hostname(), BIO_set_conn_port(), BIO_get_conn_hostname(), BIO_set_conn_address(), BIO_get_conn_port(), BIO_get_conn_address(), BIO_set_conn_ip_family(), BIO_get_conn_ip_family(), BIO_set_nbio(), and BIO_do_connect() are macros.

                                                                                                                                      "},{"location":"man3/BIO_s_connect/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_connect() returns the connect BIO method.

                                                                                                                                      BIO_set_conn_address(), BIO_set_conn_port(), and BIO_set_conn_ip_family() return 1 or <=0 if an error occurs.

                                                                                                                                      BIO_set_conn_hostname() returns 1 on success and <=0 on failure.

                                                                                                                                      BIO_get_conn_address() returns the address information or NULL if none was set.

                                                                                                                                      BIO_get_conn_hostname() returns the connected hostname or NULL if none was set.

                                                                                                                                      BIO_get_conn_ip_family() returns the address family or -1 if none was set.

                                                                                                                                      BIO_get_conn_port() returns a string representing the connected port or NULL if not set.

                                                                                                                                      BIO_set_nbio() returns 1 or <=0 if an error occurs.

                                                                                                                                      BIO_do_connect() returns 1 if the connection was successfully established and <=0 if the connection failed.

                                                                                                                                      "},{"location":"man3/BIO_s_connect/#examples","title":"EXAMPLES","text":"

                                                                                                                                      This is example connects to a webserver on the local host and attempts to retrieve a page and copy the result to standard output.

                                                                                                                                      BIO *cbio, *out;\nint len;\nchar tmpbuf[1024];\n\ncbio = BIO_new_connect(\"localhost:http\");\nout = BIO_new_fp(stdout, BIO_NOCLOSE);\nif (BIO_do_connect(cbio) <= 0) {\n    fprintf(stderr, \"Error connecting to server\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\nBIO_puts(cbio, \"GET / HTTP/1.0\\n\\n\");\nfor (;;) {\n    len = BIO_read(cbio, tmpbuf, 1024);\n    if (len <= 0)\n        break;\n    BIO_write(out, tmpbuf, len);\n}\nBIO_free(cbio);\nBIO_free(out);\n
                                                                                                                                      "},{"location":"man3/BIO_s_connect/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_ADDR(3), BIO_parse_hostserv(3)

                                                                                                                                      "},{"location":"man3/BIO_s_connect/#history","title":"HISTORY","text":"

                                                                                                                                      BIO_set_conn_int_port(), BIO_get_conn_int_port(), BIO_set_conn_ip(), and BIO_get_conn_ip() were removed in OpenSSL 1.1.0. Use BIO_set_conn_address() and BIO_get_conn_address() instead.

                                                                                                                                      "},{"location":"man3/BIO_s_connect/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_core/","title":"BIO_s_core","text":""},{"location":"man3/BIO_s_core/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_core, BIO_new_from_core_bio - OSSL_CORE_BIO functions

                                                                                                                                      "},{"location":"man3/BIO_s_core/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_core(void);\n\nBIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio);\n
                                                                                                                                      "},{"location":"man3/BIO_s_core/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_core() returns the core BIO method function.

                                                                                                                                      A core BIO is treated as source/sink BIO which communicates to some external BIO. This is primarily useful to provider authors. A number of calls from libcrypto into a provider supply an OSSL_CORE_BIO parameter. This represents a BIO within libcrypto, but cannot be used directly by a provider. Instead it should be wrapped using a BIO_s_core().

                                                                                                                                      Once a BIO is constructed based on BIO_s_core(), the associated OSSL_CORE_BIO object should be set on it using BIO_set_data(3). Note that the BIO will only operate correctly if it is associated with a library context constructed using OSSL_LIB_CTX_new_from_dispatch(3). To associate the BIO with a library context construct it using BIO_new_ex(3).

                                                                                                                                      BIO_new_from_core_bio() is a convenience function that constructs a new BIO based on BIO_s_core() and that is associated with the given library context. It then also sets the OSSL_CORE_BIO object on the BIO using BIO_set_data(3).

                                                                                                                                      "},{"location":"man3/BIO_s_core/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_core() return a core BIO BIO_METHOD structure.

                                                                                                                                      BIO_new_from_core_bio() returns a BIO structure on success or NULL on failure. A failure will most commonly be because the library context was not constructed using OSSL_LIB_CTX_new_from_dispatch(3).

                                                                                                                                      "},{"location":"man3/BIO_s_core/#history","title":"HISTORY","text":"

                                                                                                                                      BIO_s_core() and BIO_new_from_core_bio() were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/BIO_s_core/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create a core BIO and write some data to it:

                                                                                                                                      int some_function(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio) {\n    BIO *cbio = BIO_new_from_core_bio(libctx, corebio);\n\n    if (cbio == NULL)\n        return 0;\n\n    BIO_puts(cbio, \"Hello World\\n\");\n\n    BIO_free(cbio);\n    return 1;\n}\n
                                                                                                                                      "},{"location":"man3/BIO_s_core/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_datagram/","title":"BIO_s_datagram","text":""},{"location":"man3/BIO_s_datagram/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_datagram, BIO_new_dgram, BIO_ctrl_dgram_connect, BIO_ctrl_set_connected, BIO_dgram_recv_timedout, BIO_dgram_send_timedout, BIO_dgram_get_peer, BIO_dgram_set_peer, BIO_dgram_get_mtu_overhead - Network BIO with datagram semantics

                                                                                                                                      "},{"location":"man3/BIO_s_datagram/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nBIO_METHOD *BIO_s_datagram(void);\nBIO *BIO_new_dgram(int fd, int close_flag);\n\nint BIO_ctrl_dgram_connect(BIO *bio, const BIO_ADDR *peer);\nint BIO_ctrl_set_connected(BIO *bio, const BIO_ADDR *peer);\nint BIO_dgram_recv_timedout(BIO *bio);\nint BIO_dgram_send_timedout(BIO *bio);\nint BIO_dgram_get_peer(BIO *bio, BIO_ADDR *peer);\nint BIO_dgram_set_peer(BIO *bio, const BIO_ADDR *peer);\nint BIO_dgram_get_mtu_overhead(BIO *bio);\n
                                                                                                                                      "},{"location":"man3/BIO_s_datagram/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_datagram() is a BIO implementation designed for use with network sockets which provide datagram semantics, such as UDP sockets. It is suitable for use with DTLSv1.

                                                                                                                                      Because BIO_s_datagram() has datagram semantics, a single BIO_write() call sends a single datagram and a single BIO_read() call receives a single datagram. If the size of the buffer passed to BIO_read() is inadequate, the datagram is silently truncated.

                                                                                                                                      When using BIO_s_datagram(), it is important to note that:

                                                                                                                                      • This BIO can be used with either a connected or unconnected network socket. A connected socket is a network socket which has had BIO_connect(3) or a similar OS-specific function called on it. Such a socket can only receive datagrams from the specified peer. Any other socket is an unconnected socket and can receive datagrams from any host.
                                                                                                                                      • Despite their naming, neither BIO_ctrl_dgram_connect() nor BIO_ctrl_set_connected() cause a socket to become connected. These controls are provided to indicate to the BIO how the underlying socket is configured and how it is to be used; see below.
                                                                                                                                      • Use of BIO_s_datagram() with an unconnected network socket is hazardous hecause any successful call to BIO_read() results in the peer address used for any subsequent call to BIO_write() being set to the source address of the datagram received by that call to BIO_read(). Thus, unless the caller calls BIO_dgram_set_peer() immediately prior to every call to BIO_write(), or never calls BIO_read(), any host on the network may cause future datagrams written to be redirected to that host. Therefore, it is recommended that users use BIO_s_dgram() only with a connected socket. An exception is where DTLSv1_listen(3) must be used; see DTLSv1_listen(3) for further discussion.

                                                                                                                                      Various controls are available for configuring the BIO_s_datagram() using BIO_ctrl(3):

                                                                                                                                      • BIO_ctrl_dgram_connect (BIO_CTRL_DGRAM_CONNECT)

                                                                                                                                        This is equivalent to calling BIO_dgram_set_peer(3).

                                                                                                                                        Despite its name, this function does not cause the underlying socket to become connected.

                                                                                                                                      • BIO_ctrl_set_connected (BIO_CTRL_SET_CONNECTED)

                                                                                                                                        This informs the BIO_s_datagram() whether the underlying socket has been connected, and therefore how the BIO_s_datagram() should attempt to use the socket.

                                                                                                                                        If the peer argument is non-NULL, BIO_s_datagram() assumes that the underlying socket has been connected and will attempt to use the socket using OS APIs which do not specify peer addresses (for example, send(3) and recv(3) or similar). The peer argument should specify the peer address to which the socket is connected.

                                                                                                                                        If the peer argument is NULL, BIO_s_datagram() assumes that the underlying socket is not connected and will attempt to use the socket using an OS APIs which specify peer addresses (for example, sendto(3) and recvfrom(3)).

                                                                                                                                      • BIO_dgram_get_peer (BIO_CTRL_DGRAM_GET_PEER)

                                                                                                                                        This outputs a BIO_ADDR which specifies one of the following values, whichever happened most recently:

                                                                                                                                        • The peer address last passed to BIO_dgram_set_peer(), BIO_ctrl_dgram_connect() or BIO_ctrl_set_connected().
                                                                                                                                        • The peer address of the datagram last received by a call to BIO_read().
                                                                                                                                      • BIO_dgram_set_peer (BIO_CTRL_DGRAM_SET_PEER)

                                                                                                                                        Sets the peer address to be used for subsequent writes to this BIO.

                                                                                                                                        Warning: When used with an unconnected network socket, the value set may be modified by future calls to BIO_read(3), making use of BIO_s_datagram() hazardous when used with unconnected network sockets; see above.

                                                                                                                                      • BIO_dgram_recv_timeout (BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP)

                                                                                                                                        Returns 1 if the last I/O operation performed on the BIO (for example, via a call to BIO_read(3)) may have been caused by a receive timeout.

                                                                                                                                      • BIO_dgram_send_timedout (BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP)

                                                                                                                                        Returns 1 if the last I/O operation performed on the BIO (for example, via a call to BIO_write(3)) may have been caused by a send timeout.

                                                                                                                                      • BIO_dgram_get_mtu_overhead (BIO_CTRL_DGRAM_GET_MTU_OVERHEAD)

                                                                                                                                        Returns a quantity in bytes which is a rough estimate of the number of bytes of overhead which should typically be added to a datagram payload size in order to estimate the final size of the Layer 3 (e.g. IP) packet which will contain the datagram. In most cases, the maximum datagram payload size which can be transmitted can be determined by determining the link MTU in bytes and subtracting the value returned by this call.

                                                                                                                                        The value returned by this call depends on the network layer protocol being used.

                                                                                                                                        The value returned is not fully reliable because datagram overheads can be higher in atypical network configurations, for example where IPv6 extension headers or IPv4 options are used.

                                                                                                                                      • BIO_CTRL_DGRAM_SET_DONT_FRAG

                                                                                                                                        If num is nonzero, configures the underlying network socket to enable Don't Fragment mode, in which datagrams will be set with the IP Don't Fragment (DF) bit set. If num is zero, Don't Fragment mode is disabled.

                                                                                                                                      • BIO_CTRL_DGRAM_QUERY_MTU

                                                                                                                                        Queries the OS for its assessment of the Path MTU for the destination to which the underlying network socket, and returns that Path MTU in bytes. This control can only be used with a connected socket.

                                                                                                                                        This is not supported on all platforms and depends on OS support being available. Returns 0 on failure.

                                                                                                                                      • BIO_CTRL_DGRAM_MTU_DISCOVER

                                                                                                                                        This control requests that Path MTU discovery be enabled on the underlying network socket.

                                                                                                                                      • BIO_CTRL_DGRAM_GET_FALLBACK_MTU

                                                                                                                                        Returns the estimated minimum size of datagram payload which should always be supported on the BIO. This size is determined by the minimum MTU required to be supported by the applicable underlying network layer. Use of datagrams of this size may lead to suboptimal performance, but should be routable in all circumstances. The value returned is the datagram payload size in bytes and does not include the size of layer 3 or layer 4 protocol headers.

                                                                                                                                      • BIO_CTRL_DGRAM_MTU_EXCEEDED

                                                                                                                                        Returns 1 if the last attempted write to the BIO failed due to the size of the attempted write exceeding the applicable MTU.

                                                                                                                                      • BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT

                                                                                                                                        Accepts a pointer to a struct timeval. If the time specified is zero, disables receive timeouts. Otherwise, configures the specified time interval as the receive timeout for the socket for the purposes of future BIO_read(3) calls.

                                                                                                                                      • BIO_CTRL_DGRAM_SET_PEEK_MODE

                                                                                                                                        If num is nonzero, enables peek mode; otherwise, disables peek mode. Where peek mode is enabled, calls to BIO_read(3) read datagrams from the underlying network socket in peek mode, meaning that a future call to BIO_read(3) will yield the same datagram until peek mode is disabled.

                                                                                                                                      BIO_new_dgram() is a helper function which instantiates a BIO_s_datagram() and sets the BIO to use the socket given in fd by calling BIO_set_fd().

                                                                                                                                      "},{"location":"man3/BIO_s_datagram/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_datagram() returns a BIO method.

                                                                                                                                      BIO_new_dgram() returns a BIO on success and NULL on failure.

                                                                                                                                      BIO_ctrl_dgram_connect(), BIO_ctrl_set_connected(), BIO_dgram_get_peer(), BIO_dgram_set_peer() return 1 on success and 0 on failure.

                                                                                                                                      BIO_dgram_recv_timedout() and BIO_dgram_send_timedout() return 0 or 1 depending on the circumstance; see discussion above.

                                                                                                                                      BIO_dgram_get_mtu_overhead() returns a value in bytes.

                                                                                                                                      "},{"location":"man3/BIO_s_datagram/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DTLSv1_listen(3), bio(7)

                                                                                                                                      "},{"location":"man3/BIO_s_datagram/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_fd/","title":"BIO_s_fd","text":""},{"location":"man3/BIO_s_fd/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO

                                                                                                                                      "},{"location":"man3/BIO_s_fd/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_fd(void);\n\nint BIO_set_fd(BIO *b, int fd, int c);\nint BIO_get_fd(BIO *b, int *c);\n\nBIO *BIO_new_fd(int fd, int close_flag);\n
                                                                                                                                      "},{"location":"man3/BIO_s_fd/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_fd() returns the file descriptor BIO method. This is a wrapper round the platforms file descriptor routines such as read() and write().

                                                                                                                                      BIO_read_ex() and BIO_write_ex() read or write the underlying descriptor. BIO_puts() is supported but BIO_gets() is not.

                                                                                                                                      If the close flag is set then close() is called on the underlying file descriptor when the BIO is freed.

                                                                                                                                      BIO_reset() attempts to change the file pointer to the start of file such as by using lseek(fd, 0, 0).

                                                                                                                                      BIO_seek() sets the file pointer to position ofs from start of file such as by using lseek(fd, ofs, 0).

                                                                                                                                      BIO_tell() returns the current file position such as by calling lseek(fd, 0, 1).

                                                                                                                                      BIO_set_fd() sets the file descriptor of BIO b to fd and the close flag to c.

                                                                                                                                      BIO_get_fd() places the file descriptor of BIO b in c if it is not NULL. It also returns the file descriptor.

                                                                                                                                      BIO_new_fd() returns a file descriptor BIO using fd and close_flag.

                                                                                                                                      "},{"location":"man3/BIO_s_fd/#notes","title":"NOTES","text":"

                                                                                                                                      The behaviour of BIO_read_ex() and BIO_write_ex() depends on the behavior of the platforms read() and write() calls on the descriptor. If the underlying file descriptor is in a non blocking mode then the BIO will behave in the manner described in the BIO_read_ex(3) and BIO_should_retry(3) manual pages.

                                                                                                                                      File descriptor BIOs should not be used for socket I/O. Use socket BIOs instead.

                                                                                                                                      BIO_set_fd() and BIO_get_fd() are implemented as macros.

                                                                                                                                      "},{"location":"man3/BIO_s_fd/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_fd() returns the file descriptor BIO method.

                                                                                                                                      BIO_set_fd() returns 1 on success or <=0 for failure.

                                                                                                                                      BIO_get_fd() returns the file descriptor or -1 if the BIO has not been initialized. It also returns zero and negative values if other error occurs.

                                                                                                                                      BIO_new_fd() returns the newly allocated BIO or NULL is an error occurred.

                                                                                                                                      "},{"location":"man3/BIO_s_fd/#examples","title":"EXAMPLES","text":"

                                                                                                                                      This is a file descriptor BIO version of \"Hello World\":

                                                                                                                                      BIO *out;\n\nout = BIO_new_fd(fileno(stdout), BIO_NOCLOSE);\nBIO_printf(out, \"Hello World\\n\");\nBIO_free(out);\n
                                                                                                                                      "},{"location":"man3/BIO_s_fd/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_seek(3), BIO_tell(3), BIO_reset(3), BIO_read_ex(3), BIO_write_ex(3), BIO_puts(3), BIO_gets(3), BIO_printf(3), BIO_set_close(3), BIO_get_close(3)

                                                                                                                                      "},{"location":"man3/BIO_s_fd/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_file/","title":"BIO_s_file","text":""},{"location":"man3/BIO_s_file/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_file, BIO_new_file, BIO_new_fp, BIO_set_fp, BIO_get_fp, BIO_read_filename, BIO_write_filename, BIO_append_filename, BIO_rw_filename - FILE bio

                                                                                                                                      "},{"location":"man3/BIO_s_file/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_file(void);\nBIO *BIO_new_file(const char *filename, const char *mode);\nBIO *BIO_new_fp(FILE *stream, int flags);\n\nBIO_set_fp(BIO *b, FILE *fp, int flags);\nBIO_get_fp(BIO *b, FILE **fpp);\n\nint BIO_read_filename(BIO *b, char *name);\nint BIO_write_filename(BIO *b, char *name);\nint BIO_append_filename(BIO *b, char *name);\nint BIO_rw_filename(BIO *b, char *name);\n
                                                                                                                                      "},{"location":"man3/BIO_s_file/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_file() returns the BIO file method. As its name implies it is a wrapper round the stdio FILE structure and it is a source/sink BIO.

                                                                                                                                      Calls to BIO_read_ex() and BIO_write_ex() read and write data to the underlying stream. BIO_gets() and BIO_puts() are supported on file BIOs.

                                                                                                                                      BIO_flush() on a file BIO calls the fflush() function on the wrapped stream.

                                                                                                                                      BIO_reset() attempts to change the file pointer to the start of file using fseek(stream, 0, 0).

                                                                                                                                      BIO_seek() sets the file pointer to position ofs from start of file using fseek(stream, ofs, 0).

                                                                                                                                      BIO_eof() calls feof().

                                                                                                                                      Setting the BIO_CLOSE flag calls fclose() on the stream when the BIO is freed.

                                                                                                                                      BIO_new_file() creates a new file BIO with mode mode the meaning of mode is the same as the stdio function fopen(). The BIO_CLOSE flag is set on the returned BIO.

                                                                                                                                      BIO_new_fp() creates a file BIO wrapping stream. Flags can be: BIO_CLOSE, BIO_NOCLOSE (the close flag) BIO_FP_TEXT (sets the underlying stream to text mode, default is binary: this only has any effect under Win32).

                                                                                                                                      BIO_set_fp() sets the fp of a file BIO to fp. flags has the same meaning as in BIO_new_fp(), it is a macro.

                                                                                                                                      BIO_get_fp() retrieves the fp of a file BIO, it is a macro.

                                                                                                                                      BIO_seek() is a macro that sets the position pointer to offset bytes from the start of file.

                                                                                                                                      BIO_tell() returns the value of the position pointer.

                                                                                                                                      BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and BIO_rw_filename() set the file BIO b to use file name for reading, writing, append or read write respectively.

                                                                                                                                      "},{"location":"man3/BIO_s_file/#notes","title":"NOTES","text":"

                                                                                                                                      When wrapping stdout, stdin or stderr the underlying stream should not normally be closed so the BIO_NOCLOSE flag should be set.

                                                                                                                                      Because the file BIO calls the underlying stdio functions any quirks in stdio behaviour will be mirrored by the corresponding BIO.

                                                                                                                                      On Windows BIO_new_files reserves for the filename argument to be UTF-8 encoded. In other words if you have to make it work in multi- lingual environment, encode filenames in UTF-8.

                                                                                                                                      "},{"location":"man3/BIO_s_file/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_file() returns the file BIO method.

                                                                                                                                      BIO_new_file() and BIO_new_fp() return a file BIO or NULL if an error occurred.

                                                                                                                                      BIO_set_fp() and BIO_get_fp() return 1 for success or <=0 for failure (although the current implementation never return 0).

                                                                                                                                      BIO_seek() returns 0 for success or negative values for failure.

                                                                                                                                      BIO_tell() returns the current file position or negative values for failure.

                                                                                                                                      BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and BIO_rw_filename() return 1 for success or <=0 for failure.

                                                                                                                                      "},{"location":"man3/BIO_s_file/#examples","title":"EXAMPLES","text":"

                                                                                                                                      File BIO \"hello world\":

                                                                                                                                      BIO *bio_out;\n\nbio_out = BIO_new_fp(stdout, BIO_NOCLOSE);\nBIO_printf(bio_out, \"Hello World\\n\");\n

                                                                                                                                      Alternative technique:

                                                                                                                                      BIO *bio_out;\n\nbio_out = BIO_new(BIO_s_file());\nif (bio_out == NULL)\n    /* Error */\nif (BIO_set_fp(bio_out, stdout, BIO_NOCLOSE) <= 0)\n    /* Error */\nBIO_printf(bio_out, \"Hello World\\n\");\n

                                                                                                                                      Write to a file:

                                                                                                                                      BIO *out;\n\nout = BIO_new_file(\"filename.txt\", \"w\");\nif (!out)\n    /* Error */\nBIO_printf(out, \"Hello World\\n\");\nBIO_free(out);\n

                                                                                                                                      Alternative technique:

                                                                                                                                      BIO *out;\n\nout = BIO_new(BIO_s_file());\nif (out == NULL)\n    /* Error */\nif (BIO_write_filename(out, \"filename.txt\") <= 0)\n    /* Error */\nBIO_printf(out, \"Hello World\\n\");\nBIO_free(out);\n
                                                                                                                                      "},{"location":"man3/BIO_s_file/#bugs","title":"BUGS","text":"

                                                                                                                                      BIO_reset() and BIO_seek() are implemented using fseek() on the underlying stream. The return value for fseek() is 0 for success or -1 if an error occurred this differs from other types of BIO which will typically return 1 for success and a non positive value if an error occurred.

                                                                                                                                      "},{"location":"man3/BIO_s_file/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_seek(3), BIO_tell(3), BIO_reset(3), BIO_flush(3), BIO_read_ex(3), BIO_write_ex(3), BIO_puts(3), BIO_gets(3), BIO_printf(3), BIO_set_close(3), BIO_get_close(3)

                                                                                                                                      "},{"location":"man3/BIO_s_file/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_mem/","title":"BIO_s_mem","text":""},{"location":"man3/BIO_s_mem/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_secmem, BIO_s_mem, BIO_set_mem_eof_return, BIO_get_mem_data, BIO_set_mem_buf, BIO_get_mem_ptr, BIO_new_mem_buf - memory BIO

                                                                                                                                      "},{"location":"man3/BIO_s_mem/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_mem(void);\nconst BIO_METHOD *BIO_s_secmem(void);\n\nBIO_set_mem_eof_return(BIO *b, int v);\nlong BIO_get_mem_data(BIO *b, char **pp);\nBIO_set_mem_buf(BIO *b, BUF_MEM *bm, int c);\nBIO_get_mem_ptr(BIO *b, BUF_MEM **pp);\n\nBIO *BIO_new_mem_buf(const void *buf, int len);\n
                                                                                                                                      "},{"location":"man3/BIO_s_mem/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_mem() returns the memory BIO method function.

                                                                                                                                      A memory BIO is a source/sink BIO which uses memory for its I/O. Data written to a memory BIO is stored in a BUF_MEM structure which is extended as appropriate to accommodate the stored data.

                                                                                                                                      BIO_s_secmem() is like BIO_s_mem() except that the secure heap is used for buffer storage.

                                                                                                                                      Any data written to a memory BIO can be recalled by reading from it. Unless the memory BIO is read only any data read from it is deleted from the BIO.

                                                                                                                                      Memory BIOs support BIO_gets() and BIO_puts().

                                                                                                                                      If the BIO_CLOSE flag is set when a memory BIO is freed then the underlying BUF_MEM structure is also freed.

                                                                                                                                      Calling BIO_reset() on a read write memory BIO clears any data in it if the flag BIO_FLAGS_NONCLEAR_RST is not set, otherwise it just restores the read pointer to the state it was just after the last write was performed and the data can be read again. On a read only BIO it similarly restores the BIO to its original state and the read only data can be read again.

                                                                                                                                      BIO_eof() is true if no data is in the BIO.

                                                                                                                                      BIO_ctrl_pending() returns the number of bytes currently stored.

                                                                                                                                      BIO_set_mem_eof_return() sets the behaviour of memory BIO b when it is empty. If the v is zero then an empty memory BIO will return EOF (that is it will return zero and BIO_should_retry(b) will be false. If v is non zero then it will return v when it is empty and it will set the read retry flag (that is BIO_read_retry(b) is true). To avoid ambiguity with a normal positive return value v should be set to a negative value, typically -1.

                                                                                                                                      BIO_get_mem_data() sets *pp to a pointer to the start of the memory BIOs data and returns the total amount of data available. It is implemented as a macro. Note the pointer returned by this call is informative, no transfer of ownership of this memory is implied. See notes on BIO_set_close().

                                                                                                                                      BIO_set_mem_buf() sets the internal BUF_MEM structure to bm and sets the close flag to c, that is c should be either BIO_CLOSE or BIO_NOCLOSE. It is a macro.

                                                                                                                                      BIO_get_mem_ptr() places the underlying BUF_MEM structure in *pp. It is a macro.

                                                                                                                                      BIO_new_mem_buf() creates a memory BIO using len bytes of data at buf, if len is -1 then the buf is assumed to be nul terminated and its length is determined by strlen. The BIO is set to a read only state and as a result cannot be written to. This is useful when some data needs to be made available from a static area of memory in the form of a BIO. The supplied data is read directly from the supplied buffer: it is not copied first, so the supplied area of memory must be unchanged until the BIO is freed.

                                                                                                                                      "},{"location":"man3/BIO_s_mem/#notes","title":"NOTES","text":"

                                                                                                                                      Writes to memory BIOs will always succeed if memory is available: that is their size can grow indefinitely.

                                                                                                                                      Every write after partial read (not all data in the memory buffer was read) to a read write memory BIO will have to move the unread data with an internal copy operation, if a BIO contains a lot of data and it is read in small chunks intertwined with writes the operation can be very slow. Adding a buffering BIO to the chain can speed up the process.

                                                                                                                                      Calling BIO_set_mem_buf() on a BIO created with BIO_new_secmem() will give undefined results, including perhaps a program crash.

                                                                                                                                      Switching the memory BIO from read write to read only is not supported and can give undefined results including a program crash. There are two notable exceptions to the rule. The first one is to assign a static memory buffer immediately after BIO creation and set the BIO as read only.

                                                                                                                                      The other supported sequence is to start with read write BIO then temporarily switch it to read only and call BIO_reset() on the read only BIO immediately before switching it back to read write. Before the BIO is freed it must be switched back to the read write mode.

                                                                                                                                      Calling BIO_get_mem_ptr() on read only BIO will return a BUF_MEM that contains only the remaining data to be read. If the close status of the BIO is set to BIO_NOCLOSE, before freeing the BUF_MEM the data pointer in it must be set to NULL as the data pointer does not point to an allocated memory.

                                                                                                                                      Calling BIO_reset() on a read write memory BIO with BIO_FLAGS_NONCLEAR_RST flag set can have unexpected outcome when the reads and writes to the BIO are intertwined. As documented above the BIO will be reset to the state after the last completed write operation. The effects of reads preceding that write operation cannot be undone.

                                                                                                                                      Calling BIO_get_mem_ptr() prior to a BIO_reset() call with BIO_FLAGS_NONCLEAR_RST set has the same effect as a write operation.

                                                                                                                                      Calling BIO_set_close() with BIO_NOCLOSE orphans the BUF_MEM internal to the BIO, _not_ its actual data buffer. See the examples section for the proper method for claiming ownership of the data pointer for a deferred free operation.

                                                                                                                                      "},{"location":"man3/BIO_s_mem/#bugs","title":"BUGS","text":"

                                                                                                                                      There should be an option to set the maximum size of a memory BIO.

                                                                                                                                      "},{"location":"man3/BIO_s_mem/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_mem() and BIO_s_secmem() return a valid memory BIO_METHOD structure.

                                                                                                                                      BIO_set_mem_eof_return(), BIO_set_mem_buf() and BIO_get_mem_ptr() return 1 on success or a value which is less than or equal to 0 if an error occurred.

                                                                                                                                      BIO_get_mem_data() returns the total number of bytes available on success, 0 if b is NULL, or a negative value in case of other errors.

                                                                                                                                      BIO_new_mem_buf() returns a valid BIO structure on success or NULL on error.

                                                                                                                                      "},{"location":"man3/BIO_s_mem/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Create a memory BIO and write some data to it:

                                                                                                                                      BIO *mem = BIO_new(BIO_s_mem());\n\nBIO_puts(mem, \"Hello World\\n\");\n

                                                                                                                                      Create a read only memory BIO:

                                                                                                                                      char data[] = \"Hello World\";\nBIO *mem = BIO_new_mem_buf(data, -1);\n

                                                                                                                                      Extract the BUF_MEM structure from a memory BIO and then free up the BIO:

                                                                                                                                      BUF_MEM *bptr;\n\nBIO_get_mem_ptr(mem, &bptr);\nBIO_set_close(mem, BIO_NOCLOSE); /* So BIO_free() leaves BUF_MEM alone */\nBIO_free(mem);\n

                                                                                                                                      Extract the BUF_MEM ptr, claim ownership of the internal data and free the BIO and BUF_MEM structure:

                                                                                                                                      BUF_MEM *bptr;\nchar *data;\n\nBIO_get_mem_data(bio, &data);\nBIO_get_mem_ptr(bio, &bptr);\nBIO_set_close(mem, BIO_NOCLOSE); /* So BIO_free orphans BUF_MEM */\nBIO_free(bio);\nbptr->data = NULL; /* Tell BUF_MEM to orphan data */\nBUF_MEM_free(bptr);\n...\nfree(data);\n
                                                                                                                                      "},{"location":"man3/BIO_s_mem/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_null/","title":"BIO_s_null","text":""},{"location":"man3/BIO_s_null/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_null - null data sink

                                                                                                                                      "},{"location":"man3/BIO_s_null/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_null(void);\n
                                                                                                                                      "},{"location":"man3/BIO_s_null/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_null() returns the null sink BIO method. Data written to the null sink is discarded, reads return EOF.

                                                                                                                                      "},{"location":"man3/BIO_s_null/#notes","title":"NOTES","text":"

                                                                                                                                      A null sink BIO behaves in a similar manner to the Unix /dev/null device.

                                                                                                                                      A null bio can be placed on the end of a chain to discard any data passed through it.

                                                                                                                                      A null sink is useful if, for example, an application wishes to digest some data by writing through a digest bio but not send the digested data anywhere. Since a BIO chain must normally include a source/sink BIO this can be achieved by adding a null sink BIO to the end of the chain

                                                                                                                                      "},{"location":"man3/BIO_s_null/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_null() returns the null sink BIO method.

                                                                                                                                      "},{"location":"man3/BIO_s_null/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_s_socket/","title":"BIO_s_socket","text":""},{"location":"man3/BIO_s_socket/#name","title":"NAME","text":"

                                                                                                                                      BIO_s_socket, BIO_new_socket - socket BIO

                                                                                                                                      "},{"location":"man3/BIO_s_socket/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nconst BIO_METHOD *BIO_s_socket(void);\n\nBIO *BIO_new_socket(int sock, int close_flag);\n
                                                                                                                                      "},{"location":"man3/BIO_s_socket/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_s_socket() returns the socket BIO method. This is a wrapper round the platform's socket routines.

                                                                                                                                      BIO_read_ex() and BIO_write_ex() read or write the underlying socket. BIO_puts() is supported but BIO_gets() is not.

                                                                                                                                      If the close flag is set then the socket is shut down and closed when the BIO is freed.

                                                                                                                                      BIO_new_socket() returns a socket BIO using sock and close_flag.

                                                                                                                                      "},{"location":"man3/BIO_s_socket/#notes","title":"NOTES","text":"

                                                                                                                                      Socket BIOs also support any relevant functionality of file descriptor BIOs.

                                                                                                                                      The reason for having separate file descriptor and socket BIOs is that on some platforms sockets are not file descriptors and use distinct I/O routines, Windows is one such platform. Any code mixing the two will not work on all platforms.

                                                                                                                                      "},{"location":"man3/BIO_s_socket/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_s_socket() returns the socket BIO method.

                                                                                                                                      BIO_new_socket() returns the newly allocated BIO or NULL is an error occurred.

                                                                                                                                      "},{"location":"man3/BIO_s_socket/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_set_callback/","title":"BIO_set_callback","text":""},{"location":"man3/BIO_set_callback/#name","title":"NAME","text":"

                                                                                                                                      BIO_set_callback_ex, BIO_get_callback_ex, BIO_set_callback, BIO_get_callback, BIO_set_callback_arg, BIO_get_callback_arg, BIO_debug_callback, BIO_debug_callback_ex, BIO_callback_fn_ex, BIO_callback_fn - BIO callback functions

                                                                                                                                      "},{"location":"man3/BIO_set_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\ntypedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp,\n                                   size_t len, int argi,\n                                   long argl, int ret, size_t *processed);\n\nvoid BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback);\nBIO_callback_fn_ex BIO_get_callback_ex(const BIO *b);\n\nvoid BIO_set_callback_arg(BIO *b, char *arg);\nchar *BIO_get_callback_arg(const BIO *b);\n\nlong BIO_debug_callback_ex(BIO *bio, int oper, const char *argp, size_t len,\n                           int argi, long argl, int ret, size_t *processed);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi,\n                                long argl, long ret);\nvoid BIO_set_callback(BIO *b, BIO_callback_fn cb);\nBIO_callback_fn BIO_get_callback(const BIO *b);\nlong BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi,\n                        long argl, long ret);\n
                                                                                                                                      "},{"location":"man3/BIO_set_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_set_callback_ex() and BIO_get_callback_ex() set and retrieve the BIO callback. The callback is called during most high-level BIO operations. It can be used for debugging purposes to trace operations on a BIO or to modify its operation.

                                                                                                                                      BIO_set_callback() and BIO_get_callback() set and retrieve the old format BIO callback. New code should not use these functions, but they are retained for backwards compatibility. Any callback set via BIO_set_callback_ex() will get called in preference to any set by BIO_set_callback().

                                                                                                                                      BIO_set_callback_arg() and BIO_get_callback_arg() are macros which can be used to set and retrieve an argument for use in the callback.

                                                                                                                                      BIO_debug_callback_ex() is a standard debugging callback which prints out information relating to each BIO operation. If the callback argument is set it is interpreted as a BIO to send the information to, otherwise stderr is used. The BIO_debug_callback() function is the deprecated version of the same callback for use with the old callback format BIO_set_callback() function.

                                                                                                                                      BIO_callback_fn_ex is the type of the callback function and BIO_callback_fn is the type of the old format callback function. The meaning of each argument is described below:

                                                                                                                                      • b

                                                                                                                                        The BIO the callback is attached to is passed in b.

                                                                                                                                      • oper

                                                                                                                                        oper is set to the operation being performed. For some operations the callback is called twice, once before and once after the actual operation, the latter case has oper or'ed with BIO_CB_RETURN.

                                                                                                                                      • len

                                                                                                                                        The length of the data requested to be read or written. This is only useful if oper is BIO_CB_READ, BIO_CB_WRITE or BIO_CB_GETS.

                                                                                                                                      • argp argi argl

                                                                                                                                        The meaning of the arguments argp, argi and argl depends on the value of oper, that is the operation being performed.

                                                                                                                                      • processed

                                                                                                                                        processed is a pointer to a location which will be updated with the amount of data that was actually read or written. Only used for BIO_CB_READ, BIO_CB_WRITE, BIO_CB_GETS and BIO_CB_PUTS.

                                                                                                                                      • ret

                                                                                                                                        ret is the return value that would be returned to the application if no callback were present. The actual value returned is the return value of the callback itself. In the case of callbacks called before the actual BIO operation 1 is placed in ret, if the return value is not positive it will be immediately returned to the application and the BIO operation will not be performed.

                                                                                                                                      The callback should normally simply return ret when it has finished processing, unless it specifically wishes to modify the value returned to the application.

                                                                                                                                      "},{"location":"man3/BIO_set_callback/#callback-operations","title":"CALLBACK OPERATIONS","text":"

                                                                                                                                      In the notes below, callback defers to the actual callback function that is called.

                                                                                                                                      • BIO_free(b)

                                                                                                                                        callback_ex(b, BIO_CB_FREE, NULL, 0, 0, 0L, 1L, NULL)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_FREE, NULL, 0L, 0L, 1L)\n

                                                                                                                                        is called before the free operation.

                                                                                                                                      • BIO_read_ex(b, data, dlen, readbytes)

                                                                                                                                        callback_ex(b, BIO_CB_READ, data, dlen, 0, 0L, 1L, NULL)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_READ, data, dlen, 0L, 1L)\n

                                                                                                                                        is called before the read and

                                                                                                                                        callback_ex(b, BIO_CB_READ | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue,\n            &readbytes)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_READ|BIO_CB_RETURN, data, dlen, 0L, retvalue)\n

                                                                                                                                        after.

                                                                                                                                      • BIO_write(b, data, dlen, written)

                                                                                                                                        callback_ex(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L, NULL)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_WRITE, datat, dlen, 0L, 1L)\n

                                                                                                                                        is called before the write and

                                                                                                                                        callback_ex(b, BIO_CB_WRITE | BIO_CB_RETURN, data, dlen, 0, 0L, retvalue,\n            &written)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_WRITE|BIO_CB_RETURN, data, dlen, 0L, retvalue)\n

                                                                                                                                        after.

                                                                                                                                      • BIO_gets(b, buf, size)

                                                                                                                                        callback_ex(b, BIO_CB_GETS, buf, size, 0, 0L, 1, NULL, NULL)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_GETS, buf, size, 0L, 1L)\n

                                                                                                                                        is called before the operation and

                                                                                                                                        callback_ex(b, BIO_CB_GETS | BIO_CB_RETURN, buf, size, 0, 0L, retvalue,\n            &readbytes)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_GETS|BIO_CB_RETURN, buf, size, 0L, retvalue)\n

                                                                                                                                        after.

                                                                                                                                      • BIO_puts(b, buf)

                                                                                                                                        callback_ex(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_PUTS, buf, 0, 0L, 1L)\n

                                                                                                                                        is called before the operation and

                                                                                                                                        callback_ex(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0, 0L, retvalue, &written)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_PUTS|BIO_CB_RETURN, buf, 0, 0L, retvalue)\n

                                                                                                                                        after.

                                                                                                                                      • BIO_ctrl(BIO *b, int cmd, long larg, void *parg)

                                                                                                                                        callback_ex(b, BIO_CB_CTRL, parg, 0, cmd, larg, 1L, NULL)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_CTRL, parg, cmd, larg, 1L)\n

                                                                                                                                        is called before the call and

                                                                                                                                        callback_ex(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, 0, cmd, larg, ret, NULL)\n

                                                                                                                                        or

                                                                                                                                        callback(b, BIO_CB_CTRL|BIO_CB_RETURN, parg, cmd, larg, ret)\n

                                                                                                                                        after.

                                                                                                                                        Note: cmd == BIO_CTRL_SET_CALLBACK is special, because parg is not the argument of type BIO_info_cb itself. In this case parg is a pointer to the actual call parameter, see BIO_callback_ctrl.

                                                                                                                                      "},{"location":"man3/BIO_set_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_get_callback_ex() and BIO_get_callback() return the callback function previously set by a call to BIO_set_callback_ex() and BIO_set_callback() respectively.

                                                                                                                                      BIO_get_callback_arg() returns a char pointer to the value previously set via a call to BIO_set_callback_arg().

                                                                                                                                      BIO_debug_callback() returns 1 or ret if it's called after specific BIO operations.

                                                                                                                                      "},{"location":"man3/BIO_set_callback/#examples","title":"EXAMPLES","text":"

                                                                                                                                      The BIO_debug_callback_ex() function is an example, its source is in crypto/bio/bio_cb.c

                                                                                                                                      "},{"location":"man3/BIO_set_callback/#history","title":"HISTORY","text":"

                                                                                                                                      The BIO_debug_callback_ex() function was added in OpenSSL 3.0.

                                                                                                                                      BIO_set_callback(), BIO_get_callback(), and BIO_debug_callback() were deprecated in OpenSSL 3.0. Use the non-deprecated _ex functions instead.

                                                                                                                                      "},{"location":"man3/BIO_set_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_should_retry/","title":"BIO_should_retry","text":""},{"location":"man3/BIO_should_retry/#name","title":"NAME","text":"

                                                                                                                                      BIO_should_read, BIO_should_write, BIO_should_io_special, BIO_retry_type, BIO_should_retry, BIO_get_retry_BIO, BIO_get_retry_reason, BIO_set_retry_reason - BIO retry functions

                                                                                                                                      "},{"location":"man3/BIO_should_retry/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\nint BIO_should_read(BIO *b);\nint BIO_should_write(BIO *b);\nint BIO_should_io_special(iBIO *b);\nint BIO_retry_type(BIO *b);\nint BIO_should_retry(BIO *b);\n\nBIO *BIO_get_retry_BIO(BIO *bio, int *reason);\nint BIO_get_retry_reason(BIO *bio);\nvoid BIO_set_retry_reason(BIO *bio, int reason);\n
                                                                                                                                      "},{"location":"man3/BIO_should_retry/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions determine why a BIO is not able to read or write data. They will typically be called after a failed BIO_read_ex() or BIO_write_ex() call.

                                                                                                                                      BIO_should_retry() is true if the call that produced this condition should then be retried at a later time.

                                                                                                                                      If BIO_should_retry() is false then the cause is an error condition.

                                                                                                                                      BIO_should_read() is true if the cause of the condition is that the BIO has insufficient data to return. Check for readability and/or retry the last operation.

                                                                                                                                      BIO_should_write() is true if the cause of the condition is that the BIO has pending data to write. Check for writability and/or retry the last operation.

                                                                                                                                      BIO_should_io_special() is true if some \"special\" condition, that is a reason other than reading or writing is the cause of the condition.

                                                                                                                                      BIO_retry_type() returns a mask of the cause of a retry condition consisting of the values BIO_FLAGS_READ, BIO_FLAGS_WRITE, BIO_FLAGS_IO_SPECIAL though current BIO types will only set one of these.

                                                                                                                                      BIO_get_retry_BIO() determines the precise reason for the special condition, it returns the BIO that caused this condition and if reason is not NULL it contains the reason code. The meaning of the reason code and the action that should be taken depends on the type of BIO that resulted in this condition.

                                                                                                                                      BIO_get_retry_reason() returns the reason for a special condition if passed the relevant BIO, for example as returned by BIO_get_retry_BIO().

                                                                                                                                      BIO_set_retry_reason() sets the retry reason for a special condition for a given BIO. This would usually only be called by BIO implementations.

                                                                                                                                      "},{"location":"man3/BIO_should_retry/#notes","title":"NOTES","text":"

                                                                                                                                      BIO_should_read(), BIO_should_write(), BIO_should_io_special(), BIO_retry_type(), and BIO_should_retry(), are implemented as macros.

                                                                                                                                      If BIO_should_retry() returns false then the precise \"error condition\" depends on the BIO type that caused it and the return code of the BIO operation. For example if a call to BIO_read_ex() on a socket BIO returns 0 and BIO_should_retry() is false then the cause will be that the connection closed. A similar condition on a file BIO will mean that it has reached EOF. Some BIO types may place additional information on the error queue. For more details see the individual BIO type manual pages.

                                                                                                                                      If the underlying I/O structure is in a blocking mode almost all current BIO types will not request a retry, because the underlying I/O calls will not. If the application knows that the BIO type will never signal a retry then it need not call BIO_should_retry() after a failed BIO I/O call. This is typically done with file BIOs.

                                                                                                                                      SSL BIOs are the only current exception to this rule: they can request a retry even if the underlying I/O structure is blocking, if a handshake occurs during a call to BIO_read(). An application can retry the failed call immediately or avoid this situation by setting SSL_MODE_AUTO_RETRY on the underlying SSL structure.

                                                                                                                                      While an application may retry a failed non blocking call immediately this is likely to be very inefficient because the call will fail repeatedly until data can be processed or is available. An application will normally wait until the necessary condition is satisfied. How this is done depends on the underlying I/O structure.

                                                                                                                                      For example if the cause is ultimately a socket and BIO_should_read() is true then a call to select() may be made to wait until data is available and then retry the BIO operation. By combining the retry conditions of several non blocking BIOs in a single select() call it is possible to service several BIOs in a single thread, though the performance may be poor if SSL BIOs are present because long delays can occur during the initial handshake process.

                                                                                                                                      It is possible for a BIO to block indefinitely if the underlying I/O structure cannot process or return any data. This depends on the behaviour of the platforms I/O functions. This is often not desirable: one solution is to use non blocking I/O and use a timeout on the select() (or equivalent) call.

                                                                                                                                      "},{"location":"man3/BIO_should_retry/#bugs","title":"BUGS","text":"

                                                                                                                                      The OpenSSL ASN1 functions cannot gracefully deal with non blocking I/O: that is they cannot retry after a partial read or write. This is usually worked around by only passing the relevant data to ASN1 functions when the entire structure can be read or written.

                                                                                                                                      "},{"location":"man3/BIO_should_retry/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_should_read(), BIO_should_write(), BIO_should_io_special(), and BIO_should_retry() return either 1 or 0 based on the actual conditions of the BIO.

                                                                                                                                      BIO_retry_type() returns a flag combination presenting the cause of a retry condition or false if there is no retry condition.

                                                                                                                                      BIO_get_retry_BIO() returns a valid BIO structure.

                                                                                                                                      BIO_get_retry_reason() returns the reason for a special condition.

                                                                                                                                      "},{"location":"man3/BIO_should_retry/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7)

                                                                                                                                      "},{"location":"man3/BIO_should_retry/#history","title":"HISTORY","text":"

                                                                                                                                      The BIO_get_retry_reason() and BIO_set_retry_reason() functions were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/BIO_should_retry/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BIO_socket_wait/","title":"BIO_socket_wait","text":""},{"location":"man3/BIO_socket_wait/#name","title":"NAME","text":"

                                                                                                                                      BIO_socket_wait, BIO_wait, BIO_do_connect_retry - BIO connection utility functions

                                                                                                                                      "},{"location":"man3/BIO_socket_wait/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bio.h>\n\n#ifndef OPENSSL_NO_SOCK\nint BIO_socket_wait(int fd, int for_read, time_t max_time);\n#endif\nint BIO_wait(BIO *bio, time_t max_time, unsigned int nap_milliseconds);\nint BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds);\n
                                                                                                                                      "},{"location":"man3/BIO_socket_wait/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BIO_socket_wait() waits on the socket fd for reading if for_read is not 0, else for writing, at most until max_time. It succeeds immediately if max_time == 0 (which means no timeout given).

                                                                                                                                      BIO_wait() waits at most until max_time on the given (typically socket-based) bio, for reading if bio is supposed to read, else for writing. It is used by BIO_do_connect_retry() and can be used together BIO_read(3). It succeeds immediately if max_time == 0 (which means no timeout given). If sockets are not available it supports polling by succeeding after sleeping at most the given nap_milliseconds in order to avoid a tight busy loop. Via nap_milliseconds the caller determines the polling granularity.

                                                                                                                                      BIO_do_connect_retry() connects via the given bio. It retries BIO_do_connect() as far as needed to reach a definite outcome, i.e., connection succeeded, timeout has been reached, or an error occurred. For nonblocking and potentially even non-socket BIOs it polls every nap_milliseconds and sleeps in between using BIO_wait(). If nap_milliseconds is < 0 then a default value of 100 ms is used. If the timeout parameter is > 0 this indicates the maximum number of seconds to wait until the connection is established or a definite error occurred. A value of 0 enables waiting indefinitely (i.e, no timeout), while a value < 0 means that BIO_do_connect() is tried only once. The function may, directly or indirectly, invoke ERR_clear_error().

                                                                                                                                      "},{"location":"man3/BIO_socket_wait/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() return -1 on error, 0 on timeout, and 1 on success.

                                                                                                                                      "},{"location":"man3/BIO_socket_wait/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BIO_do_connect(3), BIO_read(3)

                                                                                                                                      "},{"location":"man3/BIO_socket_wait/#history","title":"HISTORY","text":"

                                                                                                                                      BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/BIO_socket_wait/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_BLINDING_new/","title":"BN_BLINDING_new","text":""},{"location":"man3/BN_BLINDING_new/#name","title":"NAME","text":"

                                                                                                                                      BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert, BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex, BN_BLINDING_is_current_thread, BN_BLINDING_set_current_thread, BN_BLINDING_lock, BN_BLINDING_unlock, BN_BLINDING_get_flags, BN_BLINDING_set_flags, BN_BLINDING_create_param - blinding related BIGNUM functions

                                                                                                                                      "},{"location":"man3/BN_BLINDING_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nBN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai,\n                             BIGNUM *mod);\nvoid BN_BLINDING_free(BN_BLINDING *b);\nint BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b,\n                           BN_CTX *ctx);\nint BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,\n                          BN_CTX *ctx);\nint BN_BLINDING_is_current_thread(BN_BLINDING *b);\nvoid BN_BLINDING_set_current_thread(BN_BLINDING *b);\nint BN_BLINDING_lock(BN_BLINDING *b);\nint BN_BLINDING_unlock(BN_BLINDING *b);\nunsigned long BN_BLINDING_get_flags(const BN_BLINDING *b);\nvoid BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags);\nBN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,\n                                      const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,\n                                      int (*bn_mod_exp)(BIGNUM *r,\n                                                        const BIGNUM *a,\n                                                        const BIGNUM *p,\n                                                        const BIGNUM *m,\n                                                        BN_CTX *ctx,\n                                                        BN_MONT_CTX *m_ctx),\n                                      BN_MONT_CTX *m_ctx);\n
                                                                                                                                      "},{"location":"man3/BN_BLINDING_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_BLINDING_new() allocates a new BN_BLINDING structure and copies the A and Ai values into the newly created BN_BLINDING object.

                                                                                                                                      BN_BLINDING_free() frees the BN_BLINDING structure. If b is NULL, nothing is done.

                                                                                                                                      BN_BLINDING_update() updates the BN_BLINDING parameters by squaring the A and Ai or, after specific number of uses and if the necessary parameters are set, by re-creating the blinding parameters.

                                                                                                                                      BN_BLINDING_convert_ex() multiplies n with the blinding factor A. If r is not NULL a copy the inverse blinding factor Ai will be returned in r (this is useful if a RSA object is shared among several threads). BN_BLINDING_invert_ex() multiplies n with the inverse blinding factor Ai. If r is not NULL it will be used as the inverse blinding.

                                                                                                                                      BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() with r set to NULL.

                                                                                                                                      BN_BLINDING_is_current_thread() returns whether the BN_BLINDING structure is owned by the current thread. This is to help users provide proper locking if needed for multi-threaded use.

                                                                                                                                      BN_BLINDING_set_current_thread() sets the current thread as the owner of the BN_BLINDING structure.

                                                                                                                                      BN_BLINDING_lock() locks the BN_BLINDING structure.

                                                                                                                                      BN_BLINDING_unlock() unlocks the BN_BLINDING structure.

                                                                                                                                      BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently there are two supported flags: BN_BLINDING_NO_UPDATE and BN_BLINDING_NO_RECREATE. BN_BLINDING_NO_UPDATE inhibits the automatic update of the BN_BLINDING parameters after each use and BN_BLINDING_NO_RECREATE inhibits the automatic re-creation of the BN_BLINDING parameters after a fixed number of uses (currently 32). In newly allocated BN_BLINDING objects no flags are set. BN_BLINDING_set_flags() sets the BN_BLINDING parameters flags.

                                                                                                                                      BN_BLINDING_create_param() creates new BN_BLINDING parameters using the exponent e and the modulus m. bn_mod_exp and m_ctx can be used to pass special functions for exponentiation (normally BN_mod_exp_mont() and BN_MONT_CTX).

                                                                                                                                      "},{"location":"man3/BN_BLINDING_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_BLINDING_new() returns the newly allocated BN_BLINDING structure or NULL in case of an error.

                                                                                                                                      BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(), BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on success and 0 if an error occurred.

                                                                                                                                      BN_BLINDING_is_current_thread() returns 1 if the current thread owns the BN_BLINDING object, 0 otherwise.

                                                                                                                                      BN_BLINDING_set_current_thread() doesn't return anything.

                                                                                                                                      BN_BLINDING_lock(), BN_BLINDING_unlock() return 1 if the operation succeeded or 0 on error.

                                                                                                                                      BN_BLINDING_get_flags() returns the currently set BN_BLINDING flags (a unsigned long value).

                                                                                                                                      BN_BLINDING_create_param() returns the newly created BN_BLINDING parameters or NULL on error.

                                                                                                                                      "},{"location":"man3/BN_BLINDING_new/#history","title":"HISTORY","text":"

                                                                                                                                      BN_BLINDING_thread_id() was first introduced in OpenSSL 1.0.0, and it deprecates BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id().

                                                                                                                                      "},{"location":"man3/BN_BLINDING_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2005-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_CTX_new/","title":"BN_CTX_new","text":""},{"location":"man3/BN_CTX_new/#name","title":"NAME","text":"

                                                                                                                                      BN_CTX_new_ex, BN_CTX_new, BN_CTX_secure_new_ex, BN_CTX_secure_new, BN_CTX_free - allocate and free BN_CTX structures

                                                                                                                                      "},{"location":"man3/BN_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nBN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx);\nBN_CTX *BN_CTX_new(void);\n\nBN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx);\nBN_CTX *BN_CTX_secure_new(void);\n\nvoid BN_CTX_free(BN_CTX *c);\n
                                                                                                                                      "},{"location":"man3/BN_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      A BN_CTX is a structure that holds BIGNUM temporary variables used by library functions. Since dynamic memory allocation to create BIGNUMs is rather expensive when used in conjunction with repeated subroutine calls, the BN_CTX structure is used.

                                                                                                                                      BN_CTX_new_ex() allocates and initializes a BN_CTX structure for the given library context ctx. The <ctx> value may be NULL in which case the default library context will be used. BN_CTX_new() is the same as BN_CTX_new_ex() except that the default library context is always used.

                                                                                                                                      BN_CTX_secure_new_ex() allocates and initializes a BN_CTX structure but uses the secure heap (see CRYPTO_secure_malloc(3)) to hold the BIGNUMs for the given library context ctx. The <ctx> value may be NULL in which case the default library context will be used. BN_CTX_secure_new() is the same as BN_CTX_secure_new_ex() except that the default library context is always used.

                                                                                                                                      BN_CTX_free() frees the components of the BN_CTX and the structure itself. Since BN_CTX_start() is required in order to obtain BIGNUMs from the BN_CTX, in most cases BN_CTX_end() must be called before the BN_CTX may be freed by BN_CTX_free(). If c is NULL, nothing is done.

                                                                                                                                      A given BN_CTX must only be used by a single thread of execution. No locking is performed, and the internal pool allocator will not properly handle multiple threads of execution.

                                                                                                                                      "},{"location":"man3/BN_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_CTX_new() and BN_CTX_secure_new() return a pointer to the BN_CTX. If the allocation fails, they return NULL and sets an error code that can be obtained by ERR_get_error(3).

                                                                                                                                      BN_CTX_free() has no return values.

                                                                                                                                      "},{"location":"man3/BN_CTX_new/#removed-functionality","title":"REMOVED FUNCTIONALITY","text":"
                                                                                                                                      void BN_CTX_init(BN_CTX *c);\n

                                                                                                                                      BN_CTX_init() is no longer available as of OpenSSL 1.1.0. Applications should replace use of BN_CTX_init with BN_CTX_new instead:

                                                                                                                                      BN_CTX *ctx;\nctx = BN_CTX_new();\nif (!ctx)\n    /* error */\n...\nBN_CTX_free(ctx);\n
                                                                                                                                      "},{"location":"man3/BN_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_add(3), BN_CTX_start(3)

                                                                                                                                      "},{"location":"man3/BN_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                      BN_CTX_init() was removed in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/BN_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_CTX_start/","title":"BN_CTX_start","text":""},{"location":"man3/BN_CTX_start/#name","title":"NAME","text":"

                                                                                                                                      BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables

                                                                                                                                      "},{"location":"man3/BN_CTX_start/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nvoid BN_CTX_start(BN_CTX *ctx);\n\nBIGNUM *BN_CTX_get(BN_CTX *ctx);\n\nvoid BN_CTX_end(BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/BN_CTX_start/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions are used to obtain temporary BIGNUM variables from a BN_CTX (which can been created by using BN_CTX_new(3)) in order to save the overhead of repeatedly creating and freeing BIGNUMs in functions that are called from inside a loop.

                                                                                                                                      A function must call BN_CTX_start() first. Then, BN_CTX_get() may be called repeatedly to obtain temporary BIGNUMs. All BN_CTX_get() calls must be made before calling any other functions that use the ctx as an argument.

                                                                                                                                      Finally, BN_CTX_end() must be called before returning from the function. If ctx is NULL, nothing is done. When BN_CTX_end() is called, the BIGNUM pointers obtained from BN_CTX_get() become invalid.

                                                                                                                                      "},{"location":"man3/BN_CTX_start/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_CTX_start() and BN_CTX_end() return no values.

                                                                                                                                      BN_CTX_get() returns a pointer to the BIGNUM, or NULL on error. Once BN_CTX_get() has failed, the subsequent calls will return NULL as well, so it is sufficient to check the return value of the last BN_CTX_get() call. In case of an error, an error code is set, which can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_CTX_start/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BN_CTX_new(3)

                                                                                                                                      "},{"location":"man3/BN_CTX_start/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_add/","title":"BN_add","text":""},{"location":"man3/BN_add/#name","title":"NAME","text":"

                                                                                                                                      BN_add, BN_sub, BN_mul, BN_sqr, BN_div, BN_mod, BN_nnmod, BN_mod_add, BN_mod_sub, BN_mod_mul, BN_mod_sqr, BN_mod_sqrt, BN_exp, BN_mod_exp, BN_gcd - arithmetic operations on BIGNUMs

                                                                                                                                      "},{"location":"man3/BN_add/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\n\nint BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\n\nint BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\n\nint BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx);\n\nint BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d,\n           BN_CTX *ctx);\n\nint BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\n\nint BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\n\nint BN_mod_add(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m,\n               BN_CTX *ctx);\n\nint BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m,\n               BN_CTX *ctx);\n\nint BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m,\n               BN_CTX *ctx);\n\nint BN_mod_sqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\n\nBIGNUM *BN_mod_sqrt(BIGNUM *in, BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\n\nint BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx);\n\nint BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p,\n               const BIGNUM *m, BN_CTX *ctx);\n\nint BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/BN_add/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_add() adds a and b and places the result in r (r=a+b). r may be the same BIGNUM as a or b.

                                                                                                                                      BN_sub() subtracts b from a and places the result in r (r=a-b). r may be the same BIGNUM as a or b.

                                                                                                                                      BN_mul() multiplies a and b and places the result in r (r=a*b). r may be the same BIGNUM as a or b. For multiplication by powers of 2, use BN_lshift(3).

                                                                                                                                      BN_sqr() takes the square of a and places the result in r (r=a^2). r and a may be the same BIGNUM. This function is faster than BN_mul(r,a,a).

                                                                                                                                      BN_div() divides a by d and places the result in dv and the remainder in rem (dv=a/d, rem=a%d). Either of dv and rem may be NULL, in which case the respective value is not returned. The result is rounded towards zero; thus if a is negative, the remainder will be zero or negative. For division by powers of 2, use BN_rshift(3).

                                                                                                                                      BN_mod() corresponds to BN_div() with dv set to NULL.

                                                                                                                                      BN_nnmod() reduces a modulo m and places the nonnegative remainder in r.

                                                                                                                                      BN_mod_add() adds a to b modulo m and places the nonnegative result in r.

                                                                                                                                      BN_mod_sub() subtracts b from a modulo m and places the nonnegative result in r.

                                                                                                                                      BN_mod_mul() multiplies a by b and finds the nonnegative remainder respective to modulus m (r=(a*b) mod m). r may be the same BIGNUM as a or b. For more efficient algorithms for repeated computations using the same modulus, see BN_mod_mul_montgomery(3) and BN_mod_mul_reciprocal(3).

                                                                                                                                      BN_mod_sqr() takes the square of a modulo m and places the result in r.

                                                                                                                                      BN_mod_sqrt() returns the modular square root of a such that in^2 = a (mod p). The modulus p must be a prime, otherwise an error or an incorrect \"result\" will be returned. The result is stored into in which can be NULL. The result will be newly allocated in that case.

                                                                                                                                      BN_exp() raises a to the p-th power and places the result in r (r=a^p). This function is faster than repeated applications of BN_mul().

                                                                                                                                      BN_mod_exp() computes a to the p-th power modulo m (r=a^p % m). This function uses less time and space than BN_exp(). Do not call this function when m is even and any of the parameters have the BN_FLG_CONSTTIME flag set.

                                                                                                                                      BN_gcd() computes the greatest common divisor of a and b and places the result in r. r may be the same BIGNUM as a or b.

                                                                                                                                      For all functions, ctx is a previously allocated BN_CTX used for temporary variables; see BN_CTX_new(3).

                                                                                                                                      Unless noted otherwise, the result BIGNUM must be different from the arguments.

                                                                                                                                      "},{"location":"man3/BN_add/#notes","title":"NOTES","text":"

                                                                                                                                      For modular operations such as BN_nnmod() or BN_mod_exp() it is an error to use the same BIGNUM object for the modulus as for the output.

                                                                                                                                      "},{"location":"man3/BN_add/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The BN_mod_sqrt() returns the result (possibly incorrect if p is not a prime), or NULL.

                                                                                                                                      For all remaining functions, 1 is returned for success, 0 on error. The return value should always be checked (e.g., if (!BN_add(r,a,b)) goto err;). The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_add/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_CTX_new(3), BN_add_word(3), BN_set_bit(3)

                                                                                                                                      "},{"location":"man3/BN_add/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_add_word/","title":"BN_add_word","text":""},{"location":"man3/BN_add_word/#name","title":"NAME","text":"

                                                                                                                                      BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic functions on BIGNUMs with integers

                                                                                                                                      "},{"location":"man3/BN_add_word/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_add_word(BIGNUM *a, BN_ULONG w);\n\nint BN_sub_word(BIGNUM *a, BN_ULONG w);\n\nint BN_mul_word(BIGNUM *a, BN_ULONG w);\n\nBN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);\n\nBN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);\n
                                                                                                                                      "},{"location":"man3/BN_add_word/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions perform arithmetic operations on BIGNUMs with unsigned integers. They are much more efficient than the normal BIGNUM arithmetic operations.

                                                                                                                                      BN_add_word() adds w to a (a+=w).

                                                                                                                                      BN_sub_word() subtracts w from a (a-=w).

                                                                                                                                      BN_mul_word() multiplies a and w (a*=w).

                                                                                                                                      BN_div_word() divides a by w (a/=w) and returns the remainder.

                                                                                                                                      BN_mod_word() returns the remainder of a divided by w (a%w).

                                                                                                                                      For BN_div_word() and BN_mod_word(), w must not be 0.

                                                                                                                                      "},{"location":"man3/BN_add_word/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      BN_mod_word() and BN_div_word() return a%w on success and (BN_ULONG)-1 if an error occurred.

                                                                                                                                      "},{"location":"man3/BN_add_word/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_add(3)

                                                                                                                                      "},{"location":"man3/BN_add_word/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_bn2bin/","title":"BN_bn2bin","text":""},{"location":"man3/BN_bn2bin/#name","title":"NAME","text":"

                                                                                                                                      BN_bn2binpad, BN_bn2bin, BN_bin2bn, BN_bn2lebinpad, BN_lebin2bn, BN_bn2nativepad, BN_native2bn, BN_bn2hex, BN_bn2dec, BN_hex2bn, BN_dec2bn, BN_print, BN_print_fp, BN_bn2mpi, BN_mpi2bn - format conversions

                                                                                                                                      "},{"location":"man3/BN_bn2bin/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_bn2bin(const BIGNUM *a, unsigned char *to);\nint BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);\nBIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);\n\nint BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);\nBIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);\n\nint BN_bn2nativepad(const BIGNUM *a, unsigned char *to, int tolen);\nBIGNUM *BN_native2bn(const unsigned char *s, int len, BIGNUM *ret);\n\nchar *BN_bn2hex(const BIGNUM *a);\nchar *BN_bn2dec(const BIGNUM *a);\nint BN_hex2bn(BIGNUM **a, const char *str);\nint BN_dec2bn(BIGNUM **a, const char *str);\n\nint BN_print(BIO *fp, const BIGNUM *a);\nint BN_print_fp(FILE *fp, const BIGNUM *a);\n\nint BN_bn2mpi(const BIGNUM *a, unsigned char *to);\nBIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret);\n
                                                                                                                                      "},{"location":"man3/BN_bn2bin/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_bn2bin() converts the absolute value of a into big-endian form and stores it at to. to must point to BN_num_bytes(a) bytes of memory.

                                                                                                                                      BN_bn2binpad() also converts the absolute value of a into big-endian form and stores it at to. tolen indicates the length of the output buffer to. The result is padded with zeros if necessary. If tolen is less than BN_num_bytes(a) an error is returned.

                                                                                                                                      BN_bin2bn() converts the positive integer in big-endian form of length len at s into a BIGNUM and places it in ret. If ret is NULL, a new BIGNUM is created.

                                                                                                                                      BN_bn2lebinpad() and BN_lebin2bn() are identical to BN_bn2binpad() and BN_bin2bn() except the buffer is in little-endian format.

                                                                                                                                      BN_bn2nativepad() and BN_native2bn() are identical to BN_bn2binpad() and BN_bin2bn() except the buffer is in native format, i.e. most significant byte first on big-endian platforms, and least significant byte first on little-endian platforms.

                                                                                                                                      BN_bn2hex() and BN_bn2dec() return printable strings containing the hexadecimal and decimal encoding of a respectively. For negative numbers, the string is prefaced with a leading '-'. The string must be freed later using OPENSSL_free().

                                                                                                                                      BN_hex2bn() takes as many characters as possible from the string str, including the leading character '-' which means negative, to form a valid hexadecimal number representation and converts them to a BIGNUM and stores it in **a. If *a is NULL, a new BIGNUM is created. If a is NULL, it only computes the length of valid representation. A \"negative zero\" is converted to zero. BN_dec2bn() is the same using the decimal system.

                                                                                                                                      BN_print() and BN_print_fp() write the hexadecimal encoding of a, with a leading '-' for negative numbers, to the BIO or FILE fp.

                                                                                                                                      BN_bn2mpi() and BN_mpi2bn() convert BIGNUMs from and to a format that consists of the number's length in bytes represented as a 4-byte big-endian number, and the number itself in big-endian format, where the most significant bit signals a negative number (the representation of numbers with the MSB set is prefixed with null byte).

                                                                                                                                      BN_bn2mpi() stores the representation of a at to, where to must be large enough to hold the result. The size can be determined by calling BN_bn2mpi(a, NULL).

                                                                                                                                      BN_mpi2bn() converts the len bytes long representation at s to a BIGNUM and stores it at ret, or in a newly allocated BIGNUM if ret is NULL.

                                                                                                                                      "},{"location":"man3/BN_bn2bin/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_bn2bin() returns the length of the big-endian number placed at to. BN_bin2bn() returns the BIGNUM, NULL on error.

                                                                                                                                      BN_bn2binpad(), BN_bn2lebinpad(), and BN_bn2nativepad() return the number of bytes written or -1 if the supplied buffer is too small.

                                                                                                                                      BN_bn2hex() and BN_bn2dec() return a NUL-terminated string, or NULL on error. BN_hex2bn() and BN_dec2bn() return the number of characters used in parsing, or 0 on error, in which case no new BIGNUM will be created.

                                                                                                                                      BN_print_fp() and BN_print() return 1 on success, 0 on write errors.

                                                                                                                                      BN_bn2mpi() returns the length of the representation. BN_mpi2bn() returns the BIGNUM, and NULL on error.

                                                                                                                                      The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_bn2bin/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_zero(3), ASN1_INTEGER_to_BN(3), BN_num_bytes(3)

                                                                                                                                      "},{"location":"man3/BN_bn2bin/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_cmp/","title":"BN_cmp","text":""},{"location":"man3/BN_cmp/#name","title":"NAME","text":"

                                                                                                                                      BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_abs_is_word, BN_is_odd, BN_are_coprime - BIGNUM comparison and test functions

                                                                                                                                      "},{"location":"man3/BN_cmp/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_cmp(const BIGNUM *a, const BIGNUM *b);\nint BN_ucmp(const BIGNUM *a, const BIGNUM *b);\n\nint BN_is_zero(const BIGNUM *a);\nint BN_is_one(const BIGNUM *a);\nint BN_is_word(const BIGNUM *a, const BN_ULONG w);\nint BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);\nint BN_is_odd(const BIGNUM *a);\n\nint BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/BN_cmp/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_cmp() compares the numbers a and b. BN_ucmp() compares their absolute values.

                                                                                                                                      BN_is_zero(), BN_is_one(), BN_is_word() and BN_abs_is_word() test if a equals 0, 1, w, or |w| respectively. BN_is_odd() tests if a is odd.

                                                                                                                                      BN_are_coprime() determines if a and b are coprime. ctx is used internally for storing temporary variables. The values of a and b and ctx must not be NULL.

                                                                                                                                      "},{"location":"man3/BN_cmp/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_cmp() returns -1 if a < b, 0 if a == b and 1 if a > b. BN_ucmp() is the same using the absolute values of a and b.

                                                                                                                                      BN_is_zero(), BN_is_one() BN_is_word(), BN_abs_is_word() and BN_is_odd() return 1 if the condition is true, 0 otherwise.

                                                                                                                                      BN_are_coprime() returns 1 if the BIGNUM's are coprime, otherwise it returns 0.

                                                                                                                                      "},{"location":"man3/BN_cmp/#history","title":"HISTORY","text":"

                                                                                                                                      Prior to OpenSSL 1.1.0, BN_is_zero(), BN_is_one(), BN_is_word(), BN_abs_is_word() and BN_is_odd() were macros.

                                                                                                                                      The function BN_are_coprime() was added in OpenSSL 3.1.

                                                                                                                                      "},{"location":"man3/BN_cmp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_copy/","title":"BN_copy","text":""},{"location":"man3/BN_copy/#name","title":"NAME","text":"

                                                                                                                                      BN_copy, BN_dup, BN_with_flags - copy BIGNUMs

                                                                                                                                      "},{"location":"man3/BN_copy/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nBIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from);\n\nBIGNUM *BN_dup(const BIGNUM *from);\n\nvoid BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);\n
                                                                                                                                      "},{"location":"man3/BN_copy/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_copy() copies from to to. BN_dup() creates a new BIGNUM containing the value from.

                                                                                                                                      BN_with_flags creates a temporary shallow copy of b in dest. It places significant restrictions on the copied data. Applications that do no adhere to these restrictions may encounter unexpected side effects or crashes. For that reason use of this function is discouraged. Any flags provided in flags will be set in dest in addition to any flags already set in b. For example this might commonly be used to create a temporary copy of a BIGNUM with the BN_FLG_CONSTTIME flag set for constant time operations. The temporary copy in dest will share some internal state with b. For this reason the following restrictions apply to the use of dest:

                                                                                                                                      • dest should be a newly allocated BIGNUM obtained via a call to BN_new(). It should not have been used for other purposes or initialised in any way.
                                                                                                                                      • dest must only be used in \"read-only\" operations, i.e. typically those functions where the relevant parameter is declared \"const\".
                                                                                                                                      • dest must be used and freed before any further subsequent use of b
                                                                                                                                      "},{"location":"man3/BN_copy/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_copy() returns to on success, NULL on error. BN_dup() returns the new BIGNUM, and NULL on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_copy/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/BN_copy/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_generate_prime/","title":"BN_generate_prime","text":""},{"location":"man3/BN_generate_prime/#name","title":"NAME","text":"

                                                                                                                                      BN_generate_prime_ex2, BN_generate_prime_ex, BN_is_prime_ex, BN_check_prime, BN_is_prime_fasttest_ex, BN_GENCB_call, BN_GENCB_new, BN_GENCB_free, BN_GENCB_set_old, BN_GENCB_set, BN_GENCB_get_arg, BN_generate_prime, BN_is_prime, BN_is_prime_fasttest - generate primes and test for primality

                                                                                                                                      "},{"location":"man3/BN_generate_prime/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe,\n                          const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb,\n                          BN_CTX *ctx);\n\nint BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,\n                         const BIGNUM *rem, BN_GENCB *cb);\n\nint BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb);\n\nint BN_GENCB_call(BN_GENCB *cb, int a, int b);\n\nBN_GENCB *BN_GENCB_new(void);\n\nvoid BN_GENCB_free(BN_GENCB *cb);\n\nvoid BN_GENCB_set_old(BN_GENCB *gencb,\n                      void (*callback)(int, int, void *), void *cb_arg);\n\nvoid BN_GENCB_set(BN_GENCB *gencb,\n                  int (*callback)(int, int, BN_GENCB *), void *cb_arg);\n\nvoid *BN_GENCB_get_arg(BN_GENCB *cb);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      BIGNUM *BN_generate_prime(BIGNUM *ret, int num, int safe, BIGNUM *add,\n                          BIGNUM *rem, void (*callback)(int, int, void *),\n                          void *cb_arg);\n\nint BN_is_prime(const BIGNUM *p, int nchecks,\n                void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg);\n\nint BN_is_prime_fasttest(const BIGNUM *p, int nchecks,\n                         void (*callback)(int, int, void *), BN_CTX *ctx,\n                         void *cb_arg, int do_trial_division);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);\n\nint BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,\n                            int do_trial_division, BN_GENCB *cb);\n
                                                                                                                                      "},{"location":"man3/BN_generate_prime/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_generate_prime_ex2() generates a pseudo-random prime number of at least bit length bits using the BN_CTX provided in ctx. The value of ctx must not be NULL.

                                                                                                                                      The returned number is probably prime with a negligible error. The maximum error rate is 2^-128. It's 2^-287 for a 512 bit prime, 2^-435 for a 1024 bit prime, 2^-648 for a 2048 bit prime, and lower than 2^-882 for primes larger than 2048 bit.

                                                                                                                                      If add is NULL the returned prime number will have exact bit length bits with the top most two bits set.

                                                                                                                                      If ret is not NULL, it will be used to store the number.

                                                                                                                                      If cb is not NULL, it is used as follows:

                                                                                                                                      • BN_GENCB_call(cb, 0, i) is called after generating the i-th potential prime number.
                                                                                                                                      • While the number is being tested for primality, BN_GENCB_call(cb, 1, j) is called as described below.
                                                                                                                                      • When a prime has been found, BN_GENCB_call(cb, 2, i) is called.
                                                                                                                                      • The callers of BN_generate_prime_ex() may call BN_GENCB_call(cb, i, j) with other values as described in their respective man pages; see \"SEE ALSO\".

                                                                                                                                      The prime may have to fulfill additional requirements for use in Diffie-Hellman key exchange:

                                                                                                                                      If add is not NULL, the prime will fulfill the condition p % add == rem (p % add == 1 if rem == NULL) in order to suit a given generator.

                                                                                                                                      If safe is true, it will be a safe prime (i.e. a prime p so that (p-1)/2 is also prime). If safe is true, and rem == NULL the condition will be p % add == 3. It is recommended that add is a multiple of 4.

                                                                                                                                      The random generator must be seeded prior to calling BN_generate_prime_ex(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail. The random number generator configured for the OSSL_LIB_CTX associated with ctx will be used.

                                                                                                                                      BN_generate_prime_ex() is the same as BN_generate_prime_ex2() except that no ctx parameter is passed. In this case the random number generator associated with the default OSSL_LIB_CTX will be used.

                                                                                                                                      BN_check_prime(), BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime() and BN_is_prime_fasttest() test if the number p is prime. The functions tests until one of the tests shows that p is composite, or all the tests passed. If p passes all these tests, it is considered a probable prime.

                                                                                                                                      The test performed on p are trial division by a number of small primes and rounds of the of the Miller-Rabin probabilistic primality test.

                                                                                                                                      The functions do at least 64 rounds of the Miller-Rabin test giving a maximum false positive rate of 2^-128. If the size of p is more than 2048 bits, they do at least 128 rounds giving a maximum false positive rate of 2^-256.

                                                                                                                                      If nchecks is larger than the minimum above (64 or 128), nchecks rounds of the Miller-Rabin test will be done.

                                                                                                                                      If do_trial_division set to 0, the trial division will be skipped. BN_is_prime_ex() and BN_is_prime() always skip the trial division.

                                                                                                                                      BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime() and BN_is_prime_fasttest() are deprecated.

                                                                                                                                      BN_is_prime_fasttest() and BN_is_prime() behave just like BN_is_prime_fasttest_ex() and BN_is_prime_ex() respectively, but with the old style call back.

                                                                                                                                      ctx is a preallocated BN_CTX (to save the overhead of allocating and freeing the structure in a loop), or NULL.

                                                                                                                                      If the trial division is done, and no divisors are found and cb is not NULL, BN_GENCB_call(cb, 1, -1) is called.

                                                                                                                                      After each round of the Miller-Rabin probabilistic primality test, if cb is not NULL, BN_GENCB_call(cb, 1, j) is called with j the iteration (j = 0, 1, ...).

                                                                                                                                      BN_GENCB_call() calls the callback function held in the BN_GENCB structure and passes the ints a and b as arguments. There are two types of BN_GENCB structure that are supported: \"new\" style and \"old\" style. New programs should prefer the \"new\" style, whilst the \"old\" style is provided for backwards compatibility purposes.

                                                                                                                                      A BN_GENCB structure should be created through a call to BN_GENCB_new(), and freed through a call to BN_GENCB_free(). If the argument is NULL, nothing is done.

                                                                                                                                      For \"new\" style callbacks a BN_GENCB structure should be initialised with a call to BN_GENCB_set(), where gencb is a BN_GENCB *, callback is of type int (*callback)(int, int, BN_GENCB *) and cb_arg is a void *. \"Old\" style callbacks are the same except they are initialised with a call to BN_GENCB_set_old() and callback is of type void (*callback)(int, int, void *).

                                                                                                                                      A callback is invoked through a call to BN_GENCB_call. This will check the type of the callback and will invoke callback(a, b, gencb) for new style callbacks or callback(a, b, cb_arg) for old style.

                                                                                                                                      It is possible to obtain the argument associated with a BN_GENCB structure (set via a call to BN_GENCB_set or BN_GENCB_set_old) using BN_GENCB_get_arg.

                                                                                                                                      BN_generate_prime() (deprecated) works in the same way as BN_generate_prime_ex() but expects an old-style callback function directly in the callback parameter, and an argument to pass to it in the cb_arg. BN_is_prime() and BN_is_prime_fasttest() can similarly be compared to BN_is_prime_ex() and BN_is_prime_fasttest_ex(), respectively.

                                                                                                                                      "},{"location":"man3/BN_generate_prime/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_generate_prime_ex() return 1 on success or 0 on error.

                                                                                                                                      BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime(), BN_is_prime_fasttest() and BN_check_prime return 0 if the number is composite, 1 if it is prime with an error probability of less than 0.25^nchecks, and -1 on error.

                                                                                                                                      BN_generate_prime() returns the prime number on success, NULL otherwise.

                                                                                                                                      BN_GENCB_new returns a pointer to a BN_GENCB structure on success, or NULL otherwise.

                                                                                                                                      BN_GENCB_get_arg returns the argument previously associated with a BN_GENCB structure.

                                                                                                                                      Callback functions should return 1 on success or 0 on error.

                                                                                                                                      The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_generate_prime/#removed-functionality","title":"REMOVED FUNCTIONALITY","text":"

                                                                                                                                      As of OpenSSL 1.1.0 it is no longer possible to create a BN_GENCB structure directly, as in:

                                                                                                                                      BN_GENCB callback;\n

                                                                                                                                      Instead applications should create a BN_GENCB structure using BN_GENCB_new:

                                                                                                                                      BN_GENCB *callback;\ncallback = BN_GENCB_new();\nif (!callback)\n    /* error */\n...\nBN_GENCB_free(callback);\n
                                                                                                                                      "},{"location":"man3/BN_generate_prime/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_generate_parameters(3), DSA_generate_parameters(3), RSA_generate_key(3), ERR_get_error(3), RAND_bytes(3), RAND(7)

                                                                                                                                      "},{"location":"man3/BN_generate_prime/#history","title":"HISTORY","text":"

                                                                                                                                      The BN_is_prime_ex() and BN_is_prime_fasttest_ex() functions were deprecated in OpenSSL 3.0.

                                                                                                                                      The BN_GENCB_new(), BN_GENCB_free(), and BN_GENCB_get_arg() functions were added in OpenSSL 1.1.0.

                                                                                                                                      BN_check_prime() was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/BN_generate_prime/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_mod_exp_mont/","title":"BN_mod_exp_mont","text":""},{"location":"man3/BN_mod_exp_mont/#name","title":"NAME","text":"

                                                                                                                                      BN_mod_exp_mont, BN_mod_exp_mont_consttime, BN_mod_exp_mont_consttime_x2 - Montgomery exponentiation

                                                                                                                                      "},{"location":"man3/BN_mod_exp_mont/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,\n                    const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);\n\nint BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,\n                              const BIGNUM *m, BN_CTX *ctx,\n                              BN_MONT_CTX *in_mont);\n\nint BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1,\n                                 const BIGNUM *p1, const BIGNUM *m1,\n                                 BN_MONT_CTX *in_mont1, BIGNUM *rr2,\n                                 const BIGNUM *a2, const BIGNUM *p2,\n                                 const BIGNUM *m2, BN_MONT_CTX *in_mont2,\n                                 BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/BN_mod_exp_mont/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_mod_exp_mont() computes a to the p-th power modulo m (rr=a^p % m) using Montgomery multiplication. in_mont is a Montgomery context and can be NULL. In the case in_mont is NULL, it will be initialized within the function, so you can save time on initialization if you provide it in advance.

                                                                                                                                      BN_mod_exp_mont_consttime() computes a to the p-th power modulo m (rr=a^p % m) using Montgomery multiplication. It is a variant of BN_mod_exp_mont(3) that uses fixed windows and the special precomputation memory layout to limit data-dependency to a minimum to protect secret exponents. It is called automatically when BN_mod_exp_mont(3) is called with parameters a, p, m, any of which have BN_FLG_CONSTTIME flag.

                                                                                                                                      BN_mod_exp_mont_consttime_x2() computes two independent exponentiations a1 to the p1-th power modulo m1 (rr1=a1^p1 % m1) and a2 to the p2-th power modulo m2 (rr2=a2^p2 % m2) using Montgomery multiplication. For some fixed and equal modulus sizes m1 and m2 it uses optimizations that allow to speedup two exponentiations. In all other cases the function reduces to two calls of BN_mod_exp_mont_consttime(3).

                                                                                                                                      "},{"location":"man3/BN_mod_exp_mont/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      For all functions 1 is returned for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_mod_exp_mont/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_mod_exp_mont(3)

                                                                                                                                      "},{"location":"man3/BN_mod_exp_mont/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_mod_inverse/","title":"BN_mod_inverse","text":""},{"location":"man3/BN_mod_inverse/#name","title":"NAME","text":"

                                                                                                                                      BN_mod_inverse - compute inverse modulo n

                                                                                                                                      "},{"location":"man3/BN_mod_inverse/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nBIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n,\n                       BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/BN_mod_inverse/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_mod_inverse() computes the inverse of a modulo n places the result in r ((a*r)%n==1). If r is NULL, a new BIGNUM is created.

                                                                                                                                      ctx is a previously allocated BN_CTX used for temporary variables. r may be the same BIGNUM as a.

                                                                                                                                      "},{"location":"man3/BN_mod_inverse/#notes","title":"NOTES","text":"

                                                                                                                                      It is an error to use the same BIGNUM as n.

                                                                                                                                      "},{"location":"man3/BN_mod_inverse/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_mod_inverse() returns the BIGNUM containing the inverse, and NULL on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_mod_inverse/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_add(3)

                                                                                                                                      "},{"location":"man3/BN_mod_inverse/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/","title":"BN_mod_mul_montgomery","text":""},{"location":"man3/BN_mod_mul_montgomery/#name","title":"NAME","text":"

                                                                                                                                      BN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy, BN_from_montgomery, BN_to_montgomery - Montgomery multiplication

                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nBN_MONT_CTX *BN_MONT_CTX_new(void);\nvoid BN_MONT_CTX_free(BN_MONT_CTX *mont);\n\nint BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx);\nBN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);\n\nint BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,\n                          BN_MONT_CTX *mont, BN_CTX *ctx);\n\nint BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont,\n                       BN_CTX *ctx);\n\nint BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont,\n                     BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/#description","title":"DESCRIPTION","text":"

                                                                                                                                      These functions implement Montgomery multiplication. They are used automatically when BN_mod_exp(3) is called with suitable input, but they may be useful when several operations are to be performed using the same modulus.

                                                                                                                                      BN_MONT_CTX_new() allocates and initializes a BN_MONT_CTX structure.

                                                                                                                                      BN_MONT_CTX_set() sets up the mont structure from the modulus m by precomputing its inverse and a value R.

                                                                                                                                      BN_MONT_CTX_copy() copies the BN_MONT_CTX from to to.

                                                                                                                                      BN_MONT_CTX_free() frees the components of the BN_MONT_CTX, and, if it was created by BN_MONT_CTX_new(), also the structure itself. If mont is NULL, nothing is done.

                                                                                                                                      BN_mod_mul_montgomery() computes Mont(a,b):=a*b*R^-1 and places the result in r.

                                                                                                                                      BN_from_montgomery() performs the Montgomery reduction r = a*R^-1.

                                                                                                                                      BN_to_montgomery() computes Mont(a,R^2), i.e. a*R. Note that a must be nonnegative and smaller than the modulus.

                                                                                                                                      For all functions, ctx is a previously allocated BN_CTX used for temporary variables.

                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_MONT_CTX_new() returns the newly allocated BN_MONT_CTX, and NULL on error.

                                                                                                                                      BN_MONT_CTX_free() has no return value.

                                                                                                                                      For the other functions, 1 is returned for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/#warnings","title":"WARNINGS","text":"

                                                                                                                                      The inputs must be reduced modulo m, otherwise the result will be outside the expected range.

                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_add(3), BN_CTX_new(3)

                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/#history","title":"HISTORY","text":"

                                                                                                                                      BN_MONT_CTX_init() was removed in OpenSSL 1.1.0

                                                                                                                                      "},{"location":"man3/BN_mod_mul_montgomery/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_mod_mul_reciprocal/","title":"BN_mod_mul_reciprocal","text":""},{"location":"man3/BN_mod_mul_reciprocal/#name","title":"NAME","text":"

                                                                                                                                      BN_mod_mul_reciprocal, BN_div_recp, BN_RECP_CTX_new, BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using reciprocal

                                                                                                                                      "},{"location":"man3/BN_mod_mul_reciprocal/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nBN_RECP_CTX *BN_RECP_CTX_new(void);\nvoid BN_RECP_CTX_free(BN_RECP_CTX *recp);\n\nint BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx);\n\nint BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, BN_RECP_CTX *recp,\n                BN_CTX *ctx);\n\nint BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n                          BN_RECP_CTX *recp, BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/BN_mod_mul_reciprocal/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_mod_mul_reciprocal() can be used to perform an efficient BN_mod_mul(3) operation when the operation will be performed repeatedly with the same modulus. It computes r=(a*b)%m using recp=1/m, which is set as described below. ctx is a previously allocated BN_CTX used for temporary variables.

                                                                                                                                      BN_RECP_CTX_new() allocates and initializes a BN_RECP structure.

                                                                                                                                      BN_RECP_CTX_free() frees the components of the BN_RECP, and, if it was created by BN_RECP_CTX_new(), also the structure itself. If recp is NULL, nothing is done.

                                                                                                                                      BN_RECP_CTX_set() stores m in recp and sets it up for computing 1/m and shifting it left by BN_num_bits(m)+1 to make it an integer. The result and the number of bits it was shifted left will later be stored in recp.

                                                                                                                                      BN_div_recp() divides a by m using recp. It places the quotient in dv and the remainder in rem.

                                                                                                                                      The BN_RECP_CTX structure cannot be shared between threads.

                                                                                                                                      "},{"location":"man3/BN_mod_mul_reciprocal/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_RECP_CTX_new() returns the newly allocated BN_RECP_CTX, and NULL on error.

                                                                                                                                      BN_RECP_CTX_free() has no return value.

                                                                                                                                      For the other functions, 1 is returned for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_mod_mul_reciprocal/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), BN_add(3), BN_CTX_new(3)

                                                                                                                                      "},{"location":"man3/BN_mod_mul_reciprocal/#history","title":"HISTORY","text":"

                                                                                                                                      BN_RECP_CTX_init() was removed in OpenSSL 1.1.0

                                                                                                                                      "},{"location":"man3/BN_mod_mul_reciprocal/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_new/","title":"BN_new","text":""},{"location":"man3/BN_new/#name","title":"NAME","text":"

                                                                                                                                      BN_new, BN_secure_new, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs

                                                                                                                                      "},{"location":"man3/BN_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nBIGNUM *BN_new(void);\n\nBIGNUM *BN_secure_new(void);\n\nvoid BN_clear(BIGNUM *a);\n\nvoid BN_free(BIGNUM *a);\n\nvoid BN_clear_free(BIGNUM *a);\n
                                                                                                                                      "},{"location":"man3/BN_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_new() allocates and initializes a BIGNUM structure. BN_secure_new() does the same except that the secure heap OPENSSL_secure_malloc(3) is used to store the value.

                                                                                                                                      BN_clear() is used to destroy sensitive data such as keys when they are no longer needed. It erases the memory used by a and sets it to the value 0. If a is NULL, nothing is done.

                                                                                                                                      BN_free() frees the components of the BIGNUM, and if it was created by BN_new(), also the structure itself. BN_clear_free() additionally overwrites the data before the memory is returned to the system. If a is NULL, nothing is done.

                                                                                                                                      "},{"location":"man3/BN_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_new() and BN_secure_new() return a pointer to the BIGNUM initialised to the value 0. If the allocation fails, they return NULL and set an error code that can be obtained by ERR_get_error(3).

                                                                                                                                      BN_clear(), BN_free() and BN_clear_free() have no return values.

                                                                                                                                      "},{"location":"man3/BN_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), OPENSSL_secure_malloc(3)

                                                                                                                                      "},{"location":"man3/BN_new/#history","title":"HISTORY","text":"

                                                                                                                                      BN_init() was removed in OpenSSL 1.1.0; use BN_new() instead.

                                                                                                                                      "},{"location":"man3/BN_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_num_bytes/","title":"BN_num_bytes","text":""},{"location":"man3/BN_num_bytes/#name","title":"NAME","text":"

                                                                                                                                      BN_num_bits, BN_num_bytes, BN_num_bits_word - get BIGNUM size

                                                                                                                                      "},{"location":"man3/BN_num_bytes/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_num_bytes(const BIGNUM *a);\n\nint BN_num_bits(const BIGNUM *a);\n\nint BN_num_bits_word(BN_ULONG w);\n
                                                                                                                                      "},{"location":"man3/BN_num_bytes/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_num_bytes() returns the size of a BIGNUM in bytes.

                                                                                                                                      BN_num_bits_word() returns the number of significant bits in a word. If we take 0x00000432 as an example, it returns 11, not 16, not 32. Basically, except for a zero, it returns floor(log2(w))+1.

                                                                                                                                      BN_num_bits() returns the number of significant bits in a BIGNUM, following the same principle as BN_num_bits_word().

                                                                                                                                      BN_num_bytes() is a macro.

                                                                                                                                      "},{"location":"man3/BN_num_bytes/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The size.

                                                                                                                                      "},{"location":"man3/BN_num_bytes/#notes","title":"NOTES","text":"

                                                                                                                                      Some have tried using BN_num_bits() on individual numbers in RSA keys, DH keys and DSA keys, and found that they don't always come up with the number of bits they expected (something like 512, 1024, 2048, ...). This is because generating a number with some specific number of bits doesn't always set the highest bits, thereby making the number of significant bits a little lower. If you want to know the \"key size\" of such a key, either use functions like RSA_size(), DH_size() and DSA_size(), or use BN_num_bytes() and multiply with 8 (although there's no real guarantee that will match the \"key size\", just a lot more probability).

                                                                                                                                      "},{"location":"man3/BN_num_bytes/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_size(3), DSA_size(3), RSA_size(3)

                                                                                                                                      "},{"location":"man3/BN_num_bytes/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_rand/","title":"BN_rand","text":""},{"location":"man3/BN_rand/#name","title":"NAME","text":"

                                                                                                                                      BN_rand_ex, BN_rand, BN_priv_rand_ex, BN_priv_rand, BN_pseudo_rand, BN_rand_range_ex, BN_rand_range, BN_priv_rand_range_ex, BN_priv_rand_range, BN_pseudo_rand_range - generate pseudo-random number

                                                                                                                                      "},{"location":"man3/BN_rand/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,\n               unsigned int strength, BN_CTX *ctx);\nint BN_rand(BIGNUM *rnd, int bits, int top, int bottom);\n\nint BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,\n                    unsigned int strength, BN_CTX *ctx);\nint BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom);\n\nint BN_rand_range_ex(BIGNUM *rnd, const BIGNUM *range, unsigned int strength,\n                     BN_CTX *ctx);\nint BN_rand_range(BIGNUM *rnd, const BIGNUM *range);\n\nint BN_priv_rand_range_ex(BIGNUM *rnd, const BIGNUM *range, unsigned int strength,\n                          BN_CTX *ctx);\nint BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);\nint BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);\n
                                                                                                                                      "},{"location":"man3/BN_rand/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_rand_ex() generates a cryptographically strong pseudo-random number of bits in length and security strength at least strength bits using the random number generator for the library context associated with ctx. The function stores the generated data in rnd. The parameter ctx may be NULL in which case the default library context is used. If bits is less than zero, or too small to accommodate the requirements specified by the top and bottom parameters, an error is returned. The top parameters specifies requirements on the most significant bit of the generated number. If it is BN_RAND_TOP_ANY, there is no constraint. If it is BN_RAND_TOP_ONE, the top bit must be one. If it is BN_RAND_TOP_TWO, the two most significant bits of the number will be set to 1, so that the product of two such random numbers will always have 2*bits length. If bottom is BN_RAND_BOTTOM_ODD, the number will be odd; if it is BN_RAND_BOTTOM_ANY it can be odd or even. If bits is 1 then top cannot also be BN_RAND_TOP_TWO.

                                                                                                                                      BN_rand() is the same as BN_rand_ex() except that the default library context is always used.

                                                                                                                                      BN_rand_range_ex() generates a cryptographically strong pseudo-random number rnd, of security strength at least strength bits, in the range 0 <= rnd < range using the random number generator for the library context associated with ctx. The parameter ctx may be NULL in which case the default library context is used.

                                                                                                                                      BN_rand_range() is the same as BN_rand_range_ex() except that the default library context is always used.

                                                                                                                                      BN_priv_rand_ex(), BN_priv_rand(), BN_priv_rand_rand_ex() and BN_priv_rand_range() have the same semantics as BN_rand_ex(), BN_rand(), BN_rand_range_ex() and BN_rand_range() respectively. They are intended to be used for generating values that should remain private, and mirror the same difference between RAND_bytes(3) and RAND_priv_bytes(3).

                                                                                                                                      "},{"location":"man3/BN_rand/#notes","title":"NOTES","text":"

                                                                                                                                      Always check the error return value of these functions and do not take randomness for granted: an error occurs if the CSPRNG has not been seeded with enough randomness to ensure an unpredictable byte sequence.

                                                                                                                                      "},{"location":"man3/BN_rand/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The functions return 1 on success, 0 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_rand/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), RAND_add(3), RAND_bytes(3), RAND_priv_bytes(3), RAND(7), EVP_RAND(7)

                                                                                                                                      "},{"location":"man3/BN_rand/#history","title":"HISTORY","text":"
                                                                                                                                      • Starting with OpenSSL release 1.1.0, BN_pseudo_rand() has been identical to BN_rand() and BN_pseudo_rand_range() has been identical to BN_rand_range(). The BN_pseudo_rand() and BN_pseudo_rand_range() functions were deprecated in OpenSSL 3.0.
                                                                                                                                      • The BN_priv_rand() and BN_priv_rand_range() functions were added in OpenSSL 1.1.1.
                                                                                                                                      • The BN_rand_ex(), BN_priv_rand_ex(), BN_rand_range_ex() and BN_priv_rand_range_ex() functions were added in OpenSSL 3.0.
                                                                                                                                      "},{"location":"man3/BN_rand/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_security_bits/","title":"BN_security_bits","text":""},{"location":"man3/BN_security_bits/#name","title":"NAME","text":"

                                                                                                                                      BN_security_bits - returns bits of security based on given numbers

                                                                                                                                      "},{"location":"man3/BN_security_bits/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_security_bits(int L, int N);\n
                                                                                                                                      "},{"location":"man3/BN_security_bits/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_security_bits() returns the number of bits of security provided by a specific algorithm and a particular key size. The bits of security is defined in NIST SP800-57. Currently, BN_security_bits() support two types of asymmetric algorithms: the FFC (Finite Field Cryptography) and IFC (Integer Factorization Cryptography). For FFC, e.g., DSA and DH, both parameters L and N are used to decide the bits of security, where L is the size of the public key and N is the size of the private key. For IFC, e.g., RSA, only L is used and it's commonly considered to be the key size (modulus).

                                                                                                                                      "},{"location":"man3/BN_security_bits/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      Number of security bits.

                                                                                                                                      "},{"location":"man3/BN_security_bits/#notes","title":"NOTES","text":"

                                                                                                                                      ECC (Elliptic Curve Cryptography) is not covered by the BN_security_bits() function. The symmetric algorithms are not covered neither.

                                                                                                                                      "},{"location":"man3/BN_security_bits/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_security_bits(3), DSA_security_bits(3), RSA_security_bits(3)

                                                                                                                                      "},{"location":"man3/BN_security_bits/#history","title":"HISTORY","text":"

                                                                                                                                      The BN_security_bits() function was added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/BN_security_bits/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_set_bit/","title":"BN_set_bit","text":""},{"location":"man3/BN_set_bit/#name","title":"NAME","text":"

                                                                                                                                      BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift, BN_lshift1, BN_rshift, BN_rshift1 - bit operations on BIGNUMs

                                                                                                                                      "},{"location":"man3/BN_set_bit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nint BN_set_bit(BIGNUM *a, int n);\nint BN_clear_bit(BIGNUM *a, int n);\n\nint BN_is_bit_set(const BIGNUM *a, int n);\n\nint BN_mask_bits(BIGNUM *a, int n);\n\nint BN_lshift(BIGNUM *r, const BIGNUM *a, int n);\nint BN_lshift1(BIGNUM *r, BIGNUM *a);\n\nint BN_rshift(BIGNUM *r, BIGNUM *a, int n);\nint BN_rshift1(BIGNUM *r, BIGNUM *a);\n
                                                                                                                                      "},{"location":"man3/BN_set_bit/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_set_bit() sets bit n in a to 1 (a|=(1<<n)). The number is expanded if necessary.

                                                                                                                                      BN_clear_bit() sets bit n in a to 0 (a&=~(1<<n)). An error occurs if a is shorter than n bits.

                                                                                                                                      BN_is_bit_set() tests if bit n in a is set.

                                                                                                                                      BN_mask_bits() truncates a to an n bit number (a&=~((~0)<<n)). An error occurs if n is negative. An error is also returned if the internal representation of a is already shorter than n bits. The internal representation depends on the platform's word size, and this error can be safely ignored. Use BN_num_bits(3) to determine the exact number of bits if needed.

                                                                                                                                      BN_lshift() shifts a left by n bits and places the result in r (r=a*2^n). Note that n must be nonnegative. BN_lshift1() shifts a left by one and places the result in r (r=2*a).

                                                                                                                                      BN_rshift() shifts a right by n bits and places the result in r (r=a/2^n). Note that n must be nonnegative. BN_rshift1() shifts a right by one and places the result in r (r=a/2).

                                                                                                                                      For the shift functions, r and a may be the same variable.

                                                                                                                                      "},{"location":"man3/BN_set_bit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_is_bit_set() returns 1 if the bit is set, 0 otherwise.

                                                                                                                                      All other functions return 1 for success, 0 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/BN_set_bit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BN_num_bytes(3), BN_add(3)

                                                                                                                                      "},{"location":"man3/BN_set_bit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_swap/","title":"BN_swap","text":""},{"location":"man3/BN_swap/#name","title":"NAME","text":"

                                                                                                                                      BN_swap - exchange BIGNUMs

                                                                                                                                      "},{"location":"man3/BN_swap/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nvoid BN_swap(BIGNUM *a, BIGNUM *b);\n
                                                                                                                                      "},{"location":"man3/BN_swap/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_swap() exchanges the values of a and b.

                                                                                                                                      "},{"location":"man3/BN_swap/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_swap() does not return a value.

                                                                                                                                      "},{"location":"man3/BN_swap/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BN_zero/","title":"BN_zero","text":""},{"location":"man3/BN_zero/#name","title":"NAME","text":"

                                                                                                                                      BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word - BIGNUM assignment operations

                                                                                                                                      "},{"location":"man3/BN_zero/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/bn.h>\n\nvoid BN_zero(BIGNUM *a);\nint BN_one(BIGNUM *a);\n\nconst BIGNUM *BN_value_one(void);\n\nint BN_set_word(BIGNUM *a, BN_ULONG w);\nunsigned BN_ULONG BN_get_word(BIGNUM *a);\n
                                                                                                                                      "},{"location":"man3/BN_zero/#description","title":"DESCRIPTION","text":"

                                                                                                                                      BN_ULONG is a macro that will be an unsigned integral type optimized for the most efficient implementation on the local platform.

                                                                                                                                      BN_zero(), BN_one() and BN_set_word() set a to the values 0, 1 and w respectively. BN_zero() and BN_one() are macros.

                                                                                                                                      BN_value_one() returns a BIGNUM constant of value 1. This constant is useful for use in comparisons and assignment.

                                                                                                                                      BN_get_word() returns a, if it can be represented as a BN_ULONG.

                                                                                                                                      "},{"location":"man3/BN_zero/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BN_get_word() returns the value a, or all-bits-set if a cannot be represented as a single integer.

                                                                                                                                      BN_one() and BN_set_word() return 1 on success, 0 otherwise. BN_value_one() returns the constant. BN_zero() never fails and returns no value.

                                                                                                                                      "},{"location":"man3/BN_zero/#bugs","title":"BUGS","text":"

                                                                                                                                      If a BIGNUM is equal to the value of all-bits-set, it will collide with the error condition returned by BN_get_word() which uses that as an error value.

                                                                                                                                      BN_ULONG should probably be a typedef.

                                                                                                                                      "},{"location":"man3/BN_zero/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      BN_bn2bin(3)

                                                                                                                                      "},{"location":"man3/BN_zero/#history","title":"HISTORY","text":"

                                                                                                                                      In OpenSSL 0.9.8, BN_zero() was changed to not return a value; previous versions returned an int.

                                                                                                                                      "},{"location":"man3/BN_zero/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/BUF_MEM_new/","title":"BUF_MEM_new","text":""},{"location":"man3/BUF_MEM_new/#name","title":"NAME","text":"

                                                                                                                                      BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow, BUF_MEM_grow_clean, BUF_reverse - simple character array structure

                                                                                                                                      "},{"location":"man3/BUF_MEM_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/buffer.h>\n\nBUF_MEM *BUF_MEM_new(void);\n\nBUF_MEM *BUF_MEM_new_ex(unsigned long flags);\n\nvoid BUF_MEM_free(BUF_MEM *a);\n\nint BUF_MEM_grow(BUF_MEM *str, int len);\nsize_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);\n\nvoid BUF_reverse(unsigned char *out, const unsigned char *in, size_t size);\n
                                                                                                                                      "},{"location":"man3/BUF_MEM_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The buffer library handles simple character arrays. Buffers are used for various purposes in the library, most notably memory BIOs.

                                                                                                                                      BUF_MEM_new() allocates a new buffer of zero size.

                                                                                                                                      BUF_MEM_new_ex() allocates a buffer with the specified flags. The flag BUF_MEM_FLAG_SECURE specifies that the data pointer should be allocated on the secure heap; see CRYPTO_secure_malloc(3).

                                                                                                                                      BUF_MEM_free() frees up an already existing buffer. The data is zeroed before freeing up in case the buffer contains sensitive data. If the argument is NULL, nothing is done.

                                                                                                                                      BUF_MEM_grow() changes the size of an already existing buffer to len. Any data already in the buffer is preserved if it increases in size.

                                                                                                                                      BUF_MEM_grow_clean() is similar to BUF_MEM_grow() but it sets any free'd or additionally-allocated memory to zero.

                                                                                                                                      BUF_reverse() reverses size bytes at in into out. If in is NULL, the array is reversed in-place.

                                                                                                                                      "},{"location":"man3/BUF_MEM_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      BUF_MEM_new() returns the buffer or NULL on error.

                                                                                                                                      BUF_MEM_free() has no return value.

                                                                                                                                      BUF_MEM_grow() and BUF_MEM_grow_clean() return zero on error or the new size (i.e., len).

                                                                                                                                      "},{"location":"man3/BUF_MEM_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      bio(7), CRYPTO_secure_malloc(3).

                                                                                                                                      "},{"location":"man3/BUF_MEM_new/#history","title":"HISTORY","text":"

                                                                                                                                      The BUF_MEM_new_ex() function was added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/BUF_MEM_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_decrypt/","title":"CMS_EncryptedData_decrypt","text":""},{"location":"man3/CMS_EncryptedData_decrypt/#name","title":"NAME","text":"

                                                                                                                                      CMS_EncryptedData_decrypt - Decrypt CMS EncryptedData

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_decrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,\n                              const unsigned char *key, size_t keylen,\n                              BIO *dcont, BIO *out, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_decrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_EncryptedData_decrypt() decrypts a cms EncryptedData object using the symmetric key of size keylen bytes. out is a BIO to write the content to and flags is an optional set of flags. dcont is used in the rare case where the encrypted content is detached. It will normally be set to NULL.

                                                                                                                                      The following flags can be passed in the flags parameter.

                                                                                                                                      If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_decrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_EncryptedData_decrypt() returns 0 if an error occurred otherwise it returns 1.

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_decrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_EncryptedData_encrypt(3)

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_decrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_encrypt/","title":"CMS_EncryptedData_encrypt","text":""},{"location":"man3/CMS_EncryptedData_encrypt/#name","title":"NAME","text":"

                                                                                                                                      CMS_EncryptedData_encrypt_ex, CMS_EncryptedData_encrypt - Create CMS EncryptedData

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in,\n                                              const EVP_CIPHER *cipher,\n                                              const unsigned char *key,\n                                              size_t keylen,\n                                              unsigned int flags,\n                                              OSSL_LIB_CTX *ctx,\n                                              const char *propq);\n\nCMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in,\n    const EVP_CIPHER *cipher, const unsigned char *key, size_t keylen,\n    unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_EncryptedData_encrypt_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_encrypted. in is a BIO containing the data to encrypt using cipher and the encryption key key of size keylen bytes. The library context libctx and the property query propq are used when retrieving algorithms from providers. flags is a set of optional flags.

                                                                                                                                      The flags field supports the options CMS_DETACHED, CMS_STREAM and CMS_PARTIAL. Internally CMS_final() is called unless CMS_STREAM and/or CMS_PARTIAL is specified.

                                                                                                                                      The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters.

                                                                                                                                      The CMS_ContentInfo structure can be freed using CMS_ContentInfo_free(3).

                                                                                                                                      CMS_EncryptedData_encrypt() is similar to CMS_EncryptedData_encrypt_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, CMS_EncryptedData_encrypt_ex() and CMS_EncryptedData_encrypt() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_final(3), CMS_EncryptedData_decrypt(3)

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                      The CMS_EncryptedData_encrypt_ex() method was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_EncryptedData_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/","title":"CMS_EnvelopedData_create","text":""},{"location":"man3/CMS_EnvelopedData_create/#name","title":"NAME","text":"

                                                                                                                                      CMS_EnvelopedData_create_ex, CMS_EnvelopedData_create, CMS_AuthEnvelopedData_create, CMS_AuthEnvelopedData_create_ex - Create CMS envelope

                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *\nCMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,\n                            const char *propq);\nCMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);\n\nCMS_ContentInfo *\nCMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,\n                                const char *propq);\nCMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher);\n
                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_EnvelopedData_create_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_enveloped. cipher is the symmetric cipher to use. The library context libctx and the property query propq are used when retrieving algorithms from providers.

                                                                                                                                      CMS_AuthEnvelopedData_create_ex() creates a CMS_ContentInfo structure with a type NID_id_smime_ct_authEnvelopedData. cipher is the symmetric AEAD cipher to use. Currently only AES variants with GCM mode are supported. The library context libctx and the property query propq are used when retrieving algorithms from providers.

                                                                                                                                      The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters.

                                                                                                                                      The recipients can be added later using CMS_add1_recipient_cert(3) or CMS_add0_recipient_key(3).

                                                                                                                                      The CMS_ContentInfo structure needs to be finalized using CMS_final(3) and then freed using CMS_ContentInfo_free(3).

                                                                                                                                      CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create are similar to CMS_EnvelopedData_create_ex() and CMS_AuthEnvelopedData_create_ex() but use default values of NULL for the library context libctx and the property query propq.

                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/#notes","title":"NOTES","text":"

                                                                                                                                      Although CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() allocate a new CMS_ContentInfo structure, they are not usually used in applications. The wrappers CMS_encrypt(3) and CMS_decrypt(3) are often used instead.

                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, CMS_EnvelopedData_create() and CMS_AuthEnvelopedData_create() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_encrypt(3), CMS_decrypt(3), CMS_final(3)

                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/#history","title":"HISTORY","text":"

                                                                                                                                      The CMS_EnvelopedData_create_ex() method was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_EnvelopedData_create/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_add0_cert/","title":"CMS_add0_cert","text":""},{"location":"man3/CMS_add0_cert/#name","title":"NAME","text":"

                                                                                                                                      CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_add1_crl, CMS_get1_crls - CMS certificate and CRL utility functions

                                                                                                                                      "},{"location":"man3/CMS_add0_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);\nint CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);\nSTACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);\n\nint CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);\nint CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);\nSTACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);\n
                                                                                                                                      "},{"location":"man3/CMS_add0_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_add0_cert() and CMS_add1_cert() add certificate cert to cms. This is used by CMS_sign_ex(3) and CMS_sign(3) and may be used before calling CMS_verify(3) to help chain building in certificate validation. cms must be of type signed data or (authenticated) enveloped data. For signed data, such a certificate can be used when signing or verifying to fill in the signer certificate or to provide an extra CA certificate that may be needed for chain building in certificate validation.

                                                                                                                                      CMS_get1_certs() returns all certificates in cms.

                                                                                                                                      CMS_add0_crl() and CMS_add1_crl() add CRL crl to cms. cms must be of type signed data or (authenticated) enveloped data. For signed data, such a CRL may be used in certificate validation with CMS_verify(3). It may be given both for inclusion when signing a CMS message and when verifying a signed CMS message.

                                                                                                                                      CMS_get1_crls() returns all CRLs in cms.

                                                                                                                                      "},{"location":"man3/CMS_add0_cert/#notes","title":"NOTES","text":"

                                                                                                                                      The CMS_ContentInfo structure cms must be of type signed data or enveloped data or an error will be returned.

                                                                                                                                      For signed data certificates and CRLs are added to the certificates and crls fields of SignedData structure. For enveloped data they are added to OriginatorInfo.

                                                                                                                                      As the 0 implies CMS_add0_cert() adds cert internally to cms and it must not be freed up after the call as opposed to CMS_add1_cert() where cert must be freed up.

                                                                                                                                      The same certificate must not be added to the same cms structure more than once.

                                                                                                                                      "},{"location":"man3/CMS_add0_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return 1 for success and 0 for failure.

                                                                                                                                      CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs or NULL if there are none or an error occurs. The only error which will occur in practice is if the cms type is invalid.

                                                                                                                                      "},{"location":"man3/CMS_add0_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_sign(3), CMS_sign_ex(3), CMS_verify(3), CMS_encrypt(3)

                                                                                                                                      "},{"location":"man3/CMS_add0_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/","title":"CMS_add1_recipient_cert","text":""},{"location":"man3/CMS_add1_recipient_cert/#name","title":"NAME","text":"

                                                                                                                                      CMS_add1_recipient, CMS_add1_recipient_cert, CMS_add0_recipient_key - add recipients to a CMS enveloped data structure

                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,\n                                      EVP_PKEY *originatorPrivKey,\n                                      X509 *originator, unsigned int flags);\n\nCMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,\n                                           X509 *recip, unsigned int flags);\n\nCMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,\n                                          unsigned char *key, size_t keylen,\n                                          unsigned char *id, size_t idlen,\n                                          ASN1_GENERALIZEDTIME *date,\n                                          ASN1_OBJECT *otherTypeId,\n                                          ASN1_TYPE *otherType);\n
                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_add1_recipient() adds recipient recip and provides the originator pkey originatorPrivKey and originator certificate originator to CMS_ContentInfo. The originator-related fields are relevant only in case when the keyAgreement method of providing of the shared key is in use.

                                                                                                                                      CMS_add1_recipient_cert() adds recipient recip to CMS_ContentInfo enveloped data structure cms as a KeyTransRecipientInfo structure.

                                                                                                                                      CMS_add0_recipient_key() adds symmetric key key of length keylen using wrapping algorithm nid, identifier id of length idlen and optional values date, otherTypeId and otherType to CMS_ContentInfo enveloped data structure cms as a KEKRecipientInfo structure.

                                                                                                                                      The CMS_ContentInfo structure should be obtained from an initial call to CMS_encrypt() with the flag CMS_PARTIAL set.

                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/#notes","title":"NOTES","text":"

                                                                                                                                      The main purpose of this function is to provide finer control over a CMS enveloped data structure where the simpler CMS_encrypt() function defaults are not appropriate. For example if one or more KEKRecipientInfo structures need to be added. New attributes can also be added using the returned CMS_RecipientInfo structure and the CMS attribute utility functions.

                                                                                                                                      OpenSSL will by default identify recipient certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if all recipient certificates do not have a subject key identifier extension.

                                                                                                                                      Currently only AES based key wrapping algorithms are supported for nid, specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wrap. If nid is set to NID_undef then an AES wrap algorithm will be used consistent with keylen.

                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal pointer to the CMS_RecipientInfo structure just added or NULL if an error occurs.

                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_decrypt(3), CMS_final(3),

                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/#history","title":"HISTORY","text":"

                                                                                                                                      CMS_add1_recipient_cert and CMS_add0_recipient_key were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_add1_recipient_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_add1_signer/","title":"CMS_add1_signer","text":""},{"location":"man3/CMS_add1_signer/#name","title":"NAME","text":"

                                                                                                                                      CMS_add1_signer, CMS_SignerInfo_sign - add a signer to a CMS_ContentInfo signed data structure

                                                                                                                                      "},{"location":"man3/CMS_add1_signer/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, X509 *signcert,\n                                EVP_PKEY *pkey, const EVP_MD *md,\n                                unsigned int flags);\n\nint CMS_SignerInfo_sign(CMS_SignerInfo *si);\n
                                                                                                                                      "},{"location":"man3/CMS_add1_signer/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_add1_signer() adds a signer with certificate signcert and private key pkey using message digest md to CMS_ContentInfo SignedData structure cms.

                                                                                                                                      The CMS_ContentInfo structure should be obtained from an initial call to CMS_sign() with the flag CMS_PARTIAL set or in the case or re-signing a valid CMS_ContentInfo SignedData structure.

                                                                                                                                      If the md parameter is NULL then the default digest for the public key algorithm will be used.

                                                                                                                                      Unless the CMS_REUSE_DIGEST flag is set the returned CMS_ContentInfo structure is not complete and must be finalized either by streaming (if applicable) or a call to CMS_final().

                                                                                                                                      The CMS_SignerInfo_sign() function explicitly signs a CMS_SignerInfo structure, its main use is when the CMS_REUSE_DIGEST and CMS_PARTIAL flags are both set.

                                                                                                                                      "},{"location":"man3/CMS_add1_signer/#notes","title":"NOTES","text":"

                                                                                                                                      The main purpose of CMS_add1_signer() is to provide finer control over a CMS signed data structure where the simpler CMS_sign() function defaults are not appropriate. For example if multiple signers or non default digest algorithms are needed. New attributes can also be added using the returned CMS_SignerInfo structure and the CMS attribute utility functions or the CMS signed receipt request functions.

                                                                                                                                      Any of the following flags (ored together) can be passed in the flags parameter.

                                                                                                                                      If CMS_REUSE_DIGEST is set then an attempt is made to copy the content digest value from the CMS_ContentInfo structure: to add a signer to an existing structure. An error occurs if a matching digest value cannot be found to copy. The returned CMS_ContentInfo structure will be valid and finalized when this flag is set.

                                                                                                                                      If CMS_PARTIAL is set in addition to CMS_REUSE_DIGEST then the CMS_SignerInfo structure will not be finalized so additional attributes can be added. In this case an explicit call to CMS_SignerInfo_sign() is needed to finalize it.

                                                                                                                                      If CMS_NOCERTS is set the signer's certificate will not be included in the CMS_ContentInfo structure, the signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signature if the signers certificate can be obtained by other means: for example a previously signed message.

                                                                                                                                      The SignedData structure includes several CMS signedAttributes including the signing time, the CMS content type and the supported list of ciphers in an SMIMECapabilities attribute. If CMS_NOATTR is set then no signedAttributes will be used. If CMS_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

                                                                                                                                      OpenSSL will by default identify signing certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if the signing certificate does not have a subject key identifier extension.

                                                                                                                                      If present the SMIMECapabilities attribute indicates support for the following algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is not loaded.

                                                                                                                                      CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo structure just added, this can be used to set additional attributes before it is finalized.

                                                                                                                                      "},{"location":"man3/CMS_add1_signer/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_add1_signer() returns an internal pointer to the CMS_SignerInfo structure just added or NULL if an error occurs.

                                                                                                                                      CMS_SignerInfo_sign() returns 1 on success, 0 on failure.

                                                                                                                                      "},{"location":"man3/CMS_add1_signer/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_sign(3), CMS_final(3),

                                                                                                                                      "},{"location":"man3/CMS_add1_signer/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2014-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_compress/","title":"CMS_compress","text":""},{"location":"man3/CMS_compress/#name","title":"NAME","text":"

                                                                                                                                      CMS_compress - create a CMS CompressedData structure

                                                                                                                                      "},{"location":"man3/CMS_compress/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_compress/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_compress() creates and returns a CMS CompressedData structure. comp_nid is the compression algorithm to use or NID_undef to use the default algorithm (zlib compression). in is the content to be compressed. flags is an optional set of flags.

                                                                                                                                      The only currently supported compression algorithm is zlib using the NID NID_zlib_compression.

                                                                                                                                      If zlib support is not compiled into OpenSSL then CMS_compress() will return an error.

                                                                                                                                      If the CMS_TEXT flag is set MIME headers for type text/plain are prepended to the data.

                                                                                                                                      Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if CMS_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it. If CMS_BINARY is set then CMS_TEXT is ignored.

                                                                                                                                      If the CMS_STREAM flag is set a partial CMS_ContentInfo structure is returned suitable for streaming I/O: no data is read from the BIO in.

                                                                                                                                      The compressed data is included in the CMS_ContentInfo structure, unless CMS_DETACHED is set in which case it is omitted. This is rarely used in practice and is not supported by SMIME_write_CMS().

                                                                                                                                      If the flag CMS_STREAM is set the returned CMS_ContentInfo structure is not complete and outputting its contents via a function that does not properly finalize the CMS_ContentInfo structure will give unpredictable results.

                                                                                                                                      Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_CMS().

                                                                                                                                      Additional compression parameters such as the zlib compression level cannot currently be set.

                                                                                                                                      "},{"location":"man3/CMS_compress/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_compress() returns either a CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/CMS_compress/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_uncompress(3)

                                                                                                                                      "},{"location":"man3/CMS_compress/#history","title":"HISTORY","text":"

                                                                                                                                      The CMS_STREAM flag was added in OpenSSL 1.0.0.

                                                                                                                                      "},{"location":"man3/CMS_compress/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_data_create/","title":"CMS_data_create","text":""},{"location":"man3/CMS_data_create/#name","title":"NAME","text":"

                                                                                                                                      CMS_data_create_ex, CMS_data_create - Create CMS Data object

                                                                                                                                      "},{"location":"man3/CMS_data_create/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,\n                                    OSSL_LIB_CTX *libctx, const char *propq);\nCMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_data_create/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_data_create_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_data. The data is supplied via the in BIO. The library context libctx and the property query propq are used when retrieving algorithms from providers. The flags field supports the CMS_STREAM flag. Internally CMS_final() is called unless CMS_STREAM is specified.

                                                                                                                                      The CMS_ContentInfo structure can be freed using CMS_ContentInfo_free(3).

                                                                                                                                      CMS_data_create() is similar to CMS_data_create_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                      "},{"location":"man3/CMS_data_create/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, CMS_data_create_ex() and CMS_data_create() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

                                                                                                                                      "},{"location":"man3/CMS_data_create/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_final(3)

                                                                                                                                      "},{"location":"man3/CMS_data_create/#history","title":"HISTORY","text":"

                                                                                                                                      The CMS_data_create_ex() method was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_data_create/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_decrypt/","title":"CMS_decrypt","text":""},{"location":"man3/CMS_decrypt/#name","title":"NAME","text":"

                                                                                                                                      CMS_decrypt, CMS_decrypt_set1_pkey_and_peer, CMS_decrypt_set1_pkey, CMS_decrypt_set1_password - decrypt content from a CMS envelopedData structure

                                                                                                                                      "},{"location":"man3/CMS_decrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,\n                BIO *dcont, BIO *out, unsigned int flags);\nint CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms,\n                EVP_PKEY *pk, X509 *cert, X509 *peer);\nint CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);\nint CMS_decrypt_set1_password(CMS_ContentInfo *cms,\n                              unsigned char *pass, ossl_ssize_t passlen);\n
                                                                                                                                      "},{"location":"man3/CMS_decrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_decrypt() extracts the decrypted content from a CMS EnvelopedData or AuthEnvelopedData structure. It uses CMS_decrypt_set1_pkey() to decrypt the content with the recipient private key pkey if pkey is not NULL. In this case, it is recommended to provide the associated certificate in cert - see the NOTES below. out is a BIO to write the content to and flags is an optional set of flags. If pkey is NULL the function assumes that decryption was already done (e.g., using CMS_decrypt_set1_pkey() or CMS_decrypt_set1_password()) and just provides the content unless cert, dcont, and out are NULL as well. The dcont parameter is used in the rare case where the encrypted content is detached. It will normally be set to NULL.

                                                                                                                                      CMS_decrypt_set1_pkey_and_peer() decrypts the CMS_ContentInfo structure cms using the private key pkey, the corresponding certificate cert, which is recommended to be supplied but may be NULL, and the (optional) originator certificate peer. On success, it also records in cms the decryption key pkey, and this should be followed by CMS_decrypt(cms, NULL, NULL, dcont, out, flags). This call deallocates any decryption key stored in cms.

                                                                                                                                      CMS_decrypt_set1_pkey() is the same as CMS_decrypt_set1_pkey_and_peer() with peer being NULL.

                                                                                                                                      CMS_decrypt_set1_password() decrypts the CMS_ContentInfo structure cms using the secret pass of length passlen. On success, it also records in cms the decryption key used, and this should be followed by CMS_decrypt(cms, NULL, NULL, dcont, out, flags). This call deallocates any decryption key stored in cms.

                                                                                                                                      "},{"location":"man3/CMS_decrypt/#notes","title":"NOTES","text":"

                                                                                                                                      Although the recipients certificate is not needed to decrypt the data it is needed to locate the appropriate (of possible several) recipients in the CMS structure.

                                                                                                                                      If cert is set to NULL all possible recipients are tried. This case however is problematic. To thwart the MMA attack (Bleichenbacher's attack on PKCS #1 v1.5 RSA padding) all recipients are tried whether they succeed or not. If no recipient succeeds then a random symmetric key is used to decrypt the content: this will typically output garbage and may (but is not guaranteed to) ultimately return a padding error only. If CMS_decrypt() just returned an error when all recipient encrypted keys failed to decrypt an attacker could use this in a timing attack. If the special flag CMS_DEBUG_DECRYPT is set then the above behaviour is modified and an error is returned if no recipient encrypted key can be decrypted without generating a random content encryption key. Applications should use this flag with extreme caution especially in automated gateways as it can leave them open to attack.

                                                                                                                                      It is possible to determine the correct recipient key by other means (for example looking them up in a database) and setting them in the CMS structure in advance using the CMS utility functions such as CMS_set1_pkey(), or use CMS_decrypt_set1_password() if the recipient has a symmetric key. In these cases both cert and pkey should be set to NULL.

                                                                                                                                      To process KEKRecipientInfo types CMS_set1_key() or CMS_RecipientInfo_set0_key() and CMS_RecipientInfo_decrypt() should be called before CMS_decrypt() and cert and pkey set to NULL.

                                                                                                                                      The following flags can be passed in the flags parameter.

                                                                                                                                      If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                                                                                                                                      "},{"location":"man3/CMS_decrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_decrypt(), CMS_decrypt_set1_pkey_and_peer(), CMS_decrypt_set1_pkey(), and CMS_decrypt_set1_password() return either 1 for success or 0 for failure. The error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/CMS_decrypt/#bugs","title":"BUGS","text":"

                                                                                                                                      The set1_ part of these function names is misleading and should better read: with_.

                                                                                                                                      The lack of single pass processing and the need to hold all data in memory as mentioned in CMS_verify() also applies to CMS_decrypt().

                                                                                                                                      "},{"location":"man3/CMS_decrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_encrypt(3)

                                                                                                                                      "},{"location":"man3/CMS_decrypt/#history","title":"HISTORY","text":"

                                                                                                                                      CMS_decrypt_set1_pkey_and_peer() and CMS_decrypt_set1_password() were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_decrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_digest_create/","title":"CMS_digest_create","text":""},{"location":"man3/CMS_digest_create/#name","title":"NAME","text":"

                                                                                                                                      CMS_digest_create_ex, CMS_digest_create - Create CMS DigestedData object

                                                                                                                                      "},{"location":"man3/CMS_digest_create/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md,\n                                      unsigned int flags, OSSL_LIB_CTX *ctx,\n                                      const char *propq);\n\nCMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,\n                                   unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_digest_create/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_digest_create_ex() creates a CMS_ContentInfo structure with a type NID_pkcs7_digest. The data supplied via the in BIO is digested using md. The library context libctx and the property query propq are used when retrieving algorithms from providers. The flags field supports the CMS_DETACHED and CMS_STREAM flags, Internally CMS_final() is called unless CMS_STREAM is specified.

                                                                                                                                      The CMS_ContentInfo structure can be freed using CMS_ContentInfo_free(3).

                                                                                                                                      CMS_digest_create() is similar to CMS_digest_create_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                      "},{"location":"man3/CMS_digest_create/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, CMS_digest_create_ex() and CMS_digest_create() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

                                                                                                                                      "},{"location":"man3/CMS_digest_create/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_final(3)>

                                                                                                                                      "},{"location":"man3/CMS_digest_create/#history","title":"HISTORY","text":"

                                                                                                                                      The CMS_digest_create_ex() method was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_digest_create/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_encrypt/","title":"CMS_encrypt","text":""},{"location":"man3/CMS_encrypt/#name","title":"NAME","text":"

                                                                                                                                      CMS_encrypt_ex, CMS_encrypt - create a CMS envelopedData structure

                                                                                                                                      "},{"location":"man3/CMS_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *in,\n                                const EVP_CIPHER *cipher, unsigned int flags,\n                                OSSL_LIB_CTX *libctx, const char *propq);\nCMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,\n                             const EVP_CIPHER *cipher, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_encrypt_ex() creates and returns a CMS EnvelopedData or AuthEnvelopedData structure. certs is a list of recipient certificates. in is the content to be encrypted. cipher is the symmetric cipher to use. flags is an optional set of flags. The library context libctx and the property query propq are used internally when retrieving algorithms from providers.

                                                                                                                                      Only certificates carrying RSA, Diffie-Hellman or EC keys are supported by this function.

                                                                                                                                      EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use because most clients will support it.

                                                                                                                                      The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters. If the cipher mode is GCM, then an AuthEnvelopedData structure containing MAC is used. Otherwise an EnvelopedData structure is used. Currently the AES variants with GCM mode are the only supported AEAD algorithms.

                                                                                                                                      Many browsers implement a \"sign and encrypt\" option which is simply an S/MIME envelopedData containing an S/MIME signed message. This can be readily produced by storing the S/MIME signed message in a memory BIO and passing it to CMS_encrypt().

                                                                                                                                      The following flags can be passed in the flags parameter.

                                                                                                                                      If the CMS_TEXT flag is set MIME headers for type text/plain are prepended to the data.

                                                                                                                                      Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if CMS_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it. If CMS_BINARY is set then CMS_TEXT is ignored.

                                                                                                                                      OpenSSL will by default identify recipient certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if all recipient certificates do not have a subject key identifier extension.

                                                                                                                                      If the CMS_STREAM flag is set a partial CMS_ContentInfo structure is returned suitable for streaming I/O: no data is read from the BIO in.

                                                                                                                                      If the CMS_PARTIAL flag is set a partial CMS_ContentInfo structure is returned to which additional recipients and attributes can be added before finalization.

                                                                                                                                      The data being encrypted is included in the CMS_ContentInfo structure, unless CMS_DETACHED is set in which case it is omitted. This is rarely used in practice and is not supported by SMIME_write_CMS().

                                                                                                                                      If the flag CMS_STREAM is set the returned CMS_ContentInfo structure is not complete and outputting its contents via a function that does not properly finalize the CMS_ContentInfo structure will give unpredictable results.

                                                                                                                                      Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_CMS().

                                                                                                                                      The recipients specified in certs use a CMS KeyTransRecipientInfo info structure. KEKRecipientInfo is also supported using the flag CMS_PARTIAL and CMS_add0_recipient_key().

                                                                                                                                      The parameter certs may be NULL if CMS_PARTIAL is set and recipients added later using CMS_add1_recipient_cert() or CMS_add0_recipient_key().

                                                                                                                                      CMS_encrypt() is similar to CMS_encrypt_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                      "},{"location":"man3/CMS_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_encrypt_ex() and CMS_encrypt() return either a CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/CMS_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_decrypt(3)

                                                                                                                                      "},{"location":"man3/CMS_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                      The function CMS_encrypt_ex() was added in OpenSSL 3.0.

                                                                                                                                      The CMS_STREAM flag was first supported in OpenSSL 1.0.0.

                                                                                                                                      "},{"location":"man3/CMS_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_final/","title":"CMS_final","text":""},{"location":"man3/CMS_final/#name","title":"NAME","text":"

                                                                                                                                      CMS_final - finalise a CMS_ContentInfo structure

                                                                                                                                      "},{"location":"man3/CMS_final/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_final/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_final() finalises the structure cms. Its purpose is to perform any operations necessary on cms (digest computation for example) and set the appropriate fields. The parameter data contains the content to be processed. The dcont parameter contains a BIO to write content to after processing: this is only used with detached data and will usually be set to NULL.

                                                                                                                                      "},{"location":"man3/CMS_final/#notes","title":"NOTES","text":"

                                                                                                                                      This function will normally be called when the CMS_PARTIAL flag is used. It should only be used when streaming is not performed because the streaming I/O functions perform finalisation operations internally.

                                                                                                                                      "},{"location":"man3/CMS_final/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_final() returns 1 for success or 0 for failure.

                                                                                                                                      "},{"location":"man3/CMS_final/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_sign(3), CMS_encrypt(3)

                                                                                                                                      "},{"location":"man3/CMS_final/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/","title":"CMS_get0_RecipientInfos","text":""},{"location":"man3/CMS_get0_RecipientInfos/#name","title":"NAME","text":"

                                                                                                                                      CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id, CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kari_set0_pkey_and_peer, CMS_RecipientInfo_kari_set0_pkey, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt, CMS_RecipientInfo_encrypt - CMS envelopedData RecipientInfo routines

                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nSTACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);\nint CMS_RecipientInfo_type(CMS_RecipientInfo *ri);\n\nint CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,\n                                          ASN1_OCTET_STRING **keyid,\n                                          X509_NAME **issuer,\n                                          ASN1_INTEGER **sno);\nint CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);\nint CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);\nint CMS_RecipientInfo_kari_set0_pkey_and_peer(CMS_RecipientInfo *ri,\n                                              EVP_PKEY *pk, X509 *peer);\nint CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);\nint CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg,\n                                    ASN1_OCTET_STRING **pid,\n                                    ASN1_GENERALIZEDTIME **pdate,\n                                    ASN1_OBJECT **potherid,\n                                    ASN1_TYPE **pothertype);\nint CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,\n                                   const unsigned char *id, size_t idlen);\nint CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,\n                               unsigned char *key, size_t keylen);\n\nint CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);\nint CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);\n
                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The function CMS_get0_RecipientInfos() returns all the CMS_RecipientInfo structures associated with a CMS EnvelopedData structure.

                                                                                                                                      CMS_RecipientInfo_type() returns the type of CMS_RecipientInfo structure ri. It will currently return CMS_RECIPINFO_TRANS, CMS_RECIPINFO_AGREE, CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or CMS_RECIPINFO_OTHER.

                                                                                                                                      CMS_RecipientInfo_ktri_get0_signer_id() retrieves the certificate recipient identifier associated with a specific CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_TRANS. Either the keyidentifier will be set in keyid or both issuer name and serial number in issuer and sno.

                                                                                                                                      CMS_RecipientInfo_ktri_cert_cmp() compares the certificate cert against the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_TRANS. It returns zero if the comparison is successful and non zero if not.

                                                                                                                                      CMS_RecipientInfo_set0_pkey() associates the private key pkey with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_TRANS.

                                                                                                                                      CMS_RecipientInfo_kari_set0_pkey_and_peer() associates the private key pkey and peer certificate peer with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_AGREE.

                                                                                                                                      CMS_RecipientInfo_kari_set0_pkey() associates the private key pkey with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_AGREE.

                                                                                                                                      CMS_RecipientInfo_kekri_get0_id() retrieves the key information from the CMS_RecipientInfo structure ri which must be of type CMS_RECIPINFO_KEK. Any of the remaining parameters can be NULL if the application is not interested in the value of a field. Where a field is optional and absent NULL will be written to the corresponding parameter. The keyEncryptionAlgorithm field is written to palg, the keyIdentifier field is written to pid, the date field if present is written to pdate, if the other field is present the components keyAttrId and keyAttr are written to parameters potherid and pothertype.

                                                                                                                                      CMS_RecipientInfo_kekri_id_cmp() compares the ID in the id and idlen parameters against the keyIdentifier CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_KEK. It returns zero if the comparison is successful and non zero if not.

                                                                                                                                      CMS_RecipientInfo_set0_key() associates the symmetric key key of length keylen with the CMS_RecipientInfo structure ri, which must be of type CMS_RECIPINFO_KEK.

                                                                                                                                      CMS_RecipientInfo_decrypt() attempts to decrypt CMS_RecipientInfo structure ri in structure cms. A key must have been associated with the structure first.

                                                                                                                                      CMS_RecipientInfo_encrypt() attempts to encrypt CMS_RecipientInfo structure ri in structure cms. A key must have been associated with the structure first and the content encryption key must be available: for example by a previous call to CMS_RecipientInfo_decrypt().

                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/#notes","title":"NOTES","text":"

                                                                                                                                      The main purpose of these functions is to enable an application to lookup recipient keys using any appropriate technique when the simpler method of CMS_decrypt() is not appropriate.

                                                                                                                                      In typical usage and application will retrieve all CMS_RecipientInfo structures using CMS_get0_RecipientInfos() and check the type of each using CMS_RecipientInfo_type(). Depending on the type the CMS_RecipientInfo structure can be ignored or its key identifier data retrieved using an appropriate function. Then if the corresponding secret or private key can be obtained by any appropriate means it can then associated with the structure and CMS_RecipientInfo_decrypt() called. If successful CMS_decrypt() can be called with a NULL key to decrypt the enveloped content.

                                                                                                                                      The CMS_RecipientInfo_encrypt() can be used to add a new recipient to an existing enveloped data structure. Typically an application will first decrypt an appropriate CMS_RecipientInfo structure to make the content encrypt key available, it will then add a new recipient using a function such as CMS_add1_recipient_cert() and finally encrypt the content encryption key using CMS_RecipientInfo_encrypt().

                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_get0_RecipientInfos() returns all CMS_RecipientInfo structures, or NULL if an error occurs.

                                                                                                                                      CMS_RecipientInfo_ktri_get0_signer_id(), CMS_RecipientInfo_set0_pkey(), CMS_RecipientInfo_kekri_get0_id(), CMS_RecipientInfo_set0_key() and CMS_RecipientInfo_decrypt() return 1 for success or 0 if an error occurs. CMS_RecipientInfo_encrypt() return 1 for success or 0 if an error occurs.

                                                                                                                                      CMS_RecipientInfo_ktri_cert_cmp() and CMS_RecipientInfo_kekri_cmp() return 0 for a successful comparison and non zero otherwise.

                                                                                                                                      Any error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_decrypt(3)

                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/#history","title":"HISTORY","text":"

                                                                                                                                      CMS_RecipientInfo_kari_set0_pkey_and_peer and CMS_RecipientInfo_kari_set0_pkey were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_get0_RecipientInfos/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_get0_SignerInfos/","title":"CMS_get0_SignerInfos","text":""},{"location":"man3/CMS_get0_SignerInfos/#name","title":"NAME","text":"

                                                                                                                                      CMS_SignerInfo_set1_signer_cert, CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_get0_signature, CMS_SignerInfo_cert_cmp - CMS signedData signer functions

                                                                                                                                      "},{"location":"man3/CMS_get0_SignerInfos/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nSTACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);\n\nint CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid,\n                                  X509_NAME **issuer, ASN1_INTEGER **sno);\nASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);\nint CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);\nvoid CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);\n
                                                                                                                                      "},{"location":"man3/CMS_get0_SignerInfos/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The function CMS_get0_SignerInfos() returns all the CMS_SignerInfo structures associated with a CMS signedData structure.

                                                                                                                                      CMS_SignerInfo_get0_signer_id() retrieves the certificate signer identifier associated with a specific CMS_SignerInfo structure si. Either the keyidentifier will be set in keyid or both issuer name and serial number in issuer and sno.

                                                                                                                                      CMS_SignerInfo_get0_signature() retrieves the signature associated with si in a pointer to an ASN1_OCTET_STRING structure. This pointer returned corresponds to the internal signature value if si so it may be read or modified.

                                                                                                                                      CMS_SignerInfo_cert_cmp() compares the certificate cert against the signer identifier si. It returns zero if the comparison is successful and non zero if not.

                                                                                                                                      CMS_SignerInfo_set1_signer_cert() sets the signers certificate of si to signer.

                                                                                                                                      "},{"location":"man3/CMS_get0_SignerInfos/#notes","title":"NOTES","text":"

                                                                                                                                      The main purpose of these functions is to enable an application to lookup signers certificates using any appropriate technique when the simpler method of CMS_verify() is not appropriate.

                                                                                                                                      In typical usage and application will retrieve all CMS_SignerInfo structures using CMS_get0_SignerInfo() and retrieve the identifier information using CMS. It will then obtain the signer certificate by some unspecified means (or return and error if it cannot be found) and set it using CMS_SignerInfo_set1_signer_cert().

                                                                                                                                      Once all signer certificates have been set CMS_verify() can be used.

                                                                                                                                      Although CMS_get0_SignerInfos() can return NULL if an error occurs or if there are no signers this is not a problem in practice because the only error which can occur is if the cms structure is not of type signedData due to application error.

                                                                                                                                      "},{"location":"man3/CMS_get0_SignerInfos/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_get0_SignerInfos() returns all CMS_SignerInfo structures, or NULL there are no signers or an error occurs.

                                                                                                                                      CMS_SignerInfo_get0_signer_id() returns 1 for success and 0 for failure.

                                                                                                                                      CMS_SignerInfo_cert_cmp() returns 0 for a successful comparison and non zero otherwise.

                                                                                                                                      CMS_SignerInfo_set1_signer_cert() does not return a value.

                                                                                                                                      Any error can be obtained from ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/CMS_get0_SignerInfos/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_verify(3)

                                                                                                                                      "},{"location":"man3/CMS_get0_SignerInfos/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_get0_type/","title":"CMS_get0_type","text":""},{"location":"man3/CMS_get0_type/#name","title":"NAME","text":"

                                                                                                                                      CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType, CMS_get0_content - get and set CMS content types and content

                                                                                                                                      "},{"location":"man3/CMS_get0_type/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nconst ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);\nint CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);\nconst ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);\nASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);\n
                                                                                                                                      "},{"location":"man3/CMS_get0_type/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_get0_type() returns the content type of a CMS_ContentInfo structure as an ASN1_OBJECT pointer. An application can then decide how to process the CMS_ContentInfo structure based on this value.

                                                                                                                                      CMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo structure. It should be called with CMS functions (such as CMS_sign(3), CMS_encrypt(3)) with the CMS_PARTIAL flag and before the structure is finalised, otherwise the results are undefined.

                                                                                                                                      ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded content type.

                                                                                                                                      CMS_get0_content() returns a pointer to the ASN1_OCTET_STRING pointer containing the embedded content.

                                                                                                                                      "},{"location":"man3/CMS_get0_type/#notes","title":"NOTES","text":"

                                                                                                                                      As the 0 implies CMS_get0_type(), CMS_get0_eContentType() and CMS_get0_content() return internal pointers which should not be freed up. CMS_set1_eContentType() copies the supplied OID and it should be freed up after use.

                                                                                                                                      The ASN1_OBJECT values returned can be converted to an integer NID value using OBJ_obj2nid(). For the currently supported content types the following values are returned:

                                                                                                                                      NID_pkcs7_data\nNID_pkcs7_signed\nNID_pkcs7_digest\nNID_id_smime_ct_compressedData:\nNID_pkcs7_encrypted\nNID_pkcs7_enveloped\n

                                                                                                                                      The return value of CMS_get0_content() is a pointer to the ASN1_OCTET_STRING content pointer. That means that for example:

                                                                                                                                      ASN1_OCTET_STRING **pconf = CMS_get0_content(cms);\n

                                                                                                                                      *pconf could be NULL if there is no embedded content. Applications can access, modify or create the embedded content in a CMS_ContentInfo structure using this function. Applications usually will not need to modify the embedded content as it is normally set by higher level functions.

                                                                                                                                      "},{"location":"man3/CMS_get0_type/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_get0_type() and CMS_get0_eContentType() return an ASN1_OBJECT structure.

                                                                                                                                      CMS_set1_eContentType() returns 1 for success or 0 if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/CMS_get0_type/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/CMS_get0_type/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/","title":"CMS_get1_ReceiptRequest","text":""},{"location":"man3/CMS_get1_ReceiptRequest/#name","title":"NAME","text":"

                                                                                                                                      CMS_ReceiptRequest_create0_ex, CMS_ReceiptRequest_create0, CMS_add1_ReceiptRequest, CMS_get1_ReceiptRequest, CMS_ReceiptRequest_get0_values - CMS signed receipt request functions

                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(\n    unsigned char *id, int idlen, int allorfirst,\n    STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo,\n    OSSL_LIB_CTX *libctx);\nCMS_ReceiptRequest *CMS_ReceiptRequest_create0(\n    unsigned char *id, int idlen, int allorfirst,\n    STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo);\nint CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);\nint CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);\nvoid CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING **pcid,\n                                    int *pallorfirst,\n                                    STACK_OF(GENERAL_NAMES) **plist,\n                                    STACK_OF(GENERAL_NAMES) **prto);\n
                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_ReceiptRequest_create0_ex() creates a signed receipt request structure. The signedContentIdentifier field is set using id and idlen, or it is set to 32 bytes of pseudo random data if id is NULL. If receiptList is NULL the allOrFirstTier option in receiptsFrom is used and set to the value of the allorfirst parameter. If receiptList is not NULL the receiptList option in receiptsFrom is used. The receiptsTo parameter specifies the receiptsTo field value. The library context libctx is used to find the public random generator.

                                                                                                                                      CMS_ReceiptRequest_create0() is similar to CMS_ReceiptRequest_create0_ex() but uses default values of NULL for the library context libctx.

                                                                                                                                      The CMS_add1_ReceiptRequest() function adds a signed receipt request rr to SignerInfo structure si.

                                                                                                                                      int CMS_get1_ReceiptRequest() looks for a signed receipt request in si, if any is found it is decoded and written to prr.

                                                                                                                                      CMS_ReceiptRequest_get0_values() retrieves the values of a receipt request. The signedContentIdentifier is copied to pcid. If the allOrFirstTier option of receiptsFrom is used its value is copied to pallorfirst otherwise the receiptList field is copied to plist. The receiptsTo parameter is copied to prto.

                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/#notes","title":"NOTES","text":"

                                                                                                                                      For more details of the meaning of the fields see RFC2634.

                                                                                                                                      The contents of a signed receipt should only be considered meaningful if the corresponding CMS_ContentInfo structure can be successfully verified using CMS_verify().

                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_ReceiptRequest_create0_ex() and CMS_ReceiptRequest_create0() return a signed receipt request structure or NULL if an error occurred.

                                                                                                                                      CMS_add1_ReceiptRequest() returns 1 for success or 0 if an error occurred.

                                                                                                                                      CMS_get1_ReceiptRequest() returns 1 is a signed receipt request is found and decoded. It returns 0 if a signed receipt request is not present and -1 if it is present but malformed.

                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_sign(3), CMS_sign_receipt(3), CMS_verify(3) CMS_verify_receipt(3)

                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/#history","title":"HISTORY","text":"

                                                                                                                                      The function CMS_ReceiptRequest_create0_ex() was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_get1_ReceiptRequest/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_sign/","title":"CMS_sign","text":""},{"location":"man3/CMS_sign/#name","title":"NAME","text":"

                                                                                                                                      CMS_sign, CMS_sign_ex - create a CMS SignedData structure

                                                                                                                                      "},{"location":"man3/CMS_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,\n                             STACK_OF(X509) *certs, BIO *data,\n                             unsigned int flags, OSSL_LIB_CTX *ctx,\n                             const char *propq);\nCMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                          BIO *data, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_sign_ex() creates and returns a CMS SignedData structure. signcert is the certificate to sign with, pkey is the corresponding private key. certs is an optional additional set of certificates to include in the CMS structure (for example any intermediate CAs in the chain). The library context libctx and the property query propq are used when retrieving algorithms from providers. Any or all of these parameters can be NULL, see NOTES below.

                                                                                                                                      The data to be signed is read from BIO data.

                                                                                                                                      flags is an optional set of flags.

                                                                                                                                      CMS_sign() is similar to CMS_sign_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                      "},{"location":"man3/CMS_sign/#notes","title":"NOTES","text":"

                                                                                                                                      Any of the following flags (ored together) can be passed in the flags parameter.

                                                                                                                                      Many S/MIME clients expect the signed content to include valid MIME headers. If the CMS_TEXT flag is set MIME headers for type text/plain are prepended to the data.

                                                                                                                                      If CMS_NOCERTS is set the signer's certificate will not be included in the CMS_ContentInfo structure, the signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signature if the signers certificate can be obtained by other means: for example a previously signed message.

                                                                                                                                      The data being signed is included in the CMS_ContentInfo structure, unless CMS_DETACHED is set in which case it is omitted. This is used for CMS_ContentInfo detached signatures which are used in S/MIME plaintext signed messages for example.

                                                                                                                                      Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if CMS_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it.

                                                                                                                                      The SignedData structure includes several CMS signedAttributes including the signing time, the CMS content type and the supported list of ciphers in an SMIMECapabilities attribute. If CMS_NOATTR is set then no signedAttributes will be used. If CMS_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

                                                                                                                                      If present the SMIMECapabilities attribute indicates support for the following algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is not loaded.

                                                                                                                                      OpenSSL will by default identify signing certificates using issuer name and serial number. If CMS_USE_KEYID is set it will use the subject key identifier value instead. An error occurs if the signing certificate does not have a subject key identifier extension.

                                                                                                                                      If the flags CMS_STREAM is set then the returned CMS_ContentInfo structure is just initialized ready to perform the signing operation. The signing is however not performed and the data to be signed is not read from the data parameter. Signing is deferred until after the data has been written. In this way data can be signed in a single pass.

                                                                                                                                      If the CMS_PARTIAL flag is set a partial CMS_ContentInfo structure is output to which additional signers and capabilities can be added before finalization.

                                                                                                                                      If the flag CMS_STREAM is set the returned CMS_ContentInfo structure is not complete and outputting its contents via a function that does not properly finalize the CMS_ContentInfo structure will give unpredictable results.

                                                                                                                                      Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_CMS().

                                                                                                                                      If a signer is specified it will use the default digest for the signing algorithm. This is SHA1 for both RSA and DSA keys.

                                                                                                                                      If signcert and pkey are NULL then a certificates only CMS structure is output.

                                                                                                                                      The function CMS_sign() is a basic CMS signing function whose output will be suitable for many purposes. For finer control of the output format the certs, signcert and pkey parameters can all be NULL and the CMS_PARTIAL flag set. Then one or more signers can be added using the function CMS_add1_signer(), non default digests can be used and custom attributes added. CMS_final() must then be called to finalize the structure if streaming is not enabled.

                                                                                                                                      "},{"location":"man3/CMS_sign/#bugs","title":"BUGS","text":"

                                                                                                                                      Some attributes such as counter signatures are not supported.

                                                                                                                                      "},{"location":"man3/CMS_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_sign_ex() and CMS_sign() return either a valid CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/CMS_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_verify(3)

                                                                                                                                      "},{"location":"man3/CMS_sign/#history","title":"HISTORY","text":"

                                                                                                                                      The CMS_STREAM flag is only supported for detached data in OpenSSL 0.9.8, it is supported for embedded data in OpenSSL 1.0.0 and later.

                                                                                                                                      The CMS_sign_ex() method was added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CMS_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_sign_receipt/","title":"CMS_sign_receipt","text":""},{"location":"man3/CMS_sign_receipt/#name","title":"NAME","text":"

                                                                                                                                      CMS_sign_receipt - create a CMS signed receipt

                                                                                                                                      "},{"location":"man3/CMS_sign_receipt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nCMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert,\n                                  EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                                  unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_sign_receipt/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_sign_receipt() creates and returns a CMS signed receipt structure. si is the CMS_SignerInfo structure containing the signed receipt request. signcert is the certificate to sign with, pkey is the corresponding private key. certs is an optional additional set of certificates to include in the CMS structure (for example any intermediate CAs in the chain).

                                                                                                                                      flags is an optional set of flags.

                                                                                                                                      "},{"location":"man3/CMS_sign_receipt/#notes","title":"NOTES","text":"

                                                                                                                                      This functions behaves in a similar way to CMS_sign() except the flag values CMS_DETACHED, CMS_BINARY, CMS_NOATTR, CMS_TEXT and CMS_STREAM are not supported since they do not make sense in the context of signed receipts.

                                                                                                                                      "},{"location":"man3/CMS_sign_receipt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_sign_receipt() returns either a valid CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/CMS_sign_receipt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_verify_receipt(3), CMS_sign(3)

                                                                                                                                      "},{"location":"man3/CMS_sign_receipt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_signed_get_attr/","title":"CMS_signed_get_attr","text":""},{"location":"man3/CMS_signed_get_attr/#name","title":"NAME","text":"

                                                                                                                                      CMS_signed_get_attr_count, CMS_signed_get_attr_by_NID, CMS_signed_get_attr_by_OBJ, CMS_signed_get_attr, CMS_signed_delete_attr, CMS_signed_add1_attr, CMS_signed_add1_attr_by_OBJ, CMS_signed_add1_attr_by_NID, CMS_signed_add1_attr_by_txt, CMS_signed_get0_data_by_OBJ, CMS_unsigned_get_attr_count, CMS_unsigned_get_attr_by_NID, CMS_unsigned_get_attr_by_OBJ, CMS_unsigned_get_attr, CMS_unsigned_delete_attr, CMS_unsigned_add1_attr, CMS_unsigned_add1_attr_by_OBJ, CMS_unsigned_add1_attr_by_NID, CMS_unsigned_add1_attr_by_txt, CMS_unsigned_get0_data_by_OBJ - CMS signed and unsigned attribute functions

                                                                                                                                      "},{"location":"man3/CMS_signed_get_attr/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_signed_get_attr_count(const CMS_SignerInfo *si);\nint CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,\n                               int lastpos);\nint CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,\n                               int lastpos);\nX509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);\nX509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);\nint CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);\nint CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,\n                                const ASN1_OBJECT *obj, int type,\n                                const void *bytes, int len);\nint CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,\n                                int nid, int type,\n                                const void *bytes, int len);\nint CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,\n                                const char *attrname, int type,\n                                const void *bytes, int len);\nvoid *CMS_signed_get0_data_by_OBJ(const CMS_SignerInfo *si,\n                                  const ASN1_OBJECT *oid,\n                                  int lastpos, int type);\n\nint CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);\nint CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,\n                                 int lastpos);\nint CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,\n                                 const ASN1_OBJECT *obj, int lastpos);\nX509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);\nX509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);\nint CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);\nint CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,\n                                  const ASN1_OBJECT *obj, int type,\n                                  const void *bytes, int len);\nint CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,\n                                  int nid, int type,\n                                  const void *bytes, int len);\nint CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,\n                                  const char *attrname, int type,\n                                  const void *bytes, int len);\nvoid *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,\n                                    int lastpos, int type);\n
                                                                                                                                      "},{"location":"man3/CMS_signed_get_attr/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_signerInfo contains separate attribute lists for signed and unsigned attributes. Each CMS_signed_XXX() function is used for signed attributes, and each CMS_unsigned_XXX() function is used for unsigned attributes. Since the CMS_unsigned_XXX() functions work in the same way as the CMS_signed_XXX() equivalents, only the CMS_signed_XXX() functions are described below.

                                                                                                                                      CMS_signed_get_attr_by_OBJ() finds the location of the first matching object obj in the SignerInfo's si signed attribute list. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to CMS_signed_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the signed attribute list.

                                                                                                                                      CMS_signed_get_attr_by_NID() is similar to CMS_signed_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                      CMS_signed_get_attr() returns the X509_ATTRIBUTE object at index loc in the si signed attribute list. loc should be in the range from 0 to CMS_signed_get_attr_count() - 1.

                                                                                                                                      CMS_signed_delete_attr() removes the X509_ATTRIBUTE object at index loc in the si signed attribute list. An error occurs if the si attribute list is NULL.

                                                                                                                                      CMS_signed_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE object to the si signed attribute list. A new signed attribute list is created if required. An error occurs if attr is NULL.

                                                                                                                                      CMS_signed_add1_attr_by_OBJ() creates a new signed X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the key object's attribute list.

                                                                                                                                      CMS_signed_add1_attr_by_NID() is similar to CMS_signed_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                      CMS_signed_add1_attr_by_txt() is similar to CMS_signed_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                                                                                                                                      CMS_signed_get0_data_by_OBJ() finds the first attribute in a si signed attributes list that matches the obj starting at index lastpos and returns the data retrieved from the found attributes first ASN1_TYPE object. An error will occur if the attribute type type does not match the type of the ASN1_TYPE object OR if type is either V_ASN1_BOOLEAN or V_ASN1_NULL OR the attribute is not found. If lastpos is less than -1 then an error will occur if there are multiple objects in the signed attribute list that match obj. If lastpos is less than -2 then an error will occur if there is more than one ASN1_TYPE object in the found signed attribute.

                                                                                                                                      Refer to X509_ATTRIBUTE(3) for information related to attributes.

                                                                                                                                      "},{"location":"man3/CMS_signed_get_attr/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The CMS_unsigned_XXX() functions return values are similar to those of the equivalent CMS_signed_XXX() functions.

                                                                                                                                      CMS_signed_get_attr_count() returns the number of signed attributes in the SignerInfo si, or -1 if the signed attribute list is NULL.

                                                                                                                                      CMS_signed_get_attr_by_OBJ() returns -1 if either the signed attribute list of si is empty OR if obj is not found, otherwise it returns the location of the obj in the SignerInfo's si signed attribute list.

                                                                                                                                      CMS_signed_get_attr_by_NID() is similar to CMS_signed_get_attr_by_OBJ() except that it returns -2 if the nid is not known by OpenSSL.

                                                                                                                                      CMS_signed_get_attr() returns either a signed X509_ATTRIBUTE or NULL on error.

                                                                                                                                      CMS_signed_delete_attr() returns either the removed signed X509_ATTRIBUTE or NULL if there is a error.

                                                                                                                                      CMS_signed_add1_attr(), CMS_signed_add1_attr_by_OBJ(), CMS_signed_add1_attr_by_NID(), CMS_signed_add1_attr_by_txt(), return 1 on success or 0 on error.

                                                                                                                                      CMS_signed_get0_data_by_OBJ() returns the data retrieved from the found signed attributes first ASN1_TYPE object, or NULL if an error occurs.

                                                                                                                                      "},{"location":"man3/CMS_signed_get_attr/#notes","title":"NOTES","text":"

                                                                                                                                      Some attributes are added automatically during the signing process.

                                                                                                                                      Calling CMS_SignerInfo_sign() adds the NID_pkcs9_signingTime signed attribute.

                                                                                                                                      Calling CMS_final(), CMS_final_digest() or CMS_dataFinal() adds the NID_pkcs9_messageDigest signed attribute.

                                                                                                                                      The NID_pkcs9_contentType signed attribute is always added if the NID_pkcs9_signingTime attribute is added.

                                                                                                                                      Calling CMS_sign_ex(), CMS_sign_receipt() or CMS_add1_signer() may add attributes depending on the flags parameter. See CMS_add1_signer(3) for more information.

                                                                                                                                      OpenSSL applies special rules for the following attribute NIDs:

                                                                                                                                      • CMS Signed Attributes

                                                                                                                                        NID_pkcs9_contentType NID_pkcs9_messageDigest NID_pkcs9_signingTime

                                                                                                                                      • ESS Signed Attributes

                                                                                                                                        NID_id_smime_aa_signingCertificate NID_id_smime_aa_signingCertificateV2 NID_id_smime_aa_receiptRequest

                                                                                                                                      • CMS Unsigned Attributes

                                                                                                                                        NID_pkcs9_countersignature

                                                                                                                                      CMS_signed_add1_attr(), CMS_signed_add1_attr_by_OBJ(), CMS_signed_add1_attr_by_NID(), CMS_signed_add1_attr_by_txt() and the equivalent CMS_unsigned_add1_attrXXX() functions allow duplicate attributes to be added. The attribute rules are not checked during these function calls, and are deferred until the sign or verify process (i.e. during calls to any of CMS_sign_ex(), CMS_sign(), CMS_sign_receipt(), CMS_add1_signer(), CMS_Final(), CMS_dataFinal(), CMS_final_digest(), CMS_verify(), CMS_verify_receipt() or CMS_SignedData_verify()).

                                                                                                                                      For CMS attribute rules see RFC 5652 Section 11. For ESS attribute rules see RFC 2634 Section 1.3.4 and RFC 5035 Section 5.4.

                                                                                                                                      "},{"location":"man3/CMS_signed_get_attr/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      X509_ATTRIBUTE(3)

                                                                                                                                      "},{"location":"man3/CMS_signed_get_attr/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_uncompress/","title":"CMS_uncompress","text":""},{"location":"man3/CMS_uncompress/#name","title":"NAME","text":"

                                                                                                                                      CMS_uncompress - uncompress a CMS CompressedData structure

                                                                                                                                      "},{"location":"man3/CMS_uncompress/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_uncompress/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_uncompress() extracts and uncompresses the content from a CMS CompressedData structure cms. data is a BIO to write the content to and flags is an optional set of flags.

                                                                                                                                      The dcont parameter is used in the rare case where the compressed content is detached. It will normally be set to NULL.

                                                                                                                                      "},{"location":"man3/CMS_uncompress/#notes","title":"NOTES","text":"

                                                                                                                                      The only currently supported compression algorithm is zlib: if the structure indicates the use of any other algorithm an error is returned.

                                                                                                                                      If zlib support is not compiled into OpenSSL then CMS_uncompress() will always return an error.

                                                                                                                                      The following flags can be passed in the flags parameter.

                                                                                                                                      If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                                                                                                                                      "},{"location":"man3/CMS_uncompress/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_uncompress() returns either 1 for success or 0 for failure. The error can be obtained from ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/CMS_uncompress/#bugs","title":"BUGS","text":"

                                                                                                                                      The lack of single pass processing and the need to hold all data in memory as mentioned in CMS_verify() also applies to CMS_decompress().

                                                                                                                                      "},{"location":"man3/CMS_uncompress/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_compress(3)

                                                                                                                                      "},{"location":"man3/CMS_uncompress/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_verify/","title":"CMS_verify","text":""},{"location":"man3/CMS_verify/#name","title":"NAME","text":"

                                                                                                                                      CMS_verify, CMS_get0_signers - verify a CMS SignedData structure

                                                                                                                                      "},{"location":"man3/CMS_verify/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store,\n               BIO *indata, BIO *out, unsigned int flags);\n\nSTACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);\n
                                                                                                                                      "},{"location":"man3/CMS_verify/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_verify() is very similar to PKCS7_verify(3). It verifies a CMS SignedData structure contained in a structure of type CMS_ContentInfo. cms points to the CMS_ContentInfo structure to verify. The optional certs parameter refers to a set of certificates in which to search for signing certificates. cms may contain extra untrusted CA certificates that may be used for chain building as well as CRLs that may be used for certificate validation. store may be NULL or point to the trusted certificate store to use for chain verification. indata refers to the signed data if the content is detached from cms. Otherwise indata should be NULL and the signed data must be in cms. The content is written to the BIO out unless it is NULL. flags is an optional set of flags, which can be used to modify the operation.

                                                                                                                                      CMS_get0_signers() retrieves the signing certificate(s) from cms, it may only be called after a successful CMS_verify() operation.

                                                                                                                                      "},{"location":"man3/CMS_verify/#verify-process","title":"VERIFY PROCESS","text":"

                                                                                                                                      Normally the verify process proceeds as follows.

                                                                                                                                      Initially some sanity checks are performed on cms. The type of cms must be SignedData. There must be at least one signature on the data and if the content is detached indata cannot be NULL.

                                                                                                                                      An attempt is made to locate all the signing certificate(s), first looking in the certs parameter (if it is not NULL) and then looking in any certificates contained in the cms structure unless CMS_NOINTERN is set. If any signing certificate cannot be located the operation fails.

                                                                                                                                      Each signing certificate is chain verified using the smimesign purpose and using the trusted certificate store store if supplied. Any internal certificates in the message, which may have been added using CMS_add1_cert(3), are used as untrusted CAs. If CRL checking is enabled in store and CMS_NOCRL is not set, any internal CRLs, which may have been added using CMS_add1_crl(3), are used in addition to attempting to look them up in store. If store is not NULL and any chain verify fails an error code is returned.

                                                                                                                                      Finally the signed content is read (and written to out unless it is NULL) and the signature is checked.

                                                                                                                                      If all signatures verify correctly then the function is successful.

                                                                                                                                      Any of the following flags (ored together) can be passed in the flags parameter to change the default verify behaviour.

                                                                                                                                      If CMS_NOINTERN is set the certificates in the message itself are not searched when locating the signing certificate(s). This means that all the signing certificates must be in the certs parameter.

                                                                                                                                      If CMS_NOCRL is set and CRL checking is enabled in store then any CRLs in the message itself are ignored.

                                                                                                                                      If the CMS_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                                                                                                                                      If CMS_NO_SIGNER_CERT_VERIFY is set the signing certificates are not chain verified, unless CMS_CADES flag is also set.

                                                                                                                                      If CMS_NO_ATTR_VERIFY is set the signed attributes signature is not verified, unless CMS_CADES flag is also set.

                                                                                                                                      If CMS_CADES is set, each signer certificate is checked against the ESS signingCertificate or ESS signingCertificateV2 extension that is required in the signed attributes of the signature.

                                                                                                                                      If CMS_NO_CONTENT_VERIFY is set then the content digest is not checked.

                                                                                                                                      "},{"location":"man3/CMS_verify/#notes","title":"NOTES","text":"

                                                                                                                                      One application of CMS_NOINTERN is to only accept messages signed by a small number of certificates. The acceptable certificates would be passed in the certs parameter. In this case if the signer certificate is not one of the certificates supplied in certs then the verify will fail because the signer cannot be found.

                                                                                                                                      In some cases the standard techniques for looking up and validating certificates are not appropriate: for example an application may wish to lookup certificates in a database or perform customised verification. This can be achieved by setting and verifying the signer certificates manually using the signed data utility functions.

                                                                                                                                      Care should be taken when modifying the default verify behaviour, for example setting CMS_NO_CONTENT_VERIFY will totally disable all content verification and any modified content will be considered valid. This combination is however useful if one merely wishes to write the content to out and its validity is not considered important.

                                                                                                                                      Chain verification should arguably be performed using the signing time rather than the current time. However, since the signing time is supplied by the signer it cannot be trusted without additional evidence (such as a trusted timestamp).

                                                                                                                                      "},{"location":"man3/CMS_verify/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_verify() returns 1 for a successful verification and 0 if an error occurred.

                                                                                                                                      CMS_get0_signers() returns all signers or NULL if an error occurred.

                                                                                                                                      The error can be obtained from ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/CMS_verify/#bugs","title":"BUGS","text":"

                                                                                                                                      The trusted certificate store is not searched for the signing certificate. This is primarily due to the inadequacies of the current X509_STORE functionality.

                                                                                                                                      The lack of single pass processing means that the signed content must all be held in memory if it is not detached.

                                                                                                                                      "},{"location":"man3/CMS_verify/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      PKCS7_verify(3), CMS_add1_cert(3), CMS_add1_crl(3), OSSL_ESS_check_signing_certs(3), ERR_get_error(3), CMS_sign(3)

                                                                                                                                      "},{"location":"man3/CMS_verify/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CMS_verify_receipt/","title":"CMS_verify_receipt","text":""},{"location":"man3/CMS_verify_receipt/#name","title":"NAME","text":"

                                                                                                                                      CMS_verify_receipt - verify a CMS signed receipt

                                                                                                                                      "},{"location":"man3/CMS_verify_receipt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/cms.h>\n\nint CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,\n                       STACK_OF(X509) *certs, X509_STORE *store,\n                       unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/CMS_verify_receipt/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CMS_verify_receipt() verifies a CMS signed receipt. rcms is the signed receipt to verify. ocms is the original SignedData structure containing the receipt request. certs is a set of certificates in which to search for the signing certificate. store is a trusted certificate store (used for chain verification).

                                                                                                                                      flags is an optional set of flags, which can be used to modify the verify operation.

                                                                                                                                      "},{"location":"man3/CMS_verify_receipt/#notes","title":"NOTES","text":"

                                                                                                                                      This functions behaves in a similar way to CMS_verify() except the flag values CMS_DETACHED, CMS_BINARY, CMS_TEXT and CMS_STREAM are not supported since they do not make sense in the context of signed receipts.

                                                                                                                                      "},{"location":"man3/CMS_verify_receipt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CMS_verify_receipt() returns 1 for a successful verification and zero if an error occurred.

                                                                                                                                      The error can be obtained from ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/CMS_verify_receipt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), CMS_sign_receipt(3), CMS_verify(3),

                                                                                                                                      "},{"location":"man3/CMS_verify_receipt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CONF_modules_free/","title":"CONF_modules_free","text":""},{"location":"man3/CONF_modules_free/#name","title":"NAME","text":"

                                                                                                                                      CONF_modules_free, CONF_modules_finish, CONF_modules_unload - OpenSSL configuration cleanup functions

                                                                                                                                      "},{"location":"man3/CONF_modules_free/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/conf.h>\n\nvoid CONF_modules_finish(void);\nvoid CONF_modules_unload(int all);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void CONF_modules_free(void);\n
                                                                                                                                      "},{"location":"man3/CONF_modules_free/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CONF_modules_free() closes down and frees up all memory allocated by all configuration modules. Normally, in versions of OpenSSL prior to 1.1.0, applications called CONF_modules_free() at exit to tidy up any configuration performed.

                                                                                                                                      CONF_modules_finish() calls each configuration modules finish handler to free up any configuration that module may have performed.

                                                                                                                                      CONF_modules_unload() finishes and unloads configuration modules. If all is set to 0 only modules loaded from DSOs will be unloads. If all is 1 all modules, including built-in modules will be unloaded.

                                                                                                                                      "},{"location":"man3/CONF_modules_free/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      None of the functions return a value.

                                                                                                                                      "},{"location":"man3/CONF_modules_free/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      config(5), OPENSSL_config(3), CONF_modules_load_file_ex(3)

                                                                                                                                      "},{"location":"man3/CONF_modules_free/#history","title":"HISTORY","text":"

                                                                                                                                      CONF_modules_free() was deprecated in OpenSSL 1.1.0; do not use it. For more information see OPENSSL_init_crypto(3).

                                                                                                                                      "},{"location":"man3/CONF_modules_free/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/","title":"CONF_modules_load_file","text":""},{"location":"man3/CONF_modules_load_file/#name","title":"NAME","text":"

                                                                                                                                      CONF_get1_default_config_file, CONF_modules_load_file_ex, CONF_modules_load_file, CONF_modules_load - OpenSSL configuration functions

                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/conf.h>\n\nchar *CONF_get1_default_config_file(void);\nint CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,\n                              const char *appname, unsigned long flags);\nint CONF_modules_load_file(const char *filename, const char *appname,\n                           unsigned long flags);\nint CONF_modules_load(const CONF *cnf, const char *appname,\n                      unsigned long flags);\n
                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The function CONF_get1_default_config_file() determines the default configuration file pathname as follows. If the OPENSSL_CONF environment variable is set its value is returned. Else the function returns the path obtained using X509_get_default_cert_area(3) with the filename \"openssl.cnf\" appended. The caller is responsible for freeing any string returned.

                                                                                                                                      The function CONF_modules_load_file_ex() configures OpenSSL using library context libctx file filename and application name appname. If filename is NULL the standard OpenSSL configuration file is used as determined by calling CONF_get1_default_config_file(). If appname is NULL the standard OpenSSL application name openssl_conf is used. The behaviour can be customized using flags. Note that, the error suppressing can be overridden by config_diagnostics as described in config(5).

                                                                                                                                      CONF_modules_load_file() is the same as CONF_modules_load_file_ex() but has a NULL library context.

                                                                                                                                      CONF_modules_load() is identical to CONF_modules_load_file() except it reads configuration information from cnf.

                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/#notes","title":"NOTES","text":"

                                                                                                                                      The following flags are currently recognized:

                                                                                                                                      If CONF_MFLAGS_IGNORE_ERRORS is set errors returned by individual configuration modules are ignored. If not set the first module error is considered fatal and no further modules are loaded.

                                                                                                                                      Normally any modules errors will add error information to the error queue. If CONF_MFLAGS_SILENT is set no error information is added.

                                                                                                                                      If CONF_MFLAGS_IGNORE_RETURN_CODES is set the function unconditionally returns success. This is used by default in OPENSSL_init_crypto(3) to ignore any errors in the default system-wide configuration file, as having all OpenSSL applications fail to start when there are potentially minor issues in the file is too risky. Applications calling CONF_modules_load_file_ex explicitly should not generally set this flag.

                                                                                                                                      If CONF_MFLAGS_NO_DSO is set configuration module loading from DSOs is disabled.

                                                                                                                                      CONF_MFLAGS_IGNORE_MISSING_FILE if set will make CONF_load_modules_file() ignore missing configuration files. Normally a missing configuration file return an error.

                                                                                                                                      CONF_MFLAGS_DEFAULT_SECTION if set and appname is not NULL will use the default section pointed to by openssl_conf if appname does not exist.

                                                                                                                                      By using CONF_modules_load_file_ex() with appropriate flags an application can customise application configuration to best suit its needs. In some cases the use of a configuration file is optional and its absence is not an error: in this case CONF_MFLAGS_IGNORE_MISSING_FILE would be set.

                                                                                                                                      Errors during configuration may also be handled differently by different applications. For example in some cases an error may simply print out a warning message and the application continue. In other cases an application might consider a configuration file error as fatal and exit immediately.

                                                                                                                                      Applications can use the CONF_modules_load() function if they wish to load a configuration file themselves and have finer control over how errors are treated.

                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      These functions return 1 for success and a zero or negative value for failure. If module errors are not ignored the return code will reflect the return value of the failing module (this will always be zero or negative).

                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Load a configuration file and print out any errors and exit (missing file considered fatal):

                                                                                                                                      if (CONF_modules_load_file_ex(libctx, NULL, NULL, 0) <= 0) {\n    fprintf(stderr, \"FATAL: error loading configuration file\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n

                                                                                                                                      Load default configuration file using the section indicated by \"myapp\", tolerate missing files, but exit on other errors:

                                                                                                                                      if (CONF_modules_load_file_ex(NULL, NULL, \"myapp\",\n                              CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {\n    fprintf(stderr, \"FATAL: error loading configuration file\\n\");\n    ERR_print_errors_fp(stderr);\n    exit(1);\n}\n

                                                                                                                                      Load custom configuration file and section, only print warnings on error, missing configuration file ignored:

                                                                                                                                      if (CONF_modules_load_file_ex(NULL, \"/something/app.cnf\", \"myapp\",\n                              CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {\n    fprintf(stderr, \"WARNING: error loading configuration file\\n\");\n    ERR_print_errors_fp(stderr);\n}\n

                                                                                                                                      Load and parse configuration file manually, custom error handling:

                                                                                                                                      FILE *fp;\nCONF *cnf = NULL;\nlong eline;\n\nfp = fopen(\"/somepath/app.cnf\", \"r\");\nif (fp == NULL) {\n    fprintf(stderr, \"Error opening configuration file\\n\");\n    /* Other missing configuration file behaviour */\n} else {\n    cnf = NCONF_new_ex(libctx, NULL);\n    if (NCONF_load_fp(cnf, fp, &eline) == 0) {\n        fprintf(stderr, \"Error on line %ld of configuration file\\n\", eline);\n        ERR_print_errors_fp(stderr);\n        /* Other malformed configuration file behaviour */\n    } else if (CONF_modules_load(cnf, \"appname\", 0) <= 0) {\n        fprintf(stderr, \"Error configuring application\\n\");\n        ERR_print_errors_fp(stderr);\n        /* Other configuration error behaviour */\n    }\n    fclose(fp);\n    NCONF_free(cnf);\n}\n
                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      config(5), OPENSSL_config(3), NCONF_new_ex(3)

                                                                                                                                      "},{"location":"man3/CONF_modules_load_file/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/","title":"CRYPTO_THREAD_run_once","text":""},{"location":"man3/CRYPTO_THREAD_run_once/#name","title":"NAME","text":"

                                                                                                                                      CRYPTO_THREAD_run_once, CRYPTO_THREAD_lock_new, CRYPTO_THREAD_read_lock, CRYPTO_THREAD_write_lock, CRYPTO_THREAD_unlock, CRYPTO_THREAD_lock_free, CRYPTO_atomic_add, CRYPTO_atomic_or, CRYPTO_atomic_load - OpenSSL thread support

                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/crypto.h>\n\nCRYPTO_ONCE CRYPTO_ONCE_STATIC_INIT;\nint CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));\n\nCRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);\nint CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);\nint CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);\nint CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);\nvoid CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);\n\nint CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);\nint CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret,\n                     CRYPTO_RWLOCK *lock);\nint CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock);\n
                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/#description","title":"DESCRIPTION","text":"

                                                                                                                                      OpenSSL can be safely used in multi-threaded applications provided that support for the underlying OS threading API is built-in. Currently, OpenSSL supports the pthread and Windows APIs. OpenSSL can also be built without any multi-threading support, for example on platforms that don't provide any threading support or that provide a threading API that is not yet supported by OpenSSL.

                                                                                                                                      The following multi-threading function are provided:

                                                                                                                                      • CRYPTO_THREAD_run_once() can be used to perform one-time initialization. The once argument must be a pointer to a static object of type CRYPTO_ONCE that was statically initialized to the value CRYPTO_ONCE_STATIC_INIT. The init argument is a pointer to a function that performs the desired exactly once initialization. In particular, this can be used to allocate locks in a thread-safe manner, which can then be used with the locking functions below.
                                                                                                                                      • CRYPTO_THREAD_lock_new() allocates, initializes and returns a new read/write lock.
                                                                                                                                      • CRYPTO_THREAD_read_lock() locks the provided lock for reading.
                                                                                                                                      • CRYPTO_THREAD_write_lock() locks the provided lock for writing.
                                                                                                                                      • CRYPTO_THREAD_unlock() unlocks the previously locked lock.
                                                                                                                                      • CRYPTO_THREAD_lock_free() frees the provided lock. If the argument is NULL, nothing is done.
                                                                                                                                      • CRYPTO_atomic_add() atomically adds amount to *val and returns the result of the operation in *ret. lock will be locked, unless atomic operations are supported on the specific platform. Because of this, if a variable is modified by CRYPTO_atomic_add() then CRYPTO_atomic_add() must be the only way that the variable is modified. If atomic operations are not supported and lock is NULL, then the function will fail.
                                                                                                                                      • CRYPTO_atomic_or() performs an atomic bitwise or of op and *val and stores the result back in *val. It also returns the result of the operation in *ret. lock will be locked, unless atomic operations are supported on the specific platform. Because of this, if a variable is modified by CRYPTO_atomic_or() or read by CRYPTO_atomic_load() then CRYPTO_atomic_or() must be the only way that the variable is modified. If atomic operations are not supported and lock is NULL, then the function will fail.
                                                                                                                                      • CRYPTO_atomic_load() atomically loads the contents of *val into *ret. lock will be locked, unless atomic operations are supported on the specific platform. Because of this, if a variable is modified by CRYPTO_atomic_or() or read by CRYPTO_atomic_load() then CRYPTO_atomic_load() must be the only way that the variable is read. If atomic operations are not supported and lock is NULL, then the function will fail.
                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CRYPTO_THREAD_run_once() returns 1 on success, or 0 on error.

                                                                                                                                      CRYPTO_THREAD_lock_new() returns the allocated lock, or NULL on error.

                                                                                                                                      CRYPTO_THREAD_lock_free() returns no value.

                                                                                                                                      The other functions return 1 on success, or 0 on error.

                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/#notes","title":"NOTES","text":"

                                                                                                                                      On Windows platforms the CRYPTO_THREAD_* types and functions in the <openssl/crypto.h> header are dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/crypto.h> where use of CRYPTO_THREAD_* types and functions is required.

                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/#examples","title":"EXAMPLES","text":"

                                                                                                                                      You can find out if OpenSSL was configured with thread support:

                                                                                                                                      #include <openssl/opensslconf.h>\n#if defined(OPENSSL_THREADS)\n    /* thread support enabled */\n#else\n    /* no thread support */\n#endif\n

                                                                                                                                      This example safely initializes and uses a lock.

                                                                                                                                      #ifdef _WIN32\n

                                                                                                                                      # # include #endif #include

                                                                                                                                      static CRYPTO_ONCE once = CRYPTO_ONCE_STATIC_INIT;\nstatic CRYPTO_RWLOCK *lock;\n\nstatic void myinit(void)\n{\n    lock = CRYPTO_THREAD_lock_new();\n}\n\nstatic int mylock(void)\n{\n    if (!CRYPTO_THREAD_run_once(&once, void init) || lock == NULL)\n        return 0;\n    return CRYPTO_THREAD_write_lock(lock);\n}\n\nstatic int myunlock(void)\n{\n    return CRYPTO_THREAD_unlock(lock);\n}\n\nint serialized(void)\n{\n    int ret = 0;\n\n    if (!mylock()) {\n       /* Do not unlock unless the lock was successfully acquired. */\n       return 0;\n    }\n\n    /* Your code here, do not return without releasing the lock! */\n    ret = ... ;\n    myunlock();\n    return ret;\n}\n

                                                                                                                                      Finalization of locks is an advanced topic, not covered in this example. This can only be done at process exit or when a dynamically loaded library is no longer in use and is unloaded. The simplest solution is to just \"leak\" the lock in applications and not repeatedly load/unload shared libraries that allocate locks.

                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), openssl-threads(7).

                                                                                                                                      "},{"location":"man3/CRYPTO_THREAD_run_once/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CRYPTO_get_ex_new_index/","title":"CRYPTO_get_ex_new_index","text":""},{"location":"man3/CRYPTO_get_ex_new_index/#name","title":"NAME","text":"

                                                                                                                                      CRYPTO_EX_new, CRYPTO_EX_free, CRYPTO_EX_dup, CRYPTO_free_ex_index, CRYPTO_get_ex_new_index, CRYPTO_alloc_ex_data, CRYPTO_set_ex_data, CRYPTO_get_ex_data, CRYPTO_free_ex_data, CRYPTO_new_ex_data - functions supporting application-specific data

                                                                                                                                      "},{"location":"man3/CRYPTO_get_ex_new_index/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/crypto.h>\n\nint CRYPTO_get_ex_new_index(int class_index,\n                            long argl, void *argp,\n                            CRYPTO_EX_new *new_func,\n                            CRYPTO_EX_dup *dup_func,\n                            CRYPTO_EX_free *free_func);\n\ntypedef void CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n                           int idx, long argl, void *argp);\ntypedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n                            int idx, long argl, void *argp);\ntypedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,\n                          void **from_d, int idx, long argl, void *argp);\n\nint CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);\n\nint CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,\n                         int idx);\n\nint CRYPTO_set_ex_data(CRYPTO_EX_DATA *r, int idx, void *arg);\n\nvoid *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *r, int idx);\n\nvoid CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *r);\n\nint CRYPTO_free_ex_index(int class_index, int idx);\n
                                                                                                                                      "},{"location":"man3/CRYPTO_get_ex_new_index/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Several OpenSSL structures can have application-specific data attached to them, known as \"exdata.\" The specific structures are:

                                                                                                                                      BIO\nDH\nDSA\nEC_KEY\nENGINE\nEVP_PKEY\nRSA\nSSL\nSSL_CTX\nSSL_SESSION\nUI\nUI_METHOD\nX509\nX509_STORE\nX509_STORE_CTX\n

                                                                                                                                      In addition, the APP name is reserved for use by application code.

                                                                                                                                      Each is identified by an CRYPTO_EX_INDEX_xxx define in the header file <openssl/crypto.h>. In addition, CRYPTO_EX_INDEX_APP is reserved for applications to use this facility for their own structures.

                                                                                                                                      The API described here is used by OpenSSL to manipulate exdata for specific structures. Since the application data can be anything at all it is passed and retrieved as a void * type.

                                                                                                                                      The CRYPTO_EX_DATA type is opaque. To initialize the exdata part of a structure, call CRYPTO_new_ex_data(). This is only necessary for CRYPTO_EX_INDEX_APP objects.

                                                                                                                                      Exdata types are identified by an index, an integer guaranteed to be unique within structures for the lifetime of the program. Applications using exdata typically call CRYPTO_get_ex_new_index at startup, and store the result in a global variable, or write a wrapper function to provide lazy evaluation. The class_index should be one of the CRYPTO_EX_INDEX_xxx values. The argl and argp parameters are saved to be passed to the callbacks but are otherwise not used. In order to transparently manipulate exdata, three callbacks must be provided. The semantics of those callbacks are described below.

                                                                                                                                      When copying or releasing objects with exdata, the callback functions are called in increasing order of their index value.

                                                                                                                                      If a dynamic library can be unloaded, it should call CRYPTO_free_ex_index() when this is done. This will replace the callbacks with no-ops so that applications don't crash. Any existing exdata will be leaked.

                                                                                                                                      To set or get the exdata on an object, the appropriate type-specific routine must be used. This is because the containing structure is opaque and the CRYPTO_EX_DATA field is not accessible. In both API's, the idx parameter should be an already-created index value.

                                                                                                                                      When setting exdata, the pointer specified with a particular index is saved, and returned on a subsequent \"get\" call. If the application is going to release the data, it must make sure to set a NULL value at the index, to avoid likely double-free crashes.

                                                                                                                                      The function CRYPTO_free_ex_data is used to free all exdata attached to a structure. The appropriate type-specific routine must be used. The class_index identifies the structure type, the obj is a pointer to the actual structure, and r is a pointer to the structure's exdata field.

                                                                                                                                      "},{"location":"man3/CRYPTO_get_ex_new_index/#callback-functions","title":"Callback Functions","text":"

                                                                                                                                      This section describes how the callback functions are used. Applications that are defining their own exdata using CYPRTO_EX_INDEX_APP must call them as described here.

                                                                                                                                      When a structure is initially allocated (such as RSA_new()) then the new_func() is called for every defined index. There is no requirement that the entire parent, or containing, structure has been set up. The new_func() is typically used only to allocate memory to store the exdata, and perhaps an \"initialized\" flag within that memory. The exdata value may be allocated later on with CRYPTO_alloc_ex_data(), or may be set by calling CRYPTO_set_ex_data().

                                                                                                                                      When a structure is free'd (such as SSL_CTX_free()) then the free_func() is called for every defined index. Again, the state of the parent structure is not guaranteed. The free_func() may be called with a NULL pointer.

                                                                                                                                      Both new_func() and free_func() take the same parameters. The parent is the pointer to the structure that contains the exdata. The ptr is the current exdata item; for new_func() this will typically be NULL. The r parameter is a pointer to the exdata field of the object. The idx is the index and is the value returned when the callbacks were initially registered via CRYPTO_get_ex_new_index() and can be used if the same callback handles different types of exdata.

                                                                                                                                      dup_func() is called when a structure is being copied. This is only done for SSL, SSL_SESSION, EC_KEY objects and BIO chains via BIO_dup_chain(). The to and from parameters are pointers to the destination and source CRYPTO_EX_DATA structures, respectively. The *from_d parameter is a pointer to the source exdata. When the dup_func() returns, the value in *from_d is copied to the destination ex_data. If the pointer contained in *pptr is not modified by the dup_func(), then both to and from will point to the same data. The idx, argl and argp parameters are as described for the other two callbacks. If the dup_func() returns 0 the whole CRYPTO_dup_ex_data() will fail.

                                                                                                                                      "},{"location":"man3/CRYPTO_get_ex_new_index/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CRYPTO_get_ex_new_index() returns a new index or -1 on failure.

                                                                                                                                      CRYPTO_free_ex_index(), CRYPTO_alloc_ex_data() and CRYPTO_set_ex_data() return 1 on success or 0 on failure.

                                                                                                                                      CRYPTO_get_ex_data() returns the application data or NULL on failure; note that NULL may be a valid value.

                                                                                                                                      dup_func() should return 0 for failure and 1 for success.

                                                                                                                                      "},{"location":"man3/CRYPTO_get_ex_new_index/#history","title":"HISTORY","text":"

                                                                                                                                      CRYPTO_alloc_ex_data() was added in OpenSSL 3.0.

                                                                                                                                      The signature of the dup_func() callback was changed in OpenSSL 3.0 to use the type void ** for from_d. Previously this parameter was of type void *.

                                                                                                                                      Support for ENGINE \"exdata\" was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/CRYPTO_get_ex_new_index/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CRYPTO_memcmp/","title":"CRYPTO_memcmp","text":""},{"location":"man3/CRYPTO_memcmp/#name","title":"NAME","text":"

                                                                                                                                      CRYPTO_memcmp - Constant time memory comparison

                                                                                                                                      "},{"location":"man3/CRYPTO_memcmp/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/crypto.h>\n\nint CRYPTO_memcmp(const void *a, const void *b, size_t len);\n
                                                                                                                                      "},{"location":"man3/CRYPTO_memcmp/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The CRYPTO_memcmp function compares the len bytes pointed to by a and b for equality. It takes an amount of time dependent on len, but independent of the contents of the memory regions pointed to by a and b.

                                                                                                                                      "},{"location":"man3/CRYPTO_memcmp/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CRYPTO_memcmp() returns 0 if the memory regions are equal and nonzero otherwise.

                                                                                                                                      "},{"location":"man3/CRYPTO_memcmp/#notes","title":"NOTES","text":"

                                                                                                                                      Unlike memcmp(2), this function cannot be used to order the two memory regions as the return value when they differ is undefined, other than being nonzero.

                                                                                                                                      "},{"location":"man3/CRYPTO_memcmp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_get0_log_by_id/","title":"CTLOG_STORE_get0_log_by_id","text":""},{"location":"man3/CTLOG_STORE_get0_log_by_id/#name","title":"NAME","text":"

                                                                                                                                      CTLOG_STORE_get0_log_by_id - Get a Certificate Transparency log from a CTLOG_STORE

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_get0_log_by_id/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ct.h>\n\nconst CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,\n                                        const uint8_t *log_id,\n                                        size_t log_id_len);\n
                                                                                                                                      "},{"location":"man3/CTLOG_STORE_get0_log_by_id/#description","title":"DESCRIPTION","text":"

                                                                                                                                      A Signed Certificate Timestamp (SCT) identifies the Certificate Transparency (CT) log that issued it using the log's LogID (see RFC 6962, Section 3.2). Therefore, it is useful to be able to look up more information about a log (e.g. its public key) using this LogID.

                                                                                                                                      CTLOG_STORE_get0_log_by_id() provides a way to do this. It will find a CTLOG in a CTLOG_STORE that has a given LogID.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_get0_log_by_id/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CTLOG_STORE_get0_log_by_id returns a CTLOG with the given LogID, if it exists in the given CTLOG_STORE, otherwise it returns NULL.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_get0_log_by_id/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ct(7), CTLOG_STORE_new(3)

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_get0_log_by_id/#history","title":"HISTORY","text":"

                                                                                                                                      The CTLOG_STORE_get0_log_by_id() function was added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_get0_log_by_id/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/","title":"CTLOG_STORE_new","text":""},{"location":"man3/CTLOG_STORE_new/#name","title":"NAME","text":"

                                                                                                                                      CTLOG_STORE_new_ex, CTLOG_STORE_new, CTLOG_STORE_free, CTLOG_STORE_load_default_file, CTLOG_STORE_load_file - Create and populate a Certificate Transparency log list

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ct.h>\n\nCTLOG_STORE *CTLOG_STORE_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nCTLOG_STORE *CTLOG_STORE_new(void);\nvoid CTLOG_STORE_free(CTLOG_STORE *store);\n\nint CTLOG_STORE_load_default_file(CTLOG_STORE *store);\nint CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);\n
                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      A CTLOG_STORE is a container for a list of CTLOGs (Certificate Transparency logs). The list can be loaded from one or more files and then searched by LogID (see RFC 6962, Section 3.2, for the definition of a LogID).

                                                                                                                                      CTLOG_STORE_new_ex() creates an empty list of CT logs associated with the library context libctx and the property query string propq.

                                                                                                                                      CTLOG_STORE_new() does the same thing as CTLOG_STORE_new_ex() but with the default library context and property query string.

                                                                                                                                      The CTLOG_STORE is then populated by CTLOG_STORE_load_default_file() or CTLOG_STORE_load_file(). CTLOG_STORE_load_default_file() loads from the default file, which is named ct_log_list.cnf in OPENSSLDIR (see the output of openssl-version(1)). This can be overridden using an environment variable named CTLOG_FILE. CTLOG_STORE_load_file() loads from a caller-specified file path instead. Both of these functions append any loaded CT logs to the CTLOG_STORE.

                                                                                                                                      The expected format of the file is:

                                                                                                                                      enabled_logs=foo,bar\n\n[foo]\ndescription = Log 1\nkey = <base64-encoded DER SubjectPublicKeyInfo here>\n\n[bar]\ndescription = Log 2\nkey = <base64-encoded DER SubjectPublicKeyInfo here>\n

                                                                                                                                      Once a CTLOG_STORE is no longer required, it should be passed to CTLOG_STORE_free(). This will delete all of the CTLOGs stored within, along with the CTLOG_STORE itself. If the argument is NULL, nothing is done.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/#notes","title":"NOTES","text":"

                                                                                                                                      If there are any invalid CT logs in a file, they are skipped and the remaining valid logs will still be added to the CTLOG_STORE. A CT log will be considered invalid if it is missing a \"key\" or \"description\" field.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      Both CTLOG_STORE_load_default_file and CTLOG_STORE_load_file return 1 if all CT logs in the file are successfully parsed and loaded, 0 otherwise.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ct(7), CTLOG_STORE_get0_log_by_id(3), SSL_CTX_set_ctlog_list_file(3)

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/#history","title":"HISTORY","text":"

                                                                                                                                      CTLOG_STORE_new_ex was added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/CTLOG_STORE_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CTLOG_new/","title":"CTLOG_new","text":""},{"location":"man3/CTLOG_new/#name","title":"NAME","text":"

                                                                                                                                      CTLOG_new_ex, CTLOG_new, CTLOG_new_from_base64, CTLOG_new_from_base64_ex, CTLOG_free, CTLOG_get0_name, CTLOG_get0_log_id, CTLOG_get0_public_key - encapsulates information about a Certificate Transparency log

                                                                                                                                      "},{"location":"man3/CTLOG_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ct.h>\n\nCTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name,\n                    OSSL_LIB_CTX *libctx, const char *propq);\nCTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);\n\nint CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,\n                             const char *name, OSSL_LIB_CTX *libctx,\n                             const char *propq);\nint CTLOG_new_from_base64(CTLOG ** ct_log,\n                          const char *pkey_base64, const char *name);\nvoid CTLOG_free(CTLOG *log);\nconst char *CTLOG_get0_name(const CTLOG *log);\nvoid CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,\n                       size_t *log_id_len);\nEVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);\n
                                                                                                                                      "},{"location":"man3/CTLOG_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      CTLOG_new_ex() returns a new CTLOG that represents the Certificate Transparency (CT) log with the given public key and associates it with the library context libctx and property query string propq. A name must also be provided that can be used to help users identify this log. Ownership of the public key is transferred.

                                                                                                                                      CTLOG_new() does the same thing as CTLOG_new_ex() but with the default library context and the default property query string.

                                                                                                                                      CTLOG_new_from_base64_ex() also creates a new CTLOG, but takes the public key in base64-encoded DER form and sets the ct_log pointer to point to the new CTLOG. The base64 will be decoded and the public key parsed. The CTLOG will be associated with the given library context libctx and property query string propq.

                                                                                                                                      CTLOG_new_from_base64() does the same thing as CTLOG_new_from_base64_ex() except that the default library context and property query string are used.

                                                                                                                                      Regardless of whether CTLOG_new() or CTLOG_new_from_base64() is used, it is the caller's responsibility to pass the CTLOG to CTLOG_free() once it is no longer needed. This will delete it and, if created by CTLOG_new(), the EVP_PKEY that was passed to it. If the argument to CTLOG_free() is NULL, nothing is done.

                                                                                                                                      CTLOG_get0_name() returns the name of the log, as provided when the CTLOG was created. Ownership of the string remains with the CTLOG.

                                                                                                                                      CTLOG_get0_log_id() sets *log_id to point to a string containing that log's LogID (see RFC 6962). It sets *log_id_len to the length of that LogID. For a v1 CT log, the LogID will be a SHA-256 hash (i.e. 32 bytes long). Ownership of the string remains with the CTLOG.

                                                                                                                                      CTLOG_get0_public_key() returns the public key of the CT log. Ownership of the EVP_PKEY remains with the CTLOG.

                                                                                                                                      "},{"location":"man3/CTLOG_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CTLOG_new() will return NULL if an error occurs.

                                                                                                                                      CTLOG_new_from_base64() will return 1 on success, 0 otherwise.

                                                                                                                                      "},{"location":"man3/CTLOG_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ct(7)

                                                                                                                                      "},{"location":"man3/CTLOG_new/#history","title":"HISTORY","text":"

                                                                                                                                      The functions CTLOG_new_ex() and CTLOG_new_from_base64_ex() were added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/CTLOG_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/","title":"CT_POLICY_EVAL_CTX_new","text":""},{"location":"man3/CT_POLICY_EVAL_CTX_new/#name","title":"NAME","text":"

                                                                                                                                      CT_POLICY_EVAL_CTX_new_ex, CT_POLICY_EVAL_CTX_new, CT_POLICY_EVAL_CTX_free, CT_POLICY_EVAL_CTX_get0_cert, CT_POLICY_EVAL_CTX_set1_cert, CT_POLICY_EVAL_CTX_get0_issuer, CT_POLICY_EVAL_CTX_set1_issuer, CT_POLICY_EVAL_CTX_get0_log_store, CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE, CT_POLICY_EVAL_CTX_get_time, CT_POLICY_EVAL_CTX_set_time - Encapsulates the data required to evaluate whether SCTs meet a Certificate Transparency policy

                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ct.h>\n\nCT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,\n                                              const char *propq);\nCT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);\nvoid CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);\nX509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);\nint CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);\nX509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);\nint CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);\nconst CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);\nvoid CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,\n                                               CTLOG_STORE *log_store);\nuint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);\nvoid CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);\n
                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      A CT_POLICY_EVAL_CTX is used by functions that evaluate whether Signed Certificate Timestamps (SCTs) fulfil a Certificate Transparency (CT) policy. This policy may be, for example, that at least one valid SCT is available. To determine this, an SCT's timestamp and signature must be verified. This requires:

                                                                                                                                      • the public key of the log that issued the SCT
                                                                                                                                      • the certificate that the SCT was issued for
                                                                                                                                      • the issuer certificate (if the SCT was issued for a pre-certificate)
                                                                                                                                      • the current time

                                                                                                                                      The above requirements are met using the setters described below.

                                                                                                                                      CT_POLICY_EVAL_CTX_new_ex() creates an empty policy evaluation context and associates it with the given library context libctx and property query string propq.

                                                                                                                                      CT_POLICY_EVAL_CTX_new() does the same thing as CT_POLICY_EVAL_CTX_new_ex() except that it uses the default library context and property query string.

                                                                                                                                      The CT_POLICY_EVAL_CTX should then be populated using:

                                                                                                                                      • CT_POLICY_EVAL_CTX_set1_cert() to provide the certificate the SCTs were issued for

                                                                                                                                        Increments the reference count of the certificate.

                                                                                                                                      • CT_POLICY_EVAL_CTX_set1_issuer() to provide the issuer certificate

                                                                                                                                        Increments the reference count of the certificate.

                                                                                                                                      • CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE() to provide a list of logs that are trusted as sources of SCTs

                                                                                                                                        Holds a pointer to the CTLOG_STORE, so the CTLOG_STORE must outlive the CT_POLICY_EVAL_CTX.

                                                                                                                                      • CT_POLICY_EVAL_CTX_set_time() to set the time SCTs should be compared with to determine if they are valid

                                                                                                                                        The SCT timestamp will be compared to this time to check whether the SCT was issued in the future. RFC6962 states that \"TLS clients MUST reject SCTs whose timestamp is in the future\". By default, this will be set to 5 minutes in the future (e.g. (time() + 300) * 1000), to allow for clock drift.

                                                                                                                                        The time should be in milliseconds since the Unix Epoch.

                                                                                                                                      Each setter has a matching getter for accessing the current value.

                                                                                                                                      When no longer required, the CT_POLICY_EVAL_CTX should be passed to CT_POLICY_EVAL_CTX_free() to delete it. If the argument to CT_POLICY_EVAL_CTX_free() is NULL, nothing is done.

                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/#notes","title":"NOTES","text":"

                                                                                                                                      The issuer certificate only needs to be provided if at least one of the SCTs was issued for a pre-certificate. This will be the case for SCTs embedded in a certificate (i.e. those in an X.509 extension), but may not be the case for SCTs found in the TLS SCT extension or OCSP response.

                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      CT_POLICY_EVAL_CTX_new_ex() and CT_POLICY_EVAL_CTX_new() will return NULL if malloc fails.

                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ct(7)

                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                      CT_POLICY_EVAL_CTX_new_ex was added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/CT_POLICY_EVAL_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DEFINE_STACK_OF/","title":"DEFINE_STACK_OF","text":""},{"location":"man3/DEFINE_STACK_OF/#name","title":"NAME","text":"

                                                                                                                                      DEFINE_STACK_OF, DEFINE_STACK_OF_CONST, DEFINE_SPECIAL_STACK_OF, DEFINE_SPECIAL_STACK_OF_CONST, sk_TYPE_num, sk_TYPE_value, sk_TYPE_new, sk_TYPE_new_null, sk_TYPE_reserve, sk_TYPE_free, sk_TYPE_zero, sk_TYPE_delete, sk_TYPE_delete_ptr, sk_TYPE_push, sk_TYPE_unshift, sk_TYPE_pop, sk_TYPE_shift, sk_TYPE_pop_free, sk_TYPE_insert, sk_TYPE_set, sk_TYPE_find, sk_TYPE_find_ex, sk_TYPE_find_all, sk_TYPE_sort, sk_TYPE_is_sorted, sk_TYPE_dup, sk_TYPE_deep_copy, sk_TYPE_set_cmp_func, sk_TYPE_new_reserve, OPENSSL_sk_deep_copy, OPENSSL_sk_delete, OPENSSL_sk_delete_ptr, OPENSSL_sk_dup, OPENSSL_sk_find, OPENSSL_sk_find_ex, OPENSSL_sk_find_all, OPENSSL_sk_free, OPENSSL_sk_insert, OPENSSL_sk_is_sorted, OPENSSL_sk_new, OPENSSL_sk_new_null, OPENSSL_sk_new_reserve, OPENSSL_sk_num, OPENSSL_sk_pop, OPENSSL_sk_pop_free, OPENSSL_sk_push, OPENSSL_sk_reserve, OPENSSL_sk_set, OPENSSL_sk_set_cmp_func, OPENSSL_sk_shift, OPENSSL_sk_sort, OPENSSL_sk_unshift, OPENSSL_sk_value, OPENSSL_sk_zero - stack container

                                                                                                                                      "},{"location":"man3/DEFINE_STACK_OF/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/safestack.h>\n\nSTACK_OF(TYPE)\nDEFINE_STACK_OF(TYPE)\nDEFINE_STACK_OF_CONST(TYPE)\nDEFINE_SPECIAL_STACK_OF(FUNCTYPE, TYPE)\nDEFINE_SPECIAL_STACK_OF_CONST(FUNCTYPE, TYPE)\n\ntypedef int (*sk_TYPE_compfunc)(const TYPE *const *a, const TYPE *const *b);\ntypedef TYPE * (*sk_TYPE_copyfunc)(const TYPE *a);\ntypedef void (*sk_TYPE_freefunc)(TYPE *a);\n\nint sk_TYPE_num(const STACK_OF(TYPE) *sk);\nTYPE *sk_TYPE_value(const STACK_OF(TYPE) *sk, int idx);\nSTACK_OF(TYPE) *sk_TYPE_new(sk_TYPE_compfunc compare);\nSTACK_OF(TYPE) *sk_TYPE_new_null(void);\nint sk_TYPE_reserve(STACK_OF(TYPE) *sk, int n);\nvoid sk_TYPE_free(STACK_OF(TYPE) *sk);\nvoid sk_TYPE_zero(STACK_OF(TYPE) *sk);\nTYPE *sk_TYPE_delete(STACK_OF(TYPE) *sk, int i);\nTYPE *sk_TYPE_delete_ptr(STACK_OF(TYPE) *sk, TYPE *ptr);\nint sk_TYPE_push(STACK_OF(TYPE) *sk, const TYPE *ptr);\nint sk_TYPE_unshift(STACK_OF(TYPE) *sk, const TYPE *ptr);\nTYPE *sk_TYPE_pop(STACK_OF(TYPE) *sk);\nTYPE *sk_TYPE_shift(STACK_OF(TYPE) *sk);\nvoid sk_TYPE_pop_free(STACK_OF(TYPE) *sk, sk_TYPE_freefunc freefunc);\nint sk_TYPE_insert(STACK_OF(TYPE) *sk, TYPE *ptr, int idx);\nTYPE *sk_TYPE_set(STACK_OF(TYPE) *sk, int idx, const TYPE *ptr);\nint sk_TYPE_find(STACK_OF(TYPE) *sk, TYPE *ptr);\nint sk_TYPE_find_ex(STACK_OF(TYPE) *sk, TYPE *ptr);\nint sk_TYPE_find_all(STACK_OF(TYPE) *sk, TYPE *ptr, int *pnum);\nvoid sk_TYPE_sort(const STACK_OF(TYPE) *sk);\nint sk_TYPE_is_sorted(const STACK_OF(TYPE) *sk);\nSTACK_OF(TYPE) *sk_TYPE_dup(const STACK_OF(TYPE) *sk);\nSTACK_OF(TYPE) *sk_TYPE_deep_copy(const STACK_OF(TYPE) *sk,\n                                  sk_TYPE_copyfunc copyfunc,\n                                  sk_TYPE_freefunc freefunc);\nsk_TYPE_compfunc (*sk_TYPE_set_cmp_func(STACK_OF(TYPE) *sk,\n                                        sk_TYPE_compfunc compare));\nSTACK_OF(TYPE) *sk_TYPE_new_reserve(sk_TYPE_compfunc compare, int n);\n
                                                                                                                                      "},{"location":"man3/DEFINE_STACK_OF/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Applications can create and use their own stacks by placing any of the macros described below in a header file. These macros define typesafe inline functions that wrap around the utility OPENSSL_sk_ API. In the description here, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509.

                                                                                                                                      The STACK_OF() macro returns the name for a stack of the specified TYPE. This is an opaque pointer to a structure declaration. This can be used in every header file that references the stack. There are several DEFINE... macros that create static inline functions for all of the functions described on this page. This should normally be used in one source file, and the stack manipulation is wrapped with application-specific functions.

                                                                                                                                      DEFINE_STACK_OF() creates set of functions for a stack of TYPE elements. The type is referenced by STACK_OF(TYPE) and each function name begins with sk_TYPE_. DEFINE_STACK_OF_CONST() is identical to DEFINE_STACK_OF() except each element is constant.

                                                                                                                                      /* DEFINE_STACK_OF(TYPE) */\nTYPE *sk_TYPE_value(STACK_OF(TYPE) *sk, int idx);\n/* DEFINE_STACK_OF_CONST(TYPE) */\nconst TYPE *sk_TYPE_value(STACK_OF(TYPE) *sk, int idx);\n

                                                                                                                                      DEFINE_SPECIAL_STACK_OF() and DEFINE_SPECIAL_STACK_OF_CONST() are similar except FUNCNAME is used in the function names:

                                                                                                                                      /* DEFINE_SPECIAL_STACK_OF(TYPE, FUNCNAME) */\nTYPE *sk_FUNCNAME_value(STACK_OF(TYPE) *sk, int idx);\n/* DEFINE_SPECIAL_STACK_OF(TYPE, FUNCNAME) */\nconst TYPE *sk_FUNCNAME_value(STACK_OF(TYPE) *sk, int idx);\n

                                                                                                                                      sk_TYPE_num() returns the number of elements in sk or -1 if sk is NULL.

                                                                                                                                      sk_TYPE_value() returns element idx in sk, where idx starts at zero. If idx is out of range then NULL is returned.

                                                                                                                                      sk_TYPE_new() allocates a new empty stack using comparison function compare. If compare is NULL then no comparison function is used. This function is equivalent to sk_TYPE_new_reserve(compare, 0).

                                                                                                                                      sk_TYPE_new_null() allocates a new empty stack with no comparison function. This function is equivalent to sk_TYPE_new_reserve(NULL, 0).

                                                                                                                                      sk_TYPE_reserve() allocates additional memory in the sk structure such that the next n calls to sk_TYPE_insert(), sk_TYPE_push() or sk_TYPE_unshift() will not fail or cause memory to be allocated or reallocated. If n is zero, any excess space allocated in the sk structure is freed. On error sk is unchanged.

                                                                                                                                      sk_TYPE_new_reserve() allocates a new stack. The new stack will have additional memory allocated to hold n elements if n is positive. The next n calls to sk_TYPE_insert(), sk_TYPE_push() or sk_TYPE_unshift() will not fail or cause memory to be allocated or reallocated. If n is zero or less than zero, no memory is allocated. sk_TYPE_new_reserve() also sets the comparison function compare to the newly created stack. If compare is NULL then no comparison function is used.

                                                                                                                                      sk_TYPE_set_cmp_func() sets the comparison function of sk to compare. The previous comparison function is returned or NULL if there was no previous comparison function.

                                                                                                                                      sk_TYPE_free() frees up the sk structure. It does not free up any elements of sk. After this call sk is no longer valid.

                                                                                                                                      sk_TYPE_zero() sets the number of elements in sk to zero. It does not free sk so after this call sk is still valid.

                                                                                                                                      sk_TYPE_pop_free() frees up all elements of sk and sk itself. The free function freefunc() is called on each element to free it.

                                                                                                                                      sk_TYPE_delete() deletes element i from sk. It returns the deleted element or NULL if i is out of range.

                                                                                                                                      sk_TYPE_delete_ptr() deletes element matching ptr from sk. It returns the deleted element or NULL if no element matching ptr was found.

                                                                                                                                      sk_TYPE_insert() inserts ptr into sk at position idx. Any existing elements at or after idx are moved downwards. If idx is out of range the new element is appended to sk. sk_TYPE_insert() either returns the number of elements in sk after the new element is inserted or zero if an error (such as memory allocation failure) occurred.

                                                                                                                                      sk_TYPE_push() appends ptr to sk it is equivalent to:

                                                                                                                                      sk_TYPE_insert(sk, ptr, -1);\n

                                                                                                                                      sk_TYPE_unshift() inserts ptr at the start of sk it is equivalent to:

                                                                                                                                      sk_TYPE_insert(sk, ptr, 0);\n

                                                                                                                                      sk_TYPE_pop() returns and removes the last element from sk.

                                                                                                                                      sk_TYPE_shift() returns and removes the first element from sk.

                                                                                                                                      sk_TYPE_set() sets element idx of sk to ptr replacing the current element. The new element value is returned or NULL if an error occurred: this will only happen if sk is NULL or idx is out of range.

                                                                                                                                      sk_TYPE_find() searches sk for the element ptr. In the case where no comparison function has been specified, the function performs a linear search for a pointer equal to ptr. The index of the first matching element is returned or -1 if there is no match. In the case where a comparison function has been specified, sk is sorted and sk_TYPE_find() returns the index of a matching element or -1 if there is no match. Note that, in this case the comparison function will usually compare the values pointed to rather than the pointers themselves and the order of elements in sk can change. Note that because the stack may be sorted as the result of a sk_TYPE_find() call, if a lock is being used to synchronise access to the stack across multiple threads, then that lock must be a \"write\" lock.

                                                                                                                                      sk_TYPE_find_ex() operates like sk_TYPE_find() except when a comparison function has been specified and no matching element is found. Instead of returning -1, sk_TYPE_find_ex() returns the index of the element either before or after the location where ptr would be if it were present in sk. The function also does not guarantee that the first matching element in the sorted stack is returned.

                                                                                                                                      sk_TYPE_find_all() operates like sk_TYPE_find() but it also sets the *pnum to number of matching elements in the stack. In case no comparison function has been specified the *pnum will be always set to 1 if matching element was found, 0 otherwise.

                                                                                                                                      sk_TYPE_sort() sorts sk using the supplied comparison function.

                                                                                                                                      sk_TYPE_is_sorted() returns 1 if sk is sorted and 0 otherwise.

                                                                                                                                      sk_TYPE_dup() returns a shallow copy of sk or an empty stack if the passed stack is NULL. Note the pointers in the copy are identical to the original.

                                                                                                                                      sk_TYPE_deep_copy() returns a new stack where each element has been copied or an empty stack if the passed stack is NULL. Copying is performed by the supplied copyfunc() and freeing by freefunc(). The function freefunc() is only called if an error occurs.

                                                                                                                                      "},{"location":"man3/DEFINE_STACK_OF/#notes","title":"NOTES","text":"

                                                                                                                                      Care should be taken when accessing stacks in multi-threaded environments. Any operation which increases the size of a stack such as sk_TYPE_insert() or sk_TYPE_push() can \"grow\" the size of an internal array and cause race conditions if the same stack is accessed in a different thread. Operations such as sk_TYPE_find() and sk_TYPE_sort() can also reorder the stack.

                                                                                                                                      Any comparison function supplied should use a metric suitable for use in a binary search operation. That is it should return zero, a positive or negative value if a is equal to, greater than or less than b respectively.

                                                                                                                                      Care should be taken when checking the return values of the functions sk_TYPE_find() and sk_TYPE_find_ex(). They return an index to the matching element. In particular 0 indicates a matching first element. A failed search is indicated by a -1 return value.

                                                                                                                                      STACK_OF(), DEFINE_STACK_OF(), DEFINE_STACK_OF_CONST(), and DEFINE_SPECIAL_STACK_OF() are implemented as macros.

                                                                                                                                      It is not an error to call sk_TYPE_num(), sk_TYPE_value(), sk_TYPE_free(), sk_TYPE_zero(), sk_TYPE_pop_free(), sk_TYPE_delete(), sk_TYPE_delete_ptr(), sk_TYPE_pop(), sk_TYPE_shift(), sk_TYPE_find(), sk_TYPE_find_ex(), and sk_TYPE_find_all() on a NULL stack, empty stack, or with an invalid index. An error is not raised in these conditions.

                                                                                                                                      The underlying utility OPENSSL_sk_ API should not be used directly. It defines these functions: OPENSSL_sk_deep_copy(), OPENSSL_sk_delete(), OPENSSL_sk_delete_ptr(), OPENSSL_sk_dup(), OPENSSL_sk_find(), OPENSSL_sk_find_ex(), OPENSSL_sk_find_all(), OPENSSL_sk_free(), OPENSSL_sk_insert(), OPENSSL_sk_is_sorted(), OPENSSL_sk_new(), OPENSSL_sk_new_null(), OPENSSL_sk_new_reserve(), OPENSSL_sk_num(), OPENSSL_sk_pop(), OPENSSL_sk_pop_free(), OPENSSL_sk_push(), OPENSSL_sk_reserve(), OPENSSL_sk_set(), OPENSSL_sk_set_cmp_func(), OPENSSL_sk_shift(), OPENSSL_sk_sort(), OPENSSL_sk_unshift(), OPENSSL_sk_value(), OPENSSL_sk_zero().

                                                                                                                                      "},{"location":"man3/DEFINE_STACK_OF/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      sk_TYPE_num() returns the number of elements in the stack or -1 if the passed stack is NULL.

                                                                                                                                      sk_TYPE_value() returns a pointer to a stack element or NULL if the index is out of range.

                                                                                                                                      sk_TYPE_new(), sk_TYPE_new_null() and sk_TYPE_new_reserve() return an empty stack or NULL if an error occurs.

                                                                                                                                      sk_TYPE_reserve() returns 1 on successful allocation of the required memory or 0 on error.

                                                                                                                                      sk_TYPE_set_cmp_func() returns the old comparison function or NULL if there was no old comparison function.

                                                                                                                                      sk_TYPE_free(), sk_TYPE_zero(), sk_TYPE_pop_free() and sk_TYPE_sort() do not return values.

                                                                                                                                      sk_TYPE_pop(), sk_TYPE_shift(), sk_TYPE_delete() and sk_TYPE_delete_ptr() return a pointer to the deleted element or NULL on error.

                                                                                                                                      sk_TYPE_insert(), sk_TYPE_push() and sk_TYPE_unshift() return the total number of elements in the stack and 0 if an error occurred. sk_TYPE_push() further returns -1 if sk is NULL.

                                                                                                                                      sk_TYPE_set() returns a pointer to the replacement element or NULL on error.

                                                                                                                                      sk_TYPE_find() and sk_TYPE_find_ex() return an index to the found element or -1 on error.

                                                                                                                                      sk_TYPE_is_sorted() returns 1 if the stack is sorted and 0 if it is not.

                                                                                                                                      sk_TYPE_dup() and sk_TYPE_deep_copy() return a pointer to the copy of the stack or NULL on error.

                                                                                                                                      "},{"location":"man3/DEFINE_STACK_OF/#history","title":"HISTORY","text":"

                                                                                                                                      Before OpenSSL 1.1.0, this was implemented via macros and not inline functions and was not a public API.

                                                                                                                                      sk_TYPE_reserve() and sk_TYPE_new_reserve() were added in OpenSSL 1.1.1.

                                                                                                                                      "},{"location":"man3/DEFINE_STACK_OF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DES_random_key/","title":"DES_random_key","text":""},{"location":"man3/DES_random_key/#name","title":"NAME","text":"

                                                                                                                                      DES_random_key, DES_set_key, DES_key_sched, DES_set_key_checked, DES_set_key_unchecked, DES_set_odd_parity, DES_is_weak_key, DES_ecb_encrypt, DES_ecb2_encrypt, DES_ecb3_encrypt, DES_ncbc_encrypt, DES_cfb_encrypt, DES_ofb_encrypt, DES_pcbc_encrypt, DES_cfb64_encrypt, DES_ofb64_encrypt, DES_xcbc_encrypt, DES_ede2_cbc_encrypt, DES_ede2_cfb64_encrypt, DES_ede2_ofb64_encrypt, DES_ede3_cbc_encrypt, DES_ede3_cfb64_encrypt, DES_ede3_ofb64_encrypt, DES_cbc_cksum, DES_quad_cksum, DES_string_to_key, DES_string_to_2keys, DES_fcrypt, DES_crypt - DES encryption

                                                                                                                                      "},{"location":"man3/DES_random_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/des.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void DES_random_key(DES_cblock *ret);\n\nint DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);\nint DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);\nint DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);\nvoid DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);\n\nvoid DES_set_odd_parity(DES_cblock *key);\nint DES_is_weak_key(const_DES_cblock *key);\n\nvoid DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,\n                     DES_key_schedule *ks, int enc);\nvoid DES_ecb2_encrypt(const_DES_cblock *input, DES_cblock *output,\n                      DES_key_schedule *ks1, DES_key_schedule *ks2, int enc);\nvoid DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,\n                      DES_key_schedule *ks1, DES_key_schedule *ks2,\n                      DES_key_schedule *ks3, int enc);\n\nvoid DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,\n                      long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                      int enc);\nvoid DES_cfb_encrypt(const unsigned char *in, unsigned char *out,\n                     int numbits, long length, DES_key_schedule *schedule,\n                     DES_cblock *ivec, int enc);\nvoid DES_ofb_encrypt(const unsigned char *in, unsigned char *out,\n                     int numbits, long length, DES_key_schedule *schedule,\n                     DES_cblock *ivec);\nvoid DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,\n                      long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                      int enc);\nvoid DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                       long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                       int *num, int enc);\nvoid DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                       long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                       int *num);\n\nvoid DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,\n                      long length, DES_key_schedule *schedule, DES_cblock *ivec,\n                      const_DES_cblock *inw, const_DES_cblock *outw, int enc);\n\nvoid DES_ede2_cbc_encrypt(const unsigned char *input, unsigned char *output,\n                          long length, DES_key_schedule *ks1,\n                          DES_key_schedule *ks2, DES_cblock *ivec, int enc);\nvoid DES_ede2_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_cblock *ivec,\n                            int *num, int enc);\nvoid DES_ede2_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_cblock *ivec, int *num);\n\nvoid DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,\n                          long length, DES_key_schedule *ks1,\n                          DES_key_schedule *ks2, DES_key_schedule *ks3,\n                          DES_cblock *ivec, int enc);\nvoid DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_key_schedule *ks3,\n                            DES_cblock *ivec, int *num, int enc);\nvoid DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n                            long length, DES_key_schedule *ks1,\n                            DES_key_schedule *ks2, DES_key_schedule *ks3,\n                            DES_cblock *ivec, int *num);\n\nDES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,\n                       long length, DES_key_schedule *schedule,\n                       const_DES_cblock *ivec);\nDES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],\n                        long length, int out_count, DES_cblock *seed);\nvoid DES_string_to_key(const char *str, DES_cblock *key);\nvoid DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);\n\nchar *DES_fcrypt(const char *buf, const char *salt, char *ret);\nchar *DES_crypt(const char *buf, const char *salt);\n
                                                                                                                                      "},{"location":"man3/DES_random_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) or the equivalently named decrypt functions.

                                                                                                                                      This library contains a fast implementation of the DES encryption algorithm.

                                                                                                                                      There are two phases to the use of DES encryption. The first is the generation of a DES_key_schedule from a key, the second is the actual encryption. A DES key is of type DES_cblock. This type consists of 8 bytes with odd parity. The least significant bit in each byte is the parity bit. The key schedule is an expanded form of the key; it is used to speed the encryption process.

                                                                                                                                      DES_random_key() generates a random key. The random generator must be seeded when calling this function. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail. If the function fails, 0 is returned.

                                                                                                                                      Before a DES key can be used, it must be converted into the architecture dependent DES_key_schedule via the DES_set_key_checked() or DES_set_key_unchecked() function.

                                                                                                                                      DES_set_key_checked() will check that the key passed is of odd parity and is not a weak or semi-weak key. If the parity is wrong, then -1 is returned. If the key is a weak key, then -2 is returned. If an error is returned, the key schedule is not generated.

                                                                                                                                      DES_set_key() works like DES_set_key_checked() and remains for backward compatibility.

                                                                                                                                      DES_set_odd_parity() sets the parity of the passed key to odd.

                                                                                                                                      DES_is_weak_key() returns 1 if the passed key is a weak key, 0 if it is ok.

                                                                                                                                      The following routines mostly operate on an input and output stream of _DES_cblock_s.

                                                                                                                                      DES_ecb_encrypt() is the basic DES encryption routine that encrypts or decrypts a single 8-byte DES_cblock in electronic code book (ECB) mode. It always transforms the input data, pointed to by input, into the output data, pointed to by the output argument. If the encrypt argument is nonzero (DES_ENCRYPT), the input (cleartext) is encrypted in to the output (ciphertext) using the key_schedule specified by the schedule argument, previously set via DES_set_key. If encrypt is zero (DES_DECRYPT), the input (now ciphertext) is decrypted into the output (now cleartext). Input and output may overlap. DES_ecb_encrypt() does not return a value.

                                                                                                                                      DES_ecb3_encrypt() encrypts/decrypts the input block by using three-key Triple-DES encryption in ECB mode. This involves encrypting the input with ks1, decrypting with the key schedule ks2, and then encrypting with ks3. This routine greatly reduces the chances of brute force breaking of DES and has the advantage of if ks1, ks2 and ks3 are the same, it is equivalent to just encryption using ECB mode and ks1 as the key.

                                                                                                                                      The macro DES_ecb2_encrypt() is provided to perform two-key Triple-DES encryption by using ks1 for the final encryption.

                                                                                                                                      DES_ncbc_encrypt() encrypts/decrypts using the cipher-block-chaining (CBC) mode of DES. If the encrypt argument is nonzero, the routine cipher-block-chain encrypts the cleartext data pointed to by the input argument into the ciphertext pointed to by the output argument, using the key schedule provided by the schedule argument, and initialization vector provided by the ivec argument. If the length argument is not an integral multiple of eight bytes, the last block is copied to a temporary area and zero filled. The output is always an integral multiple of eight bytes.

                                                                                                                                      DES_xcbc_encrypt() is RSA's DESX mode of DES. It uses inw and outw to 'whiten' the encryption. inw and outw are secret (unlike the iv) and are as such, part of the key. So the key is sort of 24 bytes. This is much better than CBC DES.

                                                                                                                                      DES_ede3_cbc_encrypt() implements outer triple CBC DES encryption with three keys. This means that each DES operation inside the CBC mode is C=E(ks3,D(ks2,E(ks1,M))). This mode is used by SSL.

                                                                                                                                      The DES_ede2_cbc_encrypt() macro implements two-key Triple-DES by reusing ks1 for the final encryption. C=E(ks1,D(ks2,E(ks1,M))). This form of Triple-DES is used by the RSAREF library.

                                                                                                                                      DES_pcbc_encrypt() encrypts/decrypts using the propagating cipher block chaining mode used by Kerberos v4. Its parameters are the same as DES_ncbc_encrypt().

                                                                                                                                      DES_cfb_encrypt() encrypts/decrypts using cipher feedback mode. This method takes an array of characters as input and outputs an array of characters. It does not require any padding to 8 character groups. Note: the ivec variable is changed and the new changed value needs to be passed to the next call to this function. Since this function runs a complete DES ECB encryption per numbits, this function is only suggested for use when sending a small number of characters.

                                                                                                                                      DES_cfb64_encrypt() implements CFB mode of DES with 64-bit feedback. Why is this useful you ask? Because this routine will allow you to encrypt an arbitrary number of bytes, without 8 byte padding. Each call to this routine will encrypt the input bytes to output and then update ivec and num. num contains 'how far' we are though ivec. If this does not make much sense, read more about CFB mode of DES.

                                                                                                                                      DES_ede3_cfb64_encrypt() and DES_ede2_cfb64_encrypt() is the same as DES_cfb64_encrypt() except that Triple-DES is used.

                                                                                                                                      DES_ofb_encrypt() encrypts using output feedback mode. This method takes an array of characters as input and outputs an array of characters. It does not require any padding to 8 character groups. Note: the ivec variable is changed and the new changed value needs to be passed to the next call to this function. Since this function runs a complete DES ECB encryption per numbits, this function is only suggested for use when sending a small number of characters.

                                                                                                                                      DES_ofb64_encrypt() is the same as DES_cfb64_encrypt() using Output Feed Back mode.

                                                                                                                                      DES_ede3_ofb64_encrypt() and DES_ede2_ofb64_encrypt() is the same as DES_ofb64_encrypt(), using Triple-DES.

                                                                                                                                      The following functions are included in the DES library for compatibility with the MIT Kerberos library.

                                                                                                                                      DES_cbc_cksum() produces an 8 byte checksum based on the input stream (via CBC encryption). The last 4 bytes of the checksum are returned and the complete 8 bytes are placed in output. This function is used by Kerberos v4. Other applications should use EVP_DigestInit(3) etc. instead.

                                                                                                                                      DES_quad_cksum() is a Kerberos v4 function. It returns a 4 byte checksum from the input bytes. The algorithm can be iterated over the input, depending on out_count, 1, 2, 3 or 4 times. If output is non-NULL, the 8 bytes generated by each pass are written into output.

                                                                                                                                      The following are DES-based transformations:

                                                                                                                                      DES_fcrypt() is a fast version of the Unix crypt(3) function. This version takes only a small amount of space relative to other fast crypt() implementations. This is different to the normal crypt() in that the third parameter is the buffer that the return value is written into. It needs to be at least 14 bytes long. This function is thread safe, unlike the normal crypt().

                                                                                                                                      DES_crypt() is a faster replacement for the normal system crypt(). This function calls DES_fcrypt() with a static array passed as the third parameter. This mostly emulates the normal non-thread-safe semantics of crypt(3). The salt must be two ASCII characters.

                                                                                                                                      The values returned by DES_fcrypt() and DES_crypt() are terminated by NUL character.

                                                                                                                                      DES_enc_write() writes len bytes to file descriptor fd from buffer buf. The data is encrypted via pcbc_encrypt (default) using sched for the key and iv as a starting vector. The actual data send down fd consists of 4 bytes (in network byte order) containing the length of the following encrypted data. The encrypted data then follows, padded with random data out to a multiple of 8 bytes.

                                                                                                                                      "},{"location":"man3/DES_random_key/#bugs","title":"BUGS","text":"

                                                                                                                                      DES_cbc_encrypt() does not modify ivec; use DES_ncbc_encrypt() instead.

                                                                                                                                      DES_cfb_encrypt() and DES_ofb_encrypt() operates on input of 8 bits. What this means is that if you set numbits to 12, and length to 2, the first 12 bits will come from the 1st input byte and the low half of the second input byte. The second 12 bits will have the low 8 bits taken from the 3rd input byte and the top 4 bits taken from the 4th input byte. The same holds for output. This function has been implemented this way because most people will be using a multiple of 8 and because once you get into pulling bytes input bytes apart things get ugly!

                                                                                                                                      DES_string_to_key() is available for backward compatibility with the MIT library. New applications should use a cryptographic hash function. The same applies for DES_string_to_2key().

                                                                                                                                      "},{"location":"man3/DES_random_key/#notes","title":"NOTES","text":"

                                                                                                                                      The des library was written to be source code compatible with the MIT Kerberos library.

                                                                                                                                      Applications should use the higher level functions EVP_EncryptInit(3) etc. instead of calling these functions directly.

                                                                                                                                      Single-key DES is insecure due to its short key size. ECB mode is not suitable for most applications; see des_modes(7).

                                                                                                                                      "},{"location":"man3/DES_random_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DES_set_key(), DES_key_sched(), and DES_set_key_checked() return 0 on success or negative values on error.

                                                                                                                                      DES_is_weak_key() returns 1 if the passed key is a weak key, 0 if it is ok.

                                                                                                                                      DES_cbc_cksum() and DES_quad_cksum() return 4-byte integer representing the last 4 bytes of the checksum of the input.

                                                                                                                                      DES_fcrypt() returns a pointer to the caller-provided buffer and DES_crypt() - to a static buffer on success; otherwise they return NULL.

                                                                                                                                      "},{"location":"man3/DES_random_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      des_modes(7), EVP_EncryptInit(3)

                                                                                                                                      "},{"location":"man3/DES_random_key/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      The requirement that the salt parameter to DES_crypt() and DES_fcrypt() be two ASCII characters was first enforced in OpenSSL 1.1.0. Previous versions tried to use the letter uppercase A if both character were not present, and could crash when given non-ASCII on some platforms.

                                                                                                                                      "},{"location":"man3/DES_random_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_generate_key/","title":"DH_generate_key","text":""},{"location":"man3/DH_generate_key/#name","title":"NAME","text":"

                                                                                                                                      DH_generate_key, DH_compute_key, DH_compute_key_padded - perform Diffie-Hellman key exchange

                                                                                                                                      "},{"location":"man3/DH_generate_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DH_generate_key(DH *dh);\n\nint DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);\n\nint DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh);\n
                                                                                                                                      "},{"location":"man3/DH_generate_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_derive_init(3) and EVP_PKEY_derive(3).

                                                                                                                                      DH_generate_key() performs the first step of a Diffie-Hellman key exchange by generating private and public DH values. By calling DH_compute_key() or DH_compute_key_padded(), these are combined with the other party's public value to compute the shared key.

                                                                                                                                      DH_generate_key() expects dh to contain the shared parameters dh->p and dh->g. It generates a random private DH value unless dh->priv_key is already set, and computes the corresponding public value dh->pub_key, which can then be published.

                                                                                                                                      DH_compute_key() computes the shared secret from the private DH value in dh and the other party's public value in pub_key and stores it in key. key must point to DH_size(dh) bytes of memory. The padding style is RFC 5246 (8.1.2) that strips leading zero bytes. It is not constant time due to the leading zero bytes being stripped. The return value should be considered public.

                                                                                                                                      DH_compute_key_padded() is similar but stores a fixed number of bytes. The padding style is NIST SP 800-56A (C.1) that retains leading zero bytes. It is constant time due to the leading zero bytes being retained. The return value should be considered public.

                                                                                                                                      "},{"location":"man3/DH_generate_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DH_generate_key() returns 1 on success, 0 otherwise.

                                                                                                                                      DH_compute_key() returns the size of the shared secret on success, -1 on error.

                                                                                                                                      DH_compute_key_padded() returns DH_size(dh) on success, -1 on error.

                                                                                                                                      The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/DH_generate_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_PKEY_derive(3), DH_new(3), ERR_get_error(3), RAND_bytes(3), DH_size(3)

                                                                                                                                      "},{"location":"man3/DH_generate_key/#history","title":"HISTORY","text":"

                                                                                                                                      DH_compute_key_padded() was added in OpenSSL 1.0.2.

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DH_generate_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_generate_parameters/","title":"DH_generate_parameters","text":""},{"location":"man3/DH_generate_parameters/#name","title":"NAME","text":"

                                                                                                                                      DH_generate_parameters_ex, DH_generate_parameters, DH_check, DH_check_params, DH_check_ex, DH_check_params_ex, DH_check_pub_key_ex - generate and check Diffie-Hellman parameters

                                                                                                                                      "},{"location":"man3/DH_generate_parameters/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb);\n\nint DH_check(DH *dh, int *codes);\nint DH_check_params(DH *dh, int *codes);\n\nint DH_check_ex(const DH *dh);\nint DH_check_params_ex(const DH *dh);\nint DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DH *DH_generate_parameters(int prime_len, int generator,\n                           void (*callback)(int, int, void *), void *cb_arg);\n
                                                                                                                                      "},{"location":"man3/DH_generate_parameters/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_check(3), EVP_PKEY_public_check(3), EVP_PKEY_private_check(3) and EVP_PKEY_param_check(3).

                                                                                                                                      DH_generate_parameters_ex() generates Diffie-Hellman parameters that can be shared among a group of users, and stores them in the provided DH structure. The pseudo-random number generator must be seeded before calling it. The parameters generated by DH_generate_parameters_ex() should not be used in signature schemes.

                                                                                                                                      prime_len is the length in bits of the safe prime to be generated. generator is a small number > 1, typically 2 or 5.

                                                                                                                                      A callback function may be used to provide feedback about the progress of the key generation. If cb is not NULL, it will be called as described in BN_generate_prime(3) while a random prime number is generated, and when a prime has been found, BN_GENCB_call(cb, 3, 0) is called. See BN_generate_prime_ex(3) for information on the BN_GENCB_call() function.

                                                                                                                                      DH_generate_parameters() is similar to DH_generate_prime_ex() but expects an old-style callback function; see BN_generate_prime(3) for information on the old-style callback.

                                                                                                                                      DH_check_params() confirms that the p and g are likely enough to be valid. This is a lightweight check, if a more thorough check is needed, use DH_check(). The value of *codes is updated with any problems found. If *codes is zero then no problems were found, otherwise the following bits may be set:

                                                                                                                                      • DH_CHECK_P_NOT_PRIME

                                                                                                                                        The parameter p has been determined to not being an odd prime. Note that the lack of this bit doesn't guarantee that p is a prime.

                                                                                                                                      • DH_NOT_SUITABLE_GENERATOR

                                                                                                                                        The generator g is not suitable. Note that the lack of this bit doesn't guarantee that g is suitable, unless p is known to be a strong prime.

                                                                                                                                      • DH_MODULUS_TOO_SMALL

                                                                                                                                        The modulus is too small.

                                                                                                                                      • DH_MODULUS_TOO_LARGE

                                                                                                                                        The modulus is too large.

                                                                                                                                      DH_check() confirms that the Diffie-Hellman parameters dh are valid. The value of *codes is updated with any problems found. If *codes is zero then no problems were found, otherwise the following bits may be set:

                                                                                                                                      • DH_CHECK_P_NOT_PRIME

                                                                                                                                        The parameter p is not prime.

                                                                                                                                      • DH_CHECK_P_NOT_SAFE_PRIME

                                                                                                                                        The parameter p is not a safe prime and no q value is present.

                                                                                                                                      • DH_UNABLE_TO_CHECK_GENERATOR

                                                                                                                                        The generator g cannot be checked for suitability.

                                                                                                                                      • DH_NOT_SUITABLE_GENERATOR

                                                                                                                                        The generator g is not suitable.

                                                                                                                                      • DH_CHECK_Q_NOT_PRIME

                                                                                                                                        The parameter q is not prime.

                                                                                                                                      • DH_CHECK_INVALID_Q_VALUE

                                                                                                                                        The parameter q is invalid.

                                                                                                                                      • DH_CHECK_INVALID_J_VALUE

                                                                                                                                        The parameter j is invalid.

                                                                                                                                      If 0 is returned or *codes is set to a nonzero value the supplied parameters should not be used for Diffie-Hellman operations otherwise the security properties of the key exchange are not guaranteed.

                                                                                                                                      DH_check_ex(), DH_check_params() and DH_check_pub_key_ex() are similar to DH_check() and DH_check_params() respectively, but the error reasons are added to the thread's error queue instead of provided as return values from the function.

                                                                                                                                      "},{"location":"man3/DH_generate_parameters/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DH_generate_parameters_ex(), DH_check() and DH_check_params() return 1 if the check could be performed, 0 otherwise.

                                                                                                                                      DH_generate_parameters() returns a pointer to the DH structure or NULL if the parameter generation fails.

                                                                                                                                      DH_check_ex(), DH_check_params() and DH_check_pub_key_ex() return 1 if the check is successful, 0 for failed.

                                                                                                                                      The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/DH_generate_parameters/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_new(3), ERR_get_error(3), RAND_bytes(3), DH_free(3)

                                                                                                                                      "},{"location":"man3/DH_generate_parameters/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      DH_generate_parameters() was deprecated in OpenSSL 0.9.8; use DH_generate_parameters_ex() instead.

                                                                                                                                      "},{"location":"man3/DH_generate_parameters/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_get0_pqg/","title":"DH_get0_pqg","text":""},{"location":"man3/DH_get0_pqg/#name","title":"NAME","text":"

                                                                                                                                      DH_get0_pqg, DH_set0_pqg, DH_get0_key, DH_set0_key, DH_get0_p, DH_get0_q, DH_get0_g, DH_get0_priv_key, DH_get0_pub_key, DH_clear_flags, DH_test_flags, DH_set_flags, DH_get0_engine, DH_get_length, DH_set_length - Routines for getting and setting data in a DH object

                                                                                                                                      "},{"location":"man3/DH_get0_pqg/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void DH_get0_pqg(const DH *dh,\n                 const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);\nint DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);\nvoid DH_get0_key(const DH *dh,\n                 const BIGNUM **pub_key, const BIGNUM **priv_key);\nint DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);\nconst BIGNUM *DH_get0_p(const DH *dh);\nconst BIGNUM *DH_get0_q(const DH *dh);\nconst BIGNUM *DH_get0_g(const DH *dh);\nconst BIGNUM *DH_get0_priv_key(const DH *dh);\nconst BIGNUM *DH_get0_pub_key(const DH *dh);\nvoid DH_clear_flags(DH *dh, int flags);\nint DH_test_flags(const DH *dh, int flags);\nvoid DH_set_flags(DH *dh, int flags);\n\nlong DH_get_length(const DH *dh);\nint DH_set_length(DH *dh, long length);\n\nENGINE *DH_get0_engine(DH *d);\n
                                                                                                                                      "},{"location":"man3/DH_get0_pqg/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bn_param(3) for any methods that return a BIGNUM. Refer to EVP_PKEY-DH(7) for more information.

                                                                                                                                      A DH object contains the parameters p, q and g. Note that the q parameter is optional. It also contains a public key (pub_key) and (optionally) a private key (priv_key).

                                                                                                                                      The p, q and g parameters can be obtained by calling DH_get0_pqg(). If the parameters have not yet been set then *p, *q and *g will be set to NULL. Otherwise they are set to pointers to their respective values. These point directly to the internal representations of the values and therefore should not be freed directly. Any of the out parameters p, q, and g can be NULL, in which case no value will be returned for that parameter.

                                                                                                                                      The p, q and g values can be set by calling DH_set0_pqg() and passing the new values for p, q and g as parameters to the function. Calling this function transfers the memory management of the values to the DH object, and therefore the values that have been passed in should not be freed directly after this function has been called. The q parameter may be NULL. DH_set0_pqg() also checks if the parameters associated with p and g and optionally q are associated with known safe prime groups. If it is a safe prime group then the value of q will be set to q = (p - 1) / 2 if q is NULL. The optional length parameter will be set to BN_num_bits(q) if q is not NULL.

                                                                                                                                      To get the public and private key values use the DH_get0_key() function. A pointer to the public key will be stored in *pub_key, and a pointer to the private key will be stored in *priv_key. Either may be NULL if they have not been set yet, although if the private key has been set then the public key must be. The values point to the internal representation of the public key and private key values. This memory should not be freed directly. Any of the out parameters pub_key and priv_key can be NULL, in which case no value will be returned for that parameter.

                                                                                                                                      The public and private key values can be set using DH_set0_key(). Either parameter may be NULL, which means the corresponding DH field is left untouched. As with DH_set0_pqg() this function transfers the memory management of the key values to the DH object, and therefore they should not be freed directly after this function has been called.

                                                                                                                                      Any of the values p, q, g, priv_key, and pub_key can also be retrieved separately by the corresponding function DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_priv_key(), and DH_get0_pub_key(), respectively.

                                                                                                                                      DH_set_flags() sets the flags in the flags parameter on the DH object. Multiple flags can be passed in one go (bitwise ORed together). Any flags that are already set are left set. DH_test_flags() tests to see whether the flags passed in the flags parameter are currently set in the DH object. Multiple flags can be tested in one go. All flags that are currently set are returned, or zero if none of the flags are set. DH_clear_flags() clears the specified flags within the DH object.

                                                                                                                                      DH_get0_engine() returns a handle to the ENGINE that has been set for this DH object, or NULL if no such ENGINE has been set. This function is deprecated. All engines should be replaced by providers.

                                                                                                                                      The DH_get_length() and DH_set_length() functions get and set the optional length parameter associated with this DH object. If the length is nonzero then it is used, otherwise it is ignored. The length parameter indicates the length of the secret exponent (private key) in bits. For safe prime groups the optional length parameter length can be set to a value greater or equal to 2 * maximum_target_security_strength(BN_num_bits(p)) as listed in SP800-56Ar3 Table(s) 25 & 26. These functions are deprecated and should be replaced with EVP_PKEY_CTX_set_params() and EVP_PKEY_get_int_param() using the parameter key OSSL_PKEY_PARAM_DH_PRIV_LEN as described in EVP_PKEY-DH(7).

                                                                                                                                      "},{"location":"man3/DH_get0_pqg/#notes","title":"NOTES","text":"

                                                                                                                                      Values retrieved with DH_get0_key() are owned by the DH object used in the call and may therefore not be passed to DH_set0_key(). If needed, duplicate the received value using BN_dup() and pass the duplicate. The same applies to DH_get0_pqg() and DH_set0_pqg().

                                                                                                                                      "},{"location":"man3/DH_get0_pqg/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DH_set0_pqg() and DH_set0_key() return 1 on success or 0 on failure.

                                                                                                                                      DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_priv_key(), and DH_get0_pub_key() return the respective value, or NULL if it is unset.

                                                                                                                                      DH_test_flags() returns the current state of the flags in the DH object.

                                                                                                                                      DH_get0_engine() returns the ENGINE set for the DH object or NULL if no ENGINE has been set.

                                                                                                                                      DH_get_length() returns the length of the secret exponent (private key) in bits, or zero if no such length has been explicitly set.

                                                                                                                                      "},{"location":"man3/DH_get0_pqg/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_new(3), DH_new(3), DH_generate_parameters(3), DH_generate_key(3), DH_set_method(3), DH_size(3), DH_meth_new(3)

                                                                                                                                      "},{"location":"man3/DH_get0_pqg/#history","title":"HISTORY","text":"

                                                                                                                                      The functions described here were added in OpenSSL 1.1.0.

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DH_get0_pqg/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_get_1024_160/","title":"DH_get_1024_160","text":""},{"location":"man3/DH_get_1024_160/#name","title":"NAME","text":"

                                                                                                                                      DH_get_1024_160, DH_get_2048_224, DH_get_2048_256, BN_get0_nist_prime_192, BN_get0_nist_prime_224, BN_get0_nist_prime_256, BN_get0_nist_prime_384, BN_get0_nist_prime_521, BN_get_rfc2409_prime_768, BN_get_rfc2409_prime_1024, BN_get_rfc3526_prime_1536, BN_get_rfc3526_prime_2048, BN_get_rfc3526_prime_3072, BN_get_rfc3526_prime_4096, BN_get_rfc3526_prime_6144, BN_get_rfc3526_prime_8192 - Create standardized public primes or DH pairs

                                                                                                                                      "},{"location":"man3/DH_get_1024_160/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n\nconst BIGNUM *BN_get0_nist_prime_192(void);\nconst BIGNUM *BN_get0_nist_prime_224(void);\nconst BIGNUM *BN_get0_nist_prime_256(void);\nconst BIGNUM *BN_get0_nist_prime_384(void);\nconst BIGNUM *BN_get0_nist_prime_521(void);\n\nBIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);\nBIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);\nBIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      #include <openssl/dh.h>\n\nDH *DH_get_1024_160(void);\nDH *DH_get_2048_224(void);\nDH *DH_get_2048_256(void);\n
                                                                                                                                      "},{"location":"man3/DH_get_1024_160/#description","title":"DESCRIPTION","text":"

                                                                                                                                      DH_get_1024_160(), DH_get_2048_224(), and DH_get_2048_256() each return a DH object for the IETF RFC 5114 value. These functions are deprecated. Applications should instead use EVP_PKEY_CTX_set_dh_rfc5114() and EVP_PKEY_CTX_set_dhx_rfc5114() as described in EVP_PKEY_CTX_ctrl(3) or by setting the OSSL_PKEY_PARAM_GROUP_NAME as specified in \"DH parameters\" in EVP_PKEY-DH(7)) to one of \"dh_1024_160\", \"dh_2048_224\" or \"dh_2048_256\".

                                                                                                                                      BN_get0_nist_prime_192(), BN_get0_nist_prime_224(), BN_get0_nist_prime_256(), BN_get0_nist_prime_384(), and BN_get0_nist_prime_521() functions return a BIGNUM for the specific NIST prime curve (e.g., P-256).

                                                                                                                                      BN_get_rfc2409_prime_768(), BN_get_rfc2409_prime_1024(), BN_get_rfc3526_prime_1536(), BN_get_rfc3526_prime_2048(), BN_get_rfc3526_prime_3072(), BN_get_rfc3526_prime_4096(), BN_get_rfc3526_prime_6144(), and BN_get_rfc3526_prime_8192() functions return a BIGNUM for the specified size from IETF RFC 2409. If bn is not NULL, the BIGNUM will be set into that location as well.

                                                                                                                                      "},{"location":"man3/DH_get_1024_160/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      Defined above.

                                                                                                                                      "},{"location":"man3/DH_get_1024_160/#history","title":"HISTORY","text":"

                                                                                                                                      The functions DH_get_1024_160(), DH_get_2048_224() and DH_get_2048_256() were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DH_get_1024_160/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_meth_new/","title":"DH_meth_new","text":""},{"location":"man3/DH_meth_new/#name","title":"NAME","text":"

                                                                                                                                      DH_meth_new, DH_meth_free, DH_meth_dup, DH_meth_get0_name, DH_meth_set1_name, DH_meth_get_flags, DH_meth_set_flags, DH_meth_get0_app_data, DH_meth_set0_app_data, DH_meth_get_generate_key, DH_meth_set_generate_key, DH_meth_get_compute_key, DH_meth_set_compute_key, DH_meth_get_bn_mod_exp, DH_meth_set_bn_mod_exp, DH_meth_get_init, DH_meth_set_init, DH_meth_get_finish, DH_meth_set_finish, DH_meth_get_generate_params, DH_meth_set_generate_params - Routines to build up DH methods

                                                                                                                                      "},{"location":"man3/DH_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DH_METHOD *DH_meth_new(const char *name, int flags);\n\nvoid DH_meth_free(DH_METHOD *dhm);\n\nDH_METHOD *DH_meth_dup(const DH_METHOD *dhm);\n\nconst char *DH_meth_get0_name(const DH_METHOD *dhm);\nint DH_meth_set1_name(DH_METHOD *dhm, const char *name);\n\nint DH_meth_get_flags(const DH_METHOD *dhm);\nint DH_meth_set_flags(DH_METHOD *dhm, int flags);\n\nvoid *DH_meth_get0_app_data(const DH_METHOD *dhm);\nint DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data);\n\nint (*DH_meth_get_generate_key(const DH_METHOD *dhm))(DH *);\nint DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key)(DH *));\n\nint (*DH_meth_get_compute_key(const DH_METHOD *dhm))\n    (unsigned char *key, const BIGNUM *pub_key, DH *dh);\nint DH_meth_set_compute_key(DH_METHOD *dhm,\n    int (*compute_key)(unsigned char *key, const BIGNUM *pub_key, DH *dh));\n\nint (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm))\n    (const DH *dh, BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n     const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\nint DH_meth_set_bn_mod_exp(DH_METHOD *dhm,\n    int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,\n                      const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n                      BN_MONT_CTX *m_ctx));\n\nint (*DH_meth_get_init(const DH_METHOD *dhm))(DH *);\nint DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *));\n\nint (*DH_meth_get_finish(const DH_METHOD *dhm))(DH *);\nint DH_meth_set_finish(DH_METHOD *dhm, int (*finish)(DH *));\n\nint (*DH_meth_get_generate_params(const DH_METHOD *dhm))\n    (DH *, int, int, BN_GENCB *);\nint DH_meth_set_generate_params(DH_METHOD *dhm,\n    int (*generate_params)(DH *, int, int, BN_GENCB *));\n
                                                                                                                                      "},{"location":"man3/DH_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use the provider APIs.

                                                                                                                                      The DH_METHOD type is a structure used for the provision of custom DH implementations. It provides a set of functions used by OpenSSL for the implementation of the various DH capabilities.

                                                                                                                                      DH_meth_new() creates a new DH_METHOD structure. It should be given a unique name and a set of flags. The name should be a NULL terminated string, which will be duplicated and stored in the DH_METHOD object. It is the callers responsibility to free the original string. The flags will be used during the construction of a new DH object based on this DH_METHOD. Any new DH object will have those flags set by default.

                                                                                                                                      DH_meth_dup() creates a duplicate copy of the DH_METHOD object passed as a parameter. This might be useful for creating a new DH_METHOD based on an existing one, but with some differences.

                                                                                                                                      DH_meth_free() destroys a DH_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

                                                                                                                                      DH_meth_get0_name() will return a pointer to the name of this DH_METHOD. This is a pointer to the internal name string and so should not be freed by the caller. DH_meth_set1_name() sets the name of the DH_METHOD to name. The string is duplicated and the copy is stored in the DH_METHOD structure, so the caller remains responsible for freeing the memory associated with the name.

                                                                                                                                      DH_meth_get_flags() returns the current value of the flags associated with this DH_METHOD. DH_meth_set_flags() provides the ability to set these flags.

                                                                                                                                      The functions DH_meth_get0_app_data() and DH_meth_set0_app_data() provide the ability to associate implementation specific data with the DH_METHOD. It is the application's responsibility to free this data before the DH_METHOD is freed via a call to DH_meth_free().

                                                                                                                                      DH_meth_get_generate_key() and DH_meth_set_generate_key() get and set the function used for generating a new DH key pair respectively. This function will be called in response to the application calling DH_generate_key(). The parameter for the function has the same meaning as for DH_generate_key().

                                                                                                                                      DH_meth_get_compute_key() and DH_meth_set_compute_key() get and set the function used for computing a new DH shared secret respectively. This function will be called in response to the application calling DH_compute_key(). The parameters for the function have the same meaning as for DH_compute_key().

                                                                                                                                      DH_meth_get_bn_mod_exp() and DH_meth_set_bn_mod_exp() get and set the function used for computing the following value:

                                                                                                                                      r = a ^ p mod m\n

                                                                                                                                      This function will be called by the default OpenSSL function for DH_generate_key(). The result is stored in the r parameter. This function may be NULL unless using the default generate key function, in which case it must be present.

                                                                                                                                      DH_meth_get_init() and DH_meth_set_init() get and set the function used for creating a new DH instance respectively. This function will be called in response to the application calling DH_new() (if the current default DH_METHOD is this one) or DH_new_method(). The DH_new() and DH_new_method() functions will allocate the memory for the new DH object, and a pointer to this newly allocated structure will be passed as a parameter to the function. This function may be NULL.

                                                                                                                                      DH_meth_get_finish() and DH_meth_set_finish() get and set the function used for destroying an instance of a DH object respectively. This function will be called in response to the application calling DH_free(). A pointer to the DH to be destroyed is passed as a parameter. The destroy function should be used for DH implementation specific clean up. The memory for the DH itself should not be freed by this function. This function may be NULL.

                                                                                                                                      DH_meth_get_generate_params() and DH_meth_set_generate_params() get and set the function used for generating DH parameters respectively. This function will be called in response to the application calling DH_generate_parameters_ex() (or DH_generate_parameters()). The parameters for the function have the same meaning as for DH_generate_parameters_ex(). This function may be NULL.

                                                                                                                                      "},{"location":"man3/DH_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DH_meth_new() and DH_meth_dup() return the newly allocated DH_METHOD object or NULL on failure.

                                                                                                                                      DH_meth_get0_name() and DH_meth_get_flags() return the name and flags associated with the DH_METHOD respectively.

                                                                                                                                      All other DH_meth_get_*() functions return the appropriate function pointer that has been set in the DH_METHOD, or NULL if no such pointer has yet been set.

                                                                                                                                      DH_meth_set1_name() and all DH_meth_set_*() functions return 1 on success or 0 on failure.

                                                                                                                                      "},{"location":"man3/DH_meth_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_new(3), DH_new(3), DH_generate_parameters(3), DH_generate_key(3), DH_set_method(3), DH_size(3), DH_get0_pqg(3)

                                                                                                                                      "},{"location":"man3/DH_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      The functions described here were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/DH_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_new/","title":"DH_new","text":""},{"location":"man3/DH_new/#name","title":"NAME","text":"

                                                                                                                                      DH_new, DH_free - allocate and free DH objects

                                                                                                                                      "},{"location":"man3/DH_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DH* DH_new(void);\n\nvoid DH_free(DH *dh);\n
                                                                                                                                      "},{"location":"man3/DH_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      DH_new() allocates and initializes a DH structure.

                                                                                                                                      DH_free() frees the DH structure and its components. The values are erased before the memory is returned to the system. If dh is NULL nothing is done.

                                                                                                                                      "},{"location":"man3/DH_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, DH_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                      DH_free() returns no value.

                                                                                                                                      "},{"location":"man3/DH_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_new(3), ERR_get_error(3), DH_generate_parameters(3), DH_generate_key(3), EVP_PKEY-DH(7)

                                                                                                                                      "},{"location":"man3/DH_new/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      For replacement see EVP_PKEY-DH(7).

                                                                                                                                      "},{"location":"man3/DH_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_new_by_nid/","title":"DH_new_by_nid","text":""},{"location":"man3/DH_new_by_nid/#name","title":"NAME","text":"

                                                                                                                                      DH_new_by_nid, DH_get_nid - create or get DH named parameters

                                                                                                                                      "},{"location":"man3/DH_new_by_nid/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DH *DH_new_by_nid(int nid);\n\nint DH_get_nid(const DH *dh);\n
                                                                                                                                      "},{"location":"man3/DH_new_by_nid/#description","title":"DESCRIPTION","text":"

                                                                                                                                      DH_new_by_nid() creates and returns a DH structure containing named parameters nid. Currently nid must be NID_ffdhe2048, NID_ffdhe3072, NID_ffdhe4096, NID_ffdhe6144, NID_ffdhe8192, NID_modp_1536, NID_modp_2048, NID_modp_3072, NID_modp_4096, NID_modp_6144 or NID_modp_8192.

                                                                                                                                      DH_get_nid() determines if the parameters contained in dh match any named safe prime group. It returns the NID corresponding to the matching parameters or NID_undef if there is no match. This function is deprecated.

                                                                                                                                      "},{"location":"man3/DH_new_by_nid/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DH_new_by_nid() returns a set of DH parameters or NULL if an error occurred.

                                                                                                                                      DH_get_nid() returns the NID of the matching set of parameters for p and g and optionally q, otherwise it returns NID_undef if there is no match.

                                                                                                                                      "},{"location":"man3/DH_new_by_nid/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DH_new_by_nid/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_set_method/","title":"DH_set_method","text":""},{"location":"man3/DH_set_method/#name","title":"NAME","text":"

                                                                                                                                      DH_set_default_method, DH_get_default_method, DH_set_method, DH_new_method, DH_OpenSSL - select DH method

                                                                                                                                      "},{"location":"man3/DH_set_method/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void DH_set_default_method(const DH_METHOD *meth);\n\nconst DH_METHOD *DH_get_default_method(void);\n\nint DH_set_method(DH *dh, const DH_METHOD *meth);\n\nDH *DH_new_method(ENGINE *engine);\n\nconst DH_METHOD *DH_OpenSSL(void);\n
                                                                                                                                      "},{"location":"man3/DH_set_method/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use the provider APIs.

                                                                                                                                      A DH_METHOD specifies the functions that OpenSSL uses for Diffie-Hellman operations. By modifying the method, alternative implementations such as hardware accelerators may be used. IMPORTANT: See the NOTES section for important information about how these DH API functions are affected by the use of ENGINE API calls.

                                                                                                                                      Initially, the default DH_METHOD is the OpenSSL internal implementation, as returned by DH_OpenSSL().

                                                                                                                                      DH_set_default_method() makes meth the default method for all DH structures created later. NB: This is true only whilst no ENGINE has been set as a default for DH, so this function is no longer recommended. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

                                                                                                                                      DH_get_default_method() returns a pointer to the current default DH_METHOD. However, the meaningfulness of this result is dependent on whether the ENGINE API is being used, so this function is no longer recommended.

                                                                                                                                      DH_set_method() selects meth to perform all operations using the key dh. This will replace the DH_METHOD used by the DH key and if the previous method was supplied by an ENGINE, the handle to that ENGINE will be released during the change. It is possible to have DH keys that only work with certain DH_METHOD implementations (e.g. from an ENGINE module that supports embedded hardware-protected keys), and in such cases attempting to change the DH_METHOD for the key can have unexpected results.

                                                                                                                                      DH_new_method() allocates and initializes a DH structure so that engine will be used for the DH operations. If engine is NULL, the default ENGINE for DH operations is used, and if no default ENGINE is set, the DH_METHOD controlled by DH_set_default_method() is used.

                                                                                                                                      A new DH_METHOD object may be constructed using DH_meth_new() (see DH_meth_new(3)).

                                                                                                                                      "},{"location":"man3/DH_set_method/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DH_OpenSSL() and DH_get_default_method() return pointers to the respective DH_METHODs.

                                                                                                                                      DH_set_default_method() returns no value.

                                                                                                                                      DH_set_method() returns nonzero if the provided meth was successfully set as the method for dh (including unloading the ENGINE handle if the previous method was supplied by an ENGINE).

                                                                                                                                      DH_new_method() returns NULL and sets an error code that can be obtained by ERR_get_error(3) if the allocation fails. Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                      "},{"location":"man3/DH_set_method/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_new(3), DH_new(3), DH_meth_new(3)

                                                                                                                                      "},{"location":"man3/DH_set_method/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DH_set_method/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DH_size/","title":"DH_size","text":""},{"location":"man3/DH_size/#name","title":"NAME","text":"

                                                                                                                                      DH_size, DH_bits, DH_security_bits - get Diffie-Hellman prime size and security bits

                                                                                                                                      "},{"location":"man3/DH_size/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dh.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DH_bits(const DH *dh);\n\nint DH_size(const DH *dh);\n\nint DH_security_bits(const DH *dh);\n
                                                                                                                                      "},{"location":"man3/DH_size/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                                                      DH_bits() returns the number of significant bits.

                                                                                                                                      dh and dh->p must not be NULL.

                                                                                                                                      DH_size() returns the Diffie-Hellman prime size in bytes. It can be used to determine how much memory must be allocated for the shared secret computed by DH_compute_key(3).

                                                                                                                                      DH_security_bits() returns the number of security bits of the given dh key. See BN_security_bits(3).

                                                                                                                                      "},{"location":"man3/DH_size/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DH_bits() returns the number of bits in the key, or -1 if dh doesn't hold any key parameters.

                                                                                                                                      DH_size() returns the prime size of Diffie-Hellman in bytes, or -1 if dh doesn't hold any key parameters.

                                                                                                                                      DH_security_bits() returns the number of security bits, or -1 if dh doesn't hold any key parameters.

                                                                                                                                      "},{"location":"man3/DH_size/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_PKEY_get_bits(3), DH_new(3), DH_generate_key(3), BN_num_bits(3)

                                                                                                                                      "},{"location":"man3/DH_size/#history","title":"HISTORY","text":"

                                                                                                                                      All functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DH_size/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_SIG_new/","title":"DSA_SIG_new","text":""},{"location":"man3/DSA_SIG_new/#name","title":"NAME","text":"

                                                                                                                                      DSA_SIG_get0, DSA_SIG_set0, DSA_SIG_new, DSA_SIG_free - allocate and free DSA signature objects

                                                                                                                                      "},{"location":"man3/DSA_SIG_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n\nDSA_SIG *DSA_SIG_new(void);\nvoid DSA_SIG_free(DSA_SIG *a);\nvoid DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);\nint DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);\n
                                                                                                                                      "},{"location":"man3/DSA_SIG_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      DSA_SIG_new() allocates an empty DSA_SIG structure.

                                                                                                                                      DSA_SIG_free() frees the DSA_SIG structure and its components. The values are erased before the memory is returned to the system. If the argument is NULL, nothing is done.

                                                                                                                                      DSA_SIG_get0() returns internal pointers to the r and s values contained in sig.

                                                                                                                                      The r and s values can be set by calling DSA_SIG_set0() and passing the new values for r and s as parameters to the function. Calling this function transfers the memory management of the values to the DSA_SIG object, and therefore the values that have been passed in should not be freed directly after this function has been called.

                                                                                                                                      "},{"location":"man3/DSA_SIG_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, DSA_SIG_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                      DSA_SIG_free() returns no value.

                                                                                                                                      DSA_SIG_set0() returns 1 on success or 0 on failure.

                                                                                                                                      "},{"location":"man3/DSA_SIG_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_PKEY_new(3), EVP_PKEY_free(3), EVP_PKEY_get_bn_param(3), ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/DSA_SIG_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_do_sign/","title":"DSA_do_sign","text":""},{"location":"man3/DSA_do_sign/#name","title":"NAME","text":"

                                                                                                                                      DSA_do_sign, DSA_do_verify - raw DSA signature operations

                                                                                                                                      "},{"location":"man3/DSA_do_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);\n\nint DSA_do_verify(const unsigned char *dgst, int dgst_len,\n                  DSA_SIG *sig, DSA *dsa);\n
                                                                                                                                      "},{"location":"man3/DSA_do_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

                                                                                                                                      DSA_do_sign() computes a digital signature on the len byte message digest dgst using the private key dsa and returns it in a newly allocated DSA_SIG structure.

                                                                                                                                      DSA_sign_setup(3) may be used to precompute part of the signing operation in case signature generation is time-critical.

                                                                                                                                      DSA_do_verify() verifies that the signature sig matches a given message digest dgst of size len. dsa is the signer's public key.

                                                                                                                                      "},{"location":"man3/DSA_do_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_do_sign() returns the signature, NULL on error. DSA_do_verify() returns 1 for a valid signature, 0 for an incorrect signature and -1 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/DSA_do_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_SIG_new(3), DSA_sign(3)

                                                                                                                                      "},{"location":"man3/DSA_do_sign/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_do_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_dup_DH/","title":"DSA_dup_DH","text":""},{"location":"man3/DSA_dup_DH/#name","title":"NAME","text":"

                                                                                                                                      DSA_dup_DH - create a DH structure out of DSA structure

                                                                                                                                      "},{"location":"man3/DSA_dup_DH/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DH *DSA_dup_DH(const DSA *r);\n
                                                                                                                                      "},{"location":"man3/DSA_dup_DH/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The function described on this page is deprecated. There is no direct replacement, applications should use the EVP_PKEY APIs for Diffie-Hellman operations.

                                                                                                                                      DSA_dup_DH() duplicates DSA parameters/keys as DH parameters/keys. q is lost during that conversion, but the resulting DH parameters contain its length.

                                                                                                                                      "},{"location":"man3/DSA_dup_DH/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_dup_DH() returns the new DH structure, and NULL on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/DSA_dup_DH/#note","title":"NOTE","text":"

                                                                                                                                      Be careful to avoid small subgroup attacks when using this.

                                                                                                                                      "},{"location":"man3/DSA_dup_DH/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DH_new(3), DSA_new(3), ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/DSA_dup_DH/#history","title":"HISTORY","text":"

                                                                                                                                      This function was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_dup_DH/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_generate_key/","title":"DSA_generate_key","text":""},{"location":"man3/DSA_generate_key/#name","title":"NAME","text":"

                                                                                                                                      DSA_generate_key - generate DSA key pair

                                                                                                                                      "},{"location":"man3/DSA_generate_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DSA_generate_key(DSA *a);\n
                                                                                                                                      "},{"location":"man3/DSA_generate_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3) as described in EVP_PKEY-DSA(7).

                                                                                                                                      DSA_generate_key() expects a to contain DSA parameters. It generates a new key pair and stores it in a->pub_key and a->priv_key.

                                                                                                                                      The random generator must be seeded prior to calling DSA_generate_key(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                      "},{"location":"man3/DSA_generate_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_generate_key() returns 1 on success, 0 otherwise. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/DSA_generate_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_generate_parameters_ex(3)

                                                                                                                                      "},{"location":"man3/DSA_generate_key/#history","title":"HISTORY","text":"

                                                                                                                                      This function was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_generate_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/","title":"DSA_generate_parameters","text":""},{"location":"man3/DSA_generate_parameters/#name","title":"NAME","text":"

                                                                                                                                      DSA_generate_parameters_ex, DSA_generate_parameters - generate DSA parameters

                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DSA_generate_parameters_ex(DSA *dsa, int bits,\n                               const unsigned char *seed, int seed_len,\n                               int *counter_ret, unsigned long *h_ret,\n                               BN_GENCB *cb);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len,\n                             int *counter_ret, unsigned long *h_ret,\n                             void (*callback)(int, int, void *), void *cb_arg);\n
                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_paramgen_init(3) and EVP_PKEY_keygen(3) as described in EVP_PKEY-DSA(7).

                                                                                                                                      DSA_generate_parameters_ex() generates primes p and q and a generator g for use in the DSA and stores the result in dsa.

                                                                                                                                      bits is the length of the prime p to be generated. For lengths under 2048 bits, the length of q is 160 bits; for lengths greater than or equal to 2048 bits, the length of q is set to 256 bits.

                                                                                                                                      If seed is NULL, the primes will be generated at random. If seed_len is less than the length of q, an error is returned.

                                                                                                                                      DSA_generate_parameters_ex() places the iteration count in *counter_ret and a counter used for finding a generator in *h_ret, unless these are NULL.

                                                                                                                                      A callback function may be used to provide feedback about the progress of the key generation. If cb is not NULL, it will be called as shown below. For information on the BN_GENCB structure and the BN_GENCB_call function discussed below, refer to BN_generate_prime(3).

                                                                                                                                      DSA_generate_parameters() is similar to DSA_generate_parameters_ex() but expects an old-style callback function; see BN_generate_prime(3) for information on the old-style callback.

                                                                                                                                      • When a candidate for q is generated, BN_GENCB_call(cb, 0, m++) is called (m is 0 for the first candidate).
                                                                                                                                      • When a candidate for q has passed a test by trial division, BN_GENCB_call(cb, 1, -1) is called. While a candidate for q is tested by Miller-Rabin primality tests, BN_GENCB_call(cb, 1, i) is called in the outer loop (once for each witness that confirms that the candidate may be prime); i is the loop counter (starting at 0).
                                                                                                                                      • When a prime q has been found, BN_GENCB_call(cb, 2, 0) and BN_GENCB_call(cb, 3, 0) are called.
                                                                                                                                      • Before a candidate for p (other than the first) is generated and tested, BN_GENCB_call(cb, 0, counter) is called.
                                                                                                                                      • When a candidate for p has passed the test by trial division, BN_GENCB_call(cb, 1, -1) is called. While it is tested by the Miller-Rabin primality test, BN_GENCB_call(cb, 1, i) is called in the outer loop (once for each witness that confirms that the candidate may be prime). i is the loop counter (starting at 0).
                                                                                                                                      • When p has been found, BN_GENCB_call(cb, 2, 1) is called.
                                                                                                                                      • When the generator has been found, BN_GENCB_call(cb, 3, 1) is called.
                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_generate_parameters_ex() returns a 1 on success, or 0 otherwise. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      DSA_generate_parameters() returns a pointer to the DSA structure or NULL if the parameter generation fails.

                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/#bugs","title":"BUGS","text":"

                                                                                                                                      Seed lengths greater than 20 are not supported.

                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_free(3), BN_generate_prime(3)

                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/#history","title":"HISTORY","text":"

                                                                                                                                      DSA_generate_parameters_ex() was deprecated in OpenSSL 3.0.

                                                                                                                                      DSA_generate_parameters() was deprecated in OpenSSL 0.9.8; use DSA_generate_parameters_ex() instead.

                                                                                                                                      "},{"location":"man3/DSA_generate_parameters/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/","title":"DSA_get0_pqg","text":""},{"location":"man3/DSA_get0_pqg/#name","title":"NAME","text":"

                                                                                                                                      DSA_get0_pqg, DSA_set0_pqg, DSA_get0_key, DSA_set0_key, DSA_get0_p, DSA_get0_q, DSA_get0_g, DSA_get0_pub_key, DSA_get0_priv_key, DSA_clear_flags, DSA_test_flags, DSA_set_flags, DSA_get0_engine - Routines for getting and setting data in a DSA object

                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void DSA_get0_pqg(const DSA *d,\n                  const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);\nint DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);\nvoid DSA_get0_key(const DSA *d,\n                  const BIGNUM **pub_key, const BIGNUM **priv_key);\nint DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);\nconst BIGNUM *DSA_get0_p(const DSA *d);\nconst BIGNUM *DSA_get0_q(const DSA *d);\nconst BIGNUM *DSA_get0_g(const DSA *d);\nconst BIGNUM *DSA_get0_pub_key(const DSA *d);\nconst BIGNUM *DSA_get0_priv_key(const DSA *d);\nvoid DSA_clear_flags(DSA *d, int flags);\nint DSA_test_flags(const DSA *d, int flags);\nvoid DSA_set_flags(DSA *d, int flags);\nENGINE *DSA_get0_engine(DSA *d);\n
                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bn_param(3).

                                                                                                                                      A DSA object contains the parameters p, q and g. It also contains a public key (pub_key) and (optionally) a private key (priv_key).

                                                                                                                                      The p, q and g parameters can be obtained by calling DSA_get0_pqg(). If the parameters have not yet been set then *p, *q and *g will be set to NULL. Otherwise they are set to pointers to their respective values. These point directly to the internal representations of the values and therefore should not be freed directly.

                                                                                                                                      The p, q and g values can be set by calling DSA_set0_pqg() and passing the new values for p, q and g as parameters to the function. Calling this function transfers the memory management of the values to the DSA object, and therefore the values that have been passed in should not be freed directly after this function has been called.

                                                                                                                                      To get the public and private key values use the DSA_get0_key() function. A pointer to the public key will be stored in *pub_key, and a pointer to the private key will be stored in *priv_key. Either may be NULL if they have not been set yet, although if the private key has been set then the public key must be. The values point to the internal representation of the public key and private key values. This memory should not be freed directly.

                                                                                                                                      The public and private key values can be set using DSA_set0_key(). The public key must be non-NULL the first time this function is called on a given DSA object. The private key may be NULL. On subsequent calls, either may be NULL, which means the corresponding DSA field is left untouched. As for DSA_set0_pqg() this function transfers the memory management of the key values to the DSA object, and therefore they should not be freed directly after this function has been called.

                                                                                                                                      Any of the values p, q, g, priv_key, and pub_key can also be retrieved separately by the corresponding function DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_priv_key(), and DSA_get0_pub_key(), respectively.

                                                                                                                                      DSA_set_flags() sets the flags in the flags parameter on the DSA object. Multiple flags can be passed in one go (bitwise ORed together). Any flags that are already set are left set. DSA_test_flags() tests to see whether the flags passed in the flags parameter are currently set in the DSA object. Multiple flags can be tested in one go. All flags that are currently set are returned, or zero if none of the flags are set. DSA_clear_flags() clears the specified flags within the DSA object.

                                                                                                                                      DSA_get0_engine() returns a handle to the ENGINE that has been set for this DSA object, or NULL if no such ENGINE has been set.

                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/#notes","title":"NOTES","text":"

                                                                                                                                      Values retrieved with DSA_get0_key() are owned by the DSA object used in the call and may therefore not be passed to DSA_set0_key(). If needed, duplicate the received value using BN_dup() and pass the duplicate. The same applies to DSA_get0_pqg() and DSA_set0_pqg().

                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_set0_pqg() and DSA_set0_key() return 1 on success or 0 on failure.

                                                                                                                                      DSA_test_flags() returns the current state of the flags in the DSA object.

                                                                                                                                      DSA_get0_engine() returns the ENGINE set for the DSA object or NULL if no ENGINE has been set.

                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_PKEY_get_bn_param(3), DSA_new(3), DSA_new(3), DSA_generate_parameters(3), DSA_generate_key(3), DSA_dup_DH(3), DSA_do_sign(3), DSA_set_method(3), DSA_SIG_new(3), DSA_sign(3), DSA_size(3), DSA_meth_new(3)

                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/#history","title":"HISTORY","text":"

                                                                                                                                      The functions described here were added in OpenSSL 1.1.0 and deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_get0_pqg/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_meth_new/","title":"DSA_meth_new","text":""},{"location":"man3/DSA_meth_new/#name","title":"NAME","text":"

                                                                                                                                      DSA_meth_new, DSA_meth_free, DSA_meth_dup, DSA_meth_get0_name, DSA_meth_set1_name, DSA_meth_get_flags, DSA_meth_set_flags, DSA_meth_get0_app_data, DSA_meth_set0_app_data, DSA_meth_get_sign, DSA_meth_set_sign, DSA_meth_get_sign_setup, DSA_meth_set_sign_setup, DSA_meth_get_verify, DSA_meth_set_verify, DSA_meth_get_mod_exp, DSA_meth_set_mod_exp, DSA_meth_get_bn_mod_exp, DSA_meth_set_bn_mod_exp, DSA_meth_get_init, DSA_meth_set_init, DSA_meth_get_finish, DSA_meth_set_finish, DSA_meth_get_paramgen, DSA_meth_set_paramgen, DSA_meth_get_keygen, DSA_meth_set_keygen - Routines to build up DSA methods

                                                                                                                                      "},{"location":"man3/DSA_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DSA_METHOD *DSA_meth_new(const char *name, int flags);\n\nvoid DSA_meth_free(DSA_METHOD *dsam);\n\nDSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth);\n\nconst char *DSA_meth_get0_name(const DSA_METHOD *dsam);\nint DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);\n\nint DSA_meth_get_flags(const DSA_METHOD *dsam);\nint DSA_meth_set_flags(DSA_METHOD *dsam, int flags);\n\nvoid *DSA_meth_get0_app_data(const DSA_METHOD *dsam);\nint DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);\n\nDSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))(const unsigned char *,\n                                                      int, DSA *);\nint DSA_meth_set_sign(DSA_METHOD *dsam, DSA_SIG *(*sign)(const unsigned char *,\n                                                         int, DSA *));\n\nint (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))(DSA *, BN_CTX *,$\n                                                       BIGNUM **, BIGNUM **);\nint DSA_meth_set_sign_setup(DSA_METHOD *dsam, int (*sign_setup)(DSA *, BN_CTX *,\n                                                                BIGNUM **, BIGNUM **));\n\nint (*DSA_meth_get_verify(const DSA_METHOD *dsam))(const unsigned char *,\n                                                   int, DSA_SIG *, DSA *);\nint DSA_meth_set_verify(DSA_METHOD *dsam, int (*verify)(const unsigned char *,\n                                                        int, DSA_SIG *, DSA *));\n\nint (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n                                                    BIGNUM *p1, BIGNUM *a2, BIGNUM *p2,\n                                                    BIGNUM *m, BN_CTX *ctx,\n                                                    BN_MONT_CTX *in_mont);\nint DSA_meth_set_mod_exp(DSA_METHOD *dsam, int (*mod_exp)(DSA *dsa, BIGNUM *rr,\n                                                          BIGNUM *a1, BIGNUM *p1,\n                                                          BIGNUM *a2, BIGNUM *p2,\n                                                          BIGNUM *m, BN_CTX *ctx,\n                                                          BN_MONT_CTX *mont));\n\nint (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))(DSA *dsa, BIGNUM *r, BIGNUM *a,\n                                                       const BIGNUM *p, const BIGNUM *m,\n                                                       BN_CTX *ctx, BN_MONT_CTX *mont);\nint DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, int (*bn_mod_exp)(DSA *dsa,\n                                                                BIGNUM *r,\n                                                                BIGNUM *a,\n                                                                const BIGNUM *p,\n                                                                const BIGNUM *m,\n                                                                BN_CTX *ctx,\n                                                                BN_MONT_CTX *mont));\n\nint (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);\nint DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));\n\nint (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *);\nint DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish)(DSA *));\n\nint (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))(DSA *, int,\n                                                     const unsigned char *,\n                                                     int, int *, unsigned long *,\n                                                     BN_GENCB *);\nint DSA_meth_set_paramgen(DSA_METHOD *dsam,\n                          int (*paramgen)(DSA *, int, const unsigned char *,\n                                          int, int *, unsigned long *, BN_GENCB *));\n\nint (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *);\nint DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen)(DSA *));\n
                                                                                                                                      "},{"location":"man3/DSA_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications and extension implementations should instead use the OSSL_PROVIDER APIs.

                                                                                                                                      The DSA_METHOD type is a structure used for the provision of custom DSA implementations. It provides a set of functions used by OpenSSL for the implementation of the various DSA capabilities.

                                                                                                                                      DSA_meth_new() creates a new DSA_METHOD structure. It should be given a unique name and a set of flags. The name should be a NULL terminated string, which will be duplicated and stored in the DSA_METHOD object. It is the callers responsibility to free the original string. The flags will be used during the construction of a new DSA object based on this DSA_METHOD. Any new DSA object will have those flags set by default.

                                                                                                                                      DSA_meth_dup() creates a duplicate copy of the DSA_METHOD object passed as a parameter. This might be useful for creating a new DSA_METHOD based on an existing one, but with some differences.

                                                                                                                                      DSA_meth_free() destroys a DSA_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

                                                                                                                                      DSA_meth_get0_name() will return a pointer to the name of this DSA_METHOD. This is a pointer to the internal name string and so should not be freed by the caller. DSA_meth_set1_name() sets the name of the DSA_METHOD to name. The string is duplicated and the copy is stored in the DSA_METHOD structure, so the caller remains responsible for freeing the memory associated with the name.

                                                                                                                                      DSA_meth_get_flags() returns the current value of the flags associated with this DSA_METHOD. DSA_meth_set_flags() provides the ability to set these flags.

                                                                                                                                      The functions DSA_meth_get0_app_data() and DSA_meth_set0_app_data() provide the ability to associate implementation specific data with the DSA_METHOD. It is the application's responsibility to free this data before the DSA_METHOD is freed via a call to DSA_meth_free().

                                                                                                                                      DSA_meth_get_sign() and DSA_meth_set_sign() get and set the function used for creating a DSA signature respectively. This function will be called in response to the application calling DSA_do_sign() (or DSA_sign()). The parameters for the function have the same meaning as for DSA_do_sign().

                                                                                                                                      DSA_meth_get_sign_setup() and DSA_meth_set_sign_setup() get and set the function used for precalculating the DSA signature values k^-1 and r. This function will be called in response to the application calling DSA_sign_setup(). The parameters for the function have the same meaning as for DSA_sign_setup().

                                                                                                                                      DSA_meth_get_verify() and DSA_meth_set_verify() get and set the function used for verifying a DSA signature respectively. This function will be called in response to the application calling DSA_do_verify() (or DSA_verify()). The parameters for the function have the same meaning as for DSA_do_verify().

                                                                                                                                      DSA_meth_get_mod_exp() and DSA_meth_set_mod_exp() get and set the function used for computing the following value:

                                                                                                                                      rr = a1^p1 * a2^p2 mod m\n

                                                                                                                                      This function will be called by the default OpenSSL method during verification of a DSA signature. The result is stored in the rr parameter. This function may be NULL.

                                                                                                                                      DSA_meth_get_bn_mod_exp() and DSA_meth_set_bn_mod_exp() get and set the function used for computing the following value:

                                                                                                                                      r = a ^ p mod m\n

                                                                                                                                      This function will be called by the default OpenSSL function for DSA_sign_setup(). The result is stored in the r parameter. This function may be NULL.

                                                                                                                                      DSA_meth_get_init() and DSA_meth_set_init() get and set the function used for creating a new DSA instance respectively. This function will be called in response to the application calling DSA_new() (if the current default DSA_METHOD is this one) or DSA_new_method(). The DSA_new() and DSA_new_method() functions will allocate the memory for the new DSA object, and a pointer to this newly allocated structure will be passed as a parameter to the function. This function may be NULL.

                                                                                                                                      DSA_meth_get_finish() and DSA_meth_set_finish() get and set the function used for destroying an instance of a DSA object respectively. This function will be called in response to the application calling DSA_free(). A pointer to the DSA to be destroyed is passed as a parameter. The destroy function should be used for DSA implementation specific clean up. The memory for the DSA itself should not be freed by this function. This function may be NULL.

                                                                                                                                      DSA_meth_get_paramgen() and DSA_meth_set_paramgen() get and set the function used for generating DSA parameters respectively. This function will be called in response to the application calling DSA_generate_parameters_ex() (or DSA_generate_parameters()). The parameters for the function have the same meaning as for DSA_generate_parameters_ex().

                                                                                                                                      DSA_meth_get_keygen() and DSA_meth_set_keygen() get and set the function used for generating a new DSA key pair respectively. This function will be called in response to the application calling DSA_generate_key(). The parameter for the function has the same meaning as for DSA_generate_key().

                                                                                                                                      "},{"location":"man3/DSA_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_meth_new() and DSA_meth_dup() return the newly allocated DSA_METHOD object or NULL on failure.

                                                                                                                                      DSA_meth_get0_name() and DSA_meth_get_flags() return the name and flags associated with the DSA_METHOD respectively.

                                                                                                                                      All other DSA_meth_get_*() functions return the appropriate function pointer that has been set in the DSA_METHOD, or NULL if no such pointer has yet been set.

                                                                                                                                      DSA_meth_set1_name() and all DSA_meth_set_*() functions return 1 on success or 0 on failure.

                                                                                                                                      "},{"location":"man3/DSA_meth_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DSA_new(3), DSA_new(3), DSA_generate_parameters(3), DSA_generate_key(3), DSA_dup_DH(3), DSA_do_sign(3), DSA_set_method(3), DSA_SIG_new(3), DSA_sign(3), DSA_size(3), DSA_get0_pqg(3)

                                                                                                                                      "},{"location":"man3/DSA_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                      The functions described here were deprecated in OpenSSL 3.0.

                                                                                                                                      The functions described here were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/DSA_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_new/","title":"DSA_new","text":""},{"location":"man3/DSA_new/#name","title":"NAME","text":"

                                                                                                                                      DSA_new, DSA_free - allocate and free DSA objects

                                                                                                                                      "},{"location":"man3/DSA_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      DSA* DSA_new(void);\n\nvoid DSA_free(DSA *dsa);\n
                                                                                                                                      "},{"location":"man3/DSA_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_new(3) and EVP_PKEY_free(3).

                                                                                                                                      DSA_new() allocates and initializes a DSA structure. It is equivalent to calling DSA_new_method(NULL).

                                                                                                                                      DSA_free() frees the DSA structure and its components. The values are erased before the memory is returned to the system. If dsa is NULL nothing is done.

                                                                                                                                      "},{"location":"man3/DSA_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If the allocation fails, DSA_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                      DSA_free() returns no value.

                                                                                                                                      "},{"location":"man3/DSA_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_PKEY_new(3), EVP_PKEY_free(3), DSA_new(3), ERR_get_error(3), DSA_generate_parameters(3), DSA_generate_key(3)

                                                                                                                                      "},{"location":"man3/DSA_new/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_set_method/","title":"DSA_set_method","text":""},{"location":"man3/DSA_set_method/#name","title":"NAME","text":"

                                                                                                                                      DSA_set_default_method, DSA_get_default_method, DSA_set_method, DSA_new_method, DSA_OpenSSL - select DSA method

                                                                                                                                      "},{"location":"man3/DSA_set_method/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void DSA_set_default_method(const DSA_METHOD *meth);\n\nconst DSA_METHOD *DSA_get_default_method(void);\n\nint DSA_set_method(DSA *dsa, const DSA_METHOD *meth);\n\nDSA *DSA_new_method(ENGINE *engine);\n\nconst DSA_METHOD *DSA_OpenSSL(void);\n
                                                                                                                                      "},{"location":"man3/DSA_set_method/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should providers instead of method overrides.

                                                                                                                                      A DSA_METHOD specifies the functions that OpenSSL uses for DSA operations. By modifying the method, alternative implementations such as hardware accelerators may be used. IMPORTANT: See the NOTES section for important information about how these DSA API functions are affected by the use of ENGINE API calls.

                                                                                                                                      Initially, the default DSA_METHOD is the OpenSSL internal implementation, as returned by DSA_OpenSSL().

                                                                                                                                      DSA_set_default_method() makes meth the default method for all DSA structures created later. NB: This is true only whilst no ENGINE has been set as a default for DSA, so this function is no longer recommended. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

                                                                                                                                      DSA_get_default_method() returns a pointer to the current default DSA_METHOD. However, the meaningfulness of this result is dependent on whether the ENGINE API is being used, so this function is no longer recommended.

                                                                                                                                      DSA_set_method() selects meth to perform all operations using the key rsa. This will replace the DSA_METHOD used by the DSA key and if the previous method was supplied by an ENGINE, the handle to that ENGINE will be released during the change. It is possible to have DSA keys that only work with certain DSA_METHOD implementations (e.g. from an ENGINE module that supports embedded hardware-protected keys), and in such cases attempting to change the DSA_METHOD for the key can have unexpected results. See DSA_meth_new(3) for information on constructing custom DSA_METHOD objects;

                                                                                                                                      DSA_new_method() allocates and initializes a DSA structure so that engine will be used for the DSA operations. If engine is NULL, the default engine for DSA operations is used, and if no default ENGINE is set, the DSA_METHOD controlled by DSA_set_default_method() is used.

                                                                                                                                      "},{"location":"man3/DSA_set_method/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_OpenSSL() and DSA_get_default_method() return pointers to the respective DSA_METHODs.

                                                                                                                                      DSA_set_default_method() returns no value.

                                                                                                                                      DSA_set_method() returns nonzero if the provided meth was successfully set as the method for dsa (including unloading the ENGINE handle if the previous method was supplied by an ENGINE).

                                                                                                                                      DSA_new_method() returns NULL and sets an error code that can be obtained by ERR_get_error(3) if the allocation fails. Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                      "},{"location":"man3/DSA_set_method/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DSA_new(3), DSA_new(3), DSA_meth_new(3)

                                                                                                                                      "},{"location":"man3/DSA_set_method/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_set_method/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_sign/","title":"DSA_sign","text":""},{"location":"man3/DSA_sign/#name","title":"NAME","text":"

                                                                                                                                      DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures

                                                                                                                                      "},{"location":"man3/DSA_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DSA_sign(int type, const unsigned char *dgst, int len,\n             unsigned char *sigret, unsigned int *siglen, DSA *dsa);\n\nint DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);\n\nint DSA_verify(int type, const unsigned char *dgst, int len,\n               unsigned char *sigbuf, int siglen, DSA *dsa);\n
                                                                                                                                      "},{"location":"man3/DSA_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

                                                                                                                                      DSA_sign() computes a digital signature on the len byte message digest dgst using the private key dsa and places its ASN.1 DER encoding at sigret. The length of the signature is places in *siglen. sigret must point to DSA_size(dsa) bytes of memory.

                                                                                                                                      DSA_sign_setup() is defined only for backward binary compatibility and should not be used. Since OpenSSL 1.1.0 the DSA type is opaque and the output of DSA_sign_setup() cannot be used anyway: calling this function will only cause overhead, and does not affect the actual signature (pre-)computation.

                                                                                                                                      DSA_verify() verifies that the signature sigbuf of size siglen matches a given message digest dgst of size len. dsa is the signer's public key.

                                                                                                                                      The type parameter is ignored.

                                                                                                                                      The random generator must be seeded when DSA_sign() (or DSA_sign_setup()) is called. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                      "},{"location":"man3/DSA_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error. DSA_verify() returns 1 for a valid signature, 0 for an incorrect signature and -1 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/DSA_sign/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                      US Federal Information Processing Standard FIPS186-4 (Digital Signature Standard, DSS), ANSI X9.30

                                                                                                                                      "},{"location":"man3/DSA_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_do_sign(3), RAND(7)

                                                                                                                                      "},{"location":"man3/DSA_sign/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DSA_size/","title":"DSA_size","text":""},{"location":"man3/DSA_size/#name","title":"NAME","text":"

                                                                                                                                      DSA_size, DSA_bits, DSA_security_bits - get DSA signature size, key bits or security bits

                                                                                                                                      "},{"location":"man3/DSA_size/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/dsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int DSA_bits(const DSA *dsa);\n\nint DSA_size(const DSA *dsa);\n\nint DSA_security_bits(const DSA *dsa);\n
                                                                                                                                      "},{"location":"man3/DSA_size/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                                                      DSA_bits() returns the number of bits in key dsa: this is the number of bits in the p parameter.

                                                                                                                                      DSA_size() returns the maximum size of an ASN.1 encoded DSA signature for key dsa in bytes. It can be used to determine how much memory must be allocated for a DSA signature.

                                                                                                                                      DSA_security_bits() returns the number of security bits of the given dsa key. See BN_security_bits(3).

                                                                                                                                      "},{"location":"man3/DSA_size/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      DSA_security_bits() returns the number of security bits in the key, or -1 if dsa doesn't hold any key parameters.

                                                                                                                                      DSA_bits() returns the number of bits in the key, or -1 if dsa doesn't hold any key parameters.

                                                                                                                                      DSA_size() returns the signature size in bytes, or -1 if dsa doesn't hold any key parameters.

                                                                                                                                      "},{"location":"man3/DSA_size/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3), EVP_PKEY_get_size(3), DSA_new(3), DSA_sign(3)

                                                                                                                                      "},{"location":"man3/DSA_size/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/DSA_size/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DTLS_get_data_mtu/","title":"DTLS_get_data_mtu","text":""},{"location":"man3/DTLS_get_data_mtu/#name","title":"NAME","text":"

                                                                                                                                      DTLS_get_data_mtu - Get maximum data payload size

                                                                                                                                      "},{"location":"man3/DTLS_get_data_mtu/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ssl.h>\n\nsize_t DTLS_get_data_mtu(const SSL *ssl);\n
                                                                                                                                      "},{"location":"man3/DTLS_get_data_mtu/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This function obtains the maximum data payload size for the established DTLS connection ssl, based on the DTLS record MTU and the overhead of the DTLS record header, encryption and authentication currently in use.

                                                                                                                                      "},{"location":"man3/DTLS_get_data_mtu/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      Returns the maximum data payload size on success, or 0 on failure.

                                                                                                                                      "},{"location":"man3/DTLS_get_data_mtu/#history","title":"HISTORY","text":"

                                                                                                                                      The DTLS_get_data_mtu() function was added in OpenSSL 1.1.1.

                                                                                                                                      "},{"location":"man3/DTLS_get_data_mtu/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DTLS_set_timer_cb/","title":"DTLS_set_timer_cb","text":""},{"location":"man3/DTLS_set_timer_cb/#name","title":"NAME","text":"

                                                                                                                                      DTLS_timer_cb, DTLS_set_timer_cb - Set callback for controlling DTLS timer duration

                                                                                                                                      "},{"location":"man3/DTLS_set_timer_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ssl.h>\n\ntypedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us);\n\nvoid DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb);\n
                                                                                                                                      "},{"location":"man3/DTLS_set_timer_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                      This function sets an optional callback function for controlling the timeout interval on the DTLS protocol. The callback function will be called by DTLS for every new DTLS packet that is sent.

                                                                                                                                      "},{"location":"man3/DTLS_set_timer_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      Returns void.

                                                                                                                                      "},{"location":"man3/DTLS_set_timer_cb/#history","title":"HISTORY","text":"

                                                                                                                                      The DTLS_set_timer_cb() function was added in OpenSSL 1.1.1.

                                                                                                                                      "},{"location":"man3/DTLS_set_timer_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/DTLSv1_listen/","title":"DTLSv1_listen","text":""},{"location":"man3/DTLSv1_listen/#name","title":"NAME","text":"

                                                                                                                                      SSL_stateless, DTLSv1_listen - Statelessly listen for incoming connections

                                                                                                                                      "},{"location":"man3/DTLSv1_listen/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ssl.h>\n\nint SSL_stateless(SSL *s);\nint DTLSv1_listen(SSL *ssl, BIO_ADDR *peer);\n
                                                                                                                                      "},{"location":"man3/DTLSv1_listen/#description","title":"DESCRIPTION","text":"

                                                                                                                                      SSL_stateless() statelessly listens for new incoming TLSv1.3 connections. DTLSv1_listen() statelessly listens for new incoming DTLS connections. If a ClientHello is received that does not contain a cookie, then they respond with a request for a new ClientHello that does contain a cookie. If a ClientHello is received with a cookie that is verified then the function returns in order to enable the handshake to be completed (for example by using SSL_accept()).

                                                                                                                                      "},{"location":"man3/DTLSv1_listen/#notes","title":"NOTES","text":"

                                                                                                                                      Some transport protocols (such as UDP) can be susceptible to amplification attacks. Unlike TCP there is no initial connection setup in UDP that validates that the client can actually receive messages on its advertised source address. An attacker could forge its source IP address and then send handshake initiation messages to the server. The server would then send its response to the forged source IP. If the response messages are larger than the original message then the amplification attack has succeeded.

                                                                                                                                      If DTLS is used over UDP (or any datagram based protocol that does not validate the source IP) then it is susceptible to this type of attack. TLSv1.3 is designed to operate over a stream-based transport protocol (such as TCP). If TCP is being used then there is no need to use SSL_stateless(). However, some stream-based transport protocols (e.g. QUIC) may not validate the source address. In this case a TLSv1.3 application would be susceptible to this attack.

                                                                                                                                      As a countermeasure to this issue TLSv1.3 and DTLS include a stateless cookie mechanism. The idea is that when a client attempts to connect to a server it sends a ClientHello message. The server responds with a HelloRetryRequest (in TLSv1.3) or a HelloVerifyRequest (in DTLS) which contains a unique cookie. The client then resends the ClientHello, but this time includes the cookie in the message thus proving that the client is capable of receiving messages sent to that address. All of this can be done by the server without allocating any state, and thus without consuming expensive resources.

                                                                                                                                      OpenSSL implements this capability via the SSL_stateless() and DTLSv1_listen() functions. The ssl parameter should be a newly allocated SSL object with its read and write BIOs set, in the same way as might be done for a call to SSL_accept(). Typically, for DTLS, the read BIO will be in an \"unconnected\" state and thus capable of receiving messages from any peer.

                                                                                                                                      When a ClientHello is received that contains a cookie that has been verified, then these functions will return with the ssl parameter updated into a state where the handshake can be continued by a call to (for example) SSL_accept(). Additionally, for DTLSv1_listen(), the BIO_ADDR pointed to by peer will be filled in with details of the peer that sent the ClientHello. If the underlying BIO is unable to obtain the BIO_ADDR of the peer (for example because the BIO does not support this), then *peer will be cleared and the family set to AF_UNSPEC. Typically user code is expected to \"connect\" the underlying socket to the peer and continue the handshake in a connected state.

                                                                                                                                      Warning: It is essential that the calling code connects the underlying socket to the peer after making use of DTLSv1_listen(). In the typical case where BIO_s_datagram(3) is used, the peer address is updated when receiving a datagram on an unconnected socket. If the socket is not connected, it can receive datagrams from any host on the network, which will cause subsequent outgoing datagrams transmitted by DTLS to be transmitted to that host. In other words, failing to call BIO_connect() or a similar OS-specific function on a socket means that any host on the network can cause outgoing DTLS traffic to be redirected to it by sending a datagram to the socket in question. This does not break the cryptographic protections of DTLS but may facilitate a denial-of-service attack or allow unencrypted information in the DTLS handshake to be learned by an attacker. This is due to the historical design of BIO_s_datagram(3); see BIO_s_datagram(3) for details on this issue.

                                                                                                                                      Once a socket has been connected, BIO_ctrl_set_connected(3) should be used to inform the BIO that the socket is to be used in connected mode.

                                                                                                                                      Prior to calling DTLSv1_listen() user code must ensure that cookie generation and verification callbacks have been set up using SSL_CTX_set_cookie_generate_cb(3) and SSL_CTX_set_cookie_verify_cb(3) respectively. For SSL_stateless(), SSL_CTX_set_stateless_cookie_generate_cb(3) and SSL_CTX_set_stateless_cookie_verify_cb(3) must be used instead.

                                                                                                                                      Since DTLSv1_listen() operates entirely statelessly whilst processing incoming ClientHellos it is unable to process fragmented messages (since this would require the allocation of state). An implication of this is that DTLSv1_listen() only supports ClientHellos that fit inside a single datagram.

                                                                                                                                      For SSL_stateless() if an entire ClientHello message cannot be read without the \"read\" BIO becoming empty then the SSL_stateless() call will fail. It is the application's responsibility to ensure that data read from the \"read\" BIO during a single SSL_stateless() call is all from the same peer.

                                                                                                                                      SSL_stateless() will fail (with a 0 return value) if some TLS version less than TLSv1.3 is used.

                                                                                                                                      Both SSL_stateless() and DTLSv1_listen() will clear the error queue when they start.

                                                                                                                                      "},{"location":"man3/DTLSv1_listen/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      For SSL_stateless() a return value of 1 indicates success and the ssl object will be set up ready to continue the handshake. A return value of 0 or -1 indicates failure. If the value is 0 then a HelloRetryRequest was sent. A value of -1 indicates any other error. User code may retry the SSL_stateless() call.

                                                                                                                                      For DTLSv1_listen() a return value of >= 1 indicates success. The ssl object will be set up ready to continue the handshake. the peer value will also be filled in.

                                                                                                                                      A return value of 0 indicates a non-fatal error. This could (for example) be because of nonblocking IO, or some invalid message having been received from a peer. Errors may be placed on the OpenSSL error queue with further information if appropriate. Typically user code is expected to retry the call to DTLSv1_listen() in the event of a non-fatal error.

                                                                                                                                      A return value of <0 indicates a fatal error. This could (for example) be because of a failure to allocate sufficient memory for the operation.

                                                                                                                                      For DTLSv1_listen(), prior to OpenSSL 1.1.0, fatal and non-fatal errors both produce return codes <= 0 (in typical implementations user code treats all errors as non-fatal), whilst return codes >0 indicate success.

                                                                                                                                      "},{"location":"man3/DTLSv1_listen/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      SSL_CTX_set_cookie_generate_cb(3), SSL_CTX_set_cookie_verify_cb(3), SSL_CTX_set_stateless_cookie_generate_cb(3), SSL_CTX_set_stateless_cookie_verify_cb(3), SSL_get_error(3), SSL_accept(3), ssl(7), bio(7)

                                                                                                                                      "},{"location":"man3/DTLSv1_listen/#history","title":"HISTORY","text":"

                                                                                                                                      The SSL_stateless() function was added in OpenSSL 1.1.1.

                                                                                                                                      The DTLSv1_listen() return codes were clarified in OpenSSL 1.1.0. The type of \"peer\" also changed in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/DTLSv1_listen/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/","title":"ECDSA_SIG_new","text":""},{"location":"man3/ECDSA_SIG_new/#name","title":"NAME","text":"

                                                                                                                                      ECDSA_SIG_new, ECDSA_SIG_free, ECDSA_SIG_get0, ECDSA_SIG_get0_r, ECDSA_SIG_get0_s, ECDSA_SIG_set0 - Functions for creating, destroying and manipulating ECDSA_SIG objects

                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ecdsa.h>\n\nECDSA_SIG *ECDSA_SIG_new(void);\nvoid ECDSA_SIG_free(ECDSA_SIG *sig);\nvoid ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);\nconst BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig);\nconst BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig);\nint ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);\n
                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ECDSA_SIG is an opaque structure consisting of two BIGNUMs for the r and s value of an Elliptic Curve Digital Signature Algorithm (ECDSA) signature (see FIPS186-4 or X9.62). The ECDSA_SIG object was mainly used by the deprecated low level functions described in ECDSA_sign(3), it is still required in order to be able to set or get the values of r and s into or from a signature. This is mainly used for testing purposes as shown in the \"EXAMPLES\".

                                                                                                                                      ECDSA_SIG_new() allocates an empty ECDSA_SIG structure. Note: before OpenSSL 1.1.0, the r and s components were initialised.

                                                                                                                                      ECDSA_SIG_free() frees the ECDSA_SIG structure sig. If the argument is NULL, nothing is done.

                                                                                                                                      ECDSA_SIG_get0() returns internal pointers the r and s values contained in sig and stores them in *pr and *ps, respectively. The pointer pr or ps can be NULL, in which case the corresponding value is not returned.

                                                                                                                                      The values r, s can also be retrieved separately by the corresponding function ECDSA_SIG_get0_r() and ECDSA_SIG_get0_s(), respectively.

                                                                                                                                      Non-NULL r and s values can be set on the sig by calling ECDSA_SIG_set0(). Calling this function transfers the memory management of the values to the ECDSA_SIG object, and therefore the values that have been passed in should not be freed by the caller.

                                                                                                                                      See i2d_ECDSA_SIG(3) and d2i_ECDSA_SIG(3) for information about encoding and decoding ECDSA signatures to/from DER.

                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ECDSA_SIG_new() returns NULL if the allocation fails.

                                                                                                                                      ECDSA_SIG_set0() returns 1 on success or 0 on failure.

                                                                                                                                      ECDSA_SIG_get0_r() and ECDSA_SIG_get0_s() return the corresponding value, or NULL if it is unset.

                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Extract signature r and s values from a ECDSA signature of size signaturelen:

                                                                                                                                      ECDSA_SIG *obj;\nconst BIGNUM *r, *s;\n\n/* Load a signature into the ECDSA_SIG object */\nobj = d2i_ECDSA_SIG(NULL, &signature, signaturelen);\nif (obj == NULL)\n    /* error */\n\nr = ECDSA_SIG_get0_r(obj);\ns = ECDSA_SIG_get0_s(obj);\nif (r == NULL || s == NULL)\n    /* error */\n\n/* Use BN_bn2binpad() here to convert to r and s into byte arrays */\n\n/*\n * Do not try to access I<r> or I<s> after calling ECDSA_SIG_free(),\n * as they are both freed by this call.\n */\nECDSA_SIG_free(obj);\n

                                                                                                                                      Convert r and s byte arrays into an ECDSA_SIG signature of size signaturelen:

                                                                                                                                      ECDSA_SIG *obj = NULL;\nunsigned char *signature = NULL;\nsize_t signaturelen;\nBIGNUM *rbn = NULL, *sbn = NULL;\n\nobj = ECDSA_SIG_new();\nif (obj == NULL)\n    /* error */\nrbn = BN_bin2bn(r, rlen, NULL);\nsbn = BN_bin2bn(s, slen, NULL);\nif (rbn == NULL || sbn == NULL)\n    /* error */\n\nif (!ECDSA_SIG_set0(obj, rbn, sbn))\n    /* error */\n/* Set these to NULL since they are now owned by obj */\nrbn = sbn = NULL;\n\nsignaturelen = i2d_ECDSA_SIG(obj, &signature);\nif (signaturelen <= 0)\n    /* error */\n\n/*\n * This signature could now be passed to L<EVP_DigestVerify(3)>\n * or L<EVP_DigestVerifyFinal(3)>\n */\n\nBN_free(rbn);\nBN_free(sbn);\nOPENSSL_free(signature);\nECDSA_SIG_free(obj);\n
                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                      ANSI X9.62, US Federal Information Processing Standard FIPS186-4 (Digital Signature Standard, DSS)

                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EC_KEY_new(3), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3), EVP_PKEY_sign(3) i2d_ECDSA_SIG(3), d2i_ECDSA_SIG(3), ECDSA_sign(3)

                                                                                                                                      "},{"location":"man3/ECDSA_SIG_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ECDSA_sign/","title":"ECDSA_sign","text":""},{"location":"man3/ECDSA_sign/#name","title":"NAME","text":"

                                                                                                                                      ECDSA_size, ECDSA_sign, ECDSA_do_sign, ECDSA_verify, ECDSA_do_verify, ECDSA_sign_setup, ECDSA_sign_ex, ECDSA_do_sign_ex - deprecated low-level elliptic curve digital signature algorithm (ECDSA) functions

                                                                                                                                      "},{"location":"man3/ECDSA_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ecdsa.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int ECDSA_size(const EC_KEY *eckey);\n\nint ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,\n               unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);\nECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len,\n                         EC_KEY *eckey);\n\nint ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,\n                 const unsigned char *sig, int siglen, EC_KEY *eckey);\nint ECDSA_do_verify(const unsigned char *dgst, int dgst_len,\n                    const ECDSA_SIG *sig, EC_KEY* eckey);\n\nECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,\n                            const BIGNUM *kinv, const BIGNUM *rp,\n                            EC_KEY *eckey);\nint ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp);\nint ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,\n                  unsigned char *sig, unsigned int *siglen,\n                  const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);\n
                                                                                                                                      "},{"location":"man3/ECDSA_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                      See ECDSA_SIG_new(3) for a description of the ECDSA_SIG object.

                                                                                                                                      See i2d_ECDSA_SIG(3) and d2i_ECDSA_SIG(3) for information about encoding and decoding ECDSA signatures to/from DER.

                                                                                                                                      All of the functions described below are deprecated. Applications should use the higher level EVP interface such as EVP_DigestSignInit(3) or EVP_DigestVerifyInit(3) instead.

                                                                                                                                      ECDSA_size() returns the maximum length of a DER encoded ECDSA signature created with the private EC key eckey. To obtain the actual signature size use EVP_PKEY_sign(3) with a NULL sig parameter.

                                                                                                                                      ECDSA_sign() computes a digital signature of the dgstlen bytes hash value dgst using the private EC key eckey. The DER encoded signatures is stored in sig and its length is returned in sig_len. Note: sig must point to ECDSA_size(eckey) bytes of memory. The parameter type is currently ignored. ECDSA_sign() is wrapper function for ECDSA_sign_ex() with kinv and rp set to NULL.

                                                                                                                                      ECDSA_do_sign() is similar to ECDSA_sign() except the signature is returned as a newly allocated ECDSA_SIG structure (or NULL on error). ECDSA_do_sign() is a wrapper function for ECDSA_do_sign_ex() with kinv and rp set to NULL.

                                                                                                                                      ECDSA_verify() verifies that the signature in sig of size siglen is a valid ECDSA signature of the hash value dgst of size dgstlen using the public key eckey. The parameter type is ignored.

                                                                                                                                      ECDSA_do_verify() is similar to ECDSA_verify() except the signature is presented in the form of a pointer to an ECDSA_SIG structure.

                                                                                                                                      The remaining functions utilise the internal kinv and r values used during signature computation. Most applications will never need to call these and some external ECDSA ENGINE implementations may not support them at all if either kinv or r is not NULL.

                                                                                                                                      ECDSA_sign_setup() may be used to precompute parts of the signing operation. eckey is the private EC key and ctx is a pointer to BN_CTX structure (or NULL). The precomputed values or returned in kinv and rp and can be used in a later call to ECDSA_sign_ex() or ECDSA_do_sign_ex().

                                                                                                                                      ECDSA_sign_ex() computes a digital signature of the dgstlen bytes hash value dgst using the private EC key eckey and the optional pre-computed values kinv and rp. The DER encoded signature is stored in sig and its length is returned in sig_len. Note: sig must point to ECDSA_size(eckey) bytes of memory. The parameter type is ignored.

                                                                                                                                      ECDSA_do_sign_ex() is similar to ECDSA_sign_ex() except the signature is returned as a newly allocated ECDSA_SIG structure (or NULL on error).

                                                                                                                                      "},{"location":"man3/ECDSA_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ECDSA_size() returns the maximum length signature or 0 on error.

                                                                                                                                      ECDSA_sign(), ECDSA_sign_ex() and ECDSA_sign_setup() return 1 if successful or 0 on error.

                                                                                                                                      ECDSA_do_sign() and ECDSA_do_sign_ex() return a pointer to an allocated ECDSA_SIG structure or NULL on error.

                                                                                                                                      ECDSA_verify() and ECDSA_do_verify() return 1 for a valid signature, 0 for an invalid signature and -1 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                      "},{"location":"man3/ECDSA_sign/#examples","title":"EXAMPLES","text":"

                                                                                                                                      Creating an ECDSA signature of a given SHA-256 hash value using the named curve prime256v1 (aka P-256). This example uses deprecated functionality. See \"DESCRIPTION\".

                                                                                                                                      First step: create an EC_KEY object (note: this part is not ECDSA specific)

                                                                                                                                      int ret;\nECDSA_SIG *sig;\nEC_KEY *eckey;\n\neckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);\nif (eckey == NULL)\n    /* error */\nif (EC_KEY_generate_key(eckey) == 0)\n    /* error */\n

                                                                                                                                      Second step: compute the ECDSA signature of a SHA-256 hash value using ECDSA_do_sign():

                                                                                                                                      sig = ECDSA_do_sign(digest, 32, eckey);\nif (sig == NULL)\n    /* error */\n

                                                                                                                                      or using ECDSA_sign():

                                                                                                                                      unsigned char *buffer, *pp;\nint buf_len;\n\nbuf_len = ECDSA_size(eckey);\nbuffer = OPENSSL_malloc(buf_len);\npp = buffer;\nif (ECDSA_sign(0, dgst, dgstlen, pp, &buf_len, eckey) == 0)\n    /* error */\n

                                                                                                                                      Third step: verify the created ECDSA signature using ECDSA_do_verify():

                                                                                                                                      ret = ECDSA_do_verify(digest, 32, sig, eckey);\n

                                                                                                                                      or using ECDSA_verify():

                                                                                                                                      ret = ECDSA_verify(0, digest, 32, buffer, buf_len, eckey);\n

                                                                                                                                      and finally evaluate the return value:

                                                                                                                                      if (ret == 1)\n    /* signature ok */\nelse if (ret == 0)\n    /* incorrect signature */\nelse\n    /* error */\n
                                                                                                                                      "},{"location":"man3/ECDSA_sign/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                      ANSI X9.62, US Federal Information Processing Standard FIPS186-2 (Digital Signature Standard, DSS)

                                                                                                                                      "},{"location":"man3/ECDSA_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EC_KEY_new(3), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3), EVP_PKEY_sign(3) i2d_ECDSA_SIG(3), d2i_ECDSA_SIG(3)

                                                                                                                                      "},{"location":"man3/ECDSA_sign/#history","title":"HISTORY","text":"

                                                                                                                                      All functionality described here was deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ECDSA_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ECPKParameters_print/","title":"ECPKParameters_print","text":""},{"location":"man3/ECPKParameters_print/#name","title":"NAME","text":"

                                                                                                                                      ECPKParameters_print, ECPKParameters_print_fp - Functions for decoding and encoding ASN1 representations of elliptic curve entities

                                                                                                                                      "},{"location":"man3/ECPKParameters_print/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);\nint ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);\n
                                                                                                                                      "},{"location":"man3/ECPKParameters_print/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_print_params(3)

                                                                                                                                      The ECPKParameters represent the public parameters for an EC_GROUP structure, which represents a curve.

                                                                                                                                      The ECPKParameters_print() and ECPKParameters_print_fp() functions print a human-readable output of the public parameters of the EC_GROUP to bp or fp. The output lines are indented by off spaces.

                                                                                                                                      "},{"location":"man3/ECPKParameters_print/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ECPKParameters_print() and ECPKParameters_print_fp() return 1 for success and 0 if an error occurs.

                                                                                                                                      "},{"location":"man3/ECPKParameters_print/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3),

                                                                                                                                      "},{"location":"man3/ECPKParameters_print/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ECPKParameters_print/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EC_GFp_simple_method/","title":"EC_GFp_simple_method","text":""},{"location":"man3/EC_GFp_simple_method/#name","title":"NAME","text":"

                                                                                                                                      EC_GFp_simple_method, EC_GFp_mont_method, EC_GFp_nist_method, EC_GFp_nistp224_method, EC_GFp_nistp256_method, EC_GFp_nistp521_method, EC_GF2m_simple_method, EC_METHOD_get_field_type - Functions for obtaining EC_METHOD objects

                                                                                                                                      "},{"location":"man3/EC_GFp_simple_method/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      const EC_METHOD *EC_GFp_simple_method(void);\nconst EC_METHOD *EC_GFp_mont_method(void);\nconst EC_METHOD *EC_GFp_nist_method(void);\nconst EC_METHOD *EC_GFp_nistp224_method(void);\nconst EC_METHOD *EC_GFp_nistp256_method(void);\nconst EC_METHOD *EC_GFp_nistp521_method(void);\n\nconst EC_METHOD *EC_GF2m_simple_method(void);\n\nint EC_METHOD_get_field_type(const EC_METHOD *meth);\n
                                                                                                                                      "},{"location":"man3/EC_GFp_simple_method/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All const EC_METHOD *EC_GF* functions were deprecated in OpenSSL 3.0, since EC_METHOD is no longer a public concept.

                                                                                                                                      The Elliptic Curve library provides a number of different implementations through a single common interface. When constructing a curve using EC_GROUP_new (see EC_GROUP_new(3)) an implementation method must be provided. The functions described here all return a const pointer to an EC_METHOD structure that can be passed to EC_GROUP_NEW. It is important that the correct implementation type for the form of curve selected is used.

                                                                                                                                      For F2^m curves there is only one implementation choice, i.e. EC_GF2_simple_method.

                                                                                                                                      For Fp curves the lowest common denominator implementation is the EC_GFp_simple_method implementation. All other implementations are based on this one. EC_GFp_mont_method builds on EC_GFp_simple_method but adds the use of montgomery multiplication (see BN_mod_mul_montgomery(3)). EC_GFp_nist_method offers an implementation optimised for use with NIST recommended curves (NIST curves are available through EC_GROUP_new_by_curve_name as described in EC_GROUP_new(3)).

                                                                                                                                      The functions EC_GFp_nistp224_method, EC_GFp_nistp256_method and EC_GFp_nistp521_method offer 64 bit optimised implementations for the NIST P224, P256 and P521 curves respectively. Note, however, that these implementations are not available on all platforms.

                                                                                                                                      EC_METHOD_get_field_type() was deprecated in OpenSSL 3.0. Applications should use EC_GROUP_get_field_type() as a replacement (see EC_GROUP_copy(3)).

                                                                                                                                      "},{"location":"man3/EC_GFp_simple_method/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      All EC_GFp* functions and EC_GF2m_simple_method always return a const pointer to an EC_METHOD structure.

                                                                                                                                      EC_METHOD_get_field_type returns an integer that identifies the type of field the EC_METHOD structure supports.

                                                                                                                                      "},{"location":"man3/EC_GFp_simple_method/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), d2i_ECPKParameters(3), BN_mod_mul_montgomery(3)

                                                                                                                                      "},{"location":"man3/EC_GFp_simple_method/#history","title":"HISTORY","text":"

                                                                                                                                      EC_GFp_simple_method(), EC_GFp_mont_method(void), EC_GFp_nist_method(), EC_GFp_nistp224_method(), EC_GFp_nistp256_method(), EC_GFp_nistp521_method(), EC_GF2m_simple_method(), and EC_METHOD_get_field_type() were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/EC_GFp_simple_method/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EC_GROUP_copy/","title":"EC_GROUP_copy","text":""},{"location":"man3/EC_GROUP_copy/#name","title":"NAME","text":"

                                                                                                                                      EC_GROUP_get0_order, EC_GROUP_order_bits, EC_GROUP_get0_cofactor, EC_GROUP_copy, EC_GROUP_dup, EC_GROUP_method_of, EC_GROUP_set_generator, EC_GROUP_get0_generator, EC_GROUP_get_order, EC_GROUP_get_cofactor, EC_GROUP_set_curve_name, EC_GROUP_get_curve_name, EC_GROUP_set_asn1_flag, EC_GROUP_get_asn1_flag, EC_GROUP_set_point_conversion_form, EC_GROUP_get_point_conversion_form, EC_GROUP_get0_seed, EC_GROUP_get_seed_len, EC_GROUP_set_seed, EC_GROUP_get_degree, EC_GROUP_check, EC_GROUP_check_named_curve, EC_GROUP_check_discriminant, EC_GROUP_cmp, EC_GROUP_get_basis_type, EC_GROUP_get_trinomial_basis, EC_GROUP_get_pentanomial_basis, EC_GROUP_get0_field, EC_GROUP_get_field_type - Functions for manipulating EC_GROUP objects

                                                                                                                                      "},{"location":"man3/EC_GROUP_copy/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n\nint EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);\nEC_GROUP *EC_GROUP_dup(const EC_GROUP *src);\n\nint EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,\n                           const BIGNUM *order, const BIGNUM *cofactor);\nconst EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);\n\nint EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);\nconst BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group);\nint EC_GROUP_order_bits(const EC_GROUP *group);\nint EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx);\nconst BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group);\nconst BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group);\n\nvoid EC_GROUP_set_curve_name(EC_GROUP *group, int nid);\nint EC_GROUP_get_curve_name(const EC_GROUP *group);\n\nvoid EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);\nint EC_GROUP_get_asn1_flag(const EC_GROUP *group);\n\nvoid EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);\npoint_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *group);\n\nunsigned char *EC_GROUP_get0_seed(const EC_GROUP *group);\nsize_t EC_GROUP_get_seed_len(const EC_GROUP *group);\nsize_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *, size_t len);\n\nint EC_GROUP_get_degree(const EC_GROUP *group);\n\nint EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);\nint EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only,\n                               BN_CTX *ctx);\n\nint EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);\n\nint EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);\n\nint EC_GROUP_get_basis_type(const EC_GROUP *group);\nint EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k);\nint EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1,\n                                   unsigned int *k2, unsigned int *k3);\n\nint EC_GROUP_get_field_type(const EC_GROUP *group);\n

                                                                                                                                      The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);\n
                                                                                                                                      "},{"location":"man3/EC_GROUP_copy/#description","title":"DESCRIPTION","text":"

                                                                                                                                      EC_GROUP_copy() copies the curve src into dst. Both src and dst must use the same EC_METHOD.

                                                                                                                                      EC_GROUP_dup() creates a new EC_GROUP object and copies the content from src to the newly created EC_GROUP object.

                                                                                                                                      EC_GROUP_method_of() obtains the EC_METHOD of group. This function was deprecated in OpenSSL 3.0, since EC_METHOD is no longer a public concept.

                                                                                                                                      EC_GROUP_set_generator() sets curve parameters that must be agreed by all participants using the curve. These parameters include the generator, the order and the cofactor. The generator is a well defined point on the curve chosen for cryptographic operations. Integers used for point multiplications will be between 0 and n-1 where n is the order. The order multiplied by the cofactor gives the number of points on the curve.

                                                                                                                                      EC_GROUP_get0_generator() returns the generator for the identified group.

                                                                                                                                      EC_GROUP_get_order() retrieves the order of group and copies its value into order. It fails in case group is not fully initialized (i.e., its order is not set or set to zero).

                                                                                                                                      EC_GROUP_get_cofactor() retrieves the cofactor of group and copies its value into cofactor. It fails in case group is not fully initialized or if the cofactor is not set (or set to zero).

                                                                                                                                      The functions EC_GROUP_set_curve_name() and EC_GROUP_get_curve_name(), set and get the NID for the curve respectively (see EC_GROUP_new(3)). If a curve does not have a NID associated with it, then EC_GROUP_get_curve_name will return NID_undef.

                                                                                                                                      The asn1_flag value is used to determine whether the curve encoding uses explicit parameters or a named curve using an ASN1 OID: many applications only support the latter form. If asn1_flag is OPENSSL_EC_NAMED_CURVE then the named curve form is used and the parameters must have a corresponding named curve NID set. If asn1_flags is OPENSSL_EC_EXPLICIT_CURVE the parameters are explicitly encoded. The functions EC_GROUP_get_asn1_flag() and EC_GROUP_set_asn1_flag() get and set the status of the asn1_flag for the curve. Note: OPENSSL_EC_EXPLICIT_CURVE was added in OpenSSL 1.1.0, for previous versions of OpenSSL the value 0 must be used instead. Before OpenSSL 1.1.0 the default form was to use explicit parameters (meaning that applications would have to explicitly set the named curve form) in OpenSSL 1.1.0 and later the named curve form is the default.

                                                                                                                                      The point_conversion_form for a curve controls how EC_POINT data is encoded as ASN1 as defined in X9.62 (ECDSA). point_conversion_form_t is an enum defined as follows:

                                                                                                                                      typedef enum {\n       /** the point is encoded as z||x, where the octet z specifies\n        *   which solution of the quadratic equation y is  */\n       POINT_CONVERSION_COMPRESSED = 2,\n       /** the point is encoded as z||x||y, where z is the octet 0x04  */\n       POINT_CONVERSION_UNCOMPRESSED = 4,\n       /** the point is encoded as z||x||y, where the octet z specifies\n        *  which solution of the quadratic equation y is  */\n       POINT_CONVERSION_HYBRID = 6\n} point_conversion_form_t;\n

                                                                                                                                      For POINT_CONVERSION_UNCOMPRESSED the point is encoded as an octet signifying the UNCOMPRESSED form has been used followed by the octets for x, followed by the octets for y.

                                                                                                                                      For any given x coordinate for a point on a curve it is possible to derive two possible y values. For POINT_CONVERSION_COMPRESSED the point is encoded as an octet signifying that the COMPRESSED form has been used AND which of the two possible solutions for y has been used, followed by the octets for x.

                                                                                                                                      For POINT_CONVERSION_HYBRID the point is encoded as an octet signifying the HYBRID form has been used AND which of the two possible solutions for y has been used, followed by the octets for x, followed by the octets for y.

                                                                                                                                      The functions EC_GROUP_set_point_conversion_form() and EC_GROUP_get_point_conversion_form(), set and get the point_conversion_form for the curve respectively.

                                                                                                                                      ANSI X9.62 (ECDSA standard) defines a method of generating the curve parameter b from a random number. This provides advantages in that a parameter obtained in this way is highly unlikely to be susceptible to special purpose attacks, or have any trapdoors in it. If the seed is present for a curve then the b parameter was generated in a verifiable fashion using that seed. The OpenSSL EC library does not use this seed value but does enable you to inspect it using EC_GROUP_get0_seed(). This returns a pointer to a memory block containing the seed that was used. The length of the memory block can be obtained using EC_GROUP_get_seed_len(). A number of the built-in curves within the library provide seed values that can be obtained. It is also possible to set a custom seed using EC_GROUP_set_seed() and passing a pointer to a memory block, along with the length of the seed. Again, the EC library will not use this seed value, although it will be preserved in any ASN1 based communications.

                                                                                                                                      EC_GROUP_get_degree() gets the degree of the field. For Fp fields this will be the number of bits in p. For F2^m fields this will be the value m.

                                                                                                                                      EC_GROUP_get_field_type() identifies what type of field the EC_GROUP structure supports, which will be either F2^m or Fp.

                                                                                                                                      The function EC_GROUP_check_discriminant() calculates the discriminant for the curve and verifies that it is valid. For a curve defined over Fp the discriminant is given by the formula 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is simply b. In either case for the curve to be valid the discriminant must be non zero.

                                                                                                                                      The function EC_GROUP_check() behaves in the following way: For the OpenSSL default provider it performs a number of checks on a curve to verify that it is valid. Checks performed include verifying that the discriminant is non zero; that a generator has been defined; that the generator is on the curve and has the correct order. For the OpenSSL FIPS provider it uses EC_GROUP_check_named_curve() to conform to SP800-56Ar3.

                                                                                                                                      The function EC_GROUP_check_named_curve() determines if the group's domain parameters match one of the built-in curves supported by the library. The curve name is returned as a NID if it matches. If the group's domain parameters have been modified then no match will be found. If the curve name of the given group is NID_undef (e.g. it has been created by using explicit parameters with no curve name), then this method can be used to lookup the name of the curve that matches the group domain parameters. The built-in curves contain aliases, so that multiple NID's can map to the same domain parameters. For such curves it is unspecified which of the aliases will be returned if the curve name of the given group is NID_undef. If nist_only is 1 it will only look for NIST approved curves, otherwise it searches all built-in curves. This function may be passed a BN_CTX object in the ctx parameter. The ctx parameter may be NULL.

                                                                                                                                      EC_GROUP_cmp() compares a and b to determine whether they represent the same curve or not.

                                                                                                                                      The functions EC_GROUP_get_basis_type(), EC_GROUP_get_trinomial_basis() and EC_GROUP_get_pentanomial_basis() should only be called for curves defined over an F2^m field. Addition and multiplication operations within an F2^m field are performed using an irreducible polynomial function f(x). This function is either a trinomial of the form:

                                                                                                                                      f(x) = x^m + x^k + 1 with m > k >= 1

                                                                                                                                      or a pentanomial of the form:

                                                                                                                                      f(x) = x^m + x^k3 + x^k2 + x^k1 + 1 with m > k3 > k2 > k1 >= 1

                                                                                                                                      The function EC_GROUP_get_basis_type() returns a NID identifying whether a trinomial or pentanomial is in use for the field. The function EC_GROUP_get_trinomial_basis() must only be called where f(x) is of the trinomial form, and returns the value of k. Similarly the function EC_GROUP_get_pentanomial_basis() must only be called where f(x) is of the pentanomial form, and returns the values of k1, k2 and k3 respectively.

                                                                                                                                      "},{"location":"man3/EC_GROUP_copy/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The following functions return 1 on success or 0 on error: EC_GROUP_copy(), EC_GROUP_set_generator(), EC_GROUP_check(), EC_GROUP_check_discriminant(), EC_GROUP_get_trinomial_basis() and EC_GROUP_get_pentanomial_basis().

                                                                                                                                      EC_GROUP_dup() returns a pointer to the duplicated curve, or NULL on error.

                                                                                                                                      EC_GROUP_method_of() returns the EC_METHOD implementation in use for the given curve or NULL on error.

                                                                                                                                      EC_GROUP_get0_generator() returns the generator for the given curve or NULL on error.

                                                                                                                                      EC_GROUP_get_order() returns 0 if the order is not set (or set to zero) for group or if copying into order fails, 1 otherwise.

                                                                                                                                      EC_GROUP_get_cofactor() returns 0 if the cofactor is not set (or is set to zero) for group or if copying into cofactor fails, 1 otherwise.

                                                                                                                                      EC_GROUP_get_curve_name() returns the curve name (NID) for group or will return NID_undef if no curve name is associated.

                                                                                                                                      EC_GROUP_get_asn1_flag() returns the ASN1 flag for the specified group .

                                                                                                                                      EC_GROUP_get_point_conversion_form() returns the point_conversion_form for group.

                                                                                                                                      EC_GROUP_get_degree() returns the degree for group or 0 if the operation is not supported by the underlying group implementation.

                                                                                                                                      EC_GROUP_get_field_type() returns either NID_X9_62_prime_field for prime curves or NID_X9_62_characteristic_two_field for binary curves; these values are defined in the <openssl/obj_mac.h> header file.

                                                                                                                                      EC_GROUP_check_named_curve() returns the nid of the matching named curve, otherwise it returns 0 for no match, or -1 on error.

                                                                                                                                      EC_GROUP_get0_order() returns an internal pointer to the group order. EC_GROUP_order_bits() returns the number of bits in the group order. EC_GROUP_get0_cofactor() returns an internal pointer to the group cofactor. EC_GROUP_get0_field() returns an internal pointer to the group field. For curves over GF(p), this is the modulus; for curves over GF(2^m), this is the irreducible polynomial defining the field.

                                                                                                                                      EC_GROUP_get0_seed() returns a pointer to the seed that was used to generate the parameter b, or NULL if the seed is not specified. EC_GROUP_get_seed_len() returns the length of the seed or 0 if the seed is not specified.

                                                                                                                                      EC_GROUP_set_seed() returns the length of the seed that has been set. If the supplied seed is NULL, or the supplied seed length is 0, the return value will be 1. On error 0 is returned.

                                                                                                                                      EC_GROUP_cmp() returns 0 if the curves are equal, 1 if they are not equal, or -1 on error.

                                                                                                                                      EC_GROUP_get_basis_type() returns the values NID_X9_62_tpBasis or NID_X9_62_ppBasis (as defined in <openssl/obj_mac.h>) for a trinomial or pentanomial respectively. Alternatively in the event of an error a 0 is returned.

                                                                                                                                      "},{"location":"man3/EC_GROUP_copy/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), EC_GROUP_new(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)

                                                                                                                                      "},{"location":"man3/EC_GROUP_copy/#history","title":"HISTORY","text":"

                                                                                                                                      EC_GROUP_method_of() was deprecated in OpenSSL 3.0. EC_GROUP_get0_field(), EC_GROUP_check_named_curve() and EC_GROUP_get_field_type() were added in OpenSSL 3.0. EC_GROUP_get0_order(), EC_GROUP_order_bits() and EC_GROUP_get0_cofactor() were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/EC_GROUP_copy/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EC_GROUP_new/","title":"EC_GROUP_new","text":""},{"location":"man3/EC_GROUP_new/#name","title":"NAME","text":"

                                                                                                                                      EC_GROUP_get_ecparameters, EC_GROUP_get_ecpkparameters, EC_GROUP_new_from_params, EC_GROUP_new_from_ecparameters, EC_GROUP_new_from_ecpkparameters, EC_GROUP_new, EC_GROUP_free, EC_GROUP_clear_free, EC_GROUP_new_curve_GFp, EC_GROUP_new_curve_GF2m, EC_GROUP_new_by_curve_name_ex, EC_GROUP_new_by_curve_name, EC_GROUP_set_curve, EC_GROUP_get_curve, EC_GROUP_set_curve_GFp, EC_GROUP_get_curve_GFp, EC_GROUP_set_curve_GF2m, EC_GROUP_get_curve_GF2m, EC_get_builtin_curves, OSSL_EC_curve_nid2name - Functions for creating and destroying EC_GROUP objects

                                                                                                                                      "},{"location":"man3/EC_GROUP_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n\nEC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[],\n                                   OSSL_LIB_CTX *libctx, const char *propq);\nEC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params);\nEC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params);\nvoid EC_GROUP_free(EC_GROUP *group);\n\nEC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,\n                                 const BIGNUM *b, BN_CTX *ctx);\nEC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,\n                                  const BIGNUM *b, BN_CTX *ctx);\nEC_GROUP *EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX *libctx, const char *propq,\n                                        int nid);\nEC_GROUP *EC_GROUP_new_by_curve_name(int nid);\n\nint EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a,\n                       const BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,\n                       BN_CTX *ctx);\n\nECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group,\n                                        ECPARAMETERS *params);\nECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group,\n                                            ECPKPARAMETERS *params);\n\nsize_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);\nconst char *OSSL_EC_curve_nid2name(int nid);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);\nvoid EC_GROUP_clear_free(EC_GROUP *group);\n\nint EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p,\n                           const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p,\n                           BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p,\n                            const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\nint EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p,\n                            BIGNUM *a, BIGNUM *b, BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/EC_GROUP_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      Within the library there are two forms of elliptic curve that are of interest. The first form is those defined over the prime field Fp. The elements of Fp are the integers 0 to p-1, where p is a prime number. This gives us a revised elliptic curve equation as follows:

                                                                                                                                      y^2 mod p = x^3 +ax + b mod p

                                                                                                                                      The second form is those defined over a binary field F2^m where the elements of the field are integers of length at most m bits. For this form the elliptic curve equation is modified to:

                                                                                                                                      y^2 + xy = x^3 + ax^2 + b (where b != 0)

                                                                                                                                      Operations in a binary field are performed relative to an irreducible polynomial. All such curves with OpenSSL use a trinomial or a pentanomial for this parameter.

                                                                                                                                      Although deprecated since OpenSSL 3.0 and should no longer be used, a new curve can be constructed by calling EC_GROUP_new(), using the implementation provided by meth (see EC_GFp_simple_method(3)) and associated with the library context ctx (see OSSL_LIB_CTX(3)). The ctx parameter may be NULL in which case the default library context is used. It is then necessary to call EC_GROUP_set_curve() to set the curve parameters. Applications should instead use one of the other EC_GROUP_new_* constructors.

                                                                                                                                      EC_GROUP_new_from_params() creates a group with parameters specified by params. The library context libctx (see OSSL_LIB_CTX(3)) and property query string propq are used to fetch algorithms from providers. params may be either a list of explicit params or a named group, The values for ctx and propq may be NULL. The params that can be used are described in EVP_PKEY-EC(7).

                                                                                                                                      EC_GROUP_new_from_ecparameters() will create a group from the specified params and EC_GROUP_new_from_ecpkparameters() will create a group from the specific PK params.

                                                                                                                                      EC_GROUP_set_curve() sets the curve parameters p, a and b. For a curve over Fp p is the prime for the field. For a curve over F2^m p represents the irreducible polynomial - each bit represents a term in the polynomial. Therefore, there will either be three or five bits set dependent on whether the polynomial is a trinomial or a pentanomial. In either case, a and b represents the coefficients a and b from the relevant equation introduced above.

                                                                                                                                      EC_group_get_curve() obtains the previously set curve parameters.

                                                                                                                                      EC_GROUP_set_curve_GFp() and EC_GROUP_set_curve_GF2m() are synonyms for EC_GROUP_set_curve(). They are defined for backwards compatibility only and should not be used.

                                                                                                                                      EC_GROUP_get_curve_GFp() and EC_GROUP_get_curve_GF2m() are synonyms for EC_GROUP_get_curve(). They are defined for backwards compatibility only and should not be used.

                                                                                                                                      The functions EC_GROUP_new_curve_GFp() and EC_GROUP_new_curve_GF2m() are shortcuts for calling EC_GROUP_new() and then the EC_GROUP_set_curve() function. An appropriate default implementation method will be used.

                                                                                                                                      Whilst the library can be used to create any curve using the functions described above, there are also a number of predefined curves that are available. In order to obtain a list of all of the predefined curves, call the function EC_get_builtin_curves(). The parameter r should be an array of EC_builtin_curve structures of size nitems. The function will populate the r array with information about the built-in curves. If nitems is less than the total number of curves available, then the first nitems curves will be returned. Otherwise the total number of curves will be provided. The return value is the total number of curves available (whether that number has been populated in r or not). Passing a NULL r, or setting nitems to 0 will do nothing other than return the total number of curves available. The EC_builtin_curve structure is defined as follows:

                                                                                                                                      typedef struct {\n       int nid;\n       const char *comment;\n       } EC_builtin_curve;\n

                                                                                                                                      Each EC_builtin_curve item has a unique integer id (nid), and a human readable comment string describing the curve.

                                                                                                                                      In order to construct a built-in curve use the function EC_GROUP_new_by_curve_name_ex() and provide the nid of the curve to be constructed, the associated library context to be used in ctx (see OSSL_LIB_CTX(3)) and any property query string in propq. The ctx value may be NULL in which case the default library context is used. The propq value may also be NULL.

                                                                                                                                      EC_GROUP_new_by_curve_name() is the same as EC_GROUP_new_by_curve_name_ex() except that the default library context is always used along with a NULL property query string.

                                                                                                                                      EC_GROUP_free() frees the memory associated with the EC_GROUP. If group is NULL nothing is done.

                                                                                                                                      EC_GROUP_clear_free() is deprecated: it was meant to destroy any sensitive data held within the EC_GROUP and then free its memory, but since all the data stored in the EC_GROUP is public anyway, this function is unnecessary. Its use can be safely replaced with EC_GROUP_free(). If group is NULL nothing is done.

                                                                                                                                      OSSL_EC_curve_nid2name() converts a curve nid into the corresponding name.

                                                                                                                                      "},{"location":"man3/EC_GROUP_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      All EC_GROUP_new* functions return a pointer to the newly constructed group, or NULL on error.

                                                                                                                                      EC_get_builtin_curves() returns the number of built-in curves that are available.

                                                                                                                                      EC_GROUP_set_curve_GFp(), EC_GROUP_get_curve_GFp(), EC_GROUP_set_curve_GF2m(), EC_GROUP_get_curve_GF2m() return 1 on success or 0 on error.

                                                                                                                                      OSSL_EC_curve_nid2name() returns a character string constant, or NULL on error.

                                                                                                                                      "},{"location":"man3/EC_GROUP_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3), OSSL_LIB_CTX(3), EVP_PKEY-EC(7)

                                                                                                                                      "},{"location":"man3/EC_GROUP_new/#history","title":"HISTORY","text":"
                                                                                                                                      • EC_GROUP_new() was deprecated in OpenSSL 3.0.

                                                                                                                                        EC_GROUP_new_by_curve_name_ex() and EC_GROUP_new_from_params() were added in OpenSSL 3.0.

                                                                                                                                      • EC_GROUP_clear_free() was deprecated in OpenSSL 3.0; use EC_GROUP_free() instead. -

                                                                                                                                        EC_GROUP_set_curve_GFp(), EC_GROUP_get_curve_GFp(),\nEC_GROUP_set_curve_GF2m() and EC_GROUP_get_curve_GF2m() were deprecated in\nOpenSSL 3.0; use EC_GROUP_set_curve() and EC_GROUP_get_curve() instead.\n
                                                                                                                                      "},{"location":"man3/EC_GROUP_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EC_KEY_get_enc_flags/","title":"EC_KEY_get_enc_flags","text":""},{"location":"man3/EC_KEY_get_enc_flags/#name","title":"NAME","text":"

                                                                                                                                      EC_KEY_get_enc_flags, EC_KEY_set_enc_flags - Get and set flags for encoding EC_KEY structures

                                                                                                                                      "},{"location":"man3/EC_KEY_get_enc_flags/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n\nunsigned int EC_KEY_get_enc_flags(const EC_KEY *key);\nvoid EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);\n
                                                                                                                                      "},{"location":"man3/EC_KEY_get_enc_flags/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The format of the external representation of the public key written by i2d_ECPrivateKey() (such as whether it is stored in a compressed form or not) is described by the point_conversion_form. See EC_GROUP_copy(3) for a description of point_conversion_form.

                                                                                                                                      When reading a private key encoded without an associated public key (e.g. if EC_PKEY_NO_PUBKEY has been used - see below), then d2i_ECPrivateKey() generates the missing public key automatically. Private keys encoded without parameters (e.g. if EC_PKEY_NO_PARAMETERS has been used - see below) cannot be loaded using d2i_ECPrivateKey().

                                                                                                                                      The functions EC_KEY_get_enc_flags() and EC_KEY_set_enc_flags() get and set the value of the encoding flags for the key. There are two encoding flags currently defined - EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These flags define the behaviour of how the key is converted into ASN1 in a call to i2d_ECPrivateKey(). If EC_PKEY_NO_PARAMETERS is set then the public parameters for the curve are not encoded along with the private key. If EC_PKEY_NO_PUBKEY is set then the public key is not encoded along with the private key.

                                                                                                                                      "},{"location":"man3/EC_KEY_get_enc_flags/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      EC_KEY_get_enc_flags() returns the value of the current encoding flags for the EC_KEY.

                                                                                                                                      "},{"location":"man3/EC_KEY_get_enc_flags/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3), d2i_ECPrivateKey(3)

                                                                                                                                      "},{"location":"man3/EC_KEY_get_enc_flags/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EC_KEY_new/","title":"EC_KEY_new","text":""},{"location":"man3/EC_KEY_new/#name","title":"NAME","text":"

                                                                                                                                      EVP_EC_gen, EC_KEY_get_method, EC_KEY_set_method, EC_KEY_new_ex, EC_KEY_new, EC_KEY_get_flags, EC_KEY_set_flags, EC_KEY_clear_flags, EC_KEY_new_by_curve_name_ex, EC_KEY_new_by_curve_name, EC_KEY_free, EC_KEY_copy, EC_KEY_dup, EC_KEY_up_ref, EC_KEY_get0_engine, EC_KEY_get0_group, EC_KEY_set_group, EC_KEY_get0_private_key, EC_KEY_set_private_key, EC_KEY_get0_public_key, EC_KEY_set_public_key, EC_KEY_get_conv_form, EC_KEY_set_conv_form, EC_KEY_set_asn1_flag, EC_KEY_decoded_from_explicit_params, EC_KEY_precompute_mult, EC_KEY_generate_key, EC_KEY_check_key, EC_KEY_set_public_key_affine_coordinates, EC_KEY_oct2key, EC_KEY_key2buf, EC_KEY_oct2priv, EC_KEY_priv2oct, EC_KEY_priv2buf - Functions for creating, destroying and manipulating EC_KEY objects

                                                                                                                                      "},{"location":"man3/EC_KEY_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n\nEVP_PKEY *EVP_EC_gen(const char *curve);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq);\nEC_KEY *EC_KEY_new(void);\nint EC_KEY_get_flags(const EC_KEY *key);\nvoid EC_KEY_set_flags(EC_KEY *key, int flags);\nvoid EC_KEY_clear_flags(EC_KEY *key, int flags);\nEC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, const char *propq,\n                                    int nid);\nEC_KEY *EC_KEY_new_by_curve_name(int nid);\nvoid EC_KEY_free(EC_KEY *key);\nEC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);\nEC_KEY *EC_KEY_dup(const EC_KEY *src);\nint EC_KEY_up_ref(EC_KEY *key);\nENGINE *EC_KEY_get0_engine(const EC_KEY *eckey);\nconst EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);\nint EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);\nconst BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);\nint EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key);\nconst EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);\nint EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);\npoint_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);\nvoid EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);\nvoid EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);\nint EC_KEY_decoded_from_explicit_params(const EC_KEY *key);\nint EC_KEY_generate_key(EC_KEY *key);\nint EC_KEY_check_key(const EC_KEY *key);\nint EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y);\nconst EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key);\nint EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth);\n\nint EC_KEY_oct2key(EC_KEY *eckey, const unsigned char *buf, size_t len, BN_CTX *ctx);\nsize_t EC_KEY_key2buf(const EC_KEY *eckey, point_conversion_form_t form,\n                      unsigned char **pbuf, BN_CTX *ctx);\n\nint EC_KEY_oct2priv(EC_KEY *eckey, const unsigned char *buf, size_t len);\nsize_t EC_KEY_priv2oct(const EC_KEY *eckey, unsigned char *buf, size_t len);\n\nsize_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf);\nint EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/EC_KEY_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      EVP_EC_gen() generates a new EC key pair on the given curve.

                                                                                                                                      All of the functions described below are deprecated. Applications should instead use EVP_EC_gen(), EVP_PKEY_Q_keygen(3), or EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3).

                                                                                                                                      An EC_KEY represents a public key and, optionally, the associated private key. A new EC_KEY with no associated curve can be constructed by calling EC_KEY_new_ex() and specifying the associated library context in ctx (see OSSL_LIB_CTX(3)) and property query string propq. The ctx parameter may be NULL in which case the default library context is used. The reference count for the newly created EC_KEY is initially set to 1. A curve can be associated with the EC_KEY by calling EC_KEY_set_group().

                                                                                                                                      EC_KEY_new() is the same as EC_KEY_new_ex() except that the default library context is always used.

                                                                                                                                      Alternatively a new EC_KEY can be constructed by calling EC_KEY_new_by_curve_name_ex() and supplying the nid of the associated curve, the library context to be used ctx (see OSSL_LIB_CTX(3)) and any property query string propq. The ctx parameter may be NULL in which case the default library context is used. The propq value may also be NULL. See EC_GROUP_new(3) for a description of curve names. This function simply wraps calls to EC_KEY_new_ex() and EC_GROUP_new_by_curve_name_ex().

                                                                                                                                      EC_KEY_new_by_curve_name() is the same as EC_KEY_new_by_curve_name_ex() except that the default library context is always used and a NULL property query string.

                                                                                                                                      Calling EC_KEY_free() decrements the reference count for the EC_KEY object, and if it has dropped to zero then frees the memory associated with it. If key is NULL nothing is done.

                                                                                                                                      EC_KEY_copy() copies the contents of the EC_KEY in src into dest.

                                                                                                                                      EC_KEY_dup() creates a new EC_KEY object and copies ec_key into it.

                                                                                                                                      EC_KEY_up_ref() increments the reference count associated with the EC_KEY object.

                                                                                                                                      EC_KEY_get0_engine() returns a handle to the ENGINE that has been set for this EC_KEY object.

                                                                                                                                      EC_KEY_generate_key() generates a new public and private key for the supplied eckey object. eckey must have an EC_GROUP object associated with it before calling this function. The private key is a random integer (0 < priv_key < order, where order is the order of the EC_GROUP object). The public key is an EC_POINT on the curve calculated by multiplying the generator for the curve by the private key.

                                                                                                                                      EC_KEY_check_key() performs various sanity checks on the EC_KEY object to confirm that it is valid.

                                                                                                                                      EC_KEY_set_public_key_affine_coordinates() sets the public key for key based on its affine coordinates; i.e., it constructs an EC_POINT object based on the supplied x and y values and sets the public key to be this EC_POINT. It also performs certain sanity checks on the key to confirm that it is valid.

                                                                                                                                      The functions EC_KEY_get0_group(), EC_KEY_set_group(), EC_KEY_get0_private_key(), EC_KEY_set_private_key(), EC_KEY_get0_public_key(), and EC_KEY_set_public_key() get and set the EC_GROUP object, the private key, and the EC_POINT public key for the key respectively. The function EC_KEY_set_private_key() accepts NULL as the priv_key argument to securely clear the private key component from the EC_KEY.

                                                                                                                                      The functions EC_KEY_get_conv_form() and EC_KEY_set_conv_form() get and set the point_conversion_form for the key. For a description of point_conversion_forms please see EC_POINT_new(3).

                                                                                                                                      EC_KEY_set_flags() sets the flags in the flags parameter on the EC_KEY object. Any flags that are already set are left set. The flags currently defined are EC_FLAG_NON_FIPS_ALLOW and EC_FLAG_FIPS_CHECKED. In addition there is the flag EC_FLAG_COFACTOR_ECDH which is specific to ECDH. EC_KEY_get_flags() returns the current flags that are set for this EC_KEY. EC_KEY_clear_flags() clears the flags indicated by the flags parameter; all other flags are left in their existing state.

                                                                                                                                      EC_KEY_set_asn1_flag() sets the asn1_flag on the underlying EC_GROUP object (if set). Refer to EC_GROUP_copy(3) for further information on the asn1_flag.

                                                                                                                                      EC_KEY_decoded_from_explicit_params() returns 1 if the group of the key was decoded from data with explicitly encoded group parameters, -1 if the key is NULL or the group parameters are missing, and 0 otherwise.

                                                                                                                                      EC_KEY_precompute_mult() stores multiples of the underlying EC_GROUP generator for faster point multiplication. See also EC_POINT_add(3). Modern versions should instead switch to named curves which OpenSSL has hardcoded lookup tables for.

                                                                                                                                      EC_KEY_oct2key() and EC_KEY_key2buf() are identical to the functions EC_POINT_oct2point() and EC_POINT_point2buf() except they use the public key EC_POINT in eckey.

                                                                                                                                      EC_KEY_oct2priv() and EC_KEY_priv2oct() convert between the private key component of eckey and octet form. The octet form consists of the content octets of the privateKey OCTET STRING in an ECPrivateKey ASN.1 structure.

                                                                                                                                      The function EC_KEY_priv2oct() must be supplied with a buffer long enough to store the octet form. The return value provides the number of octets stored. Calling the function with a NULL buffer will not perform the conversion but will just return the required buffer length.

                                                                                                                                      The function EC_KEY_priv2buf() allocates a buffer of suitable length and writes an EC_KEY to it in octet format. The allocated buffer is written to *pbuf and its length is returned. The caller must free up the allocated buffer with a call to OPENSSL_free(). Since the allocated buffer value is written to *pbuf the pbuf parameter MUST NOT be NULL.

                                                                                                                                      EC_KEY_priv2buf() converts an EC_KEY private key into an allocated buffer.

                                                                                                                                      "},{"location":"man3/EC_KEY_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      EC_KEY_new_ex(), EC_KEY_new(), EC_KEY_new_by_curve_name_ex(), EC_KEY_new_by_curve_name() and EC_KEY_dup() return a pointer to the newly created EC_KEY object, or NULL on error.

                                                                                                                                      EC_KEY_get_flags() returns the flags associated with the EC_KEY object as an integer.

                                                                                                                                      EC_KEY_copy() returns a pointer to the destination key, or NULL on error.

                                                                                                                                      EC_KEY_get0_engine() returns a pointer to an ENGINE, or NULL if it wasn't set.

                                                                                                                                      EC_KEY_up_ref(), EC_KEY_set_group(), EC_KEY_set_public_key(), EC_KEY_precompute_mult(), EC_KEY_generate_key(), EC_KEY_check_key(), EC_KEY_set_public_key_affine_coordinates(), EC_KEY_oct2key() and EC_KEY_oct2priv() return 1 on success or 0 on error.

                                                                                                                                      EC_KEY_set_private_key() returns 1 on success or 0 on error except when the priv_key argument is NULL, in that case it returns 0, for legacy compatibility, and should not be treated as an error.

                                                                                                                                      EC_KEY_get0_group() returns the EC_GROUP associated with the EC_KEY.

                                                                                                                                      EC_KEY_get0_private_key() returns the private key associated with the EC_KEY.

                                                                                                                                      EC_KEY_get_conv_form() return the point_conversion_form for the EC_KEY.

                                                                                                                                      EC_KEY_key2buf(), EC_KEY_priv2oct() and EC_KEY_priv2buf() return the length of the buffer or 0 on error.

                                                                                                                                      "},{"location":"man3/EC_KEY_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_PKEY_Q_keygen(3) crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_POINT_add(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3), OSSL_LIB_CTX(3)

                                                                                                                                      "},{"location":"man3/EC_KEY_new/#history","title":"HISTORY","text":"

                                                                                                                                      EVP_EC_gen() was added in OpenSSL 3.0. All other functions described here were deprecated in OpenSSL 3.0. For replacement see EVP_PKEY-EC(7).

                                                                                                                                      "},{"location":"man3/EC_KEY_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EC_POINT_add/","title":"EC_POINT_add","text":""},{"location":"man3/EC_POINT_add/#name","title":"NAME","text":"

                                                                                                                                      EC_POINT_add, EC_POINT_dbl, EC_POINT_invert, EC_POINT_is_at_infinity, EC_POINT_is_on_curve, EC_POINT_cmp, EC_POINT_make_affine, EC_POINTs_make_affine, EC_POINTs_mul, EC_POINT_mul, EC_GROUP_precompute_mult, EC_GROUP_have_precompute_mult - Functions for performing mathematical operations and tests on EC_POINT objects

                                                                                                                                      "},{"location":"man3/EC_POINT_add/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n\nint EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,\n                 const EC_POINT *b, BN_CTX *ctx);\nint EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx);\nint EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);\nint EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);\nint EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx);\nint EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);\nint EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n,\n                 const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);\nint EC_POINTs_make_affine(const EC_GROUP *group, size_t num,\n                          EC_POINT *points[], BN_CTX *ctx);\nint EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num,\n                  const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);\nint EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);\nint EC_GROUP_have_precompute_mult(const EC_GROUP *group);\n
                                                                                                                                      "},{"location":"man3/EC_POINT_add/#description","title":"DESCRIPTION","text":"

                                                                                                                                      EC_POINT_add adds the two points a and b and places the result in r. Similarly EC_POINT_dbl doubles the point a and places the result in r. In both cases it is valid for r to be one of a or b.

                                                                                                                                      EC_POINT_invert calculates the inverse of the supplied point a. The result is placed back in a.

                                                                                                                                      The function EC_POINT_is_at_infinity tests whether the supplied point is at infinity or not.

                                                                                                                                      EC_POINT_is_on_curve tests whether the supplied point is on the curve or not.

                                                                                                                                      EC_POINT_cmp compares the two supplied points and tests whether or not they are equal.

                                                                                                                                      The functions EC_POINT_make_affine and EC_POINTs_make_affine force the internal representation of the EC_POINT(s) into the affine coordinate system. In the case of EC_POINTs_make_affine the value num provides the number of points in the array points to be forced. These functions were deprecated in OpenSSL 3.0 and should no longer be used. Modern versions automatically perform this conversion when needed.

                                                                                                                                      EC_POINT_mul calculates the value generator * n + q * m and stores the result in r. The value n may be NULL in which case the result is just q * m (variable point multiplication). Alternatively, both q and m may be NULL, and n non-NULL, in which case the result is just generator * n (fixed point multiplication). When performing a single fixed or variable point multiplication, the underlying implementation uses a constant time algorithm, when the input scalar (either n or m) is in the range [0, ec_group_order).

                                                                                                                                      Although deprecated in OpenSSL 3.0 and should no longer be used, EC_POINTs_mul calculates the value generator * n + q[0] * m[0] + ... + q[num-1] * m[num-1]. As for EC_POINT_mul the value n may be NULL or num may be zero. When performing a fixed point multiplication (n is non-NULL and num is 0) or a variable point multiplication (n is NULL and num is 1), the underlying implementation uses a constant time algorithm, when the input scalar (either n or m[0]) is in the range [0, ec_group_order). Modern versions should instead use EC_POINT_mul(), combined (if needed) with EC_POINT_add() in such rare circumstances.

                                                                                                                                      The function EC_GROUP_precompute_mult stores multiples of the generator for faster point multiplication, whilst EC_GROUP_have_precompute_mult tests whether precomputation has already been done. See EC_GROUP_copy(3) for information about the generator. Precomputation functionality was deprecated in OpenSSL 3.0. Users of EC_GROUP_precompute_mult() and EC_GROUP_have_precompute_mult() should switch to named curves which OpenSSL has hardcoded lookup tables for.

                                                                                                                                      "},{"location":"man3/EC_POINT_add/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The following functions return 1 on success or 0 on error: EC_POINT_add, EC_POINT_dbl, EC_POINT_invert, EC_POINT_make_affine, EC_POINTs_make_affine, EC_POINTs_make_affine, EC_POINT_mul, EC_POINTs_mul and EC_GROUP_precompute_mult.

                                                                                                                                      EC_POINT_is_at_infinity returns 1 if the point is at infinity, or 0 otherwise.

                                                                                                                                      EC_POINT_is_on_curve returns 1 if the point is on the curve, 0 if not, or -1 on error.

                                                                                                                                      EC_POINT_cmp returns 1 if the points are not equal, 0 if they are, or -1 on error.

                                                                                                                                      EC_GROUP_have_precompute_mult return 1 if a precomputation has been done, or 0 if not.

                                                                                                                                      "},{"location":"man3/EC_POINT_add/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_new(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)

                                                                                                                                      "},{"location":"man3/EC_POINT_add/#history","title":"HISTORY","text":"

                                                                                                                                      EC_POINT_make_affine(), EC_POINTs_make_affine(), EC_POINTs_mul(), EC_GROUP_precompute_mult(), and EC_GROUP_have_precompute_mult() were deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/EC_POINT_add/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EC_POINT_new/","title":"EC_POINT_new","text":""},{"location":"man3/EC_POINT_new/#name","title":"NAME","text":"

                                                                                                                                      EC_POINT_set_Jprojective_coordinates_GFp, EC_POINT_point2buf, EC_POINT_new, EC_POINT_free, EC_POINT_clear_free, EC_POINT_copy, EC_POINT_dup, EC_POINT_method_of, EC_POINT_set_to_infinity, EC_POINT_get_Jprojective_coordinates_GFp, EC_POINT_set_affine_coordinates, EC_POINT_get_affine_coordinates, EC_POINT_set_compressed_coordinates, EC_POINT_set_affine_coordinates_GFp, EC_POINT_get_affine_coordinates_GFp, EC_POINT_set_compressed_coordinates_GFp, EC_POINT_set_affine_coordinates_GF2m, EC_POINT_get_affine_coordinates_GF2m, EC_POINT_set_compressed_coordinates_GF2m, EC_POINT_point2oct, EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point, EC_POINT_point2hex, EC_POINT_hex2point - Functions for creating, destroying and manipulating EC_POINT objects

                                                                                                                                      "},{"location":"man3/EC_POINT_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/ec.h>\n\nEC_POINT *EC_POINT_new(const EC_GROUP *group);\nvoid EC_POINT_free(EC_POINT *point);\nvoid EC_POINT_clear_free(EC_POINT *point);\nint EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);\nEC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);\nint EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);\nint EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p,\n                                    const BIGNUM *x, const BIGNUM *y,\n                                    BN_CTX *ctx);\nint EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p,\n                                    BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\nint EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p,\n                                        const BIGNUM *x, int y_bit,\n                                        BN_CTX *ctx);\nsize_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,\n                          point_conversion_form_t form,\n                          unsigned char *buf, size_t len, BN_CTX *ctx);\nsize_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point,\n                          point_conversion_form_t form,\n                          unsigned char **pbuf, BN_CTX *ctx);\nint EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,\n                       const unsigned char *buf, size_t len, BN_CTX *ctx);\nchar *EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *p,\n                         point_conversion_form_t form, BN_CTX *ctx);\nEC_POINT *EC_POINT_hex2point(const EC_GROUP *group, const char *hex,\n                             EC_POINT *p, BN_CTX *ctx);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);\nint EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group,\n                                             EC_POINT *p,\n                                             const BIGNUM *x, const BIGNUM *y,\n                                             const BIGNUM *z, BN_CTX *ctx);\nint EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,\n                                             const EC_POINT *p,\n                                             BIGNUM *x, BIGNUM *y, BIGNUM *z,\n                                             BN_CTX *ctx);\nint EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,\n                                        const BIGNUM *x, const BIGNUM *y,\n                                        BN_CTX *ctx);\nint EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,\n                                        const EC_POINT *p,\n                                        BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\nint EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group,\n                                            EC_POINT *p,\n                                            const BIGNUM *x, int y_bit,\n                                            BN_CTX *ctx);\nint EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,\n                                         const BIGNUM *x, const BIGNUM *y,\n                                         BN_CTX *ctx);\nint EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,\n                                         const EC_POINT *p,\n                                         BIGNUM *x, BIGNUM *y, BN_CTX *ctx);\nint EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,\n                                             EC_POINT *p,\n                                             const BIGNUM *x, int y_bit,\n                                             BN_CTX *ctx);\nBIGNUM *EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *p,\n                          point_conversion_form_t form, BIGNUM *bn,\n                          BN_CTX *ctx);\nEC_POINT *EC_POINT_bn2point(const EC_GROUP *group, const BIGNUM *bn,\n                            EC_POINT *p, BN_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/EC_POINT_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      An EC_POINT structure represents a point on a curve. A new point is constructed by calling the function EC_POINT_new() and providing the group object that the point relates to.

                                                                                                                                      EC_POINT_free() frees the memory associated with the EC_POINT. if point is NULL nothing is done.

                                                                                                                                      EC_POINT_clear_free() destroys any sensitive data held within the EC_POINT and then frees its memory. If point is NULL nothing is done.

                                                                                                                                      EC_POINT_copy() copies the point src into dst. Both src and dst must use the same EC_METHOD.

                                                                                                                                      EC_POINT_dup() creates a new EC_POINT object and copies the content from src to the newly created EC_POINT object.

                                                                                                                                      EC_POINT_method_of() obtains the EC_METHOD associated with point. This function was deprecated in OpenSSL 3.0, since EC_METHOD is no longer a public concept.

                                                                                                                                      A valid point on a curve is the special point at infinity. A point is set to be at infinity by calling EC_POINT_set_to_infinity().

                                                                                                                                      The affine coordinates for a point describe a point in terms of its x and y position. The function EC_POINT_set_affine_coordinates() sets the x and y coordinates for the point p defined over the curve given in group. The function EC_POINT_get_affine_coordinates() sets x and y, either of which may be NULL, to the corresponding coordinates of p.

                                                                                                                                      The functions EC_POINT_set_affine_coordinates_GFp() and EC_POINT_set_affine_coordinates_GF2m() are synonyms for EC_POINT_set_affine_coordinates(). They are defined for backwards compatibility only and should not be used.

                                                                                                                                      The functions EC_POINT_get_affine_coordinates_GFp() and EC_POINT_get_affine_coordinates_GF2m() are synonyms for EC_POINT_get_affine_coordinates(). They are defined for backwards compatibility only and should not be used.

                                                                                                                                      As well as the affine coordinates, a point can alternatively be described in terms of its Jacobian projective coordinates (for Fp curves only). Jacobian projective coordinates are expressed as three values x, y and z. Working in this coordinate system provides more efficient point multiplication operations. A mapping exists between Jacobian projective coordinates and affine coordinates. A Jacobian projective coordinate (x, y, z) can be written as an affine coordinate as (x/(z^2), y/(z^3)). Conversion to Jacobian projective from affine coordinates is simple. The coordinate (x, y) is mapped to (x, y, 1). Although deprecated in OpenSSL 3.0 and should no longer be used, to set or get the projective coordinates in older versions use EC_POINT_set_Jprojective_coordinates_GFp() and EC_POINT_get_Jprojective_coordinates_GFp() respectively. Modern versions should instead use EC_POINT_set_affine_coordinates() and EC_POINT_get_affine_coordinates(), performing the conversion manually using the above maps in such rare circumstances.

                                                                                                                                      Points can also be described in terms of their compressed coordinates. For a point (x, y), for any given value for x such that the point is on the curve there will only ever be two possible values for y. Therefore, a point can be set using the EC_POINT_set_compressed_coordinates() function where x is the x coordinate and y_bit is a value 0 or 1 to identify which of the two possible values for y should be used.

                                                                                                                                      The functions EC_POINT_set_compressed_coordinates_GFp() and EC_POINT_set_compressed_coordinates_GF2m() are synonyms for EC_POINT_set_compressed_coordinates(). They are defined for backwards compatibility only and should not be used.

                                                                                                                                      In addition EC_POINT can be converted to and from various external representations. The octet form is the binary encoding of the ECPoint structure (as defined in RFC5480 and used in certificates and TLS records): only the content octets are present, the OCTET STRING tag and length are not included. BIGNUM form is the octet form interpreted as a big endian integer converted to a BIGNUM structure. Hexadecimal form is the octet form converted to a NULL terminated character string where each character is one of the printable values 0-9 or A-F (or a-f).

                                                                                                                                      The functions EC_POINT_point2oct(), EC_POINT_oct2point(), EC_POINT_point2bn(), EC_POINT_bn2point(), EC_POINT_point2hex() and EC_POINT_hex2point() convert from and to EC_POINTs for the formats: octet, BIGNUM and hexadecimal respectively.

                                                                                                                                      The function EC_POINT_point2oct() encodes the given curve point p as an octet string into the buffer buf of size len, using the specified conversion form form. The encoding conforms with Sec. 2.3.3 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. Similarly the function EC_POINT_oct2point() decodes a curve point into p from the octet string contained in the given buffer buf of size len, conforming to Sec. 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard.

                                                                                                                                      The functions EC_POINT_point2hex() and EC_POINT_point2bn() convert a point p, respectively, to the hexadecimal or BIGNUM representation of the same encoding of the function EC_POINT_point2oct(). Vice versa, similarly to the function EC_POINT_oct2point(), the functions EC_POINT_hex2point() and EC_POINT_point2bn() decode the hexadecimal or BIGNUM representation into the EC_POINT p.

                                                                                                                                      Notice that, according to the standard, the octet string encoding of the point at infinity for a given curve is fixed to a single octet of value zero and that, vice versa, a single octet of size zero is decoded as the point at infinity.

                                                                                                                                      The function EC_POINT_point2oct() must be supplied with a buffer long enough to store the octet form. The return value provides the number of octets stored. Calling the function with a NULL buffer will not perform the conversion but will still return the required buffer length.

                                                                                                                                      The function EC_POINT_point2buf() allocates a buffer of suitable length and writes an EC_POINT to it in octet format. The allocated buffer is written to *pbuf and its length is returned. The caller must free up the allocated buffer with a call to OPENSSL_free(). Since the allocated buffer value is written to *pbuf the pbuf parameter MUST NOT be NULL.

                                                                                                                                      The function EC_POINT_point2hex() will allocate sufficient memory to store the hexadecimal string. It is the caller's responsibility to free this memory with a subsequent call to OPENSSL_free().

                                                                                                                                      "},{"location":"man3/EC_POINT_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      EC_POINT_new() and EC_POINT_dup() return the newly allocated EC_POINT or NULL on error.

                                                                                                                                      The following functions return 1 on success or 0 on error: EC_POINT_copy(), EC_POINT_set_to_infinity(), EC_POINT_set_Jprojective_coordinates_GFp(), EC_POINT_get_Jprojective_coordinates_GFp(), EC_POINT_set_affine_coordinates_GFp(), EC_POINT_get_affine_coordinates_GFp(), EC_POINT_set_compressed_coordinates_GFp(), EC_POINT_set_affine_coordinates_GF2m(), EC_POINT_get_affine_coordinates_GF2m(), EC_POINT_set_compressed_coordinates_GF2m() and EC_POINT_oct2point().

                                                                                                                                      EC_POINT_method_of returns the EC_METHOD associated with the supplied EC_POINT.

                                                                                                                                      EC_POINT_point2oct() and EC_POINT_point2buf() return the length of the required buffer or 0 on error.

                                                                                                                                      EC_POINT_point2bn() returns the pointer to the BIGNUM supplied, or NULL on error.

                                                                                                                                      EC_POINT_bn2point() returns the pointer to the EC_POINT supplied, or NULL on error.

                                                                                                                                      EC_POINT_point2hex() returns a pointer to the hex string, or NULL on error.

                                                                                                                                      EC_POINT_hex2point() returns the pointer to the EC_POINT supplied, or NULL on error.

                                                                                                                                      "},{"location":"man3/EC_POINT_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      crypto(7), EC_GROUP_new(3), EC_GROUP_copy(3), EC_POINT_add(3), EC_KEY_new(3), EC_GFp_simple_method(3), d2i_ECPKParameters(3)

                                                                                                                                      "},{"location":"man3/EC_POINT_new/#history","title":"HISTORY","text":"

                                                                                                                                      EC_POINT_method_of(), EC_POINT_set_Jprojective_coordinates_GFp(), EC_POINT_get_Jprojective_coordinates_GFp(), EC_POINT_set_affine_coordinates_GFp(), EC_POINT_get_affine_coordinates_GFp(), EC_POINT_set_compressed_coordinates_GFp(), EC_POINT_set_affine_coordinates_GF2m(), EC_POINT_get_affine_coordinates_GF2m(), EC_POINT_set_compressed_coordinates_GF2m(), EC_POINT_point2bn(), and EC_POINT_bn2point() were deprecated in OpenSSL 3.0.

                                                                                                                                      EC_POINT_set_affine_coordinates, EC_POINT_get_affine_coordinates, and EC_POINT_set_compressed_coordinates were added in OpenSSL 1.1.1.

                                                                                                                                      "},{"location":"man3/EC_POINT_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2013-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ENGINE_add/","title":"ENGINE_add","text":""},{"location":"man3/ENGINE_add/#name","title":"NAME","text":"

                                                                                                                                      ENGINE_get_DH, ENGINE_get_DSA, ENGINE_by_id, ENGINE_get_cipher_engine, ENGINE_get_default_DH, ENGINE_get_default_DSA, ENGINE_get_default_RAND, ENGINE_get_default_RSA, ENGINE_get_digest_engine, ENGINE_get_first, ENGINE_get_last, ENGINE_get_next, ENGINE_get_prev, ENGINE_new, ENGINE_get_ciphers, ENGINE_get_ctrl_function, ENGINE_get_digests, ENGINE_get_destroy_function, ENGINE_get_finish_function, ENGINE_get_init_function, ENGINE_get_load_privkey_function, ENGINE_get_load_pubkey_function, ENGINE_load_private_key, ENGINE_load_public_key, ENGINE_get_RAND, ENGINE_get_RSA, ENGINE_get_id, ENGINE_get_name, ENGINE_get_cmd_defns, ENGINE_get_cipher, ENGINE_get_digest, ENGINE_add, ENGINE_cmd_is_executable, ENGINE_ctrl, ENGINE_ctrl_cmd, ENGINE_ctrl_cmd_string, ENGINE_finish, ENGINE_free, ENGINE_get_flags, ENGINE_init, ENGINE_register_DH, ENGINE_register_DSA, ENGINE_register_RAND, ENGINE_register_RSA, ENGINE_register_all_complete, ENGINE_register_ciphers, ENGINE_register_complete, ENGINE_register_digests, ENGINE_remove, ENGINE_set_DH, ENGINE_set_DSA, ENGINE_set_RAND, ENGINE_set_RSA, ENGINE_set_ciphers, ENGINE_set_cmd_defns, ENGINE_set_ctrl_function, ENGINE_set_default, ENGINE_set_default_DH, ENGINE_set_default_DSA, ENGINE_set_default_RAND, ENGINE_set_default_RSA, ENGINE_set_default_ciphers, ENGINE_set_default_digests, ENGINE_set_default_string, ENGINE_set_destroy_function, ENGINE_set_digests, ENGINE_set_finish_function, ENGINE_set_flags, ENGINE_set_id, ENGINE_set_init_function, ENGINE_set_load_privkey_function, ENGINE_set_load_pubkey_function, ENGINE_set_name, ENGINE_up_ref, ENGINE_get_table_flags, ENGINE_cleanup, ENGINE_load_builtin_engines, ENGINE_register_all_DH, ENGINE_register_all_DSA, ENGINE_register_all_RAND, ENGINE_register_all_RSA, ENGINE_register_all_ciphers, ENGINE_register_all_digests, ENGINE_set_table_flags, ENGINE_unregister_DH, ENGINE_unregister_DSA, ENGINE_unregister_RAND, ENGINE_unregister_RSA, ENGINE_unregister_ciphers, ENGINE_unregister_digests - ENGINE cryptographic module support

                                                                                                                                      "},{"location":"man3/ENGINE_add/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/engine.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      ENGINE *ENGINE_get_first(void);\nENGINE *ENGINE_get_last(void);\nENGINE *ENGINE_get_next(ENGINE *e);\nENGINE *ENGINE_get_prev(ENGINE *e);\n\nint ENGINE_add(ENGINE *e);\nint ENGINE_remove(ENGINE *e);\n\nENGINE *ENGINE_by_id(const char *id);\n\nint ENGINE_init(ENGINE *e);\nint ENGINE_finish(ENGINE *e);\n\nvoid ENGINE_load_builtin_engines(void);\n\nENGINE *ENGINE_get_default_RSA(void);\nENGINE *ENGINE_get_default_DSA(void);\nENGINE *ENGINE_get_default_DH(void);\nENGINE *ENGINE_get_default_RAND(void);\nENGINE *ENGINE_get_cipher_engine(int nid);\nENGINE *ENGINE_get_digest_engine(int nid);\n\nint ENGINE_set_default_RSA(ENGINE *e);\nint ENGINE_set_default_DSA(ENGINE *e);\nint ENGINE_set_default_DH(ENGINE *e);\nint ENGINE_set_default_RAND(ENGINE *e);\nint ENGINE_set_default_ciphers(ENGINE *e);\nint ENGINE_set_default_digests(ENGINE *e);\nint ENGINE_set_default_string(ENGINE *e, const char *list);\n\nint ENGINE_set_default(ENGINE *e, unsigned int flags);\n\nunsigned int ENGINE_get_table_flags(void);\nvoid ENGINE_set_table_flags(unsigned int flags);\n\nint ENGINE_register_RSA(ENGINE *e);\nvoid ENGINE_unregister_RSA(ENGINE *e);\nvoid ENGINE_register_all_RSA(void);\nint ENGINE_register_DSA(ENGINE *e);\nvoid ENGINE_unregister_DSA(ENGINE *e);\nvoid ENGINE_register_all_DSA(void);\nint ENGINE_register_DH(ENGINE *e);\nvoid ENGINE_unregister_DH(ENGINE *e);\nvoid ENGINE_register_all_DH(void);\nint ENGINE_register_RAND(ENGINE *e);\nvoid ENGINE_unregister_RAND(ENGINE *e);\nvoid ENGINE_register_all_RAND(void);\nint ENGINE_register_ciphers(ENGINE *e);\nvoid ENGINE_unregister_ciphers(ENGINE *e);\nvoid ENGINE_register_all_ciphers(void);\nint ENGINE_register_digests(ENGINE *e);\nvoid ENGINE_unregister_digests(ENGINE *e);\nvoid ENGINE_register_all_digests(void);\nint ENGINE_register_complete(ENGINE *e);\nint ENGINE_register_all_complete(void);\n\nint ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));\nint ENGINE_cmd_is_executable(ENGINE *e, int cmd);\nint ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,\n                    long i, void *p, void (*f)(void), int cmd_optional);\nint ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,\n                           int cmd_optional);\n\nENGINE *ENGINE_new(void);\nint ENGINE_free(ENGINE *e);\nint ENGINE_up_ref(ENGINE *e);\n\nint ENGINE_set_id(ENGINE *e, const char *id);\nint ENGINE_set_name(ENGINE *e, const char *name);\nint ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);\nint ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);\nint ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);\nint ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);\nint ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);\nint ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);\nint ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);\nint ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);\nint ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);\nint ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);\nint ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);\nint ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);\nint ENGINE_set_flags(ENGINE *e, int flags);\nint ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);\n\nconst char *ENGINE_get_id(const ENGINE *e);\nconst char *ENGINE_get_name(const ENGINE *e);\nconst RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);\nconst DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);\nconst DH_METHOD *ENGINE_get_DH(const ENGINE *e);\nconst RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);\nENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);\nENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);\nENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);\nENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);\nENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);\nconst EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);\nconst EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);\nint ENGINE_get_flags(const ENGINE *e);\nconst ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);\n\nEVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,\n                                  UI_METHOD *ui_method, void *callback_data);\nEVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,\n                                 UI_METHOD *ui_method, void *callback_data);\n

                                                                                                                                      The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void ENGINE_cleanup(void);\n
                                                                                                                                      "},{"location":"man3/ENGINE_add/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use the provider APIs.

                                                                                                                                      These functions create, manipulate, and use cryptographic modules in the form of ENGINE objects. These objects act as containers for implementations of cryptographic algorithms, and support a reference-counted mechanism to allow them to be dynamically loaded in and out of the running application.

                                                                                                                                      The cryptographic functionality that can be provided by an ENGINE implementation includes the following abstractions;

                                                                                                                                      RSA_METHOD - for providing alternative RSA implementations\nDSA_METHOD, DH_METHOD, RAND_METHOD, ECDH_METHOD, ECDSA_METHOD,\n      - similarly for other OpenSSL APIs\nEVP_CIPHER - potentially multiple cipher algorithms (indexed by 'nid')\nEVP_DIGEST - potentially multiple hash algorithms (indexed by 'nid')\nkey-loading - loading public and/or private EVP_PKEY keys\n
                                                                                                                                      "},{"location":"man3/ENGINE_add/#reference-counting-and-handles","title":"Reference counting and handles","text":"

                                                                                                                                      Due to the modular nature of the ENGINE API, pointers to ENGINEs need to be treated as handles - i.e. not only as pointers, but also as references to the underlying ENGINE object. Ie. one should obtain a new reference when making copies of an ENGINE pointer if the copies will be used (and released) independently.

                                                                                                                                      ENGINE objects have two levels of reference-counting to match the way in which the objects are used. At the most basic level, each ENGINE pointer is inherently a structural reference - a structural reference is required to use the pointer value at all, as this kind of reference is a guarantee that the structure can not be deallocated until the reference is released.

                                                                                                                                      However, a structural reference provides no guarantee that the ENGINE is initialised and able to use any of its cryptographic implementations. Indeed it's quite possible that most ENGINEs will not initialise at all in typical environments, as ENGINEs are typically used to support specialised hardware. To use an ENGINE's functionality, you need a functional reference. This kind of reference can be considered a specialised form of structural reference, because each functional reference implicitly contains a structural reference as well - however to avoid difficult-to-find programming bugs, it is recommended to treat the two kinds of reference independently. If you have a functional reference to an ENGINE, you have a guarantee that the ENGINE has been initialised and is ready to perform cryptographic operations, and will remain initialised until after you have released your reference.

                                                                                                                                      Structural references

                                                                                                                                      This basic type of reference is used for instantiating new ENGINEs, iterating across OpenSSL's internal linked-list of loaded ENGINEs, reading information about an ENGINE, etc. Essentially a structural reference is sufficient if you only need to query or manipulate the data of an ENGINE implementation rather than use its functionality.

                                                                                                                                      The ENGINE_new() function returns a structural reference to a new (empty) ENGINE object. There are other ENGINE API functions that return structural references such as; ENGINE_by_id(), ENGINE_get_first(), ENGINE_get_last(), ENGINE_get_next(), ENGINE_get_prev(). All structural references should be released by a corresponding to call to the ENGINE_free() function - the ENGINE object itself will only actually be cleaned up and deallocated when the last structural reference is released. If the argument to ENGINE_free() is NULL, nothing is done.

                                                                                                                                      It should also be noted that many ENGINE API function calls that accept a structural reference will internally obtain another reference - typically this happens whenever the supplied ENGINE will be needed by OpenSSL after the function has returned. Eg. the function to add a new ENGINE to OpenSSL's internal list is ENGINE_add() - if this function returns success, then OpenSSL will have stored a new structural reference internally so the caller is still responsible for freeing their own reference with ENGINE_free() when they are finished with it. In a similar way, some functions will automatically release the structural reference passed to it if part of the function's job is to do so. Eg. the ENGINE_get_next() and ENGINE_get_prev() functions are used for iterating across the internal ENGINE list - they will return a new structural reference to the next (or previous) ENGINE in the list or NULL if at the end (or beginning) of the list, but in either case the structural reference passed to the function is released on behalf of the caller.

                                                                                                                                      To clarify a particular function's handling of references, one should always consult that function's documentation \"man\" page, or failing that the <openssl/engine.h> header file includes some hints.

                                                                                                                                      Functional references

                                                                                                                                      As mentioned, functional references exist when the cryptographic functionality of an ENGINE is required to be available. A functional reference can be obtained in one of two ways; from an existing structural reference to the required ENGINE, or by asking OpenSSL for the default operational ENGINE for a given cryptographic purpose.

                                                                                                                                      To obtain a functional reference from an existing structural reference, call the ENGINE_init() function. This returns zero if the ENGINE was not already operational and couldn't be successfully initialised (e.g. lack of system drivers, no special hardware attached, etc), otherwise it will return nonzero to indicate that the ENGINE is now operational and will have allocated a new functional reference to the ENGINE. All functional references are released by calling ENGINE_finish() (which removes the implicit structural reference as well).

                                                                                                                                      The second way to get a functional reference is by asking OpenSSL for a default implementation for a given task, e.g. by ENGINE_get_default_RSA(), ENGINE_get_default_cipher_engine(), etc. These are discussed in the next section, though they are not usually required by application programmers as they are used automatically when creating and using the relevant algorithm-specific types in OpenSSL, such as RSA, DSA, EVP_CIPHER_CTX, etc.

                                                                                                                                      "},{"location":"man3/ENGINE_add/#default-implementations","title":"Default implementations","text":"

                                                                                                                                      For each supported abstraction, the ENGINE code maintains an internal table of state to control which implementations are available for a given abstraction and which should be used by default. These implementations are registered in the tables and indexed by an 'nid' value, because abstractions like EVP_CIPHER and EVP_DIGEST support many distinct algorithms and modes, and ENGINEs can support arbitrarily many of them. In the case of other abstractions like RSA, DSA, etc, there is only one \"algorithm\" so all implementations implicitly register using the same 'nid' index.

                                                                                                                                      When a default ENGINE is requested for a given abstraction/algorithm/mode, (e.g. when calling RSA_new_method(NULL)), a \"get_default\" call will be made to the ENGINE subsystem to process the corresponding state table and return a functional reference to an initialised ENGINE whose implementation should be used. If no ENGINE should (or can) be used, it will return NULL and the caller will operate with a NULL ENGINE handle - this usually equates to using the conventional software implementation. In the latter case, OpenSSL will from then on behave the way it used to before the ENGINE API existed.

                                                                                                                                      Each state table has a flag to note whether it has processed this \"get_default\" query since the table was last modified, because to process this question it must iterate across all the registered ENGINEs in the table trying to initialise each of them in turn, in case one of them is operational. If it returns a functional reference to an ENGINE, it will also cache another reference to speed up processing future queries (without needing to iterate across the table). Likewise, it will cache a NULL response if no ENGINE was available so that future queries won't repeat the same iteration unless the state table changes. This behaviour can also be changed; if the ENGINE_TABLE_FLAG_NOINIT flag is set (using ENGINE_set_table_flags()), no attempted initialisations will take place, instead the only way for the state table to return a non-NULL ENGINE to the \"get_default\" query will be if one is expressly set in the table. Eg. ENGINE_set_default_RSA() does the same job as ENGINE_register_RSA() except that it also sets the state table's cached response for the \"get_default\" query. In the case of abstractions like EVP_CIPHER, where implementations are indexed by 'nid', these flags and cached-responses are distinct for each 'nid' value.

                                                                                                                                      "},{"location":"man3/ENGINE_add/#application-requirements","title":"Application requirements","text":"

                                                                                                                                      This section will explain the basic things an application programmer should support to make the most useful elements of the ENGINE functionality available to the user. The first thing to consider is whether the programmer wishes to make alternative ENGINE modules available to the application and user. OpenSSL maintains an internal linked list of \"visible\" ENGINEs from which it has to operate - at start-up, this list is empty and in fact if an application does not call any ENGINE API calls and it uses static linking against openssl, then the resulting application binary will not contain any alternative ENGINE code at all. So the first consideration is whether any/all available ENGINE implementations should be made visible to OpenSSL - this is controlled by calling the various \"load\" functions.

                                                                                                                                      The fact that ENGINEs are made visible to OpenSSL (and thus are linked into the program and loaded into memory at run-time) does not mean they are \"registered\" or called into use by OpenSSL automatically - that behaviour is something for the application to control. Some applications will want to allow the user to specify exactly which ENGINE they want used if any is to be used at all. Others may prefer to load all support and have OpenSSL automatically use at run-time any ENGINE that is able to successfully initialise - i.e. to assume that this corresponds to acceleration hardware attached to the machine or some such thing. There are probably numerous other ways in which applications may prefer to handle things, so we will simply illustrate the consequences as they apply to a couple of simple cases and leave developers to consider these and the source code to openssl's built-in utilities as guides.

                                                                                                                                      If no ENGINE API functions are called within an application, then OpenSSL will not allocate any internal resources. Prior to OpenSSL 1.1.0, however, if any ENGINEs are loaded, even if not registered or used, it was necessary to call ENGINE_cleanup() before the program exits.

                                                                                                                                      Using a specific ENGINE implementation

                                                                                                                                      Here we'll assume an application has been configured by its user or admin to want to use the \"ACME\" ENGINE if it is available in the version of OpenSSL the application was compiled with. If it is available, it should be used by default for all RSA, DSA, and symmetric cipher operations, otherwise OpenSSL should use its built-in software as per usual. The following code illustrates how to approach this;

                                                                                                                                      ENGINE *e;\nconst char *engine_id = \"ACME\";\nENGINE_load_builtin_engines();\ne = ENGINE_by_id(engine_id);\nif (!e)\n    /* the engine isn't available */\n    return;\nif (!ENGINE_init(e)) {\n    /* the engine couldn't initialise, release 'e' */\n    ENGINE_free(e);\n    return;\n}\nif (!ENGINE_set_default_RSA(e))\n    /*\n     * This should only happen when 'e' can't initialise, but the previous\n     * statement suggests it did.\n     */\n    abort();\nENGINE_set_default_DSA(e);\nENGINE_set_default_ciphers(e);\n/* Release the functional reference from ENGINE_init() */\nENGINE_finish(e);\n/* Release the structural reference from ENGINE_by_id() */\nENGINE_free(e);\n

                                                                                                                                      Automatically using built-in ENGINE implementations

                                                                                                                                      Here we'll assume we want to load and register all ENGINE implementations bundled with OpenSSL, such that for any cryptographic algorithm required by OpenSSL - if there is an ENGINE that implements it and can be initialised, it should be used. The following code illustrates how this can work;

                                                                                                                                      /* Load all bundled ENGINEs into memory and make them visible */\nENGINE_load_builtin_engines();\n/* Register all of them for every algorithm they collectively implement */\nENGINE_register_all_complete();\n

                                                                                                                                      That's all that's required. Eg. the next time OpenSSL tries to set up an RSA key, any bundled ENGINEs that implement RSA_METHOD will be passed to ENGINE_init() and if any of those succeed, that ENGINE will be set as the default for RSA use from then on.

                                                                                                                                      "},{"location":"man3/ENGINE_add/#advanced-configuration-support","title":"Advanced configuration support","text":"

                                                                                                                                      There is a mechanism supported by the ENGINE framework that allows each ENGINE implementation to define an arbitrary set of configuration \"commands\" and expose them to OpenSSL and any applications based on OpenSSL. This mechanism is entirely based on the use of name-value pairs and assumes ASCII input (no unicode or UTF for now!), so it is ideal if applications want to provide a transparent way for users to provide arbitrary configuration \"directives\" directly to such ENGINEs. It is also possible for the application to dynamically interrogate the loaded ENGINE implementations for the names, descriptions, and input flags of their available \"control commands\", providing a more flexible configuration scheme. However, if the user is expected to know which ENGINE device he/she is using (in the case of specialised hardware, this goes without saying) then applications may not need to concern themselves with discovering the supported control commands and simply prefer to pass settings into ENGINEs exactly as they are provided by the user.

                                                                                                                                      Before illustrating how control commands work, it is worth mentioning what they are typically used for. Broadly speaking there are two uses for control commands; the first is to provide the necessary details to the implementation (which may know nothing at all specific to the host system) so that it can be initialised for use. This could include the path to any driver or config files it needs to load, required network addresses, smart-card identifiers, passwords to initialise protected devices, logging information, etc etc. This class of commands typically needs to be passed to an ENGINE before attempting to initialise it, i.e. before calling ENGINE_init(). The other class of commands consist of settings or operations that tweak certain behaviour or cause certain operations to take place, and these commands may work either before or after ENGINE_init(), or in some cases both. ENGINE implementations should provide indications of this in the descriptions attached to built-in control commands and/or in external product documentation.

                                                                                                                                      Issuing control commands to an ENGINE

                                                                                                                                      Let's illustrate by example; a function for which the caller supplies the name of the ENGINE it wishes to use, a table of string-pairs for use before initialisation, and another table for use after initialisation. Note that the string-pairs used for control commands consist of a command \"name\" followed by the command \"parameter\" - the parameter could be NULL in some cases but the name can not. This function should initialise the ENGINE (issuing the \"pre\" commands beforehand and the \"post\" commands afterwards) and set it as the default for everything except RAND and then return a boolean success or failure.

                                                                                                                                      int generic_load_engine_fn(const char *engine_id,\n                           const char **pre_cmds, int pre_num,\n                           const char **post_cmds, int post_num)\n{\n    ENGINE *e = ENGINE_by_id(engine_id);\n    if (!e) return 0;\n    while (pre_num--) {\n        if (!ENGINE_ctrl_cmd_string(e, pre_cmds[0], pre_cmds[1], 0)) {\n            fprintf(stderr, \"Failed command (%s - %s:%s)\\n\", engine_id,\n                    pre_cmds[0], pre_cmds[1] ? pre_cmds[1] : \"(NULL)\");\n            ENGINE_free(e);\n            return 0;\n        }\n        pre_cmds += 2;\n    }\n    if (!ENGINE_init(e)) {\n        fprintf(stderr, \"Failed initialisation\\n\");\n        ENGINE_free(e);\n        return 0;\n    }\n    /*\n     * ENGINE_init() returned a functional reference, so free the structural\n     * reference from ENGINE_by_id().\n     */\n    ENGINE_free(e);\n    while (post_num--) {\n        if (!ENGINE_ctrl_cmd_string(e, post_cmds[0], post_cmds[1], 0)) {\n            fprintf(stderr, \"Failed command (%s - %s:%s)\\n\", engine_id,\n                    post_cmds[0], post_cmds[1] ? post_cmds[1] : \"(NULL)\");\n            ENGINE_finish(e);\n            return 0;\n        }\n        post_cmds += 2;\n    }\n    ENGINE_set_default(e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND);\n    /* Success */\n    return 1;\n}\n

                                                                                                                                      Note that ENGINE_ctrl_cmd_string() accepts a boolean argument that can relax the semantics of the function - if set nonzero it will only return failure if the ENGINE supported the given command name but failed while executing it, if the ENGINE doesn't support the command name it will simply return success without doing anything. In this case we assume the user is only supplying commands specific to the given ENGINE so we set this to FALSE.

                                                                                                                                      Discovering supported control commands

                                                                                                                                      It is possible to discover at run-time the names, numerical-ids, descriptions and input parameters of the control commands supported by an ENGINE using a structural reference. Note that some control commands are defined by OpenSSL itself and it will intercept and handle these control commands on behalf of the ENGINE, i.e. the ENGINE's ctrl() handler is not used for the control command. <openssl/engine.h> defines an index, ENGINE_CMD_BASE, that all control commands implemented by ENGINEs should be numbered from. Any command value lower than this symbol is considered a \"generic\" command is handled directly by the OpenSSL core routines.

                                                                                                                                      It is using these \"core\" control commands that one can discover the control commands implemented by a given ENGINE, specifically the commands:

                                                                                                                                      ENGINE_HAS_CTRL_FUNCTION\nENGINE_CTRL_GET_FIRST_CMD_TYPE\nENGINE_CTRL_GET_NEXT_CMD_TYPE\nENGINE_CTRL_GET_CMD_FROM_NAME\nENGINE_CTRL_GET_NAME_LEN_FROM_CMD\nENGINE_CTRL_GET_NAME_FROM_CMD\nENGINE_CTRL_GET_DESC_LEN_FROM_CMD\nENGINE_CTRL_GET_DESC_FROM_CMD\nENGINE_CTRL_GET_CMD_FLAGS\n

                                                                                                                                      Whilst these commands are automatically processed by the OpenSSL framework code, they use various properties exposed by each ENGINE to process these queries. An ENGINE has 3 properties it exposes that can affect how this behaves; it can supply a ctrl() handler, it can specify ENGINE_FLAGS_MANUAL_CMD_CTRL in the ENGINE's flags, and it can expose an array of control command descriptions. If an ENGINE specifies the ENGINE_FLAGS_MANUAL_CMD_CTRL flag, then it will simply pass all these \"core\" control commands directly to the ENGINE's ctrl() handler (and thus, it must have supplied one), so it is up to the ENGINE to reply to these \"discovery\" commands itself. If that flag is not set, then the OpenSSL framework code will work with the following rules:

                                                                                                                                      if no ctrl() handler supplied;\n    ENGINE_HAS_CTRL_FUNCTION returns FALSE (zero),\n    all other commands fail.\nif a ctrl() handler was supplied but no array of control commands;\n    ENGINE_HAS_CTRL_FUNCTION returns TRUE,\n    all other commands fail.\nif a ctrl() handler and array of control commands was supplied;\n    ENGINE_HAS_CTRL_FUNCTION returns TRUE,\n    all other commands proceed processing ...\n

                                                                                                                                      If the ENGINE's array of control commands is empty then all other commands will fail, otherwise; ENGINE_CTRL_GET_FIRST_CMD_TYPE returns the identifier of the first command supported by the ENGINE, ENGINE_GET_NEXT_CMD_TYPE takes the identifier of a command supported by the ENGINE and returns the next command identifier or fails if there are no more, ENGINE_CMD_FROM_NAME takes a string name for a command and returns the corresponding identifier or fails if no such command name exists, and the remaining commands take a command identifier and return properties of the corresponding commands. All except ENGINE_CTRL_GET_FLAGS return the string length of a command name or description, or populate a supplied character buffer with a copy of the command name or description. ENGINE_CTRL_GET_FLAGS returns a bitwise-OR'd mask of the following possible values:

                                                                                                                                      ENGINE_CMD_FLAG_NUMERIC\nENGINE_CMD_FLAG_STRING\nENGINE_CMD_FLAG_NO_INPUT\nENGINE_CMD_FLAG_INTERNAL\n

                                                                                                                                      If the ENGINE_CMD_FLAG_INTERNAL flag is set, then any other flags are purely informational to the caller - this flag will prevent the command being usable for any higher-level ENGINE functions such as ENGINE_ctrl_cmd_string(). \"INTERNAL\" commands are not intended to be exposed to text-based configuration by applications, administrations, users, etc. These can support arbitrary operations via ENGINE_ctrl(), including passing to and/or from the control commands data of any arbitrary type. These commands are supported in the discovery mechanisms simply to allow applications to determine if an ENGINE supports certain specific commands it might want to use (e.g. application \"foo\" might query various ENGINEs to see if they implement \"FOO_GET_VENDOR_LOGO_GIF\" - and ENGINE could therefore decide whether or not to support this \"foo\"-specific extension).

                                                                                                                                      "},{"location":"man3/ENGINE_add/#environment","title":"ENVIRONMENT","text":"
                                                                                                                                      • OPENSSL_ENGINES

                                                                                                                                        The path to the engines directory. Ignored in set-user-ID and set-group-ID programs.

                                                                                                                                      "},{"location":"man3/ENGINE_add/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ENGINE_get_first(), ENGINE_get_last(), ENGINE_get_next() and ENGINE_get_prev() return a valid ENGINE structure or NULL if an error occurred.

                                                                                                                                      ENGINE_add() and ENGINE_remove() return 1 on success or 0 on error.

                                                                                                                                      ENGINE_by_id() returns a valid ENGINE structure or NULL if an error occurred.

                                                                                                                                      ENGINE_init() and ENGINE_finish() return 1 on success or 0 on error.

                                                                                                                                      All ENGINE_get_default_TYPE() functions, ENGINE_get_cipher_engine() and ENGINE_get_digest_engine() return a valid ENGINE structure on success or NULL if an error occurred.

                                                                                                                                      All ENGINE_set_default_TYPE() functions return 1 on success or 0 on error.

                                                                                                                                      ENGINE_set_default() returns 1 on success or 0 on error.

                                                                                                                                      ENGINE_get_table_flags() returns an unsigned integer value representing the global table flags which are used to control the registration behaviour of ENGINE implementations.

                                                                                                                                      All ENGINE_register_TYPE() functions return 1 on success or 0 on error.

                                                                                                                                      ENGINE_register_complete() and ENGINE_register_all_complete() always return 1.

                                                                                                                                      ENGINE_ctrl() returns a positive value on success or others on error.

                                                                                                                                      ENGINE_cmd_is_executable() returns 1 if cmd is executable or 0 otherwise.

                                                                                                                                      ENGINE_ctrl_cmd() and ENGINE_ctrl_cmd_string() return 1 on success or 0 on error.

                                                                                                                                      ENGINE_new() returns a valid ENGINE structure on success or NULL if an error occurred.

                                                                                                                                      ENGINE_free() always returns 1.

                                                                                                                                      ENGINE_up_ref() returns 1 on success or 0 on error.

                                                                                                                                      ENGINE_set_id() and ENGINE_set_name() return 1 on success or 0 on error.

                                                                                                                                      All other ENGINE_set_* functions return 1 on success or 0 on error.

                                                                                                                                      ENGINE_get_id() and ENGINE_get_name() return a string representing the identifier and the name of the ENGINE e respectively.

                                                                                                                                      ENGINE_get_RSA(), ENGINE_get_DSA(), ENGINE_get_DH() and ENGINE_get_RAND() return corresponding method structures for each algorithms.

                                                                                                                                      ENGINE_get_destroy_function(), ENGINE_get_init_function(), ENGINE_get_finish_function(), ENGINE_get_ctrl_function(), ENGINE_get_load_privkey_function(), ENGINE_get_load_pubkey_function(), ENGINE_get_ciphers() and ENGINE_get_digests() return corresponding function pointers of the callbacks.

                                                                                                                                      ENGINE_get_cipher() returns a valid EVP_CIPHER structure on success or NULL if an error occurred.

                                                                                                                                      ENGINE_get_digest() returns a valid EVP_MD structure on success or NULL if an error occurred.

                                                                                                                                      ENGINE_get_flags() returns an integer representing the ENGINE flags which are used to control various behaviours of an ENGINE.

                                                                                                                                      ENGINE_get_cmd_defns() returns an ENGINE_CMD_DEFN structure or NULL if it's not set.

                                                                                                                                      ENGINE_load_private_key() and ENGINE_load_public_key() return a valid EVP_PKEY structure on success or NULL if an error occurred.

                                                                                                                                      "},{"location":"man3/ENGINE_add/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      OPENSSL_init_crypto(3), RSA_new_method(3), DSA_new(3), DH_new(3), RAND_bytes(3), config(5)

                                                                                                                                      "},{"location":"man3/ENGINE_add/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      ENGINE_cleanup() was deprecated in OpenSSL 1.1.0 by the automatic cleanup done by OPENSSL_cleanup() and should not be used.

                                                                                                                                      "},{"location":"man3/ENGINE_add/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/","title":"ERR_GET_LIB","text":""},{"location":"man3/ERR_GET_LIB/#name","title":"NAME","text":"

                                                                                                                                      ERR_GET_LIB, ERR_GET_REASON, ERR_FATAL_ERROR - get information from error codes

                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nint ERR_GET_LIB(unsigned long e);\n\nint ERR_GET_REASON(unsigned long e);\n\nint ERR_FATAL_ERROR(unsigned long e);\n
                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The error code returned by ERR_get_error() consists of a library number and reason code. ERR_GET_LIB() and ERR_GET_REASON() can be used to extract these.

                                                                                                                                      ERR_FATAL_ERROR() indicates whether a given error code is a fatal error.

                                                                                                                                      The library number describes where the error occurred, the reason code is the information about what went wrong.

                                                                                                                                      Each sub-library of OpenSSL has a unique library number; the reason code is unique within each sub-library. Note that different libraries may use the same value to signal different reasons.

                                                                                                                                      ERR_R_... reason codes such as ERR_R_MALLOC_FAILURE are globally unique. However, when checking for sub-library specific reason codes, be sure to also compare the library number.

                                                                                                                                      ERR_GET_LIB(), ERR_GET_REASON(), and ERR_FATAL_ERROR() are macros.

                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The library number, reason code, and whether the error is fatal, respectively. Starting with OpenSSL 3.0.0, the function code is always set to zero.

                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/#notes","title":"NOTES","text":"

                                                                                                                                      Applications should not make control flow decisions based on specific error codes. Error codes are subject to change at any time (even in patch releases of OpenSSL). A particular error code can only be considered meaningful for control flow decisions if it is explicitly documented as such. New failure codes may still appear at any time.

                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/#history","title":"HISTORY","text":"

                                                                                                                                      ERR_GET_LIB() and ERR_GET_REASON() are available in all versions of OpenSSL.

                                                                                                                                      ERR_GET_FUNC() was removed in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ERR_GET_LIB/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_clear_error/","title":"ERR_clear_error","text":""},{"location":"man3/ERR_clear_error/#name","title":"NAME","text":"

                                                                                                                                      ERR_clear_error - clear the error queue

                                                                                                                                      "},{"location":"man3/ERR_clear_error/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nvoid ERR_clear_error(void);\n
                                                                                                                                      "},{"location":"man3/ERR_clear_error/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_clear_error() empties the current thread's error queue.

                                                                                                                                      "},{"location":"man3/ERR_clear_error/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_clear_error() has no return value.

                                                                                                                                      "},{"location":"man3/ERR_clear_error/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ERR_clear_error/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_error_string/","title":"ERR_error_string","text":""},{"location":"man3/ERR_error_string/#name","title":"NAME","text":"

                                                                                                                                      ERR_error_string, ERR_error_string_n, ERR_lib_error_string, ERR_func_error_string, ERR_reason_error_string - obtain human-readable error message

                                                                                                                                      "},{"location":"man3/ERR_error_string/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nchar *ERR_error_string(unsigned long e, char *buf);\nvoid ERR_error_string_n(unsigned long e, char *buf, size_t len);\n\nconst char *ERR_lib_error_string(unsigned long e);\nconst char *ERR_reason_error_string(unsigned long e);\n

                                                                                                                                      Deprecated in OpenSSL 3.0:

                                                                                                                                      const char *ERR_func_error_string(unsigned long e);\n
                                                                                                                                      "},{"location":"man3/ERR_error_string/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_error_string() generates a human-readable string representing the error code e, and places it at buf. buf must be at least 256 bytes long. If buf is NULL, the error string is placed in a static buffer. Note that this function is not thread-safe and does no checks on the size of the buffer; use ERR_error_string_n() instead.

                                                                                                                                      ERR_error_string_n() is a variant of ERR_error_string() that writes at most len characters (including the terminating 0) and truncates the string if necessary. For ERR_error_string_n(), buf may not be NULL.

                                                                                                                                      The string will have the following format:

                                                                                                                                      error:[error code]:[library name]::[reason string]\n

                                                                                                                                      error code is an 8 digit hexadecimal number, library name and reason string are ASCII text.

                                                                                                                                      ERR_lib_error_string() and ERR_reason_error_string() return the library name and reason string respectively.

                                                                                                                                      If there is no text string registered for the given error code, the error string will contain the numeric code.

                                                                                                                                      ERR_print_errors(3) can be used to print all error codes currently in the queue.

                                                                                                                                      "},{"location":"man3/ERR_error_string/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_error_string() returns a pointer to a static buffer containing the string if buf == NULL, buf otherwise.

                                                                                                                                      ERR_lib_error_string() and ERR_reason_error_string() return the strings, and NULL if none is registered for the error code.

                                                                                                                                      ERR_func_error_string() returns NULL.

                                                                                                                                      "},{"location":"man3/ERR_error_string/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_get_error(3), ERR_print_errors(3)

                                                                                                                                      "},{"location":"man3/ERR_error_string/#history","title":"HISTORY","text":"

                                                                                                                                      ERR_func_error_string() became deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ERR_error_string/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_get_error/","title":"ERR_get_error","text":""},{"location":"man3/ERR_get_error/#name","title":"NAME","text":"

                                                                                                                                      ERR_get_error, ERR_peek_error, ERR_peek_last_error, ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, ERR_peek_error_func, ERR_peek_last_error_func, ERR_peek_error_data, ERR_peek_last_error_data, ERR_get_error_all, ERR_peek_error_all, ERR_peek_last_error_all, ERR_get_error_line_data, ERR_peek_error_line_data, ERR_peek_last_error_line_data - obtain error code and data

                                                                                                                                      "},{"location":"man3/ERR_get_error/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nunsigned long ERR_get_error(void);\nunsigned long ERR_peek_error(void);\nunsigned long ERR_peek_last_error(void);\n\nunsigned long ERR_peek_error_line(const char **file, int *line);\nunsigned long ERR_peek_last_error_line(const char **file, int *line);\n\nunsigned long ERR_peek_error_func(const char **func);\nunsigned long ERR_peek_last_error_func(const char **func);\n\nunsigned long ERR_peek_error_data(const char **data, int *flags);\nunsigned long ERR_peek_last_error_data(const char **data, int *flags);\n\nunsigned long ERR_get_error_all(const char **file, int *line,\n                                const char **func,\n                                const char **data, int *flags);\nunsigned long ERR_peek_error_all(const char **file, int *line,\n                                 const char **func,\n                                 const char **data, int *flags);\nunsigned long ERR_peek_last_error_all(const char **file, int *line,\n                                      const char *func,\n                                      const char **data, int *flags);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      unsigned long ERR_get_error_line(const char **file, int *line);\nunsigned long ERR_get_error_line_data(const char **file, int *line,\n                                      const char **data, int *flags);\nunsigned long ERR_peek_error_line_data(const char **file, int *line,\n                                       const char **data, int *flags);\nunsigned long ERR_peek_last_error_line_data(const char **file, int *line,\n                                            const char **data, int *flags);\n
                                                                                                                                      "},{"location":"man3/ERR_get_error/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_get_error() returns the earliest error code from the thread's error queue and removes the entry. This function can be called repeatedly until there are no more error codes to return.

                                                                                                                                      ERR_peek_error() returns the earliest error code from the thread's error queue without modifying it.

                                                                                                                                      ERR_peek_last_error() returns the latest error code from the thread's error queue without modifying it.

                                                                                                                                      See ERR_GET_LIB(3) for obtaining further specific information such as the reason of the error, and ERR_error_string(3) for human-readable error messages.

                                                                                                                                      ERR_get_error_all() is the same as ERR_get_error(), but on success it additionally stores the filename, line number and function where the error occurred in *file, *line and *func, and also extra text and flags in *data, *flags. If any of those parameters are NULL, it will not be changed. An unset filename is indicated as \"\", i.e. an empty string. An unset line number is indicated as 0. An unset function name is indicated as \"\", i.e. an empty string.

                                                                                                                                      A pointer returned this way by these functions and the ones below is valid until the respective entry is overwritten in the error queue.

                                                                                                                                      ERR_peek_error_line() and ERR_peek_last_error_line() are the same as ERR_peek_error() and ERR_peek_last_error(), but on success they additionally store the filename and line number where the error occurred in *file and *line, as far as they are not NULL. An unset filename is indicated as \"\", i.e., an empty string. An unset line number is indicated as 0.

                                                                                                                                      ERR_peek_error_func() and ERR_peek_last_error_func() are the same as ERR_peek_error() and ERR_peek_last_error(), but on success they additionally store the name of the function where the error occurred in *func, unless it is NULL. An unset function name is indicated as \"\".

                                                                                                                                      ERR_peek_error_data() and ERR_peek_last_error_data() are the same as ERR_peek_error() and ERR_peek_last_error(), but on success they additionally store additional data and flags associated with the error code in *data and *flags, as far as they are not NULL. Unset data is indicated as \"\". In this case the value given for the flag is irrelevant (and equals 0). *data contains a string if *flags&ERR_TXT_STRING is true.

                                                                                                                                      ERR_peek_error_all() and ERR_peek_last_error_all() are combinations of all of the above.

                                                                                                                                      ERR_get_error_line(), ERR_get_error_line_data(), ERR_peek_error_line_data() and ERR_peek_last_error_line_data() are older variants of ERR_get_error_all(), ERR_peek_error_all() and ERR_peek_last_error_all(), and may give confusing results. They should no longer be used and are therefore deprecated.

                                                                                                                                      An application MUST NOT free the *data pointer (or any other pointers returned by these functions) with OPENSSL_free() as freeing is handled automatically by the error library.

                                                                                                                                      "},{"location":"man3/ERR_get_error/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The error code, or 0 if there is no error in the queue.

                                                                                                                                      "},{"location":"man3/ERR_get_error/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_error_string(3), ERR_GET_LIB(3)

                                                                                                                                      "},{"location":"man3/ERR_get_error/#history","title":"HISTORY","text":"

                                                                                                                                      ERR_peek_error_func(), ERR_peek_last_error_func(), ERR_peek_error_data(), ERR_peek_last_error_data(), ERR_peek_error_all() and ERR_peek_last_error_all() were added in OpenSSL 3.0.

                                                                                                                                      ERR_get_error_line(), ERR_get_error_line_data(), ERR_peek_error_line_data() and ERR_peek_last_error_line_data() became deprecated in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ERR_get_error/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_load_crypto_strings/","title":"ERR_load_crypto_strings","text":""},{"location":"man3/ERR_load_crypto_strings/#name","title":"NAME","text":"

                                                                                                                                      ERR_load_crypto_strings, SSL_load_error_strings, ERR_free_strings - load and free error strings

                                                                                                                                      "},{"location":"man3/ERR_load_crypto_strings/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      #include <openssl/err.h>\n\nvoid ERR_load_crypto_strings(void);\nvoid ERR_free_strings(void);\n\n#include <openssl/ssl.h>\n\nvoid SSL_load_error_strings(void);\n
                                                                                                                                      "},{"location":"man3/ERR_load_crypto_strings/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_load_crypto_strings() registers the error strings for all libcrypto functions. SSL_load_error_strings() does the same, but also registers the libssl error strings.

                                                                                                                                      In versions prior to OpenSSL 1.1.0, ERR_free_strings() releases any resources created by the above functions.

                                                                                                                                      "},{"location":"man3/ERR_load_crypto_strings/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_load_crypto_strings(), SSL_load_error_strings() and ERR_free_strings() return no values.

                                                                                                                                      "},{"location":"man3/ERR_load_crypto_strings/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_error_string(3)

                                                                                                                                      "},{"location":"man3/ERR_load_crypto_strings/#history","title":"HISTORY","text":"

                                                                                                                                      The ERR_load_crypto_strings(), SSL_load_error_strings(), and ERR_free_strings() functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto() and OPENSSL_init_ssl() and should not be used.

                                                                                                                                      "},{"location":"man3/ERR_load_crypto_strings/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_load_strings/","title":"ERR_load_strings","text":""},{"location":"man3/ERR_load_strings/#name","title":"NAME","text":"

                                                                                                                                      ERR_load_strings, ERR_PACK, ERR_get_next_error_library - load arbitrary error strings

                                                                                                                                      "},{"location":"man3/ERR_load_strings/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nint ERR_load_strings(int lib, ERR_STRING_DATA *str);\n\nint ERR_get_next_error_library(void);\n\nunsigned long ERR_PACK(int lib, int func, int reason);\n
                                                                                                                                      "},{"location":"man3/ERR_load_strings/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_load_strings() registers error strings for library number lib.

                                                                                                                                      str is an array of error string data:

                                                                                                                                      typedef struct ERR_string_data_st\n{\n    unsigned long error;\n    char *string;\n} ERR_STRING_DATA;\n

                                                                                                                                      The error code is generated from the library number and a function and reason code: error = ERR_PACK(lib, func, reason). ERR_PACK() is a macro.

                                                                                                                                      The last entry in the array is {0,0}.

                                                                                                                                      ERR_get_next_error_library() can be used to assign library numbers to user libraries at run time.

                                                                                                                                      "},{"location":"man3/ERR_load_strings/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_load_strings() returns 1 for success and 0 for failure. ERR_PACK() returns the error code. ERR_get_next_error_library() returns zero on failure, otherwise a new library number.

                                                                                                                                      "},{"location":"man3/ERR_load_strings/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_load_strings(3)

                                                                                                                                      "},{"location":"man3/ERR_load_strings/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_new/","title":"ERR_new","text":""},{"location":"man3/ERR_new/#name","title":"NAME","text":"

                                                                                                                                      ERR_new, ERR_set_debug, ERR_set_error, ERR_vset_error - Error recording building blocks

                                                                                                                                      "},{"location":"man3/ERR_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nvoid ERR_new(void);\nvoid ERR_set_debug(const char *file, int line, const char *func);\nvoid ERR_set_error(int lib, int reason, const char *fmt, ...);\nvoid ERR_vset_error(int lib, int reason, const char *fmt, va_list args);\n
                                                                                                                                      "},{"location":"man3/ERR_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The functions described here are generally not used directly, but rather through macros such as ERR_raise(3). They can still be useful for anyone that wants to make their own macros.

                                                                                                                                      ERR_new() allocates a new slot in the thread's error queue.

                                                                                                                                      ERR_set_debug() sets the debug information related to the current error in the thread's error queue. The values that can be given are the filename file, line in the file line and the name of the function func where the error occurred. The names must be constant, this function will only save away the pointers, not copy the strings.

                                                                                                                                      ERR_set_error() sets the error information, which are the library number lib and the reason code reason, and additional data as a format string fmt and an arbitrary number of arguments. The additional data is processed with BIO_snprintf(3) to form the additional data string, which is allocated and store in the error record.

                                                                                                                                      ERR_vset_error() works like ERR_set_error(), but takes a va_list argument instead of a variable number of arguments.

                                                                                                                                      "},{"location":"man3/ERR_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_new, ERR_set_debug, ERR_set_error and ERR_vset_error do not return any values.

                                                                                                                                      "},{"location":"man3/ERR_new/#notes","title":"NOTES","text":"

                                                                                                                                      The library number is unique to each unit that records errors. OpenSSL has a number of preallocated ones for its own uses, but others may allocate their own library number dynamically with ERR_get_next_error_library(3).

                                                                                                                                      Reason codes are unique within each library, and may have an associated set of strings as a short description of the reason. For dynamically allocated library numbers, reason strings are recorded with ERR_load_strings(3).

                                                                                                                                      Provider authors are supplied with core versions of these functions, see provider-base(7).

                                                                                                                                      "},{"location":"man3/ERR_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_raise(3), ERR_get_next_error_library(3), ERR_load_strings(3), BIO_snprintf(3), provider-base(7)

                                                                                                                                      "},{"location":"man3/ERR_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_print_errors/","title":"ERR_print_errors","text":""},{"location":"man3/ERR_print_errors/#name","title":"NAME","text":"

                                                                                                                                      ERR_print_errors, ERR_print_errors_fp, ERR_print_errors_cb - print error messages

                                                                                                                                      "},{"location":"man3/ERR_print_errors/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nvoid ERR_print_errors(BIO *bp);\nvoid ERR_print_errors_fp(FILE *fp);\nvoid ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),\n                         void *u);\n
                                                                                                                                      "},{"location":"man3/ERR_print_errors/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_print_errors() is a convenience function that prints the error strings for all errors that OpenSSL has recorded to bp, thus emptying the error queue.

                                                                                                                                      ERR_print_errors_fp() is the same, except that the output goes to a FILE.

                                                                                                                                      ERR_print_errors_cb() is the same, except that the callback function, cb, is called for each error line with the string, length, and userdata u as the callback parameters.

                                                                                                                                      The error strings will have the following format:

                                                                                                                                      [pid]:error:[error code]:[library name]:[function name]:[reason string]:[filename]:[line]:[optional text message]\n

                                                                                                                                      error code is an 8 digit hexadecimal number. library name, function name and reason string are ASCII text, as is optional text message if one was set for the respective error code.

                                                                                                                                      If there is no text string registered for the given error code, the error string will contain the numeric code.

                                                                                                                                      "},{"location":"man3/ERR_print_errors/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_print_errors() and ERR_print_errors_fp() return no values.

                                                                                                                                      "},{"location":"man3/ERR_print_errors/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_error_string(3), ERR_get_error(3)

                                                                                                                                      "},{"location":"man3/ERR_print_errors/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_put_error/","title":"ERR_put_error","text":""},{"location":"man3/ERR_put_error/#name","title":"NAME","text":"

                                                                                                                                      ERR_raise, ERR_raise_data, ERR_put_error, ERR_add_error_data, ERR_add_error_vdata, ERR_add_error_txt, ERR_add_error_mem_bio - record an error

                                                                                                                                      "},{"location":"man3/ERR_put_error/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nvoid ERR_raise(int lib, int reason);\nvoid ERR_raise_data(int lib, int reason, const char *fmt, ...);\n\nvoid ERR_add_error_data(int num, ...);\nvoid ERR_add_error_vdata(int num, va_list arg);\nvoid ERR_add_error_txt(const char *sep, const char *txt);\nvoid ERR_add_error_mem_bio(const char *sep, BIO *bio);\n

                                                                                                                                      The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void ERR_put_error(int lib, int func, int reason, const char *file, int line);\n
                                                                                                                                      "},{"location":"man3/ERR_put_error/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_raise() adds a new error to the thread's error queue. The error occurred in the library lib for the reason given by the reason code. Furthermore, the name of the file, the line, and name of the function where the error occurred is saved with the error record.

                                                                                                                                      ERR_raise_data() does the same thing as ERR_raise(), but also lets the caller specify additional information as a format string fmt and an arbitrary number of values, which are processed with BIO_snprintf(3).

                                                                                                                                      ERR_put_error() adds an error code to the thread's error queue. It signals that the error of reason code reason occurred in function func of library lib, in line number line of file. This function is usually called by a macro.

                                                                                                                                      ERR_add_error_data() associates the concatenation of its num string arguments as additional data with the error code added last. ERR_add_error_vdata() is similar except the argument is a va_list. Multiple calls to these functions append to the current top of the error queue. The total length of the string data per error is limited to 4096 characters.

                                                                                                                                      ERR_add_error_txt() appends the given text string as additional data to the last error queue entry, after inserting the optional separator string if it is not NULL and the top error entry does not yet have additional data. In case the separator is at the end of the text it is not appended to the data. The sep argument may be for instance \"\\n\" to insert a line break when needed. If the associated data would become more than 4096 characters long (which is the limit given above) it is split over sufficiently many new copies of the last error queue entry.

                                                                                                                                      ERR_add_error_mem_bio() is the same as ERR_add_error_txt() except that the text string is taken from the given memory BIO. It appends '\\0' to the BIO contents if not already NUL-terminated.

                                                                                                                                      ERR_load_strings(3) can be used to register error strings so that the application can a generate human-readable error messages for the error code.

                                                                                                                                      "},{"location":"man3/ERR_put_error/#reporting-errors","title":"Reporting errors","text":""},{"location":"man3/ERR_put_error/#openssl-library-reports","title":"OpenSSL library reports","text":"

                                                                                                                                      Each OpenSSL sub-library has library code ERR_LIB_XXX and has its own set of reason codes XXX_R_.... These are both passed in combination to ERR_raise() and ERR_raise_data(), and the combination ultimately produces the correct error text for the reported error.

                                                                                                                                      All these macros and the numbers they have as values are specific to OpenSSL's libraries. OpenSSL reason codes normally consist of textual error descriptions. For example, the function ssl3_read_bytes() reports a \"handshake failure\" as follows:

                                                                                                                                      ERR_raise(ERR_LIB_SSL, SSL_R_SSL_HANDSHAKE_FAILURE);\n

                                                                                                                                      There are two exceptions:

                                                                                                                                      • ERR_LIB_SYS

                                                                                                                                        This \"library code\" indicates that a system error is being reported. In this case, the reason code given to ERR_raise() and ERR_raise_data() must be errno(3).

                                                                                                                                        ERR_raise(ERR_LIB_SYS, errno);\n
                                                                                                                                      • ERR_R_XXX

                                                                                                                                        This set of error codes is considered global, and may be used in combination with any sub-library code.

                                                                                                                                        ERR_raise(ERR_LIB_RSA, ERR_R_PASSED_INVALID_ARGUMENT);\n
                                                                                                                                      "},{"location":"man3/ERR_put_error/#other-pieces-of-software","title":"Other pieces of software","text":"

                                                                                                                                      Other pieces of software that may want to use OpenSSL's error reporting system, such as engines or applications, must normally get their own numbers.

                                                                                                                                      • To get a \"library\" code, call ERR_get_next_error_library(3); this gives the calling code a dynamic number, usable for the duration of the process.
                                                                                                                                      • Reason codes for each such \"library\" are determined or generated by the authors of that code. They must be numbers in the range 1 to 524287 (in other words, they must be nonzero unsigned 18 bit integers).

                                                                                                                                      The exceptions mentioned in \"OpenSSL library reports\" above are valid for other pieces of software, i.e. they may use ERR_LIB_SYS to report system errors:

                                                                                                                                      ERR_raise(ERR_LIB_SYS, errno);\n

                                                                                                                                      ... and they may use ERR_R_XXX macros together with their own \"library\" code.

                                                                                                                                      int app_lib_code = ERR_get_next_error_library();\n\n/* ... */\n\nERR_raise(app_lib_code, ERR_R_PASSED_INVALID_ARGUMENT);\n
                                                                                                                                      "},{"location":"man3/ERR_put_error/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_raise(), ERR_raise_data(), ERR_put_error(), ERR_add_error_data(), ERR_add_error_vdata() ERR_add_error_txt(), and ERR_add_error_mem_bio() return no values.

                                                                                                                                      "},{"location":"man3/ERR_put_error/#notes","title":"NOTES","text":"

                                                                                                                                      ERR_raise(), ERR_raise() and ERR_put_error() are implemented as macros.

                                                                                                                                      "},{"location":"man3/ERR_put_error/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      ERR_load_strings(3), ERR_get_next_error_library(3)

                                                                                                                                      "},{"location":"man3/ERR_put_error/#history","title":"HISTORY","text":"

                                                                                                                                      ERR_raise, ERR_raise_data, ERR_add_error_txt() and ERR_add_error_mem_bio() were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/ERR_put_error/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_remove_state/","title":"ERR_remove_state","text":""},{"location":"man3/ERR_remove_state/#name","title":"NAME","text":"

                                                                                                                                      ERR_remove_thread_state, ERR_remove_state - DEPRECATED

                                                                                                                                      "},{"location":"man3/ERR_remove_state/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                      The following function has been deprecated since OpenSSL 1.0.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void ERR_remove_state(unsigned long tid);\n

                                                                                                                                      The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      void ERR_remove_thread_state(void *tid);\n
                                                                                                                                      "},{"location":"man3/ERR_remove_state/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_remove_state() frees the error queue associated with the specified thread, identified by tid. ERR_remove_thread_state() does the same thing, except the identifier is an opaque pointer.

                                                                                                                                      "},{"location":"man3/ERR_remove_state/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_remove_state() and ERR_remove_thread_state() return no value.

                                                                                                                                      "},{"location":"man3/ERR_remove_state/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      LOPENSSL_init_crypto(3)

                                                                                                                                      "},{"location":"man3/ERR_remove_state/#history","title":"HISTORY","text":"

                                                                                                                                      ERR_remove_state() was deprecated in OpenSSL 1.0.0 and ERR_remove_thread_state() was deprecated in OpenSSL 1.1.0; these functions and should not be used.

                                                                                                                                      "},{"location":"man3/ERR_remove_state/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/ERR_set_mark/","title":"ERR_set_mark","text":""},{"location":"man3/ERR_set_mark/#name","title":"NAME","text":"

                                                                                                                                      ERR_set_mark, ERR_clear_last_mark, ERR_pop_to_mark - set mark, clear mark and pop errors until mark

                                                                                                                                      "},{"location":"man3/ERR_set_mark/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/err.h>\n\nint ERR_set_mark(void);\nint ERR_pop_to_mark(void);\nint ERR_clear_last_mark(void);\n
                                                                                                                                      "},{"location":"man3/ERR_set_mark/#description","title":"DESCRIPTION","text":"

                                                                                                                                      ERR_set_mark() sets a mark on the current topmost error record if there is one.

                                                                                                                                      ERR_pop_to_mark() will pop the top of the error stack until a mark is found. The mark is then removed. If there is no mark, the whole stack is removed.

                                                                                                                                      ERR_clear_last_mark() removes the last mark added if there is one.

                                                                                                                                      "},{"location":"man3/ERR_set_mark/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      ERR_set_mark() returns 0 if the error stack is empty, otherwise 1.

                                                                                                                                      ERR_clear_last_mark() and ERR_pop_to_mark() return 0 if there was no mark in the error stack, which implies that the stack became empty, otherwise 1.

                                                                                                                                      "},{"location":"man3/ERR_set_mark/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EVP_ASYM_CIPHER_free/","title":"EVP_ASYM_CIPHER_free","text":""},{"location":"man3/EVP_ASYM_CIPHER_free/#name","title":"NAME","text":"

                                                                                                                                      EVP_ASYM_CIPHER_fetch, EVP_ASYM_CIPHER_free, EVP_ASYM_CIPHER_up_ref, EVP_ASYM_CIPHER_is_a, EVP_ASYM_CIPHER_get0_provider, EVP_ASYM_CIPHER_do_all_provided, EVP_ASYM_CIPHER_names_do_all, EVP_ASYM_CIPHER_get0_name, EVP_ASYM_CIPHER_get0_description, EVP_ASYM_CIPHER_gettable_ctx_params, EVP_ASYM_CIPHER_settable_ctx_params - Functions to manage EVP_ASYM_CIPHER algorithm objects

                                                                                                                                      "},{"location":"man3/EVP_ASYM_CIPHER_free/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/evp.h>\n\nEVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                                       const char *properties);\nvoid EVP_ASYM_CIPHER_free(EVP_ASYM_CIPHER *cipher);\nint EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher);\nconst char *EVP_ASYM_CIPHER_get0_name(const EVP_ASYM_CIPHER *cipher);\nint EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name);\nOSSL_PROVIDER *EVP_ASYM_CIPHER_get0_provider(const EVP_ASYM_CIPHER *cipher);\nvoid EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                     void (*fn)(EVP_ASYM_CIPHER *cipher,\n                                                void *arg),\n                                     void *arg);\nint EVP_ASYM_CIPHER_names_do_all(const EVP_ASYM_CIPHER *cipher,\n                                 void (*fn)(const char *name, void *data),\n                                 void *data);\nconst char *EVP_ASYM_CIPHER_get0_description(const EVP_ASYM_CIPHER *cipher);\nconst OSSL_PARAM *EVP_ASYM_CIPHER_gettable_ctx_params(const EVP_ASYM_CIPHER *cip);\nconst OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *cip);\n
                                                                                                                                      "},{"location":"man3/EVP_ASYM_CIPHER_free/#description","title":"DESCRIPTION","text":"

                                                                                                                                      EVP_ASYM_CIPHER_fetch() fetches the implementation for the given algorithm from any provider offering it, within the criteria given by the properties and in the scope of the given library context ctx (see OSSL_LIB_CTX(3)). The algorithm will be one offering functions for performing asymmetric cipher related tasks such as asymmetric encryption and decryption. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                      The returned value must eventually be freed with EVP_ASYM_CIPHER_free().

                                                                                                                                      EVP_ASYM_CIPHER_free() decrements the reference count for the EVP_ASYM_CIPHER structure. Typically this structure will have been obtained from an earlier call to EVP_ASYM_CIPHER_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

                                                                                                                                      EVP_ASYM_CIPHER_up_ref() increments the reference count for an EVP_ASYM_CIPHER structure.

                                                                                                                                      EVP_ASYM_CIPHER_is_a() returns 1 if cipher is an implementation of an algorithm that's identifiable with name, otherwise 0.

                                                                                                                                      EVP_ASYM_CIPHER_get0_provider() returns the provider that cipher was fetched from.

                                                                                                                                      EVP_ASYM_CIPHER_do_all_provided() traverses all EVP_ASYM_CIPHERs implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                      EVP_ASYM_CIPHER_get0_name() returns the algorithm name from the provided implementation for the given cipher. Note that the cipher may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the cipher object and should not be freed by the caller.

                                                                                                                                      EVP_ASYM_CIPHER_names_do_all() traverses all names for cipher, and calls fn with each name and data.

                                                                                                                                      EVP_ASYM_CIPHER_get0_description() returns a description of the cipher, meant for display and human consumption. The description is at the discretion of the cipher implementation.

                                                                                                                                      EVP_ASYM_CIPHER_gettable_ctx_params() and EVP_ASYM_CIPHER_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a key encryption algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

                                                                                                                                      "},{"location":"man3/EVP_ASYM_CIPHER_free/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      EVP_ASYM_CIPHER_fetch() returns a pointer to an EVP_ASYM_CIPHER for success or NULL for failure.

                                                                                                                                      EVP_ASYM_CIPHER_up_ref() returns 1 for success or 0 otherwise.

                                                                                                                                      EVP_ASYM_CIPHER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                      EVP_ASYM_CIPHER_gettable_ctx_params() and EVP_ASYM_CIPHER_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

                                                                                                                                      "},{"location":"man3/EVP_ASYM_CIPHER_free/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      \"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

                                                                                                                                      "},{"location":"man3/EVP_ASYM_CIPHER_free/#history","title":"HISTORY","text":"

                                                                                                                                      The functions described here were added in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/EVP_ASYM_CIPHER_free/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/","title":"EVP_BytesToKey","text":""},{"location":"man3/EVP_BytesToKey/#name","title":"NAME","text":"

                                                                                                                                      EVP_BytesToKey - password based encryption routine

                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/evp.h>\n\nint EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,\n                   const unsigned char *salt,\n                   const unsigned char *data, int datal, int count,\n                   unsigned char *key, unsigned char *iv);\n
                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/#description","title":"DESCRIPTION","text":"

                                                                                                                                      EVP_BytesToKey() derives a key and IV from various parameters. type is the cipher to derive the key and IV for. md is the message digest to use. The salt parameter is used as a salt in the derivation: it should point to an 8 byte buffer or NULL if no salt is used. data is a buffer containing datal bytes which is used to derive the keying data. count is the iteration count to use. The derived key and IV will be written to key and iv respectively.

                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/#notes","title":"NOTES","text":"

                                                                                                                                      A typical application of this function is to derive keying material for an encryption algorithm from a password in the data parameter.

                                                                                                                                      Increasing the count parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                                                                                                                      If the total key and IV length is less than the digest length and MD5 is used then the derivation algorithm is compatible with PKCS#5 v1.5 otherwise a non standard extension is used to derive the extra data.

                                                                                                                                      Newer applications should use a more modern algorithm such as PBKDF2 as defined in PKCS#5v2.1 and provided by PKCS5_PBKDF2_HMAC.

                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/#key-derivation-algorithm","title":"KEY DERIVATION ALGORITHM","text":"

                                                                                                                                      The key and IV is derived by concatenating D_1, D_2, etc until enough data is available for the key and IV. D_i is defined as:

                                                                                                                                          D_i = HASH^count(D_(i-1) || data || salt)\n

                                                                                                                                      where || denotes concatenation, D_0 is empty, HASH is the digest algorithm in use, HASH^1(data) is simply HASH(data), HASH^2(data) is HASH(HASH(data)) and so on.

                                                                                                                                      The initial bytes are used for the key and the subsequent bytes for the IV.

                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      If data is NULL, then EVP_BytesToKey() returns the number of bytes needed to store the derived key. Otherwise, EVP_BytesToKey() returns the size of the derived key in bytes, or 0 on error.

                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      evp(7), RAND_bytes(3), PKCS5_PBKDF2_HMAC(3), EVP_EncryptInit(3)

                                                                                                                                      "},{"location":"man3/EVP_BytesToKey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/","title":"EVP_CIPHER_CTX_get_cipher_data","text":""},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#name","title":"NAME","text":"

                                                                                                                                      EVP_CIPHER_CTX_get_cipher_data, EVP_CIPHER_CTX_set_cipher_data - Routines to inspect and modify EVP_CIPHER_CTX objects

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/evp.h>\n\nvoid *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);\nvoid *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);\n
                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The EVP_CIPHER_CTX_get_cipher_data() function returns a pointer to the cipher data relevant to EVP_CIPHER_CTX. The contents of this data is specific to the particular implementation of the cipher. For example this data can be used by engines to store engine specific information. The data is automatically allocated and freed by OpenSSL, so applications and engines should not normally free this directly (but see below).

                                                                                                                                      The EVP_CIPHER_CTX_set_cipher_data() function allows an application or engine to replace the cipher data with new data. A pointer to any existing cipher data is returned from this function. If the old data is no longer required then it should be freed through a call to OPENSSL_free().

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      The EVP_CIPHER_CTX_get_cipher_data() function returns a pointer to the current cipher data for the EVP_CIPHER_CTX.

                                                                                                                                      The EVP_CIPHER_CTX_set_cipher_data() function returns a pointer to the old cipher data for the EVP_CIPHER_CTX.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#history","title":"HISTORY","text":"

                                                                                                                                      The EVP_CIPHER_CTX_get_cipher_data() and EVP_CIPHER_CTX_set_cipher_data() functions were added in OpenSSL 1.1.0.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_cipher_data/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/","title":"EVP_CIPHER_CTX_get_original_iv","text":""},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#name","title":"NAME","text":"

                                                                                                                                      EVP_CIPHER_CTX_get_original_iv, EVP_CIPHER_CTX_get_updated_iv, EVP_CIPHER_CTX_iv, EVP_CIPHER_CTX_original_iv, EVP_CIPHER_CTX_iv_noconst - Routines to inspect EVP_CIPHER_CTX IV data

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/evp.h>\n\nint EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);\nint EVP_CIPHER_CTX_get_updated_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx);\nconst unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);\nunsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);\n
                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#description","title":"DESCRIPTION","text":"

                                                                                                                                      EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() copy initialization vector (IV) information from the EVP_CIPHER_CTX into the caller-supplied buffer. EVP_CIPHER_CTX_get_iv_length(3) can be used to determine an appropriate buffer size, and if the supplied buffer is too small, an error will be returned (and no data copied). EVP_CIPHER_CTX_get_original_iv() accesses the (\"original\") IV that was supplied when the EVP_CIPHER_CTX was initialized, and EVP_CIPHER_CTX_get_updated_iv() accesses the current \"IV state\" of the cipher, which is updated during cipher operation for certain cipher modes (e.g., CBC and OFB).

                                                                                                                                      The functions EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst() are deprecated functions that provide similar (at a conceptual level) functionality. EVP_CIPHER_CTX_iv() returns a pointer to the beginning of the \"IV state\" as maintained internally in the EVP_CIPHER_CTX; EVP_CIPHER_CTX_original_iv() returns a pointer to the beginning of the (\"original\") IV, as maintained by the EVP_CIPHER_CTX, that was provided when the EVP_CIPHER_CTX was initialized; and EVP_CIPHER_CTX_get_iv_noconst() is the same as EVP_CIPHER_CTX_iv() but has a different return type for the pointer.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() return 1 on success and 0 on failure.

                                                                                                                                      The functions EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst() return a pointer to an IV as an array of bytes on success, and NULL on failure.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#history","title":"HISTORY","text":"

                                                                                                                                      EVP_CIPHER_CTX_get_original_iv() and EVP_CIPHER_CTX_get_updated_iv() were added in OpenSSL 3.0.0.

                                                                                                                                      EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst() were added in OpenSSL 1.1.0, and were deprecated in OpenSSL 3.0.0.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_CTX_get_original_iv/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_meth_new/","title":"EVP_CIPHER_meth_new","text":""},{"location":"man3/EVP_CIPHER_meth_new/#name","title":"NAME","text":"

                                                                                                                                      EVP_CIPHER_meth_new, EVP_CIPHER_meth_dup, EVP_CIPHER_meth_free, EVP_CIPHER_meth_set_iv_length, EVP_CIPHER_meth_set_flags, EVP_CIPHER_meth_set_impl_ctx_size, EVP_CIPHER_meth_set_init, EVP_CIPHER_meth_set_do_cipher, EVP_CIPHER_meth_set_cleanup, EVP_CIPHER_meth_set_set_asn1_params, EVP_CIPHER_meth_set_get_asn1_params, EVP_CIPHER_meth_set_ctrl, EVP_CIPHER_meth_get_init, EVP_CIPHER_meth_get_do_cipher, EVP_CIPHER_meth_get_cleanup, EVP_CIPHER_meth_get_set_asn1_params, EVP_CIPHER_meth_get_get_asn1_params, EVP_CIPHER_meth_get_ctrl - Routines to build up EVP_CIPHER methods

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/evp.h>\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len);\nEVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher);\nvoid EVP_CIPHER_meth_free(EVP_CIPHER *cipher);\n\nint EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len);\nint EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags);\nint EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size);\nint EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,\n                             int (*init)(EVP_CIPHER_CTX *ctx,\n                                         const unsigned char *key,\n                                         const unsigned char *iv,\n                                         int enc));\nint EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,\n                                  int (*do_cipher)(EVP_CIPHER_CTX *ctx,\n                                                   unsigned char *out,\n                                                   const unsigned char *in,\n                                                   size_t inl));\nint EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,\n                                int (*cleanup)(EVP_CIPHER_CTX *));\nint EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher,\n                                        int (*set_asn1_parameters)(EVP_CIPHER_CTX *,\n                                                                   ASN1_TYPE *));\nint EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher,\n                                        int (*get_asn1_parameters)(EVP_CIPHER_CTX *,\n                                                                   ASN1_TYPE *));\nint EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher,\n                             int (*ctrl)(EVP_CIPHER_CTX *, int type,\n                                         int arg, void *ptr));\n\nint (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,\n                                                          const unsigned char *key,\n                                                          const unsigned char *iv,\n                                                          int enc);\nint (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,\n                                                               unsigned char *out,\n                                                               const unsigned char *in,\n                                                               size_t inl);\nint (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *);\nint (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,\n                                                                     ASN1_TYPE *);\nint (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,\n                                                                     ASN1_TYPE *);\nint (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,\n                                                          int type, int arg,\n                                                          void *ptr);\n
                                                                                                                                      "},{"location":"man3/EVP_CIPHER_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                      All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                                                                                                                                      The EVP_CIPHER type is a structure for symmetric cipher method implementation.

                                                                                                                                      EVP_CIPHER_meth_new() creates a new EVP_CIPHER structure.

                                                                                                                                      EVP_CIPHER_meth_dup() creates a copy of cipher.

                                                                                                                                      EVP_CIPHER_meth_free() destroys a EVP_CIPHER structure. If the argument is NULL, nothing is done.

                                                                                                                                      EVP_CIPHER_meth_set_iv_length() sets the length of the IV. This is only needed when the implemented cipher mode requires it.

                                                                                                                                      EVP_CIPHER_meth_set_flags() sets the flags to describe optional behaviours in the particular cipher. With the exception of cipher modes, of which only one may be present, several flags can be or'd together. The available flags are:

                                                                                                                                      • EVP_CIPH_STREAM_CIPHER, EVP_CIPH_ECB_MODE EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE, EVP_CIPH_OFB_MODE, EVP_CIPH_CTR_MODE, EVP_CIPH_GCM_MODE, EVP_CIPH_CCM_MODE, EVP_CIPH_XTS_MODE, EVP_CIPH_WRAP_MODE, EVP_CIPH_OCB_MODE, EVP_CIPH_SIV_MODE

                                                                                                                                        The cipher mode.

                                                                                                                                      • EVP_CIPH_VARIABLE_LENGTH

                                                                                                                                        This cipher is of variable length.

                                                                                                                                      • EVP_CIPH_CUSTOM_IV

                                                                                                                                        Storing and initialising the IV is left entirely to the implementation.

                                                                                                                                      • EVP_CIPH_ALWAYS_CALL_INIT

                                                                                                                                        Set this if the implementation's init() function should be called even if key is NULL.

                                                                                                                                      • EVP_CIPH_CTRL_INIT

                                                                                                                                        Set this to have the implementation's ctrl() function called with command code EVP_CTRL_INIT early in its setup.

                                                                                                                                      • EVP_CIPH_CUSTOM_KEY_LENGTH

                                                                                                                                        Checking and setting the key length after creating the EVP_CIPHER is left to the implementation. Whenever someone uses EVP_CIPHER_CTX_set_key_length() on a EVP_CIPHER with this flag set, the implementation's ctrl() function will be called with the control code EVP_CTRL_SET_KEY_LENGTH and the key length in arg.

                                                                                                                                      • EVP_CIPH_NO_PADDING

                                                                                                                                        Don't use standard block padding.

                                                                                                                                      • EVP_CIPH_RAND_KEY

                                                                                                                                        Making a key with random content is left to the implementation. This is done by calling the implementation's ctrl() function with the control code EVP_CTRL_RAND_KEY and the pointer to the key memory storage in ptr.

                                                                                                                                      • EVP_CIPH_CUSTOM_COPY

                                                                                                                                        Set this to have the implementation's ctrl() function called with command code EVP_CTRL_COPY at the end of EVP_CIPHER_CTX_copy(). The intended use is for further things to deal with after the implementation specific data block has been copied. The destination EVP_CIPHER_CTX is passed to the control with the ptr parameter. The implementation specific data block is reached with EVP_CIPHER_CTX_get_cipher_data().

                                                                                                                                      • EVP_CIPH_FLAG_DEFAULT_ASN1

                                                                                                                                        Use the default EVP routines to pass IV to and from ASN.1.

                                                                                                                                      • EVP_CIPH_FLAG_LENGTH_BITS

                                                                                                                                        Signals that the length of the input buffer for encryption / decryption is to be understood as the number of bits instead of bytes for this implementation. This is only useful for CFB1 ciphers.

                                                                                                                                      • EVP_CIPH_FLAG_CTS

                                                                                                                                        Indicates that the cipher uses ciphertext stealing. This is currently used to indicate that the cipher is a one shot that only allows a single call to EVP_CipherUpdate().

                                                                                                                                      • EVP_CIPH_FLAG_CUSTOM_CIPHER

                                                                                                                                        This indicates that the implementation takes care of everything, including padding, buffering and finalization. The EVP routines will simply give them control and do nothing more.

                                                                                                                                      • EVP_CIPH_FLAG_AEAD_CIPHER

                                                                                                                                        This indicates that this is an AEAD cipher implementation.

                                                                                                                                      • EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK

                                                                                                                                        Allow interleaving of crypto blocks, a particular optimization only applicable to certain TLS ciphers.

                                                                                                                                      EVP_CIPHER_meth_set_impl_ctx_size() sets the size of the EVP_CIPHER's implementation context so that it can be automatically allocated.

                                                                                                                                      EVP_CIPHER_meth_set_init() sets the cipher init function for cipher. The cipher init function is called by EVP_CipherInit(), EVP_CipherInit_ex(), EVP_EncryptInit(), EVP_EncryptInit_ex(), EVP_DecryptInit(), EVP_DecryptInit_ex().

                                                                                                                                      EVP_CIPHER_meth_set_do_cipher() sets the cipher function for cipher. The cipher function is called by EVP_CipherUpdate(), EVP_EncryptUpdate(), EVP_DecryptUpdate(), EVP_CipherFinal(), EVP_EncryptFinal(), EVP_EncryptFinal_ex(), EVP_DecryptFinal() and EVP_DecryptFinal_ex().

                                                                                                                                      EVP_CIPHER_meth_set_cleanup() sets the function for cipher to do extra cleanup before the method's private data structure is cleaned out and freed. Note that the cleanup function is passed a EVP_CIPHER_CTX *, the private data structure is then available with EVP_CIPHER_CTX_get_cipher_data(). This cleanup function is called by EVP_CIPHER_CTX_reset() and EVP_CIPHER_CTX_free().

                                                                                                                                      EVP_CIPHER_meth_set_set_asn1_params() sets the function for cipher to set the AlgorithmIdentifier \"parameter\" based on the passed cipher. This function is called by EVP_CIPHER_param_to_asn1(). EVP_CIPHER_meth_set_get_asn1_params() sets the function for cipher that sets the cipher parameters based on an ASN.1 AlgorithmIdentifier \"parameter\". Both these functions are needed when there is a need for custom data (more or other than the cipher IV). They are called by EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() respectively if defined.

                                                                                                                                      EVP_CIPHER_meth_set_ctrl() sets the control function for cipher.

                                                                                                                                      EVP_CIPHER_meth_get_init(), EVP_CIPHER_meth_get_do_cipher(), EVP_CIPHER_meth_get_cleanup(), EVP_CIPHER_meth_get_set_asn1_params(), EVP_CIPHER_meth_get_get_asn1_params() and EVP_CIPHER_meth_get_ctrl() are all used to retrieve the method data given with the EVP_CIPHER_meth_set_*() functions above.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                      EVP_CIPHER_meth_new() and EVP_CIPHER_meth_dup() return a pointer to a newly created EVP_CIPHER, or NULL on failure. All EVP_CIPHER_meth_set_*() functions return 1. All EVP_CIPHER_meth_get_*() functions return pointers to their respective cipher function.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_meth_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                      EVP_EncryptInit(3)

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                      All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                      The functions described here were added in OpenSSL 1.1.0. The EVP_CIPHER structure created with these functions became reference counted in OpenSSL 3.0.

                                                                                                                                      "},{"location":"man3/EVP_CIPHER_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                      Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                      "},{"location":"man3/EVP_DigestInit/","title":"EVP_DigestInit","text":""},{"location":"man3/EVP_DigestInit/#name","title":"NAME","text":"

                                                                                                                                      EVP_MD_fetch, EVP_MD_up_ref, EVP_MD_free, EVP_MD_get_params, EVP_MD_gettable_params, EVP_MD_CTX_new, EVP_MD_CTX_reset, EVP_MD_CTX_free, EVP_MD_CTX_dup, EVP_MD_CTX_copy, EVP_MD_CTX_copy_ex, EVP_MD_CTX_ctrl, EVP_MD_CTX_set_params, EVP_MD_CTX_get_params, EVP_MD_settable_ctx_params, EVP_MD_gettable_ctx_params, EVP_MD_CTX_settable_params, EVP_MD_CTX_gettable_params, EVP_MD_CTX_set_flags, EVP_MD_CTX_clear_flags, EVP_MD_CTX_test_flags, EVP_Q_digest, EVP_Digest, EVP_DigestInit_ex2, EVP_DigestInit_ex, EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal_ex, EVP_DigestFinalXOF, EVP_DigestFinal, EVP_MD_is_a, EVP_MD_get0_name, EVP_MD_get0_description, EVP_MD_names_do_all, EVP_MD_get0_provider, EVP_MD_get_type, EVP_MD_get_pkey_type, EVP_MD_get_size, EVP_MD_get_block_size, EVP_MD_get_flags, EVP_MD_CTX_get0_name, EVP_MD_CTX_md, EVP_MD_CTX_get0_md, EVP_MD_CTX_get1_md, EVP_MD_CTX_get_type, EVP_MD_CTX_get_size, EVP_MD_CTX_get_block_size, EVP_MD_CTX_get0_md_data, EVP_MD_CTX_update_fn, EVP_MD_CTX_set_update_fn, EVP_md_null, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj, EVP_MD_CTX_get_pkey_ctx, EVP_MD_CTX_set_pkey_ctx, EVP_MD_do_all_provided, EVP_MD_type, EVP_MD_nid, EVP_MD_name, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, EVP_MD_flags, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_MD_CTX_pkey_ctx, EVP_MD_CTX_md_data - EVP digest routines

                                                                                                                                      "},{"location":"man3/EVP_DigestInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                      #include <openssl/evp.h>\n\nEVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                     const char *properties);\nint EVP_MD_up_ref(EVP_MD *md);\nvoid EVP_MD_free(EVP_MD *md);\nint EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest);\nEVP_MD_CTX *EVP_MD_CTX_new(void);\nint EVP_MD_CTX_reset(EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_free(EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void* p2);\nint EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]);\nint EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md);\nconst OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md);\nconst OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx);\nconst OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);\nvoid EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);\nint EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);\n\nint EVP_Q_digest(OSSL_LIB_CTX *libctx, const char *name, const char *propq,\n                 const void *data, size_t datalen,\n                 unsigned char *md, size_t *mdlen);\nint EVP_Digest(const void *data, size_t count, unsigned char *md,\n               unsigned int *size, const EVP_MD *type, ENGINE *impl);\nint EVP_DigestInit_ex2(EVP_MD_CTX *ctx, const EVP_MD *type,\n                       const OSSL_PARAM params[]);\nint EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\nint EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);\nint EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);\nint EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, size_t len);\n\nEVP_MD_CTX *EVP_MD_CTX_dup(const EVP_MD_CTX *in);\nint EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);\n\nint EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);\nint EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);\n\nint EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in);\n\nconst char *EVP_MD_get0_name(const EVP_MD *md);\nconst char *EVP_MD_get0_description(const EVP_MD *md);\nint EVP_MD_is_a(const EVP_MD *md, const char *name);\nint EVP_MD_names_do_all(const EVP_MD *md,\n                        void (*fn)(const char *name, void *data),\n                        void *data);\nconst OSSL_PROVIDER *EVP_MD_get0_provider(const EVP_MD *md);\nint EVP_MD_get_type(const EVP_MD *md);\nint EVP_MD_get_pkey_type(const EVP_MD *md);\nint EVP_MD_get_size(const EVP_MD *md);\nint EVP_MD_get_block_size(const EVP_MD *md);\nunsigned long EVP_MD_get_flags(const EVP_MD *md);\n\nconst EVP_MD *EVP_MD_CTX_get0_md(const EVP_MD_CTX *ctx);\nEVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx);\nconst char *EVP_MD_CTX_get0_name(const EVP_MD_CTX *ctx);\nint EVP_MD_CTX_get_size(const EVP_MD_CTX *ctx);\nint EVP_MD_CTX_get_block_size(const EVP_MD_CTX *ctx);\nint EVP_MD_CTX_get_type(const EVP_MD_CTX *ctx);\nvoid *EVP_MD_CTX_get0_md_data(const EVP_MD_CTX *ctx);\n\nconst EVP_MD *EVP_md_null(void);\n\nconst EVP_MD *EVP_get_digestbyname(const char *name);\nconst EVP_MD *EVP_get_digestbynid(int type);\nconst EVP_MD *EVP_get_digestbyobj(const ASN1_OBJECT *o);\n\nEVP_PKEY_CTX *EVP_MD_CTX_get_pkey_ctx(const EVP_MD_CTX *ctx);\nvoid EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx);\n\nvoid EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,\n                            void (*fn)(EVP_MD *mac, void *arg),\n                            void *arg);\n\n#define EVP_MD_type EVP_MD_get_type\n#define EVP_MD_nid EVP_MD_get_type\n#define EVP_MD_name EVP_MD_get0_name\n#define EVP_MD_pkey_type EVP_MD_get_pkey_type\n#define EVP_MD_size EVP_MD_get_size\n#define EVP_MD_block_size EVP_MD_get_block_size\n#define EVP_MD_flags EVP_MD_get_flags\n#define EVP_MD_CTX_size EVP_MD_CTX_get_size\n#define EVP_MD_CTX_block_size EVP_MD_CTX_get_block_size\n#define EVP_MD_CTX_type EVP_MD_CTX_get_type\n#define EVP_MD_CTX_pkey_ctx EVP_MD_CTX_get_pkey_ctx\n#define EVP_MD_CTX_md_data EVP_MD_CTX_get0_md_data\n

                                                                                                                                      The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                      const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);\n\nint (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,\n                                             const void *data, size_t count);\n\nvoid EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,\n                              int (*update)(EVP_MD_CTX *ctx,\n                                            const void *data, size_t count));\n
                                                                                                                                      "},{"location":"man3/EVP_DigestInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                      The EVP digest routines are a high-level interface to message digests, and should be used instead of the digest-specific functions.

                                                                                                                                      The EVP_MD type is a structure for digest method implementation.

                                                                                                                                      • EVP_MD_fetch()

                                                                                                                                        Fetches the digest implementation for the given algorithm from any provider offering it, within the criteria given by the properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                        The returned value must eventually be freed with EVP_MD_free().

                                                                                                                                        Fetched EVP_MD structures are reference counted.

                                                                                                                                      • EVP_MD_up_ref()

                                                                                                                                        Increments the reference count for an EVP_MD structure.

                                                                                                                                      • EVP_MD_free()

                                                                                                                                        Decrements the reference count for the fetched EVP_MD structure. If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

                                                                                                                                      • EVP_MD_CTX_new()

                                                                                                                                        Allocates and returns a digest context.

                                                                                                                                      • EVP_MD_CTX_reset()

                                                                                                                                        Resets the digest context ctx. This can be used to reuse an already existing context.

                                                                                                                                      • EVP_MD_CTX_free()

                                                                                                                                        Cleans up digest context ctx and frees up the space allocated to it. If the argument is NULL, nothing is done.

                                                                                                                                      • EVP_MD_CTX_ctrl()

                                                                                                                                        This is a legacy method. EVP_MD_CTX_set_params() and EVP_MD_CTX_get_params() is the mechanism that should be used to set and get parameters that are used by providers.

                                                                                                                                        Performs digest-specific control actions on context ctx. The control command is indicated in cmd and any additional arguments in p1 and p2. EVP_MD_CTX_ctrl() must be called after EVP_DigestInit_ex2(). Other restrictions may apply depending on the control type and digest implementation.

                                                                                                                                        If this function happens to be used with a fetched EVP_MD, it will translate the controls that are known to OpenSSL into OSSL_PARAM(3) parameters with keys defined by OpenSSL and call EVP_MD_CTX_get_params() or EVP_MD_CTX_set_params() as is appropriate for each control command.

                                                                                                                                        See \"CONTROLS\" below for more information, including what translations are being done.

                                                                                                                                      • EVP_MD_get_params()

                                                                                                                                        Retrieves the requested list of params from a MD md. See \"PARAMETERS\" below for more information.

                                                                                                                                      • EVP_MD_CTX_get_params()

                                                                                                                                        Retrieves the requested list of params from a MD context ctx. See \"PARAMETERS\" below for more information.

                                                                                                                                      • EVP_MD_CTX_set_params()

                                                                                                                                        Sets the list of params into a MD context ctx. See \"PARAMETERS\" below for more information.

                                                                                                                                      • EVP_MD_gettable_params()

                                                                                                                                        Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_MD_get_params().

                                                                                                                                      • EVP_MD_gettable_ctx_params(), EVP_MD_CTX_gettable_params()

                                                                                                                                        Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_MD_CTX_get_params(). EVP_MD_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_MD_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                      • EVP_MD_settable_ctx_params(), EVP_MD_CTX_settable_params()

                                                                                                                                        Get a constant OSSL_PARAM(3) array that describes the settable parameters that can be used with EVP_MD_CTX_set_params(). EVP_MD_settable_ctx_params() returns the parameters that can be set from the algorithm, whereas EVP_MD_CTX_settable_params() returns the parameters that can be set in the context's current state.

                                                                                                                                      • EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags(), EVP_MD_CTX_test_flags()

                                                                                                                                        Sets, clears and tests ctx flags. See \"FLAGS\" below for more information.

                                                                                                                                      • EVP_Q_digest() is a quick one-shot digest function.

                                                                                                                                        It hashes datalen bytes of data at data using the digest algorithm name, which is fetched using the optional libctx and propq parameters. The digest value is placed in md and its length is written at mdlen if the pointer is not NULL. At most EVP_MAX_MD_SIZE bytes will be written.

                                                                                                                                      • EVP_Digest()

                                                                                                                                        A wrapper around the Digest Init_ex, Update and Final_ex functions. Hashes count bytes of data at data using a digest type from ENGINE impl. The digest value is placed in md and its length is written at size if the pointer is not NULL. At most EVP_MAX_MD_SIZE bytes will be written. If impl is NULL the default implementation of digest type is used.

                                                                                                                                      • EVP_DigestInit_ex2()

                                                                                                                                        Sets up digest context ctx to use a digest type. type is typically supplied by a function such as EVP_sha1(), or a value explicitly fetched with EVP_MD_fetch().

                                                                                                                                        The parameters params are set on the context after initialisation.

                                                                                                                                        The type parameter can be NULL if ctx has been already initialized with another EVP_DigestInit_ex() call and has not been reset with EVP_MD_CTX_reset().

                                                                                                                                      • EVP_DigestInit_ex()

                                                                                                                                        Sets up digest context ctx to use a digest type. type is typically supplied by a function such as EVP_sha1(), or a value explicitly fetched with EVP_MD_fetch().

                                                                                                                                        If impl is non-NULL, its implementation of the digest type is used if there is one, and if not, the default implementation is used.

                                                                                                                                        The type parameter can be NULL if ctx has been already initialized with another EVP_DigestInit_ex() call and has not been reset with EVP_MD_CTX_reset().

                                                                                                                                      • EVP_DigestUpdate()

                                                                                                                                        Hashes cnt bytes of data at d into the digest context ctx. This function can be called several times on the same ctx to hash additional data.

                                                                                                                                      • EVP_DigestFinal_ex()

                                                                                                                                        Retrieves the digest value from ctx and places it in md. If the s parameter is not NULL then the number of bytes of data written (i.e. the length of the digest) will be written to the integer at s, at most EVP_MAX_MD_SIZE bytes will be written. After calling EVP_DigestFinal_ex() no additional calls to EVP_DigestUpdate() can be made, but EVP_DigestInit_ex2() can be called to initialize a new digest operation.

                                                                                                                                      • EVP_DigestFinalXOF()

                                                                                                                                        Interfaces to extendable-output functions, XOFs, such as SHAKE128 and SHAKE256. It retrieves the digest value from ctx and places it in len-sized md. After calling this function no additional calls to EVP_DigestUpdate() can be made, but EVP_DigestInit_ex2() can be called to initialize a new operation.

                                                                                                                                      • EVP_MD_CTX_dup()

                                                                                                                                        Can be used to duplicate the message digest state from in. This is useful to avoid multiple EVP_MD_fetch() calls or if large amounts of data are to be hashed which only differ in the last few bytes.

                                                                                                                                      • EVP_MD_CTX_copy_ex()

                                                                                                                                        Can be used to copy the message digest state from in to out. This is useful if large amounts of data are to be hashed which only differ in the last few bytes.

                                                                                                                                      • EVP_DigestInit()

                                                                                                                                        Behaves in the same way as EVP_DigestInit_ex2() except it doesn't set any parameters and calls EVP_MD_CTX_reset() so it cannot be used with an type of NULL.

                                                                                                                                      • EVP_DigestFinal()

                                                                                                                                        Similar to EVP_DigestFinal_ex() except after computing the digest the digest context ctx is automatically cleaned up with EVP_MD_CTX_reset().

                                                                                                                                      • EVP_MD_CTX_copy()

                                                                                                                                        Similar to EVP_MD_CTX_copy_ex() except the destination out does not have to be initialized.

                                                                                                                                      • EVP_MD_is_a()

                                                                                                                                        Returns 1 if md is an implementation of an algorithm that's identifiable with name, otherwise 0.

                                                                                                                                        If md is a legacy digest (it's the return value from the likes of EVP_sha256() rather than the result of an EVP_MD_fetch()), only cipher names registered with the default library context (see OSSL_LIB_CTX(3)) will be considered.

                                                                                                                                      • EVP_MD_get0_name(), EVP_MD_CTX_get0_name()

                                                                                                                                        Return the name of the given message digest. For fetched message digests with multiple names, only one of them is returned; it's recommended to use EVP_MD_names_do_all() instead.

                                                                                                                                      • EVP_MD_names_do_all()

                                                                                                                                        Traverses all names for the md, and calls fn with each name and data. This is only useful with fetched EVP_MDs.

                                                                                                                                      • EVP_MD_get0_description()

                                                                                                                                        Returns a description of the digest, meant for display and human consumption. The description is at the discretion of the digest implementation.

                                                                                                                                      • EVP_MD_get0_provider()

                                                                                                                                        Returns an OSSL_PROVIDER pointer to the provider that implements the given EVP_MD.

                                                                                                                                      • EVP_MD_get_size(), EVP_MD_CTX_get_size()

                                                                                                                                        Return the size of the message digest when passed an EVP_MD or an EVP_MD_CTX structure, i.e. the size of the hash.

                                                                                                                                      • EVP_MD_get_block_size(), EVP_MD_CTX_get_block_size()

                                                                                                                                        Return the block size of the message digest when passed an EVP_MD or an EVP_MD_CTX structure.

                                                                                                                                      • EVP_MD_get_type(), EVP_MD_CTX_get_type()

                                                                                                                                        Return the NID of the OBJECT IDENTIFIER representing the given message digest when passed an EVP_MD structure. For example, EVP_MD_get_type(EVP_sha1()) returns NID_sha1. This function is normally used when setting ASN1 OIDs.

                                                                                                                                      • EVP_MD_CTX_get0_md_data()

                                                                                                                                        Return the digest method private data for the passed EVP_MD_CTX. The space is allocated by OpenSSL and has the size originally set with EVP_MD_meth_set_app_datasize().

                                                                                                                                      • EVP_MD_CTX_get0_md(), EVP_MD_CTX_get1_md()

                                                                                                                                        EVP_MD_CTX_get0_md() returns the EVP_MD structure corresponding to the passed EVP_MD_CTX. This will be the same EVP_MD object originally passed to EVP_DigestInit_ex2() (or other similar function) when the EVP_MD_CTX was first initialised. Note that where explicit fetch is in use (see EVP_MD_fetch(3)) the value returned from this function will not have its reference count incremented and therefore it should not be used after the EVP_MD_CTX is freed. EVP_MD_CTX_get1_md() is the same except the ownership is passed to the caller and is from the passed EVP_MD_CTX.

                                                                                                                                      • EVP_MD_CTX_set_update_fn()

                                                                                                                                        Sets the update function for ctx to update. This is the function that is called by EVP_DigestUpdate(). If not set, the update function from the EVP_MD type specified at initialization is used.

                                                                                                                                      • EVP_MD_CTX_update_fn()

                                                                                                                                        Returns the update function for ctx.

                                                                                                                                      • EVP_MD_get_flags()

                                                                                                                                        Returns the md flags. Note that these are different from the EVP_MD_CTX ones. See EVP_MD_meth_set_flags(3) for more information.

                                                                                                                                      • EVP_MD_get_pkey_type()

                                                                                                                                        Returns the NID of the public key signing algorithm associated with this digest. For example EVP_sha1() is associated with RSA so this will return NID_sha1WithRSAEncryption. Since digests and signature algorithms are no longer linked this function is only retained for compatibility reasons.

                                                                                                                                      • EVP_md_null()

                                                                                                                                        A \"null\" message digest that does nothing: i.e. the hash it returns is of zero length.

                                                                                                                                      • EVP_get_digestbyname(), EVP_get_digestbynid(), EVP_get_digestbyobj()

                                                                                                                                        Returns an EVP_MD structure when passed a digest name, a digest NID or an ASN1_OBJECT structure respectively.

                                                                                                                                        The EVP_get_digestbyname() function is present for backwards compatibility with OpenSSL prior to version 3 and is different to the EVP_MD_fetch() function since it does not attempt to \"fetch\" an implementation of the cipher. Additionally, it only knows about digests that are built-in to OpenSSL and have an associated NID. Similarly EVP_get_digestbynid() and EVP_get_digestbyobj() also return objects without an associated implementation.

                                                                                                                                        When the digest objects returned by these functions are used (such as in a call to EVP_DigestInit_ex()) an implementation of the digest will be implicitly fetched from the loaded providers. This fetch could fail if no suitable implementation is available. Use EVP_MD_fetch() instead to explicitly fetch the algorithm and an associated implementation from a provider.

                                                                                                                                        See \"ALGORITHM FETCHING\" in crypto(7) for more information about fetching.

                                                                                                                                        The digest objects returned from these functions do not need to be freed with EVP_MD_free().

                                                                                                                                      • EVP_MD_CTX_get_pkey_ctx()

                                                                                                                                        Returns the EVP_PKEY_CTX assigned to ctx. The returned pointer should not be freed by the caller.

                                                                                                                                      • EVP_MD_CTX_set_pkey_ctx()

                                                                                                                                        Assigns an EVP_PKEY_CTX to EVP_MD_CTX. This is usually used to provide a customized EVP_PKEY_CTX to EVP_DigestSignInit(3) or EVP_DigestVerifyInit(3). The pctx passed to this function should be freed by the caller. A NULL pctx pointer is also allowed to clear the EVP_PKEY_CTX assigned to ctx. In such case, freeing the cleared EVP_PKEY_CTX or not depends on how the EVP_PKEY_CTX is created.

                                                                                                                                      • EVP_MD_do_all_provided()

                                                                                                                                        Traverses all messages digests implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                      "},{"location":"man3/EVP_DigestInit/#parameters","title":"PARAMETERS","text":"

                                                                                                                                      See OSSL_PARAM(3) for information about passing parameters.

                                                                                                                                      EVP_MD_CTX_set_params() can be used with the following OSSL_PARAM keys:

                                                                                                                                      • \"xoflen\" (OSSL_DIGEST_PARAM_XOFLEN) <unsigned integer>

                                                                                                                                        Sets the digest length for extendable output functions. It is used by the SHAKE algorithm and should not exceed what can be given using a size_t.

                                                                                                                                      • \"pad-type\" (OSSL_DIGEST_PARAM_PAD_TYPE) <unsigned integer>

                                                                                                                                        Sets the padding type. It is used by the MDC2 algorithm.

                                                                                                                                      EVP_MD_CTX_get_params() can be used with the following OSSL_PARAM keys:

                                                                                                                                      • \"micalg\" (OSSL_DIGEST_PARAM_MICALG) .

                                                                                                                                        Gets the digest Message Integrity Check algorithm string. This is used when creating S/MIME multipart/signed messages, as specified in RFC 3851. It may be used by external engines or providers.

                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#controls","title":"CONTROLS","text":"

                                                                                                                                        EVP_MD_CTX_ctrl() can be used to send the following standard controls:

                                                                                                                                        • EVP_MD_CTRL_MICALG

                                                                                                                                          Gets the digest Message Integrity Check algorithm string. This is used when creating S/MIME multipart/signed messages, as specified in RFC 3851. The string value is written to p2.

                                                                                                                                          When used with a fetched EVP_MD, EVP_MD_CTX_get_params() gets called with an OSSL_PARAM(3) item with the key \"micalg\" (OSSL_DIGEST_PARAM_MICALG).

                                                                                                                                        • EVP_MD_CTRL_XOF_LEN

                                                                                                                                          This control sets the digest length for extendable output functions to p1. Sending this control directly should not be necessary, the use of EVP_DigestFinalXOF() is preferred. Currently used by SHAKE.

                                                                                                                                          When used with a fetched EVP_MD, EVP_MD_CTX_get_params() gets called with an OSSL_PARAM(3) item with the key \"xoflen\" (OSSL_DIGEST_PARAM_XOFLEN).

                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#flags","title":"FLAGS","text":"

                                                                                                                                        EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags() and EVP_MD_CTX_test_flags() can be used the manipulate and test these EVP_MD_CTX flags:

                                                                                                                                        • EVP_MD_CTX_FLAG_ONESHOT

                                                                                                                                          This flag instructs the digest to optimize for one update only, if possible.

                                                                                                                                        • EVP_MD_CTX_FLAG_CLEANED

                                                                                                                                          This flag is for internal use only and must not be used in user code.

                                                                                                                                        • EVP_MD_CTX_FLAG_REUSE

                                                                                                                                          This flag is for internal use only and must not be used in user code.

                                                                                                                                        • EVP_MD_CTX_FLAG_NO_INIT

                                                                                                                                          This flag instructs EVP_DigestInit() and similar not to initialise the implementation specific data.

                                                                                                                                        • EVP_MD_CTX_FLAG_FINALISE

                                                                                                                                          Some functions such as EVP_DigestSign only finalise copies of internal contexts so additional data can be included after the finalisation call. This is inefficient if this functionality is not required, and can be disabled with this flag.

                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#return-values","title":"RETURN VALUES","text":"
                                                                                                                                        • EVP_MD_fetch()

                                                                                                                                          Returns a pointer to a EVP_MD for success or NULL for failure.

                                                                                                                                        • EVP_MD_up_ref()

                                                                                                                                          Returns 1 for success or 0 for failure.

                                                                                                                                        • EVP_Q_digest(), EVP_Digest(), EVP_DigestInit_ex2(), EVP_DigestInit_ex(), EVP_DigestInit(), EVP_DigestUpdate(), EVP_DigestFinal_ex(), EVP_DigestFinalXOF(), and EVP_DigestFinal()

                                                                                                                                          return 1 for success and 0 for failure.

                                                                                                                                        • EVP_MD_CTX_ctrl()

                                                                                                                                          Returns 1 if successful or 0 for failure.

                                                                                                                                        • EVP_MD_CTX_set_params(), EVP_MD_CTX_get_params()

                                                                                                                                          Returns 1 if successful or 0 for failure.

                                                                                                                                        • EVP_MD_CTX_settable_params(), EVP_MD_CTX_gettable_params()

                                                                                                                                          Return an array of constant OSSL_PARAM(3)s, or NULL if there is none to get.

                                                                                                                                        • EVP_MD_CTX_dup()

                                                                                                                                          Returns a new EVP_MD_CTX if successful or NULL on failure.

                                                                                                                                        • EVP_MD_CTX_copy_ex()

                                                                                                                                          Returns 1 if successful or 0 for failure.

                                                                                                                                        • EVP_MD_get_type(), EVP_MD_get_pkey_type()

                                                                                                                                          Returns the NID of the corresponding OBJECT IDENTIFIER or NID_undef if none exists.

                                                                                                                                        • EVP_MD_get_size(), EVP_MD_get_block_size(), EVP_MD_CTX_get_size(), EVP_MD_CTX_get_block_size()

                                                                                                                                          Returns the digest or block size in bytes or -1 for failure.

                                                                                                                                        • EVP_md_null()

                                                                                                                                          Returns a pointer to the EVP_MD structure of the \"null\" message digest.

                                                                                                                                        • EVP_get_digestbyname(), EVP_get_digestbynid(), EVP_get_digestbyobj()

                                                                                                                                          Returns either an EVP_MD structure or NULL if an error occurs.

                                                                                                                                        • EVP_MD_CTX_set_pkey_ctx()

                                                                                                                                          This function has no return value.

                                                                                                                                        • EVP_MD_names_do_all()

                                                                                                                                          Returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#notes","title":"NOTES","text":"

                                                                                                                                        The EVP interface to message digests should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the digest used and much more flexible.

                                                                                                                                        New applications should use the SHA-2 (such as EVP_sha256(3)) or the SHA-3 digest algorithms (such as EVP_sha3_512(3)). The other digest algorithms are still in common use.

                                                                                                                                        For most applications the impl parameter to EVP_DigestInit_ex() will be set to NULL to use the default digest implementation.

                                                                                                                                        Ignoring failure returns of EVP_DigestInit_ex(), EVP_DigestInit_ex2(), or EVP_DigestInit() can lead to undefined behavior on subsequent calls updating or finalizing the EVP_MD_CTX such as the EVP_DigestUpdate() or EVP_DigestFinal() functions. The only valid calls on the EVP_MD_CTX when initialization fails are calls that attempt another initialization of the context or release the context.

                                                                                                                                        The functions EVP_DigestInit(), EVP_DigestFinal() and EVP_MD_CTX_copy() are obsolete but are retained to maintain compatibility with existing code. New applications should use EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex() because they can efficiently reuse a digest context instead of initializing and cleaning it up on each call and allow non default implementations of digests to be specified.

                                                                                                                                        If digest contexts are not cleaned up after use, memory leaks will occur.

                                                                                                                                        EVP_MD_CTX_get0_name(), EVP_MD_CTX_get_size(), EVP_MD_CTX_get_block_size(), EVP_MD_CTX_get_type(), EVP_get_digestbynid() and EVP_get_digestbyobj() are defined as macros.

                                                                                                                                        EVP_MD_CTX_ctrl() sends commands to message digests for additional configuration or control.

                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#examples","title":"EXAMPLES","text":"

                                                                                                                                        This example digests the data \"Test Message\\n\" and \"Hello World\\n\", using the digest name passed on the command line.

                                                                                                                                        #include <stdio.h>\n#include <string.h>\n#include <openssl/evp.h>\n\nint main(int argc, char *argv[])\n{\n    EVP_MD_CTX *mdctx;\n    const EVP_MD *md;\n    char mess1[] = \"Test Message\\n\";\n    char mess2[] = \"Hello World\\n\";\n    unsigned char md_value[EVP_MAX_MD_SIZE];\n    unsigned int md_len, i;\n\n    if (argv[1] == NULL) {\n        printf(\"Usage: mdtest digestname\\n\");\n        exit(1);\n    }\n\n    md = EVP_get_digestbyname(argv[1]);\n    if (md == NULL) {\n        printf(\"Unknown message digest %s\\n\", argv[1]);\n        exit(1);\n    }\n\n    mdctx = EVP_MD_CTX_new();\n    if (!EVP_DigestInit_ex2(mdctx, md, NULL)) {\n        printf(\"Message digest initialization failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    if (!EVP_DigestUpdate(mdctx, mess1, strlen(mess1))) {\n        printf(\"Message digest update failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    if (!EVP_DigestUpdate(mdctx, mess2, strlen(mess2))) {\n        printf(\"Message digest update failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    if (!EVP_DigestFinal_ex(mdctx, md_value, &md_len)) {\n        printf(\"Message digest finalization failed.\\n\");\n        EVP_MD_CTX_free(mdctx);\n        exit(1);\n    }\n    EVP_MD_CTX_free(mdctx);\n\n    printf(\"Digest is: \");\n    for (i = 0; i < md_len; i++)\n        printf(\"%02x\", md_value[i]);\n    printf(\"\\n\");\n\n    exit(0);\n}\n
                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                        EVP_MD_meth_new(3), openssl-dgst(1), evp(7), OSSL_PROVIDER(3), OSSL_PARAM(3), property(7), \"ALGORITHM FETCHING\" in crypto(7), provider-digest(7), life_cycle-digest(7)

                                                                                                                                        The full list of digest algorithms are provided below.

                                                                                                                                        EVP_blake2b512(3), EVP_md2(3), EVP_md4(3), EVP_md5(3), EVP_mdc2(3), EVP_ripemd160(3), EVP_sha1(3), EVP_sha224(3), EVP_sha3_224(3), EVP_sm3(3), EVP_whirlpool(3)

                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#history","title":"HISTORY","text":"

                                                                                                                                        The EVP_MD_CTX_create() and EVP_MD_CTX_destroy() functions were renamed to EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1.0, respectively.

                                                                                                                                        The link between digests and signing algorithms was fixed in OpenSSL 1.0 and later, so now EVP_sha1() can be used with RSA and DSA.

                                                                                                                                        The EVP_dss1() function was removed in OpenSSL 1.1.0.

                                                                                                                                        The EVP_MD_CTX_set_pkey_ctx() function was added in OpenSSL 1.1.1.

                                                                                                                                        The EVP_Q_digest(), EVP_DigestInit_ex2(), EVP_MD_fetch(), EVP_MD_free(), EVP_MD_up_ref(), EVP_MD_get_params(), EVP_MD_CTX_set_params(), EVP_MD_CTX_get_params(), EVP_MD_gettable_params(), EVP_MD_gettable_ctx_params(), EVP_MD_settable_ctx_params(), EVP_MD_CTX_settable_params() and EVP_MD_CTX_gettable_params() functions were added in OpenSSL 3.0.

                                                                                                                                        The EVP_MD_type(), EVP_MD_nid(), EVP_MD_name(), EVP_MD_pkey_type(), EVP_MD_size(), EVP_MD_block_size(), EVP_MD_flags(), EVP_MD_CTX_size(), EVP_MD_CTX_block_size(), EVP_MD_CTX_type(), and EVP_MD_CTX_md_data() functions were renamed to include get or get0 in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

                                                                                                                                        The EVP_MD_CTX_md() function was deprecated in OpenSSL 3.0; use EVP_MD_CTX_get0_md() instead. EVP_MD_CTX_update_fn() and EVP_MD_CTX_set_update_fn() were deprecated in OpenSSL 3.0.

                                                                                                                                        EVP_MD_CTX_dup() was added in OpenSSL 3.1.

                                                                                                                                        "},{"location":"man3/EVP_DigestInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                        Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/","title":"EVP_DigestSignInit","text":""},{"location":"man3/EVP_DigestSignInit/#name","title":"NAME","text":"

                                                                                                                                        EVP_DigestSignInit_ex, EVP_DigestSignInit, EVP_DigestSignUpdate, EVP_DigestSignFinal, EVP_DigestSign - EVP signing functions

                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                        #include <openssl/evp.h>\n\nint EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                          const char *mdname, OSSL_LIB_CTX *libctx,\n                          const char *props, EVP_PKEY *pkey,\n                          const OSSL_PARAM params[]);\nint EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                       const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);\nint EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);\nint EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen);\n\nint EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sig,\n                   size_t *siglen, const unsigned char *tbs,\n                   size_t tbslen);\n
                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                        The EVP signature routines are a high-level interface to digital signatures. Input data is digested first before the signing takes place.

                                                                                                                                        EVP_DigestSignInit_ex() sets up signing context ctx to use a digest with the name mdname and private key pkey. The name of the digest to be used is passed to the provider of the signature algorithm in use. How that provider interprets the digest name is provider specific. The provider may implement that digest directly itself or it may (optionally) choose to fetch it (which could result in a digest from a different provider being selected). If the provider supports fetching the digest then it may use the props argument for the properties to be used during the fetch. Finally, the passed parameters params, if not NULL, are set on the context before returning.

                                                                                                                                        The pkey algorithm is used to fetch a EVP_SIGNATURE method implicitly, to be used for the actual signing. See \"Implicit fetch\" in provider(7) for more information about implicit fetches.

                                                                                                                                        The OpenSSL default and legacy providers support fetching digests and can fetch those digests from any available provider. The OpenSSL FIPS provider also supports fetching digests but will only fetch digests that are themselves implemented inside the FIPS provider.

                                                                                                                                        ctx must be created with EVP_MD_CTX_new() before calling this function. If pctx is not NULL, the EVP_PKEY_CTX of the signing operation will be written to *pctx: this can be used to set alternative signing options. Note that any existing value in *pctx is overwritten. The EVP_PKEY_CTX value returned must not be freed directly by the application if ctx is not assigned an EVP_PKEY_CTX value before being passed to EVP_DigestSignInit_ex() (which means the EVP_PKEY_CTX is created inside EVP_DigestSignInit_ex() and it will be freed automatically when the EVP_MD_CTX is freed). If the EVP_PKEY_CTX to be used is created by EVP_DigestSignInit_ex then it will use the OSSL_LIB_CTX specified in libctx and the property query string specified in props.

                                                                                                                                        The digest mdname may be NULL if the signing algorithm supports it. The props argument can always be NULL.

                                                                                                                                        No EVP_PKEY_CTX will be created by EVP_DigestSignInit_ex() if the passed ctx has already been assigned one via EVP_MD_CTX_set_pkey_ctx(3). See also SM2(7).

                                                                                                                                        Only EVP_PKEY types that support signing can be used with these functions. This includes MAC algorithms where the MAC generation is considered as a form of \"signing\". Built-in EVP_PKEY types supported by these functions are CMAC, Poly1305, DSA, ECDSA, HMAC, RSA, SipHash, Ed25519 and Ed448.

                                                                                                                                        Not all digests can be used for all key types. The following combinations apply.

                                                                                                                                        • DSA

                                                                                                                                          Supports SHA1, SHA224, SHA256, SHA384 and SHA512

                                                                                                                                        • ECDSA

                                                                                                                                          Supports SHA1, SHA224, SHA256, SHA384, SHA512 and SM3

                                                                                                                                        • RSA with no padding

                                                                                                                                          Supports no digests (the digest type must be NULL)

                                                                                                                                        • RSA with X931 padding

                                                                                                                                          Supports SHA1, SHA256, SHA384 and SHA512

                                                                                                                                        • All other RSA padding types

                                                                                                                                          Support SHA1, SHA224, SHA256, SHA384, SHA512, MD5, MD5_SHA1, MD2, MD4, MDC2, SHA3-224, SHA3-256, SHA3-384, SHA3-512

                                                                                                                                        • Ed25519 and Ed448

                                                                                                                                          Support no digests (the digest type must be NULL)

                                                                                                                                        • HMAC

                                                                                                                                          Supports any digest

                                                                                                                                        • CMAC, Poly1305 and SipHash

                                                                                                                                          Will ignore any digest provided.

                                                                                                                                        If RSA-PSS is used and restrictions apply then the digest must match.

                                                                                                                                        EVP_DigestSignInit() works in the same way as EVP_DigestSignInit_ex() except that the mdname parameter will be inferred from the supplied digest type, and props will be NULL. Where supplied the ENGINE e will be used for the signing and digest algorithm implementations. e may be NULL.

                                                                                                                                        EVP_DigestSignUpdate() hashes cnt bytes of data at d into the signature context ctx. This function can be called several times on the same ctx to include additional data.

                                                                                                                                        Unless sig is NULL EVP_DigestSignFinal() signs the data in ctx and places the signature in sig. Otherwise the maximum necessary size of the output buffer is written to the siglen parameter. If sig is not NULL then before the call the siglen parameter should contain the length of the sig buffer. If the call is successful the signature is written to sig and the amount of data written to siglen.

                                                                                                                                        EVP_DigestSign() signs tbslen bytes of data at tbs and places the signature in sig and its length in siglen in a similar way to EVP_DigestSignFinal(). In the event of a failure EVP_DigestSign() cannot be called again without reinitialising the EVP_MD_CTX. If sig is NULL before the call then siglen will be populated with the required size for the sig buffer. If sig is non-NULL before the call then siglen should contain the length of the sig buffer.

                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                        EVP_DigestSignInit(), EVP_DigestSignUpdate(), EVP_DigestSignFinal() and EVP_DigestSign() return 1 for success and 0 for failure.

                                                                                                                                        The error codes can be obtained from ERR_get_error(3).

                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/#notes","title":"NOTES","text":"

                                                                                                                                        The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

                                                                                                                                        EVP_DigestSign() is a one shot operation which signs a single block of data in one function. For algorithms that support streaming it is equivalent to calling EVP_DigestSignUpdate() and EVP_DigestSignFinal(). For algorithms which do not support streaming (e.g. PureEdDSA) it is the only way to sign data.

                                                                                                                                        In previous versions of OpenSSL there was a link between message digest types and public key algorithms. This meant that \"clone\" digests such as EVP_dss1() needed to be used to sign using SHA1 and DSA. This is no longer necessary and the use of clone digest is now discouraged.

                                                                                                                                        For some key types and parameters the random number generator must be seeded. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                        The call to EVP_DigestSignFinal() internally finalizes a copy of the digest context. This means that calls to EVP_DigestSignUpdate() and EVP_DigestSignFinal() can be called later to digest and sign additional data.

                                                                                                                                        EVP_DigestSignInit() and EVP_DigestSignInit_ex() functions can be called multiple times on a context and the parameters set by previous calls should be preserved if the pkey parameter is NULL. The call then just resets the state of the ctx.

                                                                                                                                        Ignoring failure returns of EVP_DigestSignInit() and EVP_DigestSignInit_ex() functions can lead to subsequent undefined behavior when calling EVP_DigestSignUpdate(), EVP_DigestSignFinal(), or EVP_DigestSign().

                                                                                                                                        The use of EVP_PKEY_get_size() with these functions is discouraged because some signature operations may have a signature length which depends on the parameters set. As a result EVP_PKEY_get_size() would have to return a value which indicates the maximum possible signature for any set of parameters.

                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                        EVP_DigestVerifyInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1), RAND(7)

                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/#history","title":"HISTORY","text":"

                                                                                                                                        EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal() were added in OpenSSL 1.0.0.

                                                                                                                                        EVP_DigestSignInit_ex() was added in OpenSSL 3.0.

                                                                                                                                        EVP_DigestSignUpdate() was converted from a macro to a function in OpenSSL 3.0.

                                                                                                                                        "},{"location":"man3/EVP_DigestSignInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                        Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/","title":"EVP_DigestVerifyInit","text":""},{"location":"man3/EVP_DigestVerifyInit/#name","title":"NAME","text":"

                                                                                                                                        EVP_DigestVerifyInit_ex, EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal, EVP_DigestVerify - EVP signature verification functions

                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                        #include <openssl/evp.h>\n\nint EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                            const char *mdname, OSSL_LIB_CTX *libctx,\n                            const char *props, EVP_PKEY *pkey,\n                            const OSSL_PARAM params[]);\nint EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,\n                         const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);\nint EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);\nint EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig,\n                          size_t siglen);\nint EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sig,\n                     size_t siglen, const unsigned char *tbs, size_t tbslen);\n
                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                        The EVP signature routines are a high-level interface to digital signatures. Input data is digested first before the signature verification takes place.

                                                                                                                                        EVP_DigestVerifyInit_ex() sets up verification context ctx to use a digest with the name mdname and public key pkey. The name of the digest to be used is passed to the provider of the signature algorithm in use. How that provider interprets the digest name is provider specific. The provider may implement that digest directly itself or it may (optionally) choose to fetch it (which could result in a digest from a different provider being selected). If the provider supports fetching the digest then it may use the props argument for the properties to be used during the fetch. Finally, the passed parameters params, if not NULL, are set on the context before returning.

                                                                                                                                        The pkey algorithm is used to fetch a EVP_SIGNATURE method implicitly, to be used for the actual signing. See \"Implicit fetch\" in provider(7) for more information about implicit fetches.

                                                                                                                                        The OpenSSL default and legacy providers support fetching digests and can fetch those digests from any available provider. The OpenSSL FIPS provider also supports fetching digests but will only fetch digests that are themselves implemented inside the FIPS provider.

                                                                                                                                        ctx must be created with EVP_MD_CTX_new() before calling this function. If pctx is not NULL, the EVP_PKEY_CTX of the verification operation will be written to *pctx: this can be used to set alternative verification options. Note that any existing value in *pctx is overwritten. The EVP_PKEY_CTX value returned must not be freed directly by the application if ctx is not assigned an EVP_PKEY_CTX value before being passed to EVP_DigestVerifyInit_ex() (which means the EVP_PKEY_CTX is created inside EVP_DigestVerifyInit_ex() and it will be freed automatically when the EVP_MD_CTX is freed). If the EVP_PKEY_CTX to be used is created by EVP_DigestVerifyInit_ex then it will use the OSSL_LIB_CTX specified in libctx and the property query string specified in props.

                                                                                                                                        No EVP_PKEY_CTX will be created by EVP_DigestVerifyInit_ex() if the passed ctx has already been assigned one via EVP_MD_CTX_set_pkey_ctx(3). See also SM2(7).

                                                                                                                                        Not all digests can be used for all key types. The following combinations apply.

                                                                                                                                        • DSA

                                                                                                                                          Supports SHA1, SHA224, SHA256, SHA384 and SHA512

                                                                                                                                        • ECDSA

                                                                                                                                          Supports SHA1, SHA224, SHA256, SHA384, SHA512 and SM3

                                                                                                                                        • RSA with no padding

                                                                                                                                          Supports no digests (the digest type must be NULL)

                                                                                                                                        • RSA with X931 padding

                                                                                                                                          Supports SHA1, SHA256, SHA384 and SHA512

                                                                                                                                        • All other RSA padding types

                                                                                                                                          Support SHA1, SHA224, SHA256, SHA384, SHA512, MD5, MD5_SHA1, MD2, MD4, MDC2, SHA3-224, SHA3-256, SHA3-384, SHA3-512

                                                                                                                                        • Ed25519 and Ed448

                                                                                                                                          Support no digests (the digest type must be NULL)

                                                                                                                                        • HMAC

                                                                                                                                          Supports any digest

                                                                                                                                        • CMAC, Poly1305 and Siphash

                                                                                                                                          Will ignore any digest provided.

                                                                                                                                        If RSA-PSS is used and restrictions apply then the digest must match.

                                                                                                                                        EVP_DigestVerifyInit() works in the same way as EVP_DigestVerifyInit_ex() except that the mdname parameter will be inferred from the supplied digest type, and props will be NULL. Where supplied the ENGINE e will be used for the signature verification and digest algorithm implementations. e may be NULL.

                                                                                                                                        EVP_DigestVerifyUpdate() hashes cnt bytes of data at d into the verification context ctx. This function can be called several times on the same ctx to include additional data.

                                                                                                                                        EVP_DigestVerifyFinal() verifies the data in ctx against the signature in sig of length siglen.

                                                                                                                                        EVP_DigestVerify() verifies tbslen bytes at tbs against the signature in sig of length siglen.

                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                        EVP_DigestVerifyInit() and EVP_DigestVerifyUpdate() return 1 for success and 0 for failure.

                                                                                                                                        EVP_DigestVerifyFinal() and EVP_DigestVerify() return 1 for success; any other value indicates failure. A return value of zero indicates that the signature did not verify successfully (that is, tbs did not match the original data or the signature had an invalid form), while other values indicate a more serious error (and sometimes also indicate an invalid signature form).

                                                                                                                                        The error codes can be obtained from ERR_get_error(3).

                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/#notes","title":"NOTES","text":"

                                                                                                                                        The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

                                                                                                                                        EVP_DigestVerify() is a one shot operation which verifies a single block of data in one function. For algorithms that support streaming it is equivalent to calling EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal(). For algorithms which do not support streaming (e.g. PureEdDSA) it is the only way to verify data.

                                                                                                                                        In previous versions of OpenSSL there was a link between message digest types and public key algorithms. This meant that \"clone\" digests such as EVP_dss1() needed to be used to sign using SHA1 and DSA. This is no longer necessary and the use of clone digest is now discouraged.

                                                                                                                                        For some key types and parameters the random number generator must be seeded. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                        The call to EVP_DigestVerifyFinal() internally finalizes a copy of the digest context. This means that EVP_VerifyUpdate() and EVP_VerifyFinal() can be called later to digest and verify additional data.

                                                                                                                                        EVP_DigestVerifyInit() and EVP_DigestVerifyInit_ex() functions can be called multiple times on a context and the parameters set by previous calls should be preserved if the pkey parameter is NULL. The call then just resets the state of the ctx.

                                                                                                                                        Ignoring failure returns of EVP_DigestVerifyInit() and EVP_DigestVerifyInit_ex() functions can lead to subsequent undefined behavior when calling EVP_DigestVerifyUpdate(), EVP_DigestVerifyFinal(), or EVP_DigestVerify().

                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                        EVP_DigestSignInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1), RAND(7)

                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/#history","title":"HISTORY","text":"

                                                                                                                                        EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal() were added in OpenSSL 1.0.0.

                                                                                                                                        EVP_DigestVerifyInit_ex() was added in OpenSSL 3.0.

                                                                                                                                        EVP_DigestVerifyUpdate() was converted from a macro to a function in OpenSSL 3.0.

                                                                                                                                        "},{"location":"man3/EVP_DigestVerifyInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                        Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                        "},{"location":"man3/EVP_EncodeInit/","title":"EVP_EncodeInit","text":""},{"location":"man3/EVP_EncodeInit/#name","title":"NAME","text":"

                                                                                                                                        EVP_ENCODE_CTX_new, EVP_ENCODE_CTX_free, EVP_ENCODE_CTX_copy, EVP_ENCODE_CTX_num, EVP_EncodeInit, EVP_EncodeUpdate, EVP_EncodeFinal, EVP_EncodeBlock, EVP_DecodeInit, EVP_DecodeUpdate, EVP_DecodeFinal, EVP_DecodeBlock - EVP base 64 encode/decode routines

                                                                                                                                        "},{"location":"man3/EVP_EncodeInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                        #include <openssl/evp.h>\n\nEVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void);\nvoid EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx);\nint EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx);\nint EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx);\nvoid EVP_EncodeInit(EVP_ENCODE_CTX *ctx);\nint EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,\n                     const unsigned char *in, int inl);\nvoid EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);\nint EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);\n\nvoid EVP_DecodeInit(EVP_ENCODE_CTX *ctx);\nint EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,\n                     const unsigned char *in, int inl);\nint EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);\nint EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);\n
                                                                                                                                        "},{"location":"man3/EVP_EncodeInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                        The EVP encode routines provide a high-level interface to base 64 encoding and decoding. Base 64 encoding converts binary data into a printable form that uses the characters A-Z, a-z, 0-9, \"+\" and \"/\" to represent the data. For every 3 bytes of binary data provided 4 bytes of base 64 encoded data will be produced plus some occasional newlines (see below). If the input data length is not a multiple of 3 then the output data will be padded at the end using the \"=\" character.

                                                                                                                                        EVP_ENCODE_CTX_new() allocates, initializes and returns a context to be used for the encode/decode functions.

                                                                                                                                        EVP_ENCODE_CTX_free() cleans up an encode/decode context ctx and frees up the space allocated to it. If the argument is NULL, nothing is done.

                                                                                                                                        Encoding of binary data is performed in blocks of 48 input bytes (or less for the final block). For each 48 byte input block encoded 64 bytes of base 64 data is output plus an additional newline character (i.e. 65 bytes in total). The final block (which may be less than 48 bytes) will output 4 bytes for every 3 bytes of input. If the data length is not divisible by 3 then a full 4 bytes is still output for the final 1 or 2 bytes of input. Similarly a newline character will also be output.

                                                                                                                                        EVP_EncodeInit() initialises ctx for the start of a new encoding operation.

                                                                                                                                        EVP_EncodeUpdate() encode inl bytes of data found in the buffer pointed to by in. The output is stored in the buffer out and the number of bytes output is stored in *outl. It is the caller's responsibility to ensure that the buffer at out is sufficiently large to accommodate the output data. Only full blocks of data (48 bytes) will be immediately processed and output by this function. Any remainder is held in the ctx object and will be processed by a subsequent call to EVP_EncodeUpdate() or EVP_EncodeFinal(). To calculate the required size of the output buffer add together the value of inl with the amount of unprocessed data held in ctx and divide the result by 48 (ignore any remainder). This gives the number of blocks of data that will be processed. Ensure the output buffer contains 65 bytes of storage for each block, plus an additional byte for a NUL terminator. EVP_EncodeUpdate() may be called repeatedly to process large amounts of input data. In the event of an error EVP_EncodeUpdate() will set *outl to 0 and return 0. On success 1 will be returned.

                                                                                                                                        EVP_EncodeFinal() must be called at the end of an encoding operation. It will process any partial block of data remaining in the ctx object. The output data will be stored in out and the length of the data written will be stored in *outl. It is the caller's responsibility to ensure that out is sufficiently large to accommodate the output data which will never be more than 65 bytes plus an additional NUL terminator (i.e. 66 bytes in total).

                                                                                                                                        EVP_ENCODE_CTX_copy() can be used to copy a context sctx to a context dctx. dctx must be initialized before calling this function.

                                                                                                                                        EVP_ENCODE_CTX_num() will return the number of as yet unprocessed bytes still to be encoded or decoded that are pending in the ctx object.

                                                                                                                                        EVP_EncodeBlock() encodes a full block of input data in f and of length n and stores it in t. For every 3 bytes of input provided 4 bytes of output data will be produced. If n is not divisible by 3 then the block is encoded as a final block of data and the output is padded such that it is always divisible by 4. Additionally a NUL terminator character will be added. For example if 16 bytes of input data is provided then 24 bytes of encoded data is created plus 1 byte for a NUL terminator (i.e. 25 bytes in total). The length of the data generated without the NUL terminator is returned from the function.

                                                                                                                                        EVP_DecodeInit() initialises ctx for the start of a new decoding operation.

                                                                                                                                        EVP_DecodeUpdate() decodes inl characters of data found in the buffer pointed to by in. The output is stored in the buffer out and the number of bytes output is stored in *outl. It is the caller's responsibility to ensure that the buffer at out is sufficiently large to accommodate the output data. This function will attempt to decode as much data as possible in 4 byte chunks. Any whitespace, newline or carriage return characters are ignored. Any partial chunk of unprocessed data (1, 2 or 3 bytes) that remains at the end will be held in the ctx object and processed by a subsequent call to EVP_DecodeUpdate(). If any illegal base 64 characters are encountered or if the base 64 padding character \"=\" is encountered in the middle of the data then the function returns -1 to indicate an error. A return value of 0 or 1 indicates successful processing of the data. A return value of 0 additionally indicates that the last input data characters processed included the base 64 padding character \"=\" and therefore no more non-padding character data is expected to be processed. For every 4 valid base 64 bytes processed (ignoring whitespace, carriage returns and line feeds), 3 bytes of binary output data will be produced (or less at the end of the data where the padding character \"=\" has been used).

                                                                                                                                        EVP_DecodeFinal() must be called at the end of a decoding operation. If there is any unprocessed data still in ctx then the input data must not have been a multiple of 4 and therefore an error has occurred. The function will return -1 in this case. Otherwise the function returns 1 on success.

                                                                                                                                        EVP_DecodeBlock() will decode the block of n characters of base 64 data contained in f and store the result in t. Any leading whitespace will be trimmed as will any trailing whitespace, newlines, carriage returns or EOF characters. After such trimming the length of the data in f must be divisible by 4. For every 4 input bytes exactly 3 output bytes will be produced. The output will be padded with 0 bits if necessary to ensure that the output is always 3 bytes for every 4 input bytes. This function will return the length of the data decoded or -1 on error.

                                                                                                                                        "},{"location":"man3/EVP_EncodeInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                        EVP_ENCODE_CTX_new() returns a pointer to the newly allocated EVP_ENCODE_CTX object or NULL on error.

                                                                                                                                        EVP_ENCODE_CTX_num() returns the number of bytes pending encoding or decoding in ctx.

                                                                                                                                        EVP_EncodeUpdate() returns 0 on error or 1 on success.

                                                                                                                                        EVP_EncodeBlock() returns the number of bytes encoded excluding the NUL terminator.

                                                                                                                                        EVP_DecodeUpdate() returns -1 on error and 0 or 1 on success. If 0 is returned then no more non-padding base 64 characters are expected.

                                                                                                                                        EVP_DecodeFinal() returns -1 on error or 1 on success.

                                                                                                                                        EVP_DecodeBlock() returns the length of the data decoded or -1 on error.

                                                                                                                                        "},{"location":"man3/EVP_EncodeInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                        evp(7)

                                                                                                                                        "},{"location":"man3/EVP_EncodeInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                        Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                        "},{"location":"man3/EVP_EncryptInit/","title":"EVP_EncryptInit","text":""},{"location":"man3/EVP_EncryptInit/#name","title":"NAME","text":"

                                                                                                                                        EVP_CIPHER_fetch, EVP_CIPHER_up_ref, EVP_CIPHER_free, EVP_CIPHER_CTX_new, EVP_CIPHER_CTX_reset, EVP_CIPHER_CTX_free, EVP_CIPHER_CTX_dup, EVP_CIPHER_CTX_copy, EVP_EncryptInit_ex, EVP_EncryptInit_ex2, EVP_EncryptUpdate, EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptInit_ex2, EVP_DecryptUpdate, EVP_DecryptFinal_ex, EVP_CipherInit_ex, EVP_CipherInit_ex2, EVP_CipherUpdate, EVP_CipherFinal_ex, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX_ctrl, EVP_EncryptInit, EVP_EncryptFinal, EVP_DecryptInit, EVP_DecryptFinal, EVP_CipherInit, EVP_CipherFinal, EVP_Cipher, EVP_get_cipherbyname, EVP_get_cipherbynid, EVP_get_cipherbyobj, EVP_CIPHER_is_a, EVP_CIPHER_get0_name, EVP_CIPHER_get0_description, EVP_CIPHER_names_do_all, EVP_CIPHER_get0_provider, EVP_CIPHER_get_nid, EVP_CIPHER_get_params, EVP_CIPHER_gettable_params, EVP_CIPHER_get_block_size, EVP_CIPHER_get_key_length, EVP_CIPHER_get_iv_length, EVP_CIPHER_get_flags, EVP_CIPHER_get_mode, EVP_CIPHER_get_type, EVP_CIPHER_CTX_cipher, EVP_CIPHER_CTX_get0_cipher, EVP_CIPHER_CTX_get1_cipher, EVP_CIPHER_CTX_get0_name, EVP_CIPHER_CTX_get_nid, EVP_CIPHER_CTX_get_params, EVP_CIPHER_gettable_ctx_params, EVP_CIPHER_CTX_gettable_params, EVP_CIPHER_CTX_set_params, EVP_CIPHER_settable_ctx_params, EVP_CIPHER_CTX_settable_params, EVP_CIPHER_CTX_get_block_size, EVP_CIPHER_CTX_get_key_length, EVP_CIPHER_CTX_get_iv_length, EVP_CIPHER_CTX_get_tag_length, EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_flags, EVP_CIPHER_CTX_set_flags, EVP_CIPHER_CTX_clear_flags, EVP_CIPHER_CTX_test_flags, EVP_CIPHER_CTX_get_type, EVP_CIPHER_CTX_get_mode, EVP_CIPHER_CTX_get_num, EVP_CIPHER_CTX_set_num, EVP_CIPHER_CTX_is_encrypting, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param, EVP_CIPHER_CTX_set_padding, EVP_enc_null, EVP_CIPHER_do_all_provided, EVP_CIPHER_nid, EVP_CIPHER_name, EVP_CIPHER_block_size, EVP_CIPHER_key_length, EVP_CIPHER_iv_length, EVP_CIPHER_flags, EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_encrypting, EVP_CIPHER_CTX_nid, EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, EVP_CIPHER_CTX_iv_length, EVP_CIPHER_CTX_tag_length, EVP_CIPHER_CTX_num, EVP_CIPHER_CTX_type, EVP_CIPHER_CTX_mode - EVP cipher routines

                                                                                                                                        "},{"location":"man3/EVP_EncryptInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                        #include <openssl/evp.h>\n\nEVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                             const char *properties);\nint EVP_CIPHER_up_ref(EVP_CIPHER *cipher);\nvoid EVP_CIPHER_free(EVP_CIPHER *cipher);\nEVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);\nint EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx);\nvoid EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx);\nEVP_CIPHER_CTX *EVP_CIPHER_CTX_dup(const EVP_CIPHER_CTX *in);\nint EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);\n\nint EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                       ENGINE *impl, const unsigned char *key, const unsigned char *iv);\nint EVP_EncryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                        const unsigned char *key, const unsigned char *iv,\n                        const OSSL_PARAM params[]);\nint EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                      int *outl, const unsigned char *in, int inl);\nint EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n\nint EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                       ENGINE *impl, const unsigned char *key, const unsigned char *iv);\nint EVP_DecryptInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                        const unsigned char *key, const unsigned char *iv,\n                        const OSSL_PARAM params[]);\nint EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                      int *outl, const unsigned char *in, int inl);\nint EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                      ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc);\nint EVP_CipherInit_ex2(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                       const unsigned char *key, const unsigned char *iv,\n                       int enc, const OSSL_PARAM params[]);\nint EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                     int *outl, const unsigned char *in, int inl);\nint EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                    const unsigned char *key, const unsigned char *iv);\nint EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n\nint EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                    const unsigned char *key, const unsigned char *iv);\nint EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                   const unsigned char *key, const unsigned char *iv, int enc);\nint EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,\n               const unsigned char *in, unsigned int inl);\n\nint EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding);\nint EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);\nint EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int cmd, int p1, void *p2);\nint EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);\nvoid EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);\nvoid EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);\nint EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags);\n\nconst EVP_CIPHER *EVP_get_cipherbyname(const char *name);\nconst EVP_CIPHER *EVP_get_cipherbynid(int nid);\nconst EVP_CIPHER *EVP_get_cipherbyobj(const ASN1_OBJECT *a);\n\nint EVP_CIPHER_get_nid(const EVP_CIPHER *e);\nint EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name);\nint EVP_CIPHER_names_do_all(const EVP_CIPHER *cipher,\n                            void (*fn)(const char *name, void *data),\n                            void *data);\nconst char *EVP_CIPHER_get0_name(const EVP_CIPHER *cipher);\nconst char *EVP_CIPHER_get0_description(const EVP_CIPHER *cipher);\nconst OSSL_PROVIDER *EVP_CIPHER_get0_provider(const EVP_CIPHER *cipher);\nint EVP_CIPHER_get_block_size(const EVP_CIPHER *e);\nint EVP_CIPHER_get_key_length(const EVP_CIPHER *e);\nint EVP_CIPHER_get_iv_length(const EVP_CIPHER *e);\nunsigned long EVP_CIPHER_get_flags(const EVP_CIPHER *e);\nunsigned long EVP_CIPHER_get_mode(const EVP_CIPHER *e);\nint EVP_CIPHER_get_type(const EVP_CIPHER *cipher);\n\nconst EVP_CIPHER *EVP_CIPHER_CTX_get0_cipher(const EVP_CIPHER_CTX *ctx);\nEVP_CIPHER *EVP_CIPHER_CTX_get1_cipher(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_nid(const EVP_CIPHER_CTX *ctx);\nconst char *EVP_CIPHER_CTX_get0_name(const EVP_CIPHER_CTX *ctx);\n\nint EVP_CIPHER_get_params(EVP_CIPHER *cipher, OSSL_PARAM params[]);\nint EVP_CIPHER_CTX_set_params(EVP_CIPHER_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_CIPHER_CTX_get_params(EVP_CIPHER_CTX *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher);\nconst OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher);\nconst OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher);\nconst OSSL_PARAM *EVP_CIPHER_CTX_settable_params(EVP_CIPHER_CTX *ctx);\nconst OSSL_PARAM *EVP_CIPHER_CTX_gettable_params(EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_block_size(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_key_length(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_iv_length(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_tag_length(const EVP_CIPHER_CTX *ctx);\nvoid *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);\nvoid EVP_CIPHER_CTX_set_app_data(const EVP_CIPHER_CTX *ctx, void *data);\nint EVP_CIPHER_CTX_get_type(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_mode(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_get_num(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num);\nint EVP_CIPHER_CTX_is_encrypting(const EVP_CIPHER_CTX *ctx);\n\nint EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\nint EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\n\nvoid EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                void (*fn)(EVP_CIPHER *cipher, void *arg),\n                                void *arg);\n\n#define EVP_CIPHER_nid EVP_CIPHER_get_nid\n#define EVP_CIPHER_name EVP_CIPHER_get0_name\n#define EVP_CIPHER_block_size EVP_CIPHER_get_block_size\n#define EVP_CIPHER_key_length EVP_CIPHER_get_key_length\n#define EVP_CIPHER_iv_length EVP_CIPHER_get_iv_length\n#define EVP_CIPHER_flags EVP_CIPHER_get_flags\n#define EVP_CIPHER_mode EVP_CIPHER_get_mode\n#define EVP_CIPHER_type EVP_CIPHER_get_type\n#define EVP_CIPHER_CTX_encrypting EVP_CIPHER_CTX_is_encrypting\n#define EVP_CIPHER_CTX_nid EVP_CIPHER_CTX_get_nid\n#define EVP_CIPHER_CTX_block_size EVP_CIPHER_CTX_get_block_size\n#define EVP_CIPHER_CTX_key_length EVP_CIPHER_CTX_get_key_length\n#define EVP_CIPHER_CTX_iv_length EVP_CIPHER_CTX_get_iv_length\n#define EVP_CIPHER_CTX_tag_length EVP_CIPHER_CTX_get_tag_length\n#define EVP_CIPHER_CTX_num EVP_CIPHER_CTX_get_num\n#define EVP_CIPHER_CTX_type EVP_CIPHER_CTX_get_type\n#define EVP_CIPHER_CTX_mode EVP_CIPHER_CTX_get_mode\n

                                                                                                                                        The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                        const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);\n

                                                                                                                                        The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                        int EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);\n
                                                                                                                                        "},{"location":"man3/EVP_EncryptInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                        The EVP cipher routines are a high-level interface to certain symmetric ciphers.

                                                                                                                                        The EVP_CIPHER type is a structure for cipher method implementation.

                                                                                                                                        • EVP_CIPHER_fetch()

                                                                                                                                          Fetches the cipher implementation for the given algorithm from any provider offering it, within the criteria given by the properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                          The returned value must eventually be freed with EVP_CIPHER_free().

                                                                                                                                          Fetched EVP_CIPHER structures are reference counted.

                                                                                                                                        • EVP_CIPHER_up_ref()

                                                                                                                                          Increments the reference count for an EVP_CIPHER structure.

                                                                                                                                        • EVP_CIPHER_free()

                                                                                                                                          Decrements the reference count for the fetched EVP_CIPHER structure. If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

                                                                                                                                        • EVP_CIPHER_CTX_new()

                                                                                                                                          Allocates and returns a cipher context.

                                                                                                                                        • EVP_CIPHER_CTX_free()

                                                                                                                                          Clears all information from a cipher context and frees any allocated memory associated with it, including ctx itself. This function should be called after all operations using a cipher are complete so sensitive information does not remain in memory. If the argument is NULL, nothing is done.

                                                                                                                                        • EVP_CIPHER_CTX_dup()

                                                                                                                                          Can be used to duplicate the cipher state from in. This is useful to avoid multiple EVP_CIPHER_fetch() calls or if large amounts of data are to be fed which only differ in the last few bytes.

                                                                                                                                        • EVP_CIPHER_CTX_copy()

                                                                                                                                          Can be used to copy the cipher state from in to out.

                                                                                                                                        • EVP_CIPHER_CTX_ctrl()

                                                                                                                                          This is a legacy method. EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() is the mechanism that should be used to set and get parameters that are used by providers.

                                                                                                                                          Performs cipher-specific control actions on context ctx. The control command is indicated in cmd and any additional arguments in p1 and p2. EVP_CIPHER_CTX_ctrl() must be called after EVP_CipherInit_ex2(). Other restrictions may apply depending on the control type and cipher implementation.

                                                                                                                                          If this function happens to be used with a fetched EVP_CIPHER, it will translate the controls that are known to OpenSSL into OSSL_PARAM(3) parameters with keys defined by OpenSSL and call EVP_CIPHER_CTX_get_params() or EVP_CIPHER_CTX_set_params() as is appropriate for each control command.

                                                                                                                                          See \"CONTROLS\" below for more information, including what translations are being done.

                                                                                                                                        • EVP_CIPHER_get_params()

                                                                                                                                          Retrieves the requested list of algorithm params from a CIPHER cipher. See \"PARAMETERS\" below for more information.

                                                                                                                                        • EVP_CIPHER_CTX_get_params()

                                                                                                                                          Retrieves the requested list of params from CIPHER context ctx. See \"PARAMETERS\" below for more information.

                                                                                                                                        • EVP_CIPHER_CTX_set_params()

                                                                                                                                          Sets the list of params into a CIPHER context ctx. See \"PARAMETERS\" below for more information.

                                                                                                                                        • EVP_CIPHER_gettable_params()

                                                                                                                                          Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_CIPHER_get_params().

                                                                                                                                        • EVP_CIPHER_gettable_ctx_params() and EVP_CIPHER_CTX_gettable_params()

                                                                                                                                          Get a constant OSSL_PARAM(3) array that describes the retrievable parameters that can be used with EVP_CIPHER_CTX_get_params(). EVP_CIPHER_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_CIPHER_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                        • EVP_CIPHER_settable_ctx_params() and EVP_CIPHER_CTX_settable_params()

                                                                                                                                          Get a constant OSSL_PARAM(3) array that describes the settable parameters that can be used with EVP_CIPHER_CTX_set_params(). EVP_CIPHER_settable_ctx_params() returns the parameters that can be set from the algorithm, whereas EVP_CIPHER_CTX_settable_params() returns the parameters that can be set in the context's current state.

                                                                                                                                        • EVP_EncryptInit_ex2()

                                                                                                                                          Sets up cipher context ctx for encryption with cipher type. type is typically supplied by calling EVP_CIPHER_fetch(). type may also be set using legacy functions such as EVP_aes_256_cbc(), but this is not recommended for new applications. key is the symmetric key to use and iv is the IV to use (if necessary), the actual number of bytes used for the key and IV depends on the cipher. The parameters params will be set on the context after initialisation. It is possible to set all parameters to NULL except type in an initial call and supply the remaining parameters in subsequent calls, all of which have type set to NULL. This is done when the default cipher parameters are not appropriate. For EVP_CIPH_GCM_MODE the IV will be generated internally if it is not specified.

                                                                                                                                        • EVP_EncryptInit_ex()

                                                                                                                                          This legacy function is similar to EVP_EncryptInit_ex2() when impl is NULL. The implementation of the type from the impl engine will be used if it exists.

                                                                                                                                        • EVP_EncryptUpdate()

                                                                                                                                          Encrypts inl bytes from the buffer in and writes the encrypted version to out. The pointers out and in may point to the same location, in which case the encryption will be done in-place. If out and in point to different locations, the two buffers must be disjoint, otherwise the operation might fail or the outcome might be undefined.

                                                                                                                                          This function can be called multiple times to encrypt successive blocks of data. The amount of data written depends on the block alignment of the encrypted data. For most ciphers and modes, the amount of data written can be anything from zero bytes to (inl + cipher_block_size - 1) bytes. For wrap cipher modes, the amount of data written can be anything from zero bytes to (inl + cipher_block_size) bytes. For stream ciphers, the amount of data written can be anything from zero bytes to inl bytes. Thus, the buffer pointed to by out must contain sufficient room for the operation being performed. The actual number of bytes written is placed in outl.

                                                                                                                                          If padding is enabled (the default) then EVP_EncryptFinal_ex() encrypts the \"final\" data, that is any data that remains in a partial block. It uses standard block padding (aka PKCS padding) as described in the NOTES section, below. The encrypted final data is written to out which should have sufficient space for one cipher block. The number of bytes written is placed in outl. After this function is called the encryption operation is finished and no further calls to EVP_EncryptUpdate() should be made.

                                                                                                                                          If padding is disabled then EVP_EncryptFinal_ex() will not encrypt any more data and it will return an error if any data remains in a partial block: that is if the total data length is not a multiple of the block size.

                                                                                                                                        • EVP_DecryptInit_ex2(), EVP_DecryptInit_ex(), EVP_DecryptUpdate() and EVP_DecryptFinal_ex()

                                                                                                                                          These functions are the corresponding decryption operations. EVP_DecryptFinal() will return an error code if padding is enabled and the final block is not correctly formatted. The parameters and restrictions are identical to the encryption operations except that if padding is enabled the decrypted data buffer out passed to EVP_DecryptUpdate() should have sufficient room for (inl + cipher_block_size) bytes unless the cipher block size is 1 in which case inl bytes is sufficient.

                                                                                                                                        • EVP_CipherInit_ex2(), EVP_CipherInit_ex(), EVP_CipherUpdate() and EVP_CipherFinal_ex()

                                                                                                                                          These functions can be used for decryption or encryption. The operation performed depends on the value of the enc parameter. It should be set to 1 for encryption, 0 for decryption and -1 to leave the value unchanged (the actual value of 'enc' being supplied in a previous call).

                                                                                                                                        • EVP_CIPHER_CTX_reset()

                                                                                                                                          Clears all information from a cipher context and free up any allocated memory associated with it, except the ctx itself. This function should be called anytime ctx is reused by another EVP_CipherInit() / EVP_CipherUpdate() / EVP_CipherFinal() series of calls.

                                                                                                                                        • EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit()

                                                                                                                                          Behave in a similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex() and EVP_CipherInit_ex() except if the type is not a fetched cipher they use the default implementation of the type.

                                                                                                                                        • EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal()

                                                                                                                                          Identical to EVP_EncryptFinal_ex(), EVP_DecryptFinal_ex() and EVP_CipherFinal_ex(). In previous releases they also cleaned up the ctx, but this is no longer done and EVP_CIPHER_CTX_cleanup() must be called to free any context resources.

                                                                                                                                        • EVP_Cipher()

                                                                                                                                          Encrypts or decrypts a maximum inl amount of bytes from in and leaves the result in out.

                                                                                                                                          For legacy ciphers - If the cipher doesn't have the flag EVP_CIPH_FLAG_CUSTOM_CIPHER set, then inl must be a multiple of EVP_CIPHER_get_block_size(). If it isn't, the result is undefined. If the cipher has that flag set, then inl can be any size.

                                                                                                                                          Due to the constraints of the API contract of this function it shouldn't be used in applications, please consider using EVP_CipherUpdate() and EVP_CipherFinal_ex() instead.

                                                                                                                                        • EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj()

                                                                                                                                          Returns an EVP_CIPHER structure when passed a cipher name, a cipher NID or an ASN1_OBJECT structure respectively.

                                                                                                                                          EVP_get_cipherbyname() will return NULL for algorithms such as \"AES-128-SIV\", \"AES-128-CBC-CTS\" and \"CAMELLIA-128-CBC-CTS\" which were previously only accessible via low level interfaces.

                                                                                                                                          The EVP_get_cipherbyname() function is present for backwards compatibility with OpenSSL prior to version 3 and is different to the EVP_CIPHER_fetch() function since it does not attempt to \"fetch\" an implementation of the cipher. Additionally, it only knows about ciphers that are built-in to OpenSSL and have an associated NID. Similarly EVP_get_cipherbynid() and EVP_get_cipherbyobj() also return objects without an associated implementation.

                                                                                                                                          When the cipher objects returned by these functions are used (such as in a call to EVP_EncryptInit_ex()) an implementation of the cipher will be implicitly fetched from the loaded providers. This fetch could fail if no suitable implementation is available. Use EVP_CIPHER_fetch() instead to explicitly fetch the algorithm and an associated implementation from a provider.

                                                                                                                                          See \"ALGORITHM FETCHING\" in crypto(7) for more information about fetching.

                                                                                                                                          The cipher objects returned from these functions do not need to be freed with EVP_CIPHER_free().

                                                                                                                                        • EVP_CIPHER_get_nid() and EVP_CIPHER_CTX_get_nid()

                                                                                                                                          Return the NID of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX structure. The actual NID value is an internal value which may not have a corresponding OBJECT IDENTIFIER.

                                                                                                                                        • EVP_CIPHER_CTX_set_flags(), EVP_CIPHER_CTX_clear_flags() and EVP_CIPHER_CTX_test_flags()

                                                                                                                                          Sets, clears and tests ctx flags. See \"FLAGS\" below for more information.

                                                                                                                                          For provided ciphers EVP_CIPHER_CTX_set_flags() should be called only after the fetched cipher has been assigned to the ctx. It is recommended to use \"PARAMETERS\" instead.

                                                                                                                                        • EVP_CIPHER_CTX_set_padding()

                                                                                                                                          Enables or disables padding. This function should be called after the context is set up for encryption or decryption with EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2() or EVP_CipherInit_ex2(). By default encryption operations are padded using standard block padding and the padding is checked and removed when decrypting. If the pad parameter is zero then no padding is performed, the total amount of data encrypted or decrypted must then be a multiple of the block size or an error will occur.

                                                                                                                                        • EVP_CIPHER_get_key_length() and EVP_CIPHER_CTX_get_key_length()

                                                                                                                                          Return the key length of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX structure. The constant EVP_MAX_KEY_LENGTH is the maximum key length for all ciphers. Note: although EVP_CIPHER_get_key_length() is fixed for a given cipher, the value of EVP_CIPHER_CTX_get_key_length() may be different for variable key length ciphers.

                                                                                                                                        • EVP_CIPHER_CTX_set_key_length()

                                                                                                                                          Sets the key length of the cipher context. If the cipher is a fixed length cipher then attempting to set the key length to any value other than the fixed value is an error.

                                                                                                                                        • EVP_CIPHER_get_iv_length() and EVP_CIPHER_CTX_get_iv_length()

                                                                                                                                          Return the IV length of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX. It will return zero if the cipher does not use an IV. The constant EVP_MAX_IV_LENGTH is the maximum IV length for all ciphers.

                                                                                                                                        • EVP_CIPHER_CTX_get_tag_length()

                                                                                                                                          Returns the tag length of an AEAD cipher when passed a EVP_CIPHER_CTX. It will return zero if the cipher does not support a tag. It returns a default value if the tag length has not been set.

                                                                                                                                        • EVP_CIPHER_get_block_size() and EVP_CIPHER_CTX_get_block_size()

                                                                                                                                          Return the block size of a cipher when passed an EVP_CIPHER or EVP_CIPHER_CTX structure. The constant EVP_MAX_BLOCK_LENGTH is also the maximum block length for all ciphers.

                                                                                                                                        • EVP_CIPHER_get_type() and EVP_CIPHER_CTX_get_type()

                                                                                                                                          Return the type of the passed cipher or context. This \"type\" is the actual NID of the cipher OBJECT IDENTIFIER and as such it ignores the cipher parameters (40 bit RC2 and 128 bit RC2 have the same NID). If the cipher does not have an object identifier or does not have ASN1 support this function will return NID_undef.

                                                                                                                                        • EVP_CIPHER_is_a()

                                                                                                                                          Returns 1 if cipher is an implementation of an algorithm that's identifiable with name, otherwise 0. If cipher is a legacy cipher (it's the return value from the likes of EVP_aes128() rather than the result of an EVP_CIPHER_fetch()), only cipher names registered with the default library context (see OSSL_LIB_CTX(3)) will be considered.

                                                                                                                                        • EVP_CIPHER_get0_name() and EVP_CIPHER_CTX_get0_name()

                                                                                                                                          Return the name of the passed cipher or context. For fetched ciphers with multiple names, only one of them is returned. See also EVP_CIPHER_names_do_all().

                                                                                                                                        • EVP_CIPHER_names_do_all()

                                                                                                                                          Traverses all names for the cipher, and calls fn with each name and data. This is only useful with fetched EVP_CIPHERs.

                                                                                                                                        • EVP_CIPHER_get0_description()

                                                                                                                                          Returns a description of the cipher, meant for display and human consumption. The description is at the discretion of the cipher implementation.

                                                                                                                                        • EVP_CIPHER_get0_provider()

                                                                                                                                          Returns an OSSL_PROVIDER pointer to the provider that implements the given EVP_CIPHER.

                                                                                                                                        • EVP_CIPHER_CTX_get0_cipher()

                                                                                                                                          Returns the EVP_CIPHER structure when passed an EVP_CIPHER_CTX structure. EVP_CIPHER_CTX_get1_cipher() is the same except the ownership is passed to the caller.

                                                                                                                                        • EVP_CIPHER_get_mode() and EVP_CIPHER_CTX_get_mode()

                                                                                                                                          Return the block cipher mode: EVP_CIPH_ECB_MODE, EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE, EVP_CIPH_OFB_MODE, EVP_CIPH_CTR_MODE, EVP_CIPH_GCM_MODE, EVP_CIPH_CCM_MODE, EVP_CIPH_XTS_MODE, EVP_CIPH_WRAP_MODE, EVP_CIPH_OCB_MODE or EVP_CIPH_SIV_MODE. If the cipher is a stream cipher then EVP_CIPH_STREAM_CIPHER is returned.

                                                                                                                                        • EVP_CIPHER_get_flags()

                                                                                                                                          Returns any flags associated with the cipher. See \"FLAGS\" for a list of currently defined flags.

                                                                                                                                        • EVP_CIPHER_CTX_get_num() and EVP_CIPHER_CTX_set_num()

                                                                                                                                          Gets or sets the cipher specific \"num\" parameter for the associated ctx. Built-in ciphers typically use this to track how much of the current underlying block has been \"used\" already.

                                                                                                                                        • EVP_CIPHER_CTX_is_encrypting()

                                                                                                                                          Reports whether the ctx is being used for encryption or decryption.

                                                                                                                                        • EVP_CIPHER_CTX_flags()

                                                                                                                                          A deprecated macro calling EVP_CIPHER_get_flags(EVP_CIPHER_CTX_get0_cipher(ctx)). Do not use.

                                                                                                                                        • EVP_CIPHER_param_to_asn1()

                                                                                                                                          Sets the AlgorithmIdentifier \"parameter\" based on the passed cipher. This will typically include any parameters and an IV. The cipher IV (if any) must be set when this call is made. This call should be made before the cipher is actually \"used\" (before any EVP_EncryptUpdate(), EVP_DecryptUpdate() calls for example). This function may fail if the cipher does not have any ASN1 support.

                                                                                                                                        • EVP_CIPHER_asn1_to_param()

                                                                                                                                          Sets the cipher parameters based on an ASN1 AlgorithmIdentifier \"parameter\". The precise effect depends on the cipher. In the case of RC2, for example, it will set the IV and effective key length. This function should be called after the base cipher type is set but before the key is set. For example EVP_CipherInit() will be called with the IV and key set to NULL, EVP_CIPHER_asn1_to_param() will be called and finally EVP_CipherInit() again with all parameters except the key set to NULL. It is possible for this function to fail if the cipher does not have any ASN1 support or the parameters cannot be set (for example the RC2 effective key length is not supported.

                                                                                                                                        • EVP_CIPHER_CTX_rand_key()

                                                                                                                                          Generates a random key of the appropriate length based on the cipher context. The EVP_CIPHER can provide its own random key generation routine to support keys of a specific form. key must point to a buffer at least as big as the value returned by EVP_CIPHER_CTX_get_key_length().

                                                                                                                                        • EVP_CIPHER_do_all_provided()

                                                                                                                                          Traverses all ciphers implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                        "},{"location":"man3/EVP_EncryptInit/#parameters","title":"PARAMETERS","text":"

                                                                                                                                        See OSSL_PARAM(3) for information about passing parameters.

                                                                                                                                        "},{"location":"man3/EVP_EncryptInit/#gettable-evp_cipher-parameters","title":"Gettable EVP_CIPHER parameters","text":"

                                                                                                                                        When EVP_CIPHER_fetch() is called it internally calls EVP_CIPHER_get_params() and caches the results.

                                                                                                                                        EVP_CIPHER_get_params() can be used with the following OSSL_PARAM(3) keys:

                                                                                                                                        • \"mode\" (OSSL_CIPHER_PARAM_MODE) <unsigned integer>

                                                                                                                                          Gets the mode for the associated cipher algorithm cipher. See \"EVP_CIPHER_get_mode() and EVP_CIPHER_CTX_get_mode()\" for a list of valid modes. Use EVP_CIPHER_get_mode() to retrieve the cached value.

                                                                                                                                        • \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN) <unsigned integer>

                                                                                                                                          Gets the key length for the associated cipher algorithm cipher. Use EVP_CIPHER_get_key_length() to retrieve the cached value.

                                                                                                                                        • \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN) <unsigned integer>

                                                                                                                                          Gets the IV length for the associated cipher algorithm cipher. Use EVP_CIPHER_get_iv_length() to retrieve the cached value.

                                                                                                                                        • \"blocksize\" (OSSL_CIPHER_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                                          Gets the block size for the associated cipher algorithm cipher. The block size should be 1 for stream ciphers. Note that the block size for a cipher may be different to the block size for the underlying encryption/decryption primitive. For example AES in CTR mode has a block size of 1 (because it operates like a stream cipher), even though AES has a block size of 16. Use EVP_CIPHER_get_block_size() to retrieve the cached value.

                                                                                                                                        • \"aead\" (OSSL_CIPHER_PARAM_AEAD) <integer>

                                                                                                                                          Gets 1 if this is an AEAD cipher algorithm, otherwise it gets 0. Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) to retrieve the cached value.

                                                                                                                                        • \"custom-iv\" (OSSL_CIPHER_PARAM_CUSTOM_IV) <integer>

                                                                                                                                          Gets 1 if the cipher algorithm cipher has a custom IV, otherwise it gets 0. Storing and initializing the IV is left entirely to the implementation, if a custom IV is used. Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_CUSTOM_IV) to retrieve the cached value.

                                                                                                                                        • \"cts\" (OSSL_CIPHER_PARAM_CTS) <integer>

                                                                                                                                          Gets 1 if the cipher algorithm cipher uses ciphertext stealing, otherwise it gets 0. This is currently used to indicate that the cipher is a one shot that only allows a single call to EVP_CipherUpdate(). Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_CTS) to retrieve the cached value.

                                                                                                                                        • \"tls-multi\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK) <integer>

                                                                                                                                          Gets 1 if the cipher algorithm cipher supports interleaving of crypto blocks, otherwise it gets 0. The interleaving is an optimization only applicable to certain TLS ciphers. Use (EVP_CIPHER_get_flags(cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK) to retrieve the cached value.

                                                                                                                                        • \"has-randkey\" (OSSL_CIPHER_PARAM_HAS_RANDKEY) <integer>

                                                                                                                                          Gets 1 if the cipher algorithm cipher supports the gettable EVP_CIPHER_CTX parameter OSSL_CIPHER_PARAM_RANDOM_KEY. Only DES and 3DES set this to 1, all other OpenSSL ciphers return 0.

                                                                                                                                        "},{"location":"man3/EVP_EncryptInit/#gettable-and-settable-evp_cipher_ctx-parameters","title":"Gettable and Settable EVP_CIPHER_CTX parameters","text":"

                                                                                                                                        The following OSSL_PARAM(3) keys can be used with both EVP_CIPHER_CTX_get_params() and EVP_CIPHER_CTX_set_params().

                                                                                                                                        • \"padding\" (OSSL_CIPHER_PARAM_PADDING) <unsigned integer>

                                                                                                                                          Gets or sets the padding mode for the cipher context ctx. Padding is enabled if the value is 1, and disabled if the value is 0. See also EVP_CIPHER_CTX_set_padding().

                                                                                                                                        • \"num\" (OSSL_CIPHER_PARAM_NUM) <unsigned integer>

                                                                                                                                          Gets or sets the cipher specific \"num\" parameter for the cipher context ctx. Built-in ciphers typically use this to track how much of the current underlying block has been \"used\" already. See also EVP_CIPHER_CTX_get_num() and EVP_CIPHER_CTX_set_num().

                                                                                                                                        • \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN) <unsigned integer>

                                                                                                                                          Gets or sets the key length for the cipher context ctx. The length of the \"keylen\" parameter should not exceed that of a size_t. See also EVP_CIPHER_CTX_get_key_length() and EVP_CIPHER_CTX_set_key_length().

                                                                                                                                        • \"tag\" (OSSL_CIPHER_PARAM_AEAD_TAG) <octet string>

                                                                                                                                          Gets or sets the AEAD tag for the associated cipher context ctx. See \"AEAD Interface\" in EVP_EncryptInit(3).

                                                                                                                                        • \"keybits\" (OSSL_CIPHER_PARAM_RC2_KEYBITS) <unsigned integer>

                                                                                                                                          Gets or sets the effective keybits used for a RC2 cipher. The length of the \"keybits\" parameter should not exceed that of a size_t.

                                                                                                                                        • \"rounds\" (OSSL_CIPHER_PARAM_ROUNDS) <unsigned integer>

                                                                                                                                          Gets or sets the number of rounds to be used for a cipher. This is used by the RC5 cipher.

                                                                                                                                        • \"alg_id_param\" (OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS) <octet string>

                                                                                                                                          Used to pass the DER encoded AlgorithmIdentifier parameter to or from the cipher implementation. Functions like EVP_CIPHER_param_to_asn1(3) and EVP_CIPHER_asn1_to_param(3) use this parameter for any implementation that has the flag EVP_CIPH_FLAG_CUSTOM_ASN1 set.

                                                                                                                                        • \"cts_mode\" (OSSL_CIPHER_PARAM_CTS_MODE)

                                                                                                                                          Gets or sets the cipher text stealing mode. For all modes the output size is the same as the input size. The input length must be greater than or equal to the block size. (The block size for AES and CAMELLIA is 16 bytes).

                                                                                                                                          Valid values for the mode are:

                                                                                                                                          • \"CS1\"

                                                                                                                                            The NIST variant of cipher text stealing. For input lengths that are multiples of the block size it is equivalent to using a \"AES-XXX-CBC\" or \"CAMELLIA-XXX-CBC\" cipher otherwise the second last cipher text block is a partial block.

                                                                                                                                          • \"CS2\"

                                                                                                                                            For input lengths that are multiples of the block size it is equivalent to using a \"AES-XXX-CBC\" or \"CAMELLIA-XXX-CBC\" cipher, otherwise it is the same as \"CS3\" mode.

                                                                                                                                          • \"CS3\"

                                                                                                                                            The Kerberos5 variant of cipher text stealing which always swaps the last cipher text block with the previous block (which may be a partial or full block depending on the input length). If the input length is exactly one full block then this is equivalent to using a \"AES-XXX-CBC\" or \"CAMELLIA-XXX-CBC\" cipher.

                                                                                                                                          The default is \"CS1\". This is only supported for \"AES-128-CBC-CTS\", \"AES-192-CBC-CTS\", \"AES-256-CBC-CTS\", \"CAMELLIA-128-CBC-CTS\", \"CAMELLIA-192-CBC-CTS\" and \"CAMELLIA-256-CBC-CTS\".

                                                                                                                                        • \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE) <unsigned integer>

                                                                                                                                          Sets or gets the number of records being sent in one go for a tls1 multiblock cipher operation (either 4 or 8 records).

                                                                                                                                        • "},{"location":"man3/EVP_EncryptInit/#gettable-evp_cipher_ctx-parameters","title":"Gettable EVP_CIPHER_CTX parameters","text":"

                                                                                                                                          The following OSSL_PARAM(3) keys can be used with EVP_CIPHER_CTX_get_params():

                                                                                                                                          • \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN and <OSSL_CIPHER_PARAM_AEAD_IVLEN) <unsigned integer>

                                                                                                                                            Gets the IV length for the cipher context ctx. The length of the \"ivlen\" parameter should not exceed that of a size_t. See also EVP_CIPHER_CTX_get_iv_length().

                                                                                                                                          • \"iv\" (OSSL_CIPHER_PARAM_IV) <octet string OR octet ptr>

                                                                                                                                            Gets the IV used to initialize the associated cipher context ctx. See also EVP_CIPHER_CTX_get_original_iv().

                                                                                                                                          • \"updated-iv\" (OSSL_CIPHER_PARAM_UPDATED_IV) <octet string OR octet ptr>

                                                                                                                                            Gets the updated pseudo-IV state for the associated cipher context, e.g., the previous ciphertext block for CBC mode or the iteratively encrypted IV value for OFB mode. Note that octet pointer access is deprecated and is provided only for backwards compatibility with historical libcrypto APIs. See also EVP_CIPHER_CTX_get_updated_iv().

                                                                                                                                          • \"randkey\" (OSSL_CIPHER_PARAM_RANDOM_KEY) <octet string>

                                                                                                                                            Gets an implementation specific randomly generated key for the associated cipher context ctx. This is currently only supported by DES and 3DES (which set the key to odd parity).

                                                                                                                                          • \"taglen\" (OSSL_CIPHER_PARAM_AEAD_TAGLEN) <unsigned integer>

                                                                                                                                            Gets the tag length to be used for an AEAD cipher for the associated cipher context ctx. It gets a default value if it has not been set. The length of the \"taglen\" parameter should not exceed that of a size_t. See also EVP_CIPHER_CTX_get_tag_length().

                                                                                                                                          • \"tlsaadpad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD) <unsigned integer>

                                                                                                                                            Gets the length of the tag that will be added to a TLS record for the AEAD tag for the associated cipher context ctx. The length of the \"tlsaadpad\" parameter should not exceed that of a size_t.

                                                                                                                                          • \"tlsivgen\" (OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN) <octet string>

                                                                                                                                            Gets the invocation field generated for encryption. Can only be called after \"tlsivfixed\" is set. This is only used for GCM mode.

                                                                                                                                          • \"tls1multi_enclen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN) <unsigned integer>

                                                                                                                                            Get the total length of the record returned from the \"tls1multi_enc\" operation.

                                                                                                                                          • \"tls1multi_maxbufsz\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE) <unsigned integer>

                                                                                                                                            Gets the maximum record length for a TLS1 multiblock cipher operation. The length of the \"tls1multi_maxbufsz\" parameter should not exceed that of a size_t.

                                                                                                                                          • \"tls1multi_aadpacklen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN) <unsigned integer>

                                                                                                                                            Gets the result of running the \"tls1multi_aad\" operation.

                                                                                                                                          • \"tls-mac\" (OSSL_CIPHER_PARAM_TLS_MAC) <octet ptr>

                                                                                                                                            Used to pass the TLS MAC data.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#settable-evp_cipher_ctx-parameters","title":"Settable EVP_CIPHER_CTX parameters","text":"

                                                                                                                                          The following OSSL_PARAM(3) keys can be used with EVP_CIPHER_CTX_set_params():

                                                                                                                                          • \"mackey\" (OSSL_CIPHER_PARAM_AEAD_MAC_KEY) <octet string>

                                                                                                                                            Sets the MAC key used by composite AEAD ciphers such as AES-CBC-HMAC-SHA256.

                                                                                                                                          • \"speed\" (OSSL_CIPHER_PARAM_SPEED) <unsigned integer>

                                                                                                                                            Sets the speed option for the associated cipher context. This is only supported by AES SIV ciphers which disallow multiple operations by default. Setting \"speed\" to 1 allows another encrypt or decrypt operation to be performed. This is used for performance testing.

                                                                                                                                          • \"use-bits\" (OSSL_CIPHER_PARAM_USE_BITS) <unsigned integer>

                                                                                                                                            Determines if the input length inl passed to EVP_EncryptUpdate(), EVP_DecryptUpdate() and EVP_CipherUpdate() is the number of bits or number of bytes. Setting \"use-bits\" to 1 uses bits. The default is in bytes. This is only used for CFB1 ciphers.

                                                                                                                                            This can be set using EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS).

                                                                                                                                          • \"tls-version\" (OSSL_CIPHER_PARAM_TLS_VERSION) <integer>

                                                                                                                                            Sets the TLS version.

                                                                                                                                          • \"tls-mac-size\" (OSSL_CIPHER_PARAM_TLS_MAC_SIZE) <unsigned integer>

                                                                                                                                            Set the TLS MAC size.

                                                                                                                                          • \"tlsaad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD) <octet string>

                                                                                                                                            Sets TLSv1.2 AAD information for the associated cipher context ctx. TLSv1.2 AAD information is always 13 bytes in length and is as defined for the \"additional_data\" field described in section 6.2.3.3 of RFC5246.

                                                                                                                                          • \"tlsivfixed\" (OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED) <octet string>

                                                                                                                                            Sets the fixed portion of an IV for an AEAD cipher used in a TLS record encryption/ decryption for the associated cipher context. TLS record encryption/decryption always occurs \"in place\" so that the input and output buffers are always the same memory location. AEAD IVs in TLSv1.2 consist of an implicit \"fixed\" part and an explicit part that varies with every record. Setting a TLS fixed IV changes a cipher to encrypt/decrypt TLS records. TLS records are encrypted/decrypted using a single OSSL_FUNC_cipher_cipher call per record. For a record decryption the first bytes of the input buffer will be the explicit part of the IV and the final bytes of the input buffer will be the AEAD tag. The length of the explicit part of the IV and the tag length will depend on the cipher in use and will be defined in the RFC for the relevant ciphersuite. In order to allow for \"in place\" decryption the plaintext output should be written to the same location in the output buffer that the ciphertext payload was read from, i.e. immediately after the explicit IV.

                                                                                                                                            When encrypting a record the first bytes of the input buffer should be empty to allow space for the explicit IV, as will the final bytes where the tag will be written. The length of the input buffer will include the length of the explicit IV, the payload, and the tag bytes. The cipher implementation should generate the explicit IV and write it to the beginning of the output buffer, do \"in place\" encryption of the payload and write that to the output buffer, and finally add the tag onto the end of the output buffer.

                                                                                                                                            Whether encrypting or decrypting the value written to *outl in the OSSL_FUNC_cipher_cipher call should be the length of the payload excluding the explicit IV length and the tag length.

                                                                                                                                          • \"tlsivinv\" (OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV) <octet string>

                                                                                                                                            Sets the invocation field used for decryption. Can only be called after \"tlsivfixed\" is set. This is only used for GCM mode.

                                                                                                                                          • \"tls1multi_enc\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC) <octet string>

                                                                                                                                            Triggers a multiblock TLS1 encrypt operation for a TLS1 aware cipher that supports sending 4 or 8 records in one go. The cipher performs both the MAC and encrypt stages and constructs the record headers itself. \"tls1multi_enc\" supplies the output buffer for the encrypt operation, \"tls1multi_encin\" & \"tls1multi_interleave\" must also be set in order to supply values to the encrypt operation.

                                                                                                                                          • \"tls1multi_encin\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN) <octet string>

                                                                                                                                            Supplies the data to encrypt for a TLS1 multiblock cipher operation.

                                                                                                                                          • \"tls1multi_maxsndfrag\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT) <unsigned integer>

                                                                                                                                            Sets the maximum send fragment size for a TLS1 multiblock cipher operation. It must be set before using \"tls1multi_maxbufsz\". The length of the \"tls1multi_maxsndfrag\" parameter should not exceed that of a size_t.

                                                                                                                                          • \"tls1multi_aad\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD) <octet string>

                                                                                                                                            Sets the authenticated additional data used by a TLS1 multiblock cipher operation. The supplied data consists of 13 bytes of record data containing: Bytes 0-7: The sequence number of the first record Byte 8: The record type Byte 9-10: The protocol version Byte 11-12: Input length (Always 0)

                                                                                                                                            \"tls1multi_interleave\" must also be set for this operation.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#controls","title":"CONTROLS","text":"

                                                                                                                                          The Mappings from EVP_CIPHER_CTX_ctrl() identifiers to PARAMETERS are listed in the following section. See the \"PARAMETERS\" section for more details.

                                                                                                                                          EVP_CIPHER_CTX_ctrl() can be used to send the following standard controls:

                                                                                                                                          • EVP_CTRL_AEAD_SET_IVLEN and EVP_CTRL_GET_IVLEN

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN).

                                                                                                                                          • EVP_CTRL_AEAD_SET_IV_FIXED

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"tlsivfixed\" (OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED).

                                                                                                                                          • EVP_CTRL_AEAD_SET_MAC_KEY

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"mackey\" (OSSL_CIPHER_PARAM_AEAD_MAC_KEY).

                                                                                                                                          • EVP_CTRL_AEAD_SET_TAG and EVP_CTRL_AEAD_GET_TAG

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"tag\" (OSSL_CIPHER_PARAM_AEAD_TAG).

                                                                                                                                          • EVP_CTRL_CCM_SET_L

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN) with a value of (15 - L)

                                                                                                                                          • EVP_CTRL_COPY

                                                                                                                                            There is no OSSL_PARAM mapping for this. Use EVP_CIPHER_CTX_copy() instead.

                                                                                                                                          • EVP_CTRL_GCM_SET_IV_INV

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"tlsivinv\" (OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV).

                                                                                                                                          • EVP_CTRL_RAND_KEY

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"randkey\" (OSSL_CIPHER_PARAM_RANDOM_KEY).

                                                                                                                                          • EVP_CTRL_SET_KEY_LENGTH

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN).

                                                                                                                                          • EVP_CTRL_SET_RC2_KEY_BITS and EVP_CTRL_GET_RC2_KEY_BITS

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"keybits\" (OSSL_CIPHER_PARAM_RC2_KEYBITS).

                                                                                                                                          • EVP_CTRL_SET_RC5_ROUNDS and EVP_CTRL_GET_RC5_ROUNDS

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() and EVP_CIPHER_CTX_get_params() get called with an OSSL_PARAM(3) item with the key \"rounds\" (OSSL_CIPHER_PARAM_ROUNDS).

                                                                                                                                          • EVP_CTRL_SET_SPEED

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key \"speed\" (OSSL_CIPHER_PARAM_SPEED).

                                                                                                                                          • EVP_CTRL_GCM_IV_GEN

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_get_params() gets called with an OSSL_PARAM(3) item with the key \"tlsivgen\" (OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN).

                                                                                                                                          • EVP_CTRL_AEAD_TLS1_AAD

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() get called with an OSSL_PARAM(3) item with the key \"tlsaad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD) followed by EVP_CIPHER_CTX_get_params() with a key of \"tlsaadpad\" (OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD).

                                                                                                                                          • EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with an OSSL_PARAM(3) item with the key OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT followed by EVP_CIPHER_CTX_get_params() with a key of \"tls1multi_maxbufsz\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE).

                                                                                                                                          • EVP_CTRL_TLS1_1_MULTIBLOCK_AAD

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with OSSL_PARAM(3) items with the keys \"tls1multi_aad\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD) and \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE) followed by EVP_CIPHER_CTX_get_params() with keys of \"tls1multi_aadpacklen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN) and \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE).

                                                                                                                                          • EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT

                                                                                                                                            When used with a fetched EVP_CIPHER, EVP_CIPHER_CTX_set_params() gets called with OSSL_PARAM(3) items with the keys \"tls1multi_enc\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC), \"tls1multi_encin\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN) and \"tls1multi_interleave\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE), followed by EVP_CIPHER_CTX_get_params() with a key of \"tls1multi_enclen\" (OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN).

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#flags","title":"FLAGS","text":"

                                                                                                                                          EVP_CIPHER_CTX_set_flags(), EVP_CIPHER_CTX_clear_flags() and EVP_CIPHER_CTX_test_flags(). can be used to manipulate and test these EVP_CIPHER_CTX flags:

                                                                                                                                          • EVP_CIPH_NO_PADDING

                                                                                                                                            Used by EVP_CIPHER_CTX_set_padding().

                                                                                                                                            See also \"Gettable and Settable EVP_CIPHER_CTX parameters\" \"padding\"

                                                                                                                                          • EVP_CIPH_FLAG_LENGTH_BITS

                                                                                                                                            See \"Settable EVP_CIPHER_CTX parameters\" \"use-bits\".

                                                                                                                                          • EVP_CIPHER_CTX_FLAG_WRAP_ALLOW

                                                                                                                                            Used for Legacy purposes only. This flag needed to be set to indicate the cipher handled wrapping.

                                                                                                                                          EVP_CIPHER_flags() uses the following flags that have mappings to \"Gettable EVP_CIPHER parameters\":

                                                                                                                                          • EVP_CIPH_FLAG_AEAD_CIPHER

                                                                                                                                            See \"Gettable EVP_CIPHER parameters\" \"aead\".

                                                                                                                                          • EVP_CIPH_CUSTOM_IV

                                                                                                                                            See \"Gettable EVP_CIPHER parameters\" \"custom-iv\".

                                                                                                                                          • EVP_CIPH_FLAG_CTS

                                                                                                                                            See \"Gettable EVP_CIPHER parameters\" \"cts\".

                                                                                                                                          • EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK;

                                                                                                                                            See \"Gettable EVP_CIPHER parameters\" \"tls-multi\".

                                                                                                                                          • EVP_CIPH_RAND_KEY

                                                                                                                                            See \"Gettable EVP_CIPHER parameters\" \"has-randkey\".

                                                                                                                                          EVP_CIPHER_flags() uses the following flags for legacy purposes only:

                                                                                                                                          • EVP_CIPH_VARIABLE_LENGTH
                                                                                                                                          • EVP_CIPH_FLAG_CUSTOM_CIPHER
                                                                                                                                          • EVP_CIPH_ALWAYS_CALL_INIT
                                                                                                                                          • EVP_CIPH_CTRL_INIT
                                                                                                                                          • EVP_CIPH_CUSTOM_KEY_LENGTH
                                                                                                                                          • EVP_CIPH_CUSTOM_COPY
                                                                                                                                          • EVP_CIPH_FLAG_DEFAULT_ASN1

                                                                                                                                            See EVP_CIPHER_meth_set_flags(3) for further information related to the above flags.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                          EVP_CIPHER_fetch() returns a pointer to a EVP_CIPHER for success and NULL for failure.

                                                                                                                                          EVP_CIPHER_up_ref() returns 1 for success or 0 otherwise.

                                                                                                                                          EVP_CIPHER_CTX_new() returns a pointer to a newly created EVP_CIPHER_CTX for success and NULL for failure.

                                                                                                                                          EVP_CIPHER_CTX_dup() returns a new EVP_CIPHER_CTX if successful or NULL on failure.

                                                                                                                                          EVP_CIPHER_CTX_copy() returns 1 if successful or 0 for failure.

                                                                                                                                          EVP_EncryptInit_ex2(), EVP_EncryptUpdate() and EVP_EncryptFinal_ex() return 1 for success and 0 for failure.

                                                                                                                                          EVP_DecryptInit_ex2() and EVP_DecryptUpdate() return 1 for success and 0 for failure. EVP_DecryptFinal_ex() returns 0 if the decrypt failed or 1 for success.

                                                                                                                                          EVP_CipherInit_ex2() and EVP_CipherUpdate() return 1 for success and 0 for failure. EVP_CipherFinal_ex() returns 0 for a decryption failure or 1 for success.

                                                                                                                                          EVP_Cipher() returns 1 on success or 0 on failure, if the flag EVP_CIPH_FLAG_CUSTOM_CIPHER is not set for the cipher. EVP_Cipher() returns the number of bytes written to out for encryption / decryption, or the number of bytes authenticated in a call specifying AAD for an AEAD cipher, if the flag EVP_CIPH_FLAG_CUSTOM_CIPHER is set for the cipher.

                                                                                                                                          EVP_CIPHER_CTX_reset() returns 1 for success and 0 for failure.

                                                                                                                                          EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() return an EVP_CIPHER structure or NULL on error.

                                                                                                                                          EVP_CIPHER_get_nid() and EVP_CIPHER_CTX_get_nid() return a NID.

                                                                                                                                          EVP_CIPHER_get_block_size() and EVP_CIPHER_CTX_get_block_size() return the block size.

                                                                                                                                          EVP_CIPHER_get_key_length() and EVP_CIPHER_CTX_get_key_length() return the key length.

                                                                                                                                          EVP_CIPHER_CTX_set_padding() always returns 1.

                                                                                                                                          EVP_CIPHER_get_iv_length() and EVP_CIPHER_CTX_get_iv_length() return the IV length or zero if the cipher does not use an IV.

                                                                                                                                          EVP_CIPHER_CTX_get_tag_length() return the tag length or zero if the cipher does not use a tag.

                                                                                                                                          EVP_CIPHER_get_type() and EVP_CIPHER_CTX_get_type() return the NID of the cipher's OBJECT IDENTIFIER or NID_undef if it has no defined OBJECT IDENTIFIER.

                                                                                                                                          EVP_CIPHER_CTX_cipher() returns an EVP_CIPHER structure.

                                                                                                                                          EVP_CIPHER_CTX_get_num() returns a nonnegative num value or EVP_CTRL_RET_UNSUPPORTED if the implementation does not support the call or on any other error.

                                                                                                                                          EVP_CIPHER_CTX_set_num() returns 1 on success and 0 if the implementation does not support the call or on any other error.

                                                                                                                                          EVP_CIPHER_CTX_is_encrypting() returns 1 if the ctx is set up for encryption 0 otherwise.

                                                                                                                                          EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return greater than zero for success and zero or a negative number on failure.

                                                                                                                                          EVP_CIPHER_CTX_rand_key() returns 1 for success and zero or a negative number for failure.

                                                                                                                                          EVP_CIPHER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#cipher-listing","title":"CIPHER LISTING","text":"

                                                                                                                                          All algorithms have a fixed key length unless otherwise stated.

                                                                                                                                          Refer to \"SEE ALSO\" for the full list of ciphers available through the EVP interface.

                                                                                                                                          • EVP_enc_null()

                                                                                                                                            Null cipher: does nothing.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#aead-interface","title":"AEAD INTERFACE","text":"

                                                                                                                                          The EVP interface for Authenticated Encryption with Associated Data (AEAD) modes are subtly altered and several additional ctrl operations are supported depending on the mode specified.

                                                                                                                                          To specify additional authenticated data (AAD), a call to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made with the output parameter out set to NULL. In this case, on success, the parameter outl is set to the number of bytes authenticated.

                                                                                                                                          When decrypting, the return value of EVP_DecryptFinal() or EVP_CipherFinal() indicates whether the operation was successful. If it does not indicate success, the authentication operation has failed and any output data MUST NOT be used as it is corrupted.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#gcm-and-ocb-modes","title":"GCM and OCB Modes","text":"

                                                                                                                                          The following _ctrl_s are supported in GCM and OCB modes.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, ivlen, NULL)

                                                                                                                                            Sets the IV length. This call can only be made before specifying an IV. If not called a default IV length is used.

                                                                                                                                            For GCM AES and OCB AES the default is 12 (i.e. 96 bits). For OCB mode the maximum is 15.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag)

                                                                                                                                            Writes taglen bytes of the tag value to the buffer indicated by tag. This call can only be made when encrypting data and after all data has been processed (e.g. after an EVP_EncryptFinal() call).

                                                                                                                                            For OCB, taglen must either be 16 or the value previously set via EVP_CTRL_AEAD_SET_TAG.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag)

                                                                                                                                            When decrypting, this call sets the expected tag to taglen bytes from tag. taglen must be between 1 and 16 inclusive. The tag must be set prior to any call to EVP_DecryptFinal() or EVP_DecryptFinal_ex().

                                                                                                                                            For GCM, this call is only valid when decrypting data.

                                                                                                                                            For OCB, this call is valid when decrypting data to set the expected tag, and when encrypting to set the desired tag length.

                                                                                                                                            In OCB mode, calling this when encrypting with tag set to NULL sets the tag length. The tag length can only be set before specifying an IV. If this is not called prior to setting the IV during encryption, then a default tag length is used.

                                                                                                                                            For OCB AES, the default tag length is 16 (i.e. 128 bits). It is also the maximum tag length for OCB.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#ccm-mode","title":"CCM Mode","text":"

                                                                                                                                          The EVP interface for CCM mode is similar to that of the GCM mode but with a few additional requirements and different ctrl values.

                                                                                                                                          For CCM mode, the total plaintext or ciphertext length MUST be passed to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() with the output and input parameters (in and out) set to NULL and the length passed in the inl parameter.

                                                                                                                                          The following _ctrl_s are supported in CCM mode.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag)

                                                                                                                                            This call is made to set the expected CCM tag value when decrypting or the length of the tag (with the tag parameter set to NULL) when encrypting. The tag length is often referred to as M. If not set a default value is used (12 for AES). When decrypting, the tag needs to be set before passing in data to be decrypted, but as in GCM and OCB mode, it can be set after passing additional authenticated data (see \"AEAD INTERFACE\").

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_L, ivlen, NULL)

                                                                                                                                            Sets the CCM L value. If not set a default is used (8 for AES).

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, ivlen, NULL)

                                                                                                                                            Sets the CCM nonce (IV) length. This call can only be made before specifying a nonce value. The nonce length is given by 15 - L so it is 7 by default for AES.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#siv-mode","title":"SIV Mode","text":"

                                                                                                                                          For SIV mode ciphers the behaviour of the EVP interface is subtly altered and several additional ctrl operations are supported.

                                                                                                                                          To specify any additional authenticated data (AAD) and/or a Nonce, a call to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made with the output parameter out set to NULL.

                                                                                                                                          RFC5297 states that the Nonce is the last piece of AAD before the actual encrypt/decrypt takes place. The API does not differentiate the Nonce from other AAD.

                                                                                                                                          When decrypting the return value of EVP_DecryptFinal() or EVP_CipherFinal() indicates if the operation was successful. If it does not indicate success the authentication operation has failed and any output data MUST NOT be used as it is corrupted.

                                                                                                                                          The API does not store the the SIV (Synthetic Initialization Vector) in the cipher text. Instead, it is stored as the tag within the EVP_CIPHER_CTX. The SIV must be retrieved from the context after encryption, and set into the context before decryption.

                                                                                                                                          This differs from RFC5297 in that the cipher output from encryption, and the cipher input to decryption, does not contain the SIV. This also means that the plain text and cipher text lengths are identical.

                                                                                                                                          The following ctrls are supported in SIV mode, and are used to get and set the Synthetic Initialization Vector:

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag);

                                                                                                                                            Writes taglen bytes of the tag value (the Synthetic Initialization Vector) to the buffer indicated by tag. This call can only be made when encrypting data and after all data has been processed (e.g. after an EVP_EncryptFinal() call). For SIV mode the taglen must be 16.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag);

                                                                                                                                            Sets the expected tag (the Synthetic Initialization Vector) to taglen bytes from tag. This call is only legal when decrypting data and must be made before any data is processed (e.g. before any EVP_DecryptUpdate() calls). For SIV mode the taglen must be 16.

                                                                                                                                          SIV mode makes two passes over the input data, thus, only one call to EVP_CipherUpdate(), EVP_EncryptUpdate() or EVP_DecryptUpdate() should be made with out set to a non-NULL value. A call to EVP_DecryptFinal() or EVP_CipherFinal() is not required, but will indicate if the update operation succeeded.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#chacha20-poly1305","title":"ChaCha20-Poly1305","text":"

                                                                                                                                          The following _ctrl_s are supported for the ChaCha20-Poly1305 AEAD algorithm.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, ivlen, NULL)

                                                                                                                                            Sets the nonce length. This call is now redundant since the only valid value is the default length of 12 (i.e. 96 bits). Prior to OpenSSL 3.0 a nonce of less than 12 bytes could be used to automatically pad the iv with leading 0 bytes to make it 12 bytes in length.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, tag)

                                                                                                                                            Writes taglen bytes of the tag value to the buffer indicated by tag. This call can only be made when encrypting data and after all data has been processed (e.g. after an EVP_EncryptFinal() call).

                                                                                                                                            taglen specified here must be 16 (POLY1305_BLOCK_SIZE, i.e. 128-bits) or less.

                                                                                                                                          • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, tag)

                                                                                                                                            Sets the expected tag to taglen bytes from tag. The tag length can only be set before specifying an IV. taglen must be between 1 and 16 (POLY1305_BLOCK_SIZE) inclusive. This call is only valid when decrypting data.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#notes","title":"NOTES","text":"

                                                                                                                                          Where possible the EVP interface to symmetric ciphers should be used in preference to the low-level interfaces. This is because the code then becomes transparent to the cipher used and much more flexible. Additionally, the EVP interface will ensure the use of platform specific cryptographic acceleration such as AES-NI (the low-level interfaces do not provide the guarantee).

                                                                                                                                          PKCS padding works by adding n padding bytes of value n to make the total length of the encrypted data a multiple of the block size. Padding is always added so if the data is already a multiple of the block size n will equal the block size. For example if the block size is 8 and 11 bytes are to be encrypted then 5 padding bytes of value 5 will be added.

                                                                                                                                          When decrypting the final block is checked to see if it has the correct form.

                                                                                                                                          Although the decryption operation can produce an error if padding is enabled, it is not a strong test that the input data or key is correct. A random block has better than 1 in 256 chance of being of the correct format and problems with the input data earlier on will not produce a final decrypt error.

                                                                                                                                          If padding is disabled then the decryption operation will always succeed if the total amount of data decrypted is a multiple of the block size.

                                                                                                                                          The functions EVP_EncryptInit(), EVP_EncryptInit_ex(), EVP_EncryptFinal(), EVP_DecryptInit(), EVP_DecryptInit_ex(), EVP_CipherInit(), EVP_CipherInit_ex() and EVP_CipherFinal() are obsolete but are retained for compatibility with existing code. New code should use EVP_EncryptInit_ex2(), EVP_EncryptFinal_ex(), EVP_DecryptInit_ex2(), EVP_DecryptFinal_ex(), EVP_CipherInit_ex2() and EVP_CipherFinal_ex() because they can reuse an existing context without allocating and freeing it up on each call.

                                                                                                                                          There are some differences between functions EVP_CipherInit() and EVP_CipherInit_ex(), significant in some circumstances. EVP_CipherInit() fills the passed context object with zeros. As a consequence, EVP_CipherInit() does not allow step-by-step initialization of the ctx when the key and iv are passed in separate calls. It also means that the flags set for the CTX are removed, and it is especially important for the EVP_CIPHER_CTX_FLAG_WRAP_ALLOW flag treated specially in EVP_CipherInit_ex().

                                                                                                                                          Ignoring failure returns of the EVP_CIPHER_CTX initialization functions can lead to subsequent undefined behavior when calling the functions that update or finalize the context. The only valid calls on the EVP_CIPHER_CTX when initialization fails are calls that attempt another initialization of the context or release the context.

                                                                                                                                          EVP_get_cipherbynid(), and EVP_get_cipherbyobj() are implemented as macros.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#bugs","title":"BUGS","text":"

                                                                                                                                          EVP_MAX_KEY_LENGTH and EVP_MAX_IV_LENGTH only refer to the internal ciphers with default key lengths. If custom ciphers exceed these values the results are unpredictable. This is because it has become standard practice to define a generic key as a fixed unsigned char array containing EVP_MAX_KEY_LENGTH bytes.

                                                                                                                                          The ASN1 code is incomplete (and sometimes inaccurate) it has only been tested for certain common S/MIME ciphers (RC2, DES, triple DES) in CBC mode.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#examples","title":"EXAMPLES","text":"

                                                                                                                                          Encrypt a string using IDEA:

                                                                                                                                          int do_crypt(char *outfile)\n{\n    unsigned char outbuf[1024];\n    int outlen, tmplen;\n    /*\n     * Bogus key and IV: we'd normally set these from\n     * another source.\n     */\n    unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};\n    unsigned char iv[] = {1,2,3,4,5,6,7,8};\n    char intext[] = \"Some Crypto Text\";\n    EVP_CIPHER_CTX *ctx;\n    FILE *out;\n\n    ctx = EVP_CIPHER_CTX_new();\n    if (!EVP_EncryptInit_ex2(ctx, EVP_idea_cbc(), key, iv, NULL)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n\n    if (!EVP_EncryptUpdate(ctx, outbuf, &outlen, intext, strlen(intext))) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    /*\n     * Buffer passed to EVP_EncryptFinal() must be after data just\n     * encrypted to avoid overwriting it.\n     */\n    if (!EVP_EncryptFinal_ex(ctx, outbuf + outlen, &tmplen)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    outlen += tmplen;\n    EVP_CIPHER_CTX_free(ctx);\n    /*\n     * Need binary mode for fopen because encrypted data is\n     * binary data. Also cannot use strlen() on it because\n     * it won't be NUL terminated and may contain embedded\n     * NULs.\n     */\n    out = fopen(outfile, \"wb\");\n    if (out == NULL) {\n        /* Error */\n        return 0;\n    }\n    fwrite(outbuf, 1, outlen, out);\n    fclose(out);\n    return 1;\n}\n

                                                                                                                                          The ciphertext from the above example can be decrypted using the openssl utility with the command line (shown on two lines for clarity):

                                                                                                                                          openssl idea -d \\\n    -K 000102030405060708090A0B0C0D0E0F -iv 0102030405060708 <filename\n

                                                                                                                                          General encryption and decryption function example using FILE I/O and AES128 with a 128-bit key:

                                                                                                                                          int do_crypt(FILE *in, FILE *out, int do_encrypt)\n{\n    /* Allow enough space in output buffer for additional block */\n    unsigned char inbuf[1024], outbuf[1024 + EVP_MAX_BLOCK_LENGTH];\n    int inlen, outlen;\n    EVP_CIPHER_CTX *ctx;\n    /*\n     * Bogus key and IV: we'd normally set these from\n     * another source.\n     */\n    unsigned char key[] = \"0123456789abcdeF\";\n    unsigned char iv[] = \"1234567887654321\";\n\n    /* Don't set key or IV right away; we want to check lengths */\n    ctx = EVP_CIPHER_CTX_new();\n    if (!EVP_CipherInit_ex2(ctx, EVP_aes_128_cbc(), NULL, NULL,\n                            do_encrypt, NULL)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    OPENSSL_assert(EVP_CIPHER_CTX_get_key_length(ctx) == 16);\n    OPENSSL_assert(EVP_CIPHER_CTX_get_iv_length(ctx) == 16);\n\n    /* Now we can set key and IV */\n    if (!EVP_CipherInit_ex2(ctx, NULL, key, iv, do_encrypt, NULL)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n\n    for (;;) {\n        inlen = fread(inbuf, 1, 1024, in);\n        if (inlen <= 0)\n            break;\n        if (!EVP_CipherUpdate(ctx, outbuf, &outlen, inbuf, inlen)) {\n            /* Error */\n            EVP_CIPHER_CTX_free(ctx);\n            return 0;\n        }\n        fwrite(outbuf, 1, outlen, out);\n    }\n    if (!EVP_CipherFinal_ex(ctx, outbuf, &outlen)) {\n        /* Error */\n        EVP_CIPHER_CTX_free(ctx);\n        return 0;\n    }\n    fwrite(outbuf, 1, outlen, out);\n\n    EVP_CIPHER_CTX_free(ctx);\n    return 1;\n}\n

                                                                                                                                          Encryption using AES-CBC with a 256-bit key with \"CS1\" ciphertext stealing.

                                                                                                                                          int encrypt(const unsigned char *key, const unsigned char *iv,\n            const unsigned char *msg, size_t msg_len, unsigned char *out)\n{\n   /*\n    * This assumes that key size is 32 bytes and the iv is 16 bytes.\n    * For ciphertext stealing mode the length of the ciphertext \"out\" will be\n    * the same size as the plaintext size \"msg_len\".\n    * The \"msg_len\" can be any size >= 16.\n    */\n    int ret = 0, encrypt = 1, outlen, len;\n    EVP_CIPHER_CTX *ctx = NULL;\n    EVP_CIPHER *cipher = NULL;\n    OSSL_PARAM params[2];\n\n    ctx = EVP_CIPHER_CTX_new();\n    cipher = EVP_CIPHER_fetch(NULL, \"AES-256-CBC-CTS\", NULL);\n    if (ctx == NULL || cipher == NULL)\n        goto err;\n\n    /*\n     * The default is \"CS1\" so this is not really needed,\n     * but would be needed to set either \"CS2\" or \"CS3\".\n     */\n    params[0] = OSSL_PARAM_construct_utf8_string(OSSL_CIPHER_PARAM_CTS_MODE,\n                                                 \"CS1\", 0);\n    params[1] = OSSL_PARAM_construct_end();\n\n    if (!EVP_CipherInit_ex2(ctx, cipher, key, iv, encrypt, params))\n        goto err;\n\n    /* NOTE: CTS mode does not support multiple calls to EVP_CipherUpdate() */\n    if (!EVP_CipherUpdate(ctx, out, &outlen, msg, msg_len))\n        goto err;\n     if (!EVP_CipherFinal_ex(ctx, out + outlen, &len))\n        goto err;\n    ret = 1;\nerr:\n    EVP_CIPHER_free(cipher);\n    EVP_CIPHER_CTX_free(ctx);\n    return ret;\n}\n
                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                          evp(7), property(7), \"ALGORITHM FETCHING\" in crypto(7), provider-cipher(7), life_cycle-cipher(7)

                                                                                                                                          Supported ciphers are listed in:

                                                                                                                                          EVP_aes_128_gcm(3), EVP_aria_128_gcm(3), EVP_bf_cbc(3), EVP_camellia_128_ecb(3), EVP_cast5_cbc(3), EVP_chacha20(3), EVP_des_cbc(3), EVP_desx_cbc(3), EVP_idea_cbc(3), EVP_rc2_cbc(3), EVP_rc4(3), EVP_rc5_32_12_16_cbc(3), EVP_seed_cbc(3), EVP_sm4_cbc(3),

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#history","title":"HISTORY","text":"

                                                                                                                                          Support for OCB mode was added in OpenSSL 1.1.0.

                                                                                                                                          EVP_CIPHER_CTX was made opaque in OpenSSL 1.1.0. As a result, EVP_CIPHER_CTX_reset() appeared and EVP_CIPHER_CTX_cleanup() disappeared. EVP_CIPHER_CTX_init() remains as an alias for EVP_CIPHER_CTX_reset().

                                                                                                                                          The EVP_CIPHER_CTX_cipher() function was deprecated in OpenSSL 3.0; use EVP_CIPHER_CTX_get0_cipher() instead.

                                                                                                                                          The EVP_EncryptInit_ex2(), EVP_DecryptInit_ex2(), EVP_CipherInit_ex2(), EVP_CIPHER_fetch(), EVP_CIPHER_free(), EVP_CIPHER_up_ref(), EVP_CIPHER_CTX_get0_cipher(), EVP_CIPHER_CTX_get1_cipher(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(), EVP_CIPHER_CTX_get_params(), EVP_CIPHER_gettable_params(), EVP_CIPHER_settable_ctx_params(), EVP_CIPHER_gettable_ctx_params(), EVP_CIPHER_CTX_settable_params() and EVP_CIPHER_CTX_gettable_params() functions were added in 3.0.

                                                                                                                                          The EVP_CIPHER_nid(), EVP_CIPHER_name(), EVP_CIPHER_block_size(), EVP_CIPHER_key_length(), EVP_CIPHER_iv_length(), EVP_CIPHER_flags(), EVP_CIPHER_mode(), EVP_CIPHER_type(), EVP_CIPHER_CTX_nid(), EVP_CIPHER_CTX_block_size(), EVP_CIPHER_CTX_key_length(), EVP_CIPHER_CTX_iv_length(), EVP_CIPHER_CTX_tag_length(), EVP_CIPHER_CTX_num(), EVP_CIPHER_CTX_type(), and EVP_CIPHER_CTX_mode() functions were renamed to include get or get0 in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

                                                                                                                                          The EVP_CIPHER_CTX_encrypting() function was renamed to EVP_CIPHER_CTX_is_encrypting() in OpenSSL 3.0. The old name is kept as non-deprecated alias macro.

                                                                                                                                          The EVP_CIPHER_CTX_flags() macro was deprecated in OpenSSL 1.1.0.

                                                                                                                                          EVP_CIPHER_CTX_dup() was added in OpenSSL 3.1.

                                                                                                                                          "},{"location":"man3/EVP_EncryptInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                          Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                          "},{"location":"man3/EVP_KDF/","title":"EVP_KDF","text":""},{"location":"man3/EVP_KDF/#name","title":"NAME","text":"

                                                                                                                                          EVP_KDF, EVP_KDF_fetch, EVP_KDF_free, EVP_KDF_up_ref, EVP_KDF_CTX, EVP_KDF_CTX_new, EVP_KDF_CTX_free, EVP_KDF_CTX_dup, EVP_KDF_CTX_reset, EVP_KDF_derive, EVP_KDF_CTX_get_kdf_size, EVP_KDF_get0_provider, EVP_KDF_CTX_kdf, EVP_KDF_is_a, EVP_KDF_get0_name, EVP_KDF_names_do_all, EVP_KDF_get0_description, EVP_KDF_CTX_get_params, EVP_KDF_CTX_set_params, EVP_KDF_do_all_provided, EVP_KDF_get_params, EVP_KDF_gettable_params, EVP_KDF_gettable_ctx_params, EVP_KDF_settable_ctx_params, EVP_KDF_CTX_gettable_params, EVP_KDF_CTX_settable_params - EVP KDF routines

                                                                                                                                          "},{"location":"man3/EVP_KDF/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                          #include <openssl/kdf.h>\n\ntypedef struct evp_kdf_st EVP_KDF;\ntypedef struct evp_kdf_ctx_st EVP_KDF_CTX;\n\nEVP_KDF_CTX *EVP_KDF_CTX_new(EVP_KDF *kdf);\nconst EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx);\nvoid EVP_KDF_CTX_free(EVP_KDF_CTX *ctx);\nEVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src);\nvoid EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx);\nsize_t EVP_KDF_CTX_get_kdf_size(EVP_KDF_CTX *ctx);\nint EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen,\n                   const OSSL_PARAM params[]);\nint EVP_KDF_up_ref(EVP_KDF *kdf);\nvoid EVP_KDF_free(EVP_KDF *kdf);\nEVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,\n                       const char *properties);\nint EVP_KDF_is_a(const EVP_KDF *kdf, const char *name);\nconst char *EVP_KDF_get0_name(const EVP_KDF *kdf);\nconst char *EVP_KDF_get0_description(const EVP_KDF *kdf);\nconst OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);\nvoid EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx,\n                             void (*fn)(EVP_KDF *kdf, void *arg),\n                             void *arg);\nint EVP_KDF_names_do_all(const EVP_KDF *kdf,\n                         void (*fn)(const char *name, void *data),\n                         void *data);\nint EVP_KDF_get_params(EVP_KDF *kdf, OSSL_PARAM params[]);\nint EVP_KDF_CTX_get_params(EVP_KDF_CTX *ctx, OSSL_PARAM params[]);\nint EVP_KDF_CTX_set_params(EVP_KDF_CTX *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_KDF_gettable_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_gettable_ctx_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_CTX_gettable_params(const EVP_KDF *kdf);\nconst OSSL_PARAM *EVP_KDF_CTX_settable_params(const EVP_KDF *kdf);\nconst OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);\n
                                                                                                                                          "},{"location":"man3/EVP_KDF/#description","title":"DESCRIPTION","text":"

                                                                                                                                          The EVP KDF routines are a high-level interface to Key Derivation Function algorithms and should be used instead of algorithm-specific functions.

                                                                                                                                          After creating a EVP_KDF_CTX for the required algorithm using EVP_KDF_CTX_new(), inputs to the algorithm are supplied either by passing them as part of the EVP_KDF_derive() call or using calls to EVP_KDF_CTX_set_params() before calling EVP_KDF_derive() to derive the key.

                                                                                                                                          "},{"location":"man3/EVP_KDF/#types","title":"Types","text":"

                                                                                                                                          EVP_KDF is a type that holds the implementation of a KDF.

                                                                                                                                          EVP_KDF_CTX is a context type that holds the algorithm inputs.

                                                                                                                                          "},{"location":"man3/EVP_KDF/#algorithm-implementation-fetching","title":"Algorithm implementation fetching","text":"

                                                                                                                                          EVP_KDF_fetch() fetches an implementation of a KDF algorithm, given a library context libctx and a set of properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                          See \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-default(7) for the lists of algorithms supported by the default provider.

                                                                                                                                          The returned value must eventually be freed with EVP_KDF_free(3).

                                                                                                                                          EVP_KDF_up_ref() increments the reference count of an already fetched KDF.

                                                                                                                                          EVP_KDF_free() frees a fetched algorithm. NULL is a valid parameter, for which this function is a no-op.

                                                                                                                                          "},{"location":"man3/EVP_KDF/#context-manipulation-functions","title":"Context manipulation functions","text":"

                                                                                                                                          EVP_KDF_CTX_new() creates a new context for the KDF implementation kdf.

                                                                                                                                          EVP_KDF_CTX_free() frees up the context ctx. If ctx is NULL, nothing is done.

                                                                                                                                          EVP_KDF_CTX_kdf() returns the EVP_KDF associated with the context ctx.

                                                                                                                                          "},{"location":"man3/EVP_KDF/#computing-functions","title":"Computing functions","text":"

                                                                                                                                          EVP_KDF_CTX_reset() resets the context to the default state as if the context had just been created.

                                                                                                                                          EVP_KDF_derive() processes any parameters in Params and then derives keylen bytes of key material and places it in the key buffer. If the algorithm produces a fixed amount of output then an error will occur unless the keylen parameter is equal to that output size, as returned by EVP_KDF_CTX_get_kdf_size().

                                                                                                                                          EVP_KDF_get_params() retrieves details about the implementation kdf. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

                                                                                                                                          EVP_KDF_CTX_get_params() retrieves chosen parameters, given the context ctx and its underlying context. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

                                                                                                                                          EVP_KDF_CTX_set_params() passes chosen parameters to the underlying context, given a context ctx. The set of parameters given with params determine exactly what parameters are passed down. Note that a parameter that is unknown in the underlying context is simply ignored. Also, what happens when a needed parameter isn't passed down is defined by the implementation.

                                                                                                                                          EVP_KDF_gettable_params() returns an OSSL_PARAM(3) array that describes the retrievable and settable parameters. EVP_KDF_gettable_params() returns parameters that can be used with EVP_KDF_get_params().

                                                                                                                                          EVP_KDF_gettable_ctx_params() and EVP_KDF_CTX_gettable_params() return constant OSSL_PARAM(3) arrays that describe the retrievable parameters that can be used with EVP_KDF_CTX_get_params(). EVP_KDF_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_KDF_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                          EVP_KDF_settable_ctx_params() and EVP_KDF_CTX_settable_params() return constant OSSL_PARAM(3) arrays that describe the settable parameters that can be used with EVP_KDF_CTX_set_params(). EVP_KDF_settable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_KDF_CTX_settable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                          "},{"location":"man3/EVP_KDF/#information-functions","title":"Information functions","text":"

                                                                                                                                          EVP_KDF_CTX_get_kdf_size() returns the output size if the algorithm produces a fixed amount of output and SIZE_MAX otherwise. If an error occurs then 0 is returned. For some algorithms an error may result if input parameters necessary to calculate a fixed output size have not yet been supplied.

                                                                                                                                          EVP_KDF_is_a() returns 1 if kdf is an implementation of an algorithm that's identifiable with name, otherwise 0.

                                                                                                                                          EVP_KDF_get0_provider() returns the provider that holds the implementation of the given kdf.

                                                                                                                                          EVP_KDF_do_all_provided() traverses all KDF implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                          EVP_KDF_get0_name() return the name of the given KDF. For fetched KDFs with multiple names, only one of them is returned; it's recommended to use EVP_KDF_names_do_all() instead.

                                                                                                                                          EVP_KDF_names_do_all() traverses all names for kdf, and calls fn with each name and data.

                                                                                                                                          EVP_KDF_get0_description() returns a description of the kdf, meant for display and human consumption. The description is at the discretion of the kdf implementation.

                                                                                                                                          "},{"location":"man3/EVP_KDF/#parameters","title":"PARAMETERS","text":"

                                                                                                                                          The standard parameter names are:

                                                                                                                                          • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>

                                                                                                                                            Some KDF implementations require a password. For those KDF implementations that support it, this parameter sets the password.

                                                                                                                                          • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                                                                                                                            Some KDF implementations can take a non-secret unique cryptographic salt. For those KDF implementations that support it, this parameter sets the salt.

                                                                                                                                            The default value, if any, is implementation dependent.

                                                                                                                                          • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

                                                                                                                                            Some KDF implementations require an iteration count. For those KDF implementations that support it, this parameter sets the iteration count.

                                                                                                                                            The default value, if any, is implementation dependent.

                                                                                                                                          • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                                                                                                                          • \"mac\" (OSSL_KDF_PARAM_MAC)
                                                                                                                                          • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                                                                                                                          • \"cipher\" (OSSL_KDF_PARAM_CIPHER)

                                                                                                                                            For KDF implementations that use an underlying computation MAC, digest or cipher, these parameters set what the algorithm should be.

                                                                                                                                            The value is always the name of the intended algorithm, or the properties.

                                                                                                                                            Note that not all algorithms may support all possible underlying implementations.

                                                                                                                                          • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                                                                                                                            Some KDF implementations require a key. For those KDF implementations that support it, this octet string parameter sets the key.

                                                                                                                                          • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                                                                                                                            Some KDF implementations, such as EVP_KDF-HKDF(7), take an 'info' parameter for binding the derived key material to application- and context-specific information. This parameter sets the info, fixed info, other info or shared info argument. You can specify this parameter multiple times, and each instance will be concatenated to form the final value.

                                                                                                                                          • \"maclen\" (OSSL_KDF_PARAM_MAC_SIZE) <unsigned integer>

                                                                                                                                            Used by implementations that use a MAC with a variable output size (KMAC). For those KDF implementations that support it, this parameter sets the MAC output size.

                                                                                                                                            The default value, if any, is implementation dependent. The length must never exceed what can be given with a size_t.

                                                                                                                                          • \"maxmem_bytes\" (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>

                                                                                                                                            Memory-hard password-based KDF algorithms, such as scrypt, use an amount of memory that depends on the load factors provided as input. For those KDF implementations that support it, this uint64_t parameter sets an upper limit on the amount of memory that may be consumed while performing a key derivation. If this memory usage limit is exceeded because the load factors are chosen too high, the key derivation will fail.

                                                                                                                                            The default value is implementation dependent. The memory size must never exceed what can be given with a size_t.

                                                                                                                                          • "},{"location":"man3/EVP_KDF/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                            EVP_KDF_fetch() returns a pointer to a newly fetched EVP_KDF, or NULL if allocation failed.

                                                                                                                                            EVP_KDF_get0_provider() returns a pointer to the provider for the KDF, or NULL on error.

                                                                                                                                            EVP_KDF_up_ref() returns 1 on success, 0 on error.

                                                                                                                                            EVP_KDF_CTX_new() returns either the newly allocated EVP_KDF_CTX structure or NULL if an error occurred.

                                                                                                                                            EVP_KDF_CTX_free() and EVP_KDF_CTX_reset() do not return a value.

                                                                                                                                            EVP_KDF_CTX_get_kdf_size() returns the output size. SIZE_MAX is returned to indicate that the algorithm produces a variable amount of output; 0 to indicate failure.

                                                                                                                                            EVP_KDF_get0_name() returns the name of the KDF, or NULL on error.

                                                                                                                                            EVP_KDF_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                            The remaining functions return 1 for success and 0 or a negative value for failure. In particular, a return value of -2 indicates the operation is not supported by the KDF algorithm.

                                                                                                                                            "},{"location":"man3/EVP_KDF/#notes","title":"NOTES","text":"

                                                                                                                                            The KDF life-cycle is described in life_cycle-kdf(7). In the future, the transitions described there will be enforced. When this is done, it will not be considered a breaking change to the API.

                                                                                                                                            "},{"location":"man3/EVP_KDF/#see-also","title":"SEE ALSO","text":"

                                                                                                                                            \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-default(7), life_cycle-kdf(7).

                                                                                                                                            "},{"location":"man3/EVP_KDF/#history","title":"HISTORY","text":"

                                                                                                                                            This functionality was added in OpenSSL 3.0.

                                                                                                                                            "},{"location":"man3/EVP_KDF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                            Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                            "},{"location":"man3/EVP_KEM_free/","title":"EVP_KEM_free","text":""},{"location":"man3/EVP_KEM_free/#name","title":"NAME","text":"

                                                                                                                                            EVP_KEM_fetch, EVP_KEM_free, EVP_KEM_up_ref, EVP_KEM_get0_name, EVP_KEM_is_a, EVP_KEM_get0_provider, EVP_KEM_do_all_provided, EVP_KEM_names_do_all, EVP_KEM_get0_description, EVP_KEM_gettable_ctx_params, EVP_KEM_settable_ctx_params - Functions to manage EVP_KEM algorithm objects

                                                                                                                                            "},{"location":"man3/EVP_KEM_free/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                            #include <openssl/evp.h>\n\nEVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                       const char *properties);\nvoid EVP_KEM_free(EVP_KEM *kem);\nint EVP_KEM_up_ref(EVP_KEM *kem);\nconst char *EVP_KEM_get0_name(const EVP_KEM *kem);\nint EVP_KEM_is_a(const EVP_KEM *kem, const char *name);\nOSSL_PROVIDER *EVP_KEM_get0_provider(const EVP_KEM *kem);\nvoid EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,\n                             void (*fn)(EVP_KEM *kem, void *arg), void *arg);\nint EVP_KEM_names_do_all(const EVP_KEM *kem,\n                         void (*fn)(const char *name, void *data), void *data);\nconst char *EVP_KEM_get0_description(const EVP_KEM *kem);\nconst OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem);\nconst OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem);\n
                                                                                                                                            "},{"location":"man3/EVP_KEM_free/#description","title":"DESCRIPTION","text":"

                                                                                                                                            EVP_KEM_fetch() fetches the implementation for the given algorithm from any provider offering it, within the criteria given by the properties and in the scope of the given library context ctx (see OSSL_LIB_CTX(3)). The algorithm will be one offering functions for performing asymmetric kem related tasks such as key encapsulation and decapsulation. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                            The returned value must eventually be freed with EVP_KEM_free().

                                                                                                                                            EVP_KEM_free() decrements the reference count for the EVP_KEM structure. Typically this structure will have been obtained from an earlier call to EVP_KEM_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

                                                                                                                                            EVP_KEM_up_ref() increments the reference count for an EVP_KEM structure.

                                                                                                                                            EVP_KEM_is_a() returns 1 if kem is an implementation of an algorithm that's identifiable with name, otherwise 0.

                                                                                                                                            EVP_KEM_get0_provider() returns the provider that kem was fetched from.

                                                                                                                                            EVP_KEM_do_all_provided() traverses all EVP_KEMs implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                            EVP_KEM_get0_name() returns the algorithm name from the provided implementation for the given kem. Note that the kem may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the kem object and should not be freed by the caller.

                                                                                                                                            EVP_KEM_names_do_all() traverses all names for kem, and calls fn with each name and data.

                                                                                                                                            EVP_KEM_get0_description() returns a description of the kem, meant for display and human consumption. The description is at the discretion of the kem implementation.

                                                                                                                                            EVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a key encapsulation algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

                                                                                                                                            "},{"location":"man3/EVP_KEM_free/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                            EVP_KEM_fetch() returns a pointer to an EVP_KEM for success or NULL for failure.

                                                                                                                                            EVP_KEM_up_ref() returns 1 for success or 0 otherwise.

                                                                                                                                            EVP_KEM_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                            EVP_KEM_gettable_ctx_params() and EVP_KEM_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

                                                                                                                                            "},{"location":"man3/EVP_KEM_free/#see-also","title":"SEE ALSO","text":"

                                                                                                                                            \"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

                                                                                                                                            "},{"location":"man3/EVP_KEM_free/#history","title":"HISTORY","text":"

                                                                                                                                            The functions described here were added in OpenSSL 3.0.

                                                                                                                                            "},{"location":"man3/EVP_KEM_free/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                            Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                            "},{"location":"man3/EVP_KEYEXCH_free/","title":"EVP_KEYEXCH_free","text":""},{"location":"man3/EVP_KEYEXCH_free/#name","title":"NAME","text":"

                                                                                                                                            EVP_KEYEXCH_fetch, EVP_KEYEXCH_free, EVP_KEYEXCH_up_ref, EVP_KEYEXCH_get0_provider, EVP_KEYEXCH_is_a, EVP_KEYEXCH_do_all_provided, EVP_KEYEXCH_names_do_all, EVP_KEYEXCH_get0_name, EVP_KEYEXCH_get0_description, EVP_KEYEXCH_gettable_ctx_params, EVP_KEYEXCH_settable_ctx_params - Functions to manage EVP_KEYEXCH algorithm objects

                                                                                                                                            "},{"location":"man3/EVP_KEYEXCH_free/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                            #include <openssl/evp.h>\n\nEVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                               const char *properties);\nvoid EVP_KEYEXCH_free(EVP_KEYEXCH *exchange);\nint EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange);\nOSSL_PROVIDER *EVP_KEYEXCH_get0_provider(const EVP_KEYEXCH *exchange);\nint EVP_KEYEXCH_is_a(const EVP_KEYEXCH *exchange, const char *name);\nconst char *EVP_KEYEXCH_get0_name(const EVP_KEYEXCH *exchange);\nvoid EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx,\n                                 void (*fn)(EVP_KEYEXCH *exchange, void *arg),\n                                 void *arg);\nint EVP_KEYEXCH_names_do_all(const EVP_KEYEXCH *exchange,\n                             void (*fn)(const char *name, void *data),\n                             void *data);\nconst char *EVP_KEYEXCH_get0_description(const EVP_KEYEXCH *keyexch);\nconst OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch);\nconst OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch);\n
                                                                                                                                            "},{"location":"man3/EVP_KEYEXCH_free/#description","title":"DESCRIPTION","text":"

                                                                                                                                            EVP_KEYEXCH_fetch() fetches the key exchange implementation for the given algorithm from any provider offering it, within the criteria given by the properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                            The returned value must eventually be freed with EVP_KEYEXCH_free().

                                                                                                                                            EVP_KEYEXCH_free() decrements the reference count for the EVP_KEYEXCH structure. Typically this structure will have been obtained from an earlier call to EVP_KEYEXCH_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

                                                                                                                                            EVP_KEYEXCH_up_ref() increments the reference count for an EVP_KEYEXCH structure.

                                                                                                                                            EVP_KEYEXCH_get0_provider() returns the provider that exchange was fetched from.

                                                                                                                                            EVP_KEYEXCH_is_a() checks if exchange is an implementation of an algorithm that's identifiable with name.

                                                                                                                                            EVP_KEYEXCH_get0_name() returns the algorithm name from the provided implementation for the given exchange. Note that the exchange may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the exchange object and should not be freed by the caller.

                                                                                                                                            EVP_KEYEXCH_names_do_all() traverses all names for the exchange, and calls fn with each name and data.

                                                                                                                                            EVP_KEYEXCH_get0_description() returns a description of the keyexch, meant for display and human consumption. The description is at the discretion of the keyexch implementation.

                                                                                                                                            EVP_KEYEXCH_do_all_provided() traverses all key exchange implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and data as arguments.

                                                                                                                                            EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a key exchange algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

                                                                                                                                            "},{"location":"man3/EVP_KEYEXCH_free/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                            EVP_KEYEXCH_fetch() returns a pointer to a EVP_KEYEXCH for success or NULL for failure.

                                                                                                                                            EVP_KEYEXCH_up_ref() returns 1 for success or 0 otherwise.

                                                                                                                                            EVP_KEYEXCH_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                            EVP_KEYEXCH_is_a() returns 1 of exchange was identifiable, otherwise 0.

                                                                                                                                            EVP_KEYEXCH_gettable_ctx_params() and EVP_KEYEXCH_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

                                                                                                                                            "},{"location":"man3/EVP_KEYEXCH_free/#see-also","title":"SEE ALSO","text":"

                                                                                                                                            \"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

                                                                                                                                            "},{"location":"man3/EVP_KEYEXCH_free/#history","title":"HISTORY","text":"

                                                                                                                                            The functions described here were added in OpenSSL 3.0.

                                                                                                                                            "},{"location":"man3/EVP_KEYEXCH_free/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                            Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/","title":"EVP_KEYMGMT","text":""},{"location":"man3/EVP_KEYMGMT/#name","title":"NAME","text":"

                                                                                                                                            EVP_KEYMGMT, EVP_KEYMGMT_fetch, EVP_KEYMGMT_up_ref, EVP_KEYMGMT_free, EVP_KEYMGMT_get0_provider, EVP_KEYMGMT_is_a, EVP_KEYMGMT_get0_description, EVP_KEYMGMT_get0_name, EVP_KEYMGMT_do_all_provided, EVP_KEYMGMT_names_do_all, EVP_KEYMGMT_gettable_params, EVP_KEYMGMT_settable_params, EVP_KEYMGMT_gen_settable_params - EVP key management routines

                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                            #include <openssl/evp.h>\n\ntypedef struct evp_keymgmt_st EVP_KEYMGMT;\n\nEVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                               const char *properties);\nint EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);\nvoid EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);\nconst OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt);\nint EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);\nconst char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt);\nconst char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt);\n\nvoid EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,\n                                 void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),\n                                 void *arg);\nint EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,\n                             void (*fn)(const char *name, void *data),\n                             void *data);\nconst OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);\nconst OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);\nconst OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);\n
                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/#description","title":"DESCRIPTION","text":"

                                                                                                                                            EVP_KEYMGMT is a method object that represents key management implementations for different cryptographic algorithms. This method object provides functionality to have providers import key material from the outside, as well as export key material to the outside. Most of the functionality can only be used internally and has no public interface, this object is simply passed into other functions when needed.

                                                                                                                                            EVP_KEYMGMT_fetch() looks for an algorithm within the provider that has been loaded into the OSSL_LIB_CTX given by ctx, having the name given by algorithm and the properties given by properties.

                                                                                                                                            EVP_KEYMGMT_up_ref() increments the reference count for the given EVP_KEYMGMT keymgmt.

                                                                                                                                            EVP_KEYMGMT_free() decrements the reference count for the given EVP_KEYMGMT keymgmt, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

                                                                                                                                            EVP_KEYMGMT_get0_provider() returns the provider that has this particular implementation.

                                                                                                                                            EVP_KEYMGMT_is_a() checks if keymgmt is an implementation of an algorithm that's identifiable with name.

                                                                                                                                            EVP_KEYMGMT_get0_name() returns the algorithm name from the provided implementation for the given keymgmt. Note that the keymgmt may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the keymgmt object and should not be freed by the caller.

                                                                                                                                            EVP_KEYMGMT_names_do_all() traverses all names for the keymgmt, and calls fn with each name and data.

                                                                                                                                            EVP_KEYMGMT_get0_description() returns a description of the keymgmt, meant for display and human consumption. The description is at the discretion of the keymgmt implementation.

                                                                                                                                            EVP_KEYMGMT_do_all_provided() traverses all key keymgmt implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and data as arguments.

                                                                                                                                            EVP_KEYMGMT_gettable_params() and EVP_KEYMGMT_settable_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set. EVP_KEYMGMT_gettable_params() is used by EVP_PKEY_gettable_params(3).

                                                                                                                                            EVP_KEYMGMT_gen_settable_params() returns a constant OSSL_PARAM(3) array that describes the names and types of key generation parameters that can be set via EVP_PKEY_CTX_set_params(3).

                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/#notes","title":"NOTES","text":"

                                                                                                                                            EVP_KEYMGMT_fetch() may be called implicitly by other fetching functions, using the same library context and properties. Any other API that uses keys will typically do this.

                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                            EVP_KEYMGMT_fetch() returns a pointer to the key management implementation represented by an EVP_KEYMGMT object, or NULL on error.

                                                                                                                                            EVP_KEYMGMT_up_ref() returns 1 on success, or 0 on error.

                                                                                                                                            EVP_KEYMGMT_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                            EVP_KEYMGMT_free() doesn't return any value.

                                                                                                                                            EVP_KEYMGMT_get0_provider() returns a pointer to a provider object, or NULL on error.

                                                                                                                                            EVP_KEYMGMT_is_a() returns 1 of keymgmt was identifiable, otherwise 0.

                                                                                                                                            EVP_KEYMGMT_get0_name() returns the algorithm name, or NULL on error.

                                                                                                                                            EVP_KEYMGMT_get0_description() returns a pointer to a description, or NULL if there isn't one.

                                                                                                                                            EVP_KEYMGMT_gettable_params(), EVP_KEYMGMT_settable_params() and EVP_KEYMGMT_gen_settable_params() return a constant OSSL_PARAM(3) array or NULL on error.

                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/#see-also","title":"SEE ALSO","text":"

                                                                                                                                            EVP_MD_fetch(3), OSSL_LIB_CTX(3)

                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/#history","title":"HISTORY","text":"

                                                                                                                                            The functions described here were added in OpenSSL 3.0.

                                                                                                                                            "},{"location":"man3/EVP_KEYMGMT/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                            Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                            "},{"location":"man3/EVP_MAC/","title":"EVP_MAC","text":""},{"location":"man3/EVP_MAC/#name","title":"NAME","text":"

                                                                                                                                            EVP_MAC, EVP_MAC_fetch, EVP_MAC_up_ref, EVP_MAC_free, EVP_MAC_is_a, EVP_MAC_get0_name, EVP_MAC_names_do_all, EVP_MAC_get0_description, EVP_MAC_get0_provider, EVP_MAC_get_params, EVP_MAC_gettable_params, EVP_MAC_CTX, EVP_MAC_CTX_new, EVP_MAC_CTX_free, EVP_MAC_CTX_dup, EVP_MAC_CTX_get0_mac, EVP_MAC_CTX_get_params, EVP_MAC_CTX_set_params, EVP_MAC_CTX_get_mac_size, EVP_MAC_CTX_get_block_size, EVP_Q_mac, EVP_MAC_init, EVP_MAC_update, EVP_MAC_final, EVP_MAC_finalXOF, EVP_MAC_gettable_ctx_params, EVP_MAC_settable_ctx_params, EVP_MAC_CTX_gettable_params, EVP_MAC_CTX_settable_params, EVP_MAC_do_all_provided - EVP MAC routines

                                                                                                                                            "},{"location":"man3/EVP_MAC/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                            #include <openssl/evp.h>\n\ntypedef struct evp_mac_st EVP_MAC;\ntypedef struct evp_mac_ctx_st EVP_MAC_CTX;\n\nEVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,\n                       const char *properties);\nint EVP_MAC_up_ref(EVP_MAC *mac);\nvoid EVP_MAC_free(EVP_MAC *mac);\nint EVP_MAC_is_a(const EVP_MAC *mac, const char *name);\nconst char *EVP_MAC_get0_name(const EVP_MAC *mac);\nint EVP_MAC_names_do_all(const EVP_MAC *mac,\n                         void (*fn)(const char *name, void *data),\n                         void *data);\nconst char *EVP_MAC_get0_description(const EVP_MAC *mac);\nconst OSSL_PROVIDER *EVP_MAC_get0_provider(const EVP_MAC *mac);\nint EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]);\n\nEVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac);\nvoid EVP_MAC_CTX_free(EVP_MAC_CTX *ctx);\nEVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src);\nEVP_MAC *EVP_MAC_CTX_get0_mac(EVP_MAC_CTX *ctx);\nint EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);\nint EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);\n\nsize_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx);\nsize_t EVP_MAC_CTX_get_block_size(EVP_MAC_CTX *ctx);\nunsigned char *EVP_Q_mac(OSSL_LIB_CTX *libctx, const char *name, const char *propq,\n                         const char *subalg, const OSSL_PARAM *params,\n                         const void *key, size_t keylen,\n                         const unsigned char *data, size_t datalen,\n                         unsigned char *out, size_t outsize, size_t *outlen);\nint EVP_MAC_init(EVP_MAC_CTX *ctx, const unsigned char *key, size_t keylen,\n                 const OSSL_PARAM params[]);\nint EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen);\nint EVP_MAC_final(EVP_MAC_CTX *ctx,\n                  unsigned char *out, size_t *outl, size_t outsize);\nint EVP_MAC_finalXOF(EVP_MAC_CTX *ctx, unsigned char *out, size_t outsize);\n\nconst OSSL_PARAM *EVP_MAC_gettable_params(const EVP_MAC *mac);\nconst OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac);\nconst OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac);\nconst OSSL_PARAM *EVP_MAC_CTX_gettable_params(EVP_MAC_CTX *ctx);\nconst OSSL_PARAM *EVP_MAC_CTX_settable_params(EVP_MAC_CTX *ctx);\n\nvoid EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx,\n                             void (*fn)(EVP_MAC *mac, void *arg),\n                             void *arg);\n
                                                                                                                                            "},{"location":"man3/EVP_MAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                            These types and functions help the application to calculate MACs of different types and with different underlying algorithms if there are any.

                                                                                                                                            MACs are a bit complex insofar that some of them use other algorithms for actual computation. HMAC uses a digest, and CMAC uses a cipher. Therefore, there are sometimes two contexts to keep track of, one for the MAC algorithm itself and one for the underlying computation algorithm if there is one.

                                                                                                                                            To make things less ambiguous, this manual talks about a \"context\" or \"MAC context\", which is to denote the MAC level context, and about a \"underlying context\", or \"computation context\", which is to denote the context for the underlying computation algorithm if there is one.

                                                                                                                                            "},{"location":"man3/EVP_MAC/#types","title":"Types","text":"

                                                                                                                                            EVP_MAC is a type that holds the implementation of a MAC.

                                                                                                                                            EVP_MAC_CTX is a context type that holds internal MAC information as well as a reference to a computation context, for those MACs that rely on an underlying computation algorithm.

                                                                                                                                            "},{"location":"man3/EVP_MAC/#algorithm-implementation-fetching","title":"Algorithm implementation fetching","text":"

                                                                                                                                            EVP_MAC_fetch() fetches an implementation of a MAC algorithm, given a library context libctx and a set of properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                            See \"Message Authentication Code (MAC)\" in OSSL_PROVIDER-default(7) for the list of algorithms supported by the default provider.

                                                                                                                                            The returned value must eventually be freed with EVP_MAC_free(3).

                                                                                                                                            EVP_MAC_up_ref() increments the reference count of an already fetched MAC.

                                                                                                                                            EVP_MAC_free() frees a fetched algorithm. NULL is a valid parameter, for which this function is a no-op.

                                                                                                                                            "},{"location":"man3/EVP_MAC/#context-manipulation-functions","title":"Context manipulation functions","text":"

                                                                                                                                            EVP_MAC_CTX_new() creates a new context for the MAC type mac. The created context can then be used with most other functions described here.

                                                                                                                                            EVP_MAC_CTX_free() frees the contents of the context, including an underlying context if there is one, as well as the context itself. NULL is a valid parameter, for which this function is a no-op.

                                                                                                                                            EVP_MAC_CTX_dup() duplicates the src context and returns a newly allocated context.

                                                                                                                                            EVP_MAC_CTX_get0_mac() returns the EVP_MAC associated with the context ctx.

                                                                                                                                            "},{"location":"man3/EVP_MAC/#computing-functions","title":"Computing functions","text":"

                                                                                                                                            EVP_Q_mac() computes the message authentication code of data with length datalen using the MAC algorithm name and the key key with length keylen. The MAC algorithm is fetched using any given libctx and property query string propq. It takes parameters subalg and further params, both of which may be NULL if not needed. If out is not NULL, it places the result in the memory pointed at by out, but only if outsize is sufficient (otherwise no computation is made). If out is NULL, it allocates and uses a buffer of suitable length, which will be returned on success and must be freed by the caller. In either case, also on error, it assigns the number of bytes written to *outlen unless outlen is NULL.

                                                                                                                                            EVP_MAC_init() sets up the underlying context ctx with information given via the key and params arguments. The MAC key has a length of keylen and the parameters in params are processed before setting the key. If key is NULL, the key must be set via params either as part of this call or separately using EVP_MAC_CTX_set_params(). Providing non-NULL params to this function is equivalent to calling EVP_MAC_CTX_set_params() with those params for the same ctx beforehand. Note: There are additional requirements for some MAC algorithms during re-initalization (i.e. calling EVP_MAC_init() on an EVP_MAC after EVP_MAC_final() has been called on the same object). See the NOTES section below.

                                                                                                                                            EVP_MAC_init() should be called before EVP_MAC_update() and EVP_MAC_final().

                                                                                                                                            EVP_MAC_update() adds datalen bytes from data to the MAC input.

                                                                                                                                            EVP_MAC_final() does the final computation and stores the result in the memory pointed at by out of size outsize, and sets the number of bytes written in *outl at. If out is NULL or outsize is too small, then no computation is made. To figure out what the output length will be and allocate space for it dynamically, simply call with out being NULL and outl pointing at a valid location, then allocate space and make a second call with out pointing at the allocated space.

                                                                                                                                            EVP_MAC_finalXOF() does the final computation for an XOF based MAC and stores the result in the memory pointed at by out of size outsize.

                                                                                                                                            EVP_MAC_get_params() retrieves details about the implementation mac. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

                                                                                                                                            EVP_MAC_CTX_get_params() retrieves chosen parameters, given the context ctx and its underlying context. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

                                                                                                                                            EVP_MAC_CTX_set_params() passes chosen parameters to the underlying context, given a context ctx. The set of parameters given with params determine exactly what parameters are passed down. If params are NULL, the underlying context should do nothing and return 1. Note that a parameter that is unknown in the underlying context is simply ignored. Also, what happens when a needed parameter isn't passed down is defined by the implementation.

                                                                                                                                            EVP_MAC_gettable_params() returns an OSSL_PARAM(3) array that describes the retrievable and settable parameters. EVP_MAC_gettable_params() returns parameters that can be used with EVP_MAC_get_params().

                                                                                                                                            EVP_MAC_gettable_ctx_params() and EVP_MAC_CTX_gettable_params() return constant OSSL_PARAM(3) arrays that describe the retrievable parameters that can be used with EVP_MAC_CTX_get_params(). EVP_MAC_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_MAC_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                            EVP_MAC_settable_ctx_params() and EVP_MAC_CTX_settable_params() return constant OSSL_PARAM(3) arrays that describe the settable parameters that can be used with EVP_MAC_CTX_set_params(). EVP_MAC_settable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_MAC_CTX_settable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                            "},{"location":"man3/EVP_MAC/#information-functions","title":"Information functions","text":"

                                                                                                                                            EVP_MAC_CTX_get_mac_size() returns the MAC output size for the given context.

                                                                                                                                            EVP_MAC_CTX_get_block_size() returns the MAC block size for the given context. Not all MAC algorithms support this.

                                                                                                                                            EVP_MAC_is_a() checks if the given mac is an implementation of an algorithm that's identifiable with name.

                                                                                                                                            EVP_MAC_get0_provider() returns the provider that holds the implementation of the given mac.

                                                                                                                                            EVP_MAC_do_all_provided() traverses all MAC implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                            EVP_MAC_get0_name() return the name of the given MAC. For fetched MACs with multiple names, only one of them is returned; it's recommended to use EVP_MAC_names_do_all() instead.

                                                                                                                                            EVP_MAC_names_do_all() traverses all names for mac, and calls fn with each name and data.

                                                                                                                                            EVP_MAC_get0_description() returns a description of the mac, meant for display and human consumption. The description is at the discretion of the mac implementation.

                                                                                                                                            "},{"location":"man3/EVP_MAC/#parameters","title":"PARAMETERS","text":"

                                                                                                                                            Parameters are identified by name as strings, and have an expected data type and maximum size. OpenSSL has a set of macros for parameter names it expects to see in its own MAC implementations. Here, we show all three, the OpenSSL macro for the parameter name, the name in string form, and a type description.

                                                                                                                                            The standard parameter names are:

                                                                                                                                            • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                              Its value is the MAC key as an array of bytes.

                                                                                                                                              For MACs that use an underlying computation algorithm, the algorithm must be set first, see parameter names \"algorithm\" below.

                                                                                                                                            • \"iv\" (OSSL_MAC_PARAM_IV) <octet string>

                                                                                                                                              Some MAC implementations (GMAC) require an IV, this parameter sets the IV.

                                                                                                                                            • \"custom\" (OSSL_MAC_PARAM_CUSTOM) <octet string>

                                                                                                                                              Some MAC implementations (KMAC, BLAKE2) accept a Customization String, this parameter sets the Customization String. The default value is the empty string.

                                                                                                                                            • \"salt\" (OSSL_MAC_PARAM_SALT) <octet string>

                                                                                                                                              This option is used by BLAKE2 MAC.

                                                                                                                                            • \"xof\" (OSSL_MAC_PARAM_XOF) <integer>

                                                                                                                                              It's a simple flag, the value 0 or 1 are expected.

                                                                                                                                              This option is used by KMAC.

                                                                                                                                            • \"digest-noinit\" (OSSL_MAC_PARAM_DIGEST_NOINIT) <integer>

                                                                                                                                              A simple flag to set the MAC digest to not initialise the implementation specific data. The value 0 or 1 is expected.

                                                                                                                                              This option is used by HMAC.

                                                                                                                                            • \"digest-oneshot\" (OSSL_MAC_PARAM_DIGEST_ONESHOT) <integer>

                                                                                                                                              A simple flag to set the MAC digest to be a oneshot operation. The value 0 or 1 is expected.

                                                                                                                                              This option is used by HMAC.

                                                                                                                                            • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

                                                                                                                                            • \"digest\" (OSSL_MAC_PARAM_DIGEST)
                                                                                                                                            • \"cipher\" (OSSL_MAC_PARAM_CIPHER)

                                                                                                                                              For MAC implementations that use an underlying computation cipher or digest, these parameters set what the algorithm should be.

                                                                                                                                              The value is always the name of the intended algorithm, or the properties.

                                                                                                                                              Note that not all algorithms may support all digests. HMAC does not support variable output length digests such as SHAKE128 or SHAKE256.

                                                                                                                                            • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                              For MAC implementations that support it, set the output size that EVP_MAC_final() should produce. The allowed sizes vary between MAC implementations, but must never exceed what can be given with a size_t.

                                                                                                                                            • \"tls-data-size\" (OSSL_MAC_PARAM_TLS_DATA_SIZE) <unsigned integer>

                                                                                                                                              This parameter is only supported by HMAC. If set then special handling is activated for calculating the MAC of a received mac-then-encrypt TLS record where variable length record padding has been used (as in the case of CBC mode ciphersuites). The value represents the total length of the record that is having the MAC calculated including the received MAC and the record padding.

                                                                                                                                              When used EVP_MAC_update must be called precisely twice. The first time with the 13 bytes of TLS \"header\" data, and the second time with the entire record including the MAC itself and any padding. The entire record length must equal the value passed in the \"tls-data-size\" parameter. The length passed in the datalen parameter to EVP_MAC_update() should be equal to the length of the record after the MAC and any padding has been removed.

                                                                                                                                            • All these parameters should be used before the calls to any of EVP_MAC_init(), EVP_MAC_update() and EVP_MAC_final() for a full computation. Anything else may give undefined results.

                                                                                                                                              "},{"location":"man3/EVP_MAC/#notes","title":"NOTES","text":"

                                                                                                                                              The MAC life-cycle is described in life_cycle-mac(7). In the future, the transitions described there will be enforced. When this is done, it will not be considered a breaking change to the API.

                                                                                                                                              The usage of the parameter names \"custom\", \"iv\" and \"salt\" correspond to the names used in the standard where the algorithm was defined.

                                                                                                                                              Some MAC algorithms store internal state that cannot be extracted during re-initalization. For example GMAC cannot extract an IV from the underlying CIPHER context, and so calling EVP_MAC_init() on an EVP_MAC object after EVP_MAC_final() has been called cannot reset its cipher state to what it was when the IV was initially generated. For such instances, an OSSL_MAC_PARAM_IV parameter must be passed with each call to EVP_MAC_init().

                                                                                                                                              "},{"location":"man3/EVP_MAC/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_MAC_fetch() returns a pointer to a newly fetched EVP_MAC, or NULL if allocation failed.

                                                                                                                                              EVP_MAC_up_ref() returns 1 on success, 0 on error.

                                                                                                                                              EVP_MAC_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                              EVP_MAC_free() returns nothing at all.

                                                                                                                                              EVP_MAC_is_a() returns 1 if the given method can be identified with the given name, otherwise 0.

                                                                                                                                              EVP_MAC_get0_name() returns a name of the MAC, or NULL on error.

                                                                                                                                              EVP_MAC_get0_provider() returns a pointer to the provider for the MAC, or NULL on error.

                                                                                                                                              EVP_MAC_CTX_new() and EVP_MAC_CTX_dup() return a pointer to a newly created EVP_MAC_CTX, or NULL if allocation failed.

                                                                                                                                              EVP_MAC_CTX_free() returns nothing at all.

                                                                                                                                              EVP_MAC_CTX_get_params() and EVP_MAC_CTX_set_params() return 1 on success, 0 on error.

                                                                                                                                              EVP_Q_mac() returns a pointer to the computed MAC value, or NULL on error.

                                                                                                                                              EVP_MAC_init(), EVP_MAC_update(), EVP_MAC_final(), and EVP_MAC_finalXOF() return 1 on success, 0 on error.

                                                                                                                                              EVP_MAC_CTX_get_mac_size() returns the expected output size, or 0 if it isn't set. If it isn't set, a call to EVP_MAC_init() will set it.

                                                                                                                                              EVP_MAC_CTX_get_block_size() returns the block size, or 0 if it isn't set. If it isn't set, a call to EVP_MAC_init() will set it.

                                                                                                                                              EVP_MAC_do_all_provided() returns nothing at all.

                                                                                                                                              "},{"location":"man3/EVP_MAC/#examples","title":"EXAMPLES","text":"
                                                                                                                                              #include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <stdarg.h>\n#include <unistd.h>\n\n#include <openssl/evp.h>\n#include <openssl/err.h>\n#include <openssl/params.h>\n\nint main() {\n    EVP_MAC *mac = EVP_MAC_fetch(NULL, getenv(\"MY_MAC\"), NULL);\n    const char *cipher = getenv(\"MY_MAC_CIPHER\");\n    const char *digest = getenv(\"MY_MAC_DIGEST\");\n    const char *key = getenv(\"MY_KEY\");\n    EVP_MAC_CTX *ctx = NULL;\n\n    unsigned char buf[4096];\n    size_t read_l;\n    size_t final_l;\n\n    size_t i;\n\n    OSSL_PARAM params[3];\n    size_t params_n = 0;\n\n    if (cipher != NULL)\n        params[params_n++] =\n            OSSL_PARAM_construct_utf8_string(\"cipher\", (char*)cipher, 0);\n    if (digest != NULL)\n        params[params_n++] =\n            OSSL_PARAM_construct_utf8_string(\"digest\", (char*)digest, 0);\n    params[params_n] = OSSL_PARAM_construct_end();\n\n    if (mac == NULL\n        || key == NULL\n        || (ctx = EVP_MAC_CTX_new(mac)) == NULL\n        || !EVP_MAC_init(ctx, (const unsigned char *)key, strlen(key),\n                         params))\n        goto err;\n\n    while ( (read_l = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {\n        if (!EVP_MAC_update(ctx, buf, read_l))\n            goto err;\n    }\n\n    if (!EVP_MAC_final(ctx, buf, &final_l, sizeof(buf)))\n        goto err;\n\n    printf(\"Result: \");\n    for (i = 0; i < final_l; i++)\n        printf(\"%02X\", buf[i]);\n    printf(\"\\n\");\n\n    EVP_MAC_CTX_free(ctx);\n    EVP_MAC_free(mac);\n    exit(0);\n\n err:\n    EVP_MAC_CTX_free(ctx);\n    EVP_MAC_free(mac);\n    fprintf(stderr, \"Something went wrong\\n\");\n    ERR_print_errors_fp(stderr);\n    exit (1);\n}\n

                                                                                                                                              A run of this program, called with correct environment variables, can look like this:

                                                                                                                                              $ MY_MAC=cmac MY_KEY=secret0123456789 MY_MAC_CIPHER=aes-128-cbc \\\n  LD_LIBRARY_PATH=. ./foo < foo.c\nResult: C5C06683CD9DDEF904D754505C560A4E\n

                                                                                                                                              (in this example, that program was stored in foo.c and compiled to ./foo)

                                                                                                                                              "},{"location":"man3/EVP_MAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              property(7) OSSL_PARAM(3), EVP_MAC-BLAKE2(7), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-HMAC(7), EVP_MAC-KMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7), provider-mac(7), life_cycle-mac(7)

                                                                                                                                              "},{"location":"man3/EVP_MAC/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_MAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_MD_meth_new/","title":"EVP_MD_meth_new","text":""},{"location":"man3/EVP_MD_meth_new/#name","title":"NAME","text":"

                                                                                                                                              EVP_MD_meth_new, EVP_MD_meth_dup, EVP_MD_meth_free, EVP_MD_meth_set_input_blocksize, EVP_MD_meth_set_result_size, EVP_MD_meth_set_app_datasize, EVP_MD_meth_set_flags, EVP_MD_meth_set_init, EVP_MD_meth_set_update, EVP_MD_meth_set_final, EVP_MD_meth_set_copy, EVP_MD_meth_set_cleanup, EVP_MD_meth_set_ctrl, EVP_MD_meth_get_input_blocksize, EVP_MD_meth_get_result_size, EVP_MD_meth_get_app_datasize, EVP_MD_meth_get_flags, EVP_MD_meth_get_init, EVP_MD_meth_get_update, EVP_MD_meth_get_final, EVP_MD_meth_get_copy, EVP_MD_meth_get_cleanup, EVP_MD_meth_get_ctrl - Routines to build up legacy EVP_MD methods

                                                                                                                                              "},{"location":"man3/EVP_MD_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n

                                                                                                                                              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);\nvoid EVP_MD_meth_free(EVP_MD *md);\nEVP_MD *EVP_MD_meth_dup(const EVP_MD *md);\n\nint EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);\nint EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);\nint EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);\nint EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);\nint EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));\nint EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,\n                                                     const void *data,\n                                                     size_t count));\nint EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,\n                                                   unsigned char *md));\nint EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,\n                                                 const EVP_MD_CTX *from));\nint EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));\nint EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,\n                                                 int p1, void *p2));\n\nint EVP_MD_meth_get_input_blocksize(const EVP_MD *md);\nint EVP_MD_meth_get_result_size(const EVP_MD *md);\nint EVP_MD_meth_get_app_datasize(const EVP_MD *md);\nunsigned long EVP_MD_meth_get_flags(const EVP_MD *md);\nint (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);\nint (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,\n                                                const void *data,\n                                                size_t count);\nint (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,\n                                               unsigned char *md);\nint (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,\n                                              const EVP_MD_CTX *from);\nint (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);\nint (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,\n                                              int p1, void *p2);\n
                                                                                                                                              "},{"location":"man3/EVP_MD_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                              All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                                                                                                                                              The EVP_MD type is a structure for digest method implementation. It can also have associated public/private key signing and verifying routines.

                                                                                                                                              EVP_MD_meth_new() creates a new EVP_MD structure. These EVP_MD structures are reference counted.

                                                                                                                                              EVP_MD_meth_dup() creates a copy of md.

                                                                                                                                              EVP_MD_meth_free() decrements the reference count for the EVP_MD structure. If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

                                                                                                                                              EVP_MD_meth_set_input_blocksize() sets the internal input block size for the method md to blocksize bytes.

                                                                                                                                              EVP_MD_meth_set_result_size() sets the size of the result that the digest method in md is expected to produce to resultsize bytes.

                                                                                                                                              The digest method may have its own private data, which OpenSSL will allocate for it. EVP_MD_meth_set_app_datasize() should be used to set the size for it to datasize.

                                                                                                                                              EVP_MD_meth_set_flags() sets the flags to describe optional behaviours in the particular md. Several flags can be or'd together. The available flags are:

                                                                                                                                              • EVP_MD_FLAG_ONESHOT

                                                                                                                                                This digest method can only handle one block of input.

                                                                                                                                              • EVP_MD_FLAG_XOF

                                                                                                                                                This digest method is an extensible-output function (XOF) and supports the EVP_MD_CTRL_XOF_LEN control.

                                                                                                                                              • EVP_MD_FLAG_DIGALGID_NULL

                                                                                                                                                When setting up a DigestAlgorithmIdentifier, this flag will have the parameter set to NULL by default. Use this for PKCS#1. Note: if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override.

                                                                                                                                              • EVP_MD_FLAG_DIGALGID_ABSENT

                                                                                                                                                When setting up a DigestAlgorithmIdentifier, this flag will have the parameter be left absent by default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.

                                                                                                                                              • EVP_MD_FLAG_DIGALGID_CUSTOM

                                                                                                                                                Custom DigestAlgorithmIdentifier handling via ctrl, with EVP_MD_FLAG_DIGALGID_ABSENT as default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. Currently unused.

                                                                                                                                              • EVP_MD_FLAG_FIPS

                                                                                                                                                This digest method is suitable for use in FIPS mode. Currently unused.

                                                                                                                                              EVP_MD_meth_set_init() sets the digest init function for md. The digest init function is called by EVP_Digest(), EVP_DigestInit(), EVP_DigestInit_ex(), EVP_SignInit, EVP_SignInit_ex(), EVP_VerifyInit() and EVP_VerifyInit_ex().

                                                                                                                                              EVP_MD_meth_set_update() sets the digest update function for md. The digest update function is called by EVP_Digest(), EVP_DigestUpdate() and EVP_SignUpdate().

                                                                                                                                              EVP_MD_meth_set_final() sets the digest final function for md. The digest final function is called by EVP_Digest(), EVP_DigestFinal(), EVP_DigestFinal_ex(), EVP_SignFinal() and EVP_VerifyFinal().

                                                                                                                                              EVP_MD_meth_set_copy() sets the function for md to do extra computations after the method's private data structure has been copied from one EVP_MD_CTX to another. If all that's needed is to copy the data, there is no need for this copy function. Note that the copy function is passed two EVP_MD_CTX *, the private data structure is then available with EVP_MD_CTX_get0_md_data(). This copy function is called by EVP_MD_CTX_copy() and EVP_MD_CTX_copy_ex().

                                                                                                                                              EVP_MD_meth_set_cleanup() sets the function for md to do extra cleanup before the method's private data structure is cleaned out and freed. Note that the cleanup function is passed a EVP_MD_CTX *, the private data structure is then available with EVP_MD_CTX_get0_md_data(). This cleanup function is called by EVP_MD_CTX_reset() and EVP_MD_CTX_free().

                                                                                                                                              EVP_MD_meth_set_ctrl() sets the control function for md. See EVP_MD_CTX_ctrl(3) for the available controls.

                                                                                                                                              EVP_MD_meth_get_input_blocksize(), EVP_MD_meth_get_result_size(), EVP_MD_meth_get_app_datasize(), EVP_MD_meth_get_flags(), EVP_MD_meth_get_init(), EVP_MD_meth_get_update(), EVP_MD_meth_get_final(), EVP_MD_meth_get_copy(), EVP_MD_meth_get_cleanup() and EVP_MD_meth_get_ctrl() are all used to retrieve the method data given with the EVP_MD_meth_set_*() functions above.

                                                                                                                                              "},{"location":"man3/EVP_MD_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_MD_meth_new() and EVP_MD_meth_dup() return a pointer to a newly created EVP_MD, or NULL on failure. All EVP_MD_meth_set_*() functions return 1. EVP_MD_get_input_blocksize(), EVP_MD_meth_get_result_size(), EVP_MD_meth_get_app_datasize() and EVP_MD_meth_get_flags() return the indicated sizes or flags. All other EVP_CIPHER_meth_get_*() functions return pointers to their respective md function.

                                                                                                                                              "},{"location":"man3/EVP_MD_meth_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_DigestInit(3), EVP_SignInit(3), EVP_VerifyInit(3)

                                                                                                                                              "},{"location":"man3/EVP_MD_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                              All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                              The EVP_MD structure was openly available in OpenSSL before version 1.1. The functions described here were added in OpenSSL 1.1. The EVP_MD structure created with these functions became reference counted in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_MD_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_OpenInit/","title":"EVP_OpenInit","text":""},{"location":"man3/EVP_OpenInit/#name","title":"NAME","text":"

                                                                                                                                              EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption

                                                                                                                                              "},{"location":"man3/EVP_OpenInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,\n                 int ekl, unsigned char *iv, EVP_PKEY *priv);\nint EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                   int *outl, unsigned char *in, int inl);\nint EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n
                                                                                                                                              "},{"location":"man3/EVP_OpenInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP envelope routines are a high-level interface to envelope decryption. They decrypt a public key encrypted symmetric key and then decrypt data using it.

                                                                                                                                              EVP_OpenInit() initializes a cipher context ctx for decryption with cipher type. It decrypts the encrypted symmetric key of length ekl bytes passed in the ek parameter using the private key priv. The IV is supplied in the iv parameter.

                                                                                                                                              EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as documented on the EVP_EncryptInit(3) manual page.

                                                                                                                                              "},{"location":"man3/EVP_OpenInit/#notes","title":"NOTES","text":"

                                                                                                                                              It is possible to call EVP_OpenInit() twice in the same way as EVP_DecryptInit(). The first call should have priv set to NULL and (after setting any cipher parameters) it should be called again with type set to NULL.

                                                                                                                                              If the cipher passed in the type parameter is a variable length cipher then the key length will be set to the value of the recovered key length. If the cipher is a fixed length cipher then the recovered key length must match the fixed cipher length.

                                                                                                                                              "},{"location":"man3/EVP_OpenInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_OpenInit() returns 0 on error or a non zero integer (actually the recovered secret key size) if successful.

                                                                                                                                              EVP_OpenUpdate() returns 1 for success or 0 for failure.

                                                                                                                                              EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success.

                                                                                                                                              "},{"location":"man3/EVP_OpenInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              evp(7), RAND_bytes(3), EVP_EncryptInit(3), EVP_SealInit(3)

                                                                                                                                              "},{"location":"man3/EVP_OpenInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/","title":"EVP_PBE_CipherInit","text":""},{"location":"man3/EVP_PBE_CipherInit/#name","title":"NAME","text":"

                                                                                                                                              EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex, EVP_PBE_find, EVP_PBE_find_ex, EVP_PBE_alg_add_type, EVP_PBE_alg_add - Password based encryption routines

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,\n                       ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);\nint EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,\n                          ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de,\n                          OSSL_LIB_CTX *libctx, const char *propq);\n\nint EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,\n                 EVP_PBE_KEYGEN **pkeygen);\nint EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,\n                    EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex);\n\nint EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,\n                         int md_nid, EVP_PBE_KEYGEN *keygen);\nint EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,\n                    EVP_PBE_KEYGEN *keygen);\n
                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#description","title":"DESCRIPTION","text":""},{"location":"man3/EVP_PBE_CipherInit/#pbe-operations","title":"PBE operations","text":"

                                                                                                                                              EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() initialise an EVP_CIPHER_CTX ctx for encryption (en_de=1) or decryption (en_de=0) using the password pass of length passlen. The PBE algorithm type and parameters are extracted from an OID pbe_obj and parameters param.

                                                                                                                                              EVP_PBE_CipherInit_ex() also allows the application to specify a library context libctx and property query propq to select appropriate algorithm implementations.

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#pbe-algorithm-search","title":"PBE algorithm search","text":"

                                                                                                                                              EVP_PBE_find() and EVP_PBE_find_ex() search for a matching algorithm using two parameters:

                                                                                                                                              1. An algorithm type type which can be:

                                                                                                                                              • EVP_PBE_TYPE_OUTER - A PBE algorithm
                                                                                                                                              • EVP_PBE_TYPE_PRF - A pseudo-random function
                                                                                                                                              • EVP_PBE_TYPE_KDF - A key derivation function

                                                                                                                                              2. A pbe_nid which can represent the algorithm identifier with parameters e.g. NID_pbeWithSHA1AndRC2_CBC or an algorithm class e.g. NID_pbes2.

                                                                                                                                              They return the algorithm's cipher ID pcnid, digest ID pmnid and a key generation function for the algorithm pkeygen. EVP_PBE_CipherInit_ex() also returns an extended key generation function keygen_ex which takes a library context and property query.

                                                                                                                                              If a NULL is supplied for any of pcnid, pmnid, pkeygen or pkeygen_ex then this parameter is not returned.

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#pbe-algorithm-add","title":"PBE algorithm add","text":"

                                                                                                                                              EVP_PBE_alg_add_type() and EVP_PBE_alg_add() add an algorithm to the list of known algorithms. Their parameters have the same meaning as for EVP_PBE_find() and EVP_PBE_find_ex() functions.

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#notes","title":"NOTES","text":"

                                                                                                                                              The arguments pbe_obj and param to EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex() together form an X509_ALGOR and can often be extracted directly from this structure.

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              Return value is 1 for success and 0 if an error occurred.

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              PKCS5_PBE_keyivgen(3), PKCS12_PBE_keyivgen_ex(3), PKCS5_v2_PBE_keyivgen_ex(3), PKCS12_pbe_crypt_ex(3), PKCS12_create_ex(3)

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#history","title":"HISTORY","text":"

                                                                                                                                              EVP_PBE_CipherInit_ex() and EVP_PBE_find_ex() were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PBE_CipherInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY2PKCS8/","title":"EVP_PKEY2PKCS8","text":""},{"location":"man3/EVP_PKEY2PKCS8/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY2PKCS8, EVP_PKCS82PKEY_ex, EVP_PKCS82PKEY - Convert a private key to/from PKCS8

                                                                                                                                              "},{"location":"man3/EVP_PKEY2PKCS8/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/x509.h>\n\nPKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(const EVP_PKEY *pkey);\nEVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8);\nEVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx,\n                            const char *propq);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY2PKCS8/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY2PKCS8() converts a private key pkey into a returned PKCS8 object.

                                                                                                                                              EVP_PKCS82PKEY_ex() converts a PKCS8 object p8 into a returned private key. It uses libctx and propq when fetching algorithms.

                                                                                                                                              EVP_PKCS82PKEY() is similar to EVP_PKCS82PKEY_ex() but uses default values of NULL for the libctx and propq.

                                                                                                                                              "},{"location":"man3/EVP_PKEY2PKCS8/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY2PKCS8() returns a PKCS8 object on success. EVP_PKCS82PKEY() and EVP_PKCS82PKEY_ex() return a private key on success.

                                                                                                                                              All functions return NULL if the operation fails.

                                                                                                                                              "},{"location":"man3/EVP_PKEY2PKCS8/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              PKCS8_pkey_add1_attr(3),

                                                                                                                                              "},{"location":"man3/EVP_PKEY2PKCS8/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/","title":"EVP_PKEY_ASN1_METHOD","text":""},{"location":"man3/EVP_PKEY_ASN1_METHOD/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_ASN1_METHOD, EVP_PKEY_asn1_new, EVP_PKEY_asn1_copy, EVP_PKEY_asn1_free, EVP_PKEY_asn1_add0, EVP_PKEY_asn1_add_alias, EVP_PKEY_asn1_set_public, EVP_PKEY_asn1_set_private, EVP_PKEY_asn1_set_param, EVP_PKEY_asn1_set_free, EVP_PKEY_asn1_set_ctrl, EVP_PKEY_asn1_set_item, EVP_PKEY_asn1_set_siginf, EVP_PKEY_asn1_set_check, EVP_PKEY_asn1_set_public_check, EVP_PKEY_asn1_set_param_check, EVP_PKEY_asn1_set_security_bits, EVP_PKEY_asn1_set_set_priv_key, EVP_PKEY_asn1_set_set_pub_key, EVP_PKEY_asn1_set_get_priv_key, EVP_PKEY_asn1_set_get_pub_key, EVP_PKEY_get0_asn1 - manipulating and registering EVP_PKEY_ASN1_METHOD structure

                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\ntypedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;\n\nEVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,\n                                        const char *pem_str,\n                                        const char *info);\nvoid EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,\n                        const EVP_PKEY_ASN1_METHOD *src);\nvoid EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);\nint EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);\nint EVP_PKEY_asn1_add_alias(int to, int from);\n\nvoid EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,\n                              int (*pub_decode) (EVP_PKEY *pk,\n                                                 const X509_PUBKEY *pub),\n                              int (*pub_encode) (X509_PUBKEY *pub,\n                                                 const EVP_PKEY *pk),\n                              int (*pub_cmp) (const EVP_PKEY *a,\n                                              const EVP_PKEY *b),\n                              int (*pub_print) (BIO *out,\n                                                const EVP_PKEY *pkey,\n                                                int indent, ASN1_PCTX *pctx),\n                              int (*pkey_size) (const EVP_PKEY *pk),\n                              int (*pkey_bits) (const EVP_PKEY *pk));\nvoid EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,\n                               int (*priv_decode) (EVP_PKEY *pk,\n                                                   const PKCS8_PRIV_KEY_INFO\n                                                   *p8inf),\n                               int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8,\n                                                   const EVP_PKEY *pk),\n                               int (*priv_print) (BIO *out,\n                                                  const EVP_PKEY *pkey,\n                                                  int indent,\n                                                  ASN1_PCTX *pctx));\nvoid EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,\n                             int (*param_decode) (EVP_PKEY *pkey,\n                                                  const unsigned char **pder,\n                                                  int derlen),\n                             int (*param_encode) (const EVP_PKEY *pkey,\n                                                  unsigned char **pder),\n                             int (*param_missing) (const EVP_PKEY *pk),\n                             int (*param_copy) (EVP_PKEY *to,\n                                                const EVP_PKEY *from),\n                             int (*param_cmp) (const EVP_PKEY *a,\n                                               const EVP_PKEY *b),\n                             int (*param_print) (BIO *out,\n                                                 const EVP_PKEY *pkey,\n                                                 int indent,\n                                                 ASN1_PCTX *pctx));\n\nvoid EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,\n                            void (*pkey_free) (EVP_PKEY *pkey));\nvoid EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,\n                            int (*pkey_ctrl) (EVP_PKEY *pkey, int op,\n                                              long arg1, void *arg2));\nvoid EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth,\n                            int (*item_verify) (EVP_MD_CTX *ctx,\n                                                const ASN1_ITEM *it,\n                                                void *asn,\n                                                X509_ALGOR *a,\n                                                ASN1_BIT_STRING *sig,\n                                                EVP_PKEY *pkey),\n                            int (*item_sign) (EVP_MD_CTX *ctx,\n                                              const ASN1_ITEM *it,\n                                              void *asn,\n                                              X509_ALGOR *alg1,\n                                              X509_ALGOR *alg2,\n                                              ASN1_BIT_STRING *sig));\n\nvoid EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth,\n                              int (*siginf_set) (X509_SIG_INFO *siginf,\n                                                 const X509_ALGOR *alg,\n                                                 const ASN1_STRING *sig));\n\nvoid EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,\n                             int (*pkey_check) (const EVP_PKEY *pk));\n\nvoid EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,\n                                    int (*pkey_pub_check) (const EVP_PKEY *pk));\n\nvoid EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,\n                                   int (*pkey_param_check) (const EVP_PKEY *pk));\n\nvoid EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,\n                                     int (*pkey_security_bits) (const EVP_PKEY\n                                                                *pk));\n\nvoid EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                    int (*set_priv_key) (EVP_PKEY *pk,\n                                                         const unsigned char\n                                                            *priv,\n                                                         size_t len));\n\nvoid EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                   int (*set_pub_key) (EVP_PKEY *pk,\n                                                       const unsigned char *pub,\n                                                       size_t len));\n\nvoid EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                    int (*get_priv_key) (const EVP_PKEY *pk,\n                                                         unsigned char *priv,\n                                                         size_t *len));\n\nvoid EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth,\n                                   int (*get_pub_key) (const EVP_PKEY *pk,\n                                                       unsigned char *pub,\n                                                       size_t *len));\n\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_ASN1_METHOD is a structure which holds a set of ASN.1 conversion, printing and information methods for a specific public key algorithm.

                                                                                                                                              There are two places where the EVP_PKEY_ASN1_METHOD objects are stored: one is a built-in array representing the standard methods for different algorithms, and the other one is a stack of user-defined application-specific methods, which can be manipulated by using EVP_PKEY_asn1_add0(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#methods","title":"Methods","text":"

                                                                                                                                              The methods are the underlying implementations of a particular public key algorithm present by the EVP_PKEY object.

                                                                                                                                              int (*pub_decode) (EVP_PKEY *pk, const X509_PUBKEY *pub);\nint (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk);\nint (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);\nint (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent,\n                  ASN1_PCTX *pctx);\n

                                                                                                                                              The pub_decode() and pub_encode() methods are called to decode / encode X509_PUBKEY ASN.1 parameters to / from pk. They MUST return 0 on error, 1 on success. They're called by X509_PUBKEY_get0(3) and X509_PUBKEY_set(3).

                                                                                                                                              The pub_cmp() method is called when two public keys are to be compared. It MUST return 1 when the keys are equal, 0 otherwise. It's called by EVP_PKEY_eq(3).

                                                                                                                                              The pub_print() method is called to print a public key in humanly readable text to out, indented indent spaces. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_print_public(3).

                                                                                                                                              int (*priv_decode) (EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);\nint (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);\nint (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent,\n                   ASN1_PCTX *pctx);\n

                                                                                                                                              The priv_decode() and priv_encode() methods are called to decode / encode PKCS8_PRIV_KEY_INFO form private key to / from pk. They MUST return 0 on error, 1 on success. They're called by EVP_PKCS82PKEY(3) and EVP_PKEY2PKCS8(3).

                                                                                                                                              The priv_print() method is called to print a private key in humanly readable text to out, indented indent spaces. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_print_private(3).

                                                                                                                                              int (*pkey_size) (const EVP_PKEY *pk);\nint (*pkey_bits) (const EVP_PKEY *pk);\nint (*pkey_security_bits) (const EVP_PKEY *pk);\n

                                                                                                                                              The pkey_size() method returns the key size in bytes. It's called by EVP_PKEY_get_size(3).

                                                                                                                                              The pkey_bits() method returns the key size in bits. It's called by EVP_PKEY_get_bits(3).

                                                                                                                                              int (*param_decode) (EVP_PKEY *pkey,\n                     const unsigned char **pder, int derlen);\nint (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder);\nint (*param_missing) (const EVP_PKEY *pk);\nint (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from);\nint (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);\nint (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent,\n                    ASN1_PCTX *pctx);\n

                                                                                                                                              The param_decode() and param_encode() methods are called to decode / encode DER formatted parameters to / from pk. They MUST return 0 on error, 1 on success. They're called by PEM_read_bio_Parameters(3) and the file: OSSL_STORE_LOADER(3).

                                                                                                                                              The param_missing() method returns 0 if a key parameter is missing, otherwise 1. It's called by EVP_PKEY_missing_parameters(3).

                                                                                                                                              The param_copy() method copies key parameters from from to to. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_copy_parameters(3).

                                                                                                                                              The param_cmp() method compares the parameters of keys a and b. It MUST return 1 when the keys are equal, 0 when not equal, or a negative number on error. It's called by EVP_PKEY_parameters_eq(3).

                                                                                                                                              The param_print() method prints the private key parameters in humanly readable text to out, indented indent spaces. It MUST return 0 on error, 1 on success. It's called by EVP_PKEY_print_params(3).

                                                                                                                                              int (*sig_print) (BIO *out,\n                  const X509_ALGOR *sigalg, const ASN1_STRING *sig,\n                  int indent, ASN1_PCTX *pctx);\n

                                                                                                                                              The sig_print() method prints a signature in humanly readable text to out, indented indent spaces. sigalg contains the exact signature algorithm. If the signature in sig doesn't correspond to what this method expects, X509_signature_dump() must be used as a last resort. It MUST return 0 on error, 1 on success. It's called by X509_signature_print(3).

                                                                                                                                              void (*pkey_free) (EVP_PKEY *pkey);\n

                                                                                                                                              The pkey_free() method helps freeing the internals of pkey. It's called by EVP_PKEY_free(3), EVP_PKEY_set_type(3), EVP_PKEY_set_type_str(3), and EVP_PKEY_assign(3).

                                                                                                                                              int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2);\n

                                                                                                                                              The pkey_ctrl() method adds extra algorithm specific control. It's called by EVP_PKEY_get_default_digest_nid(3), EVP_PKEY_set1_encoded_public_key(3), EVP_PKEY_get1_encoded_public_key(3), PKCS7_SIGNER_INFO_set(3), PKCS7_RECIP_INFO_set(3), ...

                                                                                                                                              int (*old_priv_decode) (EVP_PKEY *pkey,\n                        const unsigned char **pder, int derlen);\nint (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder);\n

                                                                                                                                              The old_priv_decode() and old_priv_encode() methods decode / encode they private key pkey from / to a DER formatted array. These are exclusively used to help decoding / encoding older (pre PKCS#8) PEM formatted encrypted private keys. old_priv_decode() MUST return 0 on error, 1 on success. old_priv_encode() MUST the return same kind of values as i2d_PrivateKey(). They're called by d2i_PrivateKey(3) and i2d_PrivateKey(3).

                                                                                                                                              int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,\n                    X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);\nint (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,\n                  X509_ALGOR *alg1, X509_ALGOR *alg2,\n                  ASN1_BIT_STRING *sig);\n

                                                                                                                                              The item_sign() and item_verify() methods make it possible to have algorithm specific signatures and verification of them.

                                                                                                                                              item_sign() MUST return one of:

                                                                                                                                              • <=0

                                                                                                                                                error

                                                                                                                                              • 1

                                                                                                                                                item_sign() did everything, OpenSSL internals just needs to pass the signature length back.

                                                                                                                                              • 2

                                                                                                                                                item_sign() did nothing, OpenSSL internal standard routines are expected to continue with the default signature production.

                                                                                                                                              • 3

                                                                                                                                                item_sign() set the algorithm identifier algor1 and algor2, OpenSSL internals should just sign using those algorithms.

                                                                                                                                              item_verify() MUST return one of:

                                                                                                                                              • <=0

                                                                                                                                                error

                                                                                                                                              • 1

                                                                                                                                                item_sign() did everything, OpenSSL internals just needs to pass the signature length back.

                                                                                                                                              • 2

                                                                                                                                                item_sign() did nothing, OpenSSL internal standard routines are expected to continue with the default signature production.

                                                                                                                                              item_verify() and item_sign() are called by ASN1_item_verify(3) and ASN1_item_sign(3), and by extension, X509_verify(3), X509_REQ_verify(3), X509_sign(3), X509_REQ_sign(3), ...

                                                                                                                                              int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg,\n                   const ASN1_STRING *sig);\n

                                                                                                                                              The siginf_set() method is used to set custom X509_SIG_INFO parameters. It MUST return 0 on error, or 1 on success. It's called as part of X509_check_purpose(3), X509_check_ca(3) and X509_check_issued(3).

                                                                                                                                              int (*pkey_check) (const EVP_PKEY *pk);\nint (*pkey_public_check) (const EVP_PKEY *pk);\nint (*pkey_param_check) (const EVP_PKEY *pk);\n

                                                                                                                                              The pkey_check(), pkey_public_check() and pkey_param_check() methods are used to check the validity of pk for key-pair, public component and parameters, respectively. They MUST return 0 for an invalid key, or 1 for a valid key. They are called by EVP_PKEY_check(3), EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) respectively.

                                                                                                                                              int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len);\nint (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len);\n

                                                                                                                                              The set_priv_key() and set_pub_key() methods are used to set the raw private and public key data for an EVP_PKEY. They MUST return 0 on error, or 1 on success. They are called by EVP_PKEY_new_raw_private_key(3), and EVP_PKEY_new_raw_public_key(3) respectively.

                                                                                                                                              size_t (*dirty) (const EVP_PKEY *pk);\nvoid *(*export_to) (const EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);\n

                                                                                                                                              dirty_cnt() returns the internal key's dirty count. This can be used to synchronise different copies of the same keys.

                                                                                                                                              The export_to() method exports the key material from the given key to a provider, through the EVP_KEYMGMT(3) interface, if that provider supports importing key material.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#functions","title":"Functions","text":"

                                                                                                                                              EVP_PKEY_asn1_new() creates and returns a new EVP_PKEY_ASN1_METHOD object, and associates the given id, flags, pem_str and info. id is a NID, pem_str is the PEM type string, info is a descriptive string. The following flags are supported:

                                                                                                                                              ASN1_PKEY_SIGPARAM_NULL\n

                                                                                                                                              If ASN1_PKEY_SIGPARAM_NULL is set, then the signature algorithm parameters are given the type V_ASN1_NULL by default, otherwise they will be given the type V_ASN1_UNDEF (i.e. the parameter is omitted). See X509_ALGOR_set0(3) for more information.

                                                                                                                                              EVP_PKEY_asn1_copy() copies an EVP_PKEY_ASN1_METHOD object from src to dst. This function is not thread safe, it's recommended to only use this when initializing the application.

                                                                                                                                              EVP_PKEY_asn1_free() frees an existing EVP_PKEY_ASN1_METHOD pointed by ameth. If the argument is NULL, nothing is done.

                                                                                                                                              EVP_PKEY_asn1_add0() adds ameth to the user defined stack of methods unless another EVP_PKEY_ASN1_METHOD with the same NID is already there. This function is not thread safe, it's recommended to only use this when initializing the application.

                                                                                                                                              EVP_PKEY_asn1_add_alias() creates an alias with the NID to for the EVP_PKEY_ASN1_METHOD with NID from unless another EVP_PKEY_ASN1_METHOD with the same NID is already added. This function is not thread safe, it's recommended to only use this when initializing the application.

                                                                                                                                              EVP_PKEY_asn1_set_public(), EVP_PKEY_asn1_set_private(), EVP_PKEY_asn1_set_param(), EVP_PKEY_asn1_set_free(), EVP_PKEY_asn1_set_ctrl(), EVP_PKEY_asn1_set_item(), EVP_PKEY_asn1_set_siginf(), EVP_PKEY_asn1_set_check(), EVP_PKEY_asn1_set_public_check(), EVP_PKEY_asn1_set_param_check(), EVP_PKEY_asn1_set_security_bits(), EVP_PKEY_asn1_set_set_priv_key(), EVP_PKEY_asn1_set_set_pub_key(), EVP_PKEY_asn1_set_get_priv_key() and EVP_PKEY_asn1_set_get_pub_key() set the diverse methods of the given EVP_PKEY_ASN1_METHOD object.

                                                                                                                                              EVP_PKEY_get0_asn1() finds the EVP_PKEY_ASN1_METHOD associated with the key pkey.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_asn1_new() returns NULL on error, or a pointer to an EVP_PKEY_ASN1_METHOD object otherwise.

                                                                                                                                              EVP_PKEY_asn1_add0() and EVP_PKEY_asn1_add_alias() return 0 on error, or 1 on success.

                                                                                                                                              EVP_PKEY_get0_asn1() returns NULL on error, or a pointer to a constant EVP_PKEY_ASN1_METHOD object otherwise.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#history","title":"HISTORY","text":"

                                                                                                                                              The signature of the pub_decode functional argument of EVP_PKEY_asn1_set_public() has changed in OpenSSL 3.0 so its pub parameter is now constified.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_ASN1_METHOD/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/","title":"EVP_PKEY_CTX_ctrl","text":""},{"location":"man3/EVP_PKEY_CTX_ctrl/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_ctrl, EVP_PKEY_CTX_ctrl_str, EVP_PKEY_CTX_ctrl_uint64, EVP_PKEY_CTX_md, EVP_PKEY_CTX_set_signature_md, EVP_PKEY_CTX_get_signature_md, EVP_PKEY_CTX_set_mac_key, EVP_PKEY_CTX_set_group_name, EVP_PKEY_CTX_get_group_name, EVP_PKEY_CTX_set_rsa_padding, EVP_PKEY_CTX_get_rsa_padding, EVP_PKEY_CTX_set_rsa_pss_saltlen, EVP_PKEY_CTX_get_rsa_pss_saltlen, EVP_PKEY_CTX_set_rsa_keygen_bits, EVP_PKEY_CTX_set_rsa_keygen_pubexp, EVP_PKEY_CTX_set1_rsa_keygen_pubexp, EVP_PKEY_CTX_set_rsa_keygen_primes, EVP_PKEY_CTX_set_rsa_mgf1_md_name, EVP_PKEY_CTX_set_rsa_mgf1_md, EVP_PKEY_CTX_get_rsa_mgf1_md, EVP_PKEY_CTX_get_rsa_mgf1_md_name, EVP_PKEY_CTX_set_rsa_oaep_md_name, EVP_PKEY_CTX_set_rsa_oaep_md, EVP_PKEY_CTX_get_rsa_oaep_md, EVP_PKEY_CTX_get_rsa_oaep_md_name, EVP_PKEY_CTX_set0_rsa_oaep_label, EVP_PKEY_CTX_get0_rsa_oaep_label, EVP_PKEY_CTX_set_dsa_paramgen_bits, EVP_PKEY_CTX_set_dsa_paramgen_q_bits, EVP_PKEY_CTX_set_dsa_paramgen_md, EVP_PKEY_CTX_set_dsa_paramgen_md_props, EVP_PKEY_CTX_set_dsa_paramgen_gindex, EVP_PKEY_CTX_set_dsa_paramgen_type, EVP_PKEY_CTX_set_dsa_paramgen_seed, EVP_PKEY_CTX_set_dh_paramgen_prime_len, EVP_PKEY_CTX_set_dh_paramgen_subprime_len, EVP_PKEY_CTX_set_dh_paramgen_generator, EVP_PKEY_CTX_set_dh_paramgen_type, EVP_PKEY_CTX_set_dh_paramgen_gindex, EVP_PKEY_CTX_set_dh_paramgen_seed, EVP_PKEY_CTX_set_dh_rfc5114, EVP_PKEY_CTX_set_dhx_rfc5114, EVP_PKEY_CTX_set_dh_pad, EVP_PKEY_CTX_set_dh_nid, EVP_PKEY_CTX_set_dh_kdf_type, EVP_PKEY_CTX_get_dh_kdf_type, EVP_PKEY_CTX_set0_dh_kdf_oid, EVP_PKEY_CTX_get0_dh_kdf_oid, EVP_PKEY_CTX_set_dh_kdf_md, EVP_PKEY_CTX_get_dh_kdf_md, EVP_PKEY_CTX_set_dh_kdf_outlen, EVP_PKEY_CTX_get_dh_kdf_outlen, EVP_PKEY_CTX_set0_dh_kdf_ukm, EVP_PKEY_CTX_get0_dh_kdf_ukm, EVP_PKEY_CTX_set_ec_paramgen_curve_nid, EVP_PKEY_CTX_set_ec_param_enc, EVP_PKEY_CTX_set_ecdh_cofactor_mode, EVP_PKEY_CTX_get_ecdh_cofactor_mode, EVP_PKEY_CTX_set_ecdh_kdf_type, EVP_PKEY_CTX_get_ecdh_kdf_type, EVP_PKEY_CTX_set_ecdh_kdf_md, EVP_PKEY_CTX_get_ecdh_kdf_md, EVP_PKEY_CTX_set_ecdh_kdf_outlen, EVP_PKEY_CTX_get_ecdh_kdf_outlen, EVP_PKEY_CTX_set0_ecdh_kdf_ukm, EVP_PKEY_CTX_get0_ecdh_kdf_ukm, EVP_PKEY_CTX_set1_id, EVP_PKEY_CTX_get1_id, EVP_PKEY_CTX_get1_id_len, EVP_PKEY_CTX_set_kem_op - algorithm specific control operations

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,\n                      int cmd, int p1, void *p2);\nint EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype,\n                             int cmd, uint64_t value);\nint EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,\n                          const char *value);\n\nint EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md);\n\nint EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **pmd);\n\nint EVP_PKEY_CTX_set_mac_key(EVP_PKEY_CTX *ctx, const unsigned char *key,\n                             int len);\nint EVP_PKEY_CTX_set_group_name(EVP_PKEY_CTX *ctx, const char *name);\nint EVP_PKEY_CTX_get_group_name(EVP_PKEY_CTX *ctx, char *name, size_t namelen);\n\nint EVP_PKEY_CTX_set_kem_op(EVP_PKEY_CTX *ctx, const char *op);\n\n#include <openssl/rsa.h>\n\nint EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad);\nint EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx, int *pad);\nint EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int saltlen);\nint EVP_PKEY_CTX_get_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int *saltlen);\nint EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits);\nint EVP_PKEY_CTX_set1_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);\nint EVP_PKEY_CTX_set_rsa_keygen_primes(EVP_PKEY_CTX *ctx, int primes);\nint EVP_PKEY_CTX_set_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, const char *mdname,\n                                    const char *mdprops);\nint EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_get_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, char *name,\n                                      size_t namelen);\nint EVP_PKEY_CTX_set_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, const char *mdname,\n                                      const char *mdprops);\nint EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_get_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, char *name,\n                                      size_t namelen);\nint EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, void *label,\n                                     int len);\nint EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char **label);\n\n#include <openssl/dsa.h>\n\nint EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);\nint EVP_PKEY_CTX_set_dsa_paramgen_q_bits(EVP_PKEY_CTX *ctx, int qbits);\nint EVP_PKEY_CTX_set_dsa_paramgen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_set_dsa_paramgen_md_props(EVP_PKEY_CTX *ctx,\n                                           const char *md_name,\n                                           const char *md_properties);\nint EVP_PKEY_CTX_set_dsa_paramgen_type(EVP_PKEY_CTX *ctx, const char *name);\nint EVP_PKEY_CTX_set_dsa_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex);\nint EVP_PKEY_CTX_set_dsa_paramgen_seed(EVP_PKEY_CTX *ctx,\n                                       const unsigned char *seed,\n                                       size_t seedlen);\n\n#include <openssl/dh.h>\n\nint EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_set_dh_paramgen_subprime_len(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);\nint EVP_PKEY_CTX_set_dh_paramgen_type(EVP_PKEY_CTX *ctx, int type);\nint EVP_PKEY_CTX_set_dh_pad(EVP_PKEY_CTX *ctx, int pad);\nint EVP_PKEY_CTX_set_dh_nid(EVP_PKEY_CTX *ctx, int nid);\nint EVP_PKEY_CTX_set_dh_rfc5114(EVP_PKEY_CTX *ctx, int rfc5114);\nint EVP_PKEY_CTX_set_dhx_rfc5114(EVP_PKEY_CTX *ctx, int rfc5114);\nint EVP_PKEY_CTX_set_dh_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex);\nint EVP_PKEY_CTX_set_dh_paramgen_seed(EVP_PKEY_CTX *ctx,\n                                       const unsigned char *seed,\n                                       size_t seedlen);\nint EVP_PKEY_CTX_set_dh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);\nint EVP_PKEY_CTX_get_dh_kdf_type(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_set0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT *oid);\nint EVP_PKEY_CTX_get0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT **oid);\nint EVP_PKEY_CTX_set_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_set_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_get_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);\nint EVP_PKEY_CTX_set0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len);\n\n#include <openssl/ec.h>\n\nint EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);\nint EVP_PKEY_CTX_set_ec_param_enc(EVP_PKEY_CTX *ctx, int param_enc);\nint EVP_PKEY_CTX_set_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx, int cofactor_mode);\nint EVP_PKEY_CTX_get_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_set_ecdh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);\nint EVP_PKEY_CTX_get_ecdh_kdf_type(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_set_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);\nint EVP_PKEY_CTX_get_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);\nint EVP_PKEY_CTX_set_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);\nint EVP_PKEY_CTX_get_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);\nint EVP_PKEY_CTX_set0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len);\n\nint EVP_PKEY_CTX_set1_id(EVP_PKEY_CTX *ctx, void *id, size_t id_len);\nint EVP_PKEY_CTX_get1_id(EVP_PKEY_CTX *ctx, void *id);\nint EVP_PKEY_CTX_get1_id_len(EVP_PKEY_CTX *ctx, size_t *id_len);\n

                                                                                                                                              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              #include <openssl/rsa.h>\n\nint EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);\n\n#include <openssl/dh.h>\n\nint EVP_PKEY_CTX_get0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);\n\n#include <openssl/ec.h>\n\nint EVP_PKEY_CTX_get0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_CTX_ctrl() sends a control operation to the context ctx. The key type used must match keytype if it is not -1. The parameter optype is a mask indicating which operations the control can be applied to. The control command is indicated in cmd and any additional arguments in p1 and p2.

                                                                                                                                              For cmd = EVP_PKEY_CTRL_SET_MAC_KEY, p1 is the length of the MAC key, and p2 is the MAC key. This is used by Poly1305, SipHash, HMAC and CMAC.

                                                                                                                                              Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will instead call one of the algorithm specific functions below.

                                                                                                                                              EVP_PKEY_CTX_ctrl_uint64() is a wrapper that directly passes a uint64 value as p2 to EVP_PKEY_CTX_ctrl().

                                                                                                                                              EVP_PKEY_CTX_ctrl_str() allows an application to send an algorithm specific control operation to a context ctx in string form. This is intended to be used for options specified on the command line or in text files. The commands supported are documented in the openssl utility command line pages for the option -pkeyopt which is supported by the pkeyutl, genpkey and req commands.

                                                                                                                                              EVP_PKEY_CTX_md() sends a message digest control operation to the context ctx. The message digest is specified by its name md.

                                                                                                                                              EVP_PKEY_CTX_set_signature_md() sets the message digest type used in a signature. It can be used in the RSA, DSA and ECDSA algorithms.

                                                                                                                                              EVP_PKEY_CTX_get_signature_md()gets the message digest type used in a signature. It can be used in the RSA, DSA and ECDSA algorithms.

                                                                                                                                              Key generation typically involves setting up parameters to be used and generating the private and public key data. Some algorithm implementations allow private key data to be set explicitly using EVP_PKEY_CTX_set_mac_key(). In this case key generation is simply the process of setting up the parameters for the key and then setting the raw key data to the value explicitly. Normally applications would call EVP_PKEY_new_raw_private_key(3) or similar functions instead.

                                                                                                                                              EVP_PKEY_CTX_set_mac_key() can be used with any of the algorithms supported by the EVP_PKEY_new_raw_private_key(3) function.

                                                                                                                                              EVP_PKEY_CTX_set_group_name() sets the group name to name for parameter and key generation. For example for EC keys this will set the curve name and for DH keys it will set the name of the finite field group.

                                                                                                                                              EVP_PKEY_CTX_get_group_name() finds the group name that's currently set with ctx, and writes it to the location that name points at, as long as its size namelen is large enough to store that name, including a terminating NUL byte.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#rsa-parameters","title":"RSA parameters","text":"

                                                                                                                                              EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for ctx. The pad parameter can take the value RSA_PKCS1_PADDING for PKCS#1 padding, RSA_NO_PADDING for no padding, RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt only), RSA_X931_PADDING for X9.31 padding (signature operations only), RSA_PKCS1_PSS_PADDING (sign and verify only) and RSA_PKCS1_WITH_TLS_PADDING for TLS RSA ClientKeyExchange message padding (decryption only).

                                                                                                                                              Two RSA padding modes behave differently if EVP_PKEY_CTX_set_signature_md() is used. If this function is called for PKCS#1 padding the plaintext buffer is an actual digest value and is encapsulated in a DigestInfo structure according to PKCS#1 when signing and this structure is expected (and stripped off) when verifying. If this control is not used with RSA and PKCS#1 padding then the supplied data is used directly and not encapsulated. In the case of X9.31 padding for RSA the algorithm identifier byte is added or checked and removed if this control is called. If it is not called then the first byte of the plaintext buffer is expected to be the algorithm identifier byte.

                                                                                                                                              EVP_PKEY_CTX_get_rsa_padding() gets the RSA padding mode for ctx.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_pss_saltlen() sets the RSA PSS salt length to saltlen. As its name implies it is only supported for PSS padding. If this function is not called then the salt length is maximized up to the digest length when signing and auto detection when verifying. Four special values are supported:

                                                                                                                                              • RSA_PSS_SALTLEN_DIGEST

                                                                                                                                                sets the salt length to the digest length.

                                                                                                                                              • RSA_PSS_SALTLEN_MAX

                                                                                                                                                sets the salt length to the maximum permissible value.

                                                                                                                                              • RSA_PSS_SALTLEN_AUTO

                                                                                                                                                causes the salt length to be automatically determined based on the PSS block structure when verifying. When signing, it has the same meaning as RSA_PSS_SALTLEN_MAX.

                                                                                                                                              • RSA_PSS_SALTLEN_AUTO_DIGEST_MAX

                                                                                                                                                causes the salt length to be automatically determined based on the PSS block structure when verifying, like RSA_PSS_SALTLEN_AUTO. When signing, the salt length is maximized up to a maximum of the digest length to comply with FIPS 186-4 section 5.5.

                                                                                                                                              EVP_PKEY_CTX_get_rsa_pss_saltlen() gets the RSA PSS salt length for ctx. The padding mode must already have been set to RSA_PKCS1_PSS_PADDING.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_keygen_bits() sets the RSA key length for RSA key generation to bits. If not specified 2048 bits is used.

                                                                                                                                              EVP_PKEY_CTX_set1_rsa_keygen_pubexp() sets the public exponent value for RSA key generation to the value stored in pubexp. Currently it should be an odd integer. In accordance with the OpenSSL naming convention, the pubexp pointer must be freed independently of the EVP_PKEY_CTX (ie, it is internally copied). If not specified 65537 is used.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_keygen_pubexp() does the same as EVP_PKEY_CTX_set1_rsa_keygen_pubexp() except that there is no internal copy and therefore pubexp should not be modified or freed after the call.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_keygen_primes() sets the number of primes for RSA key generation to primes. If not specified 2 is used.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_mgf1_md_name() sets the MGF1 digest for RSA padding schemes to the digest named mdname. If the RSA algorithm implementation for the selected provider supports it then the digest will be fetched using the properties mdprops. If not explicitly set the signing digest is used. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING or RSA_PKCS1_PSS_PADDING.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_mgf1_md() does the same as EVP_PKEY_CTX_set_rsa_mgf1_md_name() except that the name of the digest is inferred from the supplied md and it is not possible to specify any properties.

                                                                                                                                              EVP_PKEY_CTX_get_rsa_mgf1_md_name() gets the name of the MGF1 digest algorithm for ctx. If not explicitly set the signing digest is used. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING or RSA_PKCS1_PSS_PADDING.

                                                                                                                                              EVP_PKEY_CTX_get_rsa_mgf1_md() does the same as EVP_PKEY_CTX_get_rsa_mgf1_md_name() except that it returns a pointer to an EVP_MD object instead. Note that only known, built-in EVP_MD objects will be returned. The EVP_MD object may be NULL if the digest is not one of these (such as a digest only implemented in a third party provider).

                                                                                                                                              EVP_PKEY_CTX_set_rsa_oaep_md_name() sets the message digest type used in RSA OAEP to the digest named mdname. If the RSA algorithm implementation for the selected provider supports it then the digest will be fetched using the properties mdprops. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_oaep_md() does the same as EVP_PKEY_CTX_set_rsa_oaep_md_name() except that the name of the digest is inferred from the supplied md and it is not possible to specify any properties.

                                                                                                                                              EVP_PKEY_CTX_get_rsa_oaep_md_name() gets the message digest algorithm name used in RSA OAEP and stores it in the buffer name which is of size namelen. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING. The buffer should be sufficiently large for any expected digest algorithm names or the function will fail.

                                                                                                                                              EVP_PKEY_CTX_get_rsa_oaep_md() does the same as EVP_PKEY_CTX_get_rsa_oaep_md_name() except that it returns a pointer to an EVP_MD object instead. Note that only known, built-in EVP_MD objects will be returned. The EVP_MD object may be NULL if the digest is not one of these (such as a digest only implemented in a third party provider).

                                                                                                                                              EVP_PKEY_CTX_set0_rsa_oaep_label() sets the RSA OAEP label to binary data label and its length in bytes to len. If label is NULL or len is 0, the label is cleared. The library takes ownership of the label so the caller should not free the original memory pointed to by label. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING.

                                                                                                                                              EVP_PKEY_CTX_get0_rsa_oaep_label() gets the RSA OAEP label to label. The return value is the label length. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING. The resulting pointer is owned by the library and should not be freed by the caller.

                                                                                                                                              RSA_PKCS1_WITH_TLS_PADDING is used when decrypting an RSA encrypted TLS pre-master secret in a TLS ClientKeyExchange message. It is the same as RSA_PKCS1_PADDING except that it additionally verifies that the result is the correct length and the first two bytes are the protocol version initially requested by the client. If the encrypted content is publicly invalid then the decryption will fail. However, if the padding checks fail then decryption will still appear to succeed but a random TLS premaster secret will be returned instead. This padding mode accepts two parameters which can be set using the EVP_PKEY_CTX_set_params(3) function. These are OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION and OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION, both of which are expected to be unsigned integers. Normally only the first of these will be set and represents the TLS protocol version that was first requested by the client (e.g. 0x0303 for TLSv1.2, 0x0302 for TLSv1.1 etc). Historically some buggy clients would use the negotiated protocol version instead of the protocol version first requested. If this behaviour should be tolerated then OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION should be set to the actual negotiated protocol version. Otherwise it should be left unset.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#dsa-parameters","title":"DSA parameters","text":"

                                                                                                                                              EVP_PKEY_CTX_set_dsa_paramgen_bits() sets the number of bits used for DSA parameter generation to nbits. If not specified, 2048 is used.

                                                                                                                                              EVP_PKEY_CTX_set_dsa_paramgen_q_bits() sets the number of bits in the subprime parameter q for DSA parameter generation to qbits. If not specified, 224 is used. If a digest function is specified below, this parameter is ignored and instead, the number of bits in q matches the size of the digest.

                                                                                                                                              EVP_PKEY_CTX_set_dsa_paramgen_md() sets the digest function used for DSA parameter generation to md. If not specified, one of SHA-1, SHA-224, or SHA-256 is selected to match the bit length of q above.

                                                                                                                                              EVP_PKEY_CTX_set_dsa_paramgen_md_props() sets the digest function used for DSA parameter generation using md_name and md_properties to retrieve the digest from a provider. If not specified, md_name will be set to one of SHA-1, SHA-224, or SHA-256 depending on the bit length of q above. md_properties is a property query string that has a default value of '' if not specified.

                                                                                                                                              EVP_PKEY_CTX_set_dsa_paramgen_gindex() sets the gindex used by the generator G. The default value is -1 which uses unverifiable g, otherwise a positive value uses verifiable g. This value must be saved if key validation of g is required, since it is not part of a persisted key.

                                                                                                                                              EVP_PKEY_CTX_set_dsa_paramgen_seed() sets the seed to use for generation rather than using a randomly generated value for the seed. This is useful for testing purposes only and can fail if the seed does not produce primes for both p & q on its first iteration. This value must be saved if key validation of p, q, and verifiable g are required, since it is not part of a persisted key.

                                                                                                                                              EVP_PKEY_CTX_set_dsa_paramgen_type() sets the generation type to use FIPS186-4 generation if name is \"fips186_4\", or FIPS186-2 generation if name is \"fips186_2\". The default value for the default provider is \"fips186_2\". The default value for the FIPS provider is \"fips186_4\".

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#dh-parameters","title":"DH parameters","text":"

                                                                                                                                              EVP_PKEY_CTX_set_dh_paramgen_prime_len() sets the length of the DH prime parameter p for DH parameter generation. If this function is not called then 2048 is used. Only accepts lengths greater than or equal to 256.

                                                                                                                                              EVP_PKEY_CTX_set_dh_paramgen_subprime_len() sets the length of the DH optional subprime parameter q for DH parameter generation. The default is 256 if the prime is at least 2048 bits long or 160 otherwise. The DH paramgen type must have been set to \"fips186_4\".

                                                                                                                                              EVP_PKEY_CTX_set_dh_paramgen_generator() sets DH generator to gen for DH parameter generation. If not specified 2 is used.

                                                                                                                                              EVP_PKEY_CTX_set_dh_paramgen_type() sets the key type for DH parameter generation. The supported parameters are:

                                                                                                                                              • DH_PARAMGEN_TYPE_GROUP

                                                                                                                                                Use a named group. If only the safe prime parameter p is set this can be used to select a ffdhe safe prime group of the correct size.

                                                                                                                                              • DH_PARAMGEN_TYPE_FIPS_186_4

                                                                                                                                                FIPS186-4 FFC parameter generator.

                                                                                                                                              • DH_PARAMGEN_TYPE_FIPS_186_2

                                                                                                                                                FIPS186-2 FFC parameter generator (X9.42 DH).

                                                                                                                                              • DH_PARAMGEN_TYPE_GENERATOR

                                                                                                                                                Uses a safe prime generator g (PKCS#3 format).

                                                                                                                                              The default in the default provider is DH_PARAMGEN_TYPE_GENERATOR for the \"DH\" keytype, and DH_PARAMGEN_TYPE_FIPS_186_2 for the \"DHX\" keytype. In the FIPS provider the default value is DH_PARAMGEN_TYPE_GROUP for the \"DH\" keytype and <DH_PARAMGEN_TYPE_FIPS_186_4 for the \"DHX\" keytype.

                                                                                                                                              EVP_PKEY_CTX_set_dh_paramgen_gindex() sets the gindex used by the generator G. The default value is -1 which uses unverifiable g, otherwise a positive value uses verifiable g. This value must be saved if key validation of g is required, since it is not part of a persisted key.

                                                                                                                                              EVP_PKEY_CTX_set_dh_paramgen_seed() sets the seed to use for generation rather than using a randomly generated value for the seed. This is useful for testing purposes only and can fail if the seed does not produce primes for both p & q on its first iteration. This value must be saved if key validation of p, q, and verifiable g are required, since it is not part of a persisted key.

                                                                                                                                              EVP_PKEY_CTX_set_dh_pad() sets the DH padding mode. If pad is 1 the shared secret is padded with zeros up to the size of the DH prime p. If pad is zero (the default) then no padding is performed.

                                                                                                                                              EVP_PKEY_CTX_set_dh_nid() sets the DH parameters to values corresponding to nid as defined in RFC7919 or RFC3526. The nid parameter must be NID_ffdhe2048, NID_ffdhe3072, NID_ffdhe4096, NID_ffdhe6144, NID_ffdhe8192, NID_modp_1536, NID_modp_2048, NID_modp_3072, NID_modp_4096, NID_modp_6144, NID_modp_8192 or NID_undef to clear the stored value. This function can be called during parameter or key generation. The nid parameter and the rfc5114 parameter are mutually exclusive.

                                                                                                                                              EVP_PKEY_CTX_set_dh_rfc5114() and EVP_PKEY_CTX_set_dhx_rfc5114() both set the DH parameters to the values defined in RFC5114. The rfc5114 parameter must be 1, 2 or 3 corresponding to RFC5114 sections 2.1, 2.2 and 2.3. or 0 to clear the stored value. This macro can be called during parameter generation. The ctx must have a key type of EVP_PKEY_DHX. The rfc5114 parameter and the nid parameter are mutually exclusive.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#dh-key-derivation-function-parameters","title":"DH key derivation function parameters","text":"

                                                                                                                                              Note that all of the following functions require that the ctx parameter has a private key type of EVP_PKEY_DHX. When using key derivation, the output of EVP_PKEY_derive() is the output of the KDF instead of the DH shared secret. The KDF output is typically used as a Key Encryption Key (KEK) that in turn encrypts a Content Encryption Key (CEK).

                                                                                                                                              EVP_PKEY_CTX_set_dh_kdf_type() sets the key derivation function type to kdf for DH key derivation. Possible values are EVP_PKEY_DH_KDF_NONE and EVP_PKEY_DH_KDF_X9_42 which uses the key derivation specified in RFC2631 (based on the keying algorithm described in X9.42). When using key derivation, the kdf_oid, kdf_md and kdf_outlen parameters must also be specified.

                                                                                                                                              EVP_PKEY_CTX_get_dh_kdf_type() gets the key derivation function type for ctx used for DH key derivation. Possible values are EVP_PKEY_DH_KDF_NONE and EVP_PKEY_DH_KDF_X9_42.

                                                                                                                                              EVP_PKEY_CTX_set0_dh_kdf_oid() sets the key derivation function object identifier to oid for DH key derivation. This OID should identify the algorithm to be used with the Content Encryption Key. The library takes ownership of the object identifier so the caller should not free the original memory pointed to by oid.

                                                                                                                                              EVP_PKEY_CTX_get0_dh_kdf_oid() gets the key derivation function oid for ctx used for DH key derivation. The resulting pointer is owned by the library and should not be freed by the caller.

                                                                                                                                              EVP_PKEY_CTX_set_dh_kdf_md() sets the key derivation function message digest to md for DH key derivation. Note that RFC2631 specifies that this digest should be SHA1 but OpenSSL tolerates other digests.

                                                                                                                                              EVP_PKEY_CTX_get_dh_kdf_md() gets the key derivation function message digest for ctx used for DH key derivation.

                                                                                                                                              EVP_PKEY_CTX_set_dh_kdf_outlen() sets the key derivation function output length to len for DH key derivation.

                                                                                                                                              EVP_PKEY_CTX_get_dh_kdf_outlen() gets the key derivation function output length for ctx used for DH key derivation.

                                                                                                                                              EVP_PKEY_CTX_set0_dh_kdf_ukm() sets the user key material to ukm and its length to len for DH key derivation. This parameter is optional and corresponds to the partyAInfo field in RFC2631 terms. The specification requires that it is 512 bits long but this is not enforced by OpenSSL. The library takes ownership of the user key material so the caller should not free the original memory pointed to by ukm.

                                                                                                                                              EVP_PKEY_CTX_get0_dh_kdf_ukm() gets the user key material for ctx. The return value is the user key material length. The resulting pointer is owned by the library and should not be freed by the caller.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#ec-parameters","title":"EC parameters","text":"

                                                                                                                                              Use EVP_PKEY_CTX_set_group_name() (described above) to set the curve name to name for parameter and key generation.

                                                                                                                                              EVP_PKEY_CTX_set_ec_paramgen_curve_nid() does the same as EVP_PKEY_CTX_set_group_name(), but is specific to EC and uses a nid rather than a name string.

                                                                                                                                              For EC parameter generation, one of EVP_PKEY_CTX_set_group_name() or EVP_PKEY_CTX_set_ec_paramgen_curve_nid() must be called or an error occurs because there is no default curve. These function can also be called to set the curve explicitly when generating an EC key.

                                                                                                                                              EVP_PKEY_CTX_get_group_name() (described above) can be used to obtain the curve name that's currently set with ctx.

                                                                                                                                              EVP_PKEY_CTX_set_ec_param_enc() sets the EC parameter encoding to param_enc when generating EC parameters or an EC key. The encoding can be OPENSSL_EC_EXPLICIT_CURVE for explicit parameters (the default in versions of OpenSSL before 1.1.0) or OPENSSL_EC_NAMED_CURVE to use named curve form. For maximum compatibility the named curve form should be used. Note: the OPENSSL_EC_NAMED_CURVE value was added in OpenSSL 1.1.0; previous versions should use 0 instead.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#ecdh-parameters","title":"ECDH parameters","text":"

                                                                                                                                              EVP_PKEY_CTX_set_ecdh_cofactor_mode() sets the cofactor mode to cofactor_mode for ECDH key derivation. Possible values are 1 to enable cofactor key derivation, 0 to disable it and -1 to clear the stored cofactor mode and fallback to the private key cofactor mode.

                                                                                                                                              EVP_PKEY_CTX_get_ecdh_cofactor_mode() returns the cofactor mode for ctx used for ECDH key derivation. Possible values are 1 when cofactor key derivation is enabled and 0 otherwise.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#ecdh-key-derivation-function-parameters","title":"ECDH key derivation function parameters","text":"

                                                                                                                                              EVP_PKEY_CTX_set_ecdh_kdf_type() sets the key derivation function type to kdf for ECDH key derivation. Possible values are EVP_PKEY_ECDH_KDF_NONE and EVP_PKEY_ECDH_KDF_X9_63 which uses the key derivation specified in X9.63. When using key derivation, the kdf_md and kdf_outlen parameters must also be specified.

                                                                                                                                              EVP_PKEY_CTX_get_ecdh_kdf_type() returns the key derivation function type for ctx used for ECDH key derivation. Possible values are EVP_PKEY_ECDH_KDF_NONE and EVP_PKEY_ECDH_KDF_X9_63.

                                                                                                                                              EVP_PKEY_CTX_set_ecdh_kdf_md() sets the key derivation function message digest to md for ECDH key derivation. Note that X9.63 specifies that this digest should be SHA1 but OpenSSL tolerates other digests.

                                                                                                                                              EVP_PKEY_CTX_get_ecdh_kdf_md() gets the key derivation function message digest for ctx used for ECDH key derivation.

                                                                                                                                              EVP_PKEY_CTX_set_ecdh_kdf_outlen() sets the key derivation function output length to len for ECDH key derivation.

                                                                                                                                              EVP_PKEY_CTX_get_ecdh_kdf_outlen() gets the key derivation function output length for ctx used for ECDH key derivation.

                                                                                                                                              EVP_PKEY_CTX_set0_ecdh_kdf_ukm() sets the user key material to ukm for ECDH key derivation. This parameter is optional and corresponds to the shared info in X9.63 terms. The library takes ownership of the user key material so the caller should not free the original memory pointed to by ukm.

                                                                                                                                              EVP_PKEY_CTX_get0_ecdh_kdf_ukm() gets the user key material for ctx. The return value is the user key material length. The resulting pointer is owned by the library and should not be freed by the caller.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#other-parameters","title":"Other parameters","text":"

                                                                                                                                              EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id() and EVP_PKEY_CTX_get1_id_len() are used to manipulate the special identifier field for specific signature algorithms such as SM2. The EVP_PKEY_CTX_set1_id() sets an ID pointed by id with the length id_len to the library. The library takes a copy of the id so that the caller can safely free the original memory pointed to by id. EVP_PKEY_CTX_get1_id_len() returns the length of the ID set via a previous call to EVP_PKEY_CTX_set1_id(). The length is usually used to allocate adequate memory for further calls to EVP_PKEY_CTX_get1_id(). EVP_PKEY_CTX_get1_id() returns the previously set ID value to caller in id. The caller should allocate adequate memory space for the id before calling EVP_PKEY_CTX_get1_id().

                                                                                                                                              EVP_PKEY_CTX_set_kem_op() sets the KEM operation to run. This can be set after EVP_PKEY_encapsulate_init() or EVP_PKEY_decapsulate_init() to select the kem operation. RSA is the only key type that supports encapsulation currently, and as there is no default operation for the RSA type, this function must be called before EVP_PKEY_encapsulate() or EVP_PKEY_decapsulate().

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All other functions described on this page return a positive value for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_set_params(3), EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3), EVP_PKEY_keygen(3) EVP_PKEY_encapsulate(3) EVP_PKEY_decapsulate(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#history","title":"HISTORY","text":"

                                                                                                                                              EVP_PKEY_CTX_get_rsa_oaep_md_name(), EVP_PKEY_CTX_get_rsa_mgf1_md_name(), EVP_PKEY_CTX_set_rsa_mgf1_md_name(), EVP_PKEY_CTX_set_rsa_oaep_md_name(), EVP_PKEY_CTX_set_dsa_paramgen_md_props(), EVP_PKEY_CTX_set_dsa_paramgen_gindex(), EVP_PKEY_CTX_set_dsa_paramgen_type(), EVP_PKEY_CTX_set_dsa_paramgen_seed(), EVP_PKEY_CTX_set_group_name() and EVP_PKEY_CTX_get_group_name() were added in OpenSSL 3.0.

                                                                                                                                              The EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id() and EVP_PKEY_CTX_get1_id_len() macros were added in 1.1.1, other functions were added in OpenSSL 1.0.0.

                                                                                                                                              In OpenSSL 1.1.1 and below the functions were mostly macros. From OpenSSL 3.0 they are all functions.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_keygen_pubexp(), EVP_PKEY_CTX_get0_dh_kdf_ukm(), and EVP_PKEY_CTX_get0_ecdh_kdf_ukm() were deprecated in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_ctrl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/","title":"EVP_PKEY_CTX_get0_libctx","text":""},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_get0_libctx, EVP_PKEY_CTX_get0_propq, EVP_PKEY_CTX_get0_provider - functions for getting diverse information from an EVP_PKEY_CTX

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nOSSL_LIB_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx);\nconst char *EVP_PKEY_CTX_get0_propq(const EVP_PKEY_CTX *ctx);\nconst OSSL_PROVIDER *EVP_PKEY_CTX_get0_provider(const EVP_PKEY_CTX *ctx);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_CTX_get0_libctx() and EVP_PKEY_CTX_get0_propq() obtain the OSSL_LIB_CTX and property query string values respectively that were associated with the EVP_PKEY_CTX when it was constructed.

                                                                                                                                              EVP_PKEY_CTX_get0_provider() returns the provider associated with the ongoing EVP_PKEY_CTX operation. If the operation is performed by en ENGINE, this function returns NULL.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_CTX_get0_libctx() and EVP_PKEY_CTX_get0_propq() functions return the OSSL_LIB_CTX and property query string associated with the EVP_PKEY_CTX or NULL if they are not set. The returned values should not be freed by the caller.

                                                                                                                                              EVP_PKEY_CTX_get0_provider() returns a provider if an operation performed by a provider is ongoing, otherwise NULL.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#history","title":"HISTORY","text":"

                                                                                                                                              All functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_libctx/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/","title":"EVP_PKEY_CTX_get0_pkey","text":""},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_get0_pkey, EVP_PKEY_CTX_get0_peerkey - functions for accessing the EVP_PKEY associated with an EVP_PKEY_CTX

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nEVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);\nEVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_CTX_get0_pkey() is used to access the EVP_PKEY associated with the given EVP_PKEY_CTX ctx. The EVP_PKEY obtained is the one used for creating the EVP_PKEY_CTX using either EVP_PKEY_CTX_new(3) or EVP_PKEY_CTX_new_from_pkey(3).

                                                                                                                                              EVP_PKEY_CTX_get0_peerkey() is used to access the peer EVP_PKEY associated with the given EVP_PKEY_CTX ctx. The peer EVP_PKEY obtained is the one set using either EVP_PKEY_derive_set_peer(3) or EVP_PKEY_derive_set_peer_ex(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_CTX_get0_pkey() returns the EVP_PKEY associated with the EVP_PKEY_CTX or NULL if it is not set.

                                                                                                                                              EVP_PKEY_CTX_get0_peerkey() returns the peer EVP_PKEY associated with the EVP_PKEY_CTX or NULL if it is not set.

                                                                                                                                              The returned EVP_PKEY objects are owned by the EVP_PKEY_CTX, and therefore should not explicitly be freed by the caller.

                                                                                                                                              These functions do not affect the EVP_PKEY reference count. They merely act as getter functions, and should be treated as such.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_new_from_pkey(3), EVP_PKEY_derive_set_peer(3), EVP_PKEY_derive_set_peer_ex(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_get0_pkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/","title":"EVP_PKEY_CTX_new","text":""},{"location":"man3/EVP_PKEY_CTX_new/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_new_from_name, EVP_PKEY_CTX_new_from_pkey, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free, EVP_PKEY_CTX_is_a - public key algorithm context functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nEVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);\nEVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);\nEVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OSSL_LIB_CTX *libctx,\n                                         const char *name,\n                                         const char *propquery);\nEVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OSSL_LIB_CTX *libctx,\n                                         EVP_PKEY *pkey,\n                                         const char *propquery);\nEVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx);\nvoid EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_is_a(EVP_PKEY_CTX *ctx, const char *keytype);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_CTX_new() function allocates public key algorithm context using the pkey key type and ENGINE e.

                                                                                                                                              The EVP_PKEY_CTX_new_id() function allocates public key algorithm context using the key type specified by id and ENGINE e.

                                                                                                                                              The EVP_PKEY_CTX_new_from_name() function allocates a public key algorithm context using the library context libctx (see OSSL_LIB_CTX(3)), the key type specified by name and the property query propquery. None of the arguments are duplicated, so they must remain unchanged for the lifetime of the returned EVP_PKEY_CTX or of any of its duplicates. Read further about the possible names in \"NOTES\" below.

                                                                                                                                              The EVP_PKEY_CTX_new_from_pkey() function allocates a public key algorithm context using the library context libctx (see OSSL_LIB_CTX(3)) and the algorithm specified by pkey and the property query propquery. None of the arguments are duplicated, so they must remain unchanged for the lifetime of the returned EVP_PKEY_CTX or any of its duplicates.

                                                                                                                                              EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_new_from_name() are normally used when no EVP_PKEY structure is associated with the operations, for example during parameter generation or key generation for some algorithms.

                                                                                                                                              EVP_PKEY_CTX_dup() duplicates the context ctx. It is not supported for a keygen operation.

                                                                                                                                              EVP_PKEY_CTX_free() frees up the context ctx. If ctx is NULL, nothing is done.

                                                                                                                                              EVP_PKEY_is_a() checks if the key type associated with ctx is keytype.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#notes","title":"NOTES","text":""},{"location":"man3/EVP_PKEY_CTX_new/#on-evp_pkey_ctx","title":"On EVP_PKEY_CTX","text":"

                                                                                                                                              The EVP_PKEY_CTX structure is an opaque public key algorithm context used by the OpenSSL high-level public key API. Contexts MUST NOT be shared between threads: that is it is not permissible to use the same context simultaneously in two threads.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#on-key-types","title":"On Key Types","text":"

                                                                                                                                              We mention \"key type\" in this manual, which is the same as \"algorithm\" in most cases, allowing either term to be used interchangeably. There are algorithms where the key type and the algorithm of the operations that use the keys are not the same, such as EC keys being used for ECDSA and ECDH operations.

                                                                                                                                              Key types are given in two different manners:

                                                                                                                                              • Legacy NID or EVP_PKEY type

                                                                                                                                                This is the id used with EVP_PKEY_CTX_new_id().

                                                                                                                                                These are EVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA, EVP_PKEY_DH, EVP_PKEY_EC, EVP_PKEY_SM2, EVP_PKEY_X25519, EVP_PKEY_X448, and are used by legacy methods.

                                                                                                                                              • Name strings

                                                                                                                                                This is the name used with EVP_PKEY_CTX_new_from_name().

                                                                                                                                                These are names like \"RSA\", \"DSA\", and what's available depends on what providers are currently accessible.

                                                                                                                                                The OpenSSL providers offer a set of key types available this way, please see OSSL_PROVIDER-FIPS(7) and OSSL_PROVIDER-default(7) and related documentation for more information.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_dup() return either the newly allocated EVP_PKEY_CTX structure or NULL if an error occurred.

                                                                                                                                              EVP_PKEY_CTX_free() does not return a value.

                                                                                                                                              EVP_PKEY_CTX_is_a() returns 1 for true and 0 for false.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_new(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() and EVP_PKEY_CTX_free() functions were added in OpenSSL 1.0.0.

                                                                                                                                              The EVP_PKEY_CTX_new_from_name() and EVP_PKEY_CTX_new_from_pkey() functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/","title":"EVP_PKEY_CTX_set1_pbe_pass","text":""},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_set1_pbe_pass - generic KDF support functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set1_pbe_pass(EVP_PKEY_CTX *pctx, unsigned char *pass,\n                               int passlen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#description","title":"DESCRIPTION","text":"

                                                                                                                                              These functions are generic support functions for all KDF algorithms.

                                                                                                                                              EVP_PKEY_CTX_set1_pbe_pass() sets the password to the passlen first bytes from pass.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#string-ctrls","title":"STRING CTRLS","text":"

                                                                                                                                              There is also support for string based control operations via EVP_PKEY_CTX_ctrl_str(3). The password can be directly specified using the type parameter \"pass\" or given in hex encoding using the \"hexpass\" parameter.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#history","title":"HISTORY","text":"

                                                                                                                                              EVP_PKEY_CTX_set1_pbe_pass() was converted from a macro to a function in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set1_pbe_pass/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/","title":"EVP_PKEY_CTX_set_hkdf_md","text":""},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_set_hkdf_md, EVP_PKEY_CTX_set1_hkdf_salt, EVP_PKEY_CTX_set1_hkdf_key, EVP_PKEY_CTX_add1_hkdf_info, EVP_PKEY_CTX_set_hkdf_mode - HMAC-based Extract-and-Expand key derivation algorithm

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set_hkdf_mode(EVP_PKEY_CTX *pctx, int mode);\n\nint EVP_PKEY_CTX_set_hkdf_md(EVP_PKEY_CTX *pctx, const EVP_MD *md);\n\nint EVP_PKEY_CTX_set1_hkdf_salt(EVP_PKEY_CTX *pctx, unsigned char *salt,\n                                int saltlen);\n\nint EVP_PKEY_CTX_set1_hkdf_key(EVP_PKEY_CTX *pctx, unsigned char *key,\n                               int keylen);\n\nint EVP_PKEY_CTX_add1_hkdf_info(EVP_PKEY_CTX *pctx, unsigned char *info,\n                                int infolen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_HKDF algorithm implements the HKDF key derivation function. HKDF follows the \"extract-then-expand\" paradigm, where the KDF logically consists of two modules. The first stage takes the input keying material and \"extracts\" from it a fixed-length pseudorandom key K. The second stage \"expands\" the key K into several additional pseudorandom keys (the output of the KDF).

                                                                                                                                              EVP_PKEY_CTX_set_hkdf_mode() sets the mode for the HKDF operation. There are three modes that are currently defined:

                                                                                                                                              • EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND

                                                                                                                                                This is the default mode. Calling EVP_PKEY_derive(3) on an EVP_PKEY_CTX set up for HKDF will perform an extract followed by an expand operation in one go. The derived key returned will be the result after the expand operation. The intermediate fixed-length pseudorandom key K is not returned.

                                                                                                                                                In this mode the digest, key, salt and info values must be set before a key is derived or an error occurs.

                                                                                                                                              • EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY

                                                                                                                                                In this mode calling EVP_PKEY_derive(3) will just perform the extract operation. The value returned will be the intermediate fixed-length pseudorandom key K.

                                                                                                                                                The digest, key and salt values must be set before a key is derived or an error occurs.

                                                                                                                                              • EVP_PKEY_HKDEF_MODE_EXPAND_ONLY

                                                                                                                                                In this mode calling EVP_PKEY_derive(3) will just perform the expand operation. The input key should be set to the intermediate fixed-length pseudorandom key K returned from a previous extract operation.

                                                                                                                                                The digest, key and info values must be set before a key is derived or an error occurs.

                                                                                                                                              EVP_PKEY_CTX_set_hkdf_md() sets the message digest associated with the HKDF.

                                                                                                                                              EVP_PKEY_CTX_set1_hkdf_salt() sets the salt to saltlen bytes of the buffer salt. Any existing value is replaced.

                                                                                                                                              EVP_PKEY_CTX_set1_hkdf_key() sets the key to keylen bytes of the buffer key. Any existing value is replaced.

                                                                                                                                              EVP_PKEY_CTX_add1_hkdf_info() sets the info value to infolen bytes of the buffer info. If a value is already set, it is appended to the existing value.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#string-ctrls","title":"STRING CTRLS","text":"

                                                                                                                                              HKDF also supports string based control operations via EVP_PKEY_CTX_ctrl_str(3). The type parameter \"md\" uses the supplied value as the name of the digest algorithm to use. The type parameter \"mode\" uses the values \"EXTRACT_AND_EXPAND\", \"EXTRACT_ONLY\" and \"EXPAND_ONLY\" to determine the mode to use. The type parameters \"salt\", \"key\" and \"info\" use the supplied value parameter as a seed, key or info value. The names \"hexsalt\", \"hexkey\" and \"hexinfo\" are similar except they take a hex string which is converted to binary.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#notes","title":"NOTES","text":"

                                                                                                                                              A context for HKDF can be obtained by calling:

                                                                                                                                              EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);\n

                                                                                                                                              The total length of the info buffer cannot exceed 2048 bytes in length: this should be more than enough for any normal use of HKDF.

                                                                                                                                              The output length of an HKDF expand operation is specified via the length parameter to the EVP_PKEY_derive(3) function. Since the HKDF output length is variable, passing a NULL buffer as a means to obtain the requisite length is not meaningful with HKDF in any mode that performs an expand operation. Instead, the caller must allocate a buffer of the desired length, and pass that buffer to EVP_PKEY_derive(3) along with (a pointer initialized to) the desired length. Passing a NULL buffer to obtain the length is allowed when using EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY.

                                                                                                                                              Optimised versions of HKDF can be implemented in an ENGINE.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#examples","title":"EXAMPLES","text":"

                                                                                                                                              This example derives 10 bytes using SHA-256 with the secret key \"secret\", salt value \"salt\" and info value \"label\":

                                                                                                                                              EVP_PKEY_CTX *pctx;\nunsigned char out[10];\nsize_t outlen = sizeof(out);\npctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, NULL);\n\nif (EVP_PKEY_derive_init(pctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set1_hkdf_salt(pctx, \"salt\", 4) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set1_hkdf_key(pctx, \"secret\", 6) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_add1_hkdf_info(pctx, \"label\", 5) <= 0)\n    /* Error */\nif (EVP_PKEY_derive(pctx, out, &outlen) <= 0)\n    /* Error */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                              RFC 5869

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#history","title":"HISTORY","text":"

                                                                                                                                              All of the functions described here were converted from macros to functions in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_hkdf_md/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/","title":"EVP_PKEY_CTX_set_params","text":""},{"location":"man3/EVP_PKEY_CTX_set_params/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_set_params, EVP_PKEY_CTX_settable_params, EVP_PKEY_CTX_get_params, EVP_PKEY_CTX_gettable_params - provider parameter passing operations

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_CTX_set_params(EVP_PKEY_CTX *ctx, const OSSL_PARAM *params);\nconst OSSL_PARAM *EVP_PKEY_CTX_settable_params(const EVP_PKEY_CTX *ctx);\nint EVP_PKEY_CTX_get_params(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);\nconst OSSL_PARAM *EVP_PKEY_CTX_gettable_params(const EVP_PKEY_CTX *ctx);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_CTX_get_params() and EVP_PKEY_CTX_set_params() functions allow transfer of arbitrary key parameters to and from providers. Not all parameters may be supported by all providers. See OSSL_PROVIDER(3) for more information on providers. The params field is a pointer to a list of OSSL_PARAM structures, terminated with a OSSL_PARAM_END(3) struct. See OSSL_PARAM(3) for information about passing parameters. These functions must only be called after the EVP_PKEY_CTX has been initialised for use in an operation. These methods replace the EVP_PKEY_CTX_ctrl() mechanism. (EVP_PKEY_CTX_ctrl now calls these methods internally to interact with providers).

                                                                                                                                              EVP_PKEY_CTX_gettable_params() and EVP_PKEY_CTX_settable_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters for the current algorithm implementation, i.e. parameters that can be used with EVP_PKEY_CTX_get_params() and EVP_PKEY_CTX_set_params() respectively. These functions must only be called after the EVP_PKEY_CTX has been initialised for use in an operation.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/#parameters","title":"Parameters","text":"

                                                                                                                                              Examples of EVP_PKEY parameters include the following:

                                                                                                                                              \"Common parameters\" in provider-keymgmt(7) \"Key Exchange parameters\" in provider-keyexch(7) \"Signature parameters\" in provider-signature(7)

                                                                                                                                              \"Common RSA parameters\" in EVP_PKEY-RSA(7) \"RSA key generation parameters\" in EVP_PKEY-RSA(7) \"FFC parameters\" in EVP_PKEY-FFC(7) \"FFC key generation parameters\" in EVP_PKEY-FFC(7) \"DSA parameters\" in EVP_PKEY-DSA(7) \"DSA key generation parameters\" in EVP_PKEY-DSA(7) \"DH parameters\" in EVP_PKEY-DH(7) \"DH key generation parameters\" in EVP_PKEY-DH(7) \"Common EC parameters\" in EVP_PKEY-EC(7) \"Common X25519, X448, ED25519 and ED448 parameters\" in EVP_PKEY-X25519(7)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_CTX_set_params() returns 1 for success or 0 otherwise. EVP_PKEY_CTX_settable_params() returns an OSSL_PARAM array on success or NULL on error. It may also return NULL if there are no settable parameters available.

                                                                                                                                              All other functions and macros described on this page return a positive value for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3), EVP_PKEY_keygen(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/#history","title":"HISTORY","text":"

                                                                                                                                              All functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_params/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/","title":"EVP_PKEY_CTX_set_rsa_pss_keygen_md","text":""},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_set_rsa_pss_keygen_md, EVP_PKEY_CTX_set_rsa_pss_keygen_md_name, EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md, EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name, EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen - EVP_PKEY RSA-PSS algorithm support functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/rsa.h>\n\nint EVP_PKEY_CTX_set_rsa_pss_keygen_md(EVP_PKEY_CTX *pctx,\n                                       const EVP_MD *md);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_md_name(EVP_PKEY_CTX *ctx,\n                                            const char *mdname,\n                                            const char *mdprops);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(EVP_PKEY_CTX *pctx,\n                                            const EVP_MD *md);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name(EVP_PKEY_CTX *pctx,\n                                                 const char *mdname);\nint EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(EVP_PKEY_CTX *pctx,\n                                            int saltlen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#description","title":"DESCRIPTION","text":"

                                                                                                                                              These are the functions that implement RSA-PSS(7).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#signing-and-verification","title":"Signing and Verification","text":"

                                                                                                                                              The macro EVP_PKEY_CTX_set_rsa_padding() is supported but an error is returned if an attempt is made to set the padding mode to anything other than PSS. It is otherwise similar to the RSA version.

                                                                                                                                              The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro is used to set the salt length. If the key has usage restrictions then an error is returned if an attempt is made to set the salt length below the minimum value. It is otherwise similar to the RSA operation except detection of the salt length (using RSA_PSS_SALTLEN_AUTO) is not supported for verification if the key has usage restrictions.

                                                                                                                                              The EVP_PKEY_CTX_set_signature_md(3) and EVP_PKEY_CTX_set_rsa_mgf1_md(3) functions are used to set the digest and MGF1 algorithms respectively. If the key has usage restrictions then an error is returned if an attempt is made to set the digest to anything other than the restricted value. Otherwise these are similar to the RSA versions.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#key-generation","title":"Key Generation","text":"

                                                                                                                                              As with RSA key generation the EVP_PKEY_CTX_set_rsa_keygen_bits() and EVP_PKEY_CTX_set_rsa_keygen_pubexp() macros are supported for RSA-PSS: they have exactly the same meaning as for the RSA algorithm.

                                                                                                                                              Optional parameter restrictions can be specified when generating a PSS key. If any restrictions are set (using the macros described below) then all parameters are restricted. For example, setting a minimum salt length also restricts the digest and MGF1 algorithms. If any restrictions are in place then they are reflected in the corresponding parameters of the public key when (for example) a certificate request is signed.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_pss_keygen_md() restricts the digest algorithm the generated key can use to md. EVP_PKEY_CTX_set_rsa_pss_keygen_md_name() does the same thing, but passes the algorithm by name rather than by EVP_MD.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md() restricts the MGF1 algorithm the generated key can use to md. EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name() does the same thing, but passes the algorithm by name rather than by EVP_MD.

                                                                                                                                              EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen() restricts the minimum salt length to saltlen.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#notes","title":"NOTES","text":"

                                                                                                                                              A context for the RSA-PSS algorithm can be obtained by calling:

                                                                                                                                              EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA_PSS, NULL);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              RSA-PSS(7), EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/","title":"EVP_PKEY_CTX_set_scrypt_N","text":""},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_set1_scrypt_salt, EVP_PKEY_CTX_set_scrypt_N, EVP_PKEY_CTX_set_scrypt_r, EVP_PKEY_CTX_set_scrypt_p, EVP_PKEY_CTX_set_scrypt_maxmem_bytes - EVP_PKEY scrypt KDF support functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set1_scrypt_salt(EVP_PKEY_CTX *pctx, unsigned char *salt,\n                                  int saltlen);\n\nint EVP_PKEY_CTX_set_scrypt_N(EVP_PKEY_CTX *pctx, uint64_t N);\n\nint EVP_PKEY_CTX_set_scrypt_r(EVP_PKEY_CTX *pctx, uint64_t r);\n\nint EVP_PKEY_CTX_set_scrypt_p(EVP_PKEY_CTX *pctx, uint64_t p);\n\nint EVP_PKEY_CTX_set_scrypt_maxmem_bytes(EVP_PKEY_CTX *pctx,\n                                         uint64_t maxmem);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#description","title":"DESCRIPTION","text":"

                                                                                                                                              These functions are used to set up the necessary data to use the scrypt KDF. For more information on scrypt, see EVP_KDF-SCRYPT(7).

                                                                                                                                              EVP_PKEY_CTX_set1_scrypt_salt() sets the saltlen bytes long salt value.

                                                                                                                                              EVP_PKEY_CTX_set_scrypt_N(), EVP_PKEY_CTX_set_scrypt_r() and EVP_PKEY_CTX_set_scrypt_p() configure the work factors N, r and p.

                                                                                                                                              EVP_PKEY_CTX_set_scrypt_maxmem_bytes() sets how much RAM key derivation may maximally use, given in bytes. If RAM is exceeded because the load factors are chosen too high, the key derivation will fail.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#string-ctrls","title":"STRING CTRLS","text":"

                                                                                                                                              scrypt also supports string based control operations via EVP_PKEY_CTX_ctrl_str(3). Similarly, the salt can either be specified using the type parameter \"salt\" or in hex encoding by using the \"hexsalt\" parameter. The work factors N, r and p as well as maxmem_bytes can be set by using the parameters \"N\", \"r\", \"p\" and \"maxmem_bytes\", respectively.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#notes","title":"NOTES","text":"

                                                                                                                                              There is a newer generic API for KDFs, EVP_KDF(3), which is preferred over the EVP_PKEY method.

                                                                                                                                              The scrypt KDF also uses EVP_PKEY_CTX_set1_pbe_pass() as well as the value from the string controls \"pass\" and \"hexpass\". See EVP_PKEY_CTX_set1_pbe_pass(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_KDF(3) EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#history","title":"HISTORY","text":"

                                                                                                                                              All of the functions described here were converted from macros to functions in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_scrypt_N/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/","title":"EVP_PKEY_CTX_set_tls1_prf_md","text":""},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_CTX_set_tls1_prf_md, EVP_PKEY_CTX_set1_tls1_prf_secret, EVP_PKEY_CTX_add1_tls1_prf_seed - TLS PRF key derivation algorithm

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/kdf.h>\n\nint EVP_PKEY_CTX_set_tls1_prf_md(EVP_PKEY_CTX *pctx, const EVP_MD *md);\nint EVP_PKEY_CTX_set1_tls1_prf_secret(EVP_PKEY_CTX *pctx,\n                                      unsigned char *sec, int seclen);\nint EVP_PKEY_CTX_add1_tls1_prf_seed(EVP_PKEY_CTX *pctx,\n                                    unsigned char *seed, int seedlen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_TLS1_PRF algorithm implements the PRF key derivation function for TLS. It has no associated private key and only implements key derivation using EVP_PKEY_derive(3).

                                                                                                                                              EVP_PKEY_set_tls1_prf_md() sets the message digest associated with the TLS PRF. EVP_md5_sha1() is treated as a special case which uses the PRF algorithm using both MD5 and SHA1 as used in TLS 1.0 and 1.1.

                                                                                                                                              EVP_PKEY_CTX_set_tls1_prf_secret() sets the secret value of the TLS PRF to seclen bytes of the buffer sec. Any existing secret value is replaced and any seed is reset.

                                                                                                                                              EVP_PKEY_CTX_add1_tls1_prf_seed() sets the seed to seedlen bytes of seed. If a seed is already set it is appended to the existing value.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#string-ctrls","title":"STRING CTRLS","text":"

                                                                                                                                              The TLS PRF also supports string based control operations using EVP_PKEY_CTX_ctrl_str(3). The type parameter \"md\" uses the supplied value as the name of the digest algorithm to use. The type parameters \"secret\" and \"seed\" use the supplied value parameter as a secret or seed value. The names \"hexsecret\" and \"hexseed\" are similar except they take a hex string which is converted to binary.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#notes","title":"NOTES","text":"

                                                                                                                                              A context for the TLS PRF can be obtained by calling:

                                                                                                                                              EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_TLS1_PRF, NULL);\n

                                                                                                                                              The digest, secret value and seed must be set before a key is derived or an error occurs.

                                                                                                                                              The total length of all seeds cannot exceed 1024 bytes in length: this should be more than enough for any normal use of the TLS PRF.

                                                                                                                                              The output length of the PRF is specified by the length parameter in the EVP_PKEY_derive() function. Since the output length is variable, setting the buffer to NULL is not meaningful for the TLS PRF.

                                                                                                                                              Optimised versions of the TLS PRF can be implemented in an ENGINE.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All these functions return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#examples","title":"EXAMPLES","text":"

                                                                                                                                              This example derives 10 bytes using SHA-256 with the secret key \"secret\" and seed value \"seed\":

                                                                                                                                              EVP_PKEY_CTX *pctx;\nunsigned char out[10];\nsize_t outlen = sizeof(out);\n\npctx = EVP_PKEY_CTX_new_id(EVP_PKEY_TLS1_PRF, NULL);\nif (EVP_PKEY_derive_init(pctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_tls1_prf_md(pctx, EVP_sha256()) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, \"secret\", 6) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, \"seed\", 4) <= 0)\n    /* Error */\nif (EVP_PKEY_derive(pctx, out, &outlen) <= 0)\n    /* Error */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#history","title":"HISTORY","text":"

                                                                                                                                              All of the functions described here were converted from macros to functions in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_CTX_set_tls1_prf_md/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_asn1_get_count/","title":"EVP_PKEY_asn1_get_count","text":""},{"location":"man3/EVP_PKEY_asn1_get_count/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_asn1_find, EVP_PKEY_asn1_find_str, EVP_PKEY_asn1_get_count, EVP_PKEY_asn1_get0, EVP_PKEY_asn1_get0_info - enumerate public key ASN.1 methods

                                                                                                                                              "},{"location":"man3/EVP_PKEY_asn1_get_count/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_asn1_get_count(void);\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);\nconst EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,\n                                                   const char *str, int len);\nint EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id,\n                            int *ppkey_flags, const char **pinfo,\n                            const char **ppem_str,\n                            const EVP_PKEY_ASN1_METHOD *ameth);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_asn1_get_count/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_asn1_count() returns a count of the number of public key ASN.1 methods available: it includes standard methods and any methods added by the application.

                                                                                                                                              EVP_PKEY_asn1_get0() returns the public key ASN.1 method idx. The value of idx must be between zero and EVP_PKEY_asn1_get_count() - 1.

                                                                                                                                              EVP_PKEY_asn1_find() looks up the EVP_PKEY_ASN1_METHOD with NID type. If pe isn't NULL, then it will look up an engine implementing a EVP_PKEY_ASN1_METHOD for the NID type and return that instead, and also set *pe to point at the engine that implements it.

                                                                                                                                              EVP_PKEY_asn1_find_str() looks up the EVP_PKEY_ASN1_METHOD with PEM type string str. Just like EVP_PKEY_asn1_find(), if pe isn't NULL, then it will look up an engine implementing a EVP_PKEY_ASN1_METHOD for the NID type and return that instead, and also set *pe to point at the engine that implements it.

                                                                                                                                              EVP_PKEY_asn1_get0_info() returns the public key ID, base public key ID (both NIDs), any flags, the method description and PEM type string associated with the public key ASN.1 method *ameth.

                                                                                                                                              EVP_PKEY_asn1_count(), EVP_PKEY_asn1_get0(), EVP_PKEY_asn1_find() and EVP_PKEY_asn1_find_str() are not thread safe, but as long as all EVP_PKEY_ASN1_METHOD objects are added before the application gets threaded, using them is safe. See EVP_PKEY_asn1_add0(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_asn1_get_count/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_asn1_count() returns the number of available public key methods.

                                                                                                                                              EVP_PKEY_asn1_get0() return a public key method or NULL if idx is out of range.

                                                                                                                                              EVP_PKEY_asn1_get0_info() returns 0 on failure, 1 on success.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_asn1_get_count/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_asn1_new(3), EVP_PKEY_asn1_add0(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_asn1_get_count/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/","title":"EVP_PKEY_check","text":""},{"location":"man3/EVP_PKEY_check/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_check, EVP_PKEY_param_check, EVP_PKEY_param_check_quick, EVP_PKEY_public_check, EVP_PKEY_public_check_quick, EVP_PKEY_private_check, EVP_PKEY_pairwise_check - key and parameter validation functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_param_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_param_check_quick(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_public_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_public_check_quick(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_private_check(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_pairwise_check(EVP_PKEY_CTX *ctx);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_param_check() validates the parameters component of the key given by ctx. This check will always succeed for key types that do not have parameters.

                                                                                                                                              EVP_PKEY_param_check_quick() validates the parameters component of the key given by ctx like EVP_PKEY_param_check() does. However some algorithm implementations may offer a quicker form of validation that omits some checks in order to perform a lightweight sanity check of the key. If a quicker form is not provided then this function call does the same thing as EVP_PKEY_param_check().

                                                                                                                                              EVP_PKEY_public_check() validates the public component of the key given by ctx.

                                                                                                                                              EVP_PKEY_public_check_quick() validates the public component of the key given by ctx like EVP_PKEY_public_check() does. However some algorithm implementations may offer a quicker form of validation that omits some checks in order to perform a lightweight sanity check of the key. If a quicker form is not provided then this function call does the same thing as EVP_PKEY_public_check().

                                                                                                                                              EVP_PKEY_private_check() validates the private component of the key given by ctx.

                                                                                                                                              EVP_PKEY_pairwise_check() validates that the public and private components have the correct mathematical relationship to each other for the key given by ctx.

                                                                                                                                              EVP_PKEY_check() is an alias for the EVP_PKEY_pairwise_check() function.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/#notes","title":"NOTES","text":"

                                                                                                                                              Key validation used by the OpenSSL FIPS provider complies with the rules within SP800-56A and SP800-56B. For backwards compatibility reasons the OpenSSL default provider may use checks that are not as restrictive for certain key types. For further information see \"DSA key validation\" in EVP_PKEY-DSA(7), \"DH key validation\" in EVP_PKEY-DH(7), \"EC key validation\" in EVP_PKEY-EC(7) and \"RSA key validation\" in EVP_PKEY-RSA(7).

                                                                                                                                              Refer to SP800-56A and SP800-56B for rules relating to when these functions should be called during key establishment. It is not necessary to call these functions after locally calling an approved key generation method, but may be required for assurance purposes when receiving keys from a third party.

                                                                                                                                              The EVP_PKEY_pairwise_check() and EVP_PKEY_private_check() might not be bounded by any key size limits as private keys are not expected to be supplied by attackers. For that reason they might take an unbounded time if run on arbitrarily large keys.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All functions return 1 for success or others for failure. They return -2 if the operation is not supported for the specific algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_fromdata(3), EVP_PKEY-DH(7), EVP_PKEY-FFC(7), EVP_PKEY-DSA(7), EVP_PKEY-EC(7), EVP_PKEY-RSA(7),

                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/#history","title":"HISTORY","text":"

                                                                                                                                              EVP_PKEY_check(), EVP_PKEY_public_check() and EVP_PKEY_param_check() were added in OpenSSL 1.1.1.

                                                                                                                                              EVP_PKEY_param_check_quick(), EVP_PKEY_public_check_quick(), EVP_PKEY_private_check() and EVP_PKEY_pairwise_check() were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_check/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/","title":"EVP_PKEY_copy_parameters","text":""},{"location":"man3/EVP_PKEY_copy_parameters/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_missing_parameters, EVP_PKEY_copy_parameters, EVP_PKEY_parameters_eq, EVP_PKEY_cmp_parameters, EVP_PKEY_eq, EVP_PKEY_cmp - public key parameter and comparison functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);\nint EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);\n\nint EVP_PKEY_parameters_eq(const EVP_PKEY *a, const EVP_PKEY *b);\nint EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b);\n

                                                                                                                                              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);\nint EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The function EVP_PKEY_missing_parameters() returns 1 if the public key parameters of pkey are missing and 0 if they are present or the algorithm doesn't use parameters.

                                                                                                                                              The function EVP_PKEY_copy_parameters() copies the parameters from key from to key to. An error is returned if the parameters are missing in from or present in both from and to and mismatch. If the parameters in from and to are both present and match this function has no effect.

                                                                                                                                              The function EVP_PKEY_parameters_eq() checks the parameters of keys a and b for equality.

                                                                                                                                              The function EVP_PKEY_eq() checks the keys a and b for equality, including their parameters if they are available.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/#notes","title":"NOTES","text":"

                                                                                                                                              The main purpose of the functions EVP_PKEY_missing_parameters() and EVP_PKEY_copy_parameters() is to handle public keys in certificates where the parameters are sometimes omitted from a public key if they are inherited from the CA that signed it.

                                                                                                                                              The deprecated functions EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() differ in their return values compared to other _cmp() functions. They are aliases for EVP_PKEY_eq() and EVP_PKEY_parameters_eq().

                                                                                                                                              The function EVP_PKEY_cmp() previously only checked the key parameters (if there are any) and the public key, assuming that there always was a public key and that private key equality could be derived from that. Because it's no longer assumed that the private key in an EVP_PKEY(3) is always accompanied by a public key, the comparison can not rely on public key comparison alone.

                                                                                                                                              Instead, EVP_PKEY_eq() (and therefore also EVP_PKEY_cmp()) now compares:

                                                                                                                                              1. the key parameters (if there are any)
                                                                                                                                              2. the public keys or the private keys of the two EVP_PKEYs, depending on what they both contain.
                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              The function EVP_PKEY_missing_parameters() returns 1 if the public key parameters of pkey are missing and 0 if they are present or the algorithm doesn't use parameters.

                                                                                                                                              These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for failure.

                                                                                                                                              The functions EVP_PKEY_cmp_parameters(), EVP_PKEY_parameters_eq(), EVP_PKEY_cmp() and EVP_PKEY_eq() return 1 if their inputs match, 0 if they don't match, -1 if the key types are different and -2 if the operation is not supported.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_keygen(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters() functions were deprecated in OpenSSL 3.0.

                                                                                                                                              The EVP_PKEY_eq() and EVP_PKEY_parameters_eq() were added in OpenSSL 3.0 to replace EVP_PKEY_cmp() and EVP_PKEY_cmp_parameters().

                                                                                                                                              "},{"location":"man3/EVP_PKEY_copy_parameters/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/","title":"EVP_PKEY_decapsulate","text":""},{"location":"man3/EVP_PKEY_decapsulate/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_decapsulate_init, EVP_PKEY_decapsulate - Key decapsulation using a KEM algorithm with a private key

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_decapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_decapsulate(EVP_PKEY_CTX *ctx,\n                         unsigned char *unwrapped, size_t *unwrappedlen,\n                         const unsigned char *wrapped, size_t wrappedlen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_decapsulate_init() function initializes a private key algorithm context ctx for a decapsulation operation and then sets the params on the context in the same way as calling EVP_PKEY_CTX_set_params(3). Note that ctx usually is produced using EVP_PKEY_CTX_new_from_pkey(3), specifying the private key to use.

                                                                                                                                              The EVP_PKEY_decapsulate() function performs a private key decapsulation operation using ctx. The data to be decapsulated is specified using the wrapped and wrappedlen parameters. If unwrapped is NULL then the maximum size of the output secret buffer is written to *unwrappedlen. If unwrapped is not NULL and the call is successful then the decapsulated secret data is written to unwrapped and the amount of data written to *unwrappedlen.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#notes","title":"NOTES","text":"

                                                                                                                                              After the call to EVP_PKEY_decapsulate_init() algorithm-specific parameters for the operation may be set or modified using EVP_PKEY_CTX_set_params(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_decapsulate_init() and EVP_PKEY_decapsulate() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the private key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Decapsulate data using RSA:

                                                                                                                                              #include <openssl/evp.h>\n\n/*\n * NB: assumes rsa_priv_key is an RSA private key,\n * and that in, inlen are already set up to contain encapsulated data.\n */\n\nEVP_PKEY_CTX *ctx = NULL;\nsize_t secretlen = 0;\nunsigned char *secret = NULL;;\n\nctx = EVP_PKEY_CTX_new_from_pkey(libctx, rsa_priv_key, NULL);\nif (ctx = NULL)\n    /* Error */\nif (EVP_PKEY_decapsulate_init(ctx, NULL) <= 0)\n    /* Error */\n\n/* Set the mode - only 'RSASVE' is currently supported */\nif (EVP_PKEY_CTX_set_kem_op(ctx, \"RSASVE\") <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_decapsulate(ctx, NULL, &secretlen, in, inlen) <= 0)\n    /* Error */\n\nsecret = OPENSSL_malloc(secretlen);\nif (secret == NULL)\n    /* malloc failure */\n\n/* Decapsulated secret data is secretlen bytes long */\nif (EVP_PKEY_decapsulaterctx, secret, &secretlen, in, inlen) <= 0)\n    /* Error */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new_from_pkey(3), EVP_PKEY_encapsulate(3), EVP_KEM-RSA(7),

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decapsulate/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/","title":"EVP_PKEY_decrypt","text":""},{"location":"man3/EVP_PKEY_decrypt/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_decrypt_init, EVP_PKEY_decrypt_init_ex, EVP_PKEY_decrypt - decrypt using a public key algorithm

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_decrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,\n                     unsigned char *out, size_t *outlen,\n                     const unsigned char *in, size_t inlen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_decrypt_init() function initializes a public key algorithm context using key pkey for a decryption operation.

                                                                                                                                              The EVP_PKEY_decrypt_init_ex() function initializes a public key algorithm context using key pkey for a decryption operation and sets the algorithm specific params.

                                                                                                                                              The EVP_PKEY_decrypt() function performs a public key decryption operation using ctx. The data to be decrypted is specified using the in and inlen parameters. If out is NULL then the minimum required size of the output buffer is written to the *outlen parameter.

                                                                                                                                              If out is not NULL then before the call the *outlen parameter must contain the length of the out buffer. If the call is successful the decrypted data is written to out and the amount of the decrypted data written to *outlen, otherwise an error is returned.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#notes","title":"NOTES","text":"

                                                                                                                                              After the call to EVP_PKEY_decrypt_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation. These operations can be included in the EVP_PKEY_decrypt_init_ex() call.

                                                                                                                                              The function EVP_PKEY_decrypt() can be called more than once on the same context if several operations are performed using the same parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_decrypt_init(), EVP_PKEY_decrypt_init_ex() and EVP_PKEY_decrypt() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Decrypt data using OAEP (for RSA keys):

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nunsigned char *out, *in;\nsize_t outlen, inlen;\nEVP_PKEY *key;\n\n/*\n * NB: assumes key, eng, in, inlen are already set up\n * and that key is an RSA private key\n */\nctx = EVP_PKEY_CTX_new(key, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_decrypt_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0)\n    /* Error */\n\nout = OPENSSL_malloc(outlen);\n\nif (!out)\n    /* malloc failure */\n\nif (EVP_PKEY_decrypt(ctx, out, &outlen, in, inlen) <= 0)\n    /* Error */\n\n/* Decrypted data is outlen bytes written to buffer out */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 1.0.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_decrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/","title":"EVP_PKEY_derive","text":""},{"location":"man3/EVP_PKEY_derive/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_derive_init, EVP_PKEY_derive_init_ex, EVP_PKEY_derive_set_peer_ex, EVP_PKEY_derive_set_peer, EVP_PKEY_derive - derive public key algorithm shared secret

                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_derive_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_derive_set_peer_ex(EVP_PKEY_CTX *ctx, EVP_PKEY *peer,\n                                int validate_peer);\nint EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);\nint EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_derive_init() initializes a public key algorithm context ctx for shared secret derivation using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_KEYEXCH method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

                                                                                                                                              EVP_PKEY_derive_init_ex() is the same as EVP_PKEY_derive_init() but additionally sets the passed parameters params on the context before returning.

                                                                                                                                              EVP_PKEY_derive_set_peer_ex() sets the peer key: this will normally be a public key. The validate_peer will validate the public key if this value is non zero.

                                                                                                                                              EVP_PKEY_derive_set_peer() is similar to EVP_PKEY_derive_set_peer_ex() with validate_peer set to 1.

                                                                                                                                              EVP_PKEY_derive() derives a shared secret using ctx. If key is NULL then the maximum size of the output buffer is written to the keylen parameter. If key is not NULL then before the call the keylen parameter should contain the length of the key buffer, if the call is successful the shared secret is written to key and the amount of data written to keylen.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#notes","title":"NOTES","text":"

                                                                                                                                              After the call to EVP_PKEY_derive_init(), algorithm specific control operations can be performed to set any appropriate parameters for the operation.

                                                                                                                                              The function EVP_PKEY_derive() can be called more than once on the same context if several operations are performed using the same parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_derive_init() and EVP_PKEY_derive() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Derive shared secret (for example DH or EC keys):

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nunsigned char *skey;\nsize_t skeylen;\nEVP_PKEY *pkey, *peerkey;\n/* NB: assumes pkey, eng, peerkey have been already set up */\n\nctx = EVP_PKEY_CTX_new(pkey, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_derive_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0)\n    /* Error */\n\nskey = OPENSSL_malloc(skeylen);\n\nif (!skey)\n    /* malloc failure */\n\nif (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0)\n    /* Error */\n\n/* Shared secret is skey bytes written to buffer skey */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_KEYEXCH_fetch(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_derive_init(), EVP_PKEY_derive_set_peer() and EVP_PKEY_derive() functions were originally added in OpenSSL 1.0.0.

                                                                                                                                              The EVP_PKEY_derive_init_ex() and EVP_PKEY_derive_set_peer_ex() functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_derive/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/","title":"EVP_PKEY_digestsign_supports_digest","text":""},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_digestsign_supports_digest - indicate support for signature digest

                                                                                                                                              "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\nint EVP_PKEY_digestsign_supports_digest(EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,\n                                        const char *name, const char *propq);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_digestsign_supports_digest() function queries whether the message digest name is supported for public key signature operations associated with key pkey. The query is done within an optional library context libctx and with an optional property query propq.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              The EVP_PKEY_digestsign_supports_digest() function returns 1 if the message digest algorithm identified by name can be used for public key signature operations associated with key pkey and 0 if it cannot be used. It returns a negative value for failure.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_DigestSignInit_ex(3),

                                                                                                                                              "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_digestsign_supports_digest() function was added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_digestsign_supports_digest/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/","title":"EVP_PKEY_encapsulate","text":""},{"location":"man3/EVP_PKEY_encapsulate/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_encapsulate_init, EVP_PKEY_encapsulate - Key encapsulation using a KEM algorithm with a public key

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_encapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_encapsulate(EVP_PKEY_CTX *ctx,\n                         unsigned char *wrappedkey, size_t *wrappedkeylen,\n                         unsigned char *genkey, size_t *genkeylen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_encapsulate_init() function initializes a public key algorithm context ctx for an encapsulation operation and then sets the params on the context in the same way as calling EVP_PKEY_CTX_set_params(3). Note that ctx is usually is produced using EVP_PKEY_CTX_new_from_pkey(3), specifying the public key to use.

                                                                                                                                              The EVP_PKEY_encapsulate() function performs a public key encapsulation operation using ctx. The symmetric secret generated in genkey can be used as key material. The ciphertext in wrappedkey is its encapsulated form, which can be sent to another party, who can use EVP_PKEY_decapsulate(3) to retrieve it using their private key. If wrappedkey is NULL then the maximum size of the output buffer is written to the *wrappedkeylen parameter unless wrappedkeylen is NULL and the maximum size of the generated key buffer is written to *genkeylen unless genkeylen is NULL. If wrappedkey is not NULL and the call is successful then the internally generated key is written to genkey and its size is written to *genkeylen. The encapsulated version of the generated key is written to wrappedkey and its size is written to *wrappedkeylen.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#notes","title":"NOTES","text":"

                                                                                                                                              After the call to EVP_PKEY_encapsulate_init() algorithm-specific parameters for the operation may be set or modified using EVP_PKEY_CTX_set_params(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_encapsulate_init() and EVP_PKEY_encapsulate() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Encapsulate an RSASVE key (for RSA keys).

                                                                                                                                              #include <openssl/evp.h>\n\n/*\n * NB: assumes rsa_pub_key is an public key of another party.\n */\n\nEVP_PKEY_CTX *ctx = NULL;\nsize_t secretlen = 0, outlen = 0;\nunsigned char *out = NULL, *secret = NULL;\n\nctx = EVP_PKEY_CTX_new_from_pkey(libctx, rsa_pub_key, NULL);\nif (ctx = NULL)\n    /* Error */\nif (EVP_PKEY_encapsulate_init(ctx, NULL) <= 0)\n    /* Error */\n\n/* Set the mode - only 'RSASVE' is currently supported */\n if (EVP_PKEY_CTX_set_kem_op(ctx, \"RSASVE\") <= 0)\n    /* Error */\n/* Determine buffer length */\nif (EVP_PKEY_encapsulate(ctx, NULL, &outlen, NULL, &secretlen) <= 0)\n    /* Error */\n\nout = OPENSSL_malloc(outlen);\nsecret = OPENSSL_malloc(secretlen);\nif (out == NULL || secret == NULL)\n    /* malloc failure */\n\n/*\n * The generated 'secret' can be used as key material.\n * The encapsulated 'out' can be sent to another party who can\n * decapsulate it using their private key to retrieve the 'secret'.\n */\nif (EVP_PKEY_encapsulate(ctx, out, &outlen, secret, &secretlen) <= 0)\n    /* Error */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new_from_pkey(3), EVP_PKEY_decapsulate(3), EVP_KEM-RSA(7),

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encapsulate/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/","title":"EVP_PKEY_encrypt","text":""},{"location":"man3/EVP_PKEY_encrypt/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_encrypt_init_ex, EVP_PKEY_encrypt_init, EVP_PKEY_encrypt - encrypt using a public key algorithm

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_encrypt_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,\n                     unsigned char *out, size_t *outlen,\n                     const unsigned char *in, size_t inlen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP_PKEY_encrypt_init() function initializes a public key algorithm context using key pkey for an encryption operation.

                                                                                                                                              The EVP_PKEY_encrypt_init_ex() function initializes a public key algorithm context using key pkey for an encryption operation and sets the algorithm specific params.

                                                                                                                                              The EVP_PKEY_encrypt() function performs a public key encryption operation using ctx. The data to be encrypted is specified using the in and inlen parameters. If out is NULL then the maximum size of the output buffer is written to the outlen parameter. If out is not NULL then before the call the outlen parameter should contain the length of the out buffer, if the call is successful the encrypted data is written to out and the amount of data written to outlen.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#notes","title":"NOTES","text":"

                                                                                                                                              After the call to EVP_PKEY_encrypt_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation. These operations can be included in the EVP_PKEY_encrypt_init_ex() call.

                                                                                                                                              The function EVP_PKEY_encrypt() can be called more than once on the same context if several operations are performed using the same parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_encrypt_init(), EVP_PKEY_encrypt_init_ex() and EVP_PKEY_encrypt() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Encrypt data using OAEP (for RSA keys). See also PEM_read_PUBKEY(3) or d2i_X509(3) for means to load a public key. You may also simply set 'eng = NULL;' to start with the default OpenSSL RSA implementation:

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n#include <openssl/engine.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nunsigned char *out, *in;\nsize_t outlen, inlen;\nEVP_PKEY *key;\n\n/*\n * NB: assumes eng, key, in, inlen are already set up,\n * and that key is an RSA public key\n */\nctx = EVP_PKEY_CTX_new(key, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_encrypt_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0)\n    /* Error */\n\nout = OPENSSL_malloc(outlen);\n\nif (!out)\n    /* malloc failure */\n\nif (EVP_PKEY_encrypt(ctx, out, &outlen, in, inlen) <= 0)\n    /* Error */\n\n/* Encrypted data is outlen bytes written to buffer out */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              d2i_X509(3), ENGINE_by_id(3), EVP_PKEY_CTX_new(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 1.0.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/","title":"EVP_PKEY_fromdata","text":""},{"location":"man3/EVP_PKEY_fromdata/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_fromdata_init, EVP_PKEY_fromdata, EVP_PKEY_fromdata_settable - functions to create keys and key parameters from user data

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_fromdata_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_fromdata(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey, int selection,\n                      OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_PKEY_fromdata_settable(EVP_PKEY_CTX *ctx, int selection);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The functions described here are used to create new keys from user provided key data, such as n, e and d for a minimal RSA keypair.

                                                                                                                                              These functions use an EVP_PKEY_CTX context, which should primarily be created with EVP_PKEY_CTX_new_from_name(3) or EVP_PKEY_CTX_new_id(3).

                                                                                                                                              The exact key data that the user can pass depends on the key type. These are passed as an OSSL_PARAM(3) array.

                                                                                                                                              EVP_PKEY_fromdata_init() initializes a public key algorithm context for creating a key or key parameters from user data.

                                                                                                                                              EVP_PKEY_fromdata() creates the structure to store a key or key parameters, given data from params, selection and a context that's been initialized with EVP_PKEY_fromdata_init(). The result is written to *ppkey. selection is described in \"Selections\". The parameters that can be used for various types of key are as described by the diverse \"Common parameters\" sections of the EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-ED448(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), and EVP_PKEY-ED25519(7) pages.

                                                                                                                                              EVP_PKEY_fromdata_settable() gets a constant OSSL_PARAM(3) array that describes the settable parameters that can be used with EVP_PKEY_fromdata(). selection is described in \"Selections\".

                                                                                                                                              Parameters in the params array that are not among the settable parameters for the given selection are ignored.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#selections","title":"Selections","text":"

                                                                                                                                              The following constants can be used for selection:

                                                                                                                                              • EVP_PKEY_KEY_PARAMETERS

                                                                                                                                                Only key parameters will be selected.

                                                                                                                                              • EVP_PKEY_PUBLIC_KEY

                                                                                                                                                Only public key components will be selected. This includes optional key parameters.

                                                                                                                                              • EVP_PKEY_KEYPAIR

                                                                                                                                                Any keypair components will be selected. This includes the private key, public key and key parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#notes","title":"NOTES","text":"

                                                                                                                                              These functions only work with key management methods coming from a provider. This is the mirror function to EVP_PKEY_todata(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_fromdata_init() and EVP_PKEY_fromdata() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#examples","title":"EXAMPLES","text":"

                                                                                                                                              These examples are very terse for the sake of staying on topic, which is the EVP_PKEY_fromdata() set of functions. In real applications, BIGNUMs would be handled and converted to byte arrays with BN_bn2nativepad(), but that's off topic here.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#creating-an-rsa-keypair-using-raw-key-data","title":"Creating an RSA keypair using raw key data","text":"
                                                                                                                                              #include <openssl/evp.h>\n\n/*\n * These are extremely small to make this example simple.  A real\n * and secure application will not use such small numbers.  A real\n * and secure application is expected to use BIGNUMs, and to build\n * this array dynamically.\n */\nunsigned long rsa_n = 0xbc747fc5;\nunsigned long rsa_e = 0x10001;\nunsigned long rsa_d = 0x7b133399;\nOSSL_PARAM params[] = {\n    OSSL_PARAM_ulong(\"n\", &rsa_n),\n    OSSL_PARAM_ulong(\"e\", &rsa_e),\n    OSSL_PARAM_ulong(\"d\", &rsa_d),\n    OSSL_PARAM_END\n};\n\nint main()\n{\n    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n    EVP_PKEY *pkey = NULL;\n\n    if (ctx == NULL\n        || EVP_PKEY_fromdata_init(ctx) <= 0\n        || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params) <= 0)\n        exit(1);\n\n    /* Do what you want with |pkey| */\n}\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#creating-an-ecc-keypair-using-raw-key-data","title":"Creating an ECC keypair using raw key data","text":"
                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/param_build.h>\n#include <openssl/ec.h>\n\n/*\n * Fixed data to represent the private and public key.\n */\nconst unsigned char priv_data[] = {\n    0xb9, 0x2f, 0x3c, 0xe6, 0x2f, 0xfb, 0x45, 0x68,\n    0x39, 0x96, 0xf0, 0x2a, 0xaf, 0x6c, 0xda, 0xf2,\n    0x89, 0x8a, 0x27, 0xbf, 0x39, 0x9b, 0x7e, 0x54,\n    0x21, 0xc2, 0xa1, 0xe5, 0x36, 0x12, 0x48, 0x5d\n};\n/* UNCOMPRESSED FORMAT */\nconst unsigned char pub_data[] = {\n    POINT_CONVERSION_UNCOMPRESSED,\n    0xcf, 0x20, 0xfb, 0x9a, 0x1d, 0x11, 0x6c, 0x5e,\n    0x9f, 0xec, 0x38, 0x87, 0x6c, 0x1d, 0x2f, 0x58,\n    0x47, 0xab, 0xa3, 0x9b, 0x79, 0x23, 0xe6, 0xeb,\n    0x94, 0x6f, 0x97, 0xdb, 0xa3, 0x7d, 0xbd, 0xe5,\n    0x26, 0xca, 0x07, 0x17, 0x8d, 0x26, 0x75, 0xff,\n    0xcb, 0x8e, 0xb6, 0x84, 0xd0, 0x24, 0x02, 0x25,\n    0x8f, 0xb9, 0x33, 0x6e, 0xcf, 0x12, 0x16, 0x2f,\n    0x5c, 0xcd, 0x86, 0x71, 0xa8, 0xbf, 0x1a, 0x47\n};\n\nint main()\n{\n    EVP_PKEY_CTX *ctx;\n    EVP_PKEY *pkey = NULL;\n    BIGNUM *priv;\n    OSSL_PARAM_BLD *param_bld;\n    OSSL_PARAM *params = NULL;\n    int exitcode = 0;\n\n    priv = BN_bin2bn(priv_data, sizeof(priv_data), NULL);\n\n    param_bld = OSSL_PARAM_BLD_new();\n    if (priv != NULL && param_bld != NULL\n        && OSSL_PARAM_BLD_push_utf8_string(param_bld, \"group\",\n                                           \"prime256v1\", 0)\n        && OSSL_PARAM_BLD_push_BN(param_bld, \"priv\", priv)\n        && OSSL_PARAM_BLD_push_octet_string(param_bld, \"pub\",\n                                            pub_data, sizeof(pub_data)))\n        params = OSSL_PARAM_BLD_to_param(param_bld);\n\n    ctx = EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n    if (ctx == NULL\n        || params == NULL\n        || EVP_PKEY_fromdata_init(ctx) <= 0\n        || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEYPAIR, params) <= 0) {\n        exitcode = 1;\n    } else {\n        /* Do what you want with |pkey| */\n    }\n\n    EVP_PKEY_free(pkey);\n    EVP_PKEY_CTX_free(ctx);\n    OSSL_PARAM_free(params);\n    OSSL_PARAM_BLD_free(param_bld);\n    BN_free(priv);\n\n    exit(exitcode);\n}\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#finding-out-params-for-an-unknown-key-type","title":"Finding out params for an unknown key type","text":"
                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/core.h>\n\n/* Program expects a key type as first argument */\nint main(int argc, char *argv[])\n{\n    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_from_name(NULL, argv[1], NULL);\n    const OSSL_PARAM *settable_params = NULL;\n\n    if (ctx == NULL)\n       exit(1);\n   settable_params = EVP_PKEY_fromdata_settable(ctx, EVP_PKEY_KEYPAIR);\n   if (settable_params == NULL)\n        exit(1);\n\n    for (; settable_params->key != NULL; settable_params++) {\n        const char *datatype = NULL;\n\n        switch (settable_params->data_type) {\n        case OSSL_PARAM_INTEGER:\n            datatype = \"integer\";\n            break;\n        case OSSL_PARAM_UNSIGNED_INTEGER:\n            datatype = \"unsigned integer\";\n            break;\n        case OSSL_PARAM_UTF8_STRING:\n            datatype = \"printable string (utf-8 encoding expected)\";\n            break;\n        case OSSL_PARAM_UTF8_PTR:\n            datatype = \"printable string pointer (utf-8 encoding expected)\";\n            break;\n        case OSSL_PARAM_OCTET_STRING:\n            datatype = \"octet string\";\n            break;\n        case OSSL_PARAM_OCTET_PTR:\n            datatype = \"octet string pointer\";\n            break;\n        }\n        printf(\"%s : %s \", settable_params->key, datatype);\n        if (settable_params->data_size == 0)\n            printf(\"(unlimited size)\\n\");\n        else\n            printf(\"(maximum size %zu)\\n\", settable_params->data_size);\n    }\n}\n

                                                                                                                                              The descriptor OSSL_PARAM(3) returned by EVP_PKEY_fromdata_settable() may also be used programmatically, for example with OSSL_PARAM_allocate_from_text(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), provider(7), EVP_PKEY_gettable_params(3), OSSL_PARAM(3), EVP_PKEY_todata(3), EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-ED448(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), EVP_PKEY-ED25519(7)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_fromdata/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_attr/","title":"EVP_PKEY_get_attr","text":""},{"location":"man3/EVP_PKEY_get_attr/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_get_attr, EVP_PKEY_get_attr_count, EVP_PKEY_get_attr_by_NID, EVP_PKEY_get_attr_by_OBJ, EVP_PKEY_delete_attr, EVP_PKEY_add1_attr, EVP_PKEY_add1_attr_by_OBJ, EVP_PKEY_add1_attr_by_NID, EVP_PKEY_add1_attr_by_txt - EVP_PKEY X509_ATTRIBUTE functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_attr/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/x509.h>\n\nint EVP_PKEY_get_attr_count(const EVP_PKEY *key);\nint EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos);\nint EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj,\n                             int lastpos);\nX509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);\nX509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);\nint EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);\nint EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,\n                              const ASN1_OBJECT *obj, int type,\n                              const unsigned char *bytes, int len);\nint EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,\n                              int nid, int type,\n                              const unsigned char *bytes, int len);\nint EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,\n                              const char *attrname, int type,\n                              const unsigned char *bytes, int len);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_attr/#description","title":"DESCRIPTION","text":"

                                                                                                                                              These functions are used by PKCS12.

                                                                                                                                              EVP_PKEY_get_attr_by_OBJ() finds the location of the first matching object obj in the key attribute list. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to EVP_PKEY_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the attribute list.

                                                                                                                                              EVP_PKEY_get_attr_by_NID() is similar to EVP_PKEY_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                              EVP_PKEY_get_attr() returns the X509_ATTRIBUTE object at index loc in the key attribute list. loc should be in the range from 0 to EVP_PKEY_get_attr_count() - 1.

                                                                                                                                              EVP_PKEY_delete_attr() removes the X509_ATTRIBUTE object at index loc in the key attribute list.

                                                                                                                                              EVP_PKEY_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE object to the key attribute list. A new key attribute list is created if required. An error occurs if either attr is NULL, or the attribute already exists.

                                                                                                                                              EVP_PKEY_add1_attr_by_OBJ() creates a new X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the key object's attribute list. If obj already exists in the attribute list then an error occurs.

                                                                                                                                              EVP_PKEY_add1_attr_by_NID() is similar to EVP_PKEY_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                              EVP_PKEY_add1_attr_by_txt() is similar to EVP_PKEY_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_attr/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_get_attr_count() returns the number of attributes in the key object attribute list or -1 if the attribute list is NULL.

                                                                                                                                              EVP_PKEY_get_attr_by_OBJ() returns -1 if either the list is empty OR the object is not found, otherwise it returns the location of the object in the list.

                                                                                                                                              EVP_PKEY_get_attr_by_NID() is similar to EVP_PKEY_get_attr_by_OBJ(), except that it returns -2 if the nid is not known by OpenSSL.

                                                                                                                                              EVP_PKEY_get_attr() returns either a X509_ATTRIBUTE or NULL if there is a error.

                                                                                                                                              EVP_PKEY_delete_attr() returns either the removed X509_ATTRIBUTE or NULL if there is a error.

                                                                                                                                              EVP_PKEY_add1_attr(), EVP_PKEY_add1_attr_by_OBJ(), EVP_PKEY_add1_attr_by_NID() and EVP_PKEY_add1_attr_by_txt() return 1 on success or 0 otherwise.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_attr/#notes","title":"NOTES","text":"

                                                                                                                                              A EVP_PKEY object's attribute list is initially NULL. All the above functions listed will return an error unless EVP_PKEY_add1_attr() is called. All functions listed assume that the key is not NULL.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_attr/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              X509_ATTRIBUTE(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_attr/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/","title":"EVP_PKEY_get_default_digest_nid","text":""},{"location":"man3/EVP_PKEY_get_default_digest_nid/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_get_default_digest_nid, EVP_PKEY_get_default_digest_name - get default signature digest

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_get_default_digest_name(EVP_PKEY *pkey,\n                                     char *mdname, size_t mdname_sz);\nint EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_get_default_digest_name() fills in the default message digest name for the public key signature operations associated with key pkey into mdname, up to at most mdname_sz bytes including the ending NUL byte. The name could be \"UNDEF\", signifying that a digest must (for return value 2) or may (for return value 1) be left unspecified.

                                                                                                                                              EVP_PKEY_get_default_digest_nid() sets pnid to the default message digest NID for the public key signature operations associated with key pkey. Note that some signature algorithms (i.e. Ed25519 and Ed448) do not use a digest during signing. In this case pnid will be set to NID_undef. This function is only reliable for legacy keys, which are keys with a EVP_PKEY_ASN1_METHOD; these keys have typically been loaded from engines, or created with EVP_PKEY_assign_RSA(3) or similar.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#notes","title":"NOTES","text":"

                                                                                                                                              For all current standard OpenSSL public key algorithms SHA256 is returned.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_get_default_digest_name() and EVP_PKEY_get_default_digest_nid() both return 1 if the message digest is advisory (that is other digests can be used) and 2 if it is mandatory (other digests can not be used). They return 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_sign(3), EVP_PKEY_digestsign_supports_digest(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3),

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#history","title":"HISTORY","text":"

                                                                                                                                              This function was added in OpenSSL 1.0.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_default_digest_nid/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/","title":"EVP_PKEY_get_field_type","text":""},{"location":"man3/EVP_PKEY_get_field_type/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_get_field_type, EVP_PKEY_get_ec_point_conv_form - get field type or point conversion form of a key

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_get_field_type(const EVP_PKEY *pkey);\nint EVP_PKEY_get_ec_point_conv_form(const EVP_PKEY *pkey);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_get_field_type() returns the field type NID of the pkey, if pkey's key type supports it. The types currently supported by the built-in OpenSSL providers are either NID_X9_62_prime_field for prime curves or NID_X9_62_characteristic_two_field for binary curves; these values are defined in the <openssl/obj_mac.h> header file.

                                                                                                                                              EVP_PKEY_get_ec_point_conv_form() returns the point conversion format of the pkey, if pkey's key type supports it.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/#notes","title":"NOTES","text":"

                                                                                                                                              Among the standard OpenSSL key types, this is only supported for EC and SM2 keys. Other providers may support this for additional key types.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_get_field_type() returns the field type NID or 0 on error.

                                                                                                                                              EVP_PKEY_get_ec_point_conv_form() returns the point conversion format number (see EC_GROUP_copy(3)) or 0 on error.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EC_GROUP_copy(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_field_type/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_group_name/","title":"EVP_PKEY_get_group_name","text":""},{"location":"man3/EVP_PKEY_get_group_name/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_get_group_name - get group name of a key

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_group_name/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_get_group_name(EVP_PKEY *pkey, char *gname, size_t gname_sz,\n                            size_t *gname_len);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_group_name/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_get_group_name() fills in the group name of the pkey into gname, up to at most gname_sz bytes including the ending NUL byte and assigns *gname_len the actual length of the name not including the NUL byte, if pkey's key type supports it. gname as well as gname_len may individually be NULL, and won't be filled in or assigned in that case.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_group_name/#notes","title":"NOTES","text":"

                                                                                                                                              Among the standard OpenSSL key types, this is only supported for DH, EC and SM2 keys. Other providers may support this for additional key types.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_group_name/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_get_group_name() returns 1 if the group name could be filled in, otherwise 0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_group_name/#history","title":"HISTORY","text":"

                                                                                                                                              This function was added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_group_name/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/","title":"EVP_PKEY_get_size","text":""},{"location":"man3/EVP_PKEY_get_size/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_get_size, EVP_PKEY_get_bits, EVP_PKEY_get_security_bits, EVP_PKEY_bits, EVP_PKEY_security_bits, EVP_PKEY_size - EVP_PKEY information functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_get_size(const EVP_PKEY *pkey);\nint EVP_PKEY_get_bits(const EVP_PKEY *pkey);\nint EVP_PKEY_get_security_bits(const EVP_PKEY *pkey);\n\n#define EVP_PKEY_bits EVP_PKEY_get_bits\n#define EVP_PKEY_security_bits EVP_PKEY_get_security_bits\n#define EVP_PKEY_size EVP_PKEY_get_size\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_get_size() returns the maximum suitable size for the output buffers for almost all operations that can be done with pkey. The primary documented use is with EVP_SignFinal(3) and EVP_SealInit(3), but it isn't limited there. The returned size is also large enough for the output buffer of EVP_PKEY_sign(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_derive(3).

                                                                                                                                              It must be stressed that, unless the documentation for the operation that's being performed says otherwise, the size returned by EVP_PKEY_get_size() is only preliminary and not exact, so the final contents of the target buffer may be smaller. It is therefore crucial to take note of the size given back by the function that performs the operation, such as EVP_PKEY_sign(3) (the siglen argument will receive that length), to avoid bugs.

                                                                                                                                              EVP_PKEY_get_bits() returns the cryptographic length of the cryptosystem to which the key in pkey belongs, in bits. Note that the definition of cryptographic length is specific to the key cryptosystem.

                                                                                                                                              EVP_PKEY_get_security_bits() returns the number of security bits of the given pkey, bits of security is defined in NIST SP800-57.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_get_size(), EVP_PKEY_get_bits() and EVP_PKEY_get_security_bits() return a positive number, or 0 if this size isn't available.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/#notes","title":"NOTES","text":"

                                                                                                                                              Most functions that have an output buffer and are mentioned with EVP_PKEY_get_size() have a functionality where you can pass NULL for the buffer and still pass a pointer to an integer and get the exact size that this function call delivers in the context that it's called in. This allows those functions to be called twice, once to find out the exact buffer size, then allocate the buffer in between, and call that function again actually output the data. For those functions, it isn't strictly necessary to call EVP_PKEY_get_size() to find out the buffer size, but may be useful in cases where it's desirable to know the upper limit in advance.

                                                                                                                                              It should also be especially noted that EVP_PKEY_get_size() shouldn't be used to get the output size for EVP_DigestSignFinal(), according to \"NOTES\" in EVP_DigestSignFinal(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_SignFinal(3), EVP_SealInit(3), EVP_PKEY_sign(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_bits(), EVP_PKEY_security_bits(), and EVP_PKEY_size() functions were renamed to include get in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_get_size/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/","title":"EVP_PKEY_gettable_params","text":""},{"location":"man3/EVP_PKEY_gettable_params/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_gettable_params, EVP_PKEY_get_params, EVP_PKEY_get_int_param, EVP_PKEY_get_size_t_param, EVP_PKEY_get_bn_param, EVP_PKEY_get_utf8_string_param, EVP_PKEY_get_octet_string_param - retrieve key parameters from a key

                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nconst OSSL_PARAM *EVP_PKEY_gettable_params(EVP_PKEY *pkey);\nint EVP_PKEY_get_params(const EVP_PKEY *pkey, OSSL_PARAM params[]);\nint EVP_PKEY_get_int_param(const EVP_PKEY *pkey, const char *key_name,\n                           int *out);\nint EVP_PKEY_get_size_t_param(const EVP_PKEY *pkey, const char *key_name,\n                              size_t *out);\nint EVP_PKEY_get_bn_param(const EVP_PKEY *pkey, const char *key_name,\n                          BIGNUM **bn);\nint EVP_PKEY_get_utf8_string_param(const EVP_PKEY *pkey, const char *key_name,\n                                   char *str, size_t max_buf_sz,\n                                   size_t *out_len);\nint EVP_PKEY_get_octet_string_param(const EVP_PKEY *pkey, const char *key_name,\n                                    unsigned char *buf, size_t max_buf_sz,\n                                    size_t *out_len);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#description","title":"DESCRIPTION","text":"

                                                                                                                                              See OSSL_PARAM(3) for information about parameters.

                                                                                                                                              EVP_PKEY_get_params() retrieves parameters from the key pkey, according to the contents of params.

                                                                                                                                              EVP_PKEY_gettable_params() returns a constant list of params indicating the names and types of key parameters that can be retrieved.

                                                                                                                                              An OSSL_PARAM(3) of type OSSL_PARAM_INTEGER or OSSL_PARAM_UNSIGNED_INTEGER is of arbitrary length. Such a parameter can be obtained using any of the functions EVP_PKEY_get_int_param(), EVP_PKEY_get_size_t_param() or EVP_PKEY_get_bn_param(). Attempting to obtain an integer value that does not fit into a native C int type will cause EVP_PKEY_get_int_param() to fail. Similarly attempting to obtain an integer value that is negative or does not fit into a native C size_t type using EVP_PKEY_get_size_t_param() will also fail.

                                                                                                                                              EVP_PKEY_get_int_param() retrieves a key pkey integer value *out associated with a name of key_name if it fits into int type. For parameters that do not fit into int use EVP_PKEY_get_bn_param().

                                                                                                                                              EVP_PKEY_get_size_t_param() retrieves a key pkey size_t value *out associated with a name of key_name if it fits into size_t type. For parameters that do not fit into size_t use EVP_PKEY_get_bn_param().

                                                                                                                                              EVP_PKEY_get_bn_param() retrieves a key pkey BIGNUM value **bn associated with a name of key_name. If *bn is NULL then the BIGNUM is allocated by the method.

                                                                                                                                              EVP_PKEY_get_utf8_string_param() get a key pkey UTF8 string value into a buffer str of maximum size max_buf_sz associated with a name of key_name. The maximum size must be large enough to accommodate the string value including a terminating NUL byte, or this function will fail. If out_len is not NULL, *out_len is set to the length of the string not including the terminating NUL byte. The required buffer size not including the terminating NUL byte can be obtained from *out_len by calling the function with str set to NULL.

                                                                                                                                              EVP_PKEY_get_octet_string_param() get a key pkey's octet string value into a buffer buf of maximum size max_buf_sz associated with a name of key_name. If out_len is not NULL, *out_len is set to the length of the contents. The required buffer size can be obtained from *out_len by calling the function with buf set to NULL.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#notes","title":"NOTES","text":"

                                                                                                                                              These functions only work for EVP_PKEYs that contain a provider side key.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_gettable_params() returns NULL on error or if it is not supported.

                                                                                                                                              All other methods return 1 if a value associated with the key's key_name was successfully returned, or 0 if there was an error. An error may be returned by methods EVP_PKEY_get_utf8_string_param() and EVP_PKEY_get_octet_string_param() if max_buf_sz is not big enough to hold the value. If out_len is not NULL, *out_len will be assigned the required buffer size to hold the value.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#examples","title":"EXAMPLES","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nchar curve_name[64];\nunsigned char pub[256];\nBIGNUM *bn_priv = NULL;\n\n/*\n * NB: assumes 'key' is set up before the next step. In this example the key\n * is an EC key.\n */\n\nif (!EVP_PKEY_get_utf8_string_param(key, OSSL_PKEY_PARAM_GROUP_NAME,\n                                    curve_name, sizeof(curve_name), &len)) {\n  /* Error */\n}\nif (!EVP_PKEY_get_octet_string_param(key, OSSL_PKEY_PARAM_PUB_KEY,\n                                     pub, sizeof(pub), &len)) {\n    /* Error */\n}\nif (!EVP_PKEY_get_bn_param(key, OSSL_PKEY_PARAM_PRIV_KEY, &bn_priv)) {\n    /* Error */\n}\n\nBN_clear_free(bn_priv);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), provider-keymgmt(7), OSSL_PARAM(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_gettable_params/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/","title":"EVP_PKEY_is_a","text":""},{"location":"man3/EVP_PKEY_is_a/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_is_a, EVP_PKEY_can_sign, EVP_PKEY_type_names_do_all, EVP_PKEY_get0_type_name, EVP_PKEY_get0_description, EVP_PKEY_get0_provider - key type and capabilities functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_is_a(const EVP_PKEY *pkey, const char *name);\nint EVP_PKEY_can_sign(const EVP_PKEY *pkey);\nint EVP_PKEY_type_names_do_all(const EVP_PKEY *pkey,\n                               void (*fn)(const char *name, void *data),\n                               void *data);\nconst char *EVP_PKEY_get0_type_name(const EVP_PKEY *key);\nconst char *EVP_PKEY_get0_description(const EVP_PKEY *key);\nconst OSSL_PROVIDER *EVP_PKEY_get0_provider(const EVP_PKEY *key);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_is_a() checks if the key type of pkey is name.

                                                                                                                                              EVP_PKEY_can_sign() checks if the functionality for the key type of pkey supports signing. No other check is done, such as whether pkey contains a private key.

                                                                                                                                              EVP_PKEY_type_names_do_all() traverses all names for pkey's key type, and calls fn with each name and data. For example, an RSA EVP_PKEY may be named both RSA and rsaEncryption. The order of the names depends on the provider implementation that holds the key.

                                                                                                                                              EVP_PKEY_get0_type_name() returns the first key type name that is found for the given pkey. Note that the pkey may have multiple synonyms associated with it. In this case it depends on the provider implementation that holds the key which one will be returned. Ownership of the returned string is retained by the pkey object and should not be freed by the caller.

                                                                                                                                              EVP_PKEY_get0_description() returns a description of the type of EVP_PKEY, meant for display and human consumption. The description is at the discretion of the key type implementation.

                                                                                                                                              EVP_PKEY_get0_provider() returns the provider of the EVP_PKEY's EVP_KEYMGMT(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_is_a() returns 1 if pkey has the key type name, otherwise 0.

                                                                                                                                              EVP_PKEY_can_sign() returns 1 if the pkey key type functionality supports signing, otherwise 0.

                                                                                                                                              EVP_PKEY_get0_type_name() returns the name that is found or NULL on error.

                                                                                                                                              EVP_PKEY_get0_description() returns the description if found or NULL if not.

                                                                                                                                              EVP_PKEY_get0_provider() returns the provider if found or NULL if not.

                                                                                                                                              EVP_PKEY_type_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/#examples","title":"EXAMPLES","text":""},{"location":"man3/EVP_PKEY_is_a/#evp_pkey_is_a_1","title":"EVP_PKEY_is_a()","text":"

                                                                                                                                              The loaded providers and what key types they support will ultimately determine what name is possible to use with EVP_PKEY_is_a(). We do know that the default provider supports RSA, DH, DSA and EC keys, so we can use this as an crude example:

                                                                                                                                              #include <openssl/evp.h>\n\n...\n    /* |pkey| is an EVP_PKEY* */\n    if (EVP_PKEY_is_a(pkey, \"RSA\")) {\n        BIGNUM *modulus = NULL;\n        if (EVP_PKEY_get_bn_param(pkey, \"n\", &modulus))\n            /* do whatever with the modulus */\n        BN_free(modulus);\n    }\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/#evp_pkey_can_sign","title":"EVP_PKEY_can_sign()","text":"
                                                                                                                                              #include <openssl/evp.h>\n\n...\n    /* |pkey| is an EVP_PKEY* */\n    if (!EVP_PKEY_can_sign(pkey)) {\n        fprintf(stderr, \"Not a signing key!\");\n        exit(1);\n    }\n    /* Sign something... */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/#history","title":"HISTORY","text":"

                                                                                                                                              The functions described here were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_is_a/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/","title":"EVP_PKEY_keygen","text":""},{"location":"man3/EVP_PKEY_keygen/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_Q_keygen, EVP_PKEY_keygen_init, EVP_PKEY_paramgen_init, EVP_PKEY_generate, EVP_PKEY_CTX_set_cb, EVP_PKEY_CTX_get_cb, EVP_PKEY_CTX_get_keygen_info, EVP_PKEY_CTX_set_app_data, EVP_PKEY_CTX_get_app_data, EVP_PKEY_gen_cb, EVP_PKEY_paramgen, EVP_PKEY_keygen - key and parameter generation and check functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nEVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq,\n                            const char *type, ...);\n\nint EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_generate(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\nint EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\nint EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);\n\ntypedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);\n\nvoid EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);\nEVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);\n\nint EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);\n\nvoid EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);\nvoid *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#description","title":"DESCRIPTION","text":"

                                                                                                                                              Generating keys is sometimes straight forward, just generate the key's numbers and be done with it. However, there are certain key types that need key parameters, often called domain parameters but not necessarily limited to that, that also need to be generated. In addition to this, the caller may want to set user provided generation parameters that further affect key parameter or key generation, such as the desired key size.

                                                                                                                                              To flexibly allow all that's just been described, key parameter and key generation is divided into an initialization of a key algorithm context, functions to set user provided parameters, and finally the key parameter or key generation function itself.

                                                                                                                                              The key algorithm context must be created using EVP_PKEY_CTX_new(3) or variants thereof, see that manual for details.

                                                                                                                                              EVP_PKEY_keygen_init() initializes a public key algorithm context ctx for a key generation operation.

                                                                                                                                              EVP_PKEY_paramgen_init() is similar to EVP_PKEY_keygen_init() except key parameters are generated.

                                                                                                                                              After initialization, generation parameters may be provided with EVP_PKEY_CTX_ctrl(3) or EVP_PKEY_CTX_set_params(3), or any other function described in those manuals.

                                                                                                                                              EVP_PKEY_generate() performs the generation operation, the resulting key parameters or key are written to *ppkey. If *ppkey is NULL when this function is called, it will be allocated, and should be freed by the caller when no longer useful, using EVP_PKEY_free(3).

                                                                                                                                              EVP_PKEY_paramgen() and EVP_PKEY_keygen() do exactly the same thing as EVP_PKEY_generate(), after checking that the corresponding EVP_PKEY_paramgen_init() or EVP_PKEY_keygen_init() was used to initialize ctx. These are older functions that are kept for backward compatibility. It is safe to use EVP_PKEY_generate() instead.

                                                                                                                                              The function EVP_PKEY_set_cb() sets the key or parameter generation callback to cb. The function EVP_PKEY_CTX_get_cb() returns the key or parameter generation callback.

                                                                                                                                              The function EVP_PKEY_CTX_get_keygen_info() returns parameters associated with the generation operation. If idx is -1 the total number of parameters available is returned. Any non negative value returns the value of that parameter. EVP_PKEY_CTX_gen_keygen_info() with a nonnegative value for idx should only be called within the generation callback.

                                                                                                                                              If the callback returns 0 then the key generation operation is aborted and an error occurs. This might occur during a time consuming operation where a user clicks on a \"cancel\" button.

                                                                                                                                              The functions EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() set and retrieve an opaque pointer. This can be used to set some application defined value which can be retrieved in the callback: for example a handle which is used to update a \"progress dialog\".

                                                                                                                                              EVP_PKEY_Q_keygen() abstracts from the explicit use of EVP_PKEY_CTX while providing a 'quick' but limited way of generating a new asymmetric key pair. It provides shorthands for simple and common cases of key generation. As usual, the library context libctx and property query propq can be given for fetching algorithms from providers. If type is RSA, a size_t parameter must be given to specify the size of the RSA key. If type is EC, a string parameter must be given to specify the name of the EC curve. If type is X25519, X448, ED25519, ED448, or SM2 no further parameter is needed.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_keygen_init(), EVP_PKEY_paramgen_init(), EVP_PKEY_keygen() and EVP_PKEY_paramgen() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              EVP_PKEY_Q_keygen() returns an EVP_PKEY, or NULL on failure.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#notes","title":"NOTES","text":"

                                                                                                                                              After the call to EVP_PKEY_keygen_init() or EVP_PKEY_paramgen_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation.

                                                                                                                                              The functions EVP_PKEY_keygen() and EVP_PKEY_paramgen() can be called more than once on the same context if several operations are performed using the same parameters.

                                                                                                                                              The meaning of the parameters passed to the callback will depend on the algorithm and the specific implementation of the algorithm. Some might not give any useful information at all during key or parameter generation. Others might not even call the callback.

                                                                                                                                              The operation performed by key or parameter generation depends on the algorithm used. In some cases (e.g. EC with a supplied named curve) the \"generation\" option merely sets the appropriate fields in an EVP_PKEY structure.

                                                                                                                                              In OpenSSL an EVP_PKEY structure containing a private key also contains the public key components and parameters (if any). An OpenSSL private key is equivalent to what some libraries call a \"key pair\". A private key can be used in functions which require the use of a public key or parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Generate a 2048 bit RSA key:

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nEVP_PKEY *pkey = NULL;\n\nctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_keygen_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <= 0)\n    /* Error */\n\n/* Generate key */\nif (EVP_PKEY_keygen(ctx, &pkey) <= 0)\n    /* Error */\n

                                                                                                                                              Generate a key from a set of parameters:

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nENGINE *eng;\nEVP_PKEY *pkey = NULL, *param;\n\n/* Assumed param, eng are set up already */\nctx = EVP_PKEY_CTX_new(param, eng);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_keygen_init(ctx) <= 0)\n    /* Error */\n\n/* Generate key */\nif (EVP_PKEY_keygen(ctx, &pkey) <= 0)\n    /* Error */\n

                                                                                                                                              Example of generation callback for OpenSSL public key implementations:

                                                                                                                                              /* Application data is a BIO to output status to */\n\nEVP_PKEY_CTX_set_app_data(ctx, status_bio);\n\nstatic int genpkey_cb(EVP_PKEY_CTX *ctx)\n{\n    char c = '*';\n    BIO *b = EVP_PKEY_CTX_get_app_data(ctx);\n    int p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);\n\n    if (p == 0)\n        c = '.';\n    if (p == 1)\n        c = '+';\n    if (p == 2)\n        c = '*';\n    if (p == 3)\n        c = '\\n';\n    BIO_write(b, &c, 1);\n    (void)BIO_flush(b);\n    return 1;\n}\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_RSA_gen(3), EVP_EC_gen(3), EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#history","title":"HISTORY","text":"

                                                                                                                                              EVP_PKEY_keygen_init(), int EVP_PKEY_paramgen_init(), EVP_PKEY_keygen(), EVP_PKEY_paramgen(), EVP_PKEY_gen_cb(), EVP_PKEY_CTX_set_cb(), EVP_PKEY_CTX_get_cb(), EVP_PKEY_CTX_get_keygen_info(), EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() were added in OpenSSL 1.0.0.

                                                                                                                                              EVP_PKEY_Q_keygen() and EVP_PKEY_generate() were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_keygen/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_get_count/","title":"EVP_PKEY_meth_get_count","text":""},{"location":"man3/EVP_PKEY_meth_get_count/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_meth_get_count, EVP_PKEY_meth_get0, EVP_PKEY_meth_get0_info - enumerate public key methods

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_get_count/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n

                                                                                                                                              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              size_t EVP_PKEY_meth_get_count(void);\nconst EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx);\nvoid EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,\n                             const EVP_PKEY_METHOD *meth);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_get_count/#description","title":"DESCRIPTION","text":"

                                                                                                                                              All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                                                                                                                                              EVP_PKEY_meth_count() returns a count of the number of public key methods available: it includes standard methods and any methods added by the application.

                                                                                                                                              EVP_PKEY_meth_get0() returns the public key method idx. The value of idx must be between zero and EVP_PKEY_meth_get_count() - 1.

                                                                                                                                              EVP_PKEY_meth_get0_info() returns the public key ID (a NID) and any flags associated with the public key method *meth.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_get_count/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_meth_count() returns the number of available public key methods.

                                                                                                                                              EVP_PKEY_meth_get0() return a public key method or NULL if idx is out of range.

                                                                                                                                              EVP_PKEY_meth_get0_info() does not return a value.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_get_count/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_new(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_get_count/#history","title":"HISTORY","text":"

                                                                                                                                              All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_get_count/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/","title":"EVP_PKEY_meth_new","text":""},{"location":"man3/EVP_PKEY_meth_new/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_meth_new, EVP_PKEY_meth_free, EVP_PKEY_meth_copy, EVP_PKEY_meth_find, EVP_PKEY_meth_add0, EVP_PKEY_METHOD, EVP_PKEY_meth_set_init, EVP_PKEY_meth_set_copy, EVP_PKEY_meth_set_cleanup, EVP_PKEY_meth_set_paramgen, EVP_PKEY_meth_set_keygen, EVP_PKEY_meth_set_sign, EVP_PKEY_meth_set_verify, EVP_PKEY_meth_set_verify_recover, EVP_PKEY_meth_set_signctx, EVP_PKEY_meth_set_verifyctx, EVP_PKEY_meth_set_encrypt, EVP_PKEY_meth_set_decrypt, EVP_PKEY_meth_set_derive, EVP_PKEY_meth_set_ctrl, EVP_PKEY_meth_set_digestsign, EVP_PKEY_meth_set_digestverify, EVP_PKEY_meth_set_check, EVP_PKEY_meth_set_public_check, EVP_PKEY_meth_set_param_check, EVP_PKEY_meth_set_digest_custom, EVP_PKEY_meth_get_init, EVP_PKEY_meth_get_copy, EVP_PKEY_meth_get_cleanup, EVP_PKEY_meth_get_paramgen, EVP_PKEY_meth_get_keygen, EVP_PKEY_meth_get_sign, EVP_PKEY_meth_get_verify, EVP_PKEY_meth_get_verify_recover, EVP_PKEY_meth_get_signctx, EVP_PKEY_meth_get_verifyctx, EVP_PKEY_meth_get_encrypt, EVP_PKEY_meth_get_decrypt, EVP_PKEY_meth_get_derive, EVP_PKEY_meth_get_ctrl, EVP_PKEY_meth_get_digestsign, EVP_PKEY_meth_get_digestverify, EVP_PKEY_meth_get_check, EVP_PKEY_meth_get_public_check, EVP_PKEY_meth_get_param_check, EVP_PKEY_meth_get_digest_custom, EVP_PKEY_meth_remove - manipulating EVP_PKEY_METHOD structure

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n

                                                                                                                                              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              typedef struct evp_pkey_method_st EVP_PKEY_METHOD;\n\nEVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);\nvoid EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);\nvoid EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);\nconst EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);\nint EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);\nint EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth);\n\nvoid EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,\n                            int (*init) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,\n                            int (*copy) (EVP_PKEY_CTX *dst,\n                                         const EVP_PKEY_CTX *src));\nvoid EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,\n                               void (*cleanup) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,\n                                int (*paramgen_init) (EVP_PKEY_CTX *ctx),\n                                int (*paramgen) (EVP_PKEY_CTX *ctx,\n                                                 EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,\n                              int (*keygen_init) (EVP_PKEY_CTX *ctx),\n                              int (*keygen) (EVP_PKEY_CTX *ctx,\n                                             EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,\n                            int (*sign_init) (EVP_PKEY_CTX *ctx),\n                            int (*sign) (EVP_PKEY_CTX *ctx,\n                                         unsigned char *sig, size_t *siglen,\n                                         const unsigned char *tbs,\n                                         size_t tbslen));\nvoid EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,\n                              int (*verify_init) (EVP_PKEY_CTX *ctx),\n                              int (*verify) (EVP_PKEY_CTX *ctx,\n                                             const unsigned char *sig,\n                                             size_t siglen,\n                                             const unsigned char *tbs,\n                                             size_t tbslen));\nvoid EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,\n                                      int (*verify_recover_init) (EVP_PKEY_CTX\n                                                                  *ctx),\n                                      int (*verify_recover) (EVP_PKEY_CTX\n                                                             *ctx,\n                                                             unsigned char\n                                                             *sig,\n                                                             size_t *siglen,\n                                                             const unsigned\n                                                             char *tbs,\n                                                             size_t tbslen));\nvoid EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,\n                               int (*signctx_init) (EVP_PKEY_CTX *ctx,\n                                                    EVP_MD_CTX *mctx),\n                               int (*signctx) (EVP_PKEY_CTX *ctx,\n                                               unsigned char *sig,\n                                               size_t *siglen,\n                                               EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,\n                                 int (*verifyctx_init) (EVP_PKEY_CTX *ctx,\n                                                        EVP_MD_CTX *mctx),\n                                 int (*verifyctx) (EVP_PKEY_CTX *ctx,\n                                                   const unsigned char *sig,\n                                                   int siglen,\n                                                   EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,\n                               int (*encrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (*encryptfn) (EVP_PKEY_CTX *ctx,\n                                                 unsigned char *out,\n                                                 size_t *outlen,\n                                                 const unsigned char *in,\n                                                 size_t inlen));\nvoid EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,\n                               int (*decrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (*decrypt) (EVP_PKEY_CTX *ctx,\n                                               unsigned char *out,\n                                               size_t *outlen,\n                                               const unsigned char *in,\n                                               size_t inlen));\nvoid EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,\n                              int (*derive_init) (EVP_PKEY_CTX *ctx),\n                              int (*derive) (EVP_PKEY_CTX *ctx,\n                                             unsigned char *key,\n                                             size_t *keylen));\nvoid EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,\n                            int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,\n                                         void *p2),\n                            int (*ctrl_str) (EVP_PKEY_CTX *ctx,\n                                             const char *type,\n                                             const char *value));\nvoid EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth,\n                                  int (*digestsign) (EVP_MD_CTX *ctx,\n                                                     unsigned char *sig,\n                                                     size_t *siglen,\n                                                     const unsigned char *tbs,\n                                                     size_t tbslen));\nvoid EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth,\n                                    int (*digestverify) (EVP_MD_CTX *ctx,\n                                                         const unsigned char *sig,\n                                                         size_t siglen,\n                                                         const unsigned char *tbs,\n                                                         size_t tbslen));\nvoid EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth,\n                             int (*check) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth,\n                                    int (*check) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth,\n                                   int (*check) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth,\n                                    int (*digest_custom) (EVP_PKEY_CTX *ctx,\n                                                          EVP_MD_CTX *mctx));\n\nvoid EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth,\n                            int (**pinit) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth,\n                            int (**pcopy) (EVP_PKEY_CTX *dst,\n                                           EVP_PKEY_CTX *src));\nvoid EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth,\n                               void (**pcleanup) (EVP_PKEY_CTX *ctx));\nvoid EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth,\n                                int (**pparamgen_init) (EVP_PKEY_CTX *ctx),\n                                int (**pparamgen) (EVP_PKEY_CTX *ctx,\n                                                   EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth,\n                              int (**pkeygen_init) (EVP_PKEY_CTX *ctx),\n                              int (**pkeygen) (EVP_PKEY_CTX *ctx,\n                                               EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth,\n                            int (**psign_init) (EVP_PKEY_CTX *ctx),\n                            int (**psign) (EVP_PKEY_CTX *ctx,\n                                           unsigned char *sig, size_t *siglen,\n                                           const unsigned char *tbs,\n                                           size_t tbslen));\nvoid EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth,\n                              int (**pverify_init) (EVP_PKEY_CTX *ctx),\n                              int (**pverify) (EVP_PKEY_CTX *ctx,\n                                               const unsigned char *sig,\n                                               size_t siglen,\n                                               const unsigned char *tbs,\n                                               size_t tbslen));\nvoid EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth,\n                                      int (**pverify_recover_init) (EVP_PKEY_CTX\n                                                                    *ctx),\n                                      int (**pverify_recover) (EVP_PKEY_CTX\n                                                               *ctx,\n                                                               unsigned char\n                                                               *sig,\n                                                               size_t *siglen,\n                                                               const unsigned\n                                                               char *tbs,\n                                                               size_t tbslen));\nvoid EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth,\n                               int (**psignctx_init) (EVP_PKEY_CTX *ctx,\n                                                      EVP_MD_CTX *mctx),\n                               int (**psignctx) (EVP_PKEY_CTX *ctx,\n                                                 unsigned char *sig,\n                                                 size_t *siglen,\n                                                 EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth,\n                                 int (**pverifyctx_init) (EVP_PKEY_CTX *ctx,\n                                                          EVP_MD_CTX *mctx),\n                                 int (**pverifyctx) (EVP_PKEY_CTX *ctx,\n                                                     const unsigned char *sig,\n                                                     int siglen,\n                                                     EVP_MD_CTX *mctx));\nvoid EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth,\n                               int (**pencrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (**pencryptfn) (EVP_PKEY_CTX *ctx,\n                                                   unsigned char *out,\n                                                   size_t *outlen,\n                                                   const unsigned char *in,\n                                                   size_t inlen));\nvoid EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth,\n                               int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),\n                               int (**pdecrypt) (EVP_PKEY_CTX *ctx,\n                                                 unsigned char *out,\n                                                 size_t *outlen,\n                                                 const unsigned char *in,\n                                                 size_t inlen));\nvoid EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth,\n                              int (**pderive_init) (EVP_PKEY_CTX *ctx),\n                              int (**pderive) (EVP_PKEY_CTX *ctx,\n                                               unsigned char *key,\n                                               size_t *keylen));\nvoid EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth,\n                            int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1,\n                                           void *p2),\n                            int (**pctrl_str) (EVP_PKEY_CTX *ctx,\n                                               const char *type,\n                                               const char *value));\nvoid EVP_PKEY_meth_get_digestsign(const EVP_PKEY_METHOD *pmeth,\n                                  int (**digestsign) (EVP_MD_CTX *ctx,\n                                                      unsigned char *sig,\n                                                      size_t *siglen,\n                                                      const unsigned char *tbs,\n                                                      size_t tbslen));\nvoid EVP_PKEY_meth_get_digestverify(const EVP_PKEY_METHOD *pmeth,\n                                    int (**digestverify) (EVP_MD_CTX *ctx,\n                                                          const unsigned char *sig,\n                                                          size_t siglen,\n                                                          const unsigned char *tbs,\n                                                          size_t tbslen));\nvoid EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth,\n                             int (**pcheck) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth,\n                                    int (**pcheck) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth,\n                                   int (**pcheck) (EVP_PKEY *pkey));\nvoid EVP_PKEY_meth_get_digest_custom(const EVP_PKEY_METHOD *pmeth,\n                                    int (**pdigest_custom) (EVP_PKEY_CTX *ctx,\n                                                            EVP_MD_CTX *mctx));\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                              All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                                                                                                                                              EVP_PKEY_METHOD is a structure which holds a set of methods for a specific public key cryptographic algorithm. Those methods are usually used to perform different jobs, such as generating a key, signing or verifying, encrypting or decrypting, etc.

                                                                                                                                              There are two places where the EVP_PKEY_METHOD objects are stored: one is a built-in static array representing the standard methods for different algorithms, and the other one is a stack of user-defined application-specific methods, which can be manipulated by using EVP_PKEY_meth_add0(3).

                                                                                                                                              The EVP_PKEY_METHOD objects are usually referenced by EVP_PKEY_CTX objects.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/#methods","title":"Methods","text":"

                                                                                                                                              The methods are the underlying implementations of a particular public key algorithm present by the EVP_PKEY_CTX object.

                                                                                                                                              int (*init) (EVP_PKEY_CTX *ctx);\nint (*copy) (EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src);\nvoid (*cleanup) (EVP_PKEY_CTX *ctx);\n

                                                                                                                                              The init() method is called to initialize algorithm-specific data when a new EVP_PKEY_CTX is created. As opposed to init(), the cleanup() method is called when an EVP_PKEY_CTX is freed. The copy() method is called when an EVP_PKEY_CTX is being duplicated. Refer to EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_new_id(3), EVP_PKEY_CTX_free(3) and EVP_PKEY_CTX_dup(3).

                                                                                                                                              int (*paramgen_init) (EVP_PKEY_CTX *ctx);\nint (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);\n

                                                                                                                                              The paramgen_init() and paramgen() methods deal with key parameter generation. They are called by EVP_PKEY_paramgen_init(3) and EVP_PKEY_paramgen(3) to handle the parameter generation process.

                                                                                                                                              int (*keygen_init) (EVP_PKEY_CTX *ctx);\nint (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);\n

                                                                                                                                              The keygen_init() and keygen() methods are used to generate the actual key for the specified algorithm. They are called by EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3).

                                                                                                                                              int (*sign_init) (EVP_PKEY_CTX *ctx);\nint (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\n             const unsigned char *tbs, size_t tbslen);\n

                                                                                                                                              The sign_init() and sign() methods are used to generate the signature of a piece of data using a private key. They are called by EVP_PKEY_sign_init(3) and EVP_PKEY_sign(3).

                                                                                                                                              int (*verify_init) (EVP_PKEY_CTX *ctx);\nint (*verify) (EVP_PKEY_CTX *ctx,\n               const unsigned char *sig, size_t siglen,\n               const unsigned char *tbs, size_t tbslen);\n

                                                                                                                                              The verify_init() and verify() methods are used to verify whether a signature is valid. They are called by EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

                                                                                                                                              int (*verify_recover_init) (EVP_PKEY_CTX *ctx);\nint (*verify_recover) (EVP_PKEY_CTX *ctx,\n                       unsigned char *rout, size_t *routlen,\n                       const unsigned char *sig, size_t siglen);\n

                                                                                                                                              The verify_recover_init() and verify_recover() methods are used to verify a signature and then recover the digest from the signature (for instance, a signature that was generated by RSA signing algorithm). They are called by EVP_PKEY_verify_recover_init(3) and EVP_PKEY_verify_recover(3).

                                                                                                                                              int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);\nint (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,\n                EVP_MD_CTX *mctx);\n

                                                                                                                                              The signctx_init() and signctx() methods are used to sign a digest present by a EVP_MD_CTX object. They are called by the EVP_DigestSign functions. See EVP_DigestSignInit(3) for details.

                                                                                                                                              int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);\nint (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,\n                  EVP_MD_CTX *mctx);\n

                                                                                                                                              The verifyctx_init() and verifyctx() methods are used to verify a signature against the data in a EVP_MD_CTX object. They are called by the various EVP_DigestVerify functions. See EVP_DigestVerifyInit(3) for details.

                                                                                                                                              int (*encrypt_init) (EVP_PKEY_CTX *ctx);\nint (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,\n                const unsigned char *in, size_t inlen);\n

                                                                                                                                              The encrypt_init() and encrypt() methods are used to encrypt a piece of data. They are called by EVP_PKEY_encrypt_init(3) and EVP_PKEY_encrypt(3).

                                                                                                                                              int (*decrypt_init) (EVP_PKEY_CTX *ctx);\nint (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,\n                const unsigned char *in, size_t inlen);\n

                                                                                                                                              The decrypt_init() and decrypt() methods are used to decrypt a piece of data. They are called by EVP_PKEY_decrypt_init(3) and EVP_PKEY_decrypt(3).

                                                                                                                                              int (*derive_init) (EVP_PKEY_CTX *ctx);\nint (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);\n

                                                                                                                                              The derive_init() and derive() methods are used to derive the shared secret from a public key algorithm (for instance, the DH algorithm). They are called by EVP_PKEY_derive_init(3) and EVP_PKEY_derive(3).

                                                                                                                                              int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);\nint (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);\n

                                                                                                                                              The ctrl() and ctrl_str() methods are used to adjust algorithm-specific settings. See EVP_PKEY_CTX_ctrl(3) and related functions for details.

                                                                                                                                              int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,\n                   const unsigned char *tbs, size_t tbslen);\nint (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,\n                     size_t siglen, const unsigned char *tbs,\n                     size_t tbslen);\n

                                                                                                                                              The digestsign() and digestverify() methods are used to generate or verify a signature in a one-shot mode. They could be called by EVP_DigestSign(3) and EVP_DigestVerify(3).

                                                                                                                                              int (*check) (EVP_PKEY *pkey);\nint (*public_check) (EVP_PKEY *pkey);\nint (*param_check) (EVP_PKEY *pkey);\n

                                                                                                                                              The check(), public_check() and param_check() methods are used to validate a key-pair, the public component and parameters respectively for a given pkey. They could be called by EVP_PKEY_check(3), EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) respectively.

                                                                                                                                              int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);\n

                                                                                                                                              The digest_custom() method is used to generate customized digest content before the real message is passed to functions like EVP_DigestSignUpdate(3) or EVP_DigestVerifyInit(3). This is usually required by some public key signature algorithms like SM2 which requires a hashed prefix to the message to be signed. The digest_custom() function will be called by EVP_DigestSignInit(3) and EVP_DigestVerifyInit(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/#functions","title":"Functions","text":"

                                                                                                                                              EVP_PKEY_meth_new() creates and returns a new EVP_PKEY_METHOD object, and associates the given id and flags. The following flags are supported:

                                                                                                                                              EVP_PKEY_FLAG_AUTOARGLEN\nEVP_PKEY_FLAG_SIGCTX_CUSTOM\n

                                                                                                                                              If an EVP_PKEY_METHOD is set with the EVP_PKEY_FLAG_AUTOARGLEN flag, the maximum size of the output buffer will be automatically calculated or checked in corresponding EVP methods by the EVP framework. Thus the implementations of these methods don't need to care about handling the case of returning output buffer size by themselves. For details on the output buffer size, refer to EVP_PKEY_sign(3).

                                                                                                                                              The EVP_PKEY_FLAG_SIGCTX_CUSTOM is used to indicate the signctx() method of an EVP_PKEY_METHOD is always called by the EVP framework while doing a digest signing operation by calling EVP_DigestSignFinal(3).

                                                                                                                                              EVP_PKEY_meth_free() frees an existing EVP_PKEY_METHOD pointed by pmeth. If the argument is NULL, nothing is done.

                                                                                                                                              EVP_PKEY_meth_copy() copies an EVP_PKEY_METHOD object from src to dst.

                                                                                                                                              EVP_PKEY_meth_find() finds an EVP_PKEY_METHOD object with the id. This function first searches through the user-defined method objects and then the built-in objects.

                                                                                                                                              EVP_PKEY_meth_add0() adds pmeth to the user defined stack of methods.

                                                                                                                                              EVP_PKEY_meth_remove() removes an EVP_PKEY_METHOD object added by EVP_PKEY_meth_add0().

                                                                                                                                              The EVP_PKEY_meth_set functions set the corresponding fields of EVP_PKEY_METHOD structure with the arguments passed.

                                                                                                                                              The EVP_PKEY_meth_get functions get the corresponding fields of EVP_PKEY_METHOD structure to the arguments provided.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_meth_new() returns a pointer to a new EVP_PKEY_METHOD object or returns NULL on error.

                                                                                                                                              EVP_PKEY_meth_free() and EVP_PKEY_meth_copy() do not return values.

                                                                                                                                              EVP_PKEY_meth_find() returns a pointer to the found EVP_PKEY_METHOD object or returns NULL if not found.

                                                                                                                                              EVP_PKEY_meth_add0() returns 1 if method is added successfully or 0 if an error occurred.

                                                                                                                                              EVP_PKEY_meth_remove() returns 1 if method is removed successfully or 0 if an error occurred.

                                                                                                                                              All EVP_PKEY_meth_set and EVP_PKEY_meth_get functions have no return values. For the 'get' functions, function pointers are returned by arguments.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                              All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                              The signature of the copy functional argument of EVP_PKEY_meth_set_copy() has changed in OpenSSL 3.0 so its src parameter is now constified.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/","title":"EVP_PKEY_new","text":""},{"location":"man3/EVP_PKEY_new/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY, EVP_PKEY_new, EVP_PKEY_up_ref, EVP_PKEY_dup, EVP_PKEY_free, EVP_PKEY_new_raw_private_key_ex, EVP_PKEY_new_raw_private_key, EVP_PKEY_new_raw_public_key_ex, EVP_PKEY_new_raw_public_key, EVP_PKEY_new_CMAC_key, EVP_PKEY_new_mac_key, EVP_PKEY_get_raw_private_key, EVP_PKEY_get_raw_public_key - public/private key allocation and raw key handling functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\ntypedef evp_pkey_st EVP_PKEY;\n\nEVP_PKEY *EVP_PKEY_new(void);\nint EVP_PKEY_up_ref(EVP_PKEY *key);\nEVP_PKEY *EVP_PKEY_dup(EVP_PKEY *key);\nvoid EVP_PKEY_free(EVP_PKEY *key);\n\nEVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OSSL_LIB_CTX *libctx,\n                                          const char *keytype,\n                                          const char *propq,\n                                          const unsigned char *key,\n                                          size_t keylen);\nEVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e,\n                                       const unsigned char *key, size_t keylen);\nEVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OSSL_LIB_CTX *libctx,\n                                         const char *keytype,\n                                         const char *propq,\n                                         const unsigned char *key,\n                                         size_t keylen);\nEVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e,\n                                      const unsigned char *key, size_t keylen);\nEVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, const unsigned char *key,\n                               int keylen);\n\nint EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv,\n                                 size_t *len);\nint EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub,\n                                size_t *len);\n

                                                                                                                                              The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,\n                                size_t len, const EVP_CIPHER *cipher);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY is a generic structure to hold diverse types of asymmetric keys (also known as \"key pairs\"), and can be used for diverse operations, like signing, verifying signatures, key derivation, etc. The asymmetric keys themselves are often referred to as the \"internal key\", and are handled by backends, such as providers (through EVP_KEYMGMT(3)) or ENGINEs.

                                                                                                                                              Conceptually, an EVP_PKEY internal key may hold a private key, a public key, or both (a keypair), and along with those, key parameters if the key type requires them. The presence of these components determine what operations can be made; for example, signing normally requires the presence of a private key, and verifying normally requires the presence of a public key.

                                                                                                                                              EVP_PKEY has also been used for MAC algorithm that were conceived as producing signatures, although not being public key algorithms; \"POLY1305\", \"SIPHASH\", \"HMAC\", \"CMAC\". This usage is considered legacy and is discouraged in favor of the EVP_MAC(3) API.

                                                                                                                                              The EVP_PKEY_new() function allocates an empty EVP_PKEY structure which is used by OpenSSL to store public and private keys. The reference count is set to 1.

                                                                                                                                              EVP_PKEY_up_ref() increments the reference count of key.

                                                                                                                                              EVP_PKEY_dup() duplicates the key. The key must not be ENGINE based or a raw key, otherwise the duplication will fail.

                                                                                                                                              EVP_PKEY_free() decrements the reference count of key and, if the reference count is zero, frees it up. If key is NULL, nothing is done.

                                                                                                                                              EVP_PKEY_new_raw_private_key_ex() allocates a new EVP_PKEY. Unless an engine should be used for the key type, a provider for the key is found using the library context libctx and the property query string propq. The keytype argument indicates what kind of key this is. The value should be a string for a public key algorithm that supports raw private keys, i.e one of \"X25519\", \"ED25519\", \"X448\" or \"ED448\". key points to the raw private key data for this EVP_PKEY which should be of length keylen. The length should be appropriate for the type of the key. The public key data will be automatically derived from the given private key data (if appropriate for the algorithm type).

                                                                                                                                              EVP_PKEY_new_raw_private_key() does the same as EVP_PKEY_new_raw_private_key_ex() except that the default library context and default property query are used instead. If e is non-NULL then the new EVP_PKEY structure is associated with the engine e. The type argument indicates what kind of key this is. The value should be a NID for a public key algorithm that supports raw private keys, i.e. one of EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

                                                                                                                                              EVP_PKEY_new_raw_private_key_ex() and EVP_PKEY_new_raw_private_key() may also be used with most MACs implemented as public key algorithms, so key types such as \"HMAC\", \"POLY1305\", \"SIPHASH\", or their NID form EVP_PKEY_POLY1305, EVP_PKEY_SIPHASH, EVP_PKEY_HMAC are also accepted. This usage is, as mentioned above, discouraged in favor of the EVP_MAC(3) API.

                                                                                                                                              EVP_PKEY_new_raw_public_key_ex() works in the same way as EVP_PKEY_new_raw_private_key_ex() except that key points to the raw public key data. The EVP_PKEY structure will be initialised without any private key information. Algorithm types that support raw public keys are \"X25519\", \"ED25519\", \"X448\" or \"ED448\".

                                                                                                                                              EVP_PKEY_new_raw_public_key() works in the same way as EVP_PKEY_new_raw_private_key() except that key points to the raw public key data. The EVP_PKEY structure will be initialised without any private key information. Algorithm types that support raw public keys are EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

                                                                                                                                              EVP_PKEY_new_mac_key() works in the same way as EVP_PKEY_new_raw_private_key(). New applications should use EVP_PKEY_new_raw_private_key() instead.

                                                                                                                                              EVP_PKEY_get_raw_private_key() fills the buffer provided by priv with raw private key data. The size of the priv buffer should be in *len on entry to the function, and on exit *len is updated with the number of bytes actually written. If the buffer priv is NULL then *len is populated with the number of bytes required to hold the key. The calling application is responsible for ensuring that the buffer is large enough to receive the private key data. This function only works for algorithms that support raw private keys. Currently this is: EVP_PKEY_HMAC, EVP_PKEY_POLY1305, EVP_PKEY_SIPHASH, EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

                                                                                                                                              EVP_PKEY_get_raw_public_key() fills the buffer provided by pub with raw public key data. The size of the pub buffer should be in *len on entry to the function, and on exit *len is updated with the number of bytes actually written. If the buffer pub is NULL then *len is populated with the number of bytes required to hold the key. The calling application is responsible for ensuring that the buffer is large enough to receive the public key data. This function only works for algorithms that support raw public keys. Currently this is: EVP_PKEY_X25519, EVP_PKEY_ED25519, EVP_PKEY_X448 or EVP_PKEY_ED448.

                                                                                                                                              EVP_PKEY_new_CMAC_key() works in the same way as EVP_PKEY_new_raw_private_key() except it is only for the EVP_PKEY_CMAC algorithm type. In addition to the raw private key data, it also takes a cipher algorithm to be used during creation of a CMAC in the cipher argument. The cipher should be a standard encryption-only cipher. For example AEAD and XTS ciphers should not be used.

                                                                                                                                              Applications should use the EVP_MAC(3) API instead and set the OSSL_MAC_PARAM_CIPHER parameter on the EVP_MAC_CTX object with the name of the cipher being used.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/#notes","title":"NOTES","text":"

                                                                                                                                              The EVP_PKEY structure is used by various OpenSSL functions which require a general private key without reference to any particular algorithm.

                                                                                                                                              The structure returned by EVP_PKEY_new() is empty. To add a private or public key to this empty structure use the appropriate functions described in EVP_PKEY_set1_RSA(3), EVP_PKEY_set1_DSA(3), EVP_PKEY_set1_DH(3) or EVP_PKEY_set1_EC_KEY(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_new(), EVP_PKEY_new_raw_private_key(), EVP_PKEY_new_raw_public_key(), EVP_PKEY_new_CMAC_key() and EVP_PKEY_new_mac_key() return either the newly allocated EVP_PKEY structure or NULL if an error occurred.

                                                                                                                                              EVP_PKEY_dup() returns the key duplicate or NULL if an error occurred.

                                                                                                                                              EVP_PKEY_up_ref(), EVP_PKEY_get_raw_private_key() and EVP_PKEY_get_raw_public_key() return 1 for success and 0 for failure.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_set1_RSA(3), EVP_PKEY_set1_DSA(3), EVP_PKEY_set1_DH(3) or EVP_PKEY_set1_EC_KEY(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_new() and EVP_PKEY_free() functions exist in all versions of OpenSSL.

                                                                                                                                              The EVP_PKEY_up_ref() function was added in OpenSSL 1.1.0.

                                                                                                                                              The EVP_PKEY_new_raw_private_key(), EVP_PKEY_new_raw_public_key(), EVP_PKEY_new_CMAC_key(), EVP_PKEY_new_raw_private_key() and EVP_PKEY_get_raw_public_key() functions were added in OpenSSL 1.1.1.

                                                                                                                                              The EVP_PKEY_dup(), EVP_PKEY_new_raw_private_key_ex(), and EVP_PKEY_new_raw_public_key_ex() functions were added in OpenSSL 3.0.

                                                                                                                                              The EVP_PKEY_new_CMAC_key() was deprecated in OpenSSL 3.0.

                                                                                                                                              The documentation of EVP_PKEY was amended in OpenSSL 3.0 to allow there to be the private part of the keypair without the public part, where this was previously implied to be disallowed.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/","title":"EVP_PKEY_print_private","text":""},{"location":"man3/EVP_PKEY_print_private/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params, EVP_PKEY_print_public_fp, EVP_PKEY_print_private_fp, EVP_PKEY_print_params_fp - public key algorithm printing routines

                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,\n                          int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_public_fp(FILE *fp, const EVP_PKEY *pkey,\n                             int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,\n                           int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_private_fp(FILE *fp, const EVP_PKEY *pkey,\n                              int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,\n                          int indent, ASN1_PCTX *pctx);\nint EVP_PKEY_print_params_fp(FILE *fp, const EVP_PKEY *pkey,\n                             int indent, ASN1_PCTX *pctx);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The functions EVP_PKEY_print_public(), EVP_PKEY_print_private() and EVP_PKEY_print_params() print out the public, private or parameter components of key pkey respectively. The key is sent to BIO out in human readable form. The parameter indent indicates how far the printout should be indented.

                                                                                                                                              The pctx parameter allows the print output to be finely tuned by using ASN1 printing options. If pctx is set to NULL then default values will be used.

                                                                                                                                              The functions EVP_PKEY_print_public_fp(), EVP_PKEY_print_private_fp() and EVP_PKEY_print_params_fp() do the same as the BIO based functions but use FILE fp instead.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/#notes","title":"NOTES","text":"

                                                                                                                                              Currently no public key algorithms include any options in the pctx parameter.

                                                                                                                                              If the key does not include all the components indicated by the function then only those contained in the key will be printed. For example passing a public key to EVP_PKEY_print_private() will only print the public components.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              These functions all return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_keygen(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/#history","title":"HISTORY","text":"

                                                                                                                                              The functions EVP_PKEY_print_public(), EVP_PKEY_print_private(), and EVP_PKEY_print_params() were added in OpenSSL 1.0.0.

                                                                                                                                              The functions EVP_PKEY_print_public_fp(), EVP_PKEY_print_private_fp(), and EVP_PKEY_print_params_fp() were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_print_private/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/","title":"EVP_PKEY_set1_RSA","text":""},{"location":"man3/EVP_PKEY_set1_RSA/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY, EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY, EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY, EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY, EVP_PKEY_assign_POLY1305, EVP_PKEY_assign_SIPHASH, EVP_PKEY_get0_hmac, EVP_PKEY_get0_poly1305, EVP_PKEY_get0_siphash, EVP_PKEY_get0, EVP_PKEY_type, EVP_PKEY_get_id, EVP_PKEY_get_base_id, EVP_PKEY_set1_engine, EVP_PKEY_get0_engine, EVP_PKEY_id, EVP_PKEY_base_id - EVP_PKEY assignment functions

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_get_id(const EVP_PKEY *pkey);\nint EVP_PKEY_get_base_id(const EVP_PKEY *pkey);\nint EVP_PKEY_type(int type);\n\n#define EVP_PKEY_id EVP_PKEY_get_id\n#define EVP_PKEY_base_id EVP_PKEY_get_base_id\n

                                                                                                                                              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key);\nint EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key);\nint EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key);\nint EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);\n\nRSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);\nDSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);\nDH *EVP_PKEY_get1_DH(EVP_PKEY *pkey);\nEC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);\n\nconst unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len);\nconst unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len);\nconst unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len);\nconst RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey);\nconst DSA *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey);\nconst DH *EVP_PKEY_get0_DH(const EVP_PKEY *pkey);\nconst EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey);\nvoid *EVP_PKEY_get0(const EVP_PKEY *pkey);\n\nint EVP_PKEY_assign_RSA(EVP_PKEY *pkey, RSA *key);\nint EVP_PKEY_assign_DSA(EVP_PKEY *pkey, DSA *key);\nint EVP_PKEY_assign_DH(EVP_PKEY *pkey, DH *key);\nint EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);\nint EVP_PKEY_assign_POLY1305(EVP_PKEY *pkey, ASN1_OCTET_STRING *key);\nint EVP_PKEY_assign_SIPHASH(EVP_PKEY *pkey, ASN1_OCTET_STRING *key);\n\nENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey);\nint EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *engine);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_get_base_id() returns the type of pkey. For example an RSA key will return EVP_PKEY_RSA.

                                                                                                                                              EVP_PKEY_get_id() returns the actual NID associated with pkey only if the pkey type isn't implemented just in a provider(7). Historically keys using the same algorithm could use different NIDs. For example an RSA key could use the NIDs corresponding to the NIDs NID_rsaEncryption (equivalent to EVP_PKEY_RSA) or NID_rsa (equivalent to EVP_PKEY_RSA2). The use of alternative non-standard NIDs is now rare so EVP_PKEY_RSA2 et al are not often seen in practice. EVP_PKEY_get_id() returns -1 (EVP_PKEY_KEYMGMT) if the pkey is only implemented in a provider(7).

                                                                                                                                              EVP_PKEY_type() returns the underlying type of the NID type. For example EVP_PKEY_type(EVP_PKEY_RSA2) will return EVP_PKEY_RSA.

                                                                                                                                              EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and EVP_PKEY_set1_EC_KEY() set the key referenced by pkey to key. These functions are deprecated. Applications should instead use EVP_PKEY_fromdata(3).

                                                                                                                                              EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), EVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() set the referenced key to key however these use the supplied key internally and so key will be freed when the parent pkey is freed. These macros are deprecated. Applications should instead read an EVP_PKEY directly using the OSSL_DECODER APIs (see OSSL_DECODER_CTX_new_for_pkey(3)), or construct an EVP_PKEY from data using EVP_PKEY_fromdata(3).

                                                                                                                                              EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() return the referenced key in pkey or NULL if the key is not of the correct type. The returned key must be freed after use. These functions are deprecated. Applications should instead use the EVP_PKEY directly where possible. If access to the low level key parameters is required then applications should use EVP_PKEY_get_params(3) and other similar functions. To write an EVP_PKEY out use the OSSL_ENCODER APIs (see OSSL_ENCODER_CTX_new_for_pkey(3)).

                                                                                                                                              EVP_PKEY_get0_hmac(), EVP_PKEY_get0_poly1305(), EVP_PKEY_get0_siphash(), EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() and EVP_PKEY_get0_EC_KEY() return the referenced key in pkey or NULL if the key is not of the correct type. The reference count of the returned key is not incremented and so the key must not be freed after use. These functions are deprecated. Applications should instead use the EVP_PKEY directly where possible. If access to the low level key parameters is required then applications should use EVP_PKEY_get_params(3) and other similar functions. To write an EVP_PKEY out use the OSSL_ENCODER APIs (see OSSL_ENCODER_CTX_new_for_pkey(3)). EVP_PKEY_get0() returns a pointer to the legacy key or NULL if the key is not legacy.

                                                                                                                                              Note that if an EVP_PKEY was not constructed using one of the deprecated functions such as EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() or EVP_PKEY_set1_EC_KEY(), or via the similarly named EVP_PKEY_assign macros described above then the internal key will be managed by a provider (see provider(7)). In that case the key returned by EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH(), EVP_PKEY_get1_EC_KEY(), EVP_PKEY_get0_hmac(), EVP_PKEY_get0_poly1305(), EVP_PKEY_get0_siphash(), EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() or EVP_PKEY_get0_EC_KEY() will be a cached copy of the provider's key. Subsequent updates to the provider's key will not be reflected back in the cached copy, and updates made by an application to the returned key will not be reflected back in the provider's key. Subsequent calls to EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() will always return the cached copy returned by the first call.

                                                                                                                                              EVP_PKEY_get0_engine() returns a reference to the ENGINE handling pkey. This function is deprecated. Applications should use providers instead of engines (see provider(7) for details).

                                                                                                                                              EVP_PKEY_set1_engine() sets the ENGINE handling pkey to engine. It must be called after the key algorithm and components are set up. If engine does not include an EVP_PKEY_METHOD for pkey an error occurs. This function is deprecated. Applications should use providers instead of engines (see provider(7) for details).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#warnings","title":"WARNINGS","text":"

                                                                                                                                              The following functions are only reliable with EVP_PKEYs that have been assigned an internal key with EVP_PKEY_assign_*():

                                                                                                                                              EVP_PKEY_get_id(), EVP_PKEY_get_base_id(), EVP_PKEY_type()

                                                                                                                                              For EVP_PKEY key type checking purposes, EVP_PKEY_is_a(3) is more generic.

                                                                                                                                              For purposes of retrieving the name of the EVP_PKEY the function EVP_PKEY_get0_type_name(3) is more generally useful.

                                                                                                                                              The keys returned from the functions EVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() and EVP_PKEY_get0_EC_KEY() were changed to have a \"const\" return type in OpenSSL 3.0. As described above the keys returned may be cached copies of the key held in a provider. Due to this, and unlike in earlier versions of OpenSSL, they should be considered read-only copies of the key. Updates to these keys will not be reflected back in the provider side key. The EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() functions were not changed to have a \"const\" return type in order that applications can \"free\" the return value. However applications should still consider them as read-only copies.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#notes","title":"NOTES","text":"

                                                                                                                                              In accordance with the OpenSSL naming convention the key obtained from or assigned to the pkey using the 1 functions must be freed as well as pkey.

                                                                                                                                              EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), EVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() are implemented as macros.

                                                                                                                                              EVP_PKEY_assign_EC_KEY() looks at the curve name id to determine if the passed EC_KEY is an SM2(7) key, and will set the EVP_PKEY type to EVP_PKEY_SM2 in that case, instead of EVP_PKEY_EC.

                                                                                                                                              Most applications wishing to know a key type will simply call EVP_PKEY_get_base_id() and will not care about the actual type: which will be identical in almost all cases.

                                                                                                                                              Previous versions of this document suggested using EVP_PKEY_type(pkey->type) to determine the type of a key. Since EVP_PKEY is now opaque this is no longer possible: the equivalent is EVP_PKEY_get_base_id(pkey).

                                                                                                                                              EVP_PKEY_set1_engine() is typically used by an ENGINE returning an HSM key as part of its routine to load a private key.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_set1_RSA(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_DH() and EVP_PKEY_set1_EC_KEY() return 1 for success or 0 for failure.

                                                                                                                                              EVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and EVP_PKEY_get1_EC_KEY() return the referenced key or NULL if an error occurred.

                                                                                                                                              EVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), EVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() return 1 for success and 0 for failure.

                                                                                                                                              EVP_PKEY_get_base_id(), EVP_PKEY_get_id() and EVP_PKEY_type() return a key type or NID_undef (equivalently EVP_PKEY_NONE) on error.

                                                                                                                                              EVP_PKEY_set1_engine() returns 1 for success and 0 for failure.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_new(3), SM2(7)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_id() and EVP_PKEY_base_id() functions were renamed to include get in their names in OpenSSL 3.0, respectively. The old names are kept as non-deprecated alias macros.

                                                                                                                                              EVP_PKEY_set1_RSA, EVP_PKEY_set1_DSA, EVP_PKEY_set1_DH, EVP_PKEY_set1_EC_KEY, EVP_PKEY_get1_RSA, EVP_PKEY_get1_DSA, EVP_PKEY_get1_DH, EVP_PKEY_get1_EC_KEY, EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY, EVP_PKEY_assign_RSA, EVP_PKEY_assign_DSA, EVP_PKEY_assign_DH, EVP_PKEY_assign_EC_KEY, EVP_PKEY_assign_POLY1305, EVP_PKEY_assign_SIPHASH, EVP_PKEY_get0_hmac, EVP_PKEY_get0_poly1305, EVP_PKEY_get0_siphash, EVP_PKEY_set1_engine and EVP_PKEY_get0_engine were deprecated in OpenSSL 3.0.

                                                                                                                                              The return value from EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, EVP_PKEY_get0_DH, EVP_PKEY_get0_EC_KEY were made const in OpenSSL 3.0.

                                                                                                                                              The function EVP_PKEY_set_alias_type() was previously documented on this page. It was removed in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_RSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/","title":"EVP_PKEY_set1_encoded_public_key","text":""},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_set1_encoded_public_key, EVP_PKEY_get1_encoded_public_key, EVP_PKEY_set1_tls_encodedpoint, EVP_PKEY_get1_tls_encodedpoint - functions to set and get public key data within an EVP_PKEY

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_set1_encoded_public_key(EVP_PKEY *pkey,\n                                     const unsigned char *pub, size_t publen);\n\nsize_t EVP_PKEY_get1_encoded_public_key(EVP_PKEY *pkey, unsigned char **ppub);\n

                                                                                                                                              The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                              int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey,\n                                   const unsigned char *pt, size_t ptlen);\n\nsize_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_set1_encoded_public_key() can be used to set the public key value within an existing EVP_PKEY object. For the built-in OpenSSL algorithms this currently only works for those that support key exchange. Parameters are not set as part of this operation, so typically an application will create an EVP_PKEY first, set the parameters on it, and then call this function. For example setting the parameters might be done using EVP_PKEY_copy_parameters(3).

                                                                                                                                              The format for the encoded public key will depend on the algorithm in use. For DH it should be encoded as a positive integer in big-endian form. For EC is should be a point conforming to Sec. 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. For X25519 and X448 it should be encoded in a format as defined by RFC7748.

                                                                                                                                              The key to be updated is supplied in pkey. The buffer containing the encoded key is pointed to be pub. The length of the buffer is supplied in publen.

                                                                                                                                              EVP_PKEY_get1_encoded_public_key() does the equivalent operation except that the encoded public key is returned to the application. The key containing the public key data is supplied in pkey. A buffer containing the encoded key will be allocated and stored in *ppub. The length of the encoded public key is returned by the function. The application is responsible for freeing the allocated buffer.

                                                                                                                                              The macro EVP_PKEY_set1_tls_encodedpoint() is deprecated and simply calls EVP_PKEY_set1_encoded_public_key() with all the same arguments. New applications should use EVP_PKEY_set1_encoded_public_key() instead.

                                                                                                                                              The macro EVP_PKEY_get1_tls_encodedpoint() is deprecated and simply calls EVP_PKEY_get1_encoded_public_key() with all the same arguments. New applications should use EVP_PKEY_get1_encoded_public_key() instead.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_set1_encoded_public_key() returns 1 for success and 0 or a negative value for failure.

                                                                                                                                              EVP_PKEY_get1_encoded_public_key() returns the length of the encoded key or 0 for failure.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#examples","title":"EXAMPLES","text":"

                                                                                                                                              See EVP_PKEY_derive_init(3) and EVP_PKEY_derive(3) for information about performing a key exchange operation.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#set-up-a-peers-evp_pkey-ready-for-a-key-exchange-operation","title":"Set up a peer's EVP_PKEY ready for a key exchange operation","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint exchange(EVP_PKEY *ourkey, unsigned char *peer_pub, size_t peer_pub_len)\n{\n    EVP_PKEY *peerkey = EVP_PKEY_new();\n\n    if (peerkey == NULL || EVP_PKEY_copy_parameters(peerkey, ourkey) <= 0)\n        return 0;\n\n    if (EVP_PKEY_set1_encoded_public_key(peerkey, peer_pub,\n                                         peer_pub_len) <= 0)\n        return 0;\n\n    /* Do the key exchange here */\n\n    EVP_PKEY_free(peerkey);\n\n    return 1;\n}\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#get-an-encoded-public-key-to-send-to-a-peer","title":"Get an encoded public key to send to a peer","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint get_encoded_pub_key(EVP_PKEY *ourkey)\n{\n    unsigned char *pubkey;\n    size_t pubkey_len;\n\n   pubkey_len = EVP_PKEY_get1_encoded_public_key(ourkey, &pubkey);\n   if (pubkey_len == 0)\n       return 0;\n\n   /*\n    * Send the encoded public key stored in the buffer at \"pubkey\" and of\n    * length pubkey_len, to the peer.\n    */\n\n   OPENSSL_free(pubkey);\n   return 1;\n}\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_new(3), EVP_PKEY_copy_parameters(3), EVP_PKEY_derive_init(3), EVP_PKEY_derive(3), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#history","title":"HISTORY","text":"

                                                                                                                                              EVP_PKEY_set1_encoded_public_key() and EVP_PKEY_get1_encoded_public_key() were added in OpenSSL 3.0.

                                                                                                                                              EVP_PKEY_set1_tls_encodedpoint() and EVP_PKEY_get1_tls_encodedpoint() were deprecated in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set1_encoded_public_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set_type/","title":"EVP_PKEY_set_type","text":""},{"location":"man3/EVP_PKEY_set_type/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_set_type, EVP_PKEY_set_type_str, EVP_PKEY_set_type_by_keymgmt - functions to change the EVP_PKEY type

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set_type/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_set_type(EVP_PKEY *pkey, int type);\nint EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);\nint EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_set_type/#description","title":"DESCRIPTION","text":"

                                                                                                                                              All the functions described here behave the same in so far that they clear all the previous key data and methods from pkey, and reset it to be of the type of key given by the different arguments. If pkey is NULL, these functions will still return the same return values as if it wasn't.

                                                                                                                                              EVP_PKEY_set_type() initialises pkey to contain an internal legacy key. When doing this, it finds a EVP_PKEY_ASN1_METHOD(3) corresponding to type, and associates pkey with the findings. It is an error if no EVP_PKEY_ASN1_METHOD(3) could be found for type.

                                                                                                                                              EVP_PKEY_set_type_str() initialises pkey to contain an internal legacy key. When doing this, it finds a EVP_PKEY_ASN1_METHOD(3) corresponding to str that has then length len, and associates pkey with the findings. It is an error if no EVP_PKEY_ASN1_METHOD(3) could be found for type.

                                                                                                                                              For both EVP_PKEY_set_type() and EVP_PKEY_set_type_str(), pkey gets a numeric type, which can be retrieved with EVP_PKEY_get_id(3). This numeric type is taken from the EVP_PKEY_ASN1_METHOD(3) that was found, and is equal to or closely related to type in the case of EVP_PKEY_set_type(), or related to str in the case of EVP_PKEY_set_type_str().

                                                                                                                                              EVP_PKEY_set_type_by_keymgmt() initialises pkey to contain an internal provider side key. When doing this, it associates pkey with keymgmt. For keys initialised like this, the numeric type retrieved with EVP_PKEY_get_id(3) will always be EVP_PKEY_NONE.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set_type/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              All functions described here return 1 if successful, or 0 on error.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set_type/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_assign(3), EVP_PKEY_get_id(3), EVP_PKEY_get0_RSA(3), EVP_PKEY_copy_parameters(3), EVP_PKEY_ASN1_METHOD(3), EVP_KEYMGMT(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_set_type/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/","title":"EVP_PKEY_settable_params","text":""},{"location":"man3/EVP_PKEY_settable_params/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_settable_params, EVP_PKEY_set_params, EVP_PKEY_set_int_param, EVP_PKEY_set_size_t_param, EVP_PKEY_set_bn_param, EVP_PKEY_set_utf8_string_param, EVP_PKEY_set_octet_string_param - set key parameters into a key

                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nconst OSSL_PARAM *EVP_PKEY_settable_params(const EVP_PKEY *pkey);\nint EVP_PKEY_set_params(EVP_PKEY *pkey, OSSL_PARAM params[]);\nint EVP_PKEY_set_int_param(EVP_PKEY *pkey, const char *key_name, int in);\nint EVP_PKEY_set_size_t_param(EVP_PKEY *pkey, const char *key_name, size_t in);\nint EVP_PKEY_set_bn_param(EVP_PKEY *pkey, const char *key_name,\n                          const BIGNUM *bn);\nint EVP_PKEY_set_utf8_string_param(EVP_PKEY *pkey, const char *key_name,\n                                   const char *str);\nint EVP_PKEY_set_octet_string_param(EVP_PKEY *pkey, const char *key_name,\n                                    const unsigned char *buf, size_t bsize);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/#description","title":"DESCRIPTION","text":"

                                                                                                                                              These functions can be used to set additional parameters into an existing EVP_PKEY.

                                                                                                                                              EVP_PKEY_set_params() sets one or more params into a pkey. See OSSL_PARAM(3) for information about parameters.

                                                                                                                                              EVP_PKEY_settable_params() returns a constant list of params indicating the names and types of key parameters that can be set. See OSSL_PARAM(3) for information about parameters.

                                                                                                                                              EVP_PKEY_set_int_param() sets an integer value in into a key pkey for the associated field key_name.

                                                                                                                                              EVP_PKEY_set_size_t_param() sets an size_t value in into a key pkey for the associated field key_name.

                                                                                                                                              EVP_PKEY_set_bn_param() sets the BIGNUM value bn into a key pkey for the associated field key_name.

                                                                                                                                              EVP_PKEY_set_utf8_string_param() sets the UTF8 string str into a key pkey for the associated field key_name.

                                                                                                                                              EVP_PKEY_set_octet_string_param() sets the octet string value buf with a size bsize into a key pkey for the associated field key_name.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/#notes","title":"NOTES","text":"

                                                                                                                                              These functions only work for EVP_PKEYs that contain a provider side key.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_settable_params() returns NULL on error or if it is not supported,

                                                                                                                                              All other methods return 1 if a value was successfully set, or 0 if there was an error.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_gettable_params(3), EVP_PKEY_CTX_new(3), provider-keymgmt(7), OSSL_PARAM(3),

                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_settable_params/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/","title":"EVP_PKEY_sign","text":""},{"location":"man3/EVP_PKEY_sign/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_sign_init, EVP_PKEY_sign_init_ex, EVP_PKEY_sign - sign using a public key algorithm

                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_sign_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_sign(EVP_PKEY_CTX *ctx,\n                  unsigned char *sig, size_t *siglen,\n                  const unsigned char *tbs, size_t tbslen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_sign_init() initializes a public key algorithm context ctx for signing using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_SIGNATURE method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

                                                                                                                                              EVP_PKEY_sign_init_ex() is the same as EVP_PKEY_sign_init() but additionally sets the passed parameters params on the context before returning.

                                                                                                                                              The EVP_PKEY_sign() function performs a public key signing operation using ctx. The data to be signed is specified using the tbs and tbslen parameters. If sig is NULL then the maximum size of the output buffer is written to the siglen parameter. If sig is not NULL then before the call the siglen parameter should contain the length of the sig buffer, if the call is successful the signature is written to sig and the amount of data written to siglen.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#notes","title":"NOTES","text":"

                                                                                                                                              EVP_PKEY_sign() does not hash the data to be signed, and therefore is normally used to sign digests. For signing arbitrary messages, see the EVP_DigestSignInit(3) and EVP_SignInit(3) signing interfaces instead.

                                                                                                                                              After the call to EVP_PKEY_sign_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation (see EVP_PKEY_CTX_ctrl(3)).

                                                                                                                                              The function EVP_PKEY_sign() can be called more than once on the same context if several operations are performed using the same parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_sign_init() and EVP_PKEY_sign() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Sign data using RSA with PKCS#1 padding and SHA256 digest:

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\n/* md is a SHA-256 digest in this example. */\nunsigned char *md, *sig;\nsize_t mdlen = 32, siglen;\nEVP_PKEY *signing_key;\n\n/*\n * NB: assumes signing_key and md are set up before the next\n * step. signing_key must be an RSA private key and md must\n * point to the SHA-256 digest to be signed.\n */\nctx = EVP_PKEY_CTX_new(signing_key, NULL /* no engine */);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_sign_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0)\n    /* Error */\n\nsig = OPENSSL_malloc(siglen);\n\nif (!sig)\n    /* malloc failure */\n\nif (EVP_PKEY_sign(ctx, sig, &siglen, md, mdlen) <= 0)\n    /* Error */\n\n/* Signature is siglen bytes written to buffer sig */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_sign_init() and EVP_PKEY_sign() functions were added in OpenSSL 1.0.0.

                                                                                                                                              The EVP_PKEY_sign_init_ex() function was added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/","title":"EVP_PKEY_todata","text":""},{"location":"man3/EVP_PKEY_todata/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_todata, EVP_PKEY_export - functions to return keys as an array of key parameters

                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_todata(const EVP_PKEY *pkey, int selection, OSSL_PARAM **params);\nint EVP_PKEY_export(const EVP_PKEY *pkey, int selection,\n                    OSSL_CALLBACK *export_cb, void *export_cbarg);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The functions described here are used to extract EVP_PKEY key values as an array of OSSL_PARAM(3).

                                                                                                                                              EVP_PKEY_todata() extracts values from a key pkey using the selection. selection is described in \"Selections\" in EVP_PKEY_fromdata(3). OSSL_PARAM_free(3) should be used to free the returned parameters in *params.

                                                                                                                                              EVP_PKEY_export() is similar to EVP_PKEY_todata() but uses a callback export_cb that gets passed the value of export_cbarg. See openssl-core.h(7) for more information about the callback. Note that the OSSL_PARAM(3) array that is passed to the callback is not persistent after the callback returns. The user must preserve the items of interest, or use EVP_PKEY_todata() if persistence is required.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/#notes","title":"NOTES","text":"

                                                                                                                                              These functions only work with key management methods coming from a provider. This is the mirror function to EVP_PKEY_fromdata(3).

                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_todata() and EVP_PKEY_export() return 1 for success and 0 for failure.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              OSSL_PARAM(3), openssl-core.h(7), EVP_PKEY_fromdata(3), EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-EC(7), EVP_PKEY-ED448(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), EVP_PKEY-ED25519(7)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/#history","title":"HISTORY","text":"

                                                                                                                                              These functions were added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_todata/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/","title":"EVP_PKEY_verify","text":""},{"location":"man3/EVP_PKEY_verify/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_verify_init, EVP_PKEY_verify_init_ex, EVP_PKEY_verify - signature verification using a public key algorithm

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_verify_init_ex(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[]);\nint EVP_PKEY_verify(EVP_PKEY_CTX *ctx,\n                    const unsigned char *sig, size_t siglen,\n                    const unsigned char *tbs, size_t tbslen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_verify_init() initializes a public key algorithm context ctx for signing using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_SIGNATURE method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

                                                                                                                                              EVP_PKEY_verify_init_ex() is the same as EVP_PKEY_verify_init() but additionally sets the passed parameters params on the context before returning.

                                                                                                                                              The EVP_PKEY_verify() function performs a public key verification operation using ctx. The signature is specified using the sig and siglen parameters. The verified data (i.e. the data believed originally signed) is specified using the tbs and tbslen parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#notes","title":"NOTES","text":"

                                                                                                                                              After the call to EVP_PKEY_verify_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation.

                                                                                                                                              The function EVP_PKEY_verify() can be called more than once on the same context if several operations are performed using the same parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_verify_init() and EVP_PKEY_verify() return 1 if the verification was successful and 0 if it failed. Unlike other functions the return value 0 from EVP_PKEY_verify() only indicates that the signature did not verify successfully (that is tbs did not match the original data or the signature was of invalid form) it is not an indication of a more serious error.

                                                                                                                                              A negative value indicates an error other that signature verification failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Verify signature using PKCS#1 and SHA256 digest:

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nunsigned char *md, *sig;\nsize_t mdlen, siglen;\nEVP_PKEY *verify_key;\n\n/*\n * NB: assumes verify_key, sig, siglen md and mdlen are already set up\n * and that verify_key is an RSA public key\n */\nctx = EVP_PKEY_CTX_new(verify_key, NULL /* no engine */);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_verify_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)\n    /* Error */\n\n/* Perform operation */\nret = EVP_PKEY_verify(ctx, sig, siglen, md, mdlen);\n\n/*\n * ret == 1 indicates success, 0 verify failure and < 0 for some\n * other error.\n */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_verify_init() and EVP_PKEY_verify() functions were added in OpenSSL 1.0.0.

                                                                                                                                              The EVP_PKEY_verify_init_ex() function was added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/","title":"EVP_PKEY_verify_recover","text":""},{"location":"man3/EVP_PKEY_verify_recover/#name","title":"NAME","text":"

                                                                                                                                              EVP_PKEY_verify_recover_init, EVP_PKEY_verify_recover_init_ex, EVP_PKEY_verify_recover - recover signature using a public key algorithm

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\nint EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);\nint EVP_PKEY_verify_recover_init_ex(EVP_PKEY_CTX *ctx,\n                                    const OSSL_PARAM params[]);\nint EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,\n                            unsigned char *rout, size_t *routlen,\n                            const unsigned char *sig, size_t siglen);\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#description","title":"DESCRIPTION","text":"

                                                                                                                                              EVP_PKEY_verify_recover_init() initializes a public key algorithm context ctx for signing using the algorithm given when the context was created using EVP_PKEY_CTX_new(3) or variants thereof. The algorithm is used to fetch a EVP_SIGNATURE method implicitly, see \"Implicit fetch\" in provider(7) for more information about implicit fetches.

                                                                                                                                              EVP_PKEY_verify_recover_init_ex() is the same as EVP_PKEY_verify_recover_init() but additionally sets the passed parameters params on the context before returning.

                                                                                                                                              The EVP_PKEY_verify_recover() function recovers signed data using ctx. The signature is specified using the sig and siglen parameters. If rout is NULL then the maximum size of the output buffer is written to the routlen parameter. If rout is not NULL then before the call the routlen parameter should contain the length of the rout buffer, if the call is successful recovered data is written to rout and the amount of data written to routlen.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#notes","title":"NOTES","text":"

                                                                                                                                              Normally an application is only interested in whether a signature verification 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 signing operation. Only certain public key algorithms can recover a signature in this way (for example RSA in PKCS padding mode).

                                                                                                                                              After the call to EVP_PKEY_verify_recover_init() algorithm specific control operations can be performed to set any appropriate parameters for the operation.

                                                                                                                                              The function EVP_PKEY_verify_recover() can be called more than once on the same context if several operations are performed using the same parameters.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                              EVP_PKEY_verify_recover_init() and EVP_PKEY_verify_recover() return 1 for success and 0 or a negative value for failure. In particular a return value of -2 indicates the operation is not supported by the public key algorithm.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#examples","title":"EXAMPLES","text":"

                                                                                                                                              Recover digest originally signed using PKCS#1 and SHA256 digest:

                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/rsa.h>\n\nEVP_PKEY_CTX *ctx;\nunsigned char *rout, *sig;\nsize_t routlen, siglen;\nEVP_PKEY *verify_key;\n\n/*\n * NB: assumes verify_key, sig and siglen are already set up\n * and that verify_key is an RSA public key\n */\nctx = EVP_PKEY_CTX_new(verify_key, NULL /* no engine */);\nif (!ctx)\n    /* Error occurred */\nif (EVP_PKEY_verify_recover_init(ctx) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)\n    /* Error */\nif (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)\n    /* Error */\n\n/* Determine buffer length */\nif (EVP_PKEY_verify_recover(ctx, NULL, &routlen, sig, siglen) <= 0)\n    /* Error */\n\nrout = OPENSSL_malloc(routlen);\n\nif (!rout)\n    /* malloc failure */\n\nif (EVP_PKEY_verify_recover(ctx, rout, &routlen, sig, siglen) <= 0)\n    /* Error */\n\n/* Recovered data is routlen bytes written to buffer rout */\n
                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#see-also","title":"SEE ALSO","text":"

                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_derive(3)

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#history","title":"HISTORY","text":"

                                                                                                                                              The EVP_PKEY_verify_recover_init() and EVP_PKEY_verify_recover() functions were added in OpenSSL 1.0.0.

                                                                                                                                              The EVP_PKEY_verify_recover_init_ex() function was added in OpenSSL 3.0.

                                                                                                                                              "},{"location":"man3/EVP_PKEY_verify_recover/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                              Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                              "},{"location":"man3/EVP_RAND/","title":"EVP_RAND","text":""},{"location":"man3/EVP_RAND/#name","title":"NAME","text":"

                                                                                                                                              EVP_RAND, EVP_RAND_fetch, EVP_RAND_free, EVP_RAND_up_ref, EVP_RAND_CTX, EVP_RAND_CTX_new, EVP_RAND_CTX_free, EVP_RAND_CTX_up_ref, EVP_RAND_instantiate, EVP_RAND_uninstantiate, EVP_RAND_generate, EVP_RAND_reseed, EVP_RAND_nonce, EVP_RAND_enable_locking, EVP_RAND_verify_zeroization, EVP_RAND_get_strength, EVP_RAND_get_state, EVP_RAND_get0_provider, EVP_RAND_CTX_get0_rand, EVP_RAND_is_a, EVP_RAND_get0_name, EVP_RAND_names_do_all, EVP_RAND_get0_description, EVP_RAND_CTX_get_params, EVP_RAND_CTX_set_params, EVP_RAND_do_all_provided, EVP_RAND_get_params, EVP_RAND_gettable_ctx_params, EVP_RAND_settable_ctx_params, EVP_RAND_CTX_gettable_params, EVP_RAND_CTX_settable_params, EVP_RAND_gettable_params, EVP_RAND_STATE_UNINITIALISED, EVP_RAND_STATE_READY, EVP_RAND_STATE_ERROR - EVP RAND routines

                                                                                                                                              "},{"location":"man3/EVP_RAND/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                              #include <openssl/evp.h>\n\ntypedef struct evp_rand_st EVP_RAND;\ntypedef struct evp_rand_ctx_st EVP_RAND_CTX;\n\nEVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,\n                       const char *properties);\nint EVP_RAND_up_ref(EVP_RAND *rand);\nvoid EVP_RAND_free(EVP_RAND *rand);\nEVP_RAND_CTX *EVP_RAND_CTX_new(EVP_RAND *rand, EVP_RAND_CTX *parent);\nvoid EVP_RAND_CTX_free(EVP_RAND_CTX *ctx);\nint EVP_RAND_CTX_up_ref(EVP_RAND_CTX *ctx);\nEVP_RAND *EVP_RAND_CTX_get0_rand(EVP_RAND_CTX *ctx);\nint EVP_RAND_get_params(EVP_RAND *rand, OSSL_PARAM params[]);\nint EVP_RAND_CTX_get_params(EVP_RAND_CTX *ctx, OSSL_PARAM params[]);\nint EVP_RAND_CTX_set_params(EVP_RAND_CTX *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *EVP_RAND_gettable_params(const EVP_RAND *rand);\nconst OSSL_PARAM *EVP_RAND_gettable_ctx_params(const EVP_RAND *rand);\nconst OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand);\nconst OSSL_PARAM *EVP_RAND_CTX_gettable_params(EVP_RAND_CTX *ctx);\nconst OSSL_PARAM *EVP_RAND_CTX_settable_params(EVP_RAND_CTX *ctx);\nconst char *EVP_RAND_get0_name(const EVP_RAND *rand);\nconst char *EVP_RAND_get0_description(const EVP_RAND *rand);\nint EVP_RAND_is_a(const EVP_RAND *rand, const char *name);\nconst OSSL_PROVIDER *EVP_RAND_get0_provider(const EVP_RAND *rand);\nvoid EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,\n                              void (*fn)(EVP_RAND *rand, void *arg),\n                              void *arg);\nint EVP_RAND_names_do_all(const EVP_RAND *rand,\n                          void (*fn)(const char *name, void *data),\n                          void *data);\n\nint EVP_RAND_instantiate(EVP_RAND_CTX *ctx, unsigned int strength,\n                         int prediction_resistance,\n                         const unsigned char *pstr, size_t pstr_len,\n                         const OSSL_PARAM params[]);\nint EVP_RAND_uninstantiate(EVP_RAND_CTX *ctx);\nint EVP_RAND_generate(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen,\n                      unsigned int strength, int prediction_resistance,\n                      const unsigned char *addin, size_t addin_len);\nint EVP_RAND_reseed(EVP_RAND_CTX *ctx, int prediction_resistance,\n                    const unsigned char *ent, size_t ent_len,\n                    const unsigned char *addin, size_t addin_len);\nint EVP_RAND_nonce(EVP_RAND_CTX *ctx, unsigned char *out, size_t outlen);\nint EVP_RAND_enable_locking(EVP_RAND_CTX *ctx);\nint EVP_RAND_verify_zeroization(EVP_RAND_CTX *ctx);\nunsigned int EVP_RAND_get_strength(EVP_RAND_CTX *ctx);\nint EVP_RAND_get_state(EVP_RAND_CTX *ctx);\n\n#define EVP_RAND_STATE_UNINITIALISED    0\n#define EVP_RAND_STATE_READY            1\n#define EVP_RAND_STATE_ERROR            2\n
                                                                                                                                              "},{"location":"man3/EVP_RAND/#description","title":"DESCRIPTION","text":"

                                                                                                                                              The EVP RAND routines are a high-level interface to random number generators both deterministic and not. If you just want to generate random bytes then you don't need to use these functions: just call RAND_bytes() or RAND_priv_bytes(). If you want to do more, these calls should be used instead of the older RAND and RAND_DRBG functions.

                                                                                                                                              After creating a EVP_RAND_CTX for the required algorithm using EVP_RAND_CTX_new(), inputs to the algorithm are supplied either by passing them as part of the EVP_RAND_instantiate() call or using calls to EVP_RAND_CTX_set_params() before calling EVP_RAND_instantiate(). Finally, call EVP_RAND_generate() to produce cryptographically secure random bytes.

                                                                                                                                              "},{"location":"man3/EVP_RAND/#types","title":"Types","text":"

                                                                                                                                              EVP_RAND is a type that holds the implementation of a RAND.

                                                                                                                                              EVP_RAND_CTX is a context type that holds the algorithm inputs. EVP_RAND_CTX structures are reference counted.

                                                                                                                                              "},{"location":"man3/EVP_RAND/#algorithm-implementation-fetching","title":"Algorithm implementation fetching","text":"

                                                                                                                                              EVP_RAND_fetch() fetches an implementation of a RAND algorithm, given a library context libctx and a set of properties. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                              The returned value must eventually be freed with EVP_RAND_free(3).

                                                                                                                                              EVP_RAND_up_ref() increments the reference count of an already fetched RAND.

                                                                                                                                              EVP_RAND_free() frees a fetched algorithm. NULL is a valid parameter, for which this function is a no-op.

                                                                                                                                              "},{"location":"man3/EVP_RAND/#context-manipulation-functions","title":"Context manipulation functions","text":"

                                                                                                                                              EVP_RAND_CTX_new() creates a new context for the RAND implementation rand. If not NULL, parent specifies the seed source for this implementation. Not all random number generators need to have a seed source specified. If a parent is required, a NULL parent will utilise the operating system entropy sources. It is recommended to minimise the number of random number generators that rely on the operating system for their randomness because this is often scarce.

                                                                                                                                              EVP_RAND_CTX_free() frees up the context ctx. If ctx is NULL, nothing is done.

                                                                                                                                              EVP_RAND_CTX_get0_rand() returns the EVP_RAND associated with the context ctx.

                                                                                                                                              "},{"location":"man3/EVP_RAND/#random-number-generator-functions","title":"Random Number Generator Functions","text":"

                                                                                                                                              EVP_RAND_instantiate() processes any parameters in params and then instantiates the RAND ctx with a minimum security strength of <strength> and personalisation string pstr of length <pstr_len>. If prediction_resistance is specified, fresh entropy from a live source will be sought. This call operates as per NIST SP 800-90A and SP 800-90C.

                                                                                                                                              EVP_RAND_uninstantiate() uninstantiates the RAND ctx as per NIST SP 800-90A and SP 800-90C. Subsequent to this call, the RAND cannot be used to generate bytes. It can only be freed or instantiated again.

                                                                                                                                              EVP_RAND_generate() produces random bytes from the RAND ctx with the additional input addin of length addin_len. The bytes produced will meet the security strength. If prediction_resistance is specified, fresh entropy from a live source will be sought. This call operates as per NIST SP 800-90A and SP 800-90C.

                                                                                                                                              EVP_RAND_reseed() reseeds the RAND with new entropy. Entropy ent of length ent_len bytes can be supplied as can additional input addin of length addin_len bytes. In the FIPS provider, both are treated as additional input as per NIST SP-800-90Ar1, Sections 9.1 and 9.2. Additional seed material is also drawn from the RAND's parent or the operating system. If prediction_resistance is specified, fresh entropy from a live source will be sought. This call operates as per NIST SP 800-90A and SP 800-90C.

                                                                                                                                              EVP_RAND_nonce() creates a nonce in out of maximum length outlen bytes from the RAND ctx. The function returns the length of the generated nonce. If out is NULL, the length is still returned but no generation takes place. This allows a caller to dynamically allocate a buffer of the appropriate size.

                                                                                                                                              EVP_RAND_enable_locking() enables locking for the RAND ctx and all of its parents. After this ctx will operate in a thread safe manner, albeit more slowly. This function is not itself thread safe if called with the same ctx from multiple threads. Typically locking should be enabled before a ctx is shared across multiple threads.

                                                                                                                                              EVP_RAND_get_params() retrieves details about the implementation rand. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

                                                                                                                                              EVP_RAND_CTX_get_params() retrieves chosen parameters, given the context ctx and its underlying context. The set of parameters given with params determine exactly what parameters should be retrieved. Note that a parameter that is unknown in the underlying context is simply ignored.

                                                                                                                                              EVP_RAND_CTX_set_params() passes chosen parameters to the underlying context, given a context ctx. The set of parameters given with params determine exactly what parameters are passed down. Note that a parameter that is unknown in the underlying context is simply ignored. Also, what happens when a needed parameter isn't passed down is defined by the implementation.

                                                                                                                                              EVP_RAND_gettable_params() returns an OSSL_PARAM(3) array that describes the retrievable and settable parameters. EVP_RAND_gettable_params() returns parameters that can be used with EVP_RAND_get_params().

                                                                                                                                              EVP_RAND_gettable_ctx_params() and EVP_RAND_CTX_gettable_params() return constant OSSL_PARAM(3) arrays that describe the retrievable parameters that can be used with EVP_RAND_CTX_get_params(). EVP_RAND_gettable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_RAND_CTX_gettable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                              EVP_RAND_settable_ctx_params() and EVP_RAND_CTX_settable_params() return constant OSSL_PARAM(3) arrays that describe the settable parameters that can be used with EVP_RAND_CTX_set_params(). EVP_RAND_settable_ctx_params() returns the parameters that can be retrieved from the algorithm, whereas EVP_RAND_CTX_settable_params() returns the parameters that can be retrieved in the context's current state.

                                                                                                                                              "},{"location":"man3/EVP_RAND/#information-functions","title":"Information functions","text":"

                                                                                                                                              EVP_RAND_get_strength() returns the security strength of the RAND ctx.

                                                                                                                                              EVP_RAND_get_state() returns the current state of the RAND ctx. States defined by the OpenSSL RNGs are:

                                                                                                                                              • EVP_RAND_STATE_UNINITIALISED: this RNG is currently uninitialised. The instantiate call will change this to the ready state.
                                                                                                                                              • EVP_RAND_STATE_READY: this RNG is currently ready to generate output.
                                                                                                                                              • EVP_RAND_STATE_ERROR: this RNG is in an error state.

                                                                                                                                              EVP_RAND_is_a() returns 1 if rand is an implementation of an algorithm that's identifiable with name, otherwise 0.

                                                                                                                                              EVP_RAND_get0_provider() returns the provider that holds the implementation of the given rand.

                                                                                                                                              EVP_RAND_do_all_provided() traverses all RAND implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                              EVP_RAND_get0_name() returns the canonical name of rand.

                                                                                                                                              EVP_RAND_names_do_all() traverses all names for rand, and calls fn with each name and data.

                                                                                                                                              EVP_RAND_get0_description() returns a description of the rand, meant for display and human consumption. The description is at the discretion of the rand implementation.

                                                                                                                                              EVP_RAND_verify_zeroization() confirms if the internal DRBG state is currently zeroed. This is used by the FIPS provider to support the mandatory self tests.

                                                                                                                                              "},{"location":"man3/EVP_RAND/#parameters","title":"PARAMETERS","text":"

                                                                                                                                              The standard parameter names are:

                                                                                                                                              • \"state\" (OSSL_RAND_PARAM_STATE) <integer>

                                                                                                                                                Returns the state of the random number generator.

                                                                                                                                              • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>

                                                                                                                                                Returns the bit strength of the random number generator.

                                                                                                                                              For rands that are also deterministic random bit generators (DRBGs), these additional parameters are recognised. Not all parameters are relevant to, or are understood by all DRBG rands:

                                                                                                                                              • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

                                                                                                                                                Reads or set the number of generate requests before reseeding the associated RAND ctx.

                                                                                                                                              • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>

                                                                                                                                                Reads or set the number of elapsed seconds before reseeding the associated RAND ctx.

                                                                                                                                              • \"max_request\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

                                                                                                                                                Specifies the maximum number of bytes that can be generated in a single call to OSSL_FUNC_rand_generate.

                                                                                                                                              • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>

                                                                                                                                              • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>

                                                                                                                                                Specify the minimum and maximum number of bytes of random material that can be used to seed the DRBG.

                                                                                                                                              • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>

                                                                                                                                              • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>

                                                                                                                                                Specify the minimum and maximum number of bytes of nonce that can be used to seed the DRBG.

                                                                                                                                              • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>

                                                                                                                                              • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>

                                                                                                                                                Specify the minimum and maximum number of bytes of personalisation string that can be used with the DRBG.

                                                                                                                                              • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>

                                                                                                                                                Specifies the number of times the DRBG has been seeded or reseeded.

                                                                                                                                              • \"properties\" (OSSL_RAND_PARAM_PROPERTIES)

                                                                                                                                              • \"mac\" (OSSL_RAND_PARAM_MAC)
                                                                                                                                              • \"digest\" (OSSL_RAND_PARAM_DIGEST)
                                                                                                                                              • \"cipher\" (OSSL_RAND_PARAM_CIPHER)

                                                                                                                                                For RAND implementations that use an underlying computation MAC, digest or cipher, these parameters set what the algorithm should be.

                                                                                                                                                The value is always the name of the intended algorithm, or the properties in the case of OSSL_RAND_PARAM_PROPERTIES.

                                                                                                                                                "},{"location":"man3/EVP_RAND/#notes","title":"NOTES","text":"

                                                                                                                                                The use of a nonzero value for the prediction_resistance argument to EVP_RAND_instantiate(), EVP_RAND_generate() or EVP_RAND_reseed() should be used sparingly. In the default setup, this will cause all public and private DRBGs to be reseeded on next use. Since, by default, public and private DRBGs are allocated on a per thread basis, this can result in significant overhead for highly multi-threaded applications. For normal use-cases, the default \"reseed_requests\" and \"reseed_time_interval\" thresholds ensure sufficient prediction resistance over time and you can reduce those values if you think they are too high. Explicitly requesting prediction resistance is intended for more special use-cases like generating long-term secrets.

                                                                                                                                                An EVP_RAND_CTX needs to have locking enabled if it acts as the parent of more than one child and the children can be accessed concurrently. This must be done by explicitly calling EVP_RAND_enable_locking().

                                                                                                                                                The RAND life-cycle is described in life_cycle-rand(7). In the future, the transitions described there will be enforced. When this is done, it will not be considered a breaking change to the API.

                                                                                                                                                "},{"location":"man3/EVP_RAND/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                EVP_RAND_fetch() returns a pointer to a newly fetched EVP_RAND, or NULL if allocation failed.

                                                                                                                                                EVP_RAND_get0_provider() returns a pointer to the provider for the RAND, or NULL on error.

                                                                                                                                                EVP_RAND_CTX_get0_rand() returns a pointer to the EVP_RAND associated with the context.

                                                                                                                                                EVP_RAND_get0_name() returns the name of the random number generation algorithm.

                                                                                                                                                EVP_RAND_up_ref() returns 1 on success, 0 on error.

                                                                                                                                                EVP_RAND_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                                EVP_RAND_CTX_new() returns either the newly allocated EVP_RAND_CTX structure or NULL if an error occurred.

                                                                                                                                                EVP_RAND_CTX_free() does not return a value.

                                                                                                                                                EVP_RAND_CTX_up_ref() returns 1 on success, 0 on error.

                                                                                                                                                EVP_RAND_nonce() returns the length of the nonce.

                                                                                                                                                EVP_RAND_get_strength() returns the strength of the random number generator in bits.

                                                                                                                                                EVP_RAND_gettable_params(), EVP_RAND_gettable_ctx_params() and EVP_RAND_settable_ctx_params() return an array of OSSL_PARAMs.

                                                                                                                                                EVP_RAND_verify_zeroization() returns 1 if the internal DRBG state is currently zeroed, and 0 if not.

                                                                                                                                                The remaining functions return 1 for success and 0 or a negative value for failure.

                                                                                                                                                "},{"location":"man3/EVP_RAND/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                RAND_bytes(3), EVP_RAND-CTR-DRBG(7), EVP_RAND-HASH-DRBG(7), EVP_RAND-HMAC-DRBG(7), EVP_RAND-TEST-RAND(7), provider-rand(7), life_cycle-rand(7)

                                                                                                                                                "},{"location":"man3/EVP_RAND/#history","title":"HISTORY","text":"

                                                                                                                                                This functionality was added to OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/EVP_RAND/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_SIGNATURE/","title":"EVP_SIGNATURE","text":""},{"location":"man3/EVP_SIGNATURE/#name","title":"NAME","text":"

                                                                                                                                                EVP_SIGNATURE, EVP_SIGNATURE_fetch, EVP_SIGNATURE_free, EVP_SIGNATURE_up_ref, EVP_SIGNATURE_is_a, EVP_SIGNATURE_get0_provider, EVP_SIGNATURE_do_all_provided, EVP_SIGNATURE_names_do_all, EVP_SIGNATURE_get0_name, EVP_SIGNATURE_get0_description, EVP_SIGNATURE_gettable_ctx_params, EVP_SIGNATURE_settable_ctx_params - Functions to manage EVP_SIGNATURE algorithm objects

                                                                                                                                                "},{"location":"man3/EVP_SIGNATURE/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\ntypedef struct evp_signature_st EVP_SIGNATURE;\n\nEVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,\n                                   const char *properties);\nvoid EVP_SIGNATURE_free(EVP_SIGNATURE *signature);\nint EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature);\nconst char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature);\nint EVP_SIGNATURE_is_a(const EVP_SIGNATURE *signature, const char *name);\nOSSL_PROVIDER *EVP_SIGNATURE_get0_provider(const EVP_SIGNATURE *signature);\nvoid EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx,\n                                   void (*fn)(EVP_SIGNATURE *signature,\n                                              void *arg),\n                                   void *arg);\nint EVP_SIGNATURE_names_do_all(const EVP_SIGNATURE *signature,\n                               void (*fn)(const char *name, void *data),\n                               void *data);\nconst char *EVP_SIGNATURE_get0_name(const EVP_SIGNATURE *signature);\nconst char *EVP_SIGNATURE_get0_description(const EVP_SIGNATURE *signature);\nconst OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig);\nconst OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig);\n
                                                                                                                                                "},{"location":"man3/EVP_SIGNATURE/#description","title":"DESCRIPTION","text":"

                                                                                                                                                EVP_SIGNATURE_fetch() fetches the implementation for the given algorithm from any provider offering it, within the criteria given by the properties. The algorithm will be one offering functions for performing signature related tasks such as signing and verifying. See \"ALGORITHM FETCHING\" in crypto(7) for further information.

                                                                                                                                                The returned value must eventually be freed with EVP_SIGNATURE_free().

                                                                                                                                                EVP_SIGNATURE_free() decrements the reference count for the EVP_SIGNATURE structure. Typically this structure will have been obtained from an earlier call to EVP_SIGNATURE_fetch(). If the reference count drops to 0 then the structure is freed. If the argument is NULL, nothing is done.

                                                                                                                                                EVP_SIGNATURE_up_ref() increments the reference count for an EVP_SIGNATURE structure.

                                                                                                                                                EVP_SIGNATURE_is_a() returns 1 if signature is an implementation of an algorithm that's identifiable with name, otherwise 0.

                                                                                                                                                EVP_SIGNATURE_get0_provider() returns the provider that signature was fetched from.

                                                                                                                                                EVP_SIGNATURE_do_all_provided() traverses all SIGNATURE implemented by all activated providers in the given library context libctx, and for each of the implementations, calls the given function fn with the implementation method and the given arg as argument.

                                                                                                                                                EVP_SIGNATURE_get0_name() returns the algorithm name from the provided implementation for the given signature. Note that the signature may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the signature object and should not be freed by the caller.

                                                                                                                                                EVP_SIGNATURE_names_do_all() traverses all names for signature, and calls fn with each name and data.

                                                                                                                                                EVP_SIGNATURE_get0_description() returns a description of the signature, meant for display and human consumption. The description is at the discretion of the signature implementation.

                                                                                                                                                EVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params() return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set by a signature algorithm using EVP_PKEY_CTX_get_params(3) and EVP_PKEY_CTX_set_params(3).

                                                                                                                                                "},{"location":"man3/EVP_SIGNATURE/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                EVP_SIGNATURE_fetch() returns a pointer to an EVP_SIGNATURE for success or NULL for failure.

                                                                                                                                                EVP_SIGNATURE_up_ref() returns 1 for success or 0 otherwise.

                                                                                                                                                EVP_SIGNATURE_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                                EVP_SIGNATURE_gettable_ctx_params() and EVP_SIGNATURE_settable_ctx_params() return a constant OSSL_PARAM(3) array or NULL on error.

                                                                                                                                                "},{"location":"man3/EVP_SIGNATURE/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                \"ALGORITHM FETCHING\" in crypto(7), OSSL_PROVIDER(3)

                                                                                                                                                "},{"location":"man3/EVP_SIGNATURE/#history","title":"HISTORY","text":"

                                                                                                                                                The functions described here were added in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/EVP_SIGNATURE/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_SealInit/","title":"EVP_SealInit","text":""},{"location":"man3/EVP_SealInit/#name","title":"NAME","text":"

                                                                                                                                                EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption

                                                                                                                                                "},{"location":"man3/EVP_SealInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nint EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n                 unsigned char **ek, int *ekl, unsigned char *iv,\n                 EVP_PKEY **pubk, int npubk);\nint EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n                   int *outl, unsigned char *in, int inl);\nint EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n
                                                                                                                                                "},{"location":"man3/EVP_SealInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The EVP envelope routines are a high-level interface to envelope encryption. They generate a random key and IV (if required) then \"envelope\" it by using public key encryption. Data can then be encrypted using this key.

                                                                                                                                                EVP_SealInit() initializes a cipher context ctx for encryption with cipher type using a random secret key and IV. type is normally supplied by a function such as EVP_aes_256_cbc(). The secret key is encrypted using one or more public keys, this allows the same encrypted data to be decrypted using any of the corresponding private keys. ek is an array of buffers where the public key encrypted secret key will be written, each buffer must contain enough room for the corresponding encrypted key: that is ek[i] must have room for EVP_PKEY_get_size(pubk[i]) bytes. The actual size of each encrypted secret key is written to the array ekl. pubk is an array of npubk public keys.

                                                                                                                                                The iv parameter is a buffer where the generated IV is written to. It must contain enough room for the corresponding cipher's IV, as determined by (for example) EVP_CIPHER_get_iv_length(type).

                                                                                                                                                If the cipher does not require an IV then the iv parameter is ignored and can be NULL.

                                                                                                                                                EVP_SealUpdate() and EVP_SealFinal() have exactly the same properties as the EVP_EncryptUpdate() and EVP_EncryptFinal() routines, as documented on the EVP_EncryptInit(3) manual page.

                                                                                                                                                "},{"location":"man3/EVP_SealInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                EVP_SealInit() returns 0 on error or npubk if successful.

                                                                                                                                                EVP_SealUpdate() and EVP_SealFinal() return 1 for success and 0 for failure.

                                                                                                                                                "},{"location":"man3/EVP_SealInit/#notes","title":"NOTES","text":"

                                                                                                                                                Because a random secret key is generated the random number generator must be seeded when EVP_SealInit() is called. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                                The public key must be RSA because it is the only OpenSSL public key algorithm that supports key transport.

                                                                                                                                                Envelope encryption is the usual method of using public key encryption on large amounts of data, this is because public key encryption is slow but symmetric encryption is fast. So symmetric encryption is used for bulk encryption and the small random symmetric key used is transferred using public key encryption.

                                                                                                                                                It is possible to call EVP_SealInit() twice in the same way as EVP_EncryptInit(). The first call should have npubk set to 0 and (after setting any cipher parameters) it should be called again with type set to NULL.

                                                                                                                                                "},{"location":"man3/EVP_SealInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), RAND_bytes(3), EVP_EncryptInit(3), EVP_OpenInit(3), RAND(7)

                                                                                                                                                "},{"location":"man3/EVP_SealInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_SignInit/","title":"EVP_SignInit","text":""},{"location":"man3/EVP_SignInit/#name","title":"NAME","text":"

                                                                                                                                                EVP_SignInit, EVP_SignInit_ex, EVP_SignUpdate, EVP_SignFinal_ex, EVP_SignFinal - EVP signing functions

                                                                                                                                                "},{"location":"man3/EVP_SignInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nint EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\nint EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);\nint EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,\n                     EVP_PKEY *pkey, OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sig, unsigned int *s,\n                  EVP_PKEY *pkey);\n\nvoid EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type);\n
                                                                                                                                                "},{"location":"man3/EVP_SignInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The EVP signature routines are a high-level interface to digital signatures.

                                                                                                                                                EVP_SignInit_ex() sets up signing context ctx to use digest type from ENGINE impl. ctx must be created with EVP_MD_CTX_new() before calling this function.

                                                                                                                                                EVP_SignUpdate() hashes cnt bytes of data at d into the signature context ctx. This function can be called several times on the same ctx to include additional data.

                                                                                                                                                EVP_SignFinal_ex() signs the data in ctx using the private key pkey and places the signature in sig. The library context libctx and property query propq are used when creating a context to use with the key pkey. sig must be at least EVP_PKEY_get_size(pkey) bytes in size. s is an OUT parameter, and not used as an IN parameter. The number of bytes of data written (i.e. the length of the signature) will be written to the integer at s, at most EVP_PKEY_get_size(pkey) bytes will be written.

                                                                                                                                                EVP_SignFinal() is similar to EVP_SignFinal_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                                EVP_SignInit() initializes a signing context ctx to use the default implementation of digest type.

                                                                                                                                                "},{"location":"man3/EVP_SignInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                EVP_SignInit_ex(), EVP_SignUpdate(), EVP_SignFinal_ex() and EVP_SignFinal() return 1 for success and 0 for failure.

                                                                                                                                                The error codes can be obtained by ERR_get_error(3).

                                                                                                                                                "},{"location":"man3/EVP_SignInit/#notes","title":"NOTES","text":"

                                                                                                                                                The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

                                                                                                                                                When signing with some private key types the random number generator must be seeded. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                                The call to EVP_SignFinal() internally finalizes a copy of the digest context. This means that calls to EVP_SignUpdate() and EVP_SignFinal() can be called later to digest and sign additional data.

                                                                                                                                                Since only a copy of the digest context is ever finalized the context must be cleaned up after use by calling EVP_MD_CTX_free() or a memory leak will occur.

                                                                                                                                                "},{"location":"man3/EVP_SignInit/#bugs","title":"BUGS","text":"

                                                                                                                                                Older versions of this documentation wrongly stated that calls to EVP_SignUpdate() could not be made after calling EVP_SignFinal().

                                                                                                                                                Since the private key is passed in the call to EVP_SignFinal() any error relating to the private key (for example an unsuitable key and digest combination) will not be indicated until after potentially large amounts of data have been passed through EVP_SignUpdate().

                                                                                                                                                It is not possible to change the signing parameters using these function.

                                                                                                                                                The previous two bugs are fixed in the newer EVP_DigestSign*() functions.

                                                                                                                                                "},{"location":"man3/EVP_SignInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                EVP_PKEY_get_size(3), EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3), EVP_VerifyInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1)

                                                                                                                                                "},{"location":"man3/EVP_SignInit/#history","title":"HISTORY","text":"

                                                                                                                                                The function EVP_SignFinal_ex() was added in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/EVP_SignInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/","title":"EVP_VerifyInit","text":""},{"location":"man3/EVP_VerifyInit/#name","title":"NAME","text":"

                                                                                                                                                EVP_VerifyInit_ex, EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal_ex, EVP_VerifyFinal - EVP signature verification functions

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nint EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\nint EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);\nint EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,\n                       unsigned int siglen, EVP_PKEY *pkey,\n                       OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_VerifyFinal(EVP_MD_CTX *ctx, unsigned char *sigbuf, unsigned int siglen,\n                    EVP_PKEY *pkey);\n\nint EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);\n
                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The EVP signature verification routines are a high-level interface to digital signatures.

                                                                                                                                                EVP_VerifyInit_ex() sets up verification context ctx to use digest type from ENGINE impl. ctx must be created by calling EVP_MD_CTX_new() before calling this function.

                                                                                                                                                EVP_VerifyUpdate() hashes cnt bytes of data at d into the verification context ctx. This function can be called several times on the same ctx to include additional data.

                                                                                                                                                EVP_VerifyFinal_ex() verifies the data in ctx using the public key pkey and siglen bytes in sigbuf. The library context libctx and property query propq are used when creating a context to use with the key pkey.

                                                                                                                                                EVP_VerifyFinal() is similar to EVP_VerifyFinal_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                                EVP_VerifyInit() initializes verification context ctx to use the default implementation of digest type.

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for failure.

                                                                                                                                                EVP_VerifyFinal_ex() and EVP_VerifyFinal() return 1 for a correct signature, 0 for failure and a negative value if some other error occurred.

                                                                                                                                                The error codes can be obtained by ERR_get_error(3).

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#notes","title":"NOTES","text":"

                                                                                                                                                The EVP interface to digital signatures should almost always be used in preference to the low-level interfaces. This is because the code then becomes transparent to the algorithm used and much more flexible.

                                                                                                                                                The call to EVP_VerifyFinal() internally finalizes a copy of the digest context. This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called later to digest and verify additional data.

                                                                                                                                                Since only a copy of the digest context is ever finalized the context must be cleaned up after use by calling EVP_MD_CTX_free() or a memory leak will occur.

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#bugs","title":"BUGS","text":"

                                                                                                                                                Older versions of this documentation wrongly stated that calls to EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal().

                                                                                                                                                Since the public key is passed in the call to EVP_SignFinal() any error relating to the private key (for example an unsuitable key and digest combination) will not be indicated until after potentially large amounts of data have been passed through EVP_SignUpdate().

                                                                                                                                                It is not possible to change the signing parameters using these function.

                                                                                                                                                The previous two bugs are fixed in the newer EVP_DigestVerify*() function.

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_SignInit(3), EVP_DigestInit(3), evp(7), HMAC(3), MD2(3), MD5(3), MDC2(3), RIPEMD160(3), SHA1(3), openssl-dgst(1)

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#history","title":"HISTORY","text":"

                                                                                                                                                The function EVP_VerifyFinal_ex() was added in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/EVP_VerifyInit/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_aes_128_gcm/","title":"EVP_aes_128_gcm","text":""},{"location":"man3/EVP_aes_128_gcm/#name","title":"NAME","text":"

                                                                                                                                                EVP_aes_128_cbc, EVP_aes_192_cbc, EVP_aes_256_cbc, EVP_aes_128_cfb, EVP_aes_192_cfb, EVP_aes_256_cfb, EVP_aes_128_cfb1, EVP_aes_192_cfb1, EVP_aes_256_cfb1, EVP_aes_128_cfb8, EVP_aes_192_cfb8, EVP_aes_256_cfb8, EVP_aes_128_cfb128, EVP_aes_192_cfb128, EVP_aes_256_cfb128, EVP_aes_128_ctr, EVP_aes_192_ctr, EVP_aes_256_ctr, EVP_aes_128_ecb, EVP_aes_192_ecb, EVP_aes_256_ecb, EVP_aes_128_ofb, EVP_aes_192_ofb, EVP_aes_256_ofb, EVP_aes_128_cbc_hmac_sha1, EVP_aes_256_cbc_hmac_sha1, EVP_aes_128_cbc_hmac_sha256, EVP_aes_256_cbc_hmac_sha256, EVP_aes_128_ccm, EVP_aes_192_ccm, EVP_aes_256_ccm, EVP_aes_128_gcm, EVP_aes_192_gcm, EVP_aes_256_gcm, EVP_aes_128_ocb, EVP_aes_192_ocb, EVP_aes_256_ocb, EVP_aes_128_wrap, EVP_aes_192_wrap, EVP_aes_256_wrap, EVP_aes_128_wrap_pad, EVP_aes_192_wrap_pad, EVP_aes_256_wrap_pad, EVP_aes_128_xts, EVP_aes_256_xts - EVP AES cipher

                                                                                                                                                "},{"location":"man3/EVP_aes_128_gcm/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

                                                                                                                                                EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_aes_128_cbc.

                                                                                                                                                "},{"location":"man3/EVP_aes_128_gcm/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The AES encryption algorithm for EVP.

                                                                                                                                                • EVP_aes_128_cbc(), EVP_aes_192_cbc(), EVP_aes_256_cbc(), EVP_aes_128_cfb(), EVP_aes_192_cfb(), EVP_aes_256_cfb(), EVP_aes_128_cfb1(), EVP_aes_192_cfb1(), EVP_aes_256_cfb1(), EVP_aes_128_cfb8(), EVP_aes_192_cfb8(), EVP_aes_256_cfb8(), EVP_aes_128_cfb128(), EVP_aes_192_cfb128(), EVP_aes_256_cfb128(), EVP_aes_128_ctr(), EVP_aes_192_ctr(), EVP_aes_256_ctr(), EVP_aes_128_ecb(), EVP_aes_192_ecb(), EVP_aes_256_ecb(), EVP_aes_128_ofb(), EVP_aes_192_ofb(), EVP_aes_256_ofb()

                                                                                                                                                  AES for 128, 192 and 256 bit keys in the following modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB, and OFB.

                                                                                                                                                • EVP_aes_128_cbc_hmac_sha1(), EVP_aes_256_cbc_hmac_sha1()

                                                                                                                                                  Authenticated encryption with AES in CBC mode using SHA-1 as HMAC, with keys of 128 and 256 bits length respectively. The authentication tag is 160 bits long.

                                                                                                                                                  WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

                                                                                                                                                • EVP_aes_128_cbc_hmac_sha256(), EVP_aes_256_cbc_hmac_sha256()

                                                                                                                                                  Authenticated encryption with AES in CBC mode using SHA256 (SHA-2, 256-bits) as HMAC, with keys of 128 and 256 bits length respectively. The authentication tag is 256 bits long.

                                                                                                                                                  WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

                                                                                                                                                • EVP_aes_128_ccm(), EVP_aes_192_ccm(), EVP_aes_256_ccm(), EVP_aes_128_gcm(), EVP_aes_192_gcm(), EVP_aes_256_gcm(), EVP_aes_128_ocb(), EVP_aes_192_ocb(), EVP_aes_256_ocb()

                                                                                                                                                  AES for 128, 192 and 256 bit keys in CBC-MAC Mode (CCM), Galois Counter Mode (GCM) and OCB Mode respectively. These ciphers require additional control operations to function correctly, see the \"AEAD Interface\" in EVP_EncryptInit(3) section for details.

                                                                                                                                                • EVP_aes_128_wrap(), EVP_aes_192_wrap(), EVP_aes_256_wrap(), EVP_aes_128_wrap_pad(), EVP_aes_192_wrap_pad(), EVP_aes_256_wrap_pad()

                                                                                                                                                  AES key wrap with 128, 192 and 256 bit keys, as according to RFC 3394 section 2.2.1 (\"wrap\") and RFC 5649 section 4.1 (\"wrap with padding\") respectively.

                                                                                                                                                • EVP_aes_128_xts(), EVP_aes_256_xts()

                                                                                                                                                  AES XTS mode (XTS-AES) is standardized in IEEE Std. 1619-2007 and described in NIST SP 800-38E. The XTS (XEX-based tweaked-codebook mode with ciphertext stealing) mode was designed by Prof. Phillip Rogaway of University of California, Davis, intended for encrypting data on a storage device.

                                                                                                                                                  XTS-AES provides confidentiality but not authentication of data. It also requires a key of double-length for protection of a certain key size. In particular, XTS-AES-128 (EVP_aes_128_xts) takes input of a 256-bit key to achieve AES 128-bit security, and XTS-AES-256 (EVP_aes_256_xts) takes input of a 512-bit key to achieve AES 256-bit security.

                                                                                                                                                  The XTS implementation in OpenSSL does not support streaming. That is there must only be one EVP_EncryptUpdate(3) call per EVP_EncryptInit_ex(3) call (and similarly with the \"Decrypt\" functions).

                                                                                                                                                  The iv parameter to EVP_EncryptInit_ex(3) or EVP_DecryptInit_ex(3) is the XTS \"tweak\" value.

                                                                                                                                                "},{"location":"man3/EVP_aes_128_gcm/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-AES(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_aes_128_gcm/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_aes_128_gcm/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_aes_128_gcm/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_aria_128_gcm/","title":"EVP_aria_128_gcm","text":""},{"location":"man3/EVP_aria_128_gcm/#name","title":"NAME","text":"

                                                                                                                                                EVP_aria_128_cbc, EVP_aria_192_cbc, EVP_aria_256_cbc, EVP_aria_128_cfb, EVP_aria_192_cfb, EVP_aria_256_cfb, EVP_aria_128_cfb1, EVP_aria_192_cfb1, EVP_aria_256_cfb1, EVP_aria_128_cfb8, EVP_aria_192_cfb8, EVP_aria_256_cfb8, EVP_aria_128_cfb128, EVP_aria_192_cfb128, EVP_aria_256_cfb128, EVP_aria_128_ctr, EVP_aria_192_ctr, EVP_aria_256_ctr, EVP_aria_128_ecb, EVP_aria_192_ecb, EVP_aria_256_ecb, EVP_aria_128_ofb, EVP_aria_192_ofb, EVP_aria_256_ofb, EVP_aria_128_ccm, EVP_aria_192_ccm, EVP_aria_256_ccm, EVP_aria_128_gcm, EVP_aria_192_gcm, EVP_aria_256_gcm, - EVP ARIA cipher

                                                                                                                                                "},{"location":"man3/EVP_aria_128_gcm/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

                                                                                                                                                EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_aria_128_cbc.

                                                                                                                                                "},{"location":"man3/EVP_aria_128_gcm/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The ARIA encryption algorithm for EVP.

                                                                                                                                                • EVP_aria_128_cbc(), EVP_aria_192_cbc(), EVP_aria_256_cbc(), EVP_aria_128_cfb(), EVP_aria_192_cfb(), EVP_aria_256_cfb(), EVP_aria_128_cfb1(), EVP_aria_192_cfb1(), EVP_aria_256_cfb1(), EVP_aria_128_cfb8(), EVP_aria_192_cfb8(), EVP_aria_256_cfb8(), EVP_aria_128_cfb128(), EVP_aria_192_cfb128(), EVP_aria_256_cfb128(), EVP_aria_128_ctr(), EVP_aria_192_ctr(), EVP_aria_256_ctr(), EVP_aria_128_ecb(), EVP_aria_192_ecb(), EVP_aria_256_ecb(), EVP_aria_128_ofb(), EVP_aria_192_ofb(), EVP_aria_256_ofb()

                                                                                                                                                  ARIA for 128, 192 and 256 bit keys in the following modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB and OFB.

                                                                                                                                                • EVP_aria_128_ccm(), EVP_aria_192_ccm(), EVP_aria_256_ccm(), EVP_aria_128_gcm(), EVP_aria_192_gcm(), EVP_aria_256_gcm(),

                                                                                                                                                  ARIA for 128, 192 and 256 bit keys in CBC-MAC Mode (CCM) and Galois Counter Mode (GCM). These ciphers require additional control operations to function correctly, see the \"AEAD Interface\" in EVP_EncryptInit(3) section for details.

                                                                                                                                                "},{"location":"man3/EVP_aria_128_gcm/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-ARIA(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_aria_128_gcm/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_aria_128_gcm/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_aria_128_gcm/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_bf_cbc/","title":"EVP_bf_cbc","text":""},{"location":"man3/EVP_bf_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_bf_cbc, EVP_bf_cfb, EVP_bf_cfb64, EVP_bf_ecb, EVP_bf_ofb - EVP Blowfish cipher

                                                                                                                                                "},{"location":"man3/EVP_bf_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_bf_cbc(void);\nconst EVP_CIPHER *EVP_bf_cfb(void);\nconst EVP_CIPHER *EVP_bf_cfb64(void);\nconst EVP_CIPHER *EVP_bf_ecb(void);\nconst EVP_CIPHER *EVP_bf_ofb(void);\n
                                                                                                                                                "},{"location":"man3/EVP_bf_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The Blowfish encryption algorithm for EVP.

                                                                                                                                                This is a variable key length cipher.

                                                                                                                                                • EVP_bf_cbc(), EVP_bf_cfb(), EVP_bf_cfb64(), EVP_bf_ecb(), EVP_bf_ofb()

                                                                                                                                                  Blowfish encryption algorithm in CBC, CFB, ECB and OFB modes respectively.

                                                                                                                                                "},{"location":"man3/EVP_bf_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-BLOWFISH(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_bf_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_bf_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_bf_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_blake2b512/","title":"EVP_blake2b512","text":""},{"location":"man3/EVP_blake2b512/#name","title":"NAME","text":"

                                                                                                                                                EVP_blake2b512, EVP_blake2s256 - BLAKE2 For EVP

                                                                                                                                                "},{"location":"man3/EVP_blake2b512/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_blake2b512(void);\nconst EVP_MD *EVP_blake2s256(void);\n
                                                                                                                                                "},{"location":"man3/EVP_blake2b512/#description","title":"DESCRIPTION","text":"

                                                                                                                                                BLAKE2 is an improved version of BLAKE, which was submitted to the NIST SHA-3 algorithm competition. The BLAKE2s and BLAKE2b algorithms are described in RFC 7693.

                                                                                                                                                • EVP_blake2s256()

                                                                                                                                                  The BLAKE2s algorithm that produces a 256-bit output from a given input.

                                                                                                                                                • EVP_blake2b512()

                                                                                                                                                  The BLAKE2b algorithm that produces a 512-bit output from a given input.

                                                                                                                                                "},{"location":"man3/EVP_blake2b512/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-BLAKE2(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                While the BLAKE2b and BLAKE2s algorithms supports a variable length digest, this implementation outputs a digest of a fixed length (the maximum length supported), which is 512-bits for BLAKE2b and 256-bits for BLAKE2s.

                                                                                                                                                "},{"location":"man3/EVP_blake2b512/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_blake2b512/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                RFC 7693.

                                                                                                                                                "},{"location":"man3/EVP_blake2b512/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_blake2b512/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_camellia_128_ecb/","title":"EVP_camellia_128_ecb","text":""},{"location":"man3/EVP_camellia_128_ecb/#name","title":"NAME","text":"

                                                                                                                                                EVP_camellia_128_cbc, EVP_camellia_192_cbc, EVP_camellia_256_cbc, EVP_camellia_128_cfb, EVP_camellia_192_cfb, EVP_camellia_256_cfb, EVP_camellia_128_cfb1, EVP_camellia_192_cfb1, EVP_camellia_256_cfb1, EVP_camellia_128_cfb8, EVP_camellia_192_cfb8, EVP_camellia_256_cfb8, EVP_camellia_128_cfb128, EVP_camellia_192_cfb128, EVP_camellia_256_cfb128, EVP_camellia_128_ctr, EVP_camellia_192_ctr, EVP_camellia_256_ctr, EVP_camellia_128_ecb, EVP_camellia_192_ecb, EVP_camellia_256_ecb, EVP_camellia_128_ofb, EVP_camellia_192_ofb, EVP_camellia_256_ofb - EVP Camellia cipher

                                                                                                                                                "},{"location":"man3/EVP_camellia_128_ecb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

                                                                                                                                                EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_camellia_128_cbc.

                                                                                                                                                "},{"location":"man3/EVP_camellia_128_ecb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The Camellia encryption algorithm for EVP.

                                                                                                                                                • EVP_camellia_128_cbc(), EVP_camellia_192_cbc(), EVP_camellia_256_cbc(), EVP_camellia_128_cfb(), EVP_camellia_192_cfb(), EVP_camellia_256_cfb(), EVP_camellia_128_cfb1(), EVP_camellia_192_cfb1(), EVP_camellia_256_cfb1(), EVP_camellia_128_cfb8(), EVP_camellia_192_cfb8(), EVP_camellia_256_cfb8(), EVP_camellia_128_cfb128(), EVP_camellia_192_cfb128(), EVP_camellia_256_cfb128(), EVP_camellia_128_ctr(), EVP_camellia_192_ctr(), EVP_camellia_256_ctr(), EVP_camellia_128_ecb(), EVP_camellia_192_ecb(), EVP_camellia_256_ecb(), EVP_camellia_128_ofb(), EVP_camellia_192_ofb(), EVP_camellia_256_ofb()

                                                                                                                                                  Camellia for 128, 192 and 256 bit keys in the following modes: CBC, CFB with 128-bit shift, CFB with 1-bit shift, CFB with 8-bit shift, CTR, ECB and OFB.

                                                                                                                                                "},{"location":"man3/EVP_camellia_128_ecb/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-CAMELLIA(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_camellia_128_ecb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_camellia_128_ecb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_camellia_128_ecb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_cast5_cbc/","title":"EVP_cast5_cbc","text":""},{"location":"man3/EVP_cast5_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_cast5_cbc, EVP_cast5_cfb, EVP_cast5_cfb64, EVP_cast5_ecb, EVP_cast5_ofb - EVP CAST cipher

                                                                                                                                                "},{"location":"man3/EVP_cast5_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_cast5_cbc(void);\nconst EVP_CIPHER *EVP_cast5_cfb(void);\nconst EVP_CIPHER *EVP_cast5_cfb64(void);\nconst EVP_CIPHER *EVP_cast5_ecb(void);\nconst EVP_CIPHER *EVP_cast5_ofb(void);\n
                                                                                                                                                "},{"location":"man3/EVP_cast5_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The CAST encryption algorithm for EVP.

                                                                                                                                                This is a variable key length cipher.

                                                                                                                                                • EVP_cast5_cbc(), EVP_cast5_ecb(), EVP_cast5_cfb(), EVP_cast5_cfb64(), EVP_cast5_ofb()

                                                                                                                                                  CAST encryption algorithm in CBC, ECB, CFB and OFB modes respectively.

                                                                                                                                                "},{"location":"man3/EVP_cast5_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-CAST(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_cast5_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_cast5_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_cast5_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_chacha20/","title":"EVP_chacha20","text":""},{"location":"man3/EVP_chacha20/#name","title":"NAME","text":"

                                                                                                                                                EVP_chacha20, EVP_chacha20_poly1305 - EVP ChaCha20 stream cipher

                                                                                                                                                "},{"location":"man3/EVP_chacha20/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_chacha20(void);\nconst EVP_CIPHER *EVP_chacha20_poly1305(void);\n
                                                                                                                                                "},{"location":"man3/EVP_chacha20/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The ChaCha20 stream cipher for EVP.

                                                                                                                                                • EVP_chacha20()

                                                                                                                                                  The ChaCha20 stream cipher. The key length is 256 bits, the IV is 128 bits long. The first 64 bits consists of a counter in little-endian order followed by a 64 bit nonce. For example a nonce of:

                                                                                                                                                  0000000000000002

                                                                                                                                                  With an initial counter of 42 (2a in hex) would be expressed as:

                                                                                                                                                  2a000000000000000000000000000002

                                                                                                                                                • EVP_chacha20_poly1305()

                                                                                                                                                  Authenticated encryption with ChaCha20-Poly1305. Like EVP_chacha20(), the key is 256 bits and the IV is 96 bits. This supports additional authenticated data (AAD) and produces a 128-bit authentication tag. See the \"AEAD Interface\" in EVP_EncryptInit(3) section for more information.

                                                                                                                                                "},{"location":"man3/EVP_chacha20/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-CHACHA(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                RFC 7539 uses a 32 bit counter and a 96 bit nonce for the IV.

                                                                                                                                                "},{"location":"man3/EVP_chacha20/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_chacha20/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_chacha20/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_des_cbc/","title":"EVP_des_cbc","text":""},{"location":"man3/EVP_des_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_des_cbc, EVP_des_cfb, EVP_des_cfb1, EVP_des_cfb8, EVP_des_cfb64, EVP_des_ecb, EVP_des_ofb, EVP_des_ede, EVP_des_ede_cbc, EVP_des_ede_cfb, EVP_des_ede_cfb64, EVP_des_ede_ecb, EVP_des_ede_ofb, EVP_des_ede3, EVP_des_ede3_cbc, EVP_des_ede3_cfb, EVP_des_ede3_cfb1, EVP_des_ede3_cfb8, EVP_des_ede3_cfb64, EVP_des_ede3_ecb, EVP_des_ede3_ofb, EVP_des_ede3_wrap - EVP DES cipher

                                                                                                                                                "},{"location":"man3/EVP_des_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_ciphername(void)\n

                                                                                                                                                EVP_ciphername is used a placeholder for any of the described cipher functions, such as EVP_des_cbc.

                                                                                                                                                "},{"location":"man3/EVP_des_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The DES encryption algorithm for EVP.

                                                                                                                                                • EVP_des_cbc(), EVP_des_ecb(), EVP_des_cfb(), EVP_des_cfb1(), EVP_des_cfb8(), EVP_des_cfb64(), EVP_des_ofb()

                                                                                                                                                  DES in CBC, ECB, CFB with 64-bit shift, CFB with 1-bit shift, CFB with 8-bit shift and OFB modes.

                                                                                                                                                  None of these algorithms are provided by the OpenSSL default provider. To use them it is necessary to load either the OpenSSL legacy provider or another implementation.

                                                                                                                                                • EVP_des_ede(), EVP_des_ede_cbc(), EVP_des_ede_cfb(), EVP_des_ede_cfb64(), EVP_des_ede_ecb(), EVP_des_ede_ofb()

                                                                                                                                                  Two key triple DES in ECB, CBC, CFB with 64-bit shift and OFB modes.

                                                                                                                                                • EVP_des_ede3(), EVP_des_ede3_cbc(), EVP_des_ede3_cfb(), EVP_des_ede3_cfb1(), EVP_des_ede3_cfb8(), EVP_des_ede3_cfb64(), EVP_des_ede3_ecb(), EVP_des_ede3_ofb()

                                                                                                                                                  Three-key triple DES in ECB, CBC, CFB with 64-bit shift, CFB with 1-bit shift, CFB with 8-bit shift and OFB modes.

                                                                                                                                                • EVP_des_ede3_wrap()

                                                                                                                                                  Triple-DES key wrap according to RFC 3217 Section 3.

                                                                                                                                                "},{"location":"man3/EVP_des_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-DES(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_des_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_des_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_des_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_desx_cbc/","title":"EVP_desx_cbc","text":""},{"location":"man3/EVP_desx_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_desx_cbc - EVP DES-X cipher

                                                                                                                                                "},{"location":"man3/EVP_desx_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_desx_cbc(void);\n
                                                                                                                                                "},{"location":"man3/EVP_desx_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The DES-X encryption algorithm for EVP.

                                                                                                                                                All modes below use a key length of 128 bits and acts on blocks of 128-bits.

                                                                                                                                                • EVP_desx_cbc()

                                                                                                                                                  The DES-X algorithm in CBC mode.

                                                                                                                                                  This algorithm is not provided by the OpenSSL default provider. To use it is necessary to load either the OpenSSL legacy provider or another implementation.

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-DES(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_desx_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_desx_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_desx_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_idea_cbc/","title":"EVP_idea_cbc","text":""},{"location":"man3/EVP_idea_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_idea_cbc, EVP_idea_cfb, EVP_idea_cfb64, EVP_idea_ecb, EVP_idea_ofb - EVP IDEA cipher

                                                                                                                                                "},{"location":"man3/EVP_idea_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_idea_cbc(void);\nconst EVP_CIPHER *EVP_idea_cfb(void);\nconst EVP_CIPHER *EVP_idea_cfb64(void);\nconst EVP_CIPHER *EVP_idea_ecb(void);\nconst EVP_CIPHER *EVP_idea_ofb(void);\n
                                                                                                                                                "},{"location":"man3/EVP_idea_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The IDEA encryption algorithm for EVP.

                                                                                                                                                • EVP_idea_cbc(), EVP_idea_cfb(), EVP_idea_cfb64(), EVP_idea_ecb(), EVP_idea_ofb()

                                                                                                                                                  The IDEA encryption algorithm in CBC, CFB, ECB and OFB modes respectively.

                                                                                                                                                "},{"location":"man3/EVP_idea_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-IDEA(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_idea_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_idea_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_idea_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_md2/","title":"EVP_md2","text":""},{"location":"man3/EVP_md2/#name","title":"NAME","text":"

                                                                                                                                                EVP_md2 - MD2 For EVP

                                                                                                                                                "},{"location":"man3/EVP_md2/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_md2(void);\n
                                                                                                                                                "},{"location":"man3/EVP_md2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                MD2 is a cryptographic hash function standardized in RFC 1319 and designed by Ronald Rivest. This implementation is only available with the legacy provider.

                                                                                                                                                • EVP_md2()

                                                                                                                                                  The MD2 algorithm which produces a 128-bit output from a given input.

                                                                                                                                                "},{"location":"man3/EVP_md2/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MD2(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_md2/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_md2/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                IETF RFC 1319.

                                                                                                                                                "},{"location":"man3/EVP_md2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), provider(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_md2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_md4/","title":"EVP_md4","text":""},{"location":"man3/EVP_md4/#name","title":"NAME","text":"

                                                                                                                                                EVP_md4 - MD4 For EVP

                                                                                                                                                "},{"location":"man3/EVP_md4/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_md4(void);\n
                                                                                                                                                "},{"location":"man3/EVP_md4/#description","title":"DESCRIPTION","text":"

                                                                                                                                                MD4 is a cryptographic hash function standardized in RFC 1320 and designed by Ronald Rivest, first published in 1990. This implementation is only available with the legacy provider.

                                                                                                                                                • EVP_md4()

                                                                                                                                                  The MD4 algorithm which produces a 128-bit output from a given input.

                                                                                                                                                "},{"location":"man3/EVP_md4/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MD4(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_md4/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_md4/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                IETF RFC 1320.

                                                                                                                                                "},{"location":"man3/EVP_md4/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), provider(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_md4/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_md5/","title":"EVP_md5","text":""},{"location":"man3/EVP_md5/#name","title":"NAME","text":"

                                                                                                                                                EVP_md5, EVP_md5_sha1 - MD5 For EVP

                                                                                                                                                "},{"location":"man3/EVP_md5/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_md5(void);\nconst EVP_MD *EVP_md5_sha1(void);\n
                                                                                                                                                "},{"location":"man3/EVP_md5/#description","title":"DESCRIPTION","text":"

                                                                                                                                                MD5 is a cryptographic hash function standardized in RFC 1321 and designed by Ronald Rivest.

                                                                                                                                                The CMU Software Engineering Institute considers MD5 unsuitable for further use since its security has been severely compromised.

                                                                                                                                                • EVP_md5()

                                                                                                                                                  The MD5 algorithm which produces a 128-bit output from a given input.

                                                                                                                                                • EVP_md5_sha1()

                                                                                                                                                  A hash algorithm of SSL v3 that combines MD5 with SHA-1 as described in RFC 6101.

                                                                                                                                                  WARNING: this algorithm is not intended for non-SSL usage.

                                                                                                                                                "},{"location":"man3/EVP_md5/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MD5(7) or EVP_MD-MD5-SHA1(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_md5/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_md5/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                IETF RFC 1321.

                                                                                                                                                "},{"location":"man3/EVP_md5/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_md5/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_mdc2/","title":"EVP_mdc2","text":""},{"location":"man3/EVP_mdc2/#name","title":"NAME","text":"

                                                                                                                                                EVP_mdc2 - MDC-2 For EVP

                                                                                                                                                "},{"location":"man3/EVP_mdc2/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_mdc2(void);\n
                                                                                                                                                "},{"location":"man3/EVP_mdc2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                MDC-2 (Modification Detection Code 2 or Meyer-Schilling) is a cryptographic hash function based on a block cipher. This implementation is only available with the legacy provider.

                                                                                                                                                • EVP_mdc2()

                                                                                                                                                  The MDC-2DES algorithm of using MDC-2 with the DES block cipher. It produces a 128-bit output from a given input.

                                                                                                                                                "},{"location":"man3/EVP_mdc2/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-MDC2(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_mdc2/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_mdc2/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                ISO/IEC 10118-2:2000 Hash-Function 2, with DES as the underlying block cipher.

                                                                                                                                                "},{"location":"man3/EVP_mdc2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), provider(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_mdc2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_rc2_cbc/","title":"EVP_rc2_cbc","text":""},{"location":"man3/EVP_rc2_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_rc2_cbc, EVP_rc2_cfb, EVP_rc2_cfb64, EVP_rc2_ecb, EVP_rc2_ofb, EVP_rc2_40_cbc, EVP_rc2_64_cbc - EVP RC2 cipher

                                                                                                                                                "},{"location":"man3/EVP_rc2_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_rc2_cbc(void);\nconst EVP_CIPHER *EVP_rc2_cfb(void);\nconst EVP_CIPHER *EVP_rc2_cfb64(void);\nconst EVP_CIPHER *EVP_rc2_ecb(void);\nconst EVP_CIPHER *EVP_rc2_ofb(void);\nconst EVP_CIPHER *EVP_rc2_40_cbc(void);\nconst EVP_CIPHER *EVP_rc2_64_cbc(void);\n
                                                                                                                                                "},{"location":"man3/EVP_rc2_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The RC2 encryption algorithm for EVP.

                                                                                                                                                • EVP_rc2_cbc(), EVP_rc2_cfb(), EVP_rc2_cfb64(), EVP_rc2_ecb(), EVP_rc2_ofb()

                                                                                                                                                  RC2 encryption algorithm in CBC, CFB, ECB and OFB modes respectively. This is a variable key length cipher with an additional parameter called \"effective key bits\" or \"effective key length\". By default both are set to 128 bits.

                                                                                                                                                • EVP_rc2_40_cbc(), EVP_rc2_64_cbc()

                                                                                                                                                  RC2 algorithm in CBC mode with a default key length and effective key length of 40 and 64 bits.

                                                                                                                                                  WARNING: these functions are obsolete. Their usage should be replaced with the EVP_rc2_cbc(), EVP_CIPHER_CTX_set_key_length() and EVP_CIPHER_CTX_ctrl() functions to set the key length and effective key length.

                                                                                                                                                "},{"location":"man3/EVP_rc2_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-RC2(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_rc2_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_rc2_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_rc2_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_rc4/","title":"EVP_rc4","text":""},{"location":"man3/EVP_rc4/#name","title":"NAME","text":"

                                                                                                                                                EVP_rc4, EVP_rc4_40, EVP_rc4_hmac_md5 - EVP RC4 stream cipher

                                                                                                                                                "},{"location":"man3/EVP_rc4/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_rc4(void);\nconst EVP_CIPHER *EVP_rc4_40(void);\nconst EVP_CIPHER *EVP_rc4_hmac_md5(void);\n
                                                                                                                                                "},{"location":"man3/EVP_rc4/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The RC4 stream cipher for EVP.

                                                                                                                                                • EVP_rc4()

                                                                                                                                                  RC4 stream cipher. This is a variable key length cipher with a default key length of 128 bits.

                                                                                                                                                • EVP_rc4_40()

                                                                                                                                                  RC4 stream cipher with 40 bit key length.

                                                                                                                                                  WARNING: this function is obsolete. Its usage should be replaced with the EVP_rc4() and the EVP_CIPHER_CTX_set_key_length() functions.

                                                                                                                                                • EVP_rc4_hmac_md5()

                                                                                                                                                  Authenticated encryption with the RC4 stream cipher with MD5 as HMAC.

                                                                                                                                                  WARNING: this is not intended for usage outside of TLS and requires calling of some undocumented ctrl functions. These ciphers do not conform to the EVP AEAD interface.

                                                                                                                                                "},{"location":"man3/EVP_rc4/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-RC4(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_rc4/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_rc4/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_rc4/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_rc5_32_12_16_cbc/","title":"EVP_rc5_32_12_16_cbc","text":""},{"location":"man3/EVP_rc5_32_12_16_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_rc5_32_12_16_cbc, EVP_rc5_32_12_16_cfb, EVP_rc5_32_12_16_cfb64, EVP_rc5_32_12_16_ecb, EVP_rc5_32_12_16_ofb - EVP RC5 cipher

                                                                                                                                                "},{"location":"man3/EVP_rc5_32_12_16_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_cfb(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);\n
                                                                                                                                                "},{"location":"man3/EVP_rc5_32_12_16_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The RC5 encryption algorithm for EVP.

                                                                                                                                                • EVP_rc5_32_12_16_cbc(), EVP_rc5_32_12_16_cfb(), EVP_rc5_32_12_16_cfb64(), EVP_rc5_32_12_16_ecb(), EVP_rc5_32_12_16_ofb()

                                                                                                                                                  RC5 encryption algorithm in CBC, CFB, ECB and OFB modes respectively. This is a variable key length cipher with an additional \"number of rounds\" parameter. By default the key length is set to 128 bits and 12 rounds. Alternative key lengths can be set using EVP_CIPHER_CTX_set_key_length(3). The maximum key length is 2040 bits.

                                                                                                                                                  The following rc5 specific _ctrl_s are supported (see EVP_CIPHER_CTX_ctrl(3)).

                                                                                                                                                  • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, rounds, NULL)

                                                                                                                                                    Sets the number of rounds to rounds. This must be one of RC5_8_ROUNDS, RC5_12_ROUNDS or RC5_16_ROUNDS.

                                                                                                                                                  • EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &rounds)

                                                                                                                                                    Stores the number of rounds currently configured in *rounds where *rounds is an int.

                                                                                                                                                "},{"location":"man3/EVP_rc5_32_12_16_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-RC5(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_rc5_32_12_16_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_rc5_32_12_16_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_rc5_32_12_16_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_ripemd160/","title":"EVP_ripemd160","text":""},{"location":"man3/EVP_ripemd160/#name","title":"NAME","text":"

                                                                                                                                                EVP_ripemd160 - RIPEMD160 For EVP

                                                                                                                                                "},{"location":"man3/EVP_ripemd160/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_ripemd160(void);\n
                                                                                                                                                "},{"location":"man3/EVP_ripemd160/#description","title":"DESCRIPTION","text":"

                                                                                                                                                RIPEMD-160 is a cryptographic hash function first published in 1996 belonging to the RIPEMD family (RACE Integrity Primitives Evaluation Message Digest). This implementation is only available with the legacy provider.

                                                                                                                                                • EVP_ripemd160()

                                                                                                                                                  The RIPEMD-160 algorithm which produces a 160-bit output from a given input.

                                                                                                                                                "},{"location":"man3/EVP_ripemd160/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-RIPEMD160(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_ripemd160/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_ripemd160/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                ISO/IEC 10118-3:2016 Dedicated Hash-Function 1 (RIPEMD-160).

                                                                                                                                                "},{"location":"man3/EVP_ripemd160/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), provider(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_ripemd160/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_seed_cbc/","title":"EVP_seed_cbc","text":""},{"location":"man3/EVP_seed_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_seed_cbc, EVP_seed_cfb, EVP_seed_cfb128, EVP_seed_ecb, EVP_seed_ofb - EVP SEED cipher

                                                                                                                                                "},{"location":"man3/EVP_seed_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_seed_cbc(void);\nconst EVP_CIPHER *EVP_seed_cfb(void);\nconst EVP_CIPHER *EVP_seed_cfb128(void);\nconst EVP_CIPHER *EVP_seed_ecb(void);\nconst EVP_CIPHER *EVP_seed_ofb(void);\n
                                                                                                                                                "},{"location":"man3/EVP_seed_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The SEED encryption algorithm for EVP.

                                                                                                                                                All modes below use a key length of 128 bits and acts on blocks of 128-bits.

                                                                                                                                                • EVP_seed_cbc(), EVP_seed_cfb(), EVP_seed_cfb128(), EVP_seed_ecb(), EVP_seed_ofb()

                                                                                                                                                  The SEED encryption algorithm in CBC, CFB, ECB and OFB modes respectively.

                                                                                                                                                "},{"location":"man3/EVP_seed_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-SEED(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_seed_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return an EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_seed_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_seed_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/","title":"EVP_set_default_properties","text":""},{"location":"man3/EVP_set_default_properties/#name","title":"NAME","text":"

                                                                                                                                                EVP_set_default_properties, EVP_default_properties_enable_fips, EVP_default_properties_is_fips_enabled - Set default properties for future algorithm fetches

                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nint EVP_set_default_properties(OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable);\nint EVP_default_properties_is_fips_enabled(OSSL_LIB_CTX *libctx);\n
                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/#description","title":"DESCRIPTION","text":"

                                                                                                                                                EVP_set_default_properties() sets the default properties for all future EVP algorithm fetches, implicit as well as explicit. See \"ALGORITHM FETCHING\" in crypto(7) for information about implicit and explicit fetching.

                                                                                                                                                EVP_set_default_properties stores the properties given with the string propq among the EVP data that's been stored in the library context given with libctx (NULL signifies the default library context).

                                                                                                                                                Any previous default property for the specified library context will be dropped.

                                                                                                                                                EVP_default_properties_enable_fips() sets the 'fips=yes' to be a default property if enable is non zero, otherwise it clears 'fips' from the default property query for the given libctx. It merges the fips default property query with any existing query strings that have been set via EVP_set_default_properties().

                                                                                                                                                EVP_default_properties_is_fips_enabled() indicates if 'fips=yes' is a default property for the given libctx.

                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/#notes","title":"NOTES","text":"

                                                                                                                                                EVP_set_default_properties() and EVP_default_properties_enable_fips() are not thread safe. They are intended to be called only during the initialisation phase of a libctx.

                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                EVP_set_default_properties() and EVP_default_properties_enable_fips() return 1 on success, or 0 on failure. An error is placed on the error stack if a failure occurs.

                                                                                                                                                EVP_default_properties_is_fips_enabled() returns 1 if the 'fips=yes' default property is set for the given libctx, otherwise it returns 0.

                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                EVP_MD_fetch(3)

                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/#history","title":"HISTORY","text":"

                                                                                                                                                The functions described here were added in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/EVP_set_default_properties/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_sha1/","title":"EVP_sha1","text":""},{"location":"man3/EVP_sha1/#name","title":"NAME","text":"

                                                                                                                                                EVP_sha1 - SHA-1 For EVP

                                                                                                                                                "},{"location":"man3/EVP_sha1/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sha1(void);\n
                                                                                                                                                "},{"location":"man3/EVP_sha1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function standardized in NIST FIPS 180-4. The algorithm was designed by the United States National Security Agency and initially published in 1995.

                                                                                                                                                • EVP_sha1()

                                                                                                                                                  The SHA-1 algorithm which produces a 160-bit output from a given input.

                                                                                                                                                "},{"location":"man3/EVP_sha1/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SHA1(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_sha1/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_sha1/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                NIST FIPS 180-4.

                                                                                                                                                "},{"location":"man3/EVP_sha1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_sha1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_sha224/","title":"EVP_sha224","text":""},{"location":"man3/EVP_sha224/#name","title":"NAME","text":"

                                                                                                                                                EVP_sha224, EVP_sha256, EVP_sha512_224, EVP_sha512_256, EVP_sha384, EVP_sha512 - SHA-2 For EVP

                                                                                                                                                "},{"location":"man3/EVP_sha224/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sha224(void);\nconst EVP_MD *EVP_sha256(void);\nconst EVP_MD *EVP_sha512_224(void);\nconst EVP_MD *EVP_sha512_256(void);\nconst EVP_MD *EVP_sha384(void);\nconst EVP_MD *EVP_sha512(void);\n
                                                                                                                                                "},{"location":"man3/EVP_sha224/#description","title":"DESCRIPTION","text":"

                                                                                                                                                SHA-2 (Secure Hash Algorithm 2) is a family of cryptographic hash functions standardized in NIST FIPS 180-4, first published in 2001.

                                                                                                                                                • EVP_sha224(), EVP_sha256(), EVP_sha512_224, EVP_sha512_256, EVP_sha384(), EVP_sha512()

                                                                                                                                                  The SHA-2 SHA-224, SHA-256, SHA-512/224, SHA512/256, SHA-384 and SHA-512 algorithms, which generate 224, 256, 224, 256, 384 and 512 bits respectively of output from a given input.

                                                                                                                                                  The two algorithms: SHA-512/224 and SHA512/256 are truncated forms of the SHA-512 algorithm. They are distinct from SHA-224 and SHA-256 even though their outputs are of the same size.

                                                                                                                                                "},{"location":"man3/EVP_sha224/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SHA2(7)instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_sha224/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_sha224/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                NIST FIPS 180-4.

                                                                                                                                                "},{"location":"man3/EVP_sha224/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_sha224/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_sha3_224/","title":"EVP_sha3_224","text":""},{"location":"man3/EVP_sha3_224/#name","title":"NAME","text":"

                                                                                                                                                EVP_sha3_224, EVP_sha3_256, EVP_sha3_384, EVP_sha3_512, EVP_shake128, EVP_shake256 - SHA-3 For EVP

                                                                                                                                                "},{"location":"man3/EVP_sha3_224/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sha3_224(void);\nconst EVP_MD *EVP_sha3_256(void);\nconst EVP_MD *EVP_sha3_384(void);\nconst EVP_MD *EVP_sha3_512(void);\n\nconst EVP_MD *EVP_shake128(void);\nconst EVP_MD *EVP_shake256(void);\n
                                                                                                                                                "},{"location":"man3/EVP_sha3_224/#description","title":"DESCRIPTION","text":"

                                                                                                                                                SHA-3 (Secure Hash Algorithm 3) is a family of cryptographic hash functions standardized in NIST FIPS 202, first published in 2015. It is based on the Keccak algorithm.

                                                                                                                                                • EVP_sha3_224(), EVP_sha3_256(), EVP_sha3_384(), EVP_sha3_512()

                                                                                                                                                  The SHA-3 SHA-3-224, SHA-3-256, SHA-3-384, and SHA-3-512 algorithms respectively. They produce 224, 256, 384 and 512 bits of output from a given input.

                                                                                                                                                • EVP_shake128(), EVP_shake256()

                                                                                                                                                  The SHAKE-128 and SHAKE-256 Extendable Output Functions (XOF) that can generate a variable hash length.

                                                                                                                                                  Specifically, EVP_shake128 provides an overall security of 128 bits, while EVP_shake256 provides that of 256 bits.

                                                                                                                                                "},{"location":"man3/EVP_sha3_224/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SHA3(7) or EVP_MD-SHAKE(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_sha3_224/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_sha3_224/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                NIST FIPS 202.

                                                                                                                                                "},{"location":"man3/EVP_sha3_224/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_sha3_224/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_sm3/","title":"EVP_sm3","text":""},{"location":"man3/EVP_sm3/#name","title":"NAME","text":"

                                                                                                                                                EVP_sm3 - SM3 for EVP

                                                                                                                                                "},{"location":"man3/EVP_sm3/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_sm3(void);\n
                                                                                                                                                "},{"location":"man3/EVP_sm3/#description","title":"DESCRIPTION","text":"

                                                                                                                                                SM3 is a cryptographic hash function with a 256-bit output, defined in GB/T 32905-2016.

                                                                                                                                                • EVP_sm3()

                                                                                                                                                  The SM3 hash function.

                                                                                                                                                "},{"location":"man3/EVP_sm3/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-SM3(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_sm3/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_sm3/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                GB/T 32905-2016 and GM/T 0004-2012.

                                                                                                                                                "},{"location":"man3/EVP_sm3/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_sm3/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved. Copyright 2017 Ribose Inc. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_sm4_cbc/","title":"EVP_sm4_cbc","text":""},{"location":"man3/EVP_sm4_cbc/#name","title":"NAME","text":"

                                                                                                                                                EVP_sm4_cbc, EVP_sm4_ecb, EVP_sm4_cfb, EVP_sm4_cfb128, EVP_sm4_ofb, EVP_sm4_ctr - EVP SM4 cipher

                                                                                                                                                "},{"location":"man3/EVP_sm4_cbc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_CIPHER *EVP_sm4_cbc(void);\nconst EVP_CIPHER *EVP_sm4_ecb(void);\nconst EVP_CIPHER *EVP_sm4_cfb(void);\nconst EVP_CIPHER *EVP_sm4_cfb128(void);\nconst EVP_CIPHER *EVP_sm4_ofb(void);\nconst EVP_CIPHER *EVP_sm4_ctr(void);\n
                                                                                                                                                "},{"location":"man3/EVP_sm4_cbc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The SM4 blockcipher (GB/T 32907-2016) for EVP.

                                                                                                                                                All modes below use a key length of 128 bits and acts on blocks of 128 bits.

                                                                                                                                                • EVP_sm4_cbc(), EVP_sm4_ecb(), EVP_sm4_cfb(), EVP_sm4_cfb128(), EVP_sm4_ofb(), EVP_sm4_ctr()

                                                                                                                                                  The SM4 blockcipher with a 128-bit key in CBC, ECB, CFB, OFB and CTR modes respectively.

                                                                                                                                                "},{"location":"man3/EVP_sm4_cbc/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling these functions multiple times and should consider using EVP_CIPHER_fetch(3) with EVP_CIPHER-SM4(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_sm4_cbc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_CIPHER structure that contains the implementation of the symmetric cipher. See EVP_CIPHER_meth_new(3) for details of the EVP_CIPHER structure.

                                                                                                                                                "},{"location":"man3/EVP_sm4_cbc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), EVP_EncryptInit(3), EVP_CIPHER_meth_new(3)

                                                                                                                                                "},{"location":"man3/EVP_sm4_cbc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved. Copyright 2017 Ribose Inc. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/EVP_whirlpool/","title":"EVP_whirlpool","text":""},{"location":"man3/EVP_whirlpool/#name","title":"NAME","text":"

                                                                                                                                                EVP_whirlpool - WHIRLPOOL For EVP

                                                                                                                                                "},{"location":"man3/EVP_whirlpool/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/evp.h>\n\nconst EVP_MD *EVP_whirlpool(void);\n
                                                                                                                                                "},{"location":"man3/EVP_whirlpool/#description","title":"DESCRIPTION","text":"

                                                                                                                                                WHIRLPOOL is a cryptographic hash function standardized in ISO/IEC 10118-3:2004 designed by Vincent Rijmen and Paulo S. L. M. Barreto. This implementation is only available with the legacy provider.

                                                                                                                                                • EVP_whirlpool()

                                                                                                                                                  The WHIRLPOOL algorithm that produces a message digest of 512-bits from a given input.

                                                                                                                                                "},{"location":"man3/EVP_whirlpool/#notes","title":"NOTES","text":"

                                                                                                                                                Developers should be aware of the negative performance implications of calling this function multiple times and should consider using EVP_MD_fetch(3) with EVP_MD-WHIRLPOOL(7) instead. See \"Performance\" in crypto(7) for further information.

                                                                                                                                                "},{"location":"man3/EVP_whirlpool/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions return a EVP_MD structure that contains the implementation of the message digest. See EVP_MD_meth_new(3) for details of the EVP_MD structure.

                                                                                                                                                "},{"location":"man3/EVP_whirlpool/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                ISO/IEC 10118-3:2004.

                                                                                                                                                "},{"location":"man3/EVP_whirlpool/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                evp(7), provider(7), EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/EVP_whirlpool/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/HMAC/","title":"HMAC","text":""},{"location":"man3/HMAC/#name","title":"NAME","text":"

                                                                                                                                                HMAC, HMAC_CTX_new, HMAC_CTX_reset, HMAC_CTX_free, HMAC_Init, HMAC_Init_ex, HMAC_Update, HMAC_Final, HMAC_CTX_copy, HMAC_CTX_set_flags, HMAC_CTX_get_md, HMAC_size - HMAC message authentication code

                                                                                                                                                "},{"location":"man3/HMAC/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/hmac.h>\n\nunsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,\n                    const unsigned char *data, size_t data_len,\n                    unsigned char *md, unsigned int *md_len);\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                HMAC_CTX *HMAC_CTX_new(void);\nint HMAC_CTX_reset(HMAC_CTX *ctx);\n\nint HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len,\n                 const EVP_MD *md, ENGINE *impl);\nint HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);\nint HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);\n\nvoid HMAC_CTX_free(HMAC_CTX *ctx);\n\nint HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);\nvoid HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);\nconst EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx);\n\nsize_t HMAC_size(const HMAC_CTX *e);\n

                                                                                                                                                The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                int HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len,\n              const EVP_MD *md);\n
                                                                                                                                                "},{"location":"man3/HMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                HMAC is a MAC (message authentication code), i.e. a keyed hash function used for message authentication, which is based on a hash function.

                                                                                                                                                HMAC() computes the message authentication code of the data_len bytes at data using the hash function evp_md and the key key which is key_len bytes long. The key may also be NULL with key_len being 0.

                                                                                                                                                It places the result in md (which must have space for the output of the hash function, which is no more than EVP_MAX_MD_SIZE bytes). If md is NULL, the digest is placed in a static array. The size of the output is placed in md_len, unless it is NULL. Note: passing a NULL value for md to use the static array is not thread safe.

                                                                                                                                                evp_md is a message digest such as EVP_sha1(), EVP_ripemd160() etc. HMAC does not support variable output length digests such as EVP_shake128() and EVP_shake256().

                                                                                                                                                HMAC() uses the default OSSL_LIB_CTX. Use EVP_Q_mac(3) instead if a library context is required.

                                                                                                                                                All of the functions described below are deprecated. Applications should instead use EVP_MAC_CTX_new(3), EVP_MAC_CTX_free(3), EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3) or the 'quick' single-shot MAC function EVP_Q_mac(3).

                                                                                                                                                HMAC_CTX_new() creates a new HMAC_CTX in heap memory.

                                                                                                                                                HMAC_CTX_reset() clears an existing HMAC_CTX and associated resources, making it suitable for new computations as if it was newly created with HMAC_CTX_new().

                                                                                                                                                HMAC_CTX_free() erases the key and other data from the HMAC_CTX, releases any associated resources and finally frees the HMAC_CTX itself. If the argument is NULL, nothing is done.

                                                                                                                                                The following functions may be used if the message is not completely stored in memory:

                                                                                                                                                HMAC_Init_ex() initializes or reuses a HMAC_CTX structure to use the hash function evp_md and key key. If both are NULL, or if key is NULL and evp_md is the same as the previous call, then the existing key is reused. ctx must have been created with HMAC_CTX_new() before the first use of an HMAC_CTX in this function.

                                                                                                                                                If HMAC_Init_ex() is called with key NULL and evp_md is not the same as the previous digest used by ctx then an error is returned because reuse of an existing key with a different digest is not supported.

                                                                                                                                                HMAC_Init() initializes a HMAC_CTX structure to use the hash function evp_md and the key key which is key_len bytes long.

                                                                                                                                                HMAC_Update() can be called repeatedly with chunks of the message to be authenticated (len bytes at data).

                                                                                                                                                HMAC_Final() places the message authentication code in md, which must have space for the hash function output.

                                                                                                                                                HMAC_CTX_copy() copies all of the internal state from sctx into dctx.

                                                                                                                                                HMAC_CTX_set_flags() applies the specified flags to the internal EVP_MD_CTXs. These flags have the same meaning as for EVP_MD_CTX_set_flags(3).

                                                                                                                                                HMAC_CTX_get_md() returns the EVP_MD that has previously been set for the supplied HMAC_CTX.

                                                                                                                                                HMAC_size() returns the length in bytes of the underlying hash function output.

                                                                                                                                                "},{"location":"man3/HMAC/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                HMAC() returns a pointer to the message authentication code or NULL if an error occurred.

                                                                                                                                                HMAC_CTX_new() returns a pointer to a new HMAC_CTX on success or NULL if an error occurred.

                                                                                                                                                HMAC_CTX_reset(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and HMAC_CTX_copy() return 1 for success or 0 if an error occurred.

                                                                                                                                                HMAC_CTX_get_md() return the EVP_MD previously set for the supplied HMAC_CTX or NULL if no EVP_MD has been set.

                                                                                                                                                HMAC_size() returns the length in bytes of the underlying hash function output or zero on error.

                                                                                                                                                "},{"location":"man3/HMAC/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                RFC 2104

                                                                                                                                                "},{"location":"man3/HMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                SHA1(3), EVP_Q_mac(3), evp(7)

                                                                                                                                                "},{"location":"man3/HMAC/#history","title":"HISTORY","text":"

                                                                                                                                                All functions except for HMAC() were deprecated in OpenSSL 3.0.

                                                                                                                                                HMAC_CTX_init() was replaced with HMAC_CTX_reset() in OpenSSL 1.1.0.

                                                                                                                                                HMAC_CTX_cleanup() existed in OpenSSL before version 1.1.0.

                                                                                                                                                HMAC_CTX_new(), HMAC_CTX_free() and HMAC_CTX_get_md() are new in OpenSSL 1.1.0.

                                                                                                                                                HMAC_Init_ex(), HMAC_Update() and HMAC_Final() did not return values in OpenSSL before version 1.0.0.

                                                                                                                                                "},{"location":"man3/HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/MD5/","title":"MD5","text":""},{"location":"man3/MD5/#name","title":"NAME","text":"

                                                                                                                                                MD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update, MD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions

                                                                                                                                                "},{"location":"man3/MD5/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/md2.h>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md);\n\nint MD2_Init(MD2_CTX *c);\nint MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);\nint MD2_Final(unsigned char *md, MD2_CTX *c);\n\n\n#include <openssl/md4.h>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md);\n\nint MD4_Init(MD4_CTX *c);\nint MD4_Update(MD4_CTX *c, const void *data, unsigned long len);\nint MD4_Final(unsigned char *md, MD4_CTX *c);\n\n\n#include <openssl/md5.h>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);\n\nint MD5_Init(MD5_CTX *c);\nint MD5_Update(MD5_CTX *c, const void *data, unsigned long len);\nint MD5_Final(unsigned char *md, MD5_CTX *c);\n
                                                                                                                                                "},{"location":"man3/MD5/#description","title":"DESCRIPTION","text":"

                                                                                                                                                All of the functions described on this page are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3).

                                                                                                                                                MD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output.

                                                                                                                                                MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest of the n bytes at d and place it in md (which must have space for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 bytes of output). If md is NULL, the digest is placed in a static array.

                                                                                                                                                The following functions may be used if the message is not completely stored in memory:

                                                                                                                                                MD2_Init() initializes a MD2_CTX structure.

                                                                                                                                                MD2_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

                                                                                                                                                MD2_Final() places the message digest in md, which must have space for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the MD2_CTX.

                                                                                                                                                MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() are analogous using an MD4_CTX and MD5_CTX structure.

                                                                                                                                                Applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling the hash functions directly.

                                                                                                                                                "},{"location":"man3/MD5/#note","title":"NOTE","text":"

                                                                                                                                                MD2, MD4, and MD5 are recommended only for compatibility with existing applications. In new applications, hashes from the SHA-2 or SHA-3 family should be preferred.

                                                                                                                                                "},{"location":"man3/MD5/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                MD2(), MD4(), and MD5() return pointers to the hash value.

                                                                                                                                                MD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() return 1 for success, 0 otherwise.

                                                                                                                                                "},{"location":"man3/MD5/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                RFC 1319, RFC 1320, RFC 1321

                                                                                                                                                "},{"location":"man3/MD5/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                EVP_DigestInit(3), EVP_MD-SHA2(7), EVP_MD-SHA3(7)

                                                                                                                                                "},{"location":"man3/MD5/#history","title":"HISTORY","text":"

                                                                                                                                                All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/MD5/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/MDC2_Init/","title":"MDC2_Init","text":""},{"location":"man3/MDC2_Init/#name","title":"NAME","text":"

                                                                                                                                                MDC2, MDC2_Init, MDC2_Update, MDC2_Final - MDC2 hash function

                                                                                                                                                "},{"location":"man3/MDC2_Init/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/mdc2.h>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                unsigned char *MDC2(const unsigned char *d, unsigned long n,\n                    unsigned char *md);\n\nint MDC2_Init(MDC2_CTX *c);\nint MDC2_Update(MDC2_CTX *c, const unsigned char *data,\n                unsigned long len);\nint MDC2_Final(unsigned char *md, MDC2_CTX *c);\n
                                                                                                                                                "},{"location":"man3/MDC2_Init/#description","title":"DESCRIPTION","text":"

                                                                                                                                                All of the functions described on this page are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3).

                                                                                                                                                MDC2 is a method to construct hash functions with 128 bit output from block ciphers. These functions are an implementation of MDC2 with DES.

                                                                                                                                                MDC2() computes the MDC2 message digest of the n bytes at d and places it in md (which must have space for MDC2_DIGEST_LENGTH == 16 bytes of output). If md is NULL, the digest is placed in a static array.

                                                                                                                                                The following functions may be used if the message is not completely stored in memory:

                                                                                                                                                MDC2_Init() initializes a MDC2_CTX structure.

                                                                                                                                                MDC2_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

                                                                                                                                                MDC2_Final() places the message digest in md, which must have space for MDC2_DIGEST_LENGTH == 16 bytes of output, and erases the MDC2_CTX.

                                                                                                                                                Applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling the hash functions directly.

                                                                                                                                                "},{"location":"man3/MDC2_Init/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                MDC2() returns a pointer to the hash value.

                                                                                                                                                MDC2_Init(), MDC2_Update() and MDC2_Final() return 1 for success, 0 otherwise.

                                                                                                                                                "},{"location":"man3/MDC2_Init/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                ISO/IEC 10118-2:2000 Hash-Function 2, with DES as the underlying block cipher.

                                                                                                                                                "},{"location":"man3/MDC2_Init/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                EVP_DigestInit(3)

                                                                                                                                                "},{"location":"man3/MDC2_Init/#history","title":"HISTORY","text":"

                                                                                                                                                All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/MDC2_Init/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/NCONF_new_ex/","title":"NCONF_new_ex","text":""},{"location":"man3/NCONF_new_ex/#name","title":"NAME","text":"

                                                                                                                                                NCONF_new_ex, NCONF_new, NCONF_free, NCONF_default, NCONF_load, NCONF_get0_libctx, NCONF_get_section, NCONF_get_section_names - functionality to Load and parse configuration files manually

                                                                                                                                                "},{"location":"man3/NCONF_new_ex/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/conf.h>\n\ntypedef struct {\n    char *section;\n    char *name;\n    char *value;\n} CONF_VALUE;\n\nCONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);\nCONF *NCONF_new(CONF_METHOD *meth);\nvoid NCONF_free(CONF *conf);\nCONF_METHOD *NCONF_default(void);\nint NCONF_load(CONF *conf, const char *file, long *eline);\nOSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);\n\nSTACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *name);\nSTACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);\n
                                                                                                                                                "},{"location":"man3/NCONF_new_ex/#description","title":"DESCRIPTION","text":"

                                                                                                                                                NCONF_new_ex() creates a new CONF object in heap memory and assigns to it a context libctx that can be used during loading. If the method table meth is set to NULL then the default value of NCONF_default() is used.

                                                                                                                                                NCONF_new() is similar to NCONF_new_ex() but sets the libctx to NULL.

                                                                                                                                                NCONF_free() frees the data associated with conf and then frees the conf object. If the argument is NULL, nothing is done.

                                                                                                                                                NCONF_load() parses the file named filename and adds the values found to conf. If an error occurs file and eline list the file and line that the load failed on if they are not NULL.

                                                                                                                                                NCONF_default() gets the default method table for processing a configuration file.

                                                                                                                                                NCONF_get0_libctx() gets the library context associated with the conf parameter.

                                                                                                                                                NCONF_get_section_names() gets the names of the sections associated with the conf as STACK_OF(OPENSSL_CSTRING) strings. The individual strings are associated with the conf and will be invalid after conf is freed. The returned stack must be freed with sk_OPENSSL_CSTRING_free().

                                                                                                                                                NCONF_get_section() gets the config values associated with the conf from the config section name as STACK_OF(CONF_VALUE) structures. The returned stack is associated with the conf and will be invalid after conf is freed. It must not be freed by the caller.

                                                                                                                                                "},{"location":"man3/NCONF_new_ex/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                NCONF_load() returns 1 on success or 0 on error.

                                                                                                                                                NCONF_new_ex() and NCONF_new() return a newly created CONF object or NULL if an error occurs.

                                                                                                                                                "},{"location":"man3/NCONF_new_ex/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                CONF_modules_load_file(3),

                                                                                                                                                "},{"location":"man3/NCONF_new_ex/#history","title":"HISTORY","text":"

                                                                                                                                                NCONF_new_ex(), NCONF_get0_libctx(), and NCONF_get_section_names() were added in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/NCONF_new_ex/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/","title":"OBJ_nid2obj","text":""},{"location":"man3/OBJ_nid2obj/#name","title":"NAME","text":"

                                                                                                                                                i2t_ASN1_OBJECT, OBJ_length, OBJ_get0_data, OBJ_nid2obj, OBJ_nid2ln, OBJ_nid2sn, OBJ_obj2nid, OBJ_txt2nid, OBJ_ln2nid, OBJ_sn2nid, OBJ_cmp, OBJ_dup, OBJ_txt2obj, OBJ_obj2txt, OBJ_create, OBJ_cleanup, OBJ_add_sigid - ASN1 object utility functions

                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/objects.h>\n\nASN1_OBJECT *OBJ_nid2obj(int n);\nconst char *OBJ_nid2ln(int n);\nconst char *OBJ_nid2sn(int n);\n\nint OBJ_obj2nid(const ASN1_OBJECT *o);\nint OBJ_ln2nid(const char *ln);\nint OBJ_sn2nid(const char *sn);\n\nint OBJ_txt2nid(const char *s);\n\nASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name);\nint OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);\n\nint i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);\n\nint OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b);\nASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o);\n\nint OBJ_create(const char *oid, const char *sn, const char *ln);\n\nsize_t OBJ_length(const ASN1_OBJECT *obj);\nconst unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj);\n\nint OBJ_add_sigid(int signid, int dig_id, int pkey_id);\n

                                                                                                                                                The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                void OBJ_cleanup(void);\n
                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The ASN1 object utility functions process ASN1_OBJECT structures which are a representation of the ASN1 OBJECT IDENTIFIER (OID) type. For convenience, OIDs are usually represented in source code as numeric identifiers, or NIDs. OpenSSL has an internal table of OIDs that are generated when the library is built, and their corresponding NIDs are available as defined constants. For the functions below, application code should treat all returned values -- OIDs, NIDs, or names -- as constants.

                                                                                                                                                OBJ_nid2obj(), OBJ_nid2ln() and OBJ_nid2sn() convert the NID n to an ASN1_OBJECT structure, its long name and its short name respectively, or NULL if an error occurred.

                                                                                                                                                OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() return the corresponding NID for the object o, the long name ln or the short name sn respectively or NID_undef if an error occurred.

                                                                                                                                                OBJ_txt2nid() returns NID corresponding to text string s. s can be a long name, a short name or the numerical representation of an object.

                                                                                                                                                OBJ_txt2obj() converts the text string s into an ASN1_OBJECT structure. If no_name is 0 then long names and short names will be interpreted as well as numerical forms. If no_name is 1 only the numerical form is acceptable.

                                                                                                                                                OBJ_obj2txt() converts the ASN1_OBJECT a into a textual representation. Unless buf is NULL, the representation is written as a NUL-terminated string to buf, where at most buf_len bytes are written, truncating the result if necessary. In any case it returns the total string length, excluding the NUL character, required for non-truncated representation, or -1 on error. If no_name is 0 then if the object has a long or short name then that will be used, otherwise the numerical form will be used. If no_name is 1 then the numerical form will always be used.

                                                                                                                                                i2t_ASN1_OBJECT() is the same as OBJ_obj2txt() with the no_name set to zero.

                                                                                                                                                OBJ_cmp() compares a to b. If the two are identical 0 is returned.

                                                                                                                                                OBJ_dup() returns a copy of o.

                                                                                                                                                OBJ_create() adds a new object to the internal table. oid is the numerical form of the object, sn the short name and ln the long name. A new NID is returned for the created object in case of success and NID_undef in case of failure.

                                                                                                                                                OBJ_length() returns the size of the content octets of obj.

                                                                                                                                                OBJ_get0_data() returns a pointer to the content octets of obj. The returned pointer is an internal pointer which must not be freed.

                                                                                                                                                OBJ_add_sigid() creates a new composite \"Signature Algorithm\" that associates a given NID with two other NIDs - one representing the underlying signature algorithm and the other representing a digest algorithm to be used in conjunction with it. signid represents the NID for the composite \"Signature Algorithm\", dig_id is the NID for the digest algorithm and pkey_id is the NID for the underlying signature algorithm. As there are signature algorithms that do not require a digest, NID_undef is a valid dig_id.

                                                                                                                                                OBJ_cleanup() releases any resources allocated by creating new objects.

                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#notes","title":"NOTES","text":"

                                                                                                                                                Objects in OpenSSL can have a short name, a long name and a numerical identifier (NID) associated with them. A standard set of objects is represented in an internal table. The appropriate values are defined in the header file objects.h.

                                                                                                                                                For example the OID for commonName has the following definitions:

                                                                                                                                                #define SN_commonName                   \"CN\"\n#define LN_commonName                   \"commonName\"\n#define NID_commonName                  13\n

                                                                                                                                                New objects can be added by calling OBJ_create().

                                                                                                                                                Table objects have certain advantages over other objects: for example their NIDs can be used in a C language switch statement. They are also static constant structures which are shared: that is there is only a single constant structure for each table object.

                                                                                                                                                Objects which are not in the table have the NID value NID_undef.

                                                                                                                                                Objects do not need to be in the internal tables to be processed, the functions OBJ_txt2obj() and OBJ_obj2txt() can process the numerical form of an OID.

                                                                                                                                                Some objects are used to represent algorithms which do not have a corresponding ASN.1 OBJECT IDENTIFIER encoding (for example no OID currently exists for a particular algorithm). As a result they cannot be encoded or decoded as part of ASN.1 structures. Applications can determine if there is a corresponding OBJECT IDENTIFIER by checking OBJ_length() is not zero.

                                                                                                                                                These functions cannot return const because an ASN1_OBJECT can represent both an internal, constant, OID and a dynamically-created one. The latter cannot be constant because it needs to be freed after use.

                                                                                                                                                These functions were not thread safe in OpenSSL 3.0 and before.

                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OBJ_nid2obj() returns an ASN1_OBJECT structure or NULL is an error occurred.

                                                                                                                                                OBJ_nid2ln() and OBJ_nid2sn() returns a valid string or NULL on error.

                                                                                                                                                OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() and OBJ_txt2nid() return a NID or NID_undef on error.

                                                                                                                                                OBJ_add_sigid() returns 1 on success or 0 on error.

                                                                                                                                                i2t_ASN1_OBJECT() an OBJ_obj2txt() return -1 on error. On success, they return the length of the string written to buf if buf is not NULL and buf_len is big enough, otherwise the total string length. Note that this does not count the trailing NUL character.

                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#examples","title":"EXAMPLES","text":"

                                                                                                                                                Create an object for commonName:

                                                                                                                                                ASN1_OBJECT *o = OBJ_nid2obj(NID_commonName);\n

                                                                                                                                                Check if an object is commonName

                                                                                                                                                if (OBJ_obj2nid(obj) == NID_commonName)\n    /* Do something */\n

                                                                                                                                                Create a new NID and initialize an object from it:

                                                                                                                                                int new_nid = OBJ_create(\"1.2.3.4\", \"NewOID\", \"New Object Identifier\");\nASN1_OBJECT *obj = OBJ_nid2obj(new_nid);\n

                                                                                                                                                Create a new object directly:

                                                                                                                                                obj = OBJ_txt2obj(\"1.2.3.4\", 1);\n
                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                ERR_get_error(3)

                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#history","title":"HISTORY","text":"

                                                                                                                                                OBJ_cleanup() was deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto(3) and should not be used.

                                                                                                                                                "},{"location":"man3/OBJ_nid2obj/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/","title":"OCSP_REQUEST_new","text":""},{"location":"man3/OCSP_REQUEST_new/#name","title":"NAME","text":"

                                                                                                                                                OCSP_REQUEST_new, OCSP_REQUEST_free, OCSP_request_add0_id, OCSP_request_sign, OCSP_request_add1_cert, OCSP_request_onereq_count, OCSP_request_onereq_get0 - OCSP request functions

                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/ocsp.h>\n\nOCSP_REQUEST *OCSP_REQUEST_new(void);\nvoid OCSP_REQUEST_free(OCSP_REQUEST *req);\n\nOCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);\n\nint OCSP_request_sign(OCSP_REQUEST *req,\n                      X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,\n                      STACK_OF(X509) *certs, unsigned long flags);\n\nint OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);\n\nint OCSP_request_onereq_count(OCSP_REQUEST *req);\nOCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);\n
                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OCSP_REQUEST_new() allocates and returns an empty OCSP_REQUEST structure.

                                                                                                                                                OCSP_REQUEST_free() frees up the request structure req. If the argument is NULL, nothing is done.

                                                                                                                                                OCSP_request_add0_id() adds certificate ID cid to req. It returns the OCSP_ONEREQ structure added so an application can add additional extensions to the request. The id parameter MUST NOT be freed up after the operation.

                                                                                                                                                OCSP_request_sign() signs OCSP request req using certificate signer, private key key, digest dgst and additional certificates certs. If the flags option OCSP_NOCERTS is set then no certificates will be included in the request.

                                                                                                                                                OCSP_request_add1_cert() adds certificate cert to request req. The application is responsible for freeing up cert after use.

                                                                                                                                                OCSP_request_onereq_count() returns the total number of OCSP_ONEREQ structures in req.

                                                                                                                                                OCSP_request_onereq_get0() returns an internal pointer to the OCSP_ONEREQ contained in req of index i. The index value i runs from 0 to OCSP_request_onereq_count(req) - 1.

                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OCSP_REQUEST_new() returns an empty OCSP_REQUEST structure or NULL if an error occurred.

                                                                                                                                                OCSP_request_add0_id() returns the OCSP_ONEREQ structure containing cid or NULL if an error occurred.

                                                                                                                                                OCSP_request_sign() and OCSP_request_add1_cert() return 1 for success and 0 for failure.

                                                                                                                                                OCSP_request_onereq_count() returns the total number of OCSP_ONEREQ structures in req and -1 on error.

                                                                                                                                                OCSP_request_onereq_get0() returns a pointer to an OCSP_ONEREQ structure or NULL if the index value is out or range.

                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/#notes","title":"NOTES","text":"

                                                                                                                                                An OCSP request structure contains one or more OCSP_ONEREQ structures corresponding to each certificate.

                                                                                                                                                OCSP_request_onereq_count() and OCSP_request_onereq_get0() are mainly used by OCSP responders.

                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/#examples","title":"EXAMPLES","text":"

                                                                                                                                                Create an OCSP_REQUEST structure for certificate cert with issuer issuer:

                                                                                                                                                OCSP_REQUEST *req;\nOCSP_ID *cid;\n\nreq = OCSP_REQUEST_new();\nif (req == NULL)\n   /* error */\ncid = OCSP_cert_to_id(EVP_sha1(), cert, issuer);\nif (cid == NULL)\n   /* error */\n\nif (OCSP_REQUEST_add0_id(req, cid) == NULL)\n   /* error */\n\n/* Do something with req, e.g. query responder */\n\nOCSP_REQUEST_free(req);\n
                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                crypto(7), OCSP_cert_to_id(3), OCSP_request_add1_nonce(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)

                                                                                                                                                "},{"location":"man3/OCSP_REQUEST_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OCSP_cert_to_id/","title":"OCSP_cert_to_id","text":""},{"location":"man3/OCSP_cert_to_id/#name","title":"NAME","text":"

                                                                                                                                                OCSP_cert_to_id, OCSP_cert_id_new, OCSP_CERTID_free, OCSP_id_issuer_cmp, OCSP_id_cmp, OCSP_id_get0_info - OCSP certificate ID utility functions

                                                                                                                                                "},{"location":"man3/OCSP_cert_to_id/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/ocsp.h>\n\nOCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst,\n                             X509 *subject, X509 *issuer);\n\nOCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,\n                              X509_NAME *issuerName,\n                              ASN1_BIT_STRING *issuerKey,\n                              ASN1_INTEGER *serialNumber);\n\nvoid OCSP_CERTID_free(OCSP_CERTID *id);\n\nint OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);\nint OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);\n\nint OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,\n                      ASN1_OCTET_STRING **pikeyHash,\n                      ASN1_INTEGER **pserial, OCSP_CERTID *cid);\n
                                                                                                                                                "},{"location":"man3/OCSP_cert_to_id/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OCSP_cert_to_id() creates and returns a new OCSP_CERTID structure using message digest dgst for certificate subject with issuer issuer. If dgst is NULL then SHA1 is used.

                                                                                                                                                OCSP_cert_id_new() creates and returns a new OCSP_CERTID using dgst and issuer name issuerName, issuer key hash issuerKey and serial number serialNumber.

                                                                                                                                                OCSP_CERTID_free() frees up id. If the argument is NULL, nothing is done.

                                                                                                                                                OCSP_id_cmp() compares OCSP_CERTID a and b.

                                                                                                                                                OCSP_id_issuer_cmp() compares only the issuer name of OCSP_CERTID a and b.

                                                                                                                                                OCSP_id_get0_info() returns the issuer name hash, hash OID, issuer key hash and serial number contained in cid. If any of the values are not required the corresponding parameter can be set to NULL.

                                                                                                                                                "},{"location":"man3/OCSP_cert_to_id/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OCSP_cert_to_id() and OCSP_cert_id_new() return either a pointer to a valid OCSP_CERTID structure or NULL if an error occurred.

                                                                                                                                                OCSP_id_cmp() and OCSP_id_issuer_cmp() returns zero for a match and nonzero otherwise.

                                                                                                                                                OCSP_CERTID_free() does not return a value.

                                                                                                                                                OCSP_id_get0_info() returns 1 for success and 0 for failure.

                                                                                                                                                "},{"location":"man3/OCSP_cert_to_id/#notes","title":"NOTES","text":"

                                                                                                                                                OCSP clients will typically only use OCSP_cert_to_id() or OCSP_cert_id_new(): the other functions are used by responder applications.

                                                                                                                                                The values returned by OCSP_id_get0_info() are internal pointers and MUST NOT be freed up by an application: they will be freed when the corresponding OCSP_CERTID structure is freed.

                                                                                                                                                "},{"location":"man3/OCSP_cert_to_id/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                crypto(7), OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)

                                                                                                                                                "},{"location":"man3/OCSP_cert_to_id/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OCSP_request_add1_nonce/","title":"OCSP_request_add1_nonce","text":""},{"location":"man3/OCSP_request_add1_nonce/#name","title":"NAME","text":"

                                                                                                                                                OCSP_request_add1_nonce, OCSP_basic_add1_nonce, OCSP_check_nonce, OCSP_copy_nonce - OCSP nonce functions

                                                                                                                                                "},{"location":"man3/OCSP_request_add1_nonce/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/ocsp.h>\n\nint OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);\nint OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);\nint OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);\nint OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *resp);\n
                                                                                                                                                "},{"location":"man3/OCSP_request_add1_nonce/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OCSP_request_add1_nonce() adds a nonce of value val and length len to OCSP request req. If val is NULL a random nonce is used. If len is zero or negative a default length will be used (currently 16 bytes).

                                                                                                                                                OCSP_basic_add1_nonce() is identical to OCSP_request_add1_nonce() except it adds a nonce to OCSP basic response resp.

                                                                                                                                                OCSP_check_nonce() compares the nonce value in req and resp.

                                                                                                                                                OCSP_copy_nonce() copies any nonce value present in req to resp.

                                                                                                                                                "},{"location":"man3/OCSP_request_add1_nonce/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OCSP_request_add1_nonce() and OCSP_basic_add1_nonce() return 1 for success and 0 for failure.

                                                                                                                                                OCSP_copy_nonce() returns 1 if a nonce was successfully copied, 2 if no nonce was present in req and 0 if an error occurred.

                                                                                                                                                OCSP_check_nonce() returns the result of the nonce comparison between req and resp. The return value indicates the result of the comparison. If nonces are present and equal 1 is returned. If the nonces are absent 2 is returned. If a nonce is present in the response only 3 is returned. If nonces are present and unequal 0 is returned. If the nonce is present in the request only then -1 is returned.

                                                                                                                                                "},{"location":"man3/OCSP_request_add1_nonce/#notes","title":"NOTES","text":"

                                                                                                                                                For most purposes the nonce value in a request is set to a random value so the val parameter in OCSP_request_add1_nonce() is usually NULL.

                                                                                                                                                An OCSP nonce is typically added to an OCSP request to thwart replay attacks by checking the same nonce value appears in the response.

                                                                                                                                                Some responders may include a nonce in all responses even if one is not supplied.

                                                                                                                                                Some responders cache OCSP responses and do not sign each response for performance reasons. As a result they do not support nonces.

                                                                                                                                                The return values of OCSP_check_nonce() can be checked to cover each case. A positive return value effectively indicates success: nonces are both present and match, both absent or present in the response only. A nonzero return additionally covers the case where the nonce is present in the request only: this will happen if the responder doesn't support nonces. A zero return value indicates present and mismatched nonces: this should be treated as an error condition.

                                                                                                                                                "},{"location":"man3/OCSP_request_add1_nonce/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                crypto(7), OCSP_cert_to_id(3), OCSP_REQUEST_new(3), OCSP_resp_find_status(3), OCSP_response_status(3), OCSP_sendreq_new(3)

                                                                                                                                                "},{"location":"man3/OCSP_request_add1_nonce/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OCSP_resp_find_status/","title":"OCSP_resp_find_status","text":""},{"location":"man3/OCSP_resp_find_status/#name","title":"NAME","text":"

                                                                                                                                                OCSP_resp_find_status, OCSP_resp_count, OCSP_resp_get0, OCSP_resp_find, OCSP_single_get0_status, OCSP_resp_get0_produced_at, OCSP_resp_get0_signature, OCSP_resp_get0_tbs_sigalg, OCSP_resp_get0_respdata, OCSP_resp_get0_certs, OCSP_resp_get0_signer, OCSP_resp_get0_id, OCSP_resp_get1_id, OCSP_check_validity, OCSP_basic_verify - OCSP response utility functions

                                                                                                                                                "},{"location":"man3/OCSP_resp_find_status/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/ocsp.h>\n\nint OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,\n                          int *reason,\n                          ASN1_GENERALIZEDTIME **revtime,\n                          ASN1_GENERALIZEDTIME **thisupd,\n                          ASN1_GENERALIZEDTIME **nextupd);\n\nint OCSP_resp_count(OCSP_BASICRESP *bs);\nOCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);\nint OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);\nint OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,\n                            ASN1_GENERALIZEDTIME **revtime,\n                            ASN1_GENERALIZEDTIME **thisupd,\n                            ASN1_GENERALIZEDTIME **nextupd);\n\nconst ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(\n                            const OCSP_BASICRESP* single);\n\nconst ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs);\nconst X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs);\nconst OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs);\nconst STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);\n\nint OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer,\n                          STACK_OF(X509) *extra_certs);\n\nint OCSP_resp_get0_id(const OCSP_BASICRESP *bs,\n                      const ASN1_OCTET_STRING **pid,\n                      const X509_NAME **pname);\nint OCSP_resp_get1_id(const OCSP_BASICRESP *bs,\n                      ASN1_OCTET_STRING **pid,\n                      X509_NAME **pname);\n\nint OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,\n                        ASN1_GENERALIZEDTIME *nextupd,\n                        long sec, long maxsec);\n\nint OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,\n                     X509_STORE *st, unsigned long flags);\n
                                                                                                                                                "},{"location":"man3/OCSP_resp_find_status/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OCSP_resp_find_status() searches bs for an OCSP response for id. If it is successful the fields of the response are returned in *status, *reason, *revtime, *thisupd and *nextupd. The *status value will be one of V_OCSP_CERTSTATUS_GOOD, V_OCSP_CERTSTATUS_REVOKED or V_OCSP_CERTSTATUS_UNKNOWN. The *reason and *revtime fields are only set if the status is V_OCSP_CERTSTATUS_REVOKED. If set the *reason field will be set to the revocation reason which will be one of OCSP_REVOKED_STATUS_NOSTATUS, OCSP_REVOKED_STATUS_UNSPECIFIED, OCSP_REVOKED_STATUS_KEYCOMPROMISE, OCSP_REVOKED_STATUS_CACOMPROMISE, OCSP_REVOKED_STATUS_AFFILIATIONCHANGED, OCSP_REVOKED_STATUS_SUPERSEDED, OCSP_REVOKED_STATUS_CESSATIONOFOPERATION, OCSP_REVOKED_STATUS_CERTIFICATEHOLD or OCSP_REVOKED_STATUS_REMOVEFROMCRL.

                                                                                                                                                OCSP_resp_count() returns the number of OCSP_SINGLERESP structures in bs.

                                                                                                                                                OCSP_resp_get0() returns the OCSP_SINGLERESP structure in bs corresponding to index idx, where idx runs from 0 to OCSP_resp_count(bs) - 1.

                                                                                                                                                OCSP_resp_find() searches bs for id and returns the index of the first matching entry after last or starting from the beginning if last is -1.

                                                                                                                                                OCSP_single_get0_status() extracts the fields of single in *reason, *revtime, *thisupd and *nextupd.

                                                                                                                                                OCSP_resp_get0_produced_at() extracts the producedAt field from the single response bs.

                                                                                                                                                OCSP_resp_get0_signature() returns the signature from bs.

                                                                                                                                                OCSP_resp_get0_tbs_sigalg() returns the signatureAlgorithm from bs.

                                                                                                                                                OCSP_resp_get0_respdata() returns the tbsResponseData from bs.

                                                                                                                                                OCSP_resp_get0_certs() returns any certificates included in bs.

                                                                                                                                                OCSP_resp_get0_signer() attempts to retrieve the certificate that directly signed bs. The OCSP protocol does not require that this certificate is included in the certs field of the response, so additional certificates can be supplied via the extra_certs if the certificates that may have signed the response are known via some out-of-band mechanism.

                                                                                                                                                OCSP_resp_get0_id() gets the responder id of bs. If the responder ID is a name then <*pname> is set to the name and *pid is set to NULL. If the responder ID is by key ID then *pid is set to the key ID and *pname is set to NULL.

                                                                                                                                                OCSP_resp_get1_id() is the same as OCSP_resp_get0_id() but leaves ownership of *pid and *pname with the caller, who is responsible for freeing them unless the function returns 0.

                                                                                                                                                OCSP_check_validity() checks the validity of its thisupd and nextupd arguments, which will be typically obtained from OCSP_resp_find_status() or OCSP_single_get0_status(). If sec is nonzero it indicates how many seconds leeway should be allowed in the check. If maxsec is positive it indicates the maximum age of thisupd in seconds.

                                                                                                                                                OCSP_basic_verify() checks that the basic response message bs is correctly signed and that the signer certificate can be validated. It takes st as the trusted store and certs as a set of untrusted intermediate certificates. The function first tries to find the signer certificate of the response in certs. It then searches the certificates the responder may have included in bs unless flags contains OCSP_NOINTERN. It fails if the signer certificate cannot be found. Next, unless flags contains OCSP_NOSIGS, the function checks the signature of bs and fails on error. Then the function already returns success if flags contains OCSP_NOVERIFY or if the signer certificate was found in certs and flags contains OCSP_TRUSTOTHER. Otherwise the function continues by validating the signer certificate. If flags contains OCSP_PARTIAL_CHAIN it takes intermediate CA certificates in st as trust anchors. For more details, see the description of X509_V_FLAG_PARTIAL_CHAIN in \"VERIFICATION FLAGS\" in X509_VERIFY_PARAM_set_flags(3). If flags contains OCSP_NOCHAIN it ignores all certificates in certs and in bs, else it takes them as untrusted intermediate CA certificates and uses them for constructing the validation path for the signer certificate. Certificate revocation status checks using CRLs is disabled during path validation if the signer certificate contains the id-pkix-ocsp-no-check extension. After successful path validation the function returns success if the OCSP_NOCHECKS flag is set. Otherwise it verifies that the signer certificate meets the OCSP issuer criteria including potential delegation. If this does not succeed and the OCSP_NOEXPLICIT flag is not set the function checks for explicit trust for OCSP signing in the root CA certificate.

                                                                                                                                                "},{"location":"man3/OCSP_resp_find_status/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OCSP_resp_find_status() returns 1 if id is found in bs and 0 otherwise.

                                                                                                                                                OCSP_resp_count() returns the total number of OCSP_SINGLERESP fields in bs or -1 on error.

                                                                                                                                                OCSP_resp_get0() returns a pointer to an OCSP_SINGLERESP structure or NULL on error, such as idx being out of range.

                                                                                                                                                OCSP_resp_find() returns the index of id in bs (which may be 0) or -1 on error, such as when id was not found.

                                                                                                                                                OCSP_single_get0_status() returns the status of single or -1 if an error occurred.

                                                                                                                                                OCSP_resp_get0_produced_at() returns the producedAt field from bs.

                                                                                                                                                OCSP_resp_get0_signature() returns the signature from bs.

                                                                                                                                                OCSP_resp_get0_tbs_sigalg() returns the signatureAlgorithm field from bs.

                                                                                                                                                OCSP_resp_get0_respdata() returns the tbsResponseData field from bs.

                                                                                                                                                OCSP_resp_get0_certs() returns any certificates included in bs.

                                                                                                                                                OCSP_resp_get0_signer() returns 1 if the signing certificate was located, or 0 if not found or on error.

                                                                                                                                                OCSP_resp_get0_id() and OCSP_resp_get1_id() return 1 on success, 0 on failure.

                                                                                                                                                OCSP_check_validity() returns 1 if thisupd and nextupd are valid time values and the current time + sec is not before thisupd and, if maxsec >= 0, the current time - maxsec is not past nextupd. Otherwise it returns 0 to indicate an error.

                                                                                                                                                OCSP_basic_verify() returns 1 on success, 0 on verification not successful, or -1 on a fatal error such as malloc failure.

                                                                                                                                                "},{"location":"man3/OCSP_resp_find_status/#notes","title":"NOTES","text":"

                                                                                                                                                Applications will typically call OCSP_resp_find_status() using the certificate ID of interest and then check its validity using OCSP_check_validity(). They can then take appropriate action based on the status of the certificate.

                                                                                                                                                An OCSP response for a certificate contains thisUpdate and nextUpdate fields. Normally the current time should be between these two values. To account for clock skew the maxsec field can be set to nonzero in OCSP_check_validity(). Some responders do not set the nextUpdate field, this would otherwise mean an ancient response would be considered valid: the maxsec parameter to OCSP_check_validity() can be used to limit the permitted age of responses.

                                                                                                                                                The values written to *revtime, *thisupd and *nextupd by OCSP_resp_find_status() and OCSP_single_get0_status() are internal pointers which MUST NOT be freed up by the calling application. Any or all of these parameters can be set to NULL if their value is not required.

                                                                                                                                                "},{"location":"man3/OCSP_resp_find_status/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                crypto(7), OCSP_cert_to_id(3), OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3), OCSP_response_status(3), OCSP_sendreq_new(3), X509_VERIFY_PARAM_set_flags(3)

                                                                                                                                                "},{"location":"man3/OCSP_resp_find_status/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OCSP_response_status/","title":"OCSP_response_status","text":""},{"location":"man3/OCSP_response_status/#name","title":"NAME","text":"

                                                                                                                                                OCSP_response_status, OCSP_response_get1_basic, OCSP_response_create, OCSP_RESPONSE_free, OCSP_RESPID_set_by_name, OCSP_RESPID_set_by_key_ex, OCSP_RESPID_set_by_key, OCSP_RESPID_match_ex, OCSP_RESPID_match, OCSP_basic_sign, OCSP_basic_sign_ctx - OCSP response functions

                                                                                                                                                "},{"location":"man3/OCSP_response_status/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/ocsp.h>\n\nint OCSP_response_status(OCSP_RESPONSE *resp);\nOCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);\nOCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);\nvoid OCSP_RESPONSE_free(OCSP_RESPONSE *resp);\n\nint OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert);\nint OCSP_RESPID_set_by_key_ex(OCSP_RESPID *respid, X509 *cert,\n                              OSSL_LIB_CTX *libctx, const char *propq);\nint OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert);\nint OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OSSL_LIB_CTX *libctx,\n                         const char *propq);\nint OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert);\n\nint OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key,\n                    const EVP_MD *dgst, STACK_OF(X509) *certs,\n                    unsigned long flags);\nint OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, X509 *signer, EVP_MD_CTX *ctx,\n                        STACK_OF(X509) *certs, unsigned long flags);\n
                                                                                                                                                "},{"location":"man3/OCSP_response_status/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OCSP_response_status() returns the OCSP response status of resp. It returns one of the values: OCSP_RESPONSE_STATUS_SUCCESSFUL, OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, OCSP_RESPONSE_STATUS_INTERNALERROR, OCSP_RESPONSE_STATUS_TRYLATER OCSP_RESPONSE_STATUS_SIGREQUIRED, or OCSP_RESPONSE_STATUS_UNAUTHORIZED.

                                                                                                                                                OCSP_response_get1_basic() decodes and returns the OCSP_BASICRESP structure contained in resp.

                                                                                                                                                OCSP_response_create() creates and returns an OCSP_RESPONSE structure for status and optionally including basic response bs.

                                                                                                                                                OCSP_RESPONSE_free() frees up OCSP response resp. If the argument is NULL, nothing is done.

                                                                                                                                                OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the same as the subject name in the supplied X509 certificate cert for the OCSP responder.

                                                                                                                                                OCSP_RESPID_set_by_key_ex() sets the key of the OCSP_RESPID to be the same as the key in the supplied X509 certificate cert for the OCSP responder. The key is stored as a SHA1 hash. To calculate the hash the SHA1 algorithm is fetched using the library ctx libctx and the property query string propq (see \"ALGORITHM FETCHING\" in crypto(7) for further information).

                                                                                                                                                OCSP_RESPID_set_by_key() does the same as OCSP_RESPID_set_by_key_ex() except that the default library context is used with an empty property query string.

                                                                                                                                                Note that an OCSP_RESPID can only have one of the name, or the key set. Calling OCSP_RESPID_set_by_name() or OCSP_RESPID_set_by_key() will clear any existing setting.

                                                                                                                                                OCSP_RESPID_match_ex() tests whether the OCSP_RESPID given in respid matches with the X509 certificate cert based on the SHA1 hash. To calculate the hash the SHA1 algorithm is fetched using the library ctx libctx and the property query string propq (see \"ALGORITHM FETCHING\" in crypto(7) for further information).

                                                                                                                                                OCSP_RESPID_match() does the same as OCSP_RESPID_match_ex() except that the default library context is used with an empty property query string.

                                                                                                                                                OCSP_basic_sign() signs OCSP response brsp using certificate signer, private key key, digest dgst and additional certificates certs. If the flags option OCSP_NOCERTS is set then no certificates will be included in the response. If the flags option OCSP_RESPID_KEY is set then the responder is identified by key ID rather than by name. OCSP_basic_sign_ctx() also signs OCSP response brsp but uses the parameters contained in digest context ctx.

                                                                                                                                                "},{"location":"man3/OCSP_response_status/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OCSP_RESPONSE_status() returns a status value.

                                                                                                                                                OCSP_response_get1_basic() returns an OCSP_BASICRESP structure pointer or NULL if an error occurred.

                                                                                                                                                OCSP_response_create() returns an OCSP_RESPONSE structure pointer or NULL if an error occurred.

                                                                                                                                                OCSP_RESPONSE_free() does not return a value.

                                                                                                                                                OCSP_RESPID_set_by_name(), OCSP_RESPID_set_by_key(), OCSP_basic_sign(), and OCSP_basic_sign_ctx() return 1 on success or 0 on failure.

                                                                                                                                                OCSP_RESPID_match() returns 1 if the OCSP_RESPID and the X509 certificate match or 0 otherwise.

                                                                                                                                                "},{"location":"man3/OCSP_response_status/#notes","title":"NOTES","text":"

                                                                                                                                                OCSP_response_get1_basic() is only called if the status of a response is OCSP_RESPONSE_STATUS_SUCCESSFUL.

                                                                                                                                                "},{"location":"man3/OCSP_response_status/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                crypto(7) OCSP_cert_to_id(3) OCSP_request_add1_nonce(3) OCSP_REQUEST_new(3) OCSP_resp_find_status(3) OCSP_sendreq_new(3) OCSP_RESPID_new(3) OCSP_RESPID_free(3)

                                                                                                                                                "},{"location":"man3/OCSP_response_status/#history","title":"HISTORY","text":"

                                                                                                                                                The OCSP_RESPID_set_by_name(), OCSP_RESPID_set_by_key() and OCSP_RESPID_match() functions were added in OpenSSL 1.1.0a.

                                                                                                                                                The OCSP_basic_sign_ctx() function was added in OpenSSL 1.1.1.

                                                                                                                                                "},{"location":"man3/OCSP_response_status/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OCSP_sendreq_new/","title":"OCSP_sendreq_new","text":""},{"location":"man3/OCSP_sendreq_new/#name","title":"NAME","text":"

                                                                                                                                                OCSP_REQ_CTX, OCSP_sendreq_new, OCSP_sendreq_nbio, OCSP_sendreq_bio, OCSP_REQ_CTX_i2d, OCSP_REQ_CTX_add1_header, OCSP_REQ_CTX_free, OCSP_set_max_response_length, OCSP_REQ_CTX_set1_req - OCSP responder query functions

                                                                                                                                                "},{"location":"man3/OCSP_sendreq_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/ocsp.h>\n\nOSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,\n                                    const OCSP_REQUEST *req, int buf_size);\nOCSP_RESPONSE *OCSP_sendreq_bio(BIO *io, const char *path, OCSP_REQUEST *req);\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX;\nint OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OSSL_HTTP_REQ_CTX *rctx);\nint OCSP_REQ_CTX_i2d(OCSP_REQ_CT *rctx, const ASN1_ITEM *it, ASN1_VALUE *req);\nint OCSP_REQ_CTX_add1_header(OCSP_REQ_CT *rctx,\n                             const char *name, const char *value);\nvoid OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);\nvoid OCSP_set_max_response_length(OCSP_REQ_CT *rctx, unsigned long len);\nint OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, const OCSP_REQUEST *req);\n
                                                                                                                                                "},{"location":"man3/OCSP_sendreq_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                These functions perform an OCSP POST request / response transfer over HTTP, using the HTTP request functions described in OSSL_HTTP_REQ_CTX(3).

                                                                                                                                                The function OCSP_sendreq_new() builds a complete OSSL_HTTP_REQ_CTX structure with the BIO io to be used for requests and response, the URL path path, optionally the OCSP request req, and a response header maximum line length of buf_size. If buf_size is zero a default value of 4KiB is used. The req may be set to NULL and provided later using OCSP_REQ_CTX_set1_req() or OSSL_HTTP_REQ_CTX_set1_req(3). The io and path arguments to OCSP_sendreq_new() correspond to the components of the URL. For example if the responder URL is http://example.com/ocspreq the BIO io should haven been connected to host example.com on port 80 and path should be set to /ocspreq.

                                                                                                                                                OCSP_sendreq_nbio() attempts to send the request prepared in rctx and to gather the response via HTTP, using the BIO io and path that were given when calling OCSP_sendreq_new(). If the operation gets completed it assigns the response, a pointer to a OCSP_RESPONSE structure, in *presp. The function may need to be called again if its result is -1, which indicates BIO_should_retry(3). In such a case it is advisable to sleep a little in between, using BIO_wait(3) on the read BIO to prevent a busy loop.

                                                                                                                                                OCSP_sendreq_bio() combines OCSP_sendreq_new() with as many calls of OCSP_sendreq_nbio() as needed and then OCSP_REQ_CTX_free(), with a response header maximum line length 4k. It waits indefinitely on a response. It does not support setting a timeout or adding headers and is retained for compatibility; use OSSL_HTTP_transfer(3) instead.

                                                                                                                                                OCSP_REQ_CTX_i2d(rctx, it, req) is equivalent to the following:

                                                                                                                                                OSSL_HTTP_REQ_CTX_set1_req(rctx, \"application/ocsp-request\", it, req)\n

                                                                                                                                                OCSP_REQ_CTX_set1_req(rctx, req) is equivalent to the following:

                                                                                                                                                OSSL_HTTP_REQ_CTX_set1_req(rctx, \"application/ocsp-request\",\n                           ASN1_ITEM_rptr(OCSP_REQUEST),\n                           (const ASN1_VALUE *)req)\n

                                                                                                                                                The deprecated type and the remaining deprecated functions have been superseded by the following equivalents: OCSP_REQ_CTX by OSSL_HTTP_REQ_CTX(3), OCSP_REQ_CTX_add1_header() by OSSL_HTTP_REQ_CTX_add1_header(3), OCSP_REQ_CTX_free() by OSSL_HTTP_REQ_CTX_free(3), and OCSP_set_max_response_length() by OSSL_HTTP_REQ_CTX_set_max_response_length(3).

                                                                                                                                                "},{"location":"man3/OCSP_sendreq_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OCSP_sendreq_new() returns a valid OSSL_HTTP_REQ_CTX structure or NULL if an error occurred.

                                                                                                                                                OCSP_sendreq_nbio() returns 1 for success, 0 on error, -1 if retry is needed.

                                                                                                                                                OCSP_sendreq_bio() returns the OCSP_RESPONSE structure sent by the responder or NULL if an error occurred.

                                                                                                                                                "},{"location":"man3/OCSP_sendreq_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                OSSL_HTTP_REQ_CTX(3), OSSL_HTTP_transfer(3), OCSP_cert_to_id(3), OCSP_request_add1_nonce(3), OCSP_REQUEST_new(3), OCSP_resp_find_status(3), OCSP_response_status(3)

                                                                                                                                                "},{"location":"man3/OCSP_sendreq_new/#history","title":"HISTORY","text":"

                                                                                                                                                OCSP_REQ_CTX, OCSP_REQ_CTX_i2d(), OCSP_REQ_CTX_add1_header(), OCSP_REQ_CTX_free(), OCSP_set_max_response_length(), and OCSP_REQ_CTX_set1_req() were deprecated in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/OCSP_sendreq_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_Applink/","title":"OPENSSL_Applink","text":""},{"location":"man3/OPENSSL_Applink/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_Applink - glue between OpenSSL BIO and Win32 compiler run-time

                                                                                                                                                "},{"location":"man3/OPENSSL_Applink/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                __declspec(dllexport) void **OPENSSL_Applink();\n
                                                                                                                                                "},{"location":"man3/OPENSSL_Applink/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OPENSSL_Applink is application-side interface which provides a glue between OpenSSL BIO layer and Win32 compiler run-time environment. Even though it appears at application side, it's essentially OpenSSL private interface. For this reason application developers are not expected to implement it, but to compile provided module with compiler of their choice and link it into the target application. The referred module is available as applink.c, located alongside the public header files (only on the platforms where applicable).

                                                                                                                                                "},{"location":"man3/OPENSSL_Applink/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                Not available.

                                                                                                                                                "},{"location":"man3/OPENSSL_Applink/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_FILE/","title":"OPENSSL_FILE","text":""},{"location":"man3/OPENSSL_FILE/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_FILE, OPENSSL_LINE, OPENSSL_FUNC, OPENSSL_MSTR, OPENSSL_MSTR_HELPER - generic C programming utility macros

                                                                                                                                                "},{"location":"man3/OPENSSL_FILE/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/macros.h>\n\n#define OPENSSL_FILE /* typically: __FILE__ */\n#define OPENSSL_LINE /* typically: __LINE__ */\n#define OPENSSL_FUNC /* typically: __func__ */\n\n#define OPENSSL_MSTR_HELPER(x) #x\n#define OPENSSL_MSTR(x) OPENSSL_MSTR_HELPER(x)\n
                                                                                                                                                "},{"location":"man3/OPENSSL_FILE/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The macros OPENSSL_FILE and OPENSSL_LINE typically yield the current filename and line number during C compilation. When OPENSSL_NO_FILENAMES is defined they yield \"\" and 0, respectively.

                                                                                                                                                The macro OPENSSL_FUNC attempts to yield the name of the C function currently being compiled, as far as language and compiler versions allow. Otherwise, it yields \"(unknown function)\".

                                                                                                                                                The macro OPENSSL_MSTR yields the expansion of the macro given as argument, which is useful for concatenation with string constants. The macro OPENSSL_MSTR_HELPER is an auxiliary macro for this purpose.

                                                                                                                                                "},{"location":"man3/OPENSSL_FILE/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                see above

                                                                                                                                                "},{"location":"man3/OPENSSL_FILE/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                crypto(7)

                                                                                                                                                "},{"location":"man3/OPENSSL_FILE/#history","title":"HISTORY","text":"

                                                                                                                                                OPENSSL_FUNC, OPENSSL_MSTR, and OPENSSL_MSTR_HELPER were added in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/OPENSSL_FILE/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/","title":"OPENSSL_LH_COMPFUNC","text":""},{"location":"man3/OPENSSL_LH_COMPFUNC/#name","title":"NAME","text":"

                                                                                                                                                LHASH, LHASH_OF, DEFINE_LHASH_OF_EX, DEFINE_LHASH_OF, OPENSSL_LH_COMPFUNC, OPENSSL_LH_HASHFUNC, OPENSSL_LH_DOALL_FUNC, LHASH_DOALL_ARG_FN_TYPE, IMPLEMENT_LHASH_HASH_FN, IMPLEMENT_LHASH_COMP_FN, lh_TYPE_new, lh_TYPE_free, lh_TYPE_flush, lh_TYPE_insert, lh_TYPE_delete, lh_TYPE_retrieve, lh_TYPE_doall, lh_TYPE_doall_arg, lh_TYPE_num_items, lh_TYPE_get_down_load, lh_TYPE_set_down_load, lh_TYPE_error, OPENSSL_LH_new, OPENSSL_LH_free, OPENSSL_LH_flush, OPENSSL_LH_insert, OPENSSL_LH_delete, OPENSSL_LH_retrieve, OPENSSL_LH_doall, OPENSSL_LH_doall_arg, OPENSSL_LH_num_items, OPENSSL_LH_get_down_load, OPENSSL_LH_set_down_load, OPENSSL_LH_error - dynamic hash table

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/lhash.h>\n\nLHASH_OF(TYPE)\n\nDEFINE_LHASH_OF_EX(TYPE);\n\nLHASH_OF(TYPE) *lh_TYPE_new(OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC compare);\nvoid lh_TYPE_free(LHASH_OF(TYPE) *table);\nvoid lh_TYPE_flush(LHASH_OF(TYPE) *table);\n\nTYPE *lh_TYPE_insert(LHASH_OF(TYPE) *table, TYPE *data);\nTYPE *lh_TYPE_delete(LHASH_OF(TYPE) *table, TYPE *data);\nTYPE *lh_TYPE_retrieve(LHASH_OF(TYPE) *table, TYPE *data);\n\nvoid lh_TYPE_doall(LHASH_OF(TYPE) *table, OPENSSL_LH_DOALL_FUNC func);\nvoid lh_TYPE_doall_arg(LHASH_OF(TYPE) *table, OPENSSL_LH_DOALL_FUNCARG func,\n                       TYPE *arg);\n\nunsigned long lh_TYPE_num_items(OPENSSL_LHASH *lh);\nunsigned long lh_TYPE_get_down_load(OPENSSL_LHASH *lh);\nvoid lh_TYPE_set_down_load(OPENSSL_LHASH *lh, unsigned long dl);\n\nint lh_TYPE_error(LHASH_OF(TYPE) *table);\n\ntypedef int (*OPENSSL_LH_COMPFUNC)(const void *, const void *);\ntypedef unsigned long (*OPENSSL_LH_HASHFUNC)(const void *);\ntypedef void (*OPENSSL_LH_DOALL_FUNC)(const void *);\ntypedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *);\n\nOPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c);\nvoid OPENSSL_LH_free(OPENSSL_LHASH *lh);\nvoid OPENSSL_LH_flush(OPENSSL_LHASH *lh);\n\nvoid *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data);\nvoid *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data);\nvoid *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data);\n\nvoid OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func);\nvoid OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg);\n\nunsigned long OPENSSL_LH_num_items(OPENSSL_LHASH *lh);\nunsigned long OPENSSL_LH_get_down_load(OPENSSL_LHASH *lh);\nvoid OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long dl);\n\nint OPENSSL_LH_error(OPENSSL_LHASH *lh);\n\n#define LH_LOAD_MULT   /* integer constant */\n

                                                                                                                                                The following macro is deprecated:

                                                                                                                                                DEFINE_LHASH_OF(TYPE);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                This library implements type-checked dynamic hash tables. The hash table entries can be arbitrary structures. Usually they consist of key and value fields. In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes, such as SSL_SESSION.

                                                                                                                                                To define a new type-checked dynamic hash table, use DEFINE_LHASH_OF_EX(). DEFINE_LHASH_OF() was previously used for this purpose, but is now deprecated. The DEFINE_LHASH_OF_EX() macro provides all functionality of DEFINE_LHASH_OF() except for certain deprecated statistics functions (see OPENSSL_LH_stats(3)).

                                                                                                                                                lh_TYPE_new() creates a new LHASH_OF(TYPE) structure to store arbitrary data entries, and specifies the 'hash' and 'compare' callbacks to be used in organising the table's entries. The hash callback takes a pointer to a table entry as its argument and returns an unsigned long hash value for its key field. The hash value is normally truncated to a power of 2, so make sure that your hash function returns well mixed low order bits. The compare callback takes two arguments (pointers to two hash table entries), and returns 0 if their keys are equal, nonzero otherwise.

                                                                                                                                                If your hash table will contain items of some particular type and the hash and compare callbacks hash/compare these types, then the IMPLEMENT_LHASH_HASH_FN and IMPLEMENT_LHASH_COMP_FN macros can be used to create callback wrappers of the prototypes required by lh_TYPE_new() as shown in this example:

                                                                                                                                                /*\n * Implement the hash and compare functions; \"stuff\" can be any word.\n */\nstatic unsigned long stuff_hash(const TYPE *a)\n{\n    ...\n}\nstatic int stuff_cmp(const TYPE *a, const TYPE *b)\n{\n    ...\n}\n\n/*\n * Implement the wrapper functions.\n */\nstatic IMPLEMENT_LHASH_HASH_FN(stuff, TYPE)\nstatic IMPLEMENT_LHASH_COMP_FN(stuff, TYPE)\n

                                                                                                                                                If the type is going to be used in several places, the following macros can be used in a common header file to declare the function wrappers:

                                                                                                                                                DECLARE_LHASH_HASH_FN(stuff, TYPE)\nDECLARE_LHASH_COMP_FN(stuff, TYPE)\n

                                                                                                                                                Then a hash table of TYPE objects can be created using this:

                                                                                                                                                LHASH_OF(TYPE) *htable;\n\nhtable = B<lh_I<TYPE>_new>(LHASH_HASH_FN(stuff), LHASH_COMP_FN(stuff));\n

                                                                                                                                                lh_TYPE_free() frees the LHASH_OF(TYPE) structure table. Allocated hash table entries will not be freed; consider using lh_TYPE_doall() to deallocate any remaining entries in the hash table (see below). If the argument is NULL, nothing is done.

                                                                                                                                                lh_TYPE_flush() empties the LHASH_OF(TYPE) structure table. New entries can be added to the flushed table. Allocated hash table entries will not be freed; consider using lh_TYPE_doall() to deallocate any remaining entries in the hash table (see below).

                                                                                                                                                lh_TYPE_insert() inserts the structure pointed to by data into table. If there already is an entry with the same key, the old value is replaced. Note that lh_TYPE_insert() stores pointers, the data are not copied.

                                                                                                                                                lh_TYPE_delete() deletes an entry from table.

                                                                                                                                                lh_TYPE_retrieve() looks up an entry in table. Normally, data is a structure with the key field(s) set; the function will return a pointer to a fully populated structure.

                                                                                                                                                lh_TYPE_doall() will, for every entry in the hash table, call func with the data item as its parameter. For example:

                                                                                                                                                /* Cleans up resources belonging to 'a' (this is implemented elsewhere) */\nvoid TYPE_cleanup_doall(TYPE *a);\n\n/* Implement a prototype-compatible wrapper for \"TYPE_cleanup\" */\nIMPLEMENT_LHASH_DOALL_FN(TYPE_cleanup, TYPE)\n\n/* Call \"TYPE_cleanup\" against all items in a hash table. */\nlh_TYPE_doall(hashtable, LHASH_DOALL_FN(TYPE_cleanup));\n\n/* Then the hash table itself can be deallocated */\nlh_TYPE_free(hashtable);\n

                                                                                                                                                lh_TYPE_doall_arg() is the same as lh_TYPE_doall() except that func will be called with arg as the second argument and func should be of type LHASH_DOALL_ARG_FN(TYPE) (a callback prototype that is passed both the table entry and an extra argument). As with lh_doall(), you can instead choose to declare your callback with a prototype matching the types you are dealing with and use the declare/implement macros to create compatible wrappers that cast variables before calling your type-specific callbacks. An example of this is demonstrated here (printing all hash table entries to a BIO that is provided by the caller):

                                                                                                                                                /* Prints item 'a' to 'output_bio' (this is implemented elsewhere) */\nvoid TYPE_print_doall_arg(const TYPE *a, BIO *output_bio);\n\n/* Implement a prototype-compatible wrapper for \"TYPE_print\" */\nstatic IMPLEMENT_LHASH_DOALL_ARG_FN(TYPE, const TYPE, BIO)\n\n/* Print out the entire hashtable to a particular BIO */\nlh_TYPE_doall_arg(hashtable, LHASH_DOALL_ARG_FN(TYPE_print), BIO,\n                  logging_bio);\n

                                                                                                                                                Note that it is by default not safe to use lh_TYPE_delete() inside a callback passed to lh_TYPE_doall() or lh_TYPE_doall_arg(). The reason for this is that deleting an item from the hash table may result in the hash table being contracted to a smaller size and rehashed. lh_TYPE_doall() and lh_TYPE_doall_arg() are unsafe and will exhibit undefined behaviour under these conditions, as these functions assume the hash table size and bucket pointers do not change during the call.

                                                                                                                                                If it is desired to use lh_TYPE_doall() or lh_TYPE_doall_arg() with lh_TYPE_delete(), it is essential that you call lh_TYPE_set_down_load() with a down_load argument of 0 first. This disables hash table contraction and guarantees that it will be safe to delete items from a hash table during a call to lh_TYPE_doall() or lh_TYPE_doall_arg().

                                                                                                                                                It is never safe to call lh_TYPE_insert() during a call to lh_TYPE_doall() or lh_TYPE_doall_arg().

                                                                                                                                                lh_TYPE_error() can be used to determine if an error occurred in the last operation.

                                                                                                                                                lh_TYPE_num_items() returns the number of items in the hash table.

                                                                                                                                                lh_TYPE_get_down_load() and lh_TYPE_set_down_load() get and set the factor used to determine when the hash table is contracted. The factor is the load factor at or below which hash table contraction will occur, multiplied by LH_LOAD_MULT, where the load factor is the number of items divided by the number of nodes. Setting this value to 0 disables hash table contraction.

                                                                                                                                                OPENSSL_LH_new() is the same as the lh_TYPE_new() except that it is not type specific. So instead of returning an LHASH_OF(TYPE) value it returns a void *. In the same way the functions OPENSSL_LH_free(), OPENSSL_LH_flush(), OPENSSL_LH_insert(), OPENSSL_LH_delete(), OPENSSL_LH_retrieve(), OPENSSL_LH_doall(), OPENSSL_LH_doall_arg(), OPENSSL_LH_num_items(), OPENSSL_LH_get_down_load(), OPENSSL_LH_set_down_load() and OPENSSL_LH_error() are equivalent to the similarly named lh_TYPE functions except that they return or use a void * where the equivalent lh_TYPE function returns or uses a TYPE * or LHASH_OF(TYPE) *. lh_TYPE functions are implemented as type checked wrappers around the OPENSSL_LH functions. Most applications should not call the OPENSSL_LH functions directly.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                lh_TYPE_new() and OPENSSL_LH_new() return NULL on error, otherwise a pointer to the new LHASH structure.

                                                                                                                                                When a hash table entry is replaced, lh_TYPE_insert() or OPENSSL_LH_insert() return the value being replaced. NULL is returned on normal operation and on error.

                                                                                                                                                lh_TYPE_delete() and OPENSSL_LH_delete() return the entry being deleted. NULL is returned if there is no such value in the hash table.

                                                                                                                                                lh_TYPE_retrieve() and OPENSSL_LH_retrieve() return the hash table entry if it has been found, NULL otherwise.

                                                                                                                                                lh_TYPE_error() and OPENSSL_LH_error() return 1 if an error occurred in the last operation, 0 otherwise. It's meaningful only after non-retrieve operations.

                                                                                                                                                lh_TYPE_free(), OPENSSL_LH_free(), lh_TYPE_flush(), OPENSSL_LH_flush(), lh_TYPE_doall() OPENSSL_LH_doall(), lh_TYPE_doall_arg() and OPENSSL_LH_doall_arg() return no values.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#note","title":"NOTE","text":"

                                                                                                                                                The LHASH code is not thread safe. All updating operations, as well as lh_TYPE_error() or OPENSSL_LH_error() calls must be performed under a write lock. All retrieve operations should be performed under a read lock, unless accurate usage statistics are desired. In which case, a write lock should be used for retrieve operations as well. For output of the usage statistics, using the functions from OPENSSL_LH_stats(3), a read lock suffices.

                                                                                                                                                The LHASH code regards table entries as constant data. As such, it internally represents lh_insert()'d items with a \"const void *\" pointer type. This is why callbacks such as those used by lh_doall() and lh_doall_arg() declare their prototypes with \"const\", even for the parameters that pass back the table items' data pointers - for consistency, user-provided data is \"const\" at all times as far as the LHASH code is concerned. However, as callers are themselves providing these pointers, they can choose whether they too should be treating all such parameters as constant.

                                                                                                                                                As an example, a hash table may be maintained by code that, for reasons of encapsulation, has only \"const\" access to the data being indexed in the hash table (i.e. it is returned as \"const\" from elsewhere in their code) - in this case the LHASH prototypes are appropriate as-is. Conversely, if the caller is responsible for the life-time of the data in question, then they may well wish to make modifications to table item passed back in the lh_doall() or lh_doall_arg() callbacks (see the \"TYPE_cleanup\" example above). If so, the caller can either cast the \"const\" away (if they're providing the raw callbacks themselves) or use the macros to declare/implement the wrapper functions without \"const\" types.

                                                                                                                                                Callers that only have \"const\" access to data they're indexing in a table, yet declare callbacks without constant types (or cast the \"const\" away themselves), are therefore creating their own risks/bugs without being encouraged to do so by the API. On a related note, those auditing code should pay special attention to any instances of DECLARE/IMPLEMENT_LHASH_DOALL_[ARG_]_FN macros that provide types without any \"const\" qualifiers.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#bugs","title":"BUGS","text":"

                                                                                                                                                lh_TYPE_insert() and OPENSSL_LH_insert() return NULL both for success and error.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                OPENSSL_LH_stats(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#history","title":"HISTORY","text":"

                                                                                                                                                In OpenSSL 1.0.0, the lhash interface was revamped for better type checking.

                                                                                                                                                In OpenSSL 3.1, DEFINE_LHASH_OF_EX() was introduced and DEFINE_LHASH_OF() was deprecated.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_COMPFUNC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/","title":"OPENSSL_LH_stats","text":""},{"location":"man3/OPENSSL_LH_stats/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_LH_stats, OPENSSL_LH_node_stats, OPENSSL_LH_node_usage_stats, OPENSSL_LH_stats_bio, OPENSSL_LH_node_stats_bio, OPENSSL_LH_node_usage_stats_bio - LHASH statistics

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/lhash.h>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.1, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                void OPENSSL_LH_node_stats(LHASH *table, FILE *out);\nvoid OPENSSL_LH_node_usage_stats(LHASH *table, FILE *out);\n\nvoid OPENSSL_LH_node_stats_bio(LHASH *table, BIO *out);\nvoid OPENSSL_LH_node_usage_stats_bio(LHASH *table, BIO *out);\n\nvoid OPENSSL_LH_stats(LHASH *table, FILE *out);\nvoid OPENSSL_LH_stats_bio(LHASH *table, BIO *out);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The LHASH structure records statistics about most aspects of accessing the hash table.

                                                                                                                                                OPENSSL_LH_stats() prints out statistics on the size of the hash table and how many entries are in it. For historical reasons, this function also outputs a number of additional statistics, but the tracking of these statistics is no longer supported and these statistics are always reported as zero.

                                                                                                                                                OPENSSL_LH_node_stats() prints the number of entries for each 'bucket' in the hash table.

                                                                                                                                                OPENSSL_LH_node_usage_stats() prints out a short summary of the state of the hash table. It prints the 'load' and the 'actual load'. The load is the average number of data items per 'bucket' in the hash table. The 'actual load' is the average number of items per 'bucket', but only for buckets which contain entries. So the 'actual load' is the average number of searches that will need to find an item in the hash table, while the 'load' is the average number that will be done to record a miss.

                                                                                                                                                OPENSSL_LH_stats_bio(), OPENSSL_LH_node_stats_bio() and OPENSSL_LH_node_usage_stats_bio() are the same as the above, except that the output goes to a BIO.

                                                                                                                                                These functions are deprecated and should no longer be used.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                These functions do not return values.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/#note","title":"NOTE","text":"

                                                                                                                                                These calls should be made under a read lock. Refer to \"NOTE\" in OPENSSL_LH_COMPFUNC(3) for more details about the locks required when using the LHASH data structure.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                bio(7), OPENSSL_LH_COMPFUNC(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/#history","title":"HISTORY","text":"

                                                                                                                                                These functions were deprecated in version 3.1.

                                                                                                                                                "},{"location":"man3/OPENSSL_LH_stats/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_config/","title":"OPENSSL_config","text":""},{"location":"man3/OPENSSL_config/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_config, OPENSSL_no_config - simple OpenSSL configuration functions

                                                                                                                                                "},{"location":"man3/OPENSSL_config/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/conf.h>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                void OPENSSL_config(const char *appname);\nvoid OPENSSL_no_config(void);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_config/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OPENSSL_config() configures OpenSSL using the standard openssl.cnf and reads from the application section appname. If appname is NULL then the default section, openssl_conf, will be used. Errors are silently ignored. Multiple calls have no effect.

                                                                                                                                                OPENSSL_no_config() disables configuration. If called before OPENSSL_config() no configuration takes place.

                                                                                                                                                If the application is built with OPENSSL_LOAD_CONF defined, then a call to OpenSSL_add_all_algorithms() will implicitly call OPENSSL_config() first.

                                                                                                                                                "},{"location":"man3/OPENSSL_config/#notes","title":"NOTES","text":"

                                                                                                                                                The OPENSSL_config() function is designed to be a very simple \"call it and forget it\" function. It is however much better than nothing. Applications which need finer control over their configuration functionality should use the configuration functions such as CONF_modules_load() directly. This function is deprecated and its use should be avoided. Applications should instead call CONF_modules_load() during initialization (that is before starting any threads).

                                                                                                                                                There are several reasons why calling the OpenSSL configuration routines is advisable. For example, to load dynamic ENGINEs from shared libraries (DSOs). However, very few applications currently support the control interface and so very few can load and use dynamic ENGINEs. Equally in future more sophisticated ENGINEs will require certain control operations to customize them. If an application calls OPENSSL_config() it doesn't need to know or care about ENGINE control operations because they can be performed by editing a configuration file.

                                                                                                                                                "},{"location":"man3/OPENSSL_config/#environment","title":"ENVIRONMENT","text":"
                                                                                                                                                • OPENSSL_CONF

                                                                                                                                                  The path to the config file. Ignored in set-user-ID and set-group-ID programs.

                                                                                                                                                "},{"location":"man3/OPENSSL_config/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                Neither OPENSSL_config() nor OPENSSL_no_config() return a value.

                                                                                                                                                "},{"location":"man3/OPENSSL_config/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                config(5), CONF_modules_load_file(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_config/#history","title":"HISTORY","text":"

                                                                                                                                                The OPENSSL_no_config() and OPENSSL_config() functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto().

                                                                                                                                                "},{"location":"man3/OPENSSL_config/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_fork_prepare/","title":"OPENSSL_fork_prepare","text":""},{"location":"man3/OPENSSL_fork_prepare/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_fork_prepare, OPENSSL_fork_parent, OPENSSL_fork_child - OpenSSL fork handlers

                                                                                                                                                "},{"location":"man3/OPENSSL_fork_prepare/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/crypto.h>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                void OPENSSL_fork_prepare(void);\nvoid OPENSSL_fork_parent(void);\nvoid OPENSSL_fork_child(void);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_fork_prepare/#description","title":"DESCRIPTION","text":"

                                                                                                                                                These methods are currently unused, and as such, no replacement methods are required or planned.

                                                                                                                                                OpenSSL has state that should be reset when a process forks. For example, the entropy pool used to generate random numbers (and therefore encryption keys) should not be shared across multiple programs. The OPENSSL_fork_prepare(), OPENSSL_fork_parent(), and OPENSSL_fork_child() functions are used to reset this internal state.

                                                                                                                                                Platforms without fork(2) will probably not need to use these functions. Platforms with fork(2) but without pthread_atfork(3) will probably need to call them manually, as described in the following paragraph. Platforms such as Linux that have both functions will normally not need to call these functions as the OpenSSL library will do so automatically.

                                                                                                                                                OPENSSL_init_crypto(3) will register these functions with the appropriate handler, when the OPENSSL_INIT_ATFORK flag is used. For other applications, these functions can be called directly. They should be used according to the calling sequence described by the pthread_atfork(3) documentation, which is summarized here. OPENSSL_fork_prepare() should be called before a fork() is done. After the fork() returns, the parent process should call OPENSSL_fork_parent() and the child process should call OPENSSL_fork_child().

                                                                                                                                                "},{"location":"man3/OPENSSL_fork_prepare/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OPENSSL_fork_prepare(), OPENSSL_fork_parent() and OPENSSL_fork_child() do not return values.

                                                                                                                                                "},{"location":"man3/OPENSSL_fork_prepare/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                OPENSSL_init_crypto(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_fork_prepare/#history","title":"HISTORY","text":"

                                                                                                                                                These functions were added in OpenSSL 1.1.1.

                                                                                                                                                "},{"location":"man3/OPENSSL_fork_prepare/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_gmtime/","title":"OPENSSL_gmtime","text":""},{"location":"man3/OPENSSL_gmtime/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_gmtime, OPENSSL_gmtime_adj, OPENSSL_gmtime_diff - platform-agnostic OpenSSL time routines

                                                                                                                                                "},{"location":"man3/OPENSSL_gmtime/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/crypto.h>\n\nstruct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);\nint OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);\nint OPENSSL_gmtime_diff(int *pday, int *psec,\n                       const struct tm *from, const struct tm *to);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_gmtime/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OPENSSL_gmtime() returns the UTC time specified by timer into the provided result argument.

                                                                                                                                                OPENSSL_gmtime_adj() adds the offsets in offset_day and offset_sec to tm.

                                                                                                                                                OPENSSL_gmtime_diff() calculates the difference between from and to.

                                                                                                                                                "},{"location":"man3/OPENSSL_gmtime/#notes","title":"NOTES","text":"

                                                                                                                                                It is an error to call OPENSSL_gmtime() with result equal to NULL. The contents of the time_t given by timer are stored into the result. Calling with timer equal to NULL means use the current time.

                                                                                                                                                OPENSSL_gmtime_adj() converts tm into a days and seconds value, adds the offsets, then converts back into a struct tm specified by tm. Leap seconds are not considered.

                                                                                                                                                OPENSSL_gmtime_diff() calculates the difference between the two struct tm structures from and to. The difference in days is placed into *pday, the remaining seconds are placed to *psec. The value in *psec will be less than the number of seconds per day (3600). Leap seconds are not considered.

                                                                                                                                                "},{"location":"man3/OPENSSL_gmtime/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OPENSSL_gmtime() returns NULL on error, or result on success.

                                                                                                                                                OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() return 0 on error, and 1 on success.

                                                                                                                                                "},{"location":"man3/OPENSSL_gmtime/#history","title":"HISTORY","text":"

                                                                                                                                                OPENSSL_gmtime(), OPENSSL_gmtime_adj() and OPENSSL_gmtime_diff() have been in OpenSSL since 1.0.0.

                                                                                                                                                "},{"location":"man3/OPENSSL_gmtime/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_hexchar2int/","title":"OPENSSL_hexchar2int","text":""},{"location":"man3/OPENSSL_hexchar2int/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_hexchar2int, OPENSSL_hexstr2buf_ex, OPENSSL_hexstr2buf, OPENSSL_buf2hexstr_ex, OPENSSL_buf2hexstr - Hex encoding and decoding functions

                                                                                                                                                "},{"location":"man3/OPENSSL_hexchar2int/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/crypto.h>\n\nint OPENSSL_hexchar2int(unsigned char c);\nint OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, long *buflen,\n                          const char *str, const char sep);\nunsigned char *OPENSSL_hexstr2buf(const char *str, long *len);\nint OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength,\n                          const unsigned char *buf, long buflen,\n                          const char sep);\nchar *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_hexchar2int/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OPENSSL_hexchar2int() converts a hexadecimal character to its numeric equivalent.

                                                                                                                                                OPENSSL_hexstr2buf_ex() decodes the hex string str and places the resulting string of bytes in the given buf. The character sep is the separator between the bytes, setting this to '\\0' means that there is no separator. buf_n gives the size of the buffer. If buflen is not NULL, it is filled in with the result length. To find out how large the result will be, call this function with NULL for buf. Colons between two-character hex \"bytes\" are accepted and ignored. An odd number of hex digits is an error.

                                                                                                                                                OPENSSL_hexstr2buf() does the same thing as OPENSSL_hexstr2buf_ex(), but allocates the space for the result, and returns the result. It uses a default separator of ':'. The memory is allocated by calling OPENSSL_malloc() and should be released by calling OPENSSL_free().

                                                                                                                                                OPENSSL_buf2hexstr_ex() encodes the contents of the given buf with length buflen and places the resulting hexadecimal character string in the given str. The character sep is the separator between the bytes, setting this to '\\0' means that there is no separator. str_n gives the size of the of the string buffer. If strlength is not NULL, it is filled in with the result length. To find out how large the result will be, call this function with NULL for str.

                                                                                                                                                OPENSSL_buf2hexstr() does the same thing as OPENSSL_buf2hexstr_ex(), but allocates the space for the result, and returns the result. It uses a default separator of ':'. The memory is allocated by calling OPENSSL_malloc() and should be released by calling OPENSSL_free().

                                                                                                                                                "},{"location":"man3/OPENSSL_hexchar2int/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OPENSSL_hexchar2int returns the value of a decoded hex character, or -1 on error.

                                                                                                                                                OPENSSL_buf2hexstr() and OPENSSL_hexstr2buf() return a pointer to allocated memory, or NULL on error.

                                                                                                                                                OPENSSL_buf2hexstr_ex() and OPENSSL_hexstr2buf_ex() return 1 on success, or 0 on error.

                                                                                                                                                "},{"location":"man3/OPENSSL_hexchar2int/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_ia32cap/","title":"OPENSSL_ia32cap","text":""},{"location":"man3/OPENSSL_ia32cap/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_ia32cap - the x86[_64] processor capabilities vector

                                                                                                                                                "},{"location":"man3/OPENSSL_ia32cap/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                env OPENSSL_ia32cap=... <application>\n
                                                                                                                                                "},{"location":"man3/OPENSSL_ia32cap/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OpenSSL supports a range of x86[_64] instruction set extensions. These extensions are denoted by individual bits in capability vector returned by processor in EDX:ECX register pair after executing CPUID instruction with EAX=1 input value (see Intel Application Note #241618). This vector is copied to memory upon toolkit initialization and used to choose between different code paths to provide optimal performance across wide range of processors. For the moment of this writing following bits are significant:

                                                                                                                                                • bit #4 denoting presence of Time-Stamp Counter.
                                                                                                                                                • bit #19 denoting availability of CLFLUSH instruction;
                                                                                                                                                • bit #20, reserved by Intel, is used to choose among RC4 code paths;
                                                                                                                                                • bit #23 denoting MMX support;
                                                                                                                                                • bit #24, FXSR bit, denoting availability of XMM registers;
                                                                                                                                                • bit #25 denoting SSE support;
                                                                                                                                                • bit #26 denoting SSE2 support;
                                                                                                                                                • bit #28 denoting Hyperthreading, which is used to distinguish cores with shared cache;
                                                                                                                                                • bit #30, reserved by Intel, denotes specifically Intel CPUs;
                                                                                                                                                • bit #33 denoting availability of PCLMULQDQ instruction;
                                                                                                                                                • bit #41 denoting SSSE3, Supplemental SSE3, support;
                                                                                                                                                • bit #43 denoting AMD XOP support (forced to zero on non-AMD CPUs);
                                                                                                                                                • bit #54 denoting availability of MOVBE instruction;
                                                                                                                                                • bit #57 denoting AES-NI instruction set extension;
                                                                                                                                                • bit #58, XSAVE bit, lack of which in combination with MOVBE is used to identify Atom Silvermont core;
                                                                                                                                                • bit #59, OSXSAVE bit, denoting availability of YMM registers;
                                                                                                                                                • bit #60 denoting AVX extension;
                                                                                                                                                • bit #62 denoting availability of RDRAND instruction;

                                                                                                                                                For example, in 32-bit application context clearing bit #26 at run-time disables high-performance SSE2 code present in the crypto library, while clearing bit #24 disables SSE2 code operating on 128-bit XMM register bank. You might have to do the latter if target OpenSSL application is executed on SSE2 capable CPU, but under control of OS that does not enable XMM registers. Historically address of the capability vector copy was exposed to application through OPENSSL_ia32cap_loc(), but not anymore. Now the only way to affect the capability detection is to set OPENSSL_ia32cap environment variable prior target application start. To give a specific example, on Intel P4 processor env OPENSSL_ia32cap=0x16980010 apps/openssl, or better yet env OPENSSL_ia32cap=~0x1000000 apps/openssl would achieve the desired effect. Alternatively you can reconfigure the toolkit with no-sse2 option and recompile.

                                                                                                                                                Less intuitive is clearing bit #28, or ~0x10000000 in the \"environment variable\" terms. The truth is that it's not copied from CPUID output verbatim, but is adjusted to reflect whether or not the data cache is actually shared between logical cores. This in turn affects the decision on whether or not expensive countermeasures against cache-timing attacks are applied, most notably in AES assembler module.

                                                                                                                                                The capability vector is further extended with EBX value returned by CPUID with EAX=7 and ECX=0 as input. Following bits are significant:

                                                                                                                                                • bit #64+3 denoting availability of BMI1 instructions, e.g. ANDN;
                                                                                                                                                • bit #64+5 denoting availability of AVX2 instructions;
                                                                                                                                                • bit #64+8 denoting availability of BMI2 instructions, e.g. MULX and RORX;
                                                                                                                                                • bit #64+16 denoting availability of AVX512F extension;
                                                                                                                                                • bit #64+17 denoting availability of AVX512DQ extension;
                                                                                                                                                • bit #64+18 denoting availability of RDSEED instruction;
                                                                                                                                                • bit #64+19 denoting availability of ADCX and ADOX instructions;
                                                                                                                                                • bit #64+21 denoting availability of VPMADD52[LH]UQ instructions, aka AVX512IFMA extension;
                                                                                                                                                • bit #64+29 denoting availability of SHA extension;
                                                                                                                                                • bit #64+30 denoting availability of AVX512BW extension;
                                                                                                                                                • bit #64+31 denoting availability of AVX512VL extension;
                                                                                                                                                • bit #64+41 denoting availability of VAES extension;
                                                                                                                                                • bit #64+42 denoting availability of VPCLMULQDQ extension;

                                                                                                                                                To control this extended capability word use : as delimiter when setting up OPENSSL_ia32cap environment variable. For example assigning :~0x20 would disable AVX2 code paths, and :0 - all post-AVX extensions.

                                                                                                                                                "},{"location":"man3/OPENSSL_ia32cap/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                Not available.

                                                                                                                                                "},{"location":"man3/OPENSSL_ia32cap/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/","title":"OPENSSL_init_crypto","text":""},{"location":"man3/OPENSSL_init_crypto/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_INIT_new, OPENSSL_INIT_set_config_filename, OPENSSL_INIT_set_config_appname, OPENSSL_INIT_set_config_file_flags, OPENSSL_INIT_free, OPENSSL_init_crypto, OPENSSL_cleanup, OPENSSL_atexit, OPENSSL_thread_stop_ex, OPENSSL_thread_stop - OpenSSL initialisation and deinitialisation functions

                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/crypto.h>\n\nvoid OPENSSL_cleanup(void);\nint OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);\nint OPENSSL_atexit(void (*handler)(void));\nvoid OPENSSL_thread_stop_ex(OSSL_LIB_CTX *ctx);\nvoid OPENSSL_thread_stop(void);\n\nOPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);\nint OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *init,\n                                     const char* filename);\nint OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *init,\n                                       unsigned long flags);\nint OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *init,\n                                    const char* name);\nvoid OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *init);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/#description","title":"DESCRIPTION","text":"

                                                                                                                                                During normal operation OpenSSL (libcrypto) will allocate various resources at start up that must, subsequently, be freed on close down of the library. Additionally some resources are allocated on a per thread basis (if the application is multi-threaded), and these resources must be freed prior to the thread closing.

                                                                                                                                                As of version 1.1.0 OpenSSL will automatically allocate all resources that it needs so no explicit initialisation is required. Similarly it will also automatically deinitialise as required.

                                                                                                                                                However, there may be situations when explicit initialisation is desirable or needed, for example when some nondefault initialisation is required. The function OPENSSL_init_crypto() can be used for this purpose for libcrypto (see also OPENSSL_init_ssl(3) for the libssl equivalent).

                                                                                                                                                Numerous internal OpenSSL functions call OPENSSL_init_crypto(). Therefore, in order to perform nondefault initialisation, OPENSSL_init_crypto() MUST be called by application code prior to any other OpenSSL function calls.

                                                                                                                                                The opts parameter specifies which aspects of libcrypto should be initialised. Valid options are:

                                                                                                                                                • OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS

                                                                                                                                                  Suppress automatic loading of the libcrypto error strings. This option is not a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_LOAD_CRYPTO_STRINGS will be ignored.

                                                                                                                                                • OPENSSL_INIT_LOAD_CRYPTO_STRINGS

                                                                                                                                                  Automatic loading of the libcrypto error strings. With this option the library will automatically load the libcrypto error strings. This option is a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS will be ignored.

                                                                                                                                                • OPENSSL_INIT_ADD_ALL_CIPHERS

                                                                                                                                                  With this option the library will automatically load and make available all libcrypto ciphers. This option is a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_NO_ADD_ALL_CIPHERS will be ignored.

                                                                                                                                                • OPENSSL_INIT_ADD_ALL_DIGESTS

                                                                                                                                                  With this option the library will automatically load and make available all libcrypto digests. This option is a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_NO_ADD_ALL_DIGESTS will be ignored.

                                                                                                                                                • OPENSSL_INIT_NO_ADD_ALL_CIPHERS

                                                                                                                                                  With this option the library will suppress automatic loading of libcrypto ciphers. This option is not a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_ADD_ALL_CIPHERS will be ignored.

                                                                                                                                                • OPENSSL_INIT_NO_ADD_ALL_DIGESTS

                                                                                                                                                  With this option the library will suppress automatic loading of libcrypto digests. This option is not a default option. Once selected subsequent calls to OPENSSL_init_crypto() with the option OPENSSL_INIT_ADD_ALL_DIGESTS will be ignored.

                                                                                                                                                • OPENSSL_INIT_LOAD_CONFIG

                                                                                                                                                  With this option an OpenSSL configuration file will be automatically loaded and used by calling OPENSSL_config(). This is a default option. Note that in OpenSSL 1.1.1 this was the default for libssl but not for libcrypto (see OPENSSL_init_ssl(3) for further details about libssl initialisation). In OpenSSL 1.1.0 this was a nondefault option for both libssl and libcrypto. See the description of OPENSSL_INIT_new(), below.

                                                                                                                                                • OPENSSL_INIT_NO_LOAD_CONFIG

                                                                                                                                                  With this option the loading of OpenSSL configuration files will be suppressed. It is the equivalent of calling OPENSSL_no_config(). This is not a default option.

                                                                                                                                                • OPENSSL_INIT_ASYNC

                                                                                                                                                  With this option the library with automatically initialise the libcrypto async sub-library (see ASYNC_start_job(3)). This is a default option.

                                                                                                                                                • OPENSSL_INIT_ENGINE_RDRAND

                                                                                                                                                  With this option the library will automatically load and initialise the RDRAND engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ENGINE_DYNAMIC

                                                                                                                                                  With this option the library will automatically load and initialise the dynamic engine. This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ENGINE_OPENSSL

                                                                                                                                                  With this option the library will automatically load and initialise the openssl engine. This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ENGINE_CRYPTODEV

                                                                                                                                                  With this option the library will automatically load and initialise the cryptodev engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ENGINE_CAPI

                                                                                                                                                  With this option the library will automatically load and initialise the CAPI engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ENGINE_PADLOCK

                                                                                                                                                  With this option the library will automatically load and initialise the padlock engine (if available). This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ENGINE_AFALG

                                                                                                                                                  With this option the library will automatically load and initialise the AFALG engine. This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ENGINE_ALL_BUILTIN

                                                                                                                                                  With this option the library will automatically load and initialise all the built in engines listed above with the exception of the openssl and afalg engines. This not a default option and is deprecated in OpenSSL 3.0.

                                                                                                                                                • OPENSSL_INIT_ATFORK

                                                                                                                                                  With this option the library will register its fork handlers. See OPENSSL_fork_prepare(3) for details.

                                                                                                                                                • OPENSSL_INIT_NO_ATEXIT

                                                                                                                                                  By default OpenSSL will attempt to clean itself up when the process exits via an \"atexit\" handler. Using this option suppresses that behaviour. This means that the application will have to clean up OpenSSL explicitly using OPENSSL_cleanup().

                                                                                                                                                Multiple options may be combined together in a single call to OPENSSL_init_crypto(). For example:

                                                                                                                                                OPENSSL_init_crypto(OPENSSL_INIT_NO_ADD_ALL_CIPHERS\n                    | OPENSSL_INIT_NO_ADD_ALL_DIGESTS, NULL);\n

                                                                                                                                                The OPENSSL_cleanup() function deinitialises OpenSSL (both libcrypto and libssl). All resources allocated by OpenSSL are freed. Typically there should be no need to call this function directly as it is initiated automatically on application exit. This is done via the standard C library atexit() function. In the event that the application will close in a manner that will not call the registered atexit() handlers then the application should call OPENSSL_cleanup() directly. Developers of libraries using OpenSSL are discouraged from calling this function and should instead, typically, rely on auto-deinitialisation. This is to avoid error conditions where both an application and a library it depends on both use OpenSSL, and the library deinitialises it before the application has finished using it.

                                                                                                                                                Once OPENSSL_cleanup() has been called the library cannot be reinitialised. Attempts to call OPENSSL_init_crypto() will fail and an ERR_R_INIT_FAIL error will be added to the error stack. Note that because initialisation has failed OpenSSL error strings will not be available, only an error code. This code can be put through the openssl errstr command line application to produce a human readable error (see openssl-errstr(1)).

                                                                                                                                                The OPENSSL_atexit() function enables the registration of a function to be called during OPENSSL_cleanup(). Stop handlers are called after deinitialisation of resources local to a thread, but before other process wide resources are freed. In the event that multiple stop handlers are registered, no guarantees are made about the order of execution.

                                                                                                                                                The OPENSSL_thread_stop_ex() function deallocates resources associated with the current thread for the given OSSL_LIB_CTX ctx. The ctx parameter can be NULL in which case the default OSSL_LIB_CTX is used.

                                                                                                                                                Typically, this function will be called automatically by the library when the thread exits as long as the OSSL_LIB_CTX has not been freed before the thread exits. If OSSL_LIB_CTX_free() is called OPENSSL_thread_stop_ex will be called automatically for the current thread (but not any other threads that may have used this OSSL_LIB_CTX).

                                                                                                                                                OPENSSL_thread_stop_ex should be called on all threads that will exit after the OSSL_LIB_CTX is freed. Typically this is not necessary for the default OSSL_LIB_CTX (because all resources are cleaned up on library exit) except if thread local resources should be freed before library exit, or under the circumstances described in the NOTES section below.

                                                                                                                                                OPENSSL_thread_stop() is the same as OPENSSL_thread_stop_ex() except that the default OSSL_LIB_CTX is always used.

                                                                                                                                                The OPENSSL_INIT_LOAD_CONFIG flag will load a configuration file, as with CONF_modules_load_file(3) with NULL filename and application name and the CONF_MFLAGS_IGNORE_MISSING_FILE, CONF_MFLAGS_IGNORE_RETURN_CODES and CONF_MFLAGS_DEFAULT_SECTION flags. The filename, application name, and flags can be customized by providing a non-null OPENSSL_INIT_SETTINGS object. The object can be allocated via OPENSSL_INIT_new(). The OPENSSL_INIT_set_config_filename() function can be used to specify a nondefault filename, which is copied and need not refer to persistent storage. Similarly, OPENSSL_INIT_set_config_appname() can be used to specify a nondefault application name. Finally, OPENSSL_INIT_set_file_flags can be used to specify nondefault flags. If the CONF_MFLAGS_IGNORE_RETURN_CODES flag is not included, any errors in the configuration file will cause an error return from OPENSSL_init_crypto or indirectly OPENSSL_init_ssl(3). The object can be released with OPENSSL_INIT_free() when done. If the argument to OPENSSL_INIT_free() is NULL, nothing is done.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/#notes","title":"NOTES","text":"

                                                                                                                                                Resources local to a thread are deallocated automatically when the thread exits (e.g. in a pthreads environment, when pthread_exit() is called). On Windows platforms this is done in response to a DLL_THREAD_DETACH message being sent to the libcrypto32.dll entry point. Some windows functions may cause threads to exit without sending this message (for example ExitProcess()). If the application uses such functions, then the application must free up OpenSSL resources directly via a call to OPENSSL_thread_stop() on each thread. Similarly this message will also not be sent if OpenSSL is linked statically, and therefore applications using static linking should also call OPENSSL_thread_stop() on each thread. Additionally if OpenSSL is loaded dynamically via LoadLibrary() and the threads are not destroyed until after FreeLibrary() is called then each thread should call OPENSSL_thread_stop() prior to the FreeLibrary() call.

                                                                                                                                                On Linux/Unix where OpenSSL has been loaded via dlopen() and the application is multi-threaded and if dlclose() is subsequently called prior to the threads being destroyed then OpenSSL will not be able to deallocate resources associated with those threads. The application should either call OPENSSL_thread_stop() on each thread prior to the dlclose() call, or alternatively the original dlopen() call should use the RTLD_NODELETE flag (where available on the platform).

                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                The functions OPENSSL_init_crypto, OPENSSL_atexit() and OPENSSL_INIT_set_config_appname() return 1 on success or 0 on error.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                OPENSSL_init_ssl(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/#history","title":"HISTORY","text":"

                                                                                                                                                The OPENSSL_init_crypto(), OPENSSL_cleanup(), OPENSSL_atexit(), OPENSSL_thread_stop(), OPENSSL_INIT_new(), OPENSSL_INIT_set_config_appname() and OPENSSL_INIT_free() functions were added in OpenSSL 1.1.0.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_crypto/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_ssl/","title":"OPENSSL_init_ssl","text":""},{"location":"man3/OPENSSL_init_ssl/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_init_ssl - OpenSSL (libssl and libcrypto) initialisation

                                                                                                                                                "},{"location":"man3/OPENSSL_init_ssl/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/ssl.h>\n\nint OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_init_ssl/#description","title":"DESCRIPTION","text":"

                                                                                                                                                During normal operation OpenSSL (libssl and libcrypto) will allocate various resources at start up that must, subsequently, be freed on close down of the library. Additionally some resources are allocated on a per thread basis (if the application is multi-threaded), and these resources must be freed prior to the thread closing.

                                                                                                                                                As of version 1.1.0 OpenSSL will automatically allocate all resources that it needs so no explicit initialisation is required. Similarly it will also automatically deinitialise as required.

                                                                                                                                                However, there may be situations when explicit initialisation is desirable or needed, for example when some nondefault initialisation is required. The function OPENSSL_init_ssl() can be used for this purpose. Calling this function will explicitly initialise BOTH libcrypto and libssl. To explicitly initialise ONLY libcrypto see the OPENSSL_init_crypto(3) function.

                                                                                                                                                Numerous internal OpenSSL functions call OPENSSL_init_ssl(). Therefore, in order to perform nondefault initialisation, OPENSSL_init_ssl() MUST be called by application code prior to any other OpenSSL function calls.

                                                                                                                                                The opts parameter specifies which aspects of libssl and libcrypto should be initialised. Valid options for libcrypto are described on the OPENSSL_init_crypto(3) page. In addition to any libcrypto specific option the following libssl options can also be used:

                                                                                                                                                • OPENSSL_INIT_NO_LOAD_SSL_STRINGS

                                                                                                                                                  Suppress automatic loading of the libssl error strings. This option is not a default option. Once selected subsequent calls to OPENSSL_init_ssl() with the option OPENSSL_INIT_LOAD_SSL_STRINGS will be ignored.

                                                                                                                                                • OPENSSL_INIT_LOAD_SSL_STRINGS

                                                                                                                                                  Automatic loading of the libssl error strings. This option is a default option. Once selected subsequent calls to OPENSSL_init_ssl() with the option OPENSSL_INIT_LOAD_SSL_STRINGS will be ignored.

                                                                                                                                                OPENSSL_init_ssl() takes a settings parameter which can be used to set parameter values. See OPENSSL_init_crypto(3) for details.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_ssl/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                The function OPENSSL_init_ssl() returns 1 on success or 0 on error.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_ssl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                OPENSSL_init_crypto(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_init_ssl/#history","title":"HISTORY","text":"

                                                                                                                                                The OPENSSL_init_ssl() function was added in OpenSSL 1.1.0.

                                                                                                                                                "},{"location":"man3/OPENSSL_init_ssl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_instrument_bus/","title":"OPENSSL_instrument_bus","text":""},{"location":"man3/OPENSSL_instrument_bus/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_instrument_bus, OPENSSL_instrument_bus2 - instrument references to memory bus

                                                                                                                                                "},{"location":"man3/OPENSSL_instrument_bus/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #ifdef OPENSSL_CPUID_OBJ\nsize_t OPENSSL_instrument_bus(unsigned int *vector, size_t num);\nsize_t OPENSSL_instrument_bus2(unsigned int *vector, size_t num, size_t max);\n#endif\n
                                                                                                                                                "},{"location":"man3/OPENSSL_instrument_bus/#description","title":"DESCRIPTION","text":"

                                                                                                                                                It was empirically found that timings of references to primary memory are subject to irregular, apparently non-deterministic variations. The subroutines in question instrument these references for purposes of gathering randomness for random number generator. In order to make it bus-bound a 'flush cache line' instruction is used between probes. In addition probes are added to vector elements in atomic or interlocked manner, which should contribute additional noise on multi-processor systems. This also means that vector[num] should be zeroed upon invocation (if you want to retrieve actual probe values).

                                                                                                                                                OPENSSL_instrument_bus() performs num probes and records the number of oscillator cycles every probe took.

                                                                                                                                                OPENSSL_instrument_bus2() on the other hand accumulates consecutive probes with the same value, i.e. in a way it records duration of periods when probe values appeared deterministic. The subroutine performs at most max probes in attempt to fill the vector[num], with max value of 0 meaning \"as many as it takes.\"

                                                                                                                                                "},{"location":"man3/OPENSSL_instrument_bus/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                Return value of 0 indicates that CPU is not capable of performing the benchmark, either because oscillator counter or 'flush cache line' is not available on current platform. For reference, on x86 'flush cache line' was introduced with the SSE2 extensions.

                                                                                                                                                Otherwise number of recorded values is returned.

                                                                                                                                                "},{"location":"man3/OPENSSL_instrument_bus/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2011-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/","title":"OPENSSL_load_builtin_modules","text":""},{"location":"man3/OPENSSL_load_builtin_modules/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_load_builtin_modules, ASN1_add_oid_module, ENGINE_add_conf_module - add standard configuration modules

                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/conf.h>\n\nvoid OPENSSL_load_builtin_modules(void);\nvoid ASN1_add_oid_module(void);\nvoid ENGINE_add_conf_module(void);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The function OPENSSL_load_builtin_modules() adds all the standard OpenSSL configuration modules to the internal list. They can then be used by the OpenSSL configuration code.

                                                                                                                                                ASN1_add_oid_module() adds just the ASN1 OBJECT module.

                                                                                                                                                ENGINE_add_conf_module() adds just the ENGINE configuration module.

                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/#notes","title":"NOTES","text":"

                                                                                                                                                If the simple configuration function OPENSSL_config() is called then OPENSSL_load_builtin_modules() is called automatically.

                                                                                                                                                Applications which use the configuration functions directly will need to call OPENSSL_load_builtin_modules() themselves before any other configuration code.

                                                                                                                                                Applications should call OPENSSL_load_builtin_modules() to load all configuration modules instead of adding modules selectively: otherwise functionality may be missing from the application if an when new modules are added.

                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                None of the functions return a value.

                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                config(5), OPENSSL_config(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/#history","title":"HISTORY","text":"

                                                                                                                                                ENGINE_add_conf_module() was deprecated in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/OPENSSL_load_builtin_modules/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_malloc/","title":"OPENSSL_malloc","text":""},{"location":"man3/OPENSSL_malloc/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_malloc_init, OPENSSL_malloc, OPENSSL_zalloc, OPENSSL_realloc, OPENSSL_free, OPENSSL_clear_realloc, OPENSSL_clear_free, OPENSSL_cleanse, CRYPTO_malloc, CRYPTO_zalloc, CRYPTO_realloc, CRYPTO_free, OPENSSL_strdup, OPENSSL_strndup, OPENSSL_memdup, OPENSSL_strlcpy, OPENSSL_strlcat, CRYPTO_strdup, CRYPTO_strndup, OPENSSL_mem_debug_push, OPENSSL_mem_debug_pop, CRYPTO_mem_debug_push, CRYPTO_mem_debug_pop, CRYPTO_clear_realloc, CRYPTO_clear_free, CRYPTO_malloc_fn, CRYPTO_realloc_fn, CRYPTO_free_fn, CRYPTO_get_mem_functions, CRYPTO_set_mem_functions, CRYPTO_get_alloc_counts, CRYPTO_set_mem_debug, CRYPTO_mem_ctrl, CRYPTO_mem_leaks, CRYPTO_mem_leaks_fp, CRYPTO_mem_leaks_cb, OPENSSL_MALLOC_FAILURES, OPENSSL_MALLOC_FD - Memory allocation functions

                                                                                                                                                "},{"location":"man3/OPENSSL_malloc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/crypto.h>\n\nint OPENSSL_malloc_init(void);\n\nvoid *OPENSSL_malloc(size_t num);\nvoid *OPENSSL_zalloc(size_t num);\nvoid *OPENSSL_realloc(void *addr, size_t num);\nvoid OPENSSL_free(void *addr);\nchar *OPENSSL_strdup(const char *str);\nchar *OPENSSL_strndup(const char *str, size_t s);\nsize_t OPENSSL_strlcat(char *dst, const char *src, size_t size);\nsize_t OPENSSL_strlcpy(char *dst, const char *src, size_t size);\nvoid *OPENSSL_memdup(void *data, size_t s);\nvoid *OPENSSL_clear_realloc(void *p, size_t old_len, size_t num);\nvoid OPENSSL_clear_free(void *str, size_t num);\nvoid OPENSSL_cleanse(void *ptr, size_t len);\n\nvoid *CRYPTO_malloc(size_t num, const char *file, int line);\nvoid *CRYPTO_zalloc(size_t num, const char *file, int line);\nvoid *CRYPTO_realloc(void *p, size_t num, const char *file, int line);\nvoid CRYPTO_free(void *str, const char *, int);\nchar *CRYPTO_strdup(const char *p, const char *file, int line);\nchar *CRYPTO_strndup(const char *p, size_t num, const char *file, int line);\nvoid *CRYPTO_clear_realloc(void *p, size_t old_len, size_t num,\n                           const char *file, int line);\nvoid CRYPTO_clear_free(void *str, size_t num, const char *, int);\n\ntypedef void *(*CRYPTO_malloc_fn)(size_t num, const char *file, int line);\ntypedef void *(*CRYPTO_realloc_fn)(void *addr, size_t num, const char *file,\n                                   int line);\ntypedef void (*CRYPTO_free_fn)(void *addr, const char *file, int line);\nvoid CRYPTO_get_mem_functions(CRYPTO_malloc_fn *malloc_fn,\n                              CRYPTO_realloc_fn *realloc_fn,\n                              CRYPTO_free_fn *free_fn);\nint CRYPTO_set_mem_functions(CRYPTO_malloc_fn malloc_fn,\n                             CRYPTO_realloc_fn realloc_fn,\n                             CRYPTO_free_fn free_fn);\n\nvoid CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount);\n\nenv OPENSSL_MALLOC_FAILURES=... <application>\nenv OPENSSL_MALLOC_FD=... <application>\n

                                                                                                                                                The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                int CRYPTO_mem_leaks(BIO *b);\nint CRYPTO_mem_leaks_fp(FILE *fp);\nint CRYPTO_mem_leaks_cb(int (*cb)(const char *str, size_t len, void *u),\n                        void *u);\n\nint CRYPTO_set_mem_debug(int onoff);\nint CRYPTO_mem_ctrl(int mode);\nint OPENSSL_mem_debug_push(const char *info);\nint OPENSSL_mem_debug_pop(void);\nint CRYPTO_mem_debug_push(const char *info, const char *file, int line);\nint CRYPTO_mem_debug_pop(void);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_malloc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                OpenSSL memory allocation is handled by the OPENSSL_xxx API. These are generally macro's that add the standard C __FILE__ and __LINE__ parameters and call a lower-level CRYPTO_xxx API. Some functions do not add those parameters, but exist for consistency.

                                                                                                                                                OPENSSL_malloc_init() does nothing and does not need to be called. It is included for compatibility with older versions of OpenSSL.

                                                                                                                                                OPENSSL_malloc(), OPENSSL_realloc(), and OPENSSL_free() are like the C malloc(), realloc(), and free() functions. OPENSSL_zalloc() calls memset() to zero the memory before returning.

                                                                                                                                                OPENSSL_clear_realloc() and OPENSSL_clear_free() should be used when the buffer at addr holds sensitive information. The old buffer is filled with zero's by calling OPENSSL_cleanse() before ultimately calling OPENSSL_free(). If the argument to OPENSSL_free() is NULL, nothing is done.

                                                                                                                                                OPENSSL_cleanse() fills ptr of size len with a string of 0's. Use OPENSSL_cleanse() with care if the memory is a mapping of a file. If the storage controller uses write compression, then it's possible that sensitive tail bytes will survive zeroization because the block of zeros will be compressed. If the storage controller uses wear leveling, then the old sensitive data will not be overwritten; rather, a block of 0's will be written at a new physical location.

                                                                                                                                                OPENSSL_strdup(), OPENSSL_strndup() and OPENSSL_memdup() are like the equivalent C functions, except that memory is allocated by calling the OPENSSL_malloc() and should be released by calling OPENSSL_free().

                                                                                                                                                OPENSSL_strlcpy(), OPENSSL_strlcat() and OPENSSL_strnlen() are equivalents of the common C library functions and are provided for portability.

                                                                                                                                                If no allocations have been done, it is possible to \"swap out\" the default implementations for OPENSSL_malloc(), OPENSSL_realloc() and OPENSSL_free() and replace them with alternate versions. CRYPTO_get_mem_functions() function fills in the given arguments with the function pointers for the current implementations. With CRYPTO_set_mem_functions(), you can specify a different set of functions. If any of malloc_fn, realloc_fn, or free_fn are NULL, then the function is not changed. While it's permitted to swap out only a few and not all the functions with CRYPTO_set_mem_functions(), it's recommended to swap them all out at once.

                                                                                                                                                If the library is built with the crypto-mdebug option, then one function, CRYPTO_get_alloc_counts(), and two additional environment variables, OPENSSL_MALLOC_FAILURES and OPENSSL_MALLOC_FD, are available.

                                                                                                                                                The function CRYPTO_get_alloc_counts() fills in the number of times each of CRYPTO_malloc(), CRYPTO_realloc(), and CRYPTO_free() have been called, into the values pointed to by mcount, rcount, and fcount, respectively. If a pointer is NULL, then the corresponding count is not stored.

                                                                                                                                                The variable OPENSSL_MALLOC_FAILURES controls how often allocations should fail. It is a set of fields separated by semicolons, which each field is a count (defaulting to zero) and an optional atsign and percentage (defaulting to 100). If the count is zero, then it lasts forever. For example, 100;@25 or 100@0;0@25 means the first 100 allocations pass, then all other allocations (until the program exits or crashes) have a 25% chance of failing.

                                                                                                                                                If the variable OPENSSL_MALLOC_FD is parsed as a positive integer, then it is taken as an open file descriptor. This is used in conjunction with OPENSSL_MALLOC_FAILURES described above. For every allocation it will log details about how many allocations there have been so far, what percentage chance there is for this allocation failing, and whether it has actually failed. The following example in classic shell syntax shows how to use this (will not work on all platforms):

                                                                                                                                                OPENSSL_MALLOC_FAILURES='200;@10'\nexport OPENSSL_MALLOC_FAILURES\nOPENSSL_MALLOC_FD=3\nexport OPENSSL_MALLOC_FD\n...app invocation... 3>/tmp/log$$\n
                                                                                                                                                "},{"location":"man3/OPENSSL_malloc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                OPENSSL_malloc_init(), OPENSSL_free(), OPENSSL_clear_free() CRYPTO_free(), CRYPTO_clear_free() and CRYPTO_get_mem_functions() return no value.

                                                                                                                                                OPENSSL_malloc(), OPENSSL_zalloc(), OPENSSL_realloc(), OPENSSL_clear_realloc(), CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_realloc(), CRYPTO_clear_realloc(), OPENSSL_strdup(), and OPENSSL_strndup() return a pointer to allocated memory or NULL on error.

                                                                                                                                                CRYPTO_set_mem_functions() returns 1 on success or 0 on failure (almost always because allocations have already happened).

                                                                                                                                                CRYPTO_mem_leaks(), CRYPTO_mem_leaks_fp(), CRYPTO_mem_leaks_cb(), CRYPTO_set_mem_debug(), and CRYPTO_mem_ctrl() are deprecated and are no-ops that always return -1. OPENSSL_mem_debug_push(), OPENSSL_mem_debug_pop(), CRYPTO_mem_debug_push(), and CRYPTO_mem_debug_pop() are deprecated and are no-ops that always return 0.

                                                                                                                                                "},{"location":"man3/OPENSSL_malloc/#history","title":"HISTORY","text":"

                                                                                                                                                OPENSSL_mem_debug_push(), OPENSSL_mem_debug_pop(), CRYPTO_mem_debug_push(), CRYPTO_mem_debug_pop(), CRYPTO_mem_leaks(), CRYPTO_mem_leaks_fp(), CRYPTO_mem_leaks_cb(), CRYPTO_set_mem_debug(), CRYPTO_mem_ctrl() were deprecated in OpenSSL 3.0. The memory-leak checking has been deprecated in OpenSSL 3.0 in favor of clang's memory and leak sanitizer.

                                                                                                                                                "},{"location":"man3/OPENSSL_malloc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_s390xcap/","title":"OPENSSL_s390xcap","text":""},{"location":"man3/OPENSSL_s390xcap/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_s390xcap - the IBM z processor capabilities vector

                                                                                                                                                "},{"location":"man3/OPENSSL_s390xcap/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                env OPENSSL_s390xcap=... <application>\n
                                                                                                                                                "},{"location":"man3/OPENSSL_s390xcap/#description","title":"DESCRIPTION","text":"

                                                                                                                                                libcrypto supports z/Architecture instruction set extensions. These extensions are denoted by individual bits in the capabilities vector. When libcrypto is initialized, the bits returned by the STFLE instruction and by the QUERY functions are stored in the vector.

                                                                                                                                                To change the set of instructions available to an application, you can set the OPENSSL_s390xcap environment variable before you start the application. After initialization, the capability vector is ANDed bitwise with a mask which is derived from the environment variable.

                                                                                                                                                The environment variable is a semicolon-separated list of tokens which is processed from left to right (whitespace is ignored):

                                                                                                                                                OPENSSL_s390xcap=\"<tok1>;<tok2>;...\"\n

                                                                                                                                                There are three types of tokens:

                                                                                                                                                • <string>

                                                                                                                                                  The name of a processor generation. A bit in the environment variable's mask is set to one if and only if the specified processor generation implements the corresponding instruction set extension. Possible values are z900, z990, z9, z10, z196, zEC12, z13, z14, z15, and z16.

                                                                                                                                                • <string>:<mask>:<mask>

                                                                                                                                                  The name of an instruction followed by two 64-bit masks. The part of the environment variable's mask corresponding to the specified instruction is set to the specified 128-bit mask. Possible values are kimd, klmd, km, kmc, kmac, kmctr, kmo, kmf, prno, kma, pcc and kdsa.

                                                                                                                                                • stfle:<mask>:<mask>:<mask>

                                                                                                                                                  Store-facility-list-extended (stfle) followed by three 64-bit masks. The part of the environment variable's mask corresponding to the stfle instruction is set to the specified 192-bit mask.

                                                                                                                                                The 64-bit masks are specified in hexadecimal notation. The 0x prefix is optional. Prefix a mask with a tilde, ~, to denote a bitwise NOT operation.

                                                                                                                                                The following is a list of significant bits for each instruction. Colon rows separate the individual 64-bit masks. The bit numbers in the first column are consistent with [1], that is, 0 denotes the leftmost bit and the numbering is continuous across 64-bit mask boundaries.

                                                                                                                                                     Bit     Mask     Facility/Function\n\nstfle:\n  #   # 17    1<<46    message-security assist\n  #   # 25    1<<38    store-clock-fast facility\n     :\n  #   # 76    1<<51    message-security assist extension 3\n  #   # 77    1<<50    message-security assist extension 4\n     :\n     #129    1<<62    vector facility\n     #134    1<<57    vector packed decimal facility\n     #135    1<<56    vector enhancements facility 1\n     #146    1<<45    message-security assist extension 8\n     #155    1<<36    message-security assist extension 9\n\nkimd :\n  #   #  1    1<<62    KIMD-SHA-1\n  #   #  2    1<<61    KIMD-SHA-256\n  #   #  3    1<<60    KIMD-SHA-512\n  #   # 32    1<<31    KIMD-SHA3-224\n  #   # 33    1<<30    KIMD-SHA3-256\n  #   # 34    1<<29    KIMD-SHA3-384\n  #   # 35    1<<28    KIMD-SHA3-512\n  #   # 36    1<<27    KIMD-SHAKE-128\n  #   # 37    1<<26    KIMD-SHAKE-256\n     :\n  #   # 65    1<<62    KIMD-GHASH\n\nklmd :\n  #   # 32    1<<31    KLMD-SHA3-224\n  #   # 33    1<<30    KLMD-SHA3-256\n  #   # 34    1<<29    KLMD-SHA3-384\n  #   # 35    1<<28    KLMD-SHA3-512\n  #   # 36    1<<27    KLMD-SHAKE-128\n  #   # 37    1<<26    KLMD-SHAKE-256\n     :\n\nkm   :\n  #   # 18    1<<45    KM-AES-128\n  #   # 19    1<<44    KM-AES-192\n  #   # 20    1<<43    KM-AES-256\n  #   # 50    1<<13    KM-XTS-AES-128\n  #   # 52    1<<11    KM-XTS-AES-256\n     :\n\nkmc  :\n  #   # 18    1<<45    KMC-AES-128\n  #   # 19    1<<44    KMC-AES-192\n  #   # 20    1<<43    KMC-AES-256\n     :\n\nkmac :\n  #   # 18    1<<45    KMAC-AES-128\n  #   # 19    1<<44    KMAC-AES-192\n  #   # 20    1<<43    KMAC-AES-256\n     :\n\nkmctr:\n     :\n\nkmo  :\n  #   # 18    1<<45    KMO-AES-128\n  #   # 19    1<<44    KMO-AES-192\n  #   # 20    1<<43    KMO-AES-256\n     :\n\nkmf  :\n  #   # 18    1<<45    KMF-AES-128\n  #   # 19    1<<44    KMF-AES-192\n  #   # 20    1<<43    KMF-AES-256\n     :\n\nprno :\n     :\n\nkma  :\n  #   # 18    1<<45    KMA-GCM-AES-128\n  #   # 19    1<<44    KMA-GCM-AES-192\n  #   # 20    1<<43    KMA-GCM-AES-256\n     :\n\npcc  :\n     :\n  #   # 64    1<<63    PCC-Scalar-Multiply-P256\n  #   # 65    1<<62    PCC-Scalar-Multiply-P384\n  #   # 66    1<<61    PCC-Scalar-Multiply-P521\n  #   # 72    1<<55    PCC-Scalar-Multiply-Ed25519\n  #   # 73    1<<54    PCC-Scalar-Multiply-Ed448\n  #   # 80    1<<47    PCC-Scalar-Multiply-X25519\n  #   # 81    1<<46    PCC-Scalar-Multiply-X448\n\nkdsa :\n  #   #  1    1<<62    KDSA-ECDSA-Verify-P256\n  #   #  2    1<<61    KDSA-ECDSA-Verify-P384\n  #   #  3    1<<60    KDSA-ECDSA-Verify-P521\n  #   #  9    1<<54    KDSA-ECDSA-Sign-P256\n  #   # 10    1<<53    KDSA-ECDSA-Sign-P384\n  #   # 11    1<<52    KDSA-ECDSA-Sign-P521\n  #   # 32    1<<31    KDSA-EdDSA-Verify-Ed25519\n  #   # 36    1<<27    KDSA-EdDSA-Verify-Ed448\n  #   # 40    1<<23    KDSA-EdDSA-Sign-Ed25519\n  #   # 44    1<<19    KDSA-EdDSA-Sign-Ed448\n     :\n
                                                                                                                                                "},{"location":"man3/OPENSSL_s390xcap/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                Not available.

                                                                                                                                                "},{"location":"man3/OPENSSL_s390xcap/#examples","title":"EXAMPLES","text":"

                                                                                                                                                Disables all instruction set extensions which the z196 processor does not implement:

                                                                                                                                                OPENSSL_s390xcap=\"z196\"\n

                                                                                                                                                Disables the vector facility:

                                                                                                                                                OPENSSL_s390xcap=\"stfle:~0:~0:~0x4000000000000000\"\n

                                                                                                                                                Disables the KM-XTS-AES and the KIMD-SHAKE function codes:

                                                                                                                                                OPENSSL_s390xcap=\"km:~0x2800:~0;kimd:~0xc000000:~0\"\n
                                                                                                                                                "},{"location":"man3/OPENSSL_s390xcap/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                [1] z/Architecture Principles of Operation, SA22-7832-12

                                                                                                                                                "},{"location":"man3/OPENSSL_s390xcap/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_secure_malloc/","title":"OPENSSL_secure_malloc","text":""},{"location":"man3/OPENSSL_secure_malloc/#name","title":"NAME","text":"

                                                                                                                                                CRYPTO_secure_malloc_init, CRYPTO_secure_malloc_initialized, CRYPTO_secure_malloc_done, OPENSSL_secure_malloc, CRYPTO_secure_malloc, OPENSSL_secure_zalloc, CRYPTO_secure_zalloc, OPENSSL_secure_free, CRYPTO_secure_free, OPENSSL_secure_clear_free, CRYPTO_secure_clear_free, OPENSSL_secure_actual_size, CRYPTO_secure_allocated, CRYPTO_secure_used - secure heap storage

                                                                                                                                                "},{"location":"man3/OPENSSL_secure_malloc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/crypto.h>\n\nint CRYPTO_secure_malloc_init(size_t size, size_t minsize);\n\nint CRYPTO_secure_malloc_initialized();\n\nint CRYPTO_secure_malloc_done();\n\nvoid *OPENSSL_secure_malloc(size_t num);\nvoid *CRYPTO_secure_malloc(size_t num, const char *file, int line);\n\nvoid *OPENSSL_secure_zalloc(size_t num);\nvoid *CRYPTO_secure_zalloc(size_t num, const char *file, int line);\n\nvoid OPENSSL_secure_free(void* ptr);\nvoid CRYPTO_secure_free(void *ptr, const char *, int);\n\nvoid OPENSSL_secure_clear_free(void* ptr, size_t num);\nvoid CRYPTO_secure_clear_free(void *ptr, size_t num, const char *, int);\n\nsize_t OPENSSL_secure_actual_size(const void *ptr);\n\nint CRYPTO_secure_allocated(const void *ptr);\nsize_t CRYPTO_secure_used();\n
                                                                                                                                                "},{"location":"man3/OPENSSL_secure_malloc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                In order to help protect applications (particularly long-running servers) from pointer overruns or underruns that could return arbitrary data from the program's dynamic memory area, where keys and other sensitive information might be stored, OpenSSL supports the concept of a \"secure heap.\" The level and type of security guarantees depend on the operating system. It is a good idea to review the code and see if it addresses your threat model and concerns.

                                                                                                                                                If a secure heap is used, then private key BIGNUM values are stored there. This protects long-term storage of private keys, but will not necessarily put all intermediate values and computations there.

                                                                                                                                                CRYPTO_secure_malloc_init() creates the secure heap, with the specified size in bytes. The minsize parameter is the minimum size to allocate from the heap or zero to use a reasonable default value. Both size and, if specified, minsize must be a power of two and minsize should generally be small, for example 16 or 32. minsize must be less than a quarter of size in any case.

                                                                                                                                                CRYPTO_secure_malloc_initialized() indicates whether or not the secure heap as been initialized and is available.

                                                                                                                                                CRYPTO_secure_malloc_done() releases the heap and makes the memory unavailable to the process if all secure memory has been freed. It can take noticeably long to complete.

                                                                                                                                                OPENSSL_secure_malloc() allocates num bytes from the heap. If CRYPTO_secure_malloc_init() is not called, this is equivalent to calling OPENSSL_malloc(). It is a macro that expands to CRYPTO_secure_malloc() and adds the __FILE__ and __LINE__ parameters.

                                                                                                                                                OPENSSL_secure_zalloc() and CRYPTO_secure_zalloc() are like OPENSSL_secure_malloc() and CRYPTO_secure_malloc(), respectively, except that they call memset() to zero the memory before returning.

                                                                                                                                                OPENSSL_secure_free() releases the memory at ptr back to the heap. It must be called with a value previously obtained from OPENSSL_secure_malloc(). If CRYPTO_secure_malloc_init() is not called, this is equivalent to calling OPENSSL_free(). It exists for consistency with OPENSSL_secure_malloc() , and is a macro that expands to CRYPTO_secure_free() and adds the __FILE__ and __LINE__ parameters.. If the argument to OPENSSL_secure_free() is NULL, nothing is done.

                                                                                                                                                OPENSSL_secure_clear_free() is similar to OPENSSL_secure_free() except that it has an additional num parameter which is used to clear the memory if it was not allocated from the secure heap. If CRYPTO_secure_malloc_init() is not called, this is equivalent to calling OPENSSL_clear_free(). If the argument to OPENSSL_secure_clear_free() is NULL, nothing is done.

                                                                                                                                                OPENSSL_secure_actual_size() tells the actual size allocated to the pointer; implementations may allocate more space than initially requested, in order to \"round up\" and reduce secure heap fragmentation.

                                                                                                                                                OPENSSL_secure_allocated() tells if a pointer is allocated in the secure heap.

                                                                                                                                                CRYPTO_secure_used() returns the number of bytes allocated in the secure heap.

                                                                                                                                                "},{"location":"man3/OPENSSL_secure_malloc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                CRYPTO_secure_malloc_init() returns 0 on failure, 1 if successful, and 2 if successful but the heap could not be protected by memory mapping.

                                                                                                                                                CRYPTO_secure_malloc_initialized() returns 1 if the secure heap is available (that is, if CRYPTO_secure_malloc_init() has been called, but CRYPTO_secure_malloc_done() has not been called or failed) or 0 if not.

                                                                                                                                                OPENSSL_secure_malloc() and OPENSSL_secure_zalloc() return a pointer into the secure heap of the requested size, or NULL if memory could not be allocated.

                                                                                                                                                CRYPTO_secure_allocated() returns 1 if the pointer is in the secure heap, or 0 if not.

                                                                                                                                                CRYPTO_secure_malloc_done() returns 1 if the secure memory area is released, or 0 if not.

                                                                                                                                                OPENSSL_secure_free() and OPENSSL_secure_clear_free() return no values.

                                                                                                                                                "},{"location":"man3/OPENSSL_secure_malloc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                OPENSSL_malloc(3), BN_new(3)

                                                                                                                                                "},{"location":"man3/OPENSSL_secure_malloc/#history","title":"HISTORY","text":"

                                                                                                                                                The OPENSSL_secure_clear_free() function was added in OpenSSL 1.1.0g.

                                                                                                                                                The second argument to CRYPTO_secure_malloc_init() was changed from an int to a size_t in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/OPENSSL_secure_malloc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OPENSSL_strcasecmp/","title":"OPENSSL_strcasecmp","text":""},{"location":"man3/OPENSSL_strcasecmp/#name","title":"NAME","text":"

                                                                                                                                                OPENSSL_strcasecmp, OPENSSL_strncasecmp - compare two strings ignoring case

                                                                                                                                                "},{"location":"man3/OPENSSL_strcasecmp/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/crypto.h>\n\nint OPENSSL_strcasecmp(const char *s1, const char *s2);\nint OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);\n
                                                                                                                                                "},{"location":"man3/OPENSSL_strcasecmp/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The OPENSSL_strcasecmp function performs a byte-by-byte comparison of the strings s1 and s2, ignoring the case of the characters.

                                                                                                                                                The OPENSSL_strncasecmp function is similar, except that it compares no more than n bytes of s1 and s2.

                                                                                                                                                In POSIX-compatible system and on Windows these functions use \"C\" locale for case insensitive. Otherwise the comparison is done in current locale.

                                                                                                                                                "},{"location":"man3/OPENSSL_strcasecmp/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                Both functions return an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.

                                                                                                                                                "},{"location":"man3/OPENSSL_strcasecmp/#notes","title":"NOTES","text":"

                                                                                                                                                OpenSSL extensively uses case insensitive comparison of ASCII strings. Though OpenSSL itself is locale-agnostic, the applications using OpenSSL libraries may unpredictably suffer when they use localization (e.g. Turkish locale is well-known with a specific I/i cases). These functions use C locale for string comparison.

                                                                                                                                                "},{"location":"man3/OPENSSL_strcasecmp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/","title":"OSSL_ALGORITHM","text":""},{"location":"man3/OSSL_ALGORITHM/#name","title":"NAME","text":"

                                                                                                                                                OSSL_ALGORITHM - OpenSSL Core type to define a fetchable algorithm

                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/core.h>\n\ntypedef struct ossl_algorithm_st OSSL_ALGORITHM;\nstruct ossl_algorithm_st {\n    const char *algorithm_names;     /* key */\n    const char *property_definition; /* key */\n    const OSSL_DISPATCH *implementation;\n    const char *algorithm_description;\n};\n
                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/#description","title":"DESCRIPTION","text":"

                                                                                                                                                The OSSL_ALGORITHM type is a public structure that describes an algorithm that a provider(7) provides. Arrays of this type are returned by providers on demand from the OpenSSL libraries to describe what algorithms the providers provide implementations of, and with what properties.

                                                                                                                                                Arrays of this type must be terminated with a tuple where algorithm_names is NULL.

                                                                                                                                                This type of array is typically returned by the provider's operation querying function, further described in \"Provider Functions\" in provider-base(7).

                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/#ossl_algorithm-fields","title":"OSSL_ALGORITHM fields","text":"
                                                                                                                                                • algorithm_names

                                                                                                                                                  This string is a colon separated set of names / identities, and is used by the appropriate fetching functionality (such as EVP_CIPHER_fetch(3), EVP_MD_fetch(3), etc) to find the desired algorithm.

                                                                                                                                                  Multiple names / identities allow a specific algorithm implementation to be fetched multiple ways. For example, the RSA algorithm has the following known identities:

                                                                                                                                                  • RSA
                                                                                                                                                  • rsaEncryption

                                                                                                                                                    This is the name of the algorithm's OBJECT IDENTIFIER (OID), as given by the PKCS#1 RFC's ASN.1 module

                                                                                                                                                  • 1.2.840.113549.1.1.1

                                                                                                                                                    This is the OID itself for rsaEncryption, in canonical decimal text form.

                                                                                                                                                  The resulting algorithm_names string would look like this:

                                                                                                                                                  \"RSA:rsaEncryption:1.2.840.113549.1.1.1\"\n

                                                                                                                                                  The OpenSSL libraries use the first of the algorithm names as the main or canonical name, on a per algorithm implementation basis.

                                                                                                                                                  See the notes \"On the subject of algorithm names\" below for a more in depth discussion on algorithm_names and how that may interact with applications and libraries, including OpenSSL's.

                                                                                                                                                • property_definition

                                                                                                                                                  This string defines a set of properties associated with a particular algorithm implementation, and is used by the appropriate fetching functionality (such as EVP_CIPHER_fetch(3), EVP_MD_fetch(3), etc) for a finer grained lookup of an algorithm implementation, which is useful in case multiple implementations of the same algorithm are available.

                                                                                                                                                  See property(7) for a further description of the contents of this string.

                                                                                                                                                • implementation

                                                                                                                                                  Pointer to an OSSL_DISPATCH(3) array, containing pointers to the functions of a particular algorithm implementation.

                                                                                                                                                • algorithm_description

                                                                                                                                                  A string with a short human-readable description of the algorithm.

                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/#notes","title":"NOTES","text":""},{"location":"man3/OSSL_ALGORITHM/#on-the-subject-of-algorithm-names","title":"On the subject of algorithm names","text":"

                                                                                                                                                Providers may find the need to register ASN.1 OIDs for algorithms using OBJ_create(3) (via the core_obj_create upcall described in provider-base(7), because some application or library -- possibly still the OpenSSL libraries, even -- use NIDs to look up algorithms.

                                                                                                                                                In that scenario, you must make sure that the corresponding OSSL_ALGORITHM's algorithm_names includes both the short and the long name.

                                                                                                                                                Most of the time, registering ASN.1 OIDs like this shouldn't be necessary, and applications and libraries are encouraged to use OBJ_obj2txt(3) to get a text representation of the OID, which may be a long or short name for OIDs that are registered, or the OID itself in canonical decimal text form if not (or if OBJ_obj2txt(3) is called with no_name = 1).

                                                                                                                                                It's recommended to make sure that the corresponding OSSL_ALGORITHM's algorithm_names include known names as well as the OID itself in canonical decimal text form. That should cover all scenarios.

                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                crypto(7), provider-base(7), openssl-core.h(7), openssl-core_dispatch.h(7), OSSL_DISPATCH(3)

                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/#history","title":"HISTORY","text":"

                                                                                                                                                OSSL_ALGORITHM was added in OpenSSL 3.0

                                                                                                                                                "},{"location":"man3/OSSL_ALGORITHM/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OSSL_CALLBACK/","title":"OSSL_CALLBACK","text":""},{"location":"man3/OSSL_CALLBACK/#name","title":"NAME","text":"

                                                                                                                                                OSSL_CALLBACK, OSSL_PASSPHRASE_CALLBACK - OpenSSL Core type to define callbacks

                                                                                                                                                "},{"location":"man3/OSSL_CALLBACK/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/core.h>\ntypedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);\ntypedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,\n                                       size_t *pass_len,\n                                       const OSSL_PARAM params[],\n                                       void *arg);\n
                                                                                                                                                "},{"location":"man3/OSSL_CALLBACK/#description","title":"DESCRIPTION","text":"

                                                                                                                                                For certain events or activities, provider functionality may need help from the application or the calling OpenSSL libraries themselves. For example, user input or direct (possibly optional) user output could be implemented this way.

                                                                                                                                                Callback functions themselves are always provided by or through the calling OpenSSL libraries, along with a generic pointer to data arg. As far as the function receiving the pointer to the function pointer and arg is concerned, the data that arg points at is opaque, and the pointer should simply be passed back to the callback function when it's called.

                                                                                                                                                • OSSL_CALLBACK

                                                                                                                                                  This is a generic callback function. When calling this callback function, the caller is expected to build an OSSL_PARAM(3) array of data it wants or is expected to pass back, and pass that as params, as well as the opaque data pointer it received, as arg.

                                                                                                                                                • OSSL_PASSPHRASE_CALLBACK

                                                                                                                                                  This is a specialised callback function, used specifically to prompt the user for a passphrase. When calling this callback function, a buffer to store the pass phrase needs to be given with pass, and its size with pass_size. The length of the prompted pass phrase will be given back in *pass_len.

                                                                                                                                                  Additional parameters can be passed with the OSSL_PARAM(3) array params,

                                                                                                                                                "},{"location":"man3/OSSL_CALLBACK/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                openssl-core.h(7)

                                                                                                                                                "},{"location":"man3/OSSL_CALLBACK/#history","title":"HISTORY","text":"

                                                                                                                                                The types described here were added in OpenSSL 3.0.

                                                                                                                                                "},{"location":"man3/OSSL_CALLBACK/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                "},{"location":"man3/OSSL_CMP_CTX_new/","title":"OSSL_CMP_CTX_new","text":""},{"location":"man3/OSSL_CMP_CTX_new/#name","title":"NAME","text":"

                                                                                                                                                OSSL_CMP_CTX_new, OSSL_CMP_CTX_free, OSSL_CMP_CTX_reinit, OSSL_CMP_CTX_set_option, OSSL_CMP_CTX_get_option, OSSL_CMP_CTX_set_log_cb, OSSL_CMP_CTX_set_log_verbosity, OSSL_CMP_CTX_print_errors, OSSL_CMP_CTX_set1_serverPath, OSSL_CMP_CTX_set1_server, OSSL_CMP_CTX_set_serverPort, OSSL_CMP_CTX_set1_proxy, OSSL_CMP_CTX_set1_no_proxy, OSSL_CMP_CTX_set_http_cb, OSSL_CMP_CTX_set_http_cb_arg, OSSL_CMP_CTX_get_http_cb_arg, OSSL_CMP_transfer_cb_t, OSSL_CMP_CTX_set_transfer_cb, OSSL_CMP_CTX_set_transfer_cb_arg, OSSL_CMP_CTX_get_transfer_cb_arg, OSSL_CMP_CTX_set1_srvCert, OSSL_CMP_CTX_set1_expected_sender, OSSL_CMP_CTX_set0_trustedStore, OSSL_CMP_CTX_get0_trustedStore, OSSL_CMP_CTX_set1_untrusted, OSSL_CMP_CTX_get0_untrusted, OSSL_CMP_CTX_set1_cert, OSSL_CMP_CTX_build_cert_chain, OSSL_CMP_CTX_set1_pkey, OSSL_CMP_CTX_set1_referenceValue, OSSL_CMP_CTX_set1_secretValue, OSSL_CMP_CTX_set1_recipient, OSSL_CMP_CTX_push0_geninfo_ITAV, OSSL_CMP_CTX_reset_geninfo_ITAVs, OSSL_CMP_CTX_set1_extraCertsOut, OSSL_CMP_CTX_set0_newPkey, OSSL_CMP_CTX_get0_newPkey, OSSL_CMP_CTX_set1_issuer, OSSL_CMP_CTX_set1_subjectName, OSSL_CMP_CTX_push1_subjectAltName, OSSL_CMP_CTX_set0_reqExtensions, OSSL_CMP_CTX_reqExtensions_have_SAN, OSSL_CMP_CTX_push0_policy, OSSL_CMP_CTX_set1_oldCert, OSSL_CMP_CTX_set1_p10CSR, OSSL_CMP_CTX_push0_genm_ITAV, OSSL_CMP_certConf_cb_t, OSSL_CMP_certConf_cb, OSSL_CMP_CTX_set_certConf_cb, OSSL_CMP_CTX_set_certConf_cb_arg, OSSL_CMP_CTX_get_certConf_cb_arg, OSSL_CMP_CTX_get_status, OSSL_CMP_CTX_get0_statusString, OSSL_CMP_CTX_get_failInfoCode, OSSL_CMP_CTX_get0_newCert, OSSL_CMP_CTX_get1_newChain, OSSL_CMP_CTX_get1_caPubs, OSSL_CMP_CTX_get1_extraCertsIn, OSSL_CMP_CTX_set1_transactionID, OSSL_CMP_CTX_set1_senderNonce - functions for managing the CMP client context data structure

                                                                                                                                                "},{"location":"man3/OSSL_CMP_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                #include <openssl/cmp.h>\n\nOSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);\nvoid OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val);\nint OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt);\n\n/* logging and error reporting: */\nint OSSL_CMP_CTX_set_log_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_log_cb_t cb);\n#define OSSL_CMP_CTX_set_log_verbosity(ctx, level)\nvoid OSSL_CMP_CTX_print_errors(const OSSL_CMP_CTX *ctx);\n\n/* message transfer: */\nint OSSL_CMP_CTX_set1_serverPath(OSSL_CMP_CTX *ctx, const char *path);\nint OSSL_CMP_CTX_set1_server(OSSL_CMP_CTX *ctx, const char *address);\nint OSSL_CMP_CTX_set_serverPort(OSSL_CMP_CTX *ctx, int port);\nint OSSL_CMP_CTX_set1_proxy(OSSL_CMP_CTX *ctx, const char *name);\nint OSSL_CMP_CTX_set1_no_proxy(OSSL_CMP_CTX *ctx, const char *names);\nint OSSL_CMP_CTX_set_http_cb(OSSL_CMP_CTX *ctx, HTTP_bio_cb_t cb);\nint OSSL_CMP_CTX_set_http_cb_arg(OSSL_CMP_CTX *ctx, void *arg);\nvoid *OSSL_CMP_CTX_get_http_cb_arg(const OSSL_CMP_CTX *ctx);\ntypedef OSSL_CMP_MSG *(*OSSL_CMP_transfer_cb_t)(OSSL_CMP_CTX *ctx,\n                                                const OSSL_CMP_MSG *req);\nint OSSL_CMP_CTX_set_transfer_cb(OSSL_CMP_CTX *ctx,\n                                 OSSL_CMP_transfer_cb_t cb);\nint OSSL_CMP_CTX_set_transfer_cb_arg(OSSL_CMP_CTX *ctx, void *arg);\nvoid *OSSL_CMP_CTX_get_transfer_cb_arg(const OSSL_CMP_CTX *ctx);\n\n/* server authentication: */\nint OSSL_CMP_CTX_set1_srvCert(OSSL_CMP_CTX *ctx, X509 *cert);\nint OSSL_CMP_CTX_set1_expected_sender(OSSL_CMP_CTX *ctx,\n                                     const X509_NAME *name);\nint OSSL_CMP_CTX_set0_trustedStore(OSSL_CMP_CTX *ctx, X509_STORE *store);\nX509_STORE *OSSL_CMP_CTX_get0_trustedStore(const OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_set1_untrusted(OSSL_CMP_CTX *ctx, STACK_OF(X509) *certs);\nSTACK_OF(X509) *OSSL_CMP_CTX_get0_untrusted(const OSSL_CMP_CTX *ctx);\n\n/* client authentication: */\nint OSSL_CMP_CTX_set1_cert(OSSL_CMP_CTX *ctx, X509 *cert);\nint OSSL_CMP_CTX_build_cert_chain(OSSL_CMP_CTX *ctx, X509_STORE *own_trusted,\n                                  STACK_OF(X509) *candidates);\nint OSSL_CMP_CTX_set1_pkey(OSSL_CMP_CTX *ctx, EVP_PKEY *pkey);\nint OSSL_CMP_CTX_set1_referenceValue(OSSL_CMP_CTX *ctx,\n                                     const unsigned char *ref, int len);\nint OSSL_CMP_CTX_set1_secretValue(OSSL_CMP_CTX *ctx,\n                                  const unsigned char *sec, int len);\n\n/* CMP message header and extra certificates: */\nint OSSL_CMP_CTX_set1_recipient(OSSL_CMP_CTX *ctx, const X509_NAME *name);\nint OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);\nint OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_set1_extraCertsOut(OSSL_CMP_CTX *ctx,\n                                    STACK_OF(X509) *extraCertsOut);\n\n/* certificate template: */\nint OSSL_CMP_CTX_set0_newPkey(OSSL_CMP_CTX *ctx, int priv, EVP_PKEY *pkey);\nEVP_PKEY *OSSL_CMP_CTX_get0_newPkey(const OSSL_CMP_CTX *ctx, int priv);\nint OSSL_CMP_CTX_set1_issuer(OSSL_CMP_CTX *ctx, const X509_NAME *name);\nint OSSL_CMP_CTX_set1_subjectName(OSSL_CMP_CTX *ctx, const X509_NAME *name);\nint OSSL_CMP_CTX_push1_subjectAltName(OSSL_CMP_CTX *ctx,\n                                      const GENERAL_NAME *name);\nint OSSL_CMP_CTX_set0_reqExtensions(OSSL_CMP_CTX *ctx, X509_EXTENSIONS *exts);\nint OSSL_CMP_CTX_reqExtensions_have_SAN(OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_push0_policy(OSSL_CMP_CTX *ctx, POLICYINFO *pinfo);\nint OSSL_CMP_CTX_set1_oldCert(OSSL_CMP_CTX *ctx, X509 *cert);\nint OSSL_CMP_CTX_set1_p10CSR(OSSL_CMP_CTX *ctx, const X509_REQ *csr);\n\n/* misc body contents: */\nint OSSL_CMP_CTX_push0_genm_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);\n\n/* certificate confirmation: */\ntypedef int (*OSSL_CMP_certConf_cb_t)(OSSL_CMP_CTX *ctx, X509 *cert,\n                                      int fail_info, const char **txt);\nint OSSL_CMP_certConf_cb(OSSL_CMP_CTX *ctx, X509 *cert, int fail_info,\n                         const char **text);\nint OSSL_CMP_CTX_set_certConf_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_certConf_cb_t cb);\nint OSSL_CMP_CTX_set_certConf_cb_arg(OSSL_CMP_CTX *ctx, void *arg);\nvoid *OSSL_CMP_CTX_get_certConf_cb_arg(const OSSL_CMP_CTX *ctx);\n\n/* result fetching: */\nint OSSL_CMP_CTX_get_status(const OSSL_CMP_CTX *ctx);\nOSSL_CMP_PKIFREETEXT *OSSL_CMP_CTX_get0_statusString(const OSSL_CMP_CTX *ctx);\nint OSSL_CMP_CTX_get_failInfoCode(const OSSL_CMP_CTX *ctx);\n\nX509 *OSSL_CMP_CTX_get0_newCert(const OSSL_CMP_CTX *ctx);\nSTACK_OF(X509) *OSSL_CMP_CTX_get1_newChain(const OSSL_CMP_CTX *ctx);\nSTACK_OF(X509) *OSSL_CMP_CTX_get1_caPubs(const OSSL_CMP_CTX *ctx);\nSTACK_OF(X509) *OSSL_CMP_CTX_get1_extraCertsIn(const OSSL_CMP_CTX *ctx);\n\n/* for testing and debugging purposes: */\nint OSSL_CMP_CTX_set1_transactionID(OSSL_CMP_CTX *ctx,\n                                    const ASN1_OCTET_STRING *id);\nint OSSL_CMP_CTX_set1_senderNonce(OSSL_CMP_CTX *ctx,\n                                  const ASN1_OCTET_STRING *nonce);\n
                                                                                                                                                "},{"location":"man3/OSSL_CMP_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                This is the context API for using CMP (Certificate Management Protocol) with OpenSSL.

                                                                                                                                                OSSL_CMP_CTX_new() allocates an OSSL_CMP_CTX structure associated with the library context libctx and property query string propq, both of which may be NULL to select the defaults. It initializes the remaining fields to their default values - for instance, the logging verbosity is set to OSSL_CMP_LOG_INFO, the message timeout is set to 120 seconds, and the proof-of-possession method is set to OSSL_CRMF_POPO_SIGNATURE.

                                                                                                                                                OSSL_CMP_CTX_free() deallocates an OSSL_CMP_CTX structure. If the argument is NULL, nothing is done.

                                                                                                                                                OSSL_CMP_CTX_reinit() prepares the given ctx for a further transaction by clearing the internal CMP transaction (aka session) status, PKIStatusInfo, and any previous results (newCert, newChain, caPubs, and extraCertsIn) from the last executed transaction. It also clears any ITAVs that were added by OSSL_CMP_CTX_push0_genm_ITAV(). All other field values (i.e., CMP options) are retained for potential reuse.

                                                                                                                                                OSSL_CMP_CTX_set_option() sets the given value for the given option (e.g., OSSL_CMP_OPT_IMPLICIT_CONFIRM) in the given OSSL_CMP_CTX structure.

                                                                                                                                                The following options can be set:

                                                                                                                                                • OSSL_CMP_OPT_LOG_VERBOSITY

                                                                                                                                                      The level of severity needed for actually outputting log messages\n    due to errors, warnings, general info, debugging, etc.\n    Default is OSSL_CMP_LOG_INFO. See also L<OSSL_CMP_log_open(3)>.\n
                                                                                                                                                • OSSL_CMP_OPT_KEEP_ALIVE

                                                                                                                                                      If the given value is 0 then HTTP connections are not kept open\n    after receiving a response, which is the default behavior for HTTP 1.0.\n    If the value is 1 or 2 then persistent connections are requested.\n    If the value is 2 then persistent connections are required,\n    i.e., in case the server does not grant them an error occurs.\n    The default value is 1: prefer to keep the connection open.\n
                                                                                                                                                • OSSL_CMP_OPT_MSG_TIMEOUT

                                                                                                                                                      Number of seconds a CMP request-response message round trip\n    is allowed to take before a timeout error is returned.\n    A value <= 0 means no limitation (waiting indefinitely).\n    Default is to use the B<OSSL_CMP_OPT_TOTAL_TIMEOUT> setting.\n
                                                                                                                                                • OSSL_CMP_OPT_TOTAL_TIMEOUT

                                                                                                                                                      Maximum total number of seconds a transaction may take,\n    including polling etc.\n    A value <= 0 means no limitation (waiting indefinitely).\n    Default is 0.\n
                                                                                                                                                • OSSL_CMP_OPT_VALIDITY_DAYS

                                                                                                                                                      Number of days new certificates are asked to be valid for.\n
                                                                                                                                                • OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT

                                                                                                                                                      Do not take default Subject Alternative Names\n    from the reference certificate.\n
                                                                                                                                                • OSSL_CMP_OPT_SUBJECTALTNAME_CRITICAL

                                                                                                                                                      Demand that the given Subject Alternative Names are flagged as critical.\n
                                                                                                                                                • OSSL_CMP_OPT_POLICIES_CRITICAL

                                                                                                                                                      Demand that the given policies are flagged as critical.\n
                                                                                                                                                • OSSL_CMP_OPT_POPO_METHOD

                                                                                                                                                      Select the proof of possession method to use. Possible values are:\n\n        OSSL_CRMF_POPO_NONE       - ProofOfPossession field omitted\n        OSSL_CRMF_POPO_RAVERIFIED - assert that the RA has already\n                                    verified the PoPo\n        OSSL_CRMF_POPO_SIGNATURE  - sign a value with private key,\n                                    which is the default.\n        OSSL_CRMF_POPO_KEYENC     - decrypt the encrypted certificate\n                                    (\"indirect method\")\n\n    Note that a signature-based POPO can only be produced if a private key\n    is provided as the newPkey or client's pkey component of the CMP context.\n
                                                                                                                                                • OSSL_CMP_OPT_DIGEST_ALGNID

                                                                                                                                                      The NID of the digest algorithm to be used in RFC 4210's MSG_SIG_ALG\n    for signature-based message protection and Proof-of-Possession (POPO).\n    Default is SHA256.\n
                                                                                                                                                • OSSL_CMP_OPT_OWF_ALGNID The NID of the digest algorithm to be used as one-way function (OWF) for MAC-based message protection with password-based MAC (PBM). See RFC 4210 section 5.1.3.1 for details. Default is SHA256.

                                                                                                                                                • OSSL_CMP_OPT_MAC_ALGNID The NID of the MAC algorithm to be used for message protection with PBM. Default is HMAC-SHA1 as per RFC 4210.
                                                                                                                                                • OSSL_CMP_OPT_REVOCATION_REASON

                                                                                                                                                      The reason code to be included in a Revocation Request (RR);\n    values: 0..10 (RFC 5210, 5.3.1) or -1 for none, which is the default.\n
                                                                                                                                                • OSSL_CMP_OPT_IMPLICIT_CONFIRM

                                                                                                                                                      Request server to enable implicit confirm mode, where the client\n    does not need to send confirmation upon receiving the\n    certificate. If the server does not enable implicit confirmation\n    in the return message, then confirmation is sent anyway.\n
                                                                                                                                                • OSSL_CMP_OPT_DISABLE_CONFIRM

                                                                                                                                                      Do not confirm enrolled certificates, to cope with broken servers\n    not supporting implicit confirmation correctly.\n

                                                                                                                                                  B This setting leads to unspecified behavior and it is meant exclusively to allow interoperability with server implementations violating RFC 4210.

                                                                                                                                                • OSSL_CMP_OPT_UNPROTECTED_SEND

                                                                                                                                                      Send request or response messages without CMP-level protection.\n
                                                                                                                                                • OSSL_CMP_OPT_UNPROTECTED_ERRORS

                                                                                                                                                      Accept unprotected error responses which are either explicitly\n    unprotected or where protection verification failed. Applies to regular\n    error messages as well as certificate responses (IP/CP/KUP) and\n    revocation responses (RP) with rejection.\n

                                                                                                                                                  B This setting leads to unspecified behavior and it is meant exclusively to allow interoperability with server implementations violating RFC 4210.

                                                                                                                                                • OSSL_CMP_OPT_IGNORE_KEYUSAGE

                                                                                                                                                      Ignore key usage restrictions in the signer's certificate when\n    validating signature-based protection in received CMP messages.\n    Else, 'digitalSignature' must be allowed by CMP signer certificates.\n
                                                                                                                                                • OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR

                                                                                                                                                      Allow retrieving a trust anchor from extraCerts and using that\n    to validate the certificate chain of an IP message.\n
                                                                                                                                                • OSSL_CMP_CTX_get_option() reads the current value of the given option (e.g., OSSL_CMP_OPT_IMPLICIT_CONFIRM) from the given OSSL_CMP_CTX structure.

                                                                                                                                                  OSSL_CMP_CTX_set_log_cb() sets in ctx the callback function cb for handling error queue entries and logging messages. When cb is NULL errors are printed to STDERR (if available, else ignored) any log messages are ignored. Alternatively, OSSL_CMP_log_open(3) may be used to direct logging to STDOUT.

                                                                                                                                                  OSSL_CMP_CTX_set_log_verbosity() is a macro setting the OSSL_CMP_OPT_LOG_VERBOSITY context option to the given level.

                                                                                                                                                  OSSL_CMP_CTX_print_errors() outputs any entries in the OpenSSL error queue. It is similar to ERR_print_errors_cb(3) but uses the CMP log callback function if set in the ctx for uniformity with CMP logging if given. Otherwise it uses ERR_print_errors(3) to print to STDERR (unless OPENSSL_NO_STDIO is defined).

                                                                                                                                                  OSSL_CMP_CTX_set1_serverPath() sets the HTTP path of the CMP server on the host, also known as \"CMP alias\". The default is /.

                                                                                                                                                  OSSL_CMP_CTX_set1_server() sets the given server address (which may be a hostname or IP address or NULL) in the given ctx.

                                                                                                                                                  OSSL_CMP_CTX_set_serverPort() sets the port of the CMP server to connect to. If not used or the port argument is 0 the default port applies, which is 80 for HTTP and 443 for HTTPS.

                                                                                                                                                  OSSL_CMP_CTX_set1_proxy() sets the HTTP proxy to be used for connecting to the given CMP server unless overruled by any \"no_proxy\" settings (see below). If TLS is not used this defaults to the value of the environment variable http_proxy if set, else HTTP_PROXY. Otherwise defaults to the value of https_proxy if set, else HTTPS_PROXY. An empty proxy string specifies not to use a proxy. Else the format is [http[s]://]address[:port][/path], where any path given is ignored. The default port number is 80, or 443 in case https: is given.

                                                                                                                                                  OSSL_CMP_CTX_set1_no_proxy() sets the list of server hostnames not to use an HTTP proxy for. The names may be separated by commas and/or whitespace. Defaults to the environment variable no_proxy if set, else NO_PROXY.

                                                                                                                                                  OSSL_CMP_CTX_set_http_cb() sets the optional BIO connect/disconnect callback function, which has the prototype

                                                                                                                                                  typedef BIO *(*HTTP_bio_cb_t) (BIO *bio, void *ctx, int connect, int detail);\n

                                                                                                                                                  The callback may modify the bio provided by OSSL_CMP_MSG_http_perform(3), whereby it may make use of a custom defined argument ctx stored in the OSSL_CMP_CTX by means of OSSL_CMP_CTX_set_http_cb_arg(). During connection establishment, just after calling BIO_do_connect_retry(), the function is invoked with the connect argument being 1 and the detail argument being 1 if HTTPS is requested, i.e., SSL/TLS should be enabled. On disconnect connect is 0 and detail is 1 in case no error occurred, else 0. For instance, on connect the function may prepend a TLS BIO to implement HTTPS; after disconnect it may do some diagnostic output and/or specific cleanup. The function should return NULL to indicate failure. After disconnect the modified BIO will be deallocated using BIO_free_all().

                                                                                                                                                  OSSL_CMP_CTX_set_http_cb_arg() sets an argument, respectively a pointer to a structure containing arguments, optionally to be used by the http connect/disconnect callback function. arg is not consumed, and it must therefore explicitly be freed when not needed any more. arg may be NULL to clear the entry.

                                                                                                                                                  OSSL_CMP_CTX_get_http_cb_arg() gets the argument, respectively the pointer to a structure containing arguments, previously set by OSSL_CMP_CTX_set_http_cb_arg() or NULL if unset.

                                                                                                                                                  OSSL_CMP_CTX_set_transfer_cb() sets the message transfer callback function, which has the type

                                                                                                                                                  typedef OSSL_CMP_MSG *(*OSSL_CMP_transfer_cb_t) (OSSL_CMP_CTX *ctx,\n                                                 const OSSL_CMP_MSG *req);\n

                                                                                                                                                  Returns 1 on success, 0 on error.

                                                                                                                                                  Default is NULL, which implies the use of OSSL_CMP_MSG_http_perform(3). The callback should send the CMP request message it obtains via the req parameter and on success return the response, else it must return NULL. The transfer callback may make use of a custom defined argument stored in the ctx by means of OSSL_CMP_CTX_set_transfer_cb_arg(), which may be retrieved again through OSSL_CMP_CTX_get_transfer_cb_arg().

                                                                                                                                                  OSSL_CMP_CTX_set_transfer_cb_arg() sets an argument, respectively a pointer to a structure containing arguments, optionally to be used by the transfer callback. arg is not consumed, and it must therefore explicitly be freed when not needed any more. arg may be NULL to clear the entry.

                                                                                                                                                  OSSL_CMP_CTX_get_transfer_cb_arg() gets the argument, respectively the pointer to a structure containing arguments, previously set by OSSL_CMP_CTX_set_transfer_cb_arg() or NULL if unset.

                                                                                                                                                  OSSL_CMP_CTX_set1_srvCert() sets the expected server cert in ctx and trusts it directly (even if it is expired) when verifying signed response messages. This pins the accepted CMP server and results in ignoring whatever may be set using OSSL_CMP_CTX_set0_trustedStore(). Any previously set value is freed. The cert argument may be NULL to clear the entry. If set, the subject of the certificate is also used as default value for the recipient of CMP requests and as default value for the expected sender of CMP responses.

                                                                                                                                                  OSSL_CMP_CTX_set1_expected_sender() sets the Distinguished Name (DN) expected in the sender field of incoming CMP messages. Defaults to the subject of the pinned server certificate, if any. This can be used to make sure that only a particular entity is accepted as CMP message signer, and attackers are not able to use arbitrary certificates of a trusted PKI hierarchy to fraudulently pose as CMP server. Note that this gives slightly more freedom than OSSL_CMP_CTX_set1_srvCert(), which pins the server to the holder of a particular certificate, while the expected sender name will continue to match after updates of the server cert.

                                                                                                                                                  OSSL_CMP_CTX_set0_trustedStore() sets in the CMP context ctx the certificate store of type X509_STORE containing trusted certificates, typically of root CAs. This is ignored when a certificate is pinned using OSSL_CMP_CTX_set1_srvCert(). The store may also hold CRLs and a certificate verification callback function used for signature-based peer authentication. Any store entry already set before is freed. When given a NULL parameter the entry is cleared.

                                                                                                                                                  OSSL_CMP_CTX_get0_trustedStore() extracts from the CMP context ctx the pointer to the currently set certificate store containing trust anchors etc., or an empty store if unset.

                                                                                                                                                  OSSL_CMP_CTX_set1_untrusted() sets up a list of non-trusted certificates of intermediate CAs that may be useful for path construction for the own CMP signer certificate, for the own TLS certificate (if any), when verifying peer CMP protection certificates, and when verifying newly enrolled certificates. The reference counts of those certificates handled successfully are increased.

                                                                                                                                                  OSSL_CMP_CTX_get0_untrusted(OSSL_CMP_CTX *ctx) returns a pointer to the list of untrusted certs, which may be empty if unset.

                                                                                                                                                  OSSL_CMP_CTX_set1_cert() sets the CMP signer certificate, also called protection certificate, related to the private key for signature-based message protection. Therefore the public key of this cert must correspond to the private key set before or thereafter via OSSL_CMP_CTX_set1_pkey(). When using signature-based protection of CMP request messages this CMP signer certificate will be included first in the extraCerts field. It serves as fallback reference certificate, see OSSL_CMP_CTX_set1_oldCert(). The subject of this cert will be used as the sender field of outgoing messages, while the subject of any cert set via OSSL_CMP_CTX_set1_oldCert() and any value set via OSSL_CMP_CTX_set1_subjectName() are used as fallback.

                                                                                                                                                  The cert argument may be NULL to clear the entry.

                                                                                                                                                  OSSL_CMP_CTX_build_cert_chain() builds a certificate chain for the CMP signer certificate previously set in the ctx. It adds the optional candidates, a list of intermediate CA certs that may already constitute the targeted chain, to the untrusted certs that may already exist in the ctx. Then the function uses this augmented set of certs for chain construction. If own_trusted is NULL it builds the chain as far down as possible and ignores any verification errors. Else the CMP signer certificate must be verifiable where the chain reaches a trust anchor contained in own_trusted. On success the function stores the resulting chain in ctx for inclusion in the extraCerts field of signature-protected messages. Calling this function is optional; by default a chain construction is performed on demand that is equivalent to calling this function with the candidates and own_trusted arguments being NULL.

                                                                                                                                                  OSSL_CMP_CTX_set1_pkey() sets the client's private key corresponding to the CMP signer certificate set via OSSL_CMP_CTX_set1_cert(). This key is used create signature-based protection (protectionAlg = MSG_SIG_ALG) of outgoing messages unless a symmetric secret has been set via OSSL_CMP_CTX_set1_secretValue(). The pkey argument may be NULL to clear the entry.

                                                                                                                                                  OSSL_CMP_CTX_set1_secretValue() sets in ctx the byte string sec of length len to use as pre-shared secret, or clears it if the sec argument is NULL. If present, this secret is used to create MAC-based authentication and integrity protection (rather than applying signature-based protection) of outgoing messages and to verify authenticity and integrity of incoming messages that have MAC-based protection (protectionAlg = MSG_MAC_ALG).

                                                                                                                                                  OSSL_CMP_CTX_set1_referenceValue() sets the given referenceValue ref with length len in the given ctx or clears it if the ref argument is NULL. According to RFC 4210 section 5.1.1, if no value for the sender field in CMP message headers can be determined (i.e., no CMP signer certificate and no subject DN is set via OSSL_CMP_CTX_set1_subjectName() then the sender field will contain the NULL-DN and the senderKID field of the CMP message header must be set. When signature-based protection is used the senderKID will be set to the subjectKeyIdentifier of the CMP signer certificate as far as present. If not present or when MAC-based protection is used the ref value is taken as the fallback value for the senderKID.

                                                                                                                                                  OSSL_CMP_CTX_set1_recipient() sets the recipient name that will be used in the PKIHeader of CMP request messages, i.e. the X509 name of the (CA) server.

                                                                                                                                                  The recipient field in the header of a CMP message is mandatory. If not given explicitly the recipient is determined in the following order: the subject of the CMP server certificate set using OSSL_CMP_CTX_set1_srvCert(), the value set using OSSL_CMP_CTX_set1_issuer(), the issuer of the certificate set using OSSL_CMP_CTX_set1_oldCert(), the issuer of the CMP signer certificate, as far as any of those is present, else the NULL-DN as last resort.

                                                                                                                                                  OSSL_CMP_CTX_push0_geninfo_ITAV() adds itav to the stack in the ctx to be added to the GeneralInfo field of the CMP PKIMessage header of a request message sent with this context.

                                                                                                                                                  OSSL_CMP_CTX_reset_geninfo_ITAVs() clears any ITAVs that were added by OSSL_CMP_CTX_push0_geninfo_ITAV().

                                                                                                                                                  OSSL_CMP_CTX_set1_extraCertsOut() sets the stack of extraCerts that will be sent to remote.

                                                                                                                                                  OSSL_CMP_CTX_set0_newPkey() can be used to explicitly set the given EVP_PKEY structure as the private or public key to be certified in the CMP context. The priv parameter must be 0 if and only if the given key is a public key.

                                                                                                                                                  OSSL_CMP_CTX_get0_newPkey() gives the key to use for certificate enrollment dependent on fields of the CMP context structure: the newPkey (which may be a private or public key) if present, else the public key in the p10CSR if present, else the client's private key. If the priv parameter is not 0 and the selected key does not have a private component then NULL is returned.

                                                                                                                                                  OSSL_CMP_CTX_set1_issuer() sets the name of the intended issuer that will be set in the CertTemplate, i.e., the X509 name of the CA server.

                                                                                                                                                  OSSL_CMP_CTX_set1_subjectName() sets the subject DN that will be used in the CertTemplate structure when requesting a new cert. For Key Update Requests (KUR), it defaults to the subject DN of the reference certificate, see OSSL_CMP_CTX_set1_oldCert(). This default is used for Initialization Requests (IR) and Certification Requests (CR) only if no SANs are set. The subjectName is also used as fallback for the sender field of outgoing CMP messages if no reference certificate is available.

                                                                                                                                                  OSSL_CMP_CTX_push1_subjectAltName() adds the given X509 name to the list of alternate names on the certificate template request. This cannot be used if any Subject Alternative Name extension is set via OSSL_CMP_CTX_set0_reqExtensions(). By default, unless OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT has been set, the Subject Alternative Names are copied from the reference certificate, see OSSL_CMP_CTX_set1_oldCert(). If set and the subject DN is not set with OSSL_CMP_CTX_set1_subjectName() then the certificate template of an IR and CR will not be filled with the default subject DN from the reference certificate. If a subject DN is desired it needs to be set explicitly with OSSL_CMP_CTX_set1_subjectName().

                                                                                                                                                  OSSL_CMP_CTX_set0_reqExtensions() sets the X.509v3 extensions to be used in IR/CR/KUR.

                                                                                                                                                  OSSL_CMP_CTX_reqExtensions_have_SAN() returns 1 if the context contains a Subject Alternative Name extension, else 0 or -1 on error.

                                                                                                                                                  OSSL_CMP_CTX_push0_policy() adds the certificate policy info object to the X509_EXTENSIONS of the requested certificate template.

                                                                                                                                                  OSSL_CMP_CTX_set1_oldCert() sets the old certificate to be updated in Key Update Requests (KUR) or to be revoked in Revocation Requests (RR). It must be given for RR, else it defaults to the CMP signer certificate. The reference certificate determined in this way, if any, is also used for deriving default subject DN, public key, Subject Alternative Names, and the default issuer entry in the requested certificate template of IR/CR/KUR. The subject of the reference certificate is used as the sender field value in CMP message headers. Its issuer is used as default recipient in CMP message headers.

                                                                                                                                                  OSSL_CMP_CTX_set1_p10CSR() sets the PKCS#10 CSR to use in P10CR messages. If such a CSR is provided, its subject, public key, and extension fields are also used as fallback values for the certificate template of IR/CR/KUR messages.

                                                                                                                                                  OSSL_CMP_CTX_push0_genm_ITAV() adds itav to the stack in the ctx which will be the body of a General Message sent with this context.

                                                                                                                                                  OSSL_CMP_certConf_cb() is the default certificate confirmation callback function. If the callback argument is not NULL it must point to a trust store. In this case the function checks that the newly enrolled certificate can be verified using this trust store and untrusted certificates from the ctx, which have been augmented by the list of extraCerts received. During this verification, any certificate status checking is disabled. If the callback argument is NULL the function tries building an approximate chain as far as possible using the same untrusted certificates from the ctx, and if this fails it takes the received extraCerts as fallback. The resulting cert chain can be retrieved using OSSL_CMP_CTX_get1_newChain().

                                                                                                                                                  OSSL_CMP_CTX_set_certConf_cb() sets the callback used for evaluating the newly enrolled certificate before the library sends, depending on its result, a positive or negative certConf message to the server. The callback has type

                                                                                                                                                  typedef int (*OSSL_CMP_certConf_cb_t) (OSSL_CMP_CTX *ctx, X509 *cert,\n                                       int fail_info, const char **txt);\n

                                                                                                                                                  and should inspect the certificate it obtains via the cert parameter and may overrule the pre-decision given in the fail_info and *txt parameters. If it accepts the certificate it must return 0, indicating success. Else it must return a bit field reflecting PKIFailureInfo with at least one failure bit and may set the *txt output parameter to point to a string constant with more detail. The transfer callback may make use of a custom defined argument stored in the ctx by means of OSSL_CMP_CTX_set_certConf_cb_arg(), which may be retrieved again through OSSL_CMP_CTX_get_certConf_cb_arg(). Typically, the callback will check at least that the certificate can be verified using a set of trusted certificates. It also could compare the subject DN and other fields of the newly enrolled certificate with the certificate template of the request.

                                                                                                                                                  OSSL_CMP_CTX_set_certConf_cb_arg() sets an argument, respectively a pointer to a structure containing arguments, optionally to be used by the certConf callback. arg is not consumed, and it must therefore explicitly be freed when not needed any more. arg may be NULL to clear the entry.

                                                                                                                                                  OSSL_CMP_CTX_get_certConf_cb_arg() gets the argument, respectively the pointer to a structure containing arguments, previously set by OSSL_CMP_CTX_set_certConf_cb_arg(), or NULL if unset.

                                                                                                                                                  OSSL_CMP_CTX_get_status() returns for client contexts the PKIstatus from the last received CertRepMessage or Revocation Response or error message: =item OSSL_CMP_PKISTATUS_accepted on successful receipt of a GENP message:

                                                                                                                                                  • OSSL_CMP_PKISTATUS_request

                                                                                                                                                    if an IR/CR/KUR/RR/GENM request message could not be produced,

                                                                                                                                                  • OSSL_CMP_PKISTATUS_trans

                                                                                                                                                    on a transmission error or transaction error for this type of request, and

                                                                                                                                                  • OSSL_CMP_PKISTATUS_unspecified

                                                                                                                                                    if no such request was attempted or OSSL_CMP_CTX_reinit() has been called.

                                                                                                                                                  For server contexts it returns OSSL_CMP_PKISTATUS_trans if a transaction is open, otherwise OSSL_CMP_PKISTATUS_unspecified.

                                                                                                                                                  OSSL_CMP_CTX_get0_statusString() returns the statusString from the last received CertRepMessage or Revocation Response or error message, or NULL if unset.

                                                                                                                                                  OSSL_CMP_CTX_get_failInfoCode() returns the error code from the failInfo field of the last received CertRepMessage or Revocation Response or error message, or -1 if no such response was received or OSSL_CMP_CTX_reinit() has been called. This is a bit field and the flags for it are specified in the header file <openssl/cmp.h>. The flags start with OSSL_CMP_CTX_FAILINFO, for example: OSSL_CMP_CTX_FAILINFO_badAlg. Returns -1 if the failInfoCode field is unset.

                                                                                                                                                  OSSL_CMP_CTX_get0_newCert() returns the pointer to the newly obtained certificate in case it is available, else NULL.

                                                                                                                                                  OSSL_CMP_CTX_get1_newChain() returns a pointer to a duplicate of the stack of X.509 certificates computed by OSSL_CMP_certConf_cb() (if this function has been called) on the last received certificate response message IP/CP/KUP.

                                                                                                                                                  OSSL_CMP_CTX_get1_caPubs() returns a pointer to a duplicate of the list of X.509 certificates in the caPubs field of the last received certificate response message (of type IP, CP, or KUP), or an empty stack if no caPubs have been received in the current transaction.

                                                                                                                                                  OSSL_CMP_CTX_get1_extraCertsIn() returns a pointer to a duplicate of the list of X.509 certificates contained in the extraCerts field of the last received response message (except for pollRep and PKIConf), or an empty stack if no extraCerts have been received in the current transaction.

                                                                                                                                                  OSSL_CMP_CTX_set1_transactionID() sets the given transaction ID in the given OSSL_CMP_CTX structure.

                                                                                                                                                  OSSL_CMP_CTX_set1_senderNonce() stores the last sent sender nonce in the ctx. This will be used to validate the recipNonce in incoming messages.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_CTX_new/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210 (and CRMF in RFC 4211).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_CTX_free() and OSSL_CMP_CTX_print_errors() do not return anything.

                                                                                                                                                  OSSL_CMP_CTX_new(), OSSL_CMP_CTX_get_http_cb_arg(), OSSL_CMP_CTX_get_transfer_cb_arg(), OSSL_CMP_CTX_get0_trustedStore(), OSSL_CMP_CTX_get0_untrusted(), OSSL_CMP_CTX_get0_newPkey(), OSSL_CMP_CTX_get_certConf_cb_arg(), OSSL_CMP_CTX_get0_statusString(), OSSL_CMP_CTX_get0_newCert(), OSSL_CMP_CTX_get0_newChain(), OSSL_CMP_CTX_get1_caPubs(), and OSSL_CMP_CTX_get1_extraCertsIn() return the intended pointer value as described above or NULL on error.

                                                                                                                                                  OSSL_CMP_CTX_get_option(), OSSL_CMP_CTX_reqExtensions_have_SAN(), OSSL_CMP_CTX_get_status(), and OSSL_CMP_CTX_get_failInfoCode() return the intended value as described above or -1 on error.

                                                                                                                                                  OSSL_CMP_certConf_cb() returns fail_info if it is not equal to 0, else 0 on successful validation, or else a bit field with the OSSL_CMP_PKIFAILUREINFO_incorrectData bit set.

                                                                                                                                                  All other functions, including OSSL_CMP_CTX_reinit() and OSSL_CMP_CTX_reset_geninfo_ITAVs(), return 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_CTX_new/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  The following code omits error handling.

                                                                                                                                                  Set up a CMP client context for sending requests and verifying responses:

                                                                                                                                                  cmp_ctx = OSSL_CMP_CTX_new();\nOSSL_CMP_CTX_set1_server(cmp_ctx, name_or_address);\nOSSL_CMP_CTX_set1_serverPort(cmp_ctx, port_string);\nOSSL_CMP_CTX_set1_serverPath(cmp_ctx, path_or_alias);\nOSSL_CMP_CTX_set0_trustedStore(cmp_ctx, ts);\n

                                                                                                                                                  Set up symmetric credentials for MAC-based message protection such as PBM:

                                                                                                                                                  OSSL_CMP_CTX_set1_referenceValue(cmp_ctx, ref, ref_len);\nOSSL_CMP_CTX_set1_secretValue(cmp_ctx, sec, sec_len);\n

                                                                                                                                                  Set up the details for certificate requests:

                                                                                                                                                  OSSL_CMP_CTX_set1_subjectName(cmp_ctx, name);\nOSSL_CMP_CTX_set0_newPkey(cmp_ctx, 1, initialKey);\n

                                                                                                                                                  Perform an Initialization Request transaction:

                                                                                                                                                  initialCert = OSSL_CMP_exec_IR_ses(cmp_ctx);\n

                                                                                                                                                  Reset the transaction state of the CMP context and the credentials:

                                                                                                                                                  OSSL_CMP_CTX_reinit(cmp_ctx);\nOSSL_CMP_CTX_set1_referenceValue(cmp_ctx, NULL, 0);\nOSSL_CMP_CTX_set1_secretValue(cmp_ctx, NULL, 0);\n

                                                                                                                                                  Perform a Certification Request transaction, making use of the new credentials:

                                                                                                                                                  OSSL_CMP_CTX_set1_cert(cmp_ctx, initialCert);\nOSSL_CMP_CTX_set1_pkey(cmp_ctx, initialKey);\nOSSL_CMP_CTX_set0_newPkey(cmp_ctx, 1, curentKey);\ncurrentCert = OSSL_CMP_exec_CR_ses(cmp_ctx);\n

                                                                                                                                                  Perform a Key Update Request, signed using the cert (and key) to be updated:

                                                                                                                                                  OSSL_CMP_CTX_reinit(cmp_ctx);\nOSSL_CMP_CTX_set1_cert(cmp_ctx, currentCert);\nOSSL_CMP_CTX_set1_pkey(cmp_ctx, currentKey);\nOSSL_CMP_CTX_set0_newPkey(cmp_ctx, 1, updatedKey);\ncurrentCert = OSSL_CMP_exec_KUR_ses(cmp_ctx);\ncurrentKey = updatedKey;\n

                                                                                                                                                  Perform a General Message transaction including, as an example, the id-it-signKeyPairTypes OID and prints info on the General Response contents:

                                                                                                                                                  OSSL_CMP_CTX_reinit(cmp_ctx);\n\nASN1_OBJECT *type = OBJ_txt2obj(\"1.3.6.1.5.5.7.4.2\", 1);\nOSSL_CMP_ITAV *itav = OSSL_CMP_ITAV_create(type, NULL);\nOSSL_CMP_CTX_push0_genm_ITAV(cmp_ctx, itav);\n\nSTACK_OF(OSSL_CMP_ITAV) *itavs;\nitavs = OSSL_CMP_exec_GENM_ses(cmp_ctx);\nprint_itavs(itavs);\nsk_OSSL_CMP_ITAV_pop_free(itavs, OSSL_CMP_ITAV_free);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_CMP_exec_IR_ses(3), OSSL_CMP_exec_CR_ses(3), OSSL_CMP_exec_KUR_ses(3), OSSL_CMP_exec_GENM_ses(3), OSSL_CMP_exec_certreq(3), OSSL_CMP_MSG_http_perform(3), ERR_print_errors_cb(3)

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  OSSL_CMP_CTX_reset_geninfo_ITAVs() was added in OpenSSL 3.0.8.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/","title":"OSSL_CMP_HDR_get0_transactionID","text":""},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_HDR_get0_transactionID, OSSL_CMP_HDR_get0_recipNonce - functions manipulating CMP message headers

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\n\nASN1_OCTET_STRING *OSSL_CMP_HDR_get0_transactionID(const\n                                                   OSSL_CMP_PKIHEADER *hdr);\nASN1_OCTET_STRING *OSSL_CMP_HDR_get0_recipNonce(const\n                                                OSSL_CMP_PKIHEADER *hdr);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CMP_HDR_get0_transactionID returns the transaction ID of the given PKIHeader.

                                                                                                                                                  OSSL_CMP_HDR_get0_recipNonce returns the recipient nonce of the given PKIHeader.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  The functions return the intended pointer value as described above or NULL if the respective entry does not exist and on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_HDR_get0_transactionID/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/","title":"OSSL_CMP_ITAV_set0","text":""},{"location":"man3/OSSL_CMP_ITAV_set0/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_ITAV_create, OSSL_CMP_ITAV_set0, OSSL_CMP_ITAV_get0_type, OSSL_CMP_ITAV_get0_value, OSSL_CMP_ITAV_push0_stack_item - OSSL_CMP_ITAV utility functions

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\nOSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);\nvoid OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type,\n                        ASN1_TYPE *value);\nASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav);\nASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav);\n\nint OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **itav_sk_p,\n                                   OSSL_CMP_ITAV *itav);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL

                                                                                                                                                  ITAV is short for InfoTypeAndValue. This type is defined in RFC 4210 section 5.3.19 and Appendix F. It is used at various places in CMP messages, e.g., in the generalInfo PKIHeader field, to hold a key-value pair.

                                                                                                                                                  OSSL_CMP_ITAV_create() creates a new OSSL_CMP_ITAV structure and fills it in. It combines OSSL_CMP_ITAV_new() and OSSL_CMP_ITAV_set0().

                                                                                                                                                  OSSL_CMP_ITAV_set0() sets the itav with an infoType of type and an infoValue of value. This function uses the pointers type and value internally, so they must not be freed up after the call.

                                                                                                                                                  OSSL_CMP_ITAV_get0_type() returns a direct pointer to the infoType in the itav.

                                                                                                                                                  OSSL_CMP_ITAV_get0_value() returns a direct pointer to the infoValue in the itav as generic ASN1_TYPE pointer.

                                                                                                                                                  OSSL_CMP_ITAV_push0_stack_item() pushes itav to the stack pointed to by *itav_sk_p. It creates a new stack if *itav_sk_p points to NULL.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210 (and CRMF in RFC 4211).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_ITAV_create() returns a pointer to the ITAV structure on success, or NULL on error.

                                                                                                                                                  OSSL_CMP_ITAV_set0() does not return a value.

                                                                                                                                                  OSSL_CMP_ITAV_get0_type() and OSSL_CMP_ITAV_get0_value() return the respective pointer or NULL if their input is NULL.

                                                                                                                                                  OSSL_CMP_ITAV_push0_stack_item() returns 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  The following code creates and sets a structure representing a generic InfoTypeAndValue sequence, using an OID created from text as type, and an integer as value. Afterwards, it is pushed to the OSSL_CMP_CTX to be later included in the requests' PKIHeader's genInfo field.

                                                                                                                                                  ASN1_OBJECT *type = OBJ_txt2obj(\"1.2.3.4.5\", 1);\nif (type == NULL) ...\n\nASN1_INTEGER *asn1int = ASN1_INTEGER_new();\nif (asn1int == NULL || !ASN1_INTEGER_set(asn1int, 12345)) ...\n\nASN1_TYPE *val = ASN1_TYPE_new();\nif (val == NULL) ...\nASN1_TYPE_set(val, V_ASN1_INTEGER, asn1int);\n\nOSSL_CMP_ITAV *itav = OSSL_CMP_ITAV_create(type, val);\nif (itav == NULL) ...\n\nOSSL_CMP_CTX *ctx = OSSL_CMP_CTX_new();\nif (ctx == NULL || !OSSL_CMP_CTX_geninfo_push0_ITAV(ctx, itav)) {\n    OSSL_CMP_ITAV_free(itav); /* also frees type and val */\n    goto err;\n}\n\n...\n\nOSSL_CMP_CTX_free(ctx); /* also frees itav */\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_CMP_CTX_new(3), OSSL_CMP_CTX_free(3), ASN1_TYPE_set(3)

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_ITAV_set0/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/","title":"OSSL_CMP_MSG_get0_header","text":""},{"location":"man3/OSSL_CMP_MSG_get0_header/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_MSG_get0_header, OSSL_CMP_MSG_get_bodytype, OSSL_CMP_MSG_update_transactionID, OSSL_CMP_MSG_update_recipNonce, OSSL_CMP_CTX_setup_CRM, OSSL_CMP_MSG_read, OSSL_CMP_MSG_write, d2i_OSSL_CMP_MSG_bio, i2d_OSSL_CMP_MSG_bio - function(s) manipulating CMP messages

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\n\nOSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg);\nint OSSL_CMP_MSG_get_bodytype(const OSSL_CMP_MSG *msg);\nint OSSL_CMP_MSG_update_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);\nint OSSL_CMP_MSG_update_recipNonce(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);\nOSSL_CRMF_MSG *OSSL_CMP_CTX_setup_CRM(OSSL_CMP_CTX *ctx, int for_KUR, int rid);\nOSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx, const char *propq);\nint OSSL_CMP_MSG_write(const char *file, const OSSL_CMP_MSG *msg);\nOSSL_CMP_MSG *d2i_OSSL_CMP_MSG_bio(BIO *bio, OSSL_CMP_MSG **msg);\nint i2d_OSSL_CMP_MSG_bio(BIO *bio, const OSSL_CMP_MSG *msg);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CMP_MSG_get0_header() returns the header of the given CMP message.

                                                                                                                                                  OSSL_CMP_MSG_get_bodytype() returns the body type of the given CMP message.

                                                                                                                                                  OSSL_CMP_MSG_update_transactionID() updates the transactionID field in the header of the given message according to the CMP_CTX. If ctx does not contain a transaction ID, a fresh one is created before. The message gets re-protected (if protecting requests is required).

                                                                                                                                                  OSSL_CMP_MSG_update_recipNonce() updates the recipNonce field in the header of the given message according to the CMP_CTX. The message gets re-protected (if protecting requests is required).

                                                                                                                                                  OSSL_CMP_CTX_setup_CRM() creates a CRMF certificate request message from various information provided in the CMP context argument ctx for inclusion in a CMP request message based on details contained in ctx. The rid argument defines the request identifier to use, which typically is 0.

                                                                                                                                                  The subject DN included in the certificate template is the first available value of these:

                                                                                                                                                  • any subject name in ctx set via OSSL_CMP_CTX_set1_subjectName(3) - if it is the NULL-DN (i.e., any empty sequence of RDNs), no subject is included,
                                                                                                                                                  • the subject field of any PKCS#10 CSR set in ctx via OSSL_CMP_CTX_set1_p10CSR(3),
                                                                                                                                                  • the subject field of any reference certificate given in ctx (see OSSL_CMP_CTX_set1_oldCert(3)), but only if for_KUR is nonzero or the ctx does not include a Subject Alternative Name.

                                                                                                                                                  The public key included is the first available value of these:

                                                                                                                                                  • the public key derived from any key set via OSSL_CMP_CTX_set0_newPkey(3),
                                                                                                                                                  • the public key of any PKCS#10 CSR given in ctx,
                                                                                                                                                  • the public key of any reference certificate given in ctx (see OSSL_CMP_CTX_set1_oldCert(3)),
                                                                                                                                                  • the public key derived from any client's private key set via OSSL_CMP_CTX_set1_pkey(3).

                                                                                                                                                  The set of X.509 extensions to include is computed as follows. If a PKCS#10 CSR is present in ctx, default extensions are taken from there, otherwise the empty set is taken as the initial value. If there is a reference certificate in ctx and contains Subject Alternative Names (SANs) and OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT is not set, these override any SANs from the PKCS#10 CSR. The extensions are further augmented or overridden by any extensions with the same OIDs included in the ctx via OSSL_CMP_CTX_set0_reqExtensions(3). The SANs are further overridden by any SANs included in ctx via OSSL_CMP_CTX_push1_subjectAltName(3). Finally, policies are overridden by any policies included in ctx via OSSL_CMP_CTX_push0_policy(3).

                                                                                                                                                  OSSL_CMP_CTX_setup_CRM() also sets the sets the regToken control oldCertID for KUR messages using the issuer name and serial number of the reference certificate, if present.

                                                                                                                                                  OSSL_CMP_MSG_read() loads a DER-encoded OSSL_CMP_MSG from file.

                                                                                                                                                  OSSL_CMP_MSG_write() stores the given OSSL_CMP_MSG to file in DER encoding.

                                                                                                                                                  d2i_OSSL_CMP_MSG_bio() parses an ASN.1-encoded OSSL_CMP_MSG from the BIO bio. It assigns a pointer to the new structure to *msg if msg is not NULL.

                                                                                                                                                  i2d_OSSL_CMP_MSG_bio() writes the OSSL_CMP_MSG msg in ASN.1 encoding to BIO bio.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_MSG_get0_header() returns the intended pointer value as described above or NULL if the respective entry does not exist and on error.

                                                                                                                                                  OSSL_CMP_MSG_get_bodytype() returns the body type or -1 on error.

                                                                                                                                                  OSSL_CMP_CTX_setup_CRM() returns a pointer to a OSSL_CRMF_MSG on success, NULL on error.

                                                                                                                                                  d2i_OSSL_CMP_MSG_bio() returns the parsed message or NULL on error.

                                                                                                                                                  OSSL_CMP_MSG_read() and d2i_OSSL_CMP_MSG_bio() return the parsed CMP message or NULL on error.

                                                                                                                                                  OSSL_CMP_MSG_write() returns the number of bytes successfully encoded or a negative value if an error occurs.

                                                                                                                                                  i2d_OSSL_CMP_MSG_bio(), OSSL_CMP_MSG_update_transactionID(), and OSSL_CMP_MSG_update_recipNonce() return 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_CMP_CTX_set1_subjectName(3), OSSL_CMP_CTX_set1_p10CSR(3), OSSL_CMP_CTX_set1_oldCert(3), OSSL_CMP_CTX_set0_newPkey(3), OSSL_CMP_CTX_set1_pkey(3), OSSL_CMP_CTX_set0_reqExtensions(3), OSSL_CMP_CTX_push1_subjectAltName(3), OSSL_CMP_CTX_push0_policy(3)

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  OSSL_CMP_MSG_update_recipNonce() was added in OpenSSL 3.0.9.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_get0_header/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/","title":"OSSL_CMP_MSG_http_perform","text":""},{"location":"man3/OSSL_CMP_MSG_http_perform/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_MSG_http_perform - client-side HTTP(S) transfer of a CMP request-response pair

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\n\nOSSL_CMP_MSG *OSSL_CMP_MSG_http_perform(OSSL_CMP_CTX *ctx,\n                                        const OSSL_CMP_MSG *req);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CMP_MSG_http_perform() sends the given PKIMessage req to the CMP server specified in ctx via OSSL_CMP_CTX_set1_server(3) and optionally OSSL_CMP_CTX_set_serverPort(3), using any \"CMP alias\" optionally specified via OSSL_CMP_CTX_set1_serverPath(3). The default port is 80 for HTTP and 443 for HTTPS; the default path is \"/\". On success the function returns the server's response PKIMessage.

                                                                                                                                                  The function makes use of any HTTP callback function set via OSSL_CMP_CTX_set_http_cb(3). It respects any timeout value set via OSSL_CMP_CTX_set_option(3) with an OSSL_CMP_OPT_MSG_TIMEOUT argument. It also respects any HTTP(S) proxy options set via OSSL_CMP_CTX_set1_proxy(3) and OSSL_CMP_CTX_set1_no_proxy(3) and the respective environment variables. Proxying plain HTTP is supported directly, while using a proxy for HTTPS connections requires a suitable callback function such as OSSL_HTTP_proxy_connect(3).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210. HTTP transfer for CMP is defined in RFC 6712.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_MSG_http_perform() returns a CMP message on success, else NULL.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_CMP_CTX_new(3), OSSL_HTTP_proxy_connect(3).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_MSG_http_perform/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_SRV_CTX_new/","title":"OSSL_CMP_SRV_CTX_new","text":""},{"location":"man3/OSSL_CMP_SRV_CTX_new/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_SRV_process_request, OSSL_CMP_CTX_server_perform, OSSL_CMP_SRV_CTX_new, OSSL_CMP_SRV_CTX_free, OSSL_CMP_SRV_cert_request_cb_t, OSSL_CMP_SRV_rr_cb_t, OSSL_CMP_SRV_certConf_cb_t, OSSL_CMP_SRV_genm_cb_t, OSSL_CMP_SRV_error_cb_t, OSSL_CMP_SRV_pollReq_cb_t, OSSL_CMP_SRV_CTX_init, OSSL_CMP_SRV_CTX_get0_cmp_ctx, OSSL_CMP_SRV_CTX_get0_custom_ctx, OSSL_CMP_SRV_CTX_set_send_unprotected_errors, OSSL_CMP_SRV_CTX_set_accept_unprotected, OSSL_CMP_SRV_CTX_set_accept_raverified, OSSL_CMP_SRV_CTX_set_grant_implicit_confirm - generic functions to set up and control a CMP server

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\n\nOSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx,\n                                           const OSSL_CMP_MSG *req);\nOSSL_CMP_MSG *OSSL_CMP_CTX_server_perform(OSSL_CMP_CTX *client_ctx,\n                                          const OSSL_CMP_MSG *req);\nOSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);\nvoid OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx);\n\ntypedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_cert_request_cb_t)(\n                                                OSSL_CMP_SRV_CTX *srv_ctx,\n                                                const OSSL_CMP_MSG *req,\n                                                int certReqId,\n                                                const OSSL_CRMF_MSG *crm,\n                                                const X509_REQ *p10cr,\n                                                X509 **certOut,\n                                                STACK_OF(X509) **chainOut,\n                                                STACK_OF(X509) **caPubs);\ntypedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_rr_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                                const OSSL_CMP_MSG *req,\n                                                const X509_NAME *issuer,\n                                                const ASN1_INTEGER *serial);\ntypedef int (*OSSL_CMP_SRV_genm_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                      const OSSL_CMP_MSG *req,\n                                      STACK_OF(OSSL_CMP_ITAV) *in,\n                                      STACK_OF(OSSL_CMP_ITAV) **out);\ntypedef void (*OSSL_CMP_SRV_error_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                        const OSSL_CMP_MSG *req,\n                                        const OSSL_CMP_PKISI *statusInfo,\n                                        const ASN1_INTEGER *errorCode,\n                                        const OSSL_CMP_PKIFREETEXT *errorDetails);\ntypedef int (*OSSL_CMP_SRV_certConf_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                          const OSSL_CMP_MSG *req,\n                                          int certReqId,\n                                          const ASN1_OCTET_STRING *certHash,\n                                          const OSSL_CMP_PKISI *si);\ntypedef int (*OSSL_CMP_SRV_pollReq_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,\n                                         const OSSL_CMP_MSG *req,\n                                         int certReqId,\n                                         OSSL_CMP_MSG **certReq,\n                                         int64_t *check_after);\nint OSSL_CMP_SRV_CTX_init(OSSL_CMP_SRV_CTX *srv_ctx, void *custom_ctx,\n                          OSSL_CMP_SRV_cert_request_cb_t process_cert_request,\n                          OSSL_CMP_SRV_rr_cb_t process_rr,\n                          OSSL_CMP_SRV_genm_cb_t process_genm,\n                          OSSL_CMP_SRV_error_cb_t process_error,\n                          OSSL_CMP_SRV_certConf_cb_t process_certConf,\n                          OSSL_CMP_SRV_pollReq_cb_t process_pollReq);\n\nOSSL_CMP_CTX *OSSL_CMP_SRV_CTX_get0_cmp_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);\nvoid *OSSL_CMP_SRV_CTX_get0_custom_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);\n\nint OSSL_CMP_SRV_CTX_set_send_unprotected_errors(OSSL_CMP_SRV_CTX *srv_ctx,\n                                                 int val);\nint OSSL_CMP_SRV_CTX_set_accept_unprotected(OSSL_CMP_SRV_CTX *srv_ctx, int val);\nint OSSL_CMP_SRV_CTX_set_accept_raverified(OSSL_CMP_SRV_CTX *srv_ctx, int val);\nint OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(OSSL_CMP_SRV_CTX *srv_ctx,\n                                                int val);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CMP_SRV_process_request() implements the generic aspects of a CMP server. Its arguments are the OSSL_CMP_SRV_CTX srv_ctx and the CMP request message req. It does the typical generic checks on req, calls the respective callback function (if present) for more specific processing, and then assembles a result message, which may be a CMP error message. If after return of the function the expression OSSL_CMP_CTX_get_status(OSSL_CMP_SRV_CTX_get0_cmp_ctx(srv_ctx)) yields -1 then the function has closed the current transaction, which may be due to normal successful end of the transaction or due to an error.

                                                                                                                                                  OSSL_CMP_CTX_server_perform() is an interface to OSSL_CMP_SRV_process_request() that can be used by a CMP client in the same way as OSSL_CMP_MSG_http_perform(3). The OSSL_CMP_SRV_CTX must be set as transfer_cb_arg of client_ctx.

                                                                                                                                                  OSSL_CMP_SRV_CTX_new() creates and initializes an OSSL_CMP_SRV_CTX structure associated with the library context libctx and property query string propq, both of which may be NULL to select the defaults.

                                                                                                                                                  OSSL_CMP_SRV_CTX_free() deletes the given srv_ctx. If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_CMP_SRV_CTX_init() sets in the given srv_ctx a custom server context pointer as well as callback functions performing the specific processing of CMP certificate requests, revocation requests, certificate confirmation requests, general messages, error messages, and poll requests. All arguments except srv_ctx may be NULL. If a callback for some message type is not given this means that the respective type of CMP message is not supported by the server.

                                                                                                                                                  OSSL_CMP_SRV_CTX_get0_cmp_ctx() returns the OSSL_CMP_CTX from the srv_ctx.

                                                                                                                                                  OSSL_CMP_SRV_CTX_get0_custom_ctx() returns the custom server context from srv_ctx that has been set using OSSL_CMP_SRV_CTX_init().

                                                                                                                                                  OSSL_CMP_SRV_CTX_set_send_unprotected_errors() enables sending error messages and other forms of negative responses unprotected.

                                                                                                                                                  OSSL_CMP_SRV_CTX_set_accept_unprotected() enables acceptance of requests without protection of with invalid protection.

                                                                                                                                                  OSSL_CMP_SRV_CTX_set_accept_raverified() enables acceptance of ir/cr/kur messages with POPO 'RAVerified'.

                                                                                                                                                  OSSL_CMP_SRV_CTX_set_grant_implicit_confirm() enables granting implicit confirmation of newly enrolled certificates if requested.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210 (and CRMF in RFC 4211).

                                                                                                                                                  So far the CMP server implementation is limited to one request per CMP message (and consequently to at most one response component per CMP message).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_SRV_CTX_new() returns a OSSL_CMP_SRV_CTX structure on success, NULL on error.

                                                                                                                                                  OSSL_CMP_SRV_CTX_free() does not return a value.

                                                                                                                                                  OSSL_CMP_SRV_CTX_get0_cmp_ctx() returns a OSSL_CMP_CTX structure on success, NULL on error.

                                                                                                                                                  OSSL_CMP_SRV_CTX_get0_custom_ctx() returns the custom server context that has been set using OSSL_CMP_SRV_CTX_init().

                                                                                                                                                  All other functions return 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_SRV_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_STATUSINFO_new/","title":"OSSL_CMP_STATUSINFO_new","text":""},{"location":"man3/OSSL_CMP_STATUSINFO_new/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_STATUSINFO_new, OSSL_CMP_snprint_PKIStatusInfo, OSSL_CMP_CTX_snprint_PKIStatus - function(s) for managing the CMP PKIStatus

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\n\nOSSL_CMP_PKISI *OSSL_CMP_STATUSINFO_new(int status, int fail_info,\n                                        const char *text);\nchar *OSSL_CMP_snprint_PKIStatusInfo(const OSSL_CMP_PKISI *statusInfo,\n                                     char *buf, size_t bufsize);\nchar *OSSL_CMP_CTX_snprint_PKIStatus(const OSSL_CMP_CTX *ctx, char *buf,\n                                     size_t bufsize);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  This is the PKIStatus API for using CMP (Certificate Management Protocol) with OpenSSL.

                                                                                                                                                  OSSL_CMP_STATUSINFO_new() creates a new PKIStatusInfo structure and fills in the given values. It sets the status field to status, copies text (unless it is NULL) to statusString, and interprets fail_info as bit pattern for the failInfo field.

                                                                                                                                                  OSSL_CMP_snprint_PKIStatusInfo() places a human-readable string representing the given statusInfo in the given buffer, with the given maximal length.

                                                                                                                                                  OSSL_CMP_CTX_snprint_PKIStatus() places a human-readable string representing the PKIStatusInfo components of the CMP context ctx in the given buffer, with the given maximal length.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210 (and CRMF in RFC 4211).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_STATUSINFO_new() returns a pointer to the structure on success, or NULL on error.

                                                                                                                                                  OSSL_CMP_snprint_PKIStatusInfo() and OSSL_CMP_CTX_snprint_PKIStatus() return a copy of the buffer pointer containing the string or NULL on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_STATUSINFO_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/","title":"OSSL_CMP_exec_certreq","text":""},{"location":"man3/OSSL_CMP_exec_certreq/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_exec_certreq, OSSL_CMP_exec_IR_ses, OSSL_CMP_exec_CR_ses, OSSL_CMP_exec_P10CR_ses, OSSL_CMP_exec_KUR_ses, OSSL_CMP_IR, OSSL_CMP_CR, OSSL_CMP_P10CR, OSSL_CMP_KUR, OSSL_CMP_try_certreq, OSSL_CMP_exec_RR_ses, OSSL_CMP_exec_GENM_ses - functions implementing CMP client transactions

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\n\nX509 *OSSL_CMP_exec_certreq(OSSL_CMP_CTX *ctx, int req_type,\n                            const OSSL_CRMF_MSG *crm);\nX509 *OSSL_CMP_exec_IR_ses(OSSL_CMP_CTX *ctx);\nX509 *OSSL_CMP_exec_CR_ses(OSSL_CMP_CTX *ctx);\nX509 *OSSL_CMP_exec_P10CR_ses(OSSL_CMP_CTX *ctx);\nX509 *OSSL_CMP_exec_KUR_ses(OSSL_CMP_CTX *ctx);\n#define OSSL_CMP_IR\n#define OSSL_CMP_CR\n#define OSSL_CMP_P10CR\n#define OSSL_CMP_KUR\nint OSSL_CMP_try_certreq(OSSL_CMP_CTX *ctx, int req_type,\n                         const OSSL_CRMF_MSG *crm, int *checkAfter);\nint OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx);\nSTACK_OF(OSSL_CMP_ITAV) *OSSL_CMP_exec_GENM_ses(OSSL_CMP_CTX *ctx);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  This is the OpenSSL API for doing CMP (Certificate Management Protocol) client-server transactions, i.e., sequences of CMP requests and responses.

                                                                                                                                                  All functions take a populated OSSL_CMP_CTX structure as their first argument. Usually the server name, port, and path (\"CMP alias\") need to be set, as well as credentials the client can use for authenticating itself to the server. In order to authenticate the server the client typically needs a trust store. The functions return their respective main results directly, while there are also accessor functions for retrieving various results and status information from the ctx. See OSSL_CMP_CTX_new(3) etc. for details.

                                                                                                                                                  The default conveying protocol is HTTP. Timeout values may be given per request-response pair and per transaction. See OSSL_CMP_MSG_http_perform(3) for details.

                                                                                                                                                  OSSL_CMP_exec_IR_ses() requests an initial certificate from the given PKI.

                                                                                                                                                  OSSL_CMP_exec_CR_ses() requests an additional certificate.

                                                                                                                                                  OSSL_CMP_exec_P10CR_ses() conveys a legacy PKCS#10 CSR requesting a certificate.

                                                                                                                                                  OSSL_CMP_exec_KUR_ses() obtains an updated certificate.

                                                                                                                                                  These four types of certificate enrollment are implemented as macros calling OSSL_CMP_exec_certreq().

                                                                                                                                                  OSSL_CMP_exec_certreq() performs a certificate request of the type specified by the req_type parameter, which may be IR, CR, P10CR, or KUR. For IR, CR, and KUR, the certificate template to be used in the request may be supplied via the crm parameter pointing to a CRMF structure. Typically crm is NULL, then the template ingredients are taken from ctx and need to be filled in using OSSL_CMP_CTX_set1_subjectName(3), OSSL_CMP_CTX_set0_newPkey(3), OSSL_CMP_CTX_set1_oldCert(3), etc. For P10CR, OSSL_CMP_CTX_set1_p10CSR(3) needs to be used instead. The enrollment session may be blocked by sleeping until the addressed CA (or an intermediate PKI component) can fully process and answer the request.

                                                                                                                                                  OSSL_CMP_try_certreq() is an alternative to the above functions that is more flexible regarding what to do after receiving a checkAfter value. When called for the first time (with no certificate request in progress for the given ctx) it starts a new transaction by sending a certificate request constructed as stated above using the req_type and optional crm parameter. Otherwise (when according to ctx a 'waiting' status has been received before) it continues polling for the pending request unless the req_type argument is < 0, which aborts the request. If the requested certificate is available the function returns 1 and the caller can use OSSL_CMP_CTX_get0_newCert(3) to retrieve the new certificate. If no error occurred but no certificate is available yet then OSSL_CMP_try_certreq() remembers in the CMP context that it should be retried and returns -1 after assigning the received checkAfter value via the output pointer argument (unless it is NULL). The checkAfter value indicates the number of seconds the caller should let pass before trying again. The caller is free to sleep for the given number of seconds or for some other time and/or to do anything else before retrying by calling OSSL_CMP_try_certreq() again with the same parameter values as before. OSSL_CMP_try_certreq() then polls to see whether meanwhile the requested certificate is available. If the caller decides to abort the pending certificate request and provides a negative value as the req_type argument then OSSL_CMP_try_certreq() aborts the CMP transaction by sending an error message to the server.

                                                                                                                                                  OSSL_CMP_exec_RR_ses() requests the revocation of the certificate specified in the ctx using OSSL_CMP_CTX_set1_oldCert(3). RFC 4210 is vague in which PKIStatus should be returned by the server. We take \"accepted\" and \"grantedWithMods\" as clear success and handle \"revocationWarning\" and \"revocationNotification\" just as warnings because CAs typically return them as an indication that the certificate was already revoked. \"rejection\" is a clear error. The values \"waiting\" and \"keyUpdateWarning\" make no sense for revocation and thus are treated as an error as well.

                                                                                                                                                  OSSL_CMP_exec_GENM_ses() sends a general message containing the sequence of infoType and infoValue pairs (InfoTypeAndValue; short: ITAV) optionally provided in the ctx using OSSL_CMP_CTX_push0_genm_ITAV(3). On success it records in ctx the status OSSL_CMP_PKISTATUS_accepted and returns the list of ITAVs received in the GENP message. This can be used, for instance, to poll for CRLs or CA Key Updates. See RFC 4210 section 5.3.19 and appendix E.5 for details.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210 (and CRMF in RFC 4211).

                                                                                                                                                  The CMP client implementation is limited to one request per CMP message (and consequently to at most one response component per CMP message).

                                                                                                                                                  When a client obtains from a CMP server CA certificates that it is going to trust, for instance via the caPubs field of a certificate response, authentication of the CMP server is particularly critical. So special care must be taken setting up server authentication in ctx using functions such as OSSL_CMP_CTX_set0_trustedStore(3) (for certificate-based authentication) or OSSL_CMP_CTX_set1_secretValue(3) (for MAC-based protection).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_exec_certreq(), OSSL_CMP_exec_IR_ses(), OSSL_CMP_exec_CR_ses(), OSSL_CMP_exec_P10CR_ses(), and OSSL_CMP_exec_KUR_ses() return a pointer to the newly obtained X509 certificate on success, NULL on error. This pointer will be freed implicitly by OSSL_CMP_CTX_free() or CSSL_CMP_CTX_reinit().

                                                                                                                                                  OSSL_CMP_try_certreq() returns 1 if the requested certificate is available via OSSL_CMP_CTX_get0_newCert(3) or on successfully aborting a pending certificate request, 0 on error, and -1 in case a 'waiting' status has been received and checkAfter value is available. In the latter case OSSL_CMP_CTX_get0_newCert(3) yields NULL and the output parameter checkAfter has been used to assign the received value unless checkAfter is NULL.

                                                                                                                                                  OSSL_CMP_exec_RR_ses() returns 1 on success, 0 on error.

                                                                                                                                                  OSSL_CMP_exec_GENM_ses() returns NULL on error, otherwise a pointer to the sequence of ITAV received, which may be empty. This pointer must be freed by the caller.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  See OSSL_CMP_CTX for examples on how to prepare the context for these functions.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_CMP_CTX_new(3), OSSL_CMP_CTX_free(3), OSSL_CMP_CTX_set1_subjectName(3), OSSL_CMP_CTX_set0_newPkey(3), OSSL_CMP_CTX_set1_p10CSR(3), OSSL_CMP_CTX_set1_oldCert(3), OSSL_CMP_CTX_get0_newCert(3), OSSL_CMP_CTX_push0_genm_ITAV(3), OSSL_CMP_MSG_http_perform(3)

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_exec_certreq/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_log_open/","title":"OSSL_CMP_log_open","text":""},{"location":"man3/OSSL_CMP_log_open/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_log_open, OSSL_CMP_log_close, OSSL_CMP_severity, OSSL_CMP_LOG_EMERG, OSSL_CMP_LOG_ALERT, OSSL_CMP_LOG_CRIT, OSSL_CMP_LOG_ERR, OSSL_CMP_LOG_WARNING, OSSL_CMP_LOG_NOTICE, OSSL_CMP_LOG_INFO, OSSL_CMP_LOG_DEBUG, OSSL_CMP_LOG_TRACE,

                                                                                                                                                  OSSL_CMP_log_cb_t, OSSL_CMP_print_to_bio, OSSL_CMP_print_errors_cb - functions for logging and error reporting

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_log_open/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp_util.h>\n\nint  OSSL_CMP_log_open(void);\nvoid OSSL_CMP_log_close(void);\n\n/* severity level declarations resemble those from syslog.h */\ntypedef int OSSL_CMP_severity;\n#define OSSL_CMP_LOG_EMERG   0\n#define OSSL_CMP_LOG_ALERT   1\n#define OSSL_CMP_LOG_CRIT    2\n#define OSSL_CMP_LOG_ERR     3\n#define OSSL_CMP_LOG_WARNING 4\n#define OSSL_CMP_LOG_NOTICE  5\n#define OSSL_CMP_LOG_INFO    6\n#define OSSL_CMP_LOG_DEBUG   7\n#define OSSL_CMP_LOG_TRACE   8\n\ntypedef int (*OSSL_CMP_log_cb_t)(const char *component,\n                                 const char *file, int line,\n                                 OSSL_CMP_severity level, const char *msg);\nint OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file,\n                          int line, OSSL_CMP_severity level, const char *msg);\nvoid OSSL_CMP_print_errors_cb(OSSL_CMP_log_cb_t log_fn);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_log_open/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  The logging and error reporting facility described here contains convenience functions for CMP-specific logging, including a string prefix mirroring the severity levels of syslog.h, and enhancements of the error queue mechanism needed for large diagnostic messages produced by the CMP library in case of certificate validation failures.

                                                                                                                                                  When an interesting activity is performed or an error occurs, some detail should be provided for user information, debugging, and auditing purposes. A CMP application can obtain this information by providing a callback function with the following type:

                                                                                                                                                  typedef int (*OSSL_CMP_log_cb_t)(const char *component,\n                                 const char *file, int line,\n                                 OSSL_CMP_severity level, const char *msg);\n

                                                                                                                                                  The parameters may provide some component info (which may be a module name and/or function name) or NULL, a file pathname or NULL, a line number or 0 indicating the source code location, a severity level, and a message string describing the nature of the event, terminated by '\\n'.

                                                                                                                                                  Even when an activity is successful some warnings may be useful and some degree of auditing may be required. Therefore, the logging facility supports a severity level and the callback function has a level parameter indicating such a level, such that error, warning, info, debug, etc. can be treated differently. The callback is activated only when the severity level is sufficient according to the current level of verbosity, which by default is OSSL_CMP_LOG_INFO.

                                                                                                                                                  The callback function may itself do non-trivial tasks like writing to a log file or remote stream, which in turn may fail. Therefore, the function should return 1 on success and 0 on failure.

                                                                                                                                                  OSSL_CMP_log_open() initializes the CMP-specific logging facility to output everything to STDOUT. It fails if the integrated tracing is disabled or STDIO is not available. It may be called during application startup. Alternatively, OSSL_CMP_CTX_set_log_cb(3) can be used for more flexibility. As long as neither if the two is used any logging output is ignored.

                                                                                                                                                  OSSL_CMP_log_close() may be called when all activities are finished to flush any pending CMP-specific log output and deallocate related resources. It may be called multiple times. It does get called at OpenSSL shutdown.

                                                                                                                                                  OSSL_CMP_print_to_bio() prints the given component info, filename, line number, severity level, and log message or error queue message to the given bio. component usually is a function or module name. If it is NULL, empty, or \"(unknown function)\" then \"CMP\" is used as fallback.

                                                                                                                                                  OSSL_CMP_print_errors_cb() outputs any entries in the OpenSSL error queue. It is similar to ERR_print_errors_cb(3) but uses the CMP log callback function log_fn for uniformity with CMP logging if not NULL. Otherwise it prints to STDERR using OSSL_CMP_print_to_bio(3) (unless OPENSSL_NO_STDIO is defined).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_log_open/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_log_close() and OSSL_CMP_print_errors_cb() do not return anything.

                                                                                                                                                  All other functions return 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_log_open/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_log_open/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/","title":"OSSL_CMP_validate_msg","text":""},{"location":"man3/OSSL_CMP_validate_msg/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CMP_validate_msg, OSSL_CMP_validate_cert_path - functions for verifying CMP message protection

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/cmp.h>\nint OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);\nint OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx,\n                                X509_STORE *trusted_store, X509 *cert);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  This is the API for validating the protection of CMP messages, which includes validating CMP message sender certificates and their paths while optionally checking the revocation status of the certificates(s).

                                                                                                                                                  OSSL_CMP_validate_msg() validates the protection of the given msg, which must be signature-based or using password-based MAC (PBM). In the former case a suitable trust anchor must be given in the CMP context ctx, and in the latter case the matching secret must have been set there using OSSL_CMP_CTX_set1_secretValue(3).

                                                                                                                                                  In case of signature algorithm, the certificate to use for the signature check is preferably the one provided by a call to OSSL_CMP_CTX_set1_srvCert(3). If no such sender cert has been pinned then candidate sender certificates are taken from the list of certificates received in the msg extraCerts, then any certificates provided before via OSSL_CMP_CTX_set1_untrusted(3), and then all trusted certificates provided via OSSL_CMP_CTX_set0_trustedStore(3), where a candidate is acceptable only if has not expired, its subject DN matches the msg sender DN (as far as present), and its subject key identifier is present and matches the senderKID (as far as the latter present). Each acceptable cert is tried in the given order to see if the message signature check succeeds and the cert and its path can be verified using any trust store set via OSSL_CMP_CTX_set0_trustedStore(3).

                                                                                                                                                  If the option OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR was set by calling OSSL_CMP_CTX_set_option(3), for an Initialization Response (IP) message any self-issued certificate from the msg extraCerts field may also be used as trust anchor for the path verification of an acceptable cert if it can be used also to validate the issued certificate returned in the IP message. This is according to TS 33.310 [Network Domain Security (NDS); Authentication Framework (AF)] document specified by the The 3rd Generation Partnership Project (3GPP).

                                                                                                                                                  Any cert that has been found as described above is cached and tried first when validating the signatures of subsequent messages in the same transaction.

                                                                                                                                                  OSSL_CMP_validate_cert_path() attempts to validate the given certificate and its path using the given store of trusted certs (possibly including CRLs and a cert verification callback) and non-trusted intermediate certs from the ctx.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/#notes","title":"NOTES","text":"

                                                                                                                                                  CMP is defined in RFC 4210 (and CRMF in RFC 4211).

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CMP_validate_msg() and OSSL_CMP_validate_cert_path() return 1 on success, 0 on error or validation failed.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_CMP_CTX_new(3), OSSL_CMP_exec_certreq(3), OSSL_CMP_CTX_set1_secretValue(3), OSSL_CMP_CTX_set1_srvCert(3), OSSL_CMP_CTX_set1_untrusted(3), OSSL_CMP_CTX_set0_trustedStore(3)

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CMP support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CMP_validate_msg/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CORE_MAKE_FUNC/","title":"OSSL_CORE_MAKE_FUNC","text":""},{"location":"man3/OSSL_CORE_MAKE_FUNC/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CORE_MAKE_FUNC, SSL_OP_BIT, EXT_UTF8STRING - OpenSSL reserved symbols

                                                                                                                                                  "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/core_dispatch.h>\n\n#define OSSL_CORE_MAKE_FUNC(type,name,args)\n#define SSL_OP_BIT(n)\n#define EXT_UTF8STRING(nid)\n
                                                                                                                                                  "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  There are certain macros that may appear in OpenSSL header files that are reserved for internal use. They should not be used by applications or assumed to exist.

                                                                                                                                                  All the macros listed in the synopsis above are reserved.

                                                                                                                                                  "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  Not applicable.

                                                                                                                                                  "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#history","title":"HISTORY","text":"

                                                                                                                                                  The macros described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CORE_MAKE_FUNC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/","title":"OSSL_CRMF_MSG_get0_tmpl","text":""},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CRMF_MSG_get0_tmpl, OSSL_CRMF_CERTTEMPLATE_get0_serialNumber, OSSL_CRMF_CERTTEMPLATE_get0_subject, OSSL_CRMF_CERTTEMPLATE_get0_issuer, OSSL_CRMF_CERTTEMPLATE_get0_extensions, OSSL_CRMF_CERTID_get0_serialNumber, OSSL_CRMF_CERTID_get0_issuer, OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert, OSSL_CRMF_MSG_get_certReqId - functions reading from CRMF CertReqMsg structures

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/crmf.h>\n\nOSSL_CRMF_CERTTEMPLATE *OSSL_CRMF_MSG_get0_tmpl(const OSSL_CRMF_MSG *crm);\nconst ASN1_INTEGER\n*OSSL_CRMF_CERTTEMPLATE_get0_serialNumber(const OSSL_CRMF_CERTTEMPLATE *tmpl);\nconst X509_NAME\n*OSSL_CRMF_CERTTEMPLATE_get0_subject(const OSSL_CRMF_CERTTEMPLATE *tmpl);\nconst X509_NAME\n*OSSL_CRMF_CERTTEMPLATE_get0_issuer(const OSSL_CRMF_CERTTEMPLATE *tmpl);\nX509_EXTENSIONS\n*OSSL_CRMF_CERTTEMPLATE_get0_extensions(const OSSL_CRMF_CERTTEMPLATE *tmpl);\n\nconst ASN1_INTEGER\n*OSSL_CRMF_CERTID_get0_serialNumber(const OSSL_CRMF_CERTID *cid);\nconst X509_NAME *OSSL_CRMF_CERTID_get0_issuer(const OSSL_CRMF_CERTID *cid);\n\nX509\n*OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert,\n                                       OSSL_LIB_CTX *libctx, const char *propq,\n                                       EVP_PKEY *pkey);\n\nint OSSL_CRMF_MSG_get_certReqId(const OSSL_CRMF_MSG *crm);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CRMF_MSG_get0_tmpl() retrieves the certificate template of crm.

                                                                                                                                                  OSSL_CRMF_CERTTEMPLATE_get0_serialNumber() retrieves the serialNumber of the given certificate template tmpl.

                                                                                                                                                  OSSL_CRMF_CERTTEMPLATE_get0_subject() retrieves the subject name of the given certificate template tmpl.

                                                                                                                                                  OSSL_CRMF_CERTTEMPLATE_get0_issuer() retrieves the issuer name of the given certificate template tmpl.

                                                                                                                                                  OSSL_CRMF_CERTTEMPLATE_get0_extensions() retrieves the X.509 extensions of the given certificate template tmpl, or NULL if not present.

                                                                                                                                                  OSSL_CRMF_CERTID_get0_serialNumber retrieves the serialNumber of the given CertId cid.

                                                                                                                                                  OSSL_CRMF_CERTID_get0_issuer retrieves the issuer name of the given CertId cid, which must be of ASN.1 type GEN_DIRNAME.

                                                                                                                                                  OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert() decrypts the certificate in the given encryptedValue ecert, using the private key pkey, library context libctx and property query string propq (see OSSL_LIB_CTX(3)). This is needed for the indirect POPO method as in RFC 4210 section 5.2.8.2. The function returns the decrypted certificate as a copy, leaving its ownership with the caller, who is responsible for freeing it.

                                                                                                                                                  OSSL_CRMF_MSG_get_certReqId() retrieves the certReqId of crm.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CRMF_MSG_get_certReqId() returns the certificate request ID as a nonnegative integer or -1 on error.

                                                                                                                                                  All other functions return a pointer with the intended result or NULL on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  RFC 4211

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CRMF support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_get0_tmpl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/","title":"OSSL_CRMF_MSG_set0_validity","text":""},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CRMF_MSG_set0_validity, OSSL_CRMF_MSG_set_certReqId, OSSL_CRMF_CERTTEMPLATE_fill, OSSL_CRMF_MSG_set0_extensions, OSSL_CRMF_MSG_push0_extension, OSSL_CRMF_MSG_create_popo, OSSL_CRMF_MSGS_verify_popo - functions populating and verifying CRMF CertReqMsg structures

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/crmf.h>\n\nint OSSL_CRMF_MSG_set0_validity(OSSL_CRMF_MSG *crm,\n                                ASN1_TIME *notBefore, ASN1_TIME *notAfter);\n\nint OSSL_CRMF_MSG_set_certReqId(OSSL_CRMF_MSG *crm, int rid);\n\nint OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_CERTTEMPLATE *tmpl,\n                                EVP_PKEY *pubkey,\n                                const X509_NAME *subject,\n                                const X509_NAME *issuer,\n                                const ASN1_INTEGER *serial);\n\nint OSSL_CRMF_MSG_set0_extensions(OSSL_CRMF_MSG *crm, X509_EXTENSIONS *exts);\n\nint OSSL_CRMF_MSG_push0_extension(OSSL_CRMF_MSG *crm, X509_EXTENSION *ext);\n\nint OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,\n                              EVP_PKEY *pkey, const EVP_MD *digest,\n                              OSSL_LIB_CTX *libctx, const char *propq);\n\nint OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs,\n                               int rid, int acceptRAVerified,\n                               OSSL_LIB_CTX *libctx, const char *propq);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CRMF_MSG_set0_validity() sets the notBefore and notAfter fields as validity constraints in the certTemplate of crm. Any of the notBefore and notAfter parameters may be NULL, which means no constraint for the respective field. On success ownership of notBefore and notAfter is transferred to crm.

                                                                                                                                                  OSSL_CRMF_MSG_set_certReqId() sets rid as the certReqId of crm.

                                                                                                                                                  OSSL_CRMF_CERTTEMPLATE_fill() sets those fields of the certTemplate tmpl for which non-NULL values are provided: pubkey, subject, issuer, and/or serial. X.509 extensions may be set using OSSL_CRMF_MSG_set0_extensions(). On success the reference counter of the pubkey (if given) is incremented, while the subject, issuer, and serial structures (if given) are copied.

                                                                                                                                                  OSSL_CRMF_MSG_set0_extensions() sets exts as the extensions in the certTemplate of crm. Frees any pre-existing ones and consumes exts.

                                                                                                                                                  OSSL_CRMF_MSG_push0_extension() pushes the X509 extension ext to the extensions in the certTemplate of crm. Consumes ext.

                                                                                                                                                  OSSL_CRMF_MSG_create_popo() creates and sets the Proof-of-Possession (POPO) according to the method meth in crm. The library context libctx and property query string propq, may be NULL to select the defaults. In case the method is OSSL_CRMF_POPO_SIGNATURE the POPO is calculated using the private key pkey and the digest method digest, where the digest argument is ignored if pkey is of a type (such as Ed25519 and Ed448) that is implicitly associated with a digest algorithm.

                                                                                                                                                  meth can be one of the following:

                                                                                                                                                  • OSSL_CRMF_POPO_NONE - RFC 4211, section 4, POP field omitted. CA/RA uses out-of-band method to verify POP. Note that servers may fail in this case, resulting for instance in HTTP error code 500 (Internal error).
                                                                                                                                                  • OSSL_CRMF_POPO_RAVERIFIED - RFC 4211, section 4, explicit indication that the RA has already verified the POP.
                                                                                                                                                  • OSSL_CRMF_POPO_SIGNATURE - RFC 4211, section 4.1, only case 3 supported so far.
                                                                                                                                                  • OSSL_CRMF_POPO_KEYENC - RFC 4211, section 4.2, only indirect method (subsequentMessage/enccert) supported, challenge-response exchange (challengeResp) not yet supported.
                                                                                                                                                  • OSSL_CRMF_POPO_KEYAGREE - RFC 4211, section 4.3, not yet supported.

                                                                                                                                                  OSSL_CRMF_MSGS_verify_popo verifies the Proof-of-Possession of the request with the given rid in the list of reqs. Optionally accepts RAVerified. It can make use of the library context libctx and property query string propq.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  All functions return 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  RFC 4211

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CRMF support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set0_validity/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/","title":"OSSL_CRMF_MSG_set1_regCtrl_regToken","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CRMF_MSG_get0_regCtrl_regToken, OSSL_CRMF_MSG_set1_regCtrl_regToken, OSSL_CRMF_MSG_get0_regCtrl_authenticator, OSSL_CRMF_MSG_set1_regCtrl_authenticator, OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo, OSSL_CRMF_MSG_set0_SinglePubInfo, OSSL_CRMF_MSG_set_PKIPublicationInfo_action, OSSL_CRMF_MSG_get0_regCtrl_pkiPublicationInfo, OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo, OSSL_CRMF_MSG_get0_regCtrl_protocolEncrKey, OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey, OSSL_CRMF_MSG_get0_regCtrl_oldCertID, OSSL_CRMF_MSG_set1_regCtrl_oldCertID, OSSL_CRMF_CERTID_gen - functions getting or setting CRMF Registration Controls

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/crmf.h>\n\nASN1_UTF8STRING\n   *OSSL_CRMF_MSG_get0_regCtrl_regToken(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_regToken(OSSL_CRMF_MSG *msg,\n                                        const ASN1_UTF8STRING *tok);\nASN1_UTF8STRING\n   *OSSL_CRMF_MSG_get0_regCtrl_authenticator(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_authenticator(OSSL_CRMF_MSG *msg,\n                                             const ASN1_UTF8STRING *auth);\nint OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo(\n                                 OSSL_CRMF_PKIPUBLICATIONINFO *pi,\n                                 OSSL_CRMF_SINGLEPUBINFO *spi);\nint OSSL_CRMF_MSG_set0_SinglePubInfo(OSSL_CRMF_SINGLEPUBINFO *spi,\n                                     int method, GENERAL_NAME *nm);\nint OSSL_CRMF_MSG_set_PKIPublicationInfo_action(\n                                 OSSL_CRMF_PKIPUBLICATIONINFO *pi, int action);\nOSSL_CRMF_PKIPUBLICATIONINFO\n   *OSSL_CRMF_MSG_get0_regCtrl_pkiPublicationInfo(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo(OSSL_CRMF_MSG *msg,\n                                       const OSSL_CRMF_PKIPUBLICATIONINFO *pi);\nX509_PUBKEY\n   *OSSL_CRMF_MSG_get0_regCtrl_protocolEncrKey(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey(OSSL_CRMF_MSG *msg,\n                                               const X509_PUBKEY *pubkey);\nOSSL_CRMF_CERTID\n   *OSSL_CRMF_MSG_get0_regCtrl_oldCertID(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regCtrl_oldCertID(OSSL_CRMF_MSG *msg,\n                                         const OSSL_CRMF_CERTID *cid);\nOSSL_CRMF_CERTID *OSSL_CRMF_CERTID_gen(const X509_NAME *issuer,\n                                       const ASN1_INTEGER *serial);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  Each of the OSSL_CRMF_MSG_get0_regCtrl_X() functions returns the respective control X in the given msg, if present.

                                                                                                                                                  OSSL_CRMF_MSG_set1_regCtrl_regToken() sets the regToken control in the given msg copying the given tok as value. See RFC 4211, section 6.1.

                                                                                                                                                  OSSL_CRMF_MSG_set1_regCtrl_authenticator() sets the authenticator control in the given msg copying the given auth as value. See RFC 4211, section 6.2.

                                                                                                                                                  OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo() pushes the given spi to si. Consumes the spi pointer.

                                                                                                                                                  OSSL_CRMF_MSG_set0_SinglePubInfo() sets in the given SinglePubInfo spi the method and publication location, in the form of a GeneralName, nm. The publication location is optional, and therefore nm may be NULL. The function consumes the nm pointer if present. Available methods are:

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_dontcare-0","title":"# define OSSL_CRMF_PUB_METHOD_DONTCARE 0","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_x500-1","title":"# define OSSL_CRMF_PUB_METHOD_X500 1","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_web-2","title":"# define OSSL_CRMF_PUB_METHOD_WEB 2","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_method_ldap-3","title":"# define OSSL_CRMF_PUB_METHOD_LDAP 3","text":"

                                                                                                                                                  OSSL_CRMF_MSG_set_PKIPublicationInfo_action() sets the action in the given pi using the given action as value. See RFC 4211, section 6.3. Available actions are:

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_action_dontpublish-0","title":"# define OSSL_CRMF_PUB_ACTION_DONTPUBLISH 0","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#define-ossl_crmf_pub_action_pleasepublish-1","title":"# define OSSL_CRMF_PUB_ACTION_PLEASEPUBLISH 1","text":"

                                                                                                                                                  OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo() sets the pkiPublicationInfo control in the given msg copying the given tok as value. See RFC 4211, section 6.3.

                                                                                                                                                  OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey() sets the protocolEncrKey control in the given msg copying the given pubkey as value. See RFC 4211 section 6.6.

                                                                                                                                                  OSSL_CRMF_MSG_set1_regCtrl_oldCertID() sets the oldCertID regToken control in the given msg copying the given cid as value. See RFC 4211, section 6.5.

                                                                                                                                                  OSSL_CRMF_CERTID_gen produces an OSSL_CRMF_CERTID_gen structure copying the given issuer name and serial number.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  All OSSL_CRMF_MSG_get0_*() functions return the respective pointer value or NULL if not present and on error.

                                                                                                                                                  All OSSL_CRMF_MSG_set1_*() functions return 1 on success, 0 on error.

                                                                                                                                                  OSSL_CRMF_CERTID_gen() returns a pointer to the resulting structure or NULL on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#notes","title":"NOTES","text":"

                                                                                                                                                  A function OSSL_CRMF_MSG_set1_regCtrl_pkiArchiveOptions() for setting an Archive Options Control is not yet implemented due to missing features to create the needed OSSL_CRMF_PKIARCHIVEOPTINS content.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  RFC 4211

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CRMF support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/","title":"OSSL_CRMF_MSG_set1_regInfo_certReq","text":""},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CRMF_MSG_get0_regInfo_utf8Pairs, OSSL_CRMF_MSG_set1_regInfo_utf8Pairs, OSSL_CRMF_MSG_get0_regInfo_certReq, OSSL_CRMF_MSG_set1_regInfo_certReq - functions getting or setting CRMF Registration Info

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/crmf.h>\n\nASN1_UTF8STRING\n    *OSSL_CRMF_MSG_get0_regInfo_utf8Pairs(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regInfo_utf8Pairs(OSSL_CRMF_MSG *msg,\n                                         const ASN1_UTF8STRING *utf8pairs);\nOSSL_CRMF_CERTREQUEST\n    *OSSL_CRMF_MSG_get0_regInfo_certReq(const OSSL_CRMF_MSG *msg);\nint OSSL_CRMF_MSG_set1_regInfo_certReq(OSSL_CRMF_MSG *msg,\n                                       const OSSL_CRMF_CERTREQUEST *cr);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CRMF_MSG_get0_regInfo_utf8Pairs() returns the first utf8Pairs regInfo in the given msg, if present.

                                                                                                                                                  OSSL_CRMF_MSG_set1_regInfo_utf8Pairs() adds a copy of the given utf8pairs value as utf8Pairs regInfo to the given msg. See RFC 4211 section 7.1.

                                                                                                                                                  OSSL_CRMF_MSG_get0_regInfo_certReq() returns the first certReq regInfo in the given msg, if present.

                                                                                                                                                  OSSL_CRMF_MSG_set1_regInfo_certReq() adds a copy of the given cr value as certReq regInfo to the given msg. See RFC 4211 section 7.2.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  All get0_*() functions return the respective pointer value, NULL if not present.

                                                                                                                                                  All set1_*() functions return 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#notes","title":"NOTES","text":"

                                                                                                                                                  Calling the set1_*() functions multiple times adds multiple instances of the respective control to the regInfo structure of the given msg. While RFC 4211 expects multiple utf8Pairs in one regInfo structure, it does not allow multiple certReq.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  RFC 4211

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CRMF support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_MSG_set1_regInfo_certReq/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/","title":"OSSL_CRMF_pbmp_new","text":""},{"location":"man3/OSSL_CRMF_pbmp_new/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_CRMF_pbm_new, OSSL_CRMF_pbmp_new - functions for producing Password-Based MAC (PBM)

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/crmf.h>\n\nint OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,\n                      const OSSL_CRMF_PBMPARAMETER *pbmp,\n                      const unsigned char *msg, size_t msglen,\n                      const unsigned char *sec, size_t seclen,\n                      unsigned char **mac, size_t *maclen);\n\nOSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OSSL_LIB_CTX *libctx, size_t saltlen,\n                                           int owfnid, size_t itercnt,\n                                           int macnid);\n
                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_CRMF_pbm_new() generates a PBM (Password-Based MAC) based on given PBM parameters pbmp, message msg, and secret sec, along with the respective lengths msglen and seclen. The optional library context libctx and propq parameters may be used to influence the selection of the MAC algorithm referenced in the pbmp; see \"ALGORITHM FETCHING\" in crypto(7) for further information. On success writes the address of the newly allocated MAC via the mac reference parameter and writes the length via the maclen reference parameter unless it its NULL.

                                                                                                                                                  OSSL_CRMF_pbmp_new() initializes and returns a new PBMParameter structure with a new random salt of given length saltlen, OWF (one-way function) NID owfnid, OWF iteration count itercnt, and MAC NID macnid. The library context libctx parameter may be used to select the provider for the random number generation (DRBG) and may be NULL for the default.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#notes","title":"NOTES","text":"

                                                                                                                                                  The algorithms for the OWF (one-way function) and for the MAC (message authentication code) may be any with a NID defined in <openssl/objects.h>. As specified by RFC 4210, these should include NID_hmac_sha1.

                                                                                                                                                  RFC 4210 recommends that the salt SHOULD be at least 8 bytes (64 bits) long, where 16 bytes is common.

                                                                                                                                                  The iteration count must be at least 100, as stipulated by RFC 4211, and is limited to at most 100000 to avoid DoS through manipulated or otherwise malformed input.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_CRMF_pbm_new() returns 1 on success, 0 on error.

                                                                                                                                                  OSSL_CRMF_pbmp_new() returns a new and initialized OSSL_CRMF_PBMPARAMETER structure, or NULL on error.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#examples","title":"EXAMPLES","text":"
                                                                                                                                                  OSSL_CRMF_PBMPARAMETER *pbm = NULL;\nunsigned char *msg = \"Hello\";\nunsigned char *sec = \"SeCrEt\";\nunsigned char *mac = NULL;\nsize_t maclen;\n\nif ((pbm = OSSL_CRMF_pbmp_new(16, NID_sha256, 500, NID_hmac_sha1) == NULL))\n    goto err;\nif (!OSSL_CRMF_pbm_new(pbm, msg, 5, sec, 6, &mac, &maclen))\n    goto err;\n
                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  RFC 4211 section 4.4

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#history","title":"HISTORY","text":"

                                                                                                                                                  The OpenSSL CRMF support was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_CRMF_pbmp_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/","title":"OSSL_DECODER","text":""},{"location":"man3/OSSL_DECODER/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_DECODER, OSSL_DECODER_fetch, OSSL_DECODER_up_ref, OSSL_DECODER_free, OSSL_DECODER_get0_provider, OSSL_DECODER_get0_properties, OSSL_DECODER_is_a, OSSL_DECODER_get0_name, OSSL_DECODER_get0_description, OSSL_DECODER_do_all_provided, OSSL_DECODER_names_do_all, OSSL_DECODER_gettable_params, OSSL_DECODER_get_params - Decoder method routines

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/decoder.h>\n\ntypedef struct ossl_decoder_st OSSL_DECODER;\n\nOSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *ctx, const char *name,\n                                 const char *properties);\nint OSSL_DECODER_up_ref(OSSL_DECODER *decoder);\nvoid OSSL_DECODER_free(OSSL_DECODER *decoder);\nconst OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *decoder);\nconst char *OSSL_DECODER_get0_properties(const OSSL_DECODER *decoder);\nint OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name);\nconst char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder);\nconst char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder);\nvoid OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                  void (*fn)(OSSL_DECODER *decoder, void *arg),\n                                  void *arg);\nint OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,\n                              void (*fn)(const char *name, void *data),\n                              void *data);\nconst OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);\nint OSSL_DECODER_get_params(OSSL_DECODER_CTX *ctx, const OSSL_PARAM params[]);\n
                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_DECODER is a method for decoders, which know how to decode encoded data into an object of some type that the rest of OpenSSL knows how to handle.

                                                                                                                                                  OSSL_DECODER_fetch() looks for an algorithm within the provider that has been loaded into the OSSL_LIB_CTX given by ctx, having the name given by name and the properties given by properties. The name determines what type of object the fetched decoder method is expected to be able to decode, and the properties are used to determine the expected output type. For known properties and the values they may have, please have a look in \"Names and properties\" in provider-encoder(7).

                                                                                                                                                  OSSL_DECODER_up_ref() increments the reference count for the given decoder.

                                                                                                                                                  OSSL_DECODER_free() decrements the reference count for the given decoder, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_DECODER_get0_provider() returns the provider of the given decoder.

                                                                                                                                                  OSSL_DECODER_get0_properties() returns the property definition associated with the given decoder.

                                                                                                                                                  OSSL_DECODER_is_a() checks if decoder is an implementation of an algorithm that's identifiable with name.

                                                                                                                                                  OSSL_DECODER_get0_name() returns the name used to fetch the given decoder.

                                                                                                                                                  OSSL_DECODER_get0_description() returns a description of the decoder, meant for display and human consumption. The description is at the discretion of the decoder implementation.

                                                                                                                                                  OSSL_DECODER_names_do_all() traverses all names for the given decoder, and calls fn with each name and data as arguments.

                                                                                                                                                  OSSL_DECODER_do_all_provided() traverses all decoder implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and arg as arguments.

                                                                                                                                                  OSSL_DECODER_gettable_params() returns an OSSL_PARAM(3) array of parameter descriptors.

                                                                                                                                                  OSSL_DECODER_get_params() attempts to get parameters specified with an OSSL_PARAM(3) array params. Parameters that the implementation doesn't recognise should be ignored.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_DECODER_fetch() returns a pointer to an OSSL_DECODER object, or NULL on error.

                                                                                                                                                  OSSL_DECODER_up_ref() returns 1 on success, or 0 on error.

                                                                                                                                                  OSSL_DECODER_free() doesn't return any value.

                                                                                                                                                  OSSL_DECODER_get0_provider() returns a pointer to a provider object, or NULL on error.

                                                                                                                                                  OSSL_DECODER_get0_properties() returns a pointer to a property definition string, or NULL on error.

                                                                                                                                                  OSSL_DECODER_is_a() returns 1 if decoder was identifiable, otherwise 0.

                                                                                                                                                  OSSL_DECODER_get0_name() returns the algorithm name from the provided implementation for the given decoder. Note that the decoder may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the decoder object and should not be freed by the caller.

                                                                                                                                                  OSSL_DECODER_get0_description() returns a pointer to a description, or NULL if there isn't one.

                                                                                                                                                  OSSL_DECODER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#notes","title":"NOTES","text":"

                                                                                                                                                  OSSL_DECODER_fetch() may be called implicitly by other fetching functions, using the same library context and properties. Any other API that uses keys will typically do this.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  To list all decoders in a provider to a bio_out:

                                                                                                                                                  static void collect_decoders(OSSL_DECODER *decoder, void *stack)\n{\n    STACK_OF(OSSL_DECODER) *decoder_stack = stack;\n\n    sk_OSSL_DECODER_push(decoder_stack, decoder);\n    OSSL_DECODER_up_ref(decoder);\n}\n\nvoid print_name(const char *name, void *vdata)\n{\n    BIO *bio = vdata;\n\n    BIO_printf(bio, \"%s \", name);\n}\n\n\nSTACK_OF(OSSL_DECODER) *decoders;\nint i;\n\ndecoders = sk_OSSL_DECODER_new_null();\n\nBIO_printf(bio_out, \"DECODERs provided by %s:\\n\", provider);\nOSSL_DECODER_do_all_provided(NULL, collect_decoders,\n                             decoders);\n\nfor (i = 0; i < sk_OSSL_DECODER_num(decoders); i++) {\n    OSSL_DECODER *decoder = sk_OSSL_DECODER_value(decoders, i);\n\n    if (strcmp(OSSL_PROVIDER_get0_name(OSSL_DECODER_get0_provider(decoder)),\n               provider) != 0)\n        continue;\n\n    if (OSSL_DECODER_names_do_all(decoder, print_name, bio_out))\n           BIO_printf(bio_out, \"\\n\");\n}\nsk_OSSL_DECODER_pop_free(decoders, OSSL_DECODER_free);\n
                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_DECODER_CTX(3), OSSL_DECODER_from_bio(3), OSSL_DECODER_CTX_new_for_pkey(3), OSSL_LIB_CTX(3)

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/","title":"OSSL_DECODER_CTX","text":""},{"location":"man3/OSSL_DECODER_CTX/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_DECODER_CTX, OSSL_DECODER_CTX_new, OSSL_DECODER_settable_ctx_params, OSSL_DECODER_CTX_set_params, OSSL_DECODER_CTX_free, OSSL_DECODER_CTX_set_selection, OSSL_DECODER_CTX_set_input_type, OSSL_DECODER_CTX_set_input_structure, OSSL_DECODER_CTX_add_decoder, OSSL_DECODER_CTX_add_extra, OSSL_DECODER_CTX_get_num_decoders, OSSL_DECODER_INSTANCE, OSSL_DECODER_CONSTRUCT, OSSL_DECODER_CLEANUP, OSSL_DECODER_CTX_set_construct, OSSL_DECODER_CTX_set_construct_data, OSSL_DECODER_CTX_set_cleanup, OSSL_DECODER_CTX_get_construct, OSSL_DECODER_CTX_get_construct_data, OSSL_DECODER_CTX_get_cleanup, OSSL_DECODER_export, OSSL_DECODER_INSTANCE_get_decoder, OSSL_DECODER_INSTANCE_get_decoder_ctx, OSSL_DECODER_INSTANCE_get_input_type, OSSL_DECODER_INSTANCE_get_input_structure - Decoder context routines

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/decoder.h>\n\ntypedef struct ossl_decoder_ctx_st OSSL_DECODER_CTX;\n\nOSSL_DECODER_CTX *OSSL_DECODER_CTX_new(void);\nconst OSSL_PARAM *OSSL_DECODER_settable_ctx_params(OSSL_DECODER *decoder);\nint OSSL_DECODER_CTX_set_params(OSSL_DECODER_CTX *ctx,\n                                const OSSL_PARAM params[]);\nvoid OSSL_DECODER_CTX_free(OSSL_DECODER_CTX *ctx);\n\nint OSSL_DECODER_CTX_set_selection(OSSL_DECODER_CTX *ctx, int selection);\nint OSSL_DECODER_CTX_set_input_type(OSSL_DECODER_CTX *ctx,\n                                    const char *input_type);\nint OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx,\n                                         const char *input_structure);\nint OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder);\nint OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx, \n                               OSSL_LIB_CTX *libctx, \n                               const char *propq);\nint OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx);\n\ntypedef struct ossl_decoder_instance_st OSSL_DECODER_INSTANCE;\nOSSL_DECODER *\nOSSL_DECODER_INSTANCE_get_decoder(OSSL_DECODER_INSTANCE *decoder_inst);\nvoid *\nOSSL_DECODER_INSTANCE_get_decoder_ctx(OSSL_DECODER_INSTANCE *decoder_inst);\nconst char *\nOSSL_DECODER_INSTANCE_get_input_type(OSSL_DECODER_INSTANCE *decoder_inst);\nOSSL_DECODER_INSTANCE_get_input_structure(OSSL_DECODER_INSTANCE *decoder_inst,\n                                          int *was_set);\n\ntypedef int OSSL_DECODER_CONSTRUCT(OSSL_DECODER_INSTANCE *decoder_inst,\n                                   const OSSL_PARAM *object,\n                                   void *construct_data);\ntypedef void OSSL_DECODER_CLEANUP(void *construct_data);\n\nint OSSL_DECODER_CTX_set_construct(OSSL_DECODER_CTX *ctx,\n                                   OSSL_DECODER_CONSTRUCT *construct);\nint OSSL_DECODER_CTX_set_construct_data(OSSL_DECODER_CTX *ctx,\n                                        void *construct_data);\nint OSSL_DECODER_CTX_set_cleanup(OSSL_DECODER_CTX *ctx,\n                                 OSSL_DECODER_CLEANUP *cleanup);\nOSSL_DECODER_CONSTRUCT *OSSL_DECODER_CTX_get_construct(OSSL_DECODER_CTX *ctx);\nvoid *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx);\nOSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx);\n\nint OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst,\n                        void *reference, size_t reference_sz,\n                        OSSL_CALLBACK *export_cb, void *export_cbarg);\n
                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  The OSSL_DECODER_CTX holds data about multiple decoders, as needed to figure out what the input data is and to attempt to unpack it into one of several possible related results. This also includes chaining decoders, so the output from one can become the input for another. This allows having generic format decoders such as PEM to DER, as well as more specialized decoders like DER to RSA.

                                                                                                                                                  The chains may be limited by specifying an input type, which is considered a starting point. This is both considered by OSSL_DECODER_CTX_add_extra(), which will stop adding one more decoder implementations when it has already added those that take the specified input type, and functions like OSSL_DECODER_from_bio(3), which will only start the decoding process with the decoder implementations that take that input type. For example, if the input type is set to DER, a PEM to DER decoder will be ignored.

                                                                                                                                                  The input type can also be NULL, which means that the caller doesn't know what type of input they have. In this case, OSSL_DECODER_from_bio() will simply try with one decoder implementation after the other, and thereby discover what kind of input the caller gave it.

                                                                                                                                                  For every decoding done, even an intermediary one, a constructor provided by the caller is called to attempt to construct an appropriate type / structure that the caller knows how to handle from the current decoding result. The constructor is set with OSSL_DECODER_CTX_set_construct().

                                                                                                                                                  OSSL_DECODER_INSTANCE is an opaque structure that contains data about the decoder that was just used, and that may be useful for the constructor. There are some functions to extract data from this type, described further down.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#functions","title":"Functions","text":"

                                                                                                                                                  OSSL_DECODER_CTX_new() creates a new empty OSSL_DECODER_CTX.

                                                                                                                                                  OSSL_DECODER_settable_ctx_params() returns an OSSL_PARAM(3) array of parameter descriptors.

                                                                                                                                                  OSSL_DECODER_CTX_set_params() attempts to set parameters specified with an OSSL_PARAM(3) array params. These parameters are passed to all decoders that have been added to the ctx so far. Parameters that an implementation doesn't recognise should be ignored by it.

                                                                                                                                                  OSSL_DECODER_CTX_free() frees the given context ctx. If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_DECODER_CTX_add_decoder() populates the OSSL_DECODER_CTX ctx with a decoder, to be used to attempt to decode some encoded input.

                                                                                                                                                  OSSL_DECODER_CTX_add_extra() finds decoders that generate input for already added decoders, and adds them as well. This is used to build decoder chains.

                                                                                                                                                  OSSL_DECODER_CTX_set_input_type() sets the starting input type. This limits the decoder chains to be considered, as explained in the general description above.

                                                                                                                                                  OSSL_DECODER_CTX_set_input_structure() sets the name of the structure that the input is expected to have. This may be used to determines what decoder implementations may be used. NULL is a valid input structure, when it's not relevant, or when the decoder implementations are expected to figure it out.

                                                                                                                                                  OSSL_DECODER_CTX_get_num_decoders() gets the number of decoders currently added to the context ctx.

                                                                                                                                                  OSSL_DECODER_CTX_set_construct() sets the constructor construct.

                                                                                                                                                  OSSL_DECODER_CTX_set_construct_data() sets the constructor data that is passed to the constructor every time it's called.

                                                                                                                                                  OSSL_DECODER_CTX_set_cleanup() sets the constructor data cleanup function. This is called by OSSL_DECODER_CTX_free(3).

                                                                                                                                                  OSSL_DECODER_CTX_get_construct(), OSSL_DECODER_CTX_get_construct_data() and OSSL_DECODER_CTX_get_cleanup() return the values that have been set by OSSL_DECODER_CTX_set_construct(), OSSL_DECODER_CTX_set_construct_data() and OSSL_DECODER_CTX_set_cleanup() respectively.

                                                                                                                                                  OSSL_DECODER_export() is a fallback function for constructors that cannot use the data they get directly for diverse reasons. It takes the same decode instance decoder_inst that the constructor got and an object reference, unpacks the object which it refers to, and exports it by creating an OSSL_PARAM(3) array that it then passes to export_cb, along with export_arg.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#constructor","title":"Constructor","text":"

                                                                                                                                                  A OSSL_DECODER_CONSTRUCT gets the following arguments:

                                                                                                                                                  • decoder_inst

                                                                                                                                                    The OSSL_DECODER_INSTANCE for the decoder from which the constructor gets its data.

                                                                                                                                                  • object

                                                                                                                                                    A provider-native object abstraction produced by the decoder. Further information on the provider-native object abstraction can be found in provider-object(7).

                                                                                                                                                  • construct_data

                                                                                                                                                    The pointer that was set with OSSL_DECODE_CTX_set_construct_data().

                                                                                                                                                  The constructor is expected to return 1 when the data it receives can be constructed, otherwise 0.

                                                                                                                                                  These utility functions may be used by a constructor:

                                                                                                                                                  OSSL_DECODER_INSTANCE_get_decoder() can be used to get the decoder implementation from a decoder instance decoder_inst.

                                                                                                                                                  OSSL_DECODER_INSTANCE_get_decoder_ctx() can be used to get the decoder implementation's provider context from a decoder instance decoder_inst.

                                                                                                                                                  OSSL_DECODER_INSTANCE_get_input_type() can be used to get the decoder implementation's input type from a decoder instance decoder_inst.

                                                                                                                                                  OSSL_DECODER_INSTANCE_get_input_structure() can be used to get the input structure for the decoder implementation from a decoder instance decoder_inst. This may be NULL.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_DECODER_CTX_new() returns a pointer to a OSSL_DECODER_CTX, or NULL if the context structure couldn't be allocated.

                                                                                                                                                  OSSL_DECODER_settable_ctx_params() returns an OSSL_PARAM(3) array, or NULL if none is available.

                                                                                                                                                  OSSL_DECODER_CTX_set_params() returns 1 if all recognised parameters were valid, or 0 if one of them was invalid or caused some other failure in the implementation.

                                                                                                                                                  OSSL_DECODER_CTX_add_decoder(), OSSL_DECODER_CTX_add_extra(), OSSL_DECODER_CTX_set_construct(), OSSL_DECODER_CTX_set_construct_data() and OSSL_DECODER_CTX_set_cleanup() return 1 on success, or 0 on failure.

                                                                                                                                                  OSSL_DECODER_CTX_get_construct(), OSSL_DECODER_CTX_get_construct_data() and OSSL_DECODER_CTX_get_cleanup() return the current pointers to the constructor, the constructor data and the cleanup functions, respectively.

                                                                                                                                                  OSSL_DECODER_CTX_num_decoders() returns the current number of decoders. It returns 0 if ctx is NULL.

                                                                                                                                                  OSSL_DECODER_export() returns 1 on success, or 0 on failure.

                                                                                                                                                  OSSL_DECODER_INSTANCE_decoder() returns an OSSL_DECODER pointer on success, or NULL on failure.

                                                                                                                                                  OSSL_DECODER_INSTANCE_decoder_ctx() returns a provider context pointer on success, or NULL on failure.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_DECODER(3), OSSL_DECODER_from_bio(3)

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/","title":"OSSL_DECODER_CTX_new_for_pkey","text":""},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_DECODER_CTX_new_for_pkey, OSSL_DECODER_CTX_set_passphrase, OSSL_DECODER_CTX_set_pem_password_cb, OSSL_DECODER_CTX_set_passphrase_ui, OSSL_DECODER_CTX_set_passphrase_cb - Decoder routines to decode EVP_PKEYs

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/decoder.h>\n\nOSSL_DECODER_CTX *\nOSSL_DECODER_CTX_new_for_pkey(EVP_PKEY **pkey,\n                              const char *input_type,\n                              const char *input_struct,\n                              const char *keytype, int selection,\n                              OSSL_LIB_CTX *libctx, const char *propquery);\n\nint OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx,\n                                    const unsigned char *kstr,\n                                    size_t klen);\nint OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx,\n                                         pem_password_cb *cb,\n                                         void *cbarg);\nint OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx,\n                                       const UI_METHOD *ui_method,\n                                       void *ui_data);\nint OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,\n                                       OSSL_PASSPHRASE_CALLBACK *cb,\n                                       void *cbarg);\n
                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_DECODER_CTX_new_for_pkey() is a utility function that creates a OSSL_DECODER_CTX, finds all applicable decoder implementations and sets them up, so all the caller has to do next is call functions like OSSL_DECODER_from_bio(3). The caller may use the optional input_type, input_struct, keytype and selection to specify what the input is expected to contain. The pkey must reference an EVP_PKEY * variable that will be set to the newly created EVP_PKEY on successful decoding. The referenced variable must be initialized to NULL before calling the function.

                                                                                                                                                  Internally OSSL_DECODER_CTX_new_for_pkey() searches for all available EVP_KEYMGMT(3) implementations, and then builds a list of all potential decoder implementations that may be able to process the encoded input into data suitable for EVP_PKEYs. All these implementations are implicitly fetched using libctx and propquery.

                                                                                                                                                  The search of decoder implementations can be limited with input_type and input_struct which specifies a starting input type and input structure. NULL is valid for both of them and signifies that the decoder implementations will find out the input type on their own. They are set with OSSL_DECODER_CTX_set_input_type(3) and OSSL_DECODER_CTX_set_input_structure(3). See \"Input Types\" and \"Input Structures\" below for further information.

                                                                                                                                                  The search of decoder implementations can also be limited with keytype and selection, which specifies the expected resulting keytype and contents. NULL and zero are valid and signify that the decoder implementations will find out the keytype and key contents on their own from the input they get.

                                                                                                                                                  If no suitable decoder implementation is found, OSSL_DECODER_CTX_new_for_pkey() still creates a OSSL_DECODER_CTX, but with no associated decoder (OSSL_DECODER_CTX_get_num_decoders(3) returns zero). This helps the caller to distinguish between an error when creating the OSSL_ENCODER_CTX and missing encoder implementation, and allows it to act accordingly.

                                                                                                                                                  OSSL_DECODER_CTX_set_passphrase() gives the implementation a pass phrase to use when decrypting the encoded private key. Alternatively, a pass phrase callback may be specified with the following functions.

                                                                                                                                                  OSSL_DECODER_CTX_set_pem_password_cb(), OSSL_DECODER_CTX_set_passphrase_ui() and OSSL_DECODER_CTX_set_passphrase_cb() set up a callback method that the implementation can use to prompt for a pass phrase, giving the caller the choice of preferred pass phrase callback form. These are called indirectly, through an internal OSSL_PASSPHRASE_CALLBACK(3) function.

                                                                                                                                                  The internal OSSL_PASSPHRASE_CALLBACK(3) function caches the pass phrase, to be re-used in all decodings that are performed in the same decoding run (for example, within one OSSL_DECODER_from_bio(3) call).

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#input-types","title":"Input Types","text":"

                                                                                                                                                  Available input types depend on the implementations that available providers offer, and provider documentation should have the details.

                                                                                                                                                  Among the known input types that OpenSSL decoder implementations offer for EVP_PKEYs are DER, PEM, MSBLOB and PVK. See openssl-glossary(7) for further information on what these input types mean.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#input-structures","title":"Input Structures","text":"

                                                                                                                                                  Available input structures depend on the implementations that available providers offer, and provider documentation should have the details.

                                                                                                                                                  Among the known input structures that OpenSSL decoder implementations offer for EVP_PKEYs are pkcs8 and SubjectPublicKeyInfo.

                                                                                                                                                  OpenSSL decoder implementations also support the input structure type-specific. This is the structure used for keys encoded according to key type specific specifications. For example, RSA keys encoded according to PKCS#1.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#selections","title":"Selections","text":"

                                                                                                                                                  selection can be any one of the values described in \"Selections\" in EVP_PKEY_fromdata(3). Additionally selection can also be set to 0 to indicate that the code will auto detect the selection.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_DECODER_CTX_new_for_pkey() returns a pointer to a OSSL_DECODER_CTX, or NULL if it couldn't be created.

                                                                                                                                                  OSSL_DECODER_CTX_set_passphrase(), OSSL_DECODER_CTX_set_pem_password_cb(), OSSL_DECODER_CTX_set_passphrase_ui() and OSSL_DECODER_CTX_set_passphrase_cb() all return 1 on success, or 0 on failure.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_DECODER(3), OSSL_DECODER_CTX(3)

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_CTX_new_for_pkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/","title":"OSSL_DECODER_from_bio","text":""},{"location":"man3/OSSL_DECODER_from_bio/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_DECODER_from_data, OSSL_DECODER_from_bio, OSSL_DECODER_from_fp - Routines to perform a decoding

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/decoder.h>\n\nint OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in);\nint OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *fp);\nint OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata,\n                           size_t *pdata_len);\n

                                                                                                                                                  Feature availability macros:

                                                                                                                                                  • OSSL_DECODER_from_fp() is only available when OPENSSL_NO_STDIO is undefined.
                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_DECODER_from_data() runs the decoding process for the context ctx, with input coming from *pdata, *pdata_len bytes long. Both *pdata and *pdata_len must be non-NULL. When OSSL_DECODER_from_data() returns, *pdata is updated to point at the location after what has been decoded, and *pdata_len to have the number of remaining bytes.

                                                                                                                                                  OSSL_DECODER_from_bio() runs the decoding process for the context ctx, with the input coming from the BIO in. Should it make a difference, it's recommended to have the BIO set in binary mode rather than text mode.

                                                                                                                                                  OSSL_DECODER_from_fp() does the same thing as OSSL_DECODER_from_bio(), except that the input is coming from the FILE fp.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_DECODER_from_bio(), OSSL_DECODER_from_data() and OSSL_DECODER_from_fp() return 1 on success, or 0 on failure.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  To decode an RSA key encoded with PEM from a bio:

                                                                                                                                                  OSSL_DECODER_CTX *dctx;\nEVP_PKEY *pkey = NULL;\nconst char *format = \"PEM\";   /* NULL for any format */\nconst char *structure = NULL; /* any structure */\nconst char *keytype = \"RSA\";  /* NULL for any key */\nconst unsigned char *pass = \"my password\";\n\ndctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, format, structure,\n                                     keytype,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR,\n                                     NULL, NULL);\nif (dctx == NULL) {\n    /* error: no suitable potential decoders found */\n}\nif (pass != NULL)\n    OSSL_DECODER_CTX_set_passphrase(dctx, pass, strlen(pass));\nif (OSSL_DECODER_from_bio(dctx, bio)) {\n    /* pkey is created with the decoded data from the bio */\n} else {\n    /* decoding failure */\n}\nOSSL_DECODER_CTX_free(dctx);\n

                                                                                                                                                  To decode an EC key encoded with DER from a buffer:

                                                                                                                                                  OSSL_DECODER_CTX *dctx;\nEVP_PKEY *pkey = NULL;\nconst char *format = \"DER\";   /* NULL for any format */\nconst char *structure = NULL; /* any structure */\nconst char *keytype = \"EC\";   /* NULL for any key */\nconst unsigned char *pass = NULL\nconst unsigned char *data = buffer;\nsize_t datalen = sizeof(buffer);\n\ndctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, format, structure,\n                                     keytype,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR\n                                     | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                                     NULL, NULL);\nif (dctx == NULL) {\n    /* error: no suitable potential decoders found */\n}\nif (pass != NULL)\n    OSSL_DECODER_CTX_set_passphrase(dctx, pass, strlen(pass));\nif (OSSL_DECODER_from_data(dctx, &data, &datalen)) {\n    /* pkey is created with the decoded data from the buffer */\n} else {\n    /* decoding failure */\n}\nOSSL_DECODER_CTX_free(dctx);\n
                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_DECODER_CTX(3)

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_DECODER_from_bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_DISPATCH/","title":"OSSL_DISPATCH","text":""},{"location":"man3/OSSL_DISPATCH/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_DISPATCH - OpenSSL Core type to define a dispatchable function table

                                                                                                                                                  "},{"location":"man3/OSSL_DISPATCH/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/core.h>\n\ntypedef struct ossl_dispatch_st OSSL_DISPATCH;\nstruct ossl_dispatch_st {\n    int function_id;\n    void (*function)(void);\n};\n
                                                                                                                                                  "},{"location":"man3/OSSL_DISPATCH/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  This type is a tuple of function identity and function pointer. Arrays of this type are passed between the OpenSSL libraries and the providers to describe what functionality one side provides to the other.

                                                                                                                                                  Arrays of this type must be terminated with a tuple having function identity zero and function pointer NULL.

                                                                                                                                                  "},{"location":"man3/OSSL_DISPATCH/#ossl_dispatch-fields","title":"OSSL_DISPATCH fields","text":"
                                                                                                                                                  • function_id

                                                                                                                                                    OpenSSL defined function identity of the implemented function.

                                                                                                                                                  • function

                                                                                                                                                    Pointer to the implemented function itself. Despite the generic definition of this field, the implemented function it points to must have a function signature that corresponds to the function_id

                                                                                                                                                  Available function identities and corresponding function signatures are defined in openssl-core_dispatch.h(7). Furthermore, the chosen function identities and associated function signature must be chosen specifically for the operation that it's intended for, as determined by the intended OSSL_ALGORITHM(3) array.

                                                                                                                                                  Any function identity not recognised by the recipient of this type will be ignored. This ensures that providers built with one OpenSSL version in mind will work together with any other OpenSSL version that supports this mechanism.

                                                                                                                                                  "},{"location":"man3/OSSL_DISPATCH/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  crypto(7), openssl-core_dispatch.h(7), OSSL_ALGORITHM(3)

                                                                                                                                                  "},{"location":"man3/OSSL_DISPATCH/#history","title":"HISTORY","text":"

                                                                                                                                                  OSSL_DISPATCH was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_DISPATCH/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER/","title":"OSSL_ENCODER","text":""},{"location":"man3/OSSL_ENCODER/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_ENCODER, OSSL_ENCODER_fetch, OSSL_ENCODER_up_ref, OSSL_ENCODER_free, OSSL_ENCODER_get0_provider, OSSL_ENCODER_get0_properties, OSSL_ENCODER_is_a, OSSL_ENCODER_get0_name, OSSL_ENCODER_get0_description, OSSL_ENCODER_do_all_provided, OSSL_ENCODER_names_do_all, OSSL_ENCODER_gettable_params, OSSL_ENCODER_get_params - Encoder method routines

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/encoder.h>\n\ntypedef struct ossl_encoder_st OSSL_ENCODER;\n\nOSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name,\n                                 const char *properties);\nint OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);\nvoid OSSL_ENCODER_free(OSSL_ENCODER *encoder);\nconst OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder);\nconst char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder);\nint OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);\nconst char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *encoder);\nconst char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *encoder);\nvoid OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                  void (*fn)(OSSL_ENCODER *encoder, void *arg),\n                                  void *arg);\nint OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,\n                              void (*fn)(const char *name, void *data),\n                              void *data);\nconst OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);\nint OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]);\n
                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_ENCODER is a method for encoders, which know how to encode an object of some kind to a encoded form, such as PEM, DER, or even human readable text.

                                                                                                                                                  OSSL_ENCODER_fetch() looks for an algorithm within the provider that has been loaded into the OSSL_LIB_CTX given by ctx, having the name given by name and the properties given by properties. The name determines what type of object the fetched encoder method is expected to be able to encode, and the properties are used to determine the expected output type. For known properties and the values they may have, please have a look in \"Names and properties\" in provider-encoder(7).

                                                                                                                                                  OSSL_ENCODER_up_ref() increments the reference count for the given encoder.

                                                                                                                                                  OSSL_ENCODER_free() decrements the reference count for the given encoder, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_ENCODER_get0_provider() returns the provider of the given encoder.

                                                                                                                                                  OSSL_ENCODER_get0_properties() returns the property definition associated with the given encoder.

                                                                                                                                                  OSSL_ENCODER_is_a() checks if encoder is an implementation of an algorithm that's identifiable with name.

                                                                                                                                                  OSSL_ENCODER_get0_name() returns the name used to fetch the given encoder.

                                                                                                                                                  OSSL_ENCODER_get0_description() returns a description of the loader, meant for display and human consumption. The description is at the discretion of the loader implementation.

                                                                                                                                                  OSSL_ENCODER_names_do_all() traverses all names for the given encoder, and calls fn with each name and data as arguments.

                                                                                                                                                  OSSL_ENCODER_do_all_provided() traverses all encoder implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and arg as arguments.

                                                                                                                                                  OSSL_ENCODER_gettable_params() returns an OSSL_PARAM(3) array of parameter descriptors.

                                                                                                                                                  OSSL_ENCODER_get_params() attempts to get parameters specified with an OSSL_PARAM(3) array params. Parameters that the implementation doesn't recognise should be ignored.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_ENCODER_fetch() returns a pointer to the key management implementation represented by an OSSL_ENCODER object, or NULL on error.

                                                                                                                                                  OSSL_ENCODER_up_ref() returns 1 on success, or 0 on error.

                                                                                                                                                  OSSL_ENCODER_free() doesn't return any value.

                                                                                                                                                  OSSL_ENCODER_get0_provider() returns a pointer to a provider object, or NULL on error.

                                                                                                                                                  OSSL_ENCODER_get0_properties() returns a pointer to a property definition string, or NULL on error.

                                                                                                                                                  OSSL_ENCODER_is_a() returns 1 of encoder was identifiable, otherwise 0.

                                                                                                                                                  OSSL_ENCODER_get0_name() returns the algorithm name from the provided implementation for the given encoder. Note that the encoder may have multiple synonyms associated with it. In this case the first name from the algorithm definition is returned. Ownership of the returned string is retained by the encoder object and should not be freed by the caller.

                                                                                                                                                  OSSL_ENCODER_get0_description() returns a pointer to a description, or NULL if there isn't one.

                                                                                                                                                  OSSL_ENCODER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_ENCODER_CTX(3), OSSL_ENCODER_to_bio(3), OSSL_ENCODER_CTX_new_for_pkey(3), OSSL_LIB_CTX(3)

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/","title":"OSSL_ENCODER_CTX","text":""},{"location":"man3/OSSL_ENCODER_CTX/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_ENCODER_CTX, OSSL_ENCODER_CTX_new, OSSL_ENCODER_settable_ctx_params, OSSL_ENCODER_CTX_set_params, OSSL_ENCODER_CTX_free, OSSL_ENCODER_CTX_set_selection, OSSL_ENCODER_CTX_set_output_type, OSSL_ENCODER_CTX_set_output_structure, OSSL_ENCODER_CTX_add_encoder, OSSL_ENCODER_CTX_add_extra, OSSL_ENCODER_CTX_get_num_encoders, OSSL_ENCODER_INSTANCE, OSSL_ENCODER_INSTANCE_get_encoder, OSSL_ENCODER_INSTANCE_get_encoder_ctx, OSSL_ENCODER_INSTANCE_get_output_type, OSSL_ENCODER_INSTANCE_get_output_structure, OSSL_ENCODER_CONSTRUCT, OSSL_ENCODER_CLEANUP, OSSL_ENCODER_CTX_set_construct, OSSL_ENCODER_CTX_set_construct_data, OSSL_ENCODER_CTX_set_cleanup - Encoder context routines

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/encoder.h>\n\ntypedef struct ossl_encoder_ctx_st OSSL_ENCODER_CTX;\n\nOSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new();\nconst OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder);\nint OSSL_ENCODER_CTX_set_params(OSSL_ENCODER_CTX *ctx,\n                                const OSSL_PARAM params[]);\nvoid OSSL_ENCODER_CTX_free(OSSL_ENCODER_CTX *ctx);\n\nint OSSL_ENCODER_CTX_set_selection(OSSL_ENCODER_CTX *ctx, int selection);\nint OSSL_ENCODER_CTX_set_output_type(OSSL_ENCODER_CTX *ctx,\n                                     const char *output_type);\nint OSSL_ENCODER_CTX_set_output_structure(OSSL_ENCODER_CTX *ctx,\n                                          const char *output_structure);\n\nint OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder);\nint OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx,\n                               OSSL_LIB_CTX *libctx, const char *propq);\nint OSSL_ENCODER_CTX_get_num_encoders(OSSL_ENCODER_CTX *ctx);\n\ntypedef struct ossl_encoder_instance_st OSSL_ENCODER_INSTANCE;\nOSSL_ENCODER *\nOSSL_ENCODER_INSTANCE_get_encoder(OSSL_ENCODER_INSTANCE *encoder_inst);\nvoid *\nOSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst);\nconst char *\nOSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst);\nconst char *\nOSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst);\n\ntypedef const void *OSSL_ENCODER_CONSTRUCT(OSSL_ENCODER_INSTANCE *encoder_inst,\n                                           void *construct_data);\ntypedef void OSSL_ENCODER_CLEANUP(void *construct_data);\n\nint OSSL_ENCODER_CTX_set_construct(OSSL_ENCODER_CTX *ctx,\n                                   OSSL_ENCODER_CONSTRUCT *construct);\nint OSSL_ENCODER_CTX_set_construct_data(OSSL_ENCODER_CTX *ctx,\n                                        void *construct_data);\nint OSSL_ENCODER_CTX_set_cleanup(OSSL_ENCODER_CTX *ctx,\n                                 OSSL_ENCODER_CLEANUP *cleanup);\n
                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  Encoding an input object to the desired encoding may be done with a chain of encoder implementations, which means that the output from one encoder may be the input for the next in the chain. The OSSL_ENCODER_CTX holds all the data about these encoders. This allows having generic format encoders such as DER to PEM, as well as more specialized encoders like RSA to DER.

                                                                                                                                                  The final output type must be given, and a chain of encoders must end with an implementation that produces that output type.

                                                                                                                                                  At the beginning of the encoding process, a constructor provided by the caller is called to ensure that there is an appropriate provider-side object to start with. The constructor is set with OSSL_ENCODER_CTX_set_construct().

                                                                                                                                                  OSSL_ENCODER_INSTANCE is an opaque structure that contains data about the encoder that is going to be used, and that may be useful for the constructor. There are some functions to extract data from this type, described in \"Constructor\" below.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#functions","title":"Functions","text":"

                                                                                                                                                  OSSL_ENCODER_CTX_new() creates a OSSL_ENCODER_CTX.

                                                                                                                                                  OSSL_ENCODER_settable_ctx_params() returns an OSSL_PARAM(3) array of parameter descriptors.

                                                                                                                                                  OSSL_ENCODER_CTX_set_params() attempts to set parameters specified with an OSSL_PARAM(3) array params. Parameters that the implementation doesn't recognise should be ignored.

                                                                                                                                                  OSSL_ENCODER_CTX_free() frees the given context ctx. If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_ENCODER_CTX_add_encoder() populates the OSSL_ENCODER_CTX ctx with a encoder, to be used to encode an input object.

                                                                                                                                                  OSSL_ENCODER_CTX_add_extra() finds encoders that further encodes output from already added encoders, and adds them as well. This is used to build encoder chains.

                                                                                                                                                  OSSL_ENCODER_CTX_set_output_type() sets the ending output type. This must be specified, and determines if a complete encoder chain is available.

                                                                                                                                                  OSSL_ENCODER_CTX_set_output_structure() sets the desired output structure. This may be used to determines what encoder implementations may be used. Depending on the type of object being encoded, the output structure may not be relevant.

                                                                                                                                                  OSSL_ENCODER_CTX_get_num_encoders() gets the number of encoders currently added to the context ctx.

                                                                                                                                                  OSSL_ENCODER_CTX_set_construct() sets the constructor construct.

                                                                                                                                                  OSSL_ENCODER_CTX_set_construct_data() sets the constructor data that is passed to the constructor every time it's called.

                                                                                                                                                  OSSL_ENCODER_CTX_set_cleanup() sets the constructor data cleanup function. This is called by OSSL_ENCODER_CTX_free(3).

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#constructor","title":"Constructor","text":"

                                                                                                                                                  A OSSL_ENCODER_CONSTRUCT gets the following arguments:

                                                                                                                                                  • encoder_inst

                                                                                                                                                    The OSSL_ENCODER_INSTANCE for the encoder from which the constructor gets its data.

                                                                                                                                                  • construct_data

                                                                                                                                                    The pointer that was set with OSSL_ENCODE_CTX_set_construct_data().

                                                                                                                                                  The constructor is expected to return a valid (non-NULL) pointer to a provider-native object that can be used as first input of an encoding chain, or NULL to indicate that an error has occurred.

                                                                                                                                                  These utility functions may be used by a constructor:

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_encoder() can be used to get the encoder implementation of the encoder instance encoder_inst.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_encoder_ctx() can be used to get the encoder implementation's provider context of the encoder instance encoder_inst.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_output_type() can be used to get the output type for the encoder implementation of the encoder instance encoder_inst. This will never be NULL.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_output_structure() can be used to get the output structure for the encoder implementation of the encoder instance encoder_inst. This may be NULL.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_ENCODER_CTX_new() returns a pointer to a OSSL_ENCODER_CTX, or NULL if the context structure couldn't be allocated.

                                                                                                                                                  OSSL_ENCODER_settable_ctx_params() returns an OSSL_PARAM(3) array, or NULL if none is available.

                                                                                                                                                  OSSL_ENCODER_CTX_set_params() returns 1 if all recognised parameters were valid, or 0 if one of them was invalid or caused some other failure in the implementation.

                                                                                                                                                  OSSL_ENCODER_CTX_add_encoder(), OSSL_ENCODER_CTX_add_extra(), OSSL_ENCODER_CTX_set_construct(), OSSL_ENCODER_CTX_set_construct_data() and OSSL_ENCODER_CTX_set_cleanup() return 1 on success, or 0 on failure.

                                                                                                                                                  OSSL_ENCODER_CTX_get_num_encoders() returns the current number of encoders. It returns 0 if ctx is NULL.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_encoder() returns an OSSL_ENCODER pointer on success, or NULL on failure.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_encoder_ctx() returns a provider context pointer on success, or NULL on failure.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_output_type() returns a string with the name of the input type, if relevant. NULL is a valid returned value.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_output_type() returns a string with the name of the output type.

                                                                                                                                                  OSSL_ENCODER_INSTANCE_get_output_structure() returns a string with the name of the output structure.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_ENCODER(3)

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/","title":"OSSL_ENCODER_CTX_new_for_pkey","text":""},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_ENCODER_CTX_new_for_pkey, OSSL_ENCODER_CTX_set_cipher, OSSL_ENCODER_CTX_set_passphrase, OSSL_ENCODER_CTX_set_pem_password_cb, OSSL_ENCODER_CTX_set_passphrase_cb, OSSL_ENCODER_CTX_set_passphrase_ui - Encoder routines to encode EVP_PKEYs

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/encoder.h>\n\nOSSL_ENCODER_CTX *\nOSSL_ENCODER_CTX_new_for_pkey(const EVP_PKEY *pkey, int selection,\n                              const char *output_type,\n                              const char *output_structure,\n                              const char *propquery);\n\nint OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx,\n                                const char *cipher_name,\n                                const char *propquery);\nint OSSL_ENCODER_CTX_set_passphrase(OSSL_ENCODER_CTX *ctx,\n                                    const unsigned char *kstr,\n                                    size_t klen);\nint OSSL_ENCODER_CTX_set_pem_password_cb(OSSL_ENCODER_CTX *ctx,\n                                         pem_password_cb *cb, void *cbarg);\nint OSSL_ENCODER_CTX_set_passphrase_ui(OSSL_ENCODER_CTX *ctx,\n                                       const UI_METHOD *ui_method,\n                                       void *ui_data);\nint OSSL_ENCODER_CTX_set_passphrase_cb(OSSL_ENCODER_CTX *ctx,\n                                       OSSL_PASSPHRASE_CALLBACK *cb,\n                                       void *cbarg);\n
                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_ENCODER_CTX_new_for_pkey() is a utility function that creates a OSSL_ENCODER_CTX, finds all applicable encoder implementations and sets them up, so almost all the caller has to do next is call functions like OSSL_ENCODER_to_bio(3). output_type determines the final output encoding, and selection can be used to select what parts of the pkey should be included in the output. output_type is further discussed in \"Output types\" below, and selection is further described in \"Selections\".

                                                                                                                                                  Internally, OSSL_ENCODER_CTX_new_for_pkey() uses the names from the EVP_KEYMGMT(3) implementation associated with pkey to build a list of applicable encoder implementations that are used to process the pkey into the encoding named by output_type, with the outermost structure named by output_structure if that's relevant. All these implementations are implicitly fetched, with propquery for finer selection.

                                                                                                                                                  If no suitable encoder implementation is found, OSSL_ENCODER_CTX_new_for_pkey() still creates a OSSL_ENCODER_CTX, but with no associated encoder (OSSL_ENCODER_CTX_get_num_encoders(3) returns zero). This helps the caller to distinguish between an error when creating the OSSL_ENCODER_CTX and missing encoder implementation, and allows it to act accordingly.

                                                                                                                                                  OSSL_ENCODER_CTX_set_cipher() tells the implementation what cipher should be used to encrypt encoded keys. The cipher is given by name cipher_name. The interpretation of that cipher_name is implementation dependent. The implementation may implement the cipher directly itself or by other implementations, or it may choose to fetch it. If the implementation supports fetching the cipher, then it may use propquery as properties to be queried for when fetching. cipher_name may also be NULL, which will result in unencrypted encoding.

                                                                                                                                                  OSSL_ENCODER_CTX_set_passphrase() gives the implementation a pass phrase to use when encrypting the encoded private key. Alternatively, a pass phrase callback may be specified with the following functions.

                                                                                                                                                  OSSL_ENCODER_CTX_set_pem_password_cb(), OSSL_ENCODER_CTX_set_passphrase_ui() and OSSL_ENCODER_CTX_set_passphrase_cb() sets up a callback method that the implementation can use to prompt for a pass phrase, giving the caller the choice of preferred pass phrase callback form. These are called indirectly, through an internal OSSL_PASSPHRASE_CALLBACK(3) function.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#output-types","title":"Output types","text":"

                                                                                                                                                  The possible EVP_PKEY output types depends on the available implementations.

                                                                                                                                                  OpenSSL has built in implementations for the following output types:

                                                                                                                                                  • TEXT

                                                                                                                                                    The output is a human readable description of the key. EVP_PKEY_print_private(3), EVP_PKEY_print_public(3) and EVP_PKEY_print_params(3) use this for their output.

                                                                                                                                                  • DER

                                                                                                                                                    The output is the DER encoding of the selection of the pkey.

                                                                                                                                                  • PEM

                                                                                                                                                    The output is the selection of the pkey in PEM format.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#selections","title":"Selections","text":"

                                                                                                                                                  selection can be any one of the values described in \"Selections\" in EVP_PKEY_fromdata(3).

                                                                                                                                                  These are only 'hints' since the encoder implementations are free to determine what makes sense to include in the output, and this may depend on the desired output. For example, an EC key in a PKCS#8 structure doesn't usually include the public key.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_ENCODER_CTX_new_for_pkey() returns a pointer to an OSSL_ENCODER_CTX, or NULL if it couldn't be created.

                                                                                                                                                  OSSL_ENCODER_CTX_set_cipher(), OSSL_ENCODER_CTX_set_passphrase(), OSSL_ENCODER_CTX_set_pem_password_cb(), OSSL_ENCODER_CTX_set_passphrase_ui() and OSSL_ENCODER_CTX_set_passphrase_cb() all return 1 on success, or 0 on failure.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_ENCODER(3), OSSL_ENCODER_CTX(3)

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_CTX_new_for_pkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/","title":"OSSL_ENCODER_to_bio","text":""},{"location":"man3/OSSL_ENCODER_to_bio/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_ENCODER_to_data, OSSL_ENCODER_to_bio, OSSL_ENCODER_to_fp - Routines to perform an encoding

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/encoder.h>\n\nint OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,\n                         size_t *pdata_len);\nint OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);\nint OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);\n

                                                                                                                                                  Feature availability macros:

                                                                                                                                                  • OSSL_ENCODER_to_fp() is only available when OPENSSL_NO_STDIO is undefined.
                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_ENCODER_to_data() runs the encoding process for the context ctx, with the output going to the *pdata and *pdata_len. If *pdata is NULL when OSSL_ENCODER_to_data() is called, a buffer will be allocated using OPENSSL_zalloc(3), and *pdata will be set to point at the start of that buffer, and *pdata_len will be assigned its length when OSSL_ENCODER_to_data() returns. If *pdata is non-NULL when OSSL_ENCODER_to_data() is called, *pdata_len is assumed to have its size. In this case, *pdata will be set to point after the encoded bytes, and *pdata_len will be assigned the number of remaining bytes.

                                                                                                                                                  OSSL_ENCODER_to_bio() runs the encoding process for the context ctx, with the output going to the BIO out.

                                                                                                                                                  OSSL_ENCODER_to_fp() does the same thing as OSSL_ENCODER_to_bio(), except that the output is going to the FILE fp.

                                                                                                                                                  For OSSL_ENCODER_to_bio() and OSSL_ENCODER_to_fp(), the application is required to set up the BIO or FILE properly, for example to have it in text or binary mode as is appropriate for the encoder output type.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_ENCODER_to_bio(), OSSL_ENCODER_to_fp() and OSSL_ENCODER_to_data() return 1 on success, or 0 on failure.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  To encode a pkey as PKCS#8 with PEM format into a bio:

                                                                                                                                                  OSSL_ENCODER_CTX *ectx;\nconst char *format = \"PEM\";\nconst char *structure = \"PrivateKeyInfo\"; /* PKCS#8 structure */\nconst unsigned char *pass = \"my password\";\n\nectx = OSSL_ENCODER_CTX_new_for_pkey(pkey,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR\n                                     | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                                     format, structure,\n                                     NULL);\nif (ectx == NULL) {\n    /* error: no suitable potential encoders found */\n}\nif (pass != NULL)\n    OSSL_ENCODER_CTX_set_passphrase(ectx, pass, strlen(pass));\nif (OSSL_ENCODER_to_bio(ectx, bio)) {\n    /* pkey was successfully encoded into the bio */\n} else {\n    /* encoding failure */\n}\nOSSL_ENCODER_CTX_free(ectx);\n

                                                                                                                                                  To encode a pkey as PKCS#8 with DER format encrypted with AES-256-CBC into a buffer:

                                                                                                                                                  OSSL_ENCODER_CTX *ectx;\nconst char *format = \"DER\";\nconst char *structure = \"PrivateKeyInfo\"; /* PKCS#8 structure */\nconst unsigned char *pass = \"my password\";\nunsigned char *data = NULL;\nsize_t datalen;\n\nectx = OSSL_ENCODER_CTX_new_for_pkey(pkey,\n                                     OSSL_KEYMGMT_SELECT_KEYPAIR\n                                     | OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                                     format, structure,\n                                     NULL);\nif (ectx == NULL) {\n    /* error: no suitable potential encoders found */\n}\nif (pass != NULL) {\n    OSSL_ENCODER_CTX_set_passphrase(ectx, pass, strlen(pass));\n    OSSL_ENCODER_CTX_set_cipher(ctx, \"AES-256-CBC\", NULL);\n}\nif (OSSL_ENCODER_to_data(ectx, &data, &datalen)) {\n    /*\n     * pkey was successfully encoded into a newly allocated\n     * data buffer\n     */\n} else {\n    /* encoding failure */\n}\nOSSL_ENCODER_CTX_free(ectx);\n
                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  provider(7), OSSL_ENCODER_CTX(3)

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_ENCODER_to_bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/","title":"OSSL_ESS_check_signing_certs","text":""},{"location":"man3/OSSL_ESS_check_signing_certs/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_ESS_signing_cert_new_init, OSSL_ESS_signing_cert_v2_new_init, OSSL_ESS_check_signing_certs - Enhanced Security Services (ESS) functions

                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/ess.h>\n\nESS_SIGNING_CERT *OSSL_ESS_signing_cert_new_init(const X509 *signcert,\n                                                 const STACK_OF(X509) *certs,\n                                                 int set_issuer_serial);\nESS_SIGNING_CERT_V2 *OSSL_ESS_signing_cert_v2_new_init(const EVP_MD *hash_alg,\n                                                       const X509 *signcert,\n                                                       const\n                                                       STACK_OF(X509) *certs,\n                                                       int set_issuer_serial);\nint OSSL_ESS_check_signing_certs(const ESS_SIGNING_CERT *ss,\n                                 const ESS_SIGNING_CERT_V2 *ssv2,\n                                 const STACK_OF(X509) *chain,\n                                 int require_signing_cert);\n
                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_ESS_signing_cert_new_init() generates a new ESS_SIGNING_CERT structure referencing the given signcert and any given further certs using their SHA-1 fingerprints. If set_issuer_serial is nonzero then also the issuer and serial number of signcert are included in the ESS_CERT_ID as the issuerSerial field. For all members of certs the issuerSerial field is always included.

                                                                                                                                                  OSSL_ESS_signing_cert_v2_new_init() is the same as OSSL_ESS_signing_cert_new_init() except that it uses the given hash_alg and generates a ESS_SIGNING_CERT_V2 structure with ESS_CERT_ID_V2 elements.

                                                                                                                                                  OSSL_ESS_check_signing_certs() checks if the validation chain chain contains the certificates required by the identifiers given in ss and/or ssv2. If require_signing_cert is nonzero, ss or ssv2 must not be NULL. If both ss and ssv2 are not NULL, they are evaluated independently. The list of certificate identifiers in ss is of type ESS_CERT_ID, while the list contained in ssv2 is of type ESS_CERT_ID_V2. As far as these lists are present, they must be nonempty. The certificate identified by their first entry must be the first element of chain, i.e. the signer certificate. Any further certificates referenced in the list must also be found in chain. The matching is done using the given certificate hash algorithm and value. In addition to the checks required by RFCs 2624 and 5035, if the issuerSerial field is included in an ESSCertID or ESSCertIDv2 it must match the certificate issuer and serial number attributes.

                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/#notes","title":"NOTES","text":"

                                                                                                                                                  ESS has been defined in RFC 2634, which has been updated in RFC 5035 (ESS version 2) to support hash algorithms other than SHA-1. This is used for TSP (RFC 3161) and CAdES-BES (informational RFC 5126).

                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_ESS_signing_cert_new_init() and OSSL_ESS_signing_cert_v2_new_init() return a pointer to the new structure or NULL on malloc failure.

                                                                                                                                                  OSSL_ESS_check_signing_certs() returns 1 on success, 0 if a required certificate cannot be found, -1 on other error.

                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  TS_VERIFY_CTX_set_certs(3), CMS_verify(3)

                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/#history","title":"HISTORY","text":"

                                                                                                                                                  OSSL_ESS_signing_cert_new_init(), OSSL_ESS_signing_cert_v2_new_init(), and OSSL_ESS_check_signing_certs() were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_ESS_check_signing_certs/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/","title":"OSSL_HTTP_REQ_CTX","text":""},{"location":"man3/OSSL_HTTP_REQ_CTX/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_HTTP_REQ_CTX, OSSL_HTTP_REQ_CTX_new, OSSL_HTTP_REQ_CTX_free, OSSL_HTTP_REQ_CTX_set_request_line, OSSL_HTTP_REQ_CTX_add1_header, OSSL_HTTP_REQ_CTX_set_expected, OSSL_HTTP_REQ_CTX_set1_req, OSSL_HTTP_REQ_CTX_nbio, OSSL_HTTP_REQ_CTX_nbio_d2i, OSSL_HTTP_REQ_CTX_exchange, OSSL_HTTP_REQ_CTX_get0_mem_bio, OSSL_HTTP_REQ_CTX_get_resp_len, OSSL_HTTP_REQ_CTX_set_max_response_length, OSSL_HTTP_is_alive - HTTP client low-level functions

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/http.h>\n\ntypedef struct ossl_http_req_ctx_st OSSL_HTTP_REQ_CTX;\n\nOSSL_HTTP_REQ_CTX *OSSL_HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int buf_size);\nvoid OSSL_HTTP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx);\n\nint OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, int method_POST,\n                                       const char *server, const char *port,\n                                       const char *path);\nint OSSL_HTTP_REQ_CTX_add1_header(OSSL_HTTP_REQ_CTX *rctx,\n                                  const char *name, const char *value);\n\nint OSSL_HTTP_REQ_CTX_set_expected(OSSL_HTTP_REQ_CTX *rctx,\n                                   const char *content_type, int asn1,\n                                   int timeout, int keep_alive);\nint OSSL_HTTP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const char *content_type,\n                               const ASN1_ITEM *it, const ASN1_VALUE *req);\nint OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx);\nint OSSL_HTTP_REQ_CTX_nbio_d2i(OSSL_HTTP_REQ_CTX *rctx,\n                               ASN1_VALUE **pval, const ASN1_ITEM *it);\nBIO *OSSL_HTTP_REQ_CTX_exchange(OSSL_HTTP_REQ_CTX *rctx);\n\nBIO *OSSL_HTTP_REQ_CTX_get0_mem_bio(const OSSL_HTTP_REQ_CTX *rctx);\nsize_t OSSL_HTTP_REQ_CTX_get_resp_len(const OSSL_HTTP_REQ_CTX *rctx);\nvoid OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx,\n                                               unsigned long len);\n\nint OSSL_HTTP_is_alive(const OSSL_HTTP_REQ_CTX *rctx);\n
                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_HTTP_REQ_CTX is a context structure for an HTTP request and response, used to collect all the necessary data to perform that request.

                                                                                                                                                  This file documents low-level HTTP functions rarely used directly. High-level HTTP client functions like OSSL_HTTP_get(3) and OSSL_HTTP_transfer(3) should be preferred.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_new() allocates a new HTTP request context structure, which gets populated with the BIO to write/send the request to (wbio), the BIO to read/receive the response from (rbio, which may be equal to wbio), and the maximum expected response header line length buf_size. A value <= 0 indicates that the OSSL_HTTP_DEFAULT_MAX_LINE_LEN of 4KiB should be used. buf_size is also used as the number of content bytes that are read at a time. The allocated context structure includes an internal memory BIO, which collects the HTTP request header lines.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_free() frees up the HTTP request context rctx. The rbio is not free'd, wbio will be free'd if free_wbio is set. If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_set_request_line() adds the 1st HTTP request line to rctx. The HTTP method is determined by method_POST, which should be 1 to indicate POST or 0 to indicate GET. server and port may be set to give the server and the optional port that an HTTP proxy shall forward the request to, otherwise they must be left NULL. path provides the HTTP request path; if left NULL, / is used. For backward compatibility, path may begin with http:// and thus convey an absoluteURI. In this case it indicates HTTP proxy use and provides also the server (and optionally the port) that the proxy shall forward the request to. In this case the server and port arguments must be NULL.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_add1_header() adds header name with value value to the context rctx. It can be called more than once to add multiple header lines. For example, to add a Host header for example.com you would call:

                                                                                                                                                  OSSL_HTTP_REQ_CTX_add1_header(ctx, \"Host\", \"example.com\");\n

                                                                                                                                                  OSSL_HTTP_REQ_CTX_set_expected() optionally sets in rctx some expectations of the HTTP client on the response. Due to the structure of an HTTP request, if the keep_alive argument is nonzero the function must be used before calling OSSL_HTTP_REQ_CTX_set1_req(). If the content_type parameter is not NULL then the client will check that the given content type string is included in the HTTP header of the response and return an error if not. If the asn1 parameter is nonzero a structure in ASN.1 encoding will be expected as the response content and input streaming is disabled. This means that an ASN.1 sequence header is required, its length field is checked, and OSSL_HTTP_REQ_CTX_get0_mem_bio() should be used to get the buffered response. Otherwise (by default) any input format is allowed without length checks. In this case the BIO given as rbio argument to OSSL_HTTP_REQ_CTX_new() should be used directly to read the response contents, which may support streaming. If the timeout parameter is > 0 this indicates the maximum number of seconds the subsequent HTTP transfer (sending the request and receiving a response) is allowed to take. timeout == 0 enables waiting indefinitely, i.e., no timeout can occur. This is the default. timeout < 0 takes over any value set via the overall_timeout argument of OSSL_HTTP_open(3) with the default being 0, which means no timeout. If the keep_alive parameter is 0, which is the default, the connection is not kept open after receiving a response. This is the default behavior for HTTP 1.0. If the value is 1 or 2 then a persistent connection is requested. If the value is 2 then a persistent connection is required, i.e., an error occurs in case the server does not grant it.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_set1_req() finalizes the HTTP request context. It is needed if the method_POST parameter in the OSSL_HTTP_REQ_CTX_set_request_line() call was 1 and an ASN.1-encoded request should be sent. It must also be used when requesting \"keep-alive\", even if a GET request is going to be sent, in which case req must be NULL. Unless req is NULL, the function adds the DER encoding of req using the ASN.1 template it to do the encoding (which does not support streaming). The HTTP header Content-Length is filled out with the length of the request. content_type must be NULL if req is NULL. If content_type isn't NULL, the HTTP header Content-Type is also added with the given string value. The header lines are added to the internal memory BIO for the request header.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_nbio() attempts to send the request prepared in rctx and to gather the response via HTTP, using the wbio and rbio that were given when calling OSSL_HTTP_REQ_CTX_new(). The function may need to be called again if its result is -1, which indicates BIO_should_retry(3). In such a case it is advisable to sleep a little in between, using BIO_wait(3) on the read BIO to prevent a busy loop.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_nbio_d2i() is like OSSL_HTTP_REQ_CTX_nbio() but on success in addition parses the response, which must be a DER-encoded ASN.1 structure, using the ASN.1 template it and places the result in *pval.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_exchange() calls OSSL_HTTP_REQ_CTX_nbio() as often as needed in order to exchange a request and response or until a timeout is reached. On success it returns a pointer to the BIO that can be used to read the result. If an ASN.1-encoded response was expected, this is the BIO returned by OSSL_HTTP_REQ_CTX_get0_mem_bio() when called after the exchange. This memory BIO does not support streaming. Otherwise the returned BIO is the rbio given to OSSL_HTTP_REQ_CTX_new(), which may support streaming. When this BIO is returned, it has been read past the end of the response header, such that the actual response body can be read from it. The returned BIO pointer MUST NOT be freed by the caller.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_get0_mem_bio() returns the internal memory BIO. Before the HTTP request is sent, this could be used to adapt its header lines. Use with caution! After receiving a response via HTTP, the BIO represents the current state of reading the response header. If the response was expected to be ASN.1 encoded, its contents can be read via this BIO, which does not support streaming. The returned BIO pointer must not be freed by the caller.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_get_resp_len() returns the size of the response contents in rctx if provided by the server as header field, else 0.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_set_max_response_length() sets the maximum allowed response content length for rctx to len. If not set or len is 0 then the OSSL_HTTP_DEFAULT_MAX_RESP_LEN is used, which currently is 100 KiB. If the Content-Length header is present and exceeds this value or the content is an ASN.1 encoded structure with a length exceeding this value or both length indications are present but disagree then an error occurs.

                                                                                                                                                  OSSL_HTTP_is_alive() can be used to query if the HTTP connection given by rctx is still alive, i.e., has not been closed. It returns 0 if rctx is NULL.

                                                                                                                                                  If the client application requested or required a persistent connection and this was granted by the server, it can keep rctx as long as it wants to send further requests and OSSL_HTTP_is_alive() returns nonzero, else it should call OSSL_HTTP_REQ_CTX_free(rctx) or OSSL_HTTP_close(3). In case the client application keeps rctx but the connection then dies for any reason at the server side, it will notice this obtaining an I/O error when trying to send the next request via rctx.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#warnings","title":"WARNINGS","text":"

                                                                                                                                                  The server's response may be unexpected if the hostname that was used to create the wbio, any Host header, and the host specified in the request URL do not match.

                                                                                                                                                  Many of these functions must be called in a certain order.

                                                                                                                                                  First, the HTTP request context must be allocated: OSSL_HTTP_REQ_CTX_new().

                                                                                                                                                  Then, the HTTP request must be prepared with request data:

                                                                                                                                                  1. Calling OSSL_HTTP_REQ_CTX_set_request_line().
                                                                                                                                                  2. Adding extra header lines with OSSL_HTTP_REQ_CTX_add1_header(). This is optional and may be done multiple times with different names.
                                                                                                                                                  3. Finalize the request using OSSL_HTTP_REQ_CTX_set1_req(). This may be omitted if the GET method is used and \"keep-alive\" is not requested.

                                                                                                                                                  When the request context is fully prepared, the HTTP exchange may be performed with OSSL_HTTP_REQ_CTX_nbio() or OSSL_HTTP_REQ_CTX_exchange().

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#notes","title":"NOTES","text":"

                                                                                                                                                  When built with tracing enabled, OSSL_HTTP_REQ_CTX_nbio() and all functions using it, such as OSSL_HTTP_REQ_CTX_exchange() and OSSL_HTTP_transfer(3), may be traced using OSSL_TRACE_CATEGORY_HTTP. See also OSSL_trace_enabled(3) and \"ENVIRONMENT\" in openssl(1).

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_HTTP_REQ_CTX_new() returns a pointer to a OSSL_HTTP_REQ_CTX, or NULL on error.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_free() and OSSL_HTTP_REQ_CTX_set_max_response_length() do not return values.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_set_request_line(), OSSL_HTTP_REQ_CTX_add1_header(), OSSL_HTTP_REQ_CTX_set1_req(), and OSSL_HTTP_REQ_CTX_set_expected() return 1 for success and 0 for failure.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_nbio() and OSSL_HTTP_REQ_CTX_nbio_d2i() return 1 for success, 0 on error or redirection, -1 if retry is needed.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_exchange() and OSSL_HTTP_REQ_CTX_get0_mem_bio() return a pointer to a BIO on success as described above or NULL on failure. The returned BIO must not be freed by the caller.

                                                                                                                                                  OSSL_HTTP_REQ_CTX_get_resp_len() returns the size of the response contents or 0 if not available or an error occurred.

                                                                                                                                                  OSSL_HTTP_is_alive() returns 1 if its argument is non-NULL and the client requested a persistent connection and the server did not disagree on keeping the connection open, else 0.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  BIO_should_retry(3), BIO_wait(3), ASN1_item_d2i_bio(3), ASN1_item_i2d_mem_bio(3), OSSL_HTTP_open(3), OSSL_HTTP_get(3), OSSL_HTTP_transfer(3), OSSL_HTTP_close(3), OSSL_trace_enabled(3)

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_REQ_CTX/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2015-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_parse_url/","title":"OSSL_HTTP_parse_url","text":""},{"location":"man3/OSSL_HTTP_parse_url/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_HTTP_adapt_proxy, OSSL_parse_url, OSSL_HTTP_parse_url, OCSP_parse_url - http utility functions

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_parse_url/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/http.h>\n\nconst char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy,\n                                  const char *server, int use_ssl);\n\nint OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost,\n                   char **pport, int *pport_num,\n                   char **ppath, char **pquery, char **pfrag);\nint OSSL_HTTP_parse_url(const char *url,\n                        int *pssl, char **puser, char **phost,\n                        char **pport, int *pport_num,\n                        char **ppath, char **pquery, char **pfrag);\n

                                                                                                                                                  The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                  int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath,\n                   int *pssl);\n
                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_parse_url/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_HTTP_adapt_proxy() takes an optional proxy hostname proxy and returns it transformed according to the optional no_proxy parameter, server, use_ssl, and the applicable environment variable, as follows. If proxy is NULL, take any default value from the http_proxy environment variable, or from https_proxy if use_ssl is nonzero. If this still does not yield a proxy hostname, take any further default value from the HTTP_PROXY environment variable, or from HTTPS_PROXY if use_ssl is nonzero. If no_proxy is NULL, take any default exclusion value from the no_proxy environment variable, or else from NO_PROXY. Return the determined proxy hostname unless the exclusion contains server. Otherwise return NULL.

                                                                                                                                                  OSSL_parse_url() parses its input string url as a URL of the form [scheme://][userinfo@]host[:port][/path][?query][#fragment] and splits it up into scheme, userinfo, host, port, path, query, and fragment components. The host (or server) component may be a DNS name or an IP address where IPv6 addresses should be enclosed in square brackets [ and ]. The port component is optional and defaults to 0. If given, it must be in decimal form. If the pport_num argument is not NULL the integer value of the port number is assigned to *pport_num on success. The path component is also optional and defaults to /. Each non-NULL result pointer argument pscheme, puser, phost, pport, ppath, pquery, and pfrag, is assigned the respective url component. On success, they are guaranteed to contain non-NULL string pointers, else NULL. It is the responsibility of the caller to free them using OPENSSL_free(3). If pquery is NULL, any given query component is handled as part of the path. A string returned via *ppath is guaranteed to begin with a / character. For absent scheme, userinfo, port, query, and fragment components an empty string is provided.

                                                                                                                                                  OSSL_HTTP_parse_url() is a special form of OSSL_parse_url() where the scheme, if given, must be http or https. If pssl is not NULL, *pssl is assigned 1 in case parsing was successful and the scheme is https, else 0. The port component is optional and defaults to 443 if the scheme is https, else 80. Note that relative paths must be given with a leading /, otherwise the first path element is interpreted as the hostname.

                                                                                                                                                  Calling the deprecated function OCSP_parse_url(url, host, port, path, ssl) is equivalent to OSSL_HTTP_parse_url(url, ssl, NULL, host, port, NULL, path, NULL, NULL).

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_parse_url/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_HTTP_adapt_proxy() returns NULL if no proxy is to be used, otherwise a constant proxy hostname string, which is either the proxy name handed in or an environment variable value.

                                                                                                                                                  OSSL_parse_url(), OSSL_HTTP_parse_url(), and OCSP_parse_url() return 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_parse_url/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_HTTP_transfer(3)

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_parse_url/#history","title":"HISTORY","text":"

                                                                                                                                                  OSSL_HTTP_adapt_proxy(), OSSL_parse_url() and OSSL_HTTP_parse_url() were added in OpenSSL 3.0. OCSP_parse_url() was deprecated in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_parse_url/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/","title":"OSSL_HTTP_transfer","text":""},{"location":"man3/OSSL_HTTP_transfer/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_HTTP_open, OSSL_HTTP_bio_cb_t, OSSL_HTTP_proxy_connect, OSSL_HTTP_set1_request, OSSL_HTTP_exchange, OSSL_HTTP_get, OSSL_HTTP_transfer, OSSL_HTTP_close - HTTP client high-level functions

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/http.h>\n\ntypedef BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg,\n                                   int connect, int detail);\nOSSL_HTTP_REQ_CTX *OSSL_HTTP_open(const char *server, const char *port,\n                                  const char *proxy, const char *no_proxy,\n                                  int use_ssl, BIO *bio, BIO *rbio,\n                                  OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,\n                                  int buf_size, int overall_timeout);\nint OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,\n                            const char *proxyuser, const char *proxypass,\n                            int timeout, BIO *bio_err, const char *prog);\nint OSSL_HTTP_set1_request(OSSL_HTTP_REQ_CTX *rctx, const char *path,\n                           const STACK_OF(CONF_VALUE) *headers,\n                           const char *content_type, BIO *req,\n                           const char *expected_content_type, int expect_asn1,\n                           size_t max_resp_len, int timeout, int keep_alive);\nBIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url);\nBIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy,\n                   BIO *bio, BIO *rbio,\n                   OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,\n                   int buf_size, const STACK_OF(CONF_VALUE) *headers,\n                   const char *expected_content_type, int expect_asn1,\n                   size_t max_resp_len, int timeout);\nBIO *OSSL_HTTP_transfer(OSSL_HTTP_REQ_CTX **prctx,\n                        const char *server, const char *port,\n                        const char *path, int use_ssl,\n                        const char *proxy, const char *no_proxy,\n                        BIO *bio, BIO *rbio,\n                        OSSL_HTTP_bio_cb_t bio_update_fn, void *arg,\n                        int buf_size, const STACK_OF(CONF_VALUE) *headers,\n                        const char *content_type, BIO *req,\n                        const char *expected_content_type, int expect_asn1,\n                        size_t max_resp_len, int timeout, int keep_alive);\nint OSSL_HTTP_close(OSSL_HTTP_REQ_CTX *rctx, int ok);\n
                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_HTTP_open() initiates an HTTP session using the bio argument if not NULL, else by connecting to a given server optionally via a proxy.

                                                                                                                                                  Typically the OpenSSL build supports sockets and the bio parameter is NULL. In this case rbio must be NULL as well and the server must be non-NULL. The function creates a network BIO internally using BIO_new_connect(3) for connecting to the given server and the optionally given port, defaulting to 80 for HTTP or 443 for HTTPS. Then this internal BIO is used for setting up a connection and for exchanging one or more request and response. If bio is given and rbio is NULL then this bio is used instead. If both bio and rbio are given (which may be memory BIOs for instance) then no explicit connection is set up, but bio is used for writing requests and rbio for reading responses. As soon as the client has flushed bio the server must be ready to provide a response or indicate a waiting condition via rbio.

                                                                                                                                                  If bio is given, it is an error to provide proxy or no_proxy arguments, while server and port arguments may be given to support diagnostic output. If bio is NULL the optional proxy parameter can be used to set an HTTP(S) proxy to use (unless overridden by \"no_proxy\" settings). If TLS is not used this defaults to the environment variable http_proxy if set, else HTTP_PROXY. If use_ssl != 0 it defaults to https_proxy if set, else HTTPS_PROXY. An empty proxy string \"\" forbids using a proxy. Else the format is [http[s]://][userinfo@]host[:port][/path][?query][#fragment], where any userinfo, path, query, and fragment given is ignored. The default proxy port number is 80, or 443 in case \"https:\" is given. The HTTP client functions connect via the given proxy unless the server is found in the optional list no_proxy of proxy hostnames (if not NULL; default is the environment variable no_proxy if set, else NO_PROXY). Proxying plain HTTP is supported directly, while using a proxy for HTTPS connections requires a suitable callback function such as OSSL_HTTP_proxy_connect(), described below.

                                                                                                                                                  If use_ssl is nonzero a TLS connection is requested and the bio_update_fn parameter must be provided.

                                                                                                                                                  The parameter bio_update_fn, which is optional if use_ssl is 0, may be used to modify the connection BIO used by the HTTP client, but cannot be used when both bio and rbio are given. bio_update_fn is a BIO connect/disconnect callback function with prototype

                                                                                                                                                  BIO *(*OSSL_HTTP_bio_cb_t)(BIO *bio, void *arg, int connect, int detail)\n

                                                                                                                                                  The callback function may modify the BIO provided in the bio argument, whereby it may make use of a custom defined argument arg, which may for instance point to an SSL_CTX structure. During connection establishment, just after calling BIO_do_connect_retry(), the callback function is invoked with the connect argument being 1 and detail being 1 if use_ssl is nonzero (i.e., HTTPS is requested), else 0. On disconnect connect is 0 and detail is 1 if no error occurred, else 0. For instance, on connect the callback may push an SSL BIO to implement HTTPS; after disconnect it may do some diagnostic output and pop and free the SSL BIO.

                                                                                                                                                  The callback function must return either the potentially modified BIO bio. or NULL to indicate failure, in which case it should not modify the BIO.

                                                                                                                                                  Here is a simple example that supports TLS connections (but not via a proxy):

                                                                                                                                                  BIO *http_tls_cb(BIO *bio, void *arg, int connect, int detail)\n{\n    if (connect && detail) { /* connecting with TLS */\n        SSL_CTX *ctx = (SSL_CTX *)arg;\n        BIO *sbio = BIO_new_ssl(ctx, 1);\n\n        bio = sbio != NULL ? BIO_push(sbio, bio) : NULL;\n    } else if (!connect) { /* disconnecting */\n        BIO *hbio;\n\n        if (!detail) { /* an error has occurred */\n            /* optionally add diagnostics here */\n        }\n        BIO_ssl_shutdown(bio);\n        hbio = BIO_pop(bio);\n        BIO_free(bio); /* SSL BIO */\n        bio = hbio;\n    }\n    return bio;\n}\n

                                                                                                                                                  After disconnect the modified BIO will be deallocated using BIO_free_all().

                                                                                                                                                  The buf_size parameter specifies the response header maximum line length. A value <= 0 means that the OSSL_HTTP_DEFAULT_MAX_LINE_LEN (4KiB) is used. buf_size is also used as the number of content bytes that are read at a time.

                                                                                                                                                  If the overall_timeout parameter is > 0 this indicates the maximum number of seconds the overall HTTP transfer (i.e., connection setup if needed, sending requests, and receiving responses) is allowed to take until completion. A value <= 0 enables waiting indefinitely, i.e., no timeout.

                                                                                                                                                  OSSL_HTTP_proxy_connect() may be used by an above BIO connect callback function to set up an SSL/TLS connection via an HTTPS proxy. It promotes the given BIO bio representing a connection pre-established with a TLS proxy using the HTTP CONNECT method, optionally using proxy client credentials proxyuser and proxypass, to connect with TLS protection ultimately to server and port. If the port argument is NULL or the empty string it defaults to \"443\". If the timeout parameter is > 0 this indicates the maximum number of seconds the connection setup is allowed to take. A value <= 0 enables waiting indefinitely, i.e., no timeout. Since this function is typically called by applications such as openssl-s_client(1) it uses the bio_err and prog parameters (unless NULL) to print additional diagnostic information in a user-oriented way.

                                                                                                                                                  OSSL_HTTP_set1_request() sets up in rctx the request header and content data and expectations on the response using the following parameters. If <rctx> indicates using a proxy for HTTP (but not HTTPS), the server host (and optionally port) needs to be placed in the header; thus it must be present in rctx. For backward compatibility, the server (and optional port) may also be given in the path argument beginning with http:// (thus giving an absoluteURI). If path is NULL it defaults to \"/\". If req is NULL the HTTP GET method will be used to send the request else HTTP POST with the contents of req and optional content_type, where the length of the data in req does not need to be determined in advance: the BIO will be read on-the-fly while sending the request, which supports streaming. The optional list headers may contain additional custom HTTP header lines. If the parameter expected_content_type is not NULL then the client will check that the given content type string is included in the HTTP header of the response and return an error if not. If the expect_asn1 parameter is nonzero, a structure in ASN.1 encoding will be expected as response content. The max_resp_len parameter specifies the maximum allowed response content length, where the value 0 indicates no limit. If the timeout parameter is > 0 this indicates the maximum number of seconds the subsequent HTTP transfer (sending the request and receiving a response) is allowed to take. A value of 0 enables waiting indefinitely, i.e., no timeout. A value < 0 indicates that the overall_timeout parameter value given when opening the HTTP transfer will be used instead. If keep_alive is 0 the connection is not kept open after receiving a response, which is the default behavior for HTTP 1.0. If the value is 1 or 2 then a persistent connection is requested. If the value is 2 then a persistent connection is required, i.e., an error occurs in case the server does not grant it.

                                                                                                                                                  OSSL_HTTP_exchange() exchanges any form of HTTP request and response as specified by rctx, which must include both connection and request data, typically set up using OSSL_HTTP_open() and OSSL_HTTP_set1_request(). It implements the core of the functions described below. If the HTTP method is GET and redirection_url is not NULL the latter pointer is used to provide any new location that the server may return with HTTP code 301 (MOVED_PERMANENTLY) or 302 (FOUND). In this case the function returns NULL and the caller is responsible for deallocating the URL with OPENSSL_free(3). If the response header contains one or more \"Content-Length\" header lines and/or an ASN.1-encoded response is expected, which should include a total length, the length indications received are checked for consistency and for not exceeding any given maximum response length. If an ASN.1-encoded response is expected, the function returns on success the contents buffered in a memory BIO, which does not support streaming. Otherwise it returns directly the read BIO that holds the response contents, which allows a response of indefinite length and may support streaming. The caller is responsible for freeing the BIO pointer obtained.

                                                                                                                                                  OSSL_HTTP_get() uses HTTP GET to obtain data from bio if non-NULL, else from the server contained in the url, and returns it as a BIO. It supports redirection via HTTP status code 301 or 302. It is meant for transfers with a single round trip, so does not support persistent connections. If bio is non-NULL, any host and port components in the url are not used for connecting but the hostname is used, as usual, for the Host header. Any userinfo and fragment components in the url are ignored. Any query component is handled as part of the path component. If the scheme component of the url is https a TLS connection is requested and the bio_update_fn, as described for OSSL_HTTP_open(), must be provided. Also the remaining parameters are interpreted as described for OSSL_HTTP_open() and OSSL_HTTP_set1_request(), respectively. The caller is responsible for freeing the BIO pointer obtained.

                                                                                                                                                  OSSL_HTTP_transfer() exchanges an HTTP request and response over a connection managed via prctx without supporting redirection. It combines OSSL_HTTP_open(), OSSL_HTTP_set1_request(), OSSL_HTTP_exchange(), and OSSL_HTTP_close(). If prctx is not NULL it reuses any open connection represented by a non-NULL *prctx. It keeps the connection open if a persistent connection is requested or required and this was granted by the server, else it closes the connection and assigns NULL to *prctx. The remaining parameters are interpreted as described for OSSL_HTTP_open() and OSSL_HTTP_set1_request(), respectively. The caller is responsible for freeing the BIO pointer obtained.

                                                                                                                                                  OSSL_HTTP_close() closes the connection and releases rctx. The ok parameter is passed to any BIO update function given during setup as described above for OSSL_HTTP_open(). It must be 1 if no error occurred during the HTTP transfer and 0 otherwise.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/#notes","title":"NOTES","text":"

                                                                                                                                                  The names of the environment variables used by this implementation: http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, no_proxy, and NO_PROXY, have been chosen for maximal compatibility with other HTTP client implementations such as wget, curl, and git.

                                                                                                                                                  When built with tracing enabled, OSSL_HTTP_transfer() and all functions using it may be traced using OSSL_TRACE_CATEGORY_HTTP. See also OSSL_trace_enabled(3) and \"ENVIRONMENT\" in openssl(1).

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_HTTP_open() returns on success a OSSL_HTTP_REQ_CTX, else NULL.

                                                                                                                                                  OSSL_HTTP_proxy_connect() and OSSL_HTTP_set1_request() return 1 on success, 0 on error.

                                                                                                                                                  On success, OSSL_HTTP_exchange(), OSSL_HTTP_get(), and OSSL_HTTP_transfer() return a memory BIO that buffers all the data received if an ASN.1-encoded response is expected, otherwise a BIO that may support streaming. The BIO must be freed by the caller. On failure, they return NULL. Failure conditions include connection/transfer timeout, parse errors, etc. The caller is responsible for freeing the BIO pointer obtained.

                                                                                                                                                  OSSL_HTTP_close() returns 0 if anything went wrong while disconnecting, else 1.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_HTTP_parse_url(3), BIO_new_connect(3), ASN1_item_i2d_mem_bio(3), ASN1_item_d2i_bio(3), OSSL_HTTP_is_alive(3), OSSL_trace_enabled(3)

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/#history","title":"HISTORY","text":"

                                                                                                                                                  All the functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_HTTP_transfer/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_ITEM/","title":"OSSL_ITEM","text":""},{"location":"man3/OSSL_ITEM/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_ITEM - OpenSSL Core type for generic itemized data

                                                                                                                                                  "},{"location":"man3/OSSL_ITEM/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/core.h>\n\ntypedef struct ossl_item_st OSSL_ITEM;\nstruct ossl_item_st {\n    unsigned int id;\n    void *ptr;\n};\n
                                                                                                                                                  "},{"location":"man3/OSSL_ITEM/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  This type is a tuple of integer and pointer. It's a generic type used as a generic descriptor, its exact meaning being defined by how it's used. Arrays of this type are passed between the OpenSSL libraries and the providers, and must be terminated with a tuple where the integer is zero and the pointer NULL.

                                                                                                                                                  This is currently mainly used for the return value of the provider's error reason strings array, see \"Provider Functions\" in provider-base(7).

                                                                                                                                                  "},{"location":"man3/OSSL_ITEM/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  crypto(7), provider-base(7), openssl-core.h(7)

                                                                                                                                                  "},{"location":"man3/OSSL_ITEM/#history","title":"HISTORY","text":"

                                                                                                                                                  OSSL_ITEM was added in OpenSSL 3.0

                                                                                                                                                  "},{"location":"man3/OSSL_ITEM/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_LIB_CTX/","title":"OSSL_LIB_CTX","text":""},{"location":"man3/OSSL_LIB_CTX/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_LIB_CTX, OSSL_LIB_CTX_new, OSSL_LIB_CTX_new_from_dispatch, OSSL_LIB_CTX_new_child, OSSL_LIB_CTX_free, OSSL_LIB_CTX_load_config, OSSL_LIB_CTX_get0_global_default, OSSL_LIB_CTX_set0_default - OpenSSL library context

                                                                                                                                                  "},{"location":"man3/OSSL_LIB_CTX/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/crypto.h>\n\ntypedef struct ossl_lib_ctx_st OSSL_LIB_CTX;\n\nOSSL_LIB_CTX *OSSL_LIB_CTX_new(void);\nOSSL_LIB_CTX *OSSL_LIB_CTX_new_from_dispatch(const OSSL_CORE_HANDLE *handle,\n                                             const OSSL_DISPATCH *in);\nOSSL_LIB_CTX *OSSL_LIB_CTX_new_child(const OSSL_CORE_HANDLE *handle,\n                                     const OSSL_DISPATCH *in);\nint OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file);\nvoid OSSL_LIB_CTX_free(OSSL_LIB_CTX *ctx);\nOSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void);\nOSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *ctx);\n
                                                                                                                                                  "},{"location":"man3/OSSL_LIB_CTX/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_LIB_CTX is an internal OpenSSL library context type. Applications may allocate their own, but may also use NULL to use a default context with functions that take an OSSL_LIB_CTX argument.

                                                                                                                                                  When a non default library context is in use care should be taken with multi-threaded applications to properly clean up thread local resources before the OSSL_LIB_CTX is freed. See OPENSSL_thread_stop_ex(3) for more information.

                                                                                                                                                  OSSL_LIB_CTX_new() creates a new OpenSSL library context.

                                                                                                                                                  OSSL_LIB_CTX_new_from_dispatch() creates a new OpenSSL library context initialised to use callbacks from the OSSL_DISPATCH structure. This is primarily useful for provider authors. The handle and dispatch structure arguments passed should be the same ones as passed to a provider's OSSL_provider_init function. Some OpenSSL functions, such as BIO_new_from_core_bio(3), require the library context to be created in this way in order to work.

                                                                                                                                                  OSSL_LIB_CTX_new_child() is only useful to provider authors and does the same thing as OSSL_LIB_CTX_new_from_dispatch() except that it additionally links the new library context to the application library context. The new library context is a full library context in its own right, but will have all the same providers available to it that are available in the application library context (without having to reload them). If the application loads or unloads providers from the application library context then this will be automatically mirrored in the child library context.

                                                                                                                                                  In addition providers that are not loaded in the parent library context can be explicitly loaded into the child library context independently from the parent library context. Providers loaded independently in this way will not be mirrored in the parent library context and will not be affected if the parent library context subsequently loads the same provider.

                                                                                                                                                  A provider may call the function OSSL_PROVIDER_load(3) with the child library context as required. If the provider already exists due to it being mirrored from the parent library context then it will remain available and its reference count will be increased. If OSSL_PROVIDER_load(3) is called in this way then OSSL_PROVIDER_unload(3) should be subsequently called to decrement the reference count. OSSL_PROVIDER_unload(3) must not be called for a provider in the child library context that did not have an earlier OSSL_PROVIDER_load(3) call for that provider in that child library context.

                                                                                                                                                  In addition to providers, a child library context will also mirror the default properties (set via EVP_set_default_properties(3)) from the parent library context. If EVP_set_default_properties(3) is called directly on a child library context then the new properties will override anything from the parent library context and mirroring of the properties will stop.

                                                                                                                                                  When OSSL_LIB_CTX_new_child() is called from within the scope of a provider's OSSL_provider_init function the currently initialising provider is not yet available in the application's library context and therefore will similarly not yet be available in the newly constructed child library context. As soon as the OSSL_provider_init function returns then the new provider is available in the application's library context and will be similarly mirrored in the child library context.

                                                                                                                                                  OSSL_LIB_CTX_load_config() loads a configuration file using the given ctx. This can be used to associate a library context with providers that are loaded from a configuration.

                                                                                                                                                  OSSL_LIB_CTX_free() frees the given ctx, unless it happens to be the default OpenSSL library context. If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_LIB_CTX_get0_global_default() returns a concrete (non NULL) reference to the global default library context.

                                                                                                                                                  OSSL_LIB_CTX_set0_default() sets the default OpenSSL library context to be ctx in the current thread. The previous default library context is returned. Care should be taken by the caller to restore the previous default library context with a subsequent call of this function. If ctx is NULL then no change is made to the default library context, but a pointer to the current library context is still returned. On a successful call of this function the returned value will always be a concrete (non NULL) library context.

                                                                                                                                                  Care should be taken when changing the default library context and starting async jobs (see ASYNC_start_job(3)), as the default library context when the job is started will be used throughout the lifetime of an async job, no matter how the calling thread makes further default library context changes in the mean time. This means that the calling thread must not free the library context that was the default at the start of the async job before that job has finished.

                                                                                                                                                  "},{"location":"man3/OSSL_LIB_CTX/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_LIB_CTX_new(), OSSL_LIB_CTX_get0_global_default() and OSSL_LIB_CTX_set0_default() return a library context pointer on success, or NULL on error.

                                                                                                                                                  OSSL_LIB_CTX_free() doesn't return any value.

                                                                                                                                                  OSSL_LIB_CTX_load_config() returns 1 on success, 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_LIB_CTX/#history","title":"HISTORY","text":"

                                                                                                                                                  All of the functions described on this page were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_LIB_CTX/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/","title":"OSSL_PARAM","text":""},{"location":"man3/OSSL_PARAM/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_PARAM - a structure to pass or request object parameters

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/core.h>\n\ntypedef struct ossl_param_st OSSL_PARAM;\nstruct ossl_param_st {\n    const char *key;             /* the name of the parameter */\n    unsigned char data_type;     /* declare what kind of content is in data */\n    void *data;                  /* value being passed in or out */\n    size_t data_size;            /* data size */\n    size_t return_size;          /* returned size */\n};\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_PARAM is a type that allows passing arbitrary data for some object between two parties that have no or very little shared knowledge about their respective internal structures for that object.

                                                                                                                                                  A typical usage example could be an application that wants to set some parameters for an object, or wants to find out some parameters of an object.

                                                                                                                                                  Arrays of this type can be used for the following purposes:

                                                                                                                                                  • Setting parameters for some object

                                                                                                                                                    The caller sets up the OSSL_PARAM array and calls some function (the setter) that has intimate knowledge about the object that can take the data from the OSSL_PARAM array and assign them in a suitable form for the internal structure of the object.

                                                                                                                                                  • Request parameters of some object

                                                                                                                                                    The caller (the requester) sets up the OSSL_PARAM array and calls some function (the responder) that has intimate knowledge about the object, which can take the internal data of the object and copy (possibly convert) that to the memory prepared by the requester and pointed at with the OSSL_PARAM data.

                                                                                                                                                  • Request parameter descriptors

                                                                                                                                                    The caller gets an array of constant OSSL_PARAM, which describe available parameters and some of their properties; name, data type and expected data size. For a detailed description of each field for this use, see the field descriptions below.

                                                                                                                                                    The caller may then use the information from this descriptor array to build up its own OSSL_PARAM array to pass down to a setter or responder.

                                                                                                                                                  Normally, the order of the an OSSL_PARAM array is not relevant. However, if the responder can handle multiple elements with the same key, those elements must be handled in the order they are in.

                                                                                                                                                  An OSSL_PARAM array must have a terminating element, where key is NULL. The usual full terminating template is:

                                                                                                                                                  { NULL, 0, NULL, 0, 0 }\n

                                                                                                                                                  This can also be specified using OSSL_PARAM_END(3).

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#functional-support","title":"Functional support","text":"

                                                                                                                                                  Libcrypto offers a limited set of helper functions to handle OSSL_PARAM items and arrays, please see OSSL_PARAM_get_int(3). Developers are free to extend or replace those as they see fit.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#ossl_param-fields","title":"OSSL_PARAM fields","text":"
                                                                                                                                                  • key

                                                                                                                                                    The identity of the parameter in the form of a string.

                                                                                                                                                    In an OSSL_PARAM array, an item with this field set to NULL is considered a terminating item.

                                                                                                                                                  • data_type

                                                                                                                                                    The data_type is a value that describes the type and organization of the data. See \"Supported types\" below for a description of the types.

                                                                                                                                                  • data

                                                                                                                                                  • data_size

                                                                                                                                                    data is a pointer to the memory where the parameter data is (when setting parameters) or shall (when requesting parameters) be stored, and data_size is its size in bytes. The organization of the data depends on the parameter type and flag.

                                                                                                                                                    The data_size needs special attention with the parameter type OSSL_PARAM_UTF8_STRING in relation to C strings. When setting parameters, the size should be set to the length of the string, not counting the terminating NUL byte. When requesting parameters, the size should be set to the size of the buffer to be populated, which should accommodate enough space for a terminating NUL byte.

                                                                                                                                                    When requesting parameters, it's acceptable for data to be NULL. This can be used by the requester to figure out dynamically exactly how much buffer space is needed to store the parameter data. In this case, data_size is ignored.

                                                                                                                                                    When the OSSL_PARAM is used as a parameter descriptor, data should be ignored. If data_size is zero, it means that an arbitrary data size is accepted, otherwise it specifies the maximum size allowed.

                                                                                                                                                  • return_size

                                                                                                                                                    When an array of OSSL_PARAM is used to request data, the responder must set this field to indicate size of the parameter data, including padding as the case may be. In case the data_size is an unsuitable size for the data, the responder must still set this field to indicate the minimum data size required. (further notes on this in \"NOTES\" below).

                                                                                                                                                    When the OSSL_PARAM is used as a parameter descriptor, return_size should be ignored.

                                                                                                                                                  NOTE:

                                                                                                                                                  The key names and associated types are defined by the entity that offers these parameters, i.e. names for parameters provided by the OpenSSL libraries are defined by the libraries, and names for parameters provided by providers are defined by those providers, except for the pointer form of strings (see data type descriptions below). Entities that want to set or request parameters need to know what those keys are and of what type, any functionality between those two entities should remain oblivious and just pass the OSSL_PARAM array along.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#supported-types","title":"Supported types","text":"

                                                                                                                                                  The data_type field can be one of the following types:

                                                                                                                                                  • OSSL_PARAM_INTEGER
                                                                                                                                                  • OSSL_PARAM_UNSIGNED_INTEGER

                                                                                                                                                    The parameter data is an integer (signed or unsigned) of arbitrary length, organized in native form, i.e. most significant byte first on Big-Endian systems, and least significant byte first on Little-Endian systems.

                                                                                                                                                  • OSSL_PARAM_REAL

                                                                                                                                                    The parameter data is a floating point value in native form.

                                                                                                                                                  • OSSL_PARAM_UTF8_STRING

                                                                                                                                                    The parameter data is a printable string.

                                                                                                                                                  • OSSL_PARAM_OCTET_STRING

                                                                                                                                                    The parameter data is an arbitrary string of bytes.

                                                                                                                                                  • OSSL_PARAM_UTF8_PTR

                                                                                                                                                    The parameter data is a pointer to a printable string.

                                                                                                                                                    The difference between this and OSSL_PARAM_UTF8_STRING is that data doesn't point directly at the data, but to a pointer that points to the data.

                                                                                                                                                    If there is any uncertainty about which to use, OSSL_PARAM_UTF8_STRING is almost certainly the correct choice.

                                                                                                                                                    This is used to indicate that constant data is or will be passed, and there is therefore no need to copy the data that is passed, just the pointer to it.

                                                                                                                                                    data_size must be set to the size of the data, not the size of the pointer to the data. If this is used in a parameter request, data_size is not relevant. However, the responder will set return_size to the size of the data.

                                                                                                                                                    Note that the use of this type is fragile and can only be safely used for data that remains constant and in a constant location for a long enough duration (such as the life-time of the entity that offers these parameters).

                                                                                                                                                  • OSSL_PARAM_OCTET_PTR

                                                                                                                                                    The parameter data is a pointer to an arbitrary string of bytes.

                                                                                                                                                    The difference between this and OSSL_PARAM_OCTET_STRING is that data doesn't point directly at the data, but to a pointer that points to the data.

                                                                                                                                                    If there is any uncertainty about which to use, OSSL_PARAM_OCTET_STRING is almost certainly the correct choice.

                                                                                                                                                    This is used to indicate that constant data is or will be passed, and there is therefore no need to copy the data that is passed, just the pointer to it.

                                                                                                                                                    data_size must be set to the size of the data, not the size of the pointer to the data. If this is used in a parameter request, data_size is not relevant. However, the responder will set return_size to the size of the data.

                                                                                                                                                    Note that the use of this type is fragile and can only be safely used for data that remains constant and in a constant location for a long enough duration (such as the life-time of the entity that offers these parameters).

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#notes","title":"NOTES","text":"

                                                                                                                                                  Both when setting and requesting parameters, the functions that are called will have to decide what is and what is not an error. The recommended behaviour is:

                                                                                                                                                  • Keys that a setter or responder doesn't recognise should simply be ignored. That in itself isn't an error.
                                                                                                                                                  • If the keys that a called setter recognises form a consistent enough set of data, that call should succeed.
                                                                                                                                                  • Apart from the return_size, a responder must never change the fields of an OSSL_PARAM. To return a value, it should change the contents of the memory that data points at.
                                                                                                                                                  • If the data type for a key that it's associated with is incorrect, the called function may return an error.

                                                                                                                                                    The called function may also try to convert the data to a suitable form (for example, it's plausible to pass a large number as an octet string, so even though a given key is defined as an OSSL_PARAM_UNSIGNED_INTEGER, is plausible to pass the value as an OSSL_PARAM_OCTET_STRING), but this is in no way mandatory.

                                                                                                                                                  • If data for a OSSL_PARAM_OCTET_STRING or a OSSL_PARAM_UTF8_STRING is NULL, the responder should set return_size to the size of the item to be returned and return success. Later the responder will be called again with data pointing at the place for the value to be put.

                                                                                                                                                  • If a responder finds that some data sizes are too small for the requested data, it must set return_size for each such OSSL_PARAM item to the minimum required size, and eventually return an error.
                                                                                                                                                  • For the integer type parameters (OSSL_PARAM_UNSIGNED_INTEGER and OSSL_PARAM_INTEGER), a responder may choose to return an error if the data_size isn't a suitable size (even if data_size is bigger than needed). If the responder finds the size suitable, it must fill all data_size bytes and ensure correct padding for the native endianness, and set return_size to the same value as data_size.
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  A couple of examples to just show how OSSL_PARAM arrays could be set up.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#example-1","title":"Example 1","text":"

                                                                                                                                                  This example is for setting parameters on some object:

                                                                                                                                                  #include <openssl/core.h>\n\nconst char *foo = \"some string\";\nsize_t foo_l = strlen(foo);\nconst char bar[] = \"some other string\";\nOSSL_PARAM set[] = {\n    { \"foo\", OSSL_PARAM_UTF8_PTR, &foo, foo_l, 0 },\n    { \"bar\", OSSL_PARAM_UTF8_STRING, (void *)&bar, sizeof(bar) - 1, 0 },\n    { NULL, 0, NULL, 0, 0 }\n};\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#example-2","title":"Example 2","text":"

                                                                                                                                                  This example is for requesting parameters on some object:

                                                                                                                                                  const char *foo = NULL;\nsize_t foo_l;\nchar bar[1024];\nsize_t bar_l;\nOSSL_PARAM request[] = {\n    { \"foo\", OSSL_PARAM_UTF8_PTR, &foo, 0 /*irrelevant*/, 0 },\n    { \"bar\", OSSL_PARAM_UTF8_STRING, &bar, sizeof(bar), 0 },\n    { NULL, 0, NULL, 0, 0 }\n};\n

                                                                                                                                                  A responder that receives this array (as params in this example) could fill in the parameters like this:

                                                                                                                                                  /* OSSL_PARAM *params */\n\nint i;\n\nfor (i = 0; params[i].key != NULL; i++) {\n    if (strcmp(params[i].key, \"foo\") == 0) {\n        *(char **)params[i].data = \"foo value\";\n        params[i].return_size = 9; /* length of \"foo value\" string */\n    } else if (strcmp(params[i].key, \"bar\") == 0) {\n        memcpy(params[i].data, \"bar value\", 10);\n        params[i].return_size = 9; /* length of \"bar value\" string */\n    }\n    /* Ignore stuff we don't know */\n}\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  openssl-core.h(7), OSSL_PARAM_get_int(3), OSSL_PARAM_dup(3)

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#history","title":"HISTORY","text":"

                                                                                                                                                  OSSL_PARAM was added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/","title":"OSSL_PARAM_BLD","text":""},{"location":"man3/OSSL_PARAM_BLD/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_PARAM_BLD, OSSL_PARAM_BLD_new, OSSL_PARAM_BLD_to_param, OSSL_PARAM_BLD_free, OSSL_PARAM_BLD_push_int, OSSL_PARAM_BLD_push_uint, OSSL_PARAM_BLD_push_long, OSSL_PARAM_BLD_push_ulong, OSSL_PARAM_BLD_push_int32, OSSL_PARAM_BLD_push_uint32, OSSL_PARAM_BLD_push_int64, OSSL_PARAM_BLD_push_uint64, OSSL_PARAM_BLD_push_size_t, OSSL_PARAM_BLD_push_time_t, OSSL_PARAM_BLD_push_double, OSSL_PARAM_BLD_push_BN, OSSL_PARAM_BLD_push_BN_pad, OSSL_PARAM_BLD_push_utf8_string, OSSL_PARAM_BLD_push_utf8_ptr, OSSL_PARAM_BLD_push_octet_string, OSSL_PARAM_BLD_push_octet_ptr - functions to assist in the creation of OSSL_PARAM arrays

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/param_build.h>\n\ntypedef struct OSSL_PARAM_BLD;\n\nOSSL_PARAM_BLD *OSSL_PARAM_BLD_new(void);\nOSSL_PARAM *OSSL_PARAM_BLD_to_param(OSSL_PARAM_BLD *bld);\nvoid OSSL_PARAM_BLD_free(OSSL_PARAM_BLD *bld);\n\nint OSSL_PARAM_BLD_push_TYPE(OSSL_PARAM_BLD *bld, const char *key, TYPE val);\n\nint OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key,\n                           const BIGNUM *bn);\nint OSSL_PARAM_BLD_push_BN_pad(OSSL_PARAM_BLD *bld, const char *key,\n                               const BIGNUM *bn, size_t sz);\n\nint OSSL_PARAM_BLD_push_utf8_string(OSSL_PARAM_BLD *bld, const char *key,\n                                    const char *buf, size_t bsize);\nint OSSL_PARAM_BLD_push_utf8_ptr(OSSL_PARAM_BLD *bld, const char *key,\n                                 char *buf, size_t bsize);\nint OSSL_PARAM_BLD_push_octet_string(OSSL_PARAM_BLD *bld, const char *key,\n                                     const void *buf, size_t bsize);\nint OSSL_PARAM_BLD_push_octet_ptr(OSSL_PARAM_BLD *bld, const char *key,\n                                  void *buf, size_t bsize);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  A collection of utility functions that simplify the creation of OSSL_PARAM arrays. The TYPE names are as per OSSL_PARAM_int(3).

                                                                                                                                                  OSSL_PARAM_BLD_new() allocates and initialises a new OSSL_PARAM_BLD structure so that values can be added. Any existing values are cleared.

                                                                                                                                                  OSSL_PARAM_BLD_free() deallocates the memory allocates by OSSL_PARAM_BLD_new(). If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_PARAM_BLD_to_param() converts a built up OSSL_PARAM_BLD structure bld into an allocated OSSL_PARAM array. The OSSL_PARAM array and all associated storage must be freed by calling OSSL_PARAM_free() with the functions return value. OSSL_PARAM_BLD_free() can safely be called any time after this function is.

                                                                                                                                                  OSSL_PARAM_BLD_push_TYPE() are a series of functions which will create OSSL_PARAM objects of the specified size and correct type for the val argument. val is stored by value and an expression or auto variable can be used.

                                                                                                                                                  OSSL_PARAM_BLD_push_BN() is a function that will create an OSSL_PARAM object that holds the specified BIGNUM bn. If bn is marked as being securely allocated, its OSSL_PARAM representation will also be securely allocated. The bn argument is stored by reference and the underlying BIGNUM object must exist until after OSSL_PARAM_BLD_to_param() has been called.

                                                                                                                                                  OSSL_PARAM_BLD_push_BN_pad() is a function that will create an OSSL_PARAM object that holds the specified BIGNUM bn. The object will be padded to occupy exactly sz bytes, if insufficient space is specified an error results. If bn is marked as being securely allocated, its OSSL_PARAM representation will also be securely allocated. The bn argument is stored by reference and the underlying BIGNUM object must exist until after OSSL_PARAM_BLD_to_param() has been called.

                                                                                                                                                  OSSL_PARAM_BLD_push_utf8_string() is a function that will create an OSSL_PARAM object that references the UTF8 string specified by buf. The length of the string bsize should not include the terminating NUL byte. If it is zero then it will be calculated. The string that buf points to is stored by reference and must remain in scope until after OSSL_PARAM_BLD_to_param() has been called.

                                                                                                                                                  OSSL_PARAM_BLD_push_octet_string() is a function that will create an OSSL_PARAM object that references the octet string specified by buf and <bsize>. The memory that buf points to is stored by reference and must remain in scope until after OSSL_PARAM_BLD_to_param() has been called.

                                                                                                                                                  OSSL_PARAM_BLD_push_utf8_ptr() is a function that will create an OSSL_PARAM object that references the UTF8 string specified by buf. The length of the string bsize should not include the terminating NUL byte. If it is zero then it will be calculated. The string buf points to is stored by reference and must remain in scope until the OSSL_PARAM array is freed.

                                                                                                                                                  OSSL_PARAM_BLD_push_octet_ptr() is a function that will create an OSSL_PARAM object that references the octet string specified by buf. The memory buf points to is stored by reference and must remain in scope until the OSSL_PARAM array is freed.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_PARAM_BLD_new() returns the allocated OSSL_PARAM_BLD structure, or NULL on error.

                                                                                                                                                  OSSL_PARAM_BLD_to_param() returns the allocated OSSL_PARAM array, or NULL on error.

                                                                                                                                                  All of the OSSL_PARAM_BLD_push_TYPE functions return 1 on success and 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#notes","title":"NOTES","text":"

                                                                                                                                                  OSSL_PARAM_BLD_push_BN() and OSSL_PARAM_BLD_push_BN_pad() currently only support nonnegative BIGNUMs. They return an error on negative BIGNUMs.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  Both examples creating an OSSL_PARAM array that contains an RSA key. For both, the predefined key variables are:

                                                                                                                                                  BIGNUM *n;           /* modulus */\nunsigned int e;      /* public exponent */\nBIGNUM *d;           /* private exponent */\nBIGNUM *p, *q;       /* first two prime factors */\nBIGNUM *dmp1, *dmq1; /* first two CRT exponents */\nBIGNUM *iqmp;        /* first CRT coefficient */\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#example-1","title":"Example 1","text":"

                                                                                                                                                  This example shows how to create an OSSL_PARAM array that contains an RSA private key.

                                                                                                                                                  OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();\nOSSL_PARAM *params = NULL;\n\nif (bld == NULL\n    || !OSSL_PARAM_BLD_push_BN(bld, \"n\", n)\n    || !OSSL_PARAM_BLD_push_uint(bld, \"e\", e)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"d\", d)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-factor1\", p)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-factor2\", q)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-exponent1\", dmp1)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-exponent2\", dmq1)\n    || !OSSL_PARAM_BLD_push_BN(bld, \"rsa-coefficient1\", iqmp)\n    || (params = OSSL_PARAM_BLD_to_param(bld)) == NULL)\n    goto err;\nOSSL_PARAM_BLD_free(bld);\n/* Use params */\n...\nOSSL_PARAM_free(params);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#example-2","title":"Example 2","text":"

                                                                                                                                                  This example shows how to create an OSSL_PARAM array that contains an RSA public key.

                                                                                                                                                  OSSL_PARAM_BLD *bld = OSSL_PARAM_BLD_new();\nOSSL_PARAM *params = NULL;\n\nif (nld == NULL\n    || !OSSL_PARAM_BLD_push_BN(bld, \"n\", n)\n    || !OSSL_PARAM_BLD_push_uint(bld, \"e\", e)\n    || (params = OSSL_PARAM_BLD_to_param(bld)) == NULL)\n    goto err;\nOSSL_PARAM_BLD_free(bld);\n/* Use params */\n...\nOSSL_PARAM_free(params);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_PARAM_int(3), OSSL_PARAM(3), OSSL_PARAM_free(3)

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions described here were all added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_BLD/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/","title":"OSSL_PARAM_allocate_from_text","text":""},{"location":"man3/OSSL_PARAM_allocate_from_text/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_PARAM_allocate_from_text - OSSL_PARAM construction utilities

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/params.h>\n\nint OSSL_PARAM_allocate_from_text(OSSL_PARAM *to,\n                                  const OSSL_PARAM *paramdefs,\n                                  const char *key, const char *value,\n                                  size_t value_n,\n                                  int *found);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  With OpenSSL before version 3.0, parameters were passed down to or retrieved from algorithm implementations via control functions. Some of these control functions existed in variants that took string parameters, for example EVP_PKEY_CTX_ctrl_str(3).

                                                                                                                                                  OpenSSL 3.0 introduces a new mechanism to do the same thing with an array of parameters that contain name, value, value type and value size (see OSSL_PARAM(3) for more information).

                                                                                                                                                  OSSL_PARAM_allocate_from_text() uses key to look up an item in paramdefs. If an item was found, it converts value to something suitable for that item's data_type, and stores the result in to->data as well as its size in to->data_size. to->key and to->data_type are assigned the corresponding values from the item that was found, and to->return_size is set to zero.

                                                                                                                                                  to->data is always allocated using OPENSSL_zalloc(3) and needs to be freed by the caller when it's not useful any more, using OPENSSL_free(3).

                                                                                                                                                  If found is not NULL, *found is set to 1 if key could be located in paramdefs, and to 0 otherwise.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#the-use-of-key-and-value-in-detail","title":"The use of key and value in detail","text":"

                                                                                                                                                  OSSL_PARAM_allocate_from_text() takes note if key starts with \"hex\", and will only use the rest of key to look up an item in paramdefs in that case. As an example, if key is \"hexid\", \"id\" will be looked up in paramdefs.

                                                                                                                                                  When an item in paramdefs has been found, value is converted depending on that item's data_type, as follows:

                                                                                                                                                  • OSSL_PARAM_INTEGER and OSSL_PARAM_UNSIGNED_INTEGER

                                                                                                                                                    If key didn't start with \"hex\", value is assumed to contain value_n decimal characters, which are decoded, and the resulting bytes become the number stored in the to->data storage.

                                                                                                                                                    If value starts with \"0x\", it is assumed to contain value_n hexadecimal characters.

                                                                                                                                                    If key started with \"hex\", value is assumed to contain value_n hexadecimal characters without the \"0x\" prefix.

                                                                                                                                                    If value contains characters that couldn't be decoded as hexadecimal or decimal characters, OSSL_PARAM_allocate_from_text() considers that an error.

                                                                                                                                                  • OSSL_PARAM_UTF8_STRING

                                                                                                                                                    If key started with \"hex\", OSSL_PARAM_allocate_from_text() considers that an error.

                                                                                                                                                    Otherwise, value is considered a C string and is copied to the to->data storage. On systems where the native character encoding is EBCDIC, the bytes in to->data are converted to ASCII.

                                                                                                                                                  • OSSL_PARAM_OCTET_STRING

                                                                                                                                                    If key started with \"hex\", value is assumed to contain value_n hexadecimal characters, which are decoded, and the resulting bytes are stored in the to->data storage. If value contains characters that couldn't be decoded as hexadecimal or decimal characters, OSSL_PARAM_allocate_from_text() considers that an error.

                                                                                                                                                    If key didn't start with \"hex\", value_n bytes from value are copied to the to->data storage.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_PARAM_allocate_from_text() returns 1 if key was found in paramdefs and there was no other failure, otherwise 0.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#notes","title":"NOTES","text":"

                                                                                                                                                  The parameter descriptor array comes from functions dedicated to return them. The following OSSL_PARAM(3) attributes are used:

                                                                                                                                                  • key
                                                                                                                                                  • data_type
                                                                                                                                                  • data_size

                                                                                                                                                  All other attributes are ignored.

                                                                                                                                                  The data_size attribute can be zero, meaning that the parameter it describes expects arbitrary length data.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  Code that looked like this:

                                                                                                                                                  int mac_ctrl_string(EVP_PKEY_CTX *ctx, const char *value)\n{\n    int rv;\n    char *stmp, *vtmp = NULL;\n\n    stmp = OPENSSL_strdup(value);\n    if (stmp == NULL)\n        return -1;\n    vtmp = strchr(stmp, ':');\n    if (vtmp != NULL)\n        *vtmp++ = '\\0';\n    rv = EVP_MAC_ctrl_str(ctx, stmp, vtmp);\n    OPENSSL_free(stmp);\n    return rv;\n}\n\n...\n\n\nfor (i = 0; i < sk_OPENSSL_STRING_num(macopts); i++) {\n    char *macopt = sk_OPENSSL_STRING_value(macopts, i);\n\n    if (pkey_ctrl_string(mac_ctx, macopt) <= 0) {\n        BIO_printf(bio_err,\n                   \"MAC parameter error \\\"%s\\\"\\n\", macopt);\n        ERR_print_errors(bio_err);\n        goto mac_end;\n    }\n}\n

                                                                                                                                                  Can be written like this instead:

                                                                                                                                                   OSSL_PARAM *params =\n     OPENSSL_zalloc(sizeof(*params)\n                    * (sk_OPENSSL_STRING_num(opts) + 1));\n const OSSL_PARAM *paramdefs = EVP_MAC_settable_ctx_params(mac);\n size_t params_n;\n char *opt = \"<unknown>\";\n\n for (params_n = 0; params_n < (size_t)sk_OPENSSL_STRING_num(opts);\n      params_n++) {\n     char *stmp, *vtmp = NULL;\n\n     opt = sk_OPENSSL_STRING_value(opts, (int)params_n);\n     if ((stmp = OPENSSL_strdup(opt)) == NULL\n             || (vtmp = strchr(stmp, ':')) == NULL)\n         goto err;\n\n     *vtmp++ = '\\0';\n     if (!OSSL_PARAM_allocate_from_text(&params[params_n],\n                                        paramdefs, stmp,\n                                        vtmp, strlen(vtmp), NULL))\n         goto err;\n }\n params[params_n] = OSSL_PARAM_construct_end();\n if (!EVP_MAC_CTX_set_params(ctx, params))\n     goto err;\n while (params_n-- > 0)\n     OPENSSL_free(params[params_n].data);\n OPENSSL_free(params);\n /* ... */\n return;\n\nerr:\n BIO_printf(bio_err, \"MAC parameter error '%s'\\n\", opt);\n ERR_print_errors(bio_err);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_PARAM(3), OSSL_PARAM_int(3)

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_allocate_from_text/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_dup/","title":"OSSL_PARAM_dup","text":""},{"location":"man3/OSSL_PARAM_dup/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_PARAM_dup, OSSL_PARAM_merge, OSSL_PARAM_free - OSSL_PARAM array copy functions

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_dup/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/params.h>\n\nOSSL_PARAM *OSSL_PARAM_dup(const OSSL_PARAM *params);\nOSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *params, const OSSL_PARAM *params1);\nvoid OSSL_PARAM_free(OSSL_PARAM *params);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_dup/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  Algorithm parameters can be exported/imported from/to providers using arrays of OSSL_PARAM(3). The following utility functions allow the parameters to be duplicated and merged with other OSSL_PARAM(3) to assist in this process.

                                                                                                                                                  OSSL_PARAM_dup() duplicates the parameter array params. This function does a deep copy of the data.

                                                                                                                                                  OSSL_PARAM_merge() merges the parameter arrays params and params1 into a new parameter array. If params and params1 contain values with the same 'key' then the value from params1 will replace the param value. This function does a shallow copy of the parameters. Either params or params1 may be NULL. The behaviour of the merge is unpredictable if params and params1 contain the same key, and there are multiple entries within either array that have the same key.

                                                                                                                                                  OSSL_PARAM_free() frees the parameter array params that was created using OSSL_PARAM_dup(), OSSL_PARAM_merge() or OSSL_PARAM_BLD_to_param(). If the argument to OSSL_PARAM_free() is NULL, nothing is done.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_dup/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  The functions OSSL_PARAM_dup() and OSSL_PARAM_merge() return a newly allocated OSSL_PARAM(3) array, or NULL if there was an error. If both parameters are NULL then NULL is returned.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_dup/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  OSSL_PARAM(3), OSSL_PARAM_BLD(3)

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_dup/#history","title":"HISTORY","text":"

                                                                                                                                                  The functions were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_dup/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/","title":"OSSL_PARAM_int","text":""},{"location":"man3/OSSL_PARAM_int/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_PARAM_double, OSSL_PARAM_int, OSSL_PARAM_int32, OSSL_PARAM_int64, OSSL_PARAM_long, OSSL_PARAM_size_t, OSSL_PARAM_time_t, OSSL_PARAM_uint, OSSL_PARAM_uint32, OSSL_PARAM_uint64, OSSL_PARAM_ulong, OSSL_PARAM_BN, OSSL_PARAM_utf8_string, OSSL_PARAM_octet_string, OSSL_PARAM_utf8_ptr, OSSL_PARAM_octet_ptr, OSSL_PARAM_END, OSSL_PARAM_DEFN, OSSL_PARAM_construct_double, OSSL_PARAM_construct_int, OSSL_PARAM_construct_int32, OSSL_PARAM_construct_int64, OSSL_PARAM_construct_long, OSSL_PARAM_construct_size_t, OSSL_PARAM_construct_time_t, OSSL_PARAM_construct_uint, OSSL_PARAM_construct_uint32, OSSL_PARAM_construct_uint64, OSSL_PARAM_construct_ulong, OSSL_PARAM_construct_BN, OSSL_PARAM_construct_utf8_string, OSSL_PARAM_construct_utf8_ptr, OSSL_PARAM_construct_octet_string, OSSL_PARAM_construct_octet_ptr, OSSL_PARAM_construct_end, OSSL_PARAM_locate, OSSL_PARAM_locate_const, OSSL_PARAM_get_double, OSSL_PARAM_get_int, OSSL_PARAM_get_int32, OSSL_PARAM_get_int64, OSSL_PARAM_get_long, OSSL_PARAM_get_size_t, OSSL_PARAM_get_time_t, OSSL_PARAM_get_uint, OSSL_PARAM_get_uint32, OSSL_PARAM_get_uint64, OSSL_PARAM_get_ulong, OSSL_PARAM_get_BN, OSSL_PARAM_get_utf8_string, OSSL_PARAM_get_octet_string, OSSL_PARAM_get_utf8_ptr, OSSL_PARAM_get_octet_ptr, OSSL_PARAM_get_utf8_string_ptr, OSSL_PARAM_get_octet_string_ptr, OSSL_PARAM_set_double, OSSL_PARAM_set_int, OSSL_PARAM_set_int32, OSSL_PARAM_set_int64, OSSL_PARAM_set_long, OSSL_PARAM_set_size_t, OSSL_PARAM_set_time_t, OSSL_PARAM_set_uint, OSSL_PARAM_set_uint32, OSSL_PARAM_set_uint64, OSSL_PARAM_set_ulong, OSSL_PARAM_set_BN, OSSL_PARAM_set_utf8_string, OSSL_PARAM_set_octet_string, OSSL_PARAM_set_utf8_ptr, OSSL_PARAM_set_octet_ptr, OSSL_PARAM_UNMODIFIED, OSSL_PARAM_modified, OSSL_PARAM_set_all_unmodified - OSSL_PARAM helpers

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/params.h>\n\n/*\n * TYPE in function names is one of:\n * double, int, int32, int64, long, size_t, time_t, uint, uint32, uint64, ulong\n * Corresponding TYPE in function arguments is one of:\n * double, int, int32_t, int64_t, long, size_t, time_t, unsigned int, uint32_t,\n * uint64_t, unsigned long\n */\n\n#define OSSL_PARAM_TYPE(key, address)\n#define OSSL_PARAM_BN(key, address, size)\n#define OSSL_PARAM_utf8_string(key, address, size)\n#define OSSL_PARAM_octet_string(key, address, size)\n#define OSSL_PARAM_utf8_ptr(key, address, size)\n#define OSSL_PARAM_octet_ptr(key, address, size)\n#define OSSL_PARAM_END\n\n#define OSSL_PARAM_UNMODIFIED\n\n#define OSSL_PARAM_DEFN(key, type, addr, sz)    \\\n   { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }\n\nOSSL_PARAM OSSL_PARAM_construct_TYPE(const char *key, TYPE *buf);\nOSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf,\n                                   size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf,\n                                            size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf,\n                                             size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf,\n                                         size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf,\n                                          size_t bsize);\nOSSL_PARAM OSSL_PARAM_construct_end(void);\n\nOSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *array, const char *key);\nconst OSSL_PARAM *OSSL_PARAM_locate_const(const OSSL_PARAM *array,\n                                          const char *key);\n\nint OSSL_PARAM_get_TYPE(const OSSL_PARAM *p, TYPE *val);\nint OSSL_PARAM_set_TYPE(OSSL_PARAM *p, TYPE val);\n\nint OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val);\nint OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val);\n\nint OSSL_PARAM_get_utf8_string(const OSSL_PARAM *p, char **val,\n                               size_t max_len);\nint OSSL_PARAM_set_utf8_string(OSSL_PARAM *p, const char *val);\n\nint OSSL_PARAM_get_octet_string(const OSSL_PARAM *p, void **val,\n                                size_t max_len, size_t *used_len);\nint OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val, size_t len);\n\nint OSSL_PARAM_get_utf8_ptr(const OSSL_PARAM *p, const char **val);\nint OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val);\n\nint OSSL_PARAM_get_octet_ptr(const OSSL_PARAM *p, const void **val,\n                             size_t *used_len);\nint OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val,\n                             size_t used_len);\n\nint OSSL_PARAM_get_utf8_string_ptr(const OSSL_PARAM *p, const char **val);\nint OSSL_PARAM_get_octet_string_ptr(const OSSL_PARAM *p, const void **val,\n                                    size_t *used_len);\n\nint OSSL_PARAM_modified(const OSSL_PARAM *param);\nvoid OSSL_PARAM_set_all_unmodified(OSSL_PARAM *params);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  A collection of utility functions that simplify and add type safety to the OSSL_PARAM(3) arrays. The following TYPE names are supported:

                                                                                                                                                  • double
                                                                                                                                                  • int
                                                                                                                                                  • int32 (int32_t)
                                                                                                                                                  • int64 (int64_t)
                                                                                                                                                  • long int (long)
                                                                                                                                                  • time_t
                                                                                                                                                  • size_t
                                                                                                                                                  • uint32 (uint32_t)
                                                                                                                                                  • uint64 (uint64_t)
                                                                                                                                                  • unsigned int (uint)
                                                                                                                                                  • unsigned long int (ulong)

                                                                                                                                                  OSSL_PARAM_TYPE() are a series of macros designed to assist initialising an array of OSSL_PARAM(3) structures. Each of these macros defines a parameter of the specified TYPE with the provided key and parameter variable address.

                                                                                                                                                  OSSL_PARAM_utf8_string(), OSSL_PARAM_octet_string(), OSSL_PARAM_utf8_ptr(), OSSL_PARAM_octet_ptr(), OSSL_PARAM_BN() are macros that provide support for defining UTF8 strings, OCTET strings and big numbers. A parameter with name key is defined. The storage for this parameter is at address and is of size bytes.

                                                                                                                                                  OSSL_PARAM_END provides an end of parameter list marker. This should terminate all OSSL_PARAM(3) arrays.

                                                                                                                                                  The OSSL_PARAM_DEFN() macro provides the ability to construct a single OSSL_PARAM(3) (typically used in the construction of OSSL_PARAM arrays). The key, type, addr and sz arguments correspond to the key, data_type, data and data_size fields of the OSSL_PARAM(3) structure as described on the OSSL_PARAM(3) page.

                                                                                                                                                  OSSL_PARAM_construct_TYPE() are a series of functions that create OSSL_PARAM(3) records dynamically. A parameter with name key is created. The parameter will use storage pointed to by buf and return size of ret.

                                                                                                                                                  OSSL_PARAM_construct_BN() is a function that constructs a large integer OSSL_PARAM(3) structure. A parameter with name key, storage buf, size bsize and return size rsize is created.

                                                                                                                                                  OSSL_PARAM_construct_utf8_string() is a function that constructs a UTF8 string OSSL_PARAM(3) structure. A parameter with name key, storage buf and size bsize is created. If bsize is zero, the string length is determined using strlen(3). Generally pass zero for bsize instead of calling strlen(3) yourself.

                                                                                                                                                  OSSL_PARAM_construct_octet_string() is a function that constructs an OCTET string OSSL_PARAM(3) structure. A parameter with name key, storage buf and size bsize is created.

                                                                                                                                                  OSSL_PARAM_construct_utf8_ptr() is a function that constructs a UTF8 string pointer OSSL_PARAM(3) structure. A parameter with name key, storage pointer *buf and size bsize is created.

                                                                                                                                                  OSSL_PARAM_construct_octet_ptr() is a function that constructs an OCTET string pointer OSSL_PARAM(3) structure. A parameter with name key, storage pointer *buf and size bsize is created.

                                                                                                                                                  OSSL_PARAM_construct_end() is a function that constructs the terminating OSSL_PARAM(3) structure.

                                                                                                                                                  OSSL_PARAM_locate() is a function that searches an array of parameters for the one matching the key name.

                                                                                                                                                  OSSL_PARAM_locate_const() behaves exactly like OSSL_PARAM_locate() except for the presence of const for the array argument and its return value.

                                                                                                                                                  OSSL_PARAM_get_TYPE() retrieves a value of type TYPE from the parameter p. The value is copied to the address val. Type coercion takes place as discussed in the NOTES section.

                                                                                                                                                  OSSL_PARAM_set_TYPE() stores a value val of type TYPE into the parameter p. If the parameter's data field is NULL, then only its return_size field will be assigned the size the parameter's data buffer should have. Type coercion takes place as discussed in the NOTES section.

                                                                                                                                                  OSSL_PARAM_get_BN() retrieves a BIGNUM from the parameter pointed to by p. The BIGNUM referenced by val is updated and is allocated if *val is NULL.

                                                                                                                                                  OSSL_PARAM_set_BN() stores the BIGNUM val into the parameter p. If the parameter's data field is NULL, then only its return_size field will be assigned the size the parameter's data buffer should have.

                                                                                                                                                  OSSL_PARAM_get_utf8_string() retrieves a UTF8 string from the parameter pointed to by p. The string is stored into *val with a size limit of max_len, which must be large enough to accommodate a terminating NUL byte, otherwise this function will fail. If *val is NULL, memory is allocated for the string (including the terminating NUL byte) and max_len is ignored. If memory is allocated by this function, it must be freed by the caller.

                                                                                                                                                  OSSL_PARAM_set_utf8_string() sets a UTF8 string from the parameter pointed to by p to the value referenced by val. If the parameter's data field isn't NULL, its data_size must indicate that the buffer is large enough to accommodate the string that val points at, not including the terminating NUL byte, or this function will fail. A terminating NUL byte is added only if the parameter's data_size indicates the buffer is longer than the string length, otherwise the string will not be NUL terminated. If the parameter's data field is NULL, then only its return_size field will be assigned the minimum size the parameter's data buffer should have to accommodate the string, not including a terminating NUL byte.

                                                                                                                                                  OSSL_PARAM_get_octet_string() retrieves an OCTET string from the parameter pointed to by p. The OCTETs are either stored into *val with a length limit of max_len or, in the case when *val is NULL, memory is allocated and max_len is ignored. *used_len is populated with the number of OCTETs stored. If val is NULL then the OCTETS are not stored, but *used_len is still populated. If memory is allocated by this function, it must be freed by the caller.

                                                                                                                                                  OSSL_PARAM_set_octet_string() sets an OCTET string from the parameter pointed to by p to the value referenced by val. If the parameter's data field is NULL, then only its return_size field will be assigned the size the parameter's data buffer should have.

                                                                                                                                                  OSSL_PARAM_get_utf8_ptr() retrieves the UTF8 string pointer from the parameter referenced by p and stores it in *val.

                                                                                                                                                  OSSL_PARAM_set_utf8_ptr() sets the UTF8 string pointer in the parameter referenced by p to the values val.

                                                                                                                                                  OSSL_PARAM_get_octet_ptr() retrieves the OCTET string pointer from the parameter referenced by p and stores it in *val. The length of the OCTET string is stored in *used_len.

                                                                                                                                                  OSSL_PARAM_set_octet_ptr() sets the OCTET string pointer in the parameter referenced by p to the values val. The length of the OCTET string is provided by used_len.

                                                                                                                                                  OSSL_PARAM_get_utf8_string_ptr() retrieves the pointer to a UTF8 string from the parameter pointed to by p, and stores that pointer in *val. This is different from OSSL_PARAM_get_utf8_string(), which copies the string.

                                                                                                                                                  OSSL_PARAM_get_octet_string_ptr() retrieves the pointer to a octet string from the parameter pointed to by p, and stores that pointer in *val, along with the string's length in *used_len. This is different from OSSL_PARAM_get_octet_string(), which copies the string.

                                                                                                                                                  The OSSL_PARAM_UNMODIFIED macro is used to detect if a parameter was set. On creation, via either the macros or construct calls, the return_size field is set to this. If the parameter is set using the calls defined herein, the return_size field is changed.

                                                                                                                                                  OSSL_PARAM_modified() queries if the parameter param has been set or not using the calls defined herein.

                                                                                                                                                  OSSL_PARAM_set_all_unmodified() resets the unused indicator for all parameters in the array params.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_PARAM_construct_TYPE(), OSSL_PARAM_construct_BN(), OSSL_PARAM_construct_utf8_string(), OSSL_PARAM_construct_octet_string(), OSSL_PARAM_construct_utf8_ptr() and OSSL_PARAM_construct_octet_ptr() return a populated OSSL_PARAM(3) structure.

                                                                                                                                                  OSSL_PARAM_locate() and OSSL_PARAM_locate_const() return a pointer to the matching OSSL_PARAM(3) object. They return NULL on error or when no object matching key exists in the array.

                                                                                                                                                  OSSL_PARAM_modified() returns 1 if the parameter was set and 0 otherwise.

                                                                                                                                                  All other functions return 1 on success and 0 on failure.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#notes","title":"NOTES","text":"

                                                                                                                                                  Native types will be converted as required only if the value is exactly representable by the target type or parameter. Apart from that, the functions must be used appropriately for the expected type of the parameter.

                                                                                                                                                  OSSL_PARAM_get_BN() and OSSL_PARAM_set_BN() currently only support nonnegative BIGNUMs, and by consequence, only OSSL_PARAM_UNSIGNED_INTEGER. OSSL_PARAM_construct_BN() currently constructs an OSSL_PARAM(3) structure with the data type OSSL_PARAM_UNSIGNED_INTEGER.

                                                                                                                                                  For OSSL_PARAM_construct_utf8_ptr() and OSSL_PARAM_consstruct_octet_ptr(), bsize is not relevant if the purpose is to send the OSSL_PARAM(3) array to a responder, i.e. to get parameter data back. In that case, bsize can safely be given zero. See \"DESCRIPTION\" in OSSL_PARAM(3) for further information on the possible purposes.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  Reusing the examples from OSSL_PARAM(3) to just show how OSSL_PARAM(3) arrays can be handled using the macros and functions defined herein.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#example-1","title":"Example 1","text":"

                                                                                                                                                  This example is for setting parameters on some object:

                                                                                                                                                  #include <openssl/core.h>\n\nconst char *foo = \"some string\";\nsize_t foo_l = strlen(foo);\nconst char bar[] = \"some other string\";\nconst OSSL_PARAM set[] = {\n    OSSL_PARAM_utf8_ptr(\"foo\", &foo, foo_l),\n    OSSL_PARAM_utf8_string(\"bar\", bar, sizeof(bar) - 1),\n    OSSL_PARAM_END\n};\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#example-2","title":"Example 2","text":"

                                                                                                                                                  This example is for requesting parameters on some object, and also demonstrates that the requester isn't obligated to request all available parameters:

                                                                                                                                                  const char *foo = NULL;\nchar bar[1024];\nOSSL_PARAM request[] = {\n    OSSL_PARAM_utf8_ptr(\"foo\", &foo, 0),\n    OSSL_PARAM_utf8_string(\"bar\", bar, sizeof(bar)),\n    OSSL_PARAM_END\n};\n

                                                                                                                                                  A responder that receives this array (as params in this example) could fill in the parameters like this:

                                                                                                                                                  /* OSSL_PARAM *params */\n\nOSSL_PARAM *p;\n\nif ((p = OSSL_PARAM_locate(params, \"foo\")) != NULL)\n    OSSL_PARAM_set_utf8_ptr(p, \"foo value\");\nif ((p = OSSL_PARAM_locate(params, \"bar\")) != NULL)\n    OSSL_PARAM_set_utf8_string(p, \"bar value\");\nif ((p = OSSL_PARAM_locate(params, \"cookie\")) != NULL)\n    OSSL_PARAM_set_utf8_ptr(p, \"cookie value\");\n
                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  openssl-core.h(7), OSSL_PARAM(3)

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#history","title":"HISTORY","text":"

                                                                                                                                                  These APIs were introduced in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_PARAM_int/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/","title":"OSSL_PROVIDER","text":""},{"location":"man3/OSSL_PROVIDER/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_PROVIDER_set_default_search_path, OSSL_PROVIDER, OSSL_PROVIDER_load, OSSL_PROVIDER_try_load, OSSL_PROVIDER_unload, OSSL_PROVIDER_available, OSSL_PROVIDER_do_all, OSSL_PROVIDER_gettable_params, OSSL_PROVIDER_get_params, OSSL_PROVIDER_query_operation, OSSL_PROVIDER_unquery_operation, OSSL_PROVIDER_get0_provider_ctx, OSSL_PROVIDER_get0_dispatch, OSSL_PROVIDER_add_builtin, OSSL_PROVIDER_get0_name, OSSL_PROVIDER_get_capabilities, OSSL_PROVIDER_self_test - provider routines

                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/provider.h>\n\ntypedef struct ossl_provider_st OSSL_PROVIDER;\n\nint OSSL_PROVIDER_set_default_search_path(OSSL_LIB_CTX *libctx,\n                                          const char *path);\n\nOSSL_PROVIDER *OSSL_PROVIDER_load(OSSL_LIB_CTX *libctx, const char *name);\nOSSL_PROVIDER *OSSL_PROVIDER_try_load(OSSL_LIB_CTX *libctx, const char *name,\n                                      int retain_fallbacks);\nint OSSL_PROVIDER_unload(OSSL_PROVIDER *prov);\nint OSSL_PROVIDER_available(OSSL_LIB_CTX *libctx, const char *name);\nint OSSL_PROVIDER_do_all(OSSL_LIB_CTX *ctx,\n                         int (*cb)(OSSL_PROVIDER *provider, void *cbdata),\n                         void *cbdata);\n\nconst OSSL_PARAM *OSSL_PROVIDER_gettable_params(OSSL_PROVIDER *prov);\nint OSSL_PROVIDER_get_params(OSSL_PROVIDER *prov, OSSL_PARAM params[]);\n\nconst OSSL_ALGORITHM *OSSL_PROVIDER_query_operation(const OSSL_PROVIDER *prov,\n                                                    int operation_id,\n                                                    int *no_cache);\nvoid OSSL_PROVIDER_unquery_operation(const OSSL_PROVIDER *prov,\n                                     int operation_id,\n                                     const OSSL_ALGORITHM *algs);\nvoid *OSSL_PROVIDER_get0_provider_ctx(const OSSL_PROVIDER *prov);\nconst OSSL_DISPATCH *OSSL_PROVIDER_get0_dispatch(const OSSL_PROVIDER *prov);\n\nint OSSL_PROVIDER_add_builtin(OSSL_LIB_CTX *libctx, const char *name,\n                              ossl_provider_init_fn *init_fn);\n\nconst char *OSSL_PROVIDER_get0_name(const OSSL_PROVIDER *prov);\n\nint OSSL_PROVIDER_get_capabilities(const OSSL_PROVIDER *prov,\n                                   const char *capability,\n                                   OSSL_CALLBACK *cb,\n                                   void *arg);\nint OSSL_PROVIDER_self_test(const OSSL_PROVIDER *prov);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  OSSL_PROVIDER is a type that holds internal information about implementation providers (see provider(7) for information on what a provider is). A provider can be built in to the application or the OpenSSL libraries, or can be a loadable module. The functions described here handle both forms.

                                                                                                                                                  Some of these functions operate within a library context, please see OSSL_LIB_CTX(3) for further details.

                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#functions","title":"Functions","text":"

                                                                                                                                                  OSSL_PROVIDER_set_default_search_path() specifies the default search path that is to be used for looking for providers in the specified libctx. If left unspecified, an environment variable and a fall back default value will be used instead.

                                                                                                                                                  OSSL_PROVIDER_add_builtin() is used to add a built in provider to OSSL_PROVIDER store in the given library context, by associating a provider name with a provider initialization function. This name can then be used with OSSL_PROVIDER_load().

                                                                                                                                                  OSSL_PROVIDER_load() loads and initializes a provider. This may simply initialize a provider that was previously added with OSSL_PROVIDER_add_builtin() and run its given initialization function, or load a provider module with the given name and run its provider entry point, OSSL_provider_init. The name can be a path to a provider module, in that case the provider name as returned by OSSL_PROVIDER_get0_name() will be the path. Interpretation of relative paths is platform dependent and they are relative to the configured \"MODULESDIR\" directory or the path set in the environment variable OPENSSL_MODULES if set.

                                                                                                                                                  OSSL_PROVIDER_try_load() functions like OSSL_PROVIDER_load(), except that it does not disable the fallback providers if the provider cannot be loaded and initialized or if retain_fallbacks is nonzero. If the provider loads successfully and retain_fallbacks is zero, the fallback providers are disabled.

                                                                                                                                                  OSSL_PROVIDER_unload() unloads the given provider. For a provider added with OSSL_PROVIDER_add_builtin(), this simply runs its teardown function.

                                                                                                                                                  OSSL_PROVIDER_available() checks if a named provider is available for use.

                                                                                                                                                  OSSL_PROVIDER_do_all() iterates over all loaded providers, calling cb for each one, with the current provider in provider and the cbdata that comes from the caller. If no other provider has been loaded before calling this function, the default provider is still available as fallback. See OSSL_PROVIDER-default(7) for more information on this fallback behaviour.

                                                                                                                                                  OSSL_PROVIDER_gettable_params() is used to get a provider parameter descriptor set as a constant OSSL_PARAM(3) array.

                                                                                                                                                  OSSL_PROVIDER_get_params() is used to get provider parameter values. The caller must prepare the OSSL_PARAM(3) array before calling this function, and the variables acting as buffers for this parameter array should be filled with data when it returns successfully.

                                                                                                                                                  OSSL_PROVIDER_self_test() is used to run a provider's self tests on demand. If the self tests fail then the provider will fail to provide any further services and algorithms. OSSL_SELF_TEST_set_callback(3) may be called beforehand in order to display diagnostics for the running self tests.

                                                                                                                                                  OSSL_PROVIDER_query_operation() calls the provider's query_operation function (see provider(7)), if the provider has one. It returns an array of OSSL_ALGORITHM for the given operation_id terminated by an all NULL OSSL_ALGORITHM entry. This is considered a low-level function that most applications should not need to call.

                                                                                                                                                  OSSL_PROVIDER_unquery_operation() calls the provider's unquery_operation function (see provider(7)), if the provider has one. This is considered a low-level function that most applications should not need to call.

                                                                                                                                                  OSSL_PROVIDER_get0_provider_ctx() returns the provider context for the given provider. The provider context is an opaque handle set by the provider itself and is passed back to the provider by libcrypto in various function calls.

                                                                                                                                                  OSSL_PROVIDER_get0_dispatch() returns the provider's dispatch table as it was returned in the out parameter from the provider's init function. See provider-base(7).

                                                                                                                                                  If it is permissible to cache references to this array then *no_store is set to 0 or 1 otherwise. If the array is not cacheable then it is assumed to have a short lifetime.

                                                                                                                                                  OSSL_PROVIDER_get0_name() returns the name of the given provider.

                                                                                                                                                  OSSL_PROVIDER_get_capabilities() provides information about the capabilities supported by the provider specified in prov with the capability name capability. For each capability of that name supported by the provider it will call the callback cb and supply a set of OSSL_PARAM(3)s describing the capability. It will also pass back the argument arg. For more details about capabilities and what they can be used for please see \"CAPABILTIIES\" in provider-base(7).

                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                  OSSL_PROVIDER_set_default_search_path(), OSSL_PROVIDER_add(), OSSL_PROVIDER_unload(), OSSL_PROVIDER_get_params() and OSSL_PROVIDER_get_capabilities() return 1 on success, or 0 on error.

                                                                                                                                                  OSSL_PROVIDER_load() and OSSL_PROVIDER_try_load() return a pointer to a provider object on success, or NULL on error.

                                                                                                                                                  OSSL_PROVIDER_do_all() returns 1 if the callback cb returns 1 for every provider it is called with, or 0 if any provider callback invocation returns 0; callback processing stops at the first callback invocation on a provider that returns 0.

                                                                                                                                                  OSSL_PROVIDER_available() returns 1 if the named provider is available, otherwise 0.

                                                                                                                                                  OSSL_PROVIDER_gettable_params() returns a pointer to an array of constant OSSL_PARAM(3), or NULL if none is provided.

                                                                                                                                                  OSSL_PROVIDER_get_params() and returns 1 on success, or 0 on error.

                                                                                                                                                  OSSL_PROVIDER_query_operation() returns an array of OSSL_ALGORITHM or NULL on error.

                                                                                                                                                  OSSL_PROVIDER_self_test() returns 1 if the self tests pass, or 0 on error.

                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#examples","title":"EXAMPLES","text":"

                                                                                                                                                  This demonstrates how to load the provider module \"foo\" and ask for its build information.

                                                                                                                                                  #include <openssl/params.h>\n#include <openssl/provider.h>\n#include <openssl/err.h>\n\nOSSL_PROVIDER *prov = NULL;\nconst char *build = NULL;\nOSSL_PARAM request[] = {\n    { \"buildinfo\", OSSL_PARAM_UTF8_PTR, &build, 0, 0 },\n    { NULL, 0, NULL, 0, 0 }\n};\n\nif ((prov = OSSL_PROVIDER_load(NULL, \"foo\")) != NULL\n    && OSSL_PROVIDER_get_params(prov, request))\n    printf(\"Provider 'foo' buildinfo: %s\\n\", build);\nelse\n    ERR_print_errors_fp(stderr);\n
                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                  openssl-core.h(7), OSSL_LIB_CTX(3), provider(7)

                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#history","title":"HISTORY","text":"

                                                                                                                                                  The type and functions described here were added in OpenSSL 3.0.

                                                                                                                                                  "},{"location":"man3/OSSL_PROVIDER/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                  Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                  "},{"location":"man3/OSSL_SELF_TEST_new/","title":"OSSL_SELF_TEST_new","text":""},{"location":"man3/OSSL_SELF_TEST_new/#name","title":"NAME","text":"

                                                                                                                                                  OSSL_SELF_TEST_new, OSSL_SELF_TEST_free, OSSL_SELF_TEST_onbegin, OSSL_SELF_TEST_oncorrupt_byte, OSSL_SELF_TEST_onend - functionality to trigger a callback during a self test

                                                                                                                                                  "},{"location":"man3/OSSL_SELF_TEST_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                  #include <openssl/self_test.h>\n\nOSSL_SELF_TEST *OSSL_SELF_TEST_new(OSSL_CALLBACK *cb, void *cbarg);\nvoid OSSL_SELF_TEST_free(OSSL_SELF_TEST *st);\n\nvoid OSSL_SELF_TEST_onbegin(OSSL_SELF_TEST *st, const char *type,\n                            const char *desc);\nint OSSL_SELF_TEST_oncorrupt_byte(OSSL_SELF_TEST *st, unsigned char *bytes);\nvoid OSSL_SELF_TEST_onend(OSSL_SELF_TEST *st, int ret);\n
                                                                                                                                                  "},{"location":"man3/OSSL_SELF_TEST_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                  These methods are intended for use by provider implementers, to display diagnostic information during self testing.

                                                                                                                                                  OSSL_SELF_TEST_new() allocates an opaque OSSL_SELF_TEST object that has a callback and callback argument associated with it.

                                                                                                                                                  The callback cb may be triggered multiple times by a self test to indicate different phases.

                                                                                                                                                  OSSL_SELF_TEST_free() frees the space allocated by OSSL_SELF_TEST_new(). If the argument is NULL, nothing is done.

                                                                                                                                                  OSSL_SELF_TEST_onbegin() may be inserted at the start of a block of self test code. It can be used for diagnostic purposes. If this method is called the callback cb will receive the following OSSL_PARAM(3) object.

                                                                                                                                                  • \"st-phase\" (OSSL_PROV_PARAM_SELF_TEST_PHASE)

                                                                                                                                                    The value is the string \"Start\"

                                                                                                                                                    OSSL_SELF_TEST_oncorrupt_byte() may be inserted just after the known answer is calculated, but before the self test compares the result. The first byte in the passed in array of bytes will be corrupted if the callback returns 0, otherwise it leaves the array unaltered. It can be used for failure testing. The type and desc can be used to identify an individual self test to target for failure testing. If this method is called the callback cb will receive the following OSSL_PARAM(3) object.

                                                                                                                                                    • \"st-phase\" (OSSL_PROV_PARAM_SELF_TEST_PHASE)

                                                                                                                                                      The value is the string \"Corrupt\"

                                                                                                                                                      OSSL_SELF_TEST_onend() may be inserted at the end of a block of self test code just before cleanup to indicate if the test passed or failed. It can be used for diagnostic purposes. If this method is called the callback cb will receive the following OSSL_PARAM(3) object.

                                                                                                                                                      • \"st-phase\" (OSSL_PROV_PARAM_SELF_TEST_PHASE)

                                                                                                                                                        The value of the string is \"Pass\" if ret is non zero, otherwise it has the value \"Fail\".

                                                                                                                                                        After the callback cb has been called the values that were set by OSSL_SELF_TEST_onbegin() for type and desc are set to the value \"None\".

                                                                                                                                                        If OSSL_SELF_TEST_onbegin(), OSSL_SELF_TEST_oncorrupt_byte() or OSSL_SELF_TEST_onend() is called the following additional OSSL_PARAM(3) are passed to the callback.

                                                                                                                                                        • \"st-type\" (OSSL_PROV_PARAM_SELF_TEST_TYPE)

                                                                                                                                                          The value is setup by the type passed to OSSL_SELF_TEST_onbegin(). This allows the callback to identify the type of test being run.

                                                                                                                                                        • \"st-desc\" (OSSL_PROV_PARAM_SELF_TEST_DESC)

                                                                                                                                                          The value is setup by the type passed to OSSL_SELF_TEST_onbegin(). This allows the callback to identify the sub category of the test being run.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_SELF_TEST_new() returns the allocated OSSL_SELF_TEST object, or NULL if it fails.

                                                                                                                                                          OSSL_SELF_TEST_oncorrupt_byte() returns 1 if corruption occurs, otherwise it returns 0.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_new/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          A single self test could be set up in the following way:

                                                                                                                                                            OSSL_SELF_TEST *st = NULL;\n  OSSL_CALLBACK *cb;\n  void *cbarg;\n  int ok = 0;\n  unsigned char out[EVP_MAX_MD_SIZE];\n  unsigned int out_len = 0;\n  EVP_MD_CTX *ctx = EVP_MD_CTX_new();\n  EVP_MD *md = EVP_MD_fetch(libctx, t->algorithm, NULL);\n\n  /*\n   * Retrieve the callback - will be NULL if not set by the application via\n   * OSSL_SELF_TEST_set_callback().\n   */\n  OSSL_SELF_TEST_get_callback(libctx, &cb, &cbarg);\n\n  st = OSSL_SELF_TEST_new(cb, cb_arg);\n\n  /* Trigger the optional callback */\n  OSSL_SELF_TEST_onbegin(st, OSSL_SELF_TEST_TYPE_KAT_DIGEST,\n                         OSSL_SELF_TEST_DESC_MD_SHA2);\n\n  if (!EVP_DigestInit_ex(ctx, md, NULL)\n      || !EVP_DigestUpdate(ctx, pt, pt_len)\n      || !EVP_DigestFinal(ctx, out, &out_len))\n      goto err;\n\n  /* Optional corruption - If the application callback returns 0 */\n  OSSL_SELF_TEST_oncorrupt_byte(st, out);\n\n  if (out_len != t->expected_len\n      || memcmp(out, t->expected, out_len) != 0)\n      goto err;\n  ok = 1;\nerr:\n  OSSL_SELF_TEST_onend(st, ok);\n  EVP_MD_free(md);\n  EVP_MD_CTX_free(ctx);\n

                                                                                                                                                          Multiple self test's can be set up in a similar way by repeating the pattern of OSSL_SELF_TEST_onbegin(), OSSL_SELF_TEST_oncorrupt_byte(), OSSL_SELF_TEST_onend() for each test.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          OSSL_SELF_TEST_set_callback(3), openssl-core.h(7), OSSL_PROVIDER-FIPS(7)

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_new/#history","title":"HISTORY","text":"

                                                                                                                                                          The functions described here were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_set_callback/","title":"OSSL_SELF_TEST_set_callback","text":""},{"location":"man3/OSSL_SELF_TEST_set_callback/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_SELF_TEST_set_callback, OSSL_SELF_TEST_get_callback - specify a callback for processing self tests

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_set_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/self_test.h>\n\nvoid OSSL_SELF_TEST_set_callback(OSSL_LIB_CTX *ctx, OSSL_CALLBACK *cb, void *cbarg);\nvoid OSSL_SELF_TEST_get_callback(OSSL_LIB_CTX *ctx, OSSL_CALLBACK **cb, void **cbarg);\n
                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_set_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          Set or gets the optional application callback (and the callback argument) that is called during self testing. The application callback OSSL_CALLBACK(3) is associated with a OSSL_LIB_CTX. The application callback function receives information about a running self test, and may return a result to the calling self test. See openssl-core.h(7) for further information on the callback.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_set_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_SELF_TEST_get_callback() returns the callback and callback argument that has been set via OSSL_SELF_TEST_set_callback() for the given library context ctx. These returned parameters will be NULL if OSSL_SELF_TEST_set_callback() has not been called.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_set_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          openssl-core.h(7), OSSL_PROVIDER-FIPS(7) OSSL_SELF_TEST_new(3) OSSL_LIB_CTX(3)

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_set_callback/#history","title":"HISTORY","text":"

                                                                                                                                                          The functions described here were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_SELF_TEST_set_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/","title":"OSSL_STORE_INFO","text":""},{"location":"man3/OSSL_STORE_INFO/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_STORE_INFO, OSSL_STORE_INFO_get_type, OSSL_STORE_INFO_get0_NAME, OSSL_STORE_INFO_get0_NAME_description, OSSL_STORE_INFO_get0_PARAMS, OSSL_STORE_INFO_get0_PUBKEY, OSSL_STORE_INFO_get0_PKEY, OSSL_STORE_INFO_get0_CERT, OSSL_STORE_INFO_get0_CRL, OSSL_STORE_INFO_get1_NAME, OSSL_STORE_INFO_get1_NAME_description, OSSL_STORE_INFO_get1_PARAMS, OSSL_STORE_INFO_get1_PUBKEY, OSSL_STORE_INFO_get1_PKEY, OSSL_STORE_INFO_get1_CERT, OSSL_STORE_INFO_get1_CRL, OSSL_STORE_INFO_type_string, OSSL_STORE_INFO_free, OSSL_STORE_INFO_new_NAME, OSSL_STORE_INFO_set0_NAME_description, OSSL_STORE_INFO_new_PARAMS, OSSL_STORE_INFO_new_PUBKEY, OSSL_STORE_INFO_new_PKEY, OSSL_STORE_INFO_new_CERT, OSSL_STORE_INFO_new_CRL, OSSL_STORE_INFO_new, OSSL_STORE_INFO_get0_data - Functions to manipulate OSSL_STORE_INFO objects

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/store.h>\n\ntypedef struct ossl_store_info_st OSSL_STORE_INFO;\n\nint OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *store_info);\nconst char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *store_info);\nchar *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *store_info);\nconst char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO\n                                                  *store_info);\nchar *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get0_PUBKEY(const OSSL_STORE_INFO *info);\nEVP_PKEY *OSSL_STORE_INFO_get1_PUBKEY(const OSSL_STORE_INFO *info);\nEVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *store_info);\nEVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *store_info);\nX509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *store_info);\nX509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *store_info);\nX509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *store_info);\nX509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *store_info);\n\nconst char *OSSL_STORE_INFO_type_string(int type);\n\nvoid OSSL_STORE_INFO_free(OSSL_STORE_INFO *store_info);\n\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name);\nint OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(DSA *dsa_params);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_PUBKEY(EVP_PKEY *pubkey);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509);\nOSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl);\n\nOSSL_STORE_INFO *OSSL_STORE_INFO_new(int type, void *data);\nvoid *OSSL_STORE_INFO_get0_data(int type, const OSSL_STORE_INFO *info);\n
                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions are primarily useful for applications to retrieve supported objects from OSSL_STORE_INFO objects and for scheme specific loaders to create OSSL_STORE_INFO holders.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#types","title":"Types","text":"

                                                                                                                                                          OSSL_STORE_INFO is an opaque type that's just an intermediary holder for the objects that have been retrieved by OSSL_STORE_load() and similar functions. Supported OpenSSL type object can be extracted using one of STORE_INFO_get0_() where can be NAME, PARAMS, PKEY, CERT, or CRL. The life time of this extracted object is as long as the life time of the OSSL_STORE_INFO it was extracted from, so care should be taken not to free the latter too early. As an alternative, STORE_INFO_get1_() extracts a duplicate (or the same object with its reference count increased), which can be used after the containing OSSL_STORE_INFO has been freed. The object returned by STORE_INFO_get1_() must be freed separately by the caller. See \"SUPPORTED OBJECTS\" for more information on the types that are supported."},{"location":"man3/OSSL_STORE_INFO/#functions","title":"Functions","text":"

                                                                                                                                                          OSSL_STORE_INFO_get_type() takes a OSSL_STORE_INFO and returns the STORE type number for the object inside.

                                                                                                                                                          STORE_INFO_get_type_string() takes a STORE type number and returns a short string describing it.

                                                                                                                                                          OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(), OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PUBKEY(), OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), OSSL_STORE_INFO_get0_CRL() all take a OSSL_STORE_INFO and return the object it holds if the OSSL_STORE_INFO type (as returned by OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL.

                                                                                                                                                          OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(), OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PUBKEY(), OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all take a OSSL_STORE_INFO and return a duplicate the object it holds if the OSSL_STORE_INFO type (as returned by OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL.

                                                                                                                                                          OSSL_STORE_INFO_free() frees a OSSL_STORE_INFO and its contained type. If the argument is NULL, nothing is done.

                                                                                                                                                          OSSL_STORE_INFO_new_NAME() , OSSL_STORE_INFO_new_PARAMS(), , OSSL_STORE_INFO_new_PUBKEY(), OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and OSSL_STORE_INFO_new_CRL() create a OSSL_STORE_INFO object to hold the given input object. On success the input object is consumed.

                                                                                                                                                          Additionally, for OSSL_STORE_INFO_NAME objects, OSSL_STORE_INFO_set0_NAME_description() can be used to add an extra description. This description is meant to be human readable and should be used for information printout.

                                                                                                                                                          OSSL_STORE_INFO_new() creates a OSSL_STORE_INFO with an arbitrary type number and data structure. It's the responsibility of the caller to define type numbers other than the ones defined by <openssl/store.h>, and to handle freeing the associated data structure on their own. Using type numbers that are defined by <openssl/store.h> may cause undefined behaviours, including crashes.

                                                                                                                                                          OSSL_STORE_INFO_get0_data() returns the data pointer that was passed to OSSL_STORE_INFO_new() if type matches the type number in info.

                                                                                                                                                          OSSL_STORE_INFO_new() and OSSL_STORE_INFO_get0_data() may be useful for applications that define their own STORE data, but must be used with care.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#supported-objects","title":"SUPPORTED OBJECTS","text":"

                                                                                                                                                          Currently supported object types are:

                                                                                                                                                          • OSSL_STORE_INFO_NAME

                                                                                                                                                            A name is exactly that, a name. It's like a name in a directory, but formatted as a complete URI. For example, the path in URI file:/foo/bar/ could include a file named cookie.pem, and in that case, the returned OSSL_STORE_INFO_NAME object would have the URI file:/foo/bar/cookie.pem, which can be used by the application to get the objects in that file. This can be applied to all schemes that can somehow support a listing of object URIs.

                                                                                                                                                            For file: URIs that are used without the explicit scheme, the returned name will be the path of each object, so if /foo/bar was given and that path has the file cookie.pem, the name /foo/bar/cookie.pem will be returned.

                                                                                                                                                            The returned URI is considered canonical and must be unique and permanent for the storage where the object (or collection of objects) resides. Each loader is responsible for ensuring that it only returns canonical URIs. However, it's possible that certain schemes allow an object (or collection thereof) to be reached with alternative URIs; just because one URI is canonical doesn't mean that other variants can't be used.

                                                                                                                                                            At the discretion of the loader that was used to get these names, an extra description may be attached as well.

                                                                                                                                                          • OSSL_STORE_INFO_PARAMS

                                                                                                                                                            Key parameters.

                                                                                                                                                          • OSSL_STORE_INFO_PKEY

                                                                                                                                                            A keypair or just a private key (possibly with key parameters).

                                                                                                                                                          • OSSL_STORE_INFO_PUBKEY

                                                                                                                                                            A public key (possibly with key parameters).

                                                                                                                                                          • OSSL_STORE_INFO_CERT

                                                                                                                                                            An X.509 certificate.

                                                                                                                                                          • OSSL_STORE_INFO_CRL

                                                                                                                                                            A X.509 certificate revocation list.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_STORE_INFO_get_type() returns the STORE type number of the given OSSL_STORE_INFO. There is no error value.

                                                                                                                                                          OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(), OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT() and OSSL_STORE_INFO_get0_CRL() all return a pointer to the OpenSSL object on success, NULL otherwise.

                                                                                                                                                          OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(), OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all return a pointer to a duplicate of the OpenSSL object on success, NULL otherwise.

                                                                                                                                                          OSSL_STORE_INFO_type_string() returns a string on success, or NULL on failure.

                                                                                                                                                          OSSL_STORE_INFO_new_NAME(), OSSL_STORE_INFO_new_PARAMS(), OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and OSSL_STORE_INFO_new_CRL() return a OSSL_STORE_INFO pointer on success, or NULL on failure.

                                                                                                                                                          OSSL_STORE_INFO_set0_NAME_description() returns 1 on success, or 0 on failure.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ossl_store(7), OSSL_STORE_open(3), OSSL_STORE_register_loader(3)

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#history","title":"HISTORY","text":"

                                                                                                                                                          The OSSL_STORE API was added in OpenSSL 1.1.1.

                                                                                                                                                          The OSSL_STORE_INFO_PUBKEY object type was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_INFO/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/","title":"OSSL_STORE_LOADER","text":""},{"location":"man3/OSSL_STORE_LOADER/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_STORE_LOADER, OSSL_STORE_LOADER_fetch, OSSL_STORE_LOADER_up_ref, OSSL_STORE_LOADER_free, OSSL_STORE_LOADER_get0_provider, OSSL_STORE_LOADER_get0_properties, OSSL_STORE_LOADER_is_a, OSSL_STORE_LOADER_get0_description, OSSL_STORE_LOADER_do_all_provided, OSSL_STORE_LOADER_names_do_all, OSSL_STORE_LOADER_CTX, OSSL_STORE_LOADER_new, OSSL_STORE_LOADER_get0_engine, OSSL_STORE_LOADER_get0_scheme, OSSL_STORE_LOADER_set_open, OSSL_STORE_LOADER_set_open_ex, OSSL_STORE_LOADER_set_attach, OSSL_STORE_LOADER_set_ctrl, OSSL_STORE_LOADER_set_expect, OSSL_STORE_LOADER_set_find, OSSL_STORE_LOADER_set_load, OSSL_STORE_LOADER_set_eof, OSSL_STORE_LOADER_set_error, OSSL_STORE_LOADER_set_close, OSSL_STORE_register_loader, OSSL_STORE_unregister_loader, OSSL_STORE_open_fn, OSSL_STORE_open_ex_fn, OSSL_STORE_attach_fn, OSSL_STORE_ctrl_fn, OSSL_STORE_expect_fn, OSSL_STORE_find_fn, OSSL_STORE_load_fn, OSSL_STORE_eof_fn, OSSL_STORE_error_fn, OSSL_STORE_close_fn - Types and functions to manipulate, register and unregister STORE loaders for different URI schemes

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/store.h>\n\ntypedef struct ossl_store_loader_st OSSL_STORE_LOADER;\n\nOSSL_STORE_LOADER *OSSL_STORE_LOADER_fetch(OSSL_LIB_CTX *libctx,\n                                           const char *scheme,\n                                           const char *properties);\nint OSSL_STORE_LOADER_up_ref(OSSL_STORE_LOADER *loader);\nvoid OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader);\nconst OSSL_PROVIDER *OSSL_STORE_LOADER_get0_provider(const OSSL_STORE_LOADER *\n                                                loader);\nconst char *OSSL_STORE_LOADER_get0_properties(const OSSL_STORE_LOADER *loader);\nconst char *OSSL_STORE_LOADER_get0_description(const OSSL_STORE_LOADER *loader);\nint OSSL_STORE_LOADER_is_a(const OSSL_STORE_LOADER *loader,\n                           const char *scheme);\nvoid OSSL_STORE_LOADER_do_all_provided(OSSL_LIB_CTX *libctx,\n                                       void (*user_fn)(OSSL_STORE_LOADER *loader,\n                                                  void *arg),\n                                       void *user_arg);\nint OSSL_STORE_LOADER_names_do_all(const OSSL_STORE_LOADER *loader,\n                                   void (*fn)(const char *name, void *data),\n                                   void *data);\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme);\nconst ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER\n                                            *store_loader);\nconst char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER\n                                          *store_loader);\n\n/* struct ossl_store_loader_ctx_st is defined differently by each loader */\ntypedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX;\n\ntypedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(\n    const char *uri, const UI_METHOD *ui_method, void *ui_data);\nint OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *store_loader,\n                               OSSL_STORE_open_fn store_open_function);\ntypedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_ex_fn)(\n    const char *uri, const UI_METHOD *ui_method, void *ui_data);\nint OSSL_STORE_LOADER_set_open_ex\n    (OSSL_STORE_LOADER *store_loader,\n     OSSL_STORE_open_ex_fn store_open_ex_function);\ntypedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_attach_fn)\n    (const OSSL_STORE_LOADER *loader, BIO *bio,\n     OSSL_LIB_CTX *libctx, const char *propq,\n     const UI_METHOD *ui_method, void *ui_data);\nint OSSL_STORE_LOADER_set_attach(OSSL_STORE_LOADER *loader,\n                                 OSSL_STORE_attach_fn attach_function);\ntypedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd,\n                                  va_list args);\nint OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *store_loader,\n                               OSSL_STORE_ctrl_fn store_ctrl_function);\ntypedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected);\nint OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader,\n                                 OSSL_STORE_expect_fn expect_function);\ntypedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx,\n                                  OSSL_STORE_SEARCH *criteria);\nint OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader,\n                               OSSL_STORE_find_fn find_function);\ntypedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx,\n                                               UI_METHOD *ui_method,\n                                               void *ui_data);\nint OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *store_loader,\n                               OSSL_STORE_load_fn store_load_function);\ntypedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx);\nint OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *store_loader,\n                              OSSL_STORE_eof_fn store_eof_function);\ntypedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx);\nint OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *store_loader,\n                                OSSL_STORE_error_fn store_error_function);\ntypedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx);\nint OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *store_loader,\n                                OSSL_STORE_close_fn store_close_function);\n\nint OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader);\nOSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme);\n
                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          OSSL_STORE_LOADER is a method for OSSL_STORE loaders, which implement OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof(), OSSL_STORE_error() and OSSL_STORE_close() for specific storage schemes.

                                                                                                                                                          OSSL_STORE_LOADER_fetch() looks for an implementation for a storage scheme within the providers that has been loaded into the OSSL_LIB_CTX given by libctx, and with the properties given by properties.

                                                                                                                                                          OSSL_STORE_LOADER_up_ref() increments the reference count for the given loader.

                                                                                                                                                          OSSL_STORE_LOADER_free() decrements the reference count for the given loader, and when the count reaches zero, frees it. If the argument is NULL, nothing is done.

                                                                                                                                                          OSSL_STORE_LOADER_get0_provider() returns the provider of the given loader.

                                                                                                                                                          OSSL_STORE_LOADER_get0_properties() returns the property definition associated with the given loader.

                                                                                                                                                          OSSL_STORE_LOADER_is_a() checks if loader is an implementation of an algorithm that's identifiable with scheme.

                                                                                                                                                          OSSL_STORE_LOADER_get0_description() returns a description of the loader, meant for display and human consumption. The description is at the discretion of the loader implementation.

                                                                                                                                                          OSSL_STORE_LOADER_do_all_provided() traverses all store implementations by all activated providers in the library context libctx, and for each of the implementations, calls user_fn with the implementation method and user_arg as arguments.

                                                                                                                                                          OSSL_STORE_LOADER_names_do_all() traverses all names for the given loader, and calls fn with each name and data.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/#legacy-types-and-functions-deprecated","title":"Legacy Types and Functions (deprecated)","text":"

                                                                                                                                                          These functions help applications and engines to create loaders for schemes they support. These are all deprecated and discouraged in favour of provider implementations, see provider-storemgmt(7).

                                                                                                                                                          OSSL_STORE_LOADER_CTX is a type template, to be defined by each loader using struct ossl_store_loader_ctx_st { ... }.

                                                                                                                                                          OSSL_STORE_open_fn, OSSL_STORE_open_ex_fn, OSSL_STORE_ctrl_fn, OSSL_STORE_expect_fn, OSSL_STORE_find_fn, OSSL_STORE_load_fn, OSSL_STORE_eof_fn, and OSSL_STORE_close_fn are the function pointer types used within a STORE loader. The functions pointed at define the functionality of the given loader.

                                                                                                                                                          • OSSL_STORE_open_fn and OSSL_STORE_open_ex_fn

                                                                                                                                                            OSSL_STORE_open_ex_fn takes a URI and is expected to interpret it in the best manner possible according to the scheme the loader implements. It also takes a UI_METHOD and associated data, to be used any time something needs to be prompted for, as well as a library context libctx with an associated property query propq, to be used when fetching necessary algorithms to perform the loads. Furthermore, this function is expected to initialize what needs to be initialized, to create a private data store (OSSL_STORE_LOADER_CTX, see above), and to return it. If something goes wrong, this function is expected to return NULL.

                                                                                                                                                            OSSL_STORE_open_fn does the same thing as OSSL_STORE_open_ex_fn but uses NULL for the library context libctx and property query propq.

                                                                                                                                                          • OSSL_STORE_attach_fn

                                                                                                                                                            This function takes a BIO, otherwise works like OSSL_STORE_open_ex_fn.

                                                                                                                                                          • OSSL_STORE_ctrl_fn

                                                                                                                                                            This function takes a OSSL_STORE_LOADER_CTX pointer, a command number cmd and a va_list args and is used to manipulate loader specific parameters.

                                                                                                                                                            Loader specific command numbers must begin at OSSL_STORE_C_CUSTOM_START. Any number below that is reserved for future globally known command numbers.

                                                                                                                                                            This function is expected to return 1 on success, 0 on error.

                                                                                                                                                          • OSSL_STORE_expect_fn

                                                                                                                                                            This function takes a OSSL_STORE_LOADER_CTX pointer and a OSSL_STORE_INFO identity expected, and is used to tell the loader what object type is expected. expected may be zero to signify that no specific object type is expected.

                                                                                                                                                            This function is expected to return 1 on success, 0 on error.

                                                                                                                                                          • OSSL_STORE_find_fn

                                                                                                                                                            This function takes a OSSL_STORE_LOADER_CTX pointer and a OSSL_STORE_SEARCH search criterion, and is used to tell the loader what to search for.

                                                                                                                                                            When called with the loader context being NULL, this function is expected to return 1 if the loader supports the criterion, otherwise 0.

                                                                                                                                                            When called with the loader context being something other than NULL, this function is expected to return 1 on success, 0 on error.

                                                                                                                                                          • OSSL_STORE_load_fn

                                                                                                                                                            This function takes a OSSL_STORE_LOADER_CTX pointer and a UI_METHOD with associated data. It's expected to load the next available data, mold it into a data structure that can be wrapped in a OSSL_STORE_INFO using one of the OSSL_STORE_INFO(3) functions. If no more data is available or an error occurs, this function is expected to return NULL. The OSSL_STORE_eof_fn and OSSL_STORE_error_fn functions must indicate if it was in fact the end of data or if an error occurred.

                                                                                                                                                            Note that this function retrieves one data item only.

                                                                                                                                                          • OSSL_STORE_eof_fn

                                                                                                                                                            This function takes a OSSL_STORE_LOADER_CTX pointer and is expected to return 1 to indicate that the end of available data has been reached. It is otherwise expected to return 0.

                                                                                                                                                          • OSSL_STORE_error_fn

                                                                                                                                                            This function takes a OSSL_STORE_LOADER_CTX pointer and is expected to return 1 to indicate that an error occurred in a previous call to the OSSL_STORE_load_fn function. It is otherwise expected to return 0.

                                                                                                                                                          • OSSL_STORE_close_fn

                                                                                                                                                            This function takes a OSSL_STORE_LOADER_CTX pointer and is expected to close or shut down what needs to be closed, and finally free the contents of the OSSL_STORE_LOADER_CTX pointer. It returns 1 on success and 0 on error.

                                                                                                                                                          OSSL_STORE_LOADER_new() creates a new OSSL_STORE_LOADER. It takes an ENGINE e and a string scheme. scheme must always be set. Both e and scheme are used as is and must therefore be alive as long as the created loader is.

                                                                                                                                                          OSSL_STORE_LOADER_get0_engine() returns the engine of the store_loader. OSSL_STORE_LOADER_get0_scheme() returns the scheme of the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_open() sets the opener function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_open_ex() sets the opener with library context function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_attach() sets the attacher function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_ctrl() sets the control function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_expect() sets the expect function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_load() sets the loader function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_eof() sets the end of file checker function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_set_close() sets the closing function for the store_loader.

                                                                                                                                                          OSSL_STORE_LOADER_free() frees the given store_loader. If the argument is NULL, nothing is done.

                                                                                                                                                          OSSL_STORE_register_loader() register the given store_loader and thereby makes it available for use with OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close().

                                                                                                                                                          OSSL_STORE_unregister_loader() unregister the store loader for the given scheme.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_STORE_LOADER_fetch() returns a pointer to an OSSL_STORE_LOADER object, or NULL on error.

                                                                                                                                                          OSSL_STORE_LOADER_up_ref() returns 1 on success, or 0 on error.

                                                                                                                                                          OSSL_STORE_LOADER_names_do_all() returns 1 if the callback was called for all names. A return value of 0 means that the callback was not called for any names.

                                                                                                                                                          OSSL_STORE_LOADER_free() doesn't return any value.

                                                                                                                                                          OSSL_STORE_LOADER_get0_provider() returns a pointer to a provider object, or NULL on error.

                                                                                                                                                          OSSL_STORE_LOADER_get0_properties() returns a pointer to a property definition string, or NULL on error.

                                                                                                                                                          OSSL_STORE_LOADER_is_a() returns 1 if loader was identifiable, otherwise 0.

                                                                                                                                                          OSSL_STORE_LOADER_get0_description() returns a pointer to a description, or NULL if there isn't one.

                                                                                                                                                          The functions with the types OSSL_STORE_open_fn, OSSL_STORE_open_ex_fn, OSSL_STORE_ctrl_fn, OSSL_STORE_expect_fn, OSSL_STORE_load_fn, OSSL_STORE_eof_fn and OSSL_STORE_close_fn have the same return values as OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_ctrl(), OSSL_STORE_expect(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close(), respectively.

                                                                                                                                                          OSSL_STORE_LOADER_new() returns a pointer to a OSSL_STORE_LOADER on success, or NULL on failure.

                                                                                                                                                          OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_eof() and OSSL_STORE_LOADER_set_close() return 1 on success, or 0 on failure.

                                                                                                                                                          OSSL_STORE_register_loader() returns 1 on success, or 0 on failure.

                                                                                                                                                          OSSL_STORE_unregister_loader() returns the unregistered loader on success, or NULL on failure.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ossl_store(7), OSSL_STORE_open(3), OSSL_LIB_CTX(3), provider-storemgmt(7)

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/#history","title":"HISTORY","text":"

                                                                                                                                                          OSSL_STORE_LOADER_fetch(), OSSL_STORE_LOADER_up_ref(), OSSL_STORE_LOADER_get0_provider(), OSSL_STORE_LOADER_get0_properties(), OSSL_STORE_LOADER_get0_description(), OSSL_STORE_LOADER_is_a(), OSSL_STORE_LOADER_do_all_provided() and OSSL_STORE_LOADER_names_do_all() were added in OpenSSL 3.0.

                                                                                                                                                          OSSL_STORE_LOADER and OSSL_STORE_LOADER_free() were added in OpenSSL 1.1.1.

                                                                                                                                                          OSSL_STORE_LOADER_set_open_ex() and OSSL_STORE_open_ex_fn() were added in OpenSSL 3.0, and are deprecated.

                                                                                                                                                          OSSL_STORE_LOADER_CTX, OSSL_STORE_LOADER_new(), OSSL_STORE_LOADER_set0_scheme(), OSSL_STORE_LOADER_get0_scheme(), OSSL_STORE_LOADER_get0_engine(), OSSL_STORE_LOADER_set_expect(), OSSL_STORE_LOADER_set_find(), OSSL_STORE_LOADER_set_attach(), OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_eof(), OSSL_STORE_LOADER_set_close(), OSSL_STORE_register_loader(), OSSL_STORE_LOADER_set_error(), OSSL_STORE_unregister_loader(), OSSL_STORE_open_fn(), OSSL_STORE_ctrl_fn(), OSSL_STORE_load_fn(), OSSL_STORE_eof_fn() and OSSL_STORE_close_fn() were added in OpenSSL 1.1.1, and became deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_LOADER/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/","title":"OSSL_STORE_SEARCH","text":""},{"location":"man3/OSSL_STORE_SEARCH/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_STORE_SEARCH, OSSL_STORE_SEARCH_by_name, OSSL_STORE_SEARCH_by_issuer_serial, OSSL_STORE_SEARCH_by_key_fingerprint, OSSL_STORE_SEARCH_by_alias, OSSL_STORE_SEARCH_free, OSSL_STORE_SEARCH_get_type, OSSL_STORE_SEARCH_get0_name, OSSL_STORE_SEARCH_get0_serial, OSSL_STORE_SEARCH_get0_bytes, OSSL_STORE_SEARCH_get0_string, OSSL_STORE_SEARCH_get0_digest - Type and functions to create OSSL_STORE search criteria

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/store.h>\n\ntypedef struct ossl_store_search_st OSSL_STORE_SEARCH;\n\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name);\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name,\n                                                      const ASN1_INTEGER\n                                                      *serial);\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest,\n                                                        const unsigned char\n                                                        *bytes, int len);\nOSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias);\n\nvoid OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search);\n\nint OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion);\nX509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion);\nconst ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH\n                                                  *criterion);\nconst unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH\n                                                  *criterion, size_t *length);\nconst char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion);\nconst EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH\n                                            *criterion);\n
                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions are used to specify search criteria to help search for specific objects through other names than just the URI that's given to OSSL_STORE_open(). For example, this can be useful for an application that has received a URI and then wants to add on search criteria in a uniform and supported manner.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#types","title":"Types","text":"

                                                                                                                                                          OSSL_STORE_SEARCH is an opaque type that holds the constructed search criterion, and that can be given to an OSSL_STORE context with OSSL_STORE_find().

                                                                                                                                                          The calling application owns the allocation of an OSSL_STORE_SEARCH at all times, and should therefore be careful not to deallocate it before OSSL_STORE_close() has been called for the OSSL_STORE context it was given to.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#application-functions","title":"Application Functions","text":"

                                                                                                                                                          OSSL_STORE_SEARCH_by_name(), OSSL_STORE_SEARCH_by_issuer_serial(), OSSL_STORE_SEARCH_by_key_fingerprint(), and OSSL_STORE_SEARCH_by_alias() are used to create an OSSL_STORE_SEARCH from a subject name, an issuer name and serial number pair, a key fingerprint, and an alias (for example a friendly name). The parameters that are provided are not copied, only referred to in a criterion, so they must have at least the same life time as the created OSSL_STORE_SEARCH.

                                                                                                                                                          OSSL_STORE_SEARCH_free() is used to free the OSSL_STORE_SEARCH. If the argument is NULL, nothing is done.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#loader-functions","title":"Loader Functions","text":"

                                                                                                                                                          OSSL_STORE_SEARCH_get_type() returns the criterion type for the given OSSL_STORE_SEARCH.

                                                                                                                                                          OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(), OSSL_STORE_SEARCH_get0_bytes(), OSSL_STORE_SEARCH_get0_string(), and OSSL_STORE_SEARCH_get0_digest() are used to retrieve different data from a OSSL_STORE_SEARCH, as available for each type. For more information, see \"SUPPORTED CRITERION TYPES\" below.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#supported-criterion-types","title":"SUPPORTED CRITERION TYPES","text":"

                                                                                                                                                          Currently supported criterion types are:

                                                                                                                                                          • OSSL_STORE_SEARCH_BY_NAME

                                                                                                                                                            This criterion supports a search by exact match of subject name. The subject name itself is a X509_NAME pointer. A criterion of this type is created with OSSL_STORE_SEARCH_by_name(), and the actual subject name is retrieved with OSSL_STORE_SEARCH_get0_name().

                                                                                                                                                          • OSSL_STORE_SEARCH_BY_ISSUER_SERIAL

                                                                                                                                                            This criterion supports a search by exact match of both issuer name and serial number. The issuer name itself is a X509_NAME pointer, and the serial number is a ASN1_INTEGER pointer. A criterion of this type is created with OSSL_STORE_SEARCH_by_issuer_serial() and the actual issuer name and serial number are retrieved with OSSL_STORE_SEARCH_get0_name() and OSSL_STORE_SEARCH_get0_serial().

                                                                                                                                                          • OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT

                                                                                                                                                            This criterion supports a search by exact match of key fingerprint. The key fingerprint in itself is a string of bytes and its length, as well as the algorithm that was used to compute the fingerprint. The digest may be left unspecified (NULL), and in that case, the loader has to decide on a default digest and compare fingerprints accordingly. A criterion of this type is created with OSSL_STORE_SEARCH_by_key_fingerprint() and the actual fingerprint and its length can be retrieved with OSSL_STORE_SEARCH_get0_bytes(). The digest can be retrieved with OSSL_STORE_SEARCH_get0_digest().

                                                                                                                                                          • OSSL_STORE_SEARCH_BY_ALIAS

                                                                                                                                                            This criterion supports a search by match of an alias of some kind. The alias in itself is a simple C string. A criterion of this type is created with OSSL_STORE_SEARCH_by_alias() and the actual alias is retrieved with OSSL_STORE_SEARCH_get0_string().

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_STORE_SEARCH_by_name(), OSSL_STORE_SEARCH_by_issuer_serial(), OSSL_STORE_SEARCH_by_key_fingerprint(), and OSSL_STORE_SEARCH_by_alias() return a OSSL_STORE_SEARCH pointer on success, or NULL on failure.

                                                                                                                                                          OSSL_STORE_SEARCH_get_type() returns the criterion type of the given OSSL_STORE_SEARCH. There is no error value.

                                                                                                                                                          OSSL_STORE_SEARCH_get0_name() returns a X509_NAME pointer on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                                                                                                                                                          OSSL_STORE_SEARCH_get0_serial() returns a ASN1_INTEGER pointer on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                                                                                                                                                          OSSL_STORE_SEARCH_get0_bytes() returns a const unsigned char pointer and sets *length to the strings length on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                                                                                                                                                          OSSL_STORE_SEARCH_get0_string() returns a const char pointer on success, or NULL when the given OSSL_STORE_SEARCH was of a different type.

                                                                                                                                                          OSSL_STORE_SEARCH_get0_digest() returns a const EVP_MD pointer. NULL is a valid value and means that the store loader default will be used when applicable.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ossl_store(7), OSSL_STORE_supports_search(3), OSSL_STORE_find(3)

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#history","title":"HISTORY","text":"

                                                                                                                                                          OSSL_STORE_SEARCH, OSSL_STORE_SEARCH_by_name(), OSSL_STORE_SEARCH_by_issuer_serial(), OSSL_STORE_SEARCH_by_key_fingerprint(), OSSL_STORE_SEARCH_by_alias(), OSSL_STORE_SEARCH_free(), OSSL_STORE_SEARCH_get_type(), OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(), OSSL_STORE_SEARCH_get0_bytes(), and OSSL_STORE_SEARCH_get0_string() were added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_SEARCH/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_attach/","title":"OSSL_STORE_attach","text":""},{"location":"man3/OSSL_STORE_attach/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_STORE_attach - Functions to read objects from a BIO

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_attach/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/store.h>\n\nOSSL_STORE_CTX *OSSL_STORE_attach(BIO *bio, const char *scheme,\n                                  OSSL_LIB_CTX *libctx, const char *propq,\n                                  const UI_METHOD *ui_method, void *ui_data,\n                                  const OSSL_PARAM params[],\n                                  OSSL_STORE_post_process_info_fn post_process,\n                                  void *post_process_data);\n
                                                                                                                                                          "},{"location":"man3/OSSL_STORE_attach/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          OSSL_STORE_attach() works like OSSL_STORE_open(3), except it takes a BIO bio instead of a uri, along with a scheme to determine what loader should be used to process the data. The reference count of the BIO object is increased by 1 if the call is successful.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_attach/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_STORE_attach() returns a pointer to a OSSL_STORE_CTX on success, or NULL on failure.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_attach/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ossl_store(7), OSSL_STORE_open(3)

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_attach/#history","title":"HISTORY","text":"

                                                                                                                                                          OSSL_STORE_attach() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_attach/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/","title":"OSSL_STORE_expect","text":""},{"location":"man3/OSSL_STORE_expect/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_STORE_expect, OSSL_STORE_supports_search, OSSL_STORE_find - Specify what object type is expected

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/store.h>\n\nint OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type);\n\nint OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int criterion_type);\n\nint OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search);\n
                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          OSSL_STORE_expect() helps applications filter what OSSL_STORE_load() returns by specifying a OSSL_STORE_INFO type. By default, no expectations on the types of objects to be loaded are made. expected_type may be 0 to indicate explicitly that no expectation is made, or it may be any of the known object types (see \"SUPPORTED OBJECTS\" in OSSL_STORE_INFO(3)) except for OSSL_STORE_INFO_NAME. For example, if file:/foo/bar/store.pem contains several objects of different type and only certificates are interesting, the application can simply say that it expects the type OSSL_STORE_INFO_CERT.

                                                                                                                                                          OSSL_STORE_find() helps applications specify a criterion for a more fine grained search of objects.

                                                                                                                                                          OSSL_STORE_supports_search() checks if the loader of the given OSSL_STORE context supports the given search type. See \"SUPPORTED CRITERION TYPES\" in OSSL_STORE_SEARCH(3) for information on the supported search criterion types.

                                                                                                                                                          OSSL_STORE_expect() and OSSL_STORE_find must be called before the first OSSL_STORE_load() of a given session, or they will fail.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/#notes","title":"NOTES","text":"

                                                                                                                                                          If a more elaborate filter is required by the application, a better choice would be to use a post-processing function. See OSSL_STORE_open(3) for more information.

                                                                                                                                                          However, some loaders may take advantage of the knowledge of an expected type to make object retrieval more efficient, so if a single type is expected, this method is usually preferable.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_STORE_expect() returns 1 on success, or 0 on failure.

                                                                                                                                                          OSSL_STORE_supports_search() returns 1 if the criterion is supported, or 0 otherwise.

                                                                                                                                                          OSSL_STORE_find() returns 1 on success, or 0 on failure.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ossl_store(7), OSSL_STORE_INFO(3), OSSL_STORE_SEARCH(3), OSSL_STORE_load(3)

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/#history","title":"HISTORY","text":"

                                                                                                                                                          OSSL_STORE_expect(), OSSL_STORE_supports_search() and OSSL_STORE_find() were added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_expect/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/","title":"OSSL_STORE_open","text":""},{"location":"man3/OSSL_STORE_open/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_STORE_CTX, OSSL_STORE_post_process_info_fn, OSSL_STORE_open, OSSL_STORE_open_ex, OSSL_STORE_ctrl, OSSL_STORE_load, OSSL_STORE_eof, OSSL_STORE_error, OSSL_STORE_close - Types and functions to read objects from a URI

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/store.h>\n\ntypedef struct ossl_store_ctx_st OSSL_STORE_CTX;\n\ntypedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *,\n                                                            void *);\n\nOSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method,\n                                void *ui_data,\n                                OSSL_STORE_post_process_info_fn post_process,\n                                void *post_process_data);\nOSSL_STORE_CTX *\nOSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq,\n                   const UI_METHOD *ui_method, void *ui_data,\n                   const OSSL_PARAM params[],\n                   OSSL_STORE_post_process_info_fn post_process,\n                   void *post_process_data);\n\nOSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx);\nint OSSL_STORE_eof(OSSL_STORE_CTX *ctx);\nint OSSL_STORE_error(OSSL_STORE_CTX *ctx);\nint OSSL_STORE_close(OSSL_STORE_CTX *ctx);\n

                                                                                                                                                          The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */);\n
                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions help the application to fetch supported objects (see \"SUPPORTED OBJECTS\" in OSSL_STORE_INFO(3) for information on which those are) from a given URI. The general method to do so is to \"open\" the URI using OSSL_STORE_open(), read each available and supported object using OSSL_STORE_load() as long as OSSL_STORE_eof() hasn't been reached, and finish it off with OSSL_STORE_close().

                                                                                                                                                          The retrieved information is stored in a OSSL_STORE_INFO, which is further described in OSSL_STORE_INFO(3).

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#types","title":"Types","text":"

                                                                                                                                                          OSSL_STORE_CTX is a context variable that holds all the internal information for OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close() to work together.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#functions","title":"Functions","text":"

                                                                                                                                                          OSSL_STORE_open_ex() takes a uri or path uri, password UI method ui_method with associated data ui_data, and post processing callback post_process with associated data post_process_data, a library context libctx with an associated property query propq, and opens a channel to the data located at the URI and returns a OSSL_STORE_CTX with all necessary internal information. The given ui_method and ui_data will be reused by all functions that use OSSL_STORE_CTX when interaction is needed, for instance to provide a password. The auxiliary OSSL_PARAM(3) parameters in params can be set to further modify the store operation. The given post_process and post_process_data will be reused by OSSL_STORE_load() to manipulate or drop the value to be returned. The post_process function drops values by returning NULL, which will cause OSSL_STORE_load() to start its process over with loading the next object, until post_process returns something other than NULL, or the end of data is reached as indicated by OSSL_STORE_eof().

                                                                                                                                                          OSSL_STORE_open() is similar to OSSL_STORE_open_ex() but uses NULL for the params, the library context libctx and property query propq.

                                                                                                                                                          OSSL_STORE_ctrl() takes a OSSL_STORE_CTX, and command number cmd and more arguments not specified here. The available loader specific command numbers and arguments they each take depends on the loader that's used and is documented together with that loader.

                                                                                                                                                          There are also global controls available:

                                                                                                                                                          • OSSL_STORE_C_USE_SECMEM

                                                                                                                                                            Controls if the loader should attempt to use secure memory for any allocated OSSL_STORE_INFO and its contents. This control expects one argument, a pointer to an int that is expected to have the value 1 (yes) or 0 (no). Any other value is an error.

                                                                                                                                                          OSSL_STORE_load() takes a OSSL_STORE_CTX and tries to load the next available object and return it wrapped with OSSL_STORE_INFO.

                                                                                                                                                          OSSL_STORE_eof() takes a OSSL_STORE_CTX and checks if we've reached the end of data.

                                                                                                                                                          OSSL_STORE_error() takes a OSSL_STORE_CTX and checks if an error occurred in the last OSSL_STORE_load() call. Note that it may still be meaningful to try and load more objects, unless OSSL_STORE_eof() shows that the end of data has been reached.

                                                                                                                                                          OSSL_STORE_close() takes a OSSL_STORE_CTX, closes the channel that was opened by OSSL_STORE_open() and frees all other information that was stored in the OSSL_STORE_CTX, as well as the OSSL_STORE_CTX itself. If ctx is NULL it does nothing.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#notes","title":"NOTES","text":"

                                                                                                                                                          A string without a scheme prefix (that is, a non-URI string) is implicitly interpreted as using the file: scheme.

                                                                                                                                                          There are some tools that can be used together with OSSL_STORE_open() to determine if any failure is caused by an unparsable URI, or if it's a different error (such as memory allocation failures); if the URI was parsable but the scheme unregistered, the top error will have the reason OSSL_STORE_R_UNREGISTERED_SCHEME.

                                                                                                                                                          These functions make no direct assumption regarding the pass phrase received from the password callback. The loaders may make assumptions, however. For example, the file: scheme loader inherits the assumptions made by OpenSSL functionality that handles the different file types; this is mostly relevant for PKCS#12 objects. See passphrase-encoding(7) for further information.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_STORE_open() returns a pointer to a OSSL_STORE_CTX on success, or NULL on failure.

                                                                                                                                                          OSSL_STORE_load() returns a pointer to a OSSL_STORE_INFO on success, or NULL on error or when end of data is reached. Use OSSL_STORE_error() and OSSL_STORE_eof() to determine the meaning of a returned NULL.

                                                                                                                                                          OSSL_STORE_eof() returns 1 if the end of data has been reached or an error occurred, 0 otherwise.

                                                                                                                                                          OSSL_STORE_error() returns 1 if an error occurred in an OSSL_STORE_load() call, otherwise 0.

                                                                                                                                                          OSSL_STORE_ctrl() and OSSL_STORE_close() returns 1 on success, or 0 on failure.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ossl_store(7), OSSL_STORE_INFO(3), OSSL_STORE_register_loader(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#history","title":"HISTORY","text":"

                                                                                                                                                          OSSL_STORE_open_ex() was added in OpenSSL 3.0.

                                                                                                                                                          OSSL_STORE_CTX, OSSL_STORE_post_process_info_fn(), OSSL_STORE_open(), OSSL_STORE_ctrl(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close() were added in OpenSSL 1.1.1.

                                                                                                                                                          Handling of NULL ctx argument for OSSL_STORE_close() was introduced in OpenSSL 1.1.1h.

                                                                                                                                                          OSSL_STORE_open_ex() was added in OpenSSL 3.0.

                                                                                                                                                          OSSL_STORE_ctrl() and OSSL_STORE_vctrl() were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_STORE_open/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/","title":"OSSL_trace_enabled","text":""},{"location":"man3/OSSL_trace_enabled/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_trace_enabled, OSSL_trace_begin, OSSL_trace_end, OSSL_TRACE_BEGIN, OSSL_TRACE_END, OSSL_TRACE_CANCEL, OSSL_TRACE, OSSL_TRACE1, OSSL_TRACE2, OSSL_TRACE3, OSSL_TRACE4, OSSL_TRACE5, OSSL_TRACE6, OSSL_TRACE7, OSSL_TRACE8, OSSL_TRACE9, OSSL_TRACEV, OSSL_TRACE_ENABLED - OpenSSL Tracing API

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/trace.h>\n\nint OSSL_trace_enabled(int category);\n\nBIO *OSSL_trace_begin(int category);\nvoid OSSL_trace_end(int category, BIO *channel);\n\n/* trace group macros */\nOSSL_TRACE_BEGIN(category) {\n    ...\n    if (some_error) {\n        /* Leave trace group prematurely in case of an error */\n        OSSL_TRACE_CANCEL(category);\n        goto err;\n    }\n    ...\n} OSSL_TRACE_END(category);\n\n/* one-shot trace macros */\nOSSL_TRACE1(category, format, arg1)\nOSSL_TRACE2(category, format, arg1, arg2)\n...\nOSSL_TRACE9(category, format, arg1, ..., arg9)\n\n/* check whether a trace category is enabled */\nif (OSSL_TRACE_ENABLED(category)) {\n    ...\n}\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The functions described here are mainly interesting for those who provide OpenSSL functionality, either in OpenSSL itself or in engine modules or similar.

                                                                                                                                                          If the tracing facility is enabled (see \"Configure Tracing\" below), these functions are used to generate free text tracing output.

                                                                                                                                                          The tracing output is divided into types which are enabled individually by the application. The tracing types are described in detail in \"Trace types\" in OSSL_trace_set_callback(3). The fallback type OSSL_TRACE_CATEGORY_ALL should not be used with the functions described here.

                                                                                                                                                          Tracing for a specific category is enabled at run-time if a so-called trace channel is attached to it. A trace channel is simply a BIO object to which the application can write its trace output.

                                                                                                                                                          The application has two different ways of registering a trace channel, either by directly providing a BIO object using OSSL_trace_set_channel(3), or by providing a callback routine using OSSL_trace_set_callback(3). The latter is wrapped internally by a dedicated BIO object, so for the tracing code both channel types are effectively indistinguishable. We call them a simple trace channel and a callback trace channel, respectively.

                                                                                                                                                          To produce trace output, it is necessary to obtain a pointer to the trace channel (i.e., the BIO object) using OSSL_trace_begin(), write to it using arbitrary BIO output routines, and finally releases the channel using OSSL_trace_end(). The OSSL_trace_begin()/OSSL_trace_end() calls surrounding the trace output create a group, which acts as a critical section (guarded by a mutex) to ensure that the trace output of different threads does not get mixed up.

                                                                                                                                                          The tracing code normally does not call OSSL_trace_{begin,end}() directly, but rather uses a set of convenience macros, see the \"Macros\" section below.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#functions","title":"Functions","text":"

                                                                                                                                                          OSSL_trace_enabled() can be used to check if tracing for the given category is enabled, i.e., if the tracing facility has been statically enabled (see \"Configure Tracing\" below) and a trace channel has been registered using OSSL_trace_set_channel(3) or OSSL_trace_set_callback(3).

                                                                                                                                                          OSSL_trace_begin() is used to starts a tracing section, and get the channel for the given category in form of a BIO. This BIO can only be used for output.

                                                                                                                                                          OSSL_trace_end() is used to end a tracing section.

                                                                                                                                                          Using OSSL_trace_begin() and OSSL_trace_end() to wrap tracing sections is mandatory. The result of trying to produce tracing output outside of such sections is undefined.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#macros","title":"Macros","text":"

                                                                                                                                                          There are a number of convenience macros defined, to make tracing easy and consistent.

                                                                                                                                                          OSSL_TRACE_BEGIN() and OSSL_TRACE_END() reserve the BIO trc_out and are used as follows to wrap a trace section:

                                                                                                                                                          OSSL_TRACE_BEGIN(TLS) {\n\n    BIO_printf(trc_out, ... );\n\n} OSSL_TRACE_END(TLS);\n

                                                                                                                                                          This will normally expand to:

                                                                                                                                                          do {\n    BIO *trc_out = OSSL_trace_begin(OSSL_TRACE_CATEGORY_TLS);\n    if (trc_out != NULL) {\n        ...\n        BIO_printf(trc_out, ...);\n    }\n    OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out);\n} while (0);\n

                                                                                                                                                          OSSL_TRACE_CANCEL() must be used before returning from or jumping out of a trace section:

                                                                                                                                                          OSSL_TRACE_BEGIN(TLS) {\n\n    if (some_error) {\n        OSSL_TRACE_CANCEL(TLS);\n        goto err;\n    }\n    BIO_printf(trc_out, ... );\n\n} OSSL_TRACE_END(TLS);\n

                                                                                                                                                          This will normally expand to:

                                                                                                                                                          do {\n    BIO *trc_out = OSSL_trace_begin(OSSL_TRACE_CATEGORY_TLS);\n    if (trc_out != NULL) {\n        if (some_error) {\n            OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out);\n            goto err;\n        }\n        BIO_printf(trc_out, ... );\n    }\n    OSSL_trace_end(OSSL_TRACE_CATEGORY_TLS, trc_out);\n} while (0);\n

                                                                                                                                                          OSSL_TRACE() and OSSL_TRACE1(), OSSL_TRACE2(), ... OSSL_TRACE9() are so-called one-shot macros:

                                                                                                                                                          The macro call OSSL_TRACE(category, text), produces literal text trace output.

                                                                                                                                                          The macro call OSSL_TRACEn(category, format, arg1, ..., argn) produces printf-style trace output with n format field arguments (n=1,...,9). It expands to:

                                                                                                                                                          OSSL_TRACE_BEGIN(category) {\n    BIO_printf(trc_out, format, arg1, ..., argN)\n} OSSL_TRACE_END(category)\n

                                                                                                                                                          Internally, all one-shot macros are implemented using a generic OSSL_TRACEV() macro, since C90 does not support variadic macros. This helper macro has a rather weird synopsis and should not be used directly.

                                                                                                                                                          The OSSL_TRACE_ENABLED() macro can be used to conditionally execute some code only if a specific trace category is enabled. In some situations this is simpler than entering a trace section using OSSL_TRACE_BEGIN() and OSSL_TRACE_END(). For example, the code

                                                                                                                                                          if (OSSL_TRACE_ENABLED(TLS)) {\n    ...\n}\n

                                                                                                                                                          expands to

                                                                                                                                                          if (OSSL_trace_enabled(OSSL_TRACE_CATEGORY_TLS) {\n    ...\n}\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#notes","title":"NOTES","text":"

                                                                                                                                                          If producing the trace output requires carrying out auxiliary calculations, this auxiliary code should be placed inside a conditional block which is executed only if the trace category is enabled.

                                                                                                                                                          The most natural way to do this is to place the code inside the trace section itself because it already introduces such a conditional block.

                                                                                                                                                          OSSL_TRACE_BEGIN(TLS) {\n    int var = do_some_auxiliary_calculation();\n\n    BIO_printf(trc_out, \"var = %d\\n\", var);\n\n} OSSL_TRACE_END(TLS);\n

                                                                                                                                                          In some cases it is more advantageous to use a simple conditional group instead of a trace section. This is the case if calculations and tracing happen in different locations of the code, or if the calculations are so time consuming that placing them inside a (critical) trace section would create too much contention.

                                                                                                                                                          if (OSSL_TRACE_ENABLED(TLS)) {\n    int var = do_some_auxiliary_calculation();\n\n    OSSL_TRACE1(\"var = %d\\n\", var);\n}\n

                                                                                                                                                          Note however that premature optimization of tracing code is in general futile and it's better to keep the tracing code as simple as possible. Because most often the limiting factor for the application's speed is the time it takes to print the trace output, not to calculate it.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#configure-tracing","title":"Configure Tracing","text":"

                                                                                                                                                          By default, the OpenSSL library is built with tracing disabled. To use the tracing functionality documented here, it is therefore necessary to configure and build OpenSSL with the 'enable-trace' option.

                                                                                                                                                          When the library is built with tracing disabled:

                                                                                                                                                          • The macro OPENSSL_NO_TRACE is defined in <openssl/opensslconf.h>.
                                                                                                                                                          • all functions are still present, but OSSL_trace_enabled() will always report the categories as disabled, and all other functions will do nothing.
                                                                                                                                                          • the convenience macros are defined to produce dead code. For example, take this example from \"Macros\" section above:

                                                                                                                                                            OSSL_TRACE_BEGIN(TLS) {\n\n    if (condition) {\n        OSSL_TRACE_CANCEL(TLS);\n        goto err;\n    }\n    BIO_printf(trc_out, ... );\n\n} OSSL_TRACE_END(TLS);\n

                                                                                                                                                            When the tracing API isn't operational, that will expand to:

                                                                                                                                                            do {\n    BIO *trc_out = NULL;\n    if (0) {\n        if (condition) {\n            ((void)0);\n            goto err;\n        }\n        BIO_printf(trc_out, ... );\n    }\n} while (0);\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_trace_enabled() returns 1 if tracing for the given type is operational and enabled, otherwise 0.

                                                                                                                                                          OSSL_trace_begin() returns a BIO pointer if the given type is enabled, otherwise NULL.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          OSSL_trace_set_channel(3), OSSL_trace_set_callback(3)

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#history","title":"HISTORY","text":"

                                                                                                                                                          The OpenSSL Tracing API was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_enabled/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_get_category_num/","title":"OSSL_trace_get_category_num","text":""},{"location":"man3/OSSL_trace_get_category_num/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_trace_get_category_num, OSSL_trace_get_category_name - OpenSSL tracing information functions

                                                                                                                                                          "},{"location":"man3/OSSL_trace_get_category_num/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/trace.h>\n\nint OSSL_trace_get_category_num(const char *name);\nconst char *OSSL_trace_get_category_name(int num);\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_get_category_num/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          OSSL_trace_get_category_num() gives the category number corresponding to the given name.

                                                                                                                                                          OSSL_trace_get_category_name() gives the category name corresponding to the given num.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_get_category_num/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_trace_get_category_num() returns the category number if the given name is a recognised category name, otherwise -1.

                                                                                                                                                          OSSL_trace_get_category_name() returns the category name if the given num is a recognised category number, otherwise NULL.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_get_category_num/#history","title":"HISTORY","text":"

                                                                                                                                                          The OpenSSL Tracing API was added ino OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_get_category_num/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/","title":"OSSL_trace_set_channel","text":""},{"location":"man3/OSSL_trace_set_channel/#name","title":"NAME","text":"

                                                                                                                                                          OSSL_trace_set_channel, OSSL_trace_set_prefix, OSSL_trace_set_suffix, OSSL_trace_set_callback, OSSL_trace_cb - Enabling trace output

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/trace.h>\n\ntypedef size_t (*OSSL_trace_cb)(const char *buf, size_t cnt,\n                                int category, int cmd, void *data);\n\nvoid OSSL_trace_set_channel(int category, BIO *bio);\nvoid OSSL_trace_set_prefix(int category, const char *prefix);\nvoid OSSL_trace_set_suffix(int category, const char *suffix);\nvoid OSSL_trace_set_callback(int category, OSSL_trace_cb cb, void  *data);\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          If available (see \"Configure Tracing\" below), the application can request internal trace output. This output comes in form of free text for humans to read.

                                                                                                                                                          The trace output is divided into categories which can be enabled individually. Every category can be enabled individually by attaching a so-called trace channel to it, which in the simplest case is just a BIO object to which the application can write the tracing output for this category. Alternatively, the application can provide a tracer callback in order to get more finegrained trace information. This callback will be wrapped internally by a dedicated BIO object.

                                                                                                                                                          For the tracing code, both trace channel types are indistinguishable. These are called a simple trace channel and a callback trace channel, respectively.

                                                                                                                                                          OSSL_TRACE_ENABLED(3) can be used to check whether tracing is currently enabled for the given category. Functions like OSSL_TRACE1(3) and macros like OSSL_TRACE_BEGIN(3) can be used for producing free-text trace output.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#functions","title":"Functions","text":"

                                                                                                                                                          OSSL_trace_set_channel() is used to enable the given trace category by attaching the BIO bio object as (simple) trace channel. On success the ownership of the BIO is transferred to the channel, so the caller must not free it directly.

                                                                                                                                                          OSSL_trace_set_prefix() and OSSL_trace_set_suffix() can be used to add an extra line for each channel, to be output before and after group of tracing output. What constitutes an output group is decided by the code that produces the output. The lines given here are considered immutable; for more dynamic tracing prefixes, consider setting a callback with OSSL_trace_set_callback() instead.

                                                                                                                                                          OSSL_trace_set_callback() is used to enable the given trace category by giving it the tracer callback cb with the associated data data, which will simply be passed through to cb whenever it's called. The callback function is internally wrapped by a dedicated BIO object, the so-called callback trace channel. This should be used when it's desirable to do form the trace output to something suitable for application needs where a prefix and suffix line aren't enough.

                                                                                                                                                          OSSL_trace_set_channel() and OSSL_trace_set_callback() are mutually exclusive, calling one of them will clear whatever was set by the previous call.

                                                                                                                                                          Calling OSSL_trace_set_channel() with NULL for channel or OSSL_trace_set_callback() with NULL for cb disables tracing for the given category.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#trace-callback","title":"Trace callback","text":"

                                                                                                                                                          The tracer callback must return a size_t, which must be zero on error and otherwise return the number of bytes that were output. It receives a text buffer buf with cnt bytes of text, as well as the category, a control number cmd, and the data that was passed to OSSL_trace_set_callback().

                                                                                                                                                          The possible control numbers are:

                                                                                                                                                          • OSSL_TRACE_CTRL_BEGIN

                                                                                                                                                            The callback is called from OSSL_trace_begin(), which gives the callback the possibility to output a dynamic starting line, or set a prefix that should be output at the beginning of each line, or something other.

                                                                                                                                                          • OSSL_TRACE_CTRL_WRITE

                                                                                                                                                            This callback is called whenever data is written to the BIO by some regular BIO output routine. An arbitrary number of OSSL_TRACE_CTRL_WRITE callbacks can occur inside a group marked by a pair of OSSL_TRACE_CTRL_BEGIN and OSSL_TRACE_CTRL_END calls, but never outside such a group.

                                                                                                                                                          • OSSL_TRACE_CTRL_END

                                                                                                                                                            The callback is called from OSSL_trace_end(), which gives the callback the possibility to output a dynamic ending line, or reset the line prefix that was set with OSSL_TRACE_CTRL_BEGIN, or something other.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#trace-categories","title":"Trace categories","text":"

                                                                                                                                                          The trace categories are simple numbers available through macros.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_TRACE

                                                                                                                                                            Traces the OpenSSL trace API itself.

                                                                                                                                                            More precisely, this will generate trace output any time a new trace hook is set.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_INIT

                                                                                                                                                            Traces OpenSSL library initialization and cleanup.

                                                                                                                                                            This needs special care, as OpenSSL will do automatic cleanup after exit from main(), and any tracing output done during this cleanup will be lost if the tracing channel or callback were cleaned away prematurely. A suggestion is to make such cleanup part of a function that's registered very early with atexit(3).

                                                                                                                                                          • OSSL_TRACE_CATEGORY_TLS

                                                                                                                                                            Traces the TLS/SSL protocol.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_TLS_CIPHER

                                                                                                                                                            Traces the ciphers used by the TLS/SSL protocol.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_CONF

                                                                                                                                                            Traces details about the provider and engine configuration.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_ENGINE_TABLE

                                                                                                                                                            Traces the ENGINE algorithm table selection.

                                                                                                                                                            More precisely, functions like ENGINE_get_pkey_asn1_meth_engine(), ENGINE_get_pkey_meth_engine(), ENGINE_get_cipher_engine(), ENGINE_get_digest_engine(), will generate trace summaries of the handling of internal tables.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_ENGINE_REF_COUNT

                                                                                                                                                            Traces the ENGINE reference counting.

                                                                                                                                                            More precisely, both reference counts in the ENGINE structure will be monitored with a line of trace output generated for each change.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_PKCS5V2

                                                                                                                                                            Traces PKCS#5 v2 key generation.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_PKCS12_KEYGEN

                                                                                                                                                            Traces PKCS#12 key generation.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_PKCS12_DECRYPT

                                                                                                                                                            Traces PKCS#12 decryption.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_X509V3_POLICY

                                                                                                                                                            Traces X509v3 policy processing.

                                                                                                                                                            More precisely, this generates the complete policy tree at various point during evaluation.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_BN_CTX

                                                                                                                                                            Traces BIGNUM context operations.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_CMP

                                                                                                                                                            Traces CMP client and server activity.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_STORE

                                                                                                                                                            Traces STORE operations.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_DECODER

                                                                                                                                                            Traces decoder operations.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_ENCODER

                                                                                                                                                            Traces encoder operations.

                                                                                                                                                          • OSSL_TRACE_CATEGORY_REF_COUNT

                                                                                                                                                            Traces decrementing certain ASN.1 structure references.

                                                                                                                                                          There is also OSSL_TRACE_CATEGORY_ALL, which works as a fallback and can be used to get all trace output.

                                                                                                                                                          Note, however, that in this case all trace output will effectively be associated with the 'ALL' category, which is undesirable if the application intends to include the category name in the trace output. In this case it is better to register separate channels for each trace category instead.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OSSL_trace_set_channel(), OSSL_trace_set_prefix(), OSSL_trace_set_suffix(), and OSSL_trace_set_callback() return 1 on success, or 0 on failure.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          In all examples below, the trace producing code is assumed to be the following:

                                                                                                                                                          int foo = 42;\nconst char bar[] = { 0,  1,  2,  3,  4,  5,  6,  7,\n                     8,  9, 10, 11, 12, 13, 14, 15 };\n\nOSSL_TRACE_BEGIN(TLS) {\n    BIO_puts(trc_out, \"foo: \");\n    BIO_printf(trc_out, \"%d\\n\", foo);\n    BIO_dump(trc_out, bar, sizeof(bar));\n} OSSL_TRACE_END(TLS);\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#simple-example","title":"Simple example","text":"

                                                                                                                                                          An example with just a channel and constant prefix / suffix.

                                                                                                                                                          int main(int argc, char *argv[])\n{\n    BIO *err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);\n    OSSL_trace_set_channel(OSSL_TRACE_CATEGORY_SSL, err);\n    OSSL_trace_set_prefix(OSSL_TRACE_CATEGORY_SSL, \"BEGIN TRACE[TLS]\");\n    OSSL_trace_set_suffix(OSSL_TRACE_CATEGORY_SSL, \"END TRACE[TLS]\");\n\n    /* ... work ... */\n}\n

                                                                                                                                                          When the trace producing code above is performed, this will be output on standard error:

                                                                                                                                                          BEGIN TRACE[TLS]\nfoo: 42\n0000 - 00 01 02 03 04 05 06 07-08 09 0a 0b 0c 0d 0e 0f   ................\nEND TRACE[TLS]\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#advanced-example","title":"Advanced example","text":"

                                                                                                                                                          This example uses the callback, and depends on pthreads functionality.

                                                                                                                                                          static size_t cb(const char *buf, size_t cnt,\n                int category, int cmd, void *vdata)\n{\n    BIO *bio = vdata;\n    const char *label = NULL;\n\n    switch (cmd) {\n    case OSSL_TRACE_CTRL_BEGIN:\n        label = \"BEGIN\";\n        break;\n    case OSSL_TRACE_CTRL_END:\n        label = \"END\";\n        break;\n    }\n\n    if (label != NULL) {\n        union {\n            pthread_t tid;\n            unsigned long ltid;\n        } tid;\n\n        tid.tid = pthread_self();\n        BIO_printf(bio, \"%s TRACE[%s]:%lx\\n\",\n                   label, OSSL_trace_get_category_name(category), tid.ltid);\n    }\n    return (size_t)BIO_puts(bio, buf);\n}\n\nint main(int argc, char *argv[])\n{\n    BIO *err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);\n    OSSL_trace_set_callback(OSSL_TRACE_CATEGORY_SSL, cb, err);\n\n    /* ... work ... */\n}\n

                                                                                                                                                          The output is almost the same as for the simple example above.

                                                                                                                                                          BEGIN TRACE[TLS]:7f9eb0193b80\nfoo: 42\n0000 - 00 01 02 03 04 05 06 07-08 09 0a 0b 0c 0d 0e 0f   ................\nEND TRACE[TLS]:7f9eb0193b80\n
                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#notes","title":"NOTES","text":""},{"location":"man3/OSSL_trace_set_channel/#configure-tracing","title":"Configure Tracing","text":"

                                                                                                                                                          By default, the OpenSSL library is built with tracing disabled. To use the tracing functionality documented here, it is therefore necessary to configure and build OpenSSL with the 'enable-trace' option.

                                                                                                                                                          When the library is built with tracing disabled, the macro OPENSSL_NO_TRACE is defined in <openssl/opensslconf.h> and all functions described here are inoperational, i.e. will do nothing.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          OSSL_TRACE_ENABLED(3), OSSL_TRACE_BEGIN(3), OSSL_TRACE1(3), atexit(3)

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#history","title":"HISTORY","text":"

                                                                                                                                                          OSSL_trace_set_channel(), OSSL_trace_set_prefix(), OSSL_trace_set_suffix(), and OSSL_trace_set_callback() were all added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/OSSL_trace_set_channel/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OpenSSL_add_all_algorithms/","title":"OpenSSL_add_all_algorithms","text":""},{"location":"man3/OpenSSL_add_all_algorithms/#name","title":"NAME","text":"

                                                                                                                                                          OpenSSL_add_all_algorithms, OpenSSL_add_all_ciphers, OpenSSL_add_all_digests, EVP_cleanup - add algorithms to internal table

                                                                                                                                                          "},{"location":"man3/OpenSSL_add_all_algorithms/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/evp.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          void OpenSSL_add_all_algorithms(void);\nvoid OpenSSL_add_all_ciphers(void);\nvoid OpenSSL_add_all_digests(void);\n\nvoid EVP_cleanup(void);\n
                                                                                                                                                          "},{"location":"man3/OpenSSL_add_all_algorithms/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          OpenSSL keeps an internal table of digest algorithms and ciphers. It uses this table to lookup ciphers via functions such as EVP_get_cipher_byname().

                                                                                                                                                          OpenSSL_add_all_digests() adds all digest algorithms to the table.

                                                                                                                                                          OpenSSL_add_all_algorithms() adds all algorithms to the table (digests and ciphers).

                                                                                                                                                          OpenSSL_add_all_ciphers() adds all encryption algorithms to the table including password based encryption algorithms.

                                                                                                                                                          In versions prior to 1.1.0 EVP_cleanup() removed all ciphers and digests from the table. It no longer has any effect in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/OpenSSL_add_all_algorithms/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          None of the functions return a value.

                                                                                                                                                          "},{"location":"man3/OpenSSL_add_all_algorithms/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          evp(7), EVP_DigestInit(3), EVP_EncryptInit(3)

                                                                                                                                                          "},{"location":"man3/OpenSSL_add_all_algorithms/#history","title":"HISTORY","text":"

                                                                                                                                                          The OpenSSL_add_all_algorithms(), OpenSSL_add_all_ciphers(), OpenSSL_add_all_digests(), and EVP_cleanup(), functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto() and should not be used.

                                                                                                                                                          "},{"location":"man3/OpenSSL_add_all_algorithms/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/OpenSSL_version/","title":"OpenSSL_version","text":""},{"location":"man3/OpenSSL_version/#name","title":"NAME","text":"

                                                                                                                                                          OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE, OPENSSL_VERSION_BUILD_METADATA, OPENSSL_VERSION_TEXT, OPENSSL_VERSION_PREREQ, OPENSSL_version_major, OPENSSL_version_minor, OPENSSL_version_patch, OPENSSL_version_pre_release, OPENSSL_version_build_metadata, OpenSSL_version, OPENSSL_VERSION_NUMBER, OpenSSL_version_num, OPENSSL_info - get OpenSSL version number and other information

                                                                                                                                                          "},{"location":"man3/OpenSSL_version/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/opensslv.h>\n\n#define OPENSSL_VERSION_MAJOR  x\n#define OPENSSL_VERSION_MINOR  y\n#define OPENSSL_VERSION_PATCH  z\n\n/* The definitions here are typical release values */\n#define OPENSSL_VERSION_PRE_RELEASE \"\"\n#define OPENSSL_VERSION_BUILD_METADATA \"\"\n\n#define OPENSSL_VERSION_TEXT \"OpenSSL x.y.z xx XXX xxxx\"\n\n#define OPENSSL_VERSION_PREREQ(maj,min)\n\n#include <openssl/crypto.h>\n\nunsigned int OPENSSL_version_major(void);\nunsigned int OPENSSL_version_minor(void);\nunsigned int OPENSSL_version_patch(void);\nconst char *OPENSSL_version_pre_release(void);\nconst char *OPENSSL_version_build_metadata(void);\n\nconst char *OpenSSL_version(int t);\n\nconst char *OPENSSL_info(int t);\n\n/* from openssl/opensslv.h */\n#define OPENSSL_VERSION_NUMBER 0xnnnnnnnnL\n\n/* from openssl/crypto.h */\nunsigned long OpenSSL_version_num();\n
                                                                                                                                                          "},{"location":"man3/OpenSSL_version/#description","title":"DESCRIPTION","text":""},{"location":"man3/OpenSSL_version/#macros","title":"Macros","text":"

                                                                                                                                                          The three macros OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR and OPENSSL_VERSION_PATCH represent the three parts of a version identifier, MAJOR.MINOR.PATCH.

                                                                                                                                                          The macro OPENSSL_VERSION_PRE_RELEASE is an added bit of text that indicates that this is a pre-release version, such as \"-dev\" for an ongoing development snapshot or \"-alpha3\" for an alpha release. The value must be a string.

                                                                                                                                                          The macro OPENSSL_VERSION_BUILD_METADATA is extra information, reserved for other parties, such as \"+fips\", or \"+vendor.1\"). The OpenSSL project will not touch this macro (will leave it an empty string). The value must be a string.

                                                                                                                                                          OPENSSL_VERSION_STR is a convenience macro to get the short version identifier string, \"_MAJOR_._MINOR_._PATCH_\".

                                                                                                                                                          OPENSSL_FULL_VERSION_STR is a convenience macro to get the longer version identifier string, which combines OPENSSL_VERSION_STR, OPENSSL_VERSION_PRE_RELEASE and OPENSSL_VERSION_BUILD_METADATA.

                                                                                                                                                          OPENSSL_VERSION_TEXT is a convenience macro to get a full descriptive version text, which includes OPENSSL_FULL_VERSION_STR and the release date.

                                                                                                                                                          OPENSSL_VERSION_PREREQ is a useful macro for checking whether the OpenSSL version for the headers in use is at least at the given pre-requisite major (maj) and minor (min) number or not. It will evaluate to true if the header version number (OPENSSL_VERSION_MAJOR.OPENSSL_VERSION_MINOR) is greater than or equal to maj.min.

                                                                                                                                                          OPENSSL_VERSION_NUMBER is a combination of the major, minor and patch version into a single integer 0xMNN00PP0L, where:

                                                                                                                                                          • M

                                                                                                                                                            is the number from OPENSSL_VERSION_MAJOR, in hexadecimal notation

                                                                                                                                                          • NN

                                                                                                                                                            is the number from OPENSSL_VERSION_MINOR, in hexadecimal notation

                                                                                                                                                          • PP

                                                                                                                                                            is the number from OPENSSL_VERSION_PATCH, in hexadecimal notation

                                                                                                                                                          "},{"location":"man3/OpenSSL_version/#functions","title":"Functions","text":"

                                                                                                                                                          OPENSSL_version_major(), OPENSSL_version_minor(), OPENSSL_version_patch(), OPENSSL_version_pre_release(), and OPENSSL_version_build_metadata() return the values of the macros above for the build of the library, respectively.

                                                                                                                                                          OpenSSL_version() returns different strings depending on t:

                                                                                                                                                          • OPENSSL_VERSION

                                                                                                                                                            The value of OPENSSL_VERSION_TEXT

                                                                                                                                                          • OPENSSL_VERSION_STRING

                                                                                                                                                            The value of OPENSSL_VERSION_STR

                                                                                                                                                          • OPENSSL_FULL_VERSION_STRING

                                                                                                                                                            The value of OPENSSL_FULL_VERSION_STR

                                                                                                                                                          • OPENSSL_CFLAGS

                                                                                                                                                            The compiler flags set for the compilation process in the form compiler: ... if available, or compiler: information not available otherwise.

                                                                                                                                                          • OPENSSL_BUILT_ON

                                                                                                                                                            The date of the build process in the form built on: ... if available or built on: date not available otherwise. The date would not be available in a reproducible build, for example.

                                                                                                                                                          • OPENSSL_PLATFORM

                                                                                                                                                            The \"Configure\" target of the library build in the form platform: ... if available, or platform: information not available otherwise.

                                                                                                                                                          • OPENSSL_DIR

                                                                                                                                                            The OPENSSLDIR setting of the library build in the form OPENSSLDIR: \"...\" if available, or OPENSSLDIR: N/A otherwise.

                                                                                                                                                          • OPENSSL_ENGINES_DIR

                                                                                                                                                            The ENGINESDIR setting of the library build in the form ENGINESDIR: \"...\" if available, or ENGINESDIR: N/A otherwise. This option is deprecated in OpenSSL 3.0.

                                                                                                                                                          • OPENSSL_MODULES_DIR

                                                                                                                                                            The MODULESDIR setting of the library build in the form MODULESDIR: \"...\" if available, or MODULESDIR: N/A otherwise.

                                                                                                                                                          • OPENSSL_CPU_INFO

                                                                                                                                                            The current OpenSSL cpu settings. This is the current setting of the cpu capability flags. It is usually automatically configured but may be set via an environment variable. The value has the same syntax as the environment variable. For x86 the string looks like CPUINFO: OPENSSL_ia32cap=0x123:0x456 or CPUINFO: N/A if not available.

                                                                                                                                                          For an unknown t, the text not available is returned.

                                                                                                                                                          OPENSSL_info() also returns different strings depending on t:

                                                                                                                                                          • OPENSSL_INFO_CONFIG_DIR

                                                                                                                                                            The configured OPENSSLDIR, which is the default location for OpenSSL configuration files.

                                                                                                                                                          • OPENSSL_INFO_ENGINES_DIR

                                                                                                                                                            The configured ENGINESDIR, which is the default location for OpenSSL engines.

                                                                                                                                                          • OPENSSL_INFO_MODULES_DIR

                                                                                                                                                            The configured MODULESDIR, which is the default location for dynamically loadable OpenSSL modules other than engines.

                                                                                                                                                          • OPENSSL_INFO_DSO_EXTENSION

                                                                                                                                                            The configured dynamically loadable module extension.

                                                                                                                                                          • OPENSSL_INFO_DIR_FILENAME_SEPARATOR

                                                                                                                                                            The separator between a directory specification and a filename. Note that on some operating systems, this is not the same as the separator between directory elements.

                                                                                                                                                          • OPENSSL_INFO_LIST_SEPARATOR

                                                                                                                                                            The OpenSSL list separator. This is typically used in strings that are lists of items, such as the value of the environment variable $PATH on Unix (where the separator is :) or %PATH% on Windows (where the separator is ;).

                                                                                                                                                          • OPENSSL_INFO_CPU_SETTINGS

                                                                                                                                                            The current OpenSSL cpu settings. This is the current setting of the cpu capability flags. It is usually automatically configured but may be set via an environment variable. The value has the same syntax as the environment variable. For x86 the string looks like OPENSSL_ia32cap=0x123:0x456.

                                                                                                                                                          For an unknown t, NULL is returned.

                                                                                                                                                          OpenSSL_version_num() returns the value of OPENSSL_VERSION_NUMBER.

                                                                                                                                                          "},{"location":"man3/OpenSSL_version/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          OPENSSL_version_major(), OPENSSL_version_minor() and OPENSSL_version_patch() return the version number parts as integers.

                                                                                                                                                          OPENSSL_version_pre_release() and OPENSSL_version_build_metadata() return the values of OPENSSL_VERSION_PRE_RELEASE and OPENSSL_VERSION_BUILD_METADATA respectively as constant strings. For any of them that is undefined, the empty string is returned.

                                                                                                                                                          OpenSSL_version() returns constant strings.

                                                                                                                                                          "},{"location":"man3/OpenSSL_version/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          crypto(7)

                                                                                                                                                          "},{"location":"man3/OpenSSL_version/#history","title":"HISTORY","text":"

                                                                                                                                                          The macros and functions described here were added in OpenSSL 3.0, except for OPENSSL_VERSION_NUMBER and OpenSSL_version_num().

                                                                                                                                                          "},{"location":"man3/OpenSSL_version/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_X509_INFO_read_bio_ex/","title":"PEM_X509_INFO_read_bio_ex","text":""},{"location":"man3/PEM_X509_INFO_read_bio_ex/#name","title":"NAME","text":"

                                                                                                                                                          PEM_X509_INFO_read_ex, PEM_X509_INFO_read, PEM_X509_INFO_read_bio_ex, PEM_X509_INFO_read_bio - read PEM-encoded data structures into one or more X509_INFO objects

                                                                                                                                                          "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pem.h>\n\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read_ex(FILE *fp, STACK_OF(X509_INFO) *sk,\n                                           pem_password_cb *cb, void *u,\n                                           OSSL_LIB_CTX *libctx,\n                                           const char *propq);\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,\n                                        pem_password_cb *cb, void *u);\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bio,\n                                               STACK_OF(X509_INFO) *sk,\n                                               pem_password_cb *cb, void *u,\n                                               OSSL_LIB_CTX *libctx,\n                                               const char *propq);\nSTACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk,\n                                            pem_password_cb *cb, void *u);\n
                                                                                                                                                          "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PEM_X509_INFO_read_ex() loads the X509_INFO objects from a file fp.

                                                                                                                                                          PEM_X509_INFO_read() is similar to PEM_X509_INFO_read_ex() but uses the default (NULL) library context libctx and empty property query propq.

                                                                                                                                                          PEM_X509_INFO_read_bio_ex() loads the X509_INFO objects using a bio bp.

                                                                                                                                                          PEM_X509_INFO_read_bio() is similar to PEM_X509_INFO_read_bio_ex() but uses the default (NULL) library context libctx and empty property query propq.

                                                                                                                                                          Each of the loaded X509_INFO objects can contain a CRL, a certificate, and/or a private key. The elements are read sequentially, and as far as they are of different type than the elements read before, they are combined into the same X509_INFO object. The idea behind this is that if, for instance, a certificate is followed by a private key, the private key is supposed to correspond to the certificate.

                                                                                                                                                          If the input stack sk is NULL a new stack is allocated, else the given stack is extended.

                                                                                                                                                          The optional cb and u parameters can be used for providing a pass phrase needed for decrypting encrypted PEM structures (normally only private keys). See PEM_read_bio_PrivateKey(3) and passphrase-encoding(7) for details.

                                                                                                                                                          The library context libctx and property query propq are used for fetching algorithms from providers.

                                                                                                                                                          "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PEM_X509_INFO_read_ex(), PEM_X509_INFO_read(), PEM_X509_INFO_read_bio_ex() and PEM_X509_INFO_read_bio() return a stack of X509_INFO objects or NULL on failure.

                                                                                                                                                          "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PEM_read_bio_ex(3), PEM_read_bio_PrivateKey(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#history","title":"HISTORY","text":"

                                                                                                                                                          The functions PEM_X509_INFO_read_ex() and PEM_X509_INFO_read_bio_ex() were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PEM_X509_INFO_read_bio_ex/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/","title":"PEM_bytes_read_bio","text":""},{"location":"man3/PEM_bytes_read_bio/#name","title":"NAME","text":"

                                                                                                                                                          PEM_bytes_read_bio, PEM_bytes_read_bio_secmem - read a PEM-encoded data structure from a BIO

                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pem.h>\n\nint PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,\n                       const char *name, BIO *bp, pem_password_cb *cb,\n                       void *u);\nint PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm,\n                              const char *name, BIO *bp, pem_password_cb *cb,\n                              void *u);\n
                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PEM_bytes_read_bio() reads PEM-formatted (IETF RFC 1421 and IETF RFC 7468) data from the BIO bp for the data type given in name (RSA PRIVATE KEY, CERTIFICATE, etc.). If multiple PEM-encoded data structures are present in the same stream, PEM_bytes_read_bio() will skip non-matching data types and continue reading. Non-PEM data present in the stream may cause an error.

                                                                                                                                                          The PEM header may indicate that the following data is encrypted; if so, the data will be decrypted, waiting on user input to supply a passphrase if needed. The password callback cb and rock u are used to obtain the decryption passphrase, if applicable.

                                                                                                                                                          Some data types have compatibility aliases, such as a file containing X509 CERTIFICATE matching a request for the deprecated type CERTIFICATE. The actual type indicated by the file is returned in *pnm if pnm is non-NULL. The caller must free the storage pointed to by *pnm.

                                                                                                                                                          The returned data is the DER-encoded form of the requested type, in *pdata with length *plen. The caller must free the storage pointed to by *pdata.

                                                                                                                                                          PEM_bytes_read_bio_secmem() is similar to PEM_bytes_read_bio(), but uses memory from the secure heap for its temporary buffers and the storage returned in *pdata and *pnm. Accordingly, the caller must use OPENSSL_secure_free() to free that storage.

                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/#notes","title":"NOTES","text":"

                                                                                                                                                          PEM_bytes_read_bio_secmem() only enforces that the secure heap is used for storage allocated within the PEM processing stack. The BIO stack from which input is read may also use temporary buffers, which are not necessarily allocated from the secure heap. In cases where it is desirable to ensure that the contents of the PEM file only appears in memory from the secure heap, care is needed in generating the BIO passed as bp. In particular, the use of BIO_s_file() indicates the use of the operating system stdio functionality, which includes buffering as a feature; BIO_s_fd() is likely to be more appropriate in such cases.

                                                                                                                                                          These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PEM_bytes_read_bio() and PEM_bytes_read_bio_secmem() return 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PEM_read_bio_ex(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/#history","title":"HISTORY","text":"

                                                                                                                                                          PEM_bytes_read_bio_secmem() was introduced in OpenSSL 1.1.1

                                                                                                                                                          "},{"location":"man3/PEM_bytes_read_bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_read/","title":"PEM_read","text":""},{"location":"man3/PEM_read/#name","title":"NAME","text":"

                                                                                                                                                          PEM_write, PEM_write_bio, PEM_read, PEM_read_bio, PEM_do_header, PEM_get_EVP_CIPHER_INFO - PEM encoding routines

                                                                                                                                                          "},{"location":"man3/PEM_read/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pem.h>\n\nint PEM_write(FILE *fp, const char *name, const char *header,\n              const unsigned char *data, long len);\nint PEM_write_bio(BIO *bp, const char *name, const char *header,\n                  const unsigned char *data, long len);\n\nint PEM_read(FILE *fp, char **name, char **header,\n             unsigned char **data, long *len);\nint PEM_read_bio(BIO *bp, char **name, char **header,\n                 unsigned char **data, long *len);\n\nint PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cinfo);\nint PEM_do_header(EVP_CIPHER_INFO *cinfo, unsigned char *data, long *len,\n                  pem_password_cb *cb, void *u);\n
                                                                                                                                                          "},{"location":"man3/PEM_read/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions read and write PEM-encoded objects, using the PEM type name, any additional header information, and the raw data of length len.

                                                                                                                                                          PEM is the term used for binary content encoding first defined in IETF RFC 1421. The content is a series of base64-encoded lines, surrounded by begin/end markers each on their own line. For example:

                                                                                                                                                          -----BEGIN PRIVATE KEY-----\nMIICdg....\n... bhTQ==\n-----END PRIVATE KEY-----\n

                                                                                                                                                          Optional header line(s) may appear after the begin line, and their existence depends on the type of object being written or read.

                                                                                                                                                          PEM_write() writes to the file fp, while PEM_write_bio() writes to the BIO bp. The name is the name to use in the marker, the header is the header value or NULL, and data and len specify the data and its length.

                                                                                                                                                          The final data buffer is typically an ASN.1 object which can be decoded with the d2i function appropriate to the type name; see d2i_X509(3) for examples.

                                                                                                                                                          PEM_read() reads from the file fp, while PEM_read_bio() reads from the BIO bp. Both skip any non-PEM data that precedes the start of the next PEM object. When an object is successfully retrieved, the type name from the \"----BEGIN <type>-----\" is returned via the name argument, any encapsulation headers are returned in header and the base64-decoded content and its length are returned via data and len respectively. The name, header and data pointers are allocated via OPENSSL_malloc() and should be freed by the caller via OPENSSL_free() when no longer needed.

                                                                                                                                                          PEM_get_EVP_CIPHER_INFO() can be used to determine the data returned by PEM_read() or PEM_read_bio() is encrypted and to retrieve the associated cipher and IV. The caller passes a pointer to structure of type EVP_CIPHER_INFO via the cinfo argument and the header returned via PEM_read() or PEM_read_bio(). If the call is successful 1 is returned and the cipher and IV are stored at the address pointed to by cinfo. When the header is malformed, or not supported or when the cipher is unknown or some internal error happens 0 is returned. This function is deprecated, see NOTES below.

                                                                                                                                                          PEM_do_header() can then be used to decrypt the data if the header indicates encryption. The cinfo argument is a pointer to the structure initialized by the previous call to PEM_get_EVP_CIPHER_INFO(). The data and len arguments are those returned by the previous call to PEM_read() or PEM_read_bio(). The cb and u arguments make it possible to override the default password prompt function as described in PEM_read_PrivateKey(3). On successful completion the data is decrypted in place, and len is updated to indicate the plaintext length. This function is deprecated, see NOTES below.

                                                                                                                                                          If the data is a priori known to not be encrypted, then neither PEM_do_header() nor PEM_get_EVP_CIPHER_INFO() need be called.

                                                                                                                                                          "},{"location":"man3/PEM_read/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PEM_read() and PEM_read_bio() return 1 on success and 0 on failure, the latter includes the case when no more PEM objects remain in the input file. To distinguish end of file from more serious errors the caller must peek at the error stack and check for PEM_R_NO_START_LINE, which indicates that no more PEM objects were found. See ERR_peek_last_error(3), ERR_GET_REASON(3).

                                                                                                                                                          PEM_get_EVP_CIPHER_INFO() and PEM_do_header() return 1 on success, and 0 on failure. The data is likely meaningless if these functions fail.

                                                                                                                                                          "},{"location":"man3/PEM_read/#notes","title":"NOTES","text":"

                                                                                                                                                          The PEM_get_EVP_CIPHER_INFO() and PEM_do_header() functions are deprecated. This is because the underlying PEM encryption format is obsolete, and should be avoided. It uses an encryption format with an OpenSSL-specific key-derivation function, which employs MD5 with an iteration count of 1! Instead, private keys should be stored in PKCS#8 form, with a strong PKCS#5 v2.0 PBE. See PEM_write_PrivateKey(3) and d2i_PKCS8PrivateKey_bio(3).

                                                                                                                                                          PEM_do_header() makes no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                                                                                                                                                          "},{"location":"man3/PEM_read/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_peek_last_error(3), ERR_GET_LIB(3), d2i_PKCS8PrivateKey_bio(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PEM_read/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 1998-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/","title":"PEM_read_CMS","text":""},{"location":"man3/PEM_read_CMS/#name","title":"NAME","text":"

                                                                                                                                                          DECLARE_PEM_rw, PEM_read_CMS, PEM_read_bio_CMS, PEM_write_CMS, PEM_write_bio_CMS, PEM_write_DHxparams, PEM_write_bio_DHxparams, PEM_read_ECPKParameters, PEM_read_bio_ECPKParameters, PEM_write_ECPKParameters, PEM_write_bio_ECPKParameters, PEM_read_ECPrivateKey, PEM_write_ECPrivateKey, PEM_write_bio_ECPrivateKey, PEM_read_EC_PUBKEY, PEM_read_bio_EC_PUBKEY, PEM_write_EC_PUBKEY, PEM_write_bio_EC_PUBKEY, PEM_read_NETSCAPE_CERT_SEQUENCE, PEM_read_bio_NETSCAPE_CERT_SEQUENCE, PEM_write_NETSCAPE_CERT_SEQUENCE, PEM_write_bio_NETSCAPE_CERT_SEQUENCE, PEM_read_PKCS8, PEM_read_bio_PKCS8, PEM_write_PKCS8, PEM_write_bio_PKCS8, PEM_write_PKCS8_PRIV_KEY_INFO, PEM_read_bio_PKCS8_PRIV_KEY_INFO, PEM_read_PKCS8_PRIV_KEY_INFO, PEM_write_bio_PKCS8_PRIV_KEY_INFO, PEM_read_SSL_SESSION, PEM_read_bio_SSL_SESSION, PEM_write_SSL_SESSION, PEM_write_bio_SSL_SESSION, PEM_read_X509_PUBKEY, PEM_read_bio_X509_PUBKEY, PEM_write_X509_PUBKEY, PEM_write_bio_X509_PUBKEY - PEM object encoding routines

                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pem.h>\n\nDECLARE_PEM_rw(name, TYPE)\n\nTYPE *PEM_read_TYPE(FILE *fp, TYPE **a, pem_password_cb *cb, void *u);\nTYPE *PEM_read_bio_TYPE(BIO *bp, TYPE **a, pem_password_cb *cb, void *u);\nint PEM_write_TYPE(FILE *fp, const TYPE *a);\nint PEM_write_bio_TYPE(BIO *bp, const TYPE *a);\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          #include <openssl/pem.h>\n\nint PEM_write_DHxparams(FILE *out, const DH *dh);\nint PEM_write_bio_DHxparams(BIO *out, const DH *dh);\nEC_GROUP *PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u);\nEC_GROUP *PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u);\nint PEM_write_ECPKParameters(FILE *out, const EC_GROUP *x);\nint PEM_write_bio_ECPKParameters(BIO *out, const EC_GROUP *x),\n\nEC_KEY *PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u);\nEC_KEY *PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u);\nint PEM_write_EC_PUBKEY(FILE *out, const EC_KEY *x);\nint PEM_write_bio_EC_PUBKEY(BIO *out, const EC_KEY *x);\n\nEC_KEY *PEM_read_ECPrivateKey(FILE *out, EC_KEY **x, pem_password_cb *cb, void *u);\nEC_KEY *PEM_read_bio_ECPrivateKey(BIO *out, EC_KEY **x, pem_password_cb *cb, void *u);\nint PEM_write_ECPrivateKey(FILE *out, const EC_KEY *x, const EVP_CIPHER *enc,\n                           const unsigned char *kstr, int klen,\n                           pem_password_cb *cb, void *u);\nint PEM_write_bio_ECPrivateKey(BIO *out, const EC_KEY *x, const EVP_CIPHER *enc,\n                               const unsigned char *kstr, int klen,\n                               pem_password_cb *cb, void *u);\n
                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should use OSSL_ENCODER_to_bio() and OSSL_DECODER_from_bio() instead.

                                                                                                                                                          In the description below, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509. The macro DECLARE_PEM_rw expands to the set of declarations shown in the next four lines of the synopsis.

                                                                                                                                                          These routines convert between local instances of ASN1 datatypes and the PEM encoding. For more information on the templates, see ASN1_ITEM(3). For more information on the lower-level routines used by the functions here, see PEM_read(3).

                                                                                                                                                          PEM_read_TYPE() reads a PEM-encoded object of TYPE from the file fp and returns it. The cb and u parameters are as described in pem_password_cb(3).

                                                                                                                                                          PEM_read_bio_TYPE() is similar to PEM_read_TYPE() but reads from the BIO bp.

                                                                                                                                                          PEM_write_TYPE() writes the PEM encoding of the object a to the file fp.

                                                                                                                                                          PEM_write_bio_TYPE() similarly writes to the BIO bp.

                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/#notes","title":"NOTES","text":"

                                                                                                                                                          These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PEM_read_TYPE() and PEM_read_bio_TYPE() return a pointer to an allocated object, which should be released by calling TYPE_free(), or NULL on error.

                                                                                                                                                          PEM_write_TYPE() and PEM_write_bio_TYPE() return 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PEM_read(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/#history","title":"HISTORY","text":"

                                                                                                                                                          The functions PEM_write_DHxparams(), PEM_write_bio_DHxparams(), PEM_read_ECPKParameters(), PEM_read_bio_ECPKParameters(), PEM_write_ECPKParameters(), PEM_write_bio_ECPKParameters(), PEM_read_EC_PUBKEY(), PEM_read_bio_EC_PUBKEY(), PEM_write_EC_PUBKEY(), PEM_write_bio_EC_PUBKEY(), PEM_read_ECPrivateKey(), PEM_read_bio_ECPrivateKey(), PEM_write_ECPrivateKey() and PEM_write_bio_ECPrivateKey() were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PEM_read_CMS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/","title":"PEM_read_bio_PrivateKey","text":""},{"location":"man3/PEM_read_bio_PrivateKey/#name","title":"NAME","text":"

                                                                                                                                                          pem_password_cb, PEM_read_bio_PrivateKey_ex, PEM_read_bio_PrivateKey, PEM_read_PrivateKey_ex, PEM_read_PrivateKey, PEM_write_bio_PrivateKey_ex, PEM_write_bio_PrivateKey, PEM_write_bio_PrivateKey_traditional, PEM_write_PrivateKey_ex, PEM_write_PrivateKey, PEM_write_bio_PKCS8PrivateKey, PEM_write_PKCS8PrivateKey, PEM_write_bio_PKCS8PrivateKey_nid, PEM_write_PKCS8PrivateKey_nid, PEM_read_bio_PUBKEY_ex, PEM_read_bio_PUBKEY, PEM_read_PUBKEY_ex, PEM_read_PUBKEY, PEM_write_bio_PUBKEY_ex, PEM_write_bio_PUBKEY, PEM_write_PUBKEY_ex, PEM_write_PUBKEY, PEM_read_bio_RSAPrivateKey, PEM_read_RSAPrivateKey, PEM_write_bio_RSAPrivateKey, PEM_write_RSAPrivateKey, PEM_read_bio_RSAPublicKey, PEM_read_RSAPublicKey, PEM_write_bio_RSAPublicKey, PEM_write_RSAPublicKey, PEM_read_bio_RSA_PUBKEY, PEM_read_RSA_PUBKEY, PEM_write_bio_RSA_PUBKEY, PEM_write_RSA_PUBKEY, PEM_read_bio_DSAPrivateKey, PEM_read_DSAPrivateKey, PEM_write_bio_DSAPrivateKey, PEM_write_DSAPrivateKey, PEM_read_bio_DSA_PUBKEY, PEM_read_DSA_PUBKEY, PEM_write_bio_DSA_PUBKEY, PEM_write_DSA_PUBKEY, PEM_read_bio_Parameters_ex, PEM_read_bio_Parameters, PEM_write_bio_Parameters, PEM_read_bio_DSAparams, PEM_read_DSAparams, PEM_write_bio_DSAparams, PEM_write_DSAparams, PEM_read_bio_DHparams, PEM_read_DHparams, PEM_write_bio_DHparams, PEM_write_DHparams, PEM_read_bio_X509, PEM_read_X509, PEM_write_bio_X509, PEM_write_X509, PEM_read_bio_X509_AUX, PEM_read_X509_AUX, PEM_write_bio_X509_AUX, PEM_write_X509_AUX, PEM_read_bio_X509_REQ, PEM_read_X509_REQ, PEM_write_bio_X509_REQ, PEM_write_X509_REQ, PEM_write_bio_X509_REQ_NEW, PEM_write_X509_REQ_NEW, PEM_read_bio_X509_CRL, PEM_read_X509_CRL, PEM_write_bio_X509_CRL, PEM_write_X509_CRL, PEM_read_bio_PKCS7, PEM_read_PKCS7, PEM_write_bio_PKCS7, PEM_write_PKCS7 - PEM routines

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pem.h>\n\ntypedef int pem_password_cb(char *buf, int size, int rwflag, void *u);\n\nEVP_PKEY *PEM_read_bio_PrivateKey_ex(BIO *bp, EVP_PKEY **x,\n                                     pem_password_cb *cb, void *u,\n                                     OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x,\n                                  pem_password_cb *cb, void *u);\nEVP_PKEY *PEM_read_PrivateKey_ex(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,\n                                 void *u, OSSL_LIB_CTX *libctx,\n                                 const char *propq);\nEVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x,\n                              pem_password_cb *cb, void *u);\nint PEM_write_bio_PrivateKey_ex(BIO *bp, const EVP_PKEY *x,\n                                const EVP_CIPHER *enc,\n                                unsigned char *kstr, int klen,\n                                pem_password_cb *cb, void *u,\n                                OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_bio_PrivateKey(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc,\n                             unsigned char *kstr, int klen,\n                             pem_password_cb *cb, void *u);\nint PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x,\n                                         const EVP_CIPHER *enc,\n                                         unsigned char *kstr, int klen,\n                                         pem_password_cb *cb, void *u);\nint PEM_write_PrivateKey_ex(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                            unsigned char *kstr, int klen,\n                            pem_password_cb *cb, void *u,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                         unsigned char *kstr, int klen,\n                         pem_password_cb *cb, void *u);\nint PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                                  char *kstr, int klen,\n                                  pem_password_cb *cb, void *u);\nint PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\n                              char *kstr, int klen,\n                              pem_password_cb *cb, void *u);\nint PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, const EVP_PKEY *x, int nid,\n                                      char *kstr, int klen,\n                                      pem_password_cb *cb, void *u);\nint PEM_write_PKCS8PrivateKey_nid(FILE *fp, const EVP_PKEY *x, int nid,\n                                  char *kstr, int klen,\n                                  pem_password_cb *cb, void *u);\n\nEVP_PKEY *PEM_read_bio_PUBKEY_ex(BIO *bp, EVP_PKEY **x,\n                                 pem_password_cb *cb, void *u,\n                                 OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x,\n                              pem_password_cb *cb, void *u);\nEVP_PKEY *PEM_read_PUBKEY_ex(FILE *fp, EVP_PKEY **x,\n                             pem_password_cb *cb, void *u,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x,\n                          pem_password_cb *cb, void *u);\nint PEM_write_bio_PUBKEY_ex(BIO *bp, EVP_PKEY *x,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x);\nint PEM_write_PUBKEY_ex(FILE *fp, EVP_PKEY *x,\n                        OSSL_LIB_CTX *libctx, const char *propq);\nint PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x);\n\nEVP_PKEY *PEM_read_bio_Parameters_ex(BIO *bp, EVP_PKEY **x,\n                                     OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);\nint PEM_write_bio_Parameters(BIO *bp, const EVP_PKEY *x);\n\nX509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u);\nX509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_X509(BIO *bp, X509 *x);\nint PEM_write_X509(FILE *fp, X509 *x);\n\nX509 *PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u);\nX509 *PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_X509_AUX(BIO *bp, X509 *x);\nint PEM_write_X509_AUX(FILE *fp, X509 *x);\n\nX509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x,\n                                pem_password_cb *cb, void *u);\nX509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x);\nint PEM_write_X509_REQ(FILE *fp, X509_REQ *x);\nint PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x);\nint PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x);\n\nX509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x,\n                                pem_password_cb *cb, void *u);\nX509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x);\nint PEM_write_X509_CRL(FILE *fp, X509_CRL *x);\n\nPKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u);\nPKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x);\nint PEM_write_PKCS7(FILE *fp, PKCS7 *x);\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x,\n                                pem_password_cb *cb, void *u);\nRSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,\n                                unsigned char *kstr, int klen,\n                                pem_password_cb *cb, void *u);\nint PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc,\n                            unsigned char *kstr, int klen,\n                            pem_password_cb *cb, void *u);\n\nRSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x,\n                               pem_password_cb *cb, void *u);\nRSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x,\n                           pem_password_cb *cb, void *u);\nint PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x);\nint PEM_write_RSAPublicKey(FILE *fp, RSA *x);\n\nRSA *PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x,\n                             pem_password_cb *cb, void *u);\nRSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x,\n                         pem_password_cb *cb, void *u);\nint PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x);\nint PEM_write_RSA_PUBKEY(FILE *fp, RSA *x);\n\nDSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x,\n                                pem_password_cb *cb, void *u);\nDSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x,\n                            pem_password_cb *cb, void *u);\nint PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc,\n                                unsigned char *kstr, int klen,\n                                pem_password_cb *cb, void *u);\nint PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc,\n                            unsigned char *kstr, int klen,\n                            pem_password_cb *cb, void *u);\n\nDSA *PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x,\n                             pem_password_cb *cb, void *u);\nDSA *PEM_read_DSA_PUBKEY(FILE *fp, DSA **x,\n                         pem_password_cb *cb, void *u);\nint PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x);\nint PEM_write_DSA_PUBKEY(FILE *fp, DSA *x);\nDSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u);\nDSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_DSAparams(BIO *bp, DSA *x);\nint PEM_write_DSAparams(FILE *fp, DSA *x);\n\nDH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u);\nDH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u);\nint PEM_write_bio_DHparams(BIO *bp, DH *x);\nint PEM_write_DHparams(FILE *fp, DH *x);\n
                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page that have a TYPE of DH, DSA and RSA are deprecated. Applications should use OSSL_ENCODER_to_bio(3) and OSSL_DECODER_from_bio(3) instead.

                                                                                                                                                          The PEM functions read or write structures in PEM format. In this sense PEM format is simply base64 encoded data surrounded by header lines.

                                                                                                                                                          For more details about the meaning of arguments see the PEM FUNCTION ARGUMENTS section.

                                                                                                                                                          Each operation has four functions associated with it. For brevity the term \"TYPE functions\" will be used below to collectively refer to the PEM_read_bio_TYPE(), PEM_read_TYPE(), PEM_write_bio_TYPE(), and PEM_write_TYPE() functions.

                                                                                                                                                          Some operations have additional variants that take a library context libctx and a property query string propq. The X509, X509_REQ and X509_CRL objects may have an associated library context or property query string but there are no variants of these functions that take a library context or property query string parameter. In this case it is possible to set the appropriate library context or property query string by creating an empty X509, X509_REQ or X509_CRL object using X509_new_ex(3), X509_REQ_new_ex(3) or X509_CRL_new_ex(3) respectively. Then pass the empty object as a parameter to the relevant PEM function. See the \"EXAMPLES\" section below.

                                                                                                                                                          The PrivateKey functions read or write a private key in PEM format using an EVP_PKEY structure. The write routines use PKCS#8 private key format and are equivalent to PEM_write_bio_PKCS8PrivateKey(). The read functions transparently handle traditional and PKCS#8 format encrypted and unencrypted keys.

                                                                                                                                                          PEM_write_bio_PrivateKey_traditional() writes out a private key in the \"traditional\" format with a simple private key marker and should only be used for compatibility with legacy programs.

                                                                                                                                                          PEM_write_bio_PKCS8PrivateKey() and PEM_write_PKCS8PrivateKey() write a private key in an EVP_PKEY structure in PKCS#8 EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption algorithms. The cipher argument specifies the encryption algorithm to use: unlike some other PEM routines the encryption is applied at the PKCS#8 level and not in the PEM headers. If cipher is NULL then no encryption is used and a PKCS#8 PrivateKeyInfo structure is used instead.

                                                                                                                                                          PEM_write_bio_PKCS8PrivateKey_nid() and PEM_write_PKCS8PrivateKey_nid() also write out a private key as a PKCS#8 EncryptedPrivateKeyInfo however it uses PKCS#5 v1.5 or PKCS#12 encryption algorithms instead. The algorithm to use is specified in the nid parameter and should be the NID of the corresponding OBJECT IDENTIFIER (see NOTES section).

                                                                                                                                                          The PUBKEY functions process a public key using an EVP_PKEY structure. The public key is encoded as a SubjectPublicKeyInfo structure.

                                                                                                                                                          The RSAPrivateKey functions process an RSA private key using an RSA structure. The write routines uses traditional format. The read routines handles the same formats as the PrivateKey functions but an error occurs if the private key is not RSA.

                                                                                                                                                          The RSAPublicKey functions process an RSA public key using an RSA structure. The public key is encoded using a PKCS#1 RSAPublicKey structure.

                                                                                                                                                          The RSA_PUBKEY functions also process an RSA public key using an RSA structure. However, the public key is encoded using a SubjectPublicKeyInfo structure and an error occurs if the public key is not RSA.

                                                                                                                                                          The DSAPrivateKey functions process a DSA private key using a DSA structure. The write routines uses traditional format. The read routines handles the same formats as the PrivateKey functions but an error occurs if the private key is not DSA.

                                                                                                                                                          The DSA_PUBKEY functions process a DSA public key using a DSA structure. The public key is encoded using a SubjectPublicKeyInfo structure and an error occurs if the public key is not DSA.

                                                                                                                                                          The Parameters functions read or write key parameters in PEM format using an EVP_PKEY structure. The encoding depends on the type of key; for DSA key parameters, it will be a Dss-Parms structure as defined in RFC2459, and for DH key parameters, it will be a PKCS#3 DHparameter structure. These functions only exist for the BIO type.

                                                                                                                                                          The DSAparams functions process DSA parameters using a DSA structure. The parameters are encoded using a Dss-Parms structure as defined in RFC2459.

                                                                                                                                                          The DHparams functions process DH parameters using a DH structure. The parameters are encoded using a PKCS#3 DHparameter structure.

                                                                                                                                                          The X509 functions process an X509 certificate using an X509 structure. They will also process a trusted X509 certificate but any trust settings are discarded.

                                                                                                                                                          The X509_AUX functions process a trusted X509 certificate using an X509 structure.

                                                                                                                                                          The X509_REQ and X509_REQ_NEW functions process a PKCS#10 certificate request using an X509_REQ structure. The X509_REQ write functions use CERTIFICATE REQUEST in the header whereas the X509_REQ_NEW functions use NEW CERTIFICATE REQUEST (as required by some CAs). The X509_REQ read functions will handle either form so there are no X509_REQ_NEW read functions.

                                                                                                                                                          The X509_CRL functions process an X509 CRL using an X509_CRL structure.

                                                                                                                                                          The PKCS7 functions process a PKCS#7 ContentInfo using a PKCS7 structure.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#pem-function-arguments","title":"PEM FUNCTION ARGUMENTS","text":"

                                                                                                                                                          The PEM functions have many common arguments.

                                                                                                                                                          The bp BIO parameter (if present) specifies the BIO to read from or write to.

                                                                                                                                                          The fp FILE parameter (if present) specifies the FILE pointer to read from or write to.

                                                                                                                                                          The PEM read functions all take an argument TYPE **x and return a TYPE * pointer. Where TYPE is whatever structure the function uses. If x is NULL then the parameter is ignored. If x is not NULL but *x is NULL then the structure returned will be written to *x. If neither x nor *x is NULL then an attempt is made to reuse the structure at *x (but see BUGS and EXAMPLES sections). Irrespective of the value of x a pointer to the structure is always returned (or NULL if an error occurred). The caller retains ownership of the returned object and needs to free it when it is no longer needed, e.g. using X509_free() for X509 objects or EVP_PKEY_free() for EVP_PKEY objects.

                                                                                                                                                          The PEM functions which write private keys take an enc parameter which specifies the encryption algorithm to use, encryption is done at the PEM level. If this parameter is set to NULL then the private key is written in unencrypted form.

                                                                                                                                                          The cb argument is the callback to use when querying for the pass phrase used for encrypted PEM structures (normally only private keys).

                                                                                                                                                          For the PEM write routines if the kstr parameter is not NULL then klen bytes at kstr are used as the passphrase and cb is ignored.

                                                                                                                                                          If the cb parameters is set to NULL and the u parameter is not NULL then the u parameter is interpreted as a NUL terminated string to use as the passphrase. If both cb and u are NULL then the default callback routine is used which will typically prompt for the passphrase on the current terminal with echoing turned off.

                                                                                                                                                          The default passphrase callback is sometimes inappropriate (for example in a GUI application) so an alternative can be supplied. The callback routine has the following form:

                                                                                                                                                          int cb(char *buf, int size, int rwflag, void *u);\n

                                                                                                                                                          buf is the buffer to write the passphrase to. size is the maximum length of the passphrase (i.e. the size of buf). rwflag is a flag which is set to 0 when reading and 1 when writing. A typical routine will ask the user to verify the passphrase (for example by prompting for it twice) if rwflag is 1. The u parameter has the same value as the u parameter passed to the PEM routine. It allows arbitrary data to be passed to the callback by the application (for example a window handle in a GUI application). The callback must return the number of characters in the passphrase or -1 if an error occurred. The passphrase can be arbitrary data; in the case where it is a string, it is not NUL terminated. See the \"EXAMPLES\" section below.

                                                                                                                                                          Some implementations may need to use cryptographic algorithms during their operation. If this is the case and libctx and propq parameters have been passed then any algorithm fetches will use that library context and property query string. Otherwise the default library context and property query string will be used.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#notes","title":"NOTES","text":"

                                                                                                                                                          The PEM reading functions will skip any extraneous content or PEM data of a different type than they expect. This allows for example having a certificate (or multiple certificates) and a key in the PEM format in a single file.

                                                                                                                                                          The old PrivateKey write routines are retained for compatibility. New applications should write private keys using the PEM_write_bio_PKCS8PrivateKey() or PEM_write_PKCS8PrivateKey() routines because they are more secure (they use an iteration count of 2048 whereas the traditional routines use a count of 1) unless compatibility with older versions of OpenSSL is important.

                                                                                                                                                          The PrivateKey read routines can be used in all applications because they handle all formats transparently.

                                                                                                                                                          A frequent cause of problems is attempting to use the PEM routines like this:

                                                                                                                                                          X509 *x;\n\nPEM_read_bio_X509(bp, &x, 0, NULL);\n

                                                                                                                                                          this is a bug because an attempt will be made to reuse the data at x which is an uninitialised pointer.

                                                                                                                                                          These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#pem-encryption-format","title":"PEM ENCRYPTION FORMAT","text":"

                                                                                                                                                          These old PrivateKey routines use a non standard technique for encryption.

                                                                                                                                                          The private key (or other data) takes the following form:

                                                                                                                                                          -----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED\nDEK-Info: DES-EDE3-CBC,3F17F5316E2BAC89\n\n...base64 encoded data...\n-----END RSA PRIVATE KEY-----\n

                                                                                                                                                          The line beginning with Proc-Type contains the version and the protection on the encapsulated data. The line beginning DEK-Info contains two comma separated values: the encryption algorithm name as used by EVP_get_cipherbyname() and an initialization vector used by the cipher encoded as a set of hexadecimal digits. After those two lines is the base64-encoded encrypted data.

                                                                                                                                                          The encryption key is derived using EVP_BytesToKey(). The cipher's initialization vector is passed to EVP_BytesToKey() as the salt parameter. Internally, PKCS5_SALT_LEN bytes of the salt are used (regardless of the size of the initialization vector). The user's password is passed to EVP_BytesToKey() using the data and datal parameters. Finally, the library uses an iteration count of 1 for EVP_BytesToKey().

                                                                                                                                                          The key derived by EVP_BytesToKey() along with the original initialization vector is then used to decrypt the encrypted data. The iv produced by EVP_BytesToKey() is not utilized or needed, and NULL should be passed to the function.

                                                                                                                                                          The pseudo code to derive the key would look similar to:

                                                                                                                                                          EVP_CIPHER* cipher = EVP_des_ede3_cbc();\nEVP_MD* md = EVP_md5();\n\nunsigned int nkey = EVP_CIPHER_get_key_length(cipher);\nunsigned int niv = EVP_CIPHER_get_iv_length(cipher);\nunsigned char key[nkey];\nunsigned char iv[niv];\n\nmemcpy(iv, HexToBin(\"3F17F5316E2BAC89\"), niv);\nrc = EVP_BytesToKey(cipher, md, iv /*salt*/, pword, plen, 1, key, NULL /*iv*/);\nif (rc != nkey)\n    /* Error */\n\n/* On success, use key and iv to initialize the cipher */\n
                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#bugs","title":"BUGS","text":"

                                                                                                                                                          The PEM read routines in some versions of OpenSSL will not correctly reuse an existing structure. Therefore, the following:

                                                                                                                                                          PEM_read_bio_X509(bp, &x, 0, NULL);\n

                                                                                                                                                          where x already contains a valid certificate, may not work, whereas:

                                                                                                                                                          X509_free(x);\nx = PEM_read_bio_X509(bp, NULL, 0, NULL);\n

                                                                                                                                                          is guaranteed to work. It is always acceptable for x to contain a newly allocated, empty X509 object (for example allocated via X509_new_ex(3)).

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The read routines return either a pointer to the structure read or NULL if an error occurred.

                                                                                                                                                          The write routines return 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Although the PEM routines take several arguments in almost all applications most of them are set to 0 or NULL.

                                                                                                                                                          To read a certificate with a library context in PEM format from a BIO:

                                                                                                                                                          X509 *x = X509_new_ex(libctx, NULL);\n\nif (x == NULL)\n    /* Error */\n\nif (PEM_read_bio_X509(bp, &x, 0, NULL) == NULL)\n    /* Error */\n

                                                                                                                                                          Read a certificate in PEM format from a BIO:

                                                                                                                                                          X509 *x;\n\nx = PEM_read_bio_X509(bp, NULL, 0, NULL);\nif (x == NULL)\n    /* Error */\n

                                                                                                                                                          Alternative method:

                                                                                                                                                          X509 *x = NULL;\n\nif (!PEM_read_bio_X509(bp, &x, 0, NULL))\n    /* Error */\n

                                                                                                                                                          Write a certificate to a BIO:

                                                                                                                                                          if (!PEM_write_bio_X509(bp, x))\n    /* Error */\n

                                                                                                                                                          Write a private key (using traditional format) to a BIO using triple DES encryption, the pass phrase is prompted for:

                                                                                                                                                          if (!PEM_write_bio_PrivateKey(bp, key, EVP_des_ede3_cbc(), NULL, 0, 0, NULL))\n    /* Error */\n

                                                                                                                                                          Write a private key (using PKCS#8 format) to a BIO using triple DES encryption, using the pass phrase \"hello\":

                                                                                                                                                          if (!PEM_write_bio_PKCS8PrivateKey(bp, key, EVP_des_ede3_cbc(),\n                                   NULL, 0, 0, \"hello\"))\n    /* Error */\n

                                                                                                                                                          Read a private key from a BIO using a pass phrase callback:

                                                                                                                                                          key = PEM_read_bio_PrivateKey(bp, NULL, pass_cb, \"My Private Key\");\nif (key == NULL)\n    /* Error */\n

                                                                                                                                                          Skeleton pass phrase callback:

                                                                                                                                                          int pass_cb(char *buf, int size, int rwflag, void *u)\n{\n\n    /* We'd probably do something else if 'rwflag' is 1 */\n    printf(\"Enter pass phrase for \\\"%s\\\"\\n\", (char *)u);\n\n    /* get pass phrase, length 'len' into 'tmp' */\n    char *tmp = \"hello\";\n    if (tmp == NULL) /* An error occurred */\n        return -1;\n\n    size_t len = strlen(tmp);\n\n    if (len > size)\n        len = size;\n    memcpy(buf, tmp, len);\n    return len;\n}\n
                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_EncryptInit(3), EVP_BytesToKey(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#history","title":"HISTORY","text":"

                                                                                                                                                          The old Netscape certificate sequences were no longer documented in OpenSSL 1.1.0; applications should use the PKCS7 standard instead as they will be formally deprecated in a future releases.

                                                                                                                                                          PEM_read_bio_PrivateKey_ex(), PEM_read_PrivateKey_ex(), PEM_read_bio_PUBKEY_ex(), PEM_read_PUBKEY_ex() and PEM_read_bio_Parameters_ex() were introduced in OpenSSL 3.0.

                                                                                                                                                          The functions PEM_read_bio_RSAPrivateKey(), PEM_read_RSAPrivateKey(), PEM_write_bio_RSAPrivateKey(), PEM_write_RSAPrivateKey(), PEM_read_bio_RSAPublicKey(), PEM_read_RSAPublicKey(), PEM_write_bio_RSAPublicKey(), PEM_write_RSAPublicKey(), PEM_read_bio_RSA_PUBKEY(), PEM_read_RSA_PUBKEY(), PEM_write_bio_RSA_PUBKEY(), PEM_write_RSA_PUBKEY(), PEM_read_bio_DSAPrivateKey(), PEM_read_DSAPrivateKey(), PEM_write_bio_DSAPrivateKey(), PEM_write_DSAPrivateKey(), PEM_read_bio_DSA_PUBKEY(), PEM_read_DSA_PUBKEY(), PEM_write_bio_DSA_PUBKEY(), PEM_write_DSA_PUBKEY(); PEM_read_bio_DSAparams(), PEM_read_DSAparams(), PEM_write_bio_DSAparams(), PEM_write_DSAparams(), PEM_read_bio_DHparams(), PEM_read_DHparams(), PEM_write_bio_DHparams() and PEM_write_DHparams() were deprecated in 3.0.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_PrivateKey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/","title":"PEM_read_bio_ex","text":""},{"location":"man3/PEM_read_bio_ex/#name","title":"NAME","text":"

                                                                                                                                                          PEM_read_bio_ex, PEM_FLAG_SECURE, PEM_FLAG_EAY_COMPATIBLE, PEM_FLAG_ONLY_B64 - read PEM format files with custom processing

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pem.h>\n\n#define PEM_FLAG_SECURE             0x1\n#define PEM_FLAG_EAY_COMPATIBLE     0x2\n#define PEM_FLAG_ONLY_B64           0x4\nint PEM_read_bio_ex(BIO *in, char **name, char **header,\n                    unsigned char **data, long *len, unsigned int flags);\n
                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PEM_read_bio_ex() reads in PEM formatted data from an input BIO, outputting the name of the type of contained data, the header information regarding the possibly encrypted data, and the binary data payload (after base64 decoding). It should generally only be used to implement PEM_read_bio_-family functions for specific data types or other usage, but is exposed to allow greater flexibility over how processing is performed, if needed.

                                                                                                                                                          If PEM_FLAG_SECURE is set, the intermediate buffers used to read in lines of input are allocated from the secure heap.

                                                                                                                                                          If PEM_FLAG_EAY_COMPATIBLE is set, a simple algorithm is used to remove whitespace and control characters from the end of each line, so as to be compatible with the historical behavior of PEM_read_bio().

                                                                                                                                                          If PEM_FLAG_ONLY_B64 is set, all characters are required to be valid base64 characters (or newlines); non-base64 characters are treated as end of input.

                                                                                                                                                          If neither PEM_FLAG_EAY_COMPATIBLE or PEM_FLAG_ONLY_B64 is set, control characters are ignored.

                                                                                                                                                          If both PEM_FLAG_EAY_COMPATIBLE and PEM_FLAG_ONLY_B64 are set, an error is returned; these options are not compatible with each other.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/#notes","title":"NOTES","text":"

                                                                                                                                                          The caller must release the storage allocated for *name, *header, and *data. If PEM_FLAG_SECURE was set, use OPENSSL_secure_free(); otherwise, OPENSSL_free() is used.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PEM_read_bio_ex() returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PEM_bytes_read_bio(3)

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/#history","title":"HISTORY","text":"

                                                                                                                                                          The PEM_read_bio_ex() function was added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/PEM_read_bio_ex/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/","title":"PEM_write_bio_CMS_stream","text":""},{"location":"man3/PEM_write_bio_CMS_stream/#name","title":"NAME","text":"

                                                                                                                                                          PEM_write_bio_CMS_stream - output CMS_ContentInfo structure in PEM format

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/cms.h>\n\nint PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);\n
                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PEM_write_bio_CMS_stream() outputs a CMS_ContentInfo structure in PEM format.

                                                                                                                                                          It is otherwise identical to the function SMIME_write_CMS().

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/#notes","title":"NOTES","text":"

                                                                                                                                                          This function is effectively a version of the PEM_write_bio_CMS() supporting streaming.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PEM_write_bio_CMS_stream() returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3) CMS_decrypt(3), PEM_write(3), SMIME_write_CMS(3), i2d_CMS_bio_stream(3)

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/#history","title":"HISTORY","text":"

                                                                                                                                                          The PEM_write_bio_CMS_stream() function was added in OpenSSL 1.0.0.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_CMS_stream/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/","title":"PEM_write_bio_PKCS7_stream","text":""},{"location":"man3/PEM_write_bio_PKCS7_stream/#name","title":"NAME","text":"

                                                                                                                                                          PEM_write_bio_PKCS7_stream - output PKCS7 structure in PEM format

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nint PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);\n
                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PEM_write_bio_PKCS7_stream() outputs a PKCS7 structure in PEM format.

                                                                                                                                                          It is otherwise identical to the function SMIME_write_PKCS7().

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/#notes","title":"NOTES","text":"

                                                                                                                                                          This function is effectively a version of the PEM_write_bio_PKCS7() supporting streaming.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PEM_write_bio_PKCS7_stream() returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3), SMIME_write_PKCS7(3), i2d_PKCS7_bio_stream(3)

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/#history","title":"HISTORY","text":"

                                                                                                                                                          The PEM_write_bio_PKCS7_stream() function was added in OpenSSL 1.0.0.

                                                                                                                                                          "},{"location":"man3/PEM_write_bio_PKCS7_stream/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/","title":"PKCS12_PBE_keyivgen","text":""},{"location":"man3/PKCS12_PBE_keyivgen/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_PBE_keyivgen, PKCS12_PBE_keyivgen_ex, PKCS12_pbe_crypt, PKCS12_pbe_crypt_ex - PKCS#12 Password based encryption

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/evp.h>\n\nint PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                        ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                        const EVP_MD *md_type, int en_de);\nint PKCS12_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                           ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                           const EVP_MD *md_type, int en_de,\n                           OSSL_LIB_CTX *libctx, const char *propq);\nunsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor,\n                                const char *pass, int passlen,\n                                const unsigned char *in, int inlen,\n                                unsigned char **data, int *datalen,\n                                int en_de);\nunsigned char *PKCS12_pbe_crypt_ex(const X509_ALGOR *algor,\n                                   const char *pass, int passlen,\n                                   const unsigned char *in, int inlen,\n                                   unsigned char **data, int *datalen,\n                                   int en_de, OSSL_LIB_CTX *libctx,\n                                   const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_PBE_keyivgen() and PKCS12_PBE_keyivgen_ex() take a password pass of length passlen, parameters param and a message digest function md_type and perform a key derivation according to PKCS#12. The resulting key is then used to initialise the cipher context ctx with a cipher cipher for encryption (en_de=1) or decryption (en_de=0).

                                                                                                                                                          PKCS12_PBE_keyivgen_ex() also allows the application to specify a library context libctx and property query propq to select appropriate algorithm implementations.

                                                                                                                                                          PKCS12_pbe_crypt() and PKCS12_pbe_crypt_ex() will encrypt or decrypt a buffer based on the algorithm in algor and password pass of length passlen. The input is from in of length inlen and output is into a malloc'd buffer returned in *data of length datalen. The operation is determined by en_de, encryption (en_de=1) or decryption (en_de=0).

                                                                                                                                                          PKCS12_pbe_crypt_ex() allows the application to specify a library context libctx and property query propq to select appropriate algorithm implementations.

                                                                                                                                                          pass is the password used in the derivation of length passlen. pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                                                                                                                                                          salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                                                                                                                                                          iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter less than 1 is treated as a single iteration.

                                                                                                                                                          digest is the message digest function used in the derivation.

                                                                                                                                                          Functions ending in _ex() take optional parameters libctx and propq which are used to select appropriate algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#notes","title":"NOTES","text":"

                                                                                                                                                          The functions are typically used in PKCS#12 to encrypt objects.

                                                                                                                                                          These functions make no assumption regarding the given password. It will simply be treated as a byte sequence.

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_PBE_keyivgen(), PKCS12_PBE_keyivgen_ex() return 1 on success or 0 on error.

                                                                                                                                                          PKCS12_pbe_crypt() and PKCS12_pbe_crypt_ex() return a buffer containing the output or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_PBE_CipherInit_ex(3), PKCS8_encrypt_ex(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_PBE_keyivgen_ex() and PKCS12_pbe_crypt_ex() were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_PBE_keyivgen/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/","title":"PKCS12_SAFEBAG_create_cert","text":""},{"location":"man3/PKCS12_SAFEBAG_create_cert/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_SAFEBAG_create_cert, PKCS12_SAFEBAG_create_crl, PKCS12_SAFEBAG_create_secret, PKCS12_SAFEBAG_create0_p8inf, PKCS12_SAFEBAG_create0_pkcs8, PKCS12_SAFEBAG_create_pkcs8_encrypt, PKCS12_SAFEBAG_create_pkcs8_encrypt_ex - Create PKCS#12 safeBag objects

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_secret(int type, int vtype,\n                                             const unsigned char* value,\n                                             int len);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,\n                                                    const char *pass,\n                                                    int passlen,\n                                                    unsigned char *salt,\n                                                    int saltlen, int iter,\n                                                    PKCS8_PRIV_KEY_INFO *p8inf);\nPKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(int pbe_nid,\n                                                       const char *pass,\n                                                       int passlen,\n                                                       unsigned char *salt,\n                                                       int saltlen, int iter,\n                                                       PKCS8_PRIV_KEY_INFO *p8inf,\n                                                       OSSL_LIB_CTX *ctx,\n                                                       const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_SAFEBAG_create_cert() creates a new PKCS12_SAFEBAG of type NID_certBag containing the supplied certificate.

                                                                                                                                                          PKCS12_SAFEBAG_create_crl() creates a new PKCS12_SAFEBAG of type NID_crlBag containing the supplied crl.

                                                                                                                                                          PKCS12_SAFEBAG_create_secret() creates a new PKCS12_SAFEBAG of type corresponding to a PKCS#12 secretBag. The secretBag contents are tagged as type with an ASN1 value of type vtype constructed using the bytes in value of length len.

                                                                                                                                                          PKCS12_SAFEBAG_create0_p8inf() creates a new PKCS12_SAFEBAG of type NID_keyBag containing the supplied PKCS8 structure.

                                                                                                                                                          PKCS12_SAFEBAG_create0_pkcs8() creates a new PKCS12_SAFEBAG of type NID_pkcs8ShroudedKeyBag containing the supplied PKCS8 structure.

                                                                                                                                                          PKCS12_SAFEBAG_create_pkcs8_encrypt() creates a new PKCS12_SAFEBAG of type NID_pkcs8ShroudedKeyBag by encrypting the supplied PKCS8 p8inf. If pbe_nid is 0, a default encryption algorithm is used. pass is the passphrase and iter is the iteration count. If iter is zero then a default value of 2048 is used. If salt is NULL then a salt is generated randomly.

                                                                                                                                                          PKCS12_SAFEBAG_create_pkcs8_encrypt_ex() is identical to PKCS12_SAFEBAG_create_pkcs8_encrypt() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#notes","title":"NOTES","text":"

                                                                                                                                                          PKCS12_SAFEBAG_create_pkcs8_encrypt() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                                                                                                                                                          PKCS12_SAFEBAG_create_secret() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          All of these functions return a valid PKCS12_SAFEBAG structure or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_create(3), PKCS12_add_safe(3), PKCS12_add_safes(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_SAFEBAG_create_pkcs8_encrypt_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_create_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/","title":"PKCS12_SAFEBAG_get0_attrs","text":""},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_SAFEBAG_get0_attrs, PKCS12_get_attr_gen - Retrieve attributes from a PKCS#12 safeBag

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nconst STACK_OF(X509_ATTRIBUTE) *PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag);\n\nASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs,\n                               int attr_nid);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_SAFEBAG_get0_attrs() retrieves the stack of X509_ATTRIBUTEs from a PKCS#12 safeBag. bag is the PKCS12_SAFEBAG to retrieve the attributes from.

                                                                                                                                                          PKCS12_get_attr_gen() retrieves an attribute by NID from a stack of X509_ATTRIBUTEs. attr_nid is the NID of the attribute to retrieve.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_SAFEBAG_get0_attrs() returns the stack of X509_ATTRIBUTEs from a PKCS#12 safeBag, which could be empty.

                                                                                                                                                          PKCS12_get_attr_gen() returns an ASN1_TYPE object containing the attribute, or NULL if the attribute was either not present or an error occurred.

                                                                                                                                                          PKCS12_get_attr_gen() does not allocate a new attribute. The returned attribute is still owned by the PKCS12_SAFEBAG in which it resides.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_get_friendlyname(3), PKCS12_add_friendlyname_asc(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get0_attrs/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/","title":"PKCS12_SAFEBAG_get1_cert","text":""},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_SAFEBAG_get0_attr, PKCS12_SAFEBAG_get0_type, PKCS12_SAFEBAG_get_nid, PKCS12_SAFEBAG_get_bag_nid, PKCS12_SAFEBAG_get0_bag_obj, PKCS12_SAFEBAG_get0_bag_type, PKCS12_SAFEBAG_get1_cert, PKCS12_SAFEBAG_get1_crl, PKCS12_SAFEBAG_get0_safes, PKCS12_SAFEBAG_get0_p8inf, PKCS12_SAFEBAG_get0_pkcs8 - Get objects from a PKCS#12 safeBag

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nconst ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag,\n                                          int attr_nid);\nconst ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag);\nint PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag);\nint PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag);\nconst ASN1_TYPE *PKCS12_SAFEBAG_get0_bag_obj(const PKCS12_SAFEBAG *bag);\nconst ASN1_OBJECT *PKCS12_SAFEBAG_get0_bag_type(const PKCS12_SAFEBAG *bag);\nX509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag);\nX509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag);\nconst STACK_OF(PKCS12_SAFEBAG) *PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag);\nconst PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag);\nconst X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_SAFEBAG_get0_attr() gets the attribute value corresponding to the attr_nid.

                                                                                                                                                          PKCS12_SAFEBAG_get0_type() gets the safeBag type as an OID, whereas PKCS12_SAFEBAG_get_nid() gets the safeBag type as an NID, which could be NID_certBag, NID_crlBag, NID_keyBag, NID_secretBag, NID_safeContentsBag or NID_pkcs8ShroudedKeyBag.

                                                                                                                                                          PKCS12_SAFEBAG_get_bag_nid() gets the type of the object contained within the PKCS12_SAFEBAG. This corresponds to the bag type for most bags, but can be arbitrary for secretBags. PKCS12_SAFEBAG_get0_bag_type() gets this type as an OID.

                                                                                                                                                          PKCS12_SAFEBAG_get0_bag_obj() retrieves the object contained within the safeBag.

                                                                                                                                                          PKCS12_SAFEBAG_get1_cert() and PKCS12_SAFEBAG_get1_crl() return new X509 or X509_CRL objects from the item in the safeBag.

                                                                                                                                                          PKCS12_SAFEBAG_get0_p8inf() and PKCS12_SAFEBAG_get0_pkcs8() return the PKCS8 object from a PKCS8shroudedKeyBag or a keyBag.

                                                                                                                                                          PKCS12_SAFEBAG_get0_safes() retrieves the set of safeBags contained within a safeContentsBag.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_SAFEBAG_get_nid() and PKCS12_SAFEBAG_get_bag_nid() return the NID of the safeBag or bag object, or -1 if there is no corresponding NID. Other functions return a valid object of the specified type or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_create(3), PKCS12_add_safe(3), PKCS12_add_safes(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_SAFEBAG_get1_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_add1_attr_by_NID/","title":"PKCS12_add1_attr_by_NID","text":""},{"location":"man3/PKCS12_add1_attr_by_NID/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_add1_attr_by_NID, PKCS12_add1_attr_by_txt - Add an attribute to a PKCS#12 safeBag structure

                                                                                                                                                          "},{"location":"man3/PKCS12_add1_attr_by_NID/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_add1_attr_by_NID(PKCS12_SAFEBAG *bag, int nid, int type,\n                            const unsigned char *bytes, int len);\nint PKCS12_add1_attr_by_txt(PKCS12_SAFEBAG *bag, const char *attrname, int type,\n                            const unsigned char *bytes, int len);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_add1_attr_by_NID/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions add a PKCS#12 Attribute to the Attribute Set of the bag.

                                                                                                                                                          PKCS12_add1_attr_by_NID() adds an attribute of type nid with a value of ASN1 type type constructed using len bytes from bytes.

                                                                                                                                                          PKCS12_add1_attr_by_txt() adds an attribute of type attrname with a value of ASN1 type type constructed using len bytes from bytes.

                                                                                                                                                          "},{"location":"man3/PKCS12_add1_attr_by_NID/#notes","title":"NOTES","text":"

                                                                                                                                                          These functions do not check whether an existing attribute of the same type is present. There can be multiple attributes with the same type assigned to a safeBag.

                                                                                                                                                          Both functions were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_add1_attr_by_NID/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          A return value of 1 indicates success, 0 indicates failure.

                                                                                                                                                          "},{"location":"man3/PKCS12_add1_attr_by_NID/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_create(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_add1_attr_by_NID/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_CSPName_asc/","title":"PKCS12_add_CSPName_asc","text":""},{"location":"man3/PKCS12_add_CSPName_asc/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_add_CSPName_asc - Add a Microsoft CSP Name attribute to a PKCS#12 safeBag

                                                                                                                                                          "},{"location":"man3/PKCS12_add_CSPName_asc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, int namelen);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_add_CSPName_asc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_add_CSPName_asc() adds an ASCII string representation of the Microsoft CSP Name attribute to a PKCS#12 safeBag.

                                                                                                                                                          bag is the PKCS12_SAFEBAG to add the attribute to.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_CSPName_asc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          Returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_CSPName_asc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_add_friendlyname_asc(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_add_CSPName_asc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/","title":"PKCS12_add_cert","text":""},{"location":"man3/PKCS12_add_cert/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_add_cert, PKCS12_add_key, PKCS12_add_key_ex, PKCS12_add_secret - Add an object to a set of PKCS#12 safeBags

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nPKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);\nPKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags,\n                              EVP_PKEY *key, int key_usage, int iter,\n                              int key_nid, const char *pass);\nPKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags,\n                                  EVP_PKEY *key, int key_usage, int iter,\n                                  int key_nid, const char *pass,\n                                  OSSL_LIB_CTX *ctx, const char *propq);\n\nPKCS12_SAFEBAG *PKCS12_add_secret(STACK_OF(PKCS12_SAFEBAG) **pbags,\n                                 int nid_type, const unsigned char *value, int len);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions create a new PKCS12_SAFEBAG and add it to the set of safeBags in pbags.

                                                                                                                                                          PKCS12_add_cert() creates a PKCS#12 certBag containing the supplied certificate and adds this to the set of PKCS#12 safeBags.

                                                                                                                                                          PKCS12_add_key() creates a PKCS#12 keyBag (unencrypted) or a pkcs8shroudedKeyBag (encrypted) containing the supplied EVP_PKEY and adds this to the set of PKCS#12 safeBags. If key_nid is not -1 then the key is encrypted with the supplied algorithm, using pass as the passphrase and iter as the iteration count. If iter is zero then a default value for iteration count of 2048 is used.

                                                                                                                                                          PKCS12_add_key_ex() is identical to PKCS12_add_key() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          PKCS12_add_secret() creates a PKCS#12 secretBag with an OID corresponding to the supplied nid_type containing the supplied value as an ASN1 octet string. This is then added to the set of PKCS#12 safeBags.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#notes","title":"NOTES","text":"

                                                                                                                                                          If a certificate contains an alias or a keyid then this will be used for the corresponding friendlyName or localKeyID in the PKCS12 structure.

                                                                                                                                                          PKCS12_add_key() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          A valid PKCS12_SAFEBAG structure or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_create(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_add_secret() and PKCS12_add_key_ex() were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_friendlyname_asc/","title":"PKCS12_add_friendlyname_asc","text":""},{"location":"man3/PKCS12_add_friendlyname_asc/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_add_friendlyname_asc, PKCS12_add_friendlyname_utf8, PKCS12_add_friendlyname_uni - Functions to add the friendlyname attribute to a PKCS#12 safeBag

                                                                                                                                                          "},{"location":"man3/PKCS12_add_friendlyname_asc/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,\n                                int namelen);\n\nint PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name,\n                                int namelen);\n\nint PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag,\n                                const unsigned char *name, int namelen);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_add_friendlyname_asc/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_add_friendlyname_asc() adds an ASCII string representation of the PKCS#9 friendlyName attribute to a PKCS#12 safeBag.

                                                                                                                                                          PKCS12_add_friendlyname_utf8() adds a UTF-8 string representation of the PKCS#9 friendlyName attribute to a PKCS#12 safeBag.

                                                                                                                                                          PKCS12_add_friendlyname_uni() adds a Unicode string representation of the PKCS#9 friendlyName attribute to a PKCS#12 safeBag.

                                                                                                                                                          bag is the PKCS12_SAFEBAG to add the attribute to.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_friendlyname_asc/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          Returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_friendlyname_asc/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_get_friendlyname(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_add_friendlyname_asc/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_localkeyid/","title":"PKCS12_add_localkeyid","text":""},{"location":"man3/PKCS12_add_localkeyid/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_add_localkeyid - Add the localKeyId attribute to a PKCS#12 safeBag

                                                                                                                                                          "},{"location":"man3/PKCS12_add_localkeyid/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, const char *name,\n                          int namelen);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_add_localkeyid/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_add_localkeyid() adds an octet string representation of the PKCS#9 localKeyId attribute to a PKCS#12 safeBag.

                                                                                                                                                          bag is the PKCS12_SAFEBAG to add the attribute to.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_localkeyid/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          Returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_localkeyid/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_add_friendlyname_asc(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_add_localkeyid/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/","title":"PKCS12_add_safe","text":""},{"location":"man3/PKCS12_add_safe/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_add_safe, PKCS12_add_safe_ex, PKCS12_add_safes, PKCS12_add_safes_ex - Create and add objects to a PKCS#12 structure

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,\n                   int safe_nid, int iter, const char *pass);\nint PKCS12_add_safe_ex(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,\n                       int safe_nid, int iter, const char *pass,\n                       OSSL_LIB_CTX *ctx, const char *propq);\n\nPKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);\nPKCS12 *PKCS12_add_safes_ex(STACK_OF(PKCS7) *safes, int p7_nid,\n                            OSSL_LIB_CTX *ctx, const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_add_safe() creates a new PKCS7 contentInfo containing the supplied PKCS12_SAFEBAGs and adds this to a set of PKCS7 contentInfos. Its type depends on the value of safe_nid:

                                                                                                                                                          • If safe_nid is -1, a plain PKCS7 data contentInfo is created.
                                                                                                                                                          • If safe_nid is a valid PBE algorithm NID, a PKCS7 encryptedData contentInfo is created. The algorithm uses pass as the passphrase and iter as the iteration count. If iter is zero then a default value for iteration count of 2048 is used.
                                                                                                                                                          • If safe_nid is 0, a PKCS7 encryptedData contentInfo is created using a default encryption algorithm, currently NID_pbe_WithSHA1And3_Key_TripleDES_CBC.

                                                                                                                                                          PKCS12_add_safe_ex() is identical to PKCS12_add_safe() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          PKCS12_add_safes() creates a PKCS12 structure containing the supplied set of PKCS7 contentInfos. The safes are enclosed first within a PKCS7 contentInfo of type p7_nid. Currently the only supported type is NID_pkcs7_data.

                                                                                                                                                          PKCS12_add_safes_ex() is identical to PKCS12_add_safes() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#notes","title":"NOTES","text":"

                                                                                                                                                          PKCS12_add_safe() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_add_safe() returns a value of 1 indicating success or 0 for failure.

                                                                                                                                                          PKCS12_add_safes() returns a valid PKCS12 structure or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_create(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_add_safe_ex() and PKCS12_add_safes_ex() were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_add_safe/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_create/","title":"PKCS12_create","text":""},{"location":"man3/PKCS12_create/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_create, PKCS12_create_ex - create a PKCS#12 structure

                                                                                                                                                          "},{"location":"man3/PKCS12_create/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nPKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey,\n                      X509 *cert, STACK_OF(X509) *ca,\n                      int nid_key, int nid_cert, int iter, int mac_iter, int keytype);\nPKCS12 *PKCS12_create_ex(const char *pass, const char *name, EVP_PKEY *pkey,\n                         X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert,\n                         int iter, int mac_iter, int keytype,\n                         OSSL_LIB_CTX *ctx, const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_create/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_create() creates a PKCS#12 structure.

                                                                                                                                                          pass is the passphrase to use. name is the friendlyName to use for the supplied certificate and key. pkey is the private key to include in the structure and cert its corresponding certificates. ca, if not NULL is an optional set of certificates to also include in the structure.

                                                                                                                                                          nid_key and nid_cert are the encryption algorithms that should be used for the key and certificate respectively. The modes GCM, CCM, XTS, and OCB are unsupported. iter is the encryption algorithm iteration count to use and mac_iter is the MAC iteration count to use. keytype is the type of key.

                                                                                                                                                          PKCS12_create_ex() is identical to PKCS12_create() but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS12_create/#notes","title":"NOTES","text":"

                                                                                                                                                          The parameters nid_key, nid_cert, iter, mac_iter and keytype can all be set to zero and sensible defaults will be used.

                                                                                                                                                          These defaults are: AES password based encryption (PBES2 with PBKDF2 and AES-256-CBC) for private keys and certificates, the PBKDF2 and MAC key derivation iteration count of PKCS12_DEFAULT_ITER (currently 2048), and MAC algorithm HMAC with SHA2-256. The MAC key derivation algorithm used for the outer PKCS#12 structure is PKCS12KDF.

                                                                                                                                                          The default MAC iteration count is 1 in order to retain compatibility with old software which did not interpret MAC iteration counts. If such compatibility is not required then mac_iter should be set to PKCS12_DEFAULT_ITER.

                                                                                                                                                          keytype adds a flag to the store private key. This is a non standard extension that is only currently interpreted by MSIE. If set to zero the flag is omitted, if set to KEY_SIG the key can be used for signing only, if set to KEY_EX it can be used for signing and encryption. This option was useful for old export grade software which could use signing only keys of arbitrary size but had restrictions on the permissible sizes of keys which could be used for encryption.

                                                                                                                                                          If name is NULL and cert contains an alias then this will be used for the corresponding friendlyName in the PKCS12 structure instead. Similarly, if pkey is NULL and cert contains a keyid then this will be used for the corresponding localKeyID in the PKCS12 structure instead of the id calculated from the pkey.

                                                                                                                                                          For all certificates in ca then if a certificate contains an alias or keyid then this will be used for the corresponding friendlyName or localKeyID in the PKCS12 structure.

                                                                                                                                                          Either pkey, cert or both can be NULL to indicate that no key or certificate is required. In previous versions both had to be present or a fatal error is returned.

                                                                                                                                                          nid_key or nid_cert can be set to -1 indicating that no encryption should be used.

                                                                                                                                                          mac_iter can be set to -1 and the MAC will then be omitted entirely. This can be useful when running with the FIPS provider as the PKCS12KDF is not a FIPS approvable algorithm.

                                                                                                                                                          PKCS12_create() makes assumptions regarding the encoding of the given pass phrase. See passphrase-encoding(7) for more information.

                                                                                                                                                          "},{"location":"man3/PKCS12_create/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_create() returns a valid PKCS12 structure or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_create/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_create/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_KDF-PKCS12KDF(7), d2i_PKCS12(3), OSSL_PROVIDER-FIPS(7), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS12_create/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_create_ex() was added in OpenSSL 3.0.

                                                                                                                                                          The defaults for encryption algorithms, MAC algorithm, and the MAC key derivation iteration count were changed in OpenSSL 3.0 to more modern standards.

                                                                                                                                                          "},{"location":"man3/PKCS12_create/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/","title":"PKCS12_decrypt_skey","text":""},{"location":"man3/PKCS12_decrypt_skey/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_decrypt_skey, PKCS12_decrypt_skey_ex - PKCS12 shrouded keyBag decrypt functions

                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nPKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag,\n                                         const char *pass, int passlen);\nPKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey_ex(const PKCS12_SAFEBAG *bag,\n                                            const char *pass, int passlen,\n                                            OSSL_LIB_CTX *ctx,\n                                            const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_decrypt_skey() Decrypt the PKCS#8 shrouded keybag contained within bag using the supplied password pass of length passlen.

                                                                                                                                                          PKCS12_decrypt_skey_ex() is similar to the above but allows for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          Both functions will return the decrypted key or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS8_decrypt_ex(3), PKCS8_encrypt_ex(3), PKCS12_add_key_ex(3), PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_decrypt_skey_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_decrypt_skey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/","title":"PKCS12_gen_mac","text":""},{"location":"man3/PKCS12_gen_mac/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_gen_mac, PKCS12_setup_mac, PKCS12_set_mac, PKCS12_verify_mac - Functions to create and manipulate a PKCS#12 structure

                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,\n                   unsigned char *mac, unsigned int *maclen);\nint PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);\nint PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,\n                   unsigned char *salt, int saltlen, int iter,\n                   const EVP_MD *md_type);\nint PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,\n                     int saltlen, const EVP_MD *md_type);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_gen_mac() generates an HMAC over the entire PKCS#12 object using the supplied password along with a set of already configured parameters. The default key generation mechanism used is PKCS12KDF.

                                                                                                                                                          PKCS12_verify_mac() verifies the PKCS#12 object's HMAC using the supplied password.

                                                                                                                                                          PKCS12_setup_mac() sets the MAC part of the PKCS#12 structure with the supplied parameters.

                                                                                                                                                          PKCS12_set_mac() sets the MAC and MAC parameters into the PKCS#12 object.

                                                                                                                                                          pass is the passphrase to use in the HMAC. salt is the salt value to use, iter is the iteration count and md_type is the message digest function to use.

                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/#notes","title":"NOTES","text":"

                                                                                                                                                          If salt is NULL then a suitable salt will be generated and used.

                                                                                                                                                          If iter is 1 then an iteration count will be omitted from the PKCS#12 structure.

                                                                                                                                                          PKCS12_gen_mac(), PKCS12_verify_mac() and PKCS12_set_mac() make assumptions regarding the encoding of the given passphrase. See passphrase-encoding(7) for more information.

                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          All functions return 1 on success and 0 if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          d2i_PKCS12(3), EVP_KDF-PKCS12KDF(7), PKCS12_create(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS12_gen_mac/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_get_friendlyname/","title":"PKCS12_get_friendlyname","text":""},{"location":"man3/PKCS12_get_friendlyname/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_get_friendlyname - Retrieve the friendlyname attribute from a PKCS#12 safeBag

                                                                                                                                                          "},{"location":"man3/PKCS12_get_friendlyname/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nchar *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_get_friendlyname/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_get_friendlyname() retrieves a UTF-8 string representation of the PKCS#9 friendlyName attribute for a PKCS#12 safeBag item.

                                                                                                                                                          bag is the PKCS12_SAFEBAG to retrieve the attribute from.

                                                                                                                                                          "},{"location":"man3/PKCS12_get_friendlyname/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          A UTF-8 string, or NULL if the attribute was either not present or an error occurred.

                                                                                                                                                          The returned string is allocated by OpenSSL and should be freed by the user.

                                                                                                                                                          "},{"location":"man3/PKCS12_get_friendlyname/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_add_friendlyname_asc(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_get_friendlyname/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_init/","title":"PKCS12_init","text":""},{"location":"man3/PKCS12_init/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_init, PKCS12_init_ex - Create a new empty PKCS#12 structure

                                                                                                                                                          "},{"location":"man3/PKCS12_init/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nPKCS12 *PKCS12_init(int mode);\nPKCS12 *PKCS12_init_ex(int mode, OSSL_LIB_CTX *ctx, const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_init/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_init() creates an empty PKCS#12 structure. Any PKCS#7 authSafes added to this structure are enclosed first within a single PKCS#7 contentInfo of type mode. Currently the only supported type is NID_pkcs7_data.

                                                                                                                                                          PKCS12_init_ex() creates an empty PKCS#12 structure and assigns the supplied ctx and propq to be used to select algorithm implementations for operations performed on the PKCS12 object.

                                                                                                                                                          "},{"location":"man3/PKCS12_init/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_init() and PKCS12_init_ex() return a valid PKCS12 structure or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_init/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          d2i_PKCS12(3), PKCS12_create(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS12_init/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_init_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_init/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_item_decrypt_d2i/","title":"PKCS12_item_decrypt_d2i","text":""},{"location":"man3/PKCS12_item_decrypt_d2i/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_item_decrypt_d2i, PKCS12_item_decrypt_d2i_ex, PKCS12_item_i2d_encrypt, PKCS12_item_i2d_encrypt_ex - PKCS12 item encrypt/decrypt functions

                                                                                                                                                          "},{"location":"man3/PKCS12_item_decrypt_d2i/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nvoid *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it,\n                              const char *pass, int passlen,\n                              const ASN1_OCTET_STRING *oct, int zbuf);\nvoid *PKCS12_item_decrypt_d2i_ex(const X509_ALGOR *algor, const ASN1_ITEM *it,\n                                 const char *pass, int passlen,\n                                 const ASN1_OCTET_STRING *oct, int zbuf,\n                                 OSSL_LIB_CTX *libctx,\n                                 const char *propq);\nASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor,\n                                           const ASN1_ITEM *it,\n                                           const char *pass, int passlen,\n                                           void *obj, int zbuf);\nASN1_OCTET_STRING *PKCS12_item_i2d_encrypt_ex(X509_ALGOR *algor,\n                                              const ASN1_ITEM *it,\n                                              const char *pass, int passlen,\n                                              void *obj, int zbuf,\n                                              OSSL_LIB_CTX *ctx,\n                                              const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_item_decrypt_d2i/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_item_decrypt_d2i() and PKCS12_item_decrypt_d2i_ex() decrypt an octet string containing an ASN.1 encoded object using the algorithm algor and password pass of length passlen. If zbuf is nonzero then the output buffer will zeroed after the decrypt.

                                                                                                                                                          PKCS12_item_i2d_encrypt() and PKCS12_item_i2d_encrypt_ex() encrypt an ASN.1 object it using the algorithm algor and password pass of length passlen, returning an encoded object in obj. If zbuf is nonzero then the buffer containing the input encoding will be zeroed after the encrypt.

                                                                                                                                                          Functions ending in _ex() allow for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS12_item_decrypt_d2i/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_item_decrypt_d2i() and PKCS12_item_decrypt_d2i_ex() return the decrypted object or NULL if an error occurred.

                                                                                                                                                          PKCS12_item_i2d_encrypt() and PKCS12_item_i2d_encrypt_ex() return the encrypted data as an ASN.1 Octet String or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_item_decrypt_d2i/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_pbe_crypt_ex(3), PKCS8_encrypt_ex(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_item_decrypt_d2i/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_item_decrypt_d2i_ex() and PKCS12_item_i2d_encrypt_ex() were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_item_decrypt_d2i/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/","title":"PKCS12_key_gen_utf8_ex","text":""},{"location":"man3/PKCS12_key_gen_utf8_ex/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_key_gen_asc, PKCS12_key_gen_asc_ex, PKCS12_key_gen_uni, PKCS12_key_gen_uni_ex, PKCS12_key_gen_utf8, PKCS12_key_gen_utf8_ex - PKCS#12 Password based key derivation

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,\n                       int saltlen, int id, int iter, int n,\n                       unsigned char *out, const EVP_MD *md_type);\nint PKCS12_key_gen_asc_ex(const char *pass, int passlen, unsigned char *salt,\n                          int saltlen, int id, int iter, int n,\n                          unsigned char *out, const EVP_MD *md_type,\n                          OSSL_LIB_CTX *ctx, const char *propq);\nint PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,\n                       int saltlen, int id, int iter, int n,\n                       unsigned char *out, const EVP_MD *md_type);\nint PKCS12_key_gen_uni_ex(unsigned char *pass, int passlen, unsigned char *salt,\n                          int saltlen, int id, int iter, int n,\n                          unsigned char *out, const EVP_MD *md_type,\n                          OSSL_LIB_CTX *ctx, const char *propq);\nint PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt,\n                        int saltlen, int id, int iter, int n,\n                        unsigned char *out, const EVP_MD *md_type);\nint PKCS12_key_gen_utf8_ex(const char *pass, int passlen, unsigned char *salt,\n                           int saltlen, int id, int iter, int n,\n                           unsigned char *out, const EVP_MD *md_type,\n                           OSSL_LIB_CTX *ctx, const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These methods perform a key derivation according to PKCS#12 (RFC7292) with an input password pass of length passlen, a salt salt of length saltlen, an iteration count iter and a digest algorithm md_type. The ID byte id determines how the resulting key is intended to be used:

                                                                                                                                                          • If ID=1, then the pseudorandom bits being produced are to be used as key material for performing encryption or decryption.
                                                                                                                                                          • If ID=2, then the pseudorandom bits being produced are to be used as an IV (Initial Value) for encryption or decryption.
                                                                                                                                                          • If ID=3, then the pseudorandom bits being produced are to be used as an integrity key for MACing.

                                                                                                                                                          The intended format of the supplied password is determined by the method chosen:

                                                                                                                                                          • PKCS12_key_gen_asc() and PKCS12_key_gen_asc_ex() expect an ASCII-formatted password.
                                                                                                                                                          • PKCS12_key_gen_uni() and PKCS12_key_gen_uni_ex() expect a Unicode-formatted password.
                                                                                                                                                          • PKCS12_key_gen_utf8() and PKCS12_key_gen_utf8_ex() expect a UTF-8 encoded password.

                                                                                                                                                          pass is the password used in the derivation of length passlen. pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                                                                                                                                                          salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                                                                                                                                                          iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter less than 1 is treated as a single iteration.

                                                                                                                                                          digest is the message digest function used in the derivation.

                                                                                                                                                          The derived key will be written to out. The size of the out buffer is specified via n.

                                                                                                                                                          Functions ending in _ex() allow for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#notes","title":"NOTES","text":"

                                                                                                                                                          A typical application of this function is to derive keying material for an encryption algorithm from a password in the pass, a salt in salt, and an iteration count.

                                                                                                                                                          Increasing the iter parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          Returns 1 on success or 0 on error.

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_create_ex(3), PKCS12_pbe_crypt_ex(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_key_gen_asc_ex(), PKCS12_key_gen_uni_ex() and PKCS12_key_gen_utf8_ex() were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_key_gen_utf8_ex/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/","title":"PKCS12_newpass","text":""},{"location":"man3/PKCS12_newpass/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_newpass - change the password of a PKCS12 structure

                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_newpass() changes the password of a PKCS12 structure.

                                                                                                                                                          p12 is a pointer to a PKCS12 structure. oldpass is the existing password and newpass is the new password.

                                                                                                                                                          Each of oldpass and newpass is independently interpreted as a string in the UTF-8 encoding. If it is not valid UTF-8, it is assumed to be ISO8859-1 instead.

                                                                                                                                                          In particular, this means that passwords in the locale character set (or code page on Windows) must potentially be converted to UTF-8 before use. This may include passwords from local text files, or input from the terminal or command line. Refer to the documentation of UI_OpenSSL(3), for example.

                                                                                                                                                          If the PKCS#12 structure does not have a password, then you must use the empty string \"\" for oldpass. Using NULL for oldpass will result in a PKCS12_newpass() failure.

                                                                                                                                                          If the wrong password is used for oldpass then the function will fail, with a MAC verification error. In rare cases the PKCS12 structure does not contain a MAC: in this case it will usually fail with a decryption padding error.

                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_newpass() returns 1 on success or 0 on failure. Applications can retrieve the most recent error from PKCS12_newpass() with ERR_get_error().

                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          This example loads a PKCS#12 file, changes its password and writes out the result to a new file.

                                                                                                                                                          #include <stdio.h>\n#include <stdlib.h>\n#include <openssl/pem.h>\n#include <openssl/err.h>\n#include <openssl/pkcs12.h>\n\nint main(int argc, char **argv)\n{\n    FILE *fp;\n    PKCS12 *p12;\n\n    if (argc != 5) {\n        fprintf(stderr, \"Usage: pkread p12file password newpass opfile\\n\");\n        return 1;\n    }\n    if ((fp = fopen(argv[1], \"rb\")) == NULL) {\n        fprintf(stderr, \"Error opening file %s\\n\", argv[1]);\n        return 1;\n    }\n    p12 = d2i_PKCS12_fp(fp, NULL);\n    fclose(fp);\n    if (p12 == NULL) {\n        fprintf(stderr, \"Error reading PKCS#12 file\\n\");\n        ERR_print_errors_fp(stderr);\n        return 1;\n    }\n    if (PKCS12_newpass(p12, argv[2], argv[3]) == 0) {\n        fprintf(stderr, \"Error changing password\\n\");\n        ERR_print_errors_fp(stderr);\n        PKCS12_free(p12);\n        return 1;\n    }\n    if ((fp = fopen(argv[4], \"wb\")) == NULL) {\n        fprintf(stderr, \"Error opening file %s\\n\", argv[4]);\n        PKCS12_free(p12);\n        return 1;\n    }\n    i2d_PKCS12_fp(fp, p12);\n    PKCS12_free(p12);\n    fclose(fp);\n    return 0;\n}\n
                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/#bugs","title":"BUGS","text":"

                                                                                                                                                          The password format is a NULL terminated ASCII string which is converted to Unicode form internally. As a result some passwords cannot be supplied to this function.

                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_create(3), ERR_get_error(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS12_newpass/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/","title":"PKCS12_pack_p7encdata","text":""},{"location":"man3/PKCS12_pack_p7encdata/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_pack_p7encdata, PKCS12_pack_p7encdata_ex - Pack a set of PKCS#12 safeBags into a PKCS#7 encrypted data object

                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nPKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,\n                             unsigned char *salt, int saltlen, int iter,\n                             STACK_OF(PKCS12_SAFEBAG) *bags);\nPKCS7 *PKCS12_pack_p7encdata_ex(int pbe_nid, const char *pass, int passlen,\n                                unsigned char *salt, int saltlen, int iter,\n                                STACK_OF(PKCS12_SAFEBAG) *bags,\n                                OSSL_LIB_CTX *ctx, const char *propq);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_pack_p7encdata() generates a PKCS#7 ContentInfo object of encrypted-data type from the set of safeBags bags. The algorithm ID in pbe_nid can be a PKCS#12 or PKCS#5 password based encryption algorithm, or a cipher algorithm. If a cipher algorithm is passed, the PKCS#5 PBES2 algorithm will be used with this cipher as a parameter. The password pass of length passlen, salt salt of length saltlen and iteration count iter are inputs into the encryption operation.

                                                                                                                                                          PKCS12_pack_p7encdata_ex() operates similar to the above but allows for a library context ctx and property query propq to be used to select the algorithm implementation.

                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          A PKCS7 object if successful, or NULL if an error occurred.

                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 2315 (https://tools.ietf.org/html/rfc2315)

                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS12_pbe_crypt_ex(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS12_pack_p7encdata_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS12_pack_p7encdata/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS12_parse/","title":"PKCS12_parse","text":""},{"location":"man3/PKCS12_parse/#name","title":"NAME","text":"

                                                                                                                                                          PKCS12_parse - parse a PKCS#12 structure

                                                                                                                                                          "},{"location":"man3/PKCS12_parse/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs12.h>\n\nint PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,\n                 STACK_OF(X509) **ca);\n
                                                                                                                                                          "},{"location":"man3/PKCS12_parse/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS12_parse() parses a PKCS12 structure.

                                                                                                                                                          p12 is the PKCS12 structure to parse. pass is the passphrase to use. If successful the private key will be written to *pkey, the corresponding certificate to *cert and any additional certificates to *ca.

                                                                                                                                                          "},{"location":"man3/PKCS12_parse/#notes","title":"NOTES","text":"

                                                                                                                                                          Each of the parameters pkey, cert, and ca can be NULL in which case the private key, the corresponding certificate, or the additional certificates, respectively, will be discarded. If any of pkey and cert is non-NULL the variable it points to is initialized. If ca is non-NULL and *ca is NULL a new STACK will be allocated. If ca is non-NULL and *ca is a valid STACK then additional certificates are appended in the given order to *ca.

                                                                                                                                                          The friendlyName and localKeyID attributes (if present) on each certificate will be stored in the alias and keyid attributes of the X509 structure.

                                                                                                                                                          The parameter pass is interpreted as a string in the UTF-8 encoding. If it is not valid UTF-8, then it is assumed to be ISO8859-1 instead.

                                                                                                                                                          In particular, this means that passwords in the locale character set (or code page on Windows) must potentially be converted to UTF-8 before use. This may include passwords from local text files, or input from the terminal or command line. Refer to the documentation of UI_OpenSSL(3), for example.

                                                                                                                                                          "},{"location":"man3/PKCS12_parse/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS12_parse() returns 1 for success and zero if an error occurred.

                                                                                                                                                          The error can be obtained from ERR_get_error(3)

                                                                                                                                                          "},{"location":"man3/PKCS12_parse/#bugs","title":"BUGS","text":"

                                                                                                                                                          Only a single private key and corresponding certificate is returned by this function. More complex PKCS#12 files with multiple private keys will only return the first match.

                                                                                                                                                          Only friendlyName and localKeyID attributes are currently stored in certificates. Other attributes are discarded.

                                                                                                                                                          Attributes currently cannot be stored in the private key EVP_PKEY structure.

                                                                                                                                                          "},{"location":"man3/PKCS12_parse/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          d2i_PKCS12(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS12_parse/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/","title":"PKCS5_PBE_keyivgen","text":""},{"location":"man3/PKCS5_PBE_keyivgen/#name","title":"NAME","text":"

                                                                                                                                                          PKCS5_PBE_keyivgen, PKCS5_PBE_keyivgen_ex, PKCS5_pbe2_set, PKCS5_pbe2_set_iv, PKCS5_pbe2_set_iv_ex, PKCS5_pbe_set, PKCS5_pbe_set_ex, PKCS5_pbe2_set_scrypt, PKCS5_pbe_set0_algor, PKCS5_pbe_set0_algor_ex, PKCS5_v2_PBE_keyivgen, PKCS5_v2_PBE_keyivgen_ex, PKCS5_v2_scrypt_keyivgen, PKCS5_v2_scrypt_keyivgen_ex, PKCS5_pbkdf2_set, PKCS5_pbkdf2_set_ex, EVP_PBE_scrypt, EVP_PBE_scrypt_ex - PKCS#5 Password based encryption routines

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/evp.h>\n\nint PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                       ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                       const EVP_MD *md, int en_de);\nint PKCS5_PBE_keyivgen_ex(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,\n                          ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                          const EVP_MD *md, int en_de, OSSL_LIB_CTX *libctx,\n                          const char *propq);\nint PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                          ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                          const EVP_MD *md, int en_de);\nint PKCS5_v2_PBE_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n                             ASN1_TYPE *param, const EVP_CIPHER *cipher,\n                             const EVP_MD *md, int en_de,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint EVP_PBE_scrypt(const char *pass, size_t passlen,\n                   const unsigned char *salt, size_t saltlen,\n                   uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,\n                   unsigned char *key, size_t keylen);\nint EVP_PBE_scrypt_ex(const char *pass, size_t passlen,\n                      const unsigned char *salt, size_t saltlen,\n                      uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,\n                      unsigned char *key, size_t keylen,\n                      OSSL_LIB_CTX *ctx, const char *propq);\nint PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,\n                             int passlen, ASN1_TYPE *param,\n                             const EVP_CIPHER *c, const EVP_MD *md, int en_de);\nint PKCS5_v2_scrypt_keyivgen_ex(EVP_CIPHER_CTX *ctx, const char *pass,\n                                int passlen, ASN1_TYPE *param,\n                                const EVP_CIPHER *c, const EVP_MD *md, int en_de,\n                                OSSL_LIB_CTX *libctx, const char *propq);\n\n#include <openssl/x509.h>\n\nint PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,\n                         const unsigned char *salt, int saltlen);\nint PKCS5_pbe_set0_algor_ex(X509_ALGOR *algor, int alg, int iter,\n                            const unsigned char *salt, int saltlen,\n                            OSSL_LIB_CTX *libctx);\n\nX509_ALGOR *PKCS5_pbe_set(int alg, int iter,\n                          const unsigned char *salt, int saltlen);\nX509_ALGOR *PKCS5_pbe_set_ex(int alg, int iter,\n                             const unsigned char *salt, int saltlen,\n                             OSSL_LIB_CTX *libctx);\n\nX509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,\n                           unsigned char *salt, int saltlen);\nX509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,\n                              unsigned char *salt, int saltlen,\n                              unsigned char *aiv, int prf_nid);\nX509_ALGOR *PKCS5_pbe2_set_iv_ex(const EVP_CIPHER *cipher, int iter,\n                                 unsigned char *salt, int saltlen,\n                                 unsigned char *aiv, int prf_nid,\n                                 OSSL_LIB_CTX *libctx);\nX509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher,\n                                  const unsigned char *salt, int saltlen,\n                                  unsigned char *aiv, uint64_t N, uint64_t r,\n                                  uint64_t p);\n\nX509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,\n                             int prf_nid, int keylen);\nX509_ALGOR *PKCS5_pbkdf2_set_ex(int iter, unsigned char *salt, int saltlen,\n                                int prf_nid, int keylen,\n                                OSSL_LIB_CTX *libctx);\n
                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#description","title":"DESCRIPTION","text":""},{"location":"man3/PKCS5_PBE_keyivgen/#key-derivation","title":"Key Derivation","text":"

                                                                                                                                                          PKCS5_PBE_keyivgen() and PKCS5_PBE_keyivgen_ex() take a password pass of length passlen, parameters param and a message digest function md_type and performs a key derivation according to PKCS#5 PBES1. The resulting key is then used to initialise the cipher context ctx with a cipher cipher for encryption (en_de=1) or decryption (en_de=0).

                                                                                                                                                          pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                                                                                                                                                          PKCS5_v2_PBE_keyivgen() and PKCS5_v2_PBE_keyivgen_ex() are similar to the above but instead use PKCS#5 PBES2 as the encryption algorithm using the supplied parameters.

                                                                                                                                                          PKCS5_v2_scrypt_keyivgen() and PKCS5_v2_scrypt_keyivgen_ex() use SCRYPT as the key derivation part of the encryption algorithm.

                                                                                                                                                          salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                                                                                                                                                          iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter less than 1 is treated as a single iteration.

                                                                                                                                                          digest is the message digest function used in the derivation.

                                                                                                                                                          Functions ending in _ex() take optional parameters libctx and propq which are used to select appropriate algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#algorithm-identifier-creation","title":"Algorithm Identifier Creation","text":"

                                                                                                                                                          PKCS5_pbe_set(), PKCS5_pbe_set_ex(), PKCS5_pbe2_set(), PKCS5_pbe2_set_iv(), PKCS5_pbe2_set_iv_ex() and PKCS5_pbe2_set_scrypt() generate an X509_ALGOR object which represents an AlgorithmIdentifier containing the algorithm OID and associated parameters for the PBE algorithm.

                                                                                                                                                          PKCS5_pbkdf2_set() and PKCS5_pbkdf2_set_ex() generate an X509_ALGOR object which represents an AlgorithmIdentifier containing the algorithm OID and associated parameters for the PBKDF2 algorithm.

                                                                                                                                                          PKCS5_pbe_set0_algor() and PKCS5_pbe_set0_algor_ex() set the PBE algorithm OID and parameters into the supplied X509_ALGOR.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#notes","title":"NOTES","text":"

                                                                                                                                                          The *_keyivgen() functions are typically used in PKCS#12 to encrypt objects.

                                                                                                                                                          These functions make no assumption regarding the given password. It will simply be treated as a byte sequence.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS5_PBE_keyivgen(), PKCS5_v2_PBE_keyivgen(), PKCS5_v2_PBE_keyivgen_ex(), PKCS5_v2_scrypt_keyivgen(), PKCS5_v2_scrypt_keyivgen_ex(), PKCS5_pbe_set0_algor() and PKCS5_pbe_set0_algor_ex() return 1 for success and 0 if an error occurs.

                                                                                                                                                          PKCS5_pbe_set(), PKCS5_pbe_set_ex(), PKCS5_pbe2_set(), PKCS5_pbe2_set_iv(), PKCS5_pbe2_set_iv_ex(), PKCS5_pbe2_set_scrypt(), PKCS5_pbkdf2_set() and PKCS5_pbkdf2_set_ex() return an X509_ALGOR object or NULL if an error occurs.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 8018 (https://tools.ietf.org/html/rfc8018)

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_PBE_CipherInit_ex(3), PKCS12_pbe_crypt_ex(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS5_v2_PBE_keyivgen_ex(), EVP_PBE_scrypt_ex(), PKCS5_v2_scrypt_keyivgen_ex(), PKCS5_pbe_set0_algor_ex(), PKCS5_pbe_set_ex(), PKCS5_pbe2_set_iv_ex() and PKCS5_pbkdf2_set_ex() were added in OpenSSL 3.0.

                                                                                                                                                          From OpenSSL 3.0 the PBKDF1 algorithm used in PKCS5_PBE_keyivgen() and PKCS5_PBE_keyivgen_ex() has been moved to the legacy provider as an EVP_KDF.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBE_keyivgen/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBKDF2_HMAC/","title":"PKCS5_PBKDF2_HMAC","text":""},{"location":"man3/PKCS5_PBKDF2_HMAC/#name","title":"NAME","text":"

                                                                                                                                                          PKCS5_PBKDF2_HMAC, PKCS5_PBKDF2_HMAC_SHA1 - password based derivation routines with salt and iteration count

                                                                                                                                                          "},{"location":"man3/PKCS5_PBKDF2_HMAC/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/evp.h>\n\nint PKCS5_PBKDF2_HMAC(const char *pass, int passlen,\n                      const unsigned char *salt, int saltlen, int iter,\n                      const EVP_MD *digest,\n                      int keylen, unsigned char *out);\n\nint PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,\n                           const unsigned char *salt, int saltlen, int iter,\n                           int keylen, unsigned char *out);\n
                                                                                                                                                          "},{"location":"man3/PKCS5_PBKDF2_HMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS5_PBKDF2_HMAC() derives a key from a password using a salt and iteration count as specified in RFC 2898.

                                                                                                                                                          pass is the password used in the derivation of length passlen. pass is an optional parameter and can be NULL. If passlen is -1, then the function will calculate the length of pass using strlen().

                                                                                                                                                          salt is the salt used in the derivation of length saltlen. If the salt is NULL, then saltlen must be 0. The function will not attempt to calculate the length of the salt because it is not assumed to be NULL terminated.

                                                                                                                                                          iter is the iteration count and its value should be greater than or equal to 1. RFC 2898 suggests an iteration count of at least 1000. Any iter value less than 1 is invalid; such values will result in failure and raise the PROV_R_INVALID_ITERATION_COUNT error.

                                                                                                                                                          digest is the message digest function used in the derivation. PKCS5_PBKDF2_HMAC_SHA1() calls PKCS5_PBKDF2_HMAC() with EVP_sha1().

                                                                                                                                                          The derived key will be written to out. The size of the out buffer is specified via keylen.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBKDF2_HMAC/#notes","title":"NOTES","text":"

                                                                                                                                                          A typical application of this function is to derive keying material for an encryption algorithm from a password in the pass, a salt in salt, and an iteration count.

                                                                                                                                                          Increasing the iter parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                                                                                                                                          These functions make no assumption regarding the given password. It will simply be treated as a byte sequence.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBKDF2_HMAC/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS5_PBKDF2_HMAC() and PBKCS5_PBKDF2_HMAC_SHA1() return 1 on success or 0 on error.

                                                                                                                                                          "},{"location":"man3/PKCS5_PBKDF2_HMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          evp(7), RAND_bytes(3), EVP_BytesToKey(3), passphrase-encoding(7)

                                                                                                                                                          "},{"location":"man3/PKCS5_PBKDF2_HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2014-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/","title":"PKCS7_decrypt","text":""},{"location":"man3/PKCS7_decrypt/#name","title":"NAME","text":"

                                                                                                                                                          PKCS7_decrypt - decrypt content from a PKCS#7 envelopedData structure

                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nint PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);\n
                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS7_decrypt() extracts and decrypts the content from a PKCS#7 envelopedData structure. pkey is the private key of the recipient, cert is the recipients certificate, data is a BIO to write the content to and flags is an optional set of flags.

                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/#notes","title":"NOTES","text":"

                                                                                                                                                          Although the recipients certificate is not needed to decrypt the data it is needed to locate the appropriate (of possible several) recipients in the PKCS#7 structure.

                                                                                                                                                          The following flags can be passed in the flags parameter.

                                                                                                                                                          If the PKCS7_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS7_decrypt() returns either 1 for success or 0 for failure. The error can be obtained from ERR_get_error(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/#bugs","title":"BUGS","text":"

                                                                                                                                                          PKCS7_decrypt() must be passed the correct recipient key and certificate. It would be better if it could look up the correct key and certificate from a database.

                                                                                                                                                          The lack of single pass processing and need to hold all data in memory as mentioned in PKCS7_sign() also applies to PKCS7_verify().

                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), PKCS7_encrypt(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_decrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS7_encrypt/","title":"PKCS7_encrypt","text":""},{"location":"man3/PKCS7_encrypt/#name","title":"NAME","text":"

                                                                                                                                                          PKCS7_encrypt_ex, PKCS7_encrypt - create a PKCS#7 envelopedData structure

                                                                                                                                                          "},{"location":"man3/PKCS7_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nPKCS7 *PKCS7_encrypt_ex(STACK_OF(X509) *certs, BIO *in,\n                        const EVP_CIPHER *cipher, int flags,\n                        OSSL_LIB_CTX *libctx, const char *propq);\nPKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,\n                     int flags);\n
                                                                                                                                                          "},{"location":"man3/PKCS7_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS7_encrypt_ex() creates and returns a PKCS#7 envelopedData structure. certs is a list of recipient certificates. in is the content to be encrypted. cipher is the symmetric cipher to use. flags is an optional set of flags. The library context libctx and the property query propq are used when retrieving algorithms from providers.

                                                                                                                                                          Only RSA keys are supported in PKCS#7 and envelopedData so the recipient certificates supplied to this function must all contain RSA public keys, though they do not have to be signed using the RSA algorithm.

                                                                                                                                                          EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use because most clients will support it.

                                                                                                                                                          Some old \"export grade\" clients may only support weak encryption using 40 or 64 bit RC2. These can be used by passing EVP_rc2_40_cbc() and EVP_rc2_64_cbc() respectively.

                                                                                                                                                          The algorithm passed in the cipher parameter must support ASN1 encoding of its parameters.

                                                                                                                                                          Many browsers implement a \"sign and encrypt\" option which is simply an S/MIME envelopedData containing an S/MIME signed message. This can be readily produced by storing the S/MIME signed message in a memory BIO and passing it to PKCS7_encrypt().

                                                                                                                                                          The following flags can be passed in the flags parameter.

                                                                                                                                                          If the PKCS7_TEXT flag is set MIME headers for type text/plain are prepended to the data.

                                                                                                                                                          Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if PKCS7_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it. If PKCS7_BINARY is set then PKCS7_TEXT is ignored.

                                                                                                                                                          If the PKCS7_STREAM flag is set a partial PKCS7 structure is output suitable for streaming I/O: no data is read from the BIO in.

                                                                                                                                                          If the flag PKCS7_STREAM is set the returned PKCS7 structure is not complete and outputting its contents via a function that does not properly finalize the PKCS7 structure will give unpredictable results.

                                                                                                                                                          Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(), PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_PKCS7().

                                                                                                                                                          PKCS7_encrypt() is similar to PKCS7_encrypt_ex() but uses default values of NULL for the library context libctx and the property query propq.

                                                                                                                                                          "},{"location":"man3/PKCS7_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS7_encrypt_ex() and PKCS7_encrypt() return either a PKCS7 structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/PKCS7_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), PKCS7_decrypt(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                                          The function PKCS7_encrypt_ex() was added in OpenSSL 3.0.

                                                                                                                                                          The PKCS7_STREAM flag was added in OpenSSL 1.0.0.

                                                                                                                                                          "},{"location":"man3/PKCS7_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS7_get_octet_string/","title":"PKCS7_get_octet_string","text":""},{"location":"man3/PKCS7_get_octet_string/#name","title":"NAME","text":"

                                                                                                                                                          PKCS7_get_octet_string - return octet string from a PKCS#7 envelopedData structure

                                                                                                                                                          "},{"location":"man3/PKCS7_get_octet_string/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nASN1_OCTET_STRING *PKCS7_get_octet_string(PKCS7 *p7);\n
                                                                                                                                                          "},{"location":"man3/PKCS7_get_octet_string/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS7_get_octet_string() returns a pointer to an ASN1 octet string from a PKCS#7 envelopedData structure or NULL if the structure cannot be parsed.

                                                                                                                                                          "},{"location":"man3/PKCS7_get_octet_string/#notes","title":"NOTES","text":"

                                                                                                                                                          As the 0 implies, PKCS7_get_octet_string() returns internal pointers which should not be freed by the caller.

                                                                                                                                                          "},{"location":"man3/PKCS7_get_octet_string/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS7_get_octet_string() returns an ASN1_OCTET_STRING pointer.

                                                                                                                                                          "},{"location":"man3/PKCS7_get_octet_string/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS7_type_is_data(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_get_octet_string/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign/","title":"PKCS7_sign","text":""},{"location":"man3/PKCS7_sign/#name","title":"NAME","text":"

                                                                                                                                                          PKCS7_sign_ex, PKCS7_sign - create a PKCS#7 signedData structure

                                                                                                                                                          "},{"location":"man3/PKCS7_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nPKCS7 *PKCS7_sign_ex(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                     BIO *data, int flags, OSSL_LIB_CTX *libctx,\n                     const char *propq);\nPKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\n                  BIO *data, int flags);\n
                                                                                                                                                          "},{"location":"man3/PKCS7_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS7_sign_ex() creates and returns a PKCS#7 signedData structure. signcert is the certificate to sign with, pkey is the corresponding private key. certs is an optional set of extra certificates to include in the PKCS#7 structure (for example any intermediate CAs in the chain). The library context libctx and property query propq are used when retrieving algorithms from providers.

                                                                                                                                                          The data to be signed is read from BIO data.

                                                                                                                                                          flags is an optional set of flags.

                                                                                                                                                          Any of the following flags (ored together) can be passed in the flags parameter.

                                                                                                                                                          Many S/MIME clients expect the signed content to include valid MIME headers. If the PKCS7_TEXT flag is set MIME headers for type text/plain are prepended to the data.

                                                                                                                                                          If PKCS7_NOCERTS is set the signer's certificate and the extra certs will not be included in the PKCS7 structure. The signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signatures if the signer's certificates can be obtained by other means: for example a previously signed message.

                                                                                                                                                          The data being signed is included in the PKCS7 structure, unless PKCS7_DETACHED is set in which case it is omitted. This is used for PKCS7 detached signatures which are used in S/MIME plaintext signed messages for example.

                                                                                                                                                          Normally the supplied content is translated into MIME canonical format (as required by the S/MIME specifications) if PKCS7_BINARY is set no translation occurs. This option should be used if the supplied data is in binary format otherwise the translation will corrupt it.

                                                                                                                                                          The signedData structure includes several PKCS#7 authenticatedAttributes including the signing time, the PKCS#7 content type and the supported list of ciphers in an SMIMECapabilities attribute. If PKCS7_NOATTR is set then no authenticatedAttributes will be used. If PKCS7_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

                                                                                                                                                          If present the SMIMECapabilities attribute indicates support for the following algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is disabled then it will not be included.

                                                                                                                                                          If the flags PKCS7_STREAM is set then the returned PKCS7 structure is just initialized ready to perform the signing operation. The signing is however not performed and the data to be signed is not read from the data parameter. Signing is deferred until after the data has been written. In this way data can be signed in a single pass.

                                                                                                                                                          If the PKCS7_PARTIAL flag is set a partial PKCS7 structure is output to which additional signers and capabilities can be added before finalization.

                                                                                                                                                          If the flag PKCS7_STREAM is set the returned PKCS7 structure is not complete and outputting its contents via a function that does not properly finalize the PKCS7 structure will give unpredictable results.

                                                                                                                                                          Several functions including SMIME_write_PKCS7(), i2d_PKCS7_bio_stream(), PEM_write_bio_PKCS7_stream() finalize the structure. Alternatively finalization can be performed by obtaining the streaming ASN1 BIO directly using BIO_new_PKCS7().

                                                                                                                                                          If a signer is specified it will use the default digest for the signing algorithm. This is SHA1 for both RSA and DSA keys.

                                                                                                                                                          The certs, signcert and pkey parameters can all be NULL if the PKCS7_PARTIAL flag is set. One or more signers can be added using the function PKCS7_sign_add_signer(). PKCS7_final() must also be called to finalize the structure if streaming is not enabled. Alternative signing digests can also be specified using this method.

                                                                                                                                                          If signcert and pkey are NULL then a certificates only PKCS#7 structure is output.

                                                                                                                                                          In versions of OpenSSL before 1.0.0 the signcert and pkey parameters must not be NULL.

                                                                                                                                                          PKCS7_sign() is like PKCS7_sign_ex() except that it uses default values of NULL for the library context libctx and the property query propq. This is retained for API backward compatibility.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign/#bugs","title":"BUGS","text":"

                                                                                                                                                          Some advanced attributes such as counter signatures are not supported.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS7_sign_ex() and PKCS7_sign() return either a valid PKCS7 structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/PKCS7_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), PKCS7_verify(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_sign/#history","title":"HISTORY","text":"

                                                                                                                                                          The function PKCS7_sign_ex() was added in OpenSSL 3.0.

                                                                                                                                                          The PKCS7_PARTIAL flag, and the ability for certs, signcert, and pkey parameters to be NULL were added in OpenSSL 1.0.0.

                                                                                                                                                          The PKCS7_STREAM flag was added in OpenSSL 1.0.0.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/","title":"PKCS7_sign_add_signer","text":""},{"location":"man3/PKCS7_sign_add_signer/#name","title":"NAME","text":"

                                                                                                                                                          PKCS7_sign_add_signer, PKCS7_add_certificate, PKCS7_add_crl - add information to PKCS7 structure

                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nPKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert,\n                                         EVP_PKEY *pkey, const EVP_MD *md, int flags);\nint PKCS7_add_certificate(PKCS7 *p7, X509 *cert);\nint PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl);\n
                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS7_sign_add_signer() adds a signer with certificate signcert and private key pkey using message digest md to a PKCS7 signed data structure p7.

                                                                                                                                                          The PKCS7 structure should be obtained from an initial call to PKCS7_sign() with the flag PKCS7_PARTIAL set or in the case or re-signing a valid PKCS#7 signed data structure.

                                                                                                                                                          If the md parameter is NULL then the default digest for the public key algorithm will be used.

                                                                                                                                                          Unless the PKCS7_REUSE_DIGEST flag is set the returned PKCS7 structure is not complete and must be finalized either by streaming (if applicable) or a call to PKCS7_final().

                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/#notes","title":"NOTES","text":"

                                                                                                                                                          The main purpose of this function is to provide finer control over a PKCS#7 signed data structure where the simpler PKCS7_sign() function defaults are not appropriate. For example if multiple signers or non default digest algorithms are needed.

                                                                                                                                                          Any of the following flags (ored together) can be passed in the flags parameter.

                                                                                                                                                          If PKCS7_REUSE_DIGEST is set then an attempt is made to copy the content digest value from the PKCS7 structure: to add a signer to an existing structure. An error occurs if a matching digest value cannot be found to copy. The returned PKCS7 structure will be valid and finalized when this flag is set.

                                                                                                                                                          If PKCS7_PARTIAL is set in addition to PKCS7_REUSE_DIGEST then the PKCS7_SIGNER_INO structure will not be finalized so additional attributes can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is needed to finalize it.

                                                                                                                                                          If PKCS7_NOCERTS is set the signer's certificate will not be included in the PKCS7 structure, the signer's certificate must still be supplied in the signcert parameter though. This can reduce the size of the signature if the signers certificate can be obtained by other means: for example a previously signed message.

                                                                                                                                                          The signedData structure includes several PKCS#7 authenticatedAttributes including the signing time, the PKCS#7 content type and the supported list of ciphers in an SMIMECapabilities attribute. If PKCS7_NOATTR is set then no authenticatedAttributes will be used. If PKCS7_NOSMIMECAP is set then just the SMIMECapabilities are omitted.

                                                                                                                                                          If present the SMIMECapabilities attribute indicates support for the following algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of these algorithms is disabled then it will not be included.

                                                                                                                                                          PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO structure just added, which can be used to set additional attributes before it is finalized.

                                                                                                                                                          PKCS7_add_certificate() adds to the PKCS7 structure p7 the certificate cert, which may be an end-entity (signer) certificate or a CA certificate useful for chain building. This is done internally by PKCS7_sign_ex(3) and similar signing functions. It may have to be used before calling PKCS7_verify(3) in order to provide any missing certificate(s) needed for verification.

                                                                                                                                                          PKCS7_add_crl() adds the CRL crl to the PKCS7 structure p7. This may be called to provide certificate status information to be included when signing or to use when verifying the PKCS7 structure.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO structure just added or NULL if an error occurs.

                                                                                                                                                          PKCS7_add_certificate() and PKCS7_add_crl() return 1 on success, 0 on error.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), PKCS7_sign_ex(3), PKCS7_final(3), PKCS7_verify(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/#history","title":"HISTORY","text":"

                                                                                                                                                          The PPKCS7_sign_add_signer() function was added in OpenSSL 1.0.0.

                                                                                                                                                          "},{"location":"man3/PKCS7_sign_add_signer/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS7_type_is_other/","title":"PKCS7_type_is_other","text":""},{"location":"man3/PKCS7_type_is_other/#name","title":"NAME","text":"

                                                                                                                                                          PKCS7_type_is_other - determine content type of PKCS#7 envelopedData structure

                                                                                                                                                          "},{"location":"man3/PKCS7_type_is_other/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nint PKCS7_type_is_other(PKCS7 *p7);\n
                                                                                                                                                          "},{"location":"man3/PKCS7_type_is_other/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS7_type_is_other() returns the whether the content type of a PKCS#7 envelopedData structure is one of the following content types:

                                                                                                                                                          NID_pkcs7_data NID_pkcs7_signed NID_pkcs7_enveloped NID_pkcs7_signedAndEnveloped NID_pkcs7_digest NID_pkcs7_encrypted

                                                                                                                                                          "},{"location":"man3/PKCS7_type_is_other/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS7_type_is_other() returns either 0 if the content type is matched or 1 otherwise.

                                                                                                                                                          "},{"location":"man3/PKCS7_type_is_other/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          PKCS7_type_is_data(3), PKCS7_get_octet_string(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_type_is_other/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/","title":"PKCS7_verify","text":""},{"location":"man3/PKCS7_verify/#name","title":"NAME","text":"

                                                                                                                                                          PKCS7_verify, PKCS7_get0_signers - verify a PKCS#7 signedData structure

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nint PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,\n                 BIO *indata, BIO *out, int flags);\n\nSTACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);\n
                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS7_verify() is very similar to CMS_verify(3). It verifies a PKCS#7 signedData structure given in p7. The optional certs parameter refers to a set of certificates in which to search for signer's certificates. p7 may contain extra untrusted CA certificates that may be used for chain building as well as CRLs that may be used for certificate validation. store may be NULL or point to the trusted certificate store to use for chain verification. indata refers to the signed data if the content is detached from p7. Otherwise indata should be NULL, and then the signed data must be in p7. The content is written to the BIO out unless it is NULL. flags is an optional set of flags, which can be used to modify the operation.

                                                                                                                                                          PKCS7_get0_signers() retrieves the signer's certificates from p7, it does not check their validity or whether any signatures are valid. The certs and flags parameters have the same meanings as in PKCS7_verify().

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#verify-process","title":"VERIFY PROCESS","text":"

                                                                                                                                                          Normally the verify process proceeds as follows.

                                                                                                                                                          Initially some sanity checks are performed on p7. The type of p7 must be SignedData. There must be at least one signature on the data and if the content is detached indata cannot be NULL. If the content is not detached and indata is not NULL then the structure has both embedded and external content. To treat this as an error, use the flag PKCS7_NO_DUAL_CONTENT. The default behavior allows this, for compatibility with older versions of OpenSSL.

                                                                                                                                                          An attempt is made to locate all the signer's certificates, first looking in the certs parameter (if it is not NULL). Then they are looked up in any certificates contained in the p7 structure unless PKCS7_NOINTERN is set. If any signer's certificates cannot be located the operation fails.

                                                                                                                                                          Each signer's certificate is chain verified using the smimesign purpose and using the trusted certificate store store if supplied. Any internal certificates in the message, which may have been added using PKCS7_add_certificate(3), are used as untrusted CAs unless PKCS7_NOCHAIN is set. If CRL checking is enabled in store and PKCS7_NOCRL is not set, any internal CRLs, which may have been added using PKCS7_add_crl(3), are used in addition to attempting to look them up in store. If store is not NULL and any chain verify fails an error code is returned.

                                                                                                                                                          Finally the signed content is read (and written to out unless it is NULL) and the signature is checked.

                                                                                                                                                          If all signatures verify correctly then the function is successful.

                                                                                                                                                          Any of the following flags (ored together) can be passed in the flags parameter to change the default verify behaviour. Only the flag PKCS7_NOINTERN is meaningful to PKCS7_get0_signers().

                                                                                                                                                          If PKCS7_NOINTERN is set the certificates in the message itself are not searched when locating the signer's certificates. This means that all the signer's certificates must be in the certs parameter.

                                                                                                                                                          If PKCS7_NOCRL is set and CRL checking is enabled in store then any CRLs in the message itself are ignored.

                                                                                                                                                          If the PKCS7_TEXT flag is set MIME headers for type text/plain are deleted from the content. If the content is not of type text/plain then an error is returned.

                                                                                                                                                          If PKCS7_NOVERIFY is set the signer's certificates are not chain verified.

                                                                                                                                                          If PKCS7_NOCHAIN is set then the certificates contained in the message are not used as untrusted CAs. This means that the whole verify chain (apart from the signer's certificates) must be contained in the trusted store.

                                                                                                                                                          If PKCS7_NOSIGS is set then the signatures on the data are not checked.

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#notes","title":"NOTES","text":"

                                                                                                                                                          One application of PKCS7_NOINTERN is to only accept messages signed by a small number of certificates. The acceptable certificates would be passed in the certs parameter. In this case if the signer's certificate is not one of the certificates supplied in certs then the verify will fail because the signer cannot be found.

                                                                                                                                                          Care should be taken when modifying the default verify behaviour, for example setting PKCS7_NOVERIFY|PKCS7_NOSIGS will totally disable all verification and any signed message will be considered valid. This combination is however useful if one merely wishes to write the content to out and its validity is not considered important.

                                                                                                                                                          Chain verification should arguably be performed using the signing time rather than the current time. However, since the signing time is supplied by the signer it cannot be trusted without additional evidence (such as a trusted timestamp).

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS7_verify() returns 1 for a successful verification and 0 if an error occurs.

                                                                                                                                                          PKCS7_get0_signers() returns all signers or NULL if an error occurred.

                                                                                                                                                          The error can be obtained from ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#bugs","title":"BUGS","text":"

                                                                                                                                                          The trusted certificate store is not searched for the signer's certificates. This is primarily due to the inadequacies of the current X509_STORE functionality.

                                                                                                                                                          The lack of single pass processing means that the signed content must all be held in memory if it is not detached.

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          CMS_verify(3), PKCS7_add_certificate(3), PKCS7_add_crl(3), ERR_get_error(3), PKCS7_sign(3)

                                                                                                                                                          "},{"location":"man3/PKCS7_verify/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/","title":"PKCS8_encrypt","text":""},{"location":"man3/PKCS8_encrypt/#name","title":"NAME","text":"

                                                                                                                                                          PKCS8_decrypt, PKCS8_decrypt_ex, PKCS8_encrypt, PKCS8_encrypt_ex, PKCS8_set0_pbe, PKCS8_set0_pbe_ex - PKCS8 encrypt/decrypt functions

                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/x509.h>\n\nPKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass,\n                                   int passlen);\nPKCS8_PRIV_KEY_INFO *PKCS8_decrypt_ex(const X509_SIG *p8, const char *pass,\n                                      int passlen, OSSL_LIB_CTX *ctx,\n                                      const char *propq);\nX509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,\n                        const char *pass, int passlen, unsigned char *salt,\n                        int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8);\nX509_SIG *PKCS8_encrypt_ex(int pbe_nid, const EVP_CIPHER *cipher,\n                           const char *pass, int passlen, unsigned char *salt,\n                           int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8,\n                           OSSL_LIB_CTX *ctx, const char *propq);\nX509_SIG *PKCS8_set0_pbe(const char *pass, int passlen,\n                        PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe);\nX509_SIG *PKCS8_set0_pbe_ex(const char *pass, int passlen,\n                            PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe,\n                            OSSL_LIB_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS8_encrypt() and PKCS8_encrypt_ex() perform encryption of an object p8 using the password pass of length passlen, salt salt of length saltlen and iteration count iter. The resulting X509_SIG contains the encoded algorithm parameters and encrypted key.

                                                                                                                                                          PKCS8_decrypt() and PKCS8_decrypt_ex() perform decryption of an X509_SIG in p8 using the password pass of length passlen along with algorithm parameters obtained from the p8.

                                                                                                                                                          PKCS8_set0_pbe() and PKCS8_set0_pbe_ex() perform encryption of the p8inf using the password pass of length passlen and parameters pbe.

                                                                                                                                                          Functions ending in _ex() allow for a library context ctx and property query propq to be used to select algorithm implementations.

                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS8_encrypt(), PKCS8_encrypt_ex(), PKCS8_set0_pbe() and PKCS8_set0_pbe_ex() return an encrypted key in a X509_SIG structure or NULL if an error occurs.

                                                                                                                                                          PKCS8_decrypt() and PKCS8_decrypt_ex() return a PKCS8_PRIV_KEY_INFO or NULL if an error occurs.

                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          IETF RFC 7292 (https://tools.ietf.org/html/rfc7292)

                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          crypto(7)

                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                                          PKCS8_decrypt_ex(), PKCS8_encrypt_ex() and PKCS8_set0_pbe_ex() were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/PKCS8_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/PKCS8_pkey_add1_attr/","title":"PKCS8_pkey_add1_attr","text":""},{"location":"man3/PKCS8_pkey_add1_attr/#name","title":"NAME","text":"

                                                                                                                                                          PKCS8_pkey_get0_attrs, PKCS8_pkey_add1_attr, PKCS8_pkey_add1_attr_by_NID, PKCS8_pkey_add1_attr_by_OBJ - PKCS8 attribute functions

                                                                                                                                                          "},{"location":"man3/PKCS8_pkey_add1_attr/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/x509.h>\n\nconst STACK_OF(X509_ATTRIBUTE) *\nPKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8);\nint PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr);\nint PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type,\n                                const unsigned char *bytes, int len);\nint PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj,\n                               int type, const unsigned char *bytes, int len);\n
                                                                                                                                                          "},{"location":"man3/PKCS8_pkey_add1_attr/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          PKCS8_pkey_get0_attrs() returns a const STACK of X509_ATTRIBUTE present in the passed const PKCS8_PRIV_KEY_INFO structure p8.

                                                                                                                                                          PKCS8_pkey_add1_attr() adds a constructed X509_ATTRIBUTE attr to the existing PKCS8_PRIV_KEY_INFO structure p8.

                                                                                                                                                          PKCS8_pkey_add1_attr_by_NID() and PKCS8_pkey_add1_attr_by_OBJ() construct a new X509_ATTRIBUTE from the passed arguments and add it to the existing PKCS8_PRIV_KEY_INFO structure p8.

                                                                                                                                                          "},{"location":"man3/PKCS8_pkey_add1_attr/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          PKCS8_pkey_add1_attr(), PKCS8_pkey_add1_attr_by_NID(), and PKCS8_pkey_add1_attr_by_OBJ() return 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/PKCS8_pkey_add1_attr/#notes","title":"NOTES","text":"

                                                                                                                                                          STACK of X509_ATTRIBUTE is present in many X509-related structures and some of them have the corresponding set of similar functions.

                                                                                                                                                          "},{"location":"man3/PKCS8_pkey_add1_attr/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          crypto(7)

                                                                                                                                                          "},{"location":"man3/PKCS8_pkey_add1_attr/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_add/","title":"RAND_add","text":""},{"location":"man3/RAND_add/#name","title":"NAME","text":"

                                                                                                                                                          RAND_add, RAND_poll, RAND_seed, RAND_status, RAND_event, RAND_screen, RAND_keep_random_devices_open - add randomness to the PRNG or get its status

                                                                                                                                                          "},{"location":"man3/RAND_add/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n\nint RAND_status(void);\nint RAND_poll();\n\nvoid RAND_add(const void *buf, int num, double randomness);\nvoid RAND_seed(const void *buf, int num);\n\nvoid RAND_keep_random_devices_open(int keep);\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);\nvoid RAND_screen(void);\n
                                                                                                                                                          "},{"location":"man3/RAND_add/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions can be used to seed the random generator and to check its seeded state. In general, manual (re-)seeding of the default OpenSSL random generator (RAND_OpenSSL(3)) is not necessary (but allowed), since it does (re-)seed itself automatically using trusted system entropy sources. This holds unless the default RAND_METHOD has been replaced or OpenSSL was built with automatic reseeding disabled, see RAND(7) for more details.

                                                                                                                                                          RAND_status() indicates whether or not the random generator has been sufficiently seeded. If not, functions such as RAND_bytes(3) will fail.

                                                                                                                                                          RAND_poll() uses the system's capabilities to seed the random generator using random input obtained from polling various trusted entropy sources. The default choice of the entropy source can be modified at build time, see RAND(7) for more details.

                                                                                                                                                          RAND_add() mixes the num bytes at buf into the internal state of the random generator. This function will not normally be needed, as mentioned above. The randomness argument is an estimate of how much randomness is contained in buf, in bytes, and should be a number between zero and num. Details about sources of randomness and how to estimate their randomness can be found in the literature; for example [NIST SP 800-90B]. The content of buf cannot be recovered from subsequent random generator output. Applications that intend to save and restore random state in an external file should consider using RAND_load_file(3) instead.

                                                                                                                                                          NOTE: In FIPS mode, random data provided by the application is not considered to be a trusted entropy source. It is mixed into the internal state of the RNG as additional data only and this does not count as a full reseed. For more details, see EVP_RAND(7).

                                                                                                                                                          RAND_seed() is equivalent to RAND_add() with randomness set to num.

                                                                                                                                                          RAND_keep_random_devices_open() is used to control file descriptor usage by the random seed sources. Some seed sources maintain open file descriptors by default, which allows such sources to operate in a chroot(2) jail without the associated device nodes being available. When the keep argument is zero, this call disables the retention of file descriptors. Conversely, a nonzero argument enables the retention of file descriptors. This function is usually called during initialization and it takes effect immediately. This capability only applies to the default provider.

                                                                                                                                                          RAND_event() and RAND_screen() are equivalent to RAND_poll() and exist for compatibility reasons only. See HISTORY section below.

                                                                                                                                                          "},{"location":"man3/RAND_add/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RAND_status() returns 1 if the random generator has been seeded with enough data, 0 otherwise.

                                                                                                                                                          RAND_poll() returns 1 if it generated seed data, 0 otherwise.

                                                                                                                                                          RAND_event() returns RAND_status().

                                                                                                                                                          The other functions do not return values.

                                                                                                                                                          "},{"location":"man3/RAND_add/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RAND_bytes(3), RAND_egd(3), RAND_load_file(3), RAND(7) EVP_RAND(7)

                                                                                                                                                          "},{"location":"man3/RAND_add/#history","title":"HISTORY","text":"

                                                                                                                                                          RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should not be used.

                                                                                                                                                          "},{"location":"man3/RAND_add/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_bytes/","title":"RAND_bytes","text":""},{"location":"man3/RAND_bytes/#name","title":"NAME","text":"

                                                                                                                                                          RAND_bytes, RAND_priv_bytes, RAND_bytes_ex, RAND_priv_bytes_ex, RAND_pseudo_bytes - generate random data

                                                                                                                                                          "},{"location":"man3/RAND_bytes/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n\nint RAND_bytes(unsigned char *buf, int num);\nint RAND_priv_bytes(unsigned char *buf, int num);\n\nint RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,\n                  unsigned int strength);\nint RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,\n                       unsigned int strength);\n

                                                                                                                                                          The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RAND_pseudo_bytes(unsigned char *buf, int num);\n
                                                                                                                                                          "},{"location":"man3/RAND_bytes/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          RAND_bytes() generates num random bytes using a cryptographically secure pseudo random generator (CSPRNG) and stores them in buf.

                                                                                                                                                          RAND_priv_bytes() has the same semantics as RAND_bytes(). It is intended to be used for generating values that should remain private. If using the default RAND_METHOD, this function uses a separate \"private\" PRNG instance so that a compromise of the \"public\" PRNG instance will not affect the secrecy of these private values, as described in RAND(7) and EVP_RAND(7).

                                                                                                                                                          RAND_bytes_ex() and RAND_priv_bytes_ex() are the same as RAND_bytes() and RAND_priv_bytes() except that they both take additional strength and ctx parameters. The bytes generated will have a security strength of at least strength bits. The DRBG used for the operation is the public or private DRBG associated with the specified ctx. The parameter can be NULL, in which case the default library context is used (see OSSL_LIB_CTX(3). If the default RAND_METHOD has been changed then for compatibility reasons the RAND_METHOD will be used in preference and the DRBG of the library context ignored.

                                                                                                                                                          "},{"location":"man3/RAND_bytes/#notes","title":"NOTES","text":"

                                                                                                                                                          By default, the OpenSSL CSPRNG supports a security level of 256 bits, provided it was able to seed itself from a trusted entropy source. On all major platforms supported by OpenSSL (including the Unix-like platforms and Windows), OpenSSL is configured to automatically seed the CSPRNG on first use using the operating systems's random generator.

                                                                                                                                                          If the entropy source fails or is not available, the CSPRNG will enter an error state and refuse to generate random bytes. For that reason, it is important to always check the error return value of RAND_bytes() and RAND_priv_bytes() and not take randomness for granted.

                                                                                                                                                          On other platforms, there might not be a trusted entropy source available or OpenSSL might have been explicitly configured to use different entropy sources. If you are in doubt about the quality of the entropy source, don't hesitate to ask your operating system vendor or post a question on GitHub or the openssl-users mailing list.

                                                                                                                                                          "},{"location":"man3/RAND_bytes/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RAND_bytes() and RAND_priv_bytes() return 1 on success, -1 if not supported by the current RAND method, or 0 on other failure. The error code can be obtained by ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/RAND_bytes/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RAND_add(3), RAND_bytes(3), RAND_priv_bytes(3), ERR_get_error(3), RAND(7), EVP_RAND(7)

                                                                                                                                                          "},{"location":"man3/RAND_bytes/#history","title":"HISTORY","text":"
                                                                                                                                                          • RAND_pseudo_bytes() was deprecated in OpenSSL 1.1.0; use RAND_bytes() instead.
                                                                                                                                                          • The RAND_priv_bytes() function was added in OpenSSL 1.1.1.
                                                                                                                                                          • The RAND_bytes_ex() and RAND_priv_bytes_ex() functions were added in OpenSSL 3.0
                                                                                                                                                          "},{"location":"man3/RAND_bytes/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_cleanup/","title":"RAND_cleanup","text":""},{"location":"man3/RAND_cleanup/#name","title":"NAME","text":"

                                                                                                                                                          RAND_cleanup - erase the PRNG state

                                                                                                                                                          "},{"location":"man3/RAND_cleanup/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n

                                                                                                                                                          The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          void RAND_cleanup(void);\n
                                                                                                                                                          "},{"location":"man3/RAND_cleanup/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          Prior to OpenSSL 1.1.0, RAND_cleanup() released all resources used by the PRNG. As of version 1.1.0, it does nothing and should not be called, since no explicit initialisation or de-initialisation is necessary. See OPENSSL_init_crypto(3).

                                                                                                                                                          "},{"location":"man3/RAND_cleanup/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RAND_cleanup() returns no value.

                                                                                                                                                          "},{"location":"man3/RAND_cleanup/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RAND(7)

                                                                                                                                                          "},{"location":"man3/RAND_cleanup/#history","title":"HISTORY","text":"

                                                                                                                                                          RAND_cleanup() was deprecated in OpenSSL 1.1.0; do not use it. See OPENSSL_init_crypto(3)

                                                                                                                                                          "},{"location":"man3/RAND_cleanup/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_egd/","title":"RAND_egd","text":""},{"location":"man3/RAND_egd/#name","title":"NAME","text":"

                                                                                                                                                          RAND_egd, RAND_egd_bytes, RAND_query_egd_bytes - query entropy gathering daemon

                                                                                                                                                          "},{"location":"man3/RAND_egd/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n\nint RAND_egd_bytes(const char *path, int num);\nint RAND_egd(const char *path);\n\nint RAND_query_egd_bytes(const char *path, unsigned char *buf, int num);\n
                                                                                                                                                          "},{"location":"man3/RAND_egd/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          On older platforms without a good source of randomness such as /dev/urandom, it is possible to query an Entropy Gathering Daemon (EGD) over a local socket to obtain randomness and seed the OpenSSL RNG. The protocol used is defined by the EGDs available at http://egd.sourceforge.net/ or http://prngd.sourceforge.net.

                                                                                                                                                          RAND_egd_bytes() requests num bytes of randomness from an EGD at the specified socket path, and passes the data it receives into RAND_add(). RAND_egd() is equivalent to RAND_egd_bytes() with num set to 255.

                                                                                                                                                          RAND_query_egd_bytes() requests num bytes of randomness from an EGD at the specified socket path, where num must be less than 256. If buf is NULL, it is equivalent to RAND_egd_bytes(). If buf is not NULL, then the data is copied to the buffer and RAND_add() is not called.

                                                                                                                                                          OpenSSL can be configured at build time to try to use the EGD for seeding automatically.

                                                                                                                                                          "},{"location":"man3/RAND_egd/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RAND_egd() and RAND_egd_bytes() return the number of bytes read from the daemon on success, or -1 if the connection failed or the daemon did not return enough data to fully seed the PRNG.

                                                                                                                                                          RAND_query_egd_bytes() returns the number of bytes read from the daemon on success, or -1 if the connection failed.

                                                                                                                                                          "},{"location":"man3/RAND_egd/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RAND_add(3), RAND_bytes(3), RAND(7)

                                                                                                                                                          "},{"location":"man3/RAND_egd/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/","title":"RAND_get0_primary","text":""},{"location":"man3/RAND_get0_primary/#name","title":"NAME","text":"

                                                                                                                                                          RAND_get0_primary, RAND_get0_public, RAND_get0_private, RAND_set0_public, RAND_set0_private - get access to the global EVP_RAND_CTX instances

                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n\nEVP_RAND_CTX *RAND_get0_primary(OSSL_LIB_CTX *ctx);\nEVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx);\nEVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx);\nint RAND_set0_public(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand);\nint RAND_set0_private(OSSL_LIB_CTX *ctx, EVP_RAND_CTX *rand);\n
                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The default RAND API implementation (RAND_OpenSSL()) utilizes three shared DRBG instances which are accessed via the RAND API:

                                                                                                                                                          The public and private DRBG are thread-local instances, which are used by RAND_bytes() and RAND_priv_bytes(), respectively. The primary DRBG is a global instance, which is not intended to be used directly, but is used internally to reseed the other two instances.

                                                                                                                                                          The three get functions provide access to the shared DRBG instances.

                                                                                                                                                          The two set functions allow the public and private DRBG instances to be replaced by another random number generator.

                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RAND_get0_primary() returns a pointer to the primary DRBG instance for the given OSSL_LIB_CTX ctx.

                                                                                                                                                          RAND_get0_public() returns a pointer to the public DRBG instance for the given OSSL_LIB_CTX ctx.

                                                                                                                                                          RAND_get0_private() returns a pointer to the private DRBG instance for the given OSSL_LIB_CTX ctx.

                                                                                                                                                          RAND_set0_public() and RAND_set0_private() return 1 on success and 0 on error.

                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/#notes","title":"NOTES","text":"

                                                                                                                                                          It is not thread-safe to access the primary DRBG instance. The public and private DRBG instance can be accessed safely, because they are thread-local. Note however, that changes to these two instances apply only to the current thread.

                                                                                                                                                          For that reason it is recommended not to change the settings of these three instances directly. Instead, an application should change the default settings for new DRBG instances at initialization time, before creating additional threads.

                                                                                                                                                          During initialization, it is possible to change the reseed interval and reseed time interval. It is also possible to exchange the reseeding callbacks entirely.

                                                                                                                                                          To set the type of DRBG that will be instantiated, use the RAND_set_DRBG_type(3) call before accessing the random number generation infrastructure.

                                                                                                                                                          The two set functions, operate on the the current thread. If you want to use the same random number generator across all threads, each thread must individually call the set functions.

                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_RAND(3), RAND_set_DRBG_type(3)

                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/#history","title":"HISTORY","text":"

                                                                                                                                                          RAND_set0_public() and RAND_set0_private() were added in OpenSSL 3.1.

                                                                                                                                                          The remaining functions were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RAND_get0_primary/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_load_file/","title":"RAND_load_file","text":""},{"location":"man3/RAND_load_file/#name","title":"NAME","text":"

                                                                                                                                                          RAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file

                                                                                                                                                          "},{"location":"man3/RAND_load_file/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n\nint RAND_load_file(const char *filename, long max_bytes);\n\nint RAND_write_file(const char *filename);\n\nconst char *RAND_file_name(char *buf, size_t num);\n
                                                                                                                                                          "},{"location":"man3/RAND_load_file/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          RAND_load_file() reads a number of bytes from file filename and adds them to the PRNG. If max_bytes is nonnegative, up to max_bytes are read; if max_bytes is -1, the complete file is read. Do not load the same file multiple times unless its contents have been updated by RAND_write_file() between reads. Also, note that filename should be adequately protected so that an attacker cannot replace or examine the contents. If filename is not a regular file, then user is considered to be responsible for any side effects, e.g. non-anticipated blocking or capture of controlling terminal.

                                                                                                                                                          RAND_write_file() writes a number of random bytes (currently 128) to file filename which can be used to initialize the PRNG by calling RAND_load_file() in a later session.

                                                                                                                                                          RAND_file_name() generates a default path for the random seed file. buf points to a buffer of size num in which to store the filename.

                                                                                                                                                          On all systems, if the environment variable RANDFILE is set, its value will be used as the seed filename. Otherwise, the file is called .rnd, found in platform dependent locations:

                                                                                                                                                          • On Windows (in order of preference)

                                                                                                                                                            %HOME%, %USERPROFILE%, %SYSTEMROOT%, C:\\\n
                                                                                                                                                          • On VMS

                                                                                                                                                            SYS$LOGIN:\n
                                                                                                                                                          • On all other systems

                                                                                                                                                            $HOME\n

                                                                                                                                                          If $HOME (on non-Windows and non-VMS system) is not set either, or num is too small for the pathname, an error occurs.

                                                                                                                                                          "},{"location":"man3/RAND_load_file/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RAND_load_file() returns the number of bytes read or -1 on error.

                                                                                                                                                          RAND_write_file() returns the number of bytes written, or -1 if the bytes written were generated without appropriate seeding.

                                                                                                                                                          RAND_file_name() returns a pointer to buf on success, and NULL on error.

                                                                                                                                                          "},{"location":"man3/RAND_load_file/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RAND_add(3), RAND_bytes(3), RAND(7)

                                                                                                                                                          "},{"location":"man3/RAND_load_file/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/","title":"RAND_set_DRBG_type","text":""},{"location":"man3/RAND_set_DRBG_type/#name","title":"NAME","text":"

                                                                                                                                                          RAND_set_DRBG_type, RAND_set_seed_source_type - specify the global random number generator types

                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n\nint RAND_set_DRBG_type(OSSL_LIB_CTX *ctx, const char *drbg, const char *propq,\n                       const char *cipher, const char *digest);\nint RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed,\n                              const char *propq);\n
                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          RAND_set_DRBG_type() specifies the random bit generator that will be used within the library context ctx. A generator of name drbg with properties propq will be fetched. It will be instantiated with either cipher or digest as its underlying cryptographic algorithm. This specifies the type that will be used for the primary, public and private random instances.

                                                                                                                                                          RAND_set_seed_source_type() specifies the seed source that will be used within the library context ctx. The seed source of name seed with properties propq will be fetched and used to seed the primary random big generator.

                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          These function return 1 on success and 0 on failure.

                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/#notes","title":"NOTES","text":"

                                                                                                                                                          These functions must be called before the random bit generators are first created in the library context. They will return an error if the call is made too late.

                                                                                                                                                          The default DRBG is \"CTR-DRBG\" using the \"AES-256-CTR\" cipher.

                                                                                                                                                          The default seed source is \"SEED-SRC\".

                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_RAND(3), RAND_get0_primary(3)

                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RAND_set_DRBG_type/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/","title":"RAND_set_rand_method","text":""},{"location":"man3/RAND_set_rand_method/#name","title":"NAME","text":"

                                                                                                                                                          RAND_set_rand_method, RAND_get_rand_method, RAND_OpenSSL - select RAND method

                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rand.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          RAND_METHOD *RAND_OpenSSL(void);\n\nint RAND_set_rand_method(const RAND_METHOD *meth);\n\nconst RAND_METHOD *RAND_get_rand_method(void);\n
                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use RAND_set_DRBG_type(3), EVP_RAND(3) and EVP_RAND(7).

                                                                                                                                                          A RAND_METHOD specifies the functions that OpenSSL uses for random number generation.

                                                                                                                                                          RAND_OpenSSL() returns the default RAND_METHOD implementation by OpenSSL. This implementation ensures that the PRNG state is unique for each thread.

                                                                                                                                                          If an ENGINE is loaded that provides the RAND API, however, it will be used instead of the method returned by RAND_OpenSSL(). This is deprecated in OpenSSL 3.0.

                                                                                                                                                          RAND_set_rand_method() makes meth the method for PRNG use. If an ENGINE was providing the method, it will be released first.

                                                                                                                                                          RAND_get_rand_method() returns a pointer to the current RAND_METHOD.

                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/#the-rand_method-structure","title":"THE RAND_METHOD STRUCTURE","text":"
                                                                                                                                                          typedef struct rand_meth_st {\n    int (*seed)(const void *buf, int num);\n    int (*bytes)(unsigned char *buf, int num);\n    void (*cleanup)(void);\n    int (*add)(const void *buf, int num, double entropy);\n    int (*pseudorand)(unsigned char *buf, int num);\n    int (*status)(void);\n} RAND_METHOD;\n

                                                                                                                                                          The fields point to functions that are used by, in order, RAND_seed(), RAND_bytes(), internal RAND cleanup, RAND_add(), RAND_pseudo_rand() and RAND_status(). Each pointer may be NULL if the function is not implemented.

                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RAND_set_rand_method() returns 1 on success and 0 on failure. RAND_get_rand_method() and RAND_OpenSSL() return pointers to the respective methods.

                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_RAND(3), RAND_set_DRBG_type(3), RAND_bytes(3), ENGINE_by_id(3), EVP_RAND(7), RAND(7)

                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RAND_set_rand_method/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RC4_set_key/","title":"RC4_set_key","text":""},{"location":"man3/RC4_set_key/#name","title":"NAME","text":"

                                                                                                                                                          RC4_set_key, RC4 - RC4 encryption

                                                                                                                                                          "},{"location":"man3/RC4_set_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rc4.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);\n\nvoid RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,\n         unsigned char *outdata);\n
                                                                                                                                                          "},{"location":"man3/RC4_set_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal_ex(3) or the equivalently named decrypt functions.

                                                                                                                                                          This library implements the Alleged RC4 cipher, which is described for example in Applied Cryptography. It is believed to be compatible with RC4[TM], a proprietary cipher of RSA Security Inc.

                                                                                                                                                          RC4 is a stream cipher with variable key length. Typically, 128 bit (16 byte) keys are used for strong encryption, but shorter insecure key sizes have been widely used due to export restrictions.

                                                                                                                                                          RC4 consists of a key setup phase and the actual encryption or decryption phase.

                                                                                                                                                          RC4_set_key() sets up the RC4_KEY key using the len bytes long key at data.

                                                                                                                                                          RC4() encrypts or decrypts the len bytes of data at indata using key and places the result at outdata. Repeated RC4() calls with the same key yield a continuous key stream.

                                                                                                                                                          Since RC4 is a stream cipher (the input is XORed with a pseudo-random key stream to produce the output), decryption uses the same function calls as encryption.

                                                                                                                                                          "},{"location":"man3/RC4_set_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RC4_set_key() and RC4() do not return values.

                                                                                                                                                          "},{"location":"man3/RC4_set_key/#note","title":"NOTE","text":"

                                                                                                                                                          Applications should use the higher level functions EVP_EncryptInit(3) etc. instead of calling these functions directly.

                                                                                                                                                          It is difficult to securely use stream ciphers. For example, do not perform multiple encryptions using the same key stream.

                                                                                                                                                          "},{"location":"man3/RC4_set_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_EncryptInit(3)

                                                                                                                                                          "},{"location":"man3/RC4_set_key/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RC4_set_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/","title":"RIPEMD160_Init","text":""},{"location":"man3/RIPEMD160_Init/#name","title":"NAME","text":"

                                                                                                                                                          RIPEMD160, RIPEMD160_Init, RIPEMD160_Update, RIPEMD160_Final - RIPEMD-160 hash function

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ripemd.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,\n                         unsigned char *md);\n\nint RIPEMD160_Init(RIPEMD160_CTX *c);\nint RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len);\nint RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);\n
                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3).

                                                                                                                                                          RIPEMD-160 is a cryptographic hash function with a 160 bit output.

                                                                                                                                                          RIPEMD160() computes the RIPEMD-160 message digest of the n bytes at d and places it in md (which must have space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array.

                                                                                                                                                          The following functions may be used if the message is not completely stored in memory:

                                                                                                                                                          RIPEMD160_Init() initializes a RIPEMD160_CTX structure.

                                                                                                                                                          RIPEMD160_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

                                                                                                                                                          RIPEMD160_Final() places the message digest in md, which must have space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output, and erases the RIPEMD160_CTX.

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RIPEMD160() returns a pointer to the hash value.

                                                                                                                                                          RIPEMD160_Init(), RIPEMD160_Update() and RIPEMD160_Final() return 1 for success, 0 otherwise.

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#note","title":"NOTE","text":"

                                                                                                                                                          Applications should use the higher level functions EVP_DigestInit(3) etc. instead of calling these functions directly.

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          ISO/IEC 10118-3:2016 Dedicated Hash-Function 1 (RIPEMD-160).

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_DigestInit(3)

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RIPEMD160_Init/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_blinding_on/","title":"RSA_blinding_on","text":""},{"location":"man3/RSA_blinding_on/#name","title":"NAME","text":"

                                                                                                                                                          RSA_blinding_on, RSA_blinding_off - protect the RSA operation from timing attacks

                                                                                                                                                          "},{"location":"man3/RSA_blinding_on/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);\n\nvoid RSA_blinding_off(RSA *rsa);\n
                                                                                                                                                          "},{"location":"man3/RSA_blinding_on/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated.

                                                                                                                                                          RSA is vulnerable to timing attacks. In a setup where attackers can measure the time of RSA decryption or signature operations, blinding must be used to protect the RSA operation from that attack.

                                                                                                                                                          RSA_blinding_on() turns blinding on for key rsa and generates a random blinding factor. ctx is NULL or a preallocated and initialized BN_CTX.

                                                                                                                                                          RSA_blinding_off() turns blinding off and frees the memory used for the blinding factor.

                                                                                                                                                          "},{"location":"man3/RSA_blinding_on/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_blinding_on() returns 1 on success, and 0 if an error occurred.

                                                                                                                                                          RSA_blinding_off() returns no value.

                                                                                                                                                          "},{"location":"man3/RSA_blinding_on/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_blinding_on/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_check_key/","title":"RSA_check_key","text":""},{"location":"man3/RSA_check_key/#name","title":"NAME","text":"

                                                                                                                                                          RSA_check_key_ex, RSA_check_key - validate private RSA keys

                                                                                                                                                          "},{"location":"man3/RSA_check_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_check_key_ex(const RSA *rsa, BN_GENCB *cb);\n\nint RSA_check_key(const RSA *rsa);\n
                                                                                                                                                          "},{"location":"man3/RSA_check_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          Both of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_public_check(3), EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3).

                                                                                                                                                          RSA_check_key_ex() function validates RSA keys. It checks that p and q are in fact prime, and that n = p*q.

                                                                                                                                                          It does not work on RSA public keys that have only the modulus and public exponent elements populated. It also checks that d*e = 1 mod (p-1*q-1), and that dmp1, dmq1 and iqmp are set correctly or are NULL. It performs integrity checks on all the RSA key material, so the RSA key structure must contain all the private key data too. Therefore, it cannot be used with any arbitrary RSA key object, even if it is otherwise fit for regular RSA operation.

                                                                                                                                                          The cb parameter is a callback that will be invoked in the same manner as BN_is_prime_ex(3).

                                                                                                                                                          RSA_check_key() is equivalent to RSA_check_key_ex() with a NULL cb.

                                                                                                                                                          "},{"location":"man3/RSA_check_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_check_key_ex() and RSA_check_key() return 1 if rsa is a valid RSA key, and 0 otherwise. They return -1 if an error occurs while checking the key.

                                                                                                                                                          If the key is invalid or an error occurred, the reason code can be obtained using ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/RSA_check_key/#notes","title":"NOTES","text":"

                                                                                                                                                          Unlike most other RSA functions, this function does not work transparently with any underlying ENGINE implementation because it uses the key data in the RSA structure directly. An ENGINE implementation can override the way key data is stored and handled, and can even provide support for HSM keys - in which case the RSA structure may contain no key data at all! If the ENGINE in question is only being used for acceleration or analysis purposes, then in all likelihood the RSA key data is complete and untouched, but this can't be assumed in the general case.

                                                                                                                                                          "},{"location":"man3/RSA_check_key/#bugs","title":"BUGS","text":"

                                                                                                                                                          A method of verifying the RSA key using opaque RSA API functions might need to be considered. Right now RSA_check_key() simply uses the RSA structure elements directly, bypassing the RSA_METHOD table altogether (and completely violating encapsulation and object-orientation in the process). The best fix will probably be to introduce a \"check_key()\" handler to the RSA_METHOD function table so that alternative implementations can also provide their own verifiers.

                                                                                                                                                          "},{"location":"man3/RSA_check_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          BN_is_prime_ex(3), ERR_get_error(3)

                                                                                                                                                          "},{"location":"man3/RSA_check_key/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          RSA_check_key_ex() appeared after OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/RSA_check_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_generate_key/","title":"RSA_generate_key","text":""},{"location":"man3/RSA_generate_key/#name","title":"NAME","text":"

                                                                                                                                                          EVP_RSA_gen, RSA_generate_key_ex, RSA_generate_key, RSA_generate_multi_prime_key - generate RSA key pair

                                                                                                                                                          "},{"location":"man3/RSA_generate_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n\nEVP_PKEY *EVP_RSA_gen(unsigned int bits);\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\nint RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb);\n

                                                                                                                                                          The following function has been deprecated since OpenSSL 0.9.8, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          RSA *RSA_generate_key(int bits, unsigned long e,\n                      void (*callback)(int, int, void *), void *cb_arg);\n
                                                                                                                                                          "},{"location":"man3/RSA_generate_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          EVP_RSA_gen() generates a new RSA key pair with modulus size bits.

                                                                                                                                                          All of the functions described below are deprecated. Applications should instead use EVP_RSA_gen(), EVP_PKEY_Q_keygen(3), or EVP_PKEY_keygen_init(3) and EVP_PKEY_keygen(3).

                                                                                                                                                          RSA_generate_key_ex() generates a 2-prime RSA key pair and stores it in the RSA structure provided in rsa.

                                                                                                                                                          RSA_generate_multi_prime_key() generates a multi-prime RSA key pair and stores it in the RSA structure provided in rsa. The number of primes is given by the primes parameter. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                                          The modulus size will be of length bits, the number of primes to form the modulus will be primes, and the public exponent will be e. Key sizes with num < 1024 should be considered insecure. The exponent is an odd number, typically 3, 17 or 65537.

                                                                                                                                                          In order to maintain adequate security level, the maximum number of permitted primes depends on modulus bit length:

                                                                                                                                                          <1024 | >=1024 | >=4096 | >=8192\n------+--------+--------+-------\n  2   |   3    |   4    |   5\n

                                                                                                                                                          A callback function may be used to provide feedback about the progress of the key generation. If cb is not NULL, it will be called as follows using the BN_GENCB_call() function described on the BN_generate_prime(3) page.

                                                                                                                                                          RSA_generate_key() is similar to RSA_generate_key_ex() but expects an old-style callback function; see BN_generate_prime(3) for information on the old-style callback.

                                                                                                                                                          • While a random prime number is generated, it is called as described in BN_generate_prime(3).
                                                                                                                                                          • When the n-th randomly generated prime is rejected as not suitable for the key, BN_GENCB_call(cb, 2, n) is called.
                                                                                                                                                          • When a random p has been found with p-1 relatively prime to e, it is called as BN_GENCB_call(cb, 3, 0).

                                                                                                                                                          The process is then repeated for prime q and other primes (if any) with BN_GENCB_call(cb, 3, i) where i indicates the i-th prime.

                                                                                                                                                          "},{"location":"man3/RSA_generate_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          EVP_RSA_gen() returns an EVP_PKEY or NULL on failure.

                                                                                                                                                          RSA_generate_multi_prime_key() returns 1 on success or 0 on error. RSA_generate_key_ex() returns 1 on success or 0 on error. The error codes can be obtained by ERR_get_error(3).

                                                                                                                                                          RSA_generate_key() returns a pointer to the RSA structure or NULL if the key generation fails.

                                                                                                                                                          "},{"location":"man3/RSA_generate_key/#bugs","title":"BUGS","text":"

                                                                                                                                                          BN_GENCB_call(cb, 2, x) is used with two different meanings.

                                                                                                                                                          "},{"location":"man3/RSA_generate_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_PKEY_Q_keygen(3) BN_generate_prime(3), ERR_get_error(3), RAND_bytes(3), RAND(7)

                                                                                                                                                          "},{"location":"man3/RSA_generate_key/#history","title":"HISTORY","text":"

                                                                                                                                                          EVP_RSA_gen() was added in OpenSSL 3.0. All other functions described here were deprecated in OpenSSL 3.0. For replacement see EVP_PKEY-RSA(7).

                                                                                                                                                          "},{"location":"man3/RSA_generate_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_get0_key/","title":"RSA_get0_key","text":""},{"location":"man3/RSA_get0_key/#name","title":"NAME","text":"

                                                                                                                                                          RSA_set0_key, RSA_set0_factors, RSA_set0_crt_params, RSA_get0_key, RSA_get0_factors, RSA_get0_crt_params, RSA_get0_n, RSA_get0_e, RSA_get0_d, RSA_get0_p, RSA_get0_q, RSA_get0_dmp1, RSA_get0_dmq1, RSA_get0_iqmp, RSA_get0_pss_params, RSA_clear_flags, RSA_test_flags, RSA_set_flags, RSA_get0_engine, RSA_get_multi_prime_extra_count, RSA_get0_multi_prime_factors, RSA_get0_multi_prime_crt_params, RSA_set0_multi_prime_params, RSA_get_version - Routines for getting and setting data in an RSA object

                                                                                                                                                          "},{"location":"man3/RSA_get0_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);\nint RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);\nint RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);\nvoid RSA_get0_key(const RSA *r,\n                  const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);\nvoid RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);\nvoid RSA_get0_crt_params(const RSA *r,\n                         const BIGNUM **dmp1, const BIGNUM **dmq1,\n                         const BIGNUM **iqmp);\nconst BIGNUM *RSA_get0_n(const RSA *d);\nconst BIGNUM *RSA_get0_e(const RSA *d);\nconst BIGNUM *RSA_get0_d(const RSA *d);\nconst BIGNUM *RSA_get0_p(const RSA *d);\nconst BIGNUM *RSA_get0_q(const RSA *d);\nconst BIGNUM *RSA_get0_dmp1(const RSA *r);\nconst BIGNUM *RSA_get0_dmq1(const RSA *r);\nconst BIGNUM *RSA_get0_iqmp(const RSA *r);\nconst RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r);\nvoid RSA_clear_flags(RSA *r, int flags);\nint RSA_test_flags(const RSA *r, int flags);\nvoid RSA_set_flags(RSA *r, int flags);\nENGINE *RSA_get0_engine(RSA *r);\nint RSA_get_multi_prime_extra_count(const RSA *r);\nint RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]);\nint RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[],\n                                    const BIGNUM *coeffs[]);\nint RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[],\n                               BIGNUM *coeffs[], int pnum);\nint RSA_get_version(RSA *r);\n
                                                                                                                                                          "},{"location":"man3/RSA_get0_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_bn_param(3) for any methods that return a BIGNUM. Refer to EVP_PKEY-DH(7) for more information.

                                                                                                                                                          An RSA object contains the components for the public and private key, n, e, d, p, q, dmp1, dmq1 and iqmp. n is the modulus common to both public and private key, e is the public exponent and d is the private exponent. p, q, dmp1, dmq1 and iqmp are the factors for the second representation of a private key (see PKCS#1 section 3 Key Types), where p and q are the first and second factor of n and dmp1, dmq1 and iqmp are the exponents and coefficient for CRT calculations.

                                                                                                                                                          For multi-prime RSA (defined in RFC 8017), there are also one or more 'triplet' in an RSA object. A triplet contains three members, r, d and t. r is the additional prime besides p and q. d and t are the exponent and coefficient for CRT calculations.

                                                                                                                                                          The n, e and d parameters can be obtained by calling RSA_get0_key(). If they have not been set yet, then *n, *e and *d will be set to NULL. Otherwise, they are set to pointers to their respective values. These point directly to the internal representations of the values and therefore should not be freed by the caller.

                                                                                                                                                          The n, e and d parameter values can be set by calling RSA_set0_key() and passing the new values for n, e and d as parameters to the function. The values n and e must be non-NULL the first time this function is called on a given RSA object. The value d may be NULL. On subsequent calls any of these values may be NULL which means the corresponding RSA field is left untouched. Calling this function transfers the memory management of the values to the RSA object, and therefore the values that have been passed in should not be freed by the caller after this function has been called.

                                                                                                                                                          In a similar fashion, the p and q parameters can be obtained and set with RSA_get0_factors() and RSA_set0_factors(), and the dmp1, dmq1 and iqmp parameters can be obtained and set with RSA_get0_crt_params() and RSA_set0_crt_params().

                                                                                                                                                          For RSA_get0_key(), RSA_get0_factors(), and RSA_get0_crt_params(), NULL value BIGNUM ** output parameters are permitted. The functions ignore NULL parameters but return values for other, non-NULL, parameters.

                                                                                                                                                          For multi-prime RSA, RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_params() can be used to obtain other primes and related CRT parameters. The return values are stored in an array of BIGNUM *. RSA_set0_multi_prime_params() sets a collect of multi-prime 'triplet' members (prime, exponent and coefficient) into an RSA object.

                                                                                                                                                          Any of the values n, e, d, p, q, dmp1, dmq1, and iqmp can also be retrieved separately by the corresponding function RSA_get0_n(), RSA_get0_e(), RSA_get0_d(), RSA_get0_p(), RSA_get0_q(), RSA_get0_dmp1(), RSA_get0_dmq1(), and RSA_get0_iqmp(), respectively.

                                                                                                                                                          RSA_get0_pss_params() is used to retrieve the RSA-PSS parameters.

                                                                                                                                                          RSA_set_flags() sets the flags in the flags parameter on the RSA object. Multiple flags can be passed in one go (bitwise ORed together). Any flags that are already set are left set. RSA_test_flags() tests to see whether the flags passed in the flags parameter are currently set in the RSA object. Multiple flags can be tested in one go. All flags that are currently set are returned, or zero if none of the flags are set. RSA_clear_flags() clears the specified flags within the RSA object.

                                                                                                                                                          RSA_get0_engine() returns a handle to the ENGINE that has been set for this RSA object, or NULL if no such ENGINE has been set.

                                                                                                                                                          RSA_get_version() returns the version of an RSA object r.

                                                                                                                                                          "},{"location":"man3/RSA_get0_key/#notes","title":"NOTES","text":"

                                                                                                                                                          Values retrieved with RSA_get0_key() are owned by the RSA object used in the call and may therefore not be passed to RSA_set0_key(). If needed, duplicate the received value using BN_dup() and pass the duplicate. The same applies to RSA_get0_factors() and RSA_set0_factors() as well as RSA_get0_crt_params() and RSA_set0_crt_params().

                                                                                                                                                          The caller should obtain the size by calling RSA_get_multi_prime_extra_count() in advance and allocate sufficient buffer to store the return values before calling RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_params().

                                                                                                                                                          RSA_set0_multi_prime_params() always clears the original multi-prime triplets in RSA object r and assign the new set of triplets into it.

                                                                                                                                                          "},{"location":"man3/RSA_get0_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_set0_key(), RSA_set0_factors(), RSA_set0_crt_params() and RSA_set0_multi_prime_params() return 1 on success or 0 on failure.

                                                                                                                                                          RSA_get0_n(), RSA_get0_e(), RSA_get0_d(), RSA_get0_p(), RSA_get0_q(), RSA_get0_dmp1(), RSA_get0_dmq1(), and RSA_get0_iqmp() return the respective value.

                                                                                                                                                          RSA_get0_pss_params() returns a RSA_PSS_PARAMS pointer, or NULL if there is none.

                                                                                                                                                          RSA_get0_multi_prime_factors() and RSA_get0_multi_prime_crt_params() return 1 on success or 0 on failure.

                                                                                                                                                          RSA_get_multi_prime_extra_count() returns two less than the number of primes in use, which is 0 for traditional RSA and the number of extra primes for multi-prime RSA.

                                                                                                                                                          RSA_get_version() returns RSA_ASN1_VERSION_MULTI for multi-prime RSA and RSA_ASN1_VERSION_DEFAULT for normal two-prime RSA, as defined in RFC 8017.

                                                                                                                                                          RSA_test_flags() returns the current state of the flags in the RSA object.

                                                                                                                                                          RSA_get0_engine() returns the ENGINE set for the RSA object or NULL if no ENGINE has been set.

                                                                                                                                                          "},{"location":"man3/RSA_get0_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RSA_new(3), RSA_size(3)

                                                                                                                                                          "},{"location":"man3/RSA_get0_key/#history","title":"HISTORY","text":"

                                                                                                                                                          The RSA_get0_pss_params() function was added in OpenSSL 1.1.1e.

                                                                                                                                                          The RSA_get_multi_prime_extra_count(), RSA_get0_multi_prime_factors(), RSA_get0_multi_prime_crt_params(), RSA_set0_multi_prime_params(), and RSA_get_version() functions were added in OpenSSL 1.1.1.

                                                                                                                                                          Other functions described here were added in OpenSSL 1.1.0.

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_get0_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_meth_new/","title":"RSA_meth_new","text":""},{"location":"man3/RSA_meth_new/#name","title":"NAME","text":"

                                                                                                                                                          RSA_meth_get0_app_data, RSA_meth_set0_app_data, RSA_meth_new, RSA_meth_free, RSA_meth_dup, RSA_meth_get0_name, RSA_meth_set1_name, RSA_meth_get_flags, RSA_meth_set_flags, RSA_meth_get_pub_enc, RSA_meth_set_pub_enc, RSA_meth_get_pub_dec, RSA_meth_set_pub_dec, RSA_meth_get_priv_enc, RSA_meth_set_priv_enc, RSA_meth_get_priv_dec, RSA_meth_set_priv_dec, RSA_meth_get_mod_exp, RSA_meth_set_mod_exp, RSA_meth_get_bn_mod_exp, RSA_meth_set_bn_mod_exp, RSA_meth_get_init, RSA_meth_set_init, RSA_meth_get_finish, RSA_meth_set_finish, RSA_meth_get_sign, RSA_meth_set_sign, RSA_meth_get_verify, RSA_meth_set_verify, RSA_meth_get_keygen, RSA_meth_set_keygen, RSA_meth_get_multi_prime_keygen, RSA_meth_set_multi_prime_keygen - Routines to build up RSA methods

                                                                                                                                                          "},{"location":"man3/RSA_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          RSA_METHOD *RSA_meth_new(const char *name, int flags);\nvoid RSA_meth_free(RSA_METHOD *meth);\n\nRSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth);\n\nconst char *RSA_meth_get0_name(const RSA_METHOD *meth);\nint RSA_meth_set1_name(RSA_METHOD *meth, const char *name);\n\nint RSA_meth_get_flags(const RSA_METHOD *meth);\nint RSA_meth_set_flags(RSA_METHOD *meth, int flags);\n\nvoid *RSA_meth_get0_app_data(const RSA_METHOD *meth);\nint RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data);\n\nint (*RSA_meth_get_pub_enc(const RSA_METHOD *meth))(int flen, const unsigned char *from,\n                                                    unsigned char *to, RSA *rsa, int padding);\nint RSA_meth_set_pub_enc(RSA_METHOD *rsa,\n                         int (*pub_enc)(int flen, const unsigned char *from,\n                                        unsigned char *to, RSA *rsa,\n                                        int padding));\n\nint (*RSA_meth_get_pub_dec(const RSA_METHOD *meth))\n    (int flen, const unsigned char *from,\n     unsigned char *to, RSA *rsa, int padding);\nint RSA_meth_set_pub_dec(RSA_METHOD *rsa,\n                         int (*pub_dec)(int flen, const unsigned char *from,\n                                        unsigned char *to, RSA *rsa,\n                                        int padding));\n\nint (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(int flen, const unsigned char *from,\n                                                     unsigned char *to, RSA *rsa,\n                                                     int padding);\nint RSA_meth_set_priv_enc(RSA_METHOD *rsa,\n                          int (*priv_enc)(int flen, const unsigned char *from,\n                                          unsigned char *to, RSA *rsa, int padding));\n\nint (*RSA_meth_get_priv_dec(const RSA_METHOD *meth))(int flen, const unsigned char *from,\n                                                     unsigned char *to, RSA *rsa,\n                                                     int padding);\nint RSA_meth_set_priv_dec(RSA_METHOD *rsa,\n                          int (*priv_dec)(int flen, const unsigned char *from,\n                                          unsigned char *to, RSA *rsa, int padding));\n\n/* Can be null */\nint (*RSA_meth_get_mod_exp(const RSA_METHOD *meth))(BIGNUM *r0, const BIGNUM *i,\n                                                    RSA *rsa, BN_CTX *ctx);\nint RSA_meth_set_mod_exp(RSA_METHOD *rsa,\n                         int (*mod_exp)(BIGNUM *r0, const BIGNUM *i, RSA *rsa,\n                                        BN_CTX *ctx));\n\n/* Can be null */\nint (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth))(BIGNUM *r, const BIGNUM *a,\n                                                       const BIGNUM *p, const BIGNUM *m,\n                                                       BN_CTX *ctx, BN_MONT_CTX *m_ctx);\nint RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa,\n                            int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a,\n                                              const BIGNUM *p, const BIGNUM *m,\n                                              BN_CTX *ctx, BN_MONT_CTX *m_ctx));\n\n/* called at new */\nint (*RSA_meth_get_init(const RSA_METHOD *meth) (RSA *rsa);\nint RSA_meth_set_init(RSA_METHOD *rsa, int (*init (RSA *rsa));\n\n/* called at free */\nint (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa);\nint RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish)(RSA *rsa));\n\nint (*RSA_meth_get_sign(const RSA_METHOD *meth))(int type, const unsigned char *m,\n                                                 unsigned int m_length,\n                                                 unsigned char *sigret,\n                                                 unsigned int *siglen, const RSA *rsa);\nint RSA_meth_set_sign(RSA_METHOD *rsa,\n                      int (*sign)(int type, const unsigned char *m,\n                                  unsigned int m_length, unsigned char *sigret,\n                                  unsigned int *siglen, const RSA *rsa));\n\nint (*RSA_meth_get_verify(const RSA_METHOD *meth))(int dtype, const unsigned char *m,\n                                                   unsigned int m_length,\n                                                   const unsigned char *sigbuf,\n                                                   unsigned int siglen, const RSA *rsa);\nint RSA_meth_set_verify(RSA_METHOD *rsa,\n                        int (*verify)(int dtype, const unsigned char *m,\n                                      unsigned int m_length,\n                                      const unsigned char *sigbuf,\n                                      unsigned int siglen, const RSA *rsa));\n\nint (*RSA_meth_get_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits, BIGNUM *e,\n                                                   BN_GENCB *cb);\nint RSA_meth_set_keygen(RSA_METHOD *rsa,\n                        int (*keygen)(RSA *rsa, int bits, BIGNUM *e,\n                                      BN_GENCB *cb));\n\nint (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits,\n                                                               int primes, BIGNUM *e,\n                                                               BN_GENCB *cb);\n\nint RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth,\n                                    int (*keygen) (RSA *rsa, int bits,\n                                                   int primes, BIGNUM *e,\n                                                   BN_GENCB *cb));\n
                                                                                                                                                          "},{"location":"man3/RSA_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                                                                                                                                                          The RSA_METHOD type is a structure used for the provision of custom RSA implementations. It provides a set of functions used by OpenSSL for the implementation of the various RSA capabilities.

                                                                                                                                                          RSA_meth_new() creates a new RSA_METHOD structure. It should be given a unique name and a set of flags. The name should be a NULL terminated string, which will be duplicated and stored in the RSA_METHOD object. It is the callers responsibility to free the original string. The flags will be used during the construction of a new RSA object based on this RSA_METHOD. Any new RSA object will have those flags set by default.

                                                                                                                                                          RSA_meth_dup() creates a duplicate copy of the RSA_METHOD object passed as a parameter. This might be useful for creating a new RSA_METHOD based on an existing one, but with some differences.

                                                                                                                                                          RSA_meth_free() destroys an RSA_METHOD structure and frees up any memory associated with it. If the argument is NULL, nothing is done.

                                                                                                                                                          RSA_meth_get0_name() will return a pointer to the name of this RSA_METHOD. This is a pointer to the internal name string and so should not be freed by the caller. RSA_meth_set1_name() sets the name of the RSA_METHOD to name. The string is duplicated and the copy is stored in the RSA_METHOD structure, so the caller remains responsible for freeing the memory associated with the name.

                                                                                                                                                          RSA_meth_get_flags() returns the current value of the flags associated with this RSA_METHOD. RSA_meth_set_flags() provides the ability to set these flags.

                                                                                                                                                          The functions RSA_meth_get0_app_data() and RSA_meth_set0_app_data() provide the ability to associate implementation specific data with the RSA_METHOD. It is the application's responsibility to free this data before the RSA_METHOD is freed via a call to RSA_meth_free().

                                                                                                                                                          RSA_meth_get_sign() and RSA_meth_set_sign() get and set the function used for creating an RSA signature respectively. This function will be called in response to the application calling RSA_sign(). The parameters for the function have the same meaning as for RSA_sign().

                                                                                                                                                          RSA_meth_get_verify() and RSA_meth_set_verify() get and set the function used for verifying an RSA signature respectively. This function will be called in response to the application calling RSA_verify(). The parameters for the function have the same meaning as for RSA_verify().

                                                                                                                                                          RSA_meth_get_mod_exp() and RSA_meth_set_mod_exp() get and set the function used for CRT computations.

                                                                                                                                                          RSA_meth_get_bn_mod_exp() and RSA_meth_set_bn_mod_exp() get and set the function used for CRT computations, specifically the following value:

                                                                                                                                                          r = a ^ p mod m\n

                                                                                                                                                          Both the mod_exp() and bn_mod_exp() functions are called by the default OpenSSL method during encryption, decryption, signing and verification.

                                                                                                                                                          RSA_meth_get_init() and RSA_meth_set_init() get and set the function used for creating a new RSA instance respectively. This function will be called in response to the application calling RSA_new() (if the current default RSA_METHOD is this one) or RSA_new_method(). The RSA_new() and RSA_new_method() functions will allocate the memory for the new RSA object, and a pointer to this newly allocated structure will be passed as a parameter to the function. This function may be NULL.

                                                                                                                                                          RSA_meth_get_finish() and RSA_meth_set_finish() get and set the function used for destroying an instance of an RSA object respectively. This function will be called in response to the application calling RSA_free(). A pointer to the RSA to be destroyed is passed as a parameter. The destroy function should be used for RSA implementation specific clean up. The memory for the RSA itself should not be freed by this function. This function may be NULL.

                                                                                                                                                          RSA_meth_get_keygen() and RSA_meth_set_keygen() get and set the function used for generating a new RSA key pair respectively. This function will be called in response to the application calling RSA_generate_key_ex(). The parameter for the function has the same meaning as for RSA_generate_key_ex().

                                                                                                                                                          RSA_meth_get_multi_prime_keygen() and RSA_meth_set_multi_prime_keygen() get and set the function used for generating a new multi-prime RSA key pair respectively. This function will be called in response to the application calling RSA_generate_multi_prime_key(). The parameter for the function has the same meaning as for RSA_generate_multi_prime_key().

                                                                                                                                                          RSA_meth_get_pub_enc(), RSA_meth_set_pub_enc(), RSA_meth_get_pub_dec(), RSA_meth_set_pub_dec(), RSA_meth_get_priv_enc(), RSA_meth_set_priv_enc(), RSA_meth_get_priv_dec(), RSA_meth_set_priv_dec() get and set the functions used for public and private key encryption and decryption. These functions will be called in response to the application calling RSA_public_encrypt(), RSA_private_decrypt(), RSA_private_encrypt() and RSA_public_decrypt() and take the same parameters as those.

                                                                                                                                                          "},{"location":"man3/RSA_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_meth_new() and RSA_meth_dup() return the newly allocated RSA_METHOD object or NULL on failure.

                                                                                                                                                          RSA_meth_get0_name() and RSA_meth_get_flags() return the name and flags associated with the RSA_METHOD respectively.

                                                                                                                                                          All other RSA_meth_get_*() functions return the appropriate function pointer that has been set in the RSA_METHOD, or NULL if no such pointer has yet been set.

                                                                                                                                                          RSA_meth_set1_name and all RSA_meth_set_*() functions return 1 on success or 0 on failure.

                                                                                                                                                          "},{"location":"man3/RSA_meth_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RSA_new(3), RSA_generate_key_ex(3), RSA_sign(3), RSA_set_method(3), RSA_size(3), RSA_get0_key(3), RSA_generate_multi_prime_key(3)

                                                                                                                                                          "},{"location":"man3/RSA_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          RSA_meth_get_multi_prime_keygen() and RSA_meth_set_multi_prime_keygen() were added in OpenSSL 1.1.1.

                                                                                                                                                          Other functions described here were added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/RSA_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_new/","title":"RSA_new","text":""},{"location":"man3/RSA_new/#name","title":"NAME","text":"

                                                                                                                                                          RSA_new, RSA_free - allocate and free RSA objects

                                                                                                                                                          "},{"location":"man3/RSA_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          RSA *RSA_new(void);\n\nvoid RSA_free(RSA *rsa);\n
                                                                                                                                                          "},{"location":"man3/RSA_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          RSA_new() allocates and initializes an RSA structure. It is equivalent to calling RSA_new_method(NULL).

                                                                                                                                                          RSA_free() frees the RSA structure and its components. The key is erased before the memory is returned to the system. If rsa is NULL nothing is done.

                                                                                                                                                          "},{"location":"man3/RSA_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          If the allocation fails, RSA_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                                          RSA_free() returns no value.

                                                                                                                                                          "},{"location":"man3/RSA_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), RSA_generate_key(3), RSA_new_method(3)

                                                                                                                                                          "},{"location":"man3/RSA_new/#history","title":"HISTORY","text":"

                                                                                                                                                          All functions described here were deprecated in OpenSSL 3.0. For replacement see EVP_PKEY-RSA(7).

                                                                                                                                                          "},{"location":"man3/RSA_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/","title":"RSA_padding_add_PKCS1_type_1","text":""},{"location":"man3/RSA_padding_add_PKCS1_type_1/#name","title":"NAME","text":"

                                                                                                                                                          RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1, RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2, RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP, RSA_padding_add_PKCS1_OAEP_mgf1, RSA_padding_check_PKCS1_OAEP_mgf1, RSA_padding_add_none, RSA_padding_check_none - asymmetric encryption padding

                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,\n                                 const unsigned char *f, int fl);\n\nint RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,\n                                   const unsigned char *f, int fl, int rsa_len);\n\nint RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,\n                                 const unsigned char *f, int fl);\n\nint RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,\n                                   const unsigned char *f, int fl, int rsa_len);\n\nint RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,\n                               const unsigned char *f, int fl,\n                               const unsigned char *p, int pl);\n\nint RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,\n                                 const unsigned char *f, int fl, int rsa_len,\n                                 const unsigned char *p, int pl);\n\nint RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,\n                                    const unsigned char *f, int fl,\n                                    const unsigned char *p, int pl,\n                                    const EVP_MD *md, const EVP_MD *mgf1md);\n\nint RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,\n                                      const unsigned char *f, int fl, int rsa_len,\n                                      const unsigned char *p, int pl,\n                                      const EVP_MD *md, const EVP_MD *mgf1md);\n\nint RSA_padding_add_none(unsigned char *to, int tlen,\n                         const unsigned char *f, int fl);\n\nint RSA_padding_check_none(unsigned char *to, int tlen,\n                           const unsigned char *f, int fl, int rsa_len);\n
                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use the EVP PKEY APIs.

                                                                                                                                                          The RSA_padding_xxx_xxx() functions are called from the RSA encrypt, decrypt, sign and verify functions. Normally they should not be called from application programs.

                                                                                                                                                          However, they can also be called directly to implement padding for other asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() may be used in an application combined with RSA_NO_PADDING in order to implement OAEP with an encoding parameter.

                                                                                                                                                          RSA_padding_add_xxx() encodes fl bytes from f so as to fit into tlen bytes and stores the result at to. An error occurs if fl does not meet the size requirements of the encoding method.

                                                                                                                                                          The following encoding methods are implemented:

                                                                                                                                                          • PKCS1_type_1

                                                                                                                                                            PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for signatures

                                                                                                                                                          • PKCS1_type_2

                                                                                                                                                            PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2)

                                                                                                                                                          • PKCS1_OAEP

                                                                                                                                                            PKCS #1 v2.0 EME-OAEP

                                                                                                                                                          • none

                                                                                                                                                            simply copy the data

                                                                                                                                                          The random number generator must be seeded prior to calling RSA_padding_add_xxx(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                                          RSA_padding_check_xxx() verifies that the fl bytes at f contain a valid encoding for a rsa_len byte RSA key in the respective encoding method and stores the recovered data of at most tlen bytes (for RSA_NO_PADDING: of size tlen) at to.

                                                                                                                                                          For RSA_padding_xxx_OAEP(), p points to the encoding parameter of length pl. p may be NULL if pl is 0.

                                                                                                                                                          For RSA_padding_xxx_OAEP_mgf1(), md points to the md hash, if md is NULL that means md=sha1, and mgf1md points to the mgf1 hash, if mgf1md is NULL that means mgf1md=md.

                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The RSA_padding_add_xxx() functions return 1 on success, 0 on error. The RSA_padding_check_xxx() functions return the length of the recovered data, -1 on error. Error codes can be obtained by calling ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#warnings","title":"WARNINGS","text":"

                                                                                                                                                          The result of RSA_padding_check_PKCS1_type_2() is a very sensitive information which can potentially be used to mount a Bleichenbacher padding oracle attack. This is an inherent weakness in the PKCS #1 v1.5 padding design. Prefer PKCS1_OAEP padding. If that is not possible, the result of RSA_padding_check_PKCS1_type_2() should be checked in constant time if it matches the expected length of the plaintext and additionally some application specific consistency checks on the plaintext need to be performed in constant time. If the plaintext is rejected it must be kept secret which of the checks caused the application to reject the message. Do not remove the zero-padding from the decrypted raw RSA data which was computed by RSA_private_decrypt() with RSA_NO_PADDING, as this would create a small timing side channel which could be used to mount a Bleichenbacher attack against any padding mode including PKCS1_OAEP.

                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RSA_public_encrypt(3), RSA_private_decrypt(3), RSA_sign(3), RSA_verify(3), RAND(7)

                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_padding_add_PKCS1_type_1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_print/","title":"RSA_print","text":""},{"location":"man3/RSA_print/#name","title":"NAME","text":"

                                                                                                                                                          RSA_print, RSA_print_fp, DSAparams_print, DSAparams_print_fp, DSA_print, DSA_print_fp, DHparams_print, DHparams_print_fp - print cryptographic parameters

                                                                                                                                                          "},{"location":"man3/RSA_print/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_print(BIO *bp, const RSA *x, int offset);\nint RSA_print_fp(FILE *fp, const RSA *x, int offset);\n\n#include <openssl/dsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int DSAparams_print(BIO *bp, const DSA *x);\nint DSAparams_print_fp(FILE *fp, const DSA *x);\nint DSA_print(BIO *bp, const DSA *x, int offset);\nint DSA_print_fp(FILE *fp, const DSA *x, int offset);\n\n#include <openssl/dh.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int DHparams_print(BIO *bp, DH *x);\nint DHparams_print_fp(FILE *fp, const DH *x);\n
                                                                                                                                                          "},{"location":"man3/RSA_print/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_print_params(3) and EVP_PKEY_print_private(3).

                                                                                                                                                          A human-readable hexadecimal output of the components of the RSA key, DSA parameters or key or DH parameters is printed to bp or fp.

                                                                                                                                                          The output lines are indented by offset spaces.

                                                                                                                                                          "},{"location":"man3/RSA_print/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          DSAparams_print(), DSAparams_print_fp(), DSA_print(), and DSA_print_fp() return 1 for success and 0 or a negative value for failure.

                                                                                                                                                          DHparams_print() and DHparams_print_fp() return 1 on success, 0 on error.

                                                                                                                                                          "},{"location":"man3/RSA_print/#see-also","title":"SEE ALSO","text":"
                                                                                                                                                          L<EVP_PKEY_print_params(3)>,\nL<EVP_PKEY_print_private(3)>,\nL<BN_bn2bin(3)>\n
                                                                                                                                                          "},{"location":"man3/RSA_print/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_print/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_private_encrypt/","title":"RSA_private_encrypt","text":""},{"location":"man3/RSA_private_encrypt/#name","title":"NAME","text":"

                                                                                                                                                          RSA_private_encrypt, RSA_public_decrypt - low-level signature operations

                                                                                                                                                          "},{"location":"man3/RSA_private_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_private_encrypt(int flen, unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n\nint RSA_public_decrypt(int flen, unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n
                                                                                                                                                          "},{"location":"man3/RSA_private_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          Both of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init_ex(3), EVP_PKEY_sign(3), EVP_PKEY_verify_recover_init(3), and EVP_PKEY_verify_recover(3).

                                                                                                                                                          These functions handle RSA signatures at a low-level.

                                                                                                                                                          RSA_private_encrypt() signs the flen bytes at from (usually a message digest with an algorithm identifier) using the private key rsa and stores the signature in to. to must point to RSA_size(rsa) bytes of memory.

                                                                                                                                                          padding denotes one of the following modes:

                                                                                                                                                          • RSA_PKCS1_PADDING

                                                                                                                                                            PKCS #1 v1.5 padding. This function does not handle the algorithmIdentifier specified in PKCS #1. When generating or verifying PKCS #1 signatures, RSA_sign(3) and RSA_verify(3) should be used.

                                                                                                                                                          • RSA_NO_PADDING

                                                                                                                                                            Raw RSA signature. This mode should only be used to implement cryptographically sound padding modes in the application code. Signing user data directly with RSA is insecure.

                                                                                                                                                          RSA_public_decrypt() recovers the message digest from the flen bytes long signature at from using the signer's public key rsa. to must point to a memory section large enough to hold the message digest (which is smaller than RSA_size(rsa) - 11). padding is the padding mode that was used to sign the data.

                                                                                                                                                          "},{"location":"man3/RSA_private_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_private_encrypt() returns the size of the signature (i.e., RSA_size(rsa)). RSA_public_decrypt() returns the size of the recovered message digest.

                                                                                                                                                          On error, -1 is returned; the error codes can be obtained by ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/RSA_private_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), RSA_sign(3), RSA_verify(3), EVP_PKEY_sign(3), EVP_PKEY_verify_recover(3)

                                                                                                                                                          "},{"location":"man3/RSA_private_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                                          Both of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_private_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/","title":"RSA_public_encrypt","text":""},{"location":"man3/RSA_public_encrypt/#name","title":"NAME","text":"

                                                                                                                                                          RSA_public_encrypt, RSA_private_decrypt - RSA public key cryptography

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_public_encrypt(int flen, const unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n\nint RSA_private_decrypt(int flen, const unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n
                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          Both of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_encrypt_init_ex(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt_init_ex(3) and EVP_PKEY_decrypt(3).

                                                                                                                                                          RSA_public_encrypt() encrypts the flen bytes at from (usually a session key) using the public key rsa and stores the ciphertext in to. to must point to RSA_size(rsa) bytes of memory.

                                                                                                                                                          padding denotes one of the following modes:

                                                                                                                                                          • RSA_PKCS1_PADDING

                                                                                                                                                            PKCS #1 v1.5 padding. This currently is the most widely used mode. However, it is highly recommended to use RSA_PKCS1_OAEP_PADDING in new applications. SEE WARNING BELOW.

                                                                                                                                                          • RSA_PKCS1_OAEP_PADDING

                                                                                                                                                            EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty encoding parameter. This mode is recommended for all new applications.

                                                                                                                                                          • RSA_NO_PADDING

                                                                                                                                                            Raw RSA encryption. This mode should only be used to implement cryptographically sound padding modes in the application code. Encrypting user data directly with RSA is insecure.

                                                                                                                                                          flen must not be more than RSA_size(rsa) - 11 for the PKCS #1 v1.5 based padding modes, not more than RSA_size(rsa) - 42 for RSA_PKCS1_OAEP_PADDING and exactly RSA_size(rsa) for RSA_NO_PADDING. When a padding mode other than RSA_NO_PADDING is in use, then RSA_public_encrypt() will include some random bytes into the ciphertext and therefore the ciphertext will be different each time, even if the plaintext and the public key are exactly identical. The returned ciphertext in to will always be zero padded to exactly RSA_size(rsa) bytes. to and from may overlap.

                                                                                                                                                          RSA_private_decrypt() decrypts the flen bytes at from using the private key rsa and stores the plaintext in to. flen should be equal to RSA_size(rsa) but may be smaller, when leading zero bytes are in the ciphertext. Those are not important and may be removed, but RSA_public_encrypt() does not do that. to must point to a memory section large enough to hold the maximal possible decrypted data (which is equal to RSA_size(rsa) for RSA_NO_PADDING, RSA_size(rsa) - 11 for the PKCS #1 v1.5 based padding modes and RSA_size(rsa) - 42 for RSA_PKCS1_OAEP_PADDING). padding is the padding mode that was used to encrypt the data. to and from may overlap.

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_public_encrypt() returns the size of the encrypted data (i.e., RSA_size(rsa)). RSA_private_decrypt() returns the size of the recovered plaintext. A return value of 0 is not an error and means only that the plaintext was empty.

                                                                                                                                                          On error, -1 is returned; the error codes can be obtained by ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#warnings","title":"WARNINGS","text":"

                                                                                                                                                          Decryption failures in the RSA_PKCS1_PADDING mode leak information which can potentially be used to mount a Bleichenbacher padding oracle attack. This is an inherent weakness in the PKCS #1 v1.5 padding design. Prefer RSA_PKCS1_OAEP_PADDING.

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          SSL, PKCS #1 v2.0

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), RAND_bytes(3), RSA_size(3)

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#history","title":"HISTORY","text":"

                                                                                                                                                          Both of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_public_encrypt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_set_method/","title":"RSA_set_method","text":""},{"location":"man3/RSA_set_method/#name","title":"NAME","text":"

                                                                                                                                                          RSA_set_default_method, RSA_get_default_method, RSA_set_method, RSA_get_method, RSA_PKCS1_OpenSSL, RSA_flags, RSA_new_method - select RSA method

                                                                                                                                                          "},{"location":"man3/RSA_set_method/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          void RSA_set_default_method(const RSA_METHOD *meth);\n\nconst RSA_METHOD *RSA_get_default_method(void);\n\nint RSA_set_method(RSA *rsa, const RSA_METHOD *meth);\n\nconst RSA_METHOD *RSA_get_method(const RSA *rsa);\n\nconst RSA_METHOD *RSA_PKCS1_OpenSSL(void);\n\nint RSA_flags(const RSA *rsa);\n\nRSA *RSA_new_method(ENGINE *engine);\n
                                                                                                                                                          "},{"location":"man3/RSA_set_method/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use the OSSL_PROVIDER APIs.

                                                                                                                                                          An RSA_METHOD specifies the functions that OpenSSL uses for RSA operations. By modifying the method, alternative implementations such as hardware accelerators may be used. IMPORTANT: See the NOTES section for important information about how these RSA API functions are affected by the use of ENGINE API calls.

                                                                                                                                                          Initially, the default RSA_METHOD is the OpenSSL internal implementation, as returned by RSA_PKCS1_OpenSSL().

                                                                                                                                                          RSA_set_default_method() makes meth the default method for all RSA structures created later. NB: This is true only whilst no ENGINE has been set as a default for RSA, so this function is no longer recommended. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

                                                                                                                                                          RSA_get_default_method() returns a pointer to the current default RSA_METHOD. However, the meaningfulness of this result is dependent on whether the ENGINE API is being used, so this function is no longer recommended.

                                                                                                                                                          RSA_set_method() selects meth to perform all operations using the key rsa. This will replace the RSA_METHOD used by the RSA key and if the previous method was supplied by an ENGINE, the handle to that ENGINE will be released during the change. It is possible to have RSA keys that only work with certain RSA_METHOD implementations (e.g. from an ENGINE module that supports embedded hardware-protected keys), and in such cases attempting to change the RSA_METHOD for the key can have unexpected results.

                                                                                                                                                          RSA_get_method() returns a pointer to the RSA_METHOD being used by rsa. This method may or may not be supplied by an ENGINE implementation, but if it is, the return value can only be guaranteed to be valid as long as the RSA key itself is valid and does not have its implementation changed by RSA_set_method().

                                                                                                                                                          RSA_flags() returns the flags that are set for rsa's current RSA_METHOD. See the BUGS section.

                                                                                                                                                          RSA_new_method() allocates and initializes an RSA structure so that engine will be used for the RSA operations. If engine is NULL, the default ENGINE for RSA operations is used, and if no default ENGINE is set, the RSA_METHOD controlled by RSA_set_default_method() is used.

                                                                                                                                                          RSA_flags() returns the flags that are set for rsa's current method.

                                                                                                                                                          RSA_new_method() allocates and initializes an RSA structure so that method will be used for the RSA operations. If method is NULL, the default method is used.

                                                                                                                                                          "},{"location":"man3/RSA_set_method/#the-rsa_method-structure","title":"THE RSA_METHOD STRUCTURE","text":"
                                                                                                                                                          typedef struct rsa_meth_st\n{\n    /* name of the implementation */\n    const char *name;\n\n    /* encrypt */\n    int (*rsa_pub_enc)(int flen, unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n\n    /* verify arbitrary data */\n    int (*rsa_pub_dec)(int flen, unsigned char *from,\n                       unsigned char *to, RSA *rsa, int padding);\n\n    /* sign arbitrary data */\n    int (*rsa_priv_enc)(int flen, unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n\n    /* decrypt */\n    int (*rsa_priv_dec)(int flen, unsigned char *from,\n                        unsigned char *to, RSA *rsa, int padding);\n\n    /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some implementations) */\n    int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa);\n\n    /* compute r = a ^ p mod m (May be NULL for some implementations) */\n    int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p,\n                      const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\n\n    /* called at RSA_new */\n    int (*init)(RSA *rsa);\n\n    /* called at RSA_free */\n    int (*finish)(RSA *rsa);\n\n    /*\n     * RSA_FLAG_EXT_PKEY        - rsa_mod_exp is called for private key\n     *                            operations, even if p,q,dmp1,dmq1,iqmp\n     *                            are NULL\n     * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match\n     */\n    int flags;\n\n    char *app_data; /* ?? */\n\n    int (*rsa_sign)(int type,\n                    const unsigned char *m, unsigned int m_length,\n                    unsigned char *sigret, unsigned int *siglen, const RSA *rsa);\n    int (*rsa_verify)(int dtype,\n                      const unsigned char *m, unsigned int m_length,\n                      const unsigned char *sigbuf, unsigned int siglen,\n                      const RSA *rsa);\n    /* keygen. If NULL built-in RSA key generation will be used */\n    int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\n\n} RSA_METHOD;\n
                                                                                                                                                          "},{"location":"man3/RSA_set_method/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_PKCS1_OpenSSL(), RSA_PKCS1_null_method(), RSA_get_default_method() and RSA_get_method() return pointers to the respective RSA_METHODs.

                                                                                                                                                          RSA_set_default_method() returns no value.

                                                                                                                                                          RSA_set_method() returns a pointer to the old RSA_METHOD implementation that was replaced. However, this return value should probably be ignored because if it was supplied by an ENGINE, the pointer could be invalidated at any time if the ENGINE is unloaded (in fact it could be unloaded as a result of the RSA_set_method() function releasing its handle to the ENGINE). For this reason, the return type may be replaced with a void declaration in a future release.

                                                                                                                                                          RSA_new_method() returns NULL and sets an error code that can be obtained by ERR_get_error(3) if the allocation fails. Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                                          "},{"location":"man3/RSA_set_method/#bugs","title":"BUGS","text":"

                                                                                                                                                          The behaviour of RSA_flags() is a mis-feature that is left as-is for now to avoid creating compatibility problems. RSA functionality, such as the encryption functions, are controlled by the flags value in the RSA key itself, not by the flags value in the RSA_METHOD attached to the RSA key (which is what this function returns). If the flags element of an RSA key is changed, the changes will be honoured by RSA functionality but will not be reflected in the return value of the RSA_flags() function - in effect RSA_flags() behaves more like an RSA_default_flags() function (which does not currently exist).

                                                                                                                                                          "},{"location":"man3/RSA_set_method/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          RSA_new(3)

                                                                                                                                                          "},{"location":"man3/RSA_set_method/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          The RSA_null_method(), which was a partial attempt to avoid patent issues, was replaced to always return NULL in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/RSA_set_method/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_sign/","title":"RSA_sign","text":""},{"location":"man3/RSA_sign/#name","title":"NAME","text":"

                                                                                                                                                          RSA_sign, RSA_verify - RSA signatures

                                                                                                                                                          "},{"location":"man3/RSA_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_sign(int type, const unsigned char *m, unsigned int m_len,\n             unsigned char *sigret, unsigned int *siglen, RSA *rsa);\n\nint RSA_verify(int type, const unsigned char *m, unsigned int m_len,\n               unsigned char *sigbuf, unsigned int siglen, RSA *rsa);\n
                                                                                                                                                          "},{"location":"man3/RSA_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use EVP_PKEY_sign_init(3), EVP_PKEY_sign(3), EVP_PKEY_verify_init(3) and EVP_PKEY_verify(3).

                                                                                                                                                          RSA_sign() signs the message digest m of size m_len using the private key rsa using RSASSA-PKCS1-v1_5 as specified in RFC 3447. It stores the signature in sigret and the signature size in siglen. sigret must point to RSA_size(rsa) bytes of memory. Note that PKCS #1 adds meta-data, placing limits on the size of the key that can be used. See RSA_private_encrypt(3) for lower-level operations.

                                                                                                                                                          type denotes the message digest algorithm that was used to generate m. If type is NID_md5_sha1, an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding and no algorithm identifier) is created.

                                                                                                                                                          RSA_verify() verifies that the signature sigbuf of size siglen matches a given message digest m of size m_len. type denotes the message digest algorithm that was used to generate the signature. rsa is the signer's public key.

                                                                                                                                                          "},{"location":"man3/RSA_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_sign() returns 1 on success and 0 for failure. RSA_verify() returns 1 on successful verification and 0 for failure.

                                                                                                                                                          The error codes can be obtained by ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/RSA_sign/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          SSL, PKCS #1 v2.0

                                                                                                                                                          "},{"location":"man3/RSA_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), RSA_private_encrypt(3), RSA_public_decrypt(3)

                                                                                                                                                          "},{"location":"man3/RSA_sign/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/","title":"RSA_sign_ASN1_OCTET_STRING","text":""},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#name","title":"NAME","text":"

                                                                                                                                                          RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING - RSA signatures

                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_sign_ASN1_OCTET_STRING(int dummy, unsigned char *m,\n                               unsigned int m_len, unsigned char *sigret,\n                               unsigned int *siglen, RSA *rsa);\n\nint RSA_verify_ASN1_OCTET_STRING(int dummy, unsigned char *m,\n                                 unsigned int m_len, unsigned char *sigbuf,\n                                 unsigned int siglen, RSA *rsa);\n
                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. Applications should instead use EVP PKEY APIs.

                                                                                                                                                          RSA_sign_ASN1_OCTET_STRING() signs the octet string m of size m_len using the private key rsa represented in DER using PKCS #1 padding. It stores the signature in sigret and the signature size in siglen. sigret must point to RSA_size(rsa) bytes of memory.

                                                                                                                                                          dummy is ignored.

                                                                                                                                                          The random number generator must be seeded when calling RSA_sign_ASN1_OCTET_STRING(). If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail.

                                                                                                                                                          RSA_verify_ASN1_OCTET_STRING() verifies that the signature sigbuf of size siglen is the DER representation of a given octet string m of size m_len. dummy is ignored. rsa is the signer's public key.

                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_sign_ASN1_OCTET_STRING() returns 1 on success, 0 otherwise. RSA_verify_ASN1_OCTET_STRING() returns 1 on successful verification, 0 otherwise.

                                                                                                                                                          The error codes can be obtained by ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#bugs","title":"BUGS","text":"

                                                                                                                                                          These functions serve no recognizable purpose.

                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), RAND_bytes(3), RSA_sign(3), RSA_verify(3), RAND(7)

                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/RSA_sign_ASN1_OCTET_STRING/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/RSA_size/","title":"RSA_size","text":""},{"location":"man3/RSA_size/#name","title":"NAME","text":"

                                                                                                                                                          RSA_size, RSA_bits, RSA_security_bits - get RSA modulus size or security bits

                                                                                                                                                          "},{"location":"man3/RSA_size/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/rsa.h>\n\nint RSA_bits(const RSA *rsa);\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int RSA_size(const RSA *rsa);\n\nint RSA_security_bits(const RSA *rsa);\n
                                                                                                                                                          "},{"location":"man3/RSA_size/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          RSA_bits() returns the number of significant bits.

                                                                                                                                                          rsa and rsa->n must not be NULL.

                                                                                                                                                          The remaining functions described on this page are deprecated. Applications should instead use EVP_PKEY_get_size(3), EVP_PKEY_get_bits(3) and EVP_PKEY_get_security_bits(3).

                                                                                                                                                          RSA_size() returns the RSA modulus size in bytes. It can be used to determine how much memory must be allocated for an RSA encrypted value.

                                                                                                                                                          RSA_security_bits() returns the number of security bits of the given rsa key. See BN_security_bits(3).

                                                                                                                                                          "},{"location":"man3/RSA_size/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          RSA_bits() returns the number of bits in the key.

                                                                                                                                                          RSA_size() returns the size of modulus in bytes.

                                                                                                                                                          RSA_security_bits() returns the number of security bits.

                                                                                                                                                          "},{"location":"man3/RSA_size/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          BN_num_bits(3)

                                                                                                                                                          "},{"location":"man3/RSA_size/#history","title":"HISTORY","text":"

                                                                                                                                                          The RSA_size() and RSA_security_bits() functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          The RSA_bits() function was added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/RSA_size/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SCT_new/","title":"SCT_new","text":""},{"location":"man3/SCT_new/#name","title":"NAME","text":"

                                                                                                                                                          SCT_new, SCT_new_from_base64, SCT_free, SCT_LIST_free, SCT_get_version, SCT_set_version, SCT_get_log_entry_type, SCT_set_log_entry_type, SCT_get0_log_id, SCT_set0_log_id, SCT_set1_log_id, SCT_get_timestamp, SCT_set_timestamp, SCT_get_signature_nid, SCT_set_signature_nid, SCT_get0_signature, SCT_set0_signature, SCT_set1_signature, SCT_get0_extensions, SCT_set0_extensions, SCT_set1_extensions, SCT_get_source, SCT_set_source - A Certificate Transparency Signed Certificate Timestamp

                                                                                                                                                          "},{"location":"man3/SCT_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ct.h>\n\ntypedef enum {\n    CT_LOG_ENTRY_TYPE_NOT_SET = -1,\n    CT_LOG_ENTRY_TYPE_X509 = 0,\n    CT_LOG_ENTRY_TYPE_PRECERT = 1\n} ct_log_entry_type_t;\n\ntypedef enum {\n    SCT_VERSION_NOT_SET = -1,\n    SCT_VERSION_V1 = 0\n} sct_version_t;\n\ntypedef enum {\n    SCT_SOURCE_UNKNOWN,\n    SCT_SOURCE_TLS_EXTENSION,\n    SCT_SOURCE_X509V3_EXTENSION,\n    SCT_SOURCE_OCSP_STAPLED_RESPONSE\n} sct_source_t;\n\nSCT *SCT_new(void);\nSCT *SCT_new_from_base64(unsigned char version,\n                         const char *logid_base64,\n                         ct_log_entry_type_t entry_type,\n                         uint64_t timestamp,\n                         const char *extensions_base64,\n                         const char *signature_base64);\n\nvoid SCT_free(SCT *sct);\nvoid SCT_LIST_free(STACK_OF(SCT) *a);\n\nsct_version_t SCT_get_version(const SCT *sct);\nint SCT_set_version(SCT *sct, sct_version_t version);\n\nct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);\nint SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);\n\nsize_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);\nint SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);\nint SCT_set1_log_id(SCT *sct, const unsigned char *log_id, size_t log_id_len);\n\nuint64_t SCT_get_timestamp(const SCT *sct);\nvoid SCT_set_timestamp(SCT *sct, uint64_t timestamp);\n\nint SCT_get_signature_nid(const SCT *sct);\nint SCT_set_signature_nid(SCT *sct, int nid);\n\nsize_t SCT_get0_signature(const SCT *sct, unsigned char **sig);\nvoid SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);\nint SCT_set1_signature(SCT *sct, const unsigned char *sig, size_t sig_len);\n\nsize_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);\nvoid SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);\nint SCT_set1_extensions(SCT *sct, const unsigned char *ext, size_t ext_len);\n\nsct_source_t SCT_get_source(const SCT *sct);\nint SCT_set_source(SCT *sct, sct_source_t source);\n
                                                                                                                                                          "},{"location":"man3/SCT_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          Signed Certificate Timestamps (SCTs) are defined by RFC 6962, Section 3.2. They constitute a promise by a Certificate Transparency (CT) log to publicly record a certificate. By cryptographically verifying that a log did indeed issue an SCT, some confidence can be gained that the certificate is publicly known.

                                                                                                                                                          An internal representation of an SCT can be created in one of two ways. The first option is to create a blank SCT, using SCT_new(), and then populate it using:

                                                                                                                                                          • SCT_set_version() to set the SCT version.

                                                                                                                                                            Only SCT_VERSION_V1 is currently supported.

                                                                                                                                                          • SCT_set_log_entry_type() to set the type of certificate the SCT was issued for:

                                                                                                                                                            CT_LOG_ENTRY_TYPE_X509 for a normal certificate. CT_LOG_ENTRY_TYPE_PRECERT for a pre-certificate.

                                                                                                                                                          • SCT_set0_log_id() or SCT_set1_log_id() to set the LogID of the CT log that the SCT came from.

                                                                                                                                                            The former takes ownership, whereas the latter makes a copy. See RFC 6962, Section 3.2 for the definition of LogID.

                                                                                                                                                          • SCT_set_timestamp() to set the time the SCT was issued (time in milliseconds since the Unix Epoch).

                                                                                                                                                          • SCT_set_signature_nid() to set the NID of the signature.
                                                                                                                                                          • SCT_set0_signature() or SCT_set1_signature() to set the raw signature value.

                                                                                                                                                            The former takes ownership, whereas the latter makes a copy.

                                                                                                                                                          • SCT_set0_extensions() or SCT_set1_extensions to provide SCT extensions.

                                                                                                                                                            The former takes ownership, whereas the latter makes a copy.

                                                                                                                                                          Alternatively, the SCT can be pre-populated from the following data using SCT_new_from_base64():

                                                                                                                                                          • The SCT version (only SCT_VERSION_V1 is currently supported).
                                                                                                                                                          • The LogID (see RFC 6962, Section 3.2), base64 encoded.
                                                                                                                                                          • The type of certificate the SCT was issued for: CT_LOG_ENTRY_TYPE_X509 for a normal certificate. CT_LOG_ENTRY_TYPE_PRECERT for a pre-certificate.
                                                                                                                                                          • The time that the SCT was issued (time in milliseconds since the Unix Epoch).
                                                                                                                                                          • The SCT extensions, base64 encoded.
                                                                                                                                                          • The SCT signature, base64 encoded.

                                                                                                                                                          SCT_set_source() can be used to record where the SCT was found (TLS extension, X.509 certificate extension or OCSP response). This is not required for verifying the SCT.

                                                                                                                                                          SCT_free() frees the specified SCT. If the argument is NULL, nothing is done.

                                                                                                                                                          SCT_LIST_free() frees the specified stack of SCTs. If the argument is NULL, nothing is done.

                                                                                                                                                          "},{"location":"man3/SCT_new/#notes","title":"NOTES","text":"

                                                                                                                                                          Some of the setters return int, instead of void. These will all return 1 on success, 0 on failure. They will not make changes on failure.

                                                                                                                                                          All of the setters will reset the validation status of the SCT to SCT_VALIDATION_STATUS_NOT_SET (see SCT_validate(3)).

                                                                                                                                                          SCT_set_source() will call SCT_set_log_entry_type() if the type of certificate the SCT was issued for can be inferred from where the SCT was found. For example, an SCT found in an X.509 extension must have been issued for a pre- certificate.

                                                                                                                                                          SCT_set_source() will not refuse unknown values.

                                                                                                                                                          "},{"location":"man3/SCT_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SCT_set_version() returns 1 if the specified version is supported, 0 otherwise.

                                                                                                                                                          SCT_set_log_entry_type() returns 1 if the specified log entry type is supported, 0 otherwise.

                                                                                                                                                          SCT_set0_log_id() and SCT_set1_log_id return 1 if the specified LogID is a valid SHA-256 hash, 0 otherwise. Additionally, SCT_set1_log_id returns 0 if malloc fails.

                                                                                                                                                          SCT_set_signature_nid returns 1 if the specified NID is supported, 0 otherwise.

                                                                                                                                                          SCT_set1_extensions and SCT_set1_signature return 1 if the supplied buffer is copied successfully, 0 otherwise (i.e. if malloc fails).

                                                                                                                                                          SCT_set_source returns 1 on success, 0 otherwise.

                                                                                                                                                          "},{"location":"man3/SCT_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ct(7), SCT_validate(3), OBJ_nid2obj(3)

                                                                                                                                                          "},{"location":"man3/SCT_new/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/SCT_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SCT_print/","title":"SCT_print","text":""},{"location":"man3/SCT_print/#name","title":"NAME","text":"

                                                                                                                                                          SCT_print, SCT_LIST_print, SCT_validation_status_string - Prints Signed Certificate Timestamps in a human-readable way

                                                                                                                                                          "},{"location":"man3/SCT_print/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ct.h>\n\nvoid SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);\nvoid SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,\n                    const char *separator, const CTLOG_STORE *logs);\nconst char *SCT_validation_status_string(const SCT *sct);\n
                                                                                                                                                          "},{"location":"man3/SCT_print/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SCT_print() prints a single Signed Certificate Timestamp (SCT) to a BIO in a human-readable format. SCT_LIST_print() prints an entire list of SCTs in a similar way. A separator can be specified to delimit each SCT in the output.

                                                                                                                                                          The output can be indented by a specified number of spaces. If a CTLOG_STORE is provided, it will be used to print the description of the CT log that issued each SCT (if that log is in the CTLOG_STORE). Alternatively, NULL can be passed as the CTLOG_STORE parameter to disable this feature.

                                                                                                                                                          SCT_validation_status_string() will return the validation status of an SCT as a human-readable string. Call SCT_validate() or SCT_LIST_validate() beforehand in order to set the validation status of an SCT first.

                                                                                                                                                          "},{"location":"man3/SCT_print/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SCT_validation_status_string() returns a NUL-terminated string representing the validation status of an SCT object.

                                                                                                                                                          "},{"location":"man3/SCT_print/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ct(7), bio(7), CTLOG_STORE_new(3), SCT_validate(3)

                                                                                                                                                          "},{"location":"man3/SCT_print/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/SCT_print/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SCT_validate/","title":"SCT_validate","text":""},{"location":"man3/SCT_validate/#name","title":"NAME","text":"

                                                                                                                                                          SCT_validate, SCT_LIST_validate, SCT_get_validation_status - checks Signed Certificate Timestamps (SCTs) are valid

                                                                                                                                                          "},{"location":"man3/SCT_validate/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ct.h>\n\ntypedef enum {\n    SCT_VALIDATION_STATUS_NOT_SET,\n    SCT_VALIDATION_STATUS_UNKNOWN_LOG,\n    SCT_VALIDATION_STATUS_VALID,\n    SCT_VALIDATION_STATUS_INVALID,\n    SCT_VALIDATION_STATUS_UNVERIFIED,\n    SCT_VALIDATION_STATUS_UNKNOWN_VERSION\n} sct_validation_status_t;\n\nint SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);\nint SCT_LIST_validate(const STACK_OF(SCT) *scts, CT_POLICY_EVAL_CTX *ctx);\nsct_validation_status_t SCT_get_validation_status(const SCT *sct);\n
                                                                                                                                                          "},{"location":"man3/SCT_validate/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SCT_validate() will check that an SCT is valid and verify its signature. SCT_LIST_validate() performs the same checks on an entire stack of SCTs. The result of the validation checks can be obtained by passing the SCT to SCT_get_validation_status().

                                                                                                                                                          A CT_POLICY_EVAL_CTX must be provided that specifies:

                                                                                                                                                          • The certificate the SCT was issued for.

                                                                                                                                                            Failure to provide the certificate will result in the validation status being SCT_VALIDATION_STATUS_UNVERIFIED.

                                                                                                                                                          • The issuer of that certificate.

                                                                                                                                                            This is only required if the SCT was issued for a pre-certificate (see RFC 6962). If it is required but not provided, the validation status will be SCT_VALIDATION_STATUS_UNVERIFIED.

                                                                                                                                                          • A CTLOG_STORE that contains the CT log that issued this SCT.

                                                                                                                                                            If the SCT was issued by a log that is not in this CTLOG_STORE, the validation status will be SCT_VALIDATION_STATUS_UNKNOWN_LOG.

                                                                                                                                                          If the SCT is of an unsupported version (only v1 is currently supported), the validation status will be SCT_VALIDATION_STATUS_UNKNOWN_VERSION.

                                                                                                                                                          If the SCT's signature is incorrect, its timestamp is in the future (relative to the time in CT_POLICY_EVAL_CTX), or if it is otherwise invalid, the validation status will be SCT_VALIDATION_STATUS_INVALID.

                                                                                                                                                          If all checks pass, the validation status will be SCT_VALIDATION_STATUS_VALID.

                                                                                                                                                          "},{"location":"man3/SCT_validate/#notes","title":"NOTES","text":"

                                                                                                                                                          A return value of 0 from SCT_LIST_validate() should not be interpreted as a failure. At a minimum, only one valid SCT may provide sufficient confidence that a certificate has been publicly logged.

                                                                                                                                                          "},{"location":"man3/SCT_validate/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SCT_validate() returns a negative integer if an internal error occurs, 0 if the SCT fails validation, or 1 if the SCT passes validation.

                                                                                                                                                          SCT_LIST_validate() returns a negative integer if an internal error occurs, 0 if any of SCTs fails validation, or 1 if they all pass validation.

                                                                                                                                                          SCT_get_validation_status() returns the validation status of the SCT. If SCT_validate() or SCT_LIST_validate() have not been passed that SCT, the returned value will be SCT_VALIDATION_STATUS_NOT_SET.

                                                                                                                                                          "},{"location":"man3/SCT_validate/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ct(7)

                                                                                                                                                          "},{"location":"man3/SCT_validate/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/SCT_validate/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SHA256_Init/","title":"SHA256_Init","text":""},{"location":"man3/SHA256_Init/#name","title":"NAME","text":"

                                                                                                                                                          SHA1, SHA1_Init, SHA1_Update, SHA1_Final, SHA224, SHA224_Init, SHA224_Update, SHA224_Final, SHA256, SHA256_Init, SHA256_Update, SHA256_Final, SHA384, SHA384_Init, SHA384_Update, SHA384_Final, SHA512, SHA512_Init, SHA512_Update, SHA512_Final - Secure Hash Algorithm

                                                                                                                                                          "},{"location":"man3/SHA256_Init/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/sha.h>\n\nunsigned char *SHA1(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA224(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA256(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA384(const unsigned char *data, size_t count, unsigned char *md_buf);\nunsigned char *SHA512(const unsigned char *data, size_t count, unsigned char *md_buf);\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int SHA1_Init(SHA_CTX *c);\nint SHA1_Update(SHA_CTX *c, const void *data, size_t len);\nint SHA1_Final(unsigned char *md, SHA_CTX *c);\n\nint SHA224_Init(SHA256_CTX *c);\nint SHA224_Update(SHA256_CTX *c, const void *data, size_t len);\nint SHA224_Final(unsigned char *md, SHA256_CTX *c);\n\nint SHA256_Init(SHA256_CTX *c);\nint SHA256_Update(SHA256_CTX *c, const void *data, size_t len);\nint SHA256_Final(unsigned char *md, SHA256_CTX *c);\n\nint SHA384_Init(SHA512_CTX *c);\nint SHA384_Update(SHA512_CTX *c, const void *data, size_t len);\nint SHA384_Final(unsigned char *md, SHA512_CTX *c);\n\nint SHA512_Init(SHA512_CTX *c);\nint SHA512_Update(SHA512_CTX *c, const void *data, size_t len);\nint SHA512_Final(unsigned char *md, SHA512_CTX *c);\n
                                                                                                                                                          "},{"location":"man3/SHA256_Init/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page except for SHA1(), SHA224(), SHA256(), SHA384() and SHA512() are deprecated. Applications should instead use EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3), or the quick one-shot function EVP_Q_digest(3). SHA1(), SHA224(), SHA256(), SHA384(), and SHA256() can continue to be used. They can also be replaced by, e.g.,

                                                                                                                                                          (EVP_Q_digest(d, n, md, NULL, NULL, \"SHA256\", NULL) ? md : NULL)\n

                                                                                                                                                          SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a 160 bit output.

                                                                                                                                                          SHA1() computes the SHA-1 message digest of the n bytes at d and places it in md (which must have space for SHA_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array. Note: setting md to NULL is not thread safe.

                                                                                                                                                          The following functions may be used if the message is not completely stored in memory:

                                                                                                                                                          SHA1_Init() initializes a SHA_CTX structure.

                                                                                                                                                          SHA1_Update() can be called repeatedly with chunks of the message to be hashed (len bytes at data).

                                                                                                                                                          SHA1_Final() places the message digest in md, which must have space for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the SHA_CTX.

                                                                                                                                                          The SHA224, SHA256, SHA384 and SHA512 families of functions operate in the same way as for the SHA1 functions. Note that SHA224 and SHA256 use a SHA256_CTX object instead of SHA_CTX. SHA384 and SHA512 use SHA512_CTX. The buffer md must have space for the output from the SHA variant being used (defined by SHA224_DIGEST_LENGTH, SHA256_DIGEST_LENGTH, SHA384_DIGEST_LENGTH and SHA512_DIGEST_LENGTH). Also note that, as for the SHA1() function above, the SHA224(), SHA256(), SHA384() and SHA512() functions are not thread safe if md is NULL.

                                                                                                                                                          "},{"location":"man3/SHA256_Init/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SHA1(), SHA224(), SHA256(), SHA384() and SHA512() return a pointer to the hash value.

                                                                                                                                                          SHA1_Init(), SHA1_Update() and SHA1_Final() and equivalent SHA224, SHA256, SHA384 and SHA512 functions return 1 for success, 0 otherwise.

                                                                                                                                                          "},{"location":"man3/SHA256_Init/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                          US Federal Information Processing Standard FIPS PUB 180-4 (Secure Hash Standard), ANSI X9.30

                                                                                                                                                          "},{"location":"man3/SHA256_Init/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          EVP_Q_digest(3), EVP_DigestInit(3)

                                                                                                                                                          "},{"location":"man3/SHA256_Init/#history","title":"HISTORY","text":"

                                                                                                                                                          All of these functions except SHA*() were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SHA256_Init/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/","title":"SMIME_read_ASN1","text":""},{"location":"man3/SMIME_read_ASN1/#name","title":"NAME","text":"

                                                                                                                                                          SMIME_read_ASN1_ex, SMIME_read_ASN1 - parse S/MIME message

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/asn1.h>\n\nASN1_VALUE *SMIME_read_ASN1_ex(BIO *in, int flags, BIO **bcont,\n                               const ASN1_ITEM *it, ASN1_VALUE **x,\n                               OSSL_LIB_CTX *libctx, const char *propq);\nASN1_VALUE *SMIME_read_ASN1(BIO *in, BIO **bcont, const ASN1_ITEM *it);\n
                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SMIME_read_ASN1_ex() parses a message in S/MIME format.

                                                                                                                                                          in is a BIO to read the message from. If the flags argument contains CMS_BINARY then the input is assumed to be in binary format and is not translated to canonical form. If in addition SMIME_ASCIICRLF is set then the binary input is assumed to be followed by CR and LF characters, else only by an LF character. x can be used to optionally supply a previously created it ASN1_VALUE object (such as CMS_ContentInfo or PKCS7), it can be set to NULL. Valid values that can be used by ASN.1 structure it are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo). Any algorithm fetches that occur during the operation will use the OSSL_LIB_CTX supplied in the libctx parameter, and use the property query string propq See \"ALGORITHM FETCHING\" in crypto(7) for further details about algorithm fetching.

                                                                                                                                                          If cleartext signing is used then the content is saved in a memory bio which is written to *bcont, otherwise *bcont is set to NULL.

                                                                                                                                                          The parsed ASN1_VALUE structure is returned or NULL if an error occurred.

                                                                                                                                                          SMIME_read_ASN1() is similar to SMIME_read_ASN1_ex() but sets the value of x to NULL and the value of flags to 0.

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#notes","title":"NOTES","text":"

                                                                                                                                                          The higher level functions SMIME_read_CMS_ex(3) and SMIME_read_PKCS7_ex(3) should be used instead of SMIME_read_ASN1_ex().

                                                                                                                                                          To support future functionality if bcont is not NULL *bcont should be initialized to NULL.

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#bugs","title":"BUGS","text":"

                                                                                                                                                          The MIME parser used by SMIME_read_ASN1_ex() is somewhat primitive. While it will handle most S/MIME messages more complex compound formats may not work.

                                                                                                                                                          The use of a memory BIO to hold the signed content limits the size of message which can be processed due to memory restraints: a streaming single pass option should be available.

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SMIME_read_ASN1_ex() and SMIME_read_ASN1() return a valid ASN1_VALUE structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), SMIME_read_CMS_ex(3), SMIME_read_PKCS7_ex(3), SMIME_write_ASN1(3), SMIME_write_ASN1_ex(3)

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#history","title":"HISTORY","text":"

                                                                                                                                                          The function SMIME_read_ASN1_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SMIME_read_ASN1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/","title":"SMIME_read_CMS","text":""},{"location":"man3/SMIME_read_CMS/#name","title":"NAME","text":"

                                                                                                                                                          SMIME_read_CMS_ex, SMIME_read_CMS - parse S/MIME message

                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/cms.h>\n\nCMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont,\n                                   CMS_ContentInfo **cms);\nCMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);\n
                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SMIME_read_CMS() parses a message in S/MIME format.

                                                                                                                                                          in is a BIO to read the message from.

                                                                                                                                                          If cleartext signing is used then the content is saved in a memory bio which is written to *bcont, otherwise *bcont is set to NULL.

                                                                                                                                                          The parsed CMS_ContentInfo structure is returned or NULL if an error occurred.

                                                                                                                                                          SMIME_read_CMS_ex() is similar to SMIME_read_CMS() but optionally a previously created cms CMS_ContentInfo object can be supplied as well as some flags. To create a cms object use CMS_ContentInfo_new_ex(3). If the flags argument contains CMS_BINARY then the input is assumed to be in binary format and is not translated to canonical form. If in addition SMIME_ASCIICRLF is set then the binary input is assumed to be followed by CR and LF characters, else only by an LF character. If flags is 0 and cms is NULL then it is identical to SMIME_read_CMS().

                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#notes","title":"NOTES","text":"

                                                                                                                                                          If *bcont is not NULL then the message is clear text signed. *bcont can then be passed to CMS_verify() with the CMS_DETACHED flag set.

                                                                                                                                                          Otherwise the type of the returned structure can be determined using CMS_get0_type().

                                                                                                                                                          To support future functionality if bcont is not NULL *bcont should be initialized to NULL. For example:

                                                                                                                                                          BIO *cont = NULL;\nCMS_ContentInfo *cms;\n\ncms = SMIME_read_CMS(in, &cont);\n
                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#bugs","title":"BUGS","text":"

                                                                                                                                                          The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it will handle most S/MIME messages more complex compound formats may not work.

                                                                                                                                                          The parser assumes that the CMS_ContentInfo structure is always base64 encoded and will not handle the case where it is in binary format or uses quoted printable format.

                                                                                                                                                          The use of a memory BIO to hold the signed content limits the size of message which can be processed due to memory restraints: a streaming single pass option should be available.

                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SMIME_read_CMS_ex() and SMIME_read_CMS() return a valid CMS_ContentInfo structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3), CMS_decrypt(3)

                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#history","title":"HISTORY","text":"

                                                                                                                                                          The function SMIME_read_CMS_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SMIME_read_CMS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2008-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/","title":"SMIME_read_PKCS7","text":""},{"location":"man3/SMIME_read_PKCS7/#name","title":"NAME","text":"

                                                                                                                                                          SMIME_read_PKCS7_ex, SMIME_read_PKCS7 - parse S/MIME message

                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nPKCS7 *SMIME_read_PKCS7_ex(BIO *bio, BIO **bcont, PKCS7 **p7);\nPKCS7 *SMIME_read_PKCS7(BIO *in, BIO **bcont);\n
                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SMIME_read_PKCS7() parses a message in S/MIME format.

                                                                                                                                                          in is a BIO to read the message from.

                                                                                                                                                          If cleartext signing is used then the content is saved in a memory bio which is written to *bcont, otherwise *bcont is set to NULL.

                                                                                                                                                          The parsed PKCS#7 structure is returned or NULL if an error occurred.

                                                                                                                                                          SMIME_read_PKCS7_ex() is similar to SMIME_read_PKCS7() but can optionally supply a previously created p7 PKCS#7 object. If p7 is NULL then it is identical to SMIME_read_PKCS7(). To create a p7 object use PKCS7_new_ex(3).

                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#notes","title":"NOTES","text":"

                                                                                                                                                          If *bcont is not NULL then the message is clear text signed. *bcont can then be passed to PKCS7_verify() with the PKCS7_DETACHED flag set.

                                                                                                                                                          Otherwise the type of the returned structure can be determined using PKCS7_type_is_enveloped(), etc.

                                                                                                                                                          To support future functionality if bcont is not NULL *bcont should be initialized to NULL. For example:

                                                                                                                                                          BIO *cont = NULL;\nPKCS7 *p7;\n\np7 = SMIME_read_PKCS7(in, &cont);\n
                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#bugs","title":"BUGS","text":"

                                                                                                                                                          The MIME parser used by SMIME_read_PKCS7() is somewhat primitive. While it will handle most S/MIME messages more complex compound formats may not work.

                                                                                                                                                          The parser assumes that the PKCS7 structure is always base64 encoded and will not handle the case where it is in binary format or uses quoted printable format.

                                                                                                                                                          The use of a memory BIO to hold the signed content limits the size of message which can be processed due to memory restraints: a streaming single pass option should be available.

                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SMIME_read_PKCS7_ex() and SMIME_read_PKCS7() return a valid PKCS7 structure or NULL if an error occurred. The error can be obtained from ERR_get_error(3).

                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), SMIME_read_PKCS7(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3)

                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#history","title":"HISTORY","text":"

                                                                                                                                                          The function SMIME_read_PKCS7_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SMIME_read_PKCS7/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SMIME_write_ASN1/","title":"SMIME_write_ASN1","text":""},{"location":"man3/SMIME_write_ASN1/#name","title":"NAME","text":"

                                                                                                                                                          SMIME_write_ASN1_ex, SMIME_write_ASN1 - convert structure to S/MIME format

                                                                                                                                                          "},{"location":"man3/SMIME_write_ASN1/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/asn1.h>\n\nint SMIME_write_ASN1_ex(BIO *out, ASN1_VALUE *val, BIO *data, int flags,\n                        int ctype_nid, int econt_nid,\n                        STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it,\n                        OSSL_LIB_CTX *libctx, const char *propq);\n\nint SMIME_write_ASN1(BIO *out,\n    ASN1_VALUE *val, BIO *data, int flags, int ctype_nid, int econt_nid,\n    STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);\n
                                                                                                                                                          "},{"location":"man3/SMIME_write_ASN1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SMIME_write_ASN1_ex() adds the appropriate MIME headers to an object structure to produce an S/MIME message.

                                                                                                                                                          out is the BIO to write the data to. value is the appropriate ASN1_VALUE structure (either CMS_ContentInfo or PKCS7). If streaming is enabled then the content must be supplied via data. flags is an optional set of flags. ctype_nid is the NID of the content type, econt_nid is the NID of the embedded content type and mdalgs is a list of signed data digestAlgorithms. Valid values that can be used by the ASN.1 structure it are ASN1_ITEM_rptr(PKCS7) or ASN1_ITEM_rptr(CMS_ContentInfo). The library context libctx and the property query propq are used when retrieving algorithms from providers.

                                                                                                                                                          "},{"location":"man3/SMIME_write_ASN1/#notes","title":"NOTES","text":"

                                                                                                                                                          The higher level functions SMIME_write_CMS(3) and SMIME_write_PKCS7(3) should be used instead of SMIME_write_ASN1().

                                                                                                                                                          The following flags can be passed in the flags parameter.

                                                                                                                                                          If CMS_DETACHED is set then cleartext signing will be used, this option only makes sense for SignedData where CMS_DETACHED is also set when the sign() method is called.

                                                                                                                                                          If the CMS_TEXT flag is set MIME headers for type text/plain are added to the content, this only makes sense if CMS_DETACHED is also set.

                                                                                                                                                          If the CMS_STREAM flag is set streaming is performed. This flag should only be set if CMS_STREAM was also set in the previous call to a CMS_ContentInfo or PKCS7 creation function.

                                                                                                                                                          If cleartext signing is being used and CMS_STREAM not set then the data must be read twice: once to compute the signature in sign method and once to output the S/MIME message.

                                                                                                                                                          If streaming is performed the content is output in BER format using indefinite length constructed encoding except in the case of signed data with detached content where the content is absent and DER format is used.

                                                                                                                                                          "},{"location":"man3/SMIME_write_ASN1/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SMIME_write_ASN1_ex() and SMIME_write_ASN1() return 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/SMIME_write_ASN1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), SMIME_write_CMS(3), SMIME_write_PKCS7(3)

                                                                                                                                                          "},{"location":"man3/SMIME_write_ASN1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/","title":"SMIME_write_CMS","text":""},{"location":"man3/SMIME_write_CMS/#name","title":"NAME","text":"

                                                                                                                                                          SMIME_write_CMS - convert CMS structure to S/MIME format

                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/cms.h>\n\nint SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);\n
                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SMIME_write_CMS() adds the appropriate MIME headers to a CMS structure to produce an S/MIME message.

                                                                                                                                                          out is the BIO to write the data to. cms is the appropriate CMS_ContentInfo structure. If streaming is enabled then the content must be supplied in the data argument. flags is an optional set of flags.

                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/#notes","title":"NOTES","text":"

                                                                                                                                                          The following flags can be passed in the flags parameter.

                                                                                                                                                          If CMS_DETACHED is set then cleartext signing will be used, this option only makes sense for SignedData where CMS_DETACHED is also set when CMS_sign() is called.

                                                                                                                                                          If the CMS_TEXT flag is set MIME headers for type text/plain are added to the content, this only makes sense if CMS_DETACHED is also set.

                                                                                                                                                          If the CMS_STREAM flag is set streaming is performed. This flag should only be set if CMS_STREAM was also set in the previous call to a CMS_ContentInfo creation function.

                                                                                                                                                          If cleartext signing is being used and CMS_STREAM not set then the data must be read twice: once to compute the signature in CMS_sign() and once to output the S/MIME message.

                                                                                                                                                          If streaming is performed the content is output in BER format using indefinite length constructed encoding except in the case of signed data with detached content where the content is absent and DER format is used.

                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/#bugs","title":"BUGS","text":"

                                                                                                                                                          SMIME_write_CMS() always base64 encodes CMS structures, there should be an option to disable this.

                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SMIME_write_CMS() returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3) CMS_decrypt(3)

                                                                                                                                                          "},{"location":"man3/SMIME_write_CMS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/","title":"SMIME_write_PKCS7","text":""},{"location":"man3/SMIME_write_PKCS7/#name","title":"NAME","text":"

                                                                                                                                                          SMIME_write_PKCS7 - convert PKCS#7 structure to S/MIME format

                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/pkcs7.h>\n\nint SMIME_write_PKCS7(BIO *out, PKCS7 *p7, BIO *data, int flags);\n
                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SMIME_write_PKCS7() adds the appropriate MIME headers to a PKCS#7 structure to produce an S/MIME message.

                                                                                                                                                          out is the BIO to write the data to. p7 is the appropriate PKCS7 structure. If streaming is enabled then the content must be supplied in the data argument. flags is an optional set of flags.

                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/#notes","title":"NOTES","text":"

                                                                                                                                                          The following flags can be passed in the flags parameter.

                                                                                                                                                          If PKCS7_DETACHED is set then cleartext signing will be used, this option only makes sense for signedData where PKCS7_DETACHED is also set when PKCS7_sign() is also called.

                                                                                                                                                          If the PKCS7_TEXT flag is set MIME headers for type text/plain are added to the content, this only makes sense if PKCS7_DETACHED is also set.

                                                                                                                                                          If the PKCS7_STREAM flag is set streaming is performed. This flag should only be set if PKCS7_STREAM was also set in the previous call to PKCS7_sign() or PKCS7_encrypt().

                                                                                                                                                          If cleartext signing is being used and PKCS7_STREAM not set then the data must be read twice: once to compute the signature in PKCS7_sign() and once to output the S/MIME message.

                                                                                                                                                          If streaming is performed the content is output in BER format using indefinite length constructed encoding except in the case of signed data with detached content where the content is absent and DER format is used.

                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/#bugs","title":"BUGS","text":"

                                                                                                                                                          SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there should be an option to disable this.

                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SMIME_write_PKCS7() returns 1 for success or 0 for failure.

                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ERR_get_error(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3)

                                                                                                                                                          "},{"location":"man3/SMIME_write_PKCS7/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SRP_Calc_B/","title":"SRP_Calc_B","text":""},{"location":"man3/SRP_Calc_B/#name","title":"NAME","text":"

                                                                                                                                                          SRP_Calc_server_key, SRP_Calc_A, SRP_Calc_B_ex, SRP_Calc_B, SRP_Calc_u_ex, SRP_Calc_u, SRP_Calc_x_ex, SRP_Calc_x, SRP_Calc_client_key_ex, SRP_Calc_client_key - SRP authentication primitives

                                                                                                                                                          "},{"location":"man3/SRP_Calc_B/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/srp.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          /* server side .... */\nBIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,\n                            const BIGNUM *b, const BIGNUM *N);\nBIGNUM *SRP_Calc_B_ex(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,\n                      const BIGNUM *v, OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,\n                  const BIGNUM *v);\n\nBIGNUM *SRP_Calc_u_ex(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N,\n                      OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N);\n\n/* client side .... */\nBIGNUM *SRP_Calc_client_key_ex(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,\n                            const BIGNUM *x, const BIGNUM *a, const BIGNUM *u,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,\n                            const BIGNUM *x, const BIGNUM *a, const BIGNUM *u);\nBIGNUM *SRP_Calc_x_ex(const BIGNUM *s, const char *user, const char *pass,\n                      OSSL_LIB_CTX *libctx, const char *propq);\nBIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass);\nBIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g);\n
                                                                                                                                                          "},{"location":"man3/SRP_Calc_B/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                                                                                                                                                          The SRP functions described on this page are used to calculate various parameters and keys used by SRP as defined in RFC2945. The server key and B and u parameters are used on the server side and are calculated via SRP_Calc_server_key(), SRP_Calc_B_ex(), SRP_Calc_B(), SRP_Calc_u_ex() and SRP_Calc_u(). The client key and x and A parameters are used on the client side and are calculated via the functions SRP_Calc_client_key_ex(), SRP_Calc_client_key(), SRP_Calc_x_ex(), SRP_Calc_x() and SRP_Calc_A(). See RFC2945 for a detailed description of their usage and the meaning of the various BIGNUM parameters to these functions.

                                                                                                                                                          Most of these functions come in two forms. Those that take a libctx and propq parameter, and those that don't. Any cryptogrpahic functions that are fetched and used during the calculation use the provided libctx and propq. See \"ALGORITHM FETCHING\" in crypto(7) for more details. The variants that do not take a libctx and propq parameter use the default library context and property query string. The SRP_Calc_server_key() and SRP_Calc_A() functions do not have a form that takes libctx or propq parameters because they do not need to fetch any cryptographic algorithms.

                                                                                                                                                          "},{"location":"man3/SRP_Calc_B/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          All these functions return the calculated key or parameter, or NULL on error.

                                                                                                                                                          "},{"location":"man3/SRP_Calc_B/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          openssl-srp(1), SRP_VBASE_new(3), SRP_user_pwd_new(3)

                                                                                                                                                          "},{"location":"man3/SRP_Calc_B/#history","title":"HISTORY","text":"

                                                                                                                                                          SRP_Calc_B_ex, SRP_Calc_u_ex, SRP_Calc_client_key_ex and SRP_Calc_x_ex were introduced in OpenSSL 3.0.

                                                                                                                                                          All of the other functions were added in OpenSSL 1.0.1.

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SRP_Calc_B/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SRP_VBASE_new/","title":"SRP_VBASE_new","text":""},{"location":"man3/SRP_VBASE_new/#name","title":"NAME","text":"

                                                                                                                                                          SRP_VBASE_new, SRP_VBASE_free, SRP_VBASE_init, SRP_VBASE_add0_user, SRP_VBASE_get1_by_user, SRP_VBASE_get_by_user - Functions to create and manage a stack of SRP user verifier information

                                                                                                                                                          "},{"location":"man3/SRP_VBASE_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/srp.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          SRP_VBASE *SRP_VBASE_new(char *seed_key);\nvoid SRP_VBASE_free(SRP_VBASE *vb);\n\nint SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);\n\nint SRP_VBASE_add0_user(SRP_VBASE *vb, SRP_user_pwd *user_pwd);\nSRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);\nSRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);\n
                                                                                                                                                          "},{"location":"man3/SRP_VBASE_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                                                                                                                                                          The SRP_VBASE_new() function allocates a structure to store server side SRP verifier information. If seed_key is not NULL a copy is stored and used to generate dummy parameters for users that are not found by SRP_VBASE_get1_by_user(). This allows the server to hide the fact that it doesn't have a verifier for a particular username, as described in section 2.5.1.3 'Unknown SRP' of RFC 5054. The seed string should contain random NUL terminated binary data (therefore the random data should not contain NUL bytes!).

                                                                                                                                                          The SRP_VBASE_free() function frees up the vb structure. If vb is NULL, nothing is done.

                                                                                                                                                          The SRP_VBASE_init() function parses the information in a verifier file and populates the vb structure. The verifier file is a text file containing multiple entries, whose format is: flag base64(verifier) base64(salt) username gNid userinfo(optional) where the flag can be 'V' (valid) or 'R' (revoked). Note that the base64 encoding used here is non-standard so it is recommended to use openssl-srp(1) to generate this file.

                                                                                                                                                          The SRP_VBASE_add0_user() function adds the user_pwd verifier information to the vb structure. See SRP_user_pwd_new(3) to create and populate this record. The library takes ownership of user_pwd, it should not be freed by the caller.

                                                                                                                                                          The SRP_VBASE_get1_by_user() function returns the password info for the user whose username matches username. It replaces the deprecated SRP_VBASE_get_by_user(). If no matching user is found but a seed_key and default gN parameters have been set, dummy authentication information is generated from the seed_key, allowing the server to hide the fact that it doesn't have a verifier for a particular username. When using SRP as a TLS authentication mechanism, this will cause the handshake to proceed normally but the first client will be rejected with a \"bad_record_mac\" alert, as if the password was incorrect. If no matching user is found and the seed_key is not set, NULL is returned. Ownership of the returned pointer is released to the caller, it must be freed with SRP_user_pwd_free().

                                                                                                                                                          "},{"location":"man3/SRP_VBASE_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SRP_VBASE_init() returns SRP_NO_ERROR (0) on success and a positive value on failure. The error codes are SRP_ERR_OPEN_FILE if the file could not be opened, SRP_ERR_VBASE_INCOMPLETE_FILE if the file could not be parsed, SRP_ERR_MEMORY on memory allocation failure and SRP_ERR_VBASE_BN_LIB for invalid decoded parameter values.

                                                                                                                                                          SRP_VBASE_add0_user() returns 1 on success and 0 on failure.

                                                                                                                                                          "},{"location":"man3/SRP_VBASE_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          openssl-srp(1), SRP_create_verifier(3), SRP_user_pwd_new(3), SSL_CTX_set_srp_password(3)

                                                                                                                                                          "},{"location":"man3/SRP_VBASE_new/#history","title":"HISTORY","text":"

                                                                                                                                                          The SRP_VBASE_add0_user() function was added in OpenSSL 3.0.

                                                                                                                                                          All other functions were added in OpenSSL 1.0.1.

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SRP_VBASE_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/","title":"SRP_create_verifier","text":""},{"location":"man3/SRP_create_verifier/#name","title":"NAME","text":"

                                                                                                                                                          SRP_create_verifier_ex, SRP_create_verifier, SRP_create_verifier_BN_ex, SRP_create_verifier_BN, SRP_check_known_gN_param, SRP_get_default_gN - SRP authentication primitives

                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/srp.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          int SRP_create_verifier_BN_ex(const char *user, const char *pass, BIGNUM **salt,\n                              BIGNUM **verifier, const BIGNUM *N,\n                              const BIGNUM *g, OSSL_LIB_CTX *libctx,\n                              const char *propq);\nchar *SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,\n                             BIGNUM **verifier, const BIGNUM *N, const BIGNUM *g);\nchar *SRP_create_verifier_ex(const char *user, const char *pass, char **salt,\n                             char **verifier, const char *N, const char *g,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nchar *SRP_create_verifier(const char *user, const char *pass, char **salt,\n                          char **verifier, const char *N, const char *g);\n\nchar *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);\nSRP_gN *SRP_get_default_gN(const char *id);\n
                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                                                                                                                                                          The SRP_create_verifier_BN_ex() function creates an SRP password verifier from the supplied parameters as defined in section 2.4 of RFC 5054 using the library context libctx and property query string propq. Any cryptographic algorithms that need to be fetched will use the libctx and propq. See \"ALGORITHM FETCHING\" in crypto(7).

                                                                                                                                                          SRP_create_verifier_BN() is the same as SRP_create_verifier_BN_ex() except the default library context and property query string is used.

                                                                                                                                                          On successful exit *verifier will point to a newly allocated BIGNUM containing the verifier and (if a salt was not provided) *salt will be populated with a newly allocated BIGNUM containing a random salt. If *salt is not NULL then the provided salt is used instead. The caller is responsible for freeing the allocated *salt and *verifier BIGNUMS (use BN_free(3)).

                                                                                                                                                          The SRP_create_verifier() function is similar to SRP_create_verifier_BN() but all numeric parameters are in a non-standard base64 encoding originally designed for compatibility with libsrp. This is mainly present for historical compatibility and its use is discouraged. It is possible to pass NULL as N and an SRP group id as g instead to load the appropriate gN values (see SRP_get_default_gN()). If both N and g are NULL the 8192-bit SRP group parameters are used. The caller is responsible for freeing the allocated *salt and *verifier (use OPENSSL_free(3)).

                                                                                                                                                          The SRP_check_known_gN_param() function checks that g and N are valid SRP group parameters from RFC 5054 appendix A.

                                                                                                                                                          The SRP_get_default_gN() function returns the gN parameters for the RFC 5054 id SRP group size. The known ids are \"1024\", \"1536\", \"2048\", \"3072\", \"4096\", \"6144\" and \"8192\".

                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SRP_create_verifier_BN_ex() and SRP_create_verifier_BN() return 1 on success and 0 on failure.

                                                                                                                                                          SRP_create_verifier_ex() and SRP_create_verifier() return NULL on failure and a non-NULL value on success: \"*\" if N is not NULL, the selected group id otherwise. This value should not be freed.

                                                                                                                                                          SRP_check_known_gN_param() returns the text representation of the group id (i.e. the prime bit size) or NULL if the arguments are not valid SRP group parameters. This value should not be freed.

                                                                                                                                                          SRP_get_default_gN() returns NULL if id is not a valid group size, or the 8192-bit group parameters if id is NULL.

                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Generate and store a 8192 bit password verifier (error handling omitted for clarity):

                                                                                                                                                          #include <openssl/bn.h>\n#include <openssl/srp.h>\n\nconst char *username = \"username\";\nconst char *password = \"password\";\n\nSRP_VBASE *srpData = SRP_VBASE_new(NULL);\n\nSRP_gN *gN = SRP_get_default_gN(\"8192\");\n\nBIGNUM *salt = NULL, *verifier = NULL;\nSRP_create_verifier_BN_ex(username, password, &salt, &verifier, gN->N, gN->g,\n                          NULL, NULL);\n\nSRP_user_pwd *pwd = SRP_user_pwd_new();\nSRP_user_pwd_set1_ids(pwd, username, NULL);\nSRP_user_pwd_set0_sv(pwd, salt, verifier);\nSRP_user_pwd_set_gN(pwd, gN->g, gN->N);\n\nSRP_VBASE_add0_user(srpData, pwd);\n
                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          openssl-srp(1), SRP_VBASE_new(3), SRP_user_pwd_new(3)

                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/#history","title":"HISTORY","text":"

                                                                                                                                                          SRP_create_verifier_BN_ex() and SRP_create_verifier_ex() were introduced in OpenSSL 3.0. All other functions were added in OpenSSL 1.0.1.

                                                                                                                                                          All of these functions were deprecated in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SRP_create_verifier/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SRP_user_pwd_new/","title":"SRP_user_pwd_new","text":""},{"location":"man3/SRP_user_pwd_new/#name","title":"NAME","text":"

                                                                                                                                                          SRP_user_pwd_new, SRP_user_pwd_free, SRP_user_pwd_set1_ids, SRP_user_pwd_set_gN, SRP_user_pwd_set0_sv - Functions to create a record of SRP user verifier information

                                                                                                                                                          "},{"location":"man3/SRP_user_pwd_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/srp.h>\n

                                                                                                                                                          The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          SRP_user_pwd *SRP_user_pwd_new(void);\nvoid SRP_user_pwd_free(SRP_user_pwd *user_pwd);\n\nint SRP_user_pwd_set1_ids(SRP_user_pwd *user_pwd, const char *id, const char *info);\nvoid SRP_user_pwd_set_gN(SRP_user_pwd *user_pwd, const BIGNUM *g, const BIGNUM *N);\nint SRP_user_pwd_set0_sv(SRP_user_pwd *user_pwd, BIGNUM *s, BIGNUM *v);\n
                                                                                                                                                          "},{"location":"man3/SRP_user_pwd_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                                                                                                                                                          The SRP_user_pwd_new() function allocates a structure to store a user verifier record.

                                                                                                                                                          The SRP_user_pwd_free() function frees up the user_pwd structure. If user_pwd is NULL, nothing is done.

                                                                                                                                                          The SRP_user_pwd_set1_ids() function sets the username to id and the optional user info to info for user_pwd. The library allocates new copies of id and info, the caller still owns the original memory.

                                                                                                                                                          The SRP_user_pwd_set0_sv() function sets the user salt to s and the verifier to v for user_pwd. The library takes ownership of the values, they should not be freed by the caller.

                                                                                                                                                          The SRP_user_pwd_set_gN() function sets the SRP group parameters for user_pwd. The memory is not freed by SRP_user_pwd_free(), the caller must make sure it is freed once it is no longer used.

                                                                                                                                                          "},{"location":"man3/SRP_user_pwd_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SRP_user_pwd_set1_ids() returns 1 on success and 0 on failure or if id was NULL.

                                                                                                                                                          SRP_user_pwd_set0_sv() returns 1 if both s and v are not NULL, 0 otherwise.

                                                                                                                                                          "},{"location":"man3/SRP_user_pwd_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          openssl-srp(1), SRP_create_verifier(3), SRP_VBASE_new(3), SSL_CTX_set_srp_password(3)

                                                                                                                                                          "},{"location":"man3/SRP_user_pwd_new/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were made public in OpenSSL 3.0 and are deprecated.

                                                                                                                                                          "},{"location":"man3/SRP_user_pwd_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CIPHER_get_name/","title":"SSL_CIPHER_get_name","text":""},{"location":"man3/SSL_CIPHER_get_name/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CIPHER_get_name, SSL_CIPHER_standard_name, OPENSSL_cipher_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, SSL_CIPHER_description, SSL_CIPHER_get_cipher_nid, SSL_CIPHER_get_digest_nid, SSL_CIPHER_get_handshake_digest, SSL_CIPHER_get_kx_nid, SSL_CIPHER_get_auth_nid, SSL_CIPHER_is_aead, SSL_CIPHER_find, SSL_CIPHER_get_id, SSL_CIPHER_get_protocol_id - get SSL_CIPHER properties

                                                                                                                                                          "},{"location":"man3/SSL_CIPHER_get_name/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nconst char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);\nconst char *SSL_CIPHER_standard_name(const SSL_CIPHER *cipher);\nconst char *OPENSSL_cipher_name(const char *stdname);\nint SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);\nconst char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);\nchar *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size);\nint SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);\nint SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);\nconst EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);\nint SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);\nint SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);\nint SSL_CIPHER_is_aead(const SSL_CIPHER *c);\nconst SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr);\nuint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c);\nuint32_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c);\n
                                                                                                                                                          "},{"location":"man3/SSL_CIPHER_get_name/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CIPHER_get_name() returns a pointer to the name of cipher. If the cipher is NULL, it returns \"(NONE)\".

                                                                                                                                                          SSL_CIPHER_standard_name() returns a pointer to the standard RFC name of cipher. If the cipher is NULL, it returns \"(NONE)\". If the cipher has no standard name, it returns NULL. If cipher was defined in both SSLv3 and TLS, it returns the TLS name.

                                                                                                                                                          OPENSSL_cipher_name() returns a pointer to the OpenSSL name of stdname. If the stdname is NULL, or stdname has no corresponding OpenSSL name, it returns \"(NONE)\". Where both exist, stdname should be the TLS name rather than the SSLv3 name.

                                                                                                                                                          SSL_CIPHER_get_bits() returns the number of secret bits used for cipher. If cipher is NULL, 0 is returned.

                                                                                                                                                          SSL_CIPHER_get_version() returns string which indicates the SSL/TLS protocol version that first defined the cipher. It returns \"(NONE)\" if cipher is NULL.

                                                                                                                                                          SSL_CIPHER_get_cipher_nid() returns the cipher NID corresponding to c. If there is no cipher (e.g. for cipher suites with no encryption) then NID_undef is returned.

                                                                                                                                                          SSL_CIPHER_get_digest_nid() returns the digest NID corresponding to the MAC used by c during record encryption/decryption. If there is no digest (e.g. for AEAD cipher suites) then NID_undef is returned.

                                                                                                                                                          SSL_CIPHER_get_handshake_digest() returns an EVP_MD for the digest used during the SSL/TLS handshake when using the SSL_CIPHER c. Note that this may be different to the digest used to calculate the MAC for encrypted records.

                                                                                                                                                          SSL_CIPHER_get_kx_nid() returns the key exchange NID corresponding to the method used by c. If there is no key exchange, then NID_undef is returned. If any appropriate key exchange algorithm can be used (as in the case of TLS 1.3 cipher suites) NID_kx_any is returned. Examples (not comprehensive):

                                                                                                                                                          NID_kx_rsa\nNID_kx_ecdhe\nNID_kx_dhe\nNID_kx_psk\n

                                                                                                                                                          SSL_CIPHER_get_auth_nid() returns the authentication NID corresponding to the method used by c. If there is no authentication, then NID_undef is returned. If any appropriate authentication algorithm can be used (as in the case of TLS 1.3 cipher suites) NID_auth_any is returned. Examples (not comprehensive):

                                                                                                                                                          NID_auth_rsa\nNID_auth_ecdsa\nNID_auth_psk\n

                                                                                                                                                          SSL_CIPHER_is_aead() returns 1 if the cipher c is AEAD (e.g. GCM or ChaCha20/Poly1305), and 0 if it is not AEAD.

                                                                                                                                                          SSL_CIPHER_find() returns a SSL_CIPHER structure which has the cipher ID stored in ptr. The ptr parameter is a two element array of char, which stores the two-byte TLS cipher ID (as allocated by IANA) in network byte order. This parameter is usually retrieved from a TLS packet by using functions like SSL_client_hello_get0_ciphers(3). SSL_CIPHER_find() returns NULL if an error occurs or the indicated cipher is not found.

                                                                                                                                                          SSL_CIPHER_get_id() returns the OpenSSL-specific ID of the given cipher c. That ID is not the same as the IANA-specific ID.

                                                                                                                                                          SSL_CIPHER_get_protocol_id() returns the two-byte ID used in the TLS protocol of the given cipher c.

                                                                                                                                                          SSL_CIPHER_description() returns a textual description of the cipher used into the buffer buf of length len provided. If buf is provided, it must be at least 128 bytes. If buf is NULL it will be allocated using OPENSSL_malloc(). If the provided buffer is too small, or the allocation fails, NULL is returned.

                                                                                                                                                          The string returned by SSL_CIPHER_description() consists of several fields separated by whitespace:

                                                                                                                                                          • <ciphername>

                                                                                                                                                            Textual representation of the cipher name.

                                                                                                                                                          • <protocol version>

                                                                                                                                                            The minimum protocol version that the ciphersuite supports, such as TLSv1.2. Note that this is not always the same as the protocol version in which the ciphersuite was first defined because some ciphersuites are backwards compatible with earlier protocol versions.

                                                                                                                                                          • Kx=<key exchange>

                                                                                                                                                            Key exchange method such as RSA, ECDHE, etc.

                                                                                                                                                          • Au=<authentication>

                                                                                                                                                            Authentication method such as RSA, None, etc.. None is the representation of anonymous ciphers.

                                                                                                                                                          • Enc=<symmetric encryption method>

                                                                                                                                                            Encryption method, with number of secret bits, such as AESGCM(128).

                                                                                                                                                          • Mac=<message authentication code>

                                                                                                                                                            Message digest, such as SHA256.

                                                                                                                                                          Some examples for the output of SSL_CIPHER_description():

                                                                                                                                                          ECDHE-RSA-AES256-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD\nRSA-PSK-AES256-CBC-SHA384 TLSv1.0 Kx=RSAPSK   Au=RSA  Enc=AES(256)  Mac=SHA384\n
                                                                                                                                                          "},{"location":"man3/SSL_CIPHER_get_name/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CIPHER_get_name(), SSL_CIPHER_standard_name(), OPENSSL_cipher_name(), SSL_CIPHER_get_version() and SSL_CIPHER_description() return the corresponding value in a NUL-terminated string for a specific cipher or \"(NONE)\" if the cipher is not found.

                                                                                                                                                          SSL_CIPHER_get_bits() returns a positive integer representing the number of secret bits or 0 if an error occurred.

                                                                                                                                                          SSL_CIPHER_get_cipher_nid(), SSL_CIPHER_get_digest_nid(), SSL_CIPHER_get_kx_nid() and SSL_CIPHER_get_auth_nid() return the NID value or NID_undef if an error occurred.

                                                                                                                                                          SSL_CIPHER_get_handshake_digest() returns a valid EVP_MD structure or NULL if an error occurred.

                                                                                                                                                          SSL_CIPHER_is_aead() returns 1 if the cipher is AEAD or 0 otherwise.

                                                                                                                                                          SSL_CIPHER_find() returns a valid SSL_CIPHER structure or NULL if an error occurred.

                                                                                                                                                          SSL_CIPHER_get_id() returns a 4-byte integer representing the OpenSSL-specific ID.

                                                                                                                                                          SSL_CIPHER_get_protocol_id() returns a 2-byte integer representing the TLS protocol-specific ID.

                                                                                                                                                          "},{"location":"man3/SSL_CIPHER_get_name/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_get_current_cipher(3), SSL_get_ciphers(3), openssl-ciphers(1)

                                                                                                                                                          "},{"location":"man3/SSL_CIPHER_get_name/#history","title":"HISTORY","text":"

                                                                                                                                                          The SSL_CIPHER_get_version() function was updated to always return the correct protocol string in OpenSSL 1.1.0.

                                                                                                                                                          The SSL_CIPHER_description() function was changed to return NULL on error, rather than a fixed string, in OpenSSL 1.1.0.

                                                                                                                                                          The SSL_CIPHER_get_handshake_digest() function was added in OpenSSL 1.1.1.

                                                                                                                                                          The SSL_CIPHER_standard_name() function was globally available in OpenSSL 1.1.1. Before OpenSSL 1.1.1, tracing (enable-ssl-trace argument to Configure) was required to enable this function.

                                                                                                                                                          The OPENSSL_cipher_name() function was added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/SSL_CIPHER_get_name/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/","title":"SSL_COMP_add_compression_method","text":""},{"location":"man3/SSL_COMP_add_compression_method/#name","title":"NAME","text":"

                                                                                                                                                          SSL_COMP_add_compression_method, SSL_COMP_get_compression_methods, SSL_COMP_get0_name, SSL_COMP_get_id, SSL_COMP_free_compression_methods - handle SSL/TLS integrated compression methods

                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);\nSTACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);\nconst char *SSL_COMP_get0_name(const SSL_COMP *comp);\nint SSL_COMP_get_id(const SSL_COMP *comp);\n

                                                                                                                                                          The following function has been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                          void SSL_COMP_free_compression_methods(void);\n
                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_COMP_add_compression_method() adds the compression method cm with the identifier id to the list of available compression methods. This list is globally maintained for all SSL operations within this application. It cannot be set for specific SSL_CTX or SSL objects.

                                                                                                                                                          SSL_COMP_get_compression_methods() returns a stack of all of the available compression methods or NULL on error.

                                                                                                                                                          SSL_COMP_get0_name() returns the name of the compression method comp.

                                                                                                                                                          SSL_COMP_get_id() returns the id of the compression method comp.

                                                                                                                                                          SSL_COMP_free_compression_methods() releases any resources acquired to maintain the internal table of compression methods.

                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/#notes","title":"NOTES","text":"

                                                                                                                                                          The TLS standard (or SSLv3) allows the integration of compression methods into the communication. The TLS RFC does however not specify compression methods or their corresponding identifiers, so there is currently no compatible way to integrate compression with unknown peers. It is therefore currently not recommended to integrate compression into applications. Applications for non-public use may agree on certain compression methods. Using different compression methods with the same identifier will lead to connection failure.

                                                                                                                                                          An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) will unconditionally send the list of all compression methods enabled with SSL_COMP_add_compression_method() to the server during the handshake. Unlike the mechanisms to set a cipher list, there is no method available to restrict the list of compression method on a per connection basis.

                                                                                                                                                          An OpenSSL server will match the identifiers listed by a client against its own compression methods and will unconditionally activate compression when a matching identifier is found. There is no way to restrict the list of compression methods supported on a per connection basis.

                                                                                                                                                          If enabled during compilation, the OpenSSL library will have the COMP_zlib() compression method available.

                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_COMP_add_compression_method() may return the following values:

                                                                                                                                                          • 0

                                                                                                                                                            The operation succeeded.

                                                                                                                                                          • 1

                                                                                                                                                            The operation failed. Check the error queue to find out the reason.

                                                                                                                                                          SSL_COMP_get_compression_methods() returns the stack of compressions methods or NULL on error.

                                                                                                                                                          SSL_COMP_get0_name() returns the name of the compression method or NULL on error.

                                                                                                                                                          SSL_COMP_get_id() returns the name of the compression method or -1 on error.

                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7)

                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/#history","title":"HISTORY","text":"

                                                                                                                                                          The SSL_COMP_free_compression_methods() function was deprecated in OpenSSL 1.1.0. The SSL_COMP_get0_name() and SSL_comp_get_id() functions were added in OpenSSL 1.1.0d.

                                                                                                                                                          "},{"location":"man3/SSL_COMP_add_compression_method/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_new/","title":"SSL_CONF_CTX_new","text":""},{"location":"man3/SSL_CONF_CTX_new/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CONF_CTX_new, SSL_CONF_CTX_free - SSL configuration allocation functions

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nSSL_CONF_CTX *SSL_CONF_CTX_new(void);\nvoid SSL_CONF_CTX_free(SSL_CONF_CTX *cctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The function SSL_CONF_CTX_new() allocates and initialises an SSL_CONF_CTX structure for use with the SSL_CONF functions.

                                                                                                                                                          The function SSL_CONF_CTX_free() frees up the context cctx. If cctx is NULL nothing is done.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CONF_CTX_new() returns either the newly allocated SSL_CONF_CTX structure or NULL if an error occurs.

                                                                                                                                                          SSL_CONF_CTX_free() does not return a value.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/","title":"SSL_CONF_CTX_set1_prefix","text":""},{"location":"man3/SSL_CONF_CTX_set1_prefix/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CONF_CTX_set1_prefix - Set configuration context command prefix

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nunsigned int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *prefix);\n
                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The function SSL_CONF_CTX_set1_prefix() sets the command prefix of cctx to prefix. If prefix is NULL it is restored to the default value.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#notes","title":"NOTES","text":"

                                                                                                                                                          Command prefixes alter the commands recognised by subsequent SSL_CONF_cmd() calls. For example for files, if the prefix \"SSL\" is set then command names such as \"SSLProtocol\", \"SSLOptions\" etc. are recognised instead of \"Protocol\" and \"Options\". Similarly for command lines if the prefix is \"--ssl-\" then \"--ssl-no_tls1_2\" is recognised instead of \"-no_tls1_2\".

                                                                                                                                                          If the SSL_CONF_FLAG_CMDLINE flag is set then prefix checks are case sensitive and \"-\" is the default. In the unlikely even an application explicitly wants to set no prefix it must be explicitly set to \"\".

                                                                                                                                                          If the SSL_CONF_FLAG_FILE flag is set then prefix checks are case insensitive and no prefix is the default.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CONF_CTX_set1_prefix() returns 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set1_prefix/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/","title":"SSL_CONF_CTX_set_flags","text":""},{"location":"man3/SSL_CONF_CTX_set_flags/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CONF_CTX_set_flags, SSL_CONF_CTX_clear_flags - Set or clear SSL configuration context flags

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nunsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags);\nunsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, unsigned int flags);\n
                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The function SSL_CONF_CTX_set_flags() sets flags in the context cctx.

                                                                                                                                                          The function SSL_CONF_CTX_clear_flags() clears flags in the context cctx.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/#notes","title":"NOTES","text":"

                                                                                                                                                          The flags set affect how subsequent calls to SSL_CONF_cmd() or SSL_CONF_argv() behave.

                                                                                                                                                          Currently the following flags values are recognised:

                                                                                                                                                          • SSL_CONF_FLAG_CMDLINE, SSL_CONF_FLAG_FILE

                                                                                                                                                            recognise options intended for command line or configuration file use. At least one of these flags must be set.

                                                                                                                                                          • SSL_CONF_FLAG_CLIENT, SSL_CONF_FLAG_SERVER

                                                                                                                                                            recognise options intended for use in SSL/TLS clients or servers. One or both of these flags must be set.

                                                                                                                                                          • SSL_CONF_FLAG_CERTIFICATE

                                                                                                                                                            recognise certificate and private key options.

                                                                                                                                                          • SSL_CONF_FLAG_REQUIRE_PRIVATE

                                                                                                                                                            If this option is set then if a private key is not specified for a certificate it will attempt to load a private key from the certificate file when SSL_CONF_CTX_finish() is called. If a key cannot be loaded from the certificate file an error occurs.

                                                                                                                                                          • SSL_CONF_FLAG_SHOW_ERRORS

                                                                                                                                                            indicate errors relating to unrecognised options or missing arguments in the error queue. If this option isn't set such errors are only reflected in the return values of SSL_CONF_set_cmd() or SSL_CONF_set_argv()

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CONF_CTX_set_flags() and SSL_CONF_CTX_clear_flags() returns the new flags value after setting or clearing flags.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_flags/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/","title":"SSL_CONF_CTX_set_ssl_ctx","text":""},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CONF_CTX_finish, SSL_CONF_CTX_set_ssl_ctx, SSL_CONF_CTX_set_ssl - set context to configure

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx);\nvoid SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl);\nint SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CONF_CTX_set_ssl_ctx() sets the context associated with cctx to the SSL_CTX structure ctx. Any previous SSL or SSL_CTX associated with cctx is cleared. Subsequent calls to SSL_CONF_cmd() will be sent to ctx.

                                                                                                                                                          SSL_CONF_CTX_set_ssl() sets the context associated with cctx to the SSL structure ssl. Any previous SSL or SSL_CTX associated with cctx is cleared. Subsequent calls to SSL_CONF_cmd() will be sent to ssl.

                                                                                                                                                          The function SSL_CONF_CTX_finish() must be called after all configuration operations have been completed. It is used to finalise any operations or to process defaults.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#notes","title":"NOTES","text":"

                                                                                                                                                          The context need not be set or it can be set to NULL in which case only syntax checking of commands is performed, where possible.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CONF_CTX_set_ssl_ctx() and SSL_CTX_set_ssl() do not return a value.

                                                                                                                                                          SSL_CONF_CTX_finish() returns 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_cmd(3), SSL_CONF_cmd_argv(3)

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_CTX_set_ssl_ctx/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2012-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/","title":"SSL_CONF_cmd","text":""},{"location":"man3/SSL_CONF_cmd/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CONF_cmd_value_type, SSL_CONF_cmd - send configuration command

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CONF_cmd(SSL_CONF_CTX *ctx, const char *option, const char *value);\nint SSL_CONF_cmd_value_type(SSL_CONF_CTX *ctx, const char *option);\n
                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The function SSL_CONF_cmd() performs configuration operation option with optional parameter value on ctx. Its purpose is to simplify application configuration of SSL_CTX or SSL structures by providing a common framework for command line options or configuration files.

                                                                                                                                                          SSL_CONF_cmd_value_type() returns the type of value that option refers to.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#supported-command-line-commands","title":"SUPPORTED COMMAND LINE COMMANDS","text":"

                                                                                                                                                          Currently supported option names for command lines (i.e. when the flag SSL_CONF_FLAG_CMDLINE is set) are listed below. Note: all option names are case sensitive. Unless otherwise stated commands can be used by both clients and servers and the value parameter is not used. The default prefix for command line commands is - and that is reflected below.

                                                                                                                                                          • -bugs

                                                                                                                                                            Various bug workarounds are set, same as setting SSL_OP_ALL.

                                                                                                                                                          • -no_comp

                                                                                                                                                            Disables support for SSL/TLS compression, same as setting SSL_OP_NO_COMPRESSION. As of OpenSSL 1.1.0, compression is off by default.

                                                                                                                                                          • -comp

                                                                                                                                                            Enables support for SSL/TLS compression, same as clearing SSL_OP_NO_COMPRESSION. This command was introduced in OpenSSL 1.1.0. As of OpenSSL 1.1.0, compression is off by default.

                                                                                                                                                          • -no_ticket

                                                                                                                                                            Disables support for session tickets, same as setting SSL_OP_NO_TICKET.

                                                                                                                                                          • -serverpref

                                                                                                                                                            Use server and not client preference order when determining which cipher suite, signature algorithm or elliptic curve to use for an incoming connection. Equivalent to SSL_OP_CIPHER_SERVER_PREFERENCE. Only used by servers.

                                                                                                                                                          • -client_renegotiation

                                                                                                                                                            Allows servers to accept client-initiated renegotiation. Equivalent to setting SSL_OP_ALLOW_CLIENT_RENEGOTIATION. Only used by servers.

                                                                                                                                                          • -legacy_renegotiation

                                                                                                                                                            Permits the use of unsafe legacy renegotiation. Equivalent to setting SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION.

                                                                                                                                                          • -no_renegotiation

                                                                                                                                                            Disables all attempts at renegotiation in TLSv1.2 and earlier, same as setting SSL_OP_NO_RENEGOTIATION.

                                                                                                                                                          • -no_resumption_on_reneg

                                                                                                                                                            Sets SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION. Only used by servers.

                                                                                                                                                          • -legacy_server_connect, -no_legacy_server_connect

                                                                                                                                                            Permits or prohibits the use of unsafe legacy renegotiation for OpenSSL clients only. Equivalent to setting or clearing SSL_OP_LEGACY_SERVER_CONNECT.

                                                                                                                                                          • -prioritize_chacha

                                                                                                                                                            Prioritize ChaCha ciphers when the client has a ChaCha20 cipher at the top of its preference list. This usually indicates a client without AES hardware acceleration (e.g. mobile) is in use. Equivalent to SSL_OP_PRIORITIZE_CHACHA. Only used by servers. Requires -serverpref.

                                                                                                                                                          • -allow_no_dhe_kex

                                                                                                                                                            In TLSv1.3 allow a non-(ec)dhe based key exchange mode on resumption. This means that there will be no forward secrecy for the resumed session.

                                                                                                                                                          • -strict

                                                                                                                                                            Enables strict mode protocol handling. Equivalent to setting SSL_CERT_FLAG_TLS_STRICT.

                                                                                                                                                          • -sigalgs algs

                                                                                                                                                            This sets the supported signature algorithms for TLSv1.2 and TLSv1.3. For clients this value is used directly for the supported signature algorithms extension. For servers it is used to determine which signature algorithms to support.

                                                                                                                                                            The algs argument should be a colon separated list of signature algorithms in order of decreasing preference of the form algorithm+hash or signature_scheme. algorithm is one of RSA, DSA or ECDSA and hash is a supported algorithm OID short name such as SHA1, SHA224, SHA256, SHA384 of SHA512. Note: algorithm and hash names are case sensitive. signature_scheme is one of the signature schemes defined in TLSv1.3, specified using the IETF name, e.g., ecdsa_secp256r1_sha256, ed25519, or rsa_pss_pss_sha256.

                                                                                                                                                            If this option is not set then all signature algorithms supported by the OpenSSL library are permissible.

                                                                                                                                                            Note: algorithms which specify a PKCS#1 v1.5 signature scheme (either by using RSA as the algorithm or by using one of the rsa_pkcs1_* identifiers) are ignored in TLSv1.3 and will not be negotiated.

                                                                                                                                                          • -client_sigalgs algs

                                                                                                                                                            This sets the supported signature algorithms associated with client authentication for TLSv1.2 and TLSv1.3. For servers the algs is used in the signature_algorithms field of a CertificateRequest message. For clients it is used to determine which signature algorithm to use with the client certificate. If a server does not request a certificate this option has no effect.

                                                                                                                                                            The syntax of algs is identical to -sigalgs. If not set, then the value set for -sigalgs will be used instead.

                                                                                                                                                          • -groups groups

                                                                                                                                                            This sets the supported groups. For clients, the groups are sent using the supported groups extension. For servers, it is used to determine which group to use. This setting affects groups used for signatures (in TLSv1.2 and earlier) and key exchange. The first group listed will also be used for the key_share sent by a client in a TLSv1.3 ClientHello.

                                                                                                                                                            The groups argument is a colon separated list of groups. The group can be either the NIST name (e.g. P-256), some other commonly used name where applicable (e.g. X25519, ffdhe2048) or an OpenSSL OID name (e.g. prime256v1). Group names are case sensitive. The list should be in order of preference with the most preferred group first.

                                                                                                                                                            Currently supported groups for TLSv1.3 are P-256, P-384, P-521, X25519, X448, ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192.

                                                                                                                                                          • -curves groups

                                                                                                                                                            This is a synonym for the -groups command.

                                                                                                                                                          • -named_curve curve

                                                                                                                                                            This sets the temporary curve used for ephemeral ECDH modes. Only used by servers.

                                                                                                                                                            The groups argument is a curve name or the special value auto which picks an appropriate curve based on client and server preferences. The curve can be either the NIST name (e.g. P-256) or an OpenSSL OID name (e.g. prime256v1). Curve names are case sensitive.

                                                                                                                                                          • -cipher ciphers

                                                                                                                                                            Sets the TLSv1.2 and below ciphersuite list to ciphers. This list will be combined with any configured TLSv1.3 ciphersuites. Note: syntax checking of ciphers is currently not performed unless a SSL or SSL_CTX structure is associated with ctx.

                                                                                                                                                          • -ciphersuites 1.3ciphers

                                                                                                                                                            Sets the available ciphersuites for TLSv1.3 to value. This is a colon-separated list of TLSv1.3 ciphersuite names in order of preference. This list will be combined any configured TLSv1.2 and below ciphersuites. See openssl-ciphers(1) for more information.

                                                                                                                                                          • -min_protocol minprot, -max_protocol maxprot

                                                                                                                                                            Sets the minimum and maximum supported protocol. Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3 for TLS; DTLSv1, DTLSv1.2 for DTLS, and None for no limit. If either the lower or upper bound is not specified then only the other bound applies, if specified. If your application supports both TLS and DTLS you can specify any of these options twice, once with a bound for TLS and again with an appropriate bound for DTLS. To restrict the supported protocol versions use these commands rather than the deprecated alternative commands below.

                                                                                                                                                          • -record_padding padding

                                                                                                                                                            Attempts to pad TLSv1.3 records so that they are a multiple of padding in length on send. A padding of 0 or 1 turns off padding. Otherwise, the padding must be >1 or <=16384.

                                                                                                                                                          • -debug_broken_protocol

                                                                                                                                                            Ignored.

                                                                                                                                                          • -no_middlebox

                                                                                                                                                            Turn off \"middlebox compatibility\", as described below.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#additional-options","title":"Additional Options","text":"

                                                                                                                                                          The following options are accepted by SSL_CONF_cmd(), but are not processed by the OpenSSL commands.

                                                                                                                                                          • -cert file

                                                                                                                                                            Attempts to use file as the certificate for the appropriate context. It currently uses SSL_CTX_use_certificate_chain_file() if an SSL_CTX structure is set or SSL_use_certificate_file() with filetype PEM if an SSL structure is set. This option is only supported if certificate operations are permitted.

                                                                                                                                                          • -key file

                                                                                                                                                            Attempts to use file as the private key for the appropriate context. This option is only supported if certificate operations are permitted. Note: if no -key option is set then a private key is not loaded unless the flag SSL_CONF_FLAG_REQUIRE_PRIVATE is set.

                                                                                                                                                          • -dhparam file

                                                                                                                                                            Attempts to use file as the set of temporary DH parameters for the appropriate context. This option is only supported if certificate operations are permitted.

                                                                                                                                                          • -no_ssl3, -no_tls1, -no_tls1_1, -no_tls1_2, -no_tls1_3

                                                                                                                                                            Disables protocol support for SSLv3, TLSv1.0, TLSv1.1, TLSv1.2 or TLSv1.3 by setting the corresponding options SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2 and SSL_OP_NO_TLSv1_3 respectively. These options are deprecated, use -min_protocol and -max_protocol instead.

                                                                                                                                                          • -anti_replay, -no_anti_replay

                                                                                                                                                            Switches replay protection, on or off respectively. With replay protection on, OpenSSL will automatically detect if a session ticket has been used more than once, TLSv1.3 has been negotiated, and early data is enabled on the server. A full handshake is forced if a session ticket is used a second or subsequent time. Anti-Replay is on by default unless overridden by a configuration file and is only used by servers. Anti-replay measures are required for compliance with the TLSv1.3 specification. Some applications may be able to mitigate the replay risks in other ways and in such cases the built-in OpenSSL functionality is not required. Switching off anti-replay is equivalent to SSL_OP_NO_ANTI_REPLAY.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#supported-configuration-file-commands","title":"SUPPORTED CONFIGURATION FILE COMMANDS","text":"

                                                                                                                                                          Currently supported option names for configuration files (i.e., when the flag SSL_CONF_FLAG_FILE is set) are listed below. All configuration file option names are case insensitive so signaturealgorithms is recognised as well as SignatureAlgorithms. Unless otherwise stated the value names are also case insensitive.

                                                                                                                                                          Note: the command prefix (if set) alters the recognised option values.

                                                                                                                                                          • CipherString

                                                                                                                                                            Sets the ciphersuite list for TLSv1.2 and below to value. This list will be combined with any configured TLSv1.3 ciphersuites. Note: syntax checking of value is currently not performed unless an SSL or SSL_CTX structure is associated with ctx.

                                                                                                                                                          • Ciphersuites

                                                                                                                                                            Sets the available ciphersuites for TLSv1.3 to value. This is a colon-separated list of TLSv1.3 ciphersuite names in order of preference. This list will be combined any configured TLSv1.2 and below ciphersuites. See openssl-ciphers(1) for more information.

                                                                                                                                                          • Certificate

                                                                                                                                                            Attempts to use the file value as the certificate for the appropriate context. It currently uses SSL_CTX_use_certificate_chain_file() if an SSL_CTX structure is set or SSL_use_certificate_file() with filetype PEM if an SSL structure is set. This option is only supported if certificate operations are permitted.

                                                                                                                                                          • PrivateKey

                                                                                                                                                            Attempts to use the file value as the private key for the appropriate context. This option is only supported if certificate operations are permitted. Note: if no PrivateKey option is set then a private key is not loaded unless the SSL_CONF_FLAG_REQUIRE_PRIVATE is set.

                                                                                                                                                          • ChainCAFile, ChainCAPath, VerifyCAFile, VerifyCAPath

                                                                                                                                                            These options indicate a file or directory used for building certificate chains or verifying certificate chains. These options are only supported if certificate operations are permitted.

                                                                                                                                                          • RequestCAFile

                                                                                                                                                            This option indicates a file containing a set of certificates in PEM form. The subject names of the certificates are sent to the peer in the certificate_authorities extension for TLS 1.3 (in ClientHello or CertificateRequest) or in a certificate request for previous versions or TLS.

                                                                                                                                                          • ServerInfoFile

                                                                                                                                                            Attempts to use the file value in the \"serverinfo\" extension using the function SSL_CTX_use_serverinfo_file.

                                                                                                                                                          • DHParameters

                                                                                                                                                            Attempts to use the file value as the set of temporary DH parameters for the appropriate context. This option is only supported if certificate operations are permitted.

                                                                                                                                                          • RecordPadding

                                                                                                                                                            Attempts to pad TLSv1.3 records so that they are a multiple of value in length on send. A value of 0 or 1 turns off padding. Otherwise, the value must be >1 or <=16384.

                                                                                                                                                          • SignatureAlgorithms

                                                                                                                                                            This sets the supported signature algorithms for TLSv1.2 and TLSv1.3. For clients this value is used directly for the supported signature algorithms extension. For servers it is used to determine which signature algorithms to support.

                                                                                                                                                            The value argument should be a colon separated list of signature algorithms in order of decreasing preference of the form algorithm+hash or signature_scheme. algorithm is one of RSA, DSA or ECDSA and hash is a supported algorithm OID short name such as SHA1, SHA224, SHA256, SHA384 of SHA512. Note: algorithm and hash names are case sensitive. signature_scheme is one of the signature schemes defined in TLSv1.3, specified using the IETF name, e.g., ecdsa_secp256r1_sha256, ed25519, or rsa_pss_pss_sha256.

                                                                                                                                                            If this option is not set then all signature algorithms supported by the OpenSSL library are permissible.

                                                                                                                                                            Note: algorithms which specify a PKCS#1 v1.5 signature scheme (either by using RSA as the algorithm or by using one of the rsa_pkcs1_* identifiers) are ignored in TLSv1.3 and will not be negotiated.

                                                                                                                                                          • ClientSignatureAlgorithms

                                                                                                                                                            This sets the supported signature algorithms associated with client authentication for TLSv1.2 and TLSv1.3. For servers the value is used in the signature_algorithms field of a CertificateRequest message. For clients it is used to determine which signature algorithm to use with the client certificate. If a server does not request a certificate this option has no effect.

                                                                                                                                                            The syntax of value is identical to SignatureAlgorithms. If not set then the value set for SignatureAlgorithms will be used instead.

                                                                                                                                                          • Groups

                                                                                                                                                            This sets the supported groups. For clients, the groups are sent using the supported groups extension. For servers, it is used to determine which group to use. This setting affects groups used for signatures (in TLSv1.2 and earlier) and key exchange. The first group listed will also be used for the key_share sent by a client in a TLSv1.3 ClientHello.

                                                                                                                                                            The value argument is a colon separated list of groups. The group can be either the NIST name (e.g. P-256), some other commonly used name where applicable (e.g. X25519, ffdhe2048) or an OpenSSL OID name (e.g. prime256v1). Group names are case sensitive. The list should be in order of preference with the most preferred group first.

                                                                                                                                                            Currently supported groups for TLSv1.3 are P-256, P-384, P-521, X25519, X448, ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192.

                                                                                                                                                          • Curves

                                                                                                                                                            This is a synonym for the \"Groups\" command.

                                                                                                                                                          • MinProtocol

                                                                                                                                                            This sets the minimum supported SSL, TLS or DTLS version.

                                                                                                                                                            Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3, DTLSv1 and DTLSv1.2. The SSL and TLS bounds apply only to TLS-based contexts, while the DTLS bounds apply only to DTLS-based contexts. The command can be repeated with one instance setting a TLS bound, and the other setting a DTLS bound. The value None applies to both types of contexts and disables the limits.

                                                                                                                                                          • MaxProtocol

                                                                                                                                                            This sets the maximum supported SSL, TLS or DTLS version.

                                                                                                                                                            Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3, DTLSv1 and DTLSv1.2. The SSL and TLS bounds apply only to TLS-based contexts, while the DTLS bounds apply only to DTLS-based contexts. The command can be repeated with one instance setting a TLS bound, and the other setting a DTLS bound. The value None applies to both types of contexts and disables the limits.

                                                                                                                                                          • Protocol

                                                                                                                                                            This can be used to enable or disable certain versions of the SSL, TLS or DTLS protocol.

                                                                                                                                                            The value argument is a comma separated list of supported protocols to enable or disable. If a protocol is preceded by - that version is disabled.

                                                                                                                                                            All protocol versions are enabled by default. You need to disable at least one protocol version for this setting have any effect. Only enabling some protocol versions does not disable the other protocol versions.

                                                                                                                                                            Currently supported protocol values are SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3, DTLSv1 and DTLSv1.2. The special value ALL refers to all supported versions.

                                                                                                                                                            This can't enable protocols that are disabled using MinProtocol or MaxProtocol, but can disable protocols that are still allowed by them.

                                                                                                                                                            The Protocol command is fragile and deprecated; do not use it. Use MinProtocol and MaxProtocol instead. If you do use Protocol, make sure that the resulting range of enabled protocols has no \"holes\", e.g. if TLS 1.0 and TLS 1.2 are both enabled, make sure to also leave TLS 1.1 enabled.

                                                                                                                                                          • Options

                                                                                                                                                            The value argument is a comma separated list of various flags to set. If a flag string is preceded - it is disabled. See the SSL_CTX_set_options(3) function for more details of individual options.

                                                                                                                                                            Each option is listed below. Where an operation is enabled by default the -flag syntax is needed to disable it.

                                                                                                                                                            SessionTicket: session ticket support, enabled by default. Inverse of SSL_OP_NO_TICKET: that is -SessionTicket is the same as setting SSL_OP_NO_TICKET.

                                                                                                                                                            Compression: SSL/TLS compression support, disabled by default. Inverse of SSL_OP_NO_COMPRESSION.

                                                                                                                                                            EmptyFragments: use empty fragments as a countermeasure against a SSL 3.0/TLS 1.0 protocol vulnerability affecting CBC ciphers. It is set by default. Inverse of SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS.

                                                                                                                                                            Bugs: enable various bug workarounds. Same as SSL_OP_ALL.

                                                                                                                                                            DHSingle: enable single use DH keys, set by default. Inverse of SSL_OP_DH_SINGLE. Only used by servers.

                                                                                                                                                            ECDHSingle: enable single use ECDH keys, set by default. Inverse of SSL_OP_ECDH_SINGLE. Only used by servers.

                                                                                                                                                            ServerPreference: use server and not client preference order when determining which cipher suite, signature algorithm or elliptic curve to use for an incoming connection. Equivalent to SSL_OP_CIPHER_SERVER_PREFERENCE. Only used by servers.

                                                                                                                                                            PrioritizeChaCha: prioritizes ChaCha ciphers when the client has a ChaCha20 cipher at the top of its preference list. This usually indicates a mobile client is in use. Equivalent to SSL_OP_PRIORITIZE_CHACHA. Only used by servers.

                                                                                                                                                            NoResumptionOnRenegotiation: set SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION flag. Only used by servers.

                                                                                                                                                            NoRenegotiation: disables all attempts at renegotiation in TLSv1.2 and earlier, same as setting SSL_OP_NO_RENEGOTIATION.

                                                                                                                                                            UnsafeLegacyRenegotiation: permits the use of unsafe legacy renegotiation. Equivalent to SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION.

                                                                                                                                                            UnsafeLegacyServerConnect: permits the use of unsafe legacy renegotiation for OpenSSL clients only. Equivalent to SSL_OP_LEGACY_SERVER_CONNECT.

                                                                                                                                                            EncryptThenMac: use encrypt-then-mac extension, enabled by default. Inverse of SSL_OP_NO_ENCRYPT_THEN_MAC: that is, -EncryptThenMac is the same as setting SSL_OP_NO_ENCRYPT_THEN_MAC.

                                                                                                                                                            AllowNoDHEKEX: In TLSv1.3 allow a non-(ec)dhe based key exchange mode on resumption. This means that there will be no forward secrecy for the resumed session. Equivalent to SSL_OP_ALLOW_NO_DHE_KEX.

                                                                                                                                                            MiddleboxCompat: If set then dummy Change Cipher Spec (CCS) messages are sent in TLSv1.3. This has the effect of making TLSv1.3 look more like TLSv1.2 so that middleboxes that do not understand TLSv1.3 will not drop the connection. This option is set by default. A future version of OpenSSL may not set this by default. Equivalent to SSL_OP_ENABLE_MIDDLEBOX_COMPAT.

                                                                                                                                                            AntiReplay: If set then OpenSSL will automatically detect if a session ticket has been used more than once, TLSv1.3 has been negotiated, and early data is enabled on the server. A full handshake is forced if a session ticket is used a second or subsequent time. This option is set by default and is only used by servers. Anti-replay measures are required to comply with the TLSv1.3 specification. Some applications may be able to mitigate the replay risks in other ways and in such cases the built-in OpenSSL functionality is not required. Disabling anti-replay is equivalent to setting SSL_OP_NO_ANTI_REPLAY.

                                                                                                                                                            ExtendedMasterSecret: use extended master secret extension, enabled by default. Inverse of SSL_OP_NO_EXTENDED_MASTER_SECRET: that is, -ExtendedMasterSecret is the same as setting SSL_OP_NO_EXTENDED_MASTER_SECRET.

                                                                                                                                                            CANames: use CA names extension, enabled by default. Inverse of SSL_OP_DISABLE_TLSEXT_CA_NAMES: that is, -CANames is the same as setting SSL_OP_DISABLE_TLSEXT_CA_NAMES.

                                                                                                                                                            KTLS: Enables kernel TLS if support has been compiled in, and it is supported by the negotiated ciphersuites and extensions. Equivalent to SSL_OP_ENABLE_KTLS.

                                                                                                                                                          • VerifyMode

                                                                                                                                                            The value argument is a comma separated list of flags to set.

                                                                                                                                                            Peer enables peer verification: for clients only.

                                                                                                                                                            Request requests but does not require a certificate from the client. Servers only.

                                                                                                                                                            Require requests and requires a certificate from the client: an error occurs if the client does not present a certificate. Servers only.

                                                                                                                                                            Once requests a certificate from a client only on the initial connection: not when renegotiating. Servers only.

                                                                                                                                                            RequestPostHandshake configures the connection to support requests but does not require a certificate from the client post-handshake. A certificate will not be requested during the initial handshake. The server application must provide a mechanism to request a certificate post-handshake. Servers only. TLSv1.3 only.

                                                                                                                                                            RequiresPostHandshake configures the connection to support requests and requires a certificate from the client post-handshake: an error occurs if the client does not present a certificate. A certificate will not be requested during the initial handshake. The server application must provide a mechanism to request a certificate post-handshake. Servers only. TLSv1.3 only.

                                                                                                                                                          • ClientCAFile, ClientCAPath

                                                                                                                                                            A file or directory of certificates in PEM format whose names are used as the set of acceptable names for client CAs. Servers only. This option is only supported if certificate operations are permitted.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#supported-command-types","title":"SUPPORTED COMMAND TYPES","text":"

                                                                                                                                                          The function SSL_CONF_cmd_value_type() currently returns one of the following types:

                                                                                                                                                          • SSL_CONF_TYPE_UNKNOWN

                                                                                                                                                            The option string is unrecognised, this return value can be use to flag syntax errors.

                                                                                                                                                          • SSL_CONF_TYPE_STRING

                                                                                                                                                            The value is a string without any specific structure.

                                                                                                                                                          • SSL_CONF_TYPE_FILE

                                                                                                                                                            The value is a filename.

                                                                                                                                                          • SSL_CONF_TYPE_DIR

                                                                                                                                                            The value is a directory name.

                                                                                                                                                          • SSL_CONF_TYPE_NONE

                                                                                                                                                            The value string is not used e.g. a command line option which doesn't take an argument.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#notes","title":"NOTES","text":"

                                                                                                                                                          The order of operations is significant. This can be used to set either defaults or values which cannot be overridden. For example if an application calls:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"Protocol\", \"-SSLv3\");\nSSL_CONF_cmd(ctx, userparam, uservalue);\n

                                                                                                                                                          it will disable SSLv3 support by default but the user can override it. If however the call sequence is:

                                                                                                                                                          SSL_CONF_cmd(ctx, userparam, uservalue);\nSSL_CONF_cmd(ctx, \"Protocol\", \"-SSLv3\");\n

                                                                                                                                                          SSLv3 is always disabled and attempt to override this by the user are ignored.

                                                                                                                                                          By checking the return code of SSL_CONF_cmd() it is possible to query if a given option is recognised, this is useful if SSL_CONF_cmd() values are mixed with additional application specific operations.

                                                                                                                                                          For example an application might call SSL_CONF_cmd() and if it returns -2 (unrecognised command) continue with processing of application specific commands.

                                                                                                                                                          Applications can also use SSL_CONF_cmd() to process command lines though the utility function SSL_CONF_cmd_argv() is normally used instead. One way to do this is to set the prefix to an appropriate value using SSL_CONF_CTX_set1_prefix(), pass the current argument to option and the following argument to value (which may be NULL).

                                                                                                                                                          In this case if the return value is positive then it is used to skip that number of arguments as they have been processed by SSL_CONF_cmd(). If -2 is returned then option is not recognised and application specific arguments can be checked instead. If -3 is returned a required argument is missing and an error is indicated. If 0 is returned some other error occurred and this can be reported back to the user.

                                                                                                                                                          The function SSL_CONF_cmd_value_type() can be used by applications to check for the existence of a command or to perform additional syntax checking or translation of the command value. For example if the return value is SSL_CONF_TYPE_FILE an application could translate a relative pathname to an absolute pathname.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CONF_cmd() returns 1 if the value of option is recognised and value is NOT used and 2 if both option and value are used. In other words it returns the number of arguments processed. This is useful when processing command lines.

                                                                                                                                                          A return value of -2 means option is not recognised.

                                                                                                                                                          A return value of -3 means option is recognised and the command requires a value but value is NULL.

                                                                                                                                                          A return code of 0 indicates that both option and value are valid but an error occurred attempting to perform the operation: for example due to an error in the syntax of value in this case the error queue may provide additional information.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Set supported signature algorithms:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"SignatureAlgorithms\", \"ECDSA+SHA256:RSA+SHA256:DSA+SHA256\");\n

                                                                                                                                                          There are various ways to select the supported protocols.

                                                                                                                                                          This set the minimum protocol version to TLSv1, and so disables SSLv3. This is the recommended way to disable protocols.

                                                                                                                                                          SSL_CONF_cmd(ctx, \"MinProtocol\", \"TLSv1\");\n

                                                                                                                                                          The following also disables SSLv3:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"Protocol\", \"-SSLv3\");\n

                                                                                                                                                          The following will first enable all protocols, and then disable SSLv3. If no protocol versions were disabled before this has the same effect as \"-SSLv3\", but if some versions were disables this will re-enable them before disabling SSLv3.

                                                                                                                                                          SSL_CONF_cmd(ctx, \"Protocol\", \"ALL,-SSLv3\");\n

                                                                                                                                                          Only enable TLSv1.2:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"MinProtocol\", \"TLSv1.2\");\nSSL_CONF_cmd(ctx, \"MaxProtocol\", \"TLSv1.2\");\n

                                                                                                                                                          This also only enables TLSv1.2:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"Protocol\", \"-ALL,TLSv1.2\");\n

                                                                                                                                                          Disable TLS session tickets:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"Options\", \"-SessionTicket\");\n

                                                                                                                                                          Enable compression:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"Options\", \"Compression\");\n

                                                                                                                                                          Set supported curves to P-256, P-384:

                                                                                                                                                          SSL_CONF_cmd(ctx, \"Curves\", \"P-256:P-384\");\n
                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_cmd_argv(3), SSL_CTX_set_options(3)

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#history","title":"HISTORY","text":"

                                                                                                                                                          The SSL_CONF_cmd() function was added in OpenSSL 1.0.2.

                                                                                                                                                          The SSL_OP_NO_SSL2 option doesn't have effect since 1.1.0, but the macro is retained for backwards compatibility.

                                                                                                                                                          The SSL_CONF_TYPE_NONE was added in OpenSSL 1.1.0. In earlier versions of OpenSSL passing a command which didn't take an argument would return SSL_CONF_TYPE_UNKNOWN.

                                                                                                                                                          MinProtocol and MaxProtocol where added in OpenSSL 1.1.0.

                                                                                                                                                          AllowNoDHEKEX and PrioritizeChaCha were added in OpenSSL 1.1.1.

                                                                                                                                                          The UnsafeLegacyServerConnect option is no longer set by default from OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2012-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd_argv/","title":"SSL_CONF_cmd_argv","text":""},{"location":"man3/SSL_CONF_cmd_argv/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CONF_cmd_argv - SSL configuration command line processing

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd_argv/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv);\n
                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd_argv/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The function SSL_CONF_cmd_argv() processes at most two command line arguments from pargv and pargc. The values of pargv and pargc are updated to reflect the number of command options processed. The pargc argument can be set to NULL if it is not used.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd_argv/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CONF_cmd_argv() returns the number of command arguments processed: 0, 1, 2 or a negative error code.

                                                                                                                                                          If -2 is returned then an argument for a command is missing.

                                                                                                                                                          If -1 is returned the command is recognised but couldn't be processed due to an error: for example a syntax error in the argument.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd_argv/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CONF_CTX_new(3), SSL_CONF_CTX_set_flags(3), SSL_CONF_CTX_set1_prefix(3), SSL_CONF_CTX_set_ssl_ctx(3), SSL_CONF_cmd(3)

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd_argv/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CONF_cmd_argv/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/","title":"SSL_CTX_add1_chain_cert","text":""},{"location":"man3/SSL_CTX_add1_chain_cert/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set0_chain, SSL_CTX_set1_chain, SSL_CTX_add0_chain_cert, SSL_CTX_add1_chain_cert, SSL_CTX_get0_chain_certs, SSL_CTX_clear_chain_certs, SSL_set0_chain, SSL_set1_chain, SSL_add0_chain_cert, SSL_add1_chain_cert, SSL_get0_chain_certs, SSL_clear_chain_certs, SSL_CTX_build_cert_chain, SSL_build_cert_chain, SSL_CTX_select_current_cert, SSL_select_current_cert, SSL_CTX_set_current_cert, SSL_set_current_cert - extra chain certificate processing

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_set0_chain(SSL_CTX *ctx, STACK_OF(X509) *sk);\nint SSL_CTX_set1_chain(SSL_CTX *ctx, STACK_OF(X509) *sk);\nint SSL_CTX_add0_chain_cert(SSL_CTX *ctx, X509 *x509);\nint SSL_CTX_add1_chain_cert(SSL_CTX *ctx, X509 *x509);\nint SSL_CTX_get0_chain_certs(SSL_CTX *ctx, STACK_OF(X509) **sk);\nint SSL_CTX_clear_chain_certs(SSL_CTX *ctx);\n\nint SSL_set0_chain(SSL *ssl, STACK_OF(X509) *sk);\nint SSL_set1_chain(SSL *ssl, STACK_OF(X509) *sk);\nint SSL_add0_chain_cert(SSL *ssl, X509 *x509);\nint SSL_add1_chain_cert(SSL *ssl, X509 *x509);\nint SSL_get0_chain_certs(SSL *ssl, STACK_OF(X509) **sk);\nint SSL_clear_chain_certs(SSL *ssl);\n\nint SSL_CTX_build_cert_chain(SSL_CTX *ctx, flags);\nint SSL_build_cert_chain(SSL *ssl, flags);\n\nint SSL_CTX_select_current_cert(SSL_CTX *ctx, X509 *x509);\nint SSL_select_current_cert(SSL *ssl, X509 *x509);\nint SSL_CTX_set_current_cert(SSL_CTX *ctx, long op);\nint SSL_set_current_cert(SSL *ssl, long op);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set0_chain() and SSL_CTX_set1_chain() set the certificate chain associated with the current certificate of ctx to sk.

                                                                                                                                                          SSL_CTX_add0_chain_cert() and SSL_CTX_add1_chain_cert() append the single certificate x509 to the chain associated with the current certificate of ctx.

                                                                                                                                                          SSL_CTX_get0_chain_certs() retrieves the chain associated with the current certificate of ctx.

                                                                                                                                                          SSL_CTX_clear_chain_certs() clears any existing chain associated with the current certificate of ctx. (This is implemented by calling SSL_CTX_set0_chain() with sk set to NULL).

                                                                                                                                                          SSL_CTX_build_cert_chain() builds the certificate chain for ctx. Normally this uses the chain store or the verify store if the chain store is not set. If the function is successful the built chain will replace any existing chain. The flags parameter can be set to SSL_BUILD_CHAIN_FLAG_UNTRUSTED to use existing chain certificates as untrusted CAs, SSL_BUILD_CHAIN_FLAG_NO_ROOT to omit the root CA from the built chain, SSL_BUILD_CHAIN_FLAG_CHECK to use all existing chain certificates only to build the chain (effectively sanity checking and rearranging them if necessary), the flag SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR ignores any errors during verification: if flag SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR is also set verification errors are cleared from the error queue. Details of the chain building process are described in \"Certification Path Building\" in openssl-verification-options(1).

                                                                                                                                                          Each of these functions operates on the current end entity (i.e. server or client) certificate. This is the last certificate loaded or selected on the corresponding ctx structure.

                                                                                                                                                          SSL_CTX_select_current_cert() selects x509 as the current end entity certificate, but only if x509 has already been loaded into ctx using a function such as SSL_CTX_use_certificate().

                                                                                                                                                          SSL_set0_chain(), SSL_set1_chain(), SSL_add0_chain_cert(), SSL_add1_chain_cert(), SSL_get0_chain_certs(), SSL_clear_chain_certs(), SSL_build_cert_chain(), SSL_select_current_cert() and SSL_set_current_cert() are similar except they apply to SSL structure ssl.

                                                                                                                                                          SSL_CTX_set_current_cert() changes the current certificate to a value based on the op argument. Currently op can be SSL_CERT_SET_FIRST to use the first valid certificate or SSL_CERT_SET_NEXT to set the next valid certificate after the current certificate. These two operations can be used to iterate over all certificates in an SSL_CTX structure.

                                                                                                                                                          SSL_set_current_cert() also supports the option SSL_CERT_SET_SERVER. If ssl is a server and has sent a certificate to a connected client this option sets that certificate to the current certificate and returns 1. If the negotiated cipher suite is anonymous (and thus no certificate will be sent) 2 is returned and the current certificate is unchanged. If ssl is not a server or a certificate has not been sent 0 is returned and the current certificate is unchanged.

                                                                                                                                                          All these functions are implemented as macros. Those containing a 1 increment the reference count of the supplied certificate or chain so it must be freed at some point after the operation. Those containing a 0 do not increment reference counts and the supplied certificate or chain MUST NOT be freed after the operation.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/#notes","title":"NOTES","text":"

                                                                                                                                                          The chains associate with an SSL_CTX structure are copied to any SSL structures when SSL_new() is called. SSL structures will not be affected by any chains subsequently changed in the parent SSL_CTX.

                                                                                                                                                          One chain can be set for each key type supported by a server. So, for example, an RSA and a DSA certificate can (and often will) have different chains.

                                                                                                                                                          The functions SSL_CTX_build_cert_chain() and SSL_build_cert_chain() can be used to check application configuration and to ensure any necessary subordinate CAs are sent in the correct order. Misconfigured applications sending incorrect certificate chains often cause problems with peers.

                                                                                                                                                          For example an application can add any set of certificates using SSL_CTX_use_certificate_chain_file() then call SSL_CTX_build_cert_chain() with the option SSL_BUILD_CHAIN_FLAG_CHECK to check and reorder them.

                                                                                                                                                          Applications can issue non fatal warnings when checking chains by setting the flag SSL_BUILD_CHAIN_FLAG_IGNORE_ERRORS and checking the return value.

                                                                                                                                                          Calling SSL_CTX_build_cert_chain() or SSL_build_cert_chain() is more efficient than the automatic chain building as it is only performed once. Automatic chain building is performed on each new session.

                                                                                                                                                          If any certificates are added using these functions no certificates added using SSL_CTX_add_extra_chain_cert() will be used.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_set_current_cert() with SSL_CERT_SET_SERVER return 1 for success, 2 if no server certificate is used because the cipher suites is anonymous and 0 for failure.

                                                                                                                                                          SSL_CTX_build_cert_chain() and SSL_build_cert_chain() return 1 for success and 0 for failure. If the flag SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR and a verification error occurs then 2 is returned.

                                                                                                                                                          All other functions return 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_add_extra_chain_cert(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add1_chain_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/","title":"SSL_CTX_add_extra_chain_cert","text":""},{"location":"man3/SSL_CTX_add_extra_chain_cert/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_add_extra_chain_cert, SSL_CTX_get_extra_chain_certs, SSL_CTX_get_extra_chain_certs_only, SSL_CTX_clear_extra_chain_certs - add, get or clear extra chain certificates

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nlong SSL_CTX_add_extra_chain_cert(SSL_CTX *ctx, X509 *x509);\nlong SSL_CTX_get_extra_chain_certs(SSL_CTX *ctx, STACK_OF(X509) **sk);\nlong SSL_CTX_get_extra_chain_certs_only(SSL_CTX *ctx, STACK_OF(X509) **sk);\nlong SSL_CTX_clear_extra_chain_certs(SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_add_extra_chain_cert() adds the certificate x509 to the extra chain certificates associated with ctx. Several certificates can be added one after another.

                                                                                                                                                          SSL_CTX_get_extra_chain_certs() retrieves the extra chain certificates associated with ctx, or the chain associated with the current certificate of ctx if the extra chain is empty. The returned stack should not be freed by the caller.

                                                                                                                                                          SSL_CTX_get_extra_chain_certs_only() retrieves the extra chain certificates associated with ctx. The returned stack should not be freed by the caller.

                                                                                                                                                          SSL_CTX_clear_extra_chain_certs() clears all extra chain certificates associated with ctx.

                                                                                                                                                          These functions are implemented as macros.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#notes","title":"NOTES","text":"

                                                                                                                                                          When sending a certificate chain, extra chain certificates are sent in order following the end entity certificate.

                                                                                                                                                          If no chain is specified, the library will try to complete the chain from the available CA certificates in the trusted CA storage, see SSL_CTX_load_verify_locations(3).

                                                                                                                                                          The x509 certificate provided to SSL_CTX_add_extra_chain_cert() will be freed by the library when the SSL_CTX is destroyed. An application should not free the x509 object.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#restrictions","title":"RESTRICTIONS","text":"

                                                                                                                                                          Only one set of extra chain certificates can be specified per SSL_CTX structure. Different chains for different certificates (for example if both RSA and DSA certificates are specified by the same server) or different SSL structures with the same parent SSL_CTX cannot be specified using this function. For more flexibility functions such as SSL_add1_chain_cert() should be used instead.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_add_extra_chain_cert() and SSL_CTX_clear_extra_chain_certs() return 1 on success and 0 for failure. Check out the error stack to find out the reason for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_use_certificate(3), SSL_CTX_set_client_cert_cb(3), SSL_CTX_load_verify_locations(3) SSL_CTX_set0_chain(3) SSL_CTX_set1_chain(3) SSL_CTX_add0_chain_cert(3) SSL_CTX_add1_chain_cert(3) SSL_set0_chain(3) SSL_set1_chain(3) SSL_add0_chain_cert(3) SSL_add1_chain_cert(3) SSL_CTX_build_cert_chain(3) SSL_build_cert_chain(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_extra_chain_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_session/","title":"SSL_CTX_add_session","text":""},{"location":"man3/SSL_CTX_add_session/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_add_session, SSL_CTX_remove_session - manipulate session cache

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_session/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);\n\nint SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_session/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_add_session() adds the session c to the context ctx. The reference count for session c is incremented by 1. If a session with the same session id already exists, the old session is removed by calling SSL_SESSION_free(3).

                                                                                                                                                          SSL_CTX_remove_session() removes the session c from the context ctx and marks it as non-resumable. SSL_SESSION_free(3) is called once for c.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_session/#notes","title":"NOTES","text":"

                                                                                                                                                          When adding a new session to the internal session cache, it is examined whether a session with the same session id already exists. In this case it is assumed that both sessions are identical. If the same session is stored in a different SSL_SESSION object, The old session is removed and replaced by the new session. If the session is actually identical (the SSL_SESSION object is identical), SSL_CTX_add_session() is a no-op, and the return value is 0.

                                                                                                                                                          If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE flag then the internal cache will not be populated automatically by new sessions negotiated by the SSL/TLS implementation, even though the internal cache will be searched automatically for session-resume requests (the latter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the application can use SSL_CTX_add_session() directly to have full control over the sessions that can be resumed if desired.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_session/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The following values are returned by all functions:

                                                                                                                                                          • 0

                                                                                                                                                            The operation failed. In case of the add operation, it was tried to add the same (identical) session twice. In case of the remove operation, the session was not found in the cache.

                                                                                                                                                          • 1

                                                                                                                                                            The operation succeeded.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_session/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_free(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_add_session/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/","title":"SSL_CTX_config","text":""},{"location":"man3/SSL_CTX_config/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_config, SSL_config - configure SSL_CTX or SSL structure

                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_config(SSL_CTX *ctx, const char *name);\nint SSL_config(SSL *s, const char *name);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The functions SSL_CTX_config() and SSL_config() configure an SSL_CTX or SSL structure using the configuration name.

                                                                                                                                                          By calling SSL_CTX_config() or SSL_config() an application can perform many complex tasks based on the contents of the configuration file: greatly simplifying application configuration code. A degree of future proofing can also be achieved: an application can support configuration features in newer versions of OpenSSL automatically.

                                                                                                                                                          A configuration file must have been previously loaded, for example using CONF_modules_load_file(). See config(5) for details of the configuration file syntax.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error occurred.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          If the file \"config.cnf\" contains the following:

                                                                                                                                                          testapp = test_sect\n\n[test_sect]\n

                                                                                                                                                          # # list of configuration modules

                                                                                                                                                          ssl_conf = ssl_sect\n\n[ssl_sect]\nserver = server_section\n\n[server_section]\nRSA.Certificate = server-rsa.pem\nECDSA.Certificate = server-ecdsa.pem\nCiphers = ALL:!RC4\n

                                                                                                                                                          An application could call:

                                                                                                                                                          if (CONF_modules_load_file(\"config.cnf\", \"testapp\", 0) <= 0) {\n    fprintf(stderr, \"Error processing config file\\n\");\n    goto err;\n}\n\nctx = SSL_CTX_new(TLS_server_method());\n\nif (SSL_CTX_config(ctx, \"server\") == 0) {\n    fprintf(stderr, \"Error configuring server.\\n\");\n    goto err;\n}\n

                                                                                                                                                          In this example two certificates and the cipher list are configured without the need for any additional application code.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), config(5), SSL_CONF_cmd(3), CONF_modules_load_file(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/#history","title":"HISTORY","text":"

                                                                                                                                                          The SSL_CTX_config() and SSL_config() functions were added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_config/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_ctrl/","title":"SSL_CTX_ctrl","text":""},{"location":"man3/SSL_CTX_ctrl/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_ctrl, SSL_CTX_callback_ctrl, SSL_ctrl, SSL_callback_ctrl - internal handling functions for SSL_CTX and SSL objects

                                                                                                                                                          "},{"location":"man3/SSL_CTX_ctrl/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nlong SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg);\nlong SSL_CTX_callback_ctrl(SSL_CTX *, int cmd, void (*fp)());\n\nlong SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg);\nlong SSL_callback_ctrl(SSL *, int cmd, void (*fp)());\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_ctrl/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The SSL_*_ctrl() family of functions is used to manipulate settings of the SSL_CTX and SSL objects. Depending on the command cmd the arguments larg, parg, or fp are evaluated. These functions should never be called directly. All functionalities needed are made available via other functions or macros.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_ctrl/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The return values of the SSL*_ctrl() functions depend on the command supplied via the cmd parameter.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_ctrl/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_ctrl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/","title":"SSL_CTX_dane_enable","text":""},{"location":"man3/SSL_CTX_dane_enable/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_dane_enable, SSL_CTX_dane_mtype_set, SSL_dane_enable, SSL_dane_tlsa_add, SSL_get0_dane_authority, SSL_get0_dane_tlsa, SSL_CTX_dane_set_flags, SSL_CTX_dane_clear_flags, SSL_dane_set_flags, SSL_dane_clear_flags - enable DANE TLS authentication of the remote TLS server in the local TLS client

                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_dane_enable(SSL_CTX *ctx);\nint SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md,\n                           uint8_t mtype, uint8_t ord);\nint SSL_dane_enable(SSL *s, const char *basedomain);\nint SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector,\n                      uint8_t mtype, const unsigned char *data, size_t dlen);\nint SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki);\nint SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector,\n                       uint8_t *mtype, const unsigned char **data,\n                       size_t *dlen);\nunsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags);\nunsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags);\nunsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags);\nunsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          These functions implement support for DANE TLSA (RFC6698 and RFC7671) peer authentication.

                                                                                                                                                          SSL_CTX_dane_enable() must be called first to initialize the shared state required for DANE support. Individual connections associated with the context can then enable per-connection DANE support as appropriate. DANE authentication is implemented in the X509_verify_cert(3) function, and applications that override X509_verify_cert(3) via SSL_CTX_set_cert_verify_callback(3) are responsible to authenticate the peer chain in whatever manner they see fit.

                                                                                                                                                          SSL_CTX_dane_mtype_set() may then be called zero or more times to adjust the supported digest algorithms. This must be done before any SSL handles are created for the context.

                                                                                                                                                          The mtype argument specifies a DANE TLSA matching type and the md argument specifies the associated digest algorithm handle. The ord argument specifies a strength ordinal. Algorithms with a larger strength ordinal are considered more secure. Strength ordinals are used to implement RFC7671 digest algorithm agility. Specifying a NULL digest algorithm for a matching type disables support for that matching type. Matching type Full(0) cannot be modified or disabled.

                                                                                                                                                          By default, matching type SHA2-256(1) (see RFC7218 for definitions of the DANE TLSA parameter acronyms) is mapped to EVP_sha256() with a strength ordinal of 1 and matching type SHA2-512(2) is mapped to EVP_sha512() with a strength ordinal of 2.

                                                                                                                                                          SSL_dane_enable() must be called before the SSL handshake is initiated with SSL_connect(3) if (and only if) you want to enable DANE for that connection. (The connection must be associated with a DANE-enabled SSL context). The basedomain argument specifies the RFC7671 TLSA base domain, which will be the primary peer reference identifier for certificate name checks. Additional server names can be specified via SSL_add1_host(3). The basedomain is used as the default SNI hint if none has yet been specified via SSL_set_tlsext_host_name(3).

                                                                                                                                                          SSL_dane_tlsa_add() may then be called one or more times, to load each of the TLSA records that apply to the remote TLS peer. (This too must be done prior to the beginning of the SSL handshake). The arguments specify the fields of the TLSA record. The data field is provided in binary (wire RDATA) form, not the hexadecimal ASCII presentation form, with an explicit length passed via dlen. The library takes a copy of the data buffer contents and the caller may free the original data buffer when convenient. A return value of 0 indicates that \"unusable\" TLSA records (with invalid or unsupported parameters) were provided. A negative return value indicates an internal error in processing the record.

                                                                                                                                                          The caller is expected to check the return value of each SSL_dane_tlsa_add() call and take appropriate action if none are usable or an internal error is encountered in processing some records.

                                                                                                                                                          If no TLSA records are added successfully, DANE authentication is not enabled, and authentication will be based on any configured traditional trust-anchors; authentication success in this case does not mean that the peer was DANE-authenticated.

                                                                                                                                                          SSL_get0_dane_authority() can be used to get more detailed information about the matched DANE trust-anchor after successful connection completion. The return value is negative if DANE verification failed (or was not enabled), 0 if an EE TLSA record directly matched the leaf certificate, or a positive number indicating the depth at which a TA record matched an issuer certificate. The complete verified chain can be retrieved via SSL_get0_verified_chain(3). The return value is an index into this verified chain, rather than the list of certificates sent by the peer as returned by SSL_get_peer_cert_chain(3).

                                                                                                                                                          If the mcert argument is not NULL and a TLSA record matched a chain certificate, a pointer to the matching certificate is returned via mcert. The returned address is a short-term internal reference to the certificate and must not be freed by the application. Applications that want to retain access to the certificate can call X509_up_ref(3) to obtain a long-term reference which must then be freed via X509_free(3) once no longer needed.

                                                                                                                                                          If no TLSA records directly matched any elements of the certificate chain, but a DANE-TA(2) SPKI(1) Full(0) record provided the public key that signed an element of the chain, then that key is returned via mspki argument (if not NULL). In this case the return value is the depth of the top-most element of the validated certificate chain. As with mcert this is a short-term internal reference, and EVP_PKEY_up_ref(3) and EVP_PKEY_free(3) can be used to acquire and release long-term references respectively.

                                                                                                                                                          SSL_get0_dane_tlsa() can be used to retrieve the fields of the TLSA record that matched the peer certificate chain. The return value indicates the match depth or failure to match just as with SSL_get0_dane_authority(). When the return value is nonnegative, the storage pointed to by the usage, selector, mtype and data parameters is updated to the corresponding TLSA record fields. The data field is in binary wire form, and is therefore not NUL-terminated, its length is returned via the dlen parameter. If any of these parameters is NULL, the corresponding field is not returned. The data parameter is set to a short-term internal-copy of the associated data field and must not be freed by the application. Applications that need long-term access to this field need to copy the content.

                                                                                                                                                          SSL_CTX_dane_set_flags() and SSL_dane_set_flags() can be used to enable optional DANE verification features. SSL_CTX_dane_clear_flags() and SSL_dane_clear_flags() can be used to disable the same features. The flags argument is a bit-mask of the features to enable or disable. The flags set for an SSL_CTX context are copied to each SSL handle associated with that context at the time the handle is created. Subsequent changes in the context's flags have no effect on the flags set for the handle.

                                                                                                                                                          At present, the only available option is DANE_FLAG_NO_DANE_EE_NAMECHECKS which can be used to disable server name checks when authenticating via DANE-EE(3) TLSA records. For some applications, primarily web browsers, it is not safe to disable name checks due to \"unknown key share\" attacks, in which a malicious server can convince a client that a connection to a victim server is instead a secure connection to the malicious server. The malicious server may then be able to violate cross-origin scripting restrictions. Thus, despite the text of RFC7671, name checks are by default enabled for DANE-EE(3) TLSA records, and can be disabled in applications where it is safe to do so. In particular, SMTP and XMPP clients should set this option as SRV and MX records already make it possible for a remote domain to redirect client connections to any server of its choice, and in any case SMTP and XMPP clients do not execute scripts downloaded from remote servers.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The functions SSL_CTX_dane_enable(), SSL_CTX_dane_mtype_set(), SSL_dane_enable() and SSL_dane_tlsa_add() return a positive value on success. Negative return values indicate resource problems (out of memory, etc.) in the SSL library, while a return value of 0 indicates incorrect usage or invalid input, such as an unsupported TLSA record certificate usage, selector or matching type. Invalid input also includes malformed data, either a digest length that does not match the digest algorithm, or a Full(0) (binary ASN.1 DER form) certificate or a public key that fails to parse.

                                                                                                                                                          The functions SSL_get0_dane_authority() and SSL_get0_dane_tlsa() return a negative value when DANE authentication failed or was not enabled, a nonnegative value indicates the chain depth at which the TLSA record matched a chain certificate, or the depth of the top-most certificate, when the TLSA record is a full public key that is its signer.

                                                                                                                                                          The functions SSL_CTX_dane_set_flags(), SSL_CTX_dane_clear_flags(), SSL_dane_set_flags() and SSL_dane_clear_flags() return the flags in effect before they were called.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Suppose \"smtp.example.com\" is the MX host of the domain \"example.com\", and has DNSSEC-validated TLSA records. The calls below will perform DANE authentication and arrange to match either the MX hostname or the destination domain name in the SMTP server certificate. Wildcards are supported, but must match the entire label. The actual name matched in the certificate (which might be a wildcard) is retrieved, and must be copied by the application if it is to be retained beyond the lifetime of the SSL connection.

                                                                                                                                                          SSL_CTX *ctx;\nSSL *ssl;\nint (*verify_cb)(int ok, X509_STORE_CTX *sctx) = NULL;\nint num_usable = 0;\nconst char *nexthop_domain = \"example.com\";\nconst char *dane_tlsa_domain = \"smtp.example.com\";\nuint8_t usage, selector, mtype;\n\nif ((ctx = SSL_CTX_new(TLS_client_method())) == NULL)\n    /* error */\nif (SSL_CTX_dane_enable(ctx) <= 0)\n    /* error */\nif ((ssl = SSL_new(ctx)) == NULL)\n    /* error */\nif (SSL_dane_enable(ssl, dane_tlsa_domain) <= 0)\n    /* error */\n\n/*\n * For many applications it is safe to skip DANE-EE(3) namechecks.  Do not\n * disable the checks unless \"unknown key share\" attacks pose no risk for\n * your application.\n */\nSSL_dane_set_flags(ssl, DANE_FLAG_NO_DANE_EE_NAMECHECKS);\n\nif (!SSL_add1_host(ssl, nexthop_domain))\n    /* error */\nSSL_set_hostflags(ssl, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);\n\nfor (... each TLSA record ...) {\n    unsigned char *data;\n    size_t len;\n    int ret;\n\n    /* set usage, selector, mtype, data, len */\n\n    /*\n     * Opportunistic DANE TLS clients support only DANE-TA(2) or DANE-EE(3).\n     * They treat all other certificate usages, and in particular PKIX-TA(0)\n     * and PKIX-EE(1), as unusable.\n     */\n    switch (usage) {\n    default:\n    case 0:     /* PKIX-TA(0) */\n    case 1:     /* PKIX-EE(1) */\n        continue;\n    case 2:     /* DANE-TA(2) */\n    case 3:     /* DANE-EE(3) */\n        break;\n    }\n\n    ret = SSL_dane_tlsa_add(ssl, usage, selector, mtype, data, len);\n    /* free data as appropriate */\n\n    if (ret < 0)\n        /* handle SSL library internal error */\n    else if (ret == 0)\n        /* handle unusable TLSA record */\n    else\n        ++num_usable;\n}\n\n/*\n * At this point, the verification mode is still the default SSL_VERIFY_NONE.\n * Opportunistic DANE clients use unauthenticated TLS when all TLSA records\n * are unusable, so continue the handshake even if authentication fails.\n */\nif (num_usable == 0) {\n    /* Log all records unusable? */\n\n    /* Optionally set verify_cb to a suitable non-NULL callback. */\n    SSL_set_verify(ssl, SSL_VERIFY_NONE, verify_cb);\n} else {\n    /* At least one usable record.  We expect to verify the peer */\n\n    /* Optionally set verify_cb to a suitable non-NULL callback. */\n\n    /*\n     * Below we elect to fail the handshake when peer verification fails.\n     * Alternatively, use the permissive SSL_VERIFY_NONE verification mode,\n     * complete the handshake, check the verification status, and if not\n     * verified disconnect gracefully at the application layer, especially if\n     * application protocol supports informing the server that authentication\n     * failed.\n     */\n    SSL_set_verify(ssl, SSL_VERIFY_PEER, verify_cb);\n}\n\n/*\n * Load any saved session for resumption, making sure that the previous\n * session applied the same security and authentication requirements that\n * would be expected of a fresh connection.\n */\n\n/* Perform SSL_connect() handshake and handle errors here */\n\nif (SSL_session_reused(ssl)) {\n    if (SSL_get_verify_result(ssl) == X509_V_OK) {\n        /*\n         * Resumed session was originally verified, this connection is\n         * authenticated.\n         */\n    } else {\n        /*\n         * Resumed session was not originally verified, this connection is not\n         * authenticated.\n         */\n    }\n} else if (SSL_get_verify_result(ssl) == X509_V_OK) {\n    const char *peername = SSL_get0_peername(ssl);\n    EVP_PKEY *mspki = NULL;\n\n    int depth = SSL_get0_dane_authority(ssl, NULL, &mspki);\n    if (depth >= 0) {\n        (void) SSL_get0_dane_tlsa(ssl, &usage, &selector, &mtype, NULL, NULL);\n        printf(\"DANE TLSA %d %d %d %s at depth %d\\n\", usage, selector, mtype,\n               (mspki != NULL) ? \"TA public key verified certificate\" :\n               depth ? \"matched TA certificate\" : \"matched EE certificate\",\n               depth);\n    }\n    if (peername != NULL) {\n        /* Name checks were in scope and matched the peername */\n        printf(\"Verified peername: %s\\n\", peername);\n    }\n} else {\n    /*\n     * Not authenticated, presumably all TLSA rrs unusable, but possibly a\n     * callback suppressed connection termination despite the presence of\n     * usable TLSA RRs none of which matched.  Do whatever is appropriate for\n     * fresh unauthenticated connections.\n     */\n}\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#notes","title":"NOTES","text":"

                                                                                                                                                          It is expected that the majority of clients employing DANE TLS will be doing \"opportunistic DANE TLS\" in the sense of RFC7672 and RFC7435. That is, they will use DANE authentication when DNSSEC-validated TLSA records are published for a given peer, and otherwise will use unauthenticated TLS or even cleartext.

                                                                                                                                                          Such applications should generally treat any TLSA records published by the peer with usages PKIX-TA(0) and PKIX-EE(1) as \"unusable\", and should not include them among the TLSA records used to authenticate peer connections. In addition, some TLSA records with supported usages may be \"unusable\" as a result of invalid or unsupported parameters.

                                                                                                                                                          When a peer has TLSA records, but none are \"usable\", an opportunistic application must avoid cleartext, but cannot authenticate the peer, and so should generally proceed with an unauthenticated connection. Opportunistic applications need to note the return value of each call to SSL_dane_tlsa_add(), and if all return 0 (due to invalid or unsupported parameters) disable peer authentication by calling SSL_set_verify(3) with mode equal to SSL_VERIFY_NONE.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_new(3), SSL_add1_host(3), SSL_set_hostflags(3), SSL_set_tlsext_host_name(3), SSL_set_verify(3), SSL_CTX_set_cert_verify_callback(3), SSL_get0_verified_chain(3), SSL_get_peer_cert_chain(3), SSL_get_verify_result(3), SSL_connect(3), SSL_get0_peername(3), X509_verify_cert(3), X509_up_ref(3), X509_free(3), EVP_get_digestbyname(3), EVP_PKEY_up_ref(3), EVP_PKEY_free(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_dane_enable/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_flush_sessions/","title":"SSL_CTX_flush_sessions","text":""},{"location":"man3/SSL_CTX_flush_sessions/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_flush_sessions - remove expired sessions

                                                                                                                                                          "},{"location":"man3/SSL_CTX_flush_sessions/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_flush_sessions/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_flush_sessions() causes a run through the session cache of ctx to remove sessions expired at time tm.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_flush_sessions/#notes","title":"NOTES","text":"

                                                                                                                                                          If enabled, the internal session cache will collect all sessions established up to the specified maximum number (see SSL_CTX_sess_set_cache_size()). As sessions will not be reused ones they are expired, they should be removed from the cache to save resources. This can either be done automatically whenever 255 new sessions were established (see SSL_CTX_set_session_cache_mode(3)) or manually by calling SSL_CTX_flush_sessions().

                                                                                                                                                          The parameter tm specifies the time which should be used for the expiration test, in most cases the actual time given by time(0) will be used.

                                                                                                                                                          SSL_CTX_flush_sessions() will only check sessions stored in the internal cache. When a session is found and removed, the remove_session_cb is however called to synchronize with the external cache (see SSL_CTX_sess_set_get_cb(3)).

                                                                                                                                                          "},{"location":"man3/SSL_CTX_flush_sessions/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_flush_sessions() does not return a value.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_flush_sessions/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_CTX_set_timeout(3), SSL_CTX_sess_set_get_cb(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_flush_sessions/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_free/","title":"SSL_CTX_free","text":""},{"location":"man3/SSL_CTX_free/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_free - free an allocated SSL_CTX object

                                                                                                                                                          "},{"location":"man3/SSL_CTX_free/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_free(SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_free/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_free() decrements the reference count of ctx, and removes the SSL_CTX object pointed to by ctx and frees up the allocated memory if the reference count has reached 0.

                                                                                                                                                          It also calls the free()ing procedures for indirectly affected items, if applicable: the session cache, the list of ciphers, the list of Client CAs, the certificates and keys.

                                                                                                                                                          If ctx is NULL nothing is done.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_free/#warnings","title":"WARNINGS","text":"

                                                                                                                                                          If a session-remove callback is set (SSL_CTX_sess_set_remove_cb()), this callback will be called for each session being freed from ctx's session cache. This implies, that all corresponding sessions from an external session cache are removed as well. If this is not desired, the user should explicitly unset the callback by calling SSL_CTX_sess_set_remove_cb(ctx, NULL) prior to calling SSL_CTX_free().

                                                                                                                                                          "},{"location":"man3/SSL_CTX_free/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_free() does not provide diagnostic information.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_free/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          SSL_CTX_new(3), ssl(7), SSL_CTX_sess_set_get_cb(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_free/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/","title":"SSL_CTX_get0_param","text":""},{"location":"man3/SSL_CTX_get0_param/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param, SSL_CTX_set_purpose, SSL_CTX_set_trust, SSL_set_purpose, SSL_set_trust - get and set verification parameters

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nX509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx);\nX509_VERIFY_PARAM *SSL_get0_param(SSL *ssl);\nint SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);\nint SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);\n\nint SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose);\nint SSL_set_purpose(SSL *ssl, int purpose);\n\nint SSL_CTX_set_trust(SSL_CTX *ctx, int trust);\nint SSL_set_trust(SSL *ssl, int trust);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_get0_param() and SSL_get0_param() retrieve an internal pointer to the verification parameters for ctx or ssl respectively. The returned pointer must not be freed by the calling application.

                                                                                                                                                          SSL_CTX_set1_param() and SSL_set1_param() set the verification parameters to vpm for ctx or ssl.

                                                                                                                                                          The functions SSL_CTX_set_purpose() and SSL_set_purpose() are shorthands which set the purpose parameter on the verification parameters object. These functions are equivalent to calling X509_VERIFY_PARAM_set_purpose() directly.

                                                                                                                                                          The functions SSL_CTX_set_trust() and SSL_set_trust() are similarly shorthands which set the trust parameter on the verification parameters object. These functions are equivalent to calling X509_VERIFY_PARAM_set_trust() directly.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#notes","title":"NOTES","text":"

                                                                                                                                                          Typically parameters are retrieved from an SSL_CTX or SSL structure using SSL_CTX_get0_param() or SSL_get0_param() and an application modifies them to suit its needs: for example to add a hostname check.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_get0_param() and SSL_get0_param() return a pointer to an X509_VERIFY_PARAM structure.

                                                                                                                                                          SSL_CTX_set1_param(), SSL_set1_param(), SSL_CTX_set_purpose(), SSL_set_purpose(), SSL_CTX_set_trust() and SSL_set_trust() return 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Check hostname matches \"www.foo.com\" in peer certificate:

                                                                                                                                                          X509_VERIFY_PARAM *vpm = SSL_get0_param(ssl);\nX509_VERIFY_PARAM_set1_host(vpm, \"www.foo.com\", 0);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), X509_VERIFY_PARAM_set_flags(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get0_param/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get_verify_mode/","title":"SSL_CTX_get_verify_mode","text":""},{"location":"man3/SSL_CTX_get_verify_mode/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_get_verify_mode, SSL_get_verify_mode, SSL_CTX_get_verify_depth, SSL_get_verify_depth, SSL_get_verify_callback, SSL_CTX_get_verify_callback - get currently set verification parameters

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get_verify_mode/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_get_verify_mode(const SSL_CTX *ctx);\nint SSL_get_verify_mode(const SSL *ssl);\nint SSL_CTX_get_verify_depth(const SSL_CTX *ctx);\nint SSL_get_verify_depth(const SSL *ssl);\nint (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *);\nint (*SSL_get_verify_callback(const SSL *ssl))(int, X509_STORE_CTX *);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_get_verify_mode/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_get_verify_mode() returns the verification mode currently set in ctx.

                                                                                                                                                          SSL_get_verify_mode() returns the verification mode currently set in ssl.

                                                                                                                                                          SSL_CTX_get_verify_depth() returns the verification depth limit currently set in ctx. If no limit has been explicitly set, -1 is returned and the default value will be used.

                                                                                                                                                          SSL_get_verify_depth() returns the verification depth limit currently set in ssl. If no limit has been explicitly set, -1 is returned and the default value will be used.

                                                                                                                                                          SSL_CTX_get_verify_callback() returns a function pointer to the verification callback currently set in ctx. If no callback was explicitly set, the NULL pointer is returned and the default callback will be used.

                                                                                                                                                          SSL_get_verify_callback() returns a function pointer to the verification callback currently set in ssl. If no callback was explicitly set, the NULL pointer is returned and the default callback will be used.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get_verify_mode/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          See DESCRIPTION

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get_verify_mode/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_verify(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_get_verify_mode/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_has_client_custom_ext/","title":"SSL_CTX_has_client_custom_ext","text":""},{"location":"man3/SSL_CTX_has_client_custom_ext/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_has_client_custom_ext - check whether a handler exists for a particular client extension type

                                                                                                                                                          "},{"location":"man3/SSL_CTX_has_client_custom_ext/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, unsigned int ext_type);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_has_client_custom_ext/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_has_client_custom_ext() checks whether a handler has been set for a client extension of type ext_type using SSL_CTX_add_client_custom_ext().

                                                                                                                                                          "},{"location":"man3/SSL_CTX_has_client_custom_ext/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          Returns 1 if a handler has been set, 0 otherwise.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_has_client_custom_ext/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_add_client_custom_ext(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_has_client_custom_ext/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/","title":"SSL_CTX_load_verify_locations","text":""},{"location":"man3/SSL_CTX_load_verify_locations/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_load_verify_dir, SSL_CTX_load_verify_file, SSL_CTX_load_verify_store, SSL_CTX_set_default_verify_paths, SSL_CTX_set_default_verify_dir, SSL_CTX_set_default_verify_file, SSL_CTX_set_default_verify_store, SSL_CTX_load_verify_locations - set default locations for trusted CA certificates

                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_load_verify_dir(SSL_CTX *ctx, const char *CApath);\nint SSL_CTX_load_verify_file(SSL_CTX *ctx, const char *CAfile);\nint SSL_CTX_load_verify_store(SSL_CTX *ctx, const char *CAstore);\n\nint SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);\n\nint SSL_CTX_set_default_verify_dir(SSL_CTX *ctx);\nint SSL_CTX_set_default_verify_file(SSL_CTX *ctx);\nint SSL_CTX_set_default_verify_store(SSL_CTX *ctx);\n\nint SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,\n                                  const char *CApath);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_load_verify_locations(), SSL_CTX_load_verify_dir(), SSL_CTX_load_verify_file(), SSL_CTX_load_verify_store() specifies the locations for ctx, at which CA certificates for verification purposes are located. The certificates available via CAfile, CApath and CAstore are trusted.

                                                                                                                                                          Details of the certificate verification and chain checking process are described in \"Certification Path Validation\" in openssl-verification-options(1).

                                                                                                                                                          SSL_CTX_set_default_verify_paths() specifies that the default locations from which CA certificates are loaded should be used. There is one default directory, one default file and one default store. The default CA certificates directory is called certs in the default OpenSSL directory, and this is also the default store. Alternatively the SSL_CERT_DIR environment variable can be defined to override this location. The default CA certificates file is called cert.pem in the default OpenSSL directory. Alternatively the SSL_CERT_FILE environment variable can be defined to override this location.

                                                                                                                                                          SSL_CTX_set_default_verify_dir() is similar to SSL_CTX_set_default_verify_paths() except that just the default directory is used.

                                                                                                                                                          SSL_CTX_set_default_verify_file() is similar to SSL_CTX_set_default_verify_paths() except that just the default file is used.

                                                                                                                                                          SSL_CTX_set_default_verify_store() is similar to SSL_CTX_set_default_verify_paths() except that just the default store is used.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#notes","title":"NOTES","text":"

                                                                                                                                                          If CAfile is not NULL, it points to a file of CA certificates in PEM format. The file can contain several CA certificates identified by

                                                                                                                                                          -----BEGIN CERTIFICATE-----\n... (CA certificate in base64 encoding) ...\n-----END CERTIFICATE-----\n

                                                                                                                                                          sequences. Before, between, and after the certificates text is allowed which can be used e.g. for descriptions of the certificates.

                                                                                                                                                          The CAfile is processed on execution of the SSL_CTX_load_verify_locations() function.

                                                                                                                                                          If CApath is not NULL, it points to a directory containing CA certificates in PEM format. The files each contain one CA certificate. The files are looked up by the CA subject name hash value, which must hence be available. If more than one CA certificate with the same name hash value exist, the extension must be different (e.g. 9d66eef0.0, 9d66eef0.1 etc). The search is performed in the ordering of the extension number, regardless of other properties of the certificates. Use the c_rehash utility to create the necessary links.

                                                                                                                                                          The certificates in CApath are only looked up when required, e.g. when building the certificate chain or when actually performing the verification of a peer certificate.

                                                                                                                                                          When looking up CA certificates for chain building, the OpenSSL library will search for suitable certificates first in CAfile, then in CApath. Details of the chain building process are described in \"Certification Path Building\" in openssl-verification-options(1).

                                                                                                                                                          If CAstore is not NULL, it's a URI for to a store, which may represent a single container or a whole catalogue of containers. Apart from the CAstore not necessarily being a local file or directory, it's generally treated the same way as a CApath.

                                                                                                                                                          In server mode, when requesting a client certificate, the server must send the list of CAs of which it will accept client certificates. This list is not influenced by the contents of CAfile or CApath and must explicitly be set using the SSL_CTX_set_client_CA_list(3) family of functions.

                                                                                                                                                          When building its own certificate chain, an OpenSSL client/server will try to fill in missing certificates from CAfile/CApath, if the certificate chain was not explicitly specified (see SSL_CTX_add_extra_chain_cert(3), SSL_CTX_use_certificate(3).

                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#warnings","title":"WARNINGS","text":"

                                                                                                                                                          If several CA certificates matching the name, key identifier, and serial number condition are available, only the first one will be examined. This may lead to unexpected results if the same CA certificate is available with different expiration dates. If a \"certificate expired\" verification error occurs, no other certificate will be searched. Make sure to not have expired certificates mixed with valid ones.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          For SSL_CTX_load_verify_locations the following return values can occur:

                                                                                                                                                          • 0

                                                                                                                                                            The operation failed because CAfile and CApath are NULL or the processing at one of the locations specified failed. Check the error stack to find out the reason.

                                                                                                                                                          • 1

                                                                                                                                                            The operation succeeded.

                                                                                                                                                          SSL_CTX_set_default_verify_paths(), SSL_CTX_set_default_verify_dir() and SSL_CTX_set_default_verify_file() all return 1 on success or 0 on failure. A missing default location is still treated as a success.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Generate a CA certificate file with descriptive text from the CA certificates ca1.pem ca2.pem ca3.pem:

                                                                                                                                                          #!/bin/sh\nrm CAfile.pem\nfor i in ca1.pem ca2.pem ca3.pem ; do\n    openssl x509 -in $i -text >> CAfile.pem\ndone\n

                                                                                                                                                          Prepare the directory /some/where/certs containing several CA certificates for use as CApath:

                                                                                                                                                          cd /some/where/certs\nc_rehash .\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_client_CA_list(3), SSL_get_client_CA_list(3), SSL_CTX_use_certificate(3), SSL_CTX_add_extra_chain_cert(3), SSL_CTX_set_cert_store(3), SSL_CTX_set_client_CA_list(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_load_verify_locations/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/","title":"SSL_CTX_new","text":""},{"location":"man3/SSL_CTX_new/#name","title":"NAME","text":"

                                                                                                                                                          TLSv1_2_method, TLSv1_2_server_method, TLSv1_2_client_method, SSL_CTX_new, SSL_CTX_new_ex, SSL_CTX_up_ref, SSLv3_method, SSLv3_server_method, SSLv3_client_method, TLSv1_method, TLSv1_server_method, TLSv1_client_method, TLSv1_1_method, TLSv1_1_server_method, TLSv1_1_client_method, TLS_method, TLS_server_method, TLS_client_method, SSLv23_method, SSLv23_server_method, SSLv23_client_method, DTLS_method, DTLS_server_method, DTLS_client_method, DTLSv1_method, DTLSv1_server_method, DTLSv1_client_method, DTLSv1_2_method, DTLSv1_2_server_method, DTLSv1_2_client_method - create a new SSL_CTX object as framework for TLS/SSL or DTLS enabled functions

                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nSSL_CTX *SSL_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq,\n                        const SSL_METHOD *method);\nSSL_CTX *SSL_CTX_new(const SSL_METHOD *method);\nint SSL_CTX_up_ref(SSL_CTX *ctx);\n\nconst SSL_METHOD *TLS_method(void);\nconst SSL_METHOD *TLS_server_method(void);\nconst SSL_METHOD *TLS_client_method(void);\n\nconst SSL_METHOD *SSLv23_method(void);\nconst SSL_METHOD *SSLv23_server_method(void);\nconst SSL_METHOD *SSLv23_client_method(void);\n\n#ifndef OPENSSL_NO_SSL3_METHOD\nconst SSL_METHOD *SSLv3_method(void);\nconst SSL_METHOD *SSLv3_server_method(void);\nconst SSL_METHOD *SSLv3_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_TLS1_METHOD\nconst SSL_METHOD *TLSv1_method(void);\nconst SSL_METHOD *TLSv1_server_method(void);\nconst SSL_METHOD *TLSv1_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_TLS1_1_METHOD\nconst SSL_METHOD *TLSv1_1_method(void);\nconst SSL_METHOD *TLSv1_1_server_method(void);\nconst SSL_METHOD *TLSv1_1_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_TLS1_2_METHOD\nconst SSL_METHOD *TLSv1_2_method(void);\nconst SSL_METHOD *TLSv1_2_server_method(void);\nconst SSL_METHOD *TLSv1_2_client_method(void);\n#endif\n\nconst SSL_METHOD *DTLS_method(void);\nconst SSL_METHOD *DTLS_server_method(void);\nconst SSL_METHOD *DTLS_client_method(void);\n\n#ifndef OPENSSL_NO_DTLS1_METHOD\nconst SSL_METHOD *DTLSv1_method(void);\nconst SSL_METHOD *DTLSv1_server_method(void);\nconst SSL_METHOD *DTLSv1_client_method(void);\n#endif\n\n#ifndef OPENSSL_NO_DTLS1_2_METHOD\nconst SSL_METHOD *DTLSv1_2_method(void);\nconst SSL_METHOD *DTLSv1_2_server_method(void);\nconst SSL_METHOD *DTLSv1_2_client_method(void);\n#endif\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_new_ex() creates a new SSL_CTX object, which holds various configuration and data relevant to SSL/TLS or DTLS session establishment. These are later inherited by the SSL object representing an active session. The method parameter specifies whether the context will be used for the client or server side or both - for details see the \"NOTES\" below. The library context libctx (see OSSL_LIB_CTX(3)) is used to provide the cryptographic algorithms needed for the session. Any cryptographic algorithms that are used by any SSL objects created from this SSL_CTX will be fetched from the libctx using the property query string propq (see \"ALGORITHM FETCHING\" in crypto(7). Either or both the libctx or propq parameters may be NULL.

                                                                                                                                                          SSL_CTX_new() does the same as SSL_CTX_new_ex() except that the default library context is used and no property query string is specified.

                                                                                                                                                          An SSL_CTX object is reference counted. Creating an SSL_CTX object for the first time increments the reference count. Freeing the SSL_CTX (using SSL_CTX_free) decrements it. When the reference count drops to zero, any memory or resources allocated to the SSL_CTX object are freed. SSL_CTX_up_ref() increments the reference count for an existing SSL_CTX structure.

                                                                                                                                                          An SSL_CTX object should not be changed after it is used to create any SSL objects or from multiple threads concurrently, since the implementation does not provide serialization of access for these cases.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/#notes","title":"NOTES","text":"

                                                                                                                                                          On session establishment, by default, no peer credentials verification is done. This must be explicitly requested, typically using SSL_CTX_set_verify(3). For verifying peer certificates many options can be set using various functions such as SSL_CTX_load_verify_locations(3) and SSL_CTX_set1_param(3). The X509_VERIFY_PARAM_set_purpose(3) function can be used, also in conjunction with SSL_CTX_get0_param(3), to set the intended purpose of the session. The default is X509_PURPOSE_SSL_SERVER on the client side and X509_PURPOSE_SSL_CLIENT on the server side.

                                                                                                                                                          The SSL_CTX object uses method as the connection method. Three method variants are available: a generic method (for either client or server use), a server-only method, and a client-only method.

                                                                                                                                                          The method parameter of SSL_CTX_new_ex() and SSL_CTX_new() can be one of the following:

                                                                                                                                                          • TLS_method(), TLS_server_method(), TLS_client_method()

                                                                                                                                                            These are the general-purpose version-flexible SSL/TLS methods. The actual protocol version used will be negotiated to the highest version mutually supported by the client and the server. The supported protocols are SSLv3, TLSv1, TLSv1.1, TLSv1.2 and TLSv1.3. Applications should use these methods, and avoid the version-specific methods described below, which are deprecated.

                                                                                                                                                          • SSLv23_method(), SSLv23_server_method(), SSLv23_client_method()

                                                                                                                                                            These functions do not exist anymore, they have been renamed to TLS_method(), TLS_server_method() and TLS_client_method() respectively. Currently, the old function calls are renamed to the corresponding new ones by preprocessor macros, to ensure that existing code which uses the old function names still compiles. However, using the old function names is deprecated and new code should call the new functions instead.

                                                                                                                                                          • TLSv1_2_method(), TLSv1_2_server_method(), TLSv1_2_client_method()

                                                                                                                                                            A TLS/SSL connection established with these methods will only understand the TLSv1.2 protocol. These methods are deprecated.

                                                                                                                                                          • TLSv1_1_method(), TLSv1_1_server_method(), TLSv1_1_client_method()

                                                                                                                                                            A TLS/SSL connection established with these methods will only understand the TLSv1.1 protocol. These methods are deprecated.

                                                                                                                                                          • TLSv1_method(), TLSv1_server_method(), TLSv1_client_method()

                                                                                                                                                            A TLS/SSL connection established with these methods will only understand the TLSv1 protocol. These methods are deprecated.

                                                                                                                                                          • SSLv3_method(), SSLv3_server_method(), SSLv3_client_method()

                                                                                                                                                            A TLS/SSL connection established with these methods will only understand the SSLv3 protocol. The SSLv3 protocol is deprecated and should not be used.

                                                                                                                                                          • DTLS_method(), DTLS_server_method(), DTLS_client_method()

                                                                                                                                                            These are the version-flexible DTLS methods. Currently supported protocols are DTLS 1.0 and DTLS 1.2.

                                                                                                                                                          • DTLSv1_2_method(), DTLSv1_2_server_method(), DTLSv1_2_client_method()

                                                                                                                                                            These are the version-specific methods for DTLSv1.2. These methods are deprecated.

                                                                                                                                                          • DTLSv1_method(), DTLSv1_server_method(), DTLSv1_client_method()

                                                                                                                                                            These are the version-specific methods for DTLSv1. These methods are deprecated.

                                                                                                                                                          SSL_CTX_new() initializes the list of ciphers, the session cache setting, the callbacks, the keys and certificates and the options to their default values.

                                                                                                                                                          TLS_method(), TLS_server_method(), TLS_client_method(), DTLS_method(), DTLS_server_method() and DTLS_client_method() are the version-flexible methods. All other methods only support one specific protocol version. Use the version-flexible methods instead of the version specific methods.

                                                                                                                                                          If you want to limit the supported protocols for the version flexible methods you can use SSL_CTX_set_min_proto_version(3), SSL_set_min_proto_version(3), SSL_CTX_set_max_proto_version(3) and SSL_set_max_proto_version(3) functions. Using these functions it is possible to choose e.g. TLS_server_method() and be able to negotiate with all possible clients, but to only allow newer protocols like TLS 1.0, TLS 1.1, TLS 1.2 or TLS 1.3.

                                                                                                                                                          The list of protocols available can also be limited using the SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_3, SSL_OP_NO_TLSv1_2 and SSL_OP_NO_TLSv1_3 options of the SSL_CTX_set_options(3) or SSL_set_options(3) functions, but this approach is not recommended. Clients should avoid creating \"holes\" in the set of protocols they support. When disabling a protocol, make sure that you also disable either all previous or all subsequent protocol versions. In clients, when a protocol version is disabled without disabling all previous protocol versions, the effect is to also disable all subsequent protocol versions.

                                                                                                                                                          The SSLv3 protocol is deprecated and should generally not be used. Applications should typically use SSL_CTX_set_min_proto_version(3) to set the minimum protocol to at least TLS1_VERSION.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The following return values can occur:

                                                                                                                                                          • NULL

                                                                                                                                                            The creation of a new SSL_CTX object failed. Check the error stack to find out the reason.

                                                                                                                                                          • Pointer to an SSL_CTX object

                                                                                                                                                            The return value points to an allocated SSL_CTX object.

                                                                                                                                                            SSL_CTX_up_ref() returns 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          SSL_CTX_set_options(3), SSL_CTX_free(3), SSL_CTX_set_verify(3), SSL_CTX_set1_param(3), SSL_CTX_get0_param(3), SSL_connect(3), SSL_accept(3), SSL_CTX_set_min_proto_version(3), ssl(7), SSL_set_connect_state(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                                          Support for SSLv2 and the corresponding SSLv2_method(), SSLv2_server_method() and SSLv2_client_method() functions where removed in OpenSSL 1.1.0.

                                                                                                                                                          SSLv23_method(), SSLv23_server_method() and SSLv23_client_method() were deprecated and the preferred TLS_method(), TLS_server_method() and TLS_client_method() functions were added in OpenSSL 1.1.0.

                                                                                                                                                          All version-specific methods were deprecated in OpenSSL 1.1.0.

                                                                                                                                                          SSL_CTX_new_ex() was added in OpenSSL 3.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_number/","title":"SSL_CTX_sess_number","text":""},{"location":"man3/SSL_CTX_sess_number/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_sess_number, SSL_CTX_sess_connect, SSL_CTX_sess_connect_good, SSL_CTX_sess_connect_renegotiate, SSL_CTX_sess_accept, SSL_CTX_sess_accept_good, SSL_CTX_sess_accept_renegotiate, SSL_CTX_sess_hits, SSL_CTX_sess_cb_hits, SSL_CTX_sess_misses, SSL_CTX_sess_timeouts, SSL_CTX_sess_cache_full - obtain session cache statistics

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_number/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nlong SSL_CTX_sess_number(SSL_CTX *ctx);\nlong SSL_CTX_sess_connect(SSL_CTX *ctx);\nlong SSL_CTX_sess_connect_good(SSL_CTX *ctx);\nlong SSL_CTX_sess_connect_renegotiate(SSL_CTX *ctx);\nlong SSL_CTX_sess_accept(SSL_CTX *ctx);\nlong SSL_CTX_sess_accept_good(SSL_CTX *ctx);\nlong SSL_CTX_sess_accept_renegotiate(SSL_CTX *ctx);\nlong SSL_CTX_sess_hits(SSL_CTX *ctx);\nlong SSL_CTX_sess_cb_hits(SSL_CTX *ctx);\nlong SSL_CTX_sess_misses(SSL_CTX *ctx);\nlong SSL_CTX_sess_timeouts(SSL_CTX *ctx);\nlong SSL_CTX_sess_cache_full(SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_number/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_sess_number() returns the current number of sessions in the internal session cache.

                                                                                                                                                          SSL_CTX_sess_connect() returns the number of started SSL/TLS handshakes in client mode.

                                                                                                                                                          SSL_CTX_sess_connect_good() returns the number of successfully established SSL/TLS sessions in client mode.

                                                                                                                                                          SSL_CTX_sess_connect_renegotiate() returns the number of started renegotiations in client mode.

                                                                                                                                                          SSL_CTX_sess_accept() returns the number of started SSL/TLS handshakes in server mode.

                                                                                                                                                          SSL_CTX_sess_accept_good() returns the number of successfully established SSL/TLS sessions in server mode.

                                                                                                                                                          SSL_CTX_sess_accept_renegotiate() returns the number of started renegotiations in server mode.

                                                                                                                                                          SSL_CTX_sess_hits() returns the number of successfully reused sessions. In client mode a session set with SSL_set_session(3) successfully reused is counted as a hit. In server mode a session successfully retrieved from internal or external cache is counted as a hit.

                                                                                                                                                          SSL_CTX_sess_cb_hits() returns the number of successfully retrieved sessions from the external session cache in server mode.

                                                                                                                                                          SSL_CTX_sess_misses() returns the number of sessions proposed by clients that were not found in the internal session cache in server mode.

                                                                                                                                                          SSL_CTX_sess_timeouts() returns the number of sessions proposed by clients and either found in the internal or external session cache in server mode, but that were invalid due to timeout. These sessions are not included in the SSL_CTX_sess_hits() count.

                                                                                                                                                          SSL_CTX_sess_cache_full() returns the number of sessions that were removed because the maximum session cache size was exceeded.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_number/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The functions return the values indicated in the DESCRIPTION section.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_number/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_set_session(3), SSL_CTX_set_session_cache_mode(3) SSL_CTX_sess_set_cache_size(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_number/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_cache_size/","title":"SSL_CTX_sess_set_cache_size","text":""},{"location":"man3/SSL_CTX_sess_set_cache_size/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_sess_set_cache_size, SSL_CTX_sess_get_cache_size - manipulate session cache size

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_cache_size/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nlong SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, long t);\nlong SSL_CTX_sess_get_cache_size(SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_cache_size/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_sess_set_cache_size() sets the size of the internal session cache of context ctx to t. This value is a hint and not an absolute; see the notes below.

                                                                                                                                                          SSL_CTX_sess_get_cache_size() returns the currently valid session cache size.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_cache_size/#notes","title":"NOTES","text":"

                                                                                                                                                          The internal session cache size is SSL_SESSION_CACHE_MAX_SIZE_DEFAULT, currently 1024*20, so that up to 20000 sessions can be held. This size can be modified using the SSL_CTX_sess_set_cache_size() call. A special case is the size 0, which is used for unlimited size.

                                                                                                                                                          If adding the session makes the cache exceed its size, then unused sessions are dropped from the end of the cache. Cache space may also be reclaimed by calling SSL_CTX_flush_sessions(3) to remove expired sessions.

                                                                                                                                                          If the size of the session cache is reduced and more sessions are already in the session cache, old session will be removed at the next time a session shall be added. This removal is not synchronized with the expiration of sessions.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_cache_size/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_sess_set_cache_size() returns the previously valid size.

                                                                                                                                                          SSL_CTX_sess_get_cache_size() returns the currently valid size.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_cache_size/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_CTX_sess_number(3), SSL_CTX_flush_sessions(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_cache_size/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_get_cb/","title":"SSL_CTX_sess_set_get_cb","text":""},{"location":"man3/SSL_CTX_sess_set_get_cb/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_sess_set_new_cb, SSL_CTX_sess_set_remove_cb, SSL_CTX_sess_set_get_cb, SSL_CTX_sess_get_new_cb, SSL_CTX_sess_get_remove_cb, SSL_CTX_sess_get_get_cb - provide callback functions for server side external session caching

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_get_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,\n                             int (*new_session_cb)(SSL *, SSL_SESSION *));\nvoid SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,\n                                void (*remove_session_cb)(SSL_CTX *ctx,\n                                                          SSL_SESSION *));\nvoid SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,\n                             SSL_SESSION (*get_session_cb)(SSL *,\n                                                           const unsigned char *,\n                                                           int, int *));\n\nint (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl,\n                                             SSL_SESSION *sess);\nvoid (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx,\n                                                 SSL_SESSION *sess);\nSSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl,\n                                                      const unsigned char *data,\n                                                      int len, int *copy);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_get_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_sess_set_new_cb() sets the callback function that is called whenever a new session was negotiated.

                                                                                                                                                          SSL_CTX_sess_set_remove_cb() sets the callback function that is called whenever a session is removed by the SSL engine. For example, this can occur because a session is considered faulty or has become obsolete because of exceeding the timeout value.

                                                                                                                                                          SSL_CTX_sess_set_get_cb() sets the callback function that is called whenever a TLS client proposed to resume a session but the session could not be found in the internal session cache (see SSL_CTX_set_session_cache_mode(3)). (TLS server only.)

                                                                                                                                                          SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb(), and SSL_CTX_sess_get_get_cb() retrieve the function pointers set by the corresponding set callback functions. If a callback function has not been set, the NULL pointer is returned.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_get_cb/#notes","title":"NOTES","text":"

                                                                                                                                                          In order to allow external session caching, synchronization with the internal session cache is realized via callback functions. Inside these callback functions, session can be saved to disk or put into a database using the d2i_SSL_SESSION(3) interface.

                                                                                                                                                          The new_session_cb() is called whenever a new session has been negotiated and session caching is enabled (see SSL_CTX_set_session_cache_mode(3)). The new_session_cb() is passed the ssl connection and the nascent ssl session sess. Since sessions are reference-counted objects, the reference count on the session is incremented before the callback, on behalf of the application. If the callback returns 0, the session will be immediately removed from the internal cache and the reference count released. If the callback returns 1, the application retains the reference (for an entry in the application-maintained \"external session cache\"), and is responsible for calling SSL_SESSION_free() when the session reference is no longer in use.

                                                                                                                                                          Note that in TLSv1.3, sessions are established after the main handshake has completed. The server decides when to send the client the session information and this may occur some time after the end of the handshake (or not at all). This means that applications should expect the new_session_cb() function to be invoked during the handshake (for <= TLSv1.2) or after the handshake (for TLSv1.3). It is also possible in TLSv1.3 for multiple sessions to be established with a single connection. In these case the new_session_cb() function will be invoked multiple times.

                                                                                                                                                          In TLSv1.3 it is recommended that each SSL_SESSION object is only used for resumption once. One way of enforcing that is for applications to call SSL_CTX_remove_session(3) after a session has been used.

                                                                                                                                                          The remove_session_cb() is called whenever the SSL engine removes a session from the internal cache. This can happen when the session is removed because it is expired or when a connection was not shutdown cleanly. It also happens for all sessions in the internal session cache when SSL_CTX_free(3) is called. The remove_session_cb() is passed the ctx and the ssl session sess. It does not provide any feedback.

                                                                                                                                                          The get_session_cb() is only called on SSL/TLS servers, and is given the session id proposed by the client. The get_session_cb() is always called, even when session caching was disabled. The get_session_cb() is passed the ssl connection and the session id of length length at the memory location data. By setting the parameter copy to 1, the callback can require the SSL engine to increment the reference count of the SSL_SESSION object; setting copy to 0 causes the reference count to remain unchanged. If the get_session_cb() does not write to copy, the reference count is incremented and the session must be explicitly freed with SSL_SESSION_free(3).

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_get_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb() and SSL_CTX_sess_get_get_cb() return different callback function pointers respectively.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_get_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), d2i_SSL_SESSION(3), SSL_CTX_set_session_cache_mode(3), SSL_CTX_flush_sessions(3), SSL_SESSION_free(3), SSL_CTX_free(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sess_set_get_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sessions/","title":"SSL_CTX_sessions","text":""},{"location":"man3/SSL_CTX_sessions/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_sessions - access internal session cache

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sessions/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nLHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_sessions/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_sessions() returns a pointer to the lhash databases containing the internal session cache for ctx.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sessions/#notes","title":"NOTES","text":"

                                                                                                                                                          The sessions in the internal session cache are kept in an LHASH(3) type database. It is possible to directly access this database e.g. for searching. In parallel, the sessions form a linked list which is maintained separately from the LHASH(3) operations, so that the database must not be modified directly but by using the SSL_CTX_add_session(3) family of functions.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sessions/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_sessions() returns a pointer to the lhash of SSL_SESSION.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sessions/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), LHASH(3), SSL_CTX_add_session(3), SSL_CTX_set_session_cache_mode(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_sessions/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/","title":"SSL_CTX_set0_CA_list","text":""},{"location":"man3/SSL_CTX_set0_CA_list/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_client_CA_list, SSL_set_client_CA_list, SSL_get_client_CA_list, SSL_CTX_get_client_CA_list, SSL_CTX_add_client_CA, SSL_add_client_CA, SSL_set0_CA_list, SSL_CTX_set0_CA_list, SSL_get0_CA_list, SSL_CTX_get0_CA_list, SSL_add1_to_CA_list, SSL_CTX_add1_to_CA_list, SSL_get0_peer_CA_list - get or set CA list

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *list);\nvoid SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *list);\nSTACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);\nSTACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx);\nint SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *cacert);\nint SSL_add_client_CA(SSL *ssl, X509 *cacert);\n\nvoid SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);\nvoid SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);\nconst STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx);\nconst STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s);\nint SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x);\nint SSL_add1_to_CA_list(SSL *ssl, const X509 *x);\n\nconst STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The functions described here set and manage the list of CA names that are sent between two communicating peers.

                                                                                                                                                          For TLS versions 1.2 and earlier the list of CA names is only sent from the server to the client when requesting a client certificate. So any list of CA names set is never sent from client to server and the list of CA names retrieved by SSL_get0_peer_CA_list() is always NULL.

                                                                                                                                                          For TLS 1.3 the list of CA names is sent using the certificate_authorities extension and may be sent by a client (in the ClientHello message) or by a server (when requesting a certificate).

                                                                                                                                                          In most cases it is not necessary to set CA names on the client side. The list of CA names that are acceptable to the client will be sent in plaintext to the server. This has privacy implications and may also have performance implications if the list is large. This optional capability was introduced as part of TLSv1.3 and therefore setting CA names on the client side will have no impact if that protocol version has been disabled. Most servers do not need this and so this should be avoided unless required.

                                                                                                                                                          The \"client CA list\" functions below only have an effect when called on the server side.

                                                                                                                                                          SSL_CTX_set_client_CA_list() sets the list of CAs sent to the client when requesting a client certificate for ctx. Ownership of list is transferred to ctx and it should not be freed by the caller.

                                                                                                                                                          SSL_set_client_CA_list() sets the list of CAs sent to the client when requesting a client certificate for the chosen ssl, overriding the setting valid for ssl's SSL_CTX object. Ownership of list is transferred to s and it should not be freed by the caller.

                                                                                                                                                          SSL_CTX_get_client_CA_list() returns the list of client CAs explicitly set for ctx using SSL_CTX_set_client_CA_list(). The returned list should not be freed by the caller.

                                                                                                                                                          SSL_get_client_CA_list() returns the list of client CAs explicitly set for ssl using SSL_set_client_CA_list() or ssl's SSL_CTX object with SSL_CTX_set_client_CA_list(), when in server mode. In client mode, SSL_get_client_CA_list returns the list of client CAs sent from the server, if any. The returned list should not be freed by the caller.

                                                                                                                                                          SSL_CTX_add_client_CA() adds the CA name extracted from cacert to the list of CAs sent to the client when requesting a client certificate for ctx.

                                                                                                                                                          SSL_add_client_CA() adds the CA name extracted from cacert to the list of CAs sent to the client when requesting a client certificate for the chosen ssl, overriding the setting valid for ssl's SSL_CTX object.

                                                                                                                                                          SSL_get0_peer_CA_list() retrieves the list of CA names (if any) the peer has sent. This can be called on either the server or the client side. The returned list should not be freed by the caller.

                                                                                                                                                          The \"generic CA list\" functions below are very similar to the \"client CA list\" functions except that they have an effect on both the server and client sides. The lists of CA names managed are separate - so you cannot (for example) set CA names using the \"client CA list\" functions and then get them using the \"generic CA list\" functions. Where a mix of the two types of functions has been used on the server side then the \"client CA list\" functions take precedence. Typically, on the server side, the \"client CA list \" functions should be used in preference. As noted above in most cases it is not necessary to set CA names on the client side.

                                                                                                                                                          SSL_CTX_set0_CA_list() sets the list of CAs to be sent to the peer to name_list. Ownership of name_list is transferred to ctx and it should not be freed by the caller.

                                                                                                                                                          SSL_set0_CA_list() sets the list of CAs to be sent to the peer to name_list overriding any list set in the parent SSL_CTX of s. Ownership of name_list is transferred to s and it should not be freed by the caller.

                                                                                                                                                          SSL_CTX_get0_CA_list() retrieves any previously set list of CAs set for ctx. The returned list should not be freed by the caller.

                                                                                                                                                          SSL_get0_CA_list() retrieves any previously set list of CAs set for s or if none are set the list from the parent SSL_CTX is retrieved. The returned list should not be freed by the caller.

                                                                                                                                                          SSL_CTX_add1_to_CA_list() appends the CA subject name extracted from x to the list of CAs sent to peer for ctx.

                                                                                                                                                          SSL_add1_to_CA_list() appends the CA subject name extracted from x to the list of CAs sent to the peer for s, overriding the setting in the parent SSL_CTX.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/#notes","title":"NOTES","text":"

                                                                                                                                                          When a TLS/SSL server requests a client certificate (see SSL_CTX_set_verify(3)), it sends a list of CAs, for which it will accept certificates, to the client.

                                                                                                                                                          This list must explicitly be set using SSL_CTX_set_client_CA_list() or SSL_CTX_set0_CA_list() for ctx and SSL_set_client_CA_list() or SSL_set0_CA_list() for the specific ssl. The list specified overrides the previous setting. The CAs listed do not become trusted (list only contains the names, not the complete certificates); use SSL_CTX_load_verify_locations(3) to additionally load them for verification.

                                                                                                                                                          If the list of acceptable CAs is compiled in a file, the SSL_load_client_CA_file(3) function can be used to help to import the necessary data.

                                                                                                                                                          SSL_CTX_add_client_CA(), SSL_CTX_add1_to_CA_list(), SSL_add_client_CA() and SSL_add1_to_CA_list() can be used to add additional items the list of CAs. If no list was specified before using SSL_CTX_set_client_CA_list(), SSL_CTX_set0_CA_list(), SSL_set_client_CA_list() or SSL_set0_CA_list(), a new CA list for ctx or ssl (as appropriate) is opened.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_client_CA_list(), SSL_set_client_CA_list(), SSL_CTX_set_client_CA_list(), SSL_set_client_CA_list(), SSL_CTX_set0_CA_list() and SSL_set0_CA_list() do not return a value.

                                                                                                                                                          SSL_CTX_get_client_CA_list(), SSL_get_client_CA_list(), SSL_CTX_get0_CA_list() and SSL_get0_CA_list() return a stack of CA names or NULL is no CA names are set.

                                                                                                                                                          SSL_CTX_add_client_CA(),SSL_add_client_CA(), SSL_CTX_add1_to_CA_list() and SSL_add1_to_CA_list() return 1 for success and 0 for failure.

                                                                                                                                                          SSL_get0_peer_CA_list() returns a stack of CA names sent by the peer or NULL or an empty stack if no list was sent.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Scan all certificates in CAfile and list them as acceptable CAs:

                                                                                                                                                          SSL_CTX_set_client_CA_list(ctx, SSL_load_client_CA_file(CAfile));\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_load_client_CA_file(3), SSL_CTX_load_verify_locations(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set0_CA_list/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/","title":"SSL_CTX_set1_curves","text":""},{"location":"man3/SSL_CTX_set1_curves/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set1_groups, SSL_CTX_set1_groups_list, SSL_set1_groups, SSL_set1_groups_list, SSL_get1_groups, SSL_get_shared_group, SSL_get_negotiated_group, SSL_CTX_set1_curves, SSL_CTX_set1_curves_list, SSL_set1_curves, SSL_set1_curves_list, SSL_get1_curves, SSL_get_shared_curve - EC supported curve functions

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_set1_groups(SSL_CTX *ctx, int *glist, int glistlen);\nint SSL_CTX_set1_groups_list(SSL_CTX *ctx, char *list);\n\nint SSL_set1_groups(SSL *ssl, int *glist, int glistlen);\nint SSL_set1_groups_list(SSL *ssl, char *list);\n\nint SSL_get1_groups(SSL *ssl, int *groups);\nint SSL_get_shared_group(SSL *s, int n);\nint SSL_get_negotiated_group(SSL *s);\n\nint SSL_CTX_set1_curves(SSL_CTX *ctx, int *clist, int clistlen);\nint SSL_CTX_set1_curves_list(SSL_CTX *ctx, char *list);\n\nint SSL_set1_curves(SSL *ssl, int *clist, int clistlen);\nint SSL_set1_curves_list(SSL *ssl, char *list);\n\nint SSL_get1_curves(SSL *ssl, int *curves);\nint SSL_get_shared_curve(SSL *s, int n);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          For all of the functions below that set the supported groups there must be at least one group in the list. A number of these functions identify groups via a unique integer NID value. However, support for some groups may be added by external providers. In this case there will be no NID assigned for the group. When setting such groups applications should use the \"list\" form of these functions (i.e. SSL_CTX_set1_groups_list() and SSL_set1_groups_list).

                                                                                                                                                          SSL_CTX_set1_groups() sets the supported groups for ctx to glistlen groups in the array glist. The array consist of all NIDs of groups in preference order. For a TLS client the groups are used directly in the supported groups extension. For a TLS server the groups are used to determine the set of shared groups. Currently supported groups for TLSv1.3 are NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1, NID_X25519, NID_X448, NID_ffdhe2048, NID_ffdhe3072, NID_ffdhe4096, NID_ffdhe6144 and NID_ffdhe8192.

                                                                                                                                                          SSL_CTX_set1_groups_list() sets the supported groups for ctx to string list. The string is a colon separated list of group NIDs or names, for example \"P-521:P-384:P-256:X25519:ffdhe2048\". Currently supported groups for TLSv1.3 are P-256, P-384, P-521, X25519, X448, ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144, ffdhe8192. Support for other groups may be added by external providers.

                                                                                                                                                          SSL_set1_groups() and SSL_set1_groups_list() are similar except they set supported groups for the SSL structure ssl.

                                                                                                                                                          SSL_get1_groups() returns the set of supported groups sent by a client in the supported groups extension. It returns the total number of supported groups. The groups parameter can be NULL to simply return the number of groups for memory allocation purposes. The groups array is in the form of a set of group NIDs in preference order. It can return zero if the client did not send a supported groups extension. If a supported group NID is unknown then the value is set to the bitwise OR of TLSEXT_nid_unknown (0x1000000) and the id of the group.

                                                                                                                                                          SSL_get_shared_group() returns the NID of the shared group n for a server-side SSL ssl. If n is -1 then the total number of shared groups is returned, which may be zero. Other than for diagnostic purposes, most applications will only be interested in the first shared group so n is normally set to zero. If the value n is out of range, NID_undef is returned. If the NID for the shared group is unknown then the value is set to the bitwise OR of TLSEXT_nid_unknown (0x1000000) and the id of the group.

                                                                                                                                                          SSL_get_negotiated_group() returns the NID of the negotiated group used for the handshake key exchange process. For TLSv1.3 connections this typically reflects the state of the current connection, though in the case of PSK-only resumption, the returned value will be from a previous connection. For earlier TLS versions, when a session has been resumed, it always reflects the group used for key exchange during the initial handshake (otherwise it is from the current, non-resumption, connection). This can be called by either client or server. If the NID for the shared group is unknown then the value is set to the bitwise OR of TLSEXT_nid_unknown (0x1000000) and the id of the group.

                                                                                                                                                          All these functions are implemented as macros.

                                                                                                                                                          The curve functions are synonyms for the equivalently named group functions and are identical in every respect. They exist because, prior to TLS1.3, there was only the concept of supported curves. In TLS1.3 this was renamed to supported groups, and extended to include Diffie Hellman groups. The group functions should be used in preference.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/#notes","title":"NOTES","text":"

                                                                                                                                                          If an application wishes to make use of several of these functions for configuration purposes either on a command line or in a file it should consider using the SSL_CONF interface instead of manually parsing options.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set1_groups(), SSL_CTX_set1_groups_list(), SSL_set1_groups() and SSL_set1_groups_list(), return 1 for success and 0 for failure.

                                                                                                                                                          SSL_get1_groups() returns the number of groups, which may be zero.

                                                                                                                                                          SSL_get_shared_group() returns the NID of shared group n or NID_undef if there is no shared group n; or the total number of shared groups if n is -1.

                                                                                                                                                          When called on a client ssl, SSL_get_shared_group() has no meaning and returns -1.

                                                                                                                                                          SSL_get_negotiated_group() returns the NID of the negotiated group used for key exchange, or NID_undef if there was no negotiated group.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_add_extra_chain_cert(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/#history","title":"HISTORY","text":"

                                                                                                                                                          The curve functions were added in OpenSSL 1.0.2. The equivalent group functions were added in OpenSSL 1.1.1. The SSL_get_negotiated_group() function was added in OpenSSL 3.0.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_curves/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/","title":"SSL_CTX_set1_sigalgs","text":""},{"location":"man3/SSL_CTX_set1_sigalgs/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set1_sigalgs, SSL_set1_sigalgs, SSL_CTX_set1_sigalgs_list, SSL_set1_sigalgs_list, SSL_CTX_set1_client_sigalgs, SSL_set1_client_sigalgs, SSL_CTX_set1_client_sigalgs_list, SSL_set1_client_sigalgs_list - set supported signature algorithms

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nlong SSL_CTX_set1_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen);\nlong SSL_set1_sigalgs(SSL *ssl, const int *slist, long slistlen);\nlong SSL_CTX_set1_sigalgs_list(SSL_CTX *ctx, const char *str);\nlong SSL_set1_sigalgs_list(SSL *ssl, const char *str);\n\nlong SSL_CTX_set1_client_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen);\nlong SSL_set1_client_sigalgs(SSL *ssl, const int *slist, long slistlen);\nlong SSL_CTX_set1_client_sigalgs_list(SSL_CTX *ctx, const char *str);\nlong SSL_set1_client_sigalgs_list(SSL *ssl, const char *str);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set1_sigalgs() and SSL_set1_sigalgs() set the supported signature algorithms for ctx or ssl. The array slist of length slistlen must consist of pairs of NIDs corresponding to digest and public key algorithms.

                                                                                                                                                          SSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list() set the supported signature algorithms for ctx or ssl. The str parameter must be a null terminated string consisting of a colon separated list of elements, where each element is either a combination of a public key algorithm and a digest separated by +, or a TLS 1.3-style named SignatureScheme such as rsa_pss_pss_sha256.

                                                                                                                                                          SSL_CTX_set1_client_sigalgs(), SSL_set1_client_sigalgs(), SSL_CTX_set1_client_sigalgs_list() and SSL_set1_client_sigalgs_list() set signature algorithms related to client authentication, otherwise they are identical to SSL_CTX_set1_sigalgs(), SSL_set1_sigalgs(), SSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list().

                                                                                                                                                          All these functions are implemented as macros. The signature algorithm parameter (integer array or string) is not freed: the application should free it, if necessary.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/#notes","title":"NOTES","text":"

                                                                                                                                                          If an application wishes to allow the setting of signature algorithms as one of many user configurable options it should consider using the more flexible SSL_CONF API instead.

                                                                                                                                                          The signature algorithms set by a client are used directly in the supported signature algorithm in the client hello message.

                                                                                                                                                          The supported signature algorithms set by a server are not sent to the client but are used to determine the set of shared signature algorithms and (if server preferences are set with SSL_OP_CIPHER_SERVER_PREFERENCE) their order.

                                                                                                                                                          The client authentication signature algorithms set by a server are sent in a certificate request message if client authentication is enabled, otherwise they are unused.

                                                                                                                                                          Similarly client authentication signature algorithms set by a client are used to determined the set of client authentication shared signature algorithms.

                                                                                                                                                          Signature algorithms will neither be advertised nor used if the security level prohibits them (for example SHA1 if the security level is 4 or more).

                                                                                                                                                          Currently the NID_md5, NID_sha1, NID_sha224, NID_sha256, NID_sha384 and NID_sha512 digest NIDs are supported and the public key algorithm NIDs EVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA and EVP_PKEY_EC.

                                                                                                                                                          The short or long name values for digests can be used in a string (for example \"MD5\", \"SHA1\", \"SHA224\", \"SHA256\", \"SHA384\", \"SHA512\") and the public key algorithm strings \"RSA\", \"RSA-PSS\", \"DSA\" or \"ECDSA\".

                                                                                                                                                          The TLS 1.3 signature scheme names (such as \"rsa_pss_pss_sha256\") can also be used with the _list forms of the API.

                                                                                                                                                          The use of MD5 as a digest is strongly discouraged due to security weaknesses.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          All these functions return 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA using an array:

                                                                                                                                                          const int slist[] = {NID_sha256, EVP_PKEY_EC, NID_sha256, EVP_PKEY_RSA};\n\nSSL_CTX_set1_sigalgs(ctx, slist, 4);\n

                                                                                                                                                          Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA using a string:

                                                                                                                                                          SSL_CTX_set1_sigalgs_list(ctx, \"ECDSA+SHA256:RSA+SHA256\");\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_get_shared_sigalgs(3), SSL_CONF_CTX_new(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_sigalgs/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/","title":"SSL_CTX_set1_verify_cert_store","text":""},{"location":"man3/SSL_CTX_set1_verify_cert_store/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set0_verify_cert_store, SSL_CTX_set1_verify_cert_store, SSL_CTX_set0_chain_cert_store, SSL_CTX_set1_chain_cert_store, SSL_set0_verify_cert_store, SSL_set1_verify_cert_store, SSL_set0_chain_cert_store, SSL_set1_chain_cert_store, SSL_CTX_get0_verify_cert_store, SSL_CTX_get0_chain_cert_store, SSL_get0_verify_cert_store, SSL_get0_chain_cert_store - set certificate verification or chain store

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_set0_verify_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_set1_verify_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_set0_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_set1_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);\nint SSL_CTX_get0_verify_cert_store(SSL_CTX *ctx, X509_STORE **st);\nint SSL_CTX_get0_chain_cert_store(SSL_CTX *ctx, X509_STORE **st);\n\nint SSL_set0_verify_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_set1_verify_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_set0_chain_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_set1_chain_cert_store(SSL *ctx, X509_STORE *st);\nint SSL_get0_verify_cert_store(SSL *ctx, X509_STORE **st);\nint SSL_get0_chain_cert_store(SSL *ctx, X509_STORE **st);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set0_verify_cert_store() and SSL_CTX_set1_verify_cert_store() set the certificate store used for certificate verification to st.

                                                                                                                                                          SSL_CTX_set0_chain_cert_store() and SSL_CTX_set1_chain_cert_store() set the certificate store used for certificate chain building to st.

                                                                                                                                                          SSL_set0_verify_cert_store(), SSL_set1_verify_cert_store(), SSL_set0_chain_cert_store() and SSL_set1_chain_cert_store() are similar except they apply to SSL structure ssl.

                                                                                                                                                          SSL_CTX_get0_verify_chain_store(), SSL_get0_verify_chain_store(), SSL_CTX_get0_chain_cert_store() and SSL_get0_chain_cert_store() retrieve the objects previously set via the above calls. A pointer to the object (or NULL if no such object has been set) is written to *st.

                                                                                                                                                          All these functions are implemented as macros. Those containing a 1 increment the reference count of the supplied store so it must be freed at some point after the operation. Those containing a 0 do not increment reference counts and the supplied store MUST NOT be freed after the operation.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#notes","title":"NOTES","text":"

                                                                                                                                                          The stores pointers associated with an SSL_CTX structure are copied to any SSL structures when SSL_new() is called. As a result SSL structures will not be affected if the parent SSL_CTX store pointer is set to a new value.

                                                                                                                                                          The verification store is used to verify the certificate chain sent by the peer: that is an SSL/TLS client will use the verification store to verify the server's certificate chain and a SSL/TLS server will use it to verify any client certificate chain.

                                                                                                                                                          The chain store is used to build the certificate chain. Details of the chain building and checking process are described in \"Certification Path Building\" in openssl-verification-options(1) and \"Certification Path Validation\" in openssl-verification-options(1).

                                                                                                                                                          If the mode SSL_MODE_NO_AUTO_CHAIN is set or a certificate chain is configured already (for example using the functions such as SSL_CTX_add1_chain_cert(3) or SSL_CTX_add_extra_chain_cert(3)) then automatic chain building is disabled.

                                                                                                                                                          If the mode SSL_MODE_NO_AUTO_CHAIN is set then automatic chain building is disabled.

                                                                                                                                                          If the chain or the verification store is not set then the store associated with the parent SSL_CTX is used instead to retain compatibility with previous versions of OpenSSL.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          All these functions return 1 for success and 0 for failure.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_add_extra_chain_cert(3) SSL_CTX_set0_chain(3) SSL_CTX_set1_chain(3) SSL_CTX_add0_chain_cert(3) SSL_CTX_add1_chain_cert(3) SSL_set0_chain(3) SSL_set1_chain(3) SSL_add0_chain_cert(3) SSL_add1_chain_cert(3) SSL_CTX_build_cert_chain(3) SSL_build_cert_chain(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#history","title":"HISTORY","text":"

                                                                                                                                                          These functions were added in OpenSSL 1.0.2.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set1_verify_cert_store/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2013-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_alpn_select_cb/","title":"SSL_CTX_set_alpn_select_cb","text":""},{"location":"man3/SSL_CTX_set_alpn_select_cb/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_alpn_protos, SSL_set_alpn_protos, SSL_CTX_set_alpn_select_cb, SSL_CTX_set_next_proto_select_cb, SSL_CTX_set_next_protos_advertised_cb, SSL_select_next_proto, SSL_get0_alpn_selected, SSL_get0_next_proto_negotiated - handle application layer protocol negotiation (ALPN)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos,\n                            unsigned int protos_len);\nint SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos,\n                        unsigned int protos_len);\nvoid SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx,\n                                int (*cb) (SSL *ssl,\n                                           const unsigned char **out,\n                                           unsigned char *outlen,\n                                           const unsigned char *in,\n                                           unsigned int inlen,\n                                           void *arg), void *arg);\nvoid SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data,\n                            unsigned int *len);\n\nvoid SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *ctx,\n                                           int (*cb)(SSL *ssl,\n                                                     const unsigned char **out,\n                                                     unsigned int *outlen,\n                                                     void *arg),\n                                           void *arg);\nvoid SSL_CTX_set_next_proto_select_cb(SSL_CTX *ctx,\n                              int (*cb)(SSL *s,\n                                        unsigned char **out,\n                                        unsigned char *outlen,\n                                        const unsigned char *in,\n                                        unsigned int inlen,\n                                        void *arg),\n                              void *arg);\nint SSL_select_next_proto(unsigned char **out, unsigned char *outlen,\n                          const unsigned char *server,\n                          unsigned int server_len,\n                          const unsigned char *client,\n                          unsigned int client_len);\nvoid SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data,\n                            unsigned *len);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() are used by the client to set the list of protocols available to be negotiated. The protos must be in protocol-list format, described below. The length of protos is specified in protos_len. Setting protos_len to 0 clears any existing list of ALPN protocols and no ALPN extension will be sent to the server.

                                                                                                                                                          SSL_CTX_set_alpn_select_cb() sets the application callback cb used by a server to select which protocol to use for the incoming connection. When cb is NULL, ALPN is not used. The arg value is a pointer which is passed to the application callback.

                                                                                                                                                          cb is the application defined callback. The in, inlen parameters are a vector in protocol-list format. The value of the out, outlen vector should be set to the value of a single protocol selected from the in, inlen vector. The out buffer may point directly into in, or to a buffer that outlives the handshake. The arg parameter is the pointer set via SSL_CTX_set_alpn_select_cb().

                                                                                                                                                          SSL_select_next_proto() is a helper function used to select protocols. It implements the standard protocol selection. It is expected that this function is called from the application callback cb. The protocol data in server, server_len and client, client_len must be in the protocol-list format described below. The first item in the server, server_len list that matches an item in the client, client_len list is selected, and returned in out, outlen. The out value will point into either server or client, so it should be copied immediately. The client list must include at least one valid (nonempty) protocol entry in the list.

                                                                                                                                                          The SSL_select_next_proto() helper function can be useful from either the ALPN callback or the NPN callback (described below). If no match is found, the first item in client, client_len is returned in out, outlen and OPENSSL_NPN_NO_OVERLAP is returned. This can be useful when implementating the NPN callback. In the ALPN case, the value returned in out and outlen must be ignored if OPENSSL_NPN_NO_OVERLAP has been returned from SSL_select_next_proto().

                                                                                                                                                          SSL_CTX_set_next_proto_select_cb() sets a callback cb that is called when a client needs to select a protocol from the server's provided list, and a user-defined pointer argument arg which will be passed to this callback. For the callback itself, out must be set to point to the selected protocol (which may be within in). The length of the protocol name must be written into outlen. The server's advertised protocols are provided in in and inlen. The callback can assume that in is syntactically valid. The client must select a protocol (although it may be an empty, zero length protocol). It is fatal to the connection if this callback returns a value other than SSL_TLSEXT_ERR_OK or if the zero length protocol is selected. The arg parameter is the pointer set via SSL_CTX_set_next_proto_select_cb().

                                                                                                                                                          SSL_CTX_set_next_protos_advertised_cb() sets a callback cb that is called when a TLS server needs a list of supported protocols for Next Protocol Negotiation. The returned list must be in protocol-list format, described below. The list is returned by setting out to point to it and outlen to its length. This memory will not be modified, but the SSL does keep a reference to it. The callback should return SSL_TLSEXT_ERR_OK if it wishes to advertise. Otherwise, no such extension will be included in the ServerHello.

                                                                                                                                                          SSL_get0_alpn_selected() returns a pointer to the selected protocol in data with length len. It is not NUL-terminated. data is set to NULL and len is set to 0 if no protocol has been selected. data must not be freed.

                                                                                                                                                          SSL_get0_next_proto_negotiated() sets data and len to point to the client's requested protocol for this connection. If the client did not request any protocol or NPN is not enabled, then data is set to NULL and len to 0. Note that the client can request any protocol it chooses. The value returned from this function need not be a member of the list of supported protocols provided by the callback.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#notes","title":"NOTES","text":"

                                                                                                                                                          The protocol-lists must be in wire-format, which is defined as a vector of nonempty, 8-bit length-prefixed, byte strings. The length-prefix byte is not included in the length. Each string is limited to 255 bytes. A byte-string length of 0 is invalid. A truncated byte-string is invalid. The length of the vector is not in the vector itself, but in a separate variable.

                                                                                                                                                          Example:

                                                                                                                                                          unsigned char vector[] = {\n    6, 's', 'p', 'd', 'y', '/', '1',\n    8, 'h', 't', 't', 'p', '/', '1', '.', '1'\n};\nunsigned int length = sizeof(vector);\n

                                                                                                                                                          The ALPN callback is executed after the servername callback; as that servername callback may update the SSL_CTX, and subsequently, the ALPN callback.

                                                                                                                                                          If there is no ALPN proposed in the ClientHello, the ALPN callback is not invoked.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() return 0 on success, and non-0 on failure. WARNING: these functions reverse the return value convention.

                                                                                                                                                          SSL_select_next_proto() returns one of the following:

                                                                                                                                                          • OPENSSL_NPN_NEGOTIATED

                                                                                                                                                            A match was found and is returned in out, outlen.

                                                                                                                                                          • OPENSSL_NPN_NO_OVERLAP

                                                                                                                                                            No match was found. The first item in client, client_len is returned in out, outlen (or NULL and 0 in the case where the first entry in client is invalid).

                                                                                                                                                          The ALPN select callback cb, must return one of the following:

                                                                                                                                                          • SSL_TLSEXT_ERR_OK

                                                                                                                                                            ALPN protocol selected.

                                                                                                                                                          • SSL_TLSEXT_ERR_ALERT_FATAL

                                                                                                                                                            There was no overlap between the client's supplied list and the server configuration.

                                                                                                                                                          • SSL_TLSEXT_ERR_NOACK

                                                                                                                                                            ALPN protocol not selected, e.g., because no ALPN protocols are configured for this connection.

                                                                                                                                                          The callback set using SSL_CTX_set_next_proto_select_cb() should return SSL_TLSEXT_ERR_OK if successful. Any other value is fatal to the connection.

                                                                                                                                                          The callback set using SSL_CTX_set_next_protos_advertised_cb() should return SSL_TLSEXT_ERR_OK if it wishes to advertise. Otherwise, no such extension will be included in the ServerHello.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_tlsext_servername_callback(3), SSL_CTX_set_tlsext_servername_arg(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_alpn_select_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_cb/","title":"SSL_CTX_set_cert_cb","text":""},{"location":"man3/SSL_CTX_set_cert_cb/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_cert_cb, SSL_set_cert_cb - handle certificate callback function

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cert_cb)(SSL *ssl, void *arg),\n                         void *arg);\nvoid SSL_set_cert_cb(SSL *s, int (*cert_cb)(SSL *ssl, void *arg), void *arg);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_cert_cb() and SSL_set_cert_cb() sets the cert_cb callback, arg value is pointer which is passed to the application callback.

                                                                                                                                                          When cert_cb is NULL, no callback function is used.

                                                                                                                                                          cert_cb is the application defined callback. It is called before a certificate will be used by a client or server. The callback can then inspect the passed ssl structure and set or clear any appropriate certificates. If the callback is successful it MUST return 1 even if no certificates have been set. A zero is returned on error which will abort the handshake with a fatal internal error alert. A negative return value will suspend the handshake and the handshake function will return immediately. SSL_get_error(3) will return SSL_ERROR_WANT_X509_LOOKUP to indicate, that the handshake was suspended. The next call to the handshake function will again lead to the call of cert_cb. It is the job of the cert_cb to store information about the state of the last call, if required to continue.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_cb/#notes","title":"NOTES","text":"

                                                                                                                                                          An application will typically call SSL_use_certificate() and SSL_use_PrivateKey() to set the end entity certificate and private key. It can add intermediate and optionally the root CA certificates using SSL_add1_chain_cert().

                                                                                                                                                          It might also call SSL_certs_clear() to delete any certificates associated with the SSL object.

                                                                                                                                                          The certificate callback functionality supersedes the (largely broken) functionality provided by the old client certificate callback interface. It is always called even is a certificate is already set so the callback can modify or delete the existing certificate.

                                                                                                                                                          A more advanced callback might examine the handshake parameters and set whatever chain is appropriate. For example a legacy client supporting only TLSv1.0 might receive a certificate chain signed using SHA1 whereas a TLSv1.2 or later client which advertises support for SHA256 could receive a chain using SHA256.

                                                                                                                                                          Normal server sanity checks are performed on any certificates set by the callback. So if an EC chain is set for a curve the client does not support it will not be used.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_cert_cb() and SSL_set_cert_cb() do not return values.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_use_certificate(3), SSL_add1_chain_cert(3), SSL_get_client_CA_list(3), SSL_clear(3), SSL_free(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2014-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/","title":"SSL_CTX_set_cert_store","text":""},{"location":"man3/SSL_CTX_set_cert_store/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_cert_store, SSL_CTX_set1_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate verification storage

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store);\nvoid SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store);\nX509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_cert_store() sets/replaces the certificate verification storage of ctx to/with store. If another X509_STORE object is currently set in ctx, it will be X509_STORE_free()ed. SSL_CTX_set_cert_store() will take ownership of the store, i.e., the call X509_STORE_free(store) is no longer needed.

                                                                                                                                                          SSL_CTX_set1_cert_store() sets/replaces the certificate verification storage of ctx to/with store. The store's reference count is incremented. If another X509_STORE object is currently set in ctx, it will be X509_STORE_free()ed.

                                                                                                                                                          SSL_CTX_get_cert_store() returns a pointer to the current certificate verification storage.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/#notes","title":"NOTES","text":"

                                                                                                                                                          In order to verify the certificates presented by the peer, trusted CA certificates must be accessed. These CA certificates are made available via lookup methods, handled inside the X509_STORE. From the X509_STORE the X509_STORE_CTX used when verifying certificates is created.

                                                                                                                                                          Typically the trusted certificate store is handled indirectly via using SSL_CTX_load_verify_locations(3). Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions it is possible to manipulate the X509_STORE object beyond the SSL_CTX_load_verify_locations(3) call.

                                                                                                                                                          Currently no detailed documentation on how to use the X509_STORE object is available. Not all members of the X509_STORE are used when the verification takes place. So will e.g. the verify_callback() be overridden with the verify_callback() set via the SSL_CTX_set_verify(3) family of functions. This document must therefore be updated when documentation about the X509_STORE object and its handling becomes available.

                                                                                                                                                          SSL_CTX_set_cert_store() does not increment the store's reference count, so it should not be used to assign an X509_STORE that is owned by another SSL_CTX.

                                                                                                                                                          To share X509_STOREs between two SSL_CTXs, use SSL_CTX_get_cert_store() to get the X509_STORE from the first SSL_CTX, and then use SSL_CTX_set1_cert_store() to assign to the second SSL_CTX and increment the reference count of the X509_STORE.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/#restrictions","title":"RESTRICTIONS","text":"

                                                                                                                                                          The X509_STORE structure used by an SSL_CTX is used for verifying peer certificates and building certificate chains, it is also shared by every child SSL structure. Applications wanting finer control can use functions such as SSL_CTX_set1_verify_cert_store() instead.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_cert_store() does not return diagnostic output.

                                                                                                                                                          SSL_CTX_set1_cert_store() does not return diagnostic output.

                                                                                                                                                          SSL_CTX_get_cert_store() returns the current setting.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_load_verify_locations(3), SSL_CTX_set_verify(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_store/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/","title":"SSL_CTX_set_cert_verify_callback","text":""},{"location":"man3/SSL_CTX_set_cert_verify_callback/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_cert_verify_callback - set peer certificate verification procedure

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx,\n                                      int (*callback)(X509_STORE_CTX *, void *),\n                                      void *arg);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_cert_verify_callback() sets the verification callback function for ctx. SSL objects that are created from ctx inherit the setting valid at the time when SSL_new(3) is called.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#notes","title":"NOTES","text":"

                                                                                                                                                          When a peer certificate has been received during a SSL/TLS handshake, a verification function is called regardless of the verification mode. If the application does not explicitly specify a verification callback function, the built-in verification function is used. If a verification callback callback is specified via SSL_CTX_set_cert_verify_callback(), the supplied callback function is called instead with the arguments callback(X509_STORE_CTX *x509_store_ctx, void *arg). The argument arg is specified by the application when setting callback. By setting callback to NULL, the default behaviour is restored.

                                                                                                                                                          callback should return 1 to indicate verification success and 0 to indicate verification failure. In server mode, a return value of 0 leads to handshake failure. In client mode, the behaviour is as follows. All values, including 0, are ignored if the verification mode is SSL_VERIFY_NONE. Otherwise, when the return value is less than or equal to 0, the handshake will fail.

                                                                                                                                                          In client mode callback may also call the SSL_set_retry_verify(3) function on the SSL object set in the x509_store_ctx ex data (see SSL_get_ex_data_X509_STORE_CTX_idx(3)) and return 1. This would be typically done in case the certificate verification was not yet able to succeed. This makes the handshake suspend and return control to the calling application with SSL_ERROR_WANT_RETRY_VERIFY. The app can for instance fetch further certificates or cert status information needed for the verification. Calling SSL_connect(3) again resumes the connection attempt by retrying the server certificate verification step. This process may even be repeated if need be.

                                                                                                                                                          In any case a viable verification result value must be reflected in the error member of x509_store_ctx, which can be done using X509_STORE_CTX_set_error(3). This is particularly important in case the callback allows the connection to continue (by returning 1). Note that the verification status in the store context is a possibly durable indication of the chain's validity! This gets recorded in the SSL session (and thus also in session tickets) and the validity of the originally presented chain is then visible on resumption, even though no chain is presented int that case. Moreover, the calling application will be informed about the detailed result of the verification procedure and may elect to base further decisions on it.

                                                                                                                                                          Within x509_store_ctx, callback has access to the verify_callback function set using SSL_CTX_set_verify(3).

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_cert_verify_callback() does not return a value.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#warnings","title":"WARNINGS","text":"

                                                                                                                                                          Do not mix the verification callback described in this function with the verify_callback function called during the verification process. The latter is set using the SSL_CTX_set_verify(3) family of functions.

                                                                                                                                                          Providing a complete verification procedure including certificate purpose settings etc is a complex task. The built-in procedure is quite powerful and in most cases it should be sufficient to modify its behaviour using the verify_callback function.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#bugs","title":"BUGS","text":"

                                                                                                                                                          SSL_CTX_set_cert_verify_callback() does not provide diagnostic information.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_verify(3), X509_STORE_CTX_set_error(3), SSL_get_verify_result(3), SSL_set_retry_verify(3), SSL_CTX_load_verify_locations(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cert_verify_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/","title":"SSL_CTX_set_cipher_list","text":""},{"location":"man3/SSL_CTX_set_cipher_list/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_cipher_list, SSL_set_cipher_list, SSL_CTX_set_ciphersuites, SSL_set_ciphersuites, OSSL_default_cipher_list, OSSL_default_ciphersuites - choose list of available SSL_CIPHERs

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);\nint SSL_set_cipher_list(SSL *ssl, const char *str);\n\nint SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);\nint SSL_set_ciphersuites(SSL *s, const char *str);\n\nconst char *OSSL_default_cipher_list(void);\nconst char *OSSL_default_ciphersuites(void);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_cipher_list() sets the list of available ciphers (TLSv1.2 and below) for ctx using the control string str. The format of the string is described in openssl-ciphers(1). The list of ciphers is inherited by all ssl objects created from ctx. This function does not impact TLSv1.3 ciphersuites. Use SSL_CTX_set_ciphersuites() to configure those.

                                                                                                                                                          SSL_set_cipher_list() sets the list of ciphers (TLSv1.2 and below) only for ssl.

                                                                                                                                                          SSL_CTX_set_ciphersuites() is used to configure the available TLSv1.3 ciphersuites for ctx. This is a simple colon (\":\") separated list of TLSv1.3 ciphersuite names in order of preference. Valid TLSv1.3 ciphersuite names are:

                                                                                                                                                          • TLS_AES_128_GCM_SHA256
                                                                                                                                                          • TLS_AES_256_GCM_SHA384
                                                                                                                                                          • TLS_CHACHA20_POLY1305_SHA256
                                                                                                                                                          • TLS_AES_128_CCM_SHA256
                                                                                                                                                          • TLS_AES_128_CCM_8_SHA256

                                                                                                                                                          An empty list is permissible. The default value for this setting is:

                                                                                                                                                          \"TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256\"

                                                                                                                                                          SSL_set_ciphersuites() is the same as SSL_CTX_set_ciphersuites() except it configures the ciphersuites for ssl.

                                                                                                                                                          OSSL_default_cipher_list() returns the default cipher string for TLSv1.2 (and earlier) ciphers. OSSL_default_ciphersuites() returns the default cipher string for TLSv1.3 ciphersuites.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/#notes","title":"NOTES","text":"

                                                                                                                                                          The control string str for SSL_CTX_set_cipher_list(), SSL_set_cipher_list(), SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() should be universally usable and not depend on details of the library configuration (ciphers compiled in). Thus no syntax checking takes place. Items that are not recognized, because the corresponding ciphers are not compiled in or because they are mistyped, are simply ignored. Failure is only flagged if no ciphers could be collected at all.

                                                                                                                                                          It should be noted, that inclusion of a cipher to be used into the list is a necessary condition. On the client side, the inclusion into the list is also sufficient unless the security level excludes it. On the server side, additional restrictions apply. All ciphers have additional requirements. ADH ciphers don't need a certificate, but DH-parameters must have been set. All other ciphers need a corresponding certificate and key.

                                                                                                                                                          An RSA cipher can only be chosen, when an RSA certificate is available. RSA ciphers using DHE need a certificate and key and additional DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

                                                                                                                                                          A DSA cipher can only be chosen, when a DSA certificate is available. DSA ciphers always use DH key exchange and therefore need DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

                                                                                                                                                          When these conditions are not met for any cipher in the list (e.g. a client only supports export RSA ciphers with an asymmetric key length of 512 bits and the server is not configured to use temporary RSA keys), the \"no shared cipher\" (SSL_R_NO_SHARED_CIPHER) error is generated and the handshake will fail.

                                                                                                                                                          OSSL_default_cipher_list() and OSSL_default_ciphersuites() replace SSL_DEFAULT_CIPHER_LIST and TLS_DEFAULT_CIPHERSUITES, respectively. The cipher list defines are deprecated as of 3.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher could be selected and 0 on complete failure.

                                                                                                                                                          SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() return 1 if the requested ciphersuite list was configured, and 0 otherwise.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_get_ciphers(3), SSL_CTX_use_certificate(3), SSL_CTX_set_tmp_dh_callback(3), openssl-ciphers(1)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/#history","title":"HISTORY","text":"

                                                                                                                                                          OSSL_default_cipher_list() and OSSL_default_ciphersites() are new in 3.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_cipher_list/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/","title":"SSL_CTX_set_client_cert_cb","text":""},{"location":"man3/SSL_CTX_set_client_cert_cb/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_client_cert_cb, SSL_CTX_get_client_cert_cb - handle client certificate callback function

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_client_cert_cb(SSL_CTX *ctx,\n                                int (*client_cert_cb)(SSL *ssl, X509 **x509,\n                                                      EVP_PKEY **pkey));\nint (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509,\n                                                EVP_PKEY **pkey);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_client_cert_cb() sets the client_cert_cb callback, that is called when a client certificate is requested by a server and no certificate was yet set for the SSL object.

                                                                                                                                                          When client_cert_cb is NULL, no callback function is used.

                                                                                                                                                          SSL_CTX_get_client_cert_cb() returns a pointer to the currently set callback function.

                                                                                                                                                          client_cert_cb is the application defined callback. If it wants to set a certificate, a certificate/private key combination must be set using the x509 and pkey arguments and \"1\" must be returned. The certificate will be installed into ssl, see the NOTES and BUGS sections. If no certificate should be set, \"0\" has to be returned and no certificate will be sent. A negative return value will suspend the handshake and the handshake function will return immediately. SSL_get_error(3) will return SSL_ERROR_WANT_X509_LOOKUP to indicate, that the handshake was suspended. The next call to the handshake function will again lead to the call of client_cert_cb. It is the job of the client_cert_cb to store information about the state of the last call, if required to continue.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/#notes","title":"NOTES","text":"

                                                                                                                                                          During a handshake (or renegotiation) a server may request a certificate from the client. A client certificate must only be sent, when the server did send the request.

                                                                                                                                                          When a certificate was set using the SSL_CTX_use_certificate(3) family of functions, it will be sent to the server. The TLS standard requires that only a certificate is sent, if it matches the list of acceptable CAs sent by the server. This constraint is violated by the default behavior of the OpenSSL library. Using the callback function it is possible to implement a proper selection routine or to allow a user interaction to choose the certificate to be sent.

                                                                                                                                                          If a callback function is defined and no certificate was yet defined for the SSL object, the callback function will be called. If the callback function returns a certificate, the OpenSSL library will try to load the private key and certificate data into the SSL object using the SSL_use_certificate() and SSL_use_private_key() functions. Thus it will permanently install the certificate and key for this SSL object. It will not be reset by calling SSL_clear(3). If the callback returns no certificate, the OpenSSL library will not send a certificate.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_get_client_cert_cb() returns function pointer of client_cert_cb or NULL if the callback is not set.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/#bugs","title":"BUGS","text":"

                                                                                                                                                          The client_cert_cb cannot return a complete certificate chain, it can only return one client certificate. If the chain only has a length of 2, the root CA certificate may be omitted according to the TLS standard and thus a standard conforming answer can be sent to the server. For a longer chain, the client must send the complete chain (with the option to leave out the root CA certificate). This can only be accomplished by either adding the intermediate CA certificates into the trusted certificate store for the SSL_CTX object (resulting in having to add CA certificates that otherwise maybe would not be trusted), or by adding the chain certificates using the SSL_CTX_add_extra_chain_cert(3) function, which is only available for the SSL_CTX object as a whole and that therefore probably can only apply for one client certificate, making the concept of the callback function (to allow the choice from several certificates) questionable.

                                                                                                                                                          Once the SSL object has been used in conjunction with the callback function, the certificate will be set for the SSL object and will not be cleared even when SSL_clear(3) is being called. It is therefore mandatory to destroy the SSL object using SSL_free(3) and create a new one to return to the previous state.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_use_certificate(3), SSL_CTX_add_extra_chain_cert(3), SSL_get_client_CA_list(3), SSL_clear(3), SSL_free(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_cert_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/","title":"SSL_CTX_set_client_hello_cb","text":""},{"location":"man3/SSL_CTX_set_client_hello_cb/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_client_hello_cb, SSL_client_hello_cb_fn, SSL_client_hello_isv2, SSL_client_hello_get0_legacy_version, SSL_client_hello_get0_random, SSL_client_hello_get0_session_id, SSL_client_hello_get0_ciphers, SSL_client_hello_get0_compression_methods, SSL_client_hello_get1_extensions_present, SSL_client_hello_get0_ext - callback functions for early server-side ClientHello processing

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          typedef int (*SSL_client_hello_cb_fn)(SSL *s, int *al, void *arg);\nvoid SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn *f,\n                                 void *arg);\nint SSL_client_hello_isv2(SSL *s);\nunsigned int SSL_client_hello_get0_legacy_version(SSL *s);\nsize_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out);\nsize_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out);\nsize_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out);\nsize_t SSL_client_hello_get0_compression_methods(SSL *s,\n                                                 const unsigned char **out);\nint SSL_client_hello_get1_extensions_present(SSL *s, int **out,\n                                             size_t *outlen);\nint SSL_client_hello_get0_ext(SSL *s, unsigned int type, const unsigned char **out,\n                              size_t *outlen);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_client_hello_cb() sets the callback function, which is automatically called during the early stages of ClientHello processing on the server. The argument supplied when setting the callback is passed back to the callback at run time. A callback that returns failure (0) will cause the connection to terminate, and callbacks returning failure should indicate what alert value is to be sent in the al parameter. A callback may also return a negative value to suspend the handshake, and the handshake function will return immediately. SSL_get_error(3) will return SSL_ERROR_WANT_CLIENT_HELLO_CB to indicate that the handshake was suspended. It is the job of the ClientHello callback to store information about the state of the last call if needed to continue. On the next call into the handshake function, the ClientHello callback will be called again, and, if it returns success, normal handshake processing will continue from that point.

                                                                                                                                                          SSL_client_hello_isv2() indicates whether the ClientHello was carried in a SSLv2 record and is in the SSLv2 format. The SSLv2 format has substantial differences from the normal SSLv3 format, including using three bytes per cipher suite, and not allowing extensions. Additionally, the SSLv2 format 'challenge' field is exposed via SSL_client_hello_get0_random(), padded to SSL3_RANDOM_SIZE bytes with zeros if needed. For SSLv2 format ClientHellos, SSL_client_hello_get0_compression_methods() returns a dummy list that only includes the null compression method, since the SSLv2 format does not include a mechanism by which to negotiate compression.

                                                                                                                                                          SSL_client_hello_get0_random(), SSL_client_hello_get0_session_id(), SSL_client_hello_get0_ciphers(), and SSL_client_hello_get0_compression_methods() provide access to the corresponding ClientHello fields, returning the field length and optionally setting an out pointer to the octets of that field.

                                                                                                                                                          Similarly, SSL_client_hello_get0_ext() provides access to individual extensions from the ClientHello on a per-extension basis. For the provided wire protocol extension type value, the extension value and length are returned in the output parameters (if present).

                                                                                                                                                          SSL_client_hello_get1_extensions_present() can be used prior to SSL_client_hello_get0_ext(), to determine which extensions are present in the ClientHello before querying for them. The out and outlen parameters are both required, and on success the caller must release the storage allocated for *out using OPENSSL_free(). The contents of *out is an array of integers holding the numerical value of the TLS extension types in the order they appear in the ClientHello. *outlen contains the number of elements in the array. In situations when the ClientHello has no extensions, the function will return success with *out set to NULL and *outlen set to 0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/#notes","title":"NOTES","text":"

                                                                                                                                                          The ClientHello callback provides a vast window of possibilities for application code to affect the TLS handshake. A primary use of the callback is to allow the server to examine the server name indication extension provided by the client in order to select an appropriate certificate to present, and make other configuration adjustments relevant to that server name and its configuration. Such configuration changes can include swapping out the associated SSL_CTX pointer, modifying the server's list of permitted TLS versions, changing the server's cipher list in response to the client's cipher list, etc.

                                                                                                                                                          It is also recommended that applications utilize a ClientHello callback and not use a servername callback, in order to avoid unexpected behavior that occurs due to the relative order of processing between things like session resumption and the historical servername callback.

                                                                                                                                                          The SSL_client_hello_* family of functions may only be called from code executing within a ClientHello callback.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          The application's supplied ClientHello callback returns SSL_CLIENT_HELLO_SUCCESS on success, SSL_CLIENT_HELLO_ERROR on failure, and SSL_CLIENT_HELLO_RETRY to suspend processing.

                                                                                                                                                          SSL_client_hello_isv2() returns 1 for SSLv2-format ClientHellos and 0 otherwise.

                                                                                                                                                          SSL_client_hello_get0_random(), SSL_client_hello_get0_session_id(), SSL_client_hello_get0_ciphers(), and SSL_client_hello_get0_compression_methods() return the length of the corresponding ClientHello fields. If zero is returned, the output pointer should not be assumed to be valid.

                                                                                                                                                          SSL_client_hello_get0_ext() returns 1 if the extension of type 'type' is present, and 0 otherwise.

                                                                                                                                                          SSL_client_hello_get1_extensions_present() returns 1 on success and 0 on failure.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_tlsext_servername_callback(3), SSL_bytes_to_cipher_list(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/#history","title":"HISTORY","text":"

                                                                                                                                                          The SSL ClientHello callback, SSL_client_hello_isv2(), SSL_client_hello_get0_random(), SSL_client_hello_get0_session_id(), SSL_client_hello_get0_ciphers(), SSL_client_hello_get0_compression_methods(), SSL_client_hello_get0_ext(), and SSL_client_hello_get1_extensions_present() were added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_client_hello_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ct_validation_callback/","title":"SSL_CTX_set_ct_validation_callback","text":""},{"location":"man3/SSL_CTX_set_ct_validation_callback/#name","title":"NAME","text":"

                                                                                                                                                          ssl_ct_validation_cb, SSL_enable_ct, SSL_CTX_enable_ct, SSL_disable_ct, SSL_CTX_disable_ct, SSL_set_ct_validation_callback, SSL_CTX_set_ct_validation_callback, SSL_ct_is_enabled, SSL_CTX_ct_is_enabled - control Certificate Transparency policy

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\ntypedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx,\n                                   const STACK_OF(SCT) *scts, void *arg);\n\nint SSL_enable_ct(SSL *s, int validation_mode);\nint SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode);\nint SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback,\n                                   void *arg);\nint SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,\n                                       ssl_ct_validation_cb callback,\n                                       void *arg);\nvoid SSL_disable_ct(SSL *s);\nvoid SSL_CTX_disable_ct(SSL_CTX *ctx);\nint SSL_ct_is_enabled(const SSL *s);\nint SSL_CTX_ct_is_enabled(const SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_enable_ct() and SSL_CTX_enable_ct() enable the processing of signed certificate timestamps (SCTs) either for a given SSL connection or for all connections that share the given SSL context, respectively. This is accomplished by setting a built-in CT validation callback. The behaviour of the callback is determined by the validation_mode argument, which can be either of SSL_CT_VALIDATION_PERMISSIVE or SSL_CT_VALIDATION_STRICT as described below.

                                                                                                                                                          If validation_mode is equal to SSL_CT_VALIDATION_STRICT, then in a full TLS handshake with the verification mode set to SSL_VERIFY_PEER, if the peer presents no valid SCTs the handshake will be aborted. If the verification mode is SSL_VERIFY_NONE, the handshake will continue despite lack of valid SCTs. However, in that case if the verification status before the built-in callback was X509_V_OK it will be set to X509_V_ERR_NO_VALID_SCTS after the callback. Applications can call SSL_get_verify_result(3) to check the status at handshake completion, even after session resumption since the verification status is part of the saved session state. See SSL_set_verify(3), , SSL_session_reused(3).

                                                                                                                                                          If validation_mode is equal to SSL_CT_VALIDATION_PERMISSIVE, then the handshake continues, and the verification status is not modified, regardless of the validation status of any SCTs. The application can still inspect the validation status of the SCTs at handshake completion. Note that with session resumption there will not be any SCTs presented during the handshake. Therefore, in applications that delay SCT policy enforcement until after handshake completion, such delayed SCT checks should only be performed when the session is not resumed.

                                                                                                                                                          SSL_set_ct_validation_callback() and SSL_CTX_set_ct_validation_callback() register a custom callback that may implement a different policy than either of the above. This callback can examine the peer's SCTs and determine whether they are sufficient to allow the connection to continue. The TLS handshake is aborted if the verification mode is not SSL_VERIFY_NONE and the callback returns a non-positive result.

                                                                                                                                                          An arbitrary callback data argument, arg, can be passed in when setting the callback. This will be passed to the callback whenever it is invoked. Ownership of this context remains with the caller.

                                                                                                                                                          If no callback is set, SCTs will not be requested and Certificate Transparency validation will not occur.

                                                                                                                                                          No callback will be invoked when the peer presents no certificate, e.g. by employing an anonymous (aNULL) cipher suite. In that case the handshake continues as it would had no callback been requested. Callbacks are also not invoked when the peer certificate chain is invalid or validated via DANE-TA(2) or DANE-EE(3) TLSA records which use a private X.509 PKI, or no X.509 PKI at all, respectively. Clients that require SCTs are expected to not have enabled any aNULL ciphers nor to have specified server verification via DANE-TA(2) or DANE-EE(3) TLSA records.

                                                                                                                                                          SSL_disable_ct() and SSL_CTX_disable_ct() turn off CT processing, whether enabled via the built-in or the custom callbacks, by setting a NULL callback. These may be implemented as macros.

                                                                                                                                                          SSL_ct_is_enabled() and SSL_CTX_ct_is_enabled() return 1 if CT processing is enabled via either SSL_enable_ct() or a non-null custom callback, and 0 otherwise.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#notes","title":"NOTES","text":"

                                                                                                                                                          When SCT processing is enabled, OCSP stapling will be enabled. This is because one possible source of SCTs is the OCSP response from a server.

                                                                                                                                                          The time returned by SSL_SESSION_get_time() will be used to evaluate whether any presented SCTs have timestamps that are in the future (and therefore invalid).

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#restrictions","title":"RESTRICTIONS","text":"

                                                                                                                                                          Certificate Transparency validation cannot be enabled and so a callback cannot be set if a custom client extension handler has been registered to handle SCT extensions (TLSEXT_TYPE_signed_certificate_timestamp).

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_enable_ct(), SSL_CTX_enable_ct(), SSL_CTX_set_ct_validation_callback() and SSL_set_ct_validation_callback() return 1 if the callback is successfully set. They return 0 if an error occurs, e.g. a custom client extension handler has been setup to handle SCTs.

                                                                                                                                                          SSL_disable_ct() and SSL_CTX_disable_ct() do not return a result.

                                                                                                                                                          SSL_CTX_ct_is_enabled() and SSL_ct_is_enabled() return a 1 if a non-null CT validation callback is set, or 0 if no callback (or equivalently a NULL callback) is set.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ct_validation_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), , SSL_session_reused(3), SSL_set_verify(3), SSL_CTX_set_verify(3), SSL_SESSION_get_time(3)"},{"location":"man3/SSL_CTX_set_ct_validation_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ctlog_list_file/","title":"SSL_CTX_set_ctlog_list_file","text":""},{"location":"man3/SSL_CTX_set_ctlog_list_file/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_default_ctlog_list_file, SSL_CTX_set_ctlog_list_file - load a Certificate Transparency log list from a file

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx);\nint SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_default_ctlog_list_file() loads a list of Certificate Transparency (CT) logs from the default file location, \"ct_log_list.cnf\", found in the directory where OpenSSL is installed.

                                                                                                                                                          SSL_CTX_set_ctlog_list_file() loads a list of CT logs from a specific path. See CTLOG_STORE_new(3) for the file format.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#notes","title":"NOTES","text":"

                                                                                                                                                          These functions will not clear the existing CT log list - it will be appended to. To replace the existing list, use SSL_CTX_set0_ctlog_store(3) first.

                                                                                                                                                          If an error occurs whilst parsing a particular log entry in the file, that log entry will be skipped.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_default_ctlog_list_file() and SSL_CTX_set_ctlog_list_file() return 1 if the log list is successfully loaded, and 0 if an error occurs. In the case of an error, the log list may have been partially loaded.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_ct_validation_callback(3), CTLOG_STORE_new(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_ctlog_list_file/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/","title":"SSL_CTX_set_default_passwd_cb","text":""},{"location":"man3/SSL_CTX_set_default_passwd_cb/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_default_passwd_cb, SSL_CTX_set_default_passwd_cb_userdata, SSL_CTX_get_default_passwd_cb, SSL_CTX_get_default_passwd_cb_userdata, SSL_set_default_passwd_cb, SSL_set_default_passwd_cb_userdata, SSL_get_default_passwd_cb, SSL_get_default_passwd_cb_userdata - set or get passwd callback for encrypted PEM file handling

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);\nvoid SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);\npem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx);\nvoid *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx);\n\nvoid SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb);\nvoid SSL_set_default_passwd_cb_userdata(SSL *s, void *u);\npem_password_cb *SSL_get_default_passwd_cb(SSL *s);\nvoid *SSL_get_default_passwd_cb_userdata(SSL *s);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_default_passwd_cb() sets the default password callback called when loading/storing a PEM certificate with encryption.

                                                                                                                                                          SSL_CTX_set_default_passwd_cb_userdata() sets a pointer to userdata, u, which will be provided to the password callback on invocation.

                                                                                                                                                          SSL_CTX_get_default_passwd_cb() returns a function pointer to the password callback currently set in ctx. If no callback was explicitly set, the NULL pointer is returned.

                                                                                                                                                          SSL_CTX_get_default_passwd_cb_userdata() returns a pointer to the userdata currently set in ctx. If no userdata was explicitly set, the NULL pointer is returned.

                                                                                                                                                          SSL_set_default_passwd_cb(), SSL_set_default_passwd_cb_userdata(), SSL_get_default_passwd_cb() and SSL_get_default_passwd_cb_userdata() perform the same function as their SSL_CTX counterparts, but using an SSL object.

                                                                                                                                                          The password callback, which must be provided by the application, hands back the password to be used during decryption. On invocation a pointer to userdata is provided. The function must store the password into the provided buffer buf which is of size size. The actual length of the password must be returned to the calling function. rwflag indicates whether the callback is used for reading/decryption (rwflag=0) or writing/encryption (rwflag=1). For more details, see pem_password_cb(3).

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#notes","title":"NOTES","text":"

                                                                                                                                                          When loading or storing private keys, a password might be supplied to protect the private key. The way this password can be supplied may depend on the application. If only one private key is handled, it can be practical to have the callback handle the password dialog interactively. If several keys have to be handled, it can be practical to ask for the password once, then keep it in memory and use it several times. In the last case, the password could be stored into the userdata storage and the callback only returns the password already stored.

                                                                                                                                                          When asking for the password interactively, the callback can use rwflag to check, whether an item shall be encrypted (rwflag=1). In this case the password dialog may ask for the same password twice for comparison in order to catch typos, that would make decryption impossible.

                                                                                                                                                          Other items in PEM formatting (certificates) can also be encrypted, it is however not usual, as certificate information is considered public.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          These functions do not provide diagnostic information.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          The following example returns the password provided as userdata to the calling function. The password is considered to be a '\\0' terminated string. If the password does not fit into the buffer, the password is truncated.

                                                                                                                                                          int my_cb(char *buf, int size, int rwflag, void *u)\n{\n    strncpy(buf, (char *)u, size);\n    buf[size - 1] = '\\0';\n    return strlen(buf);\n}\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_use_certificate(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#history","title":"HISTORY","text":"

                                                                                                                                                          SSL_CTX_get_default_passwd_cb(), SSL_CTX_get_default_passwd_cb_userdata(), SSL_set_default_passwd_cb() and SSL_set_default_passwd_cb_userdata() were added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_default_passwd_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/","title":"SSL_CTX_set_generate_session_id","text":""},{"location":"man3/SSL_CTX_set_generate_session_id/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_generate_session_id, SSL_set_generate_session_id, SSL_has_matching_session_id, GEN_SESSION_CB - manipulate generation of SSL session IDs (server only)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\ntypedef int (*GEN_SESSION_CB)(SSL *ssl, unsigned char *id,\n                              unsigned int *id_len);\n\nint SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb);\nint SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB, cb);\nint SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,\n                                unsigned int id_len);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_generate_session_id() sets the callback function for generating new session ids for SSL/TLS sessions for ctx to be cb.

                                                                                                                                                          SSL_set_generate_session_id() sets the callback function for generating new session ids for SSL/TLS sessions for ssl to be cb.

                                                                                                                                                          SSL_has_matching_session_id() checks, whether a session with id id (of length id_len) is already contained in the internal session cache of the parent context of ssl.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/#notes","title":"NOTES","text":"

                                                                                                                                                          When a new session is established between client and server, the server generates a session id. The session id is an arbitrary sequence of bytes. The length of the session id is between 1 and 32 bytes. The session id is not security critical but must be unique for the server. Additionally, the session id is transmitted in the clear when reusing the session so it must not contain sensitive information.

                                                                                                                                                          Without a callback being set, an OpenSSL server will generate a unique session id from pseudo random numbers of the maximum possible length. Using the callback function, the session id can be changed to contain additional information like e.g. a host id in order to improve load balancing or external caching techniques.

                                                                                                                                                          The callback function receives a pointer to the memory location to put id into and a pointer to the maximum allowed length id_len. The buffer at location id is only guaranteed to have the size id_len. The callback is only allowed to generate a shorter id and reduce id_len; the callback must never increase id_len or write to the location id exceeding the given limit.

                                                                                                                                                          The location id is filled with 0x00 before the callback is called, so the callback may only fill part of the possible length and leave id_len untouched while maintaining reproducibility.

                                                                                                                                                          Since the sessions must be distinguished, session ids must be unique. Without the callback a random number is used, so that the probability of generating the same session id is extremely small (2^256 for SSLv3/TLSv1). In order to assure the uniqueness of the generated session id, the callback must call SSL_has_matching_session_id() and generate another id if a conflict occurs. If an id conflict is not resolved, the handshake will fail. If the application codes e.g. a unique host id, a unique process number, and a unique sequence number into the session id, uniqueness could easily be achieved without randomness added (it should however be taken care that no confidential information is leaked this way). If the application can not guarantee uniqueness, it is recommended to use the maximum id_len and fill in the bytes not used to code special information with random data to avoid collisions.

                                                                                                                                                          SSL_has_matching_session_id() will only query the internal session cache, not the external one. Since the session id is generated before the handshake is completed, it is not immediately added to the cache. If another thread is using the same internal session cache, a race condition can occur in that another thread generates the same session id. Collisions can also occur when using an external session cache, since the external cache is not tested with SSL_has_matching_session_id() and the same race condition applies.

                                                                                                                                                          The callback must return 0 if it cannot generate a session id for whatever reason and return 1 on success.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_generate_session_id() and SSL_set_generate_session_id() return 1 on success and 0 for failure.

                                                                                                                                                          SSL_has_matching_session_id() returns 1 if another session with the same id is already in the cache, or 0 otherwise.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          The callback function listed will generate a session id with the server id given, and will fill the rest with pseudo random bytes:

                                                                                                                                                          const char session_id_prefix = \"www-18\";\n\n#define MAX_SESSION_ID_ATTEMPTS 10\nstatic int generate_session_id(SSL *ssl, unsigned char *id,\n                               unsigned int *id_len)\n{\n    unsigned int count = 0;\n\n    do {\n        RAND_pseudo_bytes(id, *id_len);\n        /*\n         * Prefix the session_id with the required prefix. NB: If our\n         * prefix is too long, clip it - but there will be worse effects\n         * anyway, e.g. the server could only possibly create 1 session\n         * ID (i.e. the prefix!) so all future session negotiations will\n         * fail due to conflicts.\n         */\n        memcpy(id, session_id_prefix, strlen(session_id_prefix) < *id_len ?\n                                      strlen(session_id_prefix) : *id_len);\n    } while (SSL_has_matching_session_id(ssl, id, *id_len)\n              && ++count < MAX_SESSION_ID_ATTEMPTS);\n    if (count >= MAX_SESSION_ID_ATTEMPTS)\n        return 0;\n    return 1;\n}\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_get_version(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_generate_session_id/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/","title":"SSL_CTX_set_info_callback","text":""},{"location":"man3/SSL_CTX_set_info_callback/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_info_callback, SSL_CTX_get_info_callback, SSL_set_info_callback, SSL_get_info_callback - handle information callback for SSL connections

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_info_callback(SSL_CTX *ctx,\n                               void (*callback) (const SSL *ssl, int type, int val));\n\nvoid (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, int val);\n\nvoid SSL_set_info_callback(SSL *ssl,\n                           void (*callback) (const SSL *ssl, int type, int val));\n\nvoid (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, int val);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_info_callback() sets the callback function, that can be used to obtain state information for SSL objects created from ctx during connection setup and use. The setting for ctx is overridden from the setting for a specific SSL object, if specified. When callback is NULL, no callback function is used.

                                                                                                                                                          SSL_set_info_callback() sets the callback function, that can be used to obtain state information for ssl during connection setup and use. When callback is NULL, the callback setting currently valid for ctx is used.

                                                                                                                                                          SSL_CTX_get_info_callback() returns a pointer to the currently set information callback function for ctx.

                                                                                                                                                          SSL_get_info_callback() returns a pointer to the currently set information callback function for ssl.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/#notes","title":"NOTES","text":"

                                                                                                                                                          When setting up a connection and during use, it is possible to obtain state information from the SSL/TLS engine. When set, an information callback function is called whenever a significant event occurs such as: the state changes, an alert appears, or an error occurs.

                                                                                                                                                          The callback function is called as callback(SSL *ssl, int where, int ret). The where argument specifies information about where (in which context) the callback function was called. If ret is 0, an error condition occurred. If an alert is handled, SSL_CB_ALERT is set and ret specifies the alert information.

                                                                                                                                                          where is a bit-mask made up of the following bits:

                                                                                                                                                          • SSL_CB_LOOP

                                                                                                                                                            Callback has been called to indicate state change or some other significant state machine event. This may mean that the callback gets invoked more than once per state in some situations.

                                                                                                                                                          • SSL_CB_EXIT

                                                                                                                                                            Callback has been called to indicate exit of a handshake function. This will happen after the end of a handshake, but may happen at other times too such as on error or when IO might otherwise block and nonblocking is being used.

                                                                                                                                                          • SSL_CB_READ

                                                                                                                                                            Callback has been called during read operation.

                                                                                                                                                          • SSL_CB_WRITE

                                                                                                                                                            Callback has been called during write operation.

                                                                                                                                                          • SSL_CB_ALERT

                                                                                                                                                            Callback has been called due to an alert being sent or received.

                                                                                                                                                          • SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ)

                                                                                                                                                          • SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE)
                                                                                                                                                          • SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP)
                                                                                                                                                          • SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT)
                                                                                                                                                          • SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP)
                                                                                                                                                          • SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT)
                                                                                                                                                          • SSL_CB_HANDSHAKE_START

                                                                                                                                                            Callback has been called because a new handshake is started. It also occurs when resuming a handshake following a pause to handle early data.

                                                                                                                                                          • SSL_CB_HANDSHAKE_DONE

                                                                                                                                                            Callback has been called because a handshake is finished. It also occurs if the handshake is paused to allow the exchange of early data.

                                                                                                                                                          The current state information can be obtained using the SSL_state_string(3) family of functions.

                                                                                                                                                          The ret information can be evaluated using the SSL_alert_type_string(3) family of functions.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_set_info_callback() does not provide diagnostic information.

                                                                                                                                                          SSL_get_info_callback() returns the current setting.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/#examples","title":"EXAMPLES","text":"

                                                                                                                                                          The following example callback function prints state strings, information about alerts being handled and error messages to the bio_err BIO.

                                                                                                                                                          void apps_ssl_info_callback(const SSL *s, int where, int ret)\n{\n    const char *str;\n    int w = where & ~SSL_ST_MASK;\n\n    if (w & SSL_ST_CONNECT)\n        str = \"SSL_connect\";\n    else if (w & SSL_ST_ACCEPT)\n        str = \"SSL_accept\";\n    else\n        str = \"undefined\";\n\n    if (where & SSL_CB_LOOP) {\n        BIO_printf(bio_err, \"%s:%s\\n\", str, SSL_state_string_long(s));\n    } else if (where & SSL_CB_ALERT) {\n        str = (where & SSL_CB_READ) ? \"read\" : \"write\";\n        BIO_printf(bio_err, \"SSL3 alert %s:%s:%s\\n\", str,\n                   SSL_alert_type_string_long(ret),\n                   SSL_alert_desc_string_long(ret));\n    } else if (where & SSL_CB_EXIT) {\n        if (ret == 0) {\n            BIO_printf(bio_err, \"%s:failed in %s\\n\",\n                       str, SSL_state_string_long(s));\n        } else if (ret < 0) {\n            BIO_printf(bio_err, \"%s:error in %s\\n\",\n                       str, SSL_state_string_long(s));\n        }\n    }\n}\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_state_string(3), SSL_alert_type_string(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_info_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_keylog_callback/","title":"SSL_CTX_set_keylog_callback","text":""},{"location":"man3/SSL_CTX_set_keylog_callback/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_keylog_callback, SSL_CTX_get_keylog_callback, SSL_CTX_keylog_cb_func - logging TLS key material

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_keylog_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\ntypedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line);\n\nvoid SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb);\nSSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_keylog_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_keylog_callback() sets the TLS key logging callback. This callback is called whenever TLS key material is generated or received, in order to allow applications to store this keying material for debugging purposes.

                                                                                                                                                          SSL_CTX_get_keylog_callback() retrieves the previously set TLS key logging callback. If no callback has been set, this will return NULL. When there is no key logging callback, or if SSL_CTX_set_keylog_callback is called with NULL as the value of cb, no logging of key material will be done.

                                                                                                                                                          The key logging callback is called with two items: the ssl object associated with the connection, and line, a string containing the key material in the format used by NSS for its SSLKEYLOGFILE debugging output. To recreate that file, the key logging callback should log line, followed by a newline. line will always be a NUL-terminated string.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_keylog_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_get_keylog_callback() returns a pointer to SSL_CTX_keylog_cb_func or NULL if the callback is not set.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_keylog_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_keylog_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_max_cert_list/","title":"SSL_CTX_set_max_cert_list","text":""},{"location":"man3/SSL_CTX_set_max_cert_list/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_max_cert_list, SSL_CTX_get_max_cert_list, SSL_set_max_cert_list, SSL_get_max_cert_list - manipulate allowed size for the peer's certificate chain

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_max_cert_list/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nlong SSL_CTX_set_max_cert_list(SSL_CTX *ctx, long size);\nlong SSL_CTX_get_max_cert_list(SSL_CTX *ctx);\n\nlong SSL_set_max_cert_list(SSL *ssl, long size);\nlong SSL_get_max_cert_list(SSL *ctx);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_max_cert_list/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_max_cert_list() sets the maximum size allowed for the peer's certificate chain for all SSL objects created from ctx to be <size> bytes. The SSL objects inherit the setting valid for ctx at the time SSL_new(3) is being called.

                                                                                                                                                          SSL_CTX_get_max_cert_list() returns the currently set maximum size for ctx.

                                                                                                                                                          SSL_set_max_cert_list() sets the maximum size allowed for the peer's certificate chain for ssl to be <size> bytes. This setting stays valid until a new value is set.

                                                                                                                                                          SSL_get_max_cert_list() returns the currently set maximum size for ssl.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_max_cert_list/#notes","title":"NOTES","text":"

                                                                                                                                                          During the handshake process, the peer may send a certificate chain. The TLS/SSL standard does not give any maximum size of the certificate chain. The OpenSSL library handles incoming data by a dynamically allocated buffer. In order to prevent this buffer from growing without bounds due to data received from a faulty or malicious peer, a maximum size for the certificate chain is set.

                                                                                                                                                          The default value for the maximum certificate chain size is 100kB (30kB on the 16-bit DOS platform). This should be sufficient for usual certificate chains (OpenSSL's default maximum chain length is 10, see SSL_CTX_set_verify(3), and certificates without special extensions have a typical size of 1-2kB).

                                                                                                                                                          For special applications it can be necessary to extend the maximum certificate chain size allowed to be sent by the peer, see e.g. the work on \"Internet X.509 Public Key Infrastructure Proxy Certificate Profile\" and \"TLS Delegation Protocol\" at http://www.ietf.org/ and http://www.globus.org/ .

                                                                                                                                                          Under normal conditions it should never be necessary to set a value smaller than the default, as the buffer is handled dynamically and only uses the memory actually required by the data sent by the peer.

                                                                                                                                                          If the maximum certificate chain size allowed is exceeded, the handshake will fail with a SSL_R_EXCESSIVE_MESSAGE_SIZE error.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_max_cert_list/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_max_cert_list() and SSL_set_max_cert_list() return the previously set value.

                                                                                                                                                          SSL_CTX_get_max_cert_list() and SSL_get_max_cert_list() return the currently set value.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_max_cert_list/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_new(3), SSL_CTX_set_verify(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_max_cert_list/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/","title":"SSL_CTX_set_min_proto_version","text":""},{"location":"man3/SSL_CTX_set_min_proto_version/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_min_proto_version, SSL_CTX_set_max_proto_version, SSL_CTX_get_min_proto_version, SSL_CTX_get_max_proto_version, SSL_set_min_proto_version, SSL_set_max_proto_version, SSL_get_min_proto_version, SSL_get_max_proto_version - Get and set minimum and maximum supported protocol version

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version);\nint SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version);\nint SSL_CTX_get_min_proto_version(SSL_CTX *ctx);\nint SSL_CTX_get_max_proto_version(SSL_CTX *ctx);\n\nint SSL_set_min_proto_version(SSL *ssl, int version);\nint SSL_set_max_proto_version(SSL *ssl, int version);\nint SSL_get_min_proto_version(SSL *ssl);\nint SSL_get_max_proto_version(SSL *ssl);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          The functions get or set the minimum and maximum supported protocol versions for the ctx or ssl. This works in combination with the options set via SSL_CTX_set_options(3) that also make it possible to disable specific protocol versions. Use these functions instead of disabling specific protocol versions.

                                                                                                                                                          Setting the minimum or maximum version to 0, will enable protocol versions down to the lowest version, or up to the highest version supported by the library, respectively.

                                                                                                                                                          Getters return 0 in case ctx or ssl have been configured to automatically use the lowest or highest version supported by the library.

                                                                                                                                                          Currently supported versions are SSL3_VERSION, TLS1_VERSION, TLS1_1_VERSION, TLS1_2_VERSION, TLS1_3_VERSION for TLS and DTLS1_VERSION, DTLS1_2_VERSION for DTLS.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          These setter functions return 1 on success and 0 on failure. The getter functions return the configured version or 0 for auto-configuration of lowest or highest protocol, respectively.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/#notes","title":"NOTES","text":"

                                                                                                                                                          All these functions are implemented using macros.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_CTX_set_options(3), SSL_CONF_cmd(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/#history","title":"HISTORY","text":"

                                                                                                                                                          The setter functions were added in OpenSSL 1.1.0. The getter functions were added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_min_proto_version/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/","title":"SSL_CTX_set_mode","text":""},{"location":"man3/SSL_CTX_set_mode/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_mode, SSL_CTX_clear_mode, SSL_set_mode, SSL_clear_mode, SSL_CTX_get_mode, SSL_get_mode - manipulate SSL engine mode

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nlong SSL_CTX_set_mode(SSL_CTX *ctx, long mode);\nlong SSL_CTX_clear_mode(SSL_CTX *ctx, long mode);\nlong SSL_set_mode(SSL *ssl, long mode);\nlong SSL_clear_mode(SSL *ssl, long mode);\n\nlong SSL_CTX_get_mode(SSL_CTX *ctx);\nlong SSL_get_mode(SSL *ssl);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_mode() adds the mode set via bit-mask in mode to ctx. Options already set before are not cleared. SSL_CTX_clear_mode() removes the mode set via bit-mask in mode from ctx.

                                                                                                                                                          SSL_set_mode() adds the mode set via bit-mask in mode to ssl. Options already set before are not cleared. SSL_clear_mode() removes the mode set via bit-mask in mode from ssl.

                                                                                                                                                          SSL_CTX_get_mode() returns the mode set for ctx.

                                                                                                                                                          SSL_get_mode() returns the mode set for ssl.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/#notes","title":"NOTES","text":"

                                                                                                                                                          The following mode changes are available:

                                                                                                                                                          • SSL_MODE_ENABLE_PARTIAL_WRITE

                                                                                                                                                            Allow SSL_write_ex(..., n, &r) to return with 0 < r < n (i.e. report success when just a single record has been written). This works in a similar way for SSL_write(). When not set (the default), SSL_write_ex() or SSL_write() will only report success once the complete chunk was written. Once SSL_write_ex() or SSL_write() returns successful, r bytes have been written and the next call to SSL_write_ex() or SSL_write() must only send the n-r bytes left, imitating the behaviour of write().

                                                                                                                                                          • SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER

                                                                                                                                                            Make it possible to retry SSL_write_ex() or SSL_write() with changed buffer location (the buffer contents must stay the same). This is not the default to avoid the misconception that nonblocking SSL_write() behaves like nonblocking write().

                                                                                                                                                          • SSL_MODE_AUTO_RETRY

                                                                                                                                                            During normal operations, non-application data records might need to be sent or received that the application is not aware of. If a non-application data record was processed, SSL_read_ex(3) and SSL_read(3) can return with a failure and indicate the need to retry with SSL_ERROR_WANT_READ. If such a non-application data record was processed, the flag SSL_MODE_AUTO_RETRY causes it to try to process the next record instead of returning.

                                                                                                                                                            In a nonblocking environment applications must be prepared to handle incomplete read/write operations. Setting SSL_MODE_AUTO_RETRY for a nonblocking BIO will process non-application data records until either no more data is available or an application data record has been processed.

                                                                                                                                                            In a blocking environment, applications are not always prepared to deal with the functions returning intermediate reports such as retry requests, and setting the SSL_MODE_AUTO_RETRY flag will cause the functions to only return after successfully processing an application data record or a failure.

                                                                                                                                                            Turning off SSL_MODE_AUTO_RETRY can be useful with blocking BIOs in case they are used in combination with something like select() or poll(). Otherwise the call to SSL_read() or SSL_read_ex() might hang when a non-application record was sent and no application data was sent.

                                                                                                                                                          • SSL_MODE_RELEASE_BUFFERS

                                                                                                                                                            When we no longer need a read buffer or a write buffer for a given SSL, then release the memory we were using to hold it. Using this flag can save around 34k per idle SSL connection. This flag has no effect on SSL v2 connections, or on DTLS connections.

                                                                                                                                                          • SSL_MODE_SEND_FALLBACK_SCSV

                                                                                                                                                            Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications that reconnect with a downgraded protocol version; see draft-ietf-tls-downgrade-scsv-00 for details.

                                                                                                                                                            DO NOT ENABLE THIS if your application attempts a normal handshake. Only use this in explicit fallback retries, following the guidance in draft-ietf-tls-downgrade-scsv-00.

                                                                                                                                                          • SSL_MODE_ASYNC

                                                                                                                                                            Enable asynchronous processing. TLS I/O operations may indicate a retry with SSL_ERROR_WANT_ASYNC with this mode set if an asynchronous capable engine is used to perform cryptographic operations. See SSL_get_error(3).

                                                                                                                                                          • SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG

                                                                                                                                                            Older versions of OpenSSL had a bug in the computation of the label length used for computing the endpoint-pair shared secret. The bug was that the terminating zero was included in the length of the label. Setting this option enables this behaviour to allow interoperability with such broken implementations. Please note that setting this option breaks interoperability with correct implementations. This option only applies to DTLS over SCTP.

                                                                                                                                                          All modes are off by default except for SSL_MODE_AUTO_RETRY which is on by default since 1.1.1.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_mode() and SSL_set_mode() return the new mode bit-mask after adding mode.

                                                                                                                                                          SSL_CTX_get_mode() and SSL_get_mode() return the current bit-mask.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) or SSL_write(3), SSL_get_error(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/#history","title":"HISTORY","text":"

                                                                                                                                                          SSL_MODE_ASYNC was added in OpenSSL 1.1.0.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_mode/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/","title":"SSL_CTX_set_msg_callback","text":""},{"location":"man3/SSL_CTX_set_msg_callback/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg, SSL_set_msg_callback, SSL_set_msg_callback_arg - install callback for observing protocol messages

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_msg_callback(SSL_CTX *ctx,\n                              void (*cb)(int write_p, int version,\n                                         int content_type, const void *buf,\n                                         size_t len, SSL *ssl, void *arg));\nvoid SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);\n\nvoid SSL_set_msg_callback(SSL *ssl,\n                          void (*cb)(int write_p, int version,\n                                     int content_type, const void *buf,\n                                     size_t len, SSL *ssl, void *arg));\nvoid SSL_set_msg_callback_arg(SSL *ssl, void *arg);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_msg_callback() or SSL_set_msg_callback() can be used to define a message callback function cb for observing all SSL/TLS protocol messages (such as handshake messages) that are received or sent, as well as other events that occur during processing. SSL_CTX_set_msg_callback_arg() and SSL_set_msg_callback_arg() can be used to set argument arg to the callback function, which is available for arbitrary application use.

                                                                                                                                                          SSL_CTX_set_msg_callback() and SSL_CTX_set_msg_callback_arg() specify default settings that will be copied to new SSL objects by SSL_new(3). SSL_set_msg_callback() and SSL_set_msg_callback_arg() modify the actual settings of an SSL object. Using a NULL pointer for cb disables the message callback.

                                                                                                                                                          When cb is called by the SSL/TLS library the function arguments have the following meaning:

                                                                                                                                                          • write_p

                                                                                                                                                            This flag is 0 when a protocol message has been received and 1 when a protocol message has been sent.

                                                                                                                                                          • version

                                                                                                                                                            The protocol version according to which the protocol message is interpreted by the library such as TLS1_3_VERSION, TLS1_2_VERSION etc. This is set to 0 for the SSL3_RT_HEADER pseudo content type (see NOTES below).

                                                                                                                                                          • content_type

                                                                                                                                                            This is one of the content type values defined in the protocol specification (SSL3_RT_CHANGE_CIPHER_SPEC, SSL3_RT_ALERT, SSL3_RT_HANDSHAKE; but never SSL3_RT_APPLICATION_DATA because the callback will only be called for protocol messages). Alternatively it may be a \"pseudo\" content type. These pseudo content types are used to signal some other event in the processing of data (see NOTES below).

                                                                                                                                                          • buf, len

                                                                                                                                                            buf points to a buffer containing the protocol message or other data (in the case of pseudo content types), which consists of len bytes. The buffer is no longer valid after the callback function has returned.

                                                                                                                                                          • ssl

                                                                                                                                                            The SSL object that received or sent the message.

                                                                                                                                                          • arg

                                                                                                                                                            The user-defined argument optionally defined by SSL_CTX_set_msg_callback_arg() or SSL_set_msg_callback_arg().

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/#notes","title":"NOTES","text":"

                                                                                                                                                          Protocol messages are passed to the callback function after decryption and fragment collection where applicable. (Thus record boundaries are not visible.)

                                                                                                                                                          If processing a received protocol message results in an error, the callback function may not be called. For example, the callback function will never see messages that are considered too large to be processed.

                                                                                                                                                          Due to automatic protocol version negotiation, version is not necessarily the protocol version used by the sender of the message: If a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, version will be SSL3_VERSION.

                                                                                                                                                          Pseudo content type values may be sent at various points during the processing of data. The following pseudo content types are currently defined:

                                                                                                                                                          • SSL3_RT_HEADER

                                                                                                                                                            Used when a record is sent or received. The buf contains the record header bytes only.

                                                                                                                                                          • SSL3_RT_INNER_CONTENT_TYPE

                                                                                                                                                            Used when an encrypted TLSv1.3 record is sent or received. In encrypted TLSv1.3 records the content type in the record header is always SSL3_RT_APPLICATION_DATA. The real content type for the record is contained in an \"inner\" content type. buf contains the encoded \"inner\" content type byte.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_msg_callback(), SSL_CTX_set_msg_callback_arg(), SSL_set_msg_callback() and SSL_set_msg_callback_arg() do not return values.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_new(3)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/#history","title":"HISTORY","text":"

                                                                                                                                                          The pseudo content type SSL3_RT_INNER_CONTENT_TYPE was added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_msg_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_num_tickets/","title":"SSL_CTX_set_num_tickets","text":""},{"location":"man3/SSL_CTX_set_num_tickets/#name","title":"NAME","text":"

                                                                                                                                                          SSL_set_num_tickets, SSL_get_num_tickets, SSL_CTX_set_num_tickets, SSL_CTX_get_num_tickets, SSL_new_session_ticket - control the number of TLSv1.3 session tickets that are issued

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_num_tickets/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nint SSL_set_num_tickets(SSL *s, size_t num_tickets);\nsize_t SSL_get_num_tickets(const SSL *s);\nint SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets);\nsize_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx);\nint SSL_new_session_ticket(SSL *s);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_num_tickets/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_num_tickets() and SSL_set_num_tickets() can be called for a server application and set the number of TLSv1.3 session tickets that will be sent to the client after a full handshake. Set the desired value (which could be 0) in the num_tickets argument. Typically these functions should be called before the start of the handshake.

                                                                                                                                                          The default number of tickets is 2. Following a resumption the number of tickets issued will never be more than 1 regardless of the value set via SSL_set_num_tickets() or SSL_CTX_set_num_tickets(). If num_tickets is set to 0 then no tickets will be issued for either a normal connection or a resumption.

                                                                                                                                                          Tickets are also issued on receipt of a post-handshake certificate from the client following a request by the server using SSL_verify_client_post_handshake(3). These new tickets will be associated with the updated client identity (i.e. including their certificate and verification status). The number of tickets issued will normally be the same as was used for the initial handshake. If the initial handshake was a full handshake then SSL_set_num_tickets() can be called again prior to calling SSL_verify_client_post_handshake() to update the number of tickets that will be sent.

                                                                                                                                                          To issue tickets after other events (such as application-layer changes), SSL_new_session_ticket() is used by a server application to request that a new ticket be sent when it is safe to do so. New tickets are only allowed to be sent in this manner after the initial handshake has completed, and only for TLS 1.3 connections. By default, the ticket generation and transmission are delayed until the server is starting a new write operation, so that it is bundled with other application data being written and properly aligned to a record boundary. If the connection was at a record boundary when SSL_new_session_ticket() was called, the ticket can be sent immediately (without waiting for the next application write) by calling SSL_do_handshake(). SSL_new_session_ticket() can be called more than once to request additional tickets be sent; all such requests are queued and written together when it is safe to do so and triggered by SSL_write() or SSL_do_handshake(). Note that a successful return from SSL_new_session_ticket() indicates only that the request to send a ticket was processed, not that the ticket itself was sent. To be notified when the ticket itself is sent, a new-session callback can be registered with SSL_CTX_sess_set_new_cb(3) that will be invoked as the ticket or tickets are generated.

                                                                                                                                                          SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets set by a previous call to SSL_CTX_set_num_tickets() or SSL_set_num_tickets(), or 2 if no such call has been made.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_num_tickets/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_num_tickets(), SSL_set_num_tickets(), and SSL_new_session_ticket() return 1 on success or 0 on failure.

                                                                                                                                                          SSL_CTX_get_num_tickets() and SSL_get_num_tickets() return the number of tickets that have been previously set.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_num_tickets/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_num_tickets/#history","title":"HISTORY","text":"

                                                                                                                                                          SSL_new_session_ticket() was added in OpenSSL 3.0.0. SSL_set_num_tickets(), SSL_get_num_tickets(), SSL_CTX_set_num_tickets(), and SSL_CTX_get_num_tickets() were added in OpenSSL 1.1.1.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_num_tickets/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/","title":"SSL_CTX_set_options","text":""},{"location":"man3/SSL_CTX_set_options/#name","title":"NAME","text":"

                                                                                                                                                          SSL_CTX_set_options, SSL_set_options, SSL_CTX_clear_options, SSL_clear_options, SSL_CTX_get_options, SSL_get_options, SSL_get_secure_renegotiation_support - manipulate SSL options

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\nuint64_t SSL_CTX_set_options(SSL_CTX *ctx, uint64_t options);\nuint64_t SSL_set_options(SSL *ssl, uint64_t options);\n\nuint64_t SSL_CTX_clear_options(SSL_CTX *ctx, uint64_t options);\nuint64_t SSL_clear_options(SSL *ssl, uint64_t options);\n\nuint64_t SSL_CTX_get_options(const SSL_CTX *ctx);\nuint64_t SSL_get_options(const SSL *ssl);\n\nlong SSL_get_secure_renegotiation_support(SSL *ssl);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          SSL_CTX_set_options() adds the options set via bit-mask in options to ctx. Options already set before are not cleared!

                                                                                                                                                          SSL_set_options() adds the options set via bit-mask in options to ssl. Options already set before are not cleared!

                                                                                                                                                          SSL_CTX_clear_options() clears the options set via bit-mask in options to ctx.

                                                                                                                                                          SSL_clear_options() clears the options set via bit-mask in options to ssl.

                                                                                                                                                          SSL_CTX_get_options() returns the options set for ctx.

                                                                                                                                                          SSL_get_options() returns the options set for ssl.

                                                                                                                                                          SSL_get_secure_renegotiation_support() indicates whether the peer supports secure renegotiation. Note, this is implemented via a macro.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#notes","title":"NOTES","text":"

                                                                                                                                                          The behaviour of the SSL library can be changed by setting several options. The options are coded as bit-masks and can be combined by a bitwise or operation (|).

                                                                                                                                                          SSL_CTX_set_options() and SSL_set_options() affect the (external) protocol behaviour of the SSL library. The (internal) behaviour of the API can be changed by using the similar SSL_CTX_set_mode(3) and SSL_set_mode() functions.

                                                                                                                                                          During a handshake, the option settings of the SSL object are used. When a new SSL object is created from a context using SSL_new(), the current option setting is copied. Changes to ctx do not affect already created SSL objects. SSL_clear() does not affect the settings.

                                                                                                                                                          The following bug workaround options are available:

                                                                                                                                                          • SSL_OP_CRYPTOPRO_TLSEXT_BUG

                                                                                                                                                            Add server-hello extension from the early version of cryptopro draft when GOST ciphersuite is negotiated. Required for interoperability with CryptoPro CSP 3.x.

                                                                                                                                                          • SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS

                                                                                                                                                            Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol vulnerability affecting CBC ciphers, which cannot be handled by some broken SSL implementations. This option has no effect for connections using other ciphers.

                                                                                                                                                          • SSL_OP_SAFARI_ECDHE_ECDSA_BUG

                                                                                                                                                            Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on OS X. OS X 10.8..10.8.3 has broken support for ECDHE-ECDSA ciphers.

                                                                                                                                                          • SSL_OP_TLSEXT_PADDING

                                                                                                                                                            Adds a padding extension to ensure the ClientHello size is never between 256 and 511 bytes in length. This is needed as a workaround for some implementations.

                                                                                                                                                          • SSL_OP_ALL

                                                                                                                                                            All of the above bug workarounds.

                                                                                                                                                          It is usually safe to use SSL_OP_ALL to enable the bug workaround options if compatibility with somewhat broken implementations is desired.

                                                                                                                                                          The following modifying options are available:

                                                                                                                                                          • SSL_OP_ALLOW_CLIENT_RENEGOTIATION

                                                                                                                                                            Client-initiated renegotiation is disabled by default. Use this option to enable it.

                                                                                                                                                          • SSL_OP_ALLOW_NO_DHE_KEX

                                                                                                                                                            In TLSv1.3 allow a non-(ec)dhe based key exchange mode on resumption. This means that there will be no forward secrecy for the resumed session.

                                                                                                                                                          • SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION

                                                                                                                                                            Allow legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See the SECURE RENEGOTIATION section for more details.

                                                                                                                                                          • SSL_OP_CIPHER_SERVER_PREFERENCE

                                                                                                                                                            When choosing a cipher, use the server's preferences instead of the client preferences. When not set, the SSL server will always follow the clients preferences. When set, the SSL/TLS server will choose following its own preferences.

                                                                                                                                                          • SSL_OP_CISCO_ANYCONNECT

                                                                                                                                                            Use Cisco's version identifier of DTLS_BAD_VER when establishing a DTLSv1 connection. Only available when using the deprecated DTLSv1_client_method() API.

                                                                                                                                                          • SSL_OP_CLEANSE_PLAINTEXT

                                                                                                                                                            By default TLS connections keep a copy of received plaintext application data in a static buffer until it is overwritten by the next portion of data. When enabling SSL_OP_CLEANSE_PLAINTEXT deciphered application data is cleansed by calling OPENSSL_cleanse(3) after passing data to the application. Data is also cleansed when releasing the connection (e.g. SSL_free(3)).

                                                                                                                                                            Since OpenSSL only cleanses internal buffers, the application is still responsible for cleansing all other buffers. Most notably, this applies to buffers passed to functions like SSL_read(3), SSL_peek(3) but also like SSL_write(3).

                                                                                                                                                          • SSL_OP_COOKIE_EXCHANGE

                                                                                                                                                            Turn on Cookie Exchange as described in RFC4347 Section 4.2.1. Only affects DTLS connections.

                                                                                                                                                          • SSL_OP_DISABLE_TLSEXT_CA_NAMES

                                                                                                                                                            Disable TLS Extension CA Names. You may want to disable it for security reasons or for compatibility with some Windows TLS implementations crashing when this extension is larger than 1024 bytes.

                                                                                                                                                          • SSL_OP_ENABLE_KTLS

                                                                                                                                                            Enable the use of kernel TLS. In order to benefit from kernel TLS OpenSSL must have been compiled with support for it, and it must be supported by the negotiated ciphersuites and extensions. The specific ciphersuites and extensions that are supported may vary by platform and kernel version.

                                                                                                                                                            The kernel TLS data-path implements the record layer, and the encryption algorithm. The kernel will utilize the best hardware available for encryption. Using the kernel data-path should reduce the memory footprint of OpenSSL because no buffering is required. Also, the throughput should improve because data copy is avoided when user data is encrypted into kernel memory instead of the usual encrypt then copy to kernel.

                                                                                                                                                            Kernel TLS might not support all the features of OpenSSL. For instance, renegotiation, and setting the maximum fragment size is not possible as of Linux 4.20.

                                                                                                                                                            Note that with kernel TLS enabled some cryptographic operations are performed by the kernel directly and not via any available OpenSSL Providers. This might be undesirable if, for example, the application requires all cryptographic operations to be performed by the FIPS provider.

                                                                                                                                                          • SSL_OP_ENABLE_MIDDLEBOX_COMPAT

                                                                                                                                                            If set then dummy Change Cipher Spec (CCS) messages are sent in TLSv1.3. This has the effect of making TLSv1.3 look more like TLSv1.2 so that middleboxes that do not understand TLSv1.3 will not drop the connection. Regardless of whether this option is set or not CCS messages received from the peer will always be ignored in TLSv1.3. This option is set by default. To switch it off use SSL_clear_options(). A future version of OpenSSL may not set this by default.

                                                                                                                                                          • SSL_OP_IGNORE_UNEXPECTED_EOF

                                                                                                                                                            Some TLS implementations do not send the mandatory close_notify alert on shutdown. If the application tries to wait for the close_notify alert but the peer closes the connection without sending it, an error is generated. When this option is enabled the peer does not need to send the close_notify alert and a closed connection will be treated as if the close_notify alert was received.

                                                                                                                                                            You should only enable this option if the protocol running over TLS can detect a truncation attack itself, and that the application is checking for that truncation attack.

                                                                                                                                                            For more information on shutting down a connection, see SSL_shutdown(3).

                                                                                                                                                          • SSL_OP_LEGACY_SERVER_CONNECT

                                                                                                                                                            Allow legacy insecure renegotiation between OpenSSL and unpatched servers only. See the SECURE RENEGOTIATION section for more details.

                                                                                                                                                          • SSL_OP_NO_ANTI_REPLAY

                                                                                                                                                            By default, when a server is configured for early data (i.e., max_early_data > 0), OpenSSL will switch on replay protection. See SSL_read_early_data(3) for a description of the replay protection feature. Anti-replay measures are required to comply with the TLSv1.3 specification. Some applications may be able to mitigate the replay risks in other ways and in such cases the built in OpenSSL functionality is not required. Those applications can turn this feature off by setting this option. This is a server-side option only. It is ignored by clients.

                                                                                                                                                          • SSL_OP_NO_COMPRESSION

                                                                                                                                                            Do not use compression even if it is supported. This option is set by default. To switch it off use SSL_clear_options().

                                                                                                                                                          • SSL_OP_NO_ENCRYPT_THEN_MAC

                                                                                                                                                            Normally clients and servers will transparently attempt to negotiate the RFC7366 Encrypt-then-MAC option on TLS and DTLS connection.

                                                                                                                                                            If this option is set, Encrypt-then-MAC is disabled. Clients will not propose, and servers will not accept the extension.

                                                                                                                                                          • SSL_OP_NO_EXTENDED_MASTER_SECRET

                                                                                                                                                            Normally clients and servers will transparently attempt to negotiate the RFC7627 Extended Master Secret option on TLS and DTLS connection.

                                                                                                                                                            If this option is set, Extended Master Secret is disabled. Clients will not propose, and servers will not accept the extension.

                                                                                                                                                          • SSL_OP_NO_QUERY_MTU

                                                                                                                                                            Do not query the MTU. Only affects DTLS connections.

                                                                                                                                                          • SSL_OP_NO_RENEGOTIATION

                                                                                                                                                            Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest messages, and ignore renegotiation requests via ClientHello.

                                                                                                                                                          • SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION

                                                                                                                                                            When performing renegotiation as a server, always start a new session (i.e., session resumption requests are only accepted in the initial handshake). This option is not needed for clients.

                                                                                                                                                          • SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_NO_DTLSv1, SSL_OP_NO_DTLSv1_2

                                                                                                                                                            These options turn off the SSLv3, TLSv1, TLSv1.1, TLSv1.2 or TLSv1.3 protocol versions with TLS or the DTLSv1, DTLSv1.2 versions with DTLS, respectively. As of OpenSSL 1.1.0, these options are deprecated, use SSL_CTX_set_min_proto_version(3) and SSL_CTX_set_max_proto_version(3) instead.

                                                                                                                                                          • SSL_OP_NO_TICKET

                                                                                                                                                            SSL/TLS supports two mechanisms for resuming sessions: session ids and stateless session tickets.

                                                                                                                                                            When using session ids a copy of the session information is cached on the server and a unique id is sent to the client. When the client wishes to resume it provides the unique id so that the server can retrieve the session information from its cache.

                                                                                                                                                            When using stateless session tickets the server uses a session ticket encryption key to encrypt the session information. This encrypted data is sent to the client as a \"ticket\". When the client wishes to resume it sends the encrypted data back to the server. The server uses its key to decrypt the data and resume the session. In this way the server can operate statelessly - no session information needs to be cached locally.

                                                                                                                                                            The TLSv1.3 protocol only supports tickets and does not directly support session ids. However, OpenSSL allows two modes of ticket operation in TLSv1.3: stateful and stateless. Stateless tickets work the same way as in TLSv1.2 and below. Stateful tickets mimic the session id behaviour available in TLSv1.2 and below. The session information is cached on the server and the session id is wrapped up in a ticket and sent back to the client. When the client wishes to resume, it presents a ticket in the same way as for stateless tickets. The server can then extract the session id from the ticket and retrieve the session information from its cache.

                                                                                                                                                            By default OpenSSL will use stateless tickets. The SSL_OP_NO_TICKET option will cause stateless tickets to not be issued. In TLSv1.2 and below this means no ticket gets sent to the client at all. In TLSv1.3 a stateful ticket will be sent. This is a server-side option only.

                                                                                                                                                            In TLSv1.3 it is possible to suppress all tickets (stateful and stateless) from being sent by calling SSL_CTX_set_num_tickets(3) or SSL_set_num_tickets(3).

                                                                                                                                                          • SSL_OP_PRIORITIZE_CHACHA

                                                                                                                                                            When SSL_OP_CIPHER_SERVER_PREFERENCE is set, temporarily reprioritize ChaCha20-Poly1305 ciphers to the top of the server cipher list if a ChaCha20-Poly1305 cipher is at the top of the client cipher list. This helps those clients (e.g. mobile) use ChaCha20-Poly1305 if that cipher is anywhere in the server cipher list; but still allows other clients to use AES and other ciphers. Requires SSL_OP_CIPHER_SERVER_PREFERENCE.

                                                                                                                                                          • SSL_OP_TLS_ROLLBACK_BUG

                                                                                                                                                            Disable version rollback attack detection.

                                                                                                                                                            During the client key exchange, the client must send the same information about acceptable SSL/TLS protocol levels as during the first hello. Some clients violate this rule by adapting to the server's answer. (Example: the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server only understands up to SSLv3. In this case the client must still use the same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect to the server's answer and violate the version rollback protection.)

                                                                                                                                                          The following options no longer have any effect but their identifiers are retained for compatibility purposes:

                                                                                                                                                          • SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
                                                                                                                                                          • SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
                                                                                                                                                          • SSL_OP_SSLEAY_080_CLIENT_DH_BUG
                                                                                                                                                          • SSL_OP_TLS_D5_BUG
                                                                                                                                                          • SSL_OP_TLS_BLOCK_PADDING_BUG
                                                                                                                                                          • SSL_OP_MSIE_SSLV2_RSA_PADDING
                                                                                                                                                          • SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
                                                                                                                                                          • SSL_OP_MICROSOFT_SESS_ID_BUG
                                                                                                                                                          • SSL_OP_NETSCAPE_CHALLENGE_BUG
                                                                                                                                                          • SSL_OP_PKCS1_CHECK_1
                                                                                                                                                          • SSL_OP_PKCS1_CHECK_2
                                                                                                                                                          • SSL_OP_SINGLE_DH_USE
                                                                                                                                                          • SSL_OP_SINGLE_ECDH_USE
                                                                                                                                                          • SSL_OP_EPHEMERAL_RSA
                                                                                                                                                          • SSL_OP_NETSCAPE_CA_DN_BUG
                                                                                                                                                          • SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#secure-renegotiation","title":"SECURE RENEGOTIATION","text":"

                                                                                                                                                          OpenSSL always attempts to use secure renegotiation as described in RFC5746. This counters the prefix attack described in CVE-2009-3555 and elsewhere.

                                                                                                                                                          This attack has far reaching consequences which application writers should be aware of. In the description below an implementation supporting secure renegotiation is referred to as patched. A server not supporting secure renegotiation is referred to as unpatched.

                                                                                                                                                          The following sections describe the operations permitted by OpenSSL's secure renegotiation implementation.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#patched-client-and-server","title":"Patched client and server","text":"

                                                                                                                                                          Connections and renegotiation are always permitted by OpenSSL implementations.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#unpatched-client-and-patched-openssl-server","title":"Unpatched client and patched OpenSSL server","text":"

                                                                                                                                                          The initial connection succeeds but client renegotiation is denied by the server with a no_renegotiation warning alert if TLS v1.0 is used or a fatal handshake_failure alert in SSL v3.0.

                                                                                                                                                          If the patched OpenSSL server attempts to renegotiate a fatal handshake_failure alert is sent. This is because the server code may be unaware of the unpatched nature of the client.

                                                                                                                                                          If the option SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is set then renegotiation always succeeds.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#patched-openssl-client-and-unpatched-server","title":"Patched OpenSSL client and unpatched server","text":"

                                                                                                                                                          If the option SSL_OP_LEGACY_SERVER_CONNECT or SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is set then initial connections and renegotiation between patched OpenSSL clients and unpatched servers succeeds. If neither option is set then initial connections to unpatched servers will fail.

                                                                                                                                                          Setting the option SSL_OP_LEGACY_SERVER_CONNECT has security implications; clients that are willing to connect to servers that do not implement RFC 5746 secure renegotiation are subject to attacks such as CVE-2009-3555.

                                                                                                                                                          OpenSSL client applications wishing to ensure they can connect to unpatched servers should always set SSL_OP_LEGACY_SERVER_CONNECT

                                                                                                                                                          OpenSSL client applications that want to ensure they can not connect to unpatched servers (and thus avoid any security issues) should always clear SSL_OP_LEGACY_SERVER_CONNECT using SSL_CTX_clear_options() or SSL_clear_options().

                                                                                                                                                          The difference between the SSL_OP_LEGACY_SERVER_CONNECT and SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION options is that SSL_OP_LEGACY_SERVER_CONNECT enables initial connections and secure renegotiation between OpenSSL clients and unpatched servers only, while SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION allows initial connections and renegotiation between OpenSSL and unpatched clients or servers.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                          SSL_CTX_set_options() and SSL_set_options() return the new options bit-mask after adding options.

                                                                                                                                                          SSL_CTX_clear_options() and SSL_clear_options() return the new options bit-mask after clearing options.

                                                                                                                                                          SSL_CTX_get_options() and SSL_get_options() return the current bit-mask.

                                                                                                                                                          SSL_get_secure_renegotiation_support() returns 1 is the peer supports secure renegotiation and 0 if it does not.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                          ssl(7), SSL_new(3), SSL_clear(3), SSL_shutdown(3) SSL_CTX_set_tmp_dh_callback(3), SSL_CTX_set_min_proto_version(3), openssl-dhparam(1)

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#history","title":"HISTORY","text":"

                                                                                                                                                          The attempt to always try to use secure renegotiation was added in OpenSSL 0.9.8m.

                                                                                                                                                          The SSL_OP_PRIORITIZE_CHACHA and SSL_OP_NO_RENEGOTIATION options were added in OpenSSL 1.1.1.

                                                                                                                                                          The SSL_OP_NO_EXTENDED_MASTER_SECRET and SSL_OP_IGNORE_UNEXPECTED_EOF options were added in OpenSSL 3.0.

                                                                                                                                                          The SSL_OP_ constants and the corresponding parameter and return values of the affected functions were changed to uint64_t type in OpenSSL 3.0. For that reason it is no longer possible use the SSL_OP_ macro values in preprocessor #if conditions. However it is still possible to test whether these macros are defined or not.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_options/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                          Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_psk_client_callback/","title":"SSL_CTX_set_psk_client_callback","text":""},{"location":"man3/SSL_CTX_set_psk_client_callback/#name","title":"NAME","text":"

                                                                                                                                                          SSL_psk_client_cb_func, SSL_psk_use_session_cb_func, SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback, SSL_CTX_set_psk_use_session_callback, SSL_set_psk_use_session_callback - set PSK client callback

                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_psk_client_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                          #include <openssl/ssl.h>\n\ntypedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md,\n                                           const unsigned char **id,\n                                           size_t *idlen,\n                                           SSL_SESSION **sess);\n\n\nvoid SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx,\n                                          SSL_psk_use_session_cb_func cb);\nvoid SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb);\n\n\ntypedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl,\n                                               const char *hint,\n                                               char *identity,\n                                               unsigned int max_identity_len,\n                                               unsigned char *psk,\n                                               unsigned int max_psk_len);\n\nvoid SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb);\nvoid SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb);\n
                                                                                                                                                          "},{"location":"man3/SSL_CTX_set_psk_client_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                          A client application wishing to use TLSv1.3 PSKs should use either SSL_CTX_set_psk_use_session_callback() or SSL_set_psk_use_session_callback() as appropriate. These functions cannot be used for TLSv1.2 and below PSKs.

                                                                                                                                                          The callback function is given a pointer to the SSL connection in ssl.

                                                                                                                                                          The first time the callback is called for a connection the md parameter is NULL. In some circumstances the callback will be called a second time. In that case the server will have specified a ciphersuite to use already and the PSK must be compatible with the digest for that ciphersuite. The digest will be given in md. The PSK returned by the callback is allowed to be different between the first and second time it is called.

                                                                                                                                                          On successful completion the callback must store a pointer to an identifier for the PSK in *id. The identifier length in bytes should be stored in *idlen. The memory pointed to by *id remains owned by the application and should be freed by it as required at any point after the handshake is complete.

                                                                                                                                                          Additionally the callback should store a pointer to an SSL_SESSION object in *sess. This is used as the basis for the PSK, and should, at a minimum, have the following fields set:

                                                                                                                                                          • The master key

                                                                                                                                                            This can be set via a call to SSL_SESSION_set1_master_key(3).

                                                                                                                                                          • A ciphersuite

                                                                                                                                                            Only the handshake digest associated with the ciphersuite is relevant for the PSK (the server may go on to negotiate any ciphersuite which is compatible with the digest). The application can use any TLSv1.3 ciphersuite. If md is not NULL the handshake digest for the ciphersuite should be the same. The ciphersuite can be set via a call to . The handshake digest of an SSL_CIPHER object can be checked using .

                                                                                                                                                          • The protocol version

                                                                                                                                                            This can be set via a call to SSL_SESSION_set_protocol_version(3) and should be TLS1_3_VERSION.

                                                                                                                                                          • Additionally the maximum early data value should be set via a call to SSL_SESSION_set_max_early_data(3) if the PSK will be used for sending early data.

                                                                                                                                                            Alternatively an SSL_SESSION created from a previous non-PSK handshake may also be used as the basis for a PSK.

                                                                                                                                                            Ownership of the SSL_SESSION object is passed to the OpenSSL library and so it should not be freed by the application.

                                                                                                                                                            It is also possible for the callback to succeed but not supply a PSK. In this case no PSK will be sent to the server but the handshake will continue. To do this the callback should return successfully and ensure that *sess is NULL. The contents of *id and *idlen will be ignored.

                                                                                                                                                            A client application wishing to use PSK ciphersuites for TLSv1.2 and below must provide a different callback function. This function will be called when the client is sending the ClientKeyExchange message to the server.

                                                                                                                                                            The purpose of the callback function is to select the PSK identity and the pre-shared key to use during the connection setup phase.

                                                                                                                                                            The callback is set using functions SSL_CTX_set_psk_client_callback() or SSL_set_psk_client_callback(). The callback function is given the connection in parameter ssl, a NUL-terminated PSK identity hint sent by the server in parameter hint, a buffer identity of length max_identity_len bytes (including the NUL-terminator) where the resulting NUL-terminated identity is to be stored, and a buffer psk of length max_psk_len bytes where the resulting pre-shared key is to be stored.

                                                                                                                                                            The callback for use in TLSv1.2 will also work in TLSv1.3 although it is recommended to use SSL_CTX_set_psk_use_session_callback() or SSL_set_psk_use_session_callback() for this purpose instead. If TLSv1.3 has been negotiated then OpenSSL will first check to see if a callback has been set via SSL_CTX_set_psk_use_session_callback() or SSL_set_psk_use_session_callback() and it will use that in preference. If no such callback is present then it will check to see if a callback has been set via SSL_CTX_set_psk_client_callback() or SSL_set_psk_client_callback() and use that. In this case the hint value will always be NULL and the handshake digest will default to SHA-256 for any returned PSK. TLSv1.3 early data exchanges are possible in PSK connections only with the SSL_psk_use_session_cb_func callback, and are not possible with the SSL_psk_client_cb_func callback.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_psk_client_callback/#notes","title":"NOTES","text":"

                                                                                                                                                            Note that parameter hint given to the callback may be NULL.

                                                                                                                                                            A connection established via a TLSv1.3 PSK will appear as if session resumption has occurred so that SSL_session_reused(3) will return true.

                                                                                                                                                            There are no known security issues with sharing the same PSK between TLSv1.2 (or below) and TLSv1.3. However, the RFC has this note of caution:

                                                                                                                                                            \"While there is no known way in which the same PSK might produce related output in both versions, only limited analysis has been done. Implementations can ensure safety from cross-protocol related output by not reusing PSKs between TLS 1.3 and TLS 1.2.\"

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_psk_client_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            Return values from the SSL_psk_client_cb_func callback are interpreted as follows:

                                                                                                                                                            On success (callback found a PSK identity and a pre-shared key to use) the length (> 0) of psk in bytes is returned.

                                                                                                                                                            Otherwise or on errors the callback should return 0. In this case the connection setup fails.

                                                                                                                                                            The SSL_psk_use_session_cb_func callback should return 1 on success or 0 on failure. In the event of failure the connection setup fails.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_psk_client_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_psk_find_session_callback(3), SSL_set_psk_find_session_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_psk_client_callback/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_CTX_set_psk_use_session_callback() and SSL_set_psk_use_session_callback() were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_psk_client_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_quiet_shutdown/","title":"SSL_CTX_set_quiet_shutdown","text":""},{"location":"man3/SSL_CTX_set_quiet_shutdown/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_quiet_shutdown, SSL_CTX_get_quiet_shutdown, SSL_set_quiet_shutdown, SSL_get_quiet_shutdown - manipulate shutdown behaviour

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode);\nint SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);\n\nvoid SSL_set_quiet_shutdown(SSL *ssl, int mode);\nint SSL_get_quiet_shutdown(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_quiet_shutdown() sets the \"quiet shutdown\" flag for ctx to be mode. SSL objects created from ctx inherit the mode valid at the time SSL_new(3) is called. mode may be 0 or 1.

                                                                                                                                                            SSL_CTX_get_quiet_shutdown() returns the \"quiet shutdown\" setting of ctx.

                                                                                                                                                            SSL_set_quiet_shutdown() sets the \"quiet shutdown\" flag for ssl to be mode. The setting stays valid until ssl is removed with SSL_free(3) or SSL_set_quiet_shutdown() is called again. It is not changed when SSL_clear(3) is called. mode may be 0 or 1.

                                                                                                                                                            SSL_get_quiet_shutdown() returns the \"quiet shutdown\" setting of ssl.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#notes","title":"NOTES","text":"

                                                                                                                                                            Normally when a SSL connection is finished, the parties must send out close_notify alert messages using SSL_shutdown(3) for a clean shutdown.

                                                                                                                                                            When setting the \"quiet shutdown\" flag to 1, SSL_shutdown(3) will set the internal flags to SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN. (SSL_shutdown(3) then behaves like SSL_set_shutdown(3) called with SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN.) The session is thus considered to be shutdown, but no close_notify alert is sent to the peer. This behaviour violates the TLS standard.

                                                                                                                                                            The default is normal shutdown behaviour as described by the TLS standard.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_quiet_shutdown() and SSL_set_quiet_shutdown() do not return diagnostic information.

                                                                                                                                                            SSL_CTX_get_quiet_shutdown() and SSL_get_quiet_shutdown return the current setting.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_shutdown(3), SSL_set_shutdown(3), SSL_new(3), SSL_clear(3), SSL_free(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_quiet_shutdown/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_read_ahead/","title":"SSL_CTX_set_read_ahead","text":""},{"location":"man3/SSL_CTX_set_read_ahead/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_read_ahead, SSL_CTX_get_read_ahead, SSL_set_read_ahead, SSL_get_read_ahead, SSL_CTX_get_default_read_ahead - manage whether to read as many input bytes as possible

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_read_ahead/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_set_read_ahead(SSL *s, int yes);\nint SSL_get_read_ahead(const SSL *s);\n\nSSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes);\nlong SSL_CTX_get_read_ahead(SSL_CTX *ctx);\nlong SSL_CTX_get_default_read_ahead(SSL_CTX *ctx);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_read_ahead/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_read_ahead() and SSL_set_read_ahead() set whether we should read as many input bytes as possible (for nonblocking reads) or not. For example if x bytes are currently required by OpenSSL, but y bytes are available from the underlying BIO (where y > x), then OpenSSL will read all y bytes into its buffer (providing that the buffer is large enough) if reading ahead is on, or x bytes otherwise. Setting the parameter yes to 0 turns reading ahead is off, other values turn it on. SSL_CTX_set_default_read_ahead() is identical to SSL_CTX_set_read_ahead().

                                                                                                                                                            SSL_CTX_get_read_ahead() and SSL_get_read_ahead() indicate whether reading ahead has been set or not. SSL_CTX_get_default_read_ahead() is identical to SSL_CTX_get_read_ahead().

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_read_ahead/#notes","title":"NOTES","text":"

                                                                                                                                                            These functions have no impact when used with DTLS. The return values for SSL_CTX_get_read_head() and SSL_get_read_ahead() are undefined for DTLS. Setting read_ahead can impact the behaviour of the SSL_pending() function (see SSL_pending(3)).

                                                                                                                                                            Since SSL_read() can return SSL_ERROR_WANT_READ for non-application data records, and SSL_has_pending() can't tell the difference between processed and unprocessed data, it's recommended that if read ahead is turned on that SSL_MODE_AUTO_RETRY is not turned off using SSL_CTX_clear_mode(). That will prevent getting SSL_ERROR_WANT_READ when there is still a complete record available that hasn't been processed.

                                                                                                                                                            If the application wants to continue to use the underlying transport (e.g. TCP connection) after the SSL connection is finished using SSL_shutdown() reading ahead should be turned off. Otherwise the SSL structure might read data that it shouldn't.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_read_ahead/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_get_read_ahead() and SSL_CTX_get_read_ahead() return 0 if reading ahead is off, and non zero otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_read_ahead/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_pending(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_read_ahead/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/","title":"SSL_CTX_set_record_padding_callback","text":""},{"location":"man3/SSL_CTX_set_record_padding_callback/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_record_padding_callback, SSL_set_record_padding_callback, SSL_CTX_set_record_padding_callback_arg, SSL_set_record_padding_callback_arg, SSL_CTX_get_record_padding_callback_arg, SSL_get_record_padding_callback_arg, SSL_CTX_set_block_padding, SSL_set_block_padding - install callback to specify TLS 1.3 record padding

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, size_t (*cb)(SSL *s, int type, size_t len, void *arg));\nint SSL_set_record_padding_callback(SSL *ssl, size_t (*cb)(SSL *s, int type, size_t len, void *arg));\n\nvoid SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg);\nvoid *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx);\n\nvoid SSL_set_record_padding_callback_arg(SSL *ssl, void *arg);\nvoid *SSL_get_record_padding_callback_arg(const SSL *ssl);\n\nint SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size);\nint SSL_set_block_padding(SSL *ssl, size_t block_size);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_record_padding_callback() or SSL_set_record_padding_callback() can be used to assign a callback function cb to specify the padding for TLS 1.3 records. The value set in ctx is copied to a new SSL by SSL_new(). Kernel TLS is not possible if the record padding callback is set, and the callback function cannot be set if Kernel TLS is already configured for the current SSL object.

                                                                                                                                                            SSL_CTX_set_record_padding_callback_arg() and SSL_set_record_padding_callback_arg() assign a value arg that is passed to the callback when it is invoked. The value set in ctx is copied to a new SSL by SSL_new().

                                                                                                                                                            SSL_CTX_get_record_padding_callback_arg() and SSL_get_record_padding_callback_arg() retrieve the arg value that is passed to the callback.

                                                                                                                                                            SSL_CTX_set_block_padding() and SSL_set_block_padding() pads the record to a multiple of the block_size. A block_size of 0 or 1 disables block padding. The limit of block_size is SSL3_RT_MAX_PLAIN_LENGTH.

                                                                                                                                                            The callback is invoked for every record before encryption. The type parameter is the TLS record type that is being processed; may be one of SSL3_RT_APPLICATION_DATA, SSL3_RT_HANDSHAKE, or SSL3_RT_ALERT. The len parameter is the current plaintext length of the record before encryption. The arg parameter is the value set via SSL_CTX_set_record_padding_callback_arg() or SSL_set_record_padding_callback_arg().

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The SSL_CTX_get_record_padding_callback_arg() and SSL_get_record_padding_callback_arg() functions return the arg value assigned in the corresponding set functions.

                                                                                                                                                            The SSL_CTX_set_block_padding() and SSL_set_block_padding() functions return 1 on success or 0 if block_size is too large.

                                                                                                                                                            The cb returns the number of padding bytes to add to the record. A return of 0 indicates no padding will be added. A return value that causes the record to exceed the maximum record size (SSL3_RT_MAX_PLAIN_LENGTH) will pad out to the maximum record size.

                                                                                                                                                            The SSL_CTX_get_record_padding_callback_arg() function returns 1 on success or 0 if the callback function is not set because Kernel TLS is configured for the SSL object.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/#notes","title":"NOTES","text":"

                                                                                                                                                            The default behavior is to add no padding to the record.

                                                                                                                                                            A user-supplied padding callback function will override the behavior set by SSL_set_block_padding() or SSL_CTX_set_block_padding(). Setting the user-supplied callback to NULL will restore the configured block padding behavior.

                                                                                                                                                            These functions only apply to TLS 1.3 records being written.

                                                                                                                                                            Padding bytes are not added in constant-time.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_new(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/#history","title":"HISTORY","text":"

                                                                                                                                                            The record padding API was added for TLS 1.3 support in OpenSSL 1.1.1.

                                                                                                                                                            The return type of SSL_CTX_set_record_padding_callback() function was changed to int in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_record_padding_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/","title":"SSL_CTX_set_security_level","text":""},{"location":"man3/SSL_CTX_set_security_level/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_security_level, SSL_set_security_level, SSL_CTX_get_security_level, SSL_get_security_level, SSL_CTX_set_security_callback, SSL_set_security_callback, SSL_CTX_get_security_callback, SSL_get_security_callback, SSL_CTX_set0_security_ex_data, SSL_set0_security_ex_data, SSL_CTX_get0_security_ex_data, SSL_get0_security_ex_data - SSL/TLS security framework

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_security_level(SSL_CTX *ctx, int level);\nvoid SSL_set_security_level(SSL *s, int level);\n\nint SSL_CTX_get_security_level(const SSL_CTX *ctx);\nint SSL_get_security_level(const SSL *s);\n\nvoid SSL_CTX_set_security_callback(SSL_CTX *ctx,\n                                   int (*cb)(SSL *s, SSL_CTX *ctx, int op,\n                                             int bits, int nid,\n                                             void *other, void *ex));\n\nvoid SSL_set_security_callback(SSL *s, int (*cb)(SSL *s, SSL_CTX *ctx, int op,\n                                                 int bits, int nid,\n                                                 void *other, void *ex));\n\nint (*SSL_CTX_get_security_callback(const SSL_CTX *ctx))(SSL *s, SSL_CTX *ctx, int op,\n                                                         int bits, int nid, void *other,\n                                                         void *ex);\nint (*SSL_get_security_callback(const SSL *s))(SSL *s, SSL_CTX *ctx, int op,\n                                               int bits, int nid, void *other,\n                                               void *ex);\n\nvoid SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex);\nvoid SSL_set0_security_ex_data(SSL *s, void *ex);\n\nvoid *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx);\nvoid *SSL_get0_security_ex_data(const SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The functions SSL_CTX_set_security_level() and SSL_set_security_level() set the security level to level. If not set the library default security level is used.

                                                                                                                                                            The functions SSL_CTX_get_security_level() and SSL_get_security_level() retrieve the current security level.

                                                                                                                                                            SSL_CTX_set_security_callback(), SSL_set_security_callback(), SSL_CTX_get_security_callback() and SSL_get_security_callback() get or set the security callback associated with ctx or s. If not set a default security callback is used. The meaning of the parameters and the behaviour of the default callbacks is described below.

                                                                                                                                                            SSL_CTX_set0_security_ex_data(), SSL_set0_security_ex_data(), SSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() set the extra data pointer passed to the ex parameter of the callback. This value is passed to the callback verbatim and can be set to any convenient application specific value.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#default-callback-behaviour","title":"DEFAULT CALLBACK BEHAVIOUR","text":"

                                                                                                                                                            If an application doesn't set its own security callback the default callback is used. It is intended to provide sane defaults. The meaning of each level is described below.

                                                                                                                                                            • Level 0

                                                                                                                                                              Everything is permitted. This retains compatibility with previous versions of OpenSSL.

                                                                                                                                                            • Level 1

                                                                                                                                                              The security level corresponds to a minimum of 80 bits of security. Any parameters offering below 80 bits of security are excluded. As a result RSA, DSA and DH keys shorter than 1024 bits and ECC keys shorter than 160 bits are prohibited. All export cipher suites are prohibited since they all offer less than 80 bits of security. SSL version 2 is prohibited. Any cipher suite using MD5 for the MAC is also prohibited. Note that signatures using SHA1 and MD5 are also forbidden at this level as they have less than 80 security bits. Additionally, SSLv3, TLS 1.0, TLS 1.1 and DTLS 1.0 are all disabled at this level.

                                                                                                                                                            • Level 2

                                                                                                                                                              Security level set to 112 bits of security. As a result RSA, DSA and DH keys shorter than 2048 bits and ECC keys shorter than 224 bits are prohibited. In addition to the level 1 exclusions any cipher suite using RC4 is also prohibited. Compression is disabled.

                                                                                                                                                            • Level 3

                                                                                                                                                              Security level set to 128 bits of security. As a result RSA, DSA and DH keys shorter than 3072 bits and ECC keys shorter than 256 bits are prohibited. In addition to the level 2 exclusions cipher suites not offering forward secrecy are prohibited. Session tickets are disabled.

                                                                                                                                                            • Level 4

                                                                                                                                                              Security level set to 192 bits of security. As a result RSA, DSA and DH keys shorter than 7680 bits and ECC keys shorter than 384 bits are prohibited. Cipher suites using SHA1 for the MAC are prohibited.

                                                                                                                                                            • Level 5

                                                                                                                                                              Security level set to 256 bits of security. As a result RSA, DSA and DH keys shorter than 15360 bits and ECC keys shorter than 512 bits are prohibited.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#application-defined-security-callbacks","title":"APPLICATION DEFINED SECURITY CALLBACKS","text":"

                                                                                                                                                            Documentation to be provided.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#notes","title":"NOTES","text":"

                                                                                                                                                            The default security level can be configured when OpenSSL is compiled by setting -DOPENSSL_TLS_SECURITY_LEVEL=level. If not set then 1 is used.

                                                                                                                                                            The security framework disables or reject parameters inconsistent with the set security level. In the past this was difficult as applications had to set a number of distinct parameters (supported ciphers, supported curves supported signature algorithms) to achieve this end and some cases (DH parameter size for example) could not be checked at all.

                                                                                                                                                            By setting an appropriate security level much of this complexity can be avoided.

                                                                                                                                                            The bits of security limits affect all relevant parameters including cipher suite encryption algorithms, supported ECC curves, supported signature algorithms, DH parameter sizes, certificate key sizes and signature algorithms. This limit applies no matter what other custom settings an application has set: so if the cipher suite is set to ALL then only cipher suites consistent with the security level are permissible.

                                                                                                                                                            See SP800-57 for how the security limits are related to individual algorithms.

                                                                                                                                                            Some security levels require large key sizes for non-ECC public key algorithms which can severely degrade performance. For example 256 bits of security requires the use of RSA keys of at least 15360 bits in size.

                                                                                                                                                            Some restrictions can be gracefully handled: for example cipher suites offering insufficient security are not sent by the client and will not be selected by the server. Other restrictions such as the peer certificate key size or the DH parameter size will abort the handshake with a fatal alert.

                                                                                                                                                            Attempts to set certificates or parameters with insufficient security are also blocked. For example trying to set a certificate using a 512 bit RSA key or a certificate with a signature with SHA1 digest at level 1 using SSL_CTX_use_certificate(). Applications which do not check the return values for errors will misbehave: for example it might appear that a certificate is not set at all because it had been rejected.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_security_level() and SSL_set_security_level() do not return values.

                                                                                                                                                            SSL_CTX_get_security_level() and SSL_get_security_level() return a integer that represents the security level with SSL_CTX or SSL, respectively.

                                                                                                                                                            SSL_CTX_set_security_callback() and SSL_set_security_callback() do not return values.

                                                                                                                                                            SSL_CTX_get_security_callback() and SSL_get_security_callback() return the pointer to the security callback or NULL if the callback is not set.

                                                                                                                                                            SSL_CTX_get0_security_ex_data() and SSL_get0_security_ex_data() return the extra data pointer or NULL if the ex data is not set.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#history","title":"HISTORY","text":"

                                                                                                                                                            These functions were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_security_level/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2014-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_cache_mode/","title":"SSL_CTX_set_session_cache_mode","text":""},{"location":"man3/SSL_CTX_set_session_cache_mode/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_session_cache_mode, SSL_CTX_get_session_cache_mode - enable/disable session caching

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_cache_mode/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_CTX_set_session_cache_mode(SSL_CTX ctx, long mode);\nlong SSL_CTX_get_session_cache_mode(SSL_CTX ctx);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_cache_mode/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_session_cache_mode() enables/disables session caching by setting the operational mode for ctx to <mode>.

                                                                                                                                                            SSL_CTX_get_session_cache_mode() returns the currently used cache mode.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_cache_mode/#notes","title":"NOTES","text":"

                                                                                                                                                            The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse. The sessions can be held in memory for each ctx, if more than one SSL_CTX object is being maintained, the sessions are unique for each SSL_CTX object.

                                                                                                                                                            In order to reuse a session, a client must send the session's id to the server. It can only send exactly one id. The server then either agrees to reuse the session or it starts a full handshake (to create a new session).

                                                                                                                                                            A server will look up the session in its internal session storage. If the session is not found in internal storage or lookups for the internal storage have been deactivated (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP), the server will try the external storage if available.

                                                                                                                                                            Since a client may try to reuse a session intended for use in a different context, the session id context must be set by the server (see SSL_CTX_set_session_id_context(3)).

                                                                                                                                                            The following session cache modes and modifiers are available:

                                                                                                                                                            • SSL_SESS_CACHE_OFF

                                                                                                                                                              No session caching for client or server takes place.

                                                                                                                                                            • SSL_SESS_CACHE_CLIENT

                                                                                                                                                              Client sessions are added to the session cache. As there is no reliable way for the OpenSSL library to know whether a session should be reused or which session to choose (due to the abstract BIO layer the SSL engine does not have details about the connection), the application must select the session to be reused by using the SSL_set_session(3) function. This option is not activated by default.

                                                                                                                                                            • SSL_SESS_CACHE_SERVER

                                                                                                                                                              Server sessions are added to the session cache. When a client proposes a session to be reused, the server looks for the corresponding session in (first) the internal session cache (unless SSL_SESS_CACHE_NO_INTERNAL_LOOKUP is set), then (second) in the external cache if available. If the session is found, the server will try to reuse the session. This is the default.

                                                                                                                                                            • SSL_SESS_CACHE_BOTH

                                                                                                                                                              Enable both SSL_SESS_CACHE_CLIENT and SSL_SESS_CACHE_SERVER at the same time.

                                                                                                                                                            • SSL_SESS_CACHE_NO_AUTO_CLEAR

                                                                                                                                                              Normally the session cache is checked for expired sessions every 255 connections using the SSL_CTX_flush_sessions(3) function. Since this may lead to a delay which cannot be controlled, the automatic flushing may be disabled and SSL_CTX_flush_sessions(3) can be called explicitly by the application.

                                                                                                                                                            • SSL_SESS_CACHE_NO_INTERNAL_LOOKUP

                                                                                                                                                              By setting this flag, session-resume operations in an SSL/TLS server will not automatically look up sessions in the internal cache, even if sessions are automatically stored there. If external session caching callbacks are in use, this flag guarantees that all lookups are directed to the external cache. As automatic lookup only applies for SSL/TLS servers, the flag has no effect on clients.

                                                                                                                                                            • SSL_SESS_CACHE_NO_INTERNAL_STORE

                                                                                                                                                              Depending on the presence of SSL_SESS_CACHE_CLIENT and/or SSL_SESS_CACHE_SERVER, sessions negotiated in an SSL/TLS handshake may be cached for possible reuse. Normally a new session is added to the internal cache as well as any external session caching (callback) that is configured for the SSL_CTX. This flag will prevent sessions being stored in the internal cache (though the application can add them manually using SSL_CTX_add_session(3)). Note: in any SSL/TLS servers where external caching is configured, any successful session lookups in the external cache (i.e. for session-resume requests) would normally be copied into the local cache before processing continues - this flag prevents these additions to the internal cache as well.

                                                                                                                                                            • SSL_SESS_CACHE_NO_INTERNAL

                                                                                                                                                              Enable both SSL_SESS_CACHE_NO_INTERNAL_LOOKUP and SSL_SESS_CACHE_NO_INTERNAL_STORE at the same time.

                                                                                                                                                            • SSL_SESS_CACHE_UPDATE_TIME

                                                                                                                                                              Updates the timestamp of the session when it is used, increasing the lifespan of the session. The session timeout applies to last use, rather then creation time.

                                                                                                                                                            The default mode is SSL_SESS_CACHE_SERVER.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_cache_mode/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_session_cache_mode() returns the previously set cache mode.

                                                                                                                                                            SSL_CTX_get_session_cache_mode() returns the currently set cache mode.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_cache_mode/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_set_session(3), SSL_session_reused(3), SSL_CTX_add_session(3), SSL_CTX_sess_number(3), SSL_CTX_sess_set_cache_size(3), SSL_CTX_sess_set_get_cb(3), SSL_CTX_set_session_id_context(3), SSL_CTX_set_timeout(3), SSL_CTX_flush_sessions(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_cache_mode/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/","title":"SSL_CTX_set_session_id_context","text":""},{"location":"man3/SSL_CTX_set_session_id_context/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_session_id_context, SSL_set_session_id_context - set context within which session can be reused (server side only)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx,\n                                   unsigned int sid_ctx_len);\nint SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx,\n                               unsigned int sid_ctx_len);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_session_id_context() sets the context sid_ctx of length sid_ctx_len within which a session can be reused for the ctx object.

                                                                                                                                                            SSL_set_session_id_context() sets the context sid_ctx of length sid_ctx_len within which a session can be reused for the ssl object.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/#notes","title":"NOTES","text":"

                                                                                                                                                            Sessions are generated within a certain context. When exporting/importing sessions with i2d_SSL_SESSION/d2i_SSL_SESSION it would be possible, to re-import a session generated from another context (e.g. another application), which might lead to malfunctions. Therefore, each application must set its own session id context sid_ctx which is used to distinguish the contexts and is stored in exported sessions. The sid_ctx can be any kind of binary data with a given length, it is therefore possible to use e.g. the name of the application and/or the hostname and/or service name ...

                                                                                                                                                            The session id context becomes part of the session. The session id context is set by the SSL/TLS server. The SSL_CTX_set_session_id_context() and SSL_set_session_id_context() functions are therefore only useful on the server side.

                                                                                                                                                            OpenSSL clients will check the session id context returned by the server when reusing a session.

                                                                                                                                                            The maximum length of the sid_ctx is limited to SSL_MAX_SID_CTX_LENGTH.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/#warnings","title":"WARNINGS","text":"

                                                                                                                                                            If the session id context is not set on an SSL/TLS server and client certificates are used, stored sessions will not be reused but a fatal error will be flagged and the handshake will fail.

                                                                                                                                                            If a server returns a different session id context to an OpenSSL client when reusing a session, an error will be flagged and the handshake will fail. OpenSSL servers will always return the correct session id context, as an OpenSSL server checks the session id context itself before reusing a session as described above.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_session_id_context() and SSL_set_session_id_context() return the following values:

                                                                                                                                                            • 0

                                                                                                                                                              The length sid_ctx_len of the session id context sid_ctx exceeded the maximum allowed length of SSL_MAX_SID_CTX_LENGTH. The error is logged to the error stack.

                                                                                                                                                            • 1

                                                                                                                                                              The operation succeeded.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_id_context/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/","title":"SSL_CTX_set_session_ticket_cb","text":""},{"location":"man3/SSL_CTX_set_session_ticket_cb/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_session_ticket_cb, SSL_SESSION_get0_ticket_appdata, SSL_SESSION_set1_ticket_appdata, SSL_CTX_generate_session_ticket_fn, SSL_CTX_decrypt_session_ticket_fn - manage session ticket application data

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\ntypedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg);\ntypedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss,\n                                                               const unsigned char *keyname,\n                                                               size_t keyname_len,\n                                                               SSL_TICKET_STATUS status,\n                                                               void *arg);\nint SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx,\n                                  SSL_CTX_generate_session_ticket_fn gen_cb,\n                                  SSL_CTX_decrypt_session_ticket_fn dec_cb,\n                                  void *arg);\nint SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len);\nint SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_set_session_ticket_cb() sets the application callbacks gen_cb and dec_cb that are used by a server to set and get application data stored with a session, and placed into a session ticket. Either callback function may be set to NULL. The value of arg is passed to the callbacks.

                                                                                                                                                            gen_cb is the application defined callback invoked when a session ticket is about to be created. The application can call SSL_SESSION_set1_ticket_appdata() at this time to add application data to the session ticket. The value of arg is the same as that given to SSL_CTX_set_session_ticket_cb(). The gen_cb callback is defined as type SSL_CTX_generate_session_ticket_fn.

                                                                                                                                                            dec_cb is the application defined callback invoked after session ticket decryption has been attempted and any session ticket application data is available. If ticket decryption was successful then the ss argument contains the session data. The keyname and keyname_len arguments identify the key used to decrypt the session ticket. The status argument is the result of the ticket decryption. See the \"NOTES\" section below for further details. The value of arg is the same as that given to SSL_CTX_set_session_ticket_cb(). The dec_cb callback is defined as type SSL_CTX_decrypt_session_ticket_fn.

                                                                                                                                                            SSL_SESSION_set1_ticket_appdata() sets the application data specified by data and len into ss which is then placed into any generated session tickets. It can be called at any time before a session ticket is created to update the data placed into the session ticket. However, given that sessions and tickets are created by the handshake, the gen_cb is provided to notify the application that a session ticket is about to be generated.

                                                                                                                                                            SSL_SESSION_get0_ticket_appdata() assigns data to the session ticket application data and assigns len to the length of the session ticket application data from ss. The application data can be set via SSL_SESSION_set1_ticket_appdata() or by a session ticket. NULL will be assigned to data and 0 will be assigned to len if there is no session ticket application data. SSL_SESSION_get0_ticket_appdata() can be called any time after a session has been created. The dec_cb is provided to notify the application that a session ticket has just been decrypted.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#notes","title":"NOTES","text":"

                                                                                                                                                            When the dec_cb callback is invoked, the SSL_SESSION ss has not yet been assigned to the SSL s. The status indicates the result of the ticket decryption. The callback must check the status value before performing any action, as it is called even if ticket decryption fails.

                                                                                                                                                            The keyname and keyname_len arguments to dec_cb may be used to identify the key that was used to encrypt the session ticket.

                                                                                                                                                            The status argument can be any of these values:

                                                                                                                                                            • SSL_TICKET_EMPTY

                                                                                                                                                              Empty ticket present. No ticket data will be used and a new ticket should be sent to the client. This only occurs in TLSv1.2 or below. In TLSv1.3 it is not valid for a client to send an empty ticket.

                                                                                                                                                            • SSL_TICKET_NO_DECRYPT

                                                                                                                                                              The ticket couldn't be decrypted. No ticket data will be used and a new ticket should be sent to the client.

                                                                                                                                                            • SSL_TICKET_SUCCESS

                                                                                                                                                              A ticket was successfully decrypted, any session ticket application data should be available. A new ticket should not be sent to the client.

                                                                                                                                                            • SSL_TICKET_SUCCESS_RENEW

                                                                                                                                                              Same as SSL_TICKET_SUCCESS, but a new ticket should be sent to the client.

                                                                                                                                                            The return value can be any of these values:

                                                                                                                                                            • SSL_TICKET_RETURN_ABORT

                                                                                                                                                              The handshake should be aborted, either because of an error or because of some policy. Note that in TLSv1.3 a client may send more than one ticket in a single handshake. Therefore, just because one ticket is unacceptable it does not mean that all of them are. For this reason this option should be used with caution.

                                                                                                                                                            • SSL_TICKET_RETURN_IGNORE

                                                                                                                                                              Do not use a ticket (if one was available). Do not send a renewed ticket to the client.

                                                                                                                                                            • SSL_TICKET_RETURN_IGNORE_RENEW

                                                                                                                                                              Do not use a ticket (if one was available). Send a renewed ticket to the client.

                                                                                                                                                              If the callback does not wish to change the default ticket behaviour then it should return this value if status is SSL_TICKET_EMPTY or SSL_TICKET_NO_DECRYPT.

                                                                                                                                                            • SSL_TICKET_RETURN_USE

                                                                                                                                                              Use the ticket. Do not send a renewed ticket to the client. It is an error for the callback to return this value if status has a value other than SSL_TICKET_SUCCESS or SSL_TICKET_SUCCESS_RENEW.

                                                                                                                                                              If the callback does not wish to change the default ticket behaviour then it should return this value if status is SSL_TICKET_SUCCESS.

                                                                                                                                                            • SSL_TICKET_RETURN_USE_RENEW

                                                                                                                                                              Use the ticket. Send a renewed ticket to the client. It is an error for the callback to return this value if status has a value other than SSL_TICKET_SUCCESS or SSL_TICKET_SUCCESS_RENEW.

                                                                                                                                                              If the callback does not wish to change the default ticket behaviour then it should return this value if status is SSL_TICKET_SUCCESS_RENEW.

                                                                                                                                                            If status has the value SSL_TICKET_EMPTY or SSL_TICKET_NO_DECRYPT then no session data will be available and the callback must not use the ss argument. If status has the value SSL_TICKET_SUCCESS or SSL_TICKET_SUCCESS_RENEW then the application can call SSL_SESSION_get0_ticket_appdata() using the session provided in the ss argument to retrieve the application data.

                                                                                                                                                            When the gen_cb callback is invoked, the SSL_get_session() function can be used to retrieve the SSL_SESSION for SSL_SESSION_set1_ticket_appdata().

                                                                                                                                                            By default, in TLSv1.2 and below, a new session ticket is not issued on a successful resumption and therefore gen_cb will not be called. In TLSv1.3 the default behaviour is to always issue a new ticket on resumption. In both cases this behaviour can be changed if a ticket key callback is in use (see SSL_CTX_set_tlsext_ticket_key_cb(3)).

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The SSL_CTX_set_session_ticket_cb(), SSL_SESSION_set1_ticket_appdata() and SSL_SESSION_get0_ticket_appdata() functions return 1 on success and 0 on failure.

                                                                                                                                                            The gen_cb callback must return 1 to continue the connection. A return of 0 will terminate the connection with an INTERNAL_ERROR alert.

                                                                                                                                                            The dec_cb callback must return a value as described in \"NOTES\" above.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_session(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_CTX_set_session_ticket_cb(), SSL_SESSION_set1_ticket_appdata() and SSL_SESSION_get_ticket_appdata() functions were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_session_ticket_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/","title":"SSL_CTX_set_split_send_fragment","text":""},{"location":"man3/SSL_CTX_set_split_send_fragment/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_max_send_fragment, SSL_set_max_send_fragment, SSL_CTX_set_split_send_fragment, SSL_set_split_send_fragment, SSL_CTX_set_max_pipelines, SSL_set_max_pipelines, SSL_CTX_set_default_read_buffer_len, SSL_set_default_read_buffer_len, SSL_CTX_set_tlsext_max_fragment_length, SSL_set_tlsext_max_fragment_length, SSL_SESSION_get_max_fragment_length - Control fragment size settings and pipelining operations

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_CTX_set_max_send_fragment(SSL_CTX *ctx, long);\nlong SSL_set_max_send_fragment(SSL *ssl, long m);\n\nlong SSL_CTX_set_max_pipelines(SSL_CTX *ctx, long m);\nlong SSL_set_max_pipelines(SSL_CTX *ssl, long m);\n\nlong SSL_CTX_set_split_send_fragment(SSL_CTX *ctx, long m);\nlong SSL_set_split_send_fragment(SSL *ssl, long m);\n\nvoid SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len);\nvoid SSL_set_default_read_buffer_len(SSL *s, size_t len);\n\nint SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode);\nint SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode);\nuint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *session);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            Some engines are able to process multiple simultaneous crypto operations. This capability could be utilised to parallelise the processing of a single connection. For example a single write can be split into multiple records and each one encrypted independently and in parallel. Note: this will only work in TLS1.1+. There is no support in SSLv3, TLSv1.0 or DTLS (any version). This capability is known as \"pipelining\" within OpenSSL.

                                                                                                                                                            In order to benefit from the pipelining capability. You need to have an engine that provides ciphers that support this. The OpenSSL \"dasync\" engine provides AES128-SHA based ciphers that have this capability. However, these are for development and test purposes only.

                                                                                                                                                            SSL_CTX_set_max_send_fragment() and SSL_set_max_send_fragment() set the max_send_fragment parameter for SSL_CTX and SSL objects respectively. This value restricts the amount of plaintext bytes that will be sent in any one SSL/TLS record. By default its value is SSL3_RT_MAX_PLAIN_LENGTH (16384). These functions will only accept a value in the range 512 - SSL3_RT_MAX_PLAIN_LENGTH.

                                                                                                                                                            SSL_CTX_set_max_pipelines() and SSL_set_max_pipelines() set the maximum number of pipelines that will be used at any one time. This value applies to both \"read\" pipelining and \"write\" pipelining. By default only one pipeline will be used (i.e. normal non-parallel operation). The number of pipelines set must be in the range 1 - SSL_MAX_PIPELINES (32). Setting this to a value > 1 will also automatically turn on \"read_ahead\" (see SSL_CTX_set_read_ahead(3)). This is explained further below. OpenSSL will only ever use more than one pipeline if a cipher suite is negotiated that uses a pipeline capable cipher provided by an engine.

                                                                                                                                                            Pipelining operates slightly differently for reading encrypted data compared to writing encrypted data. SSL_CTX_set_split_send_fragment() and SSL_set_split_send_fragment() define how data is split up into pipelines when writing encrypted data. The number of pipelines used will be determined by the amount of data provided to the SSL_write_ex() or SSL_write() call divided by split_send_fragment.

                                                                                                                                                            For example if split_send_fragment is set to 2000 and max_pipelines is 4 then:

                                                                                                                                                            SSL_write/SSL_write_ex called with 0-2000 bytes == 1 pipeline used

                                                                                                                                                            SSL_write/SSL_write_ex called with 2001-4000 bytes == 2 pipelines used

                                                                                                                                                            SSL_write/SSL_write_ex called with 4001-6000 bytes == 3 pipelines used

                                                                                                                                                            SSL_write/SSL_write_ex called with 6001+ bytes == 4 pipelines used

                                                                                                                                                            split_send_fragment must always be less than or equal to max_send_fragment. By default it is set to be equal to max_send_fragment. This will mean that the same number of records will always be created as would have been created in the non-parallel case, although the data will be apportioned differently. In the parallel case data will be spread equally between the pipelines.

                                                                                                                                                            Read pipelining is controlled in a slightly different way than with write pipelining. While reading we are constrained by the number of records that the peer (and the network) can provide to us in one go. The more records we can get in one go the more opportunity we have to parallelise the processing. As noted above when setting max_pipelines to a value greater than one, read_ahead is automatically set. The read_ahead parameter causes OpenSSL to attempt to read as much data into the read buffer as the network can provide and will fit into the buffer. Without this set data is read into the read buffer one record at a time. The more data that can be read, the more opportunity there is for parallelising the processing at the cost of increased memory overhead per connection. Setting read_ahead can impact the behaviour of the SSL_pending() function (see SSL_pending(3)). In addition the default size of the internal read buffer is multiplied by the number of pipelines available to ensure that we can read multiple records in one go. This can therefore have a significant impact on memory usage.

                                                                                                                                                            The SSL_CTX_set_default_read_buffer_len() and SSL_set_default_read_buffer_len() functions control the size of the read buffer that will be used. The len parameter sets the size of the buffer. The value will only be used if it is greater than the default that would have been used anyway. The normal default value depends on a number of factors but it will be at least SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_ENCRYPTED_OVERHEAD (16704) bytes.

                                                                                                                                                            SSL_CTX_set_tlsext_max_fragment_length() sets the default maximum fragment length negotiation mode via value mode to ctx. This setting affects only SSL instances created after this function is called. It affects the client-side as only its side may initiate this extension use.

                                                                                                                                                            SSL_set_tlsext_max_fragment_length() sets the maximum fragment length negotiation mode via value mode to ssl. This setting will be used during a handshake when extensions are exchanged between client and server. So it only affects SSL sessions created after this function is called. It affects the client-side as only its side may initiate this extension use.

                                                                                                                                                            SSL_SESSION_get_max_fragment_length() gets the maximum fragment length negotiated in session.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            All non-void functions return 1 on success and 0 on failure.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/#notes","title":"NOTES","text":"

                                                                                                                                                            The Maximum Fragment Length extension support is optional on the server side. If the server does not support this extension then SSL_SESSION_get_max_fragment_length() will return: TLSEXT_max_fragment_length_DISABLED.

                                                                                                                                                            The following modes are available:

                                                                                                                                                            • TLSEXT_max_fragment_length_DISABLED

                                                                                                                                                              Disables Maximum Fragment Length Negotiation (default).

                                                                                                                                                            • TLSEXT_max_fragment_length_512

                                                                                                                                                              Sets Maximum Fragment Length to 512 bytes.

                                                                                                                                                            • TLSEXT_max_fragment_length_1024

                                                                                                                                                              Sets Maximum Fragment Length to 1024.

                                                                                                                                                            • TLSEXT_max_fragment_length_2048

                                                                                                                                                              Sets Maximum Fragment Length to 2048.

                                                                                                                                                            • TLSEXT_max_fragment_length_4096

                                                                                                                                                              Sets Maximum Fragment Length to 4096.

                                                                                                                                                            With the exception of SSL_CTX_set_default_read_buffer_len() SSL_set_default_read_buffer_len(), SSL_CTX_set_tlsext_max_fragment_length(), SSL_set_tlsext_max_fragment_length() and SSL_SESSION_get_max_fragment_length() all these functions are implemented using macros.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_read_ahead(3), SSL_pending(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_CTX_set_max_pipelines(), SSL_set_max_pipelines(), SSL_CTX_set_split_send_fragment(), SSL_set_split_send_fragment(), SSL_CTX_set_default_read_buffer_len() and SSL_set_default_read_buffer_len() functions were added in OpenSSL 1.1.0.

                                                                                                                                                            The SSL_CTX_set_tlsext_max_fragment_length(), SSL_set_tlsext_max_fragment_length() and SSL_SESSION_get_max_fragment_length() functions were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_split_send_fragment/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/","title":"SSL_CTX_set_srp_password","text":""},{"location":"man3/SSL_CTX_set_srp_password/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_srp_username, SSL_CTX_set_srp_password, SSL_CTX_set_srp_strength, SSL_CTX_set_srp_cb_arg, SSL_CTX_set_srp_username_callback, SSL_CTX_set_srp_client_pwd_callback, SSL_CTX_set_srp_verify_param_callback, SSL_set_srp_server_param, SSL_set_srp_server_param_pw, SSL_get_srp_g, SSL_get_srp_N, SSL_get_srp_username, SSL_get_srp_userinfo - SRP control operations

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n

                                                                                                                                                            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name);\nint SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password);\nint SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength);\nint SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg);\nint SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,\n                                      int (*cb) (SSL *s, int *ad, void *arg));\nint SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,\n                                        char *(*cb) (SSL *s, void *arg));\nint SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,\n                                          int (*cb) (SSL *s, void *arg));\n\nint SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,\n                             BIGNUM *sa, BIGNUM *v, char *info);\nint SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,\n                                const char *grp);\n\nBIGNUM *SSL_get_srp_g(SSL *s);\nBIGNUM *SSL_get_srp_N(SSL *s);\n\nchar *SSL_get_srp_username(SSL *s);\nchar *SSL_get_srp_userinfo(SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            All of the functions described on this page are deprecated. There are no available replacement functions at this time.

                                                                                                                                                            These functions provide access to SRP (Secure Remote Password) parameters, an alternate authentication mechanism for TLS. SRP allows the use of usernames and passwords over unencrypted channels without revealing the password to an eavesdropper. SRP also supplies a shared secret at the end of the authentication sequence that can be used to generate encryption keys.

                                                                                                                                                            The SRP protocol, version 3 is specified in RFC 2945. SRP version 6 is described in RFC 5054 with applications to TLS authentication.

                                                                                                                                                            The SSL_CTX_set_srp_username() function sets the SRP username for ctx. This should be called on the client prior to creating a connection to the server. The length of name must be shorter or equal to 255 characters.

                                                                                                                                                            The SSL_CTX_set_srp_password() function sets the SRP password for ctx. This may be called on the client prior to creating a connection to the server. This overrides the effect of SSL_CTX_set_srp_client_pwd_callback().

                                                                                                                                                            The SSL_CTX_set_srp_strength() function sets the SRP strength for ctx. This is the minimal length of the SRP prime in bits. If not specified 1024 is used. If not satisfied by the server key exchange the connection will be rejected.

                                                                                                                                                            The SSL_CTX_set_srp_cb_arg() function sets an extra parameter that will be passed to all following callbacks as arg.

                                                                                                                                                            The SSL_CTX_set_srp_username_callback() function sets the server side callback that is invoked when an SRP username is found in a ClientHello. The callback parameters are the SSL connection s, a writable error flag ad and the extra argument arg set by SSL_CTX_set_srp_cb_arg(). This callback should setup the server for the key exchange by calling SSL_set_srp_server_param() with the appropriate parameters for the received username. The username can be obtained by calling SSL_get_srp_username(). See SRP_VBASE_init(3) to parse the verifier file created by openssl-srp(1) or SRP_create_verifier(3) to generate it. The callback should return SSL_ERROR_NONE to proceed with the server key exchange, SSL3_AL_FATAL for a fatal error or any value < 0 for a retryable error. In the event of a SSL3_AL_FATAL the alert flag given by *al will be sent back. By default this will be SSL_AD_UNKNOWN_PSK_IDENTITY.

                                                                                                                                                            The SSL_CTX_set_srp_client_pwd_callback() function sets the client password callback on the client. The callback parameters are the SSL connection s and the extra argument arg set by SSL_CTX_set_srp_cb_arg(). The callback will be called as part of the generation of the client secrets. It should return the client password in text form or NULL to abort the connection. The resulting memory will be freed by the library as part of the callback resolution. This overrides the effect of SSL_CTX_set_srp_password().

                                                                                                                                                            The SSL_CTX_set_srp_verify_param_callback() sets the SRP gN parameter verification callback on the client. This allows the client to perform custom verification when receiving the server SRP proposed parameters. The callback parameters are the SSL connection s and the extra argument arg set by SSL_CTX_set_srp_cb_arg(). The callback should return a positive value to accept the server parameters. Returning 0 or a negative value will abort the connection. The server parameters can be obtained by calling SSL_get_srp_N() and SSL_get_srp_g(). Sanity checks are already performed by the library after the handshake (B % N non zero, check against the strength parameter) and are not necessary. If no callback is set the g and N parameters will be checked against known RFC 5054 values.

                                                                                                                                                            The SSL_set_srp_server_param() function sets all SRP parameters for the connection s. N and g are the SRP group parameters, sa is the user salt, v the password verifier and info is the optional user info.

                                                                                                                                                            The SSL_set_srp_server_param_pw() function sets all SRP parameters for the connection s by generating a random salt and a password verifier. user is the username, pass the password and grp the SRP group parameters identifier for SRP_get_default_gN(3).

                                                                                                                                                            The SSL_get_srp_g() function returns the SRP group generator for s, or from the underlying SSL_CTX if it is NULL.

                                                                                                                                                            The SSL_get_srp_N() function returns the SRP prime for s, or from the underlying SSL_CTX if it is NULL.

                                                                                                                                                            The SSL_get_srp_username() function returns the SRP username for s, or from the underlying SSL_CTX if it is NULL.

                                                                                                                                                            The SSL_get_srp_userinfo() function returns the SRP user info for s, or from the underlying SSL_CTX if it is NULL.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            All SSL_CTX_set_* functions return 1 on success and 0 on failure.

                                                                                                                                                            SSL_set_srp_server_param() returns 1 on success and -1 on failure.

                                                                                                                                                            The SSL_get_SRP_* functions return a pointer to the requested data, the memory is owned by the library and should not be freed by the caller.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Setup SRP parameters on the client:

                                                                                                                                                            #include <openssl/ssl.h>\n\nconst char *username = \"username\";\nconst char *password = \"password\";\n\nSSL_CTX *ctx = SSL_CTX_new(TLS_client_method());\nif (!ctx)\n    /* Error */\nif (!SSL_CTX_set_srp_username(ctx, username))\n    /* Error */\nif (!SSL_CTX_set_srp_password(ctx, password))\n    /* Error */\n

                                                                                                                                                            Setup SRP server with verifier file:

                                                                                                                                                            #include <openssl/srp.h>\n#include <openssl/ssl.h>\n\nconst char *srpvfile = \"password.srpv\";\n\nint srpServerCallback(SSL *s, int *ad, void *arg)\n{\n    SRP_VBASE *srpData = (SRP_VBASE*) arg;\n    char *username = SSL_get_srp_username(s);\n\n    SRP_user_pwd *user_pwd = SRP_VBASE_get1_by_user(srpData, username);\n    if (!user_pwd)\n        /* Error */\n        return SSL3_AL_FATAL;\n\n    if (SSL_set_srp_server_param(s, user_pwd->N, user_pwd->g,\n        user_pwd->s, user_pwd->v, user_pwd->info) < 0)\n        /* Error */\n\n    SRP_user_pwd_free(user_pwd);\n    return SSL_ERROR_NONE;\n}\n\nSSL_CTX *ctx = SSL_CTX_new(TLS_server_method());\nif (!ctx)\n    /* Error */\n\n/*\n * seedKey should contain a NUL terminated sequence\n * of random non NUL bytes\n */\nconst char *seedKey;\n\nSRP_VBASE *srpData = SRP_VBASE_new(seedKey);\nif (SRP_VBASE_init(srpData, (char*) srpvfile) != SRP_NO_ERROR)\n   /* Error */\n\nSSL_CTX_set_srp_cb_arg(ctx, srpData);\nSSL_CTX_set_srp_username_callback(ctx, srpServerCallback);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), openssl-srp(1), SRP_VBASE_new(3), SRP_create_verifier(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/#history","title":"HISTORY","text":"

                                                                                                                                                            These functions were added in OpenSSL 1.0.1 and deprecated in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_srp_password/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/","title":"SSL_CTX_set_ssl_version","text":""},{"location":"man3/SSL_CTX_set_ssl_version/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_ssl_version, SSL_CTX_get_ssl_method, SSL_set_ssl_method, SSL_get_ssl_method - choose a new TLS/SSL method

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);\nconst SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx);\n\nint SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);\nconst SSL_METHOD *SSL_get_ssl_method(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_ssl_version() sets a new default TLS/SSL method for SSL objects newly created from this ctx. Most of the configuration attached to the SSL_CTX object is retained, with the exception of the configured TLS ciphers, which are reset to the default values. SSL objects already created from this SSL_CTX with SSL_new(3) are not affected, except when SSL_clear(3) is being called, as described below.

                                                                                                                                                            SSL_CTX_get_ssl_method() returns the SSL_METHOD which was used to construct the SSL_CTX.

                                                                                                                                                            SSL_set_ssl_method() sets a new TLS/SSL method for a particular ssl object. It may be reset, when SSL_clear() is called.

                                                                                                                                                            SSL_get_ssl_method() returns a pointer to the TLS/SSL method set in ssl.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/#notes","title":"NOTES","text":"

                                                                                                                                                            The available method choices are described in SSL_CTX_new(3).

                                                                                                                                                            When SSL_clear(3) is called and no session is connected to an SSL object, the method of the SSL object is reset to the method currently set in the corresponding SSL_CTX object.

                                                                                                                                                            SSL_CTX_set_version() has unusual semantics and no clear use case; it would usually be preferable to create a new SSL_CTX object than to try to reuse an existing one in this fashion. Its usage is considered deprecated.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur for SSL_CTX_set_ssl_version() and SSL_set_ssl_method():

                                                                                                                                                            • 0

                                                                                                                                                              The new choice failed, check the error stack to find out the reason.

                                                                                                                                                            • 1

                                                                                                                                                              The operation succeeded.

                                                                                                                                                            SSL_CTX_get_ssl_method() and SSL_get_ssl_method() always return non-NULL pointers.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_CTX_new(3), SSL_new(3), SSL_clear(3), ssl(7), SSL_set_connect_state(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_CTX_set_ssl_version() was deprecated in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_ssl_version/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/","title":"SSL_CTX_set_stateless_cookie_generate_cb","text":""},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_stateless_cookie_generate_cb, SSL_CTX_set_stateless_cookie_verify_cb, SSL_CTX_set_cookie_generate_cb, SSL_CTX_set_cookie_verify_cb - Callback functions for stateless TLS1.3 cookies

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_CTX_set_stateless_cookie_generate_cb(\n    SSL_CTX *ctx,\n    int (*gen_stateless_cookie_cb) (SSL *ssl,\n                                    unsigned char *cookie,\n                                    size_t *cookie_len));\nvoid SSL_CTX_set_stateless_cookie_verify_cb(\n    SSL_CTX *ctx,\n    int (*verify_stateless_cookie_cb) (SSL *ssl,\n                                       const unsigned char *cookie,\n                                       size_t cookie_len));\n\nvoid SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx,\n                                    int (*app_gen_cookie_cb) (SSL *ssl,\n                                                              unsigned char\n                                                              *cookie,\n                                                              unsigned int\n                                                              *cookie_len));\nvoid SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx,\n                                  int (*app_verify_cookie_cb) (SSL *ssl,\n                                                               const unsigned\n                                                               char *cookie,\n                                                               unsigned int\n                                                               cookie_len));\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_stateless_cookie_generate_cb() sets the callback used by SSL_stateless(3) to generate the application-controlled portion of the cookie provided to clients in the HelloRetryRequest transmitted as a response to a ClientHello with a missing or invalid cookie. gen_stateless_cookie_cb() must write at most SSL_COOKIE_LENGTH bytes into cookie, and must write the number of bytes written to cookie_len. If a cookie cannot be generated, a zero return value can be used to abort the handshake.

                                                                                                                                                            SSL_CTX_set_stateless_cookie_verify_cb() sets the callback used by SSL_stateless(3) to determine whether the application-controlled portion of a ClientHello cookie is valid. The cookie data is pointed to by cookie and is of length cookie_len. A nonzero return value from verify_stateless_cookie_cb() communicates that the cookie is valid. The integrity of the entire cookie, including the application-controlled portion, is automatically verified by HMAC before verify_stateless_cookie_cb() is called.

                                                                                                                                                            SSL_CTX_set_cookie_generate_cb() sets the callback used by DTLSv1_listen(3) to generate the cookie provided to clients in the HelloVerifyRequest transmitted as a response to a ClientHello with a missing or invalid cookie. app_gen_cookie_cb() must write at most DTLS1_COOKIE_LENGTH bytes into cookie, and must write the number of bytes written to cookie_len. If a cookie cannot be generated, a zero return value can be used to abort the handshake.

                                                                                                                                                            SSL_CTX_set_cookie_verify_cb() sets the callback used by DTLSv1_listen(3) to determine whether the cookie in a ClientHello is valid. The cookie data is pointed to by cookie and is of length cookie_len. A nonzero return value from app_verify_cookie_cb() communicates that the cookie is valid. The integrity of the cookie is not verified by OpenSSL. This is an application responsibility.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            Neither function returns a value.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_stateless(3), DTLSv1_listen(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_CTX_set_stateless_cookie_generate_cb() and SSL_CTX_set_stateless_cookie_verify_cb() were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_stateless_cookie_generate_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_timeout/","title":"SSL_CTX_set_timeout","text":""},{"location":"man3/SSL_CTX_set_timeout/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_timeout, SSL_CTX_get_timeout - manipulate timeout values for session caching

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_timeout/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_CTX_set_timeout(SSL_CTX *ctx, long t);\nlong SSL_CTX_get_timeout(SSL_CTX *ctx);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_timeout/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_timeout() sets the timeout for newly created sessions for ctx to t. The timeout value t must be given in seconds.

                                                                                                                                                            SSL_CTX_get_timeout() returns the currently set timeout value for ctx.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_timeout/#notes","title":"NOTES","text":"

                                                                                                                                                            Whenever a new session is created, it is assigned a maximum lifetime. This lifetime is specified by storing the creation time of the session and the timeout value valid at this time. If the actual time is later than creation time plus timeout, the session is not reused.

                                                                                                                                                            Due to this realization, all sessions behave according to the timeout value valid at the time of the session negotiation. Changes of the timeout value do not affect already established sessions.

                                                                                                                                                            The expiration time of a single session can be modified using the SSL_SESSION_get_time(3) family of functions.

                                                                                                                                                            Expired sessions are removed from the internal session cache, whenever SSL_CTX_flush_sessions(3) is called, either directly by the application or automatically (see SSL_CTX_set_session_cache_mode(3))

                                                                                                                                                            The default value for session timeout is decided on a per protocol basis, see SSL_get_default_timeout(3). All currently supported protocols have the same default timeout value of 300 seconds.

                                                                                                                                                            This timeout value is used as the ticket lifetime hint for stateless session tickets. It is also used as the timeout value within the ticket itself.

                                                                                                                                                            For TLSv1.3, RFC8446 limits transmission of this value to 1 week (604800 seconds).

                                                                                                                                                            For TLSv1.2, tickets generated during an initial handshake use the value as specified. Tickets generated during a resumed handshake have a value of 0 for the ticket lifetime hint.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_timeout/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_timeout() returns the previously set timeout value.

                                                                                                                                                            SSL_CTX_get_timeout() returns the currently set timeout value.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_timeout/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_get_time(3), SSL_CTX_flush_sessions(3), SSL_get_default_timeout(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_timeout/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/","title":"SSL_CTX_set_tlsext_servername_callback","text":""},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_tlsext_servername_callback, SSL_CTX_set_tlsext_servername_arg, SSL_get_servername_type, SSL_get_servername, SSL_set_tlsext_host_name - handle server name indication (SNI)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_CTX_set_tlsext_servername_callback(SSL_CTX *ctx,\n                                  int (*cb)(SSL *s, int *al, void *arg));\nlong SSL_CTX_set_tlsext_servername_arg(SSL_CTX *ctx, void *arg);\n\nconst char *SSL_get_servername(const SSL *s, const int type);\nint SSL_get_servername_type(const SSL *s);\n\nint SSL_set_tlsext_host_name(const SSL *s, const char *name);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The functionality provided by the servername callback is mostly superseded by the ClientHello callback, which can be set using SSL_CTX_set_client_hello_cb(). However, even where the ClientHello callback is used, the servername callback is still necessary in order to acknowledge the servername requested by the client.

                                                                                                                                                            SSL_CTX_set_tlsext_servername_callback() sets the application callback cb used by a server to perform any actions or configuration required based on the servername extension received in the incoming connection. When cb is NULL, SNI is not used.

                                                                                                                                                            The servername callback should return one of the following values:

                                                                                                                                                            • SSL_TLSEXT_ERR_OK

                                                                                                                                                              This is used to indicate that the servername requested by the client has been accepted. Typically a server will call SSL_set_SSL_CTX() in the callback to set up a different configuration for the selected servername in this case.

                                                                                                                                                            • SSL_TLSEXT_ERR_ALERT_FATAL

                                                                                                                                                              In this case the servername requested by the client is not accepted and the handshake will be aborted. The value of the alert to be used should be stored in the location pointed to by the al parameter to the callback. By default this value is initialised to SSL_AD_UNRECOGNIZED_NAME.

                                                                                                                                                            • SSL_TLSEXT_ERR_ALERT_WARNING

                                                                                                                                                              If this value is returned then the servername is not accepted by the server. However, the handshake will continue and send a warning alert instead. The value of the alert should be stored in the location pointed to by the al parameter as for SSL_TLSEXT_ERR_ALERT_FATAL above. Note that TLSv1.3 does not support warning alerts, so if TLSv1.3 has been negotiated then this return value is treated the same way as SSL_TLSEXT_ERR_NOACK.

                                                                                                                                                            • SSL_TLSEXT_ERR_NOACK

                                                                                                                                                              This return value indicates that the servername is not accepted by the server. No alerts are sent and the server will not acknowledge the requested servername.

                                                                                                                                                            SSL_CTX_set_tlsext_servername_arg() sets a context-specific argument to be passed into the callback (via the arg parameter) for this SSL_CTX.

                                                                                                                                                            The behaviour of SSL_get_servername() depends on a number of different factors. In particular note that in TLSv1.3 the servername is negotiated in every handshake. In TLSv1.2 the servername is only negotiated on initial handshakes and not on resumption handshakes.

                                                                                                                                                            • On the client, before the handshake

                                                                                                                                                              If a servername has been set via a call to SSL_set_tlsext_host_name() then it will return that servername.

                                                                                                                                                              If one has not been set, but a TLSv1.2 resumption is being attempted and the session from the original handshake had a servername accepted by the server then it will return that servername.

                                                                                                                                                              Otherwise it returns NULL.

                                                                                                                                                            • On the client, during or after the handshake and a TLSv1.2 (or below) resumption occurred

                                                                                                                                                              If the session from the original handshake had a servername accepted by the server then it will return that servername.

                                                                                                                                                              Otherwise it returns the servername set via SSL_set_tlsext_host_name() or NULL if it was not called.

                                                                                                                                                            • On the client, during or after the handshake and a TLSv1.2 (or below) resumption did not occur

                                                                                                                                                              It will return the servername set via SSL_set_tlsext_host_name() or NULL if it was not called.

                                                                                                                                                            • On the server, before the handshake

                                                                                                                                                              The function will always return NULL before the handshake

                                                                                                                                                            • On the server, after the servername extension has been processed and a TLSv1.2 (or below) resumption occurred

                                                                                                                                                              If a servername was accepted by the server in the original handshake then it will return that servername, or NULL otherwise.

                                                                                                                                                            • On the server, after the servername extension has been processed and a TLSv1.2 (or below) resumption did not occur

                                                                                                                                                              The function will return the servername requested by the client in this handshake or NULL if none was requested.

                                                                                                                                                            Note that the ClientHello callback occurs before a servername extension from the client is processed. The servername, certificate and ALPN callbacks occur after a servername extension from the client is processed.

                                                                                                                                                            SSL_get_servername_type() returns the servername type or -1 if no servername is present. Currently the only supported type (defined in RFC3546) is TLSEXT_NAMETYPE_host_name.

                                                                                                                                                            SSL_set_tlsext_host_name() sets the server name indication ClientHello extension to contain the value name. The type of server name indication extension is set to TLSEXT_NAMETYPE_host_name (defined in RFC3546).

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#notes","title":"NOTES","text":"

                                                                                                                                                            Several callbacks are executed during ClientHello processing, including the ClientHello, ALPN, and servername callbacks. The ClientHello callback is executed first, then the servername callback, followed by the ALPN callback.

                                                                                                                                                            The SSL_set_tlsext_host_name() function should only be called on SSL objects that will act as clients; otherwise the configured name will be ignored.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_tlsext_servername_callback() and SSL_CTX_set_tlsext_servername_arg() both always return 1 indicating success. SSL_set_tlsext_host_name() returns 1 on success, 0 in case of error.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_alpn_select_cb(3), SSL_get0_alpn_selected(3), SSL_CTX_set_client_hello_cb(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_get_servername() historically provided some unexpected results in certain corner cases. This has been fixed from OpenSSL 1.1.1e.

                                                                                                                                                            Prior to 1.1.1e, when the client requested a servername in an initial TLSv1.2 handshake, the server accepted it, and then the client successfully resumed but set a different explicit servername in the second handshake then when called by the client it returned the servername from the second handshake. This has now been changed to return the servername requested in the original handshake.

                                                                                                                                                            Also prior to 1.1.1e, if the client sent a servername in the first handshake but the server did not accept it, and then a second handshake occurred where TLSv1.2 resumption was successful then when called by the server it returned the servername requested in the original handshake. This has now been changed to NULL.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_servername_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/","title":"SSL_CTX_set_tlsext_status_cb","text":""},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_tlsext_status_cb, SSL_CTX_get_tlsext_status_cb, SSL_CTX_set_tlsext_status_arg, SSL_CTX_get_tlsext_status_arg, SSL_CTX_set_tlsext_status_type, SSL_CTX_get_tlsext_status_type, SSL_set_tlsext_status_type, SSL_get_tlsext_status_type, SSL_get_tlsext_status_ocsp_resp, SSL_set_tlsext_status_ocsp_resp - OCSP Certificate Status Request functions

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/tls1.h>\n\nlong SSL_CTX_set_tlsext_status_cb(SSL_CTX *ctx, int (*callback)(SSL *, void *));\nlong SSL_CTX_get_tlsext_status_cb(SSL_CTX *ctx, int (**callback)(SSL *, void *));\n\nlong SSL_CTX_set_tlsext_status_arg(SSL_CTX *ctx, void *arg);\nlong SSL_CTX_get_tlsext_status_arg(SSL_CTX *ctx, void **arg);\n\nlong SSL_CTX_set_tlsext_status_type(SSL_CTX *ctx, int type);\nlong SSL_CTX_get_tlsext_status_type(SSL_CTX *ctx);\n\nlong SSL_set_tlsext_status_type(SSL *s, int type);\nlong SSL_get_tlsext_status_type(SSL *s);\n\nlong SSL_get_tlsext_status_ocsp_resp(ssl, unsigned char **resp);\nlong SSL_set_tlsext_status_ocsp_resp(ssl, unsigned char *resp, int len);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            A client application may request that a server send back an OCSP status response (also known as OCSP stapling). To do so the client should call the SSL_CTX_set_tlsext_status_type() function prior to the creation of any SSL objects. Alternatively an application can call the SSL_set_tlsext_status_type() function on an individual SSL object prior to the start of the handshake. Currently the only supported type is TLSEXT_STATUSTYPE_ocsp. This value should be passed in the type argument. Calling SSL_CTX_get_tlsext_status_type() will return the type TLSEXT_STATUSTYPE_ocsp previously set via SSL_CTX_set_tlsext_status_type() or -1 if not set.

                                                                                                                                                            The client should additionally provide a callback function to decide what to do with the returned OCSP response by calling SSL_CTX_set_tlsext_status_cb(). The callback function should determine whether the returned OCSP response is acceptable or not. The callback will be passed as an argument the value previously set via a call to SSL_CTX_set_tlsext_status_arg(). Note that the callback will not be called in the event of a handshake where session resumption occurs (because there are no Certificates exchanged in such a handshake). The callback previously set via SSL_CTX_set_tlsext_status_cb() can be retrieved by calling SSL_CTX_get_tlsext_status_cb(), and the argument by calling SSL_CTX_get_tlsext_status_arg().

                                                                                                                                                            On the client side SSL_get_tlsext_status_type() can be used to determine whether the client has previously called SSL_set_tlsext_status_type(). It will return TLSEXT_STATUSTYPE_ocsp if it has been called or -1 otherwise. On the server side SSL_get_tlsext_status_type() can be used to determine whether the client requested OCSP stapling. If the client requested it then this function will return TLSEXT_STATUSTYPE_ocsp, or -1 otherwise.

                                                                                                                                                            The response returned by the server can be obtained via a call to SSL_get_tlsext_status_ocsp_resp(). The value *resp will be updated to point to the OCSP response data and the return value will be the length of that data. Typically a callback would obtain an OCSP_RESPONSE object from this data via a call to the d2i_OCSP_RESPONSE() function. If the server has not provided any response data then *resp will be NULL and the return value from SSL_get_tlsext_status_ocsp_resp() will be -1.

                                                                                                                                                            A server application must also call the SSL_CTX_set_tlsext_status_cb() function if it wants to be able to provide clients with OCSP Certificate Status responses. Typically the server callback would obtain the server certificate that is being sent back to the client via a call to SSL_get_certificate(); obtain the OCSP response to be sent back; and then set that response data by calling SSL_set_tlsext_status_ocsp_resp(). A pointer to the response data should be provided in the resp argument, and the length of that data should be in the len argument.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The callback when used on the client side should return a negative value on error; 0 if the response is not acceptable (in which case the handshake will fail) or a positive value if it is acceptable.

                                                                                                                                                            The callback when used on the server side should return with either SSL_TLSEXT_ERR_OK (meaning that the OCSP response that has been set should be returned), SSL_TLSEXT_ERR_NOACK (meaning that an OCSP response should not be returned) or SSL_TLSEXT_ERR_ALERT_FATAL (meaning that a fatal error has occurred).

                                                                                                                                                            SSL_CTX_set_tlsext_status_cb(), SSL_CTX_set_tlsext_status_arg(), SSL_CTX_set_tlsext_status_type(), SSL_set_tlsext_status_type() and SSL_set_tlsext_status_ocsp_resp() return 0 on error or 1 on success.

                                                                                                                                                            SSL_CTX_get_tlsext_status_type() returns the value previously set by SSL_CTX_set_tlsext_status_type(), or -1 if not set.

                                                                                                                                                            SSL_get_tlsext_status_ocsp_resp() returns the length of the OCSP response data or -1 if there is no OCSP response data.

                                                                                                                                                            SSL_get_tlsext_status_type() returns TLSEXT_STATUSTYPE_ocsp on the client side if SSL_set_tlsext_status_type() was previously called, or on the server side if the client requested OCSP stapling. Otherwise -1 is returned.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_get_tlsext_status_type(), SSL_CTX_get_tlsext_status_type() and SSL_CTX_set_tlsext_status_type() functions were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_status_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/","title":"SSL_CTX_set_tlsext_ticket_key_cb","text":""},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_tlsext_ticket_key_evp_cb, SSL_CTX_set_tlsext_ticket_key_cb - set a callback for session ticket processing

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/tls1.h>\n\nint SSL_CTX_set_tlsext_ticket_key_evp_cb(SSL_CTX sslctx,\n    int (*cb)(SSL *s, unsigned char key_name[16],\n              unsigned char iv[EVP_MAX_IV_LENGTH],\n              EVP_CIPHER_CTX *ctx, EVP_MAC_CTX *hctx, int enc));\n

                                                                                                                                                            The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            int SSL_CTX_set_tlsext_ticket_key_cb(SSL_CTX sslctx,\n    int (*cb)(SSL *s, unsigned char key_name[16],\n              unsigned char iv[EVP_MAX_IV_LENGTH],\n              EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc));\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_tlsext_ticket_key_evp_cb() sets a callback function cb for handling session tickets for the ssl context sslctx. Session tickets, defined in RFC5077 provide an enhanced session resumption capability where the server implementation is not required to maintain per session state. It only applies to TLS and there is no SSLv3 implementation.

                                                                                                                                                            The callback function cb will be called for every client instigated TLS session when session ticket extension is presented in the TLS hello message. It is the responsibility of this function to create or retrieve the cryptographic parameters and to maintain their state.

                                                                                                                                                            The OpenSSL library uses your callback function to help implement a common TLS ticket construction state according to RFC5077 Section 4 such that per session state is unnecessary and a small set of cryptographic variables needs to be maintained by the callback function implementation.

                                                                                                                                                            In order to reuse a session, a TLS client must send the session ticket extension to the server. The client must send exactly one session ticket. The server, through the callback function, either agrees to reuse the session ticket information or it starts a full TLS handshake to create a new session ticket.

                                                                                                                                                            Before the callback function is started ctx and hctx have been initialised with EVP_CIPHER_CTX_reset(3) and EVP_MAC_CTX_new(3) respectively.

                                                                                                                                                            For new sessions tickets, when the client doesn't present a session ticket, or an attempted retrieval of the ticket failed, or a renew option was indicated, the callback function will be called with enc equal to 1. The OpenSSL library expects that the function will set an arbitrary name, initialize iv, and set the cipher context ctx and the hash context hctx.

                                                                                                                                                            The name is 16 characters long and is used as a key identifier.

                                                                                                                                                            The iv length is the length of the IV of the corresponding cipher. The maximum IV length is EVP_MAX_IV_LENGTH bytes defined in <openssl/evp.h>.

                                                                                                                                                            The initialization vector iv should be a random value. The cipher context ctx should use the initialisation vector iv. The cipher context can be set using EVP_EncryptInit_ex(3). The hmac context and digest can be set using EVP_MAC_CTX_set_params(3) with the OSSL_MAC_PARAM_KEY and OSSL_MAC_PARAM_DIGEST parameters respectively.

                                                                                                                                                            When the client presents a session ticket, the callback function with be called with enc set to 0 indicating that the cb function should retrieve a set of parameters. In this case name and iv have already been parsed out of the session ticket. The OpenSSL library expects that the name will be used to retrieve a cryptographic parameters and that the cryptographic context ctx will be set with the retrieved parameters and the initialization vector iv. using a function like EVP_DecryptInit_ex(3). The key material and digest for hctx need to be set using EVP_MAC_CTX_set_params(3) with the OSSL_MAC_PARAM_KEY and OSSL_MAC_PARAM_DIGEST parameters respectively.

                                                                                                                                                            If the name is still valid but a renewal of the ticket is required the callback function should return 2. The library will call the callback again with an argument of enc equal to 1 to set the new ticket.

                                                                                                                                                            The return value of the cb function is used by OpenSSL to determine what further processing will occur. The following return values have meaning:

                                                                                                                                                            • 2

                                                                                                                                                              This indicates that the ctx and hctx have been set and the session can continue on those parameters. Additionally it indicates that the session ticket is in a renewal period and should be replaced. The OpenSSL library will call cb again with an enc argument of 1 to set the new ticket (see RFC5077 3.3 paragraph 2).

                                                                                                                                                            • 1

                                                                                                                                                              This indicates that the ctx and hctx have been set and the session can continue on those parameters.

                                                                                                                                                            • 0

                                                                                                                                                              This indicates that it was not possible to set/retrieve a session ticket and the SSL/TLS session will continue by negotiating a set of cryptographic parameters or using the alternate SSL/TLS resumption mechanism, session ids.

                                                                                                                                                              If called with enc equal to 0 the library will call the cb again to get a new set of parameters.

                                                                                                                                                            • less than 0

                                                                                                                                                              This indicates an error.

                                                                                                                                                            The SSL_CTX_set_tlsext_ticket_key_cb() function is identical to SSL_CTX_set_tlsext_ticket_key_evp_cb() except that it takes a deprecated HMAC_CTX pointer instead of an EVP_MAC_CTX one. Before this callback function is started hctx will have been initialised with EVP_MAC_CTX_new(3) and the digest set with EVP_MAC_CTX_set_params(3). The hctx key material can be set using HMAC_Init_ex(3).

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#notes","title":"NOTES","text":"

                                                                                                                                                            Session resumption shortcuts the TLS handshake so that the client certificate negotiation doesn't occur. It makes up for this by storing the client certificate and all other negotiated state information encrypted within the ticket. In a resumed session the applications will have all this state information available exactly as if a full negotiation had occurred.

                                                                                                                                                            If an attacker can obtain the key used to encrypt a session ticket, they can obtain the master secret for any ticket using that key and decrypt any traffic using that session: even if the cipher suite supports forward secrecy. As a result applications may wish to use multiple keys and avoid using long term keys stored in files.

                                                                                                                                                            Applications can use longer keys to maintain a consistent level of security. For example if a cipher suite uses 256 bit ciphers but only a 128 bit ticket key the overall security is only 128 bits because breaking the ticket key will enable an attacker to obtain the session keys.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            Returns 1 to indicate the callback function was set and 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Reference Implementation:

                                                                                                                                                            SSL_CTX_set_tlsext_ticket_key_evp_cb(SSL, ssl_tlsext_ticket_key_cb);\n...\n\nstatic int ssl_tlsext_ticket_key_cb(SSL *s, unsigned char key_name[16],\n                                    unsigned char *iv, EVP_CIPHER_CTX *ctx,\n                                    EVP_MAC_CTX *hctx, int enc)\n{\n    OSSL_PARAM params[3];\n    your_type_t *key; /* something that you need to implement */\n\n    if (enc) { /* create new session */\n        if (RAND_bytes(iv, EVP_MAX_IV_LENGTH) <= 0)\n            return -1; /* insufficient random */\n\n        key = currentkey(); /* something that you need to implement */\n        if (key == NULL) {\n            /* current key doesn't exist or isn't valid */\n            key = createkey(); /*\n                                * Something that you need to implement.\n                                * createkey needs to initialise a name,\n                                * an aes_key, a hmac_key and optionally\n                                * an expire time.\n                                */\n            if (key == NULL) /* key couldn't be created */\n                return 0;\n        }\n        memcpy(key_name, key->name, 16);\n\n        if (EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, key->aes_key,\n                               iv) == 0)\n           return -1; /* error in cipher initialisation */\n\n        params[0] = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,\n                                                      key->hmac_key, 32);\n        params[1] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,\n                                                     \"sha256\", 0);\n        params[2] = OSSL_PARAM_construct_end();\n        if (EVP_MAC_CTX_set_params(hctx, params) == 0)\n           return -1; /* error in mac initialisation */\n\n        return 1;\n\n    } else { /* retrieve session */\n        time_t t = time(NULL);\n        key = findkey(key_name); /* something that you need to implement */\n\n        if (key == NULL || key->expire < t)\n            return 0;\n\n        params[0] = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                                      key->hmac_key, 32);\n        params[1] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,\n                                                     \"sha256\", 0);\n        params[2] = OSSL_PARAM_construct_end();\n        if (EVP_MAC_CTX_set_params(hctx, params) == 0)\n           return -1; /* error in mac initialisation */\n\n        if (EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, key->aes_key,\n                               iv) == 0)\n           return -1; /* error in cipher initialisation */\n\n        if (key->expire < t - RENEW_TIME) { /* RENEW_TIME: implement */\n            /*\n             * return 2 - This session will get a new ticket even though the\n             * current one is still valid.\n             */\n            return 2;\n        }\n        return 1;\n    }\n}\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_set_session(3), SSL_session_reused(3), SSL_CTX_add_session(3), SSL_CTX_sess_number(3), SSL_CTX_sess_set_get_cb(3), SSL_CTX_set_session_id_context(3),

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_CTX_set_tlsext_ticket_key_cb() function was deprecated in OpenSSL 3.0.

                                                                                                                                                            The SSL_CTX_set_tlsext_ticket_key_evp_cb() function was introduced in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_ticket_key_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/","title":"SSL_CTX_set_tlsext_use_srtp","text":""},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_tlsext_use_srtp, SSL_set_tlsext_use_srtp, SSL_get_srtp_profiles, SSL_get_selected_srtp_profile - Configure and query SRTP support

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/srtp.h>\n\nint SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles);\nint SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles);\n\nSTACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl);\nSRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SRTP is the Secure Real-Time Transport Protocol. OpenSSL implements support for the \"use_srtp\" DTLS extension defined in RFC5764. This provides a mechanism for establishing SRTP keying material, algorithms and parameters using DTLS. This capability may be used as part of an implementation that conforms to RFC5763. OpenSSL does not implement SRTP itself or RFC5763. Note that OpenSSL does not support the use of SRTP Master Key Identifiers (MKIs). Also note that this extension is only supported in DTLS. Any SRTP configuration will be ignored if a TLS connection is attempted.

                                                                                                                                                            An OpenSSL client wishing to send the \"use_srtp\" extension should call SSL_CTX_set_tlsext_use_srtp() to set its use for all SSL objects subsequently created from an SSL_CTX. Alternatively a client may call SSL_set_tlsext_use_srtp() to set its use for an individual SSL object. The profiles parameters should point to a NUL-terminated, colon delimited list of SRTP protection profile names.

                                                                                                                                                            The currently supported protection profile names are:

                                                                                                                                                            • SRTP_AES128_CM_SHA1_80

                                                                                                                                                              This corresponds to SRTP_AES128_CM_HMAC_SHA1_80 defined in RFC5764.

                                                                                                                                                            • SRTP_AES128_CM_SHA1_32

                                                                                                                                                              This corresponds to SRTP_AES128_CM_HMAC_SHA1_32 defined in RFC5764.

                                                                                                                                                            • SRTP_AEAD_AES_128_GCM

                                                                                                                                                              This corresponds to the profile of the same name defined in RFC7714.

                                                                                                                                                            • SRTP_AEAD_AES_256_GCM

                                                                                                                                                              This corresponds to the profile of the same name defined in RFC7714.

                                                                                                                                                            Supplying an unrecognised protection profile name will result in an error.

                                                                                                                                                            An OpenSSL server wishing to support the \"use_srtp\" extension should also call SSL_CTX_set_tlsext_use_srtp() or SSL_set_tlsext_use_srtp() to indicate the protection profiles that it is willing to negotiate.

                                                                                                                                                            The currently configured list of protection profiles for either a client or a server can be obtained by calling SSL_get_srtp_profiles(). This returns a stack of SRTP_PROTECTION_PROFILE objects. The memory pointed to in the return value of this function should not be freed by the caller.

                                                                                                                                                            After a handshake has been completed the negotiated SRTP protection profile (if any) can be obtained (on the client or the server) by calling SSL_get_selected_srtp_profile(). This function will return NULL if no SRTP protection profile was negotiated. The memory returned from this function should not be freed by the caller.

                                                                                                                                                            If an SRTP protection profile has been successfully negotiated then the SRTP keying material (on both the client and server) should be obtained via a call to SSL_export_keying_material(3). This call should provide a label value of \"EXTRACTOR-dtls_srtp\" and a NULL context value (use_context is 0). The total length of keying material obtained should be equal to two times the sum of the master key length and the salt length as defined for the protection profile in use. This provides the client write master key, the server write master key, the client write master salt and the server write master salt in that order.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_tlsext_use_srtp() and SSL_set_tlsext_use_srtp() return 0 on success or 1 on error.

                                                                                                                                                            SSL_get_srtp_profiles() returns a stack of SRTP_PROTECTION_PROFILE objects on success or NULL on error or if no protection profiles have been configured.

                                                                                                                                                            SSL_get_selected_srtp_profile() returns a pointer to an SRTP_PROTECTION_PROFILE object if one has been negotiated or NULL otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_export_keying_material(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tlsext_use_srtp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/","title":"SSL_CTX_set_tmp_dh_callback","text":""},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_dh_auto, SSL_set_dh_auto, SSL_CTX_set0_tmp_dh_pkey, SSL_set0_tmp_dh_pkey, SSL_CTX_set_tmp_dh_callback, SSL_CTX_set_tmp_dh, SSL_set_tmp_dh_callback, SSL_set_tmp_dh - handle DH keys for ephemeral key exchange

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_CTX_set_dh_auto(SSL_CTX *ctx, int onoff);\nlong SSL_set_dh_auto(SSL *s, int onoff);\nint SSL_CTX_set0_tmp_dh_pkey(SSL_CTX *ctx, EVP_PKEY *dhpkey);\nint SSL_set0_tmp_dh_pkey(SSL *s, EVP_PKEY *dhpkey);\n

                                                                                                                                                            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,\n                                 DH *(*tmp_dh_callback)(SSL *ssl, int is_export,\n                                                        int keylength));\nlong SSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh);\n\nvoid SSL_set_tmp_dh_callback(SSL *ctx,\n                             DH *(*tmp_dh_callback)(SSL *ssl, int is_export,\n                                                    int keylength));\nlong SSL_set_tmp_dh(SSL *ssl, DH *dh);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The functions described on this page are relevant for servers only.

                                                                                                                                                            Some ciphersuites may use ephemeral Diffie-Hellman (DH) key exchange. In these cases, the session data is negotiated using the ephemeral/temporary DH key and the key supplied and certified by the certificate chain is only used for signing. Anonymous ciphers (without a permanent server key) also use ephemeral DH keys.

                                                                                                                                                            Using ephemeral DH key exchange yields forward secrecy as the connection can only be decrypted when the DH key is known. By generating a temporary DH key inside the server application that is lost when the application is left, it becomes impossible for an attacker to decrypt past sessions, even if they get hold of the normal (certified) key, as this key was only used for signing.

                                                                                                                                                            In order to perform a DH key exchange the server must use a DH group (DH parameters) and generate a DH key. The server will always generate a new DH key during the negotiation.

                                                                                                                                                            As generating DH parameters is extremely time consuming, an application should not generate the parameters on the fly. DH parameters can be reused, as the actual key is newly generated during the negotiation.

                                                                                                                                                            Typically applications should use well known DH parameters that have built-in support in OpenSSL. The macros SSL_CTX_set_dh_auto() and SSL_set_dh_auto() configure OpenSSL to use the default built-in DH parameters for the SSL_CTX and SSL objects respectively. Passing a value of 1 in the onoff parameter switches the feature on, and passing a value of 0 switches it off. The default setting is off.

                                                                                                                                                            If \"auto\" DH parameters are switched on then the parameters will be selected to be consistent with the size of the key associated with the server's certificate. If there is no certificate (e.g. for PSK ciphersuites), then it it will be consistent with the size of the negotiated symmetric cipher key.

                                                                                                                                                            Applications may supply their own DH parameters instead of using the built-in values. This approach is discouraged and applications should in preference use the built-in parameter support described above. Applications wishing to supply their own DH parameters should call SSL_CTX_set0_tmp_dh_pkey() or SSL_set0_tmp_dh_pkey() to supply the parameters for the SSL_CTX or SSL respectively. The parameters should be supplied in the dhpkey argument as an EVP_PKEY containing DH parameters. Ownership of the dhpkey value is passed to the SSL_CTX or SSL object as a result of this call, and so the caller should not free it if the function call is successful.

                                                                                                                                                            The deprecated macros SSL_CTX_set_tmp_dh() and SSL_set_tmp_dh() do the same thing as SSL_CTX_set0_tmp_dh_pkey() and SSL_set0_tmp_dh_pkey() except that the DH parameters are supplied in a DH object instead in the dh argument, and ownership of the DH object is retained by the application. Applications should use \"auto\" parameters instead, or call SSL_CTX_set0_tmp_dh_pkey() or SSL_set0_tmp_dh_pkey() as appropriate.

                                                                                                                                                            An application may instead specify the DH parameters via a callback function using the functions SSL_CTX_set_tmp_dh_callback() or SSL_set_tmp_dh_callback() to set the callback for the SSL_CTX or SSL object respectively. These functions are deprecated. Applications should instead use \"auto\" parameters, or specify the parameters via SSL_CTX_set0_tmp_dh_pkey() or SSL_set0_tmp_dh_pkey() as appropriate.

                                                                                                                                                            The callback will be invoked during a connection when DH parameters are required. The SSL object for the current connection is supplied as an argument. Previous versions of OpenSSL used the is_export and keylength arguments to control parameter generation for export and non-export cipher suites. Modern OpenSSL does not support export ciphersuites and so these arguments are unused and can be ignored by the callback. The callback should return the parameters to be used in a DH object. Ownership of the DH object is retained by the application and should later be freed.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            All of these functions/macros return 1 for success or 0 on error.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_cipher_list(3), SSL_CTX_set_options(3), openssl-ciphers(1), openssl-dhparam(1)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_dh_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_ecdh/","title":"SSL_CTX_set_tmp_ecdh","text":""},{"location":"man3/SSL_CTX_set_tmp_ecdh/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_tmp_ecdh, SSL_set_tmp_ecdh, SSL_CTX_set_ecdh_auto, SSL_set_ecdh_auto - handle ECDH keys for ephemeral key exchange

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_CTX_set_tmp_ecdh(SSL_CTX *ctx, const EC_KEY *ecdh);\nlong SSL_set_tmp_ecdh(SSL *ssl, const EC_KEY *ecdh);\n\nlong SSL_CTX_set_ecdh_auto(SSL_CTX *ctx, int state);\nlong SSL_set_ecdh_auto(SSL *ssl, int state);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_tmp_ecdh() sets ECDH parameters to be used to be ecdh. The key is inherited by all ssl objects created from ctx. This macro is deprecated in favor of SSL_CTX_set1_groups(3).

                                                                                                                                                            SSL_set_tmp_ecdh() sets the parameters only for ssl. This macro is deprecated in favor of SSL_set1_groups(3).

                                                                                                                                                            SSL_CTX_set_ecdh_auto() and SSL_set_ecdh_auto() are deprecated and have no effect.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_tmp_ecdh() and SSL_set_tmp_ecdh() return 1 on success and 0 on failure.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set1_curves(3), SSL_CTX_set_cipher_list(3), SSL_CTX_set_options(3), SSL_CTX_set_tmp_dh_callback(3), openssl-ciphers(1), openssl-ecparam(1)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_tmp_ecdh/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/","title":"SSL_CTX_set_verify","text":""},{"location":"man3/SSL_CTX_set_verify/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_ex_data_X509_STORE_CTX_idx, SSL_CTX_set_verify, SSL_set_verify, SSL_CTX_set_verify_depth, SSL_set_verify_depth, SSL_verify_cb, SSL_verify_client_post_handshake, SSL_set_post_handshake_auth, SSL_CTX_set_post_handshake_auth - set various SSL/TLS parameters for peer certificate verification

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\ntypedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx);\n\nvoid SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb verify_callback);\nvoid SSL_set_verify(SSL *ssl, int mode, SSL_verify_cb verify_callback);\nSSL_get_ex_data_X509_STORE_CTX_idx(void);\n\nvoid SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth);\nvoid SSL_set_verify_depth(SSL *ssl, int depth);\n\nint SSL_verify_client_post_handshake(SSL *ssl);\nvoid SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val);\nvoid SSL_set_post_handshake_auth(SSL *ssl, int val);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_verify() sets the verification flags for ctx to be mode and specifies the verify_callback function to be used. If no callback function shall be specified, the NULL pointer can be used for verify_callback.

                                                                                                                                                            SSL_set_verify() sets the verification flags for ssl to be mode and specifies the verify_callback function to be used. If no callback function shall be specified, the NULL pointer can be used for verify_callback. In this case last verify_callback set specifically for this ssl remains. If no special callback was set before, the default callback for the underlying ctx is used, that was valid at the time ssl was created with SSL_new(3). Within the callback function, SSL_get_ex_data_X509_STORE_CTX_idx can be called to get the data index of the current SSL object that is doing the verification.

                                                                                                                                                            In client mode verify_callback may also call the SSL_set_retry_verify(3) function on the SSL object set in the x509_store_ctx ex data (see SSL_get_ex_data_X509_STORE_CTX_idx(3)) and return 1. This would be typically done in case the certificate verification was not yet able to succeed. This makes the handshake suspend and return control to the calling application with SSL_ERROR_WANT_RETRY_VERIFY. The application can for instance fetch further certificates or cert status information needed for the verification. Calling SSL_connect(3) again resumes the connection attempt by retrying the server certificate verification step. This process may even be repeated if need be. Note that the handshake may still be aborted if a subsequent invocation of the callback (e.g., at a lower depth, or for a separate error condition) returns 0.

                                                                                                                                                            SSL_CTX_set_verify_depth() sets the maximum depth for the certificate chain verification that shall be allowed for ctx.

                                                                                                                                                            SSL_set_verify_depth() sets the maximum depth for the certificate chain verification that shall be allowed for ssl.

                                                                                                                                                            SSL_CTX_set_post_handshake_auth() and SSL_set_post_handshake_auth() enable the Post-Handshake Authentication extension to be added to the ClientHello such that post-handshake authentication can be requested by the server. If val is 0 then the extension is not sent, otherwise it is. By default the extension is not sent. A certificate callback will need to be set via SSL_CTX_set_client_cert_cb() if no certificate is provided at initialization.

                                                                                                                                                            SSL_verify_client_post_handshake() causes a CertificateRequest message to be sent by a server on the given ssl connection. The SSL_VERIFY_PEER flag must be set; the SSL_VERIFY_POST_HANDSHAKE flag is optional.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#notes","title":"NOTES","text":"

                                                                                                                                                            The verification of certificates can be controlled by a set of logically or'ed mode flags:

                                                                                                                                                            • SSL_VERIFY_NONE

                                                                                                                                                              Server mode: the server will not send a client certificate request to the client, so the client will not send a certificate.

                                                                                                                                                              Client mode: if not using an anonymous cipher (by default disabled), the server will send a certificate which will be checked. The result of the certificate verification process can be checked after the TLS/SSL handshake using the SSL_get_verify_result(3) function. The handshake will be continued regardless of the verification result.

                                                                                                                                                            • SSL_VERIFY_PEER

                                                                                                                                                              Server mode: the server sends a client certificate request to the client. The certificate returned (if any) is checked. If the verification process fails, the TLS/SSL handshake is immediately terminated with an alert message containing the reason for the verification failure. The behaviour can be controlled by the additional SSL_VERIFY_FAIL_IF_NO_PEER_CERT, SSL_VERIFY_CLIENT_ONCE and SSL_VERIFY_POST_HANDSHAKE flags.

                                                                                                                                                              Client mode: the server certificate is verified. If the verification process fails, the TLS/SSL handshake is immediately terminated with an alert message containing the reason for the verification failure. If no server certificate is sent, because an anonymous cipher is used, SSL_VERIFY_PEER is ignored.

                                                                                                                                                            • SSL_VERIFY_FAIL_IF_NO_PEER_CERT

                                                                                                                                                              Server mode: if the client did not return a certificate, the TLS/SSL handshake is immediately terminated with a \"handshake failure\" alert. This flag must be used together with SSL_VERIFY_PEER.

                                                                                                                                                              Client mode: ignored (see BUGS)

                                                                                                                                                            • SSL_VERIFY_CLIENT_ONCE

                                                                                                                                                              Server mode: only request a client certificate once during the connection. Do not ask for a client certificate again during renegotiation or post-authentication if a certificate was requested during the initial handshake. This flag must be used together with SSL_VERIFY_PEER.

                                                                                                                                                              Client mode: ignored (see BUGS)

                                                                                                                                                            • SSL_VERIFY_POST_HANDSHAKE

                                                                                                                                                              Server mode: the server will not send a client certificate request during the initial handshake, but will send the request via SSL_verify_client_post_handshake(). This allows the SSL_CTX or SSL to be configured for post-handshake peer verification before the handshake occurs. This flag must be used together with SSL_VERIFY_PEER. TLSv1.3 only; no effect on pre-TLSv1.3 connections.

                                                                                                                                                              Client mode: ignored (see BUGS)

                                                                                                                                                            If the mode is SSL_VERIFY_NONE none of the other flags may be set.

                                                                                                                                                            If verification flags are not modified explicitly by SSL_CTX_set_verify() or SSL_set_verify(), the default value will be SSL_VERIFY_NONE.

                                                                                                                                                            The actual verification procedure is performed either using the built-in verification procedure or using another application provided verification function set with SSL_CTX_set_cert_verify_callback(3). The following descriptions apply in the case of the built-in procedure. An application provided procedure also has access to the verify depth information and the verify_callback() function, but the way this information is used may be different.

                                                                                                                                                            SSL_CTX_set_verify_depth() and SSL_set_verify_depth() set a limit on the number of certificates between the end-entity and trust-anchor certificates. Neither the end-entity nor the trust-anchor certificates count against depth. If the certificate chain needed to reach a trusted issuer is longer than depth+2, X509_V_ERR_CERT_CHAIN_TOO_LONG will be issued. The depth count is \"level 0:peer certificate\", \"level 1: CA certificate\", \"level 2: higher level CA certificate\", and so on. Setting the maximum depth to 2 allows the levels 0, 1, 2 and 3 (0 being the end-entity and 3 the trust-anchor). The default depth limit is 100, allowing for the peer certificate, at most 100 intermediate CA certificates and a final trust anchor certificate.

                                                                                                                                                            The verify_callback function is used to control the behaviour when the SSL_VERIFY_PEER flag is set. It must be supplied by the application and receives two arguments: preverify_ok indicates, whether the verification of the certificate in question was passed (preverify_ok=1) or not (preverify_ok=0). x509_ctx is a pointer to the complete context used for the certificate chain verification.

                                                                                                                                                            The certificate chain is checked starting with the deepest nesting level (the root CA certificate) and worked upward to the peer's certificate. At each level signatures and issuer attributes are checked. Whenever a verification error is found, the error number is stored in x509_ctx and verify_callback is called with preverify_ok=0. By applying X509_CTX_store_* functions verify_callback can locate the certificate in question and perform additional steps (see EXAMPLES). If no error is found for a certificate, verify_callback is called with preverify_ok=1 before advancing to the next level.

                                                                                                                                                            The return value of verify_callback controls the strategy of the further verification process. If verify_callback returns 0, the verification process is immediately stopped with \"verification failed\" state. If SSL_VERIFY_PEER is set, a verification failure alert is sent to the peer and the TLS/SSL handshake is terminated. If verify_callback returns 1, the verification process is continued. If verify_callback always returns 1, the TLS/SSL handshake will not be terminated with respect to verification failures and the connection will be established. The calling process can however retrieve the error code of the last verification error using SSL_get_verify_result(3) or by maintaining its own error storage managed by verify_callback.

                                                                                                                                                            If no verify_callback is specified, the default callback will be used. Its return value is identical to preverify_ok, so that any verification failure will lead to a termination of the TLS/SSL handshake with an alert message, if SSL_VERIFY_PEER is set.

                                                                                                                                                            After calling SSL_set_post_handshake_auth(), the client will need to add a certificate or certificate callback to its configuration before it can successfully authenticate. This must be called before SSL_connect().

                                                                                                                                                            SSL_verify_client_post_handshake() requires that verify flags have been previously set, and that a client sent the post-handshake authentication extension. When the client returns a certificate the verify callback will be invoked. A write operation must take place for the Certificate Request to be sent to the client, this can be done with SSL_do_handshake() or SSL_write_ex(). Only one certificate request may be outstanding at any time.

                                                                                                                                                            When post-handshake authentication occurs, a refreshed NewSessionTicket message is sent to the client.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#bugs","title":"BUGS","text":"

                                                                                                                                                            In client mode, it is not checked whether the SSL_VERIFY_PEER flag is set, but whether any flags other than SSL_VERIFY_NONE are set. This can lead to unexpected behaviour if SSL_VERIFY_PEER and other flags are not used as required.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The SSL*_set_verify*() functions do not provide diagnostic information.

                                                                                                                                                            The SSL_verify_client_post_handshake() function returns 1 if the request succeeded, and 0 if the request failed. The error stack can be examined to determine the failure reason.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            The following code sequence realizes an example verify_callback function that will always continue the TLS/SSL handshake regardless of verification failure, if wished. The callback realizes a verification depth limit with more informational output.

                                                                                                                                                            All verification errors are printed; information about the certificate chain is printed on request. The example is realized for a server that does allow but not require client certificates.

                                                                                                                                                            The example makes use of the ex_data technique to store application data into/retrieve application data from the SSL structure (see CRYPTO_get_ex_new_index(3), SSL_get_ex_data_X509_STORE_CTX_idx(3)).

                                                                                                                                                            ...\ntypedef struct {\n  int verbose_mode;\n  int verify_depth;\n  int always_continue;\n} mydata_t;\nint mydata_index;\n\n...\nstatic int verify_callback(int preverify_ok, X509_STORE_CTX *ctx)\n{\n    char    buf[256];\n    X509   *err_cert;\n    int     err, depth;\n    SSL    *ssl;\n    mydata_t *mydata;\n\n    err_cert = X509_STORE_CTX_get_current_cert(ctx);\n    err = X509_STORE_CTX_get_error(ctx);\n    depth = X509_STORE_CTX_get_error_depth(ctx);\n\n    /*\n     * Retrieve the pointer to the SSL of the connection currently treated\n     * and the application specific data stored into the SSL object.\n     */\n    ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());\n    mydata = SSL_get_ex_data(ssl, mydata_index);\n\n    X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256);\n\n    /*\n     * Catch a too long certificate chain. The depth limit set using\n     * SSL_CTX_set_verify_depth() is by purpose set to \"limit+1\" so\n     * that whenever the \"depth>verify_depth\" condition is met, we\n     * have violated the limit and want to log this error condition.\n     * We must do it here, because the CHAIN_TOO_LONG error would not\n     * be found explicitly; only errors introduced by cutting off the\n     * additional certificates would be logged.\n     */\n    if (depth > mydata->verify_depth) {\n        preverify_ok = 0;\n        err = X509_V_ERR_CERT_CHAIN_TOO_LONG;\n        X509_STORE_CTX_set_error(ctx, err);\n    }\n    if (!preverify_ok) {\n        printf(\"verify error:num=%d:%s:depth=%d:%s\\n\", err,\n               X509_verify_cert_error_string(err), depth, buf);\n    } else if (mydata->verbose_mode) {\n        printf(\"depth=%d:%s\\n\", depth, buf);\n    }\n\n    /*\n     * At this point, err contains the last verification error. We can use\n     * it for something special\n     */\n    if (!preverify_ok && (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)) {\n        X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, 256);\n        printf(\"issuer= %s\\n\", buf);\n    }\n\n    if (mydata->always_continue)\n        return 1;\n    else\n        return preverify_ok;\n}\n...\n\nmydata_t mydata;\n\n...\nmydata_index = SSL_get_ex_new_index(0, \"mydata index\", NULL, NULL, NULL);\n\n...\nSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE,\n                   verify_callback);\n\n/*\n * Let the verify_callback catch the verify_depth error so that we get\n * an appropriate error in the logfile.\n */\nSSL_CTX_set_verify_depth(verify_depth + 1);\n\n/*\n * Set up the SSL specific data into \"mydata\" and store it into th SSL\n * structure.\n */\nmydata.verify_depth = verify_depth; ...\nSSL_set_ex_data(ssl, mydata_index, &mydata);\n\n...\nSSL_accept(ssl);       /* check of success left out for clarity */\nif (peer = SSL_get_peer_certificate(ssl)) {\n    if (SSL_get_verify_result(ssl) == X509_V_OK) {\n        /* The client sent a certificate which verified OK */\n    }\n}\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_new(3), SSL_CTX_get_verify_mode(3), SSL_get_verify_result(3), SSL_CTX_load_verify_locations(3), SSL_get_peer_certificate(3), SSL_CTX_set_cert_verify_callback(3), SSL_get_ex_data_X509_STORE_CTX_idx(3), SSL_CTX_set_client_cert_cb(3), CRYPTO_get_ex_new_index(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_VERIFY_POST_HANDSHAKE option, and the SSL_verify_client_post_handshake() and SSL_set_post_handshake_auth() functions were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_set_verify/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_certificate/","title":"SSL_CTX_use_certificate","text":""},{"location":"man3/SSL_CTX_use_certificate/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_use_certificate, SSL_CTX_use_certificate_ASN1, SSL_CTX_use_certificate_file, SSL_use_certificate, SSL_use_certificate_ASN1, SSL_use_certificate_file, SSL_CTX_use_certificate_chain_file, SSL_use_certificate_chain_file, SSL_CTX_use_PrivateKey, SSL_CTX_use_PrivateKey_ASN1, SSL_CTX_use_PrivateKey_file, SSL_CTX_use_RSAPrivateKey, SSL_CTX_use_RSAPrivateKey_ASN1, SSL_CTX_use_RSAPrivateKey_file, SSL_use_PrivateKey_file, SSL_use_PrivateKey_ASN1, SSL_use_PrivateKey, SSL_use_RSAPrivateKey, SSL_use_RSAPrivateKey_ASN1, SSL_use_RSAPrivateKey_file, SSL_CTX_check_private_key, SSL_check_private_key, SSL_CTX_use_cert_and_key, SSL_use_cert_and_key - load certificate and key data

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_certificate/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);\nint SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);\nint SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);\nint SSL_use_certificate(SSL *ssl, X509 *x);\nint SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);\nint SSL_use_certificate_file(SSL *ssl, const char *file, int type);\n\nint SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file);\nint SSL_use_certificate_chain_file(SSL *ssl, const char *file);\n\nint SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);\nint SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, const unsigned char *d,\n                                long len);\nint SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);\nint SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);\nint SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);\nint SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);\nint SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);\nint SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, long len);\nint SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);\nint SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);\nint SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, long len);\nint SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);\n\nint SSL_CTX_check_private_key(const SSL_CTX *ctx);\nint SSL_check_private_key(const SSL *ssl);\n\nint SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x, EVP_PKEY *pkey, STACK_OF(X509) *chain, int override);\nint SSL_use_cert_and_key(SSL *ssl, X509 *x, EVP_PKEY *pkey, STACK_OF(X509) *chain, int override);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_certificate/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions load the certificates and private keys into the SSL_CTX or SSL object, respectively.

                                                                                                                                                            The SSL_CTX_* class of functions loads the certificates and keys into the SSL_CTX object ctx. The information is passed to SSL objects ssl created from ctx with SSL_new(3) by copying, so that changes applied to ctx do not propagate to already existing SSL objects.

                                                                                                                                                            The SSL_* class of functions only loads certificates and keys into a specific SSL object. The specific information is kept, when SSL_clear(3) is called for this SSL object.

                                                                                                                                                            SSL_CTX_use_certificate() loads the certificate x into ctx, SSL_use_certificate() loads x into ssl. The rest of the certificates needed to form the complete certificate chain can be specified using the SSL_CTX_add_extra_chain_cert(3) function. On success the reference counter of the x is incremented.

                                                                                                                                                            SSL_CTX_use_certificate_ASN1() loads the ASN1 encoded certificate from the memory location d (with length len) into ctx, SSL_use_certificate_ASN1() loads the ASN1 encoded certificate into ssl.

                                                                                                                                                            SSL_CTX_use_certificate_file() loads the first certificate stored in file into ctx. The formatting type of the certificate must be specified from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. SSL_use_certificate_file() loads the certificate from file into ssl. See the NOTES section on why SSL_CTX_use_certificate_chain_file() should be preferred.

                                                                                                                                                            SSL_CTX_use_certificate_chain_file() loads a certificate chain from file into ctx. The certificates must be in PEM format and must be sorted starting with the subject's certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA. SSL_use_certificate_chain_file() is similar except it loads the certificate chain into ssl.

                                                                                                                                                            SSL_CTX_use_PrivateKey() adds pkey as private key to ctx. SSL_CTX_use_RSAPrivateKey() adds the private key rsa of type RSA to ctx. SSL_use_PrivateKey() adds pkey as private key to ssl; SSL_use_RSAPrivateKey() adds rsa as private key of type RSA to ssl. If a certificate has already been set and the private key does not belong to the certificate an error is returned. To change a [certificate/private-key] pair, the new certificate needs to be set first with SSL_use_certificate() or SSL_CTX_use_certificate() before setting the private key with SSL_CTX_use_PrivateKey() or SSL_use_PrivateKey(). On success the reference counter of the pkey/rsa is incremented.

                                                                                                                                                            SSL_CTX_use_cert_and_key() and SSL_use_cert_and_key() assign the X.509 certificate x, private key key, and certificate chain onto the corresponding ssl or ctx. The pkey argument must be the private key of the X.509 certificate x. If the override argument is 0, then x, pkey and chain are set only if all were not previously set. If override is non-0, then the certificate, private key and chain certs are always set. If pkey is NULL, then the public key of x is used as the private key. This is intended to be used with hardware (via the ENGINE interface) that stores the private key securely, such that it cannot be accessed by OpenSSL. The reference count of the public key is incremented (twice if there is no private key); it is not copied nor duplicated. This allows all private key validations checks to succeed without an actual private key being assigned via SSL_CTX_use_PrivateKey(), etc.

                                                                                                                                                            SSL_CTX_use_PrivateKey_ASN1() adds the private key of type pk stored at memory location d (length len) to ctx. SSL_CTX_use_RSAPrivateKey_ASN1() adds the private key of type RSA stored at memory location d (length len) to ctx. SSL_use_PrivateKey_ASN1() and SSL_use_RSAPrivateKey_ASN1() add the private key to ssl.

                                                                                                                                                            SSL_CTX_use_PrivateKey_file() adds the first private key found in file to ctx. The formatting type of the private key must be specified from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. SSL_CTX_use_RSAPrivateKey_file() adds the first private RSA key found in file to ctx. SSL_use_PrivateKey_file() adds the first private key found in file to ssl; SSL_use_RSAPrivateKey_file() adds the first private RSA key found to ssl.

                                                                                                                                                            SSL_CTX_check_private_key() checks the consistency of a private key with the corresponding certificate loaded into ctx. If more than one key/certificate pair (RSA/DSA) is installed, the last item installed will be checked. If e.g. the last item was an RSA certificate or key, the RSA key/certificate pair will be checked. SSL_check_private_key() performs the same check for ssl. If no key/certificate was explicitly added for this ssl, the last item added into ctx will be checked.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_certificate/#notes","title":"NOTES","text":"

                                                                                                                                                            The internal certificate store of OpenSSL can hold several private key/certificate pairs at a time. The certificate used depends on the cipher selected, see also SSL_CTX_set_cipher_list(3).

                                                                                                                                                            When reading certificates and private keys from file, files of type SSL_FILETYPE_ASN1 (also known as DER, binary encoding) can only contain one certificate or private key, consequently SSL_CTX_use_certificate_chain_file() is only applicable to PEM formatting. Files of type SSL_FILETYPE_PEM can contain more than one item.

                                                                                                                                                            SSL_CTX_use_certificate_chain_file() adds the first certificate found in the file to the certificate store. The other certificates are added to the store of chain certificates using SSL_CTX_add1_chain_cert(3). Note: versions of OpenSSL before 1.0.2 only had a single certificate chain store for all certificate types, OpenSSL 1.0.2 and later have a separate chain store for each type. SSL_CTX_use_certificate_chain_file() should be used instead of the SSL_CTX_use_certificate_file() function in order to allow the use of complete certificate chains even when no trusted CA storage is used or when the CA issuing the certificate shall not be added to the trusted CA storage.

                                                                                                                                                            If additional certificates are needed to complete the chain during the TLS negotiation, CA certificates are additionally looked up in the locations of trusted CA certificates, see SSL_CTX_load_verify_locations(3).

                                                                                                                                                            The private keys loaded from file can be encrypted. In order to successfully load encrypted keys, a function returning the passphrase must have been supplied, see SSL_CTX_set_default_passwd_cb(3). (Certificate files might be encrypted as well from the technical point of view, it however does not make sense as the data in the certificate is considered public anyway.)

                                                                                                                                                            All of the functions to set a new certificate will replace any existing certificate of the same type that has already been set. Similarly all of the functions to set a new private key will replace any private key that has already been set. Applications should call SSL_CTX_check_private_key(3) or SSL_check_private_key(3) as appropriate after loading a new certificate and private key to confirm that the certificate and key match.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_certificate/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            On success, the functions return 1. Otherwise check out the error stack to find out the reason.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_certificate/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_new(3), SSL_clear(3), SSL_CTX_load_verify_locations(3), SSL_CTX_set_default_passwd_cb(3), SSL_CTX_set_cipher_list(3), SSL_CTX_set_client_CA_list(3), SSL_CTX_set_client_cert_cb(3), SSL_CTX_add_extra_chain_cert(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_certificate/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/","title":"SSL_CTX_use_psk_identity_hint","text":""},{"location":"man3/SSL_CTX_use_psk_identity_hint/#name","title":"NAME","text":"

                                                                                                                                                            SSL_psk_server_cb_func, SSL_psk_find_session_cb_func, SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint, SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback, SSL_CTX_set_psk_find_session_callback, SSL_set_psk_find_session_callback - set PSK identity hint to use

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\ntypedef int (*SSL_psk_find_session_cb_func)(SSL *ssl,\n                                            const unsigned char *identity,\n                                            size_t identity_len,\n                                            SSL_SESSION **sess);\n\n\nvoid SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx,\n                                           SSL_psk_find_session_cb_func cb);\nvoid SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb);\n\ntypedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl,\n                                               const char *identity,\n                                               unsigned char *psk,\n                                               unsigned int max_psk_len);\n\nint SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);\nint SSL_use_psk_identity_hint(SSL *ssl, const char *hint);\n\nvoid SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb);\nvoid SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            A server application wishing to use TLSv1.3 PSKs should set a callback using either SSL_CTX_set_psk_find_session_callback() or SSL_set_psk_find_session_callback() as appropriate.

                                                                                                                                                            The callback function is given a pointer to the SSL connection in ssl and an identity in identity of length identity_len. The callback function should identify an SSL_SESSION object that provides the PSK details and store it in *sess. The SSL_SESSION object should, as a minimum, set the master key, the ciphersuite and the protocol version. See SSL_CTX_set_psk_use_session_callback(3) for details.

                                                                                                                                                            It is also possible for the callback to succeed but not supply a PSK. In this case no PSK will be used but the handshake will continue. To do this the callback should return successfully and ensure that *sess is NULL.

                                                                                                                                                            Identity hints are not relevant for TLSv1.3. A server application wishing to use PSK ciphersuites for TLSv1.2 and below may call SSL_CTX_use_psk_identity_hint() to set the given NUL-terminated PSK identity hint hint for SSL context object ctx. SSL_use_psk_identity_hint() sets the given NUL-terminated PSK identity hint hint for the SSL connection object ssl. If hint is NULL the current hint from ctx or ssl is deleted.

                                                                                                                                                            In the case where PSK identity hint is NULL, the server does not send the ServerKeyExchange message to the client.

                                                                                                                                                            A server application wishing to use PSKs for TLSv1.2 and below must provide a callback function which is called when the server receives the ClientKeyExchange message from the client. The purpose of the callback function is to validate the received PSK identity and to fetch the pre-shared key used during the connection setup phase. The callback is set using the functions SSL_CTX_set_psk_server_callback() or SSL_set_psk_server_callback(). The callback function is given the connection in parameter ssl, NUL-terminated PSK identity sent by the client in parameter identity, and a buffer psk of length max_psk_len bytes where the pre-shared key is to be stored.

                                                                                                                                                            The callback for use in TLSv1.2 will also work in TLSv1.3 although it is recommended to use SSL_CTX_set_psk_find_session_callback() or SSL_set_psk_find_session_callback() for this purpose instead. If TLSv1.3 has been negotiated then OpenSSL will first check to see if a callback has been set via SSL_CTX_set_psk_find_session_callback() or SSL_set_psk_find_session_callback() and it will use that in preference. If no such callback is present then it will check to see if a callback has been set via SSL_CTX_set_psk_server_callback() or SSL_set_psk_server_callback() and use that. In this case the handshake digest will default to SHA-256 for any returned PSK. TLSv1.3 early data exchanges are possible in PSK connections only with the SSL_psk_find_session_cb_func callback, and are not possible with the SSL_psk_server_cb_func callback.

                                                                                                                                                            A connection established via a TLSv1.3 PSK will appear as if session resumption has occurred so that SSL_session_reused(3) will return true.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return 1 on success, 0 otherwise.

                                                                                                                                                            Return values from the TLSv1.2 and below server callback are interpreted as follows:

                                                                                                                                                            • 0

                                                                                                                                                              PSK identity was not found. An \"unknown_psk_identity\" alert message will be sent and the connection setup fails.

                                                                                                                                                            • 0

                                                                                                                                                              PSK identity was found and the server callback has provided the PSK successfully in parameter psk. Return value is the length of psk in bytes. It is an error to return a value greater than max_psk_len.

                                                                                                                                                              If the PSK identity was not found but the callback instructs the protocol to continue anyway, the callback must provide some random data to psk and return the length of the random data, so the connection will fail with decryption_error before it will be finished completely.

                                                                                                                                                            The SSL_psk_find_session_cb_func callback should return 1 on success or 0 on failure. In the event of failure the connection setup fails.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#notes","title":"NOTES","text":"

                                                                                                                                                            There are no known security issues with sharing the same PSK between TLSv1.2 (or below) and TLSv1.3. However, the RFC has this note of caution:

                                                                                                                                                            \"While there is no known way in which the same PSK might produce related output in both versions, only limited analysis has been done. Implementations can ensure safety from cross-protocol related output by not reusing PSKs between TLS 1.3 and TLS 1.2.\"

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_psk_use_session_callback(3), SSL_set_psk_use_session_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_CTX_set_psk_find_session_callback() and SSL_set_psk_find_session_callback() were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_psk_identity_hint/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_serverinfo/","title":"SSL_CTX_use_serverinfo","text":""},{"location":"man3/SSL_CTX_use_serverinfo/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_use_serverinfo_ex, SSL_CTX_use_serverinfo, SSL_CTX_use_serverinfo_file - use serverinfo extension

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_serverinfo/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version,\n                              const unsigned char *serverinfo,\n                              size_t serverinfo_length);\n\nint SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,\n                           size_t serverinfo_length);\n\nint SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file);\n
                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_serverinfo/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions load \"serverinfo\" TLS extensions into the SSL_CTX. A \"serverinfo\" extension is returned in response to an empty ClientHello Extension.

                                                                                                                                                            SSL_CTX_use_serverinfo_ex() loads one or more serverinfo extensions from a byte array into ctx. The version parameter specifies the format of the byte array provided in *serverinfo which is of length serverinfo_length.

                                                                                                                                                            If version is SSL_SERVERINFOV2 then the extensions in the array must consist of a 4-byte context, a 2-byte Extension Type, a 2-byte length, and then length bytes of extension_data. The context and type values have the same meaning as for SSL_CTX_add_custom_ext(3). If serverinfo is being loaded for extensions to be added to a Certificate message, then the extension will only be added for the first certificate in the message (which is always the end-entity certificate).

                                                                                                                                                            If version is SSL_SERVERINFOV1 then the extensions in the array must consist of a 2-byte Extension Type, a 2-byte length, and then length bytes of extension_data. The type value has the same meaning as for SSL_CTX_add_custom_ext(3). The following default context value will be used in this case:

                                                                                                                                                            SSL_EXT_TLS1_2_AND_BELOW_ONLY | SSL_EXT_CLIENT_HELLO\n| SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_IGNORE_ON_RESUMPTION\n

                                                                                                                                                            SSL_CTX_use_serverinfo() does the same thing as SSL_CTX_use_serverinfo_ex() except that there is no version parameter so a default version of SSL_SERVERINFOV1 is used instead.

                                                                                                                                                            SSL_CTX_use_serverinfo_file() loads one or more serverinfo extensions from file into ctx. The extensions must be in PEM format. Each extension must be in a format as described above for SSL_CTX_use_serverinfo_ex(). Each PEM extension name must begin with the phrase \"BEGIN SERVERINFOV2 FOR \" for SSL_SERVERINFOV2 data or \"BEGIN SERVERINFO FOR \" for SSL_SERVERINFOV1 data.

                                                                                                                                                            If more than one certificate (RSA/DSA) is installed using SSL_CTX_use_certificate(), the serverinfo extension will be loaded into the last certificate installed. If e.g. the last item was an RSA certificate, the loaded serverinfo extension data will be loaded for that certificate. To use the serverinfo extension for multiple certificates, SSL_CTX_use_serverinfo() needs to be called multiple times, once after each time a certificate is loaded via a call to SSL_CTX_use_certificate().

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_serverinfo/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            On success, the functions return 1. On failure, the functions return 0. Check out the error stack to find out the reason.

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_serverinfo/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_CTX_use_serverinfo/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2013-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/","title":"SSL_SESSION_free","text":""},{"location":"man3/SSL_SESSION_free/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_new, SSL_SESSION_dup, SSL_SESSION_up_ref, SSL_SESSION_free - create, free and manage SSL_SESSION structures

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSSL_SESSION *SSL_SESSION_new(void);\nSSL_SESSION *SSL_SESSION_dup(const SSL_SESSION *src);\nint SSL_SESSION_up_ref(SSL_SESSION *ses);\nvoid SSL_SESSION_free(SSL_SESSION *session);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_new() creates a new SSL_SESSION structure and returns a pointer to it.

                                                                                                                                                            SSL_SESSION_dup() creates a new SSL_SESSION structure that is a copy of src. The copy is not owned by any cache that src may have been in.

                                                                                                                                                            SSL_SESSION_up_ref() increments the reference count on the given SSL_SESSION structure.

                                                                                                                                                            SSL_SESSION_free() decrements the reference count of session and removes the SSL_SESSION structure pointed to by session and frees up the allocated memory, if the reference count has reached 0. If session is NULL nothing is done.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_SESSION objects are allocated, when a TLS/SSL handshake operation is successfully completed. Depending on the settings, see SSL_CTX_set_session_cache_mode(3), the SSL_SESSION objects are internally referenced by the SSL_CTX and linked into its session cache. SSL objects may be using the SSL_SESSION object; as a session may be reused, several SSL objects may be using one SSL_SESSION object at the same time. It is therefore crucial to keep the reference count (usage information) correct and not delete a SSL_SESSION object that is still used, as this may lead to program failures due to dangling pointers. These failures may also appear delayed, e.g. when an SSL_SESSION object was completely freed as the reference count incorrectly became 0, but it is still referenced in the internal session cache and the cache list is processed during a SSL_CTX_flush_sessions(3) operation.

                                                                                                                                                            SSL_SESSION_free() must only be called for SSL_SESSION objects, for which the reference count was explicitly incremented (e.g. by calling SSL_get1_session(), see SSL_get_session(3)) or when the SSL_SESSION object was generated outside a TLS handshake operation, e.g. by using d2i_SSL_SESSION(3). It must not be called on other SSL_SESSION objects, as this would cause incorrect reference counts and therefore program failures.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_new returns a pointer to the newly allocated SSL_SESSION structure or NULL on error.

                                                                                                                                                            SSL_SESSION_dup returns a pointer to the new copy or NULL on error.

                                                                                                                                                            SSL_SESSION_up_ref returns 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_session(3), SSL_CTX_set_session_cache_mode(3), SSL_CTX_flush_sessions(3), d2i_SSL_SESSION(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_dup() function was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_free/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_cipher/","title":"SSL_SESSION_get0_cipher","text":""},{"location":"man3/SSL_SESSION_get0_cipher/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get0_cipher, SSL_SESSION_set_cipher - set and retrieve the SSL cipher associated with a session

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_cipher/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s);\nint SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_cipher/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_get0_cipher() retrieves the cipher that was used by the connection when the session was created, or NULL if it cannot be determined.

                                                                                                                                                            The value returned is a pointer to an object maintained within s and should not be released.

                                                                                                                                                            SSL_SESSION_set_cipher() can be used to set the ciphersuite associated with the SSL_SESSION s to cipher. For example, this could be used to set up a session based PSK (see SSL_CTX_set_psk_use_session_callback(3)).

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_cipher/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_get0_cipher() returns the SSL_CIPHER associated with the SSL_SESSION or NULL if it cannot be determined.

                                                                                                                                                            SSL_SESSION_set_cipher() returns 1 on success or 0 on failure.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), d2i_SSL_SESSION(3), SSL_SESSION_get_time(3), SSL_SESSION_get0_hostname(3), SSL_SESSION_free(3), SSL_CTX_set_psk_use_session_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_cipher/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_get0_cipher() function was added in OpenSSL 1.1.0. The SSL_SESSION_set_cipher() function was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_hostname/","title":"SSL_SESSION_get0_hostname","text":""},{"location":"man3/SSL_SESSION_get0_hostname/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get0_hostname, SSL_SESSION_set1_hostname, SSL_SESSION_get0_alpn_selected, SSL_SESSION_set1_alpn_selected - get and set SNI and ALPN data associated with a session

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_hostname/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst char *SSL_SESSION_get0_hostname(const SSL_SESSION *s);\nint SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname);\n\nvoid SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s,\n                                    const unsigned char **alpn,\n                                    size_t *len);\nint SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, const unsigned char *alpn,\n                                   size_t len);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_hostname/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_get0_hostname() retrieves the SNI value that was sent by the client when the session was created if it was accepted by the server and TLSv1.2 or below was negotiated. Otherwise NULL is returned. Note that in TLSv1.3 the SNI hostname is negotiated with each handshake including resumption handshakes and is therefore never associated with the session.

                                                                                                                                                            The value returned is a pointer to memory maintained within s and should not be free'd.

                                                                                                                                                            SSL_SESSION_set1_hostname() sets the SNI value for the hostname to a copy of the string provided in hostname.

                                                                                                                                                            SSL_SESSION_get0_alpn_selected() retrieves the selected ALPN protocol for this session and its associated length in bytes. The returned value of *alpn is a pointer to memory maintained within s and should not be free'd.

                                                                                                                                                            SSL_SESSION_set1_alpn_selected() sets the ALPN protocol for this session to the value in alpn which should be of length len bytes. A copy of the input value is made, and the caller retains ownership of the memory pointed to by alpn.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_hostname/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_get0_hostname() returns either a string or NULL based on if there is the SNI value sent by client.

                                                                                                                                                            SSL_SESSION_set1_hostname() returns 1 on success or 0 on error.

                                                                                                                                                            SSL_SESSION_set1_alpn_selected() returns 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_hostname/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), d2i_SSL_SESSION(3), SSL_SESSION_get_time(3), SSL_SESSION_free(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_hostname/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_set1_hostname(), SSL_SESSION_get0_alpn_selected() and SSL_SESSION_set1_alpn_selected() functions were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_hostname/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_id_context/","title":"SSL_SESSION_get0_id_context","text":""},{"location":"man3/SSL_SESSION_get0_id_context/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get0_id_context, SSL_SESSION_set1_id_context - get and set the SSL ID context associated with a session

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_id_context/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s,\n                                                 unsigned int *len);\nint SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,\n                               unsigned int sid_ctx_len);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_id_context/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            See SSL_CTX_set_session_id_context(3) for further details on session ID contexts.

                                                                                                                                                            SSL_SESSION_get0_id_context() returns the ID context associated with the SSL/TLS session s. The length of the ID context is written to *len if len is not NULL.

                                                                                                                                                            The value returned is a pointer to an object maintained within s and should not be released.

                                                                                                                                                            SSL_SESSION_set1_id_context() takes a copy of the provided ID context given in sid_ctx and associates it with the session s. The length of the ID context is given by sid_ctx_len which must not exceed SSL_MAX_SID_CTX_LENGTH bytes.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_id_context/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_set1_id_context() returns 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_id_context/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_set_session_id_context(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_id_context/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_get0_id_context() function was added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_id_context/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_peer/","title":"SSL_SESSION_get0_peer","text":""},{"location":"man3/SSL_SESSION_get0_peer/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get0_peer - get details about peer's certificate for a session

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_peer/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nX509 *SSL_SESSION_get0_peer(SSL_SESSION *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_peer/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_get0_peer() returns the peer certificate associated with the session s or NULL if no peer certificate is available. The caller should not free the returned value (unless X509_up_ref(3) has also been called).

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_peer/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_get0_peer() returns a pointer to the peer certificate or NULL if no peer certificate is available.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_peer/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get0_peer/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_compress_id/","title":"SSL_SESSION_get_compress_id","text":""},{"location":"man3/SSL_SESSION_get_compress_id/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get_compress_id - get details about the compression associated with a session

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_compress_id/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nunsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_compress_id/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            If compression has been negotiated for an ssl session then SSL_SESSION_get_compress_id() will return the id for the compression method or 0 otherwise. The only built-in supported compression method is zlib which has an id of 1.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_compress_id/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_get_compress_id() returns the id of the compression method or 0 if none.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_compress_id/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_compress_id/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_protocol_version/","title":"SSL_SESSION_get_protocol_version","text":""},{"location":"man3/SSL_SESSION_get_protocol_version/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get_protocol_version, SSL_SESSION_set_protocol_version - get and set the session protocol version

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_protocol_version/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_SESSION_get_protocol_version(const SSL_SESSION *s);\nint SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_protocol_version/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_get_protocol_version() returns the protocol version number used by session s.

                                                                                                                                                            SSL_SESSION_set_protocol_version() sets the protocol version associated with the SSL_SESSION object s to the value version. This value should be a version constant such as TLS1_3_VERSION etc. For example, this could be used to set up a session based PSK (see SSL_CTX_set_psk_use_session_callback(3)).

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_protocol_version/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_get_protocol_version() returns a number indicating the protocol version used for the session; this number matches the constants e.g. TLS1_VERSION, TLS1_2_VERSION or TLS1_3_VERSION.

                                                                                                                                                            Note that the SSL_SESSION_get_protocol_version() function does not perform a null check on the provided session s pointer.

                                                                                                                                                            SSL_SESSION_set_protocol_version() returns 1 on success or 0 on failure.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_protocol_version/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_psk_use_session_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_protocol_version/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_get_protocol_version() function was added in OpenSSL 1.1.0. The SSL_SESSION_set_protocol_version() function was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_protocol_version/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_time/","title":"SSL_SESSION_get_time","text":""},{"location":"man3/SSL_SESSION_get_time/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get_time, SSL_SESSION_set_time, SSL_SESSION_get_timeout, SSL_SESSION_set_timeout, SSL_get_time, SSL_set_time, SSL_get_timeout, SSL_set_timeout - retrieve and manipulate session time and timeout settings

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_time/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_SESSION_get_time(const SSL_SESSION *s);\nlong SSL_SESSION_set_time(SSL_SESSION *s, long tm);\nlong SSL_SESSION_get_timeout(const SSL_SESSION *s);\nlong SSL_SESSION_set_timeout(SSL_SESSION *s, long tm);\n\nlong SSL_get_time(const SSL_SESSION *s);\nlong SSL_set_time(SSL_SESSION *s, long tm);\nlong SSL_get_timeout(const SSL_SESSION *s);\nlong SSL_set_timeout(SSL_SESSION *s, long tm);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_time/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_get_time() returns the time at which the session s was established. The time is given in seconds since the Epoch and therefore compatible to the time delivered by the time() call.

                                                                                                                                                            SSL_SESSION_set_time() replaces the creation time of the session s with the chosen value tm.

                                                                                                                                                            SSL_SESSION_get_timeout() returns the timeout value set for session s in seconds.

                                                                                                                                                            SSL_SESSION_set_timeout() sets the timeout value for session s in seconds to tm.

                                                                                                                                                            The SSL_get_time(), SSL_set_time(), SSL_get_timeout(), and SSL_set_timeout() functions are synonyms for the SSL_SESSION_*() counterparts.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_time/#notes","title":"NOTES","text":"

                                                                                                                                                            Sessions are expired by examining the creation time and the timeout value. Both are set at creation time of the session to the actual time and the default timeout value at creation, respectively, as set by SSL_CTX_set_timeout(3). Using these functions it is possible to extend or shorten the lifetime of the session.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_time/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_get_time() and SSL_SESSION_get_timeout() return the currently valid values.

                                                                                                                                                            SSL_SESSION_set_time() and SSL_SESSION_set_timeout() return 1 on success.

                                                                                                                                                            If any of the function is passed the NULL pointer for the session s, 0 is returned.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_time/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_timeout(3), SSL_get_default_timeout(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_get_time/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_has_ticket/","title":"SSL_SESSION_has_ticket","text":""},{"location":"man3/SSL_SESSION_has_ticket/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get0_ticket, SSL_SESSION_has_ticket, SSL_SESSION_get_ticket_lifetime_hint - get details about the ticket associated with a session

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_has_ticket/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_SESSION_has_ticket(const SSL_SESSION *s);\nunsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s);\nvoid SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick,\n                             size_t *len);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_has_ticket/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_has_ticket() returns 1 if there is a Session Ticket associated with this session, and 0 otherwise.

                                                                                                                                                            SSL_SESSION_get_ticket_lifetime_hint returns the lifetime hint in seconds associated with the session ticket.

                                                                                                                                                            SSL_SESSION_get0_ticket obtains a pointer to the ticket associated with a session. The length of the ticket is written to *len. If tick is non NULL then a pointer to the ticket is written to *tick. The pointer is only valid while the connection is in use. The session (and hence the ticket pointer) may also become invalid as a result of a call to SSL_CTX_flush_sessions().

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_has_ticket/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_has_ticket() returns 1 if session ticket exists or 0 otherwise.

                                                                                                                                                            SSL_SESSION_get_ticket_lifetime_hint() returns the number of seconds.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_has_ticket/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), d2i_SSL_SESSION(3), SSL_SESSION_get_time(3), SSL_SESSION_free(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_has_ticket/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_has_ticket(), SSL_SESSION_get_ticket_lifetime_hint() and SSL_SESSION_get0_ticket() functions were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_has_ticket/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_is_resumable/","title":"SSL_SESSION_is_resumable","text":""},{"location":"man3/SSL_SESSION_is_resumable/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_is_resumable - determine whether an SSL_SESSION object can be used for resumption

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_is_resumable/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_SESSION_is_resumable(const SSL_SESSION *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_is_resumable/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_is_resumable() determines whether an SSL_SESSION object can be used to resume a session or not. Returns 1 if it can or 0 if not. Note that attempting to resume with a non-resumable session will result in a full handshake.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_is_resumable/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_is_resumable() returns 1 if the session is resumable or 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_is_resumable/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_session(3), SSL_CTX_sess_set_new_cb(3)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_is_resumable/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_is_resumable() function was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_is_resumable/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_print/","title":"SSL_SESSION_print","text":""},{"location":"man3/SSL_SESSION_print/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_print, SSL_SESSION_print_fp, SSL_SESSION_print_keylog - printf information about a session

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_print/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses);\nint SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses);\nint SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_print/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_print() prints summary information about the session provided in ses to the BIO fp.

                                                                                                                                                            SSL_SESSION_print_fp() does the same as SSL_SESSION_print() except it prints it to the FILE fp.

                                                                                                                                                            SSL_SESSION_print_keylog() prints session information to the provided BIO <bp> in NSS keylog format.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_print/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_print(), SSL_SESSION_print_fp() and SSL_SESSION_print_keylog return 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_print/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_print/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_set1_id/","title":"SSL_SESSION_set1_id","text":""},{"location":"man3/SSL_SESSION_set1_id/#name","title":"NAME","text":"

                                                                                                                                                            SSL_SESSION_get_id, SSL_SESSION_set1_id - get and set the SSL session ID

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_set1_id/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s,\n                                        unsigned int *len);\nint SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,\n                        unsigned int sid_len);\n
                                                                                                                                                            "},{"location":"man3/SSL_SESSION_set1_id/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_SESSION_get_id() returns a pointer to the internal session id value for the session s. The length of the id in bytes is stored in *len. The length may be 0. The caller should not free the returned pointer directly.

                                                                                                                                                            SSL_SESSION_set1_id() sets the session ID for the ssl SSL/TLS session to sid of length sid_len.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_set1_id/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_get_id() returns a pointer to the session id value. SSL_SESSION_set1_id() returns 1 for success and 0 for failure, for example if the supplied session ID length exceeds SSL_MAX_SSL_SESSION_ID_LENGTH.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_set1_id/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_set1_id/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_SESSION_set1_id() function was added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_SESSION_set1_id/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_accept/","title":"SSL_accept","text":""},{"location":"man3/SSL_accept/#name","title":"NAME","text":"

                                                                                                                                                            SSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake

                                                                                                                                                            "},{"location":"man3/SSL_accept/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_accept(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_accept/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. The communication channel must already have been set and assigned to the ssl by setting an underlying BIO.

                                                                                                                                                            "},{"location":"man3/SSL_accept/#notes","title":"NOTES","text":"

                                                                                                                                                            The behaviour of SSL_accept() depends on the underlying BIO.

                                                                                                                                                            If the underlying BIO is blocking, SSL_accept() will only return once the handshake has been finished or an error occurred.

                                                                                                                                                            If the underlying BIO is nonblocking, SSL_accept() will also return when the underlying BIO could not satisfy the needs of SSL_accept() to continue the handshake, indicating the problem by the return value -1. In this case a call to SSL_get_error() with the return value of SSL_accept() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_accept(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                                                                                                                                                            "},{"location":"man3/SSL_accept/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

                                                                                                                                                            • 1

                                                                                                                                                              The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

                                                                                                                                                            • <0

                                                                                                                                                              The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur if action is needed to continue the operation for nonblocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

                                                                                                                                                            "},{"location":"man3/SSL_accept/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_error(3), SSL_connect(3), SSL_shutdown(3), ssl(7), bio(7), SSL_set_connect_state(3), SSL_do_handshake(3), SSL_CTX_new(3)

                                                                                                                                                            "},{"location":"man3/SSL_accept/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_alert_type_string/","title":"SSL_alert_type_string","text":""},{"location":"man3/SSL_alert_type_string/#name","title":"NAME","text":"

                                                                                                                                                            SSL_alert_type_string, SSL_alert_type_string_long, SSL_alert_desc_string, SSL_alert_desc_string_long - get textual description of alert information

                                                                                                                                                            "},{"location":"man3/SSL_alert_type_string/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst char *SSL_alert_type_string(int value);\nconst char *SSL_alert_type_string_long(int value);\n\nconst char *SSL_alert_desc_string(int value);\nconst char *SSL_alert_desc_string_long(int value);\n
                                                                                                                                                            "},{"location":"man3/SSL_alert_type_string/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_alert_type_string() returns a one letter string indicating the type of the alert specified by value.

                                                                                                                                                            SSL_alert_type_string_long() returns a string indicating the type of the alert specified by value.

                                                                                                                                                            SSL_alert_desc_string() returns a two letter string as a short form describing the reason of the alert specified by value.

                                                                                                                                                            SSL_alert_desc_string_long() returns a string describing the reason of the alert specified by value.

                                                                                                                                                            "},{"location":"man3/SSL_alert_type_string/#notes","title":"NOTES","text":"

                                                                                                                                                            When one side of an SSL/TLS communication wants to inform the peer about a special situation, it sends an alert. The alert is sent as a special message and does not influence the normal data stream (unless its contents results in the communication being canceled).

                                                                                                                                                            A warning alert is sent, when a non-fatal error condition occurs. The \"close notify\" alert is sent as a warning alert. Other examples for non-fatal errors are certificate errors (\"certificate expired\", \"unsupported certificate\"), for which a warning alert may be sent. (The sending party may however decide to send a fatal error.) The receiving side may cancel the connection on reception of a warning alert on it discretion.

                                                                                                                                                            Several alert messages must be sent as fatal alert messages as specified by the TLS RFC. A fatal alert always leads to a connection abort.

                                                                                                                                                            "},{"location":"man3/SSL_alert_type_string/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following strings can occur for SSL_alert_type_string() or SSL_alert_type_string_long():

                                                                                                                                                            • \"W\"/\"warning\"
                                                                                                                                                            • \"F\"/\"fatal\"
                                                                                                                                                            • \"U\"/\"unknown\"

                                                                                                                                                              This indicates that no support is available for this alert type. Probably value does not contain a correct alert message.

                                                                                                                                                            The following strings can occur for SSL_alert_desc_string() or SSL_alert_desc_string_long():

                                                                                                                                                            • \"CN\"/\"close notify\"

                                                                                                                                                              The connection shall be closed. This is a warning alert.

                                                                                                                                                            • \"UM\"/\"unexpected message\"

                                                                                                                                                              An inappropriate message was received. This alert is always fatal and should never be observed in communication between proper implementations.

                                                                                                                                                            • \"BM\"/\"bad record mac\"

                                                                                                                                                              This alert is returned if a record is received with an incorrect MAC. This message is always fatal.

                                                                                                                                                            • \"DF\"/\"decompression failure\"

                                                                                                                                                              The decompression function received improper input (e.g. data that would expand to excessive length). This message is always fatal.

                                                                                                                                                            • \"HF\"/\"handshake failure\"

                                                                                                                                                              Reception of a handshake_failure alert message indicates that the sender was unable to negotiate an acceptable set of security parameters given the options available. This is a fatal error.

                                                                                                                                                            • \"NC\"/\"no certificate\"

                                                                                                                                                              A client, that was asked to send a certificate, does not send a certificate (SSLv3 only).

                                                                                                                                                            • \"BC\"/\"bad certificate\"

                                                                                                                                                              A certificate was corrupt, contained signatures that did not verify correctly, etc

                                                                                                                                                            • \"UC\"/\"unsupported certificate\"

                                                                                                                                                              A certificate was of an unsupported type.

                                                                                                                                                            • \"CR\"/\"certificate revoked\"

                                                                                                                                                              A certificate was revoked by its signer.

                                                                                                                                                            • \"CE\"/\"certificate expired\"

                                                                                                                                                              A certificate has expired or is not currently valid.

                                                                                                                                                            • \"CU\"/\"certificate unknown\"

                                                                                                                                                              Some other (unspecified) issue arose in processing the certificate, rendering it unacceptable.

                                                                                                                                                            • \"IP\"/\"illegal parameter\"

                                                                                                                                                              A field in the handshake was out of range or inconsistent with other fields. This is always fatal.

                                                                                                                                                            • \"DC\"/\"decryption failed\"

                                                                                                                                                              A TLSCiphertext decrypted in an invalid way: either it wasn't an even multiple of the block length or its padding values, when checked, weren't correct. This message is always fatal.

                                                                                                                                                            • \"RO\"/\"record overflow\"

                                                                                                                                                              A TLSCiphertext record was received which had a length more than 2^14+2048 bytes, or a record decrypted to a TLSCompressed record with more than 2^14+1024 bytes. This message is always fatal.

                                                                                                                                                            • \"CA\"/\"unknown CA\"

                                                                                                                                                              A valid certificate chain or partial chain was received, but the certificate was not accepted because the CA certificate could not be located or couldn't be matched with a known, trusted CA. This message is always fatal.

                                                                                                                                                            • \"AD\"/\"access denied\"

                                                                                                                                                              A valid certificate was received, but when access control was applied, the sender decided not to proceed with negotiation. This message is always fatal.

                                                                                                                                                            • \"DE\"/\"decode error\"

                                                                                                                                                              A message could not be decoded because some field was out of the specified range or the length of the message was incorrect. This message is always fatal.

                                                                                                                                                            • \"CY\"/\"decrypt error\"

                                                                                                                                                              A handshake cryptographic operation failed, including being unable to correctly verify a signature, decrypt a key exchange, or validate a finished message.

                                                                                                                                                            • \"ER\"/\"export restriction\"

                                                                                                                                                              A negotiation not in compliance with export restrictions was detected; for example, attempting to transfer a 1024 bit ephemeral RSA key for the RSA_EXPORT handshake method. This message is always fatal.

                                                                                                                                                            • \"PV\"/\"protocol version\"

                                                                                                                                                              The protocol version the client has attempted to negotiate is recognized, but not supported. (For example, old protocol versions might be avoided for security reasons). This message is always fatal.

                                                                                                                                                            • \"IS\"/\"insufficient security\"

                                                                                                                                                              Returned instead of handshake_failure when a negotiation has failed specifically because the server requires ciphers more secure than those supported by the client. This message is always fatal.

                                                                                                                                                            • \"IE\"/\"internal error\"

                                                                                                                                                              An internal error unrelated to the peer or the correctness of the protocol makes it impossible to continue (such as a memory allocation failure). This message is always fatal.

                                                                                                                                                            • \"US\"/\"user canceled\"

                                                                                                                                                              This handshake is being canceled for some reason unrelated to a protocol failure. If the user cancels an operation after the handshake is complete, just closing the connection by sending a close_notify is more appropriate. This alert should be followed by a close_notify. This message is generally a warning.

                                                                                                                                                            • \"NR\"/\"no renegotiation\"

                                                                                                                                                              Sent by the client in response to a hello request or by the server in response to a client hello after initial handshaking. Either of these would normally lead to renegotiation; when that is not appropriate, the recipient should respond with this alert; at that point, the original requester can decide whether to proceed with the connection. One case where this would be appropriate would be where a server has spawned a process to satisfy a request; the process might receive security parameters (key length, authentication, etc.) at startup and it might be difficult to communicate changes to these parameters after that point. This message is always a warning.

                                                                                                                                                            • \"UP\"/\"unknown PSK identity\"

                                                                                                                                                              Sent by the server to indicate that it does not recognize a PSK identity or an SRP identity.

                                                                                                                                                            • \"UK\"/\"unknown\"

                                                                                                                                                              This indicates that no description is available for this alert type. Probably value does not contain a correct alert message.

                                                                                                                                                            "},{"location":"man3/SSL_alert_type_string/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_info_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_alert_type_string/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_alloc_buffers/","title":"SSL_alloc_buffers","text":""},{"location":"man3/SSL_alloc_buffers/#name","title":"NAME","text":"

                                                                                                                                                            SSL_free_buffers, SSL_alloc_buffers - manage SSL structure buffers

                                                                                                                                                            "},{"location":"man3/SSL_alloc_buffers/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_free_buffers(SSL *ssl);\nint SSL_alloc_buffers(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_alloc_buffers/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_free_buffers() frees the read and write buffers of the given ssl. SSL_alloc_buffers() allocates the read and write buffers of the given ssl.

                                                                                                                                                            The SSL_MODE_RELEASE_BUFFERS mode releases read or write buffers whenever the buffers have been drained. These functions allow applications to manually control when buffers are freed and allocated.

                                                                                                                                                            After freeing the buffers, the buffers are automatically reallocated upon a new read or write. The SSL_alloc_buffers() does not need to be called, but can be used to make sure the buffers are preallocated. This can be used to avoid allocation during data processing or with CRYPTO_set_mem_functions() to control where and how buffers are allocated.

                                                                                                                                                            "},{"location":"man3/SSL_alloc_buffers/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0 (Failure)

                                                                                                                                                              The SSL_free_buffers() function returns 0 when there is pending data to be read or written. The SSL_alloc_buffers() function returns 0 when there is an allocation failure.

                                                                                                                                                            • 1 (Success)

                                                                                                                                                              The SSL_free_buffers() function returns 1 if the buffers have been freed. This value is also returned if the buffers had been freed before calling SSL_free_buffers(). The SSL_alloc_buffers() function returns 1 if the buffers have been allocated. This value is also returned if the buffers had been allocated before calling SSL_alloc_buffers().

                                                                                                                                                            "},{"location":"man3/SSL_alloc_buffers/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_free(3), SSL_clear(3), SSL_new(3), SSL_CTX_set_mode(3), CRYPTO_set_mem_functions(3)

                                                                                                                                                            "},{"location":"man3/SSL_alloc_buffers/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_check_chain/","title":"SSL_check_chain","text":""},{"location":"man3/SSL_check_chain/#name","title":"NAME","text":"

                                                                                                                                                            SSL_check_chain - check certificate chain suitability

                                                                                                                                                            "},{"location":"man3/SSL_check_chain/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain);\n
                                                                                                                                                            "},{"location":"man3/SSL_check_chain/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_check_chain() checks whether certificate x, private key pk and certificate chain chain is suitable for use with the current session s.

                                                                                                                                                            "},{"location":"man3/SSL_check_chain/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_check_chain() returns a bitmap of flags indicating the validity of the chain.

                                                                                                                                                            CERT_PKEY_VALID: the chain can be used with the current session. If this flag is not set then the certificate will never be used even if the application tries to set it because it is inconsistent with the peer preferences.

                                                                                                                                                            CERT_PKEY_SIGN: the EE key can be used for signing.

                                                                                                                                                            CERT_PKEY_EE_SIGNATURE: the signature algorithm of the EE certificate is acceptable.

                                                                                                                                                            CERT_PKEY_CA_SIGNATURE: the signature algorithms of all CA certificates are acceptable.

                                                                                                                                                            CERT_PKEY_EE_PARAM: the parameters of the end entity certificate are acceptable (e.g. it is a supported curve).

                                                                                                                                                            CERT_PKEY_CA_PARAM: the parameters of all CA certificates are acceptable.

                                                                                                                                                            CERT_PKEY_EXPLICIT_SIGN: the end entity certificate algorithm can be used explicitly for signing (i.e. it is mentioned in the signature algorithms extension).

                                                                                                                                                            CERT_PKEY_ISSUER_NAME: the issuer name is acceptable. This is only meaningful for client authentication.

                                                                                                                                                            CERT_PKEY_CERT_TYPE: the certificate type is acceptable. Only meaningful for client authentication.

                                                                                                                                                            CERT_PKEY_SUITEB: chain is suitable for Suite B use.

                                                                                                                                                            "},{"location":"man3/SSL_check_chain/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_check_chain() must be called in servers after a client hello message or in clients after a certificate request message. It will typically be called in the certificate callback.

                                                                                                                                                            An application wishing to support multiple certificate chains may call this function on each chain in turn: starting with the one it considers the most secure. It could then use the chain of the first set which returns suitable flags.

                                                                                                                                                            As a minimum the flag CERT_PKEY_VALID must be set for a chain to be usable. An application supporting multiple chains with different CA signature algorithms may also wish to check CERT_PKEY_CA_SIGNATURE too. If no chain is suitable a server should fall back to the most secure chain which sets CERT_PKEY_VALID.

                                                                                                                                                            The validity of a chain is determined by checking if it matches a supported signature algorithm, supported curves and in the case of client authentication certificate types and issuer names.

                                                                                                                                                            Since the supported signature algorithms extension is only used in TLS 1.2, TLS 1.3 and DTLS 1.2 the results for earlier versions of TLS and DTLS may not be very useful. Applications may wish to specify a different \"legacy\" chain for earlier versions of TLS or DTLS.

                                                                                                                                                            "},{"location":"man3/SSL_check_chain/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_CTX_set_cert_cb(3), ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_check_chain/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_clear/","title":"SSL_clear","text":""},{"location":"man3/SSL_clear/#name","title":"NAME","text":"

                                                                                                                                                            SSL_clear - reset SSL object to allow another connection

                                                                                                                                                            "},{"location":"man3/SSL_clear/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_clear(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_clear/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            Reset ssl to allow another connection. All settings (method, ciphers, BIOs) are kept.

                                                                                                                                                            "},{"location":"man3/SSL_clear/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_clear is used to prepare an SSL object for a new connection. While all settings are kept, a side effect is the handling of the current SSL session. If a session is still open, it is considered bad and will be removed from the session cache, as required by RFC2246. A session is considered open, if SSL_shutdown(3) was not called for the connection or at least SSL_set_shutdown(3) was used to set the SSL_SENT_SHUTDOWN state.

                                                                                                                                                            If a session was closed cleanly, the session object will be kept and all settings corresponding. This explicitly means, that e.g. the special method used during the session will be kept for the next handshake. So if the session was a TLSv1 session, a SSL client object will use a TLSv1 client method for the next handshake and a SSL server object will use a TLSv1 server method, even if TLS_*_methods were chosen on startup. This will might lead to connection failures (see SSL_new(3)) for a description of the method's properties.

                                                                                                                                                            "},{"location":"man3/SSL_clear/#warnings","title":"WARNINGS","text":"

                                                                                                                                                            SSL_clear() resets the SSL object to allow for another connection. The reset operation however keeps several settings of the last sessions (some of these settings were made automatically during the last handshake). It only makes sense for a new connection with the exact same peer that shares these settings, and may fail if that peer changes its settings between connections. Use the sequence SSL_get_session(3); SSL_new(3); SSL_set_session(3); SSL_free(3) instead to avoid such failures (or simply SSL_free(3); SSL_new(3) if session reuse is not desired).

                                                                                                                                                            "},{"location":"man3/SSL_clear/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The SSL_clear() operation could not be performed. Check the error stack to find out the reason.

                                                                                                                                                            • 1

                                                                                                                                                              The SSL_clear() operation was successful.

                                                                                                                                                            SSL_new(3), SSL_free(3), SSL_shutdown(3), SSL_set_shutdown(3), SSL_CTX_set_options(3), ssl(7), SSL_CTX_set_client_cert_cb(3)

                                                                                                                                                            "},{"location":"man3/SSL_clear/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_connect/","title":"SSL_connect","text":""},{"location":"man3/SSL_connect/#name","title":"NAME","text":"

                                                                                                                                                            SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server

                                                                                                                                                            "},{"location":"man3/SSL_connect/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_connect(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_connect/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_connect() initiates the TLS/SSL handshake with a server. The communication channel must already have been set and assigned to the ssl by setting an underlying BIO.

                                                                                                                                                            "},{"location":"man3/SSL_connect/#notes","title":"NOTES","text":"

                                                                                                                                                            The behaviour of SSL_connect() depends on the underlying BIO.

                                                                                                                                                            If the underlying BIO is blocking, SSL_connect() will only return once the handshake has been finished or an error occurred.

                                                                                                                                                            If the underlying BIO is nonblocking, SSL_connect() will also return when the underlying BIO could not satisfy the needs of SSL_connect() to continue the handshake, indicating the problem by the return value -1. In this case a call to SSL_get_error() with the return value of SSL_connect() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_connect(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                                                                                                                                                            Many systems implement Nagle's algorithm by default which means that it will buffer outgoing TCP data if a TCP packet has already been sent for which no corresponding ACK has been received yet from the peer. This can have performance impacts after a successful TLSv1.3 handshake or a successful TLSv1.2 (or below) resumption handshake, because the last peer to communicate in the handshake is the client. If the client is also the first to send application data (as is typical for many protocols) then this data could be buffered until an ACK has been received for the final handshake message.

                                                                                                                                                            The TCP_NODELAY socket option is often available to disable Nagle's algorithm. If an application opts to disable Nagle's algorithm consideration should be given to turning it back on again later if appropriate. The helper function BIO_set_tcp_ndelay() can be used to turn on or off the TCP_NODELAY option.

                                                                                                                                                            "},{"location":"man3/SSL_connect/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

                                                                                                                                                            • 1

                                                                                                                                                              The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

                                                                                                                                                            • <0

                                                                                                                                                              The TLS/SSL handshake was not successful, because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur if action is needed to continue the operation for nonblocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

                                                                                                                                                            "},{"location":"man3/SSL_connect/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_error(3), SSL_accept(3), SSL_shutdown(3), ssl(7), bio(7), SSL_set_connect_state(3), SSL_do_handshake(3), SSL_CTX_new(3)

                                                                                                                                                            "},{"location":"man3/SSL_connect/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_do_handshake/","title":"SSL_do_handshake","text":""},{"location":"man3/SSL_do_handshake/#name","title":"NAME","text":"

                                                                                                                                                            SSL_do_handshake - perform a TLS/SSL handshake

                                                                                                                                                            "},{"location":"man3/SSL_do_handshake/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_do_handshake(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_do_handshake/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_do_handshake() will wait for a SSL/TLS handshake to take place. If the connection is in client mode, the handshake will be started. The handshake routines may have to be explicitly set in advance using either SSL_set_connect_state(3) or SSL_set_accept_state(3).

                                                                                                                                                            "},{"location":"man3/SSL_do_handshake/#notes","title":"NOTES","text":"

                                                                                                                                                            The behaviour of SSL_do_handshake() depends on the underlying BIO.

                                                                                                                                                            If the underlying BIO is blocking, SSL_do_handshake() will only return once the handshake has been finished or an error occurred.

                                                                                                                                                            If the underlying BIO is nonblocking, SSL_do_handshake() will also return when the underlying BIO could not satisfy the needs of SSL_do_handshake() to continue the handshake. In this case a call to SSL_get_error() with the return value of SSL_do_handshake() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_do_handshake(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                                                                                                                                                            "},{"location":"man3/SSL_do_handshake/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason.

                                                                                                                                                            • 1

                                                                                                                                                              The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been established.

                                                                                                                                                            • <0

                                                                                                                                                              The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur if action is needed to continue the operation for nonblocking BIOs. Call SSL_get_error() with the return value ret to find out the reason.

                                                                                                                                                            "},{"location":"man3/SSL_do_handshake/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_error(3), SSL_connect(3), SSL_accept(3), ssl(7), bio(7), SSL_set_connect_state(3)

                                                                                                                                                            "},{"location":"man3/SSL_do_handshake/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_export_keying_material/","title":"SSL_export_keying_material","text":""},{"location":"man3/SSL_export_keying_material/#name","title":"NAME","text":"

                                                                                                                                                            SSL_export_keying_material, SSL_export_keying_material_early - obtain keying material for application use

                                                                                                                                                            "},{"location":"man3/SSL_export_keying_material/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen,\n                               const char *label, size_t llen,\n                               const unsigned char *context,\n                               size_t contextlen, int use_context);\n\nint SSL_export_keying_material_early(SSL *s, unsigned char *out, size_t olen,\n                                     const char *label, size_t llen,\n                                     const unsigned char *context,\n                                     size_t contextlen);\n
                                                                                                                                                            "},{"location":"man3/SSL_export_keying_material/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            During the creation of a TLS or DTLS connection shared keying material is established between the two endpoints. The functions SSL_export_keying_material() and SSL_export_keying_material_early() enable an application to use some of this keying material for its own purposes in accordance with RFC5705 (for TLSv1.2 and below) or RFC8446 (for TLSv1.3).

                                                                                                                                                            SSL_export_keying_material() derives keying material using the exporter_master_secret established in the handshake.

                                                                                                                                                            SSL_export_keying_material_early() is only usable with TLSv1.3, and derives keying material using the early_exporter_master_secret (as defined in the TLS 1.3 RFC). For the client, the early_exporter_master_secret is only available when the client attempts to send 0-RTT data. For the server, it is only available when the server accepts 0-RTT data.

                                                                                                                                                            An application may need to securely establish the context within which this keying material will be used. For example this may include identifiers for the application session, application algorithms or parameters, or the lifetime of the context. The context value is left to the application but must be the same on both sides of the communication.

                                                                                                                                                            For a given SSL connection s, olen bytes of data will be written to out. The application specific context should be supplied in the location pointed to by context and should be contextlen bytes long. Provision of a context is optional. If the context should be omitted entirely then use_context should be set to 0. Otherwise it should be any other value. If use_context is 0 then the values of context and contextlen are ignored. Note that in TLSv1.2 and below a zero length context is treated differently from no context at all, and will result in different keying material being returned. In TLSv1.3 a zero length context is that same as no context at all and will result in the same keying material being returned.

                                                                                                                                                            An application specific label should be provided in the location pointed to by label and should be llen bytes long. Typically this will be a value from the IANA Exporter Label Registry (https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). Alternatively labels beginning with \"EXPERIMENTAL\" are permitted by the standard to be used without registration. TLSv1.3 imposes a maximum label length of 249 bytes.

                                                                                                                                                            Note that this function is only defined for TLSv1.0 and above, and DTLSv1.0 and above. Attempting to use it in SSLv3 will result in an error.

                                                                                                                                                            "},{"location":"man3/SSL_export_keying_material/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_export_keying_material() returns 0 or -1 on failure or 1 on success.

                                                                                                                                                            SSL_export_keying_material_early() returns 0 on failure or 1 on success.

                                                                                                                                                            "},{"location":"man3/SSL_export_keying_material/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_export_keying_material/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_export_keying_material_early() function was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_export_keying_material/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/","title":"SSL_extension_supported","text":""},{"location":"man3/SSL_extension_supported/#name","title":"NAME","text":"

                                                                                                                                                            SSL_extension_supported, SSL_custom_ext_add_cb_ex, SSL_custom_ext_free_cb_ex, SSL_custom_ext_parse_cb_ex, SSL_CTX_add_custom_ext, SSL_CTX_add_client_custom_ext, SSL_CTX_add_server_custom_ext, custom_ext_add_cb, custom_ext_free_cb, custom_ext_parse_cb - custom TLS extension handling

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\ntypedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type,\n                                        unsigned int context,\n                                        const unsigned char **out,\n                                        size_t *outlen, X509 *x,\n                                        size_t chainidx, int *al,\n                                        void *add_arg);\n\ntypedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type,\n                                          unsigned int context,\n                                          const unsigned char *out,\n                                          void *add_arg);\n\ntypedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type,\n                                          unsigned int context,\n                                          const unsigned char *in,\n                                          size_t inlen, X509 *x,\n                                          size_t chainidx, int *al,\n                                          void *parse_arg);\n\nint SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type,\n                           unsigned int context,\n                           SSL_custom_ext_add_cb_ex add_cb,\n                           SSL_custom_ext_free_cb_ex free_cb,\n                           void *add_arg,\n                           SSL_custom_ext_parse_cb_ex parse_cb,\n                           void *parse_arg);\n\ntypedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type,\n                                 const unsigned char **out,\n                                 size_t *outlen, int *al,\n                                 void *add_arg);\n\ntypedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type,\n                                   const unsigned char *out,\n                                   void *add_arg);\n\ntypedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type,\n                                   const unsigned char *in,\n                                   size_t inlen, int *al,\n                                   void *parse_arg);\n\nint SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type,\n                                  custom_ext_add_cb add_cb,\n                                  custom_ext_free_cb free_cb, void *add_arg,\n                                  custom_ext_parse_cb parse_cb,\n                                  void *parse_arg);\n\nint SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, unsigned int ext_type,\n                                  custom_ext_add_cb add_cb,\n                                  custom_ext_free_cb free_cb, void *add_arg,\n                                  custom_ext_parse_cb parse_cb,\n                                  void *parse_arg);\n\nint SSL_extension_supported(unsigned int ext_type);\n
                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_add_custom_ext() adds a custom extension for a TLS/DTLS client or server for all supported protocol versions with extension type ext_type and callbacks add_cb, free_cb and parse_cb (see the \"EXTENSION CALLBACKS\" section below). The context value determines which messages and under what conditions the extension will be added/parsed (see the \"EXTENSION CONTEXTS\" section below).

                                                                                                                                                            SSL_CTX_add_client_custom_ext() adds a custom extension for a TLS/DTLS client with extension type ext_type and callbacks add_cb, free_cb and parse_cb. This function is similar to SSL_CTX_add_custom_ext() except it only applies to clients, uses the older style of callbacks, and implicitly sets the context value to:

                                                                                                                                                            SSL_EXT_TLS1_2_AND_BELOW_ONLY | SSL_EXT_CLIENT_HELLO\n| SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_IGNORE_ON_RESUMPTION\n

                                                                                                                                                            SSL_CTX_add_server_custom_ext() adds a custom extension for a TLS/DTLS server with extension type ext_type and callbacks add_cb, free_cb and parse_cb. This function is similar to SSL_CTX_add_custom_ext() except it only applies to servers, uses the older style of callbacks, and implicitly sets the context value to the same as for SSL_CTX_add_client_custom_ext() above.

                                                                                                                                                            The ext_type parameter corresponds to the extension_type field of RFC5246 et al. It is not a NID. In all cases the extension type must not be handled by OpenSSL internally or an error occurs.

                                                                                                                                                            SSL_extension_supported() returns 1 if the extension ext_type is handled internally by OpenSSL and 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#extension-callbacks","title":"EXTENSION CALLBACKS","text":"

                                                                                                                                                            The callback add_cb is called to send custom extension data to be included in various TLS messages. The ext_type parameter is set to the extension type which will be added and add_arg to the value set when the extension handler was added. When using the new style callbacks the context parameter will indicate which message is currently being constructed e.g. for the ClientHello it will be set to SSL_EXT_CLIENT_HELLO.

                                                                                                                                                            If the application wishes to include the extension ext_type it should set *out to the extension data, set *outlen to the length of the extension data and return 1.

                                                                                                                                                            If the add_cb does not wish to include the extension it must return 0.

                                                                                                                                                            If add_cb returns -1 a fatal handshake error occurs using the TLS alert value specified in *al.

                                                                                                                                                            When constructing the ClientHello, if add_cb is set to NULL a zero length extension is added for ext_type. For all other messages if add_cb is set to NULL then no extension is added.

                                                                                                                                                            When constructing a Certificate message the callback will be called for each certificate in the message. The x parameter will indicate the current certificate and the chainidx parameter will indicate the position of the certificate in the message. The first certificate is always the end entity certificate and has a chainidx value of 0. The certificates are in the order that they were received in the Certificate message.

                                                                                                                                                            For all messages except the ServerHello and EncryptedExtensions every registered add_cb is always called to see if the application wishes to add an extension (as long as all requirements of the specified context are met).

                                                                                                                                                            For the ServerHello and EncryptedExtension messages every registered add_cb is called once if and only if the requirements of the specified context are met and the corresponding extension was received in the ClientHello. That is, if no corresponding extension was received in the ClientHello then add_cb will not be called.

                                                                                                                                                            If an extension is added (that is add_cb returns 1) free_cb is called (if it is set) with the value of out set by the add callback. It can be used to free up any dynamic extension data set by add_cb. Since out is constant (to permit use of constant data in add_cb) applications may need to cast away const to free the data.

                                                                                                                                                            The callback parse_cb receives data for TLS extensions. The callback is only called if the extension is present and relevant for the context (see \"EXTENSION CONTEXTS\" below).

                                                                                                                                                            The extension data consists of inlen bytes in the buffer in for the extension ext_type.

                                                                                                                                                            If the message being parsed is a TLSv1.3 compatible Certificate message then parse_cb will be called for each certificate contained within the message. The x parameter will indicate the current certificate and the chainidx parameter will indicate the position of the certificate in the message. The first certificate is always the end entity certificate and has a chainidx value of 0.

                                                                                                                                                            If the parse_cb considers the extension data acceptable it must return 1. If it returns 0 or a negative value a fatal handshake error occurs using the TLS alert value specified in *al.

                                                                                                                                                            The buffer in is a temporary internal buffer which will not be valid after the callback returns.

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#extension-contexts","title":"EXTENSION CONTEXTS","text":"

                                                                                                                                                            An extension context defines which messages and under which conditions an extension should be added or expected. The context is built up by performing a bitwise OR of multiple pre-defined values together. The valid context values are:

                                                                                                                                                            • SSL_EXT_TLS_ONLY

                                                                                                                                                              The extension is only allowed in TLS

                                                                                                                                                            • SSL_EXT_DTLS_ONLY

                                                                                                                                                              The extension is only allowed in DTLS

                                                                                                                                                            • SSL_EXT_TLS_IMPLEMENTATION_ONLY

                                                                                                                                                              The extension is allowed in DTLS, but there is only a TLS implementation available (so it is ignored in DTLS).

                                                                                                                                                            • SSL_EXT_SSL3_ALLOWED

                                                                                                                                                              Extensions are not typically defined for SSLv3. Setting this value will allow the extension in SSLv3. Applications will not typically need to use this.

                                                                                                                                                            • SSL_EXT_TLS1_2_AND_BELOW_ONLY

                                                                                                                                                              The extension is only defined for TLSv1.2/DTLSv1.2 and below. Servers will ignore this extension if it is present in the ClientHello and TLSv1.3 is negotiated.

                                                                                                                                                            • SSL_EXT_TLS1_3_ONLY

                                                                                                                                                              The extension is only defined for TLS1.3 and above. Servers will ignore this extension if it is present in the ClientHello and TLSv1.2 or below is negotiated.

                                                                                                                                                            • SSL_EXT_IGNORE_ON_RESUMPTION

                                                                                                                                                              The extension will be ignored during parsing if a previous session is being successfully resumed.

                                                                                                                                                            • SSL_EXT_CLIENT_HELLO

                                                                                                                                                              The extension may be present in the ClientHello message.

                                                                                                                                                            • SSL_EXT_TLS1_2_SERVER_HELLO

                                                                                                                                                              The extension may be present in a TLSv1.2 or below compatible ServerHello message.

                                                                                                                                                            • SSL_EXT_TLS1_3_SERVER_HELLO

                                                                                                                                                              The extension may be present in a TLSv1.3 compatible ServerHello message.

                                                                                                                                                            • SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS

                                                                                                                                                              The extension may be present in an EncryptedExtensions message.

                                                                                                                                                            • SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST

                                                                                                                                                              The extension may be present in a HelloRetryRequest message.

                                                                                                                                                            • SSL_EXT_TLS1_3_CERTIFICATE

                                                                                                                                                              The extension may be present in a TLSv1.3 compatible Certificate message.

                                                                                                                                                            • SSL_EXT_TLS1_3_NEW_SESSION_TICKET

                                                                                                                                                              The extension may be present in a TLSv1.3 compatible NewSessionTicket message.

                                                                                                                                                            • SSL_EXT_TLS1_3_CERTIFICATE_REQUEST

                                                                                                                                                              The extension may be present in a TLSv1.3 compatible CertificateRequest message.

                                                                                                                                                            The context must include at least one message value (otherwise the extension will never be used).

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#notes","title":"NOTES","text":"

                                                                                                                                                            The add_arg and parse_arg parameters can be set to arbitrary values which will be passed to the corresponding callbacks. They can, for example, be used to store the extension data received in a convenient structure or pass the extension data to be added or freed when adding extensions.

                                                                                                                                                            If the same custom extension type is received multiple times a fatal decode_error alert is sent and the handshake aborts. If a custom extension is received in a ServerHello/EncryptedExtensions message which was not sent in the ClientHello a fatal unsupported_extension alert is sent and the handshake is aborted. The ServerHello/EncryptedExtensions add_cb callback is only called if the corresponding extension was received in the ClientHello. This is compliant with the TLS specifications. This behaviour ensures that each callback is called at most once and that an application can never send unsolicited extensions.

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_add_custom_ext(), SSL_CTX_add_client_custom_ext() and SSL_CTX_add_server_custom_ext() return 1 for success and 0 for failure. A failure can occur if an attempt is made to add the same ext_type more than once, if an attempt is made to use an extension type handled internally by OpenSSL or if an internal error occurs (for example a memory allocation failure).

                                                                                                                                                            SSL_extension_supported() returns 1 if the extension ext_type is handled internally by OpenSSL and 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_CTX_add_custom_ext() function was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_extension_supported/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2014-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_free/","title":"SSL_free","text":""},{"location":"man3/SSL_free/#name","title":"NAME","text":"

                                                                                                                                                            SSL_free - free an allocated SSL structure

                                                                                                                                                            "},{"location":"man3/SSL_free/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_free(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_free/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_free() decrements the reference count of ssl, and removes the SSL structure pointed to by ssl and frees up the allocated memory if the reference count has reached 0. If ssl is NULL nothing is done.

                                                                                                                                                            "},{"location":"man3/SSL_free/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_free() also calls the free()ing procedures for indirectly affected items, if applicable: the buffering BIO, the read and write BIOs, cipher lists specially created for this ssl, the SSL_SESSION. Do not explicitly free these indirectly freed up items before or after calling SSL_free(), as trying to free things twice may lead to program failure.

                                                                                                                                                            The ssl session has reference counts from two users: the SSL object, for which the reference count is removed by SSL_free() and the internal session cache. If the session is considered bad, because SSL_shutdown(3) was not called for the connection and SSL_set_shutdown(3) was not used to set the SSL_SENT_SHUTDOWN state, the session will also be removed from the session cache as required by RFC2246.

                                                                                                                                                            "},{"location":"man3/SSL_free/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_free() does not provide diagnostic information.

                                                                                                                                                            SSL_new(3), SSL_clear(3), SSL_shutdown(3), SSL_set_shutdown(3), ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_free/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get0_peer_scts/","title":"SSL_get0_peer_scts","text":""},{"location":"man3/SSL_get0_peer_scts/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get0_peer_scts - get SCTs received

                                                                                                                                                            "},{"location":"man3/SSL_get0_peer_scts/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_get0_peer_scts/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get0_peer_scts() returns the signed certificate timestamps (SCTs) that have been received. If this is the first time that this function has been called for a given SSL instance, it will examine the TLS extensions, OCSP response and the peer's certificate for SCTs. Future calls will return the same SCTs.

                                                                                                                                                            "},{"location":"man3/SSL_get0_peer_scts/#restrictions","title":"RESTRICTIONS","text":"

                                                                                                                                                            If no Certificate Transparency validation callback has been set (using SSL_CTX_set_ct_validation_callback or SSL_set_ct_validation_callback), this function is not guaranteed to return all of the SCTs that the peer is capable of sending.

                                                                                                                                                            "},{"location":"man3/SSL_get0_peer_scts/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_get0_peer_scts() returns a list of SCTs found, or NULL if an error occurs.

                                                                                                                                                            "},{"location":"man3/SSL_get0_peer_scts/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_ct_validation_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_get0_peer_scts/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_SSL_CTX/","title":"SSL_get_SSL_CTX","text":""},{"location":"man3/SSL_get_SSL_CTX/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_SSL_CTX - get the SSL_CTX from which an SSL is created

                                                                                                                                                            "},{"location":"man3/SSL_get_SSL_CTX/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_SSL_CTX/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_SSL_CTX() returns a pointer to the SSL_CTX object, from which ssl was created with SSL_new(3).

                                                                                                                                                            "},{"location":"man3/SSL_get_SSL_CTX/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The pointer to the SSL_CTX object is returned.

                                                                                                                                                            "},{"location":"man3/SSL_get_SSL_CTX/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_new(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_SSL_CTX/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/","title":"SSL_get_all_async_fds","text":""},{"location":"man3/SSL_get_all_async_fds/#name","title":"NAME","text":"

                                                                                                                                                            SSL_waiting_for_async, SSL_get_all_async_fds, SSL_get_changed_async_fds - manage asynchronous operations

                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/async.h>\n#include <openssl/ssl.h>\n\nint SSL_waiting_for_async(SSL *s);\nint SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fd, size_t *numfds);\nint SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, size_t *numaddfds,\n                              OSSL_ASYNC_FD *delfd, size_t *numdelfds);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_waiting_for_async() determines whether an SSL connection is currently waiting for asynchronous operations to complete (see the SSL_MODE_ASYNC mode in SSL_CTX_set_mode(3)).

                                                                                                                                                            SSL_get_all_async_fds() returns a list of file descriptor which can be used in a call to select() or poll() to determine whether the current asynchronous operation has completed or not. A completed operation will result in data appearing as \"read ready\" on the file descriptor (no actual data should be read from the file descriptor). This function should only be called if the SSL object is currently waiting for asynchronous work to complete (i.e. SSL_ERROR_WANT_ASYNC has been received - see SSL_get_error(3)). Typically the list will only contain one file descriptor. However, if multiple asynchronous capable engines are in use then more than one is possible. The number of file descriptors returned is stored in *numfds and the file descriptors themselves are in *fds. The fds parameter may be NULL in which case no file descriptors are returned but *numfds is still populated. It is the callers responsibility to ensure sufficient memory is allocated at *fds so typically this function is called twice (once with a NULL fds parameter and once without).

                                                                                                                                                            SSL_get_changed_async_fds() returns a list of the asynchronous file descriptors that have been added and a list that have been deleted since the last SSL_ERROR_WANT_ASYNC was received (or since the SSL object was created if no SSL_ERROR_WANT_ASYNC has been received). Similar to SSL_get_all_async_fds() it is the callers responsibility to ensure that *addfd and *delfd have sufficient memory allocated, although they may be NULL. The number of added fds and the number of deleted fds are stored in *numaddfds and *numdelfds respectively.

                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_waiting_for_async() will return 1 if the current SSL operation is waiting for an async operation to complete and 0 otherwise.

                                                                                                                                                            SSL_get_all_async_fds() and SSL_get_changed_async_fds() return 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/#notes","title":"NOTES","text":"

                                                                                                                                                            On Windows platforms the <openssl/async.h> header is dependent on some of the types customarily made available by including <windows.h>. The application developer is likely to require control over when the latter is included, commonly as one of the first included headers. Therefore, it is defined as an application developer's responsibility to include <windows.h> prior to <openssl/async.h>.

                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_error(3), SSL_CTX_set_mode(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_waiting_for_async(), SSL_get_all_async_fds() and SSL_get_changed_async_fds() functions were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_get_all_async_fds/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_certificate/","title":"SSL_get_certificate","text":""},{"location":"man3/SSL_get_certificate/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_certificate, SSL_get_privatekey - retrieve TLS/SSL certificate and private key

                                                                                                                                                            "},{"location":"man3/SSL_get_certificate/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nX509 *SSL_get_certificate(const SSL *s);\nEVP_PKEY *SSL_get_privatekey(const SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_certificate/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_certificate() returns a pointer to an X509 object representing a certificate used as the local peer's identity.

                                                                                                                                                            Multiple certificates can be configured; for example, a server might have both RSA and ECDSA certificates. The certificate which is returned by SSL_get_certificate() is determined as follows:

                                                                                                                                                            • If it is called before certificate selection has occurred, it returns the most recently added certificate, or NULL if no certificate has been added.
                                                                                                                                                            • After certificate selection has occurred, it returns the certificate which was selected during the handshake, or NULL if no certificate was selected (for example, on a client where no client certificate is in use).

                                                                                                                                                            Certificate selection occurs during the handshake; therefore, the value returned by SSL_get_certificate() during any callback made during the handshake process will depend on whether that callback is made before or after certificate selection occurs.

                                                                                                                                                            A specific use for SSL_get_certificate() is inside a callback set via a call to SSL_CTX_set_tlsext_status_cb(3). This callback occurs after certificate selection, where it can be used to examine a server's chosen certificate, for example for the purpose of identifying a certificate's OCSP responder URL so that an OCSP response can be obtained.

                                                                                                                                                            SSL_get_privatekey() returns a pointer to the EVP_PKEY object corresponding to the certificate returned by SSL_get_certificate(), if any.

                                                                                                                                                            "},{"location":"man3/SSL_get_certificate/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            These functions return pointers to their respective objects, or NULL if no such object is available. Returned objects are owned by the SSL object and should not be freed by users of these functions.

                                                                                                                                                            "},{"location":"man3/SSL_get_certificate/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_tlsext_status_cb(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_certificate/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_ciphers/","title":"SSL_get_ciphers","text":""},{"location":"man3/SSL_get_ciphers/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get1_supported_ciphers, SSL_get_client_ciphers, SSL_get_ciphers, SSL_CTX_get_ciphers, SSL_bytes_to_cipher_list, SSL_get_cipher_list, SSL_get_shared_ciphers - get list of available SSL_CIPHERs

                                                                                                                                                            "},{"location":"man3/SSL_get_ciphers/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSTACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);\nSTACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);\nSTACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s);\nSTACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *ssl);\nint SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len,\n                             int isv2format, STACK_OF(SSL_CIPHER) **sk,\n                             STACK_OF(SSL_CIPHER) **scsvs);\nconst char *SSL_get_cipher_list(const SSL *ssl, int priority);\nchar *SSL_get_shared_ciphers(const SSL *s, char *buf, int size);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_ciphers/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_ciphers() returns the stack of available SSL_CIPHERs for ssl, sorted by preference. If ssl is NULL or no ciphers are available, NULL is returned.

                                                                                                                                                            SSL_CTX_get_ciphers() returns the stack of available SSL_CIPHERs for ctx.

                                                                                                                                                            SSL_get1_supported_ciphers() returns the stack of enabled SSL_CIPHERs for ssl as would be sent in a ClientHello (that is, sorted by preference). The list depends on settings like the cipher list, the supported protocol versions, the security level, and the enabled signature algorithms. SRP and PSK ciphers are only enabled if the appropriate callbacks or settings have been applied. The list of ciphers that would be sent in a ClientHello can differ from the list of ciphers that would be acceptable when acting as a server. For example, additional ciphers may be usable by a server if there is a gap in the list of supported protocols, and some ciphers may not be usable by a server if there is not a suitable certificate configured. If ssl is NULL or no ciphers are available, NULL is returned.

                                                                                                                                                            SSL_get_client_ciphers() returns the stack of available SSL_CIPHERs matching the list received from the client on ssl. If ssl is NULL, no ciphers are available, or ssl is not operating in server mode, NULL is returned.

                                                                                                                                                            SSL_bytes_to_cipher_list() treats the supplied len octets in bytes as a wire-protocol cipher suite specification (in the three-octet-per-cipher SSLv2 wire format if isv2format is nonzero; otherwise the two-octet SSLv3/TLS wire format), and parses the cipher suites supported by the library into the returned stacks of SSL_CIPHER objects sk and Signalling Cipher-Suite Values scsvs. Unsupported cipher suites are ignored. Returns 1 on success and 0 on failure.

                                                                                                                                                            SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER listed for ssl with priority. If ssl is NULL, no ciphers are available, or there are less ciphers than priority available, NULL is returned.

                                                                                                                                                            SSL_get_shared_ciphers() creates a colon separated and NUL terminated list of SSL_CIPHER names that are available in both the client and the server. buf is the buffer that should be populated with the list of names and size is the size of that buffer. A pointer to buf is returned on success or NULL on error. If the supplied buffer is not large enough to contain the complete list of names then a truncated list of names will be returned. Note that just because a ciphersuite is available (i.e. it is configured in the cipher list) and shared by both the client and the server it does not mean that it is enabled (see the description of SSL_get1_supported_ciphers() above). This function will return available shared ciphersuites whether or not they are enabled. This is a server side function only and must only be called after the completion of the initial handshake.

                                                                                                                                                            "},{"location":"man3/SSL_get_ciphers/#notes","title":"NOTES","text":"

                                                                                                                                                            The details of the ciphers obtained by SSL_get_ciphers(), SSL_CTX_get_ciphers() SSL_get1_supported_ciphers() and SSL_get_client_ciphers() can be obtained using the SSL_CIPHER_get_name(3) family of functions.

                                                                                                                                                            Call SSL_get_cipher_list() with priority starting from 0 to obtain the sorted list of available ciphers, until NULL is returned.

                                                                                                                                                            Note: SSL_get_ciphers(), SSL_CTX_get_ciphers() and SSL_get_client_ciphers() return a pointer to an internal cipher stack, which will be freed later on when the SSL or SSL_SESSION object is freed. Therefore, the calling code MUST NOT free the return value itself.

                                                                                                                                                            The stack returned by SSL_get1_supported_ciphers() should be freed using sk_SSL_CIPHER_free().

                                                                                                                                                            The stacks returned by SSL_bytes_to_cipher_list() should be freed using sk_SSL_CIPHER_free().

                                                                                                                                                            "},{"location":"man3/SSL_get_ciphers/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            See DESCRIPTION

                                                                                                                                                            "},{"location":"man3/SSL_get_ciphers/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_cipher_list(3), SSL_CIPHER_get_name(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_ciphers/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_client_random/","title":"SSL_get_client_random","text":""},{"location":"man3/SSL_get_client_random/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_client_random, SSL_get_server_random, SSL_SESSION_get_master_key, SSL_SESSION_set1_master_key - get internal TLS/SSL random values and get/set master key

                                                                                                                                                            "},{"location":"man3/SSL_get_client_random/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nsize_t SSL_get_client_random(const SSL *ssl, unsigned char *out, size_t outlen);\nsize_t SSL_get_server_random(const SSL *ssl, unsigned char *out, size_t outlen);\nsize_t SSL_SESSION_get_master_key(const SSL_SESSION *session,\n                                  unsigned char *out, size_t outlen);\nint SSL_SESSION_set1_master_key(SSL_SESSION *sess, const unsigned char *in,\n                                size_t len);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_client_random/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_client_random() extracts the random value sent from the client to the server during the initial SSL/TLS handshake. It copies as many bytes as it can of this value into the buffer provided in out, which must have at least outlen bytes available. It returns the total number of bytes that were actually copied. If outlen is zero, SSL_get_client_random() copies nothing, and returns the total size of the client_random value.

                                                                                                                                                            SSL_get_server_random() behaves the same, but extracts the random value sent from the server to the client during the initial SSL/TLS handshake.

                                                                                                                                                            SSL_SESSION_get_master_key() behaves the same, but extracts the master secret used to guarantee the security of the SSL/TLS session. This one can be dangerous if misused; see NOTES below.

                                                                                                                                                            SSL_SESSION_set1_master_key() sets the master key value associated with the SSL_SESSION sess. For example, this could be used to set up a session based PSK (see SSL_CTX_set_psk_use_session_callback(3)). The master key of length len should be provided at in. The supplied master key is copied by the function, so the caller is responsible for freeing and cleaning any memory associated with in. The caller must ensure that the length of the key is suitable for the ciphersuite associated with the SSL_SESSION.

                                                                                                                                                            "},{"location":"man3/SSL_get_client_random/#notes","title":"NOTES","text":"

                                                                                                                                                            You probably shouldn't use these functions.

                                                                                                                                                            These functions expose internal values from the TLS handshake, for use in low-level protocols. You probably should not use them, unless you are implementing something that needs access to the internal protocol details.

                                                                                                                                                            Despite the names of SSL_get_client_random() and SSL_get_server_random(), they ARE NOT random number generators. Instead, they return the mostly-random values that were already generated and used in the TLS protocol. Using them in place of RAND_bytes() would be grossly foolish.

                                                                                                                                                            The security of your TLS session depends on keeping the master key secret: do not expose it, or any information about it, to anybody. If you need to calculate another secret value that depends on the master secret, you should probably use SSL_export_keying_material() instead, and forget that you ever saw these functions.

                                                                                                                                                            In current versions of the TLS protocols, the length of client_random (and also server_random) is always SSL3_RANDOM_SIZE bytes. Support for other outlen arguments to the SSL_get_*_random() functions is provided in case of the unlikely event that a future version or variant of TLS uses some other length there.

                                                                                                                                                            Finally, though the \"client_random\" and \"server_random\" values are called \"random\", many TLS implementations will generate four bytes of those values based on their view of the current time.

                                                                                                                                                            "},{"location":"man3/SSL_get_client_random/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_SESSION_set1_master_key() returns 1 on success or 0 on failure.

                                                                                                                                                            For the other functions, if outlen is greater than 0 then these functions return the number of bytes actually copied, which will be less than or equal to outlen. If outlen is 0 then these functions return the maximum number of bytes they would copy -- that is, the length of the underlying field.

                                                                                                                                                            "},{"location":"man3/SSL_get_client_random/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), RAND_bytes(3), SSL_export_keying_material(3), SSL_CTX_set_psk_use_session_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_client_random/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_current_cipher/","title":"SSL_get_current_cipher","text":""},{"location":"man3/SSL_get_current_cipher/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_current_cipher, SSL_get_cipher_name, SSL_get_cipher, SSL_get_cipher_bits, SSL_get_cipher_version, SSL_get_pending_cipher - get SSL_CIPHER of a connection

                                                                                                                                                            "},{"location":"man3/SSL_get_current_cipher/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl);\nconst SSL_CIPHER *SSL_get_pending_cipher(const SSL *ssl);\n\nconst char *SSL_get_cipher_name(const SSL *s);\nconst char *SSL_get_cipher(const SSL *s);\nint SSL_get_cipher_bits(const SSL *s, int *np);\nconst char *SSL_get_cipher_version(const SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_current_cipher/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_current_cipher() returns a pointer to an SSL_CIPHER object containing the description of the actually used cipher of a connection established with the ssl object. See SSL_CIPHER_get_name(3) for more details.

                                                                                                                                                            SSL_get_cipher_name() obtains the name of the currently used cipher. SSL_get_cipher() is identical to SSL_get_cipher_name(). SSL_get_cipher_bits() is a macro to obtain the number of secret/algorithm bits used and SSL_get_cipher_version() returns the protocol name.

                                                                                                                                                            SSL_get_pending_cipher() returns a pointer to an SSL_CIPHER object containing the description of the cipher (if any) that has been negotiated for future use on the connection established with the ssl object, but is not yet in use. This may be the case during handshake processing, when control flow can be returned to the application via any of several callback methods. The internal sequencing of handshake processing and callback invocation is not guaranteed to be stable from release to release, and at present only the callback set by SSL_CTX_set_alpn_select_cb() is guaranteed to have a non-NULL return value. Other callbacks may be added to this list over time.

                                                                                                                                                            "},{"location":"man3/SSL_get_current_cipher/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_get_current_cipher() returns the cipher actually used, or NULL if no session has been established.

                                                                                                                                                            SSL_get_pending_cipher() returns the cipher to be used at the next change of cipher suite, or NULL if no such cipher is known.

                                                                                                                                                            "},{"location":"man3/SSL_get_current_cipher/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_get_cipher, SSL_get_cipher_bits, SSL_get_cipher_version, and SSL_get_cipher_name are implemented as macros.

                                                                                                                                                            "},{"location":"man3/SSL_get_current_cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CIPHER_get_name(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_current_cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_default_timeout/","title":"SSL_get_default_timeout","text":""},{"location":"man3/SSL_get_default_timeout/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_default_timeout - get default session timeout value

                                                                                                                                                            "},{"location":"man3/SSL_get_default_timeout/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_get_default_timeout(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_default_timeout/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_default_timeout() returns the default timeout value assigned to SSL_SESSION objects negotiated for the protocol valid for ssl.

                                                                                                                                                            "},{"location":"man3/SSL_get_default_timeout/#notes","title":"NOTES","text":"

                                                                                                                                                            Whenever a new session is negotiated, it is assigned a timeout value, after which it will not be accepted for session reuse. If the timeout value was not explicitly set using SSL_CTX_set_timeout(3), the hardcoded default timeout for the protocol will be used.

                                                                                                                                                            SSL_get_default_timeout() return this hardcoded value, which is 300 seconds for all currently supported protocols.

                                                                                                                                                            "},{"location":"man3/SSL_get_default_timeout/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            See description.

                                                                                                                                                            "},{"location":"man3/SSL_get_default_timeout/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_get_time(3), SSL_CTX_flush_sessions(3), SSL_get_default_timeout(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_default_timeout/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_error/","title":"SSL_get_error","text":""},{"location":"man3/SSL_get_error/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_error - obtain result code for TLS/SSL I/O operation

                                                                                                                                                            "},{"location":"man3/SSL_get_error/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_get_error(const SSL *ssl, int ret);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_error/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_error() returns a result code (suitable for the C \"switch\" statement) for a preceding call to SSL_connect(), SSL_accept(), SSL_do_handshake(), SSL_read_ex(), SSL_read(), SSL_peek_ex(), SSL_peek(), SSL_shutdown(), SSL_write_ex() or SSL_write() on ssl. The value returned by that TLS/SSL I/O function must be passed to SSL_get_error() in parameter ret.

                                                                                                                                                            In addition to ssl and ret, SSL_get_error() inspects the current thread's OpenSSL error queue. Thus, SSL_get_error() must be used in the same thread that performed the TLS/SSL I/O operation, and no other OpenSSL function calls should appear in between. The current thread's error queue must be empty before the TLS/SSL I/O operation is attempted, or SSL_get_error() will not work reliably.

                                                                                                                                                            "},{"location":"man3/SSL_get_error/#notes","title":"NOTES","text":"

                                                                                                                                                            Some TLS implementations do not send a close_notify alert on shutdown.

                                                                                                                                                            On an unexpected EOF, versions before OpenSSL 3.0 returned SSL_ERROR_SYSCALL, nothing was added to the error stack, and errno was 0. Since OpenSSL 3.0 the returned error is SSL_ERROR_SSL with a meaningful error on the error stack (SSL_R_UNEXPECTED_EOF_WHILE_READING). This error reason code may be used for control flow decisions (see the man page for ERR_GET_REASON(3) for further details on this).

                                                                                                                                                            "},{"location":"man3/SSL_get_error/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can currently occur:

                                                                                                                                                            • SSL_ERROR_NONE

                                                                                                                                                              The TLS/SSL I/O operation completed. This result code is returned if and only if ret > 0.

                                                                                                                                                            • SSL_ERROR_ZERO_RETURN

                                                                                                                                                              The TLS/SSL peer has closed the connection for writing by sending the close_notify alert. No more data can be read. Note that SSL_ERROR_ZERO_RETURN does not necessarily indicate that the underlying transport has been closed.

                                                                                                                                                              This error can also appear when the option SSL_OP_IGNORE_UNEXPECTED_EOF is set. See SSL_CTX_set_options(3) for more details.

                                                                                                                                                            • SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE

                                                                                                                                                              The operation did not complete and can be retried later.

                                                                                                                                                              SSL_ERROR_WANT_READ is returned when the last operation was a read operation from a nonblocking BIO. It means that not enough data was available at this time to complete the operation. If at a later time the underlying BIO has data available for reading the same function can be called again.

                                                                                                                                                              SSL_read() and SSL_read_ex() can also set SSL_ERROR_WANT_READ when there is still unprocessed data available at either the SSL or the BIO layer, even for a blocking BIO. See SSL_read(3) for more information.

                                                                                                                                                              SSL_ERROR_WANT_WRITE is returned when the last operation was a write to a nonblocking BIO and it was unable to sent all data to the BIO. When the BIO is writable again, the same function can be called again.

                                                                                                                                                              Note that the retry may again lead to an SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition. There is no fixed upper limit for the number of iterations that may be necessary until progress becomes visible at application protocol level.

                                                                                                                                                              It is safe to call SSL_read() or SSL_read_ex() when more data is available even when the call that set this error was an SSL_write() or SSL_write_ex(). However, if the call was an SSL_write() or SSL_write_ex(), it should be called again to continue sending the application data. If you get SSL_ERROR_WANT_WRITE from SSL_write() or SSL_write_ex() then you should not do any other operation that could trigger IO other than to repeat the previous SSL_write() call.

                                                                                                                                                              For socket BIOs (e.g. when SSL_set_fd() was used), select() or poll() on the underlying socket can be used to find out when the TLS/SSL I/O function should be retried.

                                                                                                                                                              Caveat: Any TLS/SSL I/O function can lead to either of SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE. In particular, SSL_read_ex(), SSL_read(), SSL_peek_ex(), or SSL_peek() may want to write data and SSL_write() or SSL_write_ex() may want to read data. This is mainly because TLS/SSL handshakes may occur at any time during the protocol (initiated by either the client or the server); SSL_read_ex(), SSL_read(), SSL_peek_ex(), SSL_peek(), SSL_write_ex(), and SSL_write() will handle any pending handshakes.

                                                                                                                                                            • SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT

                                                                                                                                                              The operation did not complete; the same TLS/SSL I/O function should be called again later. The underlying BIO was not connected yet to the peer and the call would block in connect()/accept(). The SSL function should be called again when the connection is established. These messages can only appear with a BIO_s_connect() or BIO_s_accept() BIO, respectively. In order to find out, when the connection has been successfully established, on many platforms select() or poll() for writing on the socket file descriptor can be used.

                                                                                                                                                            • SSL_ERROR_WANT_X509_LOOKUP

                                                                                                                                                              The operation did not complete because an application callback set by SSL_CTX_set_client_cert_cb() has asked to be called again. The TLS/SSL I/O function should be called again later. Details depend on the application.

                                                                                                                                                            • SSL_ERROR_WANT_ASYNC

                                                                                                                                                              The operation did not complete because an asynchronous engine is still processing data. This will only occur if the mode has been set to SSL_MODE_ASYNC using SSL_CTX_set_mode(3) or SSL_set_mode(3) and an asynchronous capable engine is being used. An application can determine whether the engine has completed its processing using select() or poll() on the asynchronous wait file descriptor. This file descriptor is available by calling SSL_get_all_async_fds(3) or SSL_get_changed_async_fds(3). The TLS/SSL I/O function should be called again later. The function must be called from the same thread that the original call was made from.

                                                                                                                                                            • SSL_ERROR_WANT_ASYNC_JOB

                                                                                                                                                              The asynchronous job could not be started because there were no async jobs available in the pool (see ASYNC_init_thread(3)). This will only occur if the mode has been set to SSL_MODE_ASYNC using SSL_CTX_set_mode(3) or SSL_set_mode(3) and a maximum limit has been set on the async job pool through a call to ASYNC_init_thread(3). The application should retry the operation after a currently executing asynchronous operation for the current thread has completed.

                                                                                                                                                            • SSL_ERROR_WANT_CLIENT_HELLO_CB

                                                                                                                                                              The operation did not complete because an application callback set by SSL_CTX_set_client_hello_cb() has asked to be called again. The TLS/SSL I/O function should be called again later. Details depend on the application.

                                                                                                                                                            • SSL_ERROR_SYSCALL

                                                                                                                                                              Some non-recoverable, fatal I/O error occurred. The OpenSSL error queue may contain more information on the error. For socket I/O on Unix systems, consult errno for details. If this error occurs then no further I/O operations should be performed on the connection and SSL_shutdown() must not be called.

                                                                                                                                                              This value can also be returned for other errors, check the error queue for details.

                                                                                                                                                            • SSL_ERROR_SSL

                                                                                                                                                              A non-recoverable, fatal error in the SSL library occurred, usually a protocol error. The OpenSSL error queue contains more information on the error. If this error occurs then no further I/O operations should be performed on the connection and SSL_shutdown() must not be called.

                                                                                                                                                            "},{"location":"man3/SSL_get_error/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_get_error/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_ERROR_WANT_ASYNC error code was added in OpenSSL 1.1.0. The SSL_ERROR_WANT_CLIENT_HELLO_CB error code was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_get_error/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_extms_support/","title":"SSL_get_extms_support","text":""},{"location":"man3/SSL_get_extms_support/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_extms_support - extended master secret support

                                                                                                                                                            "},{"location":"man3/SSL_get_extms_support/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_get_extms_support(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_extms_support/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_extms_support() indicates whether the current session used extended master secret.

                                                                                                                                                            This function is implemented as a macro.

                                                                                                                                                            "},{"location":"man3/SSL_get_extms_support/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_get_extms_support() returns 1 if the current session used extended master secret, 0 if it did not and -1 if a handshake is currently in progress i.e. it is not possible to determine if extended master secret was used.

                                                                                                                                                            "},{"location":"man3/SSL_get_extms_support/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_get_extms_support/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_fd/","title":"SSL_get_fd","text":""},{"location":"man3/SSL_get_fd/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_fd, SSL_get_rfd, SSL_get_wfd - get file descriptor linked to an SSL object

                                                                                                                                                            "},{"location":"man3/SSL_get_fd/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_get_fd(const SSL *ssl);\nint SSL_get_rfd(const SSL *ssl);\nint SSL_get_wfd(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_fd/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_fd() returns the file descriptor which is linked to ssl. SSL_get_rfd() and SSL_get_wfd() return the file descriptors for the read or the write channel, which can be different. If the read and the write channel are different, SSL_get_fd() will return the file descriptor of the read channel.

                                                                                                                                                            "},{"location":"man3/SSL_get_fd/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • -1

                                                                                                                                                              The operation failed, because the underlying BIO is not of the correct type (suitable for file descriptors).

                                                                                                                                                            • =0

                                                                                                                                                              The file descriptor linked to ssl.

                                                                                                                                                            "},{"location":"man3/SSL_get_fd/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_set_fd(3), ssl(7) , bio(7)

                                                                                                                                                            "},{"location":"man3/SSL_get_fd/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_cert_chain/","title":"SSL_get_peer_cert_chain","text":""},{"location":"man3/SSL_get_peer_cert_chain/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_peer_cert_chain, SSL_get0_verified_chain - get the X509 certificate chain of the peer

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_cert_chain/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSTACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl);\nSTACK_OF(X509) *SSL_get0_verified_chain(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_peer_cert_chain/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_peer_cert_chain() returns a pointer to STACK_OF(X509) certificates forming the certificate chain sent by the peer. If called on the client side, the stack also contains the peer's certificate; if called on the server side, the peer's certificate must be obtained separately using SSL_get_peer_certificate(3). If the peer did not present a certificate, NULL is returned.

                                                                                                                                                            NB: SSL_get_peer_cert_chain() returns the peer chain as sent by the peer: it only consists of certificates the peer has sent (in the order the peer has sent them) it is not a verified chain.

                                                                                                                                                            SSL_get0_verified_chain() returns the verified certificate chain of the peer including the peer's end entity certificate. It must be called after a session has been successfully established. If peer verification was not successful (as indicated by SSL_get_verify_result() not returning X509_V_OK) the chain may be incomplete or invalid.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_cert_chain/#notes","title":"NOTES","text":"

                                                                                                                                                            If the session is resumed peers do not send certificates so a NULL pointer is returned by these functions. Applications can call SSL_session_reused() to determine whether a session is resumed.

                                                                                                                                                            The reference count of each certificate in the returned STACK_OF(X509) object is not incremented and the returned stack may be invalidated by renegotiation. If applications wish to use any certificates in the returned chain indefinitely they must increase the reference counts using X509_up_ref() or obtain a copy of the whole chain with X509_chain_up_ref().

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_cert_chain/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • NULL

                                                                                                                                                              No certificate was presented by the peer or no connection was established or the certificate chain is no longer available when a session is reused.

                                                                                                                                                            • Pointer to a STACK_OF(X509)

                                                                                                                                                              The return value points to the certificate chain presented by the peer.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_cert_chain/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_peer_certificate(3), X509_up_ref(3), X509_chain_up_ref(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_cert_chain/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/","title":"SSL_get_peer_certificate","text":""},{"location":"man3/SSL_get_peer_certificate/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_peer_certificate, SSL_get0_peer_certificate, SSL_get1_peer_certificate - get the X509 certificate of the peer

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nX509 *SSL_get0_peer_certificate(const SSL *ssl);\nX509 *SSL_get1_peer_certificate(const SSL *ssl);\n

                                                                                                                                                            The following function has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            X509 *SSL_get_peer_certificate(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions return a pointer to the X509 certificate the peer presented. If the peer did not present a certificate, NULL is returned.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/#notes","title":"NOTES","text":"

                                                                                                                                                            Due to the protocol definition, a TLS/SSL server will always send a certificate, if present. A client will only send a certificate when explicitly requested to do so by the server (see SSL_CTX_set_verify(3)). If an anonymous cipher is used, no certificates are sent.

                                                                                                                                                            That a certificate is returned does not indicate information about the verification state, use SSL_get_verify_result(3) to check the verification state.

                                                                                                                                                            The reference count of the X509 object returned by SSL_get1_peer_certificate() is incremented by one, so that it will not be destroyed when the session containing the peer certificate is freed. The X509 object must be explicitly freed using X509_free().

                                                                                                                                                            The reference count of the X509 object returned by SSL_get0_peer_certificate() is not incremented, and must not be freed.

                                                                                                                                                            SSL_get_peer_certificate() is an alias of SSL_get1_peer_certificate().

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • NULL

                                                                                                                                                              No certificate was presented by the peer or no connection was established.

                                                                                                                                                            • Pointer to an X509 certificate

                                                                                                                                                              The return value points to the certificate presented by the peer.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_verify_result(3), SSL_CTX_set_verify(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_get0_peer_certificate() and SSL_get1_peer_certificate() were added in 3.0.0. SSL_get_peer_certificate() was deprecated in 3.0.0.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_certificate/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_signature_nid/","title":"SSL_get_peer_signature_nid","text":""},{"location":"man3/SSL_get_peer_signature_nid/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_peer_signature_nid, SSL_get_peer_signature_type_nid, SSL_get_signature_nid, SSL_get_signature_type_nid - get TLS message signing types

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_signature_nid/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_get_peer_signature_nid(SSL *ssl, int *psig_nid);\nint SSL_get_peer_signature_type_nid(const SSL *ssl, int *psigtype_nid);\nint SSL_get_signature_nid(SSL *ssl, int *psig_nid);\nint SSL_get_signature_type_nid(const SSL *ssl, int *psigtype_nid);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_peer_signature_nid/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_peer_signature_nid() sets *psig_nid to the NID of the digest used by the peer to sign TLS messages. It is implemented as a macro.

                                                                                                                                                            SSL_get_peer_signature_type_nid() sets *psigtype_nid to the signature type used by the peer to sign TLS messages. Currently the signature type is the NID of the public key type used for signing except for PSS signing where it is EVP_PKEY_RSA_PSS. To differentiate between rsa_pss_rsae_* and rsa_pss_pss_* signatures, it's necessary to check the type of public key in the peer's certificate.

                                                                                                                                                            SSL_get_signature_nid() and SSL_get_signature_type_nid() return the equivalent information for the local end of the connection.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_signature_nid/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            These functions return 1 for success and 0 for failure. There are several possible reasons for failure: the cipher suite has no signature (e.g. it uses RSA key exchange or is anonymous), the TLS version is below 1.2 or the functions were called too early, e.g. before the peer signed a message.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_signature_nid/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_peer_certificate(3),

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_signature_nid/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_tmp_key/","title":"SSL_get_peer_tmp_key","text":""},{"location":"man3/SSL_get_peer_tmp_key/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_peer_tmp_key, SSL_get_server_tmp_key, SSL_get_tmp_key - get information about temporary keys used during a handshake

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_tmp_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_get_peer_tmp_key(SSL *ssl, EVP_PKEY **key);\nlong SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **key);\nlong SSL_get_tmp_key(SSL *ssl, EVP_PKEY **key);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_peer_tmp_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_peer_tmp_key() returns the temporary key provided by the peer and used during key exchange. For example, if ECDHE is in use, then this represents the peer's public ECDHE key. On success a pointer to the key is stored in *key. It is the caller's responsibility to free this key after use using EVP_PKEY_free(3).

                                                                                                                                                            SSL_get_server_tmp_key() is a backwards compatibility alias for SSL_get_peer_tmp_key(). Under that name it worked just on the client side of the connection, its behaviour on the server end is release-dependent.

                                                                                                                                                            SSL_get_tmp_key() returns the equivalent information for the local end of the connection.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_tmp_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            All these functions return 1 on success and 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_tmp_key/#notes","title":"NOTES","text":"

                                                                                                                                                            This function is implemented as a macro.

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_tmp_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), EVP_PKEY_free(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_peer_tmp_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_psk_identity/","title":"SSL_get_psk_identity","text":""},{"location":"man3/SSL_get_psk_identity/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_psk_identity, SSL_get_psk_identity_hint - get PSK client identity and hint

                                                                                                                                                            "},{"location":"man3/SSL_get_psk_identity/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst char *SSL_get_psk_identity_hint(const SSL *ssl);\nconst char *SSL_get_psk_identity(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_psk_identity/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_psk_identity_hint() is used to retrieve the PSK identity hint used during the connection setup related to SSL object ssl. Similarly, SSL_get_psk_identity() is used to retrieve the PSK identity used during the connection setup.

                                                                                                                                                            "},{"location":"man3/SSL_get_psk_identity/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            If non-NULL, SSL_get_psk_identity_hint() returns the PSK identity hint and SSL_get_psk_identity() returns the PSK identity. Both are NULL-terminated. SSL_get_psk_identity_hint() may return NULL if no PSK identity hint was used during the connection setup.

                                                                                                                                                            Note that the return value is valid only during the lifetime of the SSL object ssl.

                                                                                                                                                            "},{"location":"man3/SSL_get_psk_identity/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_get_psk_identity/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_rbio/","title":"SSL_get_rbio","text":""},{"location":"man3/SSL_get_rbio/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_rbio, SSL_get_wbio - get BIO linked to an SSL object

                                                                                                                                                            "},{"location":"man3/SSL_get_rbio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nBIO *SSL_get_rbio(SSL *ssl);\nBIO *SSL_get_wbio(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_rbio/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_rbio() and SSL_get_wbio() return pointers to the BIOs for the read or the write channel, which can be different. The reference count of the BIO is not incremented.

                                                                                                                                                            "},{"location":"man3/SSL_get_rbio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • NULL

                                                                                                                                                              No BIO was connected to the SSL object

                                                                                                                                                            • Any other pointer

                                                                                                                                                              The BIO linked to ssl.

                                                                                                                                                            "},{"location":"man3/SSL_get_rbio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_set_bio(3), ssl(7) , bio(7)

                                                                                                                                                            "},{"location":"man3/SSL_get_rbio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_session/","title":"SSL_get_session","text":""},{"location":"man3/SSL_get_session/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_session, SSL_get0_session, SSL_get1_session - retrieve TLS/SSL session data

                                                                                                                                                            "},{"location":"man3/SSL_get_session/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSSL_SESSION *SSL_get_session(const SSL *ssl);\nSSL_SESSION *SSL_get0_session(const SSL *ssl);\nSSL_SESSION *SSL_get1_session(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_session/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_session() returns a pointer to the SSL_SESSION actually used in ssl. The reference count of the SSL_SESSION is not incremented, so that the pointer can become invalid by other operations.

                                                                                                                                                            SSL_get0_session() is the same as SSL_get_session().

                                                                                                                                                            SSL_get1_session() is the same as SSL_get_session(), but the reference count of the SSL_SESSION is incremented by one.

                                                                                                                                                            "},{"location":"man3/SSL_get_session/#notes","title":"NOTES","text":"

                                                                                                                                                            The ssl session contains all information required to re-establish the connection without a full handshake for SSL versions up to and including TLSv1.2. In TLSv1.3 the same is true, but sessions are established after the main handshake has occurred. The server will send the session information to the client at a time of its choosing, which may be some while after the initial connection is established (or never). Calling these functions on the client side in TLSv1.3 before the session has been established will still return an SSL_SESSION object but that object cannot be used for resuming the session. See SSL_SESSION_is_resumable(3) for information on how to determine whether an SSL_SESSION object can be used for resumption or not.

                                                                                                                                                            Additionally, in TLSv1.3, a server can send multiple messages that establish a session for a single connection. In that case, on the client side, the above functions will only return information on the last session that was received. On the server side they will only return information on the last session that was sent, or if no session tickets were sent then the session for the current connection.

                                                                                                                                                            The preferred way for applications to obtain a resumable SSL_SESSION object is to use a new session callback as described in SSL_CTX_sess_set_new_cb(3). The new session callback is only invoked when a session is actually established, so this avoids the problem described above where an application obtains an SSL_SESSION object that cannot be used for resumption in TLSv1.3. It also enables applications to obtain information about all sessions sent by the server.

                                                                                                                                                            A session will be automatically removed from the session cache and marked as non-resumable if the connection is not closed down cleanly, e.g. if a fatal error occurs on the connection or SSL_shutdown(3) is not called prior to SSL_free(3).

                                                                                                                                                            In TLSv1.3 it is recommended that each SSL_SESSION object is only used for resumption once.

                                                                                                                                                            SSL_get0_session() returns a pointer to the actual session. As the reference counter is not incremented, the pointer is only valid while the connection is in use. If SSL_clear(3) or SSL_free(3) is called, the session may be removed completely (if considered bad), and the pointer obtained will become invalid. Even if the session is valid, it can be removed at any time due to timeout during SSL_CTX_flush_sessions(3).

                                                                                                                                                            If the data is to be kept, SSL_get1_session() will increment the reference count, so that the session will not be implicitly removed by other operations but stays in memory. In order to remove the session SSL_SESSION_free(3) must be explicitly called once to decrement the reference count again.

                                                                                                                                                            SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object).

                                                                                                                                                            "},{"location":"man3/SSL_get_session/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • NULL

                                                                                                                                                              There is no session available in ssl.

                                                                                                                                                            • Pointer to an SSL_SESSION

                                                                                                                                                              The return value points to the data of an SSL session.

                                                                                                                                                            "},{"location":"man3/SSL_get_session/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_free(3), SSL_clear(3), SSL_SESSION_free(3)

                                                                                                                                                            "},{"location":"man3/SSL_get_session/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_shared_sigalgs/","title":"SSL_get_shared_sigalgs","text":""},{"location":"man3/SSL_get_shared_sigalgs/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_shared_sigalgs, SSL_get_sigalgs - get supported signature algorithms

                                                                                                                                                            "},{"location":"man3/SSL_get_shared_sigalgs/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_get_shared_sigalgs(SSL *s, int idx,\n                           int *psign, int *phash, int *psignhash,\n                           unsigned char *rsig, unsigned char *rhash);\n\nint SSL_get_sigalgs(SSL *s, int idx,\n                    int *psign, int *phash, int *psignhash,\n                    unsigned char *rsig, unsigned char *rhash);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_shared_sigalgs/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_shared_sigalgs() returns information about the shared signature algorithms supported by peer s. The parameter idx indicates the index of the shared signature algorithm to return starting from zero. The signature algorithm NID is written to *psign, the hash NID to *phash and the sign and hash NID to *psignhash. The raw signature and hash values are written to *rsig and *rhash.

                                                                                                                                                            SSL_get_sigalgs() is similar to SSL_get_shared_sigalgs() except it returns information about all signature algorithms supported by s in the order they were sent by the peer.

                                                                                                                                                            "},{"location":"man3/SSL_get_shared_sigalgs/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_get_shared_sigalgs() and SSL_get_sigalgs() return the number of signature algorithms or 0 if the idx parameter is out of range.

                                                                                                                                                            "},{"location":"man3/SSL_get_shared_sigalgs/#notes","title":"NOTES","text":"

                                                                                                                                                            These functions are typically called for debugging purposes (to report the peer's preferences) or where an application wants finer control over certificate selection. Most applications will rely on internal handling and will not need to call them.

                                                                                                                                                            If an application is only interested in the highest preference shared signature algorithm it can just set idx to zero.

                                                                                                                                                            Any or all of the parameters psign, phash, psignhash, rsig or rhash can be set to NULL if the value is not required. By setting them all to NULL and setting idx to zero the total number of signature algorithms can be determined: which can be zero.

                                                                                                                                                            These functions must be called after the peer has sent a list of supported signature algorithms: after a client hello (for servers) or a certificate request (for clients). They can (for example) be called in the certificate callback.

                                                                                                                                                            Only TLS 1.2, TLS 1.3 and DTLS 1.2 currently support signature algorithms. If these functions are called on an earlier version of TLS or DTLS zero is returned.

                                                                                                                                                            The shared signature algorithms returned by SSL_get_shared_sigalgs() are ordered according to configuration and peer preferences.

                                                                                                                                                            The raw values correspond to the on the wire form as defined by RFC5246 et al. The NIDs are OpenSSL equivalents. For example if the peer sent sha256(4) and rsa(1) then *rhash would be 4, *rsign 1, *phash NID_sha256, *psig NID_rsaEncryption and *psighash NID_sha256WithRSAEncryption.

                                                                                                                                                            If a signature algorithm is not recognised the corresponding NIDs will be set to NID_undef. This may be because the value is not supported, is not an appropriate combination (for example MD5 and DSA) or the signature algorithm does not use a hash (for example Ed25519).

                                                                                                                                                            "},{"location":"man3/SSL_get_shared_sigalgs/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_CTX_set_cert_cb(3), ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_get_shared_sigalgs/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/","title":"SSL_get_verify_result","text":""},{"location":"man3/SSL_get_verify_result/#name","title":"NAME","text":"

                                                                                                                                                            SSL_get_verify_result - get result of peer certificate verification

                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nlong SSL_get_verify_result(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_get_verify_result() returns the result of the verification of the X509 certificate presented by the peer, if any.

                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_get_verify_result() can only return one error code while the verification of a certificate can fail because of many reasons at the same time. Only the last verification error that occurred during the processing is available from SSL_get_verify_result().

                                                                                                                                                            Sometimes there can be a sequence of errors leading to the verification failure as reported by SSL_get_verify_result(). To get the errors, it is necessary to setup a verify callback via SSL_CTX_set_verify(3) or SSL_set_verify(3) and retrieve the errors from the error stack there, because once SSL_connect(3) returns, these errors may no longer be available.

                                                                                                                                                            The verification result is part of the established session and is restored when a session is reused.

                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/#bugs","title":"BUGS","text":"

                                                                                                                                                            If no peer certificate was presented, the returned result code is X509_V_OK. This is because no verification error occurred, it does however not indicate success. SSL_get_verify_result() is only useful in connection with SSL_get_peer_certificate(3).

                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can currently occur:

                                                                                                                                                            • X509_V_OK

                                                                                                                                                              The verification succeeded or no peer certificate was presented.

                                                                                                                                                            • Any other value

                                                                                                                                                              Documented in openssl-verify(1).

                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_set_verify_result(3), SSL_get_peer_certificate(3), openssl-verify(1)

                                                                                                                                                            "},{"location":"man3/SSL_get_verify_result/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_get_version/","title":"SSL_get_version","text":""},{"location":"man3/SSL_get_version/#name","title":"NAME","text":"

                                                                                                                                                            SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_version - get the protocol information of a connection

                                                                                                                                                            "},{"location":"man3/SSL_get_version/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_client_version(const SSL *s);\n\nconst char *SSL_get_version(const SSL *ssl);\n\nint SSL_is_dtls(const SSL *ssl);\n\nint SSL_version(const SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_get_version/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_client_version() returns the numeric protocol version advertised by the client in the legacy_version field of the ClientHello when initiating the connection. Note that, for TLS, this value will never indicate a version greater than TLSv1.2 even if TLSv1.3 is subsequently negotiated. SSL_get_version() returns the name of the protocol used for the connection. SSL_version() returns the numeric protocol version used for the connection. They should only be called after the initial handshake has been completed. Prior to that the results returned from these functions may be unreliable.

                                                                                                                                                            SSL_is_dtls() returns one if the connection is using DTLS, zero if not.

                                                                                                                                                            "},{"location":"man3/SSL_get_version/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_get_version() returns one of the following strings:

                                                                                                                                                            • SSLv3

                                                                                                                                                              The connection uses the SSLv3 protocol.

                                                                                                                                                            • TLSv1

                                                                                                                                                              The connection uses the TLSv1.0 protocol.

                                                                                                                                                            • TLSv1.1

                                                                                                                                                              The connection uses the TLSv1.1 protocol.

                                                                                                                                                            • TLSv1.2

                                                                                                                                                              The connection uses the TLSv1.2 protocol.

                                                                                                                                                            • TLSv1.3

                                                                                                                                                              The connection uses the TLSv1.3 protocol.

                                                                                                                                                            • unknown

                                                                                                                                                              This indicates an unknown protocol version.

                                                                                                                                                            SSL_version() and SSL_client_version() return an integer which could include any of the following:

                                                                                                                                                            • SSL3_VERSION

                                                                                                                                                              The connection uses the SSLv3 protocol.

                                                                                                                                                            • TLS1_VERSION

                                                                                                                                                              The connection uses the TLSv1.0 protocol.

                                                                                                                                                            • TLS1_1_VERSION

                                                                                                                                                              The connection uses the TLSv1.1 protocol.

                                                                                                                                                            • TLS1_2_VERSION

                                                                                                                                                              The connection uses the TLSv1.2 protocol.

                                                                                                                                                            • TLS1_3_VERSION

                                                                                                                                                              The connection uses the TLSv1.3 protocol (never returned for SSL_client_version()).

                                                                                                                                                            "},{"location":"man3/SSL_get_version/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_get_version/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_is_dtls() function was added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_get_version/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_group_to_name/","title":"SSL_group_to_name","text":""},{"location":"man3/SSL_group_to_name/#name","title":"NAME","text":"

                                                                                                                                                            SSL_group_to_name - get name of group

                                                                                                                                                            "},{"location":"man3/SSL_group_to_name/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst char *SSL_group_to_name(const SSL *ssl, int id);\n
                                                                                                                                                            "},{"location":"man3/SSL_group_to_name/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_group_to_name() is used to retrieve the TLS group name associated with a given TLS group ID, as registered via built-in or external providers and as returned by a call to SSL_get1_groups() or SSL_get_shared_group().

                                                                                                                                                            "},{"location":"man3/SSL_group_to_name/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            If non-NULL, SSL_group_to_name() returns the TLS group name corresponding to the given id as a NUL-terminated string. If SSL_group_to_name() returns NULL, an error occurred; possibly no corresponding tlsname was registered during provider initialisation.

                                                                                                                                                            Note that the return value is valid only during the lifetime of the SSL object ssl.

                                                                                                                                                            "},{"location":"man3/SSL_group_to_name/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_group_to_name/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_in_init/","title":"SSL_in_init","text":""},{"location":"man3/SSL_in_init/#name","title":"NAME","text":"

                                                                                                                                                            SSL_in_before, SSL_in_init, SSL_is_init_finished, SSL_in_connect_init, SSL_in_accept_init, SSL_get_state - retrieve information about the handshake state machine

                                                                                                                                                            "},{"location":"man3/SSL_in_init/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_in_init(const SSL *s);\nint SSL_in_before(const SSL *s);\nint SSL_is_init_finished(const SSL *s);\n\nint SSL_in_connect_init(SSL *s);\nint SSL_in_accept_init(SSL *s);\n\nOSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_in_init/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_in_init() returns 1 if the SSL/TLS state machine is currently processing or awaiting handshake messages, or 0 otherwise.

                                                                                                                                                            SSL_in_before() returns 1 if no SSL/TLS handshake has yet been initiated, or 0 otherwise.

                                                                                                                                                            SSL_is_init_finished() returns 1 if the SSL/TLS connection is in a state where fully protected application data can be transferred or 0 otherwise.

                                                                                                                                                            Note that in some circumstances (such as when early data is being transferred) SSL_in_init(), SSL_in_before() and SSL_is_init_finished() can all return 0.

                                                                                                                                                            SSL_in_connect_init() returns 1 if s is acting as a client and SSL_in_init() would return 1, or 0 otherwise.

                                                                                                                                                            SSL_in_accept_init() returns 1 if s is acting as a server and SSL_in_init() would return 1, or 0 otherwise.

                                                                                                                                                            SSL_in_connect_init() and SSL_in_accept_init() are implemented as macros.

                                                                                                                                                            SSL_get_state() returns a value indicating the current state of the handshake state machine. OSSL_HANDSHAKE_STATE is an enumerated type where each value indicates a discrete state machine state. Note that future versions of OpenSSL may define more states so applications should expect to receive unrecognised state values. The naming format is made up of a number of elements as follows:

                                                                                                                                                            protocol_ST_role_message

                                                                                                                                                            protocol is one of TLS or DTLS. DTLS is used where a state is specific to the DTLS protocol. Otherwise TLS is used.

                                                                                                                                                            role is one of CR, CW, SR or SW to indicate \"client reading\", \"client writing\", \"server reading\" or \"server writing\" respectively.

                                                                                                                                                            message is the name of a handshake message that is being or has been sent, or is being or has been processed.

                                                                                                                                                            Additionally there are some special states that do not conform to the above format. These are:

                                                                                                                                                            • TLS_ST_BEFORE

                                                                                                                                                              No handshake messages have yet been been sent or received.

                                                                                                                                                            • TLS_ST_OK

                                                                                                                                                              Handshake message sending/processing has completed.

                                                                                                                                                            • TLS_ST_EARLY_DATA

                                                                                                                                                              Early data is being processed

                                                                                                                                                            • TLS_ST_PENDING_EARLY_DATA_END

                                                                                                                                                              Awaiting the end of early data processing

                                                                                                                                                            "},{"location":"man3/SSL_in_init/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_in_init(), SSL_in_before(), SSL_is_init_finished(), SSL_in_connect_init() and SSL_in_accept_init() return values as indicated above.

                                                                                                                                                            SSL_get_state() returns the current handshake state.

                                                                                                                                                            "},{"location":"man3/SSL_in_init/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_read_early_data(3)

                                                                                                                                                            "},{"location":"man3/SSL_in_init/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_key_update/","title":"SSL_key_update","text":""},{"location":"man3/SSL_key_update/#name","title":"NAME","text":"

                                                                                                                                                            SSL_key_update, SSL_get_key_update_type, SSL_renegotiate, SSL_renegotiate_abbreviated, SSL_renegotiate_pending - initiate and obtain information about updating connection keys

                                                                                                                                                            "},{"location":"man3/SSL_key_update/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_key_update(SSL *s, int updatetype);\nint SSL_get_key_update_type(const SSL *s);\n\nint SSL_renegotiate(SSL *s);\nint SSL_renegotiate_abbreviated(SSL *s);\nint SSL_renegotiate_pending(const SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_key_update/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_key_update() schedules an update of the keys for the current TLS connection. If the updatetype parameter is set to SSL_KEY_UPDATE_NOT_REQUESTED then the sending keys for this connection will be updated and the peer will be informed of the change. If the updatetype parameter is set to SSL_KEY_UPDATE_REQUESTED then the sending keys for this connection will be updated and the peer will be informed of the change along with a request for the peer to additionally update its sending keys. It is an error if updatetype is set to SSL_KEY_UPDATE_NONE.

                                                                                                                                                            SSL_key_update() must only be called after the initial handshake has been completed and TLSv1.3 has been negotiated, at the same time, the application needs to ensure that the writing of data has been completed. The key update will not take place until the next time an IO operation such as SSL_read_ex() or SSL_write_ex() takes place on the connection. Alternatively SSL_do_handshake() can be called to force the update to take place immediately.

                                                                                                                                                            SSL_get_key_update_type() can be used to determine whether a key update operation has been scheduled but not yet performed. The type of the pending key update operation will be returned if there is one, or SSL_KEY_UPDATE_NONE otherwise.

                                                                                                                                                            SSL_renegotiate() and SSL_renegotiate_abbreviated() should only be called for connections that have negotiated TLSv1.2 or less. Calling them on any other connection will result in an error.

                                                                                                                                                            When called from the client side, SSL_renegotiate() schedules a completely new handshake over an existing SSL/TLS connection. The next time an IO operation such as SSL_read_ex() or SSL_write_ex() takes place on the connection a check will be performed to confirm that it is a suitable time to start a renegotiation. If so, then it will be initiated immediately. OpenSSL will not attempt to resume any session associated with the connection in the new handshake.

                                                                                                                                                            When called from the client side, SSL_renegotiate_abbreviated() works in the same was as SSL_renegotiate() except that OpenSSL will attempt to resume the session associated with the current connection in the new handshake.

                                                                                                                                                            When called from the server side, SSL_renegotiate() and SSL_renegotiate_abbreviated() behave identically. They both schedule a request for a new handshake to be sent to the client. The next time an IO operation is performed then the same checks as on the client side are performed and then, if appropriate, the request is sent. The client may or may not respond with a new handshake and it may or may not attempt to resume an existing session. If a new handshake is started then this will be handled transparently by calling any OpenSSL IO function.

                                                                                                                                                            If an OpenSSL client receives a renegotiation request from a server then again this will be handled transparently through calling any OpenSSL IO function. For a TLS connection the client will attempt to resume the current session in the new handshake. For historical reasons, DTLS clients will not attempt to resume the session in the new handshake.

                                                                                                                                                            The SSL_renegotiate_pending() function returns 1 if a renegotiation or renegotiation request has been scheduled but not yet acted on, or 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_key_update/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_key_update(), SSL_renegotiate() and SSL_renegotiate_abbreviated() return 1 on success or 0 on error.

                                                                                                                                                            SSL_get_key_update_type() returns the update type of the pending key update operation or SSL_KEY_UPDATE_NONE if there is none.

                                                                                                                                                            SSL_renegotiate_pending() returns 1 if a renegotiation or renegotiation request has been scheduled but not yet acted on, or 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_key_update/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_read_ex(3), SSL_write_ex(3), SSL_do_handshake(3)

                                                                                                                                                            "},{"location":"man3/SSL_key_update/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_key_update() and SSL_get_key_update_type() functions were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_key_update/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_library_init/","title":"SSL_library_init","text":""},{"location":"man3/SSL_library_init/#name","title":"NAME","text":"

                                                                                                                                                            SSL_library_init, OpenSSL_add_ssl_algorithms - initialize SSL library by registering algorithms

                                                                                                                                                            "},{"location":"man3/SSL_library_init/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_library_init(void);\n\nint OpenSSL_add_ssl_algorithms(void);\n
                                                                                                                                                            "},{"location":"man3/SSL_library_init/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_library_init() registers the available SSL/TLS ciphers and digests.

                                                                                                                                                            OpenSSL_add_ssl_algorithms() is a synonym for SSL_library_init() and is implemented as a macro.

                                                                                                                                                            "},{"location":"man3/SSL_library_init/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_library_init() must be called before any other action takes place. SSL_library_init() is not reentrant.

                                                                                                                                                            "},{"location":"man3/SSL_library_init/#warnings","title":"WARNINGS","text":"

                                                                                                                                                            SSL_library_init() adds ciphers and digests used directly and indirectly by SSL/TLS.

                                                                                                                                                            "},{"location":"man3/SSL_library_init/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_library_init() always returns \"1\", so it is safe to discard the return value.

                                                                                                                                                            "},{"location":"man3/SSL_library_init/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), RAND_add(3)

                                                                                                                                                            "},{"location":"man3/SSL_library_init/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_library_init() and OpenSSL_add_ssl_algorithms() functions were deprecated in OpenSSL 1.1.0 by OPENSSL_init_ssl().

                                                                                                                                                            "},{"location":"man3/SSL_library_init/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/","title":"SSL_load_client_CA_file","text":""},{"location":"man3/SSL_load_client_CA_file/#name","title":"NAME","text":"

                                                                                                                                                            SSL_load_client_CA_file_ex, SSL_load_client_CA_file, SSL_add_file_cert_subjects_to_stack, SSL_add_dir_cert_subjects_to_stack, SSL_add_store_cert_subjects_to_stack - load certificate names

                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSTACK_OF(X509_NAME) *SSL_load_client_CA_file_ex(const char *file,\n                                                OSSL_LIB_CTX *libctx,\n                                                const char *propq);\nSTACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);\n\nint SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n                                        const char *file);\nint SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n                                       const char *dir);\nint SSL_add_store_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n                                         const char *store);\n
                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_load_client_CA_file_ex() reads certificates from file and returns a STACK_OF(X509_NAME) with the subject names found. The library context libctx and property query propq are used when fetching algorithms from providers.

                                                                                                                                                            SSL_load_client_CA_file() is similar to SSL_load_client_CA_file_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            SSL_add_file_cert_subjects_to_stack() reads certificates from file, and adds their subject name to the already existing stack.

                                                                                                                                                            SSL_add_dir_cert_subjects_to_stack() reads certificates from every file in the directory dir, and adds their subject name to the already existing stack.

                                                                                                                                                            SSL_add_store_cert_subjects_to_stack() loads certificates from the store URI, and adds their subject name to the already existing stack.

                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_load_client_CA_file() reads a file of PEM formatted certificates and extracts the X509_NAMES of the certificates found. While the name suggests the specific usage as support function for SSL_CTX_set_client_CA_list(3), it is not limited to CA certificates.

                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur for SSL_load_client_CA_file_ex(), and SSL_load_client_CA_file():

                                                                                                                                                            • NULL

                                                                                                                                                              The operation failed, check out the error stack for the reason.

                                                                                                                                                            • Pointer to STACK_OF(X509_NAME)

                                                                                                                                                              Pointer to the subject names of the successfully read certificates.

                                                                                                                                                            The following return values can occur for SSL_add_file_cert_subjects_to_stack(), SSL_add_dir_cert_subjects_to_stack(), and SSL_add_store_cert_subjects_to_stack():

                                                                                                                                                            • 0 (Failure)

                                                                                                                                                              The operation failed.

                                                                                                                                                            • 1 (Success)

                                                                                                                                                              The operation succeeded.

                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Load names of CAs from file and use it as a client CA list:

                                                                                                                                                            SSL_CTX *ctx;\nSTACK_OF(X509_NAME) *cert_names;\n\n...\ncert_names = SSL_load_client_CA_file(\"/path/to/CAfile.pem\");\nif (cert_names != NULL)\n    SSL_CTX_set_client_CA_list(ctx, cert_names);\nelse\n    /* error */\n...\n
                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), ossl_store(7), SSL_CTX_set_client_CA_list(3)

                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_load_client_CA_file_ex() and SSL_add_store_cert_subjects_to_stack() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/SSL_load_client_CA_file/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_new/","title":"SSL_new","text":""},{"location":"man3/SSL_new/#name","title":"NAME","text":"

                                                                                                                                                            SSL_dup, SSL_new, SSL_up_ref - create an SSL structure for a connection

                                                                                                                                                            "},{"location":"man3/SSL_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSSL *SSL_dup(SSL *s);\nSSL *SSL_new(SSL_CTX *ctx);\nint SSL_up_ref(SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_new() creates a new SSL structure which is needed to hold the data for a TLS/SSL connection. The new structure inherits the settings of the underlying context ctx: connection method, options, verification settings, timeout settings. An SSL structure is reference counted. Creating an SSL structure for the first time increments the reference count. Freeing it (using SSL_free) decrements it. When the reference count drops to zero, any memory or resources allocated to the SSL structure are freed.

                                                                                                                                                            SSL_up_ref() increments the reference count for an existing SSL structure.

                                                                                                                                                            The function SSL_dup() creates and returns a new SSL structure from the same SSL_CTX that was used to create s. It additionally duplicates a subset of the settings in s into the new SSL object.

                                                                                                                                                            For SSL_dup() to work, the connection MUST be in its initial state and MUST NOT have yet started the SSL handshake. For connections that are not in their initial state SSL_dup() just increments an internal reference count and returns the same handle. It may be possible to use SSL_clear(3) to recycle an SSL handle that is not in its initial state for reuse, but this is best avoided. Instead, save and restore the session, if desired, and construct a fresh handle for each connection.

                                                                                                                                                            The subset of settings in s that are duplicated are:

                                                                                                                                                            • any session data if configured (including the session_id_context)
                                                                                                                                                            • any tmp_dh settings set via SSL_set_tmp_dh(3), SSL_set_tmp_dh_callback(3), or SSL_set_dh_auto(3)
                                                                                                                                                            • any configured certificates, private keys or certificate chains
                                                                                                                                                            • any configured signature algorithms, or client signature algorithms
                                                                                                                                                            • any DANE settings
                                                                                                                                                            • any Options set via SSL_set_options(3)
                                                                                                                                                            • any Mode set via SSL_set_mode(3)
                                                                                                                                                            • any minimum or maximum protocol settings set via SSL_set_min_proto_version(3) or SSL_set_max_proto_version(3) (Note: Only from OpenSSL 1.1.1h and above)
                                                                                                                                                            • any verify mode, callback or depth set via SSL_set_verify(3) or SSL_set_verify_depth(3) or any configured X509 verification parameters
                                                                                                                                                            • any msg callback or info callback set via SSL_set_msg_callback(3) or SSL_set_info_callback(3)
                                                                                                                                                            • any default password callback set via SSL_set_default_passwd_cb(3)
                                                                                                                                                            • any session id generation callback set via SSL_set_generate_session_id(3)
                                                                                                                                                            • any configured Cipher List
                                                                                                                                                            • initial accept (server) or connect (client) state
                                                                                                                                                            • the max cert list value set via SSL_set_max_cert_list(3)
                                                                                                                                                            • the read_ahead value set via SSL_set_read_ahead(3)
                                                                                                                                                            • application specific data set via SSL_set_ex_data(3)
                                                                                                                                                            • any CA list or client CA list set via SSL_set0_CA_list(3), SSL_set0_client_CA_list() or similar functions
                                                                                                                                                            • any security level settings or callbacks
                                                                                                                                                            • any configured serverinfo data
                                                                                                                                                            • any configured PSK identity hint
                                                                                                                                                            • any configured custom extensions
                                                                                                                                                            • any client certificate types configured via SSL_set1_client_certificate_types
                                                                                                                                                            "},{"location":"man3/SSL_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • NULL

                                                                                                                                                              The creation of a new SSL structure failed. Check the error stack to find out the reason.

                                                                                                                                                            • Pointer to an SSL structure

                                                                                                                                                              The return value points to an allocated SSL structure.

                                                                                                                                                              SSL_up_ref() returns 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/SSL_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_free(3), SSL_clear(3), SSL_CTX_set_options(3), SSL_get_SSL_CTX(3), ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_pending/","title":"SSL_pending","text":""},{"location":"man3/SSL_pending/#name","title":"NAME","text":"

                                                                                                                                                            SSL_pending, SSL_has_pending - check for readable bytes buffered in an SSL object

                                                                                                                                                            "},{"location":"man3/SSL_pending/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_pending(const SSL *ssl);\nint SSL_has_pending(const SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_pending/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            Data is received in whole blocks known as records from the peer. A whole record is processed (e.g. decrypted) in one go and is buffered by OpenSSL until it is read by the application via a call to SSL_read_ex(3) or SSL_read(3).

                                                                                                                                                            SSL_pending() returns the number of bytes which have been processed, buffered and are available inside ssl for immediate read.

                                                                                                                                                            If the SSL object's read_ahead flag is set (see SSL_CTX_set_read_ahead(3)), additional protocol bytes (beyond the current record) may have been read containing more TLS/SSL records. This also applies to DTLS and pipelining (see SSL_CTX_set_split_send_fragment(3)). These additional bytes will be buffered by OpenSSL but will remain unprocessed until they are needed. As these bytes are still in an unprocessed state SSL_pending() will ignore them. Therefore, it is possible for no more bytes to be readable from the underlying BIO (because OpenSSL has already read them) and for SSL_pending() to return 0, even though readable application data bytes are available (because the data is in unprocessed buffered records).

                                                                                                                                                            SSL_has_pending() returns 1 if s has buffered data (whether processed or unprocessed) and 0 otherwise. Note that it is possible for SSL_has_pending() to return 1, and then a subsequent call to SSL_read_ex() or SSL_read() to return no data because the unprocessed buffered data when processed yielded no application data (for example this can happen during renegotiation). It is also possible in this scenario for SSL_has_pending() to continue to return 1 even after an SSL_read_ex() or SSL_read() call because the buffered and unprocessed data is not yet processable (e.g. because OpenSSL has only received a partial record so far).

                                                                                                                                                            "},{"location":"man3/SSL_pending/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_pending() returns the number of buffered and processed application data bytes that are pending and are available for immediate read. SSL_has_pending() returns 1 if there is buffered record data in the SSL object and 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_pending/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_read_ex(3), SSL_read(3), SSL_CTX_set_read_ahead(3), SSL_CTX_set_split_send_fragment(3), ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_pending/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_has_pending() function was added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_pending/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_read/","title":"SSL_read","text":""},{"location":"man3/SSL_read/#name","title":"NAME","text":"

                                                                                                                                                            SSL_read_ex, SSL_read, SSL_peek_ex, SSL_peek - read bytes from a TLS/SSL connection

                                                                                                                                                            "},{"location":"man3/SSL_read/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes);\nint SSL_read(SSL *ssl, void *buf, int num);\n\nint SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes);\nint SSL_peek(SSL *ssl, void *buf, int num);\n
                                                                                                                                                            "},{"location":"man3/SSL_read/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_read_ex() and SSL_read() try to read num bytes from the specified ssl into the buffer buf. On success SSL_read_ex() will store the number of bytes actually read in *readbytes.

                                                                                                                                                            SSL_peek_ex() and SSL_peek() are identical to SSL_read_ex() and SSL_read() respectively except no bytes are actually removed from the underlying BIO during the read, so that a subsequent call to SSL_read_ex() or SSL_read() will yield at least the same bytes.

                                                                                                                                                            "},{"location":"man3/SSL_read/#notes","title":"NOTES","text":"

                                                                                                                                                            In the paragraphs below a \"read function\" is defined as one of SSL_read_ex(), SSL_read(), SSL_peek_ex() or SSL_peek().

                                                                                                                                                            If necessary, a read function will negotiate a TLS/SSL session, if not already explicitly performed by SSL_connect(3) or SSL_accept(3). If the peer requests a re-negotiation, it will be performed transparently during the read function operation. The behaviour of the read functions depends on the underlying BIO.

                                                                                                                                                            For the transparent negotiation to succeed, the ssl must have been initialized to client or server mode. This is being done by calling SSL_set_connect_state(3) or SSL_set_accept_state() before the first invocation of a read function.

                                                                                                                                                            The read functions work based on the SSL/TLS records. The data are received in records (with a maximum record size of 16kB). Only when a record has been completely received, can it be processed (decryption and check of integrity). Therefore, data that was not retrieved at the last read call can still be buffered inside the SSL layer and will be retrieved on the next read call. If num is higher than the number of bytes buffered then the read functions will return with the bytes buffered. If no more bytes are in the buffer, the read functions will trigger the processing of the next record. Only when the record has been received and processed completely will the read functions return reporting success. At most the contents of one record will be returned. As the size of an SSL/TLS record may exceed the maximum packet size of the underlying transport (e.g. TCP), it may be necessary to read several packets from the transport layer before the record is complete and the read call can succeed.

                                                                                                                                                            If SSL_MODE_AUTO_RETRY has been switched off and a non-application data record has been processed, the read function can return and set the error to SSL_ERROR_WANT_READ. In this case there might still be unprocessed data available in the BIO. If read ahead was set using SSL_CTX_set_read_ahead(3), there might also still be unprocessed data available in the SSL. This behaviour can be controlled using the SSL_CTX_set_mode(3) call.

                                                                                                                                                            If the underlying BIO is blocking, a read function will only return once the read operation has been finished or an error occurred, except when a non-application data record has been processed and SSL_MODE_AUTO_RETRY is not set. Note that if SSL_MODE_AUTO_RETRY is set and only non-application data is available the call will hang.

                                                                                                                                                            If the underlying BIO is nonblocking, a read function will also return when the underlying BIO could not satisfy the needs of the function to continue the operation. In this case a call to SSL_get_error(3) with the return value of the read function will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. As at any time it's possible that non-application data needs to be sent, a read function can also cause write operations. The calling process then must repeat the call after taking appropriate action to satisfy the needs of the read function. The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                                                                                                                                                            SSL_pending(3) can be used to find out whether there are buffered bytes available for immediate retrieval. In this case the read function can be called without blocking or actually receiving new data from the underlying socket.

                                                                                                                                                            "},{"location":"man3/SSL_read/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_read_ex() and SSL_peek_ex() will return 1 for success or 0 for failure. Success means that 1 or more application data bytes have been read from the SSL connection. Failure means that no bytes could be read from the SSL connection. Failures can be retryable (e.g. we are waiting for more bytes to be delivered by the network) or non-retryable (e.g. a fatal network error). In the event of a failure call SSL_get_error(3) to find out the reason which indicates whether the call is retryable or not.

                                                                                                                                                            For SSL_read() and SSL_peek() the following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The read operation was successful. The return value is the number of bytes actually read from the TLS/SSL connection.

                                                                                                                                                            • <= 0

                                                                                                                                                              The read operation was not successful, because either the connection was closed, an error occurred or action must be taken by the calling process. Call SSL_get_error(3) with the return value ret to find out the reason.

                                                                                                                                                              Old documentation indicated a difference between 0 and -1, and that -1 was retryable. You should instead call SSL_get_error() to find out if it's retryable.

                                                                                                                                                            "},{"location":"man3/SSL_read/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_error(3), SSL_write_ex(3), SSL_CTX_set_mode(3), SSL_CTX_new(3), SSL_connect(3), SSL_accept(3) SSL_set_connect_state(3), SSL_pending(3), SSL_shutdown(3), SSL_set_shutdown(3), ssl(7), bio(7)

                                                                                                                                                            "},{"location":"man3/SSL_read/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_read_ex() and SSL_peek_ex() functions were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_read/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/","title":"SSL_read_early_data","text":""},{"location":"man3/SSL_read_early_data/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_max_early_data, SSL_CTX_set_max_early_data, SSL_get_max_early_data, SSL_CTX_get_max_early_data, SSL_set_recv_max_early_data, SSL_CTX_set_recv_max_early_data, SSL_get_recv_max_early_data, SSL_CTX_get_recv_max_early_data, SSL_SESSION_get_max_early_data, SSL_SESSION_set_max_early_data, SSL_write_early_data, SSL_read_early_data, SSL_get_early_data_status, SSL_allow_early_data_cb_fn, SSL_CTX_set_allow_early_data_cb, SSL_set_allow_early_data_cb - functions for sending and receiving early data

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data);\nuint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx);\nint SSL_set_max_early_data(SSL *s, uint32_t max_early_data);\nuint32_t SSL_get_max_early_data(const SSL *s);\n\nint SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data);\nuint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx);\nint SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data);\nuint32_t SSL_get_recv_max_early_data(const SSL *s);\n\nuint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s);\nint SSL_SESSION_set_max_early_data(SSL_SESSION *s, uint32_t max_early_data);\n\nint SSL_write_early_data(SSL *s, const void *buf, size_t num, size_t *written);\n\nint SSL_read_early_data(SSL *s, void *buf, size_t num, size_t *readbytes);\n\nint SSL_get_early_data_status(const SSL *s);\n\n\ntypedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg);\n\nvoid SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx,\n                                     SSL_allow_early_data_cb_fn cb,\n                                     void *arg);\nvoid SSL_set_allow_early_data_cb(SSL *s,\n                                 SSL_allow_early_data_cb_fn cb,\n                                 void *arg);\n
                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions are used to send and receive early data where TLSv1.3 has been negotiated. Early data can be sent by the client immediately after its initial ClientHello without having to wait for the server to complete the handshake. Early data can be sent if a session has previously been established with the server or when establishing a new session using an out-of-band PSK, and only when the server is known to support it. Additionally these functions can be used to send data from the server to the client when the client has not yet completed the authentication stage of the handshake.

                                                                                                                                                            Early data has weaker security properties than other data sent over an SSL/TLS connection. In particular the data does not have forward secrecy. There are also additional considerations around replay attacks (see \"REPLAY PROTECTION\" below). For these reasons extreme care should be exercised when using early data. For specific details, consult the TLS 1.3 specification.

                                                                                                                                                            When a server receives early data it may opt to immediately respond by sending application data back to the client. Data sent by the server at this stage is done before the full handshake has been completed. Specifically the client's authentication messages have not yet been received, i.e. the client is unauthenticated at this point and care should be taken when using this capability.

                                                                                                                                                            A server or client can determine whether the full handshake has been completed or not by calling SSL_is_init_finished(3).

                                                                                                                                                            On the client side, the function SSL_SESSION_get_max_early_data() can be used to determine if a session established with a server can be used to send early data. If the session cannot be used then this function will return 0. Otherwise it will return the maximum number of early data bytes that can be sent.

                                                                                                                                                            The function SSL_SESSION_set_max_early_data() sets the maximum number of early data bytes that can be sent for a session. This would typically be used when creating a PSK session file (see SSL_CTX_set_psk_use_session_callback(3)). If using a ticket based PSK then this is set automatically to the value provided by the server.

                                                                                                                                                            A client uses the function SSL_write_early_data() to send early data. This function is similar to the SSL_write_ex(3) function, but with the following differences. See SSL_write_ex(3) for information on how to write bytes to the underlying connection, and how to handle any errors that may arise. This page describes the differences between SSL_write_early_data() and SSL_write_ex(3).

                                                                                                                                                            When called by a client, SSL_write_early_data() must be the first IO function called on a new connection, i.e. it must occur before any calls to SSL_write_ex(3), SSL_read_ex(3), SSL_connect(3), SSL_do_handshake(3) or other similar functions. It may be called multiple times to stream data to the server, but the total number of bytes written must not exceed the value returned from SSL_SESSION_get_max_early_data(). Once the initial SSL_write_early_data() call has completed successfully the client may interleave calls to SSL_read_ex(3) and SSL_read(3) with calls to SSL_write_early_data() as required.

                                                                                                                                                            If SSL_write_early_data() fails you should call SSL_get_error(3) to determine the correct course of action, as for SSL_write_ex(3).

                                                                                                                                                            When the client no longer wishes to send any more early data then it should complete the handshake by calling a function such as SSL_connect(3) or SSL_do_handshake(3). Alternatively you can call a standard write function such as SSL_write_ex(3), which will transparently complete the connection and write the requested data.

                                                                                                                                                            A server may choose to ignore early data that has been sent to it. Once the connection has been completed you can determine whether the server accepted or rejected the early data by calling SSL_get_early_data_status(). This will return SSL_EARLY_DATA_ACCEPTED if the data was accepted, SSL_EARLY_DATA_REJECTED if it was rejected or SSL_EARLY_DATA_NOT_SENT if no early data was sent. This function may be called by either the client or the server.

                                                                                                                                                            A server uses the SSL_read_early_data() function to receive early data on a connection for which early data has been enabled using SSL_CTX_set_max_early_data() or SSL_set_max_early_data(). As for SSL_write_early_data(), this must be the first IO function called on a connection, i.e. it must occur before any calls to SSL_write_ex(3), SSL_read_ex(3), SSL_accept(3), SSL_do_handshake(3), or other similar functions.

                                                                                                                                                            SSL_read_early_data() is similar to SSL_read_ex(3) with the following differences. Refer to SSL_read_ex(3) for full details.

                                                                                                                                                            SSL_read_early_data() may return 3 possible values:

                                                                                                                                                            • SSL_READ_EARLY_DATA_ERROR

                                                                                                                                                              This indicates an IO or some other error occurred. This should be treated in the same way as a 0 return value from SSL_read_ex(3).

                                                                                                                                                            • SSL_READ_EARLY_DATA_SUCCESS

                                                                                                                                                              This indicates that early data was successfully read. This should be treated in the same way as a 1 return value from SSL_read_ex(3). You should continue to call SSL_read_early_data() to read more data.

                                                                                                                                                            • SSL_READ_EARLY_DATA_FINISH

                                                                                                                                                              This indicates that no more early data can be read. It may be returned on the first call to SSL_read_early_data() if the client has not sent any early data, or if the early data was rejected.

                                                                                                                                                            Once the initial SSL_read_early_data() call has completed successfully (i.e. it has returned SSL_READ_EARLY_DATA_SUCCESS or SSL_READ_EARLY_DATA_FINISH) then the server may choose to write data immediately to the unauthenticated client using SSL_write_early_data(). If SSL_read_early_data() returned SSL_READ_EARLY_DATA_FINISH then in some situations (e.g. if the client only supports TLSv1.2) the handshake may have already been completed and calls to SSL_write_early_data() are not allowed. Call SSL_is_init_finished(3) to determine whether the handshake has completed or not. If the handshake is still in progress then the server may interleave calls to SSL_write_early_data() with calls to SSL_read_early_data() as required.

                                                                                                                                                            Servers must not call SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) or SSL_write(3) until SSL_read_early_data() has returned with SSL_READ_EARLY_DATA_FINISH. Once it has done so the connection to the client still needs to be completed. Complete the connection by calling a function such as SSL_accept(3) or SSL_do_handshake(3). Alternatively you can call a standard read function such as SSL_read_ex(3), which will transparently complete the connection and read the requested data. Note that it is an error to attempt to complete the connection before SSL_read_early_data() has returned SSL_READ_EARLY_DATA_FINISH.

                                                                                                                                                            Only servers may call SSL_read_early_data().

                                                                                                                                                            Calls to SSL_read_early_data() may, in certain circumstances, complete the connection immediately without further need to call a function such as SSL_accept(3). This can happen if the client is using a protocol version less than TLSv1.3. Applications can test for this by calling SSL_is_init_finished(3). Alternatively, applications may choose to call SSL_accept(3) anyway. Such a call will successfully return immediately with no further action taken.

                                                                                                                                                            When a session is created between a server and a client the server will specify the maximum amount of any early data that it will accept on any future connection attempt. By default the server does not accept early data; a server may indicate support for early data by calling SSL_CTX_set_max_early_data() or SSL_set_max_early_data() to set it for the whole SSL_CTX or an individual SSL object respectively. The max_early_data parameter specifies the maximum amount of early data in bytes that is permitted to be sent on a single connection. Similarly the SSL_CTX_get_max_early_data() and SSL_get_max_early_data() functions can be used to obtain the current maximum early data settings for the SSL_CTX and SSL objects respectively. Generally a server application will either use both of SSL_read_early_data() and SSL_CTX_set_max_early_data() (or SSL_set_max_early_data()), or neither of them, since there is no practical benefit from using only one of them. If the maximum early data setting for a server is nonzero then replay protection is automatically enabled (see \"REPLAY PROTECTION\" below).

                                                                                                                                                            If the server rejects the early data sent by a client then it will skip over the data that is sent. The maximum amount of received early data that is skipped is controlled by the recv_max_early_data setting. If a client sends more than this then the connection will abort. This value can be set by calling SSL_CTX_set_recv_max_early_data() or SSL_set_recv_max_early_data(). The current value for this setting can be obtained by calling SSL_CTX_get_recv_max_early_data() or SSL_get_recv_max_early_data(). The default value for this setting is 16,384 bytes.

                                                                                                                                                            The recv_max_early_data value also has an impact on early data that is accepted. The amount of data that is accepted will always be the lower of the max_early_data for the session and the recv_max_early_data setting for the server. If a client sends more data than this then the connection will abort.

                                                                                                                                                            The configured value for max_early_data on a server may change over time as required. However, clients may have tickets containing the previously configured max_early_data value. The recv_max_early_data should always be equal to or higher than any recently configured max_early_data value in order to avoid aborted connections. The recv_max_early_data should never be set to less than the current configured max_early_data value.

                                                                                                                                                            Some server applications may wish to have more control over whether early data is accepted or not, for example to mitigate replay risks (see \"REPLAY PROTECTION\" below) or to decline early_data when the server is heavily loaded. The functions SSL_CTX_set_allow_early_data_cb() and SSL_set_allow_early_data_cb() set a callback which is called at a point in the handshake immediately before a decision is made to accept or reject early data. The callback is provided with a pointer to the user data argument that was provided when the callback was first set. Returning 1 from the callback will allow early data and returning 0 will reject it. Note that the OpenSSL library may reject early data for other reasons in which case this callback will not get called. Notably, the built-in replay protection feature will still be used even if a callback is present unless it has been explicitly disabled using the SSL_OP_NO_ANTI_REPLAY option. See \"REPLAY PROTECTION\" below.

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#notes","title":"NOTES","text":"

                                                                                                                                                            The whole purpose of early data is to enable a client to start sending data to the server before a full round trip of network traffic has occurred. Application developers should ensure they consider optimisation of the underlying TCP socket to obtain a performant solution. For example Nagle's algorithm is commonly used by operating systems in an attempt to avoid lots of small TCP packets. In many scenarios this is beneficial for performance, but it does not work well with the early data solution as implemented in OpenSSL. In Nagle's algorithm the OS will buffer outgoing TCP data if a TCP packet has already been sent which we have not yet received an ACK for from the peer. The buffered data will only be transmitted if enough data to fill an entire TCP packet is accumulated, or if the ACK is received from the peer. The initial ClientHello will be sent in the first TCP packet along with any data from the first call to SSL_write_early_data(). If the amount of data written will exceed the size of a single TCP packet, or if there are more calls to SSL_write_early_data() then that additional data will be sent in subsequent TCP packets which will be buffered by the OS and not sent until an ACK is received for the first packet containing the ClientHello. This means the early data is not actually sent until a complete round trip with the server has occurred which defeats the objective of early data.

                                                                                                                                                            In many operating systems the TCP_NODELAY socket option is available to disable Nagle's algorithm. If an application opts to disable Nagle's algorithm consideration should be given to turning it back on again after the handshake is complete if appropriate.

                                                                                                                                                            In rare circumstances, it may be possible for a client to have a session that reports a max early data value greater than 0, but where the server does not support this. For example, this can occur if a server has had its configuration changed to accept a lower max early data value such as by calling SSL_CTX_set_recv_max_early_data(). Another example is if a server used to support TLSv1.3 but was later downgraded to TLSv1.2. Sending early data to such a server will cause the connection to abort. Clients that encounter an aborted connection while sending early data may want to retry the connection without sending early data as this does not happen automatically. A client will have to establish a new transport layer connection to the server and attempt the SSL/TLS connection again but without sending early data. Note that it is inadvisable to retry with a lower maximum protocol version.

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#replay-protection","title":"REPLAY PROTECTION","text":"

                                                                                                                                                            When early data is in use the TLS protocol provides no security guarantees that the same early data was not replayed across multiple connections. As a mitigation for this issue OpenSSL automatically enables replay protection if the server is configured with a nonzero max early data value. With replay protection enabled sessions are forced to be single use only. If a client attempts to reuse a session ticket more than once, then the second and subsequent attempts will fall back to a full handshake (and any early data that was submitted will be ignored). Note that single use tickets are enforced even if a client does not send any early data.

                                                                                                                                                            The replay protection mechanism relies on the internal OpenSSL server session cache (see SSL_CTX_set_session_cache_mode(3)). When replay protection is being used the server will operate as if the SSL_OP_NO_TICKET option had been selected (see SSL_CTX_set_options(3)). Sessions will be added to the cache whenever a session ticket is issued. When a client attempts to resume the session, OpenSSL will check for its presence in the internal cache. If it exists then the resumption is allowed and the session is removed from the cache. If it does not exist then the resumption is not allowed and a full handshake will occur.

                                                                                                                                                            Note that some applications may maintain an external cache of sessions (see SSL_CTX_sess_set_new_cb(3) and similar functions). It is the application's responsibility to ensure that any sessions in the external cache are also populated in the internal cache and that once removed from the internal cache they are similarly removed from the external cache. Failing to do this could result in an application becoming vulnerable to replay attacks. Note that OpenSSL will lock the internal cache while a session is removed but that lock is not held when the remove session callback (see SSL_CTX_sess_set_remove_cb(3)) is called. This could result in a small amount of time where the session has been removed from the internal cache but is still available in the external cache. Applications should be designed with this in mind in order to minimise the possibility of replay attacks.

                                                                                                                                                            The OpenSSL replay protection does not apply to external Pre Shared Keys (PSKs) (e.g. see SSL_CTX_set_psk_find_session_callback(3)). Therefore, extreme caution should be applied when combining external PSKs with early data.

                                                                                                                                                            Some applications may mitigate the replay risks in other ways. For those applications it is possible to turn off the built-in replay protection feature using the SSL_OP_NO_ANTI_REPLAY option. See SSL_CTX_set_options(3) for details. Applications can also set a callback to make decisions about accepting early data or not. See SSL_CTX_set_allow_early_data_cb() above for details.

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_write_early_data() returns 1 for success or 0 for failure. In the event of a failure call SSL_get_error(3) to determine the correct course of action.

                                                                                                                                                            SSL_read_early_data() returns SSL_READ_EARLY_DATA_ERROR for failure, SSL_READ_EARLY_DATA_SUCCESS for success with more data to read and SSL_READ_EARLY_DATA_FINISH for success with no more to data be read. In the event of a failure call SSL_get_error(3) to determine the correct course of action.

                                                                                                                                                            SSL_get_max_early_data(), SSL_CTX_get_max_early_data() and SSL_SESSION_get_max_early_data() return the maximum number of early data bytes that may be sent.

                                                                                                                                                            SSL_set_max_early_data(), SSL_CTX_set_max_early_data() and SSL_SESSION_set_max_early_data() return 1 for success or 0 for failure.

                                                                                                                                                            SSL_get_early_data_status() returns SSL_EARLY_DATA_ACCEPTED if early data was accepted by the server, SSL_EARLY_DATA_REJECTED if early data was rejected by the server, or SSL_EARLY_DATA_NOT_SENT if no early data was sent.

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_error(3), SSL_write_ex(3), SSL_read_ex(3), SSL_connect(3), SSL_accept(3), SSL_do_handshake(3), SSL_CTX_set_psk_use_session_callback(3), ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#history","title":"HISTORY","text":"

                                                                                                                                                            All of the functions described above were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_read_early_data/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_rstate_string/","title":"SSL_rstate_string","text":""},{"location":"man3/SSL_rstate_string/#name","title":"NAME","text":"

                                                                                                                                                            SSL_rstate_string, SSL_rstate_string_long - get textual description of state of an SSL object during read operation

                                                                                                                                                            "},{"location":"man3/SSL_rstate_string/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst char *SSL_rstate_string(SSL *ssl);\nconst char *SSL_rstate_string_long(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_rstate_string/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_rstate_string() returns a 2 letter string indicating the current read state of the SSL object ssl.

                                                                                                                                                            SSL_rstate_string_long() returns a string indicating the current read state of the SSL object ssl.

                                                                                                                                                            "},{"location":"man3/SSL_rstate_string/#notes","title":"NOTES","text":"

                                                                                                                                                            When performing a read operation, the SSL/TLS engine must parse the record, consisting of header and body. When working in a blocking environment, SSL_rstate_string[_long]() should always return \"RD\"/\"read done\".

                                                                                                                                                            This function should only seldom be needed in applications.

                                                                                                                                                            "},{"location":"man3/SSL_rstate_string/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_rstate_string() and SSL_rstate_string_long() can return the following values:

                                                                                                                                                            • \"RH\"/\"read header\"

                                                                                                                                                              The header of the record is being evaluated.

                                                                                                                                                            • \"RB\"/\"read body\"

                                                                                                                                                              The body of the record is being evaluated.

                                                                                                                                                            • \"RD\"/\"read done\"

                                                                                                                                                              The record has been completely processed.

                                                                                                                                                            • \"unknown\"/\"unknown\"

                                                                                                                                                              The read state is unknown. This should never happen.

                                                                                                                                                            "},{"location":"man3/SSL_rstate_string/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_rstate_string/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_session_reused/","title":"SSL_session_reused","text":""},{"location":"man3/SSL_session_reused/#name","title":"NAME","text":"

                                                                                                                                                            SSL_session_reused - query whether a reused session was negotiated during handshake

                                                                                                                                                            "},{"location":"man3/SSL_session_reused/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_session_reused(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_session_reused/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            Query, whether a reused session was negotiated during the handshake.

                                                                                                                                                            "},{"location":"man3/SSL_session_reused/#notes","title":"NOTES","text":"

                                                                                                                                                            During the negotiation, a client can propose to reuse a session. The server then looks up the session in its cache. If both client and server agree on the session, it will be reused and a flag is being set that can be queried by the application.

                                                                                                                                                            "},{"location":"man3/SSL_session_reused/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              A new session was negotiated.

                                                                                                                                                            • 1

                                                                                                                                                              A session was reused.

                                                                                                                                                            "},{"location":"man3/SSL_session_reused/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_set_session(3), SSL_CTX_set_session_cache_mode(3)

                                                                                                                                                            "},{"location":"man3/SSL_session_reused/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set1_host/","title":"SSL_set1_host","text":""},{"location":"man3/SSL_set1_host/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set1_host, SSL_add1_host, SSL_set_hostflags, SSL_get0_peername - SSL server verification parameters

                                                                                                                                                            "},{"location":"man3/SSL_set1_host/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_set1_host(SSL *s, const char *hostname);\nint SSL_add1_host(SSL *s, const char *hostname);\nvoid SSL_set_hostflags(SSL *s, unsigned int flags);\nconst char *SSL_get0_peername(SSL *s);\n
                                                                                                                                                            "},{"location":"man3/SSL_set1_host/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions configure server hostname checks in the SSL client.

                                                                                                                                                            SSL_set1_host() sets the expected DNS hostname to name clearing any previously specified hostname. If name is NULL or the empty string, the list of hostnames is cleared and name checks are not performed on the peer certificate. When a nonempty name is specified, certificate verification automatically checks the peer hostname via X509_check_host(3) with flags as specified via SSL_set_hostflags(). Clients that enable DANE TLSA authentication via SSL_dane_enable(3) should leave it to that function to set the primary reference identifier of the peer, and should not call SSL_set1_host().

                                                                                                                                                            SSL_add1_host() adds name as an additional reference identifier that can match the peer's certificate. Any previous names set via SSL_set1_host() or SSL_add1_host() are retained, no change is made if name is NULL or empty. When multiple names are configured, the peer is considered verified when any name matches. This function is required for DANE TLSA in the presence of service name indirection via CNAME, MX or SRV records as specified in RFC7671, RFC7672 or RFC7673.

                                                                                                                                                            SSL_set_hostflags() sets the flags that will be passed to X509_check_host(3) when name checks are applicable, by default the flags value is 0. See X509_check_host(3) for the list of available flags and their meaning.

                                                                                                                                                            SSL_get0_peername() returns the DNS hostname or subject CommonName from the peer certificate that matched one of the reference identifiers. When wildcard matching is not disabled, the name matched in the peer certificate may be a wildcard name. When one of the reference identifiers configured via SSL_set1_host() or SSL_add1_host() starts with \".\", which indicates a parent domain prefix rather than a fixed name, the matched peer name may be a sub-domain of the reference identifier. The returned string is allocated by the library and is no longer valid once the associated ssl handle is cleared or freed, or a renegotiation takes place. Applications must not free the return value.

                                                                                                                                                            SSL clients are advised to use these functions in preference to explicitly calling X509_check_host(3). Hostname checks may be out of scope with the RFC7671 DANE-EE(3) certificate usage, and the internal check will be suppressed as appropriate when DANE is enabled.

                                                                                                                                                            "},{"location":"man3/SSL_set1_host/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_set1_host() and SSL_add1_host() return 1 for success and 0 for failure.

                                                                                                                                                            SSL_get0_peername() returns NULL if peername verification is not applicable (as with RFC7671 DANE-EE(3)), or no trusted peername was matched. Otherwise, it returns the matched peername. To determine whether verification succeeded call SSL_get_verify_result(3).

                                                                                                                                                            "},{"location":"man3/SSL_set1_host/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Suppose \"smtp.example.com\" is the MX host of the domain \"example.com\". The calls below will arrange to match either the MX hostname or the destination domain name in the SMTP server certificate. Wildcards are supported, but must match the entire label. The actual name matched in the certificate (which might be a wildcard) is retrieved, and must be copied by the application if it is to be retained beyond the lifetime of the SSL connection.

                                                                                                                                                            SSL_set_hostflags(ssl, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);\nif (!SSL_set1_host(ssl, \"smtp.example.com\"))\n    /* error */\nif (!SSL_add1_host(ssl, \"example.com\"))\n    /* error */\n\n/* XXX: Perform SSL_connect() handshake and handle errors here */\n\nif (SSL_get_verify_result(ssl) == X509_V_OK) {\n    const char *peername = SSL_get0_peername(ssl);\n\n    if (peername != NULL)\n        /* Name checks were in scope and matched the peername */\n}\n
                                                                                                                                                            "},{"location":"man3/SSL_set1_host/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), X509_check_host(3), SSL_get_verify_result(3). SSL_dane_enable(3).

                                                                                                                                                            "},{"location":"man3/SSL_set1_host/#history","title":"HISTORY","text":"

                                                                                                                                                            These functions were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_set1_host/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_async_callback/","title":"SSL_set_async_callback","text":""},{"location":"man3/SSL_set_async_callback/#name","title":"NAME","text":"

                                                                                                                                                            SSL_CTX_set_async_callback, SSL_CTX_set_async_callback_arg, SSL_set_async_callback, SSL_set_async_callback_arg, SSL_get_async_status, SSL_async_callback_fn - manage asynchronous operations

                                                                                                                                                            "},{"location":"man3/SSL_set_async_callback/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\ntypedef int (*SSL_async_callback_fn)(SSL *s, void *arg);\nint SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback);\nint SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg);\nint SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback);\nint SSL_set_async_callback_arg(SSL *s, void *arg);\nint SSL_get_async_status(SSL *s, int *status);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_async_callback/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_CTX_set_async_callback() sets an asynchronous callback function. All SSL objects generated based on this SSL_CTX will get this callback. If an engine supports the callback mechanism, it will be automatically called if SSL_MODE_ASYNC has been set and an asynchronous capable engine completes a cryptography operation to notify the application to resume the paused work flow.

                                                                                                                                                            SSL_CTX_set_async_callback_arg() sets the callback argument.

                                                                                                                                                            SSL_set_async_callback() allows an application to set a callback in an asynchronous SSL object, so that when an engine completes a cryptography operation, the callback will be called to notify the application to resume the paused work flow.

                                                                                                                                                            SSL_set_async_callback_arg() sets an argument for the SSL object when the above callback is called.

                                                                                                                                                            SSL_get_async_status() returns the engine status. This function facilitates the communication from the engine to the application. During an SSL session, cryptographic operations are dispatched to an engine. The engine status is very useful for an application to know if the operation has been successfully dispatched. If the engine does not support this additional callback method, ASYNC_STATUS_UNSUPPORTED will be returned. See ASYNC_WAIT_CTX_set_status() for a description of all of the status values.

                                                                                                                                                            An example of the above functions would be the following:

                                                                                                                                                            1. Application sets the async callback and callback data on an SSL connection by calling SSL_set_async_callback().
                                                                                                                                                            2. Application sets SSL_MODE_ASYNC and makes an asynchronous SSL call
                                                                                                                                                            3. OpenSSL submits the asynchronous request to the engine. If a retry occurs at this point then the status within the ASYNC_WAIT_CTX would be set and the async callback function would be called (goto Step 7).
                                                                                                                                                            4. The OpenSSL engine pauses the current job and returns, so that the application can continue processing other connections.
                                                                                                                                                            5. At a future point in time (probably via a polling mechanism or via an interrupt) the engine will become aware that the asynchronous request has finished processing.
                                                                                                                                                            6. The engine will call the application's callback passing the callback data as a parameter.
                                                                                                                                                            7. The callback function should then run. Note: it is a requirement that the callback function is small and nonblocking as it will be run in the context of a polling mechanism or an interrupt.
                                                                                                                                                            8. It is the application's responsibility via the callback function to schedule recalling the OpenSSL asynchronous function and to continue processing.
                                                                                                                                                            9. The callback function has the option to check the status returned via SSL_get_async_status() to determine whether a retry happened instead of the request being submitted, allowing different processing if required.
                                                                                                                                                            "},{"location":"man3/SSL_set_async_callback/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_CTX_set_async_callback(), SSL_set_async_callback(), SSL_CTX_set_async_callback_arg(), SSL_CTX_set_async_callback_arg() and SSL_get_async_status() return 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/SSL_set_async_callback/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7)

                                                                                                                                                            "},{"location":"man3/SSL_set_async_callback/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_CTX_set_async_callback(), SSL_CTX_set_async_callback_arg(), SSL_set_async_callback(), SSL_set_async_callback_arg() and SSL_get_async_status() were first added to OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/SSL_set_async_callback/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_bio/","title":"SSL_set_bio","text":""},{"location":"man3/SSL_set_bio/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with a BIO

                                                                                                                                                            "},{"location":"man3/SSL_set_bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);\nvoid SSL_set0_rbio(SSL *s, BIO *rbio);\nvoid SSL_set0_wbio(SSL *s, BIO *wbio);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_set0_rbio() connects the BIO rbio for the read operations of the ssl object. The SSL engine inherits the behaviour of rbio. If the BIO is nonblocking then the ssl object will also have nonblocking behaviour. This function transfers ownership of rbio to ssl. It will be automatically freed using BIO_free_all(3) when the ssl is freed. On calling this function, any existing rbio that was previously set will also be freed via a call to BIO_free_all(3) (this includes the case where the rbio is set to the same value as previously).

                                                                                                                                                            SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it connects the BIO wbio for the write operations of the ssl object. Note that if the rbio and wbio are the same then SSL_set0_rbio() and SSL_set0_wbio() each take ownership of one reference. Therefore, it may be necessary to increment the number of references available using BIO_up_ref(3) before calling the set0 functions.

                                                                                                                                                            SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except that it connects both the rbio and the wbio at the same time, and transfers the ownership of rbio and wbio to ssl according to the following set of rules:

                                                                                                                                                            • If neither the rbio or wbio have changed from their previous values then nothing is done.
                                                                                                                                                            • If the rbio and wbio parameters are different and both are different to their previously set values then one reference is consumed for the rbio and one reference is consumed for the wbio.
                                                                                                                                                            • If the rbio and wbio parameters are the same and the rbio is not the same as the previously set value then one reference is consumed.
                                                                                                                                                            • If the rbio and wbio parameters are the same and the rbio is the same as the previously set value, then no additional references are consumed.
                                                                                                                                                            • If the rbio and wbio parameters are different and the rbio is the same as the previously set value then one reference is consumed for the wbio and no references are consumed for the rbio.
                                                                                                                                                            • If the rbio and wbio parameters are different and the wbio is the same as the previously set value and the old rbio and wbio values were the same as each other then one reference is consumed for the rbio and no references are consumed for the wbio.
                                                                                                                                                            • If the rbio and wbio parameters are different and the wbio is the same as the previously set value and the old rbio and wbio values were different to each other, then one reference is consumed for the rbio and one reference is consumed for the wbio.

                                                                                                                                                            Because of this complexity, this function should be avoided; use SSL_set0_rbio() and SSL_set0_wbio() instead.

                                                                                                                                                            "},{"location":"man3/SSL_set_bio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_set_bio(), SSL_set0_rbio() and SSL_set0_wbio() cannot fail.

                                                                                                                                                            "},{"location":"man3/SSL_set_bio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_rbio(3), SSL_connect(3), SSL_accept(3), SSL_shutdown(3), ssl(7), bio(7)

                                                                                                                                                            "},{"location":"man3/SSL_set_bio/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/SSL_set_bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_connect_state/","title":"SSL_set_connect_state","text":""},{"location":"man3/SSL_set_connect_state/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_connect_state, SSL_set_accept_state, SSL_is_server - functions for manipulating and examining the client or server mode of an SSL object

                                                                                                                                                            "},{"location":"man3/SSL_set_connect_state/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_set_connect_state(SSL *ssl);\n\nvoid SSL_set_accept_state(SSL *ssl);\n\nint SSL_is_server(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_connect_state/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_set_connect_state() sets ssl to work in client mode.

                                                                                                                                                            SSL_set_accept_state() sets ssl to work in server mode.

                                                                                                                                                            SSL_is_server() checks if ssl is working in server mode.

                                                                                                                                                            "},{"location":"man3/SSL_set_connect_state/#notes","title":"NOTES","text":"

                                                                                                                                                            When the SSL_CTX object was created with SSL_CTX_new(3), it was either assigned a dedicated client method, a dedicated server method, or a generic method, that can be used for both client and server connections. (The method might have been changed with SSL_CTX_set_ssl_version(3) or SSL_set_ssl_method(3).)

                                                                                                                                                            When beginning a new handshake, the SSL engine must know whether it must call the connect (client) or accept (server) routines. Even though it may be clear from the method chosen, whether client or server mode was requested, the handshake routines must be explicitly set.

                                                                                                                                                            When using the SSL_connect(3) or SSL_accept(3) routines, the correct handshake routines are automatically set. When performing a transparent negotiation using SSL_write_ex(3), SSL_write(3), SSL_read_ex(3), or SSL_read(3), the handshake routines must be explicitly set in advance using either SSL_set_connect_state() or SSL_set_accept_state().

                                                                                                                                                            If SSL_is_server() is called before SSL_set_connect_state() or SSL_set_accept_state() is called (either automatically or explicitly), the result depends on what method was used when SSL_CTX was created with SSL_CTX_new(3). If a generic method or a dedicated server method was passed to SSL_CTX_new(3), SSL_is_server() returns 1; otherwise, it returns 0.

                                                                                                                                                            "},{"location":"man3/SSL_set_connect_state/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_set_connect_state() and SSL_set_accept_state() do not return diagnostic information.

                                                                                                                                                            SSL_is_server() returns 1 if ssl is working in server mode or 0 for client mode.

                                                                                                                                                            "},{"location":"man3/SSL_set_connect_state/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_new(3), SSL_CTX_new(3), SSL_connect(3), SSL_accept(3), SSL_write_ex(3), SSL_write(3), SSL_read_ex(3), SSL_read(3), SSL_do_handshake(3), SSL_CTX_set_ssl_version(3)

                                                                                                                                                            "},{"location":"man3/SSL_set_connect_state/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_fd/","title":"SSL_set_fd","text":""},{"location":"man3/SSL_set_fd/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_fd, SSL_set_rfd, SSL_set_wfd - connect the SSL object with a file descriptor

                                                                                                                                                            "},{"location":"man3/SSL_set_fd/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_set_fd(SSL *ssl, int fd);\nint SSL_set_rfd(SSL *ssl, int fd);\nint SSL_set_wfd(SSL *ssl, int fd);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_fd/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_set_fd() sets the file descriptor fd as the input/output facility for the TLS/SSL (encrypted) side of ssl. fd will typically be the socket file descriptor of a network connection.

                                                                                                                                                            When performing the operation, a socket BIO is automatically created to interface between the ssl and fd. The BIO and hence the SSL engine inherit the behaviour of fd. If fd is nonblocking, the ssl will also have nonblocking behaviour.

                                                                                                                                                            If there was already a BIO connected to ssl, BIO_free() will be called (for both the reading and writing side, if different).

                                                                                                                                                            SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only for the read channel or the write channel, which can be set independently.

                                                                                                                                                            "},{"location":"man3/SSL_set_fd/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The operation failed. Check the error stack to find out why.

                                                                                                                                                            • 1

                                                                                                                                                              The operation succeeded.

                                                                                                                                                            "},{"location":"man3/SSL_set_fd/#notes","title":"NOTES","text":"

                                                                                                                                                            On Windows, a socket handle is a 64-bit data type (UINT_PTR), which leads to a compiler warning (conversion from 'SOCKET' to 'int', possible loss of data) when passing the socket handle to SSL_set_*fd(). For the time being, this warning can safely be ignored, because although the Microsoft documentation claims that the upper limit is INVALID_SOCKET-1 (2^64 - 2), in practice the current socket() implementation returns an index into the kernel handle table, the size of which is limited to 2^24.

                                                                                                                                                            "},{"location":"man3/SSL_set_fd/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_fd(3), SSL_set_bio(3), SSL_connect(3), SSL_accept(3), SSL_shutdown(3), ssl(7) , bio(7)

                                                                                                                                                            "},{"location":"man3/SSL_set_fd/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/","title":"SSL_set_retry_verify","text":""},{"location":"man3/SSL_set_retry_verify/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_retry_verify - indicate that certificate verification should be retried

                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_set_retry_verify(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_set_retry_verify() should be called from the certificate verification callback on a client when the application wants to indicate that the handshake should be suspended and the control should be returned to the application. SSL_want_retry_verify(3) will return 1 as a consequence until the handshake is resumed again by the application, retrying the verification step.

                                                                                                                                                            Please refer to SSL_CTX_set_cert_verify_callback(3) for further details.

                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#notes","title":"NOTES","text":"

                                                                                                                                                            The effect of calling SSL_set_retry_verify() outside of the certificate verification callback on the client side is undefined.

                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_set_retry verify() returns 1 on success, 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            The following code snippet shows how to obtain the SSL object associated with the X509_STORE_CTX to call the SSL_set_retry_verify() function:

                                                                                                                                                            int idx = SSL_get_ex_data_X509_STORE_CTX_idx();\nSSL *ssl;\n\n/* this should not happen but check anyway */\nif (idx < 0\n    || (ssl = X509_STORE_CTX_get_ex_data(ctx, idx)) == NULL) \n    return 0;\n\nif (/* we need to retry verification callback */)\n    return SSL_set_retry_verify(ssl);\n\n/* do normal processing of the verification callback */\n
                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_connect(3), SSL_CTX_set_cert_verify_callback(3), SSL_want_retry_verify(3)

                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#history","title":"HISTORY","text":"

                                                                                                                                                            SSL_set_retry_verify() was added in OpenSSL 3.0.2 to replace backwards incompatible handling of a negative return value from the verification callback.

                                                                                                                                                            "},{"location":"man3/SSL_set_retry_verify/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_session/","title":"SSL_set_session","text":""},{"location":"man3/SSL_set_session/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect

                                                                                                                                                            "},{"location":"man3/SSL_set_session/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_set_session(SSL *ssl, SSL_SESSION *session);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_session/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_set_session() sets session to be used when the TLS/SSL connection is to be established. SSL_set_session() is only useful for TLS/SSL clients. When the session is set, the reference count of session is incremented by 1. If the session is not reused, the reference count is decremented again during SSL_connect(). Whether the session was reused can be queried with the SSL_session_reused(3) call.

                                                                                                                                                            If there is already a session set inside ssl (because it was set with SSL_set_session() before or because the same ssl was already used for a connection), SSL_SESSION_free() will be called for that session. This is also the case when session is a NULL pointer. If that old session is still open, it is considered bad and will be removed from the session cache (if used). A session is considered open, if SSL_shutdown(3) was not called for the connection (or at least SSL_set_shutdown(3) was used to set the SSL_SENT_SHUTDOWN state).

                                                                                                                                                            "},{"location":"man3/SSL_set_session/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object).

                                                                                                                                                            "},{"location":"man3/SSL_set_session/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The operation failed; check the error stack to find out the reason.

                                                                                                                                                            • 1

                                                                                                                                                              The operation succeeded.

                                                                                                                                                            "},{"location":"man3/SSL_set_session/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_SESSION_free(3), SSL_get_session(3), SSL_session_reused(3), SSL_CTX_set_session_cache_mode(3)

                                                                                                                                                            "},{"location":"man3/SSL_set_session/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_shutdown/","title":"SSL_set_shutdown","text":""},{"location":"man3/SSL_set_shutdown/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL connection

                                                                                                                                                            "},{"location":"man3/SSL_set_shutdown/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_set_shutdown(SSL *ssl, int mode);\n\nint SSL_get_shutdown(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_shutdown/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_set_shutdown() sets the shutdown state of ssl to mode.

                                                                                                                                                            SSL_get_shutdown() returns the shutdown mode of ssl.

                                                                                                                                                            "},{"location":"man3/SSL_set_shutdown/#notes","title":"NOTES","text":"

                                                                                                                                                            The shutdown state of an ssl connection is a bit-mask of:

                                                                                                                                                            • 0

                                                                                                                                                              No shutdown setting, yet.

                                                                                                                                                            • SSL_SENT_SHUTDOWN

                                                                                                                                                              A close_notify shutdown alert was sent to the peer, the connection is being considered closed and the session is closed and correct.

                                                                                                                                                            • SSL_RECEIVED_SHUTDOWN

                                                                                                                                                              A shutdown alert was received form the peer, either a normal close_notify or a fatal error.

                                                                                                                                                            SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time.

                                                                                                                                                            The shutdown state of the connection is used to determine the state of the ssl session. If the session is still open, when SSL_clear(3) or SSL_free(3) is called, it is considered bad and removed according to RFC2246. The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN (according to the TLS RFC, it is acceptable to only send the close_notify alert but to not wait for the peer's answer, when the underlying connection is closed). SSL_set_shutdown() can be used to set this state without sending a close alert to the peer (see SSL_shutdown(3)).

                                                                                                                                                            If a close_notify was received, SSL_RECEIVED_SHUTDOWN will be set, for setting SSL_SENT_SHUTDOWN the application must however still call SSL_shutdown(3) or SSL_set_shutdown() itself.

                                                                                                                                                            "},{"location":"man3/SSL_set_shutdown/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_set_shutdown() does not return diagnostic information.

                                                                                                                                                            SSL_get_shutdown() returns the current setting.

                                                                                                                                                            "},{"location":"man3/SSL_set_shutdown/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_shutdown(3), SSL_CTX_set_quiet_shutdown(3), SSL_clear(3), SSL_free(3)

                                                                                                                                                            "},{"location":"man3/SSL_set_shutdown/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_set_verify_result/","title":"SSL_set_verify_result","text":""},{"location":"man3/SSL_set_verify_result/#name","title":"NAME","text":"

                                                                                                                                                            SSL_set_verify_result - override result of peer certificate verification

                                                                                                                                                            "},{"location":"man3/SSL_set_verify_result/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nvoid SSL_set_verify_result(SSL *ssl, long verify_result);\n
                                                                                                                                                            "},{"location":"man3/SSL_set_verify_result/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_set_verify_result() sets verify_result of the object ssl to be the result of the verification of the X509 certificate presented by the peer, if any.

                                                                                                                                                            "},{"location":"man3/SSL_set_verify_result/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_set_verify_result() overrides the verification result. It only changes the verification result of the ssl object. It does not become part of the established session, so if the session is to be reused later, the original value will reappear.

                                                                                                                                                            The valid codes for verify_result are documented in openssl-verify(1).

                                                                                                                                                            "},{"location":"man3/SSL_set_verify_result/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_set_verify_result() does not provide a return value.

                                                                                                                                                            "},{"location":"man3/SSL_set_verify_result/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_verify_result(3), SSL_get_peer_certificate(3), openssl-verify(1)

                                                                                                                                                            "},{"location":"man3/SSL_set_verify_result/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_shutdown/","title":"SSL_shutdown","text":""},{"location":"man3/SSL_shutdown/#name","title":"NAME","text":"

                                                                                                                                                            SSL_shutdown - shut down a TLS/SSL connection

                                                                                                                                                            "},{"location":"man3/SSL_shutdown/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_shutdown(SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_shutdown/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_shutdown() shuts down an active TLS/SSL connection. It sends the close_notify shutdown alert to the peer.

                                                                                                                                                            SSL_shutdown() tries to send the close_notify shutdown alert to the peer. Whether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and a currently open session is considered closed and good and will be kept in the session cache for further reuse.

                                                                                                                                                            Note that SSL_shutdown() must not be called if a previous fatal error has occurred on a connection i.e. if SSL_get_error() has returned SSL_ERROR_SYSCALL or SSL_ERROR_SSL.

                                                                                                                                                            The shutdown procedure consists of two steps: sending of the close_notify shutdown alert, and reception of the peer's close_notify shutdown alert. The order of those two steps depends on the application.

                                                                                                                                                            It is acceptable for an application to only send its shutdown alert and then close the underlying connection without waiting for the peer's response. This way resources can be saved, as the process can already terminate or serve another connection. This should only be done when it is known that the other side will not send more data, otherwise there is a risk of a truncation attack.

                                                                                                                                                            When a client only writes and never reads from the connection, and the server has sent a session ticket to establish a session, the client might not be able to resume the session because it did not received and process the session ticket from the server. In case the application wants to be able to resume the session, it is recommended to do a complete shutdown procedure (bidirectional close_notify alerts).

                                                                                                                                                            When the underlying connection shall be used for more communications, the complete shutdown procedure must be performed, so that the peers stay synchronized.

                                                                                                                                                            SSL_shutdown() only closes the write direction. It is not possible to call SSL_write() after calling SSL_shutdown(). The read direction is closed by the peer.

                                                                                                                                                            The behaviour of SSL_shutdown() additionally depends on the underlying BIO. If the underlying BIO is blocking, SSL_shutdown() will only return once the handshake step has been finished or an error occurred.

                                                                                                                                                            If the underlying BIO is nonblocking, SSL_shutdown() will also return when the underlying BIO could not satisfy the needs of SSL_shutdown() to continue the handshake. In this case a call to SSL_get_error() with the return value of SSL_shutdown() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_shutdown(). The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                                                                                                                                                            After SSL_shutdown() returned 0, it is possible to call SSL_shutdown() again to wait for the peer's close_notify alert. SSL_shutdown() will return 1 in that case. However, it is recommended to wait for it using SSL_read() instead.

                                                                                                                                                            SSL_shutdown() can be modified to only set the connection to \"shutdown\" state but not actually send the close_notify alert messages, see SSL_CTX_set_quiet_shutdown(3). When \"quiet shutdown\" is enabled, SSL_shutdown() will always succeed and return 1. Note that this is not standard compliant behaviour. It should only be done when the peer has a way to make sure all data has been received and doesn't wait for the close_notify alert message, otherwise an unexpected EOF will be reported.

                                                                                                                                                            There are implementations that do not send the required close_notify alert. If there is a need to communicate with such an implementation, and it's clear that all data has been received, do not wait for the peer's close_notify alert. Waiting for the close_notify alert when the peer just closes the connection will result in an error being generated. The error can be ignored using the SSL_OP_IGNORE_UNEXPECTED_EOF. For more information see SSL_CTX_set_options(3).

                                                                                                                                                            "},{"location":"man3/SSL_shutdown/#first-to-close-the-connection","title":"First to close the connection","text":"

                                                                                                                                                            When the application is the first party to send the close_notify alert, SSL_shutdown() will only send the alert and then set the SSL_SENT_SHUTDOWN flag (so that the session is considered good and will be kept in the cache). If successful, SSL_shutdown() will return 0.

                                                                                                                                                            If a unidirectional shutdown is enough (the underlying connection shall be closed anyway), this first successful call to SSL_shutdown() is sufficient.

                                                                                                                                                            In order to complete the bidirectional shutdown handshake, the peer needs to send back a close_notify alert. The SSL_RECEIVED_SHUTDOWN flag will be set after receiving and processing it.

                                                                                                                                                            The peer is still allowed to send data after receiving the close_notify event. When it is done sending data, it will send the close_notify alert. SSL_read() should be called until all data is received. SSL_read() will indicate the end of the peer data by returning <= 0 and SSL_get_error() returning SSL_ERROR_ZERO_RETURN.

                                                                                                                                                            "},{"location":"man3/SSL_shutdown/#peer-closes-the-connection","title":"Peer closes the connection","text":"

                                                                                                                                                            If the peer already sent the close_notify alert and it was already processed implicitly inside another function (SSL_read(3)), the SSL_RECEIVED_SHUTDOWN flag is set. SSL_read() will return <= 0 in that case, and SSL_get_error() will return SSL_ERROR_ZERO_RETURN. SSL_shutdown() will send the close_notify alert, set the SSL_SENT_SHUTDOWN flag. If successful, SSL_shutdown() will return 1.

                                                                                                                                                            Whether SSL_RECEIVED_SHUTDOWN is already set can be checked using the SSL_get_shutdown() (see also SSL_set_shutdown(3) call.

                                                                                                                                                            "},{"location":"man3/SSL_shutdown/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The shutdown is not yet finished: the close_notify was sent but the peer did not send it back yet. Call SSL_read() to do a bidirectional shutdown.

                                                                                                                                                              Unlike most other function, returning 0 does not indicate an error. SSL_get_error(3) should not get called, it may misleadingly indicate an error even though no error occurred.

                                                                                                                                                            • 1

                                                                                                                                                              The shutdown was successfully completed. The close_notify alert was sent and the peer's close_notify alert was received.

                                                                                                                                                            • <0

                                                                                                                                                              The shutdown was not successful. Call SSL_get_error(3) with the return value ret to find out the reason. It can occur if an action is needed to continue the operation for nonblocking BIOs.

                                                                                                                                                              It can also occur when not all data was read using SSL_read().

                                                                                                                                                            "},{"location":"man3/SSL_shutdown/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_error(3), SSL_connect(3), SSL_accept(3), SSL_set_shutdown(3), SSL_CTX_set_quiet_shutdown(3), SSL_CTX_set_options(3) SSL_clear(3), SSL_free(3), ssl(7), bio(7)

                                                                                                                                                            "},{"location":"man3/SSL_shutdown/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_state_string/","title":"SSL_state_string","text":""},{"location":"man3/SSL_state_string/#name","title":"NAME","text":"

                                                                                                                                                            SSL_state_string, SSL_state_string_long - get textual description of state of an SSL object

                                                                                                                                                            "},{"location":"man3/SSL_state_string/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nconst char *SSL_state_string(const SSL *ssl);\nconst char *SSL_state_string_long(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_state_string/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_state_string() returns an abbreviated string indicating the current state of the SSL object ssl. The returned NUL-terminated string contains 6 or fewer characters.

                                                                                                                                                            SSL_state_string_long() returns a descriptive string indicating the current state of the SSL object ssl.

                                                                                                                                                            "},{"location":"man3/SSL_state_string/#notes","title":"NOTES","text":"

                                                                                                                                                            During its use, an SSL objects passes several states. The state is internally maintained. Querying the state information is not very informative before or when a connection has been established. It however can be of significant interest during the handshake.

                                                                                                                                                            When using nonblocking sockets, the function call performing the handshake may return with SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition, so that SSL_state_string[_long]() may be called.

                                                                                                                                                            For both blocking or nonblocking sockets, the details state information can be used within the info_callback function set with the SSL_set_info_callback() call.

                                                                                                                                                            "},{"location":"man3/SSL_state_string/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            Detailed description of possible states to be included later.

                                                                                                                                                            "},{"location":"man3/SSL_state_string/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_CTX_set_info_callback(3)

                                                                                                                                                            "},{"location":"man3/SSL_state_string/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_want/","title":"SSL_want","text":""},{"location":"man3/SSL_want/#name","title":"NAME","text":"

                                                                                                                                                            SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup, SSL_want_retry_verify, SSL_want_async, SSL_want_async_job, SSL_want_client_hello_cb - obtain state information TLS/SSL I/O operation

                                                                                                                                                            "},{"location":"man3/SSL_want/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nint SSL_want(const SSL *ssl);\nint SSL_want_nothing(const SSL *ssl);\nint SSL_want_read(const SSL *ssl);\nint SSL_want_write(const SSL *ssl);\nint SSL_want_x509_lookup(const SSL *ssl);\nint SSL_want_retry_verify(const SSL *ssl);\nint SSL_want_async(const SSL *ssl);\nint SSL_want_async_job(const SSL *ssl);\nint SSL_want_client_hello_cb(const SSL *ssl);\n
                                                                                                                                                            "},{"location":"man3/SSL_want/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_want() returns state information for the SSL object ssl.

                                                                                                                                                            The other SSL_want_*() calls are shortcuts for the possible states returned by SSL_want().

                                                                                                                                                            "},{"location":"man3/SSL_want/#notes","title":"NOTES","text":"

                                                                                                                                                            SSL_want() examines the internal state information of the SSL object. Its return values are similar to that of SSL_get_error(3). Unlike SSL_get_error(3), which also evaluates the error queue, the results are obtained by examining an internal state flag only. The information must therefore only be used for normal operation under nonblocking I/O. Error conditions are not handled and must be treated using SSL_get_error(3).

                                                                                                                                                            The result returned by SSL_want() should always be consistent with the result of SSL_get_error(3).

                                                                                                                                                            "},{"location":"man3/SSL_want/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The following return values can currently occur for SSL_want():

                                                                                                                                                            • SSL_NOTHING

                                                                                                                                                              There is no data to be written or to be read.

                                                                                                                                                            • SSL_WRITING

                                                                                                                                                              There are data in the SSL buffer that must be written to the underlying BIO layer in order to complete the actual SSL_*() operation. A call to SSL_get_error(3) should return SSL_ERROR_WANT_WRITE.

                                                                                                                                                            • SSL_READING

                                                                                                                                                              More data must be read from the underlying BIO layer in order to complete the actual SSL_*() operation. A call to SSL_get_error(3) should return SSL_ERROR_WANT_READ.

                                                                                                                                                            • SSL_X509_LOOKUP

                                                                                                                                                              The operation did not complete because an application callback set by SSL_CTX_set_client_cert_cb() has asked to be called again. A call to SSL_get_error(3) should return SSL_ERROR_WANT_X509_LOOKUP.

                                                                                                                                                            • SSL_RETRY_VERIFY

                                                                                                                                                              The operation did not complete because a certificate verification callback has asked to be called again via SSL_set_retry_verify(3). A call to SSL_get_error(3) should return SSL_ERROR_WANT_RETRY_VERIFY.

                                                                                                                                                            • SSL_ASYNC_PAUSED

                                                                                                                                                              An asynchronous operation partially completed and was then paused. See SSL_get_all_async_fds(3). A call to SSL_get_error(3) should return SSL_ERROR_WANT_ASYNC.

                                                                                                                                                            • SSL_ASYNC_NO_JOBS

                                                                                                                                                              The asynchronous job could not be started because there were no async jobs available in the pool (see ASYNC_init_thread(3)). A call to SSL_get_error(3) should return SSL_ERROR_WANT_ASYNC_JOB.

                                                                                                                                                            • SSL_CLIENT_HELLO_CB

                                                                                                                                                              The operation did not complete because an application callback set by SSL_CTX_set_client_hello_cb() has asked to be called again. A call to SSL_get_error(3) should return SSL_ERROR_WANT_CLIENT_HELLO_CB.

                                                                                                                                                            SSL_want_nothing(), SSL_want_read(), SSL_want_write(), SSL_want_x509_lookup(), SSL_want_retry_verify(), SSL_want_async(), SSL_want_async_job(), and SSL_want_client_hello_cb() return 1 when the corresponding condition is true or 0 otherwise.

                                                                                                                                                            "},{"location":"man3/SSL_want/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_get_error(3)

                                                                                                                                                            "},{"location":"man3/SSL_want/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_want_client_hello_cb() function and the SSL_CLIENT_HELLO_CB return value were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/SSL_want/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/SSL_write/","title":"SSL_write","text":""},{"location":"man3/SSL_write/#name","title":"NAME","text":"

                                                                                                                                                            SSL_write_ex, SSL_write, SSL_sendfile - write bytes to a TLS/SSL connection

                                                                                                                                                            "},{"location":"man3/SSL_write/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size, int flags);\nint SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written);\nint SSL_write(SSL *ssl, const void *buf, int num);\n
                                                                                                                                                            "},{"location":"man3/SSL_write/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            SSL_write_ex() and SSL_write() write num bytes from the buffer buf into the specified ssl connection. On success SSL_write_ex() will store the number of bytes written in *written.

                                                                                                                                                            SSL_sendfile() writes size bytes from offset offset in the file descriptor fd to the specified SSL connection s. This function provides efficient zero-copy semantics. SSL_sendfile() is available only when Kernel TLS is enabled, which can be checked by calling BIO_get_ktls_send(). It is provided here to allow users to maintain the same interface. The meaning of flags is platform dependent. Currently, under Linux it is ignored.

                                                                                                                                                            "},{"location":"man3/SSL_write/#notes","title":"NOTES","text":"

                                                                                                                                                            In the paragraphs below a \"write function\" is defined as one of either SSL_write_ex(), or SSL_write().

                                                                                                                                                            If necessary, a write function will negotiate a TLS/SSL session, if not already explicitly performed by SSL_connect(3) or SSL_accept(3). If the peer requests a re-negotiation, it will be performed transparently during the write function operation. The behaviour of the write functions depends on the underlying BIO.

                                                                                                                                                            For the transparent negotiation to succeed, the ssl must have been initialized to client or server mode. This is being done by calling SSL_set_connect_state(3) or SSL_set_accept_state() before the first call to a write function.

                                                                                                                                                            If the underlying BIO is blocking, the write functions will only return, once the write operation has been finished or an error occurred.

                                                                                                                                                            If the underlying BIO is nonblocking the write functions will also return when the underlying BIO could not satisfy the needs of the function to continue the operation. In this case a call to SSL_get_error(3) with the return value of the write function will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. As at any time a re-negotiation is possible, a call to a write function can also cause read operations! The calling process then must repeat the call after taking appropriate action to satisfy the needs of the write function. The action depends on the underlying BIO. When using a nonblocking socket, nothing is to be done, but select() can be used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue.

                                                                                                                                                            The write functions will only return with success when the complete contents of buf of length num has been written. This default behaviour can be changed with the SSL_MODE_ENABLE_PARTIAL_WRITE option of SSL_CTX_set_mode(3). When this flag is set the write functions will also return with success when a partial write has been successfully completed. In this case the write function operation is considered completed. The bytes are sent and a new write call with a new buffer (with the already sent bytes removed) must be started. A partial write is performed with the size of a message block, which is 16kB.

                                                                                                                                                            "},{"location":"man3/SSL_write/#warnings","title":"WARNINGS","text":"

                                                                                                                                                            When a write function call has to be repeated because SSL_get_error(3) returned SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE, it must be repeated with the same arguments. The data that was passed might have been partially processed. When SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER was set using SSL_CTX_set_mode(3) the pointer can be different, but the data and length should still be the same.

                                                                                                                                                            You should not call SSL_write() with num=0, it will return an error. SSL_write_ex() can be called with num=0, but will not send application data to the peer.

                                                                                                                                                            "},{"location":"man3/SSL_write/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            SSL_write_ex() will return 1 for success or 0 for failure. Success means that all requested application data bytes have been written to the SSL connection or, if SSL_MODE_ENABLE_PARTIAL_WRITE is in use, at least 1 application data byte has been written to the SSL connection. Failure means that not all the requested bytes have been written yet (if SSL_MODE_ENABLE_PARTIAL_WRITE is not in use) or no bytes could be written to the SSL connection (if SSL_MODE_ENABLE_PARTIAL_WRITE is in use). Failures can be retryable (e.g. the network write buffer has temporarily filled up) or non-retryable (e.g. a fatal network error). In the event of a failure call SSL_get_error(3) to find out the reason which indicates whether the call is retryable or not.

                                                                                                                                                            For SSL_write() the following return values can occur:

                                                                                                                                                            • 0

                                                                                                                                                              The write operation was successful, the return value is the number of bytes actually written to the TLS/SSL connection.

                                                                                                                                                            • <= 0

                                                                                                                                                              The write operation was not successful, because either the connection was closed, an error occurred or action must be taken by the calling process. Call SSL_get_error() with the return value ret to find out the reason.

                                                                                                                                                              Old documentation indicated a difference between 0 and -1, and that -1 was retryable. You should instead call SSL_get_error() to find out if it's retryable.

                                                                                                                                                            For SSL_sendfile(), the following return values can occur:

                                                                                                                                                            • = 0

                                                                                                                                                              The write operation was successful, the return value is the number of bytes of the file written to the TLS/SSL connection. The return value can be less than size for a partial write.

                                                                                                                                                            • < 0

                                                                                                                                                              The write operation was not successful, because either the connection was closed, an error occurred or action must be taken by the calling process. Call SSL_get_error() with the return value to find out the reason.

                                                                                                                                                            "},{"location":"man3/SSL_write/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_error(3), SSL_read_ex(3), SSL_read(3) SSL_CTX_set_mode(3), SSL_CTX_new(3), SSL_connect(3), SSL_accept(3) SSL_set_connect_state(3), BIO_ctrl(3), ssl(7), bio(7)

                                                                                                                                                            "},{"location":"man3/SSL_write/#history","title":"HISTORY","text":"

                                                                                                                                                            The SSL_write_ex() function was added in OpenSSL 1.1.1. The SSL_sendfile() function was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/SSL_write/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/TS_RESP_CTX_new/","title":"TS_RESP_CTX_new","text":""},{"location":"man3/TS_RESP_CTX_new/#name","title":"NAME","text":"

                                                                                                                                                            TS_RESP_CTX_new_ex, TS_RESP_CTX_new, TS_RESP_CTX_free - Timestamp response context object creation

                                                                                                                                                            "},{"location":"man3/TS_RESP_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ts.h>\n\nTS_RESP_CTX *TS_RESP_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nTS_RESP_CTX *TS_RESP_CTX_new(void);\nvoid TS_RESP_CTX_free(TS_RESP_CTX *ctx);\n
                                                                                                                                                            "},{"location":"man3/TS_RESP_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            Creates a response context that can be used for generating responses.

                                                                                                                                                            TS_RESP_CTX_new_ex() allocates and initializes a TS_RESP_CTX structure with a library context of libctx and a property query of propq. The library context and property query can be used to select which providers supply the fetched algorithms.

                                                                                                                                                            TS_RESP_CTX_new() is similar to TS_RESP_CTX_new_ex() but sets the library context and property query to NULL. This results in the default (NULL) library context being used for any operations requiring algorithm fetches.

                                                                                                                                                            TS_RESP_CTX_free() frees the TS_RESP_CTX object ctx. If the argument is NULL, nothing is done.

                                                                                                                                                            "},{"location":"man3/TS_RESP_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            If the allocation fails, TS_RESP_CTX_new_ex() and TS_RESP_CTX_new() return NULL, otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                                            "},{"location":"man3/TS_RESP_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                                            The function TS_RESP_CTX_new_ex() was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/TS_RESP_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/TS_VERIFY_CTX_set_certs/","title":"TS_VERIFY_CTX_set_certs","text":""},{"location":"man3/TS_VERIFY_CTX_set_certs/#name","title":"NAME","text":"

                                                                                                                                                            TS_VERIFY_CTX_set_certs, TS_VERIFY_CTS_set_certs - set certificates for TS response verification

                                                                                                                                                            "},{"location":"man3/TS_VERIFY_CTX_set_certs/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ts.h>\n\nSTACK_OF(X509) *TS_VERIFY_CTX_set_certs(TS_VERIFY_CTX *ctx,\n                                        STACK_OF(X509) *certs);\nSTACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx,\n                                        STACK_OF(X509) *certs);\n
                                                                                                                                                            "},{"location":"man3/TS_VERIFY_CTX_set_certs/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The Time-Stamp Protocol (TSP) is defined by RFC 3161. TSP is a protocol used to provide long term proof of the existence of a certain datum before a particular time. TSP defines a Time Stamping Authority (TSA) and an entity who shall make requests to the TSA. Usually the TSA is denoted as the server side and the requesting entity is denoted as the client.

                                                                                                                                                            In TSP, when a server is sending a response to a client, the server normally needs to sign the response data - the TimeStampToken (TST) - with its private key. Then the client shall verify the received TST by the server's certificate chain.

                                                                                                                                                            TS_VERIFY_CTX_set_certs() is used to set the server's certificate chain when verifying a TST. ctx is the verification context created in advance and certs is a stack of X509 certificates.

                                                                                                                                                            TS_VERIFY_CTS_set_certs() is a misspelled version of TS_VERIFY_CTX_set_certs() which takes the same parameters and returns the same result.

                                                                                                                                                            "},{"location":"man3/TS_VERIFY_CTX_set_certs/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            TS_VERIFY_CTX_set_certs() returns the stack of X509 certificates the user passes in via parameter certs.

                                                                                                                                                            "},{"location":"man3/TS_VERIFY_CTX_set_certs/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            OSSL_ESS_check_signing_certs(3)

                                                                                                                                                            "},{"location":"man3/TS_VERIFY_CTX_set_certs/#history","title":"HISTORY","text":"

                                                                                                                                                            The spelling of TS_VERIFY_CTX_set_certs() was corrected in OpenSSL 3.0.0. The misspelled version TS_VERIFY_CTS_set_certs() has been retained for compatibility reasons, but it is deprecated in OpenSSL 3.0.0.

                                                                                                                                                            "},{"location":"man3/TS_VERIFY_CTX_set_certs/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/UI_STRING/","title":"UI_STRING","text":""},{"location":"man3/UI_STRING/#name","title":"NAME","text":"

                                                                                                                                                            UI_STRING, UI_string_types, UI_get_string_type, UI_get_input_flags, UI_get0_output_string, UI_get0_action_string, UI_get0_result_string, UI_get_result_string_length, UI_get0_test_string, UI_get_result_minsize, UI_get_result_maxsize, UI_set_result, UI_set_result_ex - User interface string parsing

                                                                                                                                                            "},{"location":"man3/UI_STRING/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ui.h>\n\ntypedef struct ui_string_st UI_STRING;\n\nenum UI_string_types {\n    UIT_NONE = 0,\n    UIT_PROMPT,                 /* Prompt for a string */\n    UIT_VERIFY,                 /* Prompt for a string and verify */\n    UIT_BOOLEAN,                /* Prompt for a yes/no response */\n    UIT_INFO,                   /* Send info to the user */\n    UIT_ERROR                   /* Send an error message to the user */\n};\n\nenum UI_string_types UI_get_string_type(UI_STRING *uis);\nint UI_get_input_flags(UI_STRING *uis);\nconst char *UI_get0_output_string(UI_STRING *uis);\nconst char *UI_get0_action_string(UI_STRING *uis);\nconst char *UI_get0_result_string(UI_STRING *uis);\nint UI_get_result_string_length(UI_STRING *uis);\nconst char *UI_get0_test_string(UI_STRING *uis);\nint UI_get_result_minsize(UI_STRING *uis);\nint UI_get_result_maxsize(UI_STRING *uis);\nint UI_set_result(UI *ui, UI_STRING *uis, const char *result);\nint UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);\n
                                                                                                                                                            "},{"location":"man3/UI_STRING/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The UI_STRING gets created internally and added to a UI whenever one of the functions UI_add_input_string(), UI_dup_input_string(), UI_add_verify_string(), UI_dup_verify_string(), UI_add_input_boolean(), UI_dup_input_boolean(), UI_add_info_string(), UI_dup_info_string(), UI_add_error_string() or UI_dup_error_string() is called. For a UI_METHOD user, there's no need to know more. For a UI_METHOD creator, it is of interest to fetch text from these UI_STRING objects as well as adding results to some of them.

                                                                                                                                                            UI_get_string_type() is used to retrieve the type of the given UI_STRING.

                                                                                                                                                            UI_get_input_flags() is used to retrieve the flags associated with the given UI_STRING.

                                                                                                                                                            UI_get0_output_string() is used to retrieve the actual string to output (prompt, info, error, ...).

                                                                                                                                                            UI_get0_action_string() is used to retrieve the action description associated with a UIT_BOOLEAN type UI_STRING. For all other UI_STRING types, NULL is returned. See UI_add_input_boolean(3).

                                                                                                                                                            UI_get0_result_string() and UI_get_result_string_length() are used to retrieve the result of a prompt and its length. This is only useful for UIT_PROMPT and UIT_VERIFY type strings. For all other UI_STRING types, UI_get0_result_string() returns NULL and UI_get_result_string_length() returns -1.

                                                                                                                                                            UI_get0_test_string() is used to retrieve the string to compare the prompt result with. This is only useful for UIT_VERIFY type strings. For all other UI_STRING types, NULL is returned.

                                                                                                                                                            UI_get_result_minsize() and UI_get_result_maxsize() are used to retrieve the minimum and maximum required size of the result. This is only useful for UIT_PROMPT and UIT_VERIFY type strings. For all other UI_STRING types, -1 is returned.

                                                                                                                                                            UI_set_result_ex() is used to set the result value of a prompt and its length. For UIT_PROMPT and UIT_VERIFY type UI strings, this sets the result retrievable with UI_get0_result_string() by copying the contents of result if its length fits the minimum and maximum size requirements. For UIT_BOOLEAN type UI strings, this sets the first character of the result retrievable with UI_get0_result_string() to the first ok_char given with UI_add_input_boolean() or UI_dup_input_boolean() if the result matched any of them, or the first of the cancel_chars if the result matched any of them, otherwise it's set to the NUL char \\0. See UI_add_input_boolean(3) for more information on ok_chars and cancel_chars.

                                                                                                                                                            UI_set_result() does the same thing as UI_set_result_ex(), but calculates its length internally. It expects the string to be terminated with a NUL byte, and is therefore only useful with normal C strings.

                                                                                                                                                            "},{"location":"man3/UI_STRING/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            UI_get_string_type() returns the UI string type.

                                                                                                                                                            UI_get_input_flags() returns the UI string flags.

                                                                                                                                                            UI_get0_output_string() returns the UI string output string.

                                                                                                                                                            UI_get0_action_string() returns the UI string action description string for UIT_BOOLEAN type UI strings, NULL for any other type.

                                                                                                                                                            UI_get0_result_string() returns the UI string result buffer for UIT_PROMPT and UIT_VERIFY type UI strings, NULL for any other type.

                                                                                                                                                            UI_get_result_string_length() returns the UI string result buffer's content length for UIT_PROMPT and UIT_VERIFY type UI strings, -1 for any other type.

                                                                                                                                                            UI_get0_test_string() returns the UI string action description string for UIT_VERIFY type UI strings, NULL for any other type.

                                                                                                                                                            UI_get_result_minsize() returns the minimum allowed result size for the UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other type.

                                                                                                                                                            UI_get_result_maxsize() returns the minimum allowed result size for the UI string for UIT_PROMPT and UIT_VERIFY type strings, -1 for any other type.

                                                                                                                                                            UI_set_result() returns 0 on success or when the UI string is of any type other than UIT_PROMPT, UIT_VERIFY or UIT_BOOLEAN, -1 on error.

                                                                                                                                                            "},{"location":"man3/UI_STRING/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            UI(3)

                                                                                                                                                            "},{"location":"man3/UI_STRING/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/UI_UTIL_read_pw/","title":"UI_UTIL_read_pw","text":""},{"location":"man3/UI_UTIL_read_pw/#name","title":"NAME","text":"

                                                                                                                                                            UI_UTIL_read_pw_string, UI_UTIL_read_pw, UI_UTIL_wrap_read_pem_callback - user interface utilities

                                                                                                                                                            "},{"location":"man3/UI_UTIL_read_pw/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ui.h>\n\nint UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,\n                           int verify);\nint UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,\n                    int verify);\nUI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag);\n
                                                                                                                                                            "},{"location":"man3/UI_UTIL_read_pw/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            UI_UTIL_read_pw_string() asks for a passphrase, using prompt as a prompt, and stores it in buf. The maximum allowed size is given with length, including the terminating NUL byte. If verify is nonzero, the password will be verified as well.

                                                                                                                                                            UI_UTIL_read_pw() does the same as UI_UTIL_read_pw_string(), the difference is that you can give it an external buffer buff for the verification passphrase.

                                                                                                                                                            UI_UTIL_wrap_read_pem_callback() can be used to create a temporary UI_METHOD that wraps a given PEM password callback cb. rwflag is used to specify if this method will be used for passphrase entry without (0) or with (1) verification. When not used any more, the returned method should be freed with UI_destroy_method().

                                                                                                                                                            "},{"location":"man3/UI_UTIL_read_pw/#notes","title":"NOTES","text":"

                                                                                                                                                            UI_UTIL_read_pw_string() and UI_UTIL_read_pw() use default UI_METHOD. See UI_get_default_method(3) and friends for more information.

                                                                                                                                                            The result from the UI_METHOD created by UI_UTIL_wrap_read_pem_callback() will generate password strings in the encoding that the given password callback generates. The default password prompting functions (apart from UI_UTIL_read_pw_string() and UI_UTIL_read_pw(), there is PEM_def_callback(), EVP_read_pw_string() and EVP_read_pw_string_min()) all use the default UI_METHOD.

                                                                                                                                                            "},{"location":"man3/UI_UTIL_read_pw/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            UI_UTIL_read_pw_string() and UI_UTIL_read_pw() return 0 on success or a negative value on error.

                                                                                                                                                            UI_UTIL_wrap_read_pem_callback() returns a valid UI_METHOD structure or NULL if an error occurred.

                                                                                                                                                            "},{"location":"man3/UI_UTIL_read_pw/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            UI_get_default_method(3)

                                                                                                                                                            "},{"location":"man3/UI_UTIL_read_pw/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/UI_create_method/","title":"UI_create_method","text":""},{"location":"man3/UI_create_method/#name","title":"NAME","text":"

                                                                                                                                                            UI_METHOD, UI_create_method, UI_destroy_method, UI_method_set_opener, UI_method_set_writer, UI_method_set_flusher, UI_method_set_reader, UI_method_set_closer, UI_method_set_data_duplicator, UI_method_set_prompt_constructor, UI_method_set_ex_data, UI_method_get_opener, UI_method_get_writer, UI_method_get_flusher, UI_method_get_reader, UI_method_get_closer, UI_method_get_data_duplicator, UI_method_get_data_destructor, UI_method_get_prompt_constructor, UI_method_get_ex_data - user interface method creation and destruction

                                                                                                                                                            "},{"location":"man3/UI_create_method/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ui.h>\n\ntypedef struct ui_method_st UI_METHOD;\n\nUI_METHOD *UI_create_method(const char *name);\nvoid UI_destroy_method(UI_METHOD *ui_method);\nint UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui));\nint UI_method_set_writer(UI_METHOD *method,\n                         int (*writer) (UI *ui, UI_STRING *uis));\nint UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui));\nint UI_method_set_reader(UI_METHOD *method,\n                         int (*reader) (UI *ui, UI_STRING *uis));\nint UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui));\nint UI_method_set_data_duplicator(UI_METHOD *method,\n                                  void *(*duplicator) (UI *ui, void *ui_data),\n                                  void (*destructor)(UI *ui, void *ui_data));\nint UI_method_set_prompt_constructor(UI_METHOD *method,\n                                     char *(*prompt_constructor) (UI *ui,\n                                                                  const char\n                                                                  *object_desc,\n                                                                  const char\n                                                                  *object_name));\nint UI_method_set_ex_data(UI_METHOD *method, int idx, void *data);\nint (*UI_method_get_opener(const UI_METHOD *method)) (UI *);\nint (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *);\nint (*UI_method_get_flusher(const UI_METHOD *method)) (UI *);\nint (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *);\nint (*UI_method_get_closer(const UI_METHOD *method)) (UI *);\nchar *(*UI_method_get_prompt_constructor(const UI_METHOD *method))\n    (UI *, const char *, const char *);\nvoid *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *);\nvoid (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *);\nconst void *UI_method_get_ex_data(const UI_METHOD *method, int idx);\n
                                                                                                                                                            "},{"location":"man3/UI_create_method/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            A method contains a few functions that implement the low-level of the User Interface. These functions are:

                                                                                                                                                            • an opener

                                                                                                                                                              This function takes a reference to a UI and starts a session, for example by opening a channel to a tty, or by creating a dialog box.

                                                                                                                                                            • a writer

                                                                                                                                                              This function takes a reference to a UI and a UI String, and writes the string where appropriate, maybe to the tty, maybe added as a field label in a dialog box. Note that this gets fed all strings associated with a UI, one after the other, so care must be taken which ones it actually uses.

                                                                                                                                                            • a flusher

                                                                                                                                                              This function takes a reference to a UI, and flushes everything that has been output so far. For example, if the method builds up a dialog box, this can be used to actually display it and accepting input ended with a pressed button.

                                                                                                                                                            • a reader

                                                                                                                                                              This function takes a reference to a UI and a UI string and reads off the given prompt, maybe from the tty, maybe from a field in a dialog box. Note that this gets fed all strings associated with a UI, one after the other, so care must be taken which ones it actually uses.

                                                                                                                                                            • a closer

                                                                                                                                                              This function takes a reference to a UI, and closes the session, maybe by closing the channel to the tty, maybe by destroying a dialog box.

                                                                                                                                                            All of these functions are expected to return 0 on error, 1 on success, or -1 on out-off-band events, for example if some prompting has been cancelled (by pressing Ctrl-C, for example). Only the flusher or the reader are expected to return -1. If returned by another of the functions, it's treated as if 0 was returned.

                                                                                                                                                            Regarding the writer and the reader, don't assume the former should only write and don't assume the latter should only read. This depends on the needs of the method.

                                                                                                                                                            For example, a typical tty reader wouldn't write the prompts in the write, but would rather do so in the reader, because of the sequential nature of prompting on a tty. This is how the UI_OpenSSL() method does it.

                                                                                                                                                            In contrast, a method that builds up a dialog box would add all prompt text in the writer, have all input read in the flusher and store the results in some temporary buffer, and finally have the reader just fetch those results.

                                                                                                                                                            The central function that uses these method functions is UI_process(), and it does it in five steps:

                                                                                                                                                            1. Open the session using the opener function if that one's defined. If an error occurs, jump to 5.
                                                                                                                                                            2. For every UI String associated with the UI, call the writer function if that one's defined. If an error occurs, jump to 5.
                                                                                                                                                            3. Flush everything using the flusher function if that one's defined. If an error occurs, jump to 5.
                                                                                                                                                            4. For every UI String associated with the UI, call the reader function if that one's defined. If an error occurs, jump to 5.
                                                                                                                                                            5. Close the session using the closer function if that one's defined.

                                                                                                                                                            UI_create_method() creates a new UI method with a given name.

                                                                                                                                                            UI_destroy_method() destroys the given UI method ui_method.

                                                                                                                                                            UI_method_set_opener(), UI_method_set_writer(), UI_method_set_flusher(), UI_method_set_reader() and UI_method_set_closer() set the five main method function to the given function pointer.

                                                                                                                                                            UI_method_set_data_duplicator() sets the user data duplicator and destructor. See UI_dup_user_data(3).

                                                                                                                                                            UI_method_set_prompt_constructor() sets the prompt constructor. See UI_construct_prompt(3).

                                                                                                                                                            UI_method_set_ex_data() sets application specific data with a given EX_DATA index. See CRYPTO_get_ex_new_index(3) for general information on how to get that index.

                                                                                                                                                            UI_method_get_opener(), UI_method_get_writer(), UI_method_get_flusher(), UI_method_get_reader(), UI_method_get_closer(), UI_method_get_data_duplicator(), UI_method_get_data_destructor() and UI_method_get_prompt_constructor() return the different method functions.

                                                                                                                                                            UI_method_get_ex_data() returns the application data previously stored with UI_method_set_ex_data().

                                                                                                                                                            "},{"location":"man3/UI_create_method/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            UI_create_method() returns a UI_METHOD pointer on success, NULL on error.

                                                                                                                                                            UI_method_set_opener(), UI_method_set_writer(), UI_method_set_flusher(), UI_method_set_reader(), UI_method_set_closer(), UI_method_set_data_duplicator() and UI_method_set_prompt_constructor() return 0 on success, -1 if the given method is NULL.

                                                                                                                                                            UI_method_set_ex_data() returns 1 on success and 0 on error (because CRYPTO_set_ex_data() does so).

                                                                                                                                                            UI_method_get_opener(), UI_method_get_writer(), UI_method_get_flusher(), UI_method_get_reader(), UI_method_get_closer(), UI_method_get_data_duplicator(), UI_method_get_data_destructor() and UI_method_get_prompt_constructor() return the requested function pointer if it's set in the method, otherwise NULL.

                                                                                                                                                            UI_method_get_ex_data() returns a pointer to the application specific data associated with the method.

                                                                                                                                                            "},{"location":"man3/UI_create_method/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            UI(3), CRYPTO_get_ex_data(3), UI_STRING(3)

                                                                                                                                                            "},{"location":"man3/UI_create_method/#history","title":"HISTORY","text":"

                                                                                                                                                            The UI_method_set_data_duplicator(), UI_method_get_data_duplicator() and UI_method_get_data_destructor() functions were added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/UI_create_method/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/UI_new/","title":"UI_new","text":""},{"location":"man3/UI_new/#name","title":"NAME","text":"

                                                                                                                                                            UI, UI_new, UI_new_method, UI_free, UI_add_input_string, UI_dup_input_string, UI_add_verify_string, UI_dup_verify_string, UI_add_input_boolean, UI_dup_input_boolean, UI_add_info_string, UI_dup_info_string, UI_add_error_string, UI_dup_error_string, UI_construct_prompt, UI_add_user_data, UI_dup_user_data, UI_get0_user_data, UI_get0_result, UI_get_result_length, UI_process, UI_ctrl, UI_set_default_method, UI_get_default_method, UI_get_method, UI_set_method, UI_OpenSSL, UI_null - user interface

                                                                                                                                                            "},{"location":"man3/UI_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ui.h>\n\ntypedef struct ui_st UI;\n\nUI *UI_new(void);\nUI *UI_new_method(const UI_METHOD *method);\nvoid UI_free(UI *ui);\n\nint UI_add_input_string(UI *ui, const char *prompt, int flags,\n                        char *result_buf, int minsize, int maxsize);\nint UI_dup_input_string(UI *ui, const char *prompt, int flags,\n                        char *result_buf, int minsize, int maxsize);\nint UI_add_verify_string(UI *ui, const char *prompt, int flags,\n                         char *result_buf, int minsize, int maxsize,\n                         const char *test_buf);\nint UI_dup_verify_string(UI *ui, const char *prompt, int flags,\n                         char *result_buf, int minsize, int maxsize,\n                         const char *test_buf);\nint UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,\n                         const char *ok_chars, const char *cancel_chars,\n                         int flags, char *result_buf);\nint UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,\n                         const char *ok_chars, const char *cancel_chars,\n                         int flags, char *result_buf);\nint UI_add_info_string(UI *ui, const char *text);\nint UI_dup_info_string(UI *ui, const char *text);\nint UI_add_error_string(UI *ui, const char *text);\nint UI_dup_error_string(UI *ui, const char *text);\n\nchar *UI_construct_prompt(UI *ui_method,\n                          const char *phrase_desc, const char *object_name);\n\nvoid *UI_add_user_data(UI *ui, void *user_data);\nint UI_dup_user_data(UI *ui, void *user_data);\nvoid *UI_get0_user_data(UI *ui);\n\nconst char *UI_get0_result(UI *ui, int i);\nint UI_get_result_length(UI *ui, int i);\n\nint UI_process(UI *ui);\n\nint UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)());\n\nvoid UI_set_default_method(const UI_METHOD *meth);\nconst UI_METHOD *UI_get_default_method(void);\nconst UI_METHOD *UI_get_method(UI *ui);\nconst UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);\n\nUI_METHOD *UI_OpenSSL(void);\nconst UI_METHOD *UI_null(void);\n
                                                                                                                                                            "},{"location":"man3/UI_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            UI stands for User Interface, and is general purpose set of routines to prompt the user for text-based information. Through user-written methods (see UI_create_method(3)), prompting can be done in any way imaginable, be it plain text prompting, through dialog boxes or from a cell phone.

                                                                                                                                                            All the functions work through a context of the type UI. This context contains all the information needed to prompt correctly as well as a reference to a UI_METHOD, which is an ordered vector of functions that carry out the actual prompting.

                                                                                                                                                            The first thing to do is to create a UI with UI_new() or UI_new_method(), then add information to it with the UI_add or UI_dup functions. Also, user-defined random data can be passed down to the underlying method through calls to UI_add_user_data() or UI_dup_user_data(). The default UI method doesn't care about these data, but other methods might. Finally, use UI_process() to actually perform the prompting and UI_get0_result() and UI_get_result_length() to find the result to the prompt and its length.

                                                                                                                                                            A UI can contain more than one prompt, which are performed in the given sequence. Each prompt gets an index number which is returned by the UI_add and UI_dup functions, and has to be used to get the corresponding result with UI_get0_result() and UI_get_result_length().

                                                                                                                                                            UI_process() can be called more than once on the same UI, thereby allowing a UI to have a long lifetime, but can just as well have a short lifetime.

                                                                                                                                                            The functions are as follows:

                                                                                                                                                            UI_new() creates a new UI using the default UI method. When done with this UI, it should be freed using UI_free().

                                                                                                                                                            UI_new_method() creates a new UI using the given UI method. When done with this UI, it should be freed using UI_free().

                                                                                                                                                            UI_OpenSSL() returns the built-in UI method (note: not necessarily the default one, since the default can be changed. See further on). This method is the most machine/OS dependent part of OpenSSL and normally generates the most problems when porting.

                                                                                                                                                            UI_null() returns a UI method that does nothing. Its use is to avoid getting internal defaults for passed UI_METHOD pointers.

                                                                                                                                                            UI_free() removes a UI from memory, along with all other pieces of memory that's connected to it, like duplicated input strings, results and others. If ui is NULL nothing is done.

                                                                                                                                                            UI_add_input_string() and UI_add_verify_string() add a prompt to the UI, as well as flags and a result buffer and the desired minimum and maximum sizes of the result, not counting the final NUL character. The given information is used to prompt for information, for example a password, and to verify a password (i.e. having the user enter it twice and check that the same string was entered twice). UI_add_verify_string() takes and extra argument that should be a pointer to the result buffer of the input string that it's supposed to verify, or verification will fail.

                                                                                                                                                            UI_add_input_boolean() adds a prompt to the UI that's supposed to be answered in a boolean way, with a single character for yes and a different character for no. A set of characters that can be used to cancel the prompt is given as well. The prompt itself is divided in two, one part being the descriptive text (given through the prompt argument) and one describing the possible answers (given through the action_desc argument).

                                                                                                                                                            UI_add_info_string() and UI_add_error_string() add strings that are shown at the same time as the prompt for extra information or to show an error string. The difference between the two is only conceptual. With the built-in method, there's no technical difference between them. Other methods may make a difference between them, however.

                                                                                                                                                            The flags currently supported are UI_INPUT_FLAG_ECHO, which is relevant for UI_add_input_string() and will have the users response be echoed (when prompting for a password, this flag should obviously not be used, and UI_INPUT_FLAG_DEFAULT_PWD, which means that a default password of some sort will be used (completely depending on the application and the UI method).

                                                                                                                                                            UI_dup_input_string(), UI_dup_verify_string(), UI_dup_input_boolean(), UI_dup_info_string() and UI_dup_error_string() are basically the same as their UI_add counterparts, except that they make their own copies of all strings.

                                                                                                                                                            UI_construct_prompt() is a helper function that can be used to create a prompt from two pieces of information: a phrase description phrase_desc and an object name object_name, where the latter may be NULL. The default constructor (if there is none provided by the method used) creates a string \"Enter phrase_desc for object_name:\" where the \" for object_name\" part is left out if object_name is NULL. With the description \"pass phrase\" and the filename \"foo.key\", that becomes \"Enter pass phrase for foo.key:\". Other methods may create whatever string and may include encodings that will be processed by the other method functions.

                                                                                                                                                            UI_add_user_data() adds a user data pointer for the method to use at any time. The built-in UI method doesn't care about this info. Note that several calls to this function doesn't add data, it replaces the previous blob with the one given as argument.

                                                                                                                                                            UI_dup_user_data() duplicates the user data and works as an alternative to UI_add_user_data() when the user data needs to be preserved for a longer duration, perhaps even the lifetime of the application. The UI object takes ownership of this duplicate and will free it whenever it gets replaced or the UI is destroyed. UI_dup_user_data() returns 0 on success, or -1 on memory allocation failure or if the method doesn't have a duplicator function.

                                                                                                                                                            UI_get0_user_data() retrieves the data that has last been given to the UI with UI_add_user_data() or UI_dup_user_data.

                                                                                                                                                            UI_get0_result() returns a pointer to the result buffer associated with the information indexed by i.

                                                                                                                                                            UI_get_result_length() returns the length of the result buffer associated with the information indexed by i.

                                                                                                                                                            UI_process() goes through the information given so far, does all the printing and prompting and returns the final status, which is -2 on out-of-band events (Interrupt, Cancel, ...), -1 on error and 0 on success.

                                                                                                                                                            UI_ctrl() adds extra control for the application author. For now, it understands two commands: UI_CTRL_PRINT_ERRORS, which makes UI_process() print the OpenSSL error stack as part of processing the UI, and UI_CTRL_IS_REDOABLE, which returns a flag saying if the used UI can be used again or not.

                                                                                                                                                            UI_set_default_method() changes the default UI method to the one given. This function is not thread-safe and should not be called at the same time as other OpenSSL functions.

                                                                                                                                                            UI_get_default_method() returns a pointer to the current default UI method.

                                                                                                                                                            UI_get_method() returns the UI method associated with a given UI.

                                                                                                                                                            UI_set_method() changes the UI method associated with a given UI.

                                                                                                                                                            "},{"location":"man3/UI_new/#notes","title":"NOTES","text":"

                                                                                                                                                            The resulting strings that the built in method UI_OpenSSL() generate are assumed to be encoded according to the current locale or (for Windows) code page. For applications having different demands, these strings need to be converted appropriately by the caller. For Windows, if the OPENSSL_WIN32_UTF8 environment variable is set, the built-in method UI_OpenSSL() will produce UTF-8 encoded strings instead.

                                                                                                                                                            "},{"location":"man3/UI_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            UI_new() and UI_new_method() return a valid UI structure or NULL if an error occurred.

                                                                                                                                                            UI_add_input_string(), UI_dup_input_string(), UI_add_verify_string(), UI_dup_verify_string(), UI_add_input_boolean(), UI_dup_input_boolean(), UI_add_info_string(), UI_dup_info_string(), UI_add_error_string() and UI_dup_error_string() return a positive number on success or a value which is less than or equal to 0 otherwise.

                                                                                                                                                            UI_construct_prompt() returns a string or NULL if an error occurred.

                                                                                                                                                            UI_dup_user_data() returns 0 on success or -1 on error.

                                                                                                                                                            UI_get0_result() returns a string or NULL on error.

                                                                                                                                                            UI_get_result_length() returns a positive integer or 0 on success; otherwise it returns -1 on error.

                                                                                                                                                            UI_process() returns 0 on success or a negative value on error.

                                                                                                                                                            UI_ctrl() returns a mask on success or -1 on error.

                                                                                                                                                            UI_get_default_method(), UI_get_method(), UI_OpenSSL(), UI_null() and UI_set_method() return either a valid UI_METHOD structure or NULL respectively.

                                                                                                                                                            "},{"location":"man3/UI_new/#history","title":"HISTORY","text":"

                                                                                                                                                            The UI_dup_user_data() function was added in OpenSSL 1.1.1.

                                                                                                                                                            "},{"location":"man3/UI_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/","title":"X509V3_get_d2i","text":""},{"location":"man3/X509V3_get_d2i/#name","title":"NAME","text":"

                                                                                                                                                            X509V3_get_d2i, X509V3_add1_i2d, X509V3_EXT_d2i, X509V3_EXT_i2d, X509_get_ext_d2i, X509_add1_ext_i2d, X509_CRL_get_ext_d2i, X509_CRL_add1_ext_i2d, X509_REVOKED_get_ext_d2i, X509_REVOKED_add1_ext_i2d, X509_get0_extensions, X509_CRL_get0_extensions, X509_REVOKED_get0_extensions - X509 extension decode and encode functions

                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nvoid *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit,\n                     int *idx);\nint X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value,\n                    int crit, unsigned long flags);\n\nvoid *X509V3_EXT_d2i(X509_EXTENSION *ext);\nX509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);\n\nvoid *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx);\nint X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,\n                      unsigned long flags);\n\nvoid *X509_CRL_get_ext_d2i(const X509_CRL *crl, int nid, int *crit, int *idx);\nint X509_CRL_add1_ext_i2d(X509_CRL *crl, int nid, void *value, int crit,\n                          unsigned long flags);\n\nvoid *X509_REVOKED_get_ext_d2i(const X509_REVOKED *r, int nid, int *crit, int *idx);\nint X509_REVOKED_add1_ext_i2d(X509_REVOKED *r, int nid, void *value, int crit,\n                              unsigned long flags);\n\nconst STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x);\nconst STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl);\nconst STACK_OF(X509_EXTENSION) *X509_REVOKED_get0_extensions(const X509_REVOKED *r);\n
                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509V3_get_d2i() looks for an extension with OID nid in the extensions x and, if found, decodes it. If idx is NULL then only one occurrence of an extension is permissible, otherwise the first extension after index *idx is returned and *idx updated to the location of the extension. If crit is not NULL then *crit is set to a status value: -2 if the extension occurs multiple times (this is only returned if idx is NULL), -1 if the extension could not be found, 0 if the extension is found and is not critical and 1 if critical. A pointer to an extension specific structure or NULL is returned.

                                                                                                                                                            X509V3_add1_i2d() adds extension value to STACK *x (allocating a new STACK if necessary) using OID nid and criticality crit according to flags.

                                                                                                                                                            X509V3_EXT_d2i() attempts to decode the ASN.1 data contained in extension ext and returns a pointer to an extension specific structure or NULL if the extension could not be decoded (invalid syntax or not supported).

                                                                                                                                                            X509V3_EXT_i2d() encodes the extension specific structure ext_struc with OID ext_nid and criticality crit.

                                                                                                                                                            X509_get_ext_d2i() and X509_add1_ext_i2d() operate on the extensions of certificate x. They are otherwise identical to X509V3_get_d2i() and X509V3_add1_i2d().

                                                                                                                                                            X509_CRL_get_ext_d2i() and X509_CRL_add1_ext_i2d() operate on the extensions of CRL crl. They are otherwise identical to X509V3_get_d2i() and X509V3_add1_i2d().

                                                                                                                                                            X509_REVOKED_get_ext_d2i() and X509_REVOKED_add1_ext_i2d() operate on the extensions of X509_REVOKED structure r (i.e for CRL entry extensions). They are otherwise identical to X509V3_get_d2i() and X509V3_add1_i2d().

                                                                                                                                                            X509_get0_extensions(), X509_CRL_get0_extensions() and X509_REVOKED_get0_extensions() return a STACK of all the extensions of a certificate, a CRL or a CRL entry respectively.

                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#notes","title":"NOTES","text":"

                                                                                                                                                            In almost all cases an extension can occur at most once and multiple occurrences is an error. Therefore, the idx parameter is usually NULL.

                                                                                                                                                            The flags parameter may be one of the following values.

                                                                                                                                                            X509V3_ADD_DEFAULT appends a new extension only if the extension does not exist. An error is returned if the extension exists.

                                                                                                                                                            X509V3_ADD_APPEND appends a new extension, ignoring whether the extension exists.

                                                                                                                                                            X509V3_ADD_REPLACE replaces an existing extension. If the extension does not exist, appends a new extension.

                                                                                                                                                            X509V3_ADD_REPLACE_EXISTING replaces an existing extension. If the extension does not exist, returns an error.

                                                                                                                                                            X509V3_ADD_KEEP_EXISTING appends a new extension only if the extension does not exist. An error is not returned if the extension exists.

                                                                                                                                                            X509V3_ADD_DELETE deletes and frees an existing extension. If the extension does not exist, returns an error. No new extension is added.

                                                                                                                                                            If X509V3_ADD_SILENT is bitwise ORed with flags: any error returned will not be added to the error queue.

                                                                                                                                                            The function X509V3_get_d2i() and its variants will return NULL if the extension is not found, occurs multiple times or cannot be decoded. It is possible to determine the precise reason by checking the value of *crit.

                                                                                                                                                            The function X509V3_add1_i2d() and its variants allocate X509_EXTENSION objects on STACK *x depending on flags. The X509_EXTENSION objects must be explicitly freed using X509_EXTENSION_free().

                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#supported-extensions","title":"SUPPORTED EXTENSIONS","text":"

                                                                                                                                                            The following sections contain a list of all supported extensions including their name and NID.

                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#pkix-certificate-extensions","title":"PKIX Certificate Extensions","text":"

                                                                                                                                                            The following certificate extensions are defined in PKIX standards such as RFC5280.

                                                                                                                                                            Basic Constraints                  NID_basic_constraints\nKey Usage                          NID_key_usage\nExtended Key Usage                 NID_ext_key_usage\n\nSubject Key Identifier             NID_subject_key_identifier\nAuthority Key Identifier           NID_authority_key_identifier\n\nPrivate Key Usage Period           NID_private_key_usage_period\n\nSubject Alternative Name           NID_subject_alt_name\nIssuer Alternative Name            NID_issuer_alt_name\n\nAuthority Information Access       NID_info_access\nSubject Information Access         NID_sinfo_access\n\nName Constraints                   NID_name_constraints\n\nCertificate Policies               NID_certificate_policies\nPolicy Mappings                    NID_policy_mappings\nPolicy Constraints                 NID_policy_constraints\nInhibit Any Policy                 NID_inhibit_any_policy\n\nTLS Feature                        NID_tlsfeature\n
                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#netscape-certificate-extensions","title":"Netscape Certificate Extensions","text":"

                                                                                                                                                            The following are (largely obsolete) Netscape certificate extensions.

                                                                                                                                                            Netscape Cert Type                 NID_netscape_cert_type\nNetscape Base Url                  NID_netscape_base_url\nNetscape Revocation Url            NID_netscape_revocation_url\nNetscape CA Revocation Url         NID_netscape_ca_revocation_url\nNetscape Renewal Url               NID_netscape_renewal_url\nNetscape CA Policy Url             NID_netscape_ca_policy_url\nNetscape SSL Server Name           NID_netscape_ssl_server_name\nNetscape Comment                   NID_netscape_comment\n
                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#miscellaneous-certificate-extensions","title":"Miscellaneous Certificate Extensions","text":"
                                                                                                                                                            Strong Extranet ID                 NID_sxnet\nProxy Certificate Information      NID_proxyCertInfo\n
                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#pkix-crl-extensions","title":"PKIX CRL Extensions","text":"

                                                                                                                                                            The following are CRL extensions from PKIX standards such as RFC5280.

                                                                                                                                                            CRL Number                         NID_crl_number\nCRL Distribution Points            NID_crl_distribution_points\nDelta CRL Indicator                NID_delta_crl\nFreshest CRL                       NID_freshest_crl\nInvalidity Date                    NID_invalidity_date\nIssuing Distribution Point         NID_issuing_distribution_point\n

                                                                                                                                                            The following are CRL entry extensions from PKIX standards such as RFC5280.

                                                                                                                                                            CRL Reason Code                    NID_crl_reason\nCertificate Issuer                 NID_certificate_issuer\n
                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#ocsp-extensions","title":"OCSP Extensions","text":"
                                                                                                                                                            OCSP Nonce                         NID_id_pkix_OCSP_Nonce\nOCSP CRL ID                        NID_id_pkix_OCSP_CrlID\nAcceptable OCSP Responses          NID_id_pkix_OCSP_acceptableResponses\nOCSP No Check                      NID_id_pkix_OCSP_noCheck\nOCSP Archive Cutoff                NID_id_pkix_OCSP_archiveCutoff\nOCSP Service Locator               NID_id_pkix_OCSP_serviceLocator\nHold Instruction Code              NID_hold_instruction_code\n
                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#certificate-transparency-extensions","title":"Certificate Transparency Extensions","text":"

                                                                                                                                                            The following extensions are used by certificate transparency, RFC6962

                                                                                                                                                            CT Precertificate SCTs             NID_ct_precert_scts\nCT Certificate SCTs                NID_ct_cert_scts\n
                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509V3_get_d2i(), its variants, and X509V3_EXT_d2i() return a pointer to an extension specific structure or NULL if an error occurs.

                                                                                                                                                            X509V3_add1_i2d() and its variants return 1 if the operation is successful and 0 if it fails due to a non-fatal error (extension not found, already exists, cannot be encoded) or -1 due to a fatal error such as a memory allocation failure.

                                                                                                                                                            X509V3_EXT_i2d() returns a pointer to an X509_EXTENSION structure or NULL if an error occurs.

                                                                                                                                                            X509_get0_extensions(), X509_CRL_get0_extensions() and X509_REVOKED_get0_extensions() return a stack of extensions. They return NULL if no extensions are present.

                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509V3_get_d2i/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509V3_set_ctx/","title":"X509V3_set_ctx","text":""},{"location":"man3/X509V3_set_ctx/#name","title":"NAME","text":"

                                                                                                                                                            X509V3_set_ctx, X509V3_set_issuer_pkey - X.509 v3 extension generation utilities

                                                                                                                                                            "},{"location":"man3/X509V3_set_ctx/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nvoid X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,\n                    X509_REQ *req, X509_CRL *crl, int flags);\nint X509V3_set_issuer_pkey(X509V3_CTX *ctx, EVP_PKEY *pkey);\n
                                                                                                                                                            "},{"location":"man3/X509V3_set_ctx/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509V3_set_ctx() fills in the basic fields of ctx of type X509V3_CTX, providing details potentially needed by functions producing X509 v3 extensions, e.g., to look up values for filling in authority key identifiers. Any of subject, req, or crl may be provided, pointing to a certificate, certification request, or certificate revocation list, respectively. When constructing the subject key identifier of a certificate by computing a hash value of its public key, the public key is taken from subject or req. Similarly, when constructing subject alternative names from any email addresses contained in a subject DN, the subject DN is taken from subject or req. If subject or crl is provided, issuer should point to its issuer, for instance to help generating an authority key identifier extension. Note that if subject is provided, issuer may be the same as subject, which means that subject is self-issued (or even self-signed). flags may be 0 or contain X509V3_CTX_TEST, which means that just the syntax of extension definitions is to be checked without actually producing an extension, or X509V3_CTX_REPLACE, which means that each X.509v3 extension added as defined in some configuration section shall replace any already existing extension with the same OID.

                                                                                                                                                            X509V3_set_issuer_pkey() explicitly sets the issuer private key of the certificate that has been provided in ctx. This should be done for self-issued certificates (which may be self-signed or not) to provide fallback data for the authority key identifier extension.

                                                                                                                                                            "},{"location":"man3/X509V3_set_ctx/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509V3_set_ctx() and X509V3_set_issuer_pkey() return 1 on success and 0 on error.

                                                                                                                                                            "},{"location":"man3/X509V3_set_ctx/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_add_ext(3)

                                                                                                                                                            "},{"location":"man3/X509V3_set_ctx/#history","title":"HISTORY","text":"

                                                                                                                                                            X509V3_set_issuer_pkey() was added in OpenSSL 3.0.

                                                                                                                                                            CTX_TEST was deprecated in OpenSSL 3.0; use X509V3_CTX_TEST instead.

                                                                                                                                                            "},{"location":"man3/X509V3_set_ctx/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_ALGOR_dup/","title":"X509_ALGOR_dup","text":""},{"location":"man3/X509_ALGOR_dup/#name","title":"NAME","text":"

                                                                                                                                                            X509_ALGOR_dup, X509_ALGOR_set0, X509_ALGOR_get0, X509_ALGOR_set_md, X509_ALGOR_cmp, X509_ALGOR_copy - AlgorithmIdentifier functions

                                                                                                                                                            "},{"location":"man3/X509_ALGOR_dup/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nX509_ALGOR *X509_ALGOR_dup(X509_ALGOR *alg);\nint X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);\nvoid X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,\n                     const void **ppval, const X509_ALGOR *alg);\nvoid X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);\nint X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);\nint X509_ALGOR_copy(X509_ALGOR *dest, const X509_ALGOR *src);\n
                                                                                                                                                            "},{"location":"man3/X509_ALGOR_dup/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_ALGOR_dup() returns a copy of alg.

                                                                                                                                                            X509_ALGOR_set0() sets the algorithm OID of alg to aobj and the associated parameter type to ptype with value pval. If ptype is V_ASN1_UNDEF the parameter is omitted, otherwise ptype and pval have the same meaning as the type and value parameters to ASN1_TYPE_set(). All the supplied parameters are used internally so must NOT be freed after this call.

                                                                                                                                                            X509_ALGOR_get0() is the inverse of X509_ALGOR_set0(): it returns the algorithm OID in *paobj and the associated parameter in *pptype and *ppval from the AlgorithmIdentifier alg.

                                                                                                                                                            X509_ALGOR_set_md() sets the AlgorithmIdentifier alg to appropriate values for the message digest md.

                                                                                                                                                            X509_ALGOR_cmp() compares a and b and returns 0 if they have identical encodings and nonzero otherwise.

                                                                                                                                                            X509_ALGOR_copy() copies the source values into the dest structs; making a duplicate of each (and free any thing pointed to from within *dest).

                                                                                                                                                            "},{"location":"man3/X509_ALGOR_dup/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_ALGOR_dup() returns a valid X509_ALGOR structure or NULL if an error occurred.

                                                                                                                                                            X509_ALGOR_set0() and X509_ALGOR_copy() return 1 on success or 0 on error.

                                                                                                                                                            X509_ALGOR_get0() and X509_ALGOR_set_md() return no values.

                                                                                                                                                            X509_ALGOR_cmp() returns 0 if the two parameters have identical encodings and nonzero otherwise.

                                                                                                                                                            "},{"location":"man3/X509_ALGOR_dup/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_ALGOR_copy() was added in 1.1.1e.

                                                                                                                                                            "},{"location":"man3/X509_ALGOR_dup/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_ATTRIBUTE/","title":"X509_ATTRIBUTE","text":""},{"location":"man3/X509_ATTRIBUTE/#name","title":"NAME","text":"

                                                                                                                                                            X509_ATTRIBUTE, X509at_get_attr, X509at_get_attr_count, X509at_get_attr_by_NID, X509at_get_attr_by_OBJ, X509at_delete_attr, X509at_add1_attr, X509at_add1_attr_by_OBJ, X509at_add1_attr_by_NID, X509at_add1_attr_by_txt, X509at_get0_data_by_OBJ, X509_ATTRIBUTE_create, X509_ATTRIBUTE_create_by_NID, X509_ATTRIBUTE_create_by_OBJ, X509_ATTRIBUTE_create_by_txt, X509_ATTRIBUTE_set1_object, X509_ATTRIBUTE_set1_data, X509_ATTRIBUTE_count, X509_ATTRIBUTE_get0_data, X509_ATTRIBUTE_get0_object, X509_ATTRIBUTE_get0_type - X509 attribute functions

                                                                                                                                                            "},{"location":"man3/X509_ATTRIBUTE/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\ntypedef struct x509_attributes_st X509_ATTRIBUTE;\n\nint X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);\nint X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,\n                           int lastpos);\nint X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk,\n                           const ASN1_OBJECT *obj, int lastpos);\nX509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);\nX509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,\n                                           X509_ATTRIBUTE *attr);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE)\n                                                  **x, const ASN1_OBJECT *obj,\n                                                  int type,\n                                                  const unsigned char *bytes,\n                                                  int len);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE)\n                                                  **x, int nid, int type,\n                                                  const unsigned char *bytes,\n                                                  int len);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE)\n                                                  **x, const char *attrname,\n                                                  int type,\n                                                  const unsigned char *bytes,\n                                                  int len);\nvoid *X509at_get0_data_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *x,\n                              const ASN1_OBJECT *obj, int lastpos, int type);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,\n                                             int atrtype, const void *data,\n                                             int len);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,\n                                             const ASN1_OBJECT *obj,\n                                             int atrtype, const void *data,\n                                             int len);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,\n                                             const char *atrname, int type,\n                                             const unsigned char *bytes,\n                                             int len);\nint X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);\nint X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype,\n                             const void *data, int len);\nvoid *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype,\n                               void *data);\nint X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr);\nASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);\nASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);\n
                                                                                                                                                            "},{"location":"man3/X509_ATTRIBUTE/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_ATTRIBUTE objects are used by many standards including X509, X509_REQ, PKCS12, PKCS8, PKCS7 and CMS.

                                                                                                                                                            The X509_ATTRIBUTE object is used to represent the ASN.1 Attribute as defined in RFC 5280, i.e.

                                                                                                                                                            Attribute ::= SEQUENCE {\n  type             AttributeType,\n  values    SET OF AttributeValue }\n\nAttributeType ::= OBJECT IDENTIFIER\nAttributeValue ::= ANY -- DEFINED BY AttributeType\n

                                                                                                                                                            For example CMS defines the signing-time attribute as:

                                                                                                                                                            id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)\n    us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }\n\nSigningTime ::= Time\n\nTime ::= CHOICE {\n  utcTime UTCTime,\n  generalizedTime GeneralizedTime }\n

                                                                                                                                                            In OpenSSL AttributeType maps to an ASN1_OBJECT object and AttributeValue maps to a list of ASN1_TYPE objects.

                                                                                                                                                            The following functions are used for X509_ATTRIBUTE objects.

                                                                                                                                                            X509at_get_attr_by_OBJ() finds the location of the first matching object obj in a list of attributes sk. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to X509at_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the list.

                                                                                                                                                            X509at_get_attr_by_NID() is similar to X509at_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                                            X509at_get_attr() returns the X509_ATTRIBUTE object at index loc in the list of attributes x. loc should be in the range from 0 to X509at_get_attr_count() - 1.

                                                                                                                                                            X509at_delete_attr() removes the X509_ATTRIBUTE object at index loc in the list of attributes x.

                                                                                                                                                            X509at_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE object to the list x. Both x and attr must be non NULL or an error will occur. If *x is NULL then a new list is created, otherwise it uses the passed in list. An error will occur if an existing attribute (with the same attribute type) already exists in the attribute list.

                                                                                                                                                            X509at_add1_attr_by_OBJ() creates a new X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the attribute list x. Both x and attr must be non NULL or an error will occur. If *x is NULL then a new attribute list is created. If obj already exists in the attribute list then an error occurs.

                                                                                                                                                            X509at_add1_attr_by_NID() is similar to X509at_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                                            X509at_add1_attr_by_txt() is similar to X509at_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                                                                                                                                                            X509_ATTRIBUTE_set1_object() assigns a ASN1_OBJECT obj to the attribute attr. If attr contained an existing ASN1_OBJECT then it is freed. An error occurs if either attr or obj are NULL, or if the passed in obj cannot be duplicated.

                                                                                                                                                            X509_ATTRIBUTE_set1_data() pushes a new ASN1_TYPE object onto the attr attributes list. The new object is assigned a copy of the data in data of size len. If attrtype has flag MBSTRING_FLAG set then a table lookup using the attr attributes NID is used to set an ASN1_STRING using ASN1_STRING_set_by_NID(), and the passed in data must be in the format required for that object type or an error will occur. If len is not -1 then internally ASN1_STRING_type_new() is used with the passed in attrtype. If attrtype is 0 the call does nothing except return 1.

                                                                                                                                                            X509_ATTRIBUTE_create() creates a new X509_ATTRIBUTE using the nid to set the ASN1_OBJECT OID and the atrtype and value to set the ASN1_TYPE.

                                                                                                                                                            X509_ATTRIBUTE_create_by_OBJ() uses X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type atrtype and data data of length len. If the passed in attribute attr OR *attr is NULL then a new X509_ATTRIBUTE will be returned, otherwise the passed in X509_ATTRIBUTE is used. Note that the ASN1_OBJECT obj is pushed onto the attributes existing list of objects, which could be an issue if the attributes was different.

                                                                                                                                                            X509_ATTRIBUTE_create_by_NID() is similar to X509_ATTRIBUTE_create_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                                            X509_ATTRIBUTE_create_by_txt() is similar to X509_ATTRIBUTE_create_by_OBJ() except that it passes a name atrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                                                                                                                                                            X509_ATTRIBUTE_count() returns the number of ASN1_TYPE objects in an attribute attr.

                                                                                                                                                            X509_ATTRIBUTE_get0_type() returns the ASN1_TYPE object at index idx in the attribute list attr. idx should be in the range of 0 to X509_ATTRIBUTE_count() - 1 or an error will occur.

                                                                                                                                                            X509_ATTRIBUTE_get0_data() returns the data of an ASN1_TYPE object at index idx in the attribute attr. data is unused and can be set to NULL. An error will occur if the attribute type atrtype does not match the type of the ASN1_TYPE object at index idx OR if atrtype is either V_ASN1_BOOLEAN or V_ASN1_NULL OR if the idx is not in the range 0 to X509_ATTRIBUTE_count() - 1.

                                                                                                                                                            X509at_get0_data_by_OBJ() finds the first attribute in an attribute list x that matches the obj starting at index lastpos and returns the data retrieved from the found attributes first ASN1_TYPE object. An error will occur if the attribute type type does not match the type of the ASN1_TYPE object OR if type is either V_ASN1_BOOLEAN or V_ASN1_NULL OR the attribute is not found. If lastpos is less than -1 then an error will occur if there are multiple objects in the list x that match obj. If lastpos is less than -2 then an error will occur if there is more than one ASN1_TYPE object in the found attribute.

                                                                                                                                                            "},{"location":"man3/X509_ATTRIBUTE/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509at_get_attr_count() returns the number of attributes in the list x or -1 if x is NULL.

                                                                                                                                                            X509at_get_attr_by_OBJ() returns -1 if either the list is empty OR the object is not found, otherwise it returns the location of the object in the list.

                                                                                                                                                            X509at_get_attr_by_NID() is similar to X509at_get_attr_by_OBJ(), except that it returns -2 if the nid is not known by OpenSSL.

                                                                                                                                                            X509at_get_attr() returns either an X509_ATTRIBUTE or NULL if there is a error.

                                                                                                                                                            X509at_delete_attr() returns either the removed X509_ATTRIBUTE or NULL if there is a error.

                                                                                                                                                            X509_ATTRIBUTE_count() returns -1 on error, otherwise it returns the number of ASN1_TYPE elements.

                                                                                                                                                            X509_ATTRIBUTE_get0_type() returns NULL on error, otherwise it returns a ASN1_TYPE object.

                                                                                                                                                            X509_ATTRIBUTE_get0_data() returns NULL if an error occurs, otherwise it returns the data associated with an ASN1_TYPE object.

                                                                                                                                                            X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() returns 1 on success, or 0 otherwise.

                                                                                                                                                            X509_ATTRIBUTE_create(), X509_ATTRIBUTE_create_by_OBJ(), X509_ATTRIBUTE_create_by_NID() and X509_ATTRIBUTE_create_by_txt() return either a X509_ATTRIBUTE on success, or NULL if there is a error.

                                                                                                                                                            X509at_add1_attr(), X509at_add1_attr_by_OBJ(), X509at_add1_attr_by_NID() and X509at_add1_attr_by_txt() return NULL on error, otherwise they return a list of X509_ATTRIBUTE.

                                                                                                                                                            X509at_get0_data_by_OBJ() returns the data retrieved from the found attributes first ASN1_TYPE object, or NULL if an error occurs.

                                                                                                                                                            "},{"location":"man3/X509_ATTRIBUTE/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ASN1_TYPE_get(3), ASN1_INTEGER_get(3), ASN1_ENUMERATED_get(3), ASN1_STRING_get0_data(3), ASN1_STRING_length(3), ASN1_STRING_type(3), X509_REQ_get_attr(3), EVP_PKEY_get_attr(3), CMS_signed_get_attr(3), PKCS8_pkey_get0_attrs(3),

                                                                                                                                                            "},{"location":"man3/X509_ATTRIBUTE/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_CRL_get0_by_serial/","title":"X509_CRL_get0_by_serial","text":""},{"location":"man3/X509_CRL_get0_by_serial/#name","title":"NAME","text":"

                                                                                                                                                            X509_CRL_get0_by_serial, X509_CRL_get0_by_cert, X509_CRL_get_REVOKED, X509_REVOKED_get0_serialNumber, X509_REVOKED_get0_revocationDate, X509_REVOKED_set_serialNumber, X509_REVOKED_set_revocationDate, X509_CRL_add0_revoked, X509_CRL_sort - CRL revoked entry utility functions

                                                                                                                                                            "},{"location":"man3/X509_CRL_get0_by_serial/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_CRL_get0_by_serial(X509_CRL *crl,\n                            X509_REVOKED **ret, const ASN1_INTEGER *serial);\nint X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);\n\nSTACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl);\n\nconst ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *r);\nconst ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *r);\n\nint X509_REVOKED_set_serialNumber(X509_REVOKED *r, ASN1_INTEGER *serial);\nint X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);\n\nint X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);\n\nint X509_CRL_sort(X509_CRL *crl);\n
                                                                                                                                                            "},{"location":"man3/X509_CRL_get0_by_serial/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_CRL_get0_by_serial() attempts to find a revoked entry in crl for serial number serial. If it is successful, it sets *ret to the internal pointer of the matching entry. As a result, *ret MUST NOT be freed after the call.

                                                                                                                                                            X509_CRL_get0_by_cert() is similar to X509_get0_by_serial() except it looks for a revoked entry using the serial number of certificate x.

                                                                                                                                                            X509_CRL_get_REVOKED() returns an internal pointer to a STACK of all revoked entries for crl.

                                                                                                                                                            X509_REVOKED_get0_serialNumber() returns an internal pointer to the serial number of r.

                                                                                                                                                            X509_REVOKED_get0_revocationDate() returns an internal pointer to the revocation date of r.

                                                                                                                                                            X509_REVOKED_set_serialNumber() sets the serial number of r to serial. The supplied serial pointer is not used internally so it should be freed after use.

                                                                                                                                                            X509_REVOKED_set_revocationDate() sets the revocation date of r to tm. The supplied tm pointer is not used internally so it should be freed after use.

                                                                                                                                                            X509_CRL_add0_revoked() appends revoked entry rev to CRL crl. The pointer rev is used internally so it MUST NOT be freed after the call: it is freed when the parent CRL is freed.

                                                                                                                                                            X509_CRL_sort() sorts the revoked entries of crl into ascending serial number order.

                                                                                                                                                            "},{"location":"man3/X509_CRL_get0_by_serial/#notes","title":"NOTES","text":"

                                                                                                                                                            Applications can determine the number of revoked entries returned by X509_CRL_get_REVOKED() using sk_X509_REVOKED_num() and examine each one in turn using sk_X509_REVOKED_value().

                                                                                                                                                            "},{"location":"man3/X509_CRL_get0_by_serial/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_CRL_get0_by_serial() and X509_CRL_get0_by_cert() return 0 for failure, 1 on success except if the revoked entry has the reason removeFromCRL (8), in which case 2 is returned.

                                                                                                                                                            X509_CRL_get_REVOKED() returns a STACK of revoked entries.

                                                                                                                                                            X509_REVOKED_get0_serialNumber() returns an ASN1_INTEGER structure.

                                                                                                                                                            X509_REVOKED_get0_revocationDate() returns an ASN1_TIME structure.

                                                                                                                                                            X509_REVOKED_set_serialNumber(), X509_REVOKED_set_revocationDate(), X509_CRL_add0_revoked() and X509_CRL_sort() return 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_CRL_get0_by_serial/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_CRL_get0_by_serial/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_EXTENSION_set_object/","title":"X509_EXTENSION_set_object","text":""},{"location":"man3/X509_EXTENSION_set_object/#name","title":"NAME","text":"

                                                                                                                                                            X509_EXTENSION_set_object, X509_EXTENSION_set_critical, X509_EXTENSION_set_data, X509_EXTENSION_create_by_NID, X509_EXTENSION_create_by_OBJ, X509_EXTENSION_get_object, X509_EXTENSION_get_critical, X509_EXTENSION_get_data - extension utility functions

                                                                                                                                                            "},{"location":"man3/X509_EXTENSION_set_object/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj);\nint X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);\nint X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);\n\nX509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,\n                                             int nid, int crit,\n                                             ASN1_OCTET_STRING *data);\nX509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,\n                                             const ASN1_OBJECT *obj, int crit,\n                                             ASN1_OCTET_STRING *data);\n\nASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);\nint X509_EXTENSION_get_critical(const X509_EXTENSION *ex);\nASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);\n
                                                                                                                                                            "},{"location":"man3/X509_EXTENSION_set_object/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_EXTENSION_set_object() sets the extension type of ex to obj. The obj pointer is duplicated internally so obj should be freed up after use.

                                                                                                                                                            X509_EXTENSION_set_critical() sets the criticality of ex to crit. If crit is zero the extension in non-critical otherwise it is critical.

                                                                                                                                                            X509_EXTENSION_set_data() sets the data in extension ex to data. The data pointer is duplicated internally.

                                                                                                                                                            X509_EXTENSION_create_by_NID() creates an extension of type nid, criticality crit using data data. The created extension is returned and written to *ex reusing or allocating a new extension if necessary so *ex should either be NULL or a valid X509_EXTENSION structure it must not be an uninitialised pointer.

                                                                                                                                                            X509_EXTENSION_create_by_OBJ() is identical to X509_EXTENSION_create_by_NID() except it creates and extension using obj instead of a NID.

                                                                                                                                                            X509_EXTENSION_get_object() returns the extension type of ex as an ASN1_OBJECT pointer. The returned pointer is an internal value which must not be freed up.

                                                                                                                                                            X509_EXTENSION_get_critical() returns the criticality of extension ex it returns 1 for critical and 0 for non-critical.

                                                                                                                                                            X509_EXTENSION_get_data() returns the data of extension ex. The returned pointer is an internal value which must not be freed up.

                                                                                                                                                            "},{"location":"man3/X509_EXTENSION_set_object/#notes","title":"NOTES","text":"

                                                                                                                                                            These functions manipulate the contents of an extension directly. Most applications will want to parse or encode and add an extension: they should use the extension encode and decode functions instead such as X509_add1_ext_i2d() and X509_get_ext_d2i().

                                                                                                                                                            The data associated with an extension is the extension encoding in an ASN1_OCTET_STRING structure.

                                                                                                                                                            "},{"location":"man3/X509_EXTENSION_set_object/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_EXTENSION_set_object() X509_EXTENSION_set_critical() and X509_EXTENSION_set_data() return 1 for success and 0 for failure.

                                                                                                                                                            X509_EXTENSION_create_by_NID() and X509_EXTENSION_create_by_OBJ() return an X509_EXTENSION pointer or NULL if an error occurs.

                                                                                                                                                            X509_EXTENSION_get_object() returns an ASN1_OBJECT pointer.

                                                                                                                                                            X509_EXTENSION_get_critical() returns 0 for non-critical and 1 for critical.

                                                                                                                                                            X509_EXTENSION_get_data() returns an ASN1_OCTET_STRING pointer.

                                                                                                                                                            "},{"location":"man3/X509_EXTENSION_set_object/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509V3_get_d2i(3)

                                                                                                                                                            "},{"location":"man3/X509_EXTENSION_set_object/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/","title":"X509_LOOKUP","text":""},{"location":"man3/X509_LOOKUP/#name","title":"NAME","text":"

                                                                                                                                                            X509_LOOKUP, X509_LOOKUP_TYPE, X509_LOOKUP_new, X509_LOOKUP_free, X509_LOOKUP_init, X509_LOOKUP_shutdown, X509_LOOKUP_set_method_data, X509_LOOKUP_get_method_data, X509_LOOKUP_ctrl_ex, X509_LOOKUP_ctrl, X509_LOOKUP_load_file_ex, X509_LOOKUP_load_file, X509_LOOKUP_add_dir, X509_LOOKUP_add_store_ex, X509_LOOKUP_add_store, X509_LOOKUP_load_store_ex, X509_LOOKUP_load_store, X509_LOOKUP_get_store, X509_LOOKUP_by_subject_ex, X509_LOOKUP_by_subject, X509_LOOKUP_by_issuer_serial, X509_LOOKUP_by_fingerprint, X509_LOOKUP_by_alias - OpenSSL certificate lookup mechanisms

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\ntypedef x509_lookup_st X509_LOOKUP;\n\ntypedef enum X509_LOOKUP_TYPE;\n\nX509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);\nint X509_LOOKUP_init(X509_LOOKUP *ctx);\nint X509_LOOKUP_shutdown(X509_LOOKUP *ctx);\nvoid X509_LOOKUP_free(X509_LOOKUP *ctx);\n\nint X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data);\nvoid *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx);\n\nint X509_LOOKUP_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,\n                        char **ret, OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,\n                     long argl, char **ret);\nint X509_LOOKUP_load_file_ex(X509_LOOKUP *ctx, char *name, long type,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_load_file(X509_LOOKUP *ctx, char *name, long type);\nint X509_LOOKUP_load_file_ex(X509_LOOKUP *ctx, char *name, long type,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_add_dir(X509_LOOKUP *ctx, char *name, long type);\nint X509_LOOKUP_add_store_ex(X509_LOOKUP *ctx, char *uri, OSSL_LIB_CTX *libctx,\n                             const char *propq);\nint X509_LOOKUP_add_store(X509_LOOKUP *ctx, char *uri);\nint X509_LOOKUP_load_store_ex(X509_LOOKUP *ctx, char *uri, OSSL_LIB_CTX *libctx,\n                              const char *propq);\nint X509_LOOKUP_load_store(X509_LOOKUP *ctx, char *uri);\n\nX509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx);\n\nint X509_LOOKUP_by_subject_ex(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                              const X509_NAME *name, X509_OBJECT *ret,\n                              OSSL_LIB_CTX *libctx, const char *propq);\nint X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                           const X509_NAME *name, X509_OBJECT *ret);\nint X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                                 const X509_NAME *name,\n                                 const ASN1_INTEGER *serial, X509_OBJECT *ret);\nint X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                               const unsigned char *bytes, int len,\n                               X509_OBJECT *ret);\nint X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,\n                         const char *str, int len, X509_OBJECT *ret);\n
                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The X509_LOOKUP structure holds the information needed to look up certificates and CRLs according to an associated X509_LOOKUP_METHOD(3). Multiple X509_LOOKUP instances can be added to an X509_STORE(3) to enable lookup in that store.

                                                                                                                                                            X509_LOOKUP_new() creates a new X509_LOOKUP using the given lookup method. It can also be created by calling X509_STORE_add_lookup(3), which will associate a X509_STORE with the lookup mechanism.

                                                                                                                                                            X509_LOOKUP_init() initializes the internal state and resources as needed by the given X509_LOOKUP to do its work.

                                                                                                                                                            X509_LOOKUP_shutdown() tears down the internal state and resources of the given X509_LOOKUP.

                                                                                                                                                            X509_LOOKUP_free() destructs the given X509_LOOKUP. If the argument is NULL, nothing is done.

                                                                                                                                                            X509_LOOKUP_set_method_data() and X509_LOOKUP_get_method_data() associates and retrieves a pointer to application data to and from the given X509_LOOKUP, respectively.

                                                                                                                                                            X509_LOOKUP_ctrl_ex() is used to set or get additional data to or from a X509_LOOKUP structure or its associated X509_LOOKUP_METHOD(3). The arguments of the control command are passed via argc and argl, its return value via *ret. The library context libctx and property query propq are used when fetching algorithms from providers. The meaning of the arguments depends on the cmd number of the control command. In general, this function is not called directly, but wrapped by a macro call, see below. The control _cmd_s known to OpenSSL are discussed in more depth in \"Control Commands\".

                                                                                                                                                            X509_LOOKUP_ctrl() is similar to X509_LOOKUP_ctrl_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            X509_LOOKUP_load_file_ex() passes a filename to be loaded immediately into the associated X509_STORE. The library context libctx and property query propq are used when fetching algorithms from providers. type indicates what type of object is expected. This can only be used with a lookup using the implementation X509_LOOKUP_file(3).

                                                                                                                                                            X509_LOOKUP_load_file() is similar to X509_LOOKUP_load_file_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            X509_LOOKUP_add_dir() passes a directory specification from which certificates and CRLs are loaded on demand into the associated X509_STORE. type indicates what type of object is expected. This can only be used with a lookup using the implementation X509_LOOKUP_hash_dir(3).

                                                                                                                                                            X509_LOOKUP_add_store_ex() passes a URI for a directory-like structure from which containers with certificates and CRLs are loaded on demand into the associated X509_STORE. The library context libctx and property query propq are used when fetching algorithms from providers.

                                                                                                                                                            X509_LOOKUP_add_store() is similar to X509_LOOKUP_add_store_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            X509_LOOKUP_load_store_ex() passes a URI for a single container from which certificates and CRLs are immediately loaded into the associated X509_STORE. The library context libctx and property query propq are used when fetching algorithms from providers. These functions can only be used with a lookup using the implementation X509_LOOKUP_store(3).

                                                                                                                                                            X509_LOOKUP_load_store() is similar to X509_LOOKUP_load_store_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            X509_LOOKUP_load_file_ex(), X509_LOOKUP_load_file(), X509_LOOKUP_add_dir(), X509_LOOKUP_add_store_ex() X509_LOOKUP_add_store(), X509_LOOKUP_load_store_ex() and X509_LOOKUP_load_store() are implemented as macros that use X509_LOOKUP_ctrl().

                                                                                                                                                            X509_LOOKUP_by_subject_ex(), X509_LOOKUP_by_subject(), X509_LOOKUP_by_issuer_serial(), X509_LOOKUP_by_fingerprint(), and X509_LOOKUP_by_alias() look up certificates and CRLs in the X509_STORE(3) associated with the X509_LOOKUP using different criteria, where the looked up object is stored in ret. Some of the underlying X509_LOOKUP_METHODs will also cache objects matching the criteria in the associated X509_STORE, which makes it possible to handle cases where the criteria have more than one hit.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/#control-commands","title":"Control Commands","text":"

                                                                                                                                                            The X509_LOOKUP_METHODs built into OpenSSL recognize the following X509_LOOKUP_ctrl() _cmd_s:

                                                                                                                                                            • X509_L_FILE_LOAD

                                                                                                                                                              This is the command that X509_LOOKUP_load_file_ex() and X509_LOOKUP_load_file() use. The filename is passed in argc, and the type in argl.

                                                                                                                                                            • X509_L_ADD_DIR

                                                                                                                                                              This is the command that X509_LOOKUP_add_dir() uses. The directory specification is passed in argc, and the type in argl.

                                                                                                                                                            • X509_L_ADD_STORE

                                                                                                                                                              This is the command that X509_LOOKUP_add_store_ex() and X509_LOOKUP_add_store() use. The URI is passed in argc.

                                                                                                                                                            • X509_L_LOAD_STORE

                                                                                                                                                              This is the command that X509_LOOKUP_load_store_ex() and X509_LOOKUP_load_store() use. The URI is passed in argc.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_LOOKUP_new() returns a X509_LOOKUP pointer when successful, or NULL on error.

                                                                                                                                                            X509_LOOKUP_init() and X509_LOOKUP_shutdown() return 1 on success, or 0 on error.

                                                                                                                                                            X509_LOOKUP_ctrl() returns -1 if the X509_LOOKUP doesn't have an associated X509_LOOKUP_METHOD, or 1 if the doesn't have a control function. Otherwise, it returns what the control function in the X509_LOOKUP_METHOD returns, which is usually 1 on success and 0 in error.

                                                                                                                                                            X509_LOOKUP_get_store() returns a X509_STORE pointer if there is one, otherwise NULL.

                                                                                                                                                            X509_LOOKUP_by_subject_ex(), X509_LOOKUP_by_subject(), X509_LOOKUP_by_issuer_serial(), X509_LOOKUP_by_fingerprint(), and X509_LOOKUP_by_alias() all return 0 if there is no X509_LOOKUP_METHOD or that method doesn't implement the corresponding function. Otherwise, it returns what the corresponding function in the X509_LOOKUP_METHOD returns, which is usually 1 on success and 0 in error.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_LOOKUP_METHOD(3), X509_STORE(3)

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/#history","title":"HISTORY","text":"

                                                                                                                                                            The functions X509_LOOKUP_by_subject_ex() and X509_LOOKUP_ctrl_ex() were added in OpenSSL 3.0.

                                                                                                                                                            The macros X509_LOOKUP_load_file_ex(), X509_LOOKUP_load_store_ex() and 509_LOOKUP_add_store_ex() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/","title":"X509_LOOKUP_hash_dir","text":""},{"location":"man3/X509_LOOKUP_hash_dir/#name","title":"NAME","text":"

                                                                                                                                                            X509_LOOKUP_hash_dir, X509_LOOKUP_file, X509_LOOKUP_store, X509_load_cert_file_ex, X509_load_cert_file, X509_load_crl_file, X509_load_cert_crl_file_ex, X509_load_cert_crl_file - Default OpenSSL certificate lookup methods

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\nX509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);\nX509_LOOKUP_METHOD *X509_LOOKUP_file(void);\nX509_LOOKUP_METHOD *X509_LOOKUP_store(void);\n\nint X509_load_cert_file_ex(X509_LOOKUP *ctx, const char *file, int type,\n                           OSSL_LIB_CTX *libctx, const char *propq);\nint X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);\nint X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);\nint X509_load_cert_crl_file_ex(X509_LOOKUP *ctx, const char *file, int type,\n                               OSSL_LIB_CTX *libctx, const char *propq);\nint X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);\n
                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_LOOKUP_hash_dir and X509_LOOKUP_file are two certificate lookup methods to use with X509_STORE, provided by OpenSSL library.

                                                                                                                                                            Users of the library typically do not need to create instances of these methods manually, they would be created automatically by X509_STORE_load_locations(3) or SSL_CTX_load_verify_locations(3) functions.

                                                                                                                                                            Internally loading of certificates and CRLs is implemented via functions X509_load_cert_crl_file, X509_load_cert_file and X509_load_crl_file. These functions support parameter type, which can be one of constants FILETYPE_PEM, FILETYPE_ASN1 and FILETYPE_DEFAULT. They load certificates and/or CRLs from specified file into memory cache of X509_STORE objects which given ctx parameter is associated with.

                                                                                                                                                            Functions X509_load_cert_file and X509_load_crl_file can load both PEM and DER formats depending of type value. Because DER format cannot contain more than one certificate or CRL object (while PEM can contain several concatenated PEM objects) X509_load_cert_crl_file with FILETYPE_ASN1 is equivalent to X509_load_cert_file.

                                                                                                                                                            Constant FILETYPE_DEFAULT with NULL filename causes these functions to load default certificate store file (see X509_STORE_set_default_paths(3).

                                                                                                                                                            Functions return number of objects loaded from file or 0 in case of error.

                                                                                                                                                            Both methods support adding several certificate locations into one X509_STORE.

                                                                                                                                                            This page documents certificate store formats used by these methods and caching policy.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#file-method","title":"File Method","text":"

                                                                                                                                                            The X509_LOOKUP_file method loads all the certificates or CRLs present in a file into memory at the time the file is added as a lookup source.

                                                                                                                                                            File format is ASCII text which contains concatenated PEM certificates and CRLs.

                                                                                                                                                            This method should be used by applications which work with a small set of CAs.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#hashed-directory-method","title":"Hashed Directory Method","text":"

                                                                                                                                                            X509_LOOKUP_hash_dir is a more advanced method, which loads certificates and CRLs on demand, and caches them in memory once they are loaded. As of OpenSSL 1.0.0, it also checks for newer CRLs upon each lookup, so that newer CRLs are as soon as they appear in the directory.

                                                                                                                                                            The directory should contain one certificate or CRL per file in PEM format, with a filename of the form hash.N for a certificate, or hash.rN for a CRL. The hash is the value returned by the X509_NAME_hash_ex(3) function applied to the subject name for certificates or issuer name for CRLs. The hash can also be obtained via the -hash option of the openssl-x509(1) or openssl-crl(1) commands.

                                                                                                                                                            The .N or .rN suffix is a sequence number that starts at zero, and is incremented consecutively for each certificate or CRL with the same hash value. Gaps in the sequence numbers are not supported, it is assumed that there are no more objects with the same hash beyond the first missing number in the sequence.

                                                                                                                                                            Sequence numbers make it possible for the directory to contain multiple certificates with same subject name hash value. For example, it is possible to have in the store several certificates with same subject or several CRLs with same issuer (and, for example, different validity period).

                                                                                                                                                            When checking for new CRLs once one CRL for given hash value is loaded, hash_dir lookup method checks only for certificates with sequence number greater than that of the already cached CRL.

                                                                                                                                                            Note that the hash algorithm used for subject name hashing changed in OpenSSL 1.0.0, and all certificate stores have to be rehashed when moving from OpenSSL 0.9.8 to 1.0.0.

                                                                                                                                                            OpenSSL includes a openssl-rehash(1) utility which creates symlinks with hashed names for all files with .pem suffix in a given directory.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#ossl_store-method","title":"OSSL_STORE Method","text":"

                                                                                                                                                            X509_LOOKUP_store is a method that allows access to any store of certificates and CRLs through any loader supported by ossl_store(7). It works with the help of URIs, which can be direct references to certificates or CRLs, but can also be references to catalogues of such objects (that behave like directories).

                                                                                                                                                            This method overlaps the \"File Method\" and \"Hashed Directory Method\" because of the 'file:' scheme loader. It does no caching of its own, but can use a caching ossl_store(7) loader, and therefore depends on the loader's capability.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_LOOKUP_hash_dir(), X509_LOOKUP_file() and X509_LOOKUP_store() always return a valid X509_LOOKUP_METHOD structure.

                                                                                                                                                            X509_load_cert_file(), X509_load_crl_file() and X509_load_cert_crl_file() return the number of loaded objects or 0 on error.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            PEM_read_PrivateKey(3), X509_STORE_load_locations(3), SSL_CTX_load_verify_locations(3), X509_LOOKUP_meth_new(3), ossl_store(7)

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#history","title":"HISTORY","text":"

                                                                                                                                                            The functions X509_load_cert_file_ex(), X509_load_cert_crl_file_ex() and X509_LOOKUP_store() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_hash_dir/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_meth_new/","title":"X509_LOOKUP_meth_new","text":""},{"location":"man3/X509_LOOKUP_meth_new/#name","title":"NAME","text":"

                                                                                                                                                            X509_LOOKUP_METHOD, X509_LOOKUP_meth_new, X509_LOOKUP_meth_free, X509_LOOKUP_meth_set_new_item, X509_LOOKUP_meth_get_new_item, X509_LOOKUP_meth_set_free, X509_LOOKUP_meth_get_free, X509_LOOKUP_meth_set_init, X509_LOOKUP_meth_get_init, X509_LOOKUP_meth_set_shutdown, X509_LOOKUP_meth_get_shutdown, X509_LOOKUP_ctrl_fn, X509_LOOKUP_meth_set_ctrl, X509_LOOKUP_meth_get_ctrl, X509_LOOKUP_get_by_subject_fn, X509_LOOKUP_meth_set_get_by_subject, X509_LOOKUP_meth_get_get_by_subject, X509_LOOKUP_get_by_issuer_serial_fn, X509_LOOKUP_meth_set_get_by_issuer_serial, X509_LOOKUP_meth_get_get_by_issuer_serial, X509_LOOKUP_get_by_fingerprint_fn, X509_LOOKUP_meth_set_get_by_fingerprint, X509_LOOKUP_meth_get_get_by_fingerprint, X509_LOOKUP_get_by_alias_fn, X509_LOOKUP_meth_set_get_by_alias, X509_LOOKUP_meth_get_get_by_alias, X509_OBJECT_set1_X509, X509_OBJECT_set1_X509_CRL - Routines to build up X509_LOOKUP methods

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_meth_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\ntypedef x509_lookup_method_st X509_LOOKUP_METHOD;\n\nX509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name);\nvoid X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method);\n\nint X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method,\n                                  int (*new_item) (X509_LOOKUP *ctx));\nint (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\nint X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method,\n                              void (*free) (X509_LOOKUP *ctx));\nvoid (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\nint X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method,\n                              int (*init) (X509_LOOKUP *ctx));\nint (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\nint X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method,\n                                  int (*shutdown) (X509_LOOKUP *ctx));\nint (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method))\n    (X509_LOOKUP *ctx);\n\ntypedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc,\n                                   long argl, char **ret);\nint X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_ctrl_fn ctrl_fn);\nX509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx,\n                                             X509_LOOKUP_TYPE type,\n                                             const X509_NAME *name,\n                                             X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_get_by_subject_fn fn);\nX509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject(\n    const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx,\n                                                   X509_LOOKUP_TYPE type,\n                                                   const X509_NAME *name,\n                                                   const ASN1_INTEGER *serial,\n                                                   X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_issuer_serial(\n    X509_LOOKUP_METHOD *method, X509_LOOKUP_get_by_issuer_serial_fn fn);\nX509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial(\n    const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx,\n                                                 X509_LOOKUP_TYPE type,\n                                                 const unsigned char* bytes,\n                                                 int len,\n                                                 X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_get_by_fingerprint_fn fn);\nX509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint(\n    const X509_LOOKUP_METHOD *method);\n\ntypedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx,\n                                           X509_LOOKUP_TYPE type,\n                                           const char *str,\n                                           int len,\n                                           X509_OBJECT *ret);\nint X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method,\n    X509_LOOKUP_get_by_alias_fn fn);\nX509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias(\n    const X509_LOOKUP_METHOD *method);\n\nint X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj);\nint X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj);\n
                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_meth_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The X509_LOOKUP_METHOD type is a structure used for the implementation of new X509_LOOKUP types. It provides a set of functions used by OpenSSL for the implementation of various X509 and X509_CRL lookup capabilities. One instance of an X509_LOOKUP_METHOD can be associated to many instantiations of an X509_LOOKUP structure.

                                                                                                                                                            X509_LOOKUP_meth_new() creates a new X509_LOOKUP_METHOD structure. It should be given a human-readable string containing a brief description of the lookup method.

                                                                                                                                                            X509_LOOKUP_meth_free() destroys a X509_LOOKUP_METHOD structure. If the argument is NULL, nothing is done.

                                                                                                                                                            X509_LOOKUP_get_new_item() and X509_LOOKUP_set_new_item() get and set the function that is called when an X509_LOOKUP object is created with X509_LOOKUP_new(). If an X509_LOOKUP_METHOD requires any per-X509_LOOKUP specific data, the supplied new_item function should allocate this data and invoke X509_LOOKUP_set_method_data(3).

                                                                                                                                                            X509_LOOKUP_get_free() and X509_LOOKUP_set_free() get and set the function that is used to free any method data that was allocated and set from within new_item function.

                                                                                                                                                            X509_LOOKUP_meth_get_init() and X509_LOOKUP_meth_set_init() get and set the function that is used to initialize the method data that was set with X509_LOOKUP_set_method_data(3) as part of the new_item routine.

                                                                                                                                                            X509_LOOKUP_meth_get_shutdown() and X509_LOOKUP_meth_set_shutdown() get and set the function that is used to shut down the method data whose state was previously initialized in the init function.

                                                                                                                                                            X509_LOOKUP_meth_get_ctrl() and X509_LOOKUP_meth_set_ctrl() get and set a function to be used to handle arbitrary control commands issued by X509_LOOKUP_ctrl(). The control function is given the X509_LOOKUP ctx, along with the arguments passed by X509_LOOKUP_ctrl. cmd is an arbitrary integer that defines some operation. argc is a pointer to an array of characters. argl is an integer. ret, if set, points to a location where any return data should be written to. How argc and argl are used depends entirely on the control function.

                                                                                                                                                            X509_LOOKUP_set_get_by_subject(), X509_LOOKUP_set_get_by_issuer_serial(), X509_LOOKUP_set_get_by_fingerprint(), X509_LOOKUP_set_get_by_alias() set the functions used to retrieve an X509 or X509_CRL object by the object's subject, issuer, fingerprint, and alias respectively. These functions are given the X509_LOOKUP context, the type of the X509_OBJECT being requested, parameters related to the lookup, and an X509_OBJECT that will receive the requested object.

                                                                                                                                                            Implementations must add objects they find to the X509_STORE object using X509_STORE_add_cert() or X509_STORE_add_crl(). This increments its reference count. However, the X509_STORE_CTX_get_by_subject() function also increases the reference count which leads to one too many references being held. Therefore, applications should additionally call X509_free() or X509_CRL_free() to decrement the reference count again.

                                                                                                                                                            Implementations should also use either X509_OBJECT_set1_X509() or X509_OBJECT_set1_X509_CRL() to set the result. Note that this also increments the result's reference count.

                                                                                                                                                            Any method data that was created as a result of the new_item function set by X509_LOOKUP_meth_set_new_item() can be accessed with X509_LOOKUP_get_method_data(3). The X509_STORE object that owns the X509_LOOKUP may be accessed with X509_LOOKUP_get_store(3). Successful lookups should return 1, and unsuccessful lookups should return 0.

                                                                                                                                                            X509_LOOKUP_get_get_by_subject(), X509_LOOKUP_get_get_by_issuer_serial(), X509_LOOKUP_get_get_by_fingerprint(), X509_LOOKUP_get_get_by_alias() retrieve the function set by the corresponding setter.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_meth_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The X509_LOOKUP_meth_set functions return 1 on success or 0 on error.

                                                                                                                                                            The X509_LOOKUP_meth_get functions return the corresponding function pointers.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_meth_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_STORE_new(3), SSL_CTX_set_cert_store(3)

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_meth_new/#history","title":"HISTORY","text":"

                                                                                                                                                            The functions described here were added in OpenSSL 1.1.0i.

                                                                                                                                                            "},{"location":"man3/X509_LOOKUP_meth_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_NAME_ENTRY_get_object/","title":"X509_NAME_ENTRY_get_object","text":""},{"location":"man3/X509_NAME_ENTRY_get_object/#name","title":"NAME","text":"

                                                                                                                                                            X509_NAME_ENTRY_get_object, X509_NAME_ENTRY_get_data, X509_NAME_ENTRY_set_object, X509_NAME_ENTRY_set_data, X509_NAME_ENTRY_create_by_txt, X509_NAME_ENTRY_create_by_NID, X509_NAME_ENTRY_create_by_OBJ - X509_NAME_ENTRY utility functions

                                                                                                                                                            "},{"location":"man3/X509_NAME_ENTRY_get_object/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne);\nASN1_STRING *X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne);\n\nint X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj);\nint X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,\n                             const unsigned char *bytes, int len);\n\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, const char *field,\n                                               int type, const unsigned char *bytes,\n                                               int len);\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,\n                                               int type, const unsigned char *bytes,\n                                               int len);\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,\n                                               const ASN1_OBJECT *obj, int type,\n                                               const unsigned char *bytes, int len);\n
                                                                                                                                                            "},{"location":"man3/X509_NAME_ENTRY_get_object/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_NAME_ENTRY_get_object() retrieves the field name of ne in and ASN1_OBJECT structure.

                                                                                                                                                            X509_NAME_ENTRY_get_data() retrieves the field value of ne in and ASN1_STRING structure.

                                                                                                                                                            X509_NAME_ENTRY_set_object() sets the field name of ne to obj.

                                                                                                                                                            X509_NAME_ENTRY_set_data() sets the field value of ne to string type type and value determined by bytes and len.

                                                                                                                                                            X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_create_by_OBJ() create and return an X509_NAME_ENTRY structure.

                                                                                                                                                            "},{"location":"man3/X509_NAME_ENTRY_get_object/#notes","title":"NOTES","text":"

                                                                                                                                                            X509_NAME_ENTRY_get_object() and X509_NAME_ENTRY_get_data() can be used to examine an X509_NAME_ENTRY function as returned by X509_NAME_get_entry() for example.

                                                                                                                                                            X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_OBJ(), X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_set_data() are seldom used in practice because X509_NAME_ENTRY structures are almost always part of X509_NAME structures and the corresponding X509_NAME functions are typically used to create and add new entries in a single operation.

                                                                                                                                                            The arguments of these functions support similar options to the similarly named ones of the corresponding X509_NAME functions such as X509_NAME_add_entry_by_txt(). So for example type can be set to MBSTRING_ASC but in the case of X509_set_data() the field name must be set first so the relevant field information can be looked up internally.

                                                                                                                                                            "},{"location":"man3/X509_NAME_ENTRY_get_object/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_NAME_ENTRY_get_object() returns a valid ASN1_OBJECT structure if it is set or NULL if an error occurred.

                                                                                                                                                            X509_NAME_ENTRY_get_data() returns a valid ASN1_STRING structure if it is set or NULL if an error occurred.

                                                                                                                                                            X509_NAME_ENTRY_set_object() and X509_NAME_ENTRY_set_data() return 1 on success or 0 on error.

                                                                                                                                                            X509_NAME_ENTRY_create_by_txt(), X509_NAME_ENTRY_create_by_NID() and X509_NAME_ENTRY_create_by_OBJ() return a valid X509_NAME_ENTRY on success or NULL if an error occurred.

                                                                                                                                                            "},{"location":"man3/X509_NAME_ENTRY_get_object/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3), d2i_X509_NAME(3), OBJ_nid2obj(3)

                                                                                                                                                            "},{"location":"man3/X509_NAME_ENTRY_get_object/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/","title":"X509_NAME_add_entry_by_txt","text":""},{"location":"man3/X509_NAME_add_entry_by_txt/#name","title":"NAME","text":"

                                                                                                                                                            X509_NAME_add_entry_by_txt, X509_NAME_add_entry_by_OBJ, X509_NAME_add_entry_by_NID, X509_NAME_add_entry, X509_NAME_delete_entry - X509_NAME modification functions

                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,\n                               const unsigned char *bytes, int len, int loc, int set);\n\nint X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type,\n                               const unsigned char *bytes, int len, int loc, int set);\n\nint X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,\n                               const unsigned char *bytes, int len, int loc, int set);\n\nint X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, int loc, int set);\n\nX509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);\n
                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ() and X509_NAME_add_entry_by_NID() add a field whose name is defined by a string field, an object obj or a NID nid respectively. The field value to be added is in bytes of length len. If len is -1 then the field length is calculated internally using strlen(bytes).

                                                                                                                                                            The type of field is determined by type which can either be a definition of the type of bytes (such as MBSTRING_ASC) or a standard ASN1 type (such as V_ASN1_IA5STRING). The new entry is added to a position determined by loc and set.

                                                                                                                                                            X509_NAME_add_entry() adds a copy of X509_NAME_ENTRY structure ne to name. The new entry is added to a position determined by loc and set. Since a copy of ne is added ne must be freed up after the call.

                                                                                                                                                            X509_NAME_delete_entry() deletes an entry from name at position loc. The deleted entry is returned and must be freed up.

                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#notes","title":"NOTES","text":"

                                                                                                                                                            The use of string types such as MBSTRING_ASC or MBSTRING_UTF8 is strongly recommended for the type parameter. This allows the internal code to correctly determine the type of the field and to apply length checks according to the relevant standards. This is done using ASN1_STRING_set_by_NID().

                                                                                                                                                            If instead an ASN1 type is used no checks are performed and the supplied data in bytes is used directly.

                                                                                                                                                            In X509_NAME_add_entry_by_txt() the field string represents the field name using OBJ_txt2obj(field, 0).

                                                                                                                                                            The loc and set parameters determine where a new entry should be added. For almost all applications loc can be set to -1 and set to 0. This adds a new entry to the end of name as a single valued RelativeDistinguishedName (RDN).

                                                                                                                                                            loc actually determines the index where the new entry is inserted: if it is -1 it is appended.

                                                                                                                                                            set determines how the new type is added. If it is zero a new RDN is created.

                                                                                                                                                            If set is -1 or 1 it is added as a new set member to the previous or next RDN structure, respectively. This will then become part of a multi-valued RDN (containing a set of AVAs). Since multi-valued RDNs are very rarely used set typically will be zero.

                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_NAME_add_entry_by_txt(), X509_NAME_add_entry_by_OBJ(), X509_NAME_add_entry_by_NID() and X509_NAME_add_entry() return 1 for success of 0 if an error occurred.

                                                                                                                                                            X509_NAME_delete_entry() returns either the deleted X509_NAME_ENTRY structure or NULL if an error occurred.

                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Create an X509_NAME structure:

                                                                                                                                                            \"C=UK, O=Disorganized Organization, CN=Joe Bloggs\"

                                                                                                                                                            X509_NAME *nm;\n\nnm = X509_NAME_new();\nif (nm == NULL)\n    /* Some error */\nif (!X509_NAME_add_entry_by_txt(nm, \"C\", MBSTRING_ASC,\n                                \"UK\", -1, -1, 0))\n    /* Error */\nif (!X509_NAME_add_entry_by_txt(nm, \"O\", MBSTRING_ASC,\n                                \"Disorganized Organization\", -1, -1, 0))\n    /* Error */\nif (!X509_NAME_add_entry_by_txt(nm, \"CN\", MBSTRING_ASC,\n                                \"Joe Bloggs\", -1, -1, 0))\n    /* Error */\n
                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#bugs","title":"BUGS","text":"

                                                                                                                                                            type can still be set to V_ASN1_APP_CHOOSE to use a different algorithm to determine field types. Since this form does not understand multicharacter types, performs no length checks and can result in invalid field types its use is strongly discouraged.

                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3), d2i_X509_NAME(3)

                                                                                                                                                            "},{"location":"man3/X509_NAME_add_entry_by_txt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_NAME_get0_der/","title":"X509_NAME_get0_der","text":""},{"location":"man3/X509_NAME_get0_der/#name","title":"NAME","text":"

                                                                                                                                                            X509_NAME_get0_der - get X509_NAME DER encoding

                                                                                                                                                            "},{"location":"man3/X509_NAME_get0_der/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_NAME_get0_der(const X509_NAME *nm, const unsigned char **pder,\n                       size_t *pderlen);\n
                                                                                                                                                            "},{"location":"man3/X509_NAME_get0_der/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The function X509_NAME_get0_der() returns an internal pointer to the encoding of an X509_NAME structure in *pder and consisting of *pderlen bytes. It is useful for applications that wish to examine the encoding of an X509_NAME structure without copying it.

                                                                                                                                                            "},{"location":"man3/X509_NAME_get0_der/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The function X509_NAME_get0_der() returns 1 for success and 0 if an error occurred.

                                                                                                                                                            "},{"location":"man3/X509_NAME_get0_der/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3)

                                                                                                                                                            "},{"location":"man3/X509_NAME_get0_der/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_NAME_get_index_by_NID/","title":"X509_NAME_get_index_by_NID","text":""},{"location":"man3/X509_NAME_get_index_by_NID/#name","title":"NAME","text":"

                                                                                                                                                            X509_NAME_get_index_by_NID, X509_NAME_get_index_by_OBJ, X509_NAME_get_entry, X509_NAME_entry_count, X509_NAME_get_text_by_NID, X509_NAME_get_text_by_OBJ - X509_NAME lookup and enumeration functions

                                                                                                                                                            "},{"location":"man3/X509_NAME_get_index_by_NID/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos);\nint X509_NAME_get_index_by_OBJ(const X509_NAME *name,\n                               const ASN1_OBJECT *obj, int lastpos);\n\nint X509_NAME_entry_count(const X509_NAME *name);\nX509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc);\n\nint X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,\n                              char *buf, int len);\nint X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj,\n                              char *buf, int len);\n
                                                                                                                                                            "},{"location":"man3/X509_NAME_get_index_by_NID/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions allow an X509_NAME structure to be examined. The X509_NAME structure is the same as the Name type defined in RFC2459 (and elsewhere) and used for example in certificate subject and issuer names.

                                                                                                                                                            X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() retrieve the next index matching nid or obj after lastpos. lastpos should initially be set to -1. If there are no more entries -1 is returned. If nid is invalid (doesn't correspond to a valid OID) then -2 is returned.

                                                                                                                                                            X509_NAME_entry_count() returns the total number of entries in name.

                                                                                                                                                            X509_NAME_get_entry() retrieves the X509_NAME_ENTRY from name corresponding to index loc. Acceptable values for loc run from 0 to (X509_NAME_entry_count(name) - 1). The value returned is an internal pointer which must not be freed.

                                                                                                                                                            X509_NAME_get_text_by_NID(), X509_NAME_get_text_by_OBJ() retrieve the \"text\" from the first entry in name which matches nid or obj, if no such entry exists -1 is returned. At most len bytes will be written and the text written to buf will be null terminated. The length of the output string written is returned excluding the terminating null. If buf is then the amount of space needed in buf (excluding the final null) is returned."},{"location":"man3/X509_NAME_get_index_by_NID/#notes","title":"NOTES","text":"

                                                                                                                                                            X509_NAME_get_text_by_NID() and X509_NAME_get_text_by_OBJ() should be considered deprecated because they have various limitations which make them of minimal use in practice. They can only find the first matching entry and will copy the contents of the field verbatim: this can be highly confusing if the target is a multicharacter string type like a BMPString or a UTF8String.

                                                                                                                                                            For a more general solution X509_NAME_get_index_by_NID() or X509_NAME_get_index_by_OBJ() should be used followed by X509_NAME_get_entry() on any matching indices and then the various X509_NAME_ENTRY utility functions on the result.

                                                                                                                                                            The list of all relevant NID_* and OBJ_* codes can be found in the source code header files <openssl/obj_mac.h> and/or <openssl/objects.h>.

                                                                                                                                                            Applications which could pass invalid NIDs to X509_NAME_get_index_by_NID() should check for the return value of -2. Alternatively the NID validity can be determined first by checking OBJ_nid2obj(nid) is not NULL.

                                                                                                                                                            "},{"location":"man3/X509_NAME_get_index_by_NID/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() return the index of the next matching entry or -1 if not found. X509_NAME_get_index_by_NID() can also return -2 if the supplied NID is invalid.

                                                                                                                                                            X509_NAME_entry_count() returns the total number of entries, and 0 for failure.

                                                                                                                                                            X509_NAME_get_entry() returns an X509_NAME pointer to the requested entry or NULL if the index is invalid.

                                                                                                                                                            "},{"location":"man3/X509_NAME_get_index_by_NID/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Process all entries:

                                                                                                                                                            int i;\nX509_NAME_ENTRY *e;\n\nfor (i = 0; i < X509_NAME_entry_count(nm); i++) {\n    e = X509_NAME_get_entry(nm, i);\n    /* Do something with e */\n}\n

                                                                                                                                                            Process all commonName entries:

                                                                                                                                                            int lastpos = -1;\nX509_NAME_ENTRY *e;\n\nfor (;;) {\n    lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos);\n    if (lastpos == -1)\n        break;\n    e = X509_NAME_get_entry(nm, lastpos);\n    /* Do something with e */\n}\n
                                                                                                                                                            "},{"location":"man3/X509_NAME_get_index_by_NID/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3), d2i_X509_NAME(3)

                                                                                                                                                            "},{"location":"man3/X509_NAME_get_index_by_NID/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_NAME_print_ex/","title":"X509_NAME_print_ex","text":""},{"location":"man3/X509_NAME_print_ex/#name","title":"NAME","text":"

                                                                                                                                                            X509_NAME_print_ex, X509_NAME_print_ex_fp, X509_NAME_print, X509_NAME_oneline - X509_NAME printing routines

                                                                                                                                                            "},{"location":"man3/X509_NAME_print_ex/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_NAME_print_ex(BIO *out, const X509_NAME *nm,\n                       int indent, unsigned long flags);\nint X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm,\n                          int indent, unsigned long flags);\nchar *X509_NAME_oneline(const X509_NAME *a, char *buf, int size);\nint X509_NAME_print(BIO *bp, const X509_NAME *name, int obase);\n
                                                                                                                                                            "},{"location":"man3/X509_NAME_print_ex/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_NAME_print_ex() prints a human readable version of nm to BIO out. Each line (for multiline formats) is indented by indent spaces. The output format can be extensively customised by use of the flags parameter.

                                                                                                                                                            X509_NAME_print_ex_fp() is identical to X509_NAME_print_ex() except the output is written to FILE pointer fp.

                                                                                                                                                            X509_NAME_oneline() prints an ASCII version of a to buf. This supports multi-valued RDNs and escapes / and + characters in values. If buf is NULL then a buffer is dynamically allocated and returned, and size is ignored. Otherwise, at most size bytes will be written, including the ending '\\0', and buf is returned.

                                                                                                                                                            X509_NAME_print() prints out name to bp indenting each line by obase characters. Multiple lines are used if the output (including indent) exceeds 80 characters.

                                                                                                                                                            "},{"location":"man3/X509_NAME_print_ex/#notes","title":"NOTES","text":"

                                                                                                                                                            The functions X509_NAME_oneline() and X509_NAME_print() produce a non standard output form, they don't handle multi-character fields and have various quirks and inconsistencies. Their use is strongly discouraged in new applications and they could be deprecated in a future release.

                                                                                                                                                            Although there are a large number of possible flags for most purposes XN_FLAG_ONELINE, XN_FLAG_MULTILINE or XN_FLAG_RFC2253 will suffice. As noted on the ASN1_STRING_print_ex(3) manual page for UTF8 terminals the ASN1_STRFLGS_ESC_MSB should be unset: so for example XN_FLAG_ONELINE & ~ASN1_STRFLGS_ESC_MSB would be used.

                                                                                                                                                            The complete set of the flags supported by X509_NAME_print_ex() is listed below.

                                                                                                                                                            Several options can be ored together.

                                                                                                                                                            The options XN_FLAG_SEP_COMMA_PLUS, XN_FLAG_SEP_CPLUS_SPC, XN_FLAG_SEP_SPLUS_SPC and XN_FLAG_SEP_MULTILINE determine the field separators to use. Two distinct separators are used between distinct RelativeDistinguishedName components and separate values in the same RDN for a multi-valued RDN. Multi-valued RDNs are currently very rare so the second separator will hardly ever be used.

                                                                                                                                                            XN_FLAG_SEP_COMMA_PLUS uses comma and plus as separators. XN_FLAG_SEP_CPLUS_SPC uses comma and plus with spaces: this is more readable that plain comma and plus. XN_FLAG_SEP_SPLUS_SPC uses spaced semicolon and plus. XN_FLAG_SEP_MULTILINE uses spaced newline and plus respectively.

                                                                                                                                                            If XN_FLAG_DN_REV is set the whole DN is printed in reversed order.

                                                                                                                                                            The fields XN_FLAG_FN_SN, XN_FLAG_FN_LN, XN_FLAG_FN_OID, XN_FLAG_FN_NONE determine how a field name is displayed. It will use the short name (e.g. CN) the long name (e.g. commonName) always use OID numerical form (normally OIDs are only used if the field name is not recognised) and no field name respectively.

                                                                                                                                                            If XN_FLAG_SPC_EQ is set then spaces will be placed around the '=' character separating field names and values.

                                                                                                                                                            If XN_FLAG_DUMP_UNKNOWN_FIELDS is set then the encoding of unknown fields is printed instead of the values.

                                                                                                                                                            If XN_FLAG_FN_ALIGN is set then field names are padded to 20 characters: this is only of use for multiline format.

                                                                                                                                                            Additionally all the options supported by ASN1_STRING_print_ex() can be used to control how each field value is displayed.

                                                                                                                                                            In addition a number options can be set for commonly used formats.

                                                                                                                                                            XN_FLAG_RFC2253 sets options which produce an output compatible with RFC2253. It is equivalent to: ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS

                                                                                                                                                            XN_FLAG_ONELINE is a more readable one line format which is the same as: ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN

                                                                                                                                                            XN_FLAG_MULTILINE is a multiline format which is the same as: ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN

                                                                                                                                                            XN_FLAG_COMPAT uses a format identical to X509_NAME_print(): in fact it calls X509_NAME_print() internally.

                                                                                                                                                            "},{"location":"man3/X509_NAME_print_ex/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_NAME_oneline() returns a valid string on success or NULL on error.

                                                                                                                                                            X509_NAME_print() returns 1 on success or 0 on error.

                                                                                                                                                            X509_NAME_print_ex() and X509_NAME_print_ex_fp() return 1 on success or 0 on error if the XN_FLAG_COMPAT is set, which is the same as X509_NAME_print(). Otherwise, it returns -1 on error or other values on success.

                                                                                                                                                            "},{"location":"man3/X509_NAME_print_ex/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ASN1_STRING_print_ex(3)

                                                                                                                                                            "},{"location":"man3/X509_NAME_print_ex/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/","title":"X509_PUBKEY_new","text":""},{"location":"man3/X509_PUBKEY_new/#name","title":"NAME","text":"

                                                                                                                                                            X509_PUBKEY_new_ex, X509_PUBKEY_new, X509_PUBKEY_free, X509_PUBKEY_dup, X509_PUBKEY_set, X509_PUBKEY_get0, X509_PUBKEY_get, d2i_PUBKEY_ex, d2i_PUBKEY, i2d_PUBKEY, d2i_PUBKEY_bio, d2i_PUBKEY_fp, i2d_PUBKEY_fp, i2d_PUBKEY_bio, X509_PUBKEY_set0_param, X509_PUBKEY_get0_param, X509_PUBKEY_eq - SubjectPublicKeyInfo public key functions

                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nX509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nX509_PUBKEY *X509_PUBKEY_new(void);\nvoid X509_PUBKEY_free(X509_PUBKEY *a);\nX509_PUBKEY *X509_PUBKEY_dup(const X509_PUBKEY *a);\n\nint X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);\nEVP_PKEY *X509_PUBKEY_get0(const X509_PUBKEY *key);\nEVP_PKEY *X509_PUBKEY_get(const X509_PUBKEY *key);\n\nEVP_PKEY *d2i_PUBKEY_ex(EVP_PKEY **a, const unsigned char **pp, long length,\n                        OSSL_LIB_CTX *libctx, const char *propq);\nEVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length);\nint i2d_PUBKEY(const EVP_PKEY *a, unsigned char **pp);\n\nEVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);\nEVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);\n\nint i2d_PUBKEY_fp(const FILE *fp, EVP_PKEY *pkey);\nint i2d_PUBKEY_bio(BIO *bp, const EVP_PKEY *pkey);\n\nint X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,\n                           int ptype, void *pval,\n                           unsigned char *penc, int penclen);\nint X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,\n                           const unsigned char **pk, int *ppklen,\n                           X509_ALGOR **pa, const X509_PUBKEY *pub);\nint X509_PUBKEY_eq(X509_PUBKEY *a, X509_PUBKEY *b);\n
                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The X509_PUBKEY structure represents the ASN.1 SubjectPublicKeyInfo structure defined in RFC5280 and used in certificates and certificate requests.

                                                                                                                                                            X509_PUBKEY_new_ex() allocates and initializes an X509_PUBKEY structure associated with the given OSSL_LIB_CTX in the libctx parameter. Any algorithm fetches associated with using the X509_PUBKEY object will use the property query string propq. See \"ALGORITHM FETCHING\" in crypto(7) for further information about algorithm fetching.

                                                                                                                                                            X509_PUBKEY_new() is the same as X509_PUBKEY_new_ex() except that the default (NULL) OSSL_LIB_CTX and a NULL property query string are used.

                                                                                                                                                            X509_PUBKEY_dup() creates a duplicate copy of the X509_PUBKEY object specified by a.

                                                                                                                                                            X509_PUBKEY_free() frees up X509_PUBKEY structure a. If a is NULL nothing is done.

                                                                                                                                                            X509_PUBKEY_set() sets the public key in *x to the public key contained in the EVP_PKEY structure pkey. If *x is not NULL any existing public key structure will be freed.

                                                                                                                                                            X509_PUBKEY_get0() returns the public key contained in key. The returned value is an internal pointer which MUST NOT be freed after use.

                                                                                                                                                            X509_PUBKEY_get() is similar to X509_PUBKEY_get0() except the reference count on the returned key is incremented so it MUST be freed using EVP_PKEY_free() after use.

                                                                                                                                                            d2i_PUBKEY_ex() decodes an EVP_PKEY structure using SubjectPublicKeyInfo format. Some public key decoding implementations may use cryptographic algorithms. In this case the supplied library context libctx and property query string propq are used. d2i_PUBKEY() does the same as d2i_PUBKEY_ex() except that the default library context and property query string are used.

                                                                                                                                                            i2d_PUBKEY() encodes an EVP_PKEY structure using SubjectPublicKeyInfo format.

                                                                                                                                                            d2i_PUBKEY_bio(), d2i_PUBKEY_fp(), i2d_PUBKEY_bio() and i2d_PUBKEY_fp() are similar to d2i_PUBKEY() and i2d_PUBKEY() except they decode or encode using a BIO or FILE pointer.

                                                                                                                                                            X509_PUBKEY_set0_param() sets the public key parameters of pub. The OID associated with the algorithm is set to aobj. The type of the algorithm parameters is set to type using the structure pval. The encoding of the public key itself is set to the penclen bytes contained in buffer penc. On success ownership of all the supplied parameters is passed to pub so they must not be freed after the call.

                                                                                                                                                            X509_PUBKEY_get0_param() retrieves the public key parameters from pub, *ppkalg is set to the associated OID and the encoding consists of *ppklen bytes at *pk, *pa is set to the associated AlgorithmIdentifier for the public key. If the value of any of these parameters is not required it can be set to NULL. All of the retrieved pointers are internal and must not be freed after the call.

                                                                                                                                                            X509_PUBKEY_eq() compares two X509_PUBKEY values.

                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/#notes","title":"NOTES","text":"

                                                                                                                                                            The X509_PUBKEY functions can be used to encode and decode public keys in a standard format.

                                                                                                                                                            In many cases applications will not call the X509_PUBKEY functions directly: they will instead call wrapper functions such as X509_get0_pubkey().

                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            If the allocation fails, X509_PUBKEY_new() and X509_PUBKEY_dup() return NULL and set an error code that can be obtained by ERR_get_error(3). Otherwise they return a pointer to the newly allocated structure.

                                                                                                                                                            X509_PUBKEY_free() does not return a value.

                                                                                                                                                            X509_PUBKEY_get0() and X509_PUBKEY_get() return a pointer to an EVP_PKEY structure or NULL if an error occurs.

                                                                                                                                                            X509_PUBKEY_set(), X509_PUBKEY_set0_param() and X509_PUBKEY_get0_param() return 1 for success and 0 if an error occurred.

                                                                                                                                                            X509_PUBKEY_eq() returns 1 for equal, 0 for different, and < 0 on error.

                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_get_pubkey(3),

                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_PUBKEY_new_ex() and X509_PUBKEY_eq() functions were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_PUBKEY_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_attr/","title":"X509_REQ_get_attr","text":""},{"location":"man3/X509_REQ_get_attr/#name","title":"NAME","text":"

                                                                                                                                                            X509_REQ_get_attr_count, X509_REQ_get_attr_by_NID, X509_REQ_get_attr_by_OBJ, X509_REQ_get_attr, X509_REQ_delete_attr, X509_REQ_add1_attr, X509_REQ_add1_attr_by_OBJ, X509_REQ_add1_attr_by_NID, X509_REQ_add1_attr_by_txt - X509_ATTRIBUTE support for signed certificate requests

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_attr/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_REQ_get_attr_count(const X509_REQ *req);\nint X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos);\nint X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj,\n                             int lastpos);\nX509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);\nX509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);\nint X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);\nint X509_REQ_add1_attr_by_OBJ(X509_REQ *req,\n                              const ASN1_OBJECT *obj, int type,\n                              const unsigned char *bytes, int len);\nint X509_REQ_add1_attr_by_NID(X509_REQ *req,\n                              int nid, int type,\n                              const unsigned char *bytes, int len);\nint X509_REQ_add1_attr_by_txt(X509_REQ *req,\n                              const char *attrname, int type,\n                              const unsigned char *bytes, int len);\n
                                                                                                                                                            "},{"location":"man3/X509_REQ_get_attr/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_REQ_get_attr_by_OBJ() finds the location of the first matching object obj in the req attribute list. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to X509_REQ_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the attribute list.

                                                                                                                                                            X509_REQ_get_attr_by_NID() is similar to X509_REQ_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                                            X509_REQ_get_attr() returns the X509_ATTRIBUTE object at index loc in the req attribute list. loc should be in the range from 0 to X509_REQ_get_attr_count() - 1.

                                                                                                                                                            X509_REQ_delete_attr() removes the X509_ATTRIBUTE object at index loc in the req objects list of attributes. An error occurs if req is NULL.

                                                                                                                                                            X509_REQ_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE __attr> to the req object's attribute list. An error will occur if either the attribute list is NULL or the attribute already exists.

                                                                                                                                                            X509_REQ_add1_attr_by_OBJ() creates a new X509_ATTRIBUTE using X509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new obj with type type and data bytes of length len and then pushes it to the req object's attribute list. req must be non NULL or an error will occur. If obj already exists in the attribute list then an error occurs.

                                                                                                                                                            X509_REQ_add1_attr_by_NID() is similar to X509_REQ_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.

                                                                                                                                                            X509_REQ_add1_attr_by_txt() is similar to X509_REQ_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.

                                                                                                                                                            Refer to X509_ATTRIBUTE(3) for information related to attributes.

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_attr/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_REQ_get_attr_count() returns the number of attributes in the req object attribute list or -1 if the attribute list is NULL.

                                                                                                                                                            X509_REQ_get_attr_by_OBJ() returns -1 if either the req object's attribute list is empty OR obj is not found, otherwise it returns the location of the obj in the attribute list.

                                                                                                                                                            X509_REQ_get_attr_by_NID() is similar to X509_REQ_get_attr_by_OBJ(), except that it returns -2 if the nid is not known by OpenSSL.

                                                                                                                                                            X509_REQ_get_attr() returns either an X509_ATTRIBUTE or NULL on error.

                                                                                                                                                            X509_REQ_delete_attr() returns either the removed X509_ATTRIBUTE or NULL if there is a error.

                                                                                                                                                            X509_REQ_add1_attr(), X509_REQ_add1_attr_by_OBJ(), X509_REQ_add1_attr_by_NID() and X509_REQ_add1_attr_by_txt() return 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_attr/#notes","title":"NOTES","text":"

                                                                                                                                                            Any functions that modify the attributes (add or delete) internally set a flag to indicate the ASN.1 encoding has been modified.

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_attr/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_ATTRIBUTE(3)

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_attr/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_extensions/","title":"X509_REQ_get_extensions","text":""},{"location":"man3/X509_REQ_get_extensions/#name","title":"NAME","text":"

                                                                                                                                                            X509_REQ_get_extensions, X509_REQ_add_extensions, X509_REQ_add_extensions_nid - handle X.509 extension attributes of a CSR

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_extensions/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nSTACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);\nint X509_REQ_add_extensions(X509_REQ *req, const STACK_OF(X509_EXTENSION) *exts);\nint X509_REQ_add_extensions_nid(X509_REQ *req,\n                                const STACK_OF(X509_EXTENSION) *exts, int nid);\n
                                                                                                                                                            "},{"location":"man3/X509_REQ_get_extensions/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_REQ_get_extensions() returns the first list of X.509 extensions found in the attributes of req. The returned list is empty if there are no such extensions in req. The caller is responsible for freeing the list obtained.

                                                                                                                                                            X509_REQ_add_extensions() adds to req a list of X.509 extensions exts, which must not be NULL, using the default NID_ext_req. This function must not be called more than once on the same req.

                                                                                                                                                            X509_REQ_add_extensions_nid() is like X509_REQ_add_extensions() except that nid is used to identify the extensions attribute. This function must not be called more than once with the same req and nid.

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_extensions/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_REQ_get_extensions() returns a pointer to STACK_OF(X509_EXTENSION) or NULL on error.

                                                                                                                                                            X509_REQ_add_extensions() and X509_REQ_add_extensions_nid() return 1 on success, 0 on error.

                                                                                                                                                            "},{"location":"man3/X509_REQ_get_extensions/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_SIG_get0/","title":"X509_SIG_get0","text":""},{"location":"man3/X509_SIG_get0/#name","title":"NAME","text":"

                                                                                                                                                            X509_SIG_get0, X509_SIG_getm - DigestInfo functions

                                                                                                                                                            "},{"location":"man3/X509_SIG_get0/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nvoid X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg,\n                   const ASN1_OCTET_STRING **pdigest);\nvoid X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg,\n                   ASN1_OCTET_STRING **pdigest);\n
                                                                                                                                                            "},{"location":"man3/X509_SIG_get0/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_SIG_get0() returns pointers to the algorithm identifier and digest value in sig. X509_SIG_getm() is identical to X509_SIG_get0() except the pointers returned are not constant and can be modified: for example to initialise them.

                                                                                                                                                            "},{"location":"man3/X509_SIG_get0/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_SIG_get0() and X509_SIG_getm() return no values.

                                                                                                                                                            "},{"location":"man3/X509_SIG_get0/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3)

                                                                                                                                                            "},{"location":"man3/X509_SIG_get0/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/","title":"X509_STORE_CTX_get_error","text":""},{"location":"man3/X509_STORE_CTX_get_error/#name","title":"NAME","text":"

                                                                                                                                                            X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, X509_STORE_CTX_get_error_depth, X509_STORE_CTX_set_error_depth, X509_STORE_CTX_get_current_cert, X509_STORE_CTX_set_current_cert, X509_STORE_CTX_get0_cert, X509_STORE_CTX_get1_chain, X509_verify_cert_error_string - get or set certificate verification status information

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint   X509_STORE_CTX_get_error(const X509_STORE_CTX *ctx);\nvoid  X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s);\nint   X509_STORE_CTX_get_error_depth(const X509_STORE_CTX *ctx);\nvoid  X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth);\nX509 *X509_STORE_CTX_get_current_cert(const X509_STORE_CTX *ctx);\nvoid  X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x);\nX509 *X509_STORE_CTX_get0_cert(const X509_STORE_CTX *ctx);\n\nSTACK_OF(X509) *X509_STORE_CTX_get1_chain(const X509_STORE_CTX *ctx);\n\nconst char *X509_verify_cert_error_string(long n);\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions are typically called after certificate or chain verification using X509_verify_cert(3) or X509_STORE_CTX_verify(3) has indicated an error or in a verification callback to determine the nature of an error.

                                                                                                                                                            X509_STORE_CTX_get_error() returns the error code of ctx. See the \"ERROR CODES\" section for a full description of all error codes. It may return a code != X509_V_OK even if X509_verify_cert() did not indicate an error, likely because a verification callback function has waived the error.

                                                                                                                                                            X509_STORE_CTX_set_error() sets the error code of ctx to s. For example it might be used in a verification callback to set an error based on additional checks.

                                                                                                                                                            X509_STORE_CTX_get_error_depth() returns the depth of the error. This is a nonnegative integer representing where in the certificate chain the error occurred. If it is zero it occurred in the end entity certificate, one if it is the certificate which signed the end entity certificate and so on.

                                                                                                                                                            X509_STORE_CTX_set_error_depth() sets the error depth. This can be used in combination with X509_STORE_CTX_set_error() to set the depth at which an error condition was detected.

                                                                                                                                                            X509_STORE_CTX_get_current_cert() returns the current certificate in ctx. If an error occurred, the current certificate will be the one that is most closely related to the error, or possibly NULL if no such certificate is relevant.

                                                                                                                                                            X509_STORE_CTX_set_current_cert() sets the certificate x in ctx which caused the error. This value is not intended to remain valid for very long, and remains owned by the caller. It may be examined by a verification callback invoked to handle each error encountered during chain verification and is no longer required after such a callback. If a callback wishes the save the certificate for use after it returns, it needs to increment its reference count via X509_up_ref(3). Once such a saved certificate is no longer needed it can be freed with X509_free(3).

                                                                                                                                                            X509_STORE_CTX_get0_cert() retrieves an internal pointer to the certificate being verified by the ctx.

                                                                                                                                                            X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous verification is successful. Otherwise the returned chain may be incomplete or invalid. The returned chain persists after the ctx structure is freed. When it is no longer needed it should be free up using:

                                                                                                                                                            sk_X509_pop_free(chain, X509_free);\n

                                                                                                                                                            X509_verify_cert_error_string() returns a human readable error string for verification error n.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_STORE_CTX_get_error() returns X509_V_OK or an error code.

                                                                                                                                                            X509_STORE_CTX_get_error_depth() returns a nonnegative error depth.

                                                                                                                                                            X509_STORE_CTX_get_current_cert() returns the certificate which caused the error or NULL if no certificate is relevant to the error.

                                                                                                                                                            X509_verify_cert_error_string() returns a human readable error string for verification error n.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#error-codes","title":"ERROR CODES","text":"

                                                                                                                                                            A list of error codes and messages is shown below. Some of the error codes are defined but currently never returned: these are described as \"unused\".

                                                                                                                                                            • X509_V_OK: ok

                                                                                                                                                              The operation was successful.

                                                                                                                                                            • X509_V_ERR_UNSPECIFIED: unspecified certificate verification error

                                                                                                                                                              Unspecified error; should not happen.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate

                                                                                                                                                              The issuer certificate of a locally looked up certificate could not be found. This normally means the list of trusted certificates is not complete. To allow any certificate (not only a self-signed one) in the trust store to terminate the chain the X509_V_FLAG_PARTIAL_CHAIN flag may be set.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL

                                                                                                                                                              The CRL of a certificate could not be found.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature

                                                                                                                                                              The certificate signature could not be decrypted. This means that the actual signature value could not be determined rather than it not matching the expected value, this is only meaningful for RSA keys.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature

                                                                                                                                                              The CRL signature could not be decrypted: this means that the actual signature value could not be determined rather than it not matching the expected value. Unused.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key

                                                                                                                                                              The public key in the certificate SubjectPublicKeyInfo field could not be read.

                                                                                                                                                            • X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure

                                                                                                                                                              The signature of the certificate is invalid.

                                                                                                                                                            • X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure

                                                                                                                                                              The signature of the CRL is invalid.

                                                                                                                                                            • X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid

                                                                                                                                                              The certificate is not yet valid: the notBefore date is after the current time.

                                                                                                                                                            • X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired

                                                                                                                                                              The certificate has expired: that is the notAfter date is before the current time.

                                                                                                                                                            • X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid

                                                                                                                                                              The CRL is not yet valid.

                                                                                                                                                            • X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired

                                                                                                                                                              The CRL has expired.

                                                                                                                                                            • X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field

                                                                                                                                                              The certificate notBefore field contains an invalid time.

                                                                                                                                                            • X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field

                                                                                                                                                              The certificate notAfter field contains an invalid time.

                                                                                                                                                            • X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field

                                                                                                                                                              The CRL lastUpdate field contains an invalid time.

                                                                                                                                                            • X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field

                                                                                                                                                              The CRL nextUpdate field contains an invalid time.

                                                                                                                                                            • X509_V_ERR_OUT_OF_MEM: out of memory

                                                                                                                                                              An error occurred trying to allocate memory.

                                                                                                                                                            • X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self-signed certificate

                                                                                                                                                              The passed certificate is self-signed and the same certificate cannot be found in the list of trusted certificates.

                                                                                                                                                            • X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self-signed certificate in certificate chain

                                                                                                                                                              The certificate chain could be built up using the untrusted certificates but no suitable trust anchor (which typically is a self-signed root certificate) could be found in the trust store.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate

                                                                                                                                                              The issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate

                                                                                                                                                              No signatures could be verified because the chain contains only one certificate and it is not self-signed and the X509_V_FLAG_PARTIAL_CHAIN flag is not set.

                                                                                                                                                            • X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long

                                                                                                                                                              The certificate chain length is greater than the supplied maximum depth.

                                                                                                                                                            • X509_V_ERR_CERT_REVOKED: certificate revoked

                                                                                                                                                              The certificate has been revoked.

                                                                                                                                                            • X509_V_ERR_NO_ISSUER_PUBLIC_KEY: issuer certificate doesn't have a public key

                                                                                                                                                              The issuer certificate does not have a public key.

                                                                                                                                                            • X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded

                                                                                                                                                              The basicConstraints path-length parameter has been exceeded.

                                                                                                                                                            • X509_V_ERR_INVALID_PURPOSE: unsuitable certificate purpose

                                                                                                                                                              The target certificate cannot be used for the specified purpose.

                                                                                                                                                            • X509_V_ERR_CERT_UNTRUSTED: certificate not trusted

                                                                                                                                                              The root CA is not marked as trusted for the specified purpose.

                                                                                                                                                            • X509_V_ERR_CERT_REJECTED: certificate rejected

                                                                                                                                                              The root CA is marked to reject the specified purpose.

                                                                                                                                                            • X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch

                                                                                                                                                              The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate.

                                                                                                                                                            • X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch

                                                                                                                                                              The current candidate issuer certificate was rejected because its subject key identifier was present and did not match the authority key identifier current certificate.

                                                                                                                                                            • X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch

                                                                                                                                                              The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate.

                                                                                                                                                            • X509_V_ERR_KEYUSAGE_NO_CERTSIGN: key usage does not include certificate signing

                                                                                                                                                              The current candidate issuer certificate was rejected because its keyUsage extension does not permit certificate signing.

                                                                                                                                                            • X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER: unable to get CRL issuer certificate

                                                                                                                                                              Unable to get CRL issuer certificate.

                                                                                                                                                            • X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: unhandled critical extension

                                                                                                                                                              Unhandled critical extension.

                                                                                                                                                            • X509_V_ERR_KEYUSAGE_NO_CRL_SIGN: key usage does not include CRL signing

                                                                                                                                                              Key usage does not include CRL signing.

                                                                                                                                                            • X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION: unhandled critical CRL extension

                                                                                                                                                              Unhandled critical CRL extension.

                                                                                                                                                            • X509_V_ERR_INVALID_NON_CA: invalid non-CA certificate (has CA markings)

                                                                                                                                                              Invalid non-CA certificate has CA markings.

                                                                                                                                                            • X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED: proxy path length constraint exceeded

                                                                                                                                                              Proxy path length constraint exceeded.

                                                                                                                                                            • X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE: key usage does not include digital signature

                                                                                                                                                              Key usage does not include digital signature, and therefore cannot sign certificates.

                                                                                                                                                            • X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED: proxy certificates not allowed, please set the appropriate flag

                                                                                                                                                              Proxy certificates not allowed unless the X509_V_FLAG_ALLOW_PROXY_CERTS flag is set.

                                                                                                                                                            • X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificate extension

                                                                                                                                                              A certificate extension had an invalid value (for example an incorrect encoding) or some value inconsistent with other extensions.

                                                                                                                                                            • X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent certificate policy extension

                                                                                                                                                              A certificate policies extension had an invalid value (for example an incorrect encoding) or some value inconsistent with other extensions. This error only occurs if policy processing is enabled.

                                                                                                                                                            • X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy

                                                                                                                                                              The verification flags were set to require and explicit policy but none was present.

                                                                                                                                                            • X509_V_ERR_DIFFERENT_CRL_SCOPE: different CRL scope

                                                                                                                                                              The only CRLs that could be found did not match the scope of the certificate.

                                                                                                                                                            • X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: unsupported extension feature

                                                                                                                                                              Some feature of a certificate extension is not supported. Unused.

                                                                                                                                                            • X509_V_ERR_UNNESTED_RESOURCE: RFC 3779 resource not subset of parent's resources

                                                                                                                                                              See RFC 3779 for details.

                                                                                                                                                            • X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation

                                                                                                                                                              A name constraint violation occurred in the permitted subtrees.

                                                                                                                                                            • X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation

                                                                                                                                                              A name constraint violation occurred in the excluded subtrees.

                                                                                                                                                            • X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum not supported

                                                                                                                                                              A certificate name constraints extension included a minimum or maximum field: this is not supported.

                                                                                                                                                            • X509_V_ERR_APPLICATION_VERIFICATION: application verification failure

                                                                                                                                                              An application specific error. This will never be returned unless explicitly set by an application callback.

                                                                                                                                                            • X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constraint type

                                                                                                                                                              An unsupported name constraint type was encountered. OpenSSL currently only supports directory name, DNS name, email and URI types.

                                                                                                                                                            • X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid name constraint syntax

                                                                                                                                                              The format of the name constraint is not recognised: for example an email address format of a form not mentioned in RFC3280. This could be caused by a garbage extension or some new feature not currently supported.

                                                                                                                                                            • X509_V_ERR_UNSUPPORTED_NAME_SYNTAX: unsupported or invalid name syntax

                                                                                                                                                              Unsupported or invalid name syntax.

                                                                                                                                                            • X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error

                                                                                                                                                              An error occurred when attempting to verify the CRL path. This error can only happen if extended CRL checking is enabled.

                                                                                                                                                            • X509_V_ERR_PATH_LOOP: path loop

                                                                                                                                                              Path loop.

                                                                                                                                                            • X509_V_ERR_HOSTNAME_MISMATCH: hostname mismatch

                                                                                                                                                              Hostname mismatch.

                                                                                                                                                            • X509_V_ERR_EMAIL_MISMATCH: email address mismatch

                                                                                                                                                              Email address mismatch.

                                                                                                                                                            • X509_V_ERR_IP_ADDRESS_MISMATCH: IP address mismatch

                                                                                                                                                              IP address mismatch.

                                                                                                                                                            • X509_V_ERR_DANE_NO_MATCH: no matching DANE TLSA records

                                                                                                                                                              DANE TLSA authentication is enabled, but no TLSA records matched the certificate chain. This error is only possible in openssl-s_client(1).

                                                                                                                                                            • X509_V_ERR_EE_KEY_TOO_SMALL: EE certificate key too weak

                                                                                                                                                              EE certificate key too weak.

                                                                                                                                                            • X509_V_ERR_CA_KEY_TOO_SMALL: CA certificate key too weak

                                                                                                                                                              CA certificate key too weak.

                                                                                                                                                            • X509_V_ERR_CA_MD_TOO_WEAK: CA signature digest algorithm too weak

                                                                                                                                                              CA signature digest algorithm too weak.

                                                                                                                                                            • X509_V_ERR_INVALID_CALL: invalid certificate verification context

                                                                                                                                                              Invalid certificate verification context.

                                                                                                                                                            • X509_V_ERR_STORE_LOOKUP: issuer certificate lookup error

                                                                                                                                                              Issuer certificate lookup error.

                                                                                                                                                            • X509_V_ERR_NO_VALID_SCTS: certificate transparency required, but no valid SCTs found

                                                                                                                                                              Certificate Transparency required, but no valid SCTs found.

                                                                                                                                                            • X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION: proxy subject name violation

                                                                                                                                                              Proxy subject name violation.

                                                                                                                                                            • X509_V_ERR_OCSP_VERIFY_NEEDED: OCSP verification needed

                                                                                                                                                              Returned by the verify callback to indicate an OCSP verification is needed.

                                                                                                                                                            • X509_V_ERR_OCSP_VERIFY_FAILED: OCSP verification failed

                                                                                                                                                              Returned by the verify callback to indicate OCSP verification failed.

                                                                                                                                                            • X509_V_ERR_OCSP_CERT_UNKNOWN: OCSP unknown cert

                                                                                                                                                              Returned by the verify callback to indicate that the certificate is not recognized by the OCSP responder.

                                                                                                                                                            • X509_V_ERR_UNSUPPORTED_SIGNATURE_ALGORITHM: unsupported signature algorithm

                                                                                                                                                              Cannot find certificate signature algorithm.

                                                                                                                                                            • X509_V_ERR_SIGNATURE_ALGORITHM_MISMATCH: subject signature algorithm and issuer public key algorithm mismatch

                                                                                                                                                              The issuer's public key is not of the type required by the signature in the subject's certificate.

                                                                                                                                                            • X509_V_ERR_SIGNATURE_ALGORITHM_INCONSISTENCY: cert info signature and signature algorithm mismatch

                                                                                                                                                              The algorithm given in the certificate info is inconsistent with the one used for the certificate signature.

                                                                                                                                                            • X509_V_ERR_INVALID_CA: invalid CA certificate

                                                                                                                                                              A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#notes","title":"NOTES","text":"

                                                                                                                                                            The above functions should be used instead of directly referencing the fields in the X509_VERIFY_CTX structure.

                                                                                                                                                            In versions of OpenSSL before 1.0 the current certificate returned by X509_STORE_CTX_get_current_cert() was never NULL. Applications should check the return value before printing out any debugging information relating to the current certificate.

                                                                                                                                                            If an unrecognised error code is passed to X509_verify_cert_error_string() the numerical value of the unknown code is returned in a static buffer. This is not thread safe but will never happen unless an invalid code is passed.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#bugs","title":"BUGS","text":"

                                                                                                                                                            Previous versions of this documentation swapped the meaning of the X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT and X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY error codes.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_verify_cert(3), X509_STORE_CTX_verify(3), X509_up_ref(3), X509_free(3).

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_get_error/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2009-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/","title":"X509_STORE_CTX_new","text":""},{"location":"man3/X509_STORE_CTX_new/#name","title":"NAME","text":"

                                                                                                                                                            X509_STORE_CTX_new_ex, X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STORE_CTX_init, X509_STORE_CTX_set0_trusted_stack, X509_STORE_CTX_set_cert, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param, X509_STORE_CTX_get0_untrusted, X509_STORE_CTX_set0_untrusted, X509_STORE_CTX_get_num_untrusted, X509_STORE_CTX_get0_chain, X509_STORE_CTX_set0_verified_chain, X509_STORE_CTX_set_default, X509_STORE_CTX_set_verify, X509_STORE_CTX_verify_fn, X509_STORE_CTX_set_purpose, X509_STORE_CTX_set_trust, X509_STORE_CTX_purpose_inherit - X509_STORE_CTX initialisation

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\nX509_STORE_CTX *X509_STORE_CTX_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nX509_STORE_CTX *X509_STORE_CTX_new(void);\nvoid X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_free(X509_STORE_CTX *ctx);\n\nint X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *trust_store,\n                        X509 *target, STACK_OF(X509) *untrusted);\n\nvoid X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);\n\nvoid X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *target);\nvoid X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk);\n\nX509_VERIFY_PARAM *X509_STORE_CTX_get0_param(const X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);\n\nSTACK_OF(X509)* X509_STORE_CTX_get0_untrusted(const X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);\n\nint X509_STORE_CTX_get_num_untrusted(const X509_STORE_CTX *ctx);\nSTACK_OF(X509) *X509_STORE_CTX_get0_chain(const X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *chain);\n\nint X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);\ntypedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *);\nvoid X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, X509_STORE_CTX_verify_fn verify);\n\nint X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);\nint X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);\nint X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,\n                                   int purpose, int trust);\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions initialise an X509_STORE_CTX structure for subsequent use by X509_verify_cert(3) or X509_STORE_CTX_verify(3).

                                                                                                                                                            X509_STORE_CTX_new_ex() returns a newly initialised X509_STORE_CTX structure associated with the specified library context libctx and property query string propq. Any cryptographic algorithms fetched while performing processing with the X509_STORE_CTX will use that library context and property query string.

                                                                                                                                                            X509_STORE_CTX_new() is the same as X509_STORE_CTX_new_ex() except that the default library context and a NULL property query string are used.

                                                                                                                                                            X509_STORE_CTX_cleanup() internally cleans up an X509_STORE_CTX structure. It is used by X509_STORE_CTX_init() and X509_STORE_CTX_free().

                                                                                                                                                            X509_STORE_CTX_free() completely frees up ctx. After this call ctx is no longer valid. If ctx is NULL nothing is done.

                                                                                                                                                            It must be called before each call to X509_verify_cert(3) or X509_STORE_CTX_verify(3), i.e., a context is only good for one verification. If you want to verify a further certificate or chain with the same ctx then you must call X509_STORE_CTX_init() again. The trusted certificate store is set to trust_store of type X509_STORE. This may be NULL because there are no trusted certificates or because they are provided simply as a list using X509_STORE_CTX_set0_trusted_stack(). The certificate to be verified is set to target, and a list of additional certificates may be provided in untrusted, which will be untrusted but may be used to build the chain. Each of the trust_store, target and untrusted parameters can be NULL. Yet note that X509_verify_cert(3) and X509_STORE_CTX_verify(3) will need a verification target. This can also be set using X509_STORE_CTX_set_cert(). For X509_STORE_CTX_verify(3), which takes by default the first element of the list of untrusted certificates as its verification target, this can be also set indirectly using X509_STORE_CTX_set0_untrusted().

                                                                                                                                                            X509_STORE_CTX_set0_trusted_stack() sets the set of trusted certificates of ctx to sk. This is an alternative way of specifying trusted certificates instead of using an X509_STORE where its complexity is not needed or to make sure that only the given set sk of certificates are trusted.

                                                                                                                                                            X509_STORE_CTX_set_cert() sets the target certificate to be verified in ctx to target.

                                                                                                                                                            X509_STORE_CTX_set0_verified_chain() sets the validated chain to chain. Ownership of the chain is transferred to ctx, and so it should not be free'd by the caller.

                                                                                                                                                            X509_STORE_CTX_get0_chain() returns the internal pointer used by the ctx that contains the constructed (output) chain.

                                                                                                                                                            X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate verification to sk. These CRLs will only be used if CRL verification is enabled in the associated X509_VERIFY_PARAM structure. This might be used where additional \"useful\" CRLs are supplied as part of a protocol, for example in a PKCS#7 structure.

                                                                                                                                                            X509_STORE_CTX_get0_param() retrieves an internal pointer to the verification parameters associated with ctx.

                                                                                                                                                            X509_STORE_CTX_set0_param() sets the internal verification parameter pointer to param. After this call param should not be used.

                                                                                                                                                            X509_STORE_CTX_get0_untrusted() retrieves an internal pointer to the stack of untrusted certificates associated with ctx.

                                                                                                                                                            X509_STORE_CTX_set0_untrusted() sets the internal pointer to the stack of untrusted certificates associated with ctx to sk. X509_STORE_CTX_verify() will take the first element, if any, as its default target if the target certificate is not set explicitly.

                                                                                                                                                            X509_STORE_CTX_get_num_untrusted() returns the number of untrusted certificates that were used in building the chain. This is can be used after calling X509_verify_cert(3) and similar functions. With X509_STORE_CTX_verify(3), this does not count the first chain element.

                                                                                                                                                            X509_STORE_CTX_get0_chain() returns the internal pointer used by the ctx that contains the validated chain.

                                                                                                                                                            Details of the chain building and checking process are described in \"Certification Path Building\" in openssl-verification-options(1) and \"Certification Path Validation\" in openssl-verification-options(1).

                                                                                                                                                            X509_STORE_CTX_set0_verified_chain() sets the validated chain used by ctx to be chain. Ownership of the chain is transferred to ctx, and so it should not be free'd by the caller.

                                                                                                                                                            X509_STORE_CTX_set_default() looks up and sets the default verification method to name. This uses the function X509_VERIFY_PARAM_lookup() to find an appropriate set of parameters from the purpose identifier name. Currently defined purposes are sslclient, sslserver, nssslserver, smimesign, smimeencrypt, crlsign, ocsphelper, timestampsign, and any.

                                                                                                                                                            X509_STORE_CTX_set_verify() provides the capability for overriding the default verify function. This function is responsible for verifying chain signatures and expiration times.

                                                                                                                                                            A verify function is defined as an X509_STORE_CTX_verify type which has the following signature:

                                                                                                                                                            int (*verify)(X509_STORE_CTX *);\n

                                                                                                                                                            This function should receive the current X509_STORE_CTX as a parameter and return 1 on success or 0 on failure.

                                                                                                                                                            X509 certificates may contain information about what purposes keys contained within them can be used for. For example \"TLS WWW Server Authentication\" or \"Email Protection\". This \"key usage\" information is held internally to the certificate itself. In addition the trust store containing trusted certificates can declare what purposes we trust different certificates for. This \"trust\" information is not held within the certificate itself but is \"meta\" information held alongside it. This \"meta\" information is associated with the certificate after it is issued and could be determined by a system administrator. For example a certificate might declare that it is suitable for use for both \"TLS WWW Server Authentication\" and \"TLS Client Authentication\", but a system administrator might only trust it for the former. An X.509 certificate extension exists that can record extended key usage information to supplement the purpose information described above. This extended mechanism is arbitrarily extensible and not well suited for a generic library API; applications that need to validate extended key usage information in certificates will need to define a custom \"purpose\" (see below) or supply a nondefault verification callback (X509_STORE_set_verify_cb_func(3)).

                                                                                                                                                            X509_STORE_CTX_set_purpose() sets the purpose for the target certificate being verified in the ctx. Built-in available values for the purpose argument are X509_PURPOSE_SSL_CLIENT, X509_PURPOSE_SSL_SERVER, X509_PURPOSE_NS_SSL_SERVER, X509_PURPOSE_SMIME_SIGN, X509_PURPOSE_SMIME_ENCRYPT, X509_PURPOSE_CRL_SIGN, X509_PURPOSE_ANY, X509_PURPOSE_OCSP_HELPER and X509_PURPOSE_TIMESTAMP_SIGN. It is also possible to create a custom purpose value. Setting a purpose will ensure that the key usage declared within certificates in the chain being verified is consistent with that purpose as well as, potentially, other checks. Every purpose also has an associated default trust value which will also be set at the same time. During verification this trust setting will be verified to check it is consistent with the trust set by the system administrator for certificates in the chain.

                                                                                                                                                            X509_STORE_CTX_set_trust() sets the trust value for the target certificate being verified in the ctx. Built-in available values for the trust argument are X509_TRUST_COMPAT, X509_TRUST_SSL_CLIENT, X509_TRUST_SSL_SERVER, X509_TRUST_EMAIL, X509_TRUST_OBJECT_SIGN, X509_TRUST_OCSP_SIGN, X509_TRUST_OCSP_REQUEST and X509_TRUST_TSA. It is also possible to create a custom trust value. Since X509_STORE_CTX_set_purpose() also sets the trust value it is normally sufficient to only call that function. If both are called then X509_STORE_CTX_set_trust() should be called after X509_STORE_CTX_set_purpose() since the trust setting of the last call will be used.

                                                                                                                                                            It should not normally be necessary for end user applications to call X509_STORE_CTX_purpose_inherit() directly. Typically applications should call X509_STORE_CTX_set_purpose() or X509_STORE_CTX_set_trust() instead. Using this function it is possible to set the purpose and trust values for the ctx at the same time. Both ctx and its internal verification parameter pointer must not be NULL. The def_purpose and purpose arguments can have the same purpose values as described for X509_STORE_CTX_set_purpose() above. The trust argument can have the same trust values as described in X509_STORE_CTX_set_trust() above. Any of the def_purpose, purpose or trust values may also have the value 0 to indicate that the supplied parameter should be ignored. After calling this function the purpose to be used for verification is set from the purpose argument unless the purpose was already set in ctx before, and the trust is set from the trust argument unless the trust was already set in ctx before. If trust is 0 then the trust value will be set from the default trust value for purpose. If the default trust value for the purpose is X509_TRUST_DEFAULT and trust is 0 then the default trust value associated with the def_purpose value is used for the trust setting instead.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#notes","title":"NOTES","text":"

                                                                                                                                                            The certificates and CRLs in a store are used internally and should not be freed up until after the associated X509_STORE_CTX is freed.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#bugs","title":"BUGS","text":"

                                                                                                                                                            The certificates and CRLs in a context are used internally and should not be freed up until after the associated X509_STORE_CTX is freed. Copies should be made or reference counts increased instead.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_STORE_CTX_new() returns a newly allocated context or NULL if an error occurred.

                                                                                                                                                            X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred.

                                                                                                                                                            X509_STORE_CTX_get0_param() returns a pointer to an X509_VERIFY_PARAM structure or NULL if an error occurred.

                                                                                                                                                            X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(), X509_STORE_CTX_set0_trusted_stack(), X509_STORE_CTX_set_cert(), X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not return values.

                                                                                                                                                            X509_STORE_CTX_set_default() returns 1 for success or 0 if an error occurred.

                                                                                                                                                            X509_STORE_CTX_get_num_untrusted() returns the number of untrusted certificates used.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_verify_cert(3), X509_STORE_CTX_verify(3), X509_VERIFY_PARAM_set_flags(3)

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_STORE_CTX_set0_crls() function was added in OpenSSL 1.0.0. The X509_STORE_CTX_get_num_untrusted() function was added in OpenSSL 1.1.0. The X509_STORE_CTX_new_ex() function was added in OpenSSL 3.0.

                                                                                                                                                            There is no need to call X509_STORE_CTX_cleanup() explicitly since OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2009-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/","title":"X509_STORE_CTX_set_verify_cb","text":""},{"location":"man3/X509_STORE_CTX_set_verify_cb/#name","title":"NAME","text":"

                                                                                                                                                            X509_STORE_CTX_get_cleanup, X509_STORE_CTX_get_lookup_crls, X509_STORE_CTX_get_lookup_certs, X509_STORE_CTX_get_check_policy, X509_STORE_CTX_get_cert_crl, X509_STORE_CTX_get_check_crl, X509_STORE_CTX_get_get_crl, X509_STORE_CTX_get_check_revocation, X509_STORE_CTX_get_check_issued, X509_STORE_CTX_get_get_issuer, X509_STORE_CTX_get_verify_cb, X509_STORE_CTX_set_verify_cb, X509_STORE_CTX_verify_cb, X509_STORE_CTX_print_verify_cb - get and set X509_STORE_CTX components such as verification callback

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\ntypedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *);\nint X509_STORE_CTX_print_verify_cb(int ok, X509_STORE_CTX *ctx);\n\nX509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx);\n\nvoid X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,\n                                  X509_STORE_CTX_verify_cb verify_cb);\n\nX509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx);\nX509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx);\nX509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx);\nX509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx);\nX509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx);\nX509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx);\nX509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx);\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_STORE_CTX_set_verify_cb() sets the verification callback of ctx to verify_cb overwriting any existing callback.

                                                                                                                                                            The verification callback can be used to customise the operation of certificate verification, for instance by overriding error conditions or logging errors for debugging purposes.

                                                                                                                                                            However, a verification callback is not essential and the default operation is often sufficient.

                                                                                                                                                            The ok parameter to the callback indicates the value the callback should return to retain the default behaviour. If it is zero then an error condition is indicated. If it is 1 then no error occurred. If the flag X509_V_FLAG_NOTIFY_POLICY is set then ok is set to 2 to indicate the policy checking is complete.

                                                                                                                                                            The ctx parameter to the callback is the X509_STORE_CTX structure that is performing the verification operation. A callback can examine this structure and receive additional information about the error, for example by calling X509_STORE_CTX_get_current_cert(). Additional application data can be passed to the callback via the ex_data mechanism.

                                                                                                                                                            X509_STORE_CTX_print_verify_cb() is a verification callback function that, when a certificate verification has failed, adds an entry to the error queue with code X509_R_CERTIFICATE_VERIFICATION_FAILED and with diagnostic details, including the most relevant fields of the target certificate that failed to verify and, if appropriate, of the available untrusted and trusted certificates.

                                                                                                                                                            X509_STORE_CTX_get_verify_cb() returns the value of the current callback for the specific ctx.

                                                                                                                                                            X509_STORE_CTX_get_get_issuer(), X509_STORE_CTX_get_check_issued(), X509_STORE_CTX_get_check_revocation(), X509_STORE_CTX_get_get_crl(), X509_STORE_CTX_get_check_crl(), X509_STORE_CTX_get_cert_crl(), X509_STORE_CTX_get_check_policy(), X509_STORE_CTX_get_lookup_certs(), X509_STORE_CTX_get_lookup_crls() and X509_STORE_CTX_get_cleanup() return the function pointers cached from the corresponding X509_STORE, please see X509_STORE_set_verify(3) for more information.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#warnings","title":"WARNINGS","text":"

                                                                                                                                                            In general a verification callback should NOT unconditionally return 1 in all circumstances because this will allow verification to succeed no matter what the error. This effectively removes all security from the application because any certificate (including untrusted generated ones) will be accepted.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#notes","title":"NOTES","text":"

                                                                                                                                                            The verification callback can be set and inherited from the parent structure performing the operation. In some cases (such as S/MIME verification) the X509_STORE_CTX structure is created and destroyed internally and the only way to set a custom verification callback is by inheriting it from the associated X509_STORE.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_STORE_CTX_set_verify_cb() does not return a value.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Default callback operation:

                                                                                                                                                            int verify_callback(int ok, X509_STORE_CTX *ctx) {\n    return ok;\n}\n

                                                                                                                                                            Simple example, suppose a certificate in the chain is expired and we wish to continue after this error:

                                                                                                                                                            int verify_callback(int ok, X509_STORE_CTX *ctx) {\n    /* Tolerate certificate expiration */\n    if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED)\n        return 1;\n    /* Otherwise don't override */\n    return ok;\n}\n

                                                                                                                                                            More complex example, we don't wish to continue after any certificate has expired just one specific case:

                                                                                                                                                            int verify_callback(int ok, X509_STORE_CTX *ctx)\n{\n    int err = X509_STORE_CTX_get_error(ctx);\n    X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx);\n\n    if (err == X509_V_ERR_CERT_HAS_EXPIRED) {\n        if (check_is_acceptable_expired_cert(err_cert)\n            return 1;\n    }\n    return ok;\n}\n

                                                                                                                                                            Full featured logging callback. In this case the bio_err is assumed to be a global logging BIO, an alternative would to store a BIO in ctx using ex_data.

                                                                                                                                                            int verify_callback(int ok, X509_STORE_CTX *ctx)\n{\n    X509 *err_cert;\n    int err, depth;\n\n    err_cert = X509_STORE_CTX_get_current_cert(ctx);\n    err = X509_STORE_CTX_get_error(ctx);\n    depth = X509_STORE_CTX_get_error_depth(ctx);\n\n    BIO_printf(bio_err, \"depth=%d \", depth);\n    if (err_cert) {\n        X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert),\n                           0, XN_FLAG_ONELINE);\n        BIO_puts(bio_err, \"\\n\");\n    }\n    else\n        BIO_puts(bio_err, \"<no cert>\\n\");\n    if (!ok)\n        BIO_printf(bio_err, \"verify error:num=%d:%s\\n\", err,\n                   X509_verify_cert_error_string(err));\n    switch (err) {\n    case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:\n        BIO_puts(bio_err, \"issuer= \");\n        X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert),\n                           0, XN_FLAG_ONELINE);\n        BIO_puts(bio_err, \"\\n\");\n        break;\n    case X509_V_ERR_CERT_NOT_YET_VALID:\n    case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:\n        BIO_printf(bio_err, \"notBefore=\");\n        ASN1_TIME_print(bio_err, X509_get_notBefore(err_cert));\n        BIO_printf(bio_err, \"\\n\");\n        break;\n    case X509_V_ERR_CERT_HAS_EXPIRED:\n    case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:\n        BIO_printf(bio_err, \"notAfter=\");\n        ASN1_TIME_print(bio_err, X509_get_notAfter(err_cert));\n        BIO_printf(bio_err, \"\\n\");\n        break;\n    case X509_V_ERR_NO_EXPLICIT_POLICY:\n        policies_print(bio_err, ctx);\n        break;\n    }\n    if (err == X509_V_OK && ok == 2)\n        /* print out policies */\n\n    BIO_printf(bio_err, \"verify return:%d\\n\", ok);\n    return(ok);\n}\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_STORE_CTX_get_error(3) X509_STORE_set_verify_cb_func(3) X509_STORE_CTX_get_ex_new_index(3)

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_STORE_CTX_get_get_issuer(), X509_STORE_CTX_get_check_issued(), X509_STORE_CTX_get_check_revocation(), X509_STORE_CTX_get_get_crl(), X509_STORE_CTX_get_check_crl(), X509_STORE_CTX_get_cert_crl(), X509_STORE_CTX_get_check_policy(), X509_STORE_CTX_get_lookup_certs(), X509_STORE_CTX_get_lookup_crls() and X509_STORE_CTX_get_cleanup() functions were added in OpenSSL 1.1.0.

                                                                                                                                                            X509_STORE_CTX_print_verify_cb() was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_STORE_CTX_set_verify_cb/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2009-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_STORE_add_cert/","title":"X509_STORE_add_cert","text":""},{"location":"man3/X509_STORE_add_cert/#name","title":"NAME","text":"

                                                                                                                                                            X509_STORE, X509_STORE_add_cert, X509_STORE_add_crl, X509_STORE_set_depth, X509_STORE_set_flags, X509_STORE_set_purpose, X509_STORE_set_trust, X509_STORE_add_lookup, X509_STORE_load_file_ex, X509_STORE_load_file, X509_STORE_load_path, X509_STORE_load_store_ex, X509_STORE_load_store, X509_STORE_set_default_paths_ex, X509_STORE_set_default_paths, X509_STORE_load_locations_ex, X509_STORE_load_locations - X509_STORE manipulation

                                                                                                                                                            "},{"location":"man3/X509_STORE_add_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\ntypedef x509_store_st X509_STORE;\n\nint X509_STORE_add_cert(X509_STORE *ctx, X509 *x);\nint X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);\nint X509_STORE_set_depth(X509_STORE *store, int depth);\nint X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);\nint X509_STORE_set_purpose(X509_STORE *ctx, int purpose);\nint X509_STORE_set_trust(X509_STORE *ctx, int trust);\n\nX509_LOOKUP *X509_STORE_add_lookup(X509_STORE *store,\n                                   X509_LOOKUP_METHOD *meth);\n\nint X509_STORE_set_default_paths_ex(X509_STORE *ctx, OSSL_LIB_CTX *libctx,\n                                    const char *propq);\nint X509_STORE_set_default_paths(X509_STORE *ctx);\nint X509_STORE_load_file_ex(X509_STORE *ctx, const char *file,\n                            OSSL_LIB_CTX *libctx, const char *propq);\nint X509_STORE_load_file(X509_STORE *ctx, const char *file);\nint X509_STORE_load_path(X509_STORE *ctx, const char *dir);\nint X509_STORE_load_store_ex(X509_STORE *ctx, const char *uri,\n                             OSSL_LIB_CTX *libctx, const char *propq);\nint X509_STORE_load_store(X509_STORE *ctx, const char *uri);\nint X509_STORE_load_locations_ex(X509_STORE *ctx, const char *file,\n                                 const char *dir, OSSL_LIB_CTX *libctx,\n                                 const char *propq);\nint X509_STORE_load_locations(X509_STORE *ctx,\n                              const char *file, const char *dir);\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_add_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The X509_STORE structure is intended to be a consolidated mechanism for holding information about X.509 certificates and CRLs, and constructing and validating chains of certificates terminating in trusted roots. It admits multiple lookup mechanisms and efficient scaling performance with large numbers of certificates, and a great deal of flexibility in how validation and policy checks are performed.

                                                                                                                                                            Details of the chain building and checking process are described in \"Certification Path Building\" in openssl-verification-options(1) and \"Certification Path Validation\" in openssl-verification-options(1).

                                                                                                                                                            X509_STORE_new(3) creates an empty X509_STORE structure, which contains no information about trusted certificates or where such certificates are located on disk, and is generally not usable. Normally, trusted certificates will be added to the X509_STORE to prepare it for use, via mechanisms such as X509_STORE_add_lookup() and X509_LOOKUP_file(), or PEM_read_bio_X509_AUX() and X509_STORE_add_cert(). CRLs can also be added, and many behaviors configured as desired.

                                                                                                                                                            Once the X509_STORE is suitably configured, X509_STORE_CTX_new() is used to instantiate a single-use X509_STORE_CTX for each chain-building and verification operation. That process includes providing the end-entity certificate to be verified and an additional set of untrusted certificates that may be used in chain-building. As such, it is expected that the certificates included in the X509_STORE are certificates that represent trusted entities such as root certificate authorities (CAs). OpenSSL represents these trusted certificates internally as X509 objects with an associated X509_CERT_AUX, as are produced by PEM_read_bio_X509_AUX() and similar routines that refer to X509_AUX. The public interfaces that operate on such trusted certificates still operate on pointers to X509 objects, though.

                                                                                                                                                            X509_STORE_add_cert() and X509_STORE_add_crl() add the respective object to the X509_STORE's local storage. Untrusted objects should not be added in this way. The added object's reference count is incremented by one, hence the caller retains ownership of the object and needs to free it when it is no longer needed.

                                                                                                                                                            X509_STORE_set_depth(), X509_STORE_set_flags(), X509_STORE_set_purpose(), X509_STORE_set_trust(), and X509_STORE_set1_param() set the default values for the corresponding values used in certificate chain validation. Their behavior is documented in the corresponding X509_VERIFY_PARAM manual pages, e.g., X509_VERIFY_PARAM_set_depth(3).

                                                                                                                                                            X509_STORE_add_lookup() finds or creates a X509_LOOKUP(3) with the X509_LOOKUP_METHOD(3) meth and adds it to the X509_STORE store. This also associates the X509_STORE with the lookup, so X509_LOOKUP functions can look up objects in that store.

                                                                                                                                                            X509_STORE_load_file_ex() loads trusted certificate(s) into an X509_STORE from a given file. The library context libctx and property query propq are used when fetching algorithms from providers.

                                                                                                                                                            X509_STORE_load_file() is similar to X509_STORE_load_file_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            X509_STORE_load_path() loads trusted certificate(s) into an X509_STORE from a given directory path. The certificates in the directory must be in hashed form, as documented in X509_LOOKUP_hash_dir(3).

                                                                                                                                                            X509_STORE_load_store_ex() loads trusted certificate(s) into an X509_STORE from a store at a given URI. The library context libctx and property query propq are used when fetching algorithms from providers.

                                                                                                                                                            X509_STORE_load_store() is similar to X509_STORE_load_store_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            X509_STORE_load_locations_ex() combines X509_STORE_load_file_ex() and X509_STORE_load_path() for a given file and/or directory path. It is permitted to specify just a file, just a directory, or both paths.

                                                                                                                                                            X509_STORE_load_locations() is similar to X509_STORE_load_locations_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            X509_STORE_set_default_paths_ex() is somewhat misnamed, in that it does not set what default paths should be used for loading certificates. Instead, it loads certificates into the X509_STORE from the hardcoded default paths. The library context libctx and property query propq are used when fetching algorithms from providers.

                                                                                                                                                            X509_STORE_set_default_paths() is similar to X509_STORE_set_default_paths_ex() but uses NULL for the library context libctx and property query propq.

                                                                                                                                                            "},{"location":"man3/X509_STORE_add_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_STORE_add_cert(), X509_STORE_add_crl(), X509_STORE_set_depth(), X509_STORE_set_flags(), X509_STORE_set_purpose(), X509_STORE_set_trust(), X509_STORE_load_file_ex(), X509_STORE_load_file(), X509_STORE_load_path(), X509_STORE_load_store_ex(), X509_STORE_load_store(), X509_STORE_load_locations_ex(), X509_STORE_load_locations(), X509_STORE_set_default_paths_ex() and X509_STORE_set_default_paths() return 1 on success or 0 on failure.

                                                                                                                                                            X509_STORE_add_lookup() returns the found or created X509_LOOKUP(3), or NULL on error.

                                                                                                                                                            "},{"location":"man3/X509_STORE_add_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_LOOKUP_hash_dir(3). X509_VERIFY_PARAM_set_depth(3). X509_STORE_new(3), X509_STORE_get0_param(3)

                                                                                                                                                            "},{"location":"man3/X509_STORE_add_cert/#history","title":"HISTORY","text":"

                                                                                                                                                            The functions X509_STORE_set_default_paths_ex(), X509_STORE_load_file_ex(), X509_STORE_load_store_ex() and X509_STORE_load_locations_ex() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_STORE_add_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_STORE_get0_param/","title":"X509_STORE_get0_param","text":""},{"location":"man3/X509_STORE_get0_param/#name","title":"NAME","text":"

                                                                                                                                                            X509_STORE_get0_param, X509_STORE_set1_param, X509_STORE_get0_objects, X509_STORE_get1_all_certs - X509_STORE setter and getter functions

                                                                                                                                                            "},{"location":"man3/X509_STORE_get0_param/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\nX509_VERIFY_PARAM *X509_STORE_get0_param(const X509_STORE *ctx);\nint X509_STORE_set1_param(X509_STORE *ctx, const X509_VERIFY_PARAM *pm);\nSTACK_OF(X509_OBJECT) *X509_STORE_get0_objects(const X509_STORE *ctx);\nSTACK_OF(X509) *X509_STORE_get1_all_certs(X509_STORE *st);\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_get0_param/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_STORE_set1_param() sets the verification parameters to pm for ctx.

                                                                                                                                                            X509_STORE_get0_param() retrieves an internal pointer to the verification parameters for ctx. The returned pointer must not be freed by the calling application

                                                                                                                                                            X509_STORE_get0_objects() retrieves an internal pointer to the store's X509 object cache. The cache contains X509 and X509_CRL objects. The returned pointer must not be freed by the calling application.

                                                                                                                                                            X509_STORE_get1_all_certs() returns a list of all certificates in the store. The caller is responsible for freeing the returned list.

                                                                                                                                                            "},{"location":"man3/X509_STORE_get0_param/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_STORE_get0_param() returns a pointer to an X509_VERIFY_PARAM structure.

                                                                                                                                                            X509_STORE_set1_param() returns 1 for success and 0 for failure.

                                                                                                                                                            X509_STORE_get0_objects() returns a pointer to a stack of X509_OBJECT.

                                                                                                                                                            X509_STORE_get1_all_certs() returns a pointer to a stack of the retrieved certificates on success, else NULL.

                                                                                                                                                            "},{"location":"man3/X509_STORE_get0_param/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_STORE_new(3)

                                                                                                                                                            "},{"location":"man3/X509_STORE_get0_param/#history","title":"HISTORY","text":"

                                                                                                                                                            X509_STORE_get0_param and X509_STORE_get0_objects were added in OpenSSL 1.1.0. X509_STORE_get1_certs was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_STORE_get0_param/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_STORE_new/","title":"X509_STORE_new","text":""},{"location":"man3/X509_STORE_new/#name","title":"NAME","text":"

                                                                                                                                                            X509_STORE_new, X509_STORE_up_ref, X509_STORE_free, X509_STORE_lock,X509_STORE_unlock - X509_STORE allocation, freeing and locking functions

                                                                                                                                                            "},{"location":"man3/X509_STORE_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\nX509_STORE *X509_STORE_new(void);\nvoid X509_STORE_free(X509_STORE *v);\nint X509_STORE_lock(X509_STORE *v);\nint X509_STORE_unlock(X509_STORE *v);\nint X509_STORE_up_ref(X509_STORE *v);\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The X509_STORE_new() function returns a new X509_STORE.

                                                                                                                                                            X509_STORE_up_ref() increments the reference count associated with the X509_STORE object.

                                                                                                                                                            X509_STORE_lock() locks the store from modification by other threads, X509_STORE_unlock() unlocks it.

                                                                                                                                                            X509_STORE_free() frees up a single X509_STORE object. If the argument is NULL, nothing is done.

                                                                                                                                                            "},{"location":"man3/X509_STORE_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_STORE_new() returns a newly created X509_STORE or NULL if the call fails.

                                                                                                                                                            X509_STORE_up_ref(), X509_STORE_lock() and X509_STORE_unlock() return 1 for success and 0 for failure.

                                                                                                                                                            X509_STORE_free() does not return values.

                                                                                                                                                            "},{"location":"man3/X509_STORE_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_STORE_set_verify_cb_func(3) X509_STORE_get0_param(3)

                                                                                                                                                            "},{"location":"man3/X509_STORE_new/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_STORE_up_ref(), X509_STORE_lock() and X509_STORE_unlock() functions were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/X509_STORE_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/","title":"X509_STORE_set_verify_cb_func","text":""},{"location":"man3/X509_STORE_set_verify_cb_func/#name","title":"NAME","text":"

                                                                                                                                                            X509_STORE_set_lookup_crls_cb, X509_STORE_set_verify_func, X509_STORE_get_cleanup, X509_STORE_set_cleanup, X509_STORE_get_lookup_crls, X509_STORE_set_lookup_crls, X509_STORE_get_lookup_certs, X509_STORE_set_lookup_certs, X509_STORE_get_check_policy, X509_STORE_set_check_policy, X509_STORE_get_cert_crl, X509_STORE_set_cert_crl, X509_STORE_get_check_crl, X509_STORE_set_check_crl, X509_STORE_get_get_crl, X509_STORE_set_get_crl, X509_STORE_get_check_revocation, X509_STORE_set_check_revocation, X509_STORE_get_check_issued, X509_STORE_set_check_issued, X509_STORE_CTX_get1_issuer, X509_STORE_get_get_issuer, X509_STORE_set_get_issuer, X509_STORE_CTX_get_verify, X509_STORE_set_verify, X509_STORE_get_verify_cb, X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb, X509_STORE_CTX_cert_crl_fn, X509_STORE_CTX_check_crl_fn, X509_STORE_CTX_check_issued_fn, X509_STORE_CTX_check_policy_fn, X509_STORE_CTX_check_revocation_fn, X509_STORE_CTX_cleanup_fn, X509_STORE_CTX_get_crl_fn, X509_STORE_CTX_get_issuer_fn, X509_STORE_CTX_lookup_certs_fn, X509_STORE_CTX_lookup_crls_fn - set verification callback

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\ntypedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer,\n                                            X509_STORE_CTX *ctx, X509 *x);\ntypedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx,\n                                              X509 *x, X509 *issuer);\ntypedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx);\ntypedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx,\n                                         X509_CRL **crl, X509 *x);\ntypedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl);\ntypedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx,\n                                          X509_CRL *crl, X509 *x);\ntypedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx);\ntypedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx,\n                                                          const X509_NAME *nm);\ntypedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(const\n                                                             X509_STORE_CTX *ctx,\n                                                             const X509_NAME *nm);\ntypedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_verify_cb(X509_STORE *ctx,\n                              X509_STORE_CTX_verify_cb verify_cb);\nX509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify);\nX509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(const X509_STORE_CTX *ctx);\n\nint X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\nX509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(const X509_STORE_CTX *ctx);\nvoid X509_STORE_set_get_issuer(X509_STORE *ctx,\n                               X509_STORE_CTX_get_issuer_fn get_issuer);\n\nvoid X509_STORE_set_check_issued(X509_STORE *ctx,\n                                 X509_STORE_CTX_check_issued_fn check_issued);\nX509_STORE_CTX_check_issued_fn\n    X509_STORE_get_check_issued(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_check_revocation(X509_STORE *ctx,\n                                     X509_STORE_CTX_check_revocation_fn check_revocation);\nX509_STORE_CTX_check_revocation_fn\n    X509_STORE_get_check_revocation(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_get_crl(X509_STORE *ctx,\n                            X509_STORE_CTX_get_crl_fn get_crl);\nX509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_check_crl(X509_STORE *ctx,\n                              X509_STORE_CTX_check_crl_fn check_crl);\nX509_STORE_CTX_check_crl_fn\n    X509_STORE_get_check_crl(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_cert_crl(X509_STORE *ctx,\n                             X509_STORE_CTX_cert_crl_fn cert_crl);\nX509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_check_policy(X509_STORE *ctx,\n                                 X509_STORE_CTX_check_policy_fn check_policy);\nX509_STORE_CTX_check_policy_fn\n    X509_STORE_get_check_policy(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_lookup_certs(X509_STORE *ctx,\n                                 X509_STORE_CTX_lookup_certs_fn lookup_certs);\nX509_STORE_CTX_lookup_certs_fn\n    X509_STORE_get_lookup_certs(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_lookup_crls(X509_STORE *ctx,\n                                X509_STORE_CTX_lookup_crls_fn lookup_crls);\nX509_STORE_CTX_lookup_crls_fn\n    X509_STORE_get_lookup_crls(const X509_STORE_CTX *ctx);\n\nvoid X509_STORE_set_cleanup(X509_STORE *ctx,\n                            X509_STORE_CTX_cleanup_fn cleanup);\nX509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(const X509_STORE_CTX *ctx);\n\n/* Aliases */\nvoid X509_STORE_set_verify_cb_func(X509_STORE *st,\n                                   X509_STORE_CTX_verify_cb verify_cb);\nvoid X509_STORE_set_verify_func(X509_STORE *ctx,\n                                X509_STORE_CTX_verify_fn verify);\nvoid X509_STORE_set_lookup_crls_cb(X509_STORE *ctx,\n                                   X509_STORE_CTX_lookup_crls_fn lookup_crls);\n
                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_STORE_set_verify_cb() sets the verification callback of ctx to verify_cb overwriting the previous callback. The callback assigned with this function becomes a default for the one that can be assigned directly to the corresponding X509_STORE_CTX, please see X509_STORE_CTX_set_verify_cb(3) for further information.

                                                                                                                                                            X509_STORE_set_verify() sets the final chain verification function for ctx to verify. Its purpose is to go through the chain of certificates and check that all signatures are valid and that the current time is within the limits of each certificate's first and last validity time. The final chain verification functions must return 0 on failure and 1 on success. If no chain verification function is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_CTX_get1_issuer() tries to find a certificate from the store component of ctx with a subject name matching the issuer name of x. On success it assigns to *issuer the first match that is currently valid, or at least the most recently expired match if there is no currently valid one. If the function returns 1 the caller is responsible for freeing *issuer.

                                                                                                                                                            X509_STORE_set_get_issuer() sets the function get_issuer to get the \"best\" candidate issuer certificate of the given certificate x. When such a certificate is found, get_issuer must up-ref and assign it to *issuer and then return 1. Otherwise get_issuer must return 0 if not found and -1 (or 0) on failure. If X509_STORE_set_get_issuer() is not used or get_issuer is NULL then X509_STORE_CTX_get1_issuer() is used as the default implementation.

                                                                                                                                                            X509_STORE_set_check_issued() sets the function to check that a given certificate x is issued by the issuer certificate issuer. This function must return 0 on failure (among others if x hasn't been issued with issuer) and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_set_check_revocation() sets the revocation checking function. Its purpose is to look through the final chain and check the revocation status for each certificate. It must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_set_get_crl() sets the function to get the crl for a given certificate x. When found, the crl must be assigned to *crl. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_set_check_crl() sets the function to check the validity of the given crl. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_set_cert_crl() sets the function to check the revocation status of the given certificate x against the given crl. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_set_check_policy() sets the function to check the policies of all the certificates in the final chain.. This function must return 0 on failure and 1 on success. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_set_lookup_certs() and X509_STORE_set_lookup_crls() set the functions to look up all the certs or all the CRLs that match the given name nm. These functions return NULL on failure and a pointer to a stack of certificates (X509) or to a stack of CRLs (X509_CRL) on success. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_set_cleanup() sets the final cleanup function, which is called when the context (X509_STORE_CTX) is being torn down. This function doesn't return any value. If no function to get the issuer is provided, the internal default function will be used instead.

                                                                                                                                                            X509_STORE_get_verify_cb(), X509_STORE_CTX_get_verify(), X509_STORE_get_get_issuer(), X509_STORE_get_check_issued(), X509_STORE_get_check_revocation(), X509_STORE_get_get_crl(), X509_STORE_get_check_crl(), X509_STORE_set_verify(), X509_STORE_set_get_issuer(), X509_STORE_get_cert_crl(), X509_STORE_get_check_policy(), X509_STORE_get_lookup_certs(), X509_STORE_get_lookup_crls() and X509_STORE_get_cleanup() all return the function pointer assigned with X509_STORE_set_check_issued(), X509_STORE_set_check_revocation(), X509_STORE_set_get_crl(), X509_STORE_set_check_crl(), X509_STORE_set_cert_crl(), X509_STORE_set_check_policy(), X509_STORE_set_lookup_certs(), X509_STORE_set_lookup_crls() and X509_STORE_set_cleanup(), or NULL if no assignment has been made.

                                                                                                                                                            X509_STORE_set_verify_cb_func(), X509_STORE_set_verify_func() and X509_STORE_set_lookup_crls_cb() are aliases for X509_STORE_set_verify_cb(), X509_STORE_set_verify() and X509_STORE_set_lookup_crls, available as macros for backward compatibility.

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#notes","title":"NOTES","text":"

                                                                                                                                                            All the callbacks from a X509_STORE are inherited by the corresponding X509_STORE_CTX structure when it is initialized. See X509_STORE_CTX_set_verify_cb(3) for further details.

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#bugs","title":"BUGS","text":"

                                                                                                                                                            The macro version of this function was the only one available before OpenSSL 1.0.0.

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The X509_STORE_set_*() functions do not return a value.

                                                                                                                                                            The X509_STORE_get_*() functions return a pointer of the appropriate function type.

                                                                                                                                                            X509_STORE_CTX_get1_issuer() returns 1 if a suitable certificate is found, 0 if not found, -1 on other error.

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_STORE_CTX_set_verify_cb(3), X509_STORE_CTX_get0_chain(3), X509_STORE_CTX_verify_cb(3), X509_STORE_CTX_verify_fn(3), CMS_verify(3)

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_STORE_set_verify_cb() function was added in OpenSSL 1.0.0.

                                                                                                                                                            The functions X509_STORE_set_verify_cb(), X509_STORE_get_verify_cb(), X509_STORE_set_verify(), X509_STORE_CTX_get_verify(), X509_STORE_set_get_issuer(), X509_STORE_get_get_issuer(), X509_STORE_set_check_issued(), X509_STORE_get_check_issued(), X509_STORE_set_check_revocation(), X509_STORE_get_check_revocation(), X509_STORE_set_get_crl(), X509_STORE_get_get_crl(), X509_STORE_set_check_crl(), X509_STORE_get_check_crl(), X509_STORE_set_cert_crl(), X509_STORE_get_cert_crl(), X509_STORE_set_check_policy(), X509_STORE_get_check_policy(), X509_STORE_set_lookup_certs(), X509_STORE_get_lookup_certs(), X509_STORE_set_lookup_crls(), X509_STORE_get_lookup_crls(), X509_STORE_set_cleanup() and X509_STORE_get_cleanup() were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/X509_STORE_set_verify_cb_func/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/","title":"X509_VERIFY_PARAM_set_flags","text":""},{"location":"man3/X509_VERIFY_PARAM_set_flags/#name","title":"NAME","text":"

                                                                                                                                                            X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_get_inh_flags, X509_VERIFY_PARAM_set_inh_flags, X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_auth_level, X509_VERIFY_PARAM_get_auth_level, X509_VERIFY_PARAM_set_time, X509_VERIFY_PARAM_get_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies, X509_VERIFY_PARAM_get0_host, X509_VERIFY_PARAM_set1_host, X509_VERIFY_PARAM_add1_host, X509_VERIFY_PARAM_set_hostflags, X509_VERIFY_PARAM_get_hostflags, X509_VERIFY_PARAM_get0_peername, X509_VERIFY_PARAM_get0_email, X509_VERIFY_PARAM_set1_email, X509_VERIFY_PARAM_set1_ip, X509_VERIFY_PARAM_get1_ip_asc, X509_VERIFY_PARAM_set1_ip_asc - X509 verification parameters

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\nint X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param,\n                                unsigned long flags);\nint X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,\n                                  unsigned long flags);\nunsigned long X509_VERIFY_PARAM_get_flags(const X509_VERIFY_PARAM *param);\n\nint X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param,\n                                    uint32_t flags);\nuint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param);\n\nint X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);\nint X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);\n\nvoid X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);\ntime_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param);\n\nint X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,\n                                  ASN1_OBJECT *policy);\nint X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,\n                                    STACK_OF(ASN1_OBJECT) *policies);\n\nvoid X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);\nint X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);\n\nvoid X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param,\n                                      int auth_level);\nint X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param);\n\nchar *X509_VERIFY_PARAM_get0_host(X509_VERIFY_PARAM *param, int n);\nint X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,\n                                const char *name, size_t namelen);\nint X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,\n                                const char *name, size_t namelen);\nvoid X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,\n                                     unsigned int flags);\nunsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param);\nchar *X509_VERIFY_PARAM_get0_peername(const X509_VERIFY_PARAM *param);\nchar *X509_VERIFY_PARAM_get0_email(X509_VERIFY_PARAM *param);\nint X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,\n                                 const char *email, size_t emaillen);\nchar *X509_VERIFY_PARAM_get1_ip_asc(X509_VERIFY_PARAM *param);\nint X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,\n                              const unsigned char *ip, size_t iplen);\nint X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc);\n
                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions manipulate the X509_VERIFY_PARAM structure associated with a certificate verification operation.

                                                                                                                                                            The X509_VERIFY_PARAM_set_flags() function sets the flags in param by oring it with flags. See \"VERIFICATION FLAGS\" for a complete description of values the flags parameter can take.

                                                                                                                                                            X509_VERIFY_PARAM_get_flags() returns the flags in param.

                                                                                                                                                            X509_VERIFY_PARAM_get_inh_flags() returns the inheritance flags in param which specifies how verification flags are copied from one structure to another. X509_VERIFY_PARAM_set_inh_flags() sets the inheritance flags. See the INHERITANCE FLAGS section for a description of these bits.

                                                                                                                                                            X509_VERIFY_PARAM_clear_flags() clears the flags flags in param.

                                                                                                                                                            X509_VERIFY_PARAM_set_purpose() sets the verification purpose in param to purpose. This determines the acceptable purpose of the certificate chain, for example X509_PURPOSE_SSL_CLIENT. The purpose requirement is cleared if purpose is 0.

                                                                                                                                                            X509_VERIFY_PARAM_set_trust() sets the trust setting in param to trust.

                                                                                                                                                            X509_VERIFY_PARAM_set_time() sets the verification time in param to t. Normally the current time is used.

                                                                                                                                                            X509_VERIFY_PARAM_add0_policy() adds policy to the acceptable policy set. Contrary to preexisting documentation of this function it does not enable policy checking.

                                                                                                                                                            X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled by default) and sets the acceptable policy set to policies. Any existing policy set is cleared. The policies parameter can be NULL to clear an existing policy set.

                                                                                                                                                            X509_VERIFY_PARAM_set_depth() sets the maximum verification depth to depth. That is the maximum number of intermediate CA certificates that can appear in a chain. A maximal depth chain contains 2 more certificates than the limit, since neither the end-entity certificate nor the trust-anchor count against this limit. Thus a depth limit of 0 only allows the end-entity certificate to be signed directly by the trust anchor, while with a depth limit of 1 there can be one intermediate CA certificate between the trust anchor and the end-entity certificate.

                                                                                                                                                            X509_VERIFY_PARAM_set_auth_level() sets the authentication security level to auth_level. The authentication security level determines the acceptable signature and public key strength when verifying certificate chains. For a certificate chain to validate, the public keys of all the certificates must meet the specified security level. The signature algorithm security level is not enforced for the chain's trust anchor certificate, which is either directly trusted or validated by means other than its signature. See SSL_CTX_set_security_level(3) for the definitions of the available levels. The default security level is -1, or \"not set\". At security level 0 or lower all algorithms are acceptable. Security level 1 requires at least 80-bit-equivalent security and is broadly interoperable, though it will, for example, reject MD5 signatures or RSA keys shorter than 1024 bits.

                                                                                                                                                            X509_VERIFY_PARAM_get0_host() returns the nth expected DNS hostname that has been set using X509_VERIFY_PARAM_set1_host() or X509_VERIFY_PARAM_add1_host(). To obtain all names start with n = 0 and increment n as long as no NULL pointer is returned.

                                                                                                                                                            X509_VERIFY_PARAM_set1_host() sets the expected DNS hostname to name clearing any previously specified hostname. If name is NULL, or empty the list of hostnames is cleared, and name checks are not performed on the peer certificate. If name is NUL-terminated, namelen may be zero, otherwise namelen must be set to the length of name.

                                                                                                                                                            When a hostname is specified, certificate verification automatically invokes X509_check_host(3) with flags equal to the flags argument given to X509_VERIFY_PARAM_set_hostflags() (default zero). Applications are strongly advised to use this interface in preference to explicitly calling X509_check_host(3), hostname checks may be out of scope with the DANE-EE(3) certificate usage, and the internal check will be suppressed as appropriate when DANE verification is enabled.

                                                                                                                                                            When the subject CommonName will not be ignored, whether as a result of the X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT host flag, or because no DNS subject alternative names are present in the certificate, any DNS name constraints in issuer certificates apply to the subject CommonName as well as the subject alternative name extension.

                                                                                                                                                            When the subject CommonName will be ignored, whether as a result of the X509_CHECK_FLAG_NEVER_CHECK_SUBJECT host flag, or because some DNS subject alternative names are present in the certificate, DNS name constraints in issuer certificates will not be applied to the subject DN. As described in X509_check_host(3) the X509_CHECK_FLAG_NEVER_CHECK_SUBJECT flag takes precedence over the X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT flag.

                                                                                                                                                            X509_VERIFY_PARAM_get_hostflags() returns any host flags previously set via a call to X509_VERIFY_PARAM_set_hostflags().

                                                                                                                                                            X509_VERIFY_PARAM_add1_host() adds name as an additional reference identifier that can match the peer's certificate. Any previous names set via X509_VERIFY_PARAM_set1_host() or X509_VERIFY_PARAM_add1_host() are retained, no change is made if name is NULL or empty. When multiple names are configured, the peer is considered verified when any name matches.

                                                                                                                                                            X509_VERIFY_PARAM_get0_peername() returns the DNS hostname or subject CommonName from the peer certificate that matched one of the reference identifiers. When wildcard matching is not disabled, or when a reference identifier specifies a parent domain (starts with \".\") rather than a hostname, the peer name may be a wildcard name or a sub-domain of the reference identifier respectively. The return string is allocated by the library and is no longer valid once the associated param argument is freed. Applications must not free the return value.

                                                                                                                                                            X509_VERIFY_PARAM_get0_email() returns the expected RFC822 email address.

                                                                                                                                                            X509_VERIFY_PARAM_set1_email() sets the expected RFC822 email address to email. If email is NUL-terminated, emaillen may be zero, otherwise emaillen must be set to the length of email. When an email address is specified, certificate verification automatically invokes X509_check_email(3).

                                                                                                                                                            X509_VERIFY_PARAM_get1_ip_asc() returns the expected IP address as a string. The caller is responsible for freeing it.

                                                                                                                                                            X509_VERIFY_PARAM_set1_ip() sets the expected IP address to ip. The ip argument is in binary format, in network byte-order and iplen must be set to 4 for IPv4 and 16 for IPv6. When an IP address is specified, certificate verification automatically invokes X509_check_ip(3).

                                                                                                                                                            X509_VERIFY_PARAM_set1_ip_asc() sets the expected IP address to ipasc. The ipasc argument is a NUL-terminal ASCII string: dotted decimal quad for IPv4 and colon-separated hexadecimal for IPv6. The condensed \"::\" notation is supported for IPv6 addresses.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_VERIFY_PARAM_set_flags(), X509_VERIFY_PARAM_clear_flags(), X509_VERIFY_PARAM_set_inh_flags(), X509_VERIFY_PARAM_set_purpose(), X509_VERIFY_PARAM_set_trust(), X509_VERIFY_PARAM_add0_policy() X509_VERIFY_PARAM_set1_policies(), X509_VERIFY_PARAM_set1_host(), X509_VERIFY_PARAM_add1_host(), X509_VERIFY_PARAM_set1_email(), X509_VERIFY_PARAM_set1_ip() and X509_VERIFY_PARAM_set1_ip_asc() return 1 for success and 0 for failure.

                                                                                                                                                            X509_VERIFY_PARAM_get0_host(), X509_VERIFY_PARAM_get0_email(), and X509_VERIFY_PARAM_get1_ip_asc(), return the string pointers specified above or NULL if the respective value has not been set or on error.

                                                                                                                                                            X509_VERIFY_PARAM_get_flags() returns the current verification flags.

                                                                                                                                                            X509_VERIFY_PARAM_get_hostflags() returns any current host flags.

                                                                                                                                                            X509_VERIFY_PARAM_get_inh_flags() returns the current inheritance flags.

                                                                                                                                                            X509_VERIFY_PARAM_set_time() and X509_VERIFY_PARAM_set_depth() do not return values.

                                                                                                                                                            X509_VERIFY_PARAM_get_depth() returns the current verification depth.

                                                                                                                                                            X509_VERIFY_PARAM_get_auth_level() returns the current authentication security level.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#verification-flags","title":"VERIFICATION FLAGS","text":"

                                                                                                                                                            The verification flags consists of zero or more of the following flags ored together.

                                                                                                                                                            X509_V_FLAG_CRL_CHECK enables CRL checking for the certificate chain leaf certificate. An error occurs if a suitable CRL cannot be found.

                                                                                                                                                            X509_V_FLAG_CRL_CHECK_ALL enables CRL checking for the entire certificate chain.

                                                                                                                                                            X509_V_FLAG_IGNORE_CRITICAL disables critical extension checking. By default any unhandled critical extensions in certificates or (if checked) CRLs result in a fatal error. If this flag is set unhandled critical extensions are ignored. WARNING setting this option for anything other than debugging purposes can be a security risk. Finer control over which extensions are supported can be performed in the verification callback.

                                                                                                                                                            The X509_V_FLAG_X509_STRICT flag disables workarounds for some broken certificates and makes the verification strictly apply X509 rules.

                                                                                                                                                            X509_V_FLAG_ALLOW_PROXY_CERTS enables proxy certificate verification.

                                                                                                                                                            X509_V_FLAG_POLICY_CHECK enables certificate policy checking, by default no policy checking is performed. Additional information is sent to the verification callback relating to policy checking.

                                                                                                                                                            X509_V_FLAG_EXPLICIT_POLICY, X509_V_FLAG_INHIBIT_ANY and X509_V_FLAG_INHIBIT_MAP set the require explicit policy, inhibit any policy and inhibit policy mapping flags respectively as defined in RFC3280. Policy checking is automatically enabled if any of these flags are set.

                                                                                                                                                            If X509_V_FLAG_NOTIFY_POLICY is set and the policy checking is successful a special status code is set to the verification callback. This permits it to examine the valid policy tree and perform additional checks or simply log it for debugging purposes.

                                                                                                                                                            By default some additional features such as indirect CRLs and CRLs signed by different keys are disabled. If X509_V_FLAG_EXTENDED_CRL_SUPPORT is set they are enabled.

                                                                                                                                                            If X509_V_FLAG_USE_DELTAS is set delta CRLs (if present) are used to determine certificate status. If not set deltas are ignored.

                                                                                                                                                            X509_V_FLAG_CHECK_SS_SIGNATURE requests checking the signature of the last certificate in a chain if the certificate is supposedly self-signed. This is prohibited and will result in an error if it is a non-conforming CA certificate with key usage restrictions not including the keyCertSign bit. By default this check is disabled because it doesn't add any additional security but in some cases applications might want to check the signature anyway. A side effect of not checking the self-signature of such a certificate is that disabled or unsupported message digests used for the signature are not treated as fatal errors.

                                                                                                                                                            When X509_V_FLAG_TRUSTED_FIRST is set, which is always the case since OpenSSL 1.1.0, construction of the certificate chain in X509_verify_cert(3) searches the trust store for issuer certificates before searching the provided untrusted certificates. Local issuer certificates are often more likely to satisfy local security requirements and lead to a locally trusted root. This is especially important when some certificates in the trust store have explicit trust settings (see \"TRUST SETTINGS\" in openssl-x509(1)).

                                                                                                                                                            The X509_V_FLAG_NO_ALT_CHAINS flag could have been used before OpenSSL 1.1.0 to suppress checking for alternative chains. By default, unless X509_V_FLAG_TRUSTED_FIRST is set, when building a certificate chain, if the first certificate chain found is not trusted, then OpenSSL will attempt to replace untrusted certificates supplied by the peer with certificates from the trust store to see if an alternative chain can be found that is trusted. As of OpenSSL 1.1.0, with X509_V_FLAG_TRUSTED_FIRST always set, this option has no effect.

                                                                                                                                                            The X509_V_FLAG_PARTIAL_CHAIN flag causes non-self-signed certificates in the trust store to be treated as trust anchors, in the same way as self-signed root CA certificates. This makes it possible to trust self-issued certificates as well as certificates issued by an intermediate CA without having to trust their ancestor root CA. With OpenSSL 1.1.0 and later and X509_V_FLAG_PARTIAL_CHAIN set, chain construction stops as soon as the first certificate contained in the trust store is added to the chain, whether that certificate is a self-signed \"root\" certificate or a not self-signed \"intermediate\" or self-issued certificate. Thus, when an intermediate certificate is found in the trust store, the verified chain passed to callbacks may be shorter than it otherwise would be without the X509_V_FLAG_PARTIAL_CHAIN flag.

                                                                                                                                                            The X509_V_FLAG_NO_CHECK_TIME flag suppresses checking the validity period of certificates and CRLs against the current time. If X509_VERIFY_PARAM_set_time() is used to specify a verification time, the check is not suppressed.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#inheritance-flags","title":"INHERITANCE FLAGS","text":"

                                                                                                                                                            These flags specify how parameters are \"inherited\" from one structure to another.

                                                                                                                                                            If X509_VP_FLAG_ONCE is set then the current setting is zeroed after the next call.

                                                                                                                                                            If X509_VP_FLAG_LOCKED is set then no values are copied. This overrides all of the following flags.

                                                                                                                                                            If X509_VP_FLAG_DEFAULT is set then anything set in the source is copied to the destination. Effectively the values in \"to\" become default values which will be used only if nothing new is set in \"from\". This is the default.

                                                                                                                                                            If X509_VP_FLAG_OVERWRITE is set then all value are copied across whether they are set or not. Flags is still Ored though.

                                                                                                                                                            If X509_VP_FLAG_RESET_FLAGS is set then the flags value is copied instead of ORed.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#notes","title":"NOTES","text":"

                                                                                                                                                            The above functions should be used to manipulate verification parameters instead of functions which work in specific structures such as X509_STORE_CTX_set_flags() which are likely to be deprecated in a future release.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#bugs","title":"BUGS","text":"

                                                                                                                                                            Delta CRL checking is currently primitive. Only a single delta can be used and (partly due to limitations of X509_STORE) constructed CRLs are not maintained.

                                                                                                                                                            If CRLs checking is enable CRLs are expected to be available in the corresponding X509_STORE structure. No attempt is made to download CRLs from the CRL distribution points extension.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Enable CRL checking when performing certificate verification during SSL connections associated with an SSL_CTX structure ctx:

                                                                                                                                                            X509_VERIFY_PARAM *param;\n\nparam = X509_VERIFY_PARAM_new();\nX509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);\nSSL_CTX_set1_param(ctx, param);\nX509_VERIFY_PARAM_free(param);\n
                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_verify_cert(3), X509_check_host(3), X509_check_email(3), X509_check_ip(3), openssl-x509(1)

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_V_FLAG_NO_ALT_CHAINS flag was added in OpenSSL 1.1.0. The flag X509_V_FLAG_CB_ISSUER_CHECK was deprecated in OpenSSL 1.1.0 and has no effect.

                                                                                                                                                            The X509_VERIFY_PARAM_get_hostflags() function was added in OpenSSL 1.1.0i.

                                                                                                                                                            The X509_VERIFY_PARAM_get0_host(), X509_VERIFY_PARAM_get0_email(), and X509_VERIFY_PARAM_get1_ip_asc() functions were added in OpenSSL 3.0.

                                                                                                                                                            The function X509_VERIFY_PARAM_add0_policy() was historically documented as enabling policy checking however the implementation has never done this. The documentation was changed to align with the implementation.

                                                                                                                                                            "},{"location":"man3/X509_VERIFY_PARAM_set_flags/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2009-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_add_cert/","title":"X509_add_cert","text":""},{"location":"man3/X509_add_cert/#name","title":"NAME","text":"

                                                                                                                                                            X509_add_cert, X509_add_certs - X509 certificate list addition functions

                                                                                                                                                            "},{"location":"man3/X509_add_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_add_cert(STACK_OF(X509) *sk, X509 *cert, int flags);\nint X509_add_certs(STACK_OF(X509) *sk, STACK_OF(X509) *certs, int flags);\n
                                                                                                                                                            "},{"location":"man3/X509_add_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_add_cert() adds a certificate cert to the given list sk.

                                                                                                                                                            X509_add_certs() adds a list of certificate certs to the given list sk. The certs argument may be NULL, which implies no effect. It does not modify the list certs but in case the X509_ADD_FLAG_UP_REF flag (described below) is set the reference counters of those of its members added to sk are increased.

                                                                                                                                                            Both these functions have a flags parameter, which is used to control details of the operation.

                                                                                                                                                            The value X509_ADD_FLAG_DEFAULT, which equals 0, means no special semantics.

                                                                                                                                                            If X509_ADD_FLAG_UP_REF is set then the reference counts of those certificates added successfully are increased.

                                                                                                                                                            If X509_ADD_FLAG_PREPEND is set then the certificates are prepended to sk. By default they are appended to sk. In both cases the original order of the added certificates is preserved.

                                                                                                                                                            If X509_ADD_FLAG_NO_DUP is set then certificates already contained in sk, which is determined using X509_cmp(3), are ignored.

                                                                                                                                                            If X509_ADD_FLAG_NO_SS is set then certificates that are marked self-signed, which is determined using X509_self_signed(3), are ignored.

                                                                                                                                                            "},{"location":"man3/X509_add_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            Both functions return 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_add_cert/#notes","title":"NOTES","text":"

                                                                                                                                                            If X509_add_certs() is used with the flags X509_ADD_FLAG_NO_DUP or X509_ADD_FLAG_NO_SS it is advisable to use also X509_ADD_FLAG_UP_REF because otherwise likely not for all members of the certs list the ownership is transferred to the list of certificates sk.

                                                                                                                                                            Care should also be taken in case the certs argument equals sk.

                                                                                                                                                            "},{"location":"man3/X509_add_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_cmp(3) X509_self_signed(3)

                                                                                                                                                            "},{"location":"man3/X509_add_cert/#history","title":"HISTORY","text":"

                                                                                                                                                            The functions X509_add_cert() and X509_add_certs() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_add_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_check_ca/","title":"X509_check_ca","text":""},{"location":"man3/X509_check_ca/#name","title":"NAME","text":"

                                                                                                                                                            X509_check_ca - check if given certificate is CA certificate

                                                                                                                                                            "},{"location":"man3/X509_check_ca/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nint X509_check_ca(X509 *cert);\n
                                                                                                                                                            "},{"location":"man3/X509_check_ca/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            This function checks if given certificate is CA certificate (can be used to sign other certificates). The certificate must be a complete certificate otherwise an error is returned.

                                                                                                                                                            "},{"location":"man3/X509_check_ca/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            Function return 0, if it is not CA certificate, 1 if it is proper X509v3 CA certificate with basicConstraints extension CA:TRUE, 3, if it is self-signed X509 v1 certificate, 4, if it is certificate with keyUsage extension with bit keyCertSign set, but without basicConstraints, and 5 if it has outdated Netscape Certificate Type extension telling that it is CA certificate.

                                                                                                                                                            This function will also return 0 on error.

                                                                                                                                                            Actually, any nonzero value means that this certificate could have been used to sign other certificates.

                                                                                                                                                            "},{"location":"man3/X509_check_ca/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_verify_cert(3), X509_check_issued(3), X509_check_purpose(3)

                                                                                                                                                            "},{"location":"man3/X509_check_ca/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_check_host/","title":"X509_check_host","text":""},{"location":"man3/X509_check_host/#name","title":"NAME","text":"

                                                                                                                                                            X509_check_host, X509_check_email, X509_check_ip, X509_check_ip_asc - X.509 certificate matching

                                                                                                                                                            "},{"location":"man3/X509_check_host/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nint X509_check_host(X509 *, const char *name, size_t namelen,\n                    unsigned int flags, char **peername);\nint X509_check_email(X509 *, const char *address, size_t addresslen,\n                     unsigned int flags);\nint X509_check_ip(X509 *, const unsigned char *address, size_t addresslen,\n                  unsigned int flags);\nint X509_check_ip_asc(X509 *, const char *address, unsigned int flags);\n
                                                                                                                                                            "},{"location":"man3/X509_check_host/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The certificate matching functions are used to check whether a certificate matches a given hostname, email address, or IP address. The validity of the certificate and its trust level has to be checked by other means.

                                                                                                                                                            X509_check_host() checks if the certificate Subject Alternative Name (SAN) or Subject CommonName (CN) matches the specified hostname, which must be encoded in the preferred name syntax described in section 3.5 of RFC 1034. By default, wildcards are supported and they match only in the left-most label; but they may match part of that label with an explicit prefix or suffix. For example, by default, the host name \"www.example.com\" would match a certificate with a SAN or CN value of \"*.example.com\", \"w*.example.com\" or \"*w.example.com\".

                                                                                                                                                            Per section 6.4.2 of RFC 6125, name values representing international domain names must be given in A-label form. The namelen argument must be the number of characters in the name string or zero in which case the length is calculated with strlen(name). When name starts with a dot (e.g. \".example.com\"), it will be matched by a certificate valid for any sub-domain of name, (see also X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS below).

                                                                                                                                                            When the certificate is matched, and peername is not NULL, a pointer to a copy of the matching SAN or CN from the peer certificate is stored at the address passed in peername. The application is responsible for freeing the peername via OPENSSL_free() when it is no longer needed.

                                                                                                                                                            X509_check_email() checks if the certificate matches the specified email address. The mailbox syntax of RFC 822 is supported, comments are not allowed, and no attempt is made to normalize quoted characters. The mailbox syntax of RFC 6531 is supported for SmtpUTF8Mailbox address in subjectAltName according to RFC 8398, with similar limitations as for RFC 822 syntax, and no attempt is made to convert from A-label to U-label before comparison. The addresslen argument must be the number of characters in the address string or zero in which case the length is calculated with strlen(address).

                                                                                                                                                            X509_check_ip() checks if the certificate matches a specified IPv4 or IPv6 address. The address array is in binary format, in network byte order. The length is either 4 (IPv4) or 16 (IPv6). Only explicitly marked addresses in the certificates are considered; IP addresses stored in DNS names and Common Names are ignored. There are currently no flags that would affect the behavior of this call.

                                                                                                                                                            X509_check_ip_asc() is similar, except that the NUL-terminated string address is first converted to the internal representation.

                                                                                                                                                            The flags argument is usually 0. It can be the bitwise OR of the flags:

                                                                                                                                                            • X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT,
                                                                                                                                                            • X509_CHECK_FLAG_NEVER_CHECK_SUBJECT,
                                                                                                                                                            • X509_CHECK_FLAG_NO_WILDCARDS,
                                                                                                                                                            • X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS,
                                                                                                                                                            • X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS.
                                                                                                                                                            • X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS.

                                                                                                                                                            The X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT flag causes the function to consider the subject DN even if the certificate contains at least one subject alternative name of the right type (DNS name or email address as appropriate); the default is to ignore the subject DN when at least one corresponding subject alternative names is present.

                                                                                                                                                            The X509_CHECK_FLAG_NEVER_CHECK_SUBJECT flag causes the function to never consider the subject DN even if the certificate contains no subject alternative names of the right type (DNS name or email address as appropriate); the default is to use the subject DN when no corresponding subject alternative names are present. If both X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT and X509_CHECK_FLAG_NEVER_CHECK_SUBJECT are specified, the latter takes precedence and the subject DN is not checked for matching names.

                                                                                                                                                            If set, X509_CHECK_FLAG_NO_WILDCARDS disables wildcard expansion; this only applies to X509_check_host.

                                                                                                                                                            If set, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS suppresses support for \"*\" as wildcard pattern in labels that have a prefix or suffix, such as: \"www*\" or \"*www\"; this only applies to X509_check_host.

                                                                                                                                                            If set, X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS allows a \"*\" that constitutes the complete label of a DNS name (e.g. \"*.example.com\") to match more than one label in name; this flag only applies to X509_check_host.

                                                                                                                                                            If set, X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS restricts name values which start with \".\", that would otherwise match any sub-domain in the peer certificate, to only match direct child sub-domains. Thus, for instance, with this flag set a name of \".example.com\" would match a peer certificate with a DNS name of \"www.example.com\", but would not match a peer certificate with a DNS name of \"www.sub.example.com\"; this flag only applies to X509_check_host.

                                                                                                                                                            "},{"location":"man3/X509_check_host/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The functions return 1 for a successful match, 0 for a failed match and -1 for an internal error: typically a memory allocation failure or an ASN.1 decoding error.

                                                                                                                                                            All functions can also return -2 if the input is malformed. For example, X509_check_host() returns -2 if the provided name contains embedded NULs.

                                                                                                                                                            "},{"location":"man3/X509_check_host/#notes","title":"NOTES","text":"

                                                                                                                                                            Applications are encouraged to use X509_VERIFY_PARAM_set1_host() rather than explicitly calling X509_check_host(3). Hostname checks may be out of scope with the DANE-EE(3) certificate usage, and the internal checks will be suppressed as appropriate when DANE support is enabled.

                                                                                                                                                            "},{"location":"man3/X509_check_host/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            SSL_get_verify_result(3), X509_VERIFY_PARAM_set1_host(3), X509_VERIFY_PARAM_add1_host(3), X509_VERIFY_PARAM_set1_email(3), X509_VERIFY_PARAM_set1_ip(3)

                                                                                                                                                            "},{"location":"man3/X509_check_host/#history","title":"HISTORY","text":"

                                                                                                                                                            These functions were added in OpenSSL 1.0.2.

                                                                                                                                                            "},{"location":"man3/X509_check_host/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2012-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_check_issued/","title":"X509_check_issued","text":""},{"location":"man3/X509_check_issued/#name","title":"NAME","text":"

                                                                                                                                                            X509_check_issued - checks if certificate is apparently issued by another certificate

                                                                                                                                                            "},{"location":"man3/X509_check_issued/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nint X509_check_issued(X509 *issuer, X509 *subject);\n
                                                                                                                                                            "},{"location":"man3/X509_check_issued/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_check_issued() checks if certificate subject was apparently issued using (CA) certificate issuer. This function takes into account not only matching of the issuer field of subject with the subject field of issuer, but also compares all sub-fields of the authorityKeyIdentifier extension of subject, as far as present, with the respective subjectKeyIdentifier, serial number, and issuer fields of issuer, as far as present. It also checks if the keyUsage field (if present) of issuer allows certificate signing. It does not actually check the certificate signature. An error is returned if the issuer or the subject are incomplete certificates.

                                                                                                                                                            "},{"location":"man3/X509_check_issued/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_check_issued() returns X509_V_OK if all checks are successful or some X509_V_ERR* constant to indicate an error.

                                                                                                                                                            "},{"location":"man3/X509_check_issued/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_verify_cert(3), X509_verify(3), X509_check_ca(3), openssl-verify(1), X509_self_signed(3)

                                                                                                                                                            "},{"location":"man3/X509_check_issued/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_check_private_key/","title":"X509_check_private_key","text":""},{"location":"man3/X509_check_private_key/#name","title":"NAME","text":"

                                                                                                                                                            X509_check_private_key, X509_REQ_check_private_key - check the consistency of a private key with the public key in an X509 certificate or certificate request

                                                                                                                                                            "},{"location":"man3/X509_check_private_key/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_check_private_key(X509 *x, EVP_PKEY *k);\n\nint X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k);\n
                                                                                                                                                            "},{"location":"man3/X509_check_private_key/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_check_private_key() function checks the consistency of private key k with the public key in x.

                                                                                                                                                            X509_REQ_check_private_key() is equivalent to X509_check_private_key() except that x represents a certificate request of structure X509_REQ.

                                                                                                                                                            "},{"location":"man3/X509_check_private_key/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_check_private_key() and X509_REQ_check_private_key() return 1 if the keys match each other, and 0 if not.

                                                                                                                                                            If the key is invalid or an error occurred, the reason code can be obtained using ERR_get_error(3).

                                                                                                                                                            "},{"location":"man3/X509_check_private_key/#bugs","title":"BUGS","text":"

                                                                                                                                                            The check_private_key functions don't check if k itself is indeed a private key or not. It merely compares the public materials (e.g. exponent and modulus of an RSA key) and/or key parameters (e.g. EC params of an EC key) of a key pair. So if you pass a public key to these functions in k, it will return success.

                                                                                                                                                            "},{"location":"man3/X509_check_private_key/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3)

                                                                                                                                                            "},{"location":"man3/X509_check_private_key/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_check_purpose/","title":"X509_check_purpose","text":""},{"location":"man3/X509_check_purpose/#name","title":"NAME","text":"

                                                                                                                                                            X509_check_purpose - Check the purpose of a certificate

                                                                                                                                                            "},{"location":"man3/X509_check_purpose/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nint X509_check_purpose(X509 *x, int id, int ca);\n
                                                                                                                                                            "},{"location":"man3/X509_check_purpose/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            This function checks if certificate x was created with the purpose represented by id. If ca is nonzero, then certificate x is checked to determine if it's a possible CA with various levels of certainty possibly returned. The certificate x must be a complete certificate otherwise the function returns an error.

                                                                                                                                                            Below are the potential ID's that can be checked:

                                                                                                                                                            # # define X509_PURPOSE_SSL_CLIENT 1 # # define X509_PURPOSE_SSL_SERVER 2 # # define X509_PURPOSE_NS_SSL_SERVER 3 # # define X509_PURPOSE_SMIME_SIGN 4 # # define X509_PURPOSE_SMIME_ENCRYPT 5 # # define X509_PURPOSE_CRL_SIGN 6 # # define X509_PURPOSE_ANY 7 # # define X509_PURPOSE_OCSP_HELPER 8 # # define X509_PURPOSE_TIMESTAMP_SIGN 9

                                                                                                                                                            The checks performed take into account the X.509 extensions keyUsage, extendedKeyUsage, and basicConstraints.

                                                                                                                                                            "},{"location":"man3/X509_check_purpose/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            For non-CA checks

                                                                                                                                                            • -1 an error condition has occurred
                                                                                                                                                            • 1 if the certificate was created to perform the purpose represented by id
                                                                                                                                                            • 0 if the certificate was not created to perform the purpose represented by id

                                                                                                                                                            For CA checks the below integers could be returned with the following meanings:

                                                                                                                                                            • -1 an error condition has occurred
                                                                                                                                                            • 0 not a CA or does not have the purpose represented by id
                                                                                                                                                            • 1 is a CA.
                                                                                                                                                            • 2 Only possible in old versions of openSSL when basicConstraints are absent. New versions will not return this value. May be a CA
                                                                                                                                                            • 3 basicConstraints absent but self signed V1.
                                                                                                                                                            • 4 basicConstraints absent but keyUsage present and keyCertSign asserted.
                                                                                                                                                            • 5 legacy Netscape specific CA Flags present
                                                                                                                                                            "},{"location":"man3/X509_check_purpose/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_cmp/","title":"X509_cmp","text":""},{"location":"man3/X509_cmp/#name","title":"NAME","text":"

                                                                                                                                                            X509_cmp, X509_NAME_cmp, X509_issuer_and_serial_cmp, X509_issuer_name_cmp, X509_subject_name_cmp, X509_CRL_cmp, X509_CRL_match - compare X509 certificates and related values

                                                                                                                                                            "},{"location":"man3/X509_cmp/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_cmp(const X509 *a, const X509 *b);\nint X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);\nint X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);\nint X509_issuer_name_cmp(const X509 *a, const X509 *b);\nint X509_subject_name_cmp(const X509 *a, const X509 *b);\nint X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);\nint X509_CRL_match(const X509_CRL *a, const X509_CRL *b);\n
                                                                                                                                                            "},{"location":"man3/X509_cmp/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            This set of functions are used to compare X509 objects, including X509 certificates, X509 CRL objects and various values in an X509 certificate.

                                                                                                                                                            The X509_cmp() function compares two X509 objects indicated by parameters a and b. The comparison is based on the memcmp result of the hash values of two X509 objects and the canonical (DER) encoding values.

                                                                                                                                                            The X509_NAME_cmp() function compares two X509_NAME objects indicated by parameters a and b. The comparison is based on the memcmp result of the canonical (DER) encoding values of the two objects using i2d_X509_NAME(3). This procedure adheres to the matching rules for Distinguished Names (DN) given in RFC 4517 section 4.2.15 and RFC 5280 section 7.1. In particular, the order of Relative Distinguished Names (RDNs) is relevant. On the other hand, if an RDN is multi-valued, i.e., it contains a set of AttributeValueAssertions (AVAs), its members are effectively not ordered.

                                                                                                                                                            The X509_issuer_and_serial_cmp() function compares the serial number and issuer values in the given X509 objects a and b.

                                                                                                                                                            The X509_issuer_name_cmp(), X509_subject_name_cmp() and X509_CRL_cmp() functions are effectively wrappers of the X509_NAME_cmp() function. These functions compare issuer names and subject names of the objects, or issuers of X509_CRL objects, respectively.

                                                                                                                                                            The X509_CRL_match() function compares two X509_CRL objects. Unlike the X509_CRL_cmp() function, this function compares the whole CRL content instead of just the issuer name.

                                                                                                                                                            "},{"location":"man3/X509_cmp/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The X509 comparison functions return -1, 0, or 1 if object a is found to be less than, to match, or be greater than object b, respectively.

                                                                                                                                                            X509_NAME_cmp(), X509_issuer_and_serial_cmp(), X509_issuer_name_cmp(), X509_subject_name_cmp(), X509_CRL_cmp(), and X509_CRL_match() may return -2 to indicate an error.

                                                                                                                                                            "},{"location":"man3/X509_cmp/#notes","title":"NOTES","text":"

                                                                                                                                                            These functions in fact utilize the underlying memcmp of the C library to do the comparison job. Data to be compared varies from DER encoding data, hash value or ASN1_STRING. The sign of the comparison can be used to order the objects but it does not have a special meaning in some cases.

                                                                                                                                                            X509_NAME_cmp() and wrappers utilize the value -2 to indicate errors in some circumstances, which could cause confusion for the applications.

                                                                                                                                                            "},{"location":"man3/X509_cmp/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            i2d_X509_NAME(3), i2d_X509(3)

                                                                                                                                                            "},{"location":"man3/X509_cmp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_cmp_time/","title":"X509_cmp_time","text":""},{"location":"man3/X509_cmp_time/#name","title":"NAME","text":"

                                                                                                                                                            X509_cmp_time, X509_cmp_current_time, X509_cmp_timeframe, X509_time_adj, X509_time_adj_ex, X509_gmtime_adj - X509 time functions

                                                                                                                                                            "},{"location":"man3/X509_cmp_time/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            int X509_cmp_time(const ASN1_TIME *asn1_time, time_t *in_tm);\nint X509_cmp_current_time(const ASN1_TIME *asn1_time);\nint X509_cmp_timeframe(const X509_VERIFY_PARAM *vpm,\n                       const ASN1_TIME *start, const ASN1_TIME *end);\nASN1_TIME *X509_time_adj(ASN1_TIME *asn1_time, long offset_sec, time_t *in_tm);\nASN1_TIME *X509_time_adj_ex(ASN1_TIME *asn1_time, int offset_day, long\n                            offset_sec, time_t *in_tm);\nASN1_TIME *X509_gmtime_adj(ASN1_TIME *asn1_time, long offset_sec);\n
                                                                                                                                                            "},{"location":"man3/X509_cmp_time/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_cmp_time() compares the ASN1_TIME in asn1_time with the time in <in_tm>.

                                                                                                                                                            X509_cmp_current_time() compares the ASN1_TIME in asn1_time with the current time, expressed as time_t.

                                                                                                                                                            X509_cmp_timeframe() compares the given time period with the reference time included in the verification parameters vpm if they are not NULL and contain X509_V_FLAG_USE_CHECK_TIME; else the current time is used as reference time.

                                                                                                                                                            X509_time_adj_ex() sets the ASN1_TIME structure asn1_time to the time offset_day and offset_sec after in_tm.

                                                                                                                                                            X509_time_adj() sets the ASN1_TIME structure asn1_time to the time offset_sec after in_tm. This method can only handle second offsets up to the capacity of long, so the newer X509_time_adj_ex() API should be preferred.

                                                                                                                                                            In both methods, if asn1_time is NULL, a new ASN1_TIME structure is allocated and returned.

                                                                                                                                                            In all methods, if in_tm is NULL, the current time, expressed as time_t, is used.

                                                                                                                                                            asn1_time must satisfy the ASN1_TIME format mandated by RFC 5280, i.e., its format must be either YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ.

                                                                                                                                                            X509_gmtime_adj() sets the ASN1_TIME structure asn1_time to the time offset_sec after the current time. It is equivalent to calling X509_time_adj() with the last parameter as NULL.

                                                                                                                                                            "},{"location":"man3/X509_cmp_time/#bugs","title":"BUGS","text":"

                                                                                                                                                            Unlike many standard comparison functions, X509_cmp_time() and X509_cmp_current_time() return 0 on error.

                                                                                                                                                            "},{"location":"man3/X509_cmp_time/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_cmp_time() and X509_cmp_current_time() return -1 if asn1_time is earlier than, or equal to, in_tm (resp. current time), and 1 otherwise. These methods return 0 on error.

                                                                                                                                                            X509_cmp_timeframe() returns 0 if vpm is not NULL and the verification parameters do not contain X509_V_FLAG_USE_CHECK_TIME but do contain X509_V_FLAG_NO_CHECK_TIME. Otherwise it returns 1 if the end time is not NULL and the reference time (which has determined as stated above) is past the end time, -1 if the start time is not NULL and the reference time is before, else 0 to indicate that the reference time is in range (implying that the end time is not before the start time if both are present).

                                                                                                                                                            X509_time_adj(), X509_time_adj_ex() and X509_gmtime_adj() return a pointer to the updated ASN1_TIME structure, and NULL on error.

                                                                                                                                                            "},{"location":"man3/X509_cmp_time/#history","title":"HISTORY","text":"

                                                                                                                                                            X509_cmp_timeframe() was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_cmp_time/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_digest/","title":"X509_digest","text":""},{"location":"man3/X509_digest/#name","title":"NAME","text":"

                                                                                                                                                            X509_digest, X509_digest_sig, X509_CRL_digest, X509_pubkey_digest, X509_NAME_digest, X509_REQ_digest, PKCS7_ISSUER_AND_SERIAL_digest - get digest of various objects

                                                                                                                                                            "},{"location":"man3/X509_digest/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_digest(const X509 *data, const EVP_MD *type, unsigned char *md,\n                unsigned int *len);\nASN1_OCTET_STRING *X509_digest_sig(const X509 *cert,\n                                   EVP_MD **md_used, int *md_is_fallback);\n\nint X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, unsigned char *md,\n                    unsigned int *len);\n\nint X509_pubkey_digest(const X509 *data, const EVP_MD *type,\n                       unsigned char *md, unsigned int *len);\n\nint X509_REQ_digest(const X509_REQ *data, const EVP_MD *type,\n                    unsigned char *md, unsigned int *len);\n\nint X509_NAME_digest(const X509_NAME *data, const EVP_MD *type,\n                     unsigned char *md, unsigned int *len);\n\n#include <openssl/pkcs7.h>\n\nint PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,\n                                   const EVP_MD *type, unsigned char *md,\n                                   unsigned int *len);\n
                                                                                                                                                            "},{"location":"man3/X509_digest/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_digest_sig() calculates a digest of the given certificate cert using the same hash algorithm as in its signature, if the digest is an integral part of the certificate signature algorithm identifier. Otherwise, a fallback hash algorithm is determined as follows: SHA512 if the signature algorithm is ED25519, SHAKE256 if it is ED448, otherwise SHA256. The output parameters are assigned as follows. Unless md_used is NULL, the hash algorithm used is provided in *md_used and must be freed by the caller (if it is not NULL). Unless md_is_fallback is NULL, the *md_is_fallback is set to 1 if the hash algorithm used is a fallback, otherwise to 0.

                                                                                                                                                            X509_pubkey_digest() returns a digest of the DER representation of the public key in the specified X509 data object.

                                                                                                                                                            All other functions described here return a digest of the DER representation of their entire data objects.

                                                                                                                                                            The type parameter specifies the digest to be used, such as EVP_sha1(). The md is a pointer to the buffer where the digest will be copied and is assumed to be large enough; the constant EVP_MAX_MD_SIZE is suggested. The len parameter, if not NULL, points to a place where the digest size will be stored.

                                                                                                                                                            "},{"location":"man3/X509_digest/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_digest_sig() returns an ASN1_OCTET_STRING pointer on success, else NULL.

                                                                                                                                                            All other functions described here return 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_digest/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            EVP_sha1(3)

                                                                                                                                                            "},{"location":"man3/X509_digest/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_digest_sig() function was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_digest/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_dup/","title":"X509_dup","text":""},{"location":"man3/X509_dup/#name","title":"NAME","text":"

                                                                                                                                                            DECLARE_ASN1_FUNCTIONS, IMPLEMENT_ASN1_FUNCTIONS, ASN1_ITEM, ACCESS_DESCRIPTION_free, ACCESS_DESCRIPTION_new, ADMISSIONS_free, ADMISSIONS_new, ADMISSION_SYNTAX_free, ADMISSION_SYNTAX_new, ASIdOrRange_free, ASIdOrRange_new, ASIdentifierChoice_free, ASIdentifierChoice_new, ASIdentifiers_free, ASIdentifiers_new, ASRange_free, ASRange_new, AUTHORITY_INFO_ACCESS_free, AUTHORITY_INFO_ACCESS_new, AUTHORITY_KEYID_free, AUTHORITY_KEYID_new, BASIC_CONSTRAINTS_free, BASIC_CONSTRAINTS_new, CERTIFICATEPOLICIES_free, CERTIFICATEPOLICIES_new, CMS_ContentInfo_free, CMS_ContentInfo_new, CMS_ContentInfo_new_ex, CMS_ContentInfo_print_ctx, CMS_ReceiptRequest_free, CMS_ReceiptRequest_new, CRL_DIST_POINTS_free, CRL_DIST_POINTS_new, DIRECTORYSTRING_free, DIRECTORYSTRING_new, DISPLAYTEXT_free, DISPLAYTEXT_new, DIST_POINT_NAME_free, DIST_POINT_NAME_new, DIST_POINT_free, DIST_POINT_new, DSAparams_dup, ECPARAMETERS_free, ECPARAMETERS_new, ECPKPARAMETERS_free, ECPKPARAMETERS_new, EDIPARTYNAME_free, EDIPARTYNAME_new, ESS_CERT_ID_dup, ESS_CERT_ID_free, ESS_CERT_ID_new, ESS_CERT_ID_V2_dup, ESS_CERT_ID_V2_free, ESS_CERT_ID_V2_new, ESS_ISSUER_SERIAL_dup, ESS_ISSUER_SERIAL_free, ESS_ISSUER_SERIAL_new, ESS_SIGNING_CERT_dup, ESS_SIGNING_CERT_free, ESS_SIGNING_CERT_it, ESS_SIGNING_CERT_new, ESS_SIGNING_CERT_V2_dup, ESS_SIGNING_CERT_V2_free, ESS_SIGNING_CERT_V2_it, ESS_SIGNING_CERT_V2_new, EXTENDED_KEY_USAGE_free, EXTENDED_KEY_USAGE_new, GENERAL_NAMES_free, GENERAL_NAMES_new, GENERAL_NAME_dup, GENERAL_NAME_free, GENERAL_NAME_new, GENERAL_SUBTREE_free, GENERAL_SUBTREE_new, IPAddressChoice_free, IPAddressChoice_new, IPAddressFamily_free, IPAddressFamily_new, IPAddressOrRange_free, IPAddressOrRange_new, IPAddressRange_free, IPAddressRange_new, ISSUER_SIGN_TOOL_free, ISSUER_SIGN_TOOL_it, ISSUER_SIGN_TOOL_new, ISSUING_DIST_POINT_free, ISSUING_DIST_POINT_it, ISSUING_DIST_POINT_new, NAME_CONSTRAINTS_free, NAME_CONSTRAINTS_new, NAMING_AUTHORITY_free, NAMING_AUTHORITY_new, NETSCAPE_CERT_SEQUENCE_free, NETSCAPE_CERT_SEQUENCE_new, NETSCAPE_SPKAC_free, NETSCAPE_SPKAC_new, NETSCAPE_SPKI_free, NETSCAPE_SPKI_new, NOTICEREF_free, NOTICEREF_new, OCSP_BASICRESP_free, OCSP_BASICRESP_new, OCSP_CERTID_dup, OCSP_CERTID_new, OCSP_CERTSTATUS_free, OCSP_CERTSTATUS_new, OCSP_CRLID_free, OCSP_CRLID_new, OCSP_ONEREQ_free, OCSP_ONEREQ_new, OCSP_REQINFO_free, OCSP_REQINFO_new, OCSP_RESPBYTES_free, OCSP_RESPBYTES_new, OCSP_RESPDATA_free, OCSP_RESPDATA_new, OCSP_RESPID_free, OCSP_RESPID_new, OCSP_RESPONSE_new, OCSP_REVOKEDINFO_free, OCSP_REVOKEDINFO_new, OCSP_SERVICELOC_free, OCSP_SERVICELOC_new, OCSP_SIGNATURE_free, OCSP_SIGNATURE_new, OCSP_SINGLERESP_free, OCSP_SINGLERESP_new, OSSL_CMP_ITAV_dup, OSSL_CMP_ITAV_free, OSSL_CMP_MSG_dup, OSSL_CMP_MSG_it, OSSL_CMP_MSG_free, OSSL_CMP_PKIHEADER_free, OSSL_CMP_PKIHEADER_it, OSSL_CMP_PKIHEADER_new, OSSL_CMP_PKISI_dup, OSSL_CMP_PKISI_free, OSSL_CMP_PKISI_it, OSSL_CMP_PKISI_new, OSSL_CMP_PKISTATUS_it, OSSL_CRMF_CERTID_dup, OSSL_CRMF_CERTID_free, OSSL_CRMF_CERTID_it, OSSL_CRMF_CERTID_new, OSSL_CRMF_CERTTEMPLATE_free, OSSL_CRMF_CERTTEMPLATE_it, OSSL_CRMF_CERTTEMPLATE_new, OSSL_CRMF_ENCRYPTEDVALUE_free, OSSL_CRMF_ENCRYPTEDVALUE_it, OSSL_CRMF_ENCRYPTEDVALUE_new, OSSL_CRMF_MSGS_free, OSSL_CRMF_MSGS_it, OSSL_CRMF_MSGS_new, OSSL_CRMF_MSG_dup, OSSL_CRMF_MSG_free, OSSL_CRMF_MSG_it, OSSL_CRMF_MSG_new, OSSL_CRMF_PBMPARAMETER_free, OSSL_CRMF_PBMPARAMETER_it, OSSL_CRMF_PBMPARAMETER_new, OSSL_CRMF_PKIPUBLICATIONINFO_free, OSSL_CRMF_PKIPUBLICATIONINFO_it, OSSL_CRMF_PKIPUBLICATIONINFO_new, OSSL_CRMF_SINGLEPUBINFO_free, OSSL_CRMF_SINGLEPUBINFO_it, OSSL_CRMF_SINGLEPUBINFO_new, OTHERNAME_free, OTHERNAME_new, PBE2PARAM_free, PBE2PARAM_new, PBEPARAM_free, PBEPARAM_new, PBKDF2PARAM_free, PBKDF2PARAM_new, PKCS12_BAGS_free, PKCS12_BAGS_new, PKCS12_MAC_DATA_free, PKCS12_MAC_DATA_new, PKCS12_SAFEBAG_free, PKCS12_SAFEBAG_new, PKCS12_free, PKCS12_new, PKCS7_DIGEST_free, PKCS7_DIGEST_new, PKCS7_ENCRYPT_free, PKCS7_ENCRYPT_new, PKCS7_ENC_CONTENT_free, PKCS7_ENC_CONTENT_new, PKCS7_ENVELOPE_free, PKCS7_ENVELOPE_new, PKCS7_ISSUER_AND_SERIAL_free, PKCS7_ISSUER_AND_SERIAL_new, PKCS7_RECIP_INFO_free, PKCS7_RECIP_INFO_new, PKCS7_SIGNED_free, PKCS7_SIGNED_new, PKCS7_SIGNER_INFO_free, PKCS7_SIGNER_INFO_new, PKCS7_SIGN_ENVELOPE_free, PKCS7_SIGN_ENVELOPE_new, PKCS7_dup, PKCS7_free, PKCS7_new_ex, PKCS7_new, PKCS7_print_ctx, PKCS8_PRIV_KEY_INFO_free, PKCS8_PRIV_KEY_INFO_new, PKEY_USAGE_PERIOD_free, PKEY_USAGE_PERIOD_new, POLICYINFO_free, POLICYINFO_new, POLICYQUALINFO_free, POLICYQUALINFO_new, POLICY_CONSTRAINTS_free, POLICY_CONSTRAINTS_new, POLICY_MAPPING_free, POLICY_MAPPING_new, PROFESSION_INFOS_free, PROFESSION_INFOS_new, PROFESSION_INFO_free, PROFESSION_INFO_new, PROXY_CERT_INFO_EXTENSION_free, PROXY_CERT_INFO_EXTENSION_new, PROXY_POLICY_free, PROXY_POLICY_new, RSAPrivateKey_dup, RSAPublicKey_dup, RSA_OAEP_PARAMS_free, RSA_OAEP_PARAMS_new, RSA_PSS_PARAMS_free, RSA_PSS_PARAMS_new, RSA_PSS_PARAMS_dup, SCRYPT_PARAMS_free, SCRYPT_PARAMS_new, SXNETID_free, SXNETID_new, SXNET_free, SXNET_new, TLS_FEATURE_free, TLS_FEATURE_new, TS_ACCURACY_dup, TS_ACCURACY_free, TS_ACCURACY_new, TS_MSG_IMPRINT_dup, TS_MSG_IMPRINT_free, TS_MSG_IMPRINT_new, TS_REQ_dup, TS_REQ_free, TS_REQ_new, TS_RESP_dup, TS_RESP_free, TS_RESP_new, TS_STATUS_INFO_dup, TS_STATUS_INFO_free, TS_STATUS_INFO_new, TS_TST_INFO_dup, TS_TST_INFO_free, TS_TST_INFO_new, USERNOTICE_free, USERNOTICE_new, X509_ALGOR_free, X509_ALGOR_it, X509_ALGOR_new, X509_ATTRIBUTE_dup, X509_ATTRIBUTE_free, X509_ATTRIBUTE_new, X509_CERT_AUX_free, X509_CERT_AUX_new, X509_CINF_free, X509_CINF_new, X509_CRL_INFO_free, X509_CRL_INFO_new, X509_CRL_dup, X509_CRL_free, X509_CRL_new_ex, X509_CRL_new, X509_EXTENSION_dup, X509_EXTENSION_free, X509_EXTENSION_new, X509_NAME_ENTRY_dup, X509_NAME_ENTRY_free, X509_NAME_ENTRY_new, X509_NAME_dup, X509_NAME_free, X509_NAME_new, X509_REQ_INFO_free, X509_REQ_INFO_new, X509_REQ_dup, X509_REQ_free, X509_REQ_new, X509_REQ_new_ex, X509_REVOKED_dup, X509_REVOKED_free, X509_REVOKED_new, X509_SIG_free, X509_SIG_new, X509_VAL_free, X509_VAL_new, X509_dup, - ASN1 object utilities

                                                                                                                                                            "},{"location":"man3/X509_dup/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/asn1t.h>\n\nDECLARE_ASN1_FUNCTIONS(type)\nIMPLEMENT_ASN1_FUNCTIONS(stname)\n\ntypedef struct ASN1_ITEM_st ASN1_ITEM;\n\nextern const ASN1_ITEM TYPE_it;\nTYPE *TYPE_new(void);\nTYPE *TYPE_dup(const TYPE *a);\nvoid TYPE_free(TYPE *a);\nint TYPE_print_ctx(BIO *out, TYPE *a, int indent, const ASN1_PCTX *pctx);\n

                                                                                                                                                            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            DSA *DSAparams_dup(const DSA *dsa);\nRSA *RSAPrivateKey_dup(const RSA *rsa);\nRSA *RSAPublicKey_dup(const RSA *rsa);\n
                                                                                                                                                            "},{"location":"man3/X509_dup/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            In the description below, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509.

                                                                                                                                                            The OpenSSL ASN1 parsing library templates are like a data-driven bytecode interpreter. Every ASN1 object as a global variable, TYPE_it, that describes the item such as its fields. (On systems which cannot export variables from shared libraries, the global is instead a function which returns a pointer to a static variable.

                                                                                                                                                            The macro DECLARE_ASN1_FUNCTIONS() is typically used in header files to generate the function declarations.

                                                                                                                                                            The macro IMPLEMENT_ASN1_FUNCTIONS() is used once in a source file to generate the function bodies.

                                                                                                                                                            TYPE_new() allocates an empty object of the indicated type. The object returned must be released by calling TYPE_free().

                                                                                                                                                            TYPE_new_ex() is similar to TYPE_new() but also passes the library context libctx and the property query propq to use when retrieving algorithms from providers. This created object can then be used when loading binary data using d2i_TYPE().

                                                                                                                                                            TYPE_dup() copies an existing object, leaving it untouched. Note, however, that the internal representation of the object may contain (besides the ASN.1 structure) further data, which is not copied. For instance, an X509 object usually is augmented by cached information on X.509v3 extensions, etc., and losing it can lead to wrong validation results. To avoid such situations, better use TYPE_up_ref() if available. For the case of X509 objects, an alternative to using X509_up_ref(3) may be to still call TYPE_dup(), e.g., copied_cert = X509_dup(cert), followed by X509_check_purpose(copied_cert, -1, 0), which re-builds the cached data.

                                                                                                                                                            TYPE_free() releases the object and all pointers and sub-objects within it. If the argument is NULL, nothing is done.

                                                                                                                                                            TYPE_print_ctx() prints the object a on the specified BIO out. Each line will be prefixed with indent spaces. The pctx specifies the printing context and is for internal use; use NULL to get the default behavior. If a print function is user-defined, then pass in any pctx down to any nested calls.

                                                                                                                                                            "},{"location":"man3/X509_dup/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            TYPE_new(), TYPE_new_ex() and TYPE_dup() return a pointer to the object or NULL on failure.

                                                                                                                                                            TYPE_print_ctx() returns 1 on success or zero on failure.

                                                                                                                                                            "},{"location":"man3/X509_dup/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_up_ref(3)

                                                                                                                                                            "},{"location":"man3/X509_dup/#history","title":"HISTORY","text":"

                                                                                                                                                            The functions X509_REQ_new_ex(), X509_CRL_new_ex(), PKCS7_new_ex() and CMS_ContentInfo_new_ex() were added in OpenSSL 3.0.

                                                                                                                                                            The functions DSAparams_dup(), RSAPrivateKey_dup() and RSAPublicKey_dup() were deprecated in 3.0.

                                                                                                                                                            "},{"location":"man3/X509_dup/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get0_distinguishing_id/","title":"X509_get0_distinguishing_id","text":""},{"location":"man3/X509_get0_distinguishing_id/#name","title":"NAME","text":"

                                                                                                                                                            X509_get0_distinguishing_id, X509_set0_distinguishing_id, X509_REQ_get0_distinguishing_id, X509_REQ_set0_distinguishing_id - get or set the Distinguishing ID for certificate operations

                                                                                                                                                            "},{"location":"man3/X509_get0_distinguishing_id/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nASN1_OCTET_STRING *X509_get0_distinguishing_id(X509 *x);\nvoid X509_set0_distinguishing_id(X509 *x, ASN1_OCTET_STRING *distid);\nASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x);\nvoid X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *distid);\n
                                                                                                                                                            "},{"location":"man3/X509_get0_distinguishing_id/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The Distinguishing ID is defined in FIPS 196 as follows:

                                                                                                                                                            • Distinguishing identifier

                                                                                                                                                              Information which unambiguously distinguishes an entity in the authentication process.

                                                                                                                                                            The SM2 signature algorithm requires a Distinguishing ID value when generating and verifying a signature, but the Ddistinguishing ID may also find other uses. In the context of SM2, the Distinguishing ID is often referred to as the \"SM2 ID\".

                                                                                                                                                            For the purpose off verifying a certificate or a certification request, a Distinguishing ID may be attached to it, so functions like X509_verify(3) or X509_REQ_verify(3) have easy access to that identity for signature verification.

                                                                                                                                                            X509_get0_distinguishing_id() gets the Distinguishing ID value of a certificate x by returning an ASN1_OCTET_STRING object which should not be freed by the caller.

                                                                                                                                                            X509_set0_distinguishing_id() assigns distid to the certificate x. Calling this function transfers the memory management of the value to the X509 object, and therefore the value that has been passed in should not be freed by the caller after this function has been called.

                                                                                                                                                            X509_REQ_get0_distinguishing_id() and X509_REQ_set0_distinguishing_id() have the same functionality as X509_get0_distinguishing_id() and X509_set0_distinguishing_id() except that they deal with X509_REQ objects instead of X509.

                                                                                                                                                            "},{"location":"man3/X509_get0_distinguishing_id/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_set0_distinguishing_id() and X509_REQ_set0_distinguishing_id() do not return a value.

                                                                                                                                                            "},{"location":"man3/X509_get0_distinguishing_id/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_verify(3), SM2(7)

                                                                                                                                                            "},{"location":"man3/X509_get0_distinguishing_id/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get0_notBefore/","title":"X509_get0_notBefore","text":""},{"location":"man3/X509_get0_notBefore/#name","title":"NAME","text":"

                                                                                                                                                            X509_get0_notBefore, X509_getm_notBefore, X509_get0_notAfter, X509_getm_notAfter, X509_set1_notBefore, X509_set1_notAfter, X509_CRL_get0_lastUpdate, X509_CRL_get0_nextUpdate, X509_CRL_set1_lastUpdate, X509_CRL_set1_nextUpdate - get or set certificate or CRL dates

                                                                                                                                                            "},{"location":"man3/X509_get0_notBefore/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nconst ASN1_TIME *X509_get0_notBefore(const X509 *x);\nconst ASN1_TIME *X509_get0_notAfter(const X509 *x);\n\nASN1_TIME *X509_getm_notBefore(const X509 *x);\nASN1_TIME *X509_getm_notAfter(const X509 *x);\n\nint X509_set1_notBefore(X509 *x, const ASN1_TIME *tm);\nint X509_set1_notAfter(X509 *x, const ASN1_TIME *tm);\n\nconst ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl);\nconst ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl);\n\nint X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);\nint X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);\n
                                                                                                                                                            "},{"location":"man3/X509_get0_notBefore/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_get0_notBefore() and X509_get0_notAfter() return the notBefore and notAfter fields of certificate x respectively. The value returned is an internal pointer which must not be freed up after the call.

                                                                                                                                                            X509_getm_notBefore() and X509_getm_notAfter() are similar to X509_get0_notBefore() and X509_get0_notAfter() except they return non-constant mutable references to the associated date field of the certificate.

                                                                                                                                                            X509_set1_notBefore() and X509_set1_notAfter() set the notBefore and notAfter fields of x to tm. Ownership of the passed parameter tm is not transferred by these functions so it must be freed up after the call.

                                                                                                                                                            X509_CRL_get0_lastUpdate() and X509_CRL_get0_nextUpdate() return the lastUpdate and nextUpdate fields of crl. The value returned is an internal pointer which must not be freed up after the call. If the nextUpdate field is absent from crl then NULL is returned.

                                                                                                                                                            X509_CRL_set1_lastUpdate() and X509_CRL_set1_nextUpdate() set the lastUpdate and nextUpdate fields of crl to tm. Ownership of the passed parameter tm is not transferred by these functions so it must be freed up after the call.

                                                                                                                                                            "},{"location":"man3/X509_get0_notBefore/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get0_notBefore(), X509_get0_notAfter() and X509_CRL_get0_lastUpdate() return a pointer to an ASN1_TIME structure.

                                                                                                                                                            X509_CRL_get0_lastUpdate() return a pointer to an ASN1_TIME structure or NULL if the lastUpdate field is absent.

                                                                                                                                                            X509_set1_notBefore(), X509_set1_notAfter(), X509_CRL_set1_lastUpdate() and X509_CRL_set1_nextUpdate() return 1 for success or 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_get0_notBefore/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_get0_notBefore/#history","title":"HISTORY","text":"

                                                                                                                                                            These functions are available in all versions of OpenSSL.

                                                                                                                                                            X509_get_notBefore() and X509_get_notAfter() were deprecated in OpenSSL 1.1.0

                                                                                                                                                            "},{"location":"man3/X509_get0_notBefore/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get0_signature/","title":"X509_get0_signature","text":""},{"location":"man3/X509_get0_signature/#name","title":"NAME","text":"

                                                                                                                                                            X509_get0_signature, X509_REQ_set0_signature, X509_REQ_set1_signature_algo, X509_get_signature_nid, X509_get0_tbs_sigalg, X509_REQ_get0_signature, X509_REQ_get_signature_nid, X509_CRL_get0_signature, X509_CRL_get_signature_nid, X509_get_signature_info, X509_SIG_INFO_get, X509_SIG_INFO_set - signature information

                                                                                                                                                            "},{"location":"man3/X509_get0_signature/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nvoid X509_get0_signature(const ASN1_BIT_STRING **psig,\n                         const X509_ALGOR **palg,\n                         const X509 *x);\nvoid X509_REQ_set0_signature(X509_REQ *req, ASN1_BIT_STRING *psig);\nint X509_REQ_set1_signature_algo(X509_REQ *req, X509_ALGOR *palg);\nint X509_get_signature_nid(const X509 *x);\nconst X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x);\n\nvoid X509_REQ_get0_signature(const X509_REQ *crl,\n                             const ASN1_BIT_STRING **psig,\n                             const X509_ALGOR **palg);\nint X509_REQ_get_signature_nid(const X509_REQ *crl);\n\nvoid X509_CRL_get0_signature(const X509_CRL *crl,\n                             const ASN1_BIT_STRING **psig,\n                             const X509_ALGOR **palg);\nint X509_CRL_get_signature_nid(const X509_CRL *crl);\n\nint X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits,\n                            uint32_t *flags);\n\nint X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid,\n                     int *secbits, uint32_t *flags);\nvoid X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid,\n                       int secbits, uint32_t flags);\n
                                                                                                                                                            "},{"location":"man3/X509_get0_signature/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_get0_signature() sets *psig to the signature of x and *palg to the signature algorithm of x. The values returned are internal pointers which MUST NOT be freed up after the call.

                                                                                                                                                            X509_set0_signature() and X509_REQ_set1_signature_algo() are the equivalent setters for the two values of X509_get0_signature().

                                                                                                                                                            X509_get0_tbs_sigalg() returns the signature algorithm in the signed portion of x.

                                                                                                                                                            X509_get_signature_nid() returns the NID corresponding to the signature algorithm of x.

                                                                                                                                                            X509_REQ_get0_signature(), X509_REQ_get_signature_nid() X509_CRL_get0_signature() and X509_CRL_get_signature_nid() perform the same function for certificate requests and CRLs.

                                                                                                                                                            X509_get_signature_info() retrieves information about the signature of certificate x. The NID of the signing digest is written to *mdnid, the public key algorithm to *pknid, the effective security bits to *secbits and flag details to *flags. Any of the parameters can be set to NULL if the information is not required.

                                                                                                                                                            X509_SIG_INFO_get() and X509_SIG_INFO_set() get and set information about a signature in an X509_SIG_INFO structure. They are only used by implementations of algorithms which need to set custom signature information: most applications will never need to call them.

                                                                                                                                                            "},{"location":"man3/X509_get0_signature/#notes","title":"NOTES","text":"

                                                                                                                                                            These functions provide lower level access to signatures in certificates where an application wishes to analyse or generate a signature in a form where X509_sign() et al is not appropriate (for example a non standard or unsupported format).

                                                                                                                                                            The security bits returned by X509_get_signature_info() refers to information available from the certificate signature (such as the signing digest). In some cases the actual security of the signature is less because the signing key is less secure: for example a certificate signed using SHA-512 and a 1024 bit RSA key.

                                                                                                                                                            "},{"location":"man3/X509_get0_signature/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get_signature_nid(), X509_REQ_get_signature_nid() and X509_CRL_get_signature_nid() return a NID.

                                                                                                                                                            X509_get0_signature(), X509_REQ_get0_signature() and X509_CRL_get0_signature() do not return values.

                                                                                                                                                            X509_get_signature_info() returns 1 if the signature information returned is valid or 0 if the information is not available (e.g. unknown algorithms or malformed parameters).

                                                                                                                                                            X509_REQ_set1_signature_algo() returns 0 on success; or 1 on an error (e.g. null ALGO pointer). X509_REQ_set0_signature does not return an error value.

                                                                                                                                                            "},{"location":"man3/X509_get0_signature/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_get0_signature/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_get0_signature() and X509_get_signature_nid() functions were added in OpenSSL 1.0.2.

                                                                                                                                                            The X509_REQ_get0_signature(), X509_REQ_get_signature_nid(), X509_CRL_get0_signature() and X509_CRL_get_signature_nid() were added in OpenSSL 1.1.0.

                                                                                                                                                            The X509_REQ_set0_signature() and X509_REQ_set1_signature_algo() were added in OpenSSL 1.1.1e.

                                                                                                                                                            "},{"location":"man3/X509_get0_signature/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get0_uids/","title":"X509_get0_uids","text":""},{"location":"man3/X509_get0_uids/#name","title":"NAME","text":"

                                                                                                                                                            X509_get0_uids - get certificate unique identifiers

                                                                                                                                                            "},{"location":"man3/X509_get0_uids/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nvoid X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid,\n                    const ASN1_BIT_STRING **psuid);\n
                                                                                                                                                            "},{"location":"man3/X509_get0_uids/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_get0_uids() sets *piuid and *psuid to the issuer and subject unique identifiers of certificate x or NULL if the fields are not present.

                                                                                                                                                            "},{"location":"man3/X509_get0_uids/#notes","title":"NOTES","text":"

                                                                                                                                                            The issuer and subject unique identifier fields are very rarely encountered in practice outside test cases.

                                                                                                                                                            "},{"location":"man3/X509_get0_uids/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get0_uids() does not return a value.

                                                                                                                                                            "},{"location":"man3/X509_get0_uids/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_get0_uids/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/","title":"X509_get_extension_flags","text":""},{"location":"man3/X509_get_extension_flags/#name","title":"NAME","text":"

                                                                                                                                                            X509_get0_subject_key_id, X509_get0_authority_key_id, X509_get0_authority_issuer, X509_get0_authority_serial, X509_get_pathlen, X509_get_extension_flags, X509_get_key_usage, X509_get_extended_key_usage, X509_set_proxy_flag, X509_set_proxy_pathlen, X509_get_proxy_pathlen - retrieve certificate extension data

                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nlong X509_get_pathlen(X509 *x);\nuint32_t X509_get_extension_flags(X509 *x);\nuint32_t X509_get_key_usage(X509 *x);\nuint32_t X509_get_extended_key_usage(X509 *x);\nconst ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x);\nconst ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x);\nconst GENERAL_NAMES *X509_get0_authority_issuer(X509 *x);\nconst ASN1_INTEGER *X509_get0_authority_serial(X509 *x);\nvoid X509_set_proxy_flag(X509 *x);\nvoid X509_set_proxy_pathlen(int l);\nlong X509_get_proxy_pathlen(X509 *x);\n
                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions retrieve information related to commonly used certificate extensions.

                                                                                                                                                            X509_get_pathlen() retrieves the path length extension from a certificate. This extension is used to limit the length of a cert chain that may be issued from that CA.

                                                                                                                                                            X509_get_extension_flags() retrieves general information about a certificate, it will return one or more of the following flags ored together.

                                                                                                                                                            • EXFLAG_V1

                                                                                                                                                              The certificate is an obsolete version 1 certificate.

                                                                                                                                                            • EXFLAG_BCONS

                                                                                                                                                              The certificate contains a basic constraints extension.

                                                                                                                                                            • EXFLAG_CA

                                                                                                                                                              The certificate contains basic constraints and asserts the CA flag.

                                                                                                                                                            • EXFLAG_PROXY

                                                                                                                                                              The certificate is a valid proxy certificate.

                                                                                                                                                            • EXFLAG_SI

                                                                                                                                                              The certificate is self issued (that is subject and issuer names match).

                                                                                                                                                            • EXFLAG_SS

                                                                                                                                                              The subject and issuer names match and extension values imply it is self signed.

                                                                                                                                                            • EXFLAG_FRESHEST

                                                                                                                                                              The freshest CRL extension is present in the certificate.

                                                                                                                                                            • EXFLAG_CRITICAL

                                                                                                                                                              The certificate contains an unhandled critical extension.

                                                                                                                                                            • EXFLAG_INVALID

                                                                                                                                                              Some certificate extension values are invalid or inconsistent. The certificate should be rejected. This bit may also be raised after an out-of-memory error while processing the X509 object, so it may not be related to the processed ASN1 object itself.

                                                                                                                                                            • EXFLAG_NO_FINGERPRINT

                                                                                                                                                              Failed to compute the internal SHA1 hash value of the certificate or CRL. This may be due to malloc failure or because no SHA1 implementation was found.

                                                                                                                                                            • EXFLAG_INVALID_POLICY

                                                                                                                                                              The NID_certificate_policies certificate extension is invalid or inconsistent. The certificate should be rejected. This bit may also be raised after an out-of-memory error while processing the X509 object, so it may not be related to the processed ASN1 object itself.

                                                                                                                                                            • EXFLAG_KUSAGE

                                                                                                                                                              The certificate contains a key usage extension. The value can be retrieved using X509_get_key_usage().

                                                                                                                                                            • EXFLAG_XKUSAGE

                                                                                                                                                              The certificate contains an extended key usage extension. The value can be retrieved using X509_get_extended_key_usage().

                                                                                                                                                            X509_get_key_usage() returns the value of the key usage extension. If key usage is present will return zero or more of the flags: KU_DIGITAL_SIGNATURE, KU_NON_REPUDIATION, KU_KEY_ENCIPHERMENT, KU_DATA_ENCIPHERMENT, KU_KEY_AGREEMENT, KU_KEY_CERT_SIGN, KU_CRL_SIGN, KU_ENCIPHER_ONLY or KU_DECIPHER_ONLY corresponding to individual key usage bits. If key usage is absent then UINT32_MAX is returned.

                                                                                                                                                            X509_get_extended_key_usage() returns the value of the extended key usage extension. If extended key usage is present it will return zero or more of the flags: XKU_SSL_SERVER, XKU_SSL_CLIENT, XKU_SMIME, XKU_CODE_SIGN XKU_OCSP_SIGN, XKU_TIMESTAMP, XKU_DVCS or XKU_ANYEKU. These correspond to the OIDs id-kp-serverAuth, id-kp-clientAuth, id-kp-emailProtection, id-kp-codeSigning, id-kp-OCSPSigning, id-kp-timeStamping, id-kp-dvcs and anyExtendedKeyUsage respectively. Additionally XKU_SGC is set if either Netscape or Microsoft SGC OIDs are present.

                                                                                                                                                            X509_get0_subject_key_id() returns an internal pointer to the subject key identifier of x as an ASN1_OCTET_STRING or NULL if the extension is not present or cannot be parsed.

                                                                                                                                                            X509_get0_authority_key_id() returns an internal pointer to the authority key identifier of x as an ASN1_OCTET_STRING or NULL if the extension is not present or cannot be parsed.

                                                                                                                                                            X509_get0_authority_issuer() returns an internal pointer to the authority certificate issuer of x as a stack of GENERAL_NAME structures or NULL if the extension is not present or cannot be parsed.

                                                                                                                                                            X509_get0_authority_serial() returns an internal pointer to the authority certificate serial number of x as an ASN1_INTEGER or NULL if the extension is not present or cannot be parsed.

                                                                                                                                                            X509_set_proxy_flag() marks the certificate with the EXFLAG_PROXY flag. This is for the users who need to mark non-RFC3820 proxy certificates as such, as OpenSSL only detects RFC3820 compliant ones.

                                                                                                                                                            X509_set_proxy_pathlen() sets the proxy certificate path length for the given certificate x. This is for the users who need to mark non-RFC3820 proxy certificates as such, as OpenSSL only detects RFC3820 compliant ones.

                                                                                                                                                            X509_get_proxy_pathlen() returns the proxy certificate path length for the given certificate x if it is a proxy certificate.

                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/#notes","title":"NOTES","text":"

                                                                                                                                                            The value of the flags correspond to extension values which are cached in the X509 structure. If the flags returned do not provide sufficient information an application should examine extension values directly for example using X509_get_ext_d2i().

                                                                                                                                                            If the key usage or extended key usage extension is absent then typically usage is unrestricted. For this reason X509_get_key_usage() and X509_get_extended_key_usage() return UINT32_MAX when the corresponding extension is absent. Applications can additionally check the return value of X509_get_extension_flags() and take appropriate action is an extension is absent.

                                                                                                                                                            If X509_get0_subject_key_id() returns NULL then the extension may be absent or malformed. Applications can determine the precise reason using X509_get_ext_d2i().

                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get_pathlen() returns the path length value, or -1 if the extension is not present.

                                                                                                                                                            X509_get_extension_flags(), X509_get_key_usage() and X509_get_extended_key_usage() return sets of flags corresponding to the certificate extension values.

                                                                                                                                                            X509_get0_subject_key_id() returns the subject key identifier as a pointer to an ASN1_OCTET_STRING structure or NULL if the extension is absent or an error occurred during parsing.

                                                                                                                                                            X509_get_proxy_pathlen() returns the path length value if the given certificate is a proxy one and has a path length set, and -1 otherwise.

                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_check_purpose(3)

                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/#history","title":"HISTORY","text":"

                                                                                                                                                            X509_get_pathlen(), X509_set_proxy_flag(), X509_set_proxy_pathlen() and X509_get_proxy_pathlen() were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/X509_get_extension_flags/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get_pubkey/","title":"X509_get_pubkey","text":""},{"location":"man3/X509_get_pubkey/#name","title":"NAME","text":"

                                                                                                                                                            X509_get_pubkey, X509_get0_pubkey, X509_set_pubkey, X509_get_X509_PUBKEY, X509_REQ_get_pubkey, X509_REQ_get0_pubkey, X509_REQ_set_pubkey, X509_REQ_get_X509_PUBKEY - get or set certificate or certificate request public key

                                                                                                                                                            "},{"location":"man3/X509_get_pubkey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nEVP_PKEY *X509_get_pubkey(X509 *x);\nEVP_PKEY *X509_get0_pubkey(const X509 *x);\nint X509_set_pubkey(X509 *x, EVP_PKEY *pkey);\nX509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x);\n\nEVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);\nEVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req);\nint X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);\nX509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *x);\n
                                                                                                                                                            "},{"location":"man3/X509_get_pubkey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_get_pubkey() attempts to decode the public key for certificate x. If successful it returns the public key as an EVP_PKEY pointer with its reference count incremented: this means the returned key must be freed up after use. X509_get0_pubkey() is similar except it does not increment the reference count of the returned EVP_PKEY so it must not be freed up after use.

                                                                                                                                                            X509_get_X509_PUBKEY() returns an internal pointer to the X509_PUBKEY structure which encodes the certificate of x. The returned value must not be freed up after use.

                                                                                                                                                            X509_set_pubkey() attempts to set the public key for certificate x to pkey. The key pkey should be freed up after use.

                                                                                                                                                            X509_REQ_get_pubkey(), X509_REQ_get0_pubkey(), X509_REQ_set_pubkey() and X509_REQ_get_X509_PUBKEY() are similar but operate on certificate request req.

                                                                                                                                                            "},{"location":"man3/X509_get_pubkey/#notes","title":"NOTES","text":"

                                                                                                                                                            The first time a public key is decoded the EVP_PKEY structure is cached in the certificate or certificate request itself. Subsequent calls return the cached structure with its reference count incremented to improve performance.

                                                                                                                                                            "},{"location":"man3/X509_get_pubkey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get_pubkey(), X509_get0_pubkey(), X509_get_X509_PUBKEY(), X509_REQ_get_pubkey() and X509_REQ_get_X509_PUBKEY() return a public key or NULL if an error occurred.

                                                                                                                                                            X509_set_pubkey() and X509_REQ_set_pubkey() return 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_get_pubkey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_get_pubkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get_serialNumber/","title":"X509_get_serialNumber","text":""},{"location":"man3/X509_get_serialNumber/#name","title":"NAME","text":"

                                                                                                                                                            X509_get_serialNumber, X509_get0_serialNumber, X509_set_serialNumber - get or set certificate serial number

                                                                                                                                                            "},{"location":"man3/X509_get_serialNumber/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nASN1_INTEGER *X509_get_serialNumber(X509 *x);\nconst ASN1_INTEGER *X509_get0_serialNumber(const X509 *x);\nint X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);\n
                                                                                                                                                            "},{"location":"man3/X509_get_serialNumber/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_get_serialNumber() returns the serial number of certificate x as an ASN1_INTEGER structure which can be examined or initialised. The value returned is an internal pointer which MUST NOT be freed up after the call.

                                                                                                                                                            X509_get0_serialNumber() is the same as X509_get_serialNumber() except it accepts a const parameter and returns a const result.

                                                                                                                                                            X509_set_serialNumber() sets the serial number of certificate x to serial. A copy of the serial number is used internally so serial should be freed up after use.

                                                                                                                                                            "},{"location":"man3/X509_get_serialNumber/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get_serialNumber() and X509_get0_serialNumber() return an ASN1_INTEGER structure.

                                                                                                                                                            X509_set_serialNumber() returns 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_get_serialNumber/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_get_serialNumber/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_get_serialNumber() and X509_set_serialNumber() functions are available in all versions of OpenSSL. The X509_get0_serialNumber() function was added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/X509_get_serialNumber/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/","title":"X509_get_subject_name","text":""},{"location":"man3/X509_get_subject_name/#name","title":"NAME","text":"

                                                                                                                                                            X509_NAME_hash_ex, X509_NAME_hash, X509_get_subject_name, X509_set_subject_name, X509_subject_name_hash, X509_get_issuer_name, X509_set_issuer_name, X509_issuer_name_hash, X509_REQ_get_subject_name, X509_REQ_set_subject_name, X509_CRL_get_issuer, X509_CRL_set_issuer_name - get X509_NAME hashes or get and set issuer or subject names

                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nunsigned long X509_NAME_hash_ex(const X509_NAME *x, OSSL_LIB_CTX *libctx,\n                                const char *propq, int *ok);\n\nX509_NAME *X509_get_subject_name(const X509 *x);\nint X509_set_subject_name(X509 *x, const X509_NAME *name);\nunsigned long X509_subject_name_hash(X509 *x);\n\nX509_NAME *X509_get_issuer_name(const X509 *x);\nint X509_set_issuer_name(X509 *x, const X509_NAME *name);\nunsigned long X509_issuer_name_hash(X509 *x);\n\nX509_NAME *X509_REQ_get_subject_name(const X509_REQ *req);\nint X509_REQ_set_subject_name(X509_REQ *req, const X509_NAME *name);\n\nX509_NAME *X509_CRL_get_issuer(const X509_CRL *crl);\nint X509_CRL_set_issuer_name(X509_CRL *x, const X509_NAME *name);\n

                                                                                                                                                            The following macro has been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            #define X509_NAME_hash(x) X509_NAME_hash_ex(x, NULL, NULL, NULL)\n
                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_NAME_hash_ex() returns a hash value of name x or 0 on failure, using any given library context libctx and property query propq. The ok result argument may be NULL or else is used to return 1 for success and 0 for failure. Failure may happen on malloc error or if no SHA1 implementation is available.

                                                                                                                                                            X509_NAME_hash() returns a hash value of name x or 0 on failure, using the default library context and default property query.

                                                                                                                                                            X509_get_subject_name() returns the subject name of certificate x. The returned value is an internal pointer which MUST NOT be freed.

                                                                                                                                                            X509_set_subject_name() sets the issuer name of certificate x to name. The name parameter is copied internally and should be freed up when it is no longer needed.

                                                                                                                                                            X509_subject_name_hash() returns a hash value of the subject name of certificate x.

                                                                                                                                                            X509_get_issuer_name(), X509_set_issuer_name(), and X509_issuer_name_hash() are identical to X509_get_subject_name(), X509_set_subject_name(), and X509_subject_name_hash() except they relate to the issuer name of x.

                                                                                                                                                            Similarly X509_REQ_get_subject_name(), X509_REQ_set_subject_name(), X509_CRL_get_issuer() and X509_CRL_set_issuer_name() get or set the subject or issuer names of certificate requests of CRLs respectively.

                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get_subject_name(), X509_get_issuer_name(), X509_REQ_get_subject_name() and X509_CRL_get_issuer() return an X509_NAME pointer.

                                                                                                                                                            X509_NAME_hash_ex(), X509_NAME_hash(), X509_subject_name_hash() and X509_issuer_name_hash() return the first four bytes of the SHA1 hash value, converted to unsigned long in little endian order, or 0 on failure.

                                                                                                                                                            X509_set_subject_name(), X509_set_issuer_name(), X509_REQ_set_subject_name() and X509_CRL_set_issuer_name() return 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/#bugs","title":"BUGS","text":"

                                                                                                                                                            In case X509_NAME_hash(), X509_subject_name_hash(), or X509_issuer_name_hash() returns 0 it remains unclear if this is the real hash value or due to failure. Better use X509_NAME_hash_ex() instead.

                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), d2i_X509(3) X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/#history","title":"HISTORY","text":"

                                                                                                                                                            X509_REQ_get_subject_name() is a function in OpenSSL 1.1.0 and a macro in earlier versions.

                                                                                                                                                            X509_CRL_get_issuer() is a function in OpenSSL 1.1.0. It was previously added in OpenSSL 1.0.0 as a macro.

                                                                                                                                                            X509_NAME_hash() was turned into a macro and deprecated in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_get_subject_name/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_get_version/","title":"X509_get_version","text":""},{"location":"man3/X509_get_version/#name","title":"NAME","text":"

                                                                                                                                                            X509_get_version, X509_set_version, X509_REQ_get_version, X509_REQ_set_version, X509_CRL_get_version, X509_CRL_set_version - get or set certificate, certificate request or CRL version

                                                                                                                                                            "},{"location":"man3/X509_get_version/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nlong X509_get_version(const X509 *x);\nint X509_set_version(X509 *x, long version);\n\nlong X509_REQ_get_version(const X509_REQ *req);\nint X509_REQ_set_version(X509_REQ *x, long version);\n\nlong X509_CRL_get_version(const X509_CRL *crl);\nint X509_CRL_set_version(X509_CRL *x, long version);\n
                                                                                                                                                            "},{"location":"man3/X509_get_version/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_get_version() returns the numerical value of the version field of certificate x. These correspond to the constants X509_VERSION_1, X509_VERSION_2, and X509_VERSION_3. Note: the values of these constants are defined by standards (X.509 et al) to be one less than the certificate version. So X509_VERSION_3 has value 2 and X509_VERSION_1 has value 0.

                                                                                                                                                            X509_set_version() sets the numerical value of the version field of certificate x to version.

                                                                                                                                                            Similarly X509_REQ_get_version(), X509_REQ_set_version(), X509_CRL_get_version() and X509_CRL_set_version() get and set the version number of certificate requests and CRLs. They use constants X509_REQ_VERSION_1, X509_CRL_VERSION_1, and X509_CRL_VERSION_2.

                                                                                                                                                            "},{"location":"man3/X509_get_version/#notes","title":"NOTES","text":"

                                                                                                                                                            The version field of certificates, certificate requests and CRLs has a DEFAULT value of v1(0) meaning the field should be omitted for version 1. This is handled transparently by these functions.

                                                                                                                                                            "},{"location":"man3/X509_get_version/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_get_version(), X509_REQ_get_version() and X509_CRL_get_version() return the numerical value of the version field.

                                                                                                                                                            X509_set_version(), X509_REQ_set_version() and X509_CRL_set_version() return 1 for success and 0 for failure.

                                                                                                                                                            "},{"location":"man3/X509_get_version/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_get_version/#history","title":"HISTORY","text":"

                                                                                                                                                            X509_get_version(), X509_REQ_get_version() and X509_CRL_get_version() are functions in OpenSSL 1.1.0, in previous versions they were macros.

                                                                                                                                                            "},{"location":"man3/X509_get_version/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_load_http/","title":"X509_load_http","text":""},{"location":"man3/X509_load_http/#name","title":"NAME","text":"

                                                                                                                                                            X509_load_http, X509_http_nbio, X509_CRL_load_http, X509_CRL_http_nbio - certificate and CRL loading functions

                                                                                                                                                            "},{"location":"man3/X509_load_http/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nX509 *X509_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);\nX509_CRL *X509_CRL_load_http(const char *url, BIO *bio, BIO *rbio, int timeout);\n

                                                                                                                                                            The following macros have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            #define X509_http_nbio(rctx, pcert)\n#define X509_CRL_http_nbio(rctx, pcrl)\n
                                                                                                                                                            "},{"location":"man3/X509_load_http/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_load_http() and X509_CRL_load_http() loads a certificate or a CRL, respectively, in ASN.1 format using HTTP from the given url.

                                                                                                                                                            If bio is given and rbio is NULL then this BIO is used instead of an internal one for connecting, writing the request, and reading the response. If both bio and rbio are given (which may be memory BIOs, for instance) then no explicit connection is attempted, bio is used for writing the request, and rbio for reading the response.

                                                                                                                                                            If the timeout parameter is > 0 this indicates the maximum number of seconds to wait until the transfer is complete. A value of 0 enables waiting indefinitely, while a value < 0 immediately leads to a timeout condition.

                                                                                                                                                            X509_http_nbio() and X509_CRL_http_nbio() are macros for backward compatibility that have the same effect as the functions above but with infinite timeout and without the possibility to specify custom BIOs.

                                                                                                                                                            "},{"location":"man3/X509_load_http/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            On success the function yield the loaded value, else NULL. Error conditions include connection/transfer timeout, parse errors, etc.

                                                                                                                                                            "},{"location":"man3/X509_load_http/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            OSSL_HTTP_get(3)

                                                                                                                                                            "},{"location":"man3/X509_load_http/#history","title":"HISTORY","text":"

                                                                                                                                                            X509_load_http() and X509_CRL_load_http() were added in OpenSSL 3.0. X509_http_nbio() and X509_CRL_http_nbio() were deprecated in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_load_http/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_new/","title":"X509_new","text":""},{"location":"man3/X509_new/#name","title":"NAME","text":"

                                                                                                                                                            X509_new, X509_new_ex, X509_free, X509_up_ref, X509_chain_up_ref - X509 certificate ASN1 allocation functions

                                                                                                                                                            "},{"location":"man3/X509_new/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nX509 *X509_new(void);\nX509 *X509_new_ex(OSSL_LIB_CTX *libctx, const char *propq);\nvoid X509_free(X509 *a);\nint X509_up_ref(X509 *a);\nSTACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *x);\n
                                                                                                                                                            "},{"location":"man3/X509_new/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The X509 ASN1 allocation routines allocate and free an X509 structure, which represents an X509 certificate.

                                                                                                                                                            X509_new_ex() allocates and initializes a X509 structure with a library context of libctx, property query of propq and a reference count of 1. Many X509 functions such as X509_check_purpose(), and X509_verify() use this library context to select which providers supply the fetched algorithms (SHA1 is used internally). This created X509 object can then be used when loading binary data using d2i_X509().

                                                                                                                                                            X509_new() is similar to X509_new_ex() but sets the library context and property query to NULL. This results in the default (NULL) library context being used for any X509 operations requiring algorithm fetches.

                                                                                                                                                            X509_free() decrements the reference count of X509 structure a and frees it up if the reference count is zero. If the argument is NULL, nothing is done.

                                                                                                                                                            X509_up_ref() increments the reference count of a.

                                                                                                                                                            X509_chain_up_ref() increases the reference count of all certificates in chain x and returns a copy of the stack, or an empty stack if a is NULL.

                                                                                                                                                            "},{"location":"man3/X509_new/#notes","title":"NOTES","text":"

                                                                                                                                                            The function X509_up_ref() if useful if a certificate structure is being used by several different operations each of which will free it up after use: this avoids the need to duplicate the entire certificate structure.

                                                                                                                                                            The function X509_chain_up_ref() doesn't just up the reference count of each certificate. It also returns a copy of the stack, using sk_X509_dup(), but it serves a similar purpose: the returned chain persists after the original has been freed.

                                                                                                                                                            "},{"location":"man3/X509_new/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            If the allocation fails, X509_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the newly allocated structure.

                                                                                                                                                            X509_up_ref() returns 1 for success and 0 for failure.

                                                                                                                                                            X509_chain_up_ref() returns a copy of the stack or NULL if an error occurred.

                                                                                                                                                            "},{"location":"man3/X509_new/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/X509_new/#history","title":"HISTORY","text":"

                                                                                                                                                            The function X509_new_ex() was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_new/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_sign/","title":"X509_sign","text":""},{"location":"man3/X509_sign/#name","title":"NAME","text":"

                                                                                                                                                            X509_sign, X509_sign_ctx, X509_REQ_sign, X509_REQ_sign_ctx, X509_CRL_sign, X509_CRL_sign_ctx - sign certificate, certificate request, or CRL signature

                                                                                                                                                            "},{"location":"man3/X509_sign/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);\n\nint X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);\n\nint X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);\n
                                                                                                                                                            "},{"location":"man3/X509_sign/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_sign() signs certificate x using private key pkey and message digest md and sets the signature in x. X509_sign_ctx() also signs certificate x but uses the parameters contained in digest context ctx.

                                                                                                                                                            X509_REQ_sign(), X509_REQ_sign_ctx(), X509_CRL_sign(), and X509_CRL_sign_ctx() sign certificate requests and CRLs, respectively.

                                                                                                                                                            "},{"location":"man3/X509_sign/#notes","title":"NOTES","text":"

                                                                                                                                                            X509_sign_ctx() is used where the default parameters for the corresponding public key and digest are not suitable. It can be used to sign keys using RSA-PSS for example.

                                                                                                                                                            For efficiency reasons and to work around ASN.1 encoding issues the encoding of the signed portion of a certificate, certificate request and CRL is cached internally. If the signed portion of the structure is modified the encoding is not always updated meaning a stale version is sometimes used. This is not normally a problem because modifying the signed portion will invalidate the signature and signing will always update the encoding.

                                                                                                                                                            "},{"location":"man3/X509_sign/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            All functions return the size of the signature in bytes for success and zero for failure.

                                                                                                                                                            "},{"location":"man3/X509_sign/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3), X509_NAME_add_entry_by_txt(3), X509_new(3), X509_verify_cert(3), X509_verify(3), X509_REQ_verify_ex(3), X509_REQ_verify(3), X509_CRL_verify(3)

                                                                                                                                                            "},{"location":"man3/X509_sign/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_sign(), X509_REQ_sign() and X509_CRL_sign() functions are available in all versions of OpenSSL.

                                                                                                                                                            The X509_sign_ctx(), X509_REQ_sign_ctx() and X509_CRL_sign_ctx() functions were added in OpenSSL 1.0.1.

                                                                                                                                                            "},{"location":"man3/X509_sign/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_verify/","title":"X509_verify","text":""},{"location":"man3/X509_verify/#name","title":"NAME","text":"

                                                                                                                                                            X509_verify, X509_self_signed, X509_REQ_verify_ex, X509_REQ_verify, X509_CRL_verify - verify certificate, certificate request, or CRL signature

                                                                                                                                                            "},{"location":"man3/X509_verify/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509_verify(X509 *x, EVP_PKEY *pkey);\nint X509_self_signed(X509 *cert, int verify_signature);\n\nint X509_REQ_verify_ex(X509_REQ *a, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,\n                       const char *propq);\nint X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);\nint X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);\n
                                                                                                                                                            "},{"location":"man3/X509_verify/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_verify() verifies the signature of certificate x using public key pkey. Only the signature is checked: no other checks (such as certificate chain validity) are performed.

                                                                                                                                                            X509_self_signed() checks whether certificate cert is self-signed. For success the issuer and subject names must match, the components of the authority key identifier (if present) must match the subject key identifier etc. The signature itself is actually verified only if verify_signature is 1, as for explicitly trusted certificates this verification is not worth the effort.

                                                                                                                                                            X509_REQ_verify_ex(), X509_REQ_verify() and X509_CRL_verify() verify the signatures of certificate requests and CRLs, respectively.

                                                                                                                                                            "},{"location":"man3/X509_verify/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_verify(), X509_REQ_verify_ex(), X509_REQ_verify() and X509_CRL_verify() return 1 if the signature is valid and 0 if the signature check fails. If the signature could not be checked at all because it was ill-formed, the certificate or the request was not complete or some other error occurred then -1 is returned.

                                                                                                                                                            X509_self_signed() returns the same values but also returns 1 if all respective fields match and verify_signature is 0.

                                                                                                                                                            "},{"location":"man3/X509_verify/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            d2i_X509(3), ERR_get_error(3), X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509V3_get_d2i(3), X509_verify_cert(3), OSSL_LIB_CTX(3)

                                                                                                                                                            "},{"location":"man3/X509_verify/#history","title":"HISTORY","text":"

                                                                                                                                                            The X509_verify(), X509_REQ_verify(), and X509_CRL_verify() functions are available in all versions of OpenSSL.

                                                                                                                                                            X509_REQ_verify_ex(), and X509_self_signed() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_verify/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509_verify_cert/","title":"X509_verify_cert","text":""},{"location":"man3/X509_verify_cert/#name","title":"NAME","text":"

                                                                                                                                                            X509_build_chain, X509_verify_cert, X509_STORE_CTX_verify - build and verify X509 certificate chain

                                                                                                                                                            "},{"location":"man3/X509_verify_cert/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509_vfy.h>\n\nSTACK_OF(X509) *X509_build_chain(X509 *target, STACK_OF(X509) *certs,\n                                 X509_STORE *store, int with_self_signed,\n                                 OSSL_LIB_CTX *libctx, const char *propq);\nint X509_verify_cert(X509_STORE_CTX *ctx);\nint X509_STORE_CTX_verify(X509_STORE_CTX *ctx);\n
                                                                                                                                                            "},{"location":"man3/X509_verify_cert/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509_build_chain() builds a certificate chain starting from target using the optional list of intermediate CA certificates certs. If store is NULL it builds the chain as far down as possible, ignoring errors. Else the chain must reach a trust anchor contained in store. It internally uses a X509_STORE_CTX structure associated with the library context libctx and property query string propq, both of which may be NULL. In case there is more than one possibility for the chain, only one is taken.

                                                                                                                                                            On success it returns a pointer to a new stack of (up_ref'ed) certificates starting with target and followed by all available intermediate certificates. A self-signed trust anchor is included only if target is the trust anchor of with_self_signed is 1. If a non-NULL stack is returned the caller is responsible for freeing it.

                                                                                                                                                            The X509_verify_cert() function attempts to discover and validate a certificate chain based on parameters in ctx. The verification context, of type X509_STORE_CTX, can be constructed using X509_STORE_CTX_new(3) and X509_STORE_CTX_init(3). It usually includes a target certificate to be verified, a set of certificates serving as trust anchors, a list of non-trusted certificates that may be helpful for chain construction, flags such as X509_V_FLAG_X509_STRICT, and various other optional components such as a callback function that allows customizing the verification outcome. A complete description of the certificate verification process is contained in the openssl-verification-options(1) manual page.

                                                                                                                                                            Applications rarely call this function directly but it is used by OpenSSL internally for certificate validation, in both the S/MIME and SSL/TLS code.

                                                                                                                                                            A negative return value from X509_verify_cert() can occur if it is invoked incorrectly, such as with no certificate set in ctx, or when it is called twice in succession without reinitialising ctx for the second call. A negative return value can also happen due to internal resource problems or because an internal inconsistency has been detected. Applications must interpret any return value <= 0 as an error.

                                                                                                                                                            The X509_STORE_CTX_verify() behaves like X509_verify_cert() except that its target certificate is the first element of the list of untrusted certificates in ctx unless a target certificate is set explicitly.

                                                                                                                                                            "},{"location":"man3/X509_verify_cert/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509_build_chain() returns NULL on error, else a stack of certificates.

                                                                                                                                                            Both X509_verify_cert() and X509_STORE_CTX_verify() return 1 if a complete chain can be built and validated, otherwise they return 0, and in exceptional circumstances (such as malloc failure and internal errors) they can also return a negative code.

                                                                                                                                                            If a complete chain can be built and validated both functions return 1. If the certificate must be rejected on the basis of the data available or any required certificate status data is not available they return 0. If no definite answer possible they usually return a negative code.

                                                                                                                                                            On error or failure additional error information can be obtained by examining ctx using, for example, X509_STORE_CTX_get_error(3). Even if verification indicated success, the stored error code may be different from X509_V_OK, likely because a verification callback function has waived the error.

                                                                                                                                                            "},{"location":"man3/X509_verify_cert/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509_STORE_CTX_new(3), X509_STORE_CTX_init(3), X509_STORE_CTX_get_error(3)

                                                                                                                                                            "},{"location":"man3/X509_verify_cert/#history","title":"HISTORY","text":"

                                                                                                                                                            X509_build_chain() and X509_STORE_CTX_verify() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/X509_verify_cert/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2009-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/X509v3_get_ext_by_NID/","title":"X509v3_get_ext_by_NID","text":""},{"location":"man3/X509v3_get_ext_by_NID/#name","title":"NAME","text":"

                                                                                                                                                            X509v3_get_ext_count, X509v3_get_ext, X509v3_get_ext_by_NID, X509v3_get_ext_by_OBJ, X509v3_get_ext_by_critical, X509v3_delete_ext, X509v3_add_ext, X509_get_ext_count, X509_get_ext, X509_get_ext_by_NID, X509_get_ext_by_OBJ, X509_get_ext_by_critical, X509_delete_ext, X509_add_ext, X509_CRL_get_ext_count, X509_CRL_get_ext, X509_CRL_get_ext_by_NID, X509_CRL_get_ext_by_OBJ, X509_CRL_get_ext_by_critical, X509_CRL_delete_ext, X509_CRL_add_ext, X509_REVOKED_get_ext_count, X509_REVOKED_get_ext, X509_REVOKED_get_ext_by_NID, X509_REVOKED_get_ext_by_OBJ, X509_REVOKED_get_ext_by_critical, X509_REVOKED_delete_ext, X509_REVOKED_add_ext - extension stack utility functions

                                                                                                                                                            "},{"location":"man3/X509v3_get_ext_by_NID/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nint X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);\nX509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);\n\nint X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,\n                          int nid, int lastpos);\nint X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,\n                          const ASN1_OBJECT *obj, int lastpos);\nint X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,\n                               int crit, int lastpos);\nX509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);\nSTACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,\n                                         X509_EXTENSION *ex, int loc);\n\nint X509_get_ext_count(const X509 *x);\nX509_EXTENSION *X509_get_ext(const X509 *x, int loc);\nint X509_get_ext_by_NID(const X509 *x, int nid, int lastpos);\nint X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos);\nint X509_get_ext_by_critical(const X509 *x, int crit, int lastpos);\nX509_EXTENSION *X509_delete_ext(X509 *x, int loc);\nint X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);\n\nint X509_CRL_get_ext_count(const X509_CRL *x);\nX509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc);\nint X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos);\nint X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj,\n                            int lastpos);\nint X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos);\nX509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);\nint X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);\n\nint X509_REVOKED_get_ext_count(const X509_REVOKED *x);\nX509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc);\nint X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos);\nint X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,\n                                int lastpos);\nint X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, int lastpos);\nX509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);\nint X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);\n
                                                                                                                                                            "},{"location":"man3/X509v3_get_ext_by_NID/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            X509v3_get_ext_count() retrieves the number of extensions in x.

                                                                                                                                                            X509v3_get_ext() retrieves extension loc from x. The index loc can take any value from 0 to X509_get_ext_count(x) - 1. The returned extension is an internal pointer which MUST NOT be freed by the application.

                                                                                                                                                            X509v3_get_ext_by_NID() and X509v3_get_ext_by_OBJ() look for an extension with nid or obj from extension STACK x. The search starts from the extension after lastpos or from the beginning if lastpos is -1. If the extension is found, its index is returned, otherwise -1 is returned.

                                                                                                                                                            X509v3_get_ext_by_critical() is similar to X509v3_get_ext_by_NID() except it looks for an extension of criticality crit. A zero value for crit looks for a non-critical extension. A nonzero value looks for a critical extension.

                                                                                                                                                            X509v3_delete_ext() deletes the extension with index loc from x. The deleted extension is returned and must be freed by the caller. If loc is an invalid index value, NULL is returned.

                                                                                                                                                            X509v3_add_ext() adds extension ex to STACK *x at position loc. If loc is -1, the new extension is added to the end. If *x is NULL, a new STACK will be allocated. The passed extension ex is duplicated internally so it must be freed after use.

                                                                                                                                                            X509_get_ext_count(), X509_get_ext(), X509_get_ext_by_NID(), X509_get_ext_by_OBJ(), X509_get_ext_by_critical(), X509_delete_ext() and X509_add_ext() operate on the extensions of certificate x. They are otherwise identical to the X509v3 functions.

                                                                                                                                                            X509_CRL_get_ext_count(), X509_CRL_get_ext(), X509_CRL_get_ext_by_NID(), X509_CRL_get_ext_by_OBJ(), X509_CRL_get_ext_by_critical(), X509_CRL_delete_ext() and X509_CRL_add_ext() operate on the extensions of CRL x. They are otherwise identical to the X509v3 functions.

                                                                                                                                                            X509_REVOKED_get_ext_count(), X509_REVOKED_get_ext(), X509_REVOKED_get_ext_by_NID(), X509_REVOKED_get_ext_by_OBJ(), X509_REVOKED_get_ext_by_critical(), X509_REVOKED_delete_ext() and X509_REVOKED_add_ext() operate on the extensions of CRL entry x. They are otherwise identical to the X509v3 functions.

                                                                                                                                                            "},{"location":"man3/X509v3_get_ext_by_NID/#notes","title":"NOTES","text":"

                                                                                                                                                            These functions are used to examine stacks of extensions directly. Applications that want to parse or encode and add an extension should use the extension encode and decode functions instead, such as X509_add1_ext_i2d() and X509_get_ext_d2i().

                                                                                                                                                            For X509v3_get_ext_by_NID(), X509v3_get_ext_by_OBJ(), X509v3_get_ext_by_critical() and its variants, a zero index return value is not an error since extension STACK x indices start from zero. These search functions start from the extension after the lastpos parameter so it should initially be set to -1. If it is set to zero, the initial extension will not be checked.

                                                                                                                                                            X509v3_delete_ext() and its variants are a bit counter-intuitive because these functions do not free the extension they delete. They return an X509_EXTENSION object which must be explicitly freed using X509_EXTENSION_free().

                                                                                                                                                            "},{"location":"man3/X509v3_get_ext_by_NID/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            X509v3_get_ext_count() returns the extension count or 0 for failure.

                                                                                                                                                            X509v3_get_ext(), X509v3_delete_ext() and X509_delete_ext() return an X509_EXTENSION structure or NULL if an error occurs.

                                                                                                                                                            X509v3_get_ext_by_OBJ() and X509v3_get_ext_by_critical() return the extension index or -1 if an error occurs.

                                                                                                                                                            X509v3_get_ext_by_NID() returns the extension index or negative values if an error occurs.

                                                                                                                                                            X509v3_add_ext() returns a STACK of extensions or NULL on error.

                                                                                                                                                            X509_add_ext() returns 1 on success and 0 on error.

                                                                                                                                                            "},{"location":"man3/X509v3_get_ext_by_NID/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            X509V3_get_d2i(3)

                                                                                                                                                            "},{"location":"man3/X509v3_get_ext_by_NID/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/b2i_PVK_bio_ex/","title":"b2i_PVK_bio_ex","text":""},{"location":"man3/b2i_PVK_bio_ex/#name","title":"NAME","text":"

                                                                                                                                                            b2i_PVK_bio, b2i_PVK_bio_ex, i2b_PVK_bio, i2b_PVK_bio_ex - Decode and encode functions for reading and writing MSBLOB format private keys

                                                                                                                                                            "},{"location":"man3/b2i_PVK_bio_ex/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/pem.h>\n\nEVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);\nEVP_PKEY *b2i_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u,\n                         OSSL_LIB_CTX *libctx, const char *propq);\nint i2b_PVK_bio(BIO *out, const EVP_PKEY *pk, int enclevel,\n                pem_password_cb *cb, void *u);\nint i2b_PVK_bio_ex(BIO *out, const EVP_PKEY *pk, int enclevel,\n                   pem_password_cb *cb, void *u,\n                   OSSL_LIB_CTX *libctx, const char *propq);\n
                                                                                                                                                            "},{"location":"man3/b2i_PVK_bio_ex/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            b2i_PVK_bio_ex() decodes a private key of MSBLOB format read from a BIO. It attempts to automatically determine the key type. If the key is encrypted then cb is called with the user data u in order to obtain a password to decrypt the key. The supplied library context libctx and property query string propq are used in any decrypt operation.

                                                                                                                                                            b2i_PVK_bio() does the same as b2i_PVK_bio_ex() except that the default library context and property query string are used.

                                                                                                                                                            i2b_PVK_bio_ex() encodes pk using MSBLOB format. If enclevel is 1 then a password obtained via pem_password_cb is used to encrypt the private key. If enclevel is 0 then no encryption is applied. The user data in u is passed to the password callback. The supplied library context libctx and property query string propq are used in any decrypt operation.

                                                                                                                                                            i2b_PVK_bio() does the same as i2b_PVK_bio_ex() except that the default library context and property query string are used.

                                                                                                                                                            "},{"location":"man3/b2i_PVK_bio_ex/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The b2i_PVK_bio() and b2i_PVK_bio_ex() functions return a valid EVP_KEY structure or NULL if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                                                                                                                                                            i2b_PVK_bio() and i2b_PVK_bio_ex() return the number of bytes successfully encoded or a negative value if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                                                                                                                                                            "},{"location":"man3/b2i_PVK_bio_ex/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            crypto(7), d2i_PKCS8PrivateKey_bio(3)

                                                                                                                                                            "},{"location":"man3/b2i_PVK_bio_ex/#history","title":"HISTORY","text":"

                                                                                                                                                            b2i_PVK_bio_ex() and i2b_PVK_bio_ex() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/b2i_PVK_bio_ex/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/d2i_PKCS8PrivateKey_bio/","title":"d2i_PKCS8PrivateKey_bio","text":""},{"location":"man3/d2i_PKCS8PrivateKey_bio/#name","title":"NAME","text":"

                                                                                                                                                            d2i_PKCS8PrivateKey_bio, d2i_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_bio, i2d_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_nid_bio, i2d_PKCS8PrivateKey_nid_fp - PKCS#8 format private key functions

                                                                                                                                                            "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/pem.h>\n\nEVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);\nEVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_bio(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc,\n                            char *kstr, int klen,\n                            pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_fp(FILE *fp, const EVP_PKEY *x, const EVP_CIPHER *enc,\n                           char *kstr, int klen,\n                           pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_nid_bio(BIO *bp, const EVP_PKEY *x, int nid,\n                                char *kstr, int klen,\n                                pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_nid_fp(FILE *fp, const EVP_PKEY *x, int nid,\n                               char *kstr, int klen,\n                               pem_password_cb *cb, void *u);\n
                                                                                                                                                            "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The PKCS#8 functions encode and decode private keys in PKCS#8 format using both PKCS#5 v1.5 and PKCS#5 v2.0 password based encryption algorithms.

                                                                                                                                                            Other than the use of DER as opposed to PEM these functions are identical to the corresponding PEM function as described in PEM_read_PrivateKey(3).

                                                                                                                                                            "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#notes","title":"NOTES","text":"

                                                                                                                                                            These functions are currently the only way to store encrypted private keys using DER format.

                                                                                                                                                            Currently all the functions use BIOs or FILE pointers, there are no functions which work directly on memory: this can be readily worked around by converting the buffers to memory BIOs, see BIO_s_mem(3) for details.

                                                                                                                                                            These functions make no assumption regarding the pass phrase received from the password callback. It will simply be treated as a byte sequence.

                                                                                                                                                            "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            d2i_PKCS8PrivateKey_bio() and d2i_PKCS8PrivateKey_fp() return a valid EVP_PKEY structure or NULL if an error occurred.

                                                                                                                                                            i2d_PKCS8PrivateKey_bio(), i2d_PKCS8PrivateKey_fp(), i2d_PKCS8PrivateKey_nid_bio() and i2d_PKCS8PrivateKey_nid_fp() return 1 on success or 0 on error.

                                                                                                                                                            "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            PEM_read_PrivateKey(3), passphrase-encoding(7)

                                                                                                                                                            "},{"location":"man3/d2i_PKCS8PrivateKey_bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/","title":"d2i_PrivateKey","text":""},{"location":"man3/d2i_PrivateKey/#name","title":"NAME","text":"

                                                                                                                                                            d2i_PrivateKey_ex, d2i_PrivateKey, d2i_PublicKey, d2i_KeyParams, d2i_AutoPrivateKey_ex, d2i_AutoPrivateKey, i2d_PrivateKey, i2d_PublicKey, i2d_KeyParams, i2d_KeyParams_bio, d2i_PrivateKey_ex_bio, d2i_PrivateKey_bio, d2i_PrivateKey_ex_fp, d2i_PrivateKey_fp, d2i_KeyParams_bio, i2d_PrivateKey_bio, i2d_PrivateKey_fp - decode and encode functions for reading and saving EVP_PKEY structures

                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/evp.h>\n\nEVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp,\n                            long length, OSSL_LIB_CTX *libctx,\n                            const char *propq);\nEVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,\n                         long length);\nEVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,\n                        long length);\nEVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp,\n                        long length);\nEVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp,\n                                long length, OSSL_LIB_CTX *libctx,\n                                const char *propq);\nEVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,\n                             long length);\n\nint i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp);\nint i2d_PublicKey(const EVP_PKEY *a, unsigned char **pp);\nint i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp);\nint i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey);\nEVP_PKEY *d2i_KeyParams_bio(int type, EVP_PKEY **a, BIO *in);\n\n\n#include <openssl/x509.h>\n\nEVP_PKEY *d2i_PrivateKey_ex_bio(BIO *bp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,\n                                const char *propq);\nEVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);\nEVP_PKEY *d2i_PrivateKey_ex_fp(FILE *fp, EVP_PKEY **a, OSSL_LIB_CTX *libctx,\n                               const char *propq);\nEVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);\n\nint i2d_PrivateKey_bio(BIO *bp, const EVP_PKEY *pkey);\nint i2d_PrivateKey_fp(FILE *fp, const EVP_PKEY *pkey);\n
                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            d2i_PrivateKey_ex() decodes a private key using algorithm type. It attempts to use any key-specific format or PKCS#8 unencrypted PrivateKeyInfo format. The type parameter should be a public key algorithm constant such as EVP_PKEY_RSA. An error occurs if the decoded key does not match type. Some private key decoding implementations may use cryptographic algorithms (for example to automatically derive the public key if it is not explicitly included in the encoding). In this case the supplied library context libctx and property query string propq are used. If successful and the a parameter is not NULL the function assigns the returned EVP_PKEY structure pointer to *a, overwriting any previous value.

                                                                                                                                                            d2i_PrivateKey() does the same as d2i_PrivateKey_ex() except that the default library context and property query string are used. d2i_PublicKey() does the same for public keys. d2i_KeyParams() does the same for key parameters.

                                                                                                                                                            The d2i_PrivateKey_ex_bio() and d2i_PrivateKey_bio() functions are similar to d2i_PrivateKey_ex() and d2i_PrivateKey() respectively except that they decode the data read from the given BIO. The d2i_PrivateKey_ex_fp() and d2i_PrivateKey_fp() functions are the same except that they read the data from the given FILE.

                                                                                                                                                            d2i_AutoPrivateKey_ex() and d2i_AutoPrivateKey() are similar to d2i_PrivateKey_ex() and d2i_PrivateKey() respectively except that they attempt to automatically detect the private key format.

                                                                                                                                                            i2d_PrivateKey() encodes a. It uses a key specific format or, if none is defined for that key type, PKCS#8 unencrypted PrivateKeyInfo format. i2d_PublicKey() does the same for public keys. i2d_KeyParams() does the same for key parameters. These functions are similar to the d2i_X509() functions; see d2i_X509(3). i2d_PrivateKey_bio() and i2d_PrivateKey_fp() do the same thing except that they encode to a BIO or FILE respectively. Again, these work similarly to the functions described in d2i_X509(3).

                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/#notes","title":"NOTES","text":"

                                                                                                                                                            All the functions that operate on data in memory update the data pointer *pp after a successful operation, just like the other d2i and i2d functions; see d2i_X509(3).

                                                                                                                                                            All these functions use DER format and unencrypted keys. Applications wishing to encrypt or decrypt private keys should use other functions such as d2i_PKCS8PrivateKey() instead.

                                                                                                                                                            To decode a key with type EVP_PKEY_EC, d2i_PublicKey() requires *a to be a non-NULL EVP_PKEY structure assigned an EC_KEY structure referencing the proper EC_GROUP.

                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            The d2i_PrivateKey_ex(), d2i_PrivateKey(), d2i_AutoPrivateKey_ex(), d2i_AutoPrivateKey(), d2i_PrivateKey_ex_bio(), d2i_PrivateKey_bio(), d2i_PrivateKey_ex_fp(), d2i_PrivateKey_fp(), d2i_PublicKey(), d2i_KeyParams() and d2i_KeyParams_bio() functions return a valid EVP_PKEY structure or NULL if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                                                                                                                                                            i2d_PrivateKey(), i2d_PublicKey() and i2d_KeyParams() return the number of bytes successfully encoded or a negative value if an error occurs. The error code can be obtained by calling ERR_get_error(3).

                                                                                                                                                            i2d_PrivateKey_bio(), i2d_PrivateKey_fp() and i2d_KeyParams_bio() return 1 if successfully encoded or zero if an error occurs.

                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            crypto(7), d2i_PKCS8PrivateKey_bio(3)

                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/#history","title":"HISTORY","text":"

                                                                                                                                                            d2i_PrivateKey_ex(), d2i_PrivateKey_ex_bio(), d2i_PrivateKey_ex_fp(), and d2i_AutoPrivateKey_ex() were added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/d2i_PrivateKey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/","title":"d2i_RSAPrivateKey","text":""},{"location":"man3/d2i_RSAPrivateKey/#name","title":"NAME","text":"

                                                                                                                                                            d2i_DSAPrivateKey, d2i_DSAPrivateKey_bio, d2i_DSAPrivateKey_fp, d2i_DSAPublicKey, d2i_DSA_PUBKEY, d2i_DSA_PUBKEY_bio, d2i_DSA_PUBKEY_fp, d2i_DSAparams, d2i_RSAPrivateKey, d2i_RSAPrivateKey_bio, d2i_RSAPrivateKey_fp, d2i_RSAPublicKey, d2i_RSAPublicKey_bio, d2i_RSAPublicKey_fp, d2i_RSA_PUBKEY, d2i_RSA_PUBKEY_bio, d2i_RSA_PUBKEY_fp, d2i_DHparams, d2i_DHparams_bio, d2i_DHparams_fp, d2i_ECParameters, d2i_ECPrivateKey, d2i_ECPrivateKey_bio, d2i_ECPrivateKey_fp, d2i_EC_PUBKEY, d2i_EC_PUBKEY_bio, d2i_EC_PUBKEY_fp, i2d_RSAPrivateKey, i2d_RSAPrivateKey_bio, i2d_RSAPrivateKey_fp, i2d_RSAPublicKey, i2d_RSAPublicKey_bio, i2d_RSAPublicKey_fp, i2d_RSA_PUBKEY, i2d_RSA_PUBKEY_bio, i2d_RSA_PUBKEY_fp, i2d_DHparams, i2d_DHparams_bio, i2d_DHparams_fp, i2d_DSAPrivateKey, i2d_DSAPrivateKey_bio, i2d_DSAPrivateKey_fp, i2d_DSAPublicKey, i2d_DSA_PUBKEY, i2d_DSA_PUBKEY_bio, i2d_DSA_PUBKEY_fp, i2d_DSAparams, i2d_ECParameters, i2d_ECPrivateKey, i2d_ECPrivateKey_bio, i2d_ECPrivateKey_fp, i2d_EC_PUBKEY, i2d_EC_PUBKEY_bio, i2d_EC_PUBKEY_fp - DEPRECATED

                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                            The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):

                                                                                                                                                            TYPE *d2i_TYPEPrivateKey(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPEPrivateKey_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPEPrivateKey_fp(FILE *fp, TYPE **a);\nTYPE *d2i_TYPEPublicKey(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPEPublicKey_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPEPublicKey_fp(FILE *fp, TYPE **a);\nTYPE *d2i_TYPEparams(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPEparams_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPEparams_fp(FILE *fp, TYPE **a);\nTYPE *d2i_TYPE_PUBKEY(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPE_PUBKEY_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPE_PUBKEY_fp(FILE *fp, TYPE **a);\n\nint i2d_TYPEPrivateKey(const TYPE *a, unsigned char **ppout);\nint i2d_TYPEPrivateKey(TYPE *a, unsigned char **ppout);\nint i2d_TYPEPrivateKey_fp(FILE *fp, const TYPE *a);\nint i2d_TYPEPrivateKey_fp(FILE *fp, TYPE *a);\nint i2d_TYPEPrivateKey_bio(BIO *bp, const TYPE *a);\nint i2d_TYPEPrivateKey_bio(BIO *bp, TYPE *a);\nint i2d_TYPEPublicKey(const TYPE *a, unsigned char **ppout);\nint i2d_TYPEPublicKey(TYPE *a, unsigned char **ppout);\nint i2d_TYPEPublicKey_fp(FILE *fp, const TYPE *a);\nint i2d_TYPEPublicKey_fp(FILE *fp, TYPE *a);\nint i2d_TYPEPublicKey_bio(BIO *bp, const TYPE *a);\nint i2d_TYPEPublicKey_bio(BIO *bp, TYPE *a);\nint i2d_TYPEparams(const TYPE *a, unsigned char **ppout);\nint i2d_TYPEparams(TYPE *a, unsigned char **ppout);\nint i2d_TYPEparams_fp(FILE *fp, const TYPE *a);\nint i2d_TYPEparams_fp(FILE *fp, TYPE *a);\nint i2d_TYPEparams_bio(BIO *bp, const TYPE *a);\nint i2d_TYPEparams_bio(BIO *bp, TYPE *a);\nint i2d_TYPE_PUBKEY(const TYPE *a, unsigned char **ppout);\nint i2d_TYPE_PUBKEY(TYPE *a, unsigned char **ppout);\nint i2d_TYPE_PUBKEY_fp(FILE *fp, const TYPE *a);\nint i2d_TYPE_PUBKEY_fp(FILE *fp, TYPE *a);\nint i2d_TYPE_PUBKEY_bio(BIO *bp, const TYPE *a);\nint i2d_TYPE_PUBKEY_bio(BIO *bp, TYPE *a);\n
                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            All functions described here are deprecated. Please use OSSL_DECODER(3) instead of the d2i functions and OSSL_ENCODER(3) instead of the i2d functions. See \"Migration\" below.

                                                                                                                                                            In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes, such as RSA. The function parameters ppin and ppout are generally either both named pp in the headers, or in and out.

                                                                                                                                                            All the functions here behave the way that's described in d2i_X509(3).

                                                                                                                                                            Please note that not all functions in the synopsis are available for all key types. For example, there are no d2i_RSAparams() or i2d_RSAparams(), because the PKCS#1 RSA structure doesn't include any key parameters.

                                                                                                                                                            d2i__TYPE_PrivateKey() and derivates thereof decode DER encoded TYPE private key data organized in a type specific structure.

                                                                                                                                                            d2i__TYPE_PublicKey() and derivates thereof decode DER encoded TYPE public key data organized in a type specific structure.

                                                                                                                                                            d2i__TYPE_params() and derivates thereof decode DER encoded TYPE key parameters organized in a type specific structure.

                                                                                                                                                            d2i_TYPE_PUBKEY() and derivates thereof decode DER encoded TYPE public key data organized in a SubjectPublicKeyInfo structure.

                                                                                                                                                            i2d__TYPE_PrivateKey() and derivates thereof encode the private key TYPE data into a type specific DER encoded structure.

                                                                                                                                                            i2d__TYPE_PublicKey() and derivates thereof encode the public key TYPE data into a type specific DER encoded structure.

                                                                                                                                                            i2d__TYPE_params() and derivates thereof encode the TYPE key parameters data into a type specific DER encoded structure.

                                                                                                                                                            i2d_TYPE_PUBKEY() and derivates thereof encode the public key TYPE data into a DER encoded SubjectPublicKeyInfo structure.

                                                                                                                                                            For example, d2i_RSAPrivateKey() and d2i_RSAPublicKey() expects the structure defined by PKCS#1. Similarly, i2d_RSAPrivateKey() and i2d_RSAPublicKey() produce DER encoded string organized according to PKCS#1.

                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#migration","title":"Migration","text":"

                                                                                                                                                            Migration from the diverse TYPEs requires using corresponding new OpenSSL types. For all TYPEs described here, the corresponding new type is EVP_PKEY. The rest of this section assumes that this has been done, exactly how to do that is described elsewhere.

                                                                                                                                                            There are two migration paths:

                                                                                                                                                            • Replace b<d2i_TYPE_PrivateKey()> with d2i_PrivateKey(3), b<d2i__TYPE_PublicKey()> with d2i_PublicKey(3), b<d2i__TYPE_params()> with d2i_KeyParams(3), b<d2i__TYPE_PUBKEY()> with d2i_PUBKEY(3), b<i2d_TYPE_PrivateKey()> with i2d_PrivateKey(3), b<i2d__TYPE_PublicKey()> with i2d_PublicKey(3), b<i2d__TYPE_params()> with i2d_KeyParams(3), b<i2d__TYPE_PUBKEY()> with i2d_PUBKEY(3). A caveat is that i2d_PrivateKey(3) may output a DER encoded PKCS#8 outermost structure instead of the type specific structure, and that d2i_PrivateKey(3) recognises and unpacks a PKCS#8 structures.
                                                                                                                                                            • Use OSSL_DECODER(3) and OSSL_ENCODER(3). How to migrate is described below. All those descriptions assume that the key to be encoded is in the variable pkey.
                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#migrating-i2d-functions-to-ossl_encoder","title":"Migrating i2d functions to OSSL_ENCODER","text":"

                                                                                                                                                            The exact OSSL_ENCODER(3) output is driven by arguments rather than by function names. The sample code to get DER encoded output in a type specific structure is uniform, the only things that vary are the selection of what part of the EVP_PKEY should be output, and the structure. The i2d functions names can therefore be translated into two variables, selection and structure as follows:

                                                                                                                                                            • i2d__TYPE_PrivateKey() translates into:

                                                                                                                                                              int selection = EVP_PKEY_KEYPAIR;\nconst char *structure = \"type-specific\";\n
                                                                                                                                                            • i2d__TYPE_PublicKey() translates into:

                                                                                                                                                              int selection = EVP_PKEY_PUBLIC_KEY;\nconst char *structure = \"type-specific\";\n
                                                                                                                                                            • i2d__TYPE_params() translates into:

                                                                                                                                                              int selection = EVP_PKEY_PARAMETERS;\nconst char *structure = \"type-specific\";\n
                                                                                                                                                            • i2d_TYPE_PUBKEY() translates into:

                                                                                                                                                              int selection = EVP_PKEY_PUBLIC_KEY;\nconst char *structure = \"SubjectPublicKeyInfo\";\n

                                                                                                                                                            The following sample code does the rest of the work:

                                                                                                                                                            unsigned char *p = buffer;     /* |buffer| is supplied by the caller */\nsize_t len = buffer_size;      /* assumed be the size of |buffer| */\nOSSL_ENCODER_CTX *ctx =\n    OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, \"DER\", structure,\n                                  NULL, NULL);\nif (ctx == NULL) {\n    /* fatal error handling */\n}\nif (OSSL_ENCODER_CTX_get_num_encoders(ctx) == 0) {\n    OSSL_ENCODER_CTX_free(ctx);\n    /* non-fatal error handling */\n}\nif (!OSSL_ENCODER_to_data(ctx, &p, &len)) {\n    OSSL_ENCODER_CTX_free(ctx);\n    /* error handling */\n}\nOSSL_ENCODER_CTX_free(ctx);\n
                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#notes","title":"NOTES","text":"

                                                                                                                                                            The letters i and d in i2d_TYPE() stand for \"internal\" (that is, an internal C structure) and \"DER\" respectively. So i2d_TYPE() converts from internal to DER.

                                                                                                                                                            The functions can also understand BER forms.

                                                                                                                                                            The actual TYPE structure passed to i2d_TYPE() must be a valid populated TYPE structure -- it cannot simply be fed with an empty structure such as that returned by TYPE_new().

                                                                                                                                                            The encoded data is in binary form and may contain embedded zeros. Therefore, any FILE pointers or BIOs should be opened in binary mode. Functions such as strlen() will not return the correct length of the encoded structure.

                                                                                                                                                            The ways that *ppin and *ppout are incremented after the operation can trap the unwary. See the WARNINGS section in d2i_X509(3) for some common errors. The reason for this-auto increment behaviour is to reflect a typical usage of ASN1 functions: after one structure is encoded or decoded another will be processed after it.

                                                                                                                                                            The following points about the data types might be useful:

                                                                                                                                                            • DSA_PUBKEY

                                                                                                                                                              Represents a DSA public key using a SubjectPublicKeyInfo structure.

                                                                                                                                                            • DSAPublicKey, DSAPrivateKey

                                                                                                                                                              Use a non-standard OpenSSL format and should be avoided; use DSA_PUBKEY, PEM_write_PrivateKey(3), or similar instead.

                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            d2i_TYPE(), d2i_TYPE_bio() and d2i_TYPE_fp() return a valid TYPE structure or NULL if an error occurs. If the \"reuse\" capability has been used with a valid structure being passed in via a, then the object is freed in the event of error and *a is set to NULL.

                                                                                                                                                            i2d_TYPE() returns the number of bytes successfully encoded or a negative value if an error occurs.

                                                                                                                                                            i2d_TYPE_bio() and i2d_TYPE_fp() return 1 for success and 0 if an error occurs.

                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            OSSL_ENCODER(3), OSSL_DECODER(3), d2i_PrivateKey(3), d2i_PublicKey(3), d2i_KeyParams(3), d2i_PUBKEY(3), i2d_PrivateKey(3), i2d_PublicKey(3), i2d_KeyParams(3), i2d_PUBKEY(3)

                                                                                                                                                            "},{"location":"man3/d2i_RSAPrivateKey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/d2i_SSL_SESSION/","title":"d2i_SSL_SESSION","text":""},{"location":"man3/d2i_SSL_SESSION/#name","title":"NAME","text":"

                                                                                                                                                            d2i_SSL_SESSION, i2d_SSL_SESSION - convert SSL_SESSION object from/to ASN1 representation

                                                                                                                                                            "},{"location":"man3/d2i_SSL_SESSION/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ssl.h>\n\nSSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,\n                             long length);\nint i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp);\n
                                                                                                                                                            "},{"location":"man3/d2i_SSL_SESSION/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions decode and encode an SSL_SESSION object. For encoding details see d2i_X509(3).

                                                                                                                                                            SSL_SESSION objects keep internal link information about the session cache list, when being inserted into one SSL_CTX object's session cache. One SSL_SESSION object, regardless of its reference count, must therefore only be used with one SSL_CTX object (and the SSL objects created from this SSL_CTX object).

                                                                                                                                                            "},{"location":"man3/d2i_SSL_SESSION/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            d2i_SSL_SESSION() returns a pointer to the newly allocated SSL_SESSION object. In case of failure the NULL-pointer is returned and the error message can be retrieved from the error stack.

                                                                                                                                                            i2d_SSL_SESSION() returns the size of the ASN1 representation in bytes. When the session is not valid, 0 is returned and no operation is performed.

                                                                                                                                                            "},{"location":"man3/d2i_SSL_SESSION/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ssl(7), SSL_SESSION_free(3), SSL_CTX_sess_set_get_cb(3), d2i_X509(3)

                                                                                                                                                            "},{"location":"man3/d2i_SSL_SESSION/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/d2i_X509/","title":"d2i_X509","text":""},{"location":"man3/d2i_X509/#name","title":"NAME","text":"

                                                                                                                                                            d2i_ACCESS_DESCRIPTION, d2i_ADMISSIONS, d2i_ADMISSION_SYNTAX, d2i_ASIdOrRange, d2i_ASIdentifierChoice, d2i_ASIdentifiers, d2i_ASN1_BIT_STRING, d2i_ASN1_BMPSTRING, d2i_ASN1_ENUMERATED, d2i_ASN1_GENERALIZEDTIME, d2i_ASN1_GENERALSTRING, d2i_ASN1_IA5STRING, d2i_ASN1_INTEGER, d2i_ASN1_NULL, d2i_ASN1_OBJECT, d2i_ASN1_OCTET_STRING, d2i_ASN1_PRINTABLE, d2i_ASN1_PRINTABLESTRING, d2i_ASN1_SEQUENCE_ANY, d2i_ASN1_SET_ANY, d2i_ASN1_T61STRING, d2i_ASN1_TIME, d2i_ASN1_TYPE, d2i_ASN1_UINTEGER, d2i_ASN1_UNIVERSALSTRING, d2i_ASN1_UTCTIME, d2i_ASN1_UTF8STRING, d2i_ASN1_VISIBLESTRING, d2i_ASRange, d2i_AUTHORITY_INFO_ACCESS, d2i_AUTHORITY_KEYID, d2i_BASIC_CONSTRAINTS, d2i_CERTIFICATEPOLICIES, d2i_CMS_ContentInfo, d2i_CMS_ReceiptRequest, d2i_CMS_bio, d2i_CRL_DIST_POINTS, d2i_DHxparams, d2i_DIRECTORYSTRING, d2i_DISPLAYTEXT, d2i_DIST_POINT, d2i_DIST_POINT_NAME, d2i_DSA_SIG, d2i_ECDSA_SIG, d2i_ECPKParameters, d2i_EDIPARTYNAME, d2i_ESS_CERT_ID, d2i_ESS_CERT_ID_V2, d2i_ESS_ISSUER_SERIAL, d2i_ESS_SIGNING_CERT, d2i_ESS_SIGNING_CERT_V2, d2i_EXTENDED_KEY_USAGE, d2i_GENERAL_NAME, d2i_GENERAL_NAMES, d2i_IPAddressChoice, d2i_IPAddressFamily, d2i_IPAddressOrRange, d2i_IPAddressRange, d2i_ISSUER_SIGN_TOOL, d2i_ISSUING_DIST_POINT, d2i_NAMING_AUTHORITY, d2i_NETSCAPE_CERT_SEQUENCE, d2i_NETSCAPE_SPKAC, d2i_NETSCAPE_SPKI, d2i_NOTICEREF, d2i_OCSP_BASICRESP, d2i_OCSP_CERTID, d2i_OCSP_CERTSTATUS, d2i_OCSP_CRLID, d2i_OCSP_ONEREQ, d2i_OCSP_REQINFO, d2i_OCSP_REQUEST, d2i_OCSP_RESPBYTES, d2i_OCSP_RESPDATA, d2i_OCSP_RESPID, d2i_OCSP_RESPONSE, d2i_OCSP_REVOKEDINFO, d2i_OCSP_SERVICELOC, d2i_OCSP_SIGNATURE, d2i_OCSP_SINGLERESP, d2i_OSSL_CMP_MSG, d2i_OSSL_CMP_PKIHEADER, d2i_OSSL_CMP_PKISI, d2i_OSSL_CRMF_CERTID, d2i_OSSL_CRMF_CERTTEMPLATE, d2i_OSSL_CRMF_ENCRYPTEDVALUE, d2i_OSSL_CRMF_MSG, d2i_OSSL_CRMF_MSGS, d2i_OSSL_CRMF_PBMPARAMETER, d2i_OSSL_CRMF_PKIPUBLICATIONINFO, d2i_OSSL_CRMF_SINGLEPUBINFO, d2i_OTHERNAME, d2i_PBE2PARAM, d2i_PBEPARAM, d2i_PBKDF2PARAM, d2i_PKCS12, d2i_PKCS12_BAGS, d2i_PKCS12_MAC_DATA, d2i_PKCS12_SAFEBAG, d2i_PKCS12_bio, d2i_PKCS12_fp, d2i_PKCS7, d2i_PKCS7_DIGEST, d2i_PKCS7_ENCRYPT, d2i_PKCS7_ENC_CONTENT, d2i_PKCS7_ENVELOPE, d2i_PKCS7_ISSUER_AND_SERIAL, d2i_PKCS7_RECIP_INFO, d2i_PKCS7_SIGNED, d2i_PKCS7_SIGNER_INFO, d2i_PKCS7_SIGN_ENVELOPE, d2i_PKCS7_bio, d2i_PKCS7_fp, d2i_PKCS8_PRIV_KEY_INFO, d2i_PKCS8_PRIV_KEY_INFO_bio, d2i_PKCS8_PRIV_KEY_INFO_fp, d2i_PKCS8_bio, d2i_PKCS8_fp, d2i_PKEY_USAGE_PERIOD, d2i_POLICYINFO, d2i_POLICYQUALINFO, d2i_PROFESSION_INFO, d2i_PROXY_CERT_INFO_EXTENSION, d2i_PROXY_POLICY, d2i_RSA_OAEP_PARAMS, d2i_RSA_PSS_PARAMS, d2i_SCRYPT_PARAMS, d2i_SCT_LIST, d2i_SXNET, d2i_SXNETID, d2i_TS_ACCURACY, d2i_TS_MSG_IMPRINT, d2i_TS_MSG_IMPRINT_bio, d2i_TS_MSG_IMPRINT_fp, d2i_TS_REQ, d2i_TS_REQ_bio, d2i_TS_REQ_fp, d2i_TS_RESP, d2i_TS_RESP_bio, d2i_TS_RESP_fp, d2i_TS_STATUS_INFO, d2i_TS_TST_INFO, d2i_TS_TST_INFO_bio, d2i_TS_TST_INFO_fp, d2i_USERNOTICE, d2i_X509, d2i_X509_bio, d2i_X509_fp, d2i_X509_ALGOR, d2i_X509_ALGORS, d2i_X509_ATTRIBUTE, d2i_X509_CERT_AUX, d2i_X509_CINF, d2i_X509_CRL, d2i_X509_CRL_INFO, d2i_X509_CRL_bio, d2i_X509_CRL_fp, d2i_X509_EXTENSION, d2i_X509_EXTENSIONS, d2i_X509_NAME, d2i_X509_NAME_ENTRY, d2i_X509_PUBKEY, d2i_X509_PUBKEY_bio, d2i_X509_PUBKEY_fp, d2i_X509_REQ, d2i_X509_REQ_INFO, d2i_X509_REQ_bio, d2i_X509_REQ_fp, d2i_X509_REVOKED, d2i_X509_SIG, d2i_X509_VAL, i2d_ACCESS_DESCRIPTION, i2d_ADMISSIONS, i2d_ADMISSION_SYNTAX, i2d_ASIdOrRange, i2d_ASIdentifierChoice, i2d_ASIdentifiers, i2d_ASN1_BIT_STRING, i2d_ASN1_BMPSTRING, i2d_ASN1_ENUMERATED, i2d_ASN1_GENERALIZEDTIME, i2d_ASN1_GENERALSTRING, i2d_ASN1_IA5STRING, i2d_ASN1_INTEGER, i2d_ASN1_NULL, i2d_ASN1_OBJECT, i2d_ASN1_OCTET_STRING, i2d_ASN1_PRINTABLE, i2d_ASN1_PRINTABLESTRING, i2d_ASN1_SEQUENCE_ANY, i2d_ASN1_SET_ANY, i2d_ASN1_T61STRING, i2d_ASN1_TIME, i2d_ASN1_TYPE, i2d_ASN1_UNIVERSALSTRING, i2d_ASN1_UTCTIME, i2d_ASN1_UTF8STRING, i2d_ASN1_VISIBLESTRING, i2d_ASN1_bio_stream, i2d_ASRange, i2d_AUTHORITY_INFO_ACCESS, i2d_AUTHORITY_KEYID, i2d_BASIC_CONSTRAINTS, i2d_CERTIFICATEPOLICIES, i2d_CMS_ContentInfo, i2d_CMS_ReceiptRequest, i2d_CMS_bio, i2d_CRL_DIST_POINTS, i2d_DHxparams, i2d_DIRECTORYSTRING, i2d_DISPLAYTEXT, i2d_DIST_POINT, i2d_DIST_POINT_NAME, i2d_DSA_SIG, i2d_ECDSA_SIG, i2d_ECPKParameters, i2d_EDIPARTYNAME, i2d_ESS_CERT_ID, i2d_ESS_CERT_ID_V2, i2d_ESS_ISSUER_SERIAL, i2d_ESS_SIGNING_CERT, i2d_ESS_SIGNING_CERT_V2, i2d_EXTENDED_KEY_USAGE, i2d_GENERAL_NAME, i2d_GENERAL_NAMES, i2d_IPAddressChoice, i2d_IPAddressFamily, i2d_IPAddressOrRange, i2d_IPAddressRange, i2d_ISSUER_SIGN_TOOL, i2d_ISSUING_DIST_POINT, i2d_NAMING_AUTHORITY, i2d_NETSCAPE_CERT_SEQUENCE, i2d_NETSCAPE_SPKAC, i2d_NETSCAPE_SPKI, i2d_NOTICEREF, i2d_OCSP_BASICRESP, i2d_OCSP_CERTID, i2d_OCSP_CERTSTATUS, i2d_OCSP_CRLID, i2d_OCSP_ONEREQ, i2d_OCSP_REQINFO, i2d_OCSP_REQUEST, i2d_OCSP_RESPBYTES, i2d_OCSP_RESPDATA, i2d_OCSP_RESPID, i2d_OCSP_RESPONSE, i2d_OCSP_REVOKEDINFO, i2d_OCSP_SERVICELOC, i2d_OCSP_SIGNATURE, i2d_OCSP_SINGLERESP, i2d_OSSL_CMP_MSG, i2d_OSSL_CMP_PKIHEADER, i2d_OSSL_CMP_PKISI, i2d_OSSL_CRMF_CERTID, i2d_OSSL_CRMF_CERTTEMPLATE, i2d_OSSL_CRMF_ENCRYPTEDVALUE, i2d_OSSL_CRMF_MSG, i2d_OSSL_CRMF_MSGS, i2d_OSSL_CRMF_PBMPARAMETER, i2d_OSSL_CRMF_PKIPUBLICATIONINFO, i2d_OSSL_CRMF_SINGLEPUBINFO, i2d_OTHERNAME, i2d_PBE2PARAM, i2d_PBEPARAM, i2d_PBKDF2PARAM, i2d_PKCS12, i2d_PKCS12_BAGS, i2d_PKCS12_MAC_DATA, i2d_PKCS12_SAFEBAG, i2d_PKCS12_bio, i2d_PKCS12_fp, i2d_PKCS7, i2d_PKCS7_DIGEST, i2d_PKCS7_ENCRYPT, i2d_PKCS7_ENC_CONTENT, i2d_PKCS7_ENVELOPE, i2d_PKCS7_ISSUER_AND_SERIAL, i2d_PKCS7_NDEF, i2d_PKCS7_RECIP_INFO, i2d_PKCS7_SIGNED, i2d_PKCS7_SIGNER_INFO, i2d_PKCS7_SIGN_ENVELOPE, i2d_PKCS7_bio, i2d_PKCS7_fp, i2d_PKCS8PrivateKeyInfo_bio, i2d_PKCS8PrivateKeyInfo_fp, i2d_PKCS8_PRIV_KEY_INFO, i2d_PKCS8_PRIV_KEY_INFO_bio, i2d_PKCS8_PRIV_KEY_INFO_fp, i2d_PKCS8_bio, i2d_PKCS8_fp, i2d_PKEY_USAGE_PERIOD, i2d_POLICYINFO, i2d_POLICYQUALINFO, i2d_PROFESSION_INFO, i2d_PROXY_CERT_INFO_EXTENSION, i2d_PROXY_POLICY, i2d_RSA_OAEP_PARAMS, i2d_RSA_PSS_PARAMS, i2d_SCRYPT_PARAMS, i2d_SCT_LIST, i2d_SXNET, i2d_SXNETID, i2d_TS_ACCURACY, i2d_TS_MSG_IMPRINT, i2d_TS_MSG_IMPRINT_bio, i2d_TS_MSG_IMPRINT_fp, i2d_TS_REQ, i2d_TS_REQ_bio, i2d_TS_REQ_fp, i2d_TS_RESP, i2d_TS_RESP_bio, i2d_TS_RESP_fp, i2d_TS_STATUS_INFO, i2d_TS_TST_INFO, i2d_TS_TST_INFO_bio, i2d_TS_TST_INFO_fp, i2d_USERNOTICE, i2d_X509, i2d_X509_bio, i2d_X509_fp, i2d_X509_ALGOR, i2d_X509_ALGORS, i2d_X509_ATTRIBUTE, i2d_X509_CERT_AUX, i2d_X509_CINF, i2d_X509_CRL, i2d_X509_CRL_INFO, i2d_X509_CRL_bio, i2d_X509_CRL_fp, i2d_X509_EXTENSION, i2d_X509_EXTENSIONS, i2d_X509_NAME, i2d_X509_NAME_ENTRY, i2d_X509_PUBKEY, i2d_X509_PUBKEY_bio, i2d_X509_PUBKEY_fp, i2d_X509_REQ, i2d_X509_REQ_INFO, i2d_X509_REQ_bio, i2d_X509_REQ_fp, i2d_X509_REVOKED, i2d_X509_SIG, i2d_X509_VAL, - convert objects from/to ASN.1/DER representation

                                                                                                                                                            "},{"location":"man3/d2i_X509/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            TYPE *d2i_TYPE(TYPE **a, const unsigned char **ppin, long length);\nTYPE *d2i_TYPE_bio(BIO *bp, TYPE **a);\nTYPE *d2i_TYPE_fp(FILE *fp, TYPE **a);\n\nint i2d_TYPE(const TYPE *a, unsigned char **ppout);\nint i2d_TYPE(TYPE *a, unsigned char **ppout);\nint i2d_TYPE_fp(FILE *fp, const TYPE *a);\nint i2d_TYPE_fp(FILE *fp, TYPE *a);\nint i2d_TYPE_bio(BIO *bp, const TYPE *a);\nint i2d_TYPE_bio(BIO *bp, TYPE *a);\n
                                                                                                                                                            "},{"location":"man3/d2i_X509/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            In the description here, TYPE is used a placeholder for any of the OpenSSL datatypes, such as X509_CRL. The function parameters ppin and ppout are generally either both named pp in the headers, or in and out.

                                                                                                                                                            These functions convert OpenSSL objects to and from their ASN.1/DER encoding. Unlike the C structures which can have pointers to sub-objects within, the DER is a serialized encoding, suitable for sending over the network, writing to a file, and so on.

                                                                                                                                                            d2i_TYPE() attempts to decode len bytes at *ppin. If successful a pointer to the TYPE structure is returned and *ppin is incremented to the byte following the parsed data. If a is not NULL then a pointer to the returned structure is also written to *a. If an error occurred then NULL is returned. The caller retains ownership of the returned object and needs to free it when it is no longer needed, e.g. using X509_free() for X509 objects or DSA_SIG_free() for DSA_SIG objects.

                                                                                                                                                            On a successful return, if *a is not NULL then it is assumed that *a contains a valid TYPE structure and an attempt is made to reuse it. For TYPE structures where it matters it is possible to set up a library context on the decoded structure this way (see the EXAMPLES section). However using the \"reuse\" capability for other purposes is strongly discouraged (see BUGS below, and the discussion in the RETURN VALUES section).

                                                                                                                                                            d2i_TYPE_bio() is similar to d2i_TYPE() except it attempts to parse data from BIO bp.

                                                                                                                                                            d2i_TYPE_fp() is similar to d2i_TYPE() except it attempts to parse data from FILE pointer fp.

                                                                                                                                                            i2d_TYPE() encodes the structure pointed to by a into DER format. If ppout is not NULL, it writes the DER encoded data to the buffer at *ppout, and increments it to point after the data just written. If the return value is negative an error occurred, otherwise it returns the length of the encoded data.

                                                                                                                                                            If *ppout is NULL memory will be allocated for a buffer and the encoded data written to it. In this case *ppout is not incremented and it points to the start of the data just written.

                                                                                                                                                            i2d_TYPE_bio() is similar to i2d_TYPE() except it writes the encoding of the structure a to BIO bp and it returns 1 for success and 0 for failure.

                                                                                                                                                            i2d_TYPE_fp() is similar to i2d_TYPE() except it writes the encoding of the structure a to FILE pointer fp and it returns 1 for success and 0 for failure.

                                                                                                                                                            These routines do not encrypt private keys and therefore offer no security; use PEM_write_PrivateKey(3) or similar for writing to files.

                                                                                                                                                            "},{"location":"man3/d2i_X509/#notes","title":"NOTES","text":"

                                                                                                                                                            The letters i and d in i2d_TYPE() stand for \"internal\" (that is, an internal C structure) and \"DER\" respectively. So i2d_TYPE() converts from internal to DER.

                                                                                                                                                            The functions can also understand BER forms.

                                                                                                                                                            The actual TYPE structure passed to i2d_TYPE() must be a valid populated TYPE structure -- it cannot simply be fed with an empty structure such as that returned by TYPE_new().

                                                                                                                                                            The encoded data is in binary form and may contain embedded zeros. Therefore, any FILE pointers or BIOs should be opened in binary mode. Functions such as strlen() will not return the correct length of the encoded structure.

                                                                                                                                                            The ways that *ppin and *ppout are incremented after the operation can trap the unwary. See the WARNINGS section for some common errors. The reason for this-auto increment behaviour is to reflect a typical usage of ASN1 functions: after one structure is encoded or decoded another will be processed after it.

                                                                                                                                                            The following points about the data types might be useful:

                                                                                                                                                            • ASN1_OBJECT

                                                                                                                                                              Represents an ASN1 OBJECT IDENTIFIER.

                                                                                                                                                            • DHparams

                                                                                                                                                              Represents a PKCS#3 DH parameters structure.

                                                                                                                                                            • DHxparams

                                                                                                                                                              Represents an ANSI X9.42 DH parameters structure.

                                                                                                                                                            • ECDSA_SIG

                                                                                                                                                              Represents an ECDSA signature.

                                                                                                                                                            • X509_ALGOR

                                                                                                                                                              Represents an AlgorithmIdentifier structure as used in IETF RFC 6960 and elsewhere.

                                                                                                                                                            • X509_NAME

                                                                                                                                                              Represents a Name type as used for subject and issuer names in IETF RFC 6960 and elsewhere.

                                                                                                                                                            • X509_REQ

                                                                                                                                                              Represents a PKCS#10 certificate request.

                                                                                                                                                            • X509_SIG

                                                                                                                                                              Represents the DigestInfo structure defined in PKCS#1 and PKCS#7.

                                                                                                                                                            "},{"location":"man3/d2i_X509/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            d2i_TYPE(), d2i_TYPE_bio() and d2i_TYPE_fp() return a valid TYPE structure or NULL if an error occurs. If the \"reuse\" capability has been used with a valid structure being passed in via a, then the object is freed in the event of error and *a is set to NULL.

                                                                                                                                                            i2d_TYPE() returns the number of bytes successfully encoded or a negative value if an error occurs.

                                                                                                                                                            i2d_TYPE_bio() and i2d_TYPE_fp() return 1 for success and 0 if an error occurs.

                                                                                                                                                            "},{"location":"man3/d2i_X509/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            Allocate and encode the DER encoding of an X509 structure:

                                                                                                                                                            int len;\nunsigned char *buf;\n\nbuf = NULL;\nlen = i2d_X509(x, &buf);\nif (len < 0)\n    /* error */\n

                                                                                                                                                            Attempt to decode a buffer:

                                                                                                                                                            X509 *x;\nunsigned char *buf;\nconst unsigned char *p;\nint len;\n\n/* Set up buf and len to point to the input buffer. */\np = buf;\nx = d2i_X509(NULL, &p, len);\nif (x == NULL)\n    /* error */\n

                                                                                                                                                            Alternative technique:

                                                                                                                                                            X509 *x;\nunsigned char *buf;\nconst unsigned char *p;\nint len;\n\n/* Set up buf and len to point to the input buffer. */\np = buf;\nx = NULL;\n\nif (d2i_X509(&x, &p, len) == NULL)\n    /* error */\n

                                                                                                                                                            Setting up a library context and property query:

                                                                                                                                                            X509 *x;\nunsigned char *buf;\nconst unsigned char *p;\nint len;\nOSSL_LIB_CTX *libctx = ....;\nconst char *propq = ....;\n\n/* Set up buf and len to point to the input buffer. */\np = buf;\nx = X509_new_ex(libctx, propq);\n\nif (d2i_X509(&x, &p, len) == NULL)\n    /* error, x was freed and NULL assigned to it (see RETURN VALUES) */\n
                                                                                                                                                            "},{"location":"man3/d2i_X509/#warnings","title":"WARNINGS","text":"

                                                                                                                                                            Using a temporary variable is mandatory. A common mistake is to attempt to use a buffer directly as follows:

                                                                                                                                                            int len;\nunsigned char *buf;\n\nlen = i2d_X509(x, NULL);\nbuf = OPENSSL_malloc(len);\n...\ni2d_X509(x, &buf);\n...\nOPENSSL_free(buf);\n

                                                                                                                                                            This code will result in buf apparently containing garbage because it was incremented after the call to point after the data just written. Also buf will no longer contain the pointer allocated by OPENSSL_malloc() and the subsequent call to OPENSSL_free() is likely to crash.

                                                                                                                                                            Another trap to avoid is misuse of the a argument to d2i_TYPE():

                                                                                                                                                            X509 *x;\n\nif (d2i_X509(&x, &p, len) == NULL)\n    /* error */\n

                                                                                                                                                            This will probably crash somewhere in d2i_X509(). The reason for this is that the variable x is uninitialized and an attempt will be made to interpret its (invalid) value as an X509 structure, typically causing a segmentation violation. If x is set to NULL first then this will not happen.

                                                                                                                                                            "},{"location":"man3/d2i_X509/#bugs","title":"BUGS","text":"

                                                                                                                                                            In some versions of OpenSSL the \"reuse\" behaviour of d2i_TYPE() when *a is valid is broken and some parts of the reused structure may persist if they are not present in the new one. Additionally, in versions of OpenSSL prior to 1.1.0, when the \"reuse\" behaviour is used and an error occurs the behaviour is inconsistent. Some functions behaved as described here, while some did not free *a on error and did not set *a to NULL.

                                                                                                                                                            As a result of the above issues the \"reuse\" behaviour is strongly discouraged.

                                                                                                                                                            i2d_TYPE() will not return an error in many versions of OpenSSL, if mandatory fields are not initialized due to a programming error then the encoded structure may contain invalid data or omit the fields entirely and will not be parsed by d2i_TYPE(). This may be fixed in future so code should not assume that i2d_TYPE() will always succeed.

                                                                                                                                                            Any function which encodes a structure (i2d_TYPE(), i2d_TYPE_bio() or i2d_TYPE_fp()) may return a stale encoding if the structure has been modified after deserialization or previous serialization. This is because some objects cache the encoding for efficiency reasons.

                                                                                                                                                            "},{"location":"man3/d2i_X509/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/","title":"i2d_CMS_bio_stream","text":""},{"location":"man3/i2d_CMS_bio_stream/#name","title":"NAME","text":"

                                                                                                                                                            i2d_CMS_bio_stream - output CMS_ContentInfo structure in BER format

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/cms.h>\n\nint i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);\n
                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format.

                                                                                                                                                            It is otherwise identical to the function SMIME_write_CMS().

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#notes","title":"NOTES","text":"

                                                                                                                                                            This function is effectively a version of the i2d_CMS_bio() supporting streaming.

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#bugs","title":"BUGS","text":"

                                                                                                                                                            The prefix \"i2d\" is arguably wrong because the function outputs BER format.

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            i2d_CMS_bio_stream() returns 1 for success or 0 for failure.

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3), CMS_sign(3), CMS_verify(3), CMS_encrypt(3) CMS_decrypt(3), SMIME_write_CMS(3), PEM_write_bio_CMS_stream(3)

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#history","title":"HISTORY","text":"

                                                                                                                                                            The i2d_CMS_bio_stream() function was added in OpenSSL 1.0.0.

                                                                                                                                                            "},{"location":"man3/i2d_CMS_bio_stream/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/","title":"i2d_PKCS7_bio_stream","text":""},{"location":"man3/i2d_PKCS7_bio_stream/#name","title":"NAME","text":"

                                                                                                                                                            i2d_PKCS7_bio_stream - output PKCS7 structure in BER format

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/pkcs7.h>\n\nint i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);\n
                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format.

                                                                                                                                                            It is otherwise identical to the function SMIME_write_PKCS7().

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#notes","title":"NOTES","text":"

                                                                                                                                                            This function is effectively a version of the d2i_PKCS7_bio() supporting streaming.

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#bugs","title":"BUGS","text":"

                                                                                                                                                            The prefix \"i2d\" is arguably wrong because the function outputs BER format.

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure.

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3), PKCS7_sign(3), PKCS7_verify(3), PKCS7_encrypt(3) PKCS7_decrypt(3), SMIME_write_PKCS7(3), PEM_write_bio_PKCS7_stream(3)

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#history","title":"HISTORY","text":"

                                                                                                                                                            The i2d_PKCS7_bio_stream() function was added in OpenSSL 1.0.0.

                                                                                                                                                            "},{"location":"man3/i2d_PKCS7_bio_stream/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/i2d_re_X509_tbs/","title":"i2d_re_X509_tbs","text":""},{"location":"man3/i2d_re_X509_tbs/#name","title":"NAME","text":"

                                                                                                                                                            d2i_X509_AUX, i2d_X509_AUX, i2d_re_X509_tbs, i2d_re_X509_CRL_tbs, i2d_re_X509_REQ_tbs - X509 encode and decode functions

                                                                                                                                                            "},{"location":"man3/i2d_re_X509_tbs/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509.h>\n\nX509 *d2i_X509_AUX(X509 **px, const unsigned char **in, long len);\nint i2d_X509_AUX(const X509 *x, unsigned char **out);\nint i2d_re_X509_tbs(X509 *x, unsigned char **out);\nint i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp);\nint i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);\n
                                                                                                                                                            "},{"location":"man3/i2d_re_X509_tbs/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The X509 encode and decode routines encode and parse an X509 structure, which represents an X509 certificate.

                                                                                                                                                            d2i_X509_AUX() is similar to d2i_X509(3) but the input is expected to consist of an X509 certificate followed by auxiliary trust information. This is used by the PEM routines to read \"TRUSTED CERTIFICATE\" objects. This function should not be called on untrusted input.

                                                                                                                                                            i2d_X509_AUX() is similar to i2d_X509(3), but the encoded output contains both the certificate and any auxiliary trust information. This is used by the PEM routines to write \"TRUSTED CERTIFICATE\" objects. Note that this is a non-standard OpenSSL-specific data format.

                                                                                                                                                            i2d_re_X509_tbs() is similar to i2d_X509(3) except it encodes only the TBSCertificate portion of the certificate. i2d_re_X509_CRL_tbs() and i2d_re_X509_REQ_tbs() are analogous for CRL and certificate request, respectively. The \"re\" in i2d_re_X509_tbs stands for \"re-encode\", and ensures that a fresh encoding is generated in case the object has been modified after creation (see the BUGS section).

                                                                                                                                                            The encoding of the TBSCertificate portion of a certificate is cached in the X509 structure internally to improve encoding performance and to ensure certificate signatures are verified correctly in some certificates with broken (non-DER) encodings.

                                                                                                                                                            If, after modification, the X509 object is re-signed with X509_sign(), the encoding is automatically renewed. Otherwise, the encoding of the TBSCertificate portion of the X509 can be manually renewed by calling i2d_re_X509_tbs().

                                                                                                                                                            "},{"location":"man3/i2d_re_X509_tbs/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            d2i_X509_AUX() returns a valid X509 structure or NULL if an error occurred.

                                                                                                                                                            i2d_X509_AUX() returns the length of encoded data or -1 on error.

                                                                                                                                                            i2d_re_X509_tbs(), i2d_re_X509_CRL_tbs() and i2d_re_X509_REQ_tbs() return the length of encoded data or <=0 on error.

                                                                                                                                                            "},{"location":"man3/i2d_re_X509_tbs/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ERR_get_error(3) X509_CRL_get0_by_serial(3), X509_get0_signature(3), X509_get_ext_d2i(3), X509_get_extension_flags(3), X509_get_pubkey(3), X509_get_subject_name(3), X509_get_version(3), X509_NAME_add_entry_by_txt(3), X509_NAME_ENTRY_get_object(3), X509_NAME_get_index_by_NID(3), X509_NAME_print_ex(3), X509_new(3), X509_sign(3), X509V3_get_d2i(3), X509_verify_cert(3)

                                                                                                                                                            "},{"location":"man3/i2d_re_X509_tbs/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2002-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/o2i_SCT_LIST/","title":"o2i_SCT_LIST","text":""},{"location":"man3/o2i_SCT_LIST/#name","title":"NAME","text":"

                                                                                                                                                            o2i_SCT_LIST, i2o_SCT_LIST, o2i_SCT, i2o_SCT - decode and encode Signed Certificate Timestamp lists in TLS wire format

                                                                                                                                                            "},{"location":"man3/o2i_SCT_LIST/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/ct.h>\n\nSTACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,\n                            size_t len);\nint i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);\nSCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);\nint i2o_SCT(const SCT *sct, unsigned char **out);\n
                                                                                                                                                            "},{"location":"man3/o2i_SCT_LIST/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            The SCT_LIST and SCT functions are very similar to the i2d and d2i family of functions, except that they convert to and from TLS wire format, as described in RFC 6962. See d2i_SCT_LIST(3) for more information about how the parameters are treated and the return values.

                                                                                                                                                            "},{"location":"man3/o2i_SCT_LIST/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            All of the functions have return values consistent with those stated for d2i_SCT_LIST(3) and i2d_SCT_LIST(3).

                                                                                                                                                            "},{"location":"man3/o2i_SCT_LIST/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            ct(7), d2i_SCT_LIST(3), i2d_SCT_LIST(3)

                                                                                                                                                            "},{"location":"man3/o2i_SCT_LIST/#history","title":"HISTORY","text":"

                                                                                                                                                            These functions were added in OpenSSL 1.1.0.

                                                                                                                                                            "},{"location":"man3/o2i_SCT_LIST/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man3/s2i_ASN1_IA5STRING/","title":"s2i_ASN1_IA5STRING","text":""},{"location":"man3/s2i_ASN1_IA5STRING/#name","title":"NAME","text":"

                                                                                                                                                            i2s_ASN1_IA5STRING, s2i_ASN1_IA5STRING, i2s_ASN1_INTEGER, s2i_ASN1_INTEGER, i2s_ASN1_OCTET_STRING, s2i_ASN1_OCTET_STRING, i2s_ASN1_ENUMERATED, i2s_ASN1_ENUMERATED_TABLE, i2s_ASN1_UTF8STRING, s2i_ASN1_UTF8STRING - convert objects from/to ASN.1/string representation

                                                                                                                                                            "},{"location":"man3/s2i_ASN1_IA5STRING/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                            #include <openssl/x509v3.h>\n\nchar *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5);\nASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,\n                                  X509V3_CTX *ctx, const char *str);\nchar *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a);\nASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, const char *value);\nchar *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,\n                           const ASN1_OCTET_STRING *oct);\nASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,\n                                        X509V3_CTX *ctx, const char *str);\nchar *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *method, const ASN1_ENUMERATED *a);\nchar *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *method,\n                               const ASN1_ENUMERATED *e);\n\nchar *i2s_ASN1_UTF8STRING(X509V3_EXT_METHOD *method,\n                          ASN1_UTF8STRING *utf8);\nASN1_UTF8STRING *s2i_ASN1_UTF8STRING(X509V3_EXT_METHOD *method,\n                                     X509V3_CTX *ctx, const char *str);\n
                                                                                                                                                            "},{"location":"man3/s2i_ASN1_IA5STRING/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            These functions convert OpenSSL objects to and from their ASN.1/string representation. This function is used for X509v3 extensions.

                                                                                                                                                            "},{"location":"man3/s2i_ASN1_IA5STRING/#notes","title":"NOTES","text":"

                                                                                                                                                            The letters i and s in i2s and s2i stand for \"internal\" (that is, an internal C structure) and string respectively. So i2s_ASN1_IA5STRING() converts from internal to string.

                                                                                                                                                            It is the caller's responsibility to free the returned string. In the i2s_ASN1_IA5STRING() function the string is copied and the ownership of the original string remains with the caller.

                                                                                                                                                            "},{"location":"man3/s2i_ASN1_IA5STRING/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                            i2s_ASN1_IA5STRING() returns the pointer to a IA5 string or NULL if an error occurs.

                                                                                                                                                            s2i_ASN1_IA5STRING() return a valid ASN1_IA5STRING structure or NULL if an error occurs.

                                                                                                                                                            i2s_ASN1_INTEGER() return a valid string or NULL if an error occurs.

                                                                                                                                                            s2i_ASN1_INTEGER() returns the pointer to a ASN1_INTEGER structure or NULL if an error occurs.

                                                                                                                                                            i2s_ASN1_OCTET_STRING() returns the pointer to a OCTET_STRING string or NULL if an error occurs.

                                                                                                                                                            s2i_ASN1_OCTET_STRING() return a valid ASN1_OCTET_STRING structure or NULL if an error occurs.

                                                                                                                                                            i2s_ASN1_ENUMERATED() return a valid string or NULL if an error occurs.

                                                                                                                                                            s2i_ASN1_ENUMERATED() returns the pointer to a ASN1_ENUMERATED structure or NULL if an error occurs.

                                                                                                                                                            s2i_ASN1_UTF8STRING() return a valid ASN1_UTF8STRING structure or NULL if an error occurs.

                                                                                                                                                            i2s_ASN1_UTF8STRING() returns the pointer to a UTF-8 string or NULL if an error occurs.

                                                                                                                                                            "},{"location":"man3/s2i_ASN1_IA5STRING/#history","title":"HISTORY","text":"

                                                                                                                                                            i2s_ASN1_UTF8STRING() and s2i_ASN1_UTF8STRING() were made public in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man3/s2i_ASN1_IA5STRING/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man5/config/","title":"config","text":""},{"location":"man5/config/#name","title":"NAME","text":"

                                                                                                                                                            config - OpenSSL CONF library configuration files

                                                                                                                                                            "},{"location":"man5/config/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            This page documents the syntax of OpenSSL configuration files, as parsed by NCONF_load(3) and related functions. This format is used by many of the OpenSSL commands, and to initialize the libraries when used by any application.

                                                                                                                                                            The first part describes the general syntax of the configuration files, and subsequent sections describe the semantics of individual modules. Other modules are described in fips_config(5) and x509v3_config(5). The syntax for defining ASN.1 values is described in ASN1_generate_nconf(3).

                                                                                                                                                            "},{"location":"man5/config/#syntax","title":"SYNTAX","text":"

                                                                                                                                                            A configuration file is a series of lines. Blank lines, and whitespace between the elements of a line, have no significance. A comment starts with a # character; the rest of the line is ignored. If the # is the first non-space character in a line, the entire line is ignored.

                                                                                                                                                            "},{"location":"man5/config/#directives","title":"Directives","text":"

                                                                                                                                                            Two directives can be used to control the parsing of configuration files: .include and .pragma.

                                                                                                                                                            For compatibility with older versions of OpenSSL, an equal sign after the directive will be ignored. Older versions will treat it as an assignment, so care should be taken if the difference in semantics is important.

                                                                                                                                                            A file can include other files using the include syntax:

                                                                                                                                                            .include [=] pathname\n

                                                                                                                                                            If pathname is a simple filename, that file is included directly at that point. Included files can have .include statements that specify other files. If pathname is a directory, all files within that directory that have a .cnf or .conf extension will be included. (This is only available on systems with POSIX IO support.) Any sub-directories found inside the pathname are ignored. Similarly, if a file is opened while scanning a directory, and that file has an .include directive that specifies a directory, that is also ignored.

                                                                                                                                                            As a general rule, the pathname should be an absolute path; this can be enforced with the abspath and includedir pragmas, described below. The environment variable OPENSSL_CONF_INCLUDE, if it exists, is prepended to all relative pathnames. If the pathname is still relative, it is interpreted based on the current working directory.

                                                                                                                                                            To require all file inclusions to name absolute paths, use the following directive:

                                                                                                                                                            .pragma [=] abspath:value\n

                                                                                                                                                            The default behavior, where the value is false or off, is to allow relative paths. To require all .include pathnames to be absolute paths, use a value of true or on.

                                                                                                                                                            In these files, the dollar sign, $, is used to reference a variable, as described below. On some platforms, however, it is common to treat $ as a regular character in symbol names. Supporting this behavior can be done with the following directive:

                                                                                                                                                            .pragma [=] dollarid:value\n

                                                                                                                                                            The default behavior, where the value is false or off, is to treat the dollarsign as indicating a variable name; foo$bar is interpreted as foo followed by the expansion of the variable bar. If value is true or on, then foo$bar is a single seven-character name and variable expansions must be specified using braces or parentheses.

                                                                                                                                                            .pragma [=] includedir:value\n

                                                                                                                                                            If a relative pathname is specified in the .include directive, and the OPENSSL_CONF_INCLUDE environment variable doesn't exist, then the value of the includedir pragma, if it exists, is prepended to the pathname.

                                                                                                                                                            "},{"location":"man5/config/#settings","title":"Settings","text":"

                                                                                                                                                            A configuration file is divided into a number of sections. A section begins with the section name in square brackets, and ends when a new section starts, or at the end of the file. The section name can consist of alphanumeric characters and underscores. Whitespace between the name and the brackets is removed.

                                                                                                                                                            The first section of a configuration file is special and is referred to as the default section. This section is usually unnamed and spans from the start of file until the first named section. When a name is being looked up, it is first looked up in the current or named section, and then the default section if necessary.

                                                                                                                                                            The environment is mapped onto a section called ENV.

                                                                                                                                                            Within a section are a series of name/value assignments, described in more detail below. As a reminder, the square brackets shown in this example are required, not optional:

                                                                                                                                                            [ section ]\nname1 = This is value1\nname2 = Another value\n...\n[ newsection ]\nname1 = New value1\nname3 = Value 3\n

                                                                                                                                                            The name can contain any alphanumeric characters as well as a few punctuation symbols such as . , ; and _. Whitespace after the name and before the equal sign is ignored.

                                                                                                                                                            If a name is repeated in the same section, then all but the last value are ignored. In certain circumstances, such as with Certificate DNs, the same field may occur multiple times. In order to support this, commands like openssl-req(1) ignore any leading text that is preceded with a period. For example:

                                                                                                                                                            1.OU = First OU\n2.OU = Second OU\n

                                                                                                                                                            The value consists of the string following the = character until end of line with any leading and trailing whitespace removed.

                                                                                                                                                            The value string undergoes variable expansion. The text $var or ${var} inserts the value of the named variable from the current section. To use a value from another section use $section::name or ${section::name}. By using $ENV::name, the value of the specified environment variable will be substituted.

                                                                                                                                                            Variables must be defined before their value is referenced, otherwise an error is flagged and the file will not load. This can be worked around by specifying a default value in the default section before the variable is used.

                                                                                                                                                            Any name/value settings in an ENV section are available to the configuration file, but are not propagated to the environment.

                                                                                                                                                            It is an error if the value ends up longer than 64k.

                                                                                                                                                            It is possible to escape certain characters by using a single ' or double \" quote around the value, or using a backslash \\ before the character, By making the last character of a line a \\ a value string can be spread across multiple lines. In addition the sequences \\n, \\r, \\b and \\t are recognized.

                                                                                                                                                            The expansion and escape rules as described above that apply to value also apply to the pathname of the .include directive.

                                                                                                                                                            "},{"location":"man5/config/#openssl-library-configuration","title":"OPENSSL LIBRARY CONFIGURATION","text":"

                                                                                                                                                            The sections below use the informal term module to refer to a part of the OpenSSL functionality. This is not the same as the formal term FIPS module, for example.

                                                                                                                                                            The OpenSSL configuration looks up the value of openssl_conf in the default section and takes that as the name of a section that specifies how to configure any modules in the library. It is not an error to leave any module in its default configuration. An application can specify a different name by calling CONF_modules_load_file(), for example, directly.

                                                                                                                                                            OpenSSL also looks up the value of config_diagnostics. If this exists and has a nonzero numeric value, any error suppressing flags passed to CONF_modules_load() will be ignored. This is useful for diagnosing misconfigurations but its use in production requires additional consideration. With this option enabled, a configuration error will completely prevent access to a service. Without this option and in the presence of a configuration error, access will be allowed but the desired configuration will not be used.

                                                                                                                                                            # # These must be in the default section config_diagnostics = 1 openssl_conf = openssl_init

                                                                                                                                                            [openssl_init]\noid_section = oids\nproviders = providers\nalg_section = evp_properties\nssl_conf = ssl_configuration\nengines = engines\nrandom = random\n\n[oids]\n... new oids here ...\n\n[providers]\n... provider stuff here ...\n\n[evp_properties]\n... EVP properties here ...\n\n[ssl_configuration]\n... SSL/TLS configuration properties here ...\n\n[engines]\n... engine properties here ...\n\n[random]\n... random properties here ...\n

                                                                                                                                                            The semantics of each module are described below. The phrase \"in the initialization section\" refers to the section identified by the openssl_conf or other name (given as openssl_init in the example above). The examples below assume the configuration above is used to specify the individual sections.

                                                                                                                                                            "},{"location":"man5/config/#asn1-object-identifier-configuration","title":"ASN.1 Object Identifier Configuration","text":"

                                                                                                                                                            The name oid_section in the initialization section names the section containing name/value pairs of OID's. The name is the short name; the value is an optional long name followed by a comma, and the numeric value. While some OpenSSL commands have their own section for specifying OID's, this section makes them available to all commands and applications.

                                                                                                                                                            [oids]\nshortName = a very long OID name, 1.2.3.4\nnewoid1 = 1.2.3.4.1\nsome_other_oid = 1.2.3.5\n

                                                                                                                                                            If a full configuration with the above fragment is in the file example.cnf, then the following command line:

                                                                                                                                                            OPENSSL_CONF=example.cnf openssl asn1parse -genstr OID:1.2.3.4.1\n

                                                                                                                                                            will output:

                                                                                                                                                            0:d=0  hl=2 l=   4 prim: OBJECT            :newoid1\n

                                                                                                                                                            showing that the OID \"newoid1\" has been added as \"1.2.3.4.1\".

                                                                                                                                                            "},{"location":"man5/config/#provider-configuration","title":"Provider Configuration","text":"

                                                                                                                                                            The name providers in the initialization section names the section containing cryptographic provider configuration. The name/value assignments in this section each name a provider, and point to the configuration section for that provider. The provider-specific section is used to specify how to load the module, activate it, and set other parameters.

                                                                                                                                                            Within a provider section, the following names have meaning:

                                                                                                                                                            • identity

                                                                                                                                                              This is used to specify an alternate name, overriding the default name specified in the list of providers. For example:

                                                                                                                                                              [providers]\nfoo = foo_provider\n\n[foo_provider]\nidentity = my_fips_module\n
                                                                                                                                                            • module

                                                                                                                                                              Specifies the pathname of the module (typically a shared library) to load.

                                                                                                                                                            • activate

                                                                                                                                                              If present, the module is activated. The value assigned to this name is not significant.

                                                                                                                                                            All parameters in the section as well as sub-sections are made available to the provider.

                                                                                                                                                            "},{"location":"man5/config/#default-provider-and-its-activation","title":"Default provider and its activation","text":"

                                                                                                                                                            If no providers are activated explicitly, the default one is activated implicitly. See OSSL_PROVIDER-default(7) for more details.

                                                                                                                                                            If you add a section explicitly activating any other provider(s), you most probably need to explicitly activate the default provider, otherwise it becomes unavailable in openssl. It may make the system remotely unavailable.

                                                                                                                                                            "},{"location":"man5/config/#evp-configuration","title":"EVP Configuration","text":"

                                                                                                                                                            The name alg_section in the initialization section names the section containing algorithmic properties when using the EVP API.

                                                                                                                                                            Within the algorithm properties section, the following names have meaning:

                                                                                                                                                            • default_properties

                                                                                                                                                              The value may be anything that is acceptable as a property query string for EVP_set_default_properties().

                                                                                                                                                            • fips_mode (deprecated)

                                                                                                                                                              The value is a boolean that can be yes or no. If the value is yes, this is exactly equivalent to:

                                                                                                                                                              default_properties = fips=yes\n

                                                                                                                                                              If the value is no, nothing happens. Using this name is deprecated, and if used, it must be the only name in the section.

                                                                                                                                                            "},{"location":"man5/config/#ssl-configuration","title":"SSL Configuration","text":"

                                                                                                                                                            The name ssl_conf in the initialization section names the section containing the list of SSL/TLS configurations. As with the providers, each name in this section identifies a section with the configuration for that name. For example:

                                                                                                                                                            [ssl_configuration]\nserver = server_tls_config\nclient = client_tls_config\nsystem_default = tls_system_default\n\n[server_tls_config]\n... configuration for SSL/TLS servers ...\n\n[client_tls_config]\n... configuration for SSL/TLS clients ...\n

                                                                                                                                                            The configuration name system_default has a special meaning. If it exists, it is applied whenever an SSL_CTX object is created. For example, to impose system-wide minimum TLS and DTLS protocol versions:

                                                                                                                                                            [tls_system_default]\nMinProtocol = TLSv1.2\nMinProtocol = DTLSv1.2\n

                                                                                                                                                            The minimum TLS protocol is applied to SSL_CTX objects that are TLS-based, and the minimum DTLS protocol to those are DTLS-based. The same applies also to maximum versions set with MaxProtocol.

                                                                                                                                                            Each configuration section consists of name/value pairs that are parsed by SSL_CONF_cmd(3), which will be called by SSL_CTX_config() or SSL_config(), appropriately. Note that any characters before an initial dot in the configuration section are ignored, so that the same command can be used multiple times. This probably is most useful for loading different key types, as shown here:

                                                                                                                                                            [server_tls_config]\nRSA.Certificate = server-rsa.pem\nECDSA.Certificate = server-ecdsa.pem\n
                                                                                                                                                            "},{"location":"man5/config/#engine-configuration","title":"Engine Configuration","text":"

                                                                                                                                                            The name engines in the initialization section names the section containing the list of ENGINE configurations. As with the providers, each name in this section identifies an engine with the configuration for that engine. The engine-specific section is used to specify how to load the engine, activate it, and set other parameters.

                                                                                                                                                            Within an engine section, the following names have meaning:

                                                                                                                                                            • engine_id

                                                                                                                                                              This is used to specify an alternate name, overriding the default name specified in the list of engines. If present, it must be first. For example:

                                                                                                                                                              [engines]\nfoo = foo_engine\n\n[foo_engine]\nengine_id = myfoo\n
                                                                                                                                                            • dynamic_path

                                                                                                                                                              This loads and adds an ENGINE from the given path. It is equivalent to sending the ctrls SO_PATH with the path argument followed by LIST_ADD with value 2 and LOAD to the dynamic ENGINE. If this is not the required behaviour then alternative ctrls can be sent directly to the dynamic ENGINE using ctrl commands.

                                                                                                                                                            • init

                                                                                                                                                              This specifies whether to initialize the ENGINE. If the value is 0 the ENGINE will not be initialized, if the value is 1 an attempt is made to initialize the ENGINE immediately. If the init command is not present then an attempt will be made to initialize the ENGINE after all commands in its section have been processed.

                                                                                                                                                            • default_algorithms

                                                                                                                                                              This sets the default algorithms an ENGINE will supply using the function ENGINE_set_default_string().

                                                                                                                                                            All other names are taken to be the name of a ctrl command that is sent to the ENGINE, and the value is the argument passed with the command. The special value EMPTY means no value is sent with the command. For example:

                                                                                                                                                            [engines]\nfoo = foo_engine\n\n[foo_engine]\ndynamic_path = /some/path/fooengine.so\nsome_ctrl = some_value\ndefault_algorithms = ALL\nother_ctrl = EMPTY\n
                                                                                                                                                            "},{"location":"man5/config/#random-configuration","title":"Random Configuration","text":"

                                                                                                                                                            The name random in the initialization section names the section containing the random number generator settings.

                                                                                                                                                            Within the random section, the following names have meaning:

                                                                                                                                                            • random

                                                                                                                                                              This is used to specify the random bit generator. For example:

                                                                                                                                                              [random]\nrandom = CTR-DRBG\n

                                                                                                                                                              The available random bit generators are:

                                                                                                                                                              • CTR-DRBG
                                                                                                                                                              • HASH-DRBG
                                                                                                                                                              • HMAC-DRBG
                                                                                                                                                            • cipher

                                                                                                                                                              This specifies what cipher a CTR-DRBG random bit generator will use. Other random bit generators ignore this name. The default value is AES-256-CTR.

                                                                                                                                                            • digest

                                                                                                                                                              This specifies what digest the HASH-DRBG or HMAC-DRBG random bit generators will use. Other random bit generators ignore this name.

                                                                                                                                                            • properties

                                                                                                                                                              This sets the property query used when fetching the random bit generator and any underlying algorithms.

                                                                                                                                                            • seed

                                                                                                                                                              This sets the randomness source that should be used. By default SEED-SRC will be used outside of the FIPS provider. The FIPS provider uses call backs to access the same randomness sources from outside the validated boundary.

                                                                                                                                                            • seed_properties

                                                                                                                                                              This sets the property query used when fetching the randomness source.

                                                                                                                                                            "},{"location":"man5/config/#examples","title":"EXAMPLES","text":"

                                                                                                                                                            This example shows how to use quoting and escaping.

                                                                                                                                                            # # This is the default section. HOME = /temp configdir = $ENV::HOME/config

                                                                                                                                                            [ section_one ]\n

                                                                                                                                                            # # Quotes permit leading and trailing whitespace any = \" any variable name \" other = A string that can \\ cover several lines \\ by including \\ characters message = Hello World\\n

                                                                                                                                                            [ section_two ]\ngreeting = $section_one::message\n

                                                                                                                                                            This example shows how to expand environment variables safely. In this example, the variable tempfile is intended to refer to a temporary file, and the environment variable TEMP or TMP, if present, specify the directory where the file should be put. Since the default section is checked if a variable does not exist, it is possible to set TMP to default to /tmp, and TEMP to default to TMP.

                                                                                                                                                            # # These two lines must be in the default section. TMP = /tmp TEMP = $ENV::TMP

                                                                                                                                                            # # This can be used anywhere tmpfile = ${ENV::TEMP}/tmp.filename

                                                                                                                                                            This example shows how to enforce FIPS mode for the application sample.

                                                                                                                                                            sample = fips_config\n\n[fips_config]\nalg_section = evp_properties\n\n[evp_properties]\ndefault_properties = \"fips=yes\"\n
                                                                                                                                                            "},{"location":"man5/config/#environment","title":"ENVIRONMENT","text":"
                                                                                                                                                            • OPENSSL_CONF

                                                                                                                                                              The path to the config file, or the empty string for none. Ignored in set-user-ID and set-group-ID programs.

                                                                                                                                                            • OPENSSL_ENGINES

                                                                                                                                                              The path to the engines directory. Ignored in set-user-ID and set-group-ID programs.

                                                                                                                                                            • OPENSSL_MODULES

                                                                                                                                                              The path to the directory with OpenSSL modules, such as providers. Ignored in set-user-ID and set-group-ID programs.

                                                                                                                                                            • OPENSSL_CONF_INCLUDE

                                                                                                                                                              The optional path to prepend to all .include paths.

                                                                                                                                                            "},{"location":"man5/config/#bugs","title":"BUGS","text":"

                                                                                                                                                            There is no way to include characters using the octal \\nnn form. Strings are all null terminated so nulls cannot form part of the value.

                                                                                                                                                            The escaping isn't quite right: if you want to use sequences like \\n you can't use any quote escaping on the same line.

                                                                                                                                                            The limit that only one directory can be opened and read at a time can be considered a bug and should be fixed.

                                                                                                                                                            "},{"location":"man5/config/#history","title":"HISTORY","text":"

                                                                                                                                                            An undocumented API, NCONF_WIN32(), used a slightly different set of parsing rules there were intended to be tailored to the Microsoft Windows platform. Specifically, the backslash character was not an escape character and could be used in pathnames, only the double-quote character was recognized, and comments began with a semi-colon. This function was deprecated in OpenSSL 3.0; applications with configuration files using that syntax will have to be modified.

                                                                                                                                                            "},{"location":"man5/config/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            openssl-x509(1), openssl-req(1), openssl-ca(1), openssl-fipsinstall(1), ASN1_generate_nconf(3), EVP_set_default_properties(3), CONF_modules_load(3), CONF_modules_load_file(3), fips_config(5), and x509v3_config(5).

                                                                                                                                                            "},{"location":"man5/config/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man5/fips_config/","title":"fips_config","text":""},{"location":"man5/fips_config/#name","title":"NAME","text":"

                                                                                                                                                            fips_config - OpenSSL FIPS configuration

                                                                                                                                                            "},{"location":"man5/fips_config/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            A separate configuration file, using the OpenSSL config(5) syntax, is used to hold information about the FIPS module. This includes a digest of the shared library file, and status about the self-testing. This data is used automatically by the module itself for two purposes:

                                                                                                                                                              • Run the startup FIPS self-test known answer tests (KATS).

                                                                                                                                                              This is normally done once, at installation time, but may also be set up to run each time the module is used.

                                                                                                                                                              • Verify the module's checksum.

                                                                                                                                                              This is done each time the module is used.

                                                                                                                                                            This file is generated by the openssl-fipsinstall(1) program, and used internally by the FIPS module during its initialization.

                                                                                                                                                            The following options are supported. They should all appear in a section whose name is identified by the fips option in the providers section, as described in \"Provider Configuration Module\" in config(5).

                                                                                                                                                            • activate

                                                                                                                                                              If present, the module is activated. The value assigned to this name is not significant.

                                                                                                                                                            • install-version

                                                                                                                                                              A version number for the fips install process. Should be 1.

                                                                                                                                                            • conditional-errors

                                                                                                                                                              The FIPS module normally enters an internal error mode if any self test fails. Once this error mode is active, no services or cryptographic algorithms are accessible from this point on. Continuous tests are a subset of the self tests (e.g., a key pair test during key generation, or the CRNG output test). Setting this value to 0 allows the error mode to not be triggered if any continuous test fails. The default value of 1 will trigger the error mode. Regardless of the value, the operation (e.g., key generation) that called the continuous test will return an error code if its continuous test fails. The operation may then be retried if the error mode has not been triggered.

                                                                                                                                                            • security-checks

                                                                                                                                                              This indicates if run-time checks related to enforcement of security parameters such as minimum security strength of keys and approved curve names are used. A value of '1' will perform the checks, otherwise if the value is '0' the checks are not performed and FIPS compliance must be done by procedures documented in the relevant Security Policy.

                                                                                                                                                            • module-mac

                                                                                                                                                              The calculated MAC of the FIPS provider file.

                                                                                                                                                            • install-status

                                                                                                                                                              An indicator that the self-tests were successfully run. This should only be written after the module has successfully passed its self tests during installation. If this field is not present, then the self tests will run when the module loads.

                                                                                                                                                            • install-mac

                                                                                                                                                              A MAC of the value of the install-status option, to prevent accidental changes to that value. It is written-to at the same time as install-status is updated.

                                                                                                                                                            For example:

                                                                                                                                                            [fips_sect]\nactivate = 1\ninstall-version = 1\nconditional-errors = 1\nsecurity-checks = 1\nmodule-mac = 41:D0:FA:C2:5D:41:75:CD:7D:C3:90:55:6F:A4:DC\ninstall-mac = FE:10:13:5A:D3:B4:C7:82:1B:1E:17:4C:AC:84:0C\ninstall-status = INSTALL_SELF_TEST_KATS_RUN\n
                                                                                                                                                            "},{"location":"man5/fips_config/#notes","title":"NOTES","text":"

                                                                                                                                                            When using the FIPS provider, it is recommended that the config_diagnostics option is enabled to prevent accidental use of non-FIPS validated algorithms via broken or mistaken configuration. See config(5).

                                                                                                                                                            "},{"location":"man5/fips_config/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            config(5) openssl-fipsinstall(1)

                                                                                                                                                            "},{"location":"man5/fips_config/#history","title":"HISTORY","text":"

                                                                                                                                                            This functionality was added in OpenSSL 3.0.

                                                                                                                                                            "},{"location":"man5/fips_config/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man5/x509v3_config/","title":"x509v3_config","text":""},{"location":"man5/x509v3_config/#name","title":"NAME","text":"

                                                                                                                                                            x509v3_config - X509 V3 certificate extension configuration format

                                                                                                                                                            "},{"location":"man5/x509v3_config/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            Several OpenSSL commands can add extensions to a certificate or certificate request based on the contents of a configuration file and CLI options such as -addext. The syntax of configuration files is described in config(5). The commands typically have an option to specify the name of the configuration file, and a section within that file; see the documentation of the individual command for details.

                                                                                                                                                            This page uses extensions as the name of the section, when needed in examples.

                                                                                                                                                            Each entry in the extension section takes the form:

                                                                                                                                                            name = [critical, ]value(s)\n

                                                                                                                                                            If critical is present then the extension will be marked as critical.

                                                                                                                                                            If multiple entries are processed for the same extension name, later entries override earlier ones with the same name.

                                                                                                                                                            The format of values depends on the value of name, many have a type-value pairing where the type and value are separated by a colon. There are four main types of extension:

                                                                                                                                                            string\nmulti-valued\nraw\narbitrary\n

                                                                                                                                                            Each is described in the following paragraphs.

                                                                                                                                                            String extensions simply have a string which contains either the value itself or how it is obtained.

                                                                                                                                                            Multi-valued extensions have a short form and a long form. The short form is a comma-separated list of names and values:

                                                                                                                                                            basicConstraints = critical, CA:true, pathlen:1\n

                                                                                                                                                            The long form allows the values to be placed in a separate section:

                                                                                                                                                            [extensions]\nbasicConstraints = critical, @basic_constraints\n\n[basic_constraints]\nCA = true\npathlen = 1\n

                                                                                                                                                            Both forms are equivalent.

                                                                                                                                                            If an extension is multi-value and a field value must contain a comma the long form must be used otherwise the comma would be misinterpreted as a field separator. For example:

                                                                                                                                                            subjectAltName = URI:ldap://somehost.com/CN=foo,OU=bar\n

                                                                                                                                                            will produce an error but the equivalent form:

                                                                                                                                                            [extensions]\nsubjectAltName = @subject_alt_section\n\n[subject_alt_section]\nsubjectAltName = URI:ldap://somehost.com/CN=foo,OU=bar\n

                                                                                                                                                            is valid.

                                                                                                                                                            OpenSSL does not support multiple occurrences of the same field within a section. In this example:

                                                                                                                                                            [extensions]\nsubjectAltName = @alt_section\n\n[alt_section]\nemail = steve@example.com\nemail = steve@example.org\n

                                                                                                                                                            will only recognize the last value. To specify multiple values append a numeric identifier, as shown here:

                                                                                                                                                            [extensions]\nsubjectAltName = @alt_section\n\n[alt_section]\nemail.1 = steve@example.com\nemail.2 = steve@example.org\n

                                                                                                                                                            The syntax of raw extensions is defined by the source code that parses the extension but should be documented. See \"Certificate Policies\" for an example of a raw extension.

                                                                                                                                                            If an extension type is unsupported, then the arbitrary extension syntax must be used, see the \"ARBITRARY EXTENSIONS\" section for more details.

                                                                                                                                                            "},{"location":"man5/x509v3_config/#standard-extensions","title":"STANDARD EXTENSIONS","text":"

                                                                                                                                                            The following sections describe the syntax of each supported extension. They do not define the semantics of the extension.

                                                                                                                                                            "},{"location":"man5/x509v3_config/#basic-constraints","title":"Basic Constraints","text":"

                                                                                                                                                            This is a multi-valued extension which indicates whether a certificate is a CA certificate. The first value is CA followed by TRUE or FALSE. If CA is TRUE then an optional pathlen name followed by a nonnegative value can be included.

                                                                                                                                                            For example:

                                                                                                                                                            basicConstraints = CA:TRUE\n\nbasicConstraints = CA:FALSE\n\nbasicConstraints = critical, CA:TRUE, pathlen:1\n

                                                                                                                                                            A CA certificate must include the basicConstraints name with the CA parameter set to TRUE. An end-user certificate must either have CA:FALSE or omit the extension entirely. The pathlen parameter specifies the maximum number of CAs that can appear below this one in a chain. A pathlen of zero means the CA cannot sign any sub-CA's, and can only sign end-entity certificates.

                                                                                                                                                            "},{"location":"man5/x509v3_config/#key-usage","title":"Key Usage","text":"

                                                                                                                                                            Key usage is a multi-valued extension consisting of a list of names of the permitted key usages. The defined values are: digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign, encipherOnly, and decipherOnly.

                                                                                                                                                            Examples:

                                                                                                                                                            keyUsage = digitalSignature, nonRepudiation\n\nkeyUsage = critical, keyCertSign\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#extended-key-usage","title":"Extended Key Usage","text":"

                                                                                                                                                            This extension consists of a list of values indicating purposes for which the certificate public key can be used. Each value can be either a short text name or an OID. The following text names, and their intended meaning, are known:

                                                                                                                                                            Value                  Meaning according to RFC 5280 etc.\n-----                  ----------------------------------\nserverAuth             SSL/TLS WWW Server Authentication\nclientAuth             SSL/TLS WWW Client Authentication\ncodeSigning            Code Signing\nemailProtection        E-mail Protection (S/MIME)\ntimeStamping           Trusted Timestamping\nOCSPSigning            OCSP Signing\nipsecIKE               ipsec Internet Key Exchange\nmsCodeInd              Microsoft Individual Code Signing (authenticode)\nmsCodeCom              Microsoft Commercial Code Signing (authenticode)\nmsCTLSign              Microsoft Trust List Signing\nmsEFS                  Microsoft Encrypted File System\n

                                                                                                                                                            While IETF RFC 5280 says that id-kp-serverAuth and id-kp-clientAuth are only for WWW use, in practice they are used for all kinds of TLS clients and servers, and this is what OpenSSL assumes as well.

                                                                                                                                                            Examples:

                                                                                                                                                            extendedKeyUsage = critical, codeSigning, 1.2.3.4\n\nextendedKeyUsage = serverAuth, clientAuth\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#subject-key-identifier","title":"Subject Key Identifier","text":"

                                                                                                                                                            The SKID extension specification has a value with three choices. If the value is the word none then no SKID extension will be included. If the value is the word hash, or by default for the x509, req, and ca apps, the process specified in RFC 5280 section 4.2.1.2. (1) is followed: The keyIdentifier is composed of the 160-bit SHA-1 hash of the value of the BIT STRING subjectPublicKey (excluding the tag, length, and number of unused bits).

                                                                                                                                                            Otherwise, the value must be a hex string (possibly with : separating bytes) to output directly, however, this is strongly discouraged.

                                                                                                                                                            Example:

                                                                                                                                                            subjectKeyIdentifier = hash\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#authority-key-identifier","title":"Authority Key Identifier","text":"

                                                                                                                                                            The AKID extension specification may have the value none indicating that no AKID shall be included. Otherwise it may have the value keyid or issuer or both of them, separated by ,. Either or both can have the option always, indicated by putting a colon : between the value and this option. For self-signed certificates the AKID is suppressed unless always is present. By default the x509, req, and ca apps behave as if \"none\" was given for self-signed certificates and \"keyid, issuer\" otherwise.

                                                                                                                                                            If keyid is present, an attempt is made to copy the subject key identifier (SKID) from the issuer certificate except if the issuer certificate is the same as the current one and it is not self-signed. The hash of the public key related to the signing key is taken as fallback if the issuer certificate is the same as the current certificate. If always is present but no value can be obtained, an error is returned.

                                                                                                                                                            If issuer is present, and in addition it has the option always specified or keyid is not present, then the issuer DN and serial number are copied from the issuer certificate.

                                                                                                                                                            Examples:

                                                                                                                                                            authorityKeyIdentifier = keyid, issuer\n\nauthorityKeyIdentifier = keyid, issuer:always\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#subject-alternative-name","title":"Subject Alternative Name","text":"

                                                                                                                                                            This is a multi-valued extension that supports several types of name identifier, including email (an email address), URI (a uniform resource indicator), DNS (a DNS domain name), RID (a registered ID: OBJECT IDENTIFIER), IP (an IP address), dirName (a distinguished name), and otherName. The syntax of each is described in the following paragraphs.

                                                                                                                                                            The email option has two special values. copy will automatically include any email addresses contained in the certificate subject name in the extension. move will automatically move any email addresses from the certificate subject name to the extension.

                                                                                                                                                            The IP address used in the IP option can be in either IPv4 or IPv6 format.

                                                                                                                                                            The value of dirName is specifies the configuration section containing the distinguished name to use, as a set of name-value pairs. Multi-valued AVAs can be formed by prefacing the name with a + character.

                                                                                                                                                            The value of otherName can include arbitrary data associated with an OID; the value should be the OID followed by a semicolon and the content in specified using the syntax in ASN1_generate_nconf(3).

                                                                                                                                                            Examples:

                                                                                                                                                            subjectAltName = email:copy, email:my@example.com, URI:http://my.example.com/\n\nsubjectAltName = IP:192.168.7.1\n\nsubjectAltName = IP:13::17\n\nsubjectAltName = email:my@example.com, RID:1.2.3.4\n\nsubjectAltName = otherName:1.2.3.4;UTF8:some other identifier\n\n[extensions]\nsubjectAltName = dirName:dir_sect\n\n[dir_sect]\nC = UK\nO = My Organization\nOU = My Unit\nCN = My Name\n

                                                                                                                                                            Non-ASCII Email Address conforming the syntax defined in Section 3.3 of RFC 6531 are provided as otherName.SmtpUTF8Mailbox. According to RFC 8398, the email address should be provided as UTF8String. To enforce the valid representation in the certificate, the SmtpUTF8Mailbox should be provided as follows

                                                                                                                                                            subjectAltName=@alts\n[alts]\notherName = 1.3.6.1.5.5.7.8.9;FORMAT:UTF8,UTF8String:nonasciiname.example.com\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#issuer-alternative-name","title":"Issuer Alternative Name","text":"

                                                                                                                                                            This extension supports most of the options of subject alternative name; it does not support email:copy. It also adds issuer:copy as an allowed value, which copies any subject alternative names from the issuer certificate, if possible.

                                                                                                                                                            Example:

                                                                                                                                                            issuerAltName = issuer:copy\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#authority-info-access","title":"Authority Info Access","text":"

                                                                                                                                                            This extension gives details about how to retrieve information that related to the certificate that the CA makes available. The syntax is access_id;location, where access_id is an object identifier (although only a few values are well-known) and location has the same syntax as subject alternative name (except that email:copy is not supported).

                                                                                                                                                            Possible values for access_id include OCSP (OCSP responder), caIssuers (CA Issuers), ad_timestamping (AD Time Stamping), AD_DVCS (ad dvcs), caRepository (CA Repository).

                                                                                                                                                            Examples:

                                                                                                                                                            authorityInfoAccess = OCSP;URI:http://ocsp.example.com/,caIssuers;URI:http://myca.example.com/ca.cer\n\nauthorityInfoAccess = OCSP;URI:http://ocsp.example.com/\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#crl-distribution-points","title":"CRL distribution points","text":"

                                                                                                                                                            This is a multi-valued extension whose values can be either a name-value pair using the same form as subject alternative name or a single value specifying the section name containing all the distribution point values.

                                                                                                                                                            When a name-value pair is used, a DistributionPoint extension will be set with the given value as the fullName field as the distributionPoint value, and the reasons and cRLIssuer fields will be omitted.

                                                                                                                                                            When a single option is used, the value specifies the section, and that section can have the following items:

                                                                                                                                                            • fullname

                                                                                                                                                              The full name of the distribution point, in the same format as the subject alternative name.

                                                                                                                                                            • relativename

                                                                                                                                                              The value is taken as a distinguished name fragment that is set as the value of the nameRelativeToCRLIssuer field.

                                                                                                                                                            • CRLIssuer

                                                                                                                                                              The value must in the same format as the subject alternative name.

                                                                                                                                                            • reasons

                                                                                                                                                              A multi-value field that contains the reasons for revocation. The recognized values are: keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold, privilegeWithdrawn, and AACompromise.

                                                                                                                                                            Only one of fullname or relativename should be specified.

                                                                                                                                                            Simple examples:

                                                                                                                                                            crlDistributionPoints = URI:http://example.com/myca.crl\n\ncrlDistributionPoints = URI:http://example.com/myca.crl, URI:http://example.org/my.crl\n

                                                                                                                                                            Full distribution point example:

                                                                                                                                                            [extensions]\ncrlDistributionPoints = crldp1_section\n\n[crldp1_section]\nfullname = URI:http://example.com/myca.crl\nCRLissuer = dirName:issuer_sect\nreasons = keyCompromise, CACompromise\n\n[issuer_sect]\nC = UK\nO = Organisation\nCN = Some Name\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#issuing-distribution-point","title":"Issuing Distribution Point","text":"

                                                                                                                                                            This extension should only appear in CRLs. It is a multi-valued extension whose syntax is similar to the \"section\" pointed to by the CRL distribution points extension. The following names have meaning:

                                                                                                                                                            • fullname

                                                                                                                                                              The full name of the distribution point, in the same format as the subject alternative name.

                                                                                                                                                            • relativename

                                                                                                                                                              The value is taken as a distinguished name fragment that is set as the value of the nameRelativeToCRLIssuer field.

                                                                                                                                                            • onlysomereasons

                                                                                                                                                              A multi-value field that contains the reasons for revocation. The recognized values are: keyCompromise, CACompromise, affiliationChanged, superseded, cessationOfOperation, certificateHold, privilegeWithdrawn, and AACompromise.

                                                                                                                                                            • onlyuser, onlyCA, onlyAA, indirectCRL

                                                                                                                                                              The value for each of these names is a boolean.

                                                                                                                                                            Example:

                                                                                                                                                            [extensions]\nissuingDistributionPoint = critical, @idp_section\n\n[idp_section]\nfullname = URI:http://example.com/myca.crl\nindirectCRL = TRUE\nonlysomereasons = keyCompromise, CACompromise\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#certificate-policies","title":"Certificate Policies","text":"

                                                                                                                                                            This is a raw extension that supports all of the defined fields of the certificate extension.

                                                                                                                                                            Policies without qualifiers are specified by giving the OID. Multiple policies are comma-separated. For example:

                                                                                                                                                            certificatePolicies = 1.2.4.5, 1.1.3.4\n

                                                                                                                                                            To include policy qualifiers, use the \"@section\" syntax to point to a section that specifies all the information.

                                                                                                                                                            The section referred to must include the policy OID using the name policyIdentifier. cPSuri qualifiers can be included using the syntax:

                                                                                                                                                            CPS.nnn = value\n

                                                                                                                                                            where nnn is a number.

                                                                                                                                                            userNotice qualifiers can be set using the syntax:

                                                                                                                                                            userNotice.nnn = @notice\n

                                                                                                                                                            The value of the userNotice qualifier is specified in the relevant section. This section can include explicitText, organization, and noticeNumbers options. explicitText and organization are text strings, noticeNumbers is a comma separated list of numbers. The organization and noticeNumbers options (if included) must BOTH be present. Some software might require the ia5org option at the top level; this changes the encoding from Displaytext to IA5String.

                                                                                                                                                            Example:

                                                                                                                                                            [extensions]\ncertificatePolicies = ia5org, 1.2.3.4, 1.5.6.7.8, @polsect\n\n[polsect]\npolicyIdentifier = 1.3.5.8\nCPS.1 = \"http://my.host.example.com/\"\nCPS.2 = \"http://my.your.example.com/\"\nuserNotice.1 = @notice\n\n[notice]\nexplicitText = \"Explicit Text Here\"\norganization = \"Organisation Name\"\nnoticeNumbers = 1, 2, 3, 4\n

                                                                                                                                                            The character encoding of explicitText can be specified by prefixing the value with UTF8, BMP, or VISIBLE followed by colon. For example:

                                                                                                                                                            [notice]\nexplicitText = \"UTF8:Explicit Text Here\"\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#policy-constraints","title":"Policy Constraints","text":"

                                                                                                                                                            This is a multi-valued extension which consisting of the names requireExplicitPolicy or inhibitPolicyMapping and a non negative integer value. At least one component must be present.

                                                                                                                                                            Example:

                                                                                                                                                            policyConstraints = requireExplicitPolicy:3\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#inhibit-any-policy","title":"Inhibit Any Policy","text":"

                                                                                                                                                            This is a string extension whose value must be a non negative integer.

                                                                                                                                                            Example:

                                                                                                                                                            inhibitAnyPolicy = 2\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#name-constraints","title":"Name Constraints","text":"

                                                                                                                                                            This is a multi-valued extension. The name should begin with the word permitted or excluded followed by a ;. The rest of the name and the value follows the syntax of subjectAltName except email:copy is not supported and the IP form should consist of an IP addresses and subnet mask separated by a /.

                                                                                                                                                            Examples:

                                                                                                                                                            nameConstraints = permitted;IP:192.168.0.0/255.255.0.0\n\nnameConstraints = permitted;email:.example.com\n\nnameConstraints = excluded;email:.com\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#ocsp-no-check","title":"OCSP No Check","text":"

                                                                                                                                                            This is a string extension. It is parsed, but ignored.

                                                                                                                                                            Example:

                                                                                                                                                            noCheck = ignored\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#tls-feature-aka-must-staple","title":"TLS Feature (aka Must Staple)","text":"

                                                                                                                                                            This is a multi-valued extension consisting of a list of TLS extension identifiers. Each identifier may be a number (0..65535) or a supported name. When a TLS client sends a listed extension, the TLS server is expected to include that extension in its reply.

                                                                                                                                                            The supported names are: status_request and status_request_v2.

                                                                                                                                                            Example:

                                                                                                                                                            tlsfeature = status_request\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#deprecated-extensions","title":"DEPRECATED EXTENSIONS","text":"

                                                                                                                                                            The following extensions are non standard, Netscape specific and largely obsolete. Their use in new applications is discouraged.

                                                                                                                                                            "},{"location":"man5/x509v3_config/#netscape-string-extensions","title":"Netscape String extensions","text":"

                                                                                                                                                            Netscape Comment (nsComment) is a string extension containing a comment which will be displayed when the certificate is viewed in some browsers. Other extensions of this type are: nsBaseUrl, nsRevocationUrl, nsCaRevocationUrl, nsRenewalUrl, nsCaPolicyUrl and nsSslServerName.

                                                                                                                                                            "},{"location":"man5/x509v3_config/#netscape-certificate-type","title":"Netscape Certificate Type","text":"

                                                                                                                                                            This is a multi-valued extensions which consists of a list of flags to be included. It was used to indicate the purposes for which a certificate could be used. The basicConstraints, keyUsage and extended key usage extensions are now used instead.

                                                                                                                                                            Acceptable values for nsCertType are: client, server, email, objsign, reserved, sslCA, emailCA, objCA.

                                                                                                                                                            "},{"location":"man5/x509v3_config/#arbitrary-extensions","title":"ARBITRARY EXTENSIONS","text":"

                                                                                                                                                            If an extension is not supported by the OpenSSL code then it must be encoded using the arbitrary extension format. It is also possible to use the arbitrary format for supported extensions. Extreme care should be taken to ensure that the data is formatted correctly for the given extension type.

                                                                                                                                                            There are two ways to encode arbitrary extensions.

                                                                                                                                                            The first way is to use the word ASN1 followed by the extension content using the same syntax as ASN1_generate_nconf(3). For example:

                                                                                                                                                            [extensions]\n1.2.3.4 = critical, ASN1:UTF8String:Some random data\n1.2.3.4.1 = ASN1:SEQUENCE:seq_sect\n\n[seq_sect]\nfield1 = UTF8:field1\nfield2 = UTF8:field2\n

                                                                                                                                                            It is also possible to use the word DER to include the raw encoded data in any extension.

                                                                                                                                                            1.2.3.4 = critical, DER:01:02:03:04\n1.2.3.4.1 = DER:01020304\n

                                                                                                                                                            The value following DER is a hex dump of the DER encoding of the extension Any extension can be placed in this form to override the default behaviour. For example:

                                                                                                                                                            basicConstraints = critical, DER:00:01:02:03\n
                                                                                                                                                            "},{"location":"man5/x509v3_config/#warnings","title":"WARNINGS","text":"

                                                                                                                                                            There is no guarantee that a specific implementation will process a given extension. It may therefore be sometimes possible to use certificates for purposes prohibited by their extensions because a specific application does not recognize or honour the values of the relevant extensions.

                                                                                                                                                            The DER and ASN1 options should be used with caution. It is possible to create invalid extensions if they are not used carefully.

                                                                                                                                                            "},{"location":"man5/x509v3_config/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                            openssl-req(1), openssl-ca(1), openssl-x509(1), ASN1_generate_nconf(3)

                                                                                                                                                            "},{"location":"man5/x509v3_config/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                            Copyright 2004-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                            "},{"location":"man7/EVP_ASYM_CIPHER-RSA/","title":"EVP_ASYM_CIPHER-RSA","text":""},{"location":"man7/EVP_ASYM_CIPHER-RSA/#name","title":"NAME","text":"

                                                                                                                                                            EVP_ASYM_CIPHER-RSA - RSA Asymmetric Cipher algorithm support

                                                                                                                                                            "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                            Asymmetric Cipher support for the RSA key type.

                                                                                                                                                            "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#rsa-asymmetric-cipher-parameters","title":"RSA Asymmetric Cipher parameters","text":"
                                                                                                                                                            • \"pad-mode\" (OSSL_ASYM_CIPHER_PARAM_PAD_MODE)

                                                                                                                                                              The default provider understands these RSA padding modes in string form:

                                                                                                                                                              • \"none\" (OSSL_PKEY_RSA_PAD_MODE_NONE)
                                                                                                                                                              • \"oaep\" (OSSL_PKEY_RSA_PAD_MODE_OAEP)
                                                                                                                                                              • \"pkcs1\" (OSSL_PKEY_RSA_PAD_MODE_PKCSV15)
                                                                                                                                                              • \"x931\" (OSSL_PKEY_RSA_PAD_MODE_X931)
                                                                                                                                                            • \"pad-mode\" (OSSL_ASYM_CIPHER_PARAM_PAD_MODE) <integer>

                                                                                                                                                              The default provider understands these RSA padding modes in integer form:

                                                                                                                                                              • 1 (RSA_PKCS1_PADDING)
                                                                                                                                                              • 3 (RSA_NO_PADDING)
                                                                                                                                                              • 4 (RSA_PKCS1_OAEP_PADDING)
                                                                                                                                                              • 5 (RSA_X931_PADDING)

                                                                                                                                                              See EVP_PKEY_CTX_set_rsa_padding(3) for further details.

                                                                                                                                                            • \"digest\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST)

                                                                                                                                                            • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS)
                                                                                                                                                            • \"mgf1-digest\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST)
                                                                                                                                                            • \"mgf1-digest-props\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS)
                                                                                                                                                            • \"oaep-label\" (OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL) <octet string>
                                                                                                                                                            • \"tls-client-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                                                                                                                                                              See RSA_PKCS1_WITH_TLS_PADDING on the page EVP_PKEY_CTX_set_rsa_padding(3).

                                                                                                                                                            • \"tls-negotiated-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                                                                                                                                                              See RSA_PKCS1_WITH_TLS_PADDING on the page EVP_PKEY_CTX_set_rsa_padding(3).

                                                                                                                                                              See \"Asymmetric Cipher Parameters\" in provider-asym_cipher(7) for more information.

                                                                                                                                                            • "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                              EVP_PKEY-RSA(7), EVP_PKEY(3), provider-asym_cipher(7), provider-keymgmt(7), OSSL_PROVIDER-default(7) OSSL_PROVIDER-FIPS(7)

                                                                                                                                                              "},{"location":"man7/EVP_ASYM_CIPHER-RSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                              Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                              "},{"location":"man7/EVP_ASYM_CIPHER-SM2/","title":"EVP_ASYM_CIPHER-SM2","text":""},{"location":"man7/EVP_ASYM_CIPHER-SM2/#name","title":"NAME","text":"

                                                                                                                                                              EVP_ASYM_CIPHER-SM2 - SM2 Asymmetric Cipher algorithm support

                                                                                                                                                              "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                              Asymmetric Cipher support for the SM2 key type.

                                                                                                                                                              "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#sm2-asymmetric-cipher-parameters","title":"SM2 Asymmetric Cipher parameters","text":"
                                                                                                                                                              • \"digest\" (OSSL_ASYM_CIPHER_PARAM_DIGEST)
                                                                                                                                                              • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_DIGEST_PROPS)

                                                                                                                                                                See \"Asymmetric Cipher Parameters\" in provider-asym_cipher(7).

                                                                                                                                                                "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                EVP_PKEY-SM2(7), EVP_PKEY(3), provider-asym_cipher(7), provider-keymgmt(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                "},{"location":"man7/EVP_ASYM_CIPHER-SM2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-AES/","title":"EVP_CIPHER-AES","text":""},{"location":"man7/EVP_CIPHER-AES/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-AES - The AES EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-AES/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for AES symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-AES/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the FIPS provider as well as the default provider:

                                                                                                                                                                • \"AES-128-CBC\", \"AES-192-CBC\" and \"AES-256-CBC\"
                                                                                                                                                                • \"AES-128-CBC-CTS\", \"AES-192-CBC-CTS\" and \"AES-256-CBC-CTS\"
                                                                                                                                                                • \"AES-128-CFB\", \"AES-192-CFB\", \"AES-256-CFB\", \"AES-128-CFB1\", \"AES-192-CFB1\", \"AES-256-CFB1\", \"AES-128-CFB8\", \"AES-192-CFB8\" and \"AES-256-CFB8\"
                                                                                                                                                                • \"AES-128-CTR\", \"AES-192-CTR\" and \"AES-256-CTR\"
                                                                                                                                                                • \"AES-128-ECB\", \"AES-192-ECB\" and \"AES-256-ECB\"
                                                                                                                                                                • \"AES-192-OFB\", \"AES-128-OFB\" and \"AES-256-OFB\"
                                                                                                                                                                • \"AES-128-XTS\" and \"AES-256-XTS\"
                                                                                                                                                                • \"AES-128-CCM\", \"AES-192-CCM\" and \"AES-256-CCM\"
                                                                                                                                                                • \"AES-128-GCM\", \"AES-192-GCM\" and \"AES-256-GCM\"
                                                                                                                                                                • \"AES-128-WRAP\", \"AES-192-WRAP\", \"AES-256-WRAP\", \"AES-128-WRAP-PAD\", \"AES-192-WRAP-PAD\", \"AES-256-WRAP-PAD\", \"AES-128-WRAP-INV\", \"AES-192-WRAP-INV\", \"AES-256-WRAP-INV\", \"AES-128-WRAP-PAD-INV\", \"AES-192-WRAP-PAD-INV\" and \"AES-256-WRAP-PAD-INV\"
                                                                                                                                                                • \"AES-128-CBC-HMAC-SHA1\", \"AES-256-CBC-HMAC-SHA1\", \"AES-128-CBC-HMAC-SHA256\" and \"AES-256-CBC-HMAC-SHA256\"

                                                                                                                                                                The following algorithms are available in the default provider, but not the FIPS provider:

                                                                                                                                                                • \"AES-128-OCB\", \"AES-192-OCB\" and \"AES-256-OCB\"
                                                                                                                                                                • \"AES-128-SIV\", \"AES-192-SIV\" and \"AES-256-SIV\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-AES/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-AES/#notes","title":"NOTES","text":"

                                                                                                                                                                The AES-SIV and AES-WRAP mode implementations do not support streaming. That means to obtain correct results there can be only one EVP_EncryptUpdate(3) or EVP_DecryptUpdate(3) call after the initialization of the context.

                                                                                                                                                                The AES-XTS implementations allow streaming to be performed, but each EVP_EncryptUpdate(3) or EVP_DecryptUpdate(3) call requires each input to be a multiple of the blocksize. Only the final EVP_EncryptUpdate() or EVP_DecryptUpdate() call can optionally have an input that is not a multiple of the blocksize but is larger than one block. In that case ciphertext stealing (CTS) is used to fill the block.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-AES/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-AES/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-ARIA/","title":"EVP_CIPHER-ARIA","text":""},{"location":"man7/EVP_CIPHER-ARIA/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-ARIA - The ARIA EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-ARIA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for ARIA symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-ARIA/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the default provider:

                                                                                                                                                                • \"ARIA-128-CBC\", \"ARIA-192-CBC\" and \"ARIA-256-CBC\"
                                                                                                                                                                • \"ARIA-128-CFB\", \"ARIA-192-CFB\", \"ARIA-256-CFB\", \"ARIA-128-CFB1\", \"ARIA-192-CFB1\", \"ARIA-256-CFB1\", \"ARIA-128-CFB8\", \"ARIA-192-CFB8\" and \"ARIA-256-CFB8\"
                                                                                                                                                                • \"ARIA-128-CTR\", \"ARIA-192-CTR\" and \"ARIA-256-CTR\"
                                                                                                                                                                • \"ARIA-128-ECB\", \"ARIA-192-ECB\" and \"ARIA-256-ECB\"
                                                                                                                                                                • \"AES-192-OCB\", \"AES-128-OCB\" and \"AES-256-OCB\"
                                                                                                                                                                • \"ARIA-128-OFB\", \"ARIA-192-OFB\" and \"ARIA-256-OFB\"
                                                                                                                                                                • \"ARIA-128-CCM\", \"ARIA-192-CCM\" and \"ARIA-256-CCM\"
                                                                                                                                                                • \"ARIA-128-GCM\", \"ARIA-192-GCM\" and \"ARIA-256-GCM\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-ARIA/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-ARIA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-ARIA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-BLOWFISH/","title":"EVP_CIPHER-BLOWFISH","text":""},{"location":"man7/EVP_CIPHER-BLOWFISH/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-BLOWFISH - The BLOBFISH EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-BLOWFISH/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for BLOWFISH symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-BLOWFISH/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"BF-ECB\"
                                                                                                                                                                • \"BF-CBC\"
                                                                                                                                                                • \"BF-OFB\"
                                                                                                                                                                • \"BF-CFB\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-BLOWFISH/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-BLOWFISH/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-BLOWFISH/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAMELLIA/","title":"EVP_CIPHER-CAMELLIA","text":""},{"location":"man7/EVP_CIPHER-CAMELLIA/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-CAMELLIA - The CAMELLIA EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAMELLIA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for CAMELLIA symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAMELLIA/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the default provider:

                                                                                                                                                                • \"CAMELLIA-128-CBC\", \"CAMELLIA-192-CBC\" and \"CAMELLIA-256-CBC\"
                                                                                                                                                                • \"CAMELLIA-128-CBC-CTS\", \"CAMELLIA-192-CBC-CTS\" and \"CAMELLIA-256-CBC-CTS\"
                                                                                                                                                                • \"CAMELLIA-128-CFB\", \"CAMELLIA-192-CFB\", \"CAMELLIA-256-CFB\", \"CAMELLIA-128-CFB1\", \"CAMELLIA-192-CFB1\", \"CAMELLIA-256-CFB1\", \"CAMELLIA-128-CFB8\", \"CAMELLIA-192-CFB8\" and \"CAMELLIA-256-CFB8\"
                                                                                                                                                                • \"CAMELLIA-128-CTR\", \"CAMELLIA-192-CTR\" and \"CAMELLIA-256-CTR\"
                                                                                                                                                                • \"CAMELLIA-128-ECB\", \"CAMELLIA-192-ECB\" and \"CAMELLIA-256-ECB\"
                                                                                                                                                                • \"CAMELLIA-192-OFB\", \"CAMELLIA-128-OFB\" and \"CAMELLIA-256-OFB\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAMELLIA/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAMELLIA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAMELLIA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAST/","title":"EVP_CIPHER-CAST","text":""},{"location":"man7/EVP_CIPHER-CAST/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-CAST - The CAST EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAST/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for CAST symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAST/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"CAST-128-CBC\", \"CAST-192-CBC\" and \"CAST-256-CBC\"
                                                                                                                                                                • \"CAST-128-CFB\", \"CAST-192-CFB\", \"CAST-256-CFB\"
                                                                                                                                                                • \"CAST-128-ECB\", \"CAST-192-ECB\" and \"CAST-256-ECB\"
                                                                                                                                                                • \"CAST-192-OFB\", \"CAST-128-OFB\" and \"CAST-256-OFB\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAST/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAST/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CAST/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CHACHA/","title":"EVP_CIPHER-CHACHA","text":""},{"location":"man7/EVP_CIPHER-CHACHA/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-CHACHA - The CHACHA EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CHACHA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for CHACHA symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CHACHA/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the default provider:

                                                                                                                                                                • \"ChaCha20\"
                                                                                                                                                                • \"ChaCha20-Poly1305\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CHACHA/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CHACHA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-CHACHA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-DES/","title":"EVP_CIPHER-DES","text":""},{"location":"man7/EVP_CIPHER-DES/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-DES - The DES EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-DES/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for DES symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-DES/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the FIPS provider as well as the default provider:

                                                                                                                                                                • \"DES-EDE3-ECB\" or \"DES-EDE3\"
                                                                                                                                                                • \"DES-EDE3-CBC\" or \"DES3\"

                                                                                                                                                                The following algorithms are available in the default provider, but not the FIPS provider:

                                                                                                                                                                • \"DES-EDE3-CFB8\" and \"DES-EDE3-CFB1\"
                                                                                                                                                                • \"DES-EDE-ECB\" or \"DES-EDE\"
                                                                                                                                                                • \"DES-EDE-CBC\"
                                                                                                                                                                • \"DES-EDE-OFB\"
                                                                                                                                                                • \"DES-EDE-CFB\"
                                                                                                                                                                • \"DES3-WRAP\"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"DES-ECB\"
                                                                                                                                                                • \"DES-CBC\"
                                                                                                                                                                • \"DES-OFB\"
                                                                                                                                                                • \"DES-CFB\", \"DES-CFB1\" and \"DES-CFB8\"
                                                                                                                                                                • \"DESX-CBC\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-DES/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-DES/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-legacy(7),

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-DES/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-IDEA/","title":"EVP_CIPHER-IDEA","text":""},{"location":"man7/EVP_CIPHER-IDEA/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-IDEA - The IDEA EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-IDEA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for IDEA symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-IDEA/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"IDEA-ECB\"
                                                                                                                                                                • \"IDEA-CBC\"
                                                                                                                                                                • \"IDEA-OFB\" or \"IDEA-OFB64\"
                                                                                                                                                                • \"IDEA-CFB\" or \"IDEA-CFB64\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-IDEA/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-IDEA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-IDEA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/","title":"EVP_CIPHER-NULL","text":""},{"location":"man7/EVP_CIPHER-NULL/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-NULL - The NULL EVP_CIPHER implementation

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for a NULL symmetric encryption using the EVP_CIPHER API. This is used when the TLS cipher suite is TLS_NULL_WITH_NULL_NULL. This does no encryption (just copies the data) and has a mac size of zero.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#algorithm-name","title":"Algorithm Name","text":"

                                                                                                                                                                The following algorithm is available in the default provider:

                                                                                                                                                                • \"NULL\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the following parameters:

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#gettable-evp_cipher-parameters","title":"Gettable EVP_CIPHER parameters","text":"

                                                                                                                                                                See \"Gettable EVP_CIPHER parameters\" in EVP_EncryptInit(3)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#gettable-evp_cipher_ctx-parameters","title":"Gettable EVP_CIPHER_CTX parameters","text":"
                                                                                                                                                                • \"keylen\" (OSSL_CIPHER_PARAM_KEYLEN) <unsigned integer>
                                                                                                                                                                • \"ivlen\" (OSSL_CIPHER_PARAM_IVLEN and <OSSL_CIPHER_PARAM_AEAD_IVLEN) <unsigned integer>
                                                                                                                                                                • \"tls-mac\" (OSSL_CIPHER_PARAM_TLS_MAC) <octet ptr>

                                                                                                                                                                See \"PARAMETERS\" in EVP_EncryptInit(3) for further information.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#settable-evp_cipher_ctx-parameters","title":"Settable EVP_CIPHER_CTX parameters","text":"
                                                                                                                                                                • \"tls-mac-size\" (OSSL_CIPHER_PARAM_TLS_MAC_SIZE) <unsigned integer>

                                                                                                                                                                See \"PARAMETERS\" in EVP_EncryptInit(3) for further information.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                RFC 5246 section-6.2.3.1

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-NULL/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC2/","title":"EVP_CIPHER-RC2","text":""},{"location":"man7/EVP_CIPHER-RC2/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-RC2 - The RC2 EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for RC2 symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC2/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"RC2-CBC\", \"RC2\" or \"RC2-128\"
                                                                                                                                                                • \"RC2-40-CBC\" or \"RC2-40\"
                                                                                                                                                                • \"RC2-64-CBC\" or \"RC2-64\"
                                                                                                                                                                • \"RC2-ECB\"
                                                                                                                                                                • \"RC2-CFB\"
                                                                                                                                                                • \"RC2-OFB\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC2/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC4/","title":"EVP_CIPHER-RC4","text":""},{"location":"man7/EVP_CIPHER-RC4/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-RC4 - The RC4 EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC4/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for RC4 symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC4/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"RC4\"
                                                                                                                                                                • \"RC4-40\"
                                                                                                                                                                • \"RC4-HMAC-MD5\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC4/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC4/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC4/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC5/","title":"EVP_CIPHER-RC5","text":""},{"location":"man7/EVP_CIPHER-RC5/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-RC5 - The RC5 EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC5/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for RC5 symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                Disabled by default. Use the enable-rc5 configuration option to enable.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC5/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"RC5-CBC\" or \"RC5\"
                                                                                                                                                                • \"RC5-ECB\"
                                                                                                                                                                • \"RC5-OFB\"
                                                                                                                                                                • \"RC5-CFB\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC5/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC5/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-RC5/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SEED/","title":"EVP_CIPHER-SEED","text":""},{"location":"man7/EVP_CIPHER-SEED/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-SEED - The SEED EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SEED/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for SEED symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SEED/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the legacy provider:

                                                                                                                                                                • \"SEED-CBC\" or \"SEED\"
                                                                                                                                                                • \"SEED-ECB\"
                                                                                                                                                                • \"SEED-OFB\" or \"SEED-OFB128\"
                                                                                                                                                                • \"SEED-CFB\" or \"SEED-CFB128\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SEED/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SEED/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SEED/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SM4/","title":"EVP_CIPHER-SM4","text":""},{"location":"man7/EVP_CIPHER-SM4/#name","title":"NAME","text":"

                                                                                                                                                                EVP_CIPHER-SM4 - The SM4 EVP_CIPHER implementations

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SM4/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for SM4 symmetric encryption using the EVP_CIPHER API.

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SM4/#algorithm-names","title":"Algorithm Names","text":"

                                                                                                                                                                The following algorithms are available in the default provider:

                                                                                                                                                                • \"SM4-CBC:SM4\"
                                                                                                                                                                • \"SM4-ECB\"
                                                                                                                                                                • \"SM4-CTR\"
                                                                                                                                                                • \"SM4-OFB\" or \"SM4-OFB128\"
                                                                                                                                                                • \"SM4-CFB\" or \"SM4-CFB128\"
                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SM4/#parameters","title":"Parameters","text":"

                                                                                                                                                                This implementation supports the parameters described in \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SM4/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                provider-cipher(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                "},{"location":"man7/EVP_CIPHER-SM4/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                "},{"location":"man7/EVP_KDF-HKDF/","title":"EVP_KDF-HKDF","text":""},{"location":"man7/EVP_KDF-HKDF/#name","title":"NAME","text":"

                                                                                                                                                                EVP_KDF-HKDF - The HKDF EVP_KDF implementation

                                                                                                                                                                "},{"location":"man7/EVP_KDF-HKDF/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                Support for computing the HKDF KDF through the EVP_KDF API.

                                                                                                                                                                The EVP_KDF-HKDF algorithm implements the HKDF key derivation function. HKDF follows the \"extract-then-expand\" paradigm, where the KDF logically consists of two modules. The first stage takes the input keying material and \"extracts\" from it a fixed-length pseudorandom key K. The second stage \"expands\" the key K into several additional pseudorandom keys (the output of the KDF).

                                                                                                                                                                "},{"location":"man7/EVP_KDF-HKDF/#identity","title":"Identity","text":"

                                                                                                                                                                \"HKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                "},{"location":"man7/EVP_KDF-HKDF/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                The supported parameters are:

                                                                                                                                                                • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                                                                                                                                                • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>
                                                                                                                                                                • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                                                                                                                                                  These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                                                                                                                                                  This parameter sets the info value. The length of the context info buffer cannot exceed 1024 bytes; this should be more than enough for any normal use of HKDF.

                                                                                                                                                                • \"mode\" (OSSL_KDF_PARAM_MODE) or <integer>

                                                                                                                                                                  This parameter sets the mode for the HKDF operation. There are three modes that are currently defined:

                                                                                                                                                                  • \"EXTRACT_AND_EXPAND\" or EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND

                                                                                                                                                                    This is the default mode. Calling EVP_KDF_derive(3) on an EVP_KDF_CTX set up for HKDF will perform an extract followed by an expand operation in one go. The derived key returned will be the result after the expand operation. The intermediate fixed-length pseudorandom key K is not returned.

                                                                                                                                                                    In this mode the digest, key, salt and info values must be set before a key is derived otherwise an error will occur.

                                                                                                                                                                  • \"EXTRACT_ONLY\" or EVP_KDF_HKDF_MODE_EXTRACT_ONLY

                                                                                                                                                                    In this mode calling EVP_KDF_derive(3) will just perform the extract operation. The value returned will be the intermediate fixed-length pseudorandom key K. The keylen parameter must match the size of K, which can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest.

                                                                                                                                                                    The digest, key and salt values must be set before a key is derived otherwise an error will occur.

                                                                                                                                                                  • \"EXPAND_ONLY\" or EVP_KDF_HKDF_MODE_EXPAND_ONLY

                                                                                                                                                                    In this mode calling EVP_KDF_derive(3) will just perform the expand operation. The input key should be set to the intermediate fixed-length pseudorandom key K returned from a previous extract operation.

                                                                                                                                                                    The digest, key and info values must be set before a key is derived otherwise an error will occur.

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-HKDF/#notes","title":"NOTES","text":"

                                                                                                                                                                  A context for HKDF can be obtained by calling:

                                                                                                                                                                  EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"HKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                  The output length of an HKDF expand operation is specified via the keylen parameter to the EVP_KDF_derive(3) function. When using EVP_KDF_HKDF_MODE_EXTRACT_ONLY the keylen parameter must equal the size of the intermediate fixed-length pseudorandom key otherwise an error will occur. For that mode, the fixed output size can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest on the EVP_KDF_CTX.

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-HKDF/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                  This example derives 10 bytes using SHA-256 with the secret key \"secret\", salt value \"salt\" and info value \"label\":

                                                                                                                                                                  EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[5], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"HKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"salt\", (size_t)4);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                  "},{"location":"man7/EVP_KDF-HKDF/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                  RFC 5869

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-HKDF/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                  EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3), EVP_KDF-TLS13_KDF(7)

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-HKDF/#history","title":"HISTORY","text":"

                                                                                                                                                                  This functionality was added in OpenSSL 3.0.

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-HKDF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                  Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-KB/","title":"EVP_KDF-KB","text":""},{"location":"man7/EVP_KDF-KB/#name","title":"NAME","text":"

                                                                                                                                                                  EVP_KDF-KB - The Key-Based EVP_KDF implementation

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-KB/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                  The EVP_KDF-KB algorithm implements the Key-Based key derivation function (KBKDF). KBKDF derives a key from repeated application of a keyed MAC to an input secret (and other optional values).

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-KB/#identity","title":"Identity","text":"

                                                                                                                                                                  \"KBKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                  "},{"location":"man7/EVP_KDF-KB/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                  The supported parameters are:

                                                                                                                                                                  • \"mode\" (OSSL_KDF_PARAM_MODE)

                                                                                                                                                                    The mode parameter determines which flavor of KBKDF to use - currently the choices are \"counter\" and \"feedback\". \"counter\" is the default, and will be used if unspecified.

                                                                                                                                                                  • \"mac\" (OSSL_KDF_PARAM_MAC)

                                                                                                                                                                    The value is either CMAC, HMAC, KMAC128 or KMAC256.

                                                                                                                                                                  • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                  • \"cipher\" (OSSL_KDF_PARAM_CIPHER)
                                                                                                                                                                  • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                  • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>
                                                                                                                                                                  • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                                                                                                                                                                  • \"info (OSSL_KDF_PARAM_INFO) <octet string>
                                                                                                                                                                  • \"seed\" (OSSL_KDF_PARAM_SEED) <octet string>

                                                                                                                                                                    The seed parameter is unused in counter mode.

                                                                                                                                                                  • \"use-l\" (OSSL_KDF_PARAM_KBKDF_USE_L) <integer>

                                                                                                                                                                    Set to 0 to disable use of the optional Fixed Input data 'L' (see SP800-108). The default value of 1 will be used if unspecified.

                                                                                                                                                                  • \"use-separator\" (OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR) <integer>

                                                                                                                                                                    Set to 0 to disable use of the optional Fixed Input data 'zero separator' (see SP800-108) that is placed between the Label and Context. The default value of 1 will be used if unspecified.

                                                                                                                                                                  • \"r\" (OSSL_KDF_PARAM_KBKDF_R) <integer>

                                                                                                                                                                    Set the fixed value 'r', indicating the length of the counter in bits.

                                                                                                                                                                    Supported values are 8, 16, 24, and 32. The default value of 32 will be used if unspecified.

                                                                                                                                                                  • Depending on whether mac is CMAC or HMAC, either digest or cipher is required (respectively) and the other is unused. They are unused for KMAC128 and KMAC256.

                                                                                                                                                                    The parameters key, salt, info, and seed correspond to KI, Label, Context, and IV (respectively) in SP800-108. As in that document, salt, info, and seed are optional and may be omitted.

                                                                                                                                                                    \"mac\", \"digest\", cipher\" and \"properties\" are described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KB/#notes","title":"NOTES","text":"

                                                                                                                                                                    A context for KBKDF can be obtained by calling:

                                                                                                                                                                    EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"KBKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                    The output length of an KBKDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                                                                                                                                                    Note that currently OpenSSL only implements counter and feedback modes. Other variants may be supported in the future.

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KB/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                    This example derives 10 bytes using COUNTER-HMAC-SHA256, with KI \"secret\", Label \"label\", and Context \"context\".

                                                                                                                                                                    EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"KBKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        \"SHA2-256\", 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,\n                                        \"HMAC\", 0);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", strlen(\"secret\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"label\", strlen(\"label\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"context\", strlen(\"context\"));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0)\n    error(\"EVP_KDF_derive\");\n\nEVP_KDF_CTX_free(kctx);\n

                                                                                                                                                                    This example derives 10 bytes using FEEDBACK-CMAC-AES256, with KI \"secret\", Label \"label\", and IV \"sixteen bytes iv\".

                                                                                                                                                                    EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[8], *p = params;\nunsigned char *iv = \"sixteen bytes iv\";\n\nkdf = EVP_KDF_fetch(NULL, \"KBKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER, \"AES256\", 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC, \"CMAC\", 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MODE, \"FEEDBACK\", 0);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", strlen(\"secret\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"label\", strlen(\"label\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"context\", strlen(\"context\"));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,\n                                         iv, strlen(iv));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0)\n    error(\"EVP_KDF_derive\");\n\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KB/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                    NIST SP800-108, IETF RFC 6803, IETF RFC 8009.

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KB/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                    EVP_KDF(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KB/#history","title":"HISTORY","text":"

                                                                                                                                                                    This functionality was added in OpenSSL 3.0.

                                                                                                                                                                    Support for KMAC was added in OpenSSL 3.1.

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KB/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                    Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. Copyright 2019 Red Hat, Inc.

                                                                                                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KRB5KDF/","title":"EVP_KDF-KRB5KDF","text":""},{"location":"man7/EVP_KDF-KRB5KDF/#name","title":"NAME","text":"

                                                                                                                                                                    EVP_KDF-KRB5KDF - The RFC3961 Krb5 KDF EVP_KDF implementation

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KRB5KDF/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                    Support for computing the KRB5KDF KDF through the EVP_KDF API.

                                                                                                                                                                    The EVP_KDF-KRB5KDF algorithm implements the key derivation function defined in RFC 3961, section 5.1 and is used by Krb5 to derive session keys. Three inputs are required to perform key derivation: a cipher, (for example AES-128-CBC), the initial key, and a constant.

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KRB5KDF/#identity","title":"Identity","text":"

                                                                                                                                                                    \"KRB5KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                    "},{"location":"man7/EVP_KDF-KRB5KDF/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                    The supported parameters are:

                                                                                                                                                                    • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                    • \"cipher\" (OSSL_KDF_PARAM_CIPHER)
                                                                                                                                                                    • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                                                                                                                                                      These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                    • \"constant\" (OSSL_KDF_PARAM_CONSTANT) <octet string>

                                                                                                                                                                      This parameter sets the constant value for the KDF. If a value is already set, the contents are replaced.

                                                                                                                                                                    • "},{"location":"man7/EVP_KDF-KRB5KDF/#notes","title":"NOTES","text":"

                                                                                                                                                                      A context for KRB5KDF can be obtained by calling:

                                                                                                                                                                      EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"KRB5KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                      The output length of the KRB5KDF derivation is specified via the keylen parameter to the EVP_KDF_derive(3) function, and MUST match the key length for the chosen cipher or an error is returned. Moreover, the constant's length must not exceed the block size of the cipher. Since the KRB5KDF output length depends on the chosen cipher, calling EVP_KDF_CTX_get_kdf_size(3) to obtain the requisite length returns the correct length only after the cipher is set. Prior to that EVP_MAX_KEY_LENGTH is returned. The caller must allocate a buffer of the correct length for the chosen cipher, and pass that buffer to the EVP_KDF_derive(3) function along with that length.

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-KRB5KDF/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                      This example derives a key using the AES-128-CBC cipher:

                                                                                                                                                                      EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char key[16] = \"01234...\";\nunsigned char constant[] = \"I'm a constant\";\nunsigned char out[16];\nsize_t outlen = sizeof(out);\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"KRB5KDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CIPHER,\n                                        SN_aes_128_cbc,\n                                        strlen(SN_aes_128_cbc));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         key, (size_t)16);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_CONSTANT,\n                                         constant, strlen(constant));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, outlen, params) <= 0)\n    /* Error */\n\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                      "},{"location":"man7/EVP_KDF-KRB5KDF/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                      RFC 3961

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-KRB5KDF/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                      EVP_KDF(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-KRB5KDF/#history","title":"HISTORY","text":"

                                                                                                                                                                      This functionality was added in OpenSSL 3.0.

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-KRB5KDF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                      Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-PBKDF1/","title":"EVP_KDF-PBKDF1","text":""},{"location":"man7/EVP_KDF-PBKDF1/#name","title":"NAME","text":"

                                                                                                                                                                      EVP_KDF-PBKDF1 - The PBKDF1 EVP_KDF implementation

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-PBKDF1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                      Support for computing the PBKDF1 password-based KDF through the EVP_KDF API.

                                                                                                                                                                      The EVP_KDF-PBKDF1 algorithm implements the PBKDF1 password-based key derivation function, as described in RFC 8018; it derives a key from a password using a salt and iteration count.

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-PBKDF1/#identity","title":"Identity","text":"

                                                                                                                                                                      \"PBKDF1\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                      "},{"location":"man7/EVP_KDF-PBKDF1/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                      The supported parameters are:

                                                                                                                                                                      • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                                                                                                                                                      • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                                                                                                                                                                      • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

                                                                                                                                                                        This parameter has a default value of 0 and should be set.

                                                                                                                                                                      • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                                                                                                                                                      • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                        These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF1/#notes","title":"NOTES","text":"

                                                                                                                                                                        A typical application of this algorithm is to derive keying material for an encryption algorithm from a password in the \"pass\", a salt in \"salt\", and an iteration count.

                                                                                                                                                                        Increasing the \"iter\" parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                                                                                                                                                        No assumption is made regarding the given password; it is simply treated as a byte sequence.

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF1/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                        RFC 8018

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                        EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF1/#history","title":"HISTORY","text":"

                                                                                                                                                                        This functionality was added in OpenSSL 3.0.

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                        Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF2/","title":"EVP_KDF-PBKDF2","text":""},{"location":"man7/EVP_KDF-PBKDF2/#name","title":"NAME","text":"

                                                                                                                                                                        EVP_KDF-PBKDF2 - The PBKDF2 EVP_KDF implementation

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                        Support for computing the PBKDF2 password-based KDF through the EVP_KDF API.

                                                                                                                                                                        The EVP_KDF-PBKDF2 algorithm implements the PBKDF2 password-based key derivation function, as described in SP800-132; it derives a key from a password using a salt and iteration count.

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF2/#identity","title":"Identity","text":"

                                                                                                                                                                        \"PBKDF2\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                        "},{"location":"man7/EVP_KDF-PBKDF2/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                        The supported parameters are:

                                                                                                                                                                        • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                                                                                                                                                        • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                                                                                                                                                                        • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

                                                                                                                                                                          This parameter has a default value of 2048.

                                                                                                                                                                        • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                                                                                                                                                        • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                          These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                        • \"pkcs5\" (OSSL_KDF_PARAM_PKCS5) <integer>

                                                                                                                                                                          This parameter can be used to enable or disable SP800-132 compliance checks. Setting the mode to 0 enables the compliance checks.

                                                                                                                                                                          The checks performed are:

                                                                                                                                                                            • the iteration count is at least 1000.
                                                                                                                                                                            • the salt length is at least 128 bits.
                                                                                                                                                                            • the derived key length is at least 112 bits.

                                                                                                                                                                          The default provider uses a default mode of 1 for backwards compatibility, and the FIPS provider uses a default mode of 0.

                                                                                                                                                                          The value string is expected to be a decimal number 0 or 1.

                                                                                                                                                                        • "},{"location":"man7/EVP_KDF-PBKDF2/#notes","title":"NOTES","text":"

                                                                                                                                                                          A typical application of this algorithm is to derive keying material for an encryption algorithm from a password in the \"pass\", a salt in \"salt\", and an iteration count.

                                                                                                                                                                          Increasing the \"iter\" parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                                                                                                                                                          No assumption is made regarding the given password; it is simply treated as a byte sequence.

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PBKDF2/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                          SP800-132

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PBKDF2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                          EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PBKDF2/#history","title":"HISTORY","text":"

                                                                                                                                                                          This functionality was added in OpenSSL 3.0.

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PBKDF2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                          Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PKCS12KDF/","title":"EVP_KDF-PKCS12KDF","text":""},{"location":"man7/EVP_KDF-PKCS12KDF/#name","title":"NAME","text":"

                                                                                                                                                                          EVP_KDF-PKCS12KDF - The PKCS#12 EVP_KDF implementation

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PKCS12KDF/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                          Support for computing the PKCS#12 password-based KDF through the EVP_KDF API.

                                                                                                                                                                          The EVP_KDF-PKCS12KDF algorithm implements the PKCS#12 password-based key derivation function, as described in appendix B of RFC 7292 (PKCS #12: Personal Information Exchange Syntax); it derives a key from a password using a salt, iteration count and the intended usage.

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PKCS12KDF/#identity","title":"Identity","text":"

                                                                                                                                                                          \"PKCS12KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                          "},{"location":"man7/EVP_KDF-PKCS12KDF/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                          The supported parameters are:

                                                                                                                                                                          • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                                                                                                                                                          • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>
                                                                                                                                                                          • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>
                                                                                                                                                                          • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                          • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                            These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                          • \"id\" (OSSL_KDF_PARAM_PKCS12_ID) <integer>

                                                                                                                                                                            This parameter is used to specify the intended usage of the output bits, as per RFC 7292 section B.3.

                                                                                                                                                                          • "},{"location":"man7/EVP_KDF-PKCS12KDF/#notes","title":"NOTES","text":"

                                                                                                                                                                            This algorithm is not available in the FIPS provider as it is not FIPS approvable.

                                                                                                                                                                            A typical application of this algorithm is to derive keying material for an encryption algorithm from a password in the \"pass\", a salt in \"salt\", and an iteration count.

                                                                                                                                                                            Increasing the \"iter\" parameter slows down the algorithm which makes it harder for an attacker to perform a brute force attack using a large number of candidate passwords.

                                                                                                                                                                            No assumption is made regarding the given password; it is simply treated as a byte sequence.

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-PKCS12KDF/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                            RFC7292

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-PKCS12KDF/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                            EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3), OSSL_PROVIDER-FIPS(7)

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-PKCS12KDF/#history","title":"HISTORY","text":"

                                                                                                                                                                            This functionality was added in OpenSSL 3.0.

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-PKCS12KDF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                            Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-SCRYPT/","title":"EVP_KDF-SCRYPT","text":""},{"location":"man7/EVP_KDF-SCRYPT/#name","title":"NAME","text":"

                                                                                                                                                                            EVP_KDF-SCRYPT - The scrypt EVP_KDF implementation

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-SCRYPT/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                            Support for computing the scrypt password-based KDF through the EVP_KDF API.

                                                                                                                                                                            The EVP_KDF-SCRYPT algorithm implements the scrypt password-based key derivation function, as described in RFC 7914. It is memory-hard in the sense that it deliberately requires a significant amount of RAM for efficient computation. The intention of this is to render brute forcing of passwords on systems that lack large amounts of main memory (such as GPUs or ASICs) computationally infeasible.

                                                                                                                                                                            scrypt provides three work factors that can be customized: N, r and p. N, which has to be a positive power of two, is the general work factor and scales CPU time in an approximately linear fashion. r is the block size of the internally used hash function and p is the parallelization factor. Both r and p need to be greater than zero. The amount of RAM that scrypt requires for its computation is roughly (128 * N * r * p) bytes.

                                                                                                                                                                            In the original paper of Colin Percival (\"Stronger Key Derivation via Sequential Memory-Hard Functions\", 2009), the suggested values that give a computation time of less than 5 seconds on a 2.5 GHz Intel Core 2 Duo are N = 2^20 = 1048576, r = 8, p = 1. Consequently, the required amount of memory for this computation is roughly 1 GiB. On a more recent CPU (Intel i7-5930K at 3.5 GHz), this computation takes about 3 seconds. When N, r or p are not specified, they default to 1048576, 8, and 1, respectively. The maximum amount of RAM that may be used by scrypt defaults to 1025 MiB.

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-SCRYPT/#identity","title":"Identity","text":"

                                                                                                                                                                            \"SCRYPT\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                            "},{"location":"man7/EVP_KDF-SCRYPT/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                            The supported parameters are:

                                                                                                                                                                            • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>
                                                                                                                                                                            • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                                                                                                                                                              These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                            • \"n\" (OSSL_KDF_PARAM_SCRYPT_N) <unsigned integer>

                                                                                                                                                                            • \"r\" (OSSL_KDF_PARAM_SCRYPT_R) <unsigned integer>
                                                                                                                                                                            • \"p\" (OSSL_KDF_PARAM_SCRYPT_P) <unsigned integer>
                                                                                                                                                                            • \"maxmem_bytes\" (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>

                                                                                                                                                                              These parameters configure the scrypt work factors N, r, maxmem and p. Both N and maxmem_bytes are parameters of type uint64_t. Both r and p are parameters of type uint32_t.

                                                                                                                                                                            • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                                                                                                                                                              This can be used to set the property query string when fetching the fixed digest internally. NULL is used if this value is not set.

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SCRYPT/#notes","title":"NOTES","text":"

                                                                                                                                                                              A context for scrypt can be obtained by calling:

                                                                                                                                                                              EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"SCRYPT\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                              The output length of an scrypt key derivation is specified via the \"keylen\" parameter to the EVP_KDF_derive(3) function.

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SCRYPT/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                              This example derives a 64-byte long test vector using scrypt with the password \"password\", salt \"NaCl\" and N = 1024, r = 8, p = 16.

                                                                                                                                                                              EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[64];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SCRYPT\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_PASSWORD,\n                                         \"password\", (size_t)8);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"NaCl\", (size_t)4);\n*p++ = OSSL_PARAM_construct_uint64(OSSL_KDF_PARAM_SCRYPT_N, (uint64_t)1024);\n*p++ = OSSL_PARAM_construct_uint32(OSSL_KDF_PARAM_SCRYPT_R, (uint32_t)8);\n*p++ = OSSL_PARAM_construct_uint32(OSSL_KDF_PARAM_SCRYPT_P, (uint32_t)16);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\n{\n    const unsigned char expected[sizeof(out)] = {\n        0xfd, 0xba, 0xbe, 0x1c, 0x9d, 0x34, 0x72, 0x00,\n        0x78, 0x56, 0xe7, 0x19, 0x0d, 0x01, 0xe9, 0xfe,\n        0x7c, 0x6a, 0xd7, 0xcb, 0xc8, 0x23, 0x78, 0x30,\n        0xe7, 0x73, 0x76, 0x63, 0x4b, 0x37, 0x31, 0x62,\n        0x2e, 0xaf, 0x30, 0xd9, 0x2e, 0x22, 0xa3, 0x88,\n        0x6f, 0xf1, 0x09, 0x27, 0x9d, 0x98, 0x30, 0xda,\n        0xc7, 0x27, 0xaf, 0xb9, 0x4a, 0x83, 0xee, 0x6d,\n        0x83, 0x60, 0xcb, 0xdf, 0xa2, 0xcc, 0x06, 0x40\n    };\n\n    assert(!memcmp(out, expected, sizeof(out)));\n}\n\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SCRYPT/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                              RFC 7914

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SCRYPT/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                              EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SCRYPT/#history","title":"HISTORY","text":"

                                                                                                                                                                              This functionality was added in OpenSSL 3.0.

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SCRYPT/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                              Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SS/","title":"EVP_KDF-SS","text":""},{"location":"man7/EVP_KDF-SS/#name","title":"NAME","text":"

                                                                                                                                                                              EVP_KDF-SS - The Single Step / One Step EVP_KDF implementation

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SS/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                              The EVP_KDF-SS algorithm implements the Single Step key derivation function (SSKDF). SSKDF derives a key using input such as a shared secret key (that was generated during the execution of a key establishment scheme) and fixedinfo. SSKDF is also informally referred to as 'Concat KDF'.

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SS/#auxiliary-function","title":"Auxiliary function","text":"

                                                                                                                                                                              The implementation uses a selectable auxiliary function H, which can be one of:

                                                                                                                                                                              • H(x) = hash(x, digest=md)
                                                                                                                                                                              • H(x) = HMAC_hash(x, key=salt, digest=md)
                                                                                                                                                                              • H(x) = KMACxxx(x, key=salt, custom=\"KDF\", outlen=mac_size)

                                                                                                                                                                              Both the HMAC and KMAC implementations set the key using the 'salt' value. The hash and HMAC also require the digest to be set.

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SS/#identity","title":"Identity","text":"

                                                                                                                                                                              \"SSKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                              "},{"location":"man7/EVP_KDF-SS/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                              The supported parameters are:

                                                                                                                                                                              • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                              • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                                This parameter is ignored for KMAC.

                                                                                                                                                                              • \"mac\" (OSSL_KDF_PARAM_MAC)

                                                                                                                                                                              • \"maclen\" (OSSL_KDF_PARAM_MAC_SIZE) <unsigned integer>
                                                                                                                                                                              • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                                                                                                                                                                These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                              • \"key\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                                                                                                                                                                This parameter set the shared secret that is used for key derivation.

                                                                                                                                                                              • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                                                                                                                                                                This parameter sets an optional value for fixedinfo, also known as otherinfo.

                                                                                                                                                                              • "},{"location":"man7/EVP_KDF-SS/#notes","title":"NOTES","text":"

                                                                                                                                                                                A context for SSKDF can be obtained by calling:

                                                                                                                                                                                EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                                The output length of an SSKDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SS/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                This example derives 10 bytes using H(x) = SHA-256, with the secret key \"secret\" and fixedinfo value \"label\":

                                                                                                                                                                                EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n

                                                                                                                                                                                This example derives 10 bytes using H(x) = HMAC(SHA-256), with the secret key \"secret\", fixedinfo value \"label\" and salt \"salt\":

                                                                                                                                                                                EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,\n                                        SN_hmac, strlen(SN_hmac));\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"salt\", (size_t)4);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n

                                                                                                                                                                                This example derives 10 bytes using H(x) = KMAC128(x,salt,outlen), with the secret key \"secret\" fixedinfo value \"label\", salt of \"salt\" and KMAC outlen of 20:

                                                                                                                                                                                EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,\n                                        SN_kmac128, strlen(SN_kmac128));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,\n                                         \"salt\", (size_t)4);\n*p++ = OSSL_PARAM_construct_size_t(OSSL_KDF_PARAM_MAC_SIZE, (size_t)20);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SS/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                NIST SP800-56Cr1.

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SS/#history","title":"HISTORY","text":"

                                                                                                                                                                                This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.

                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SSHKDF/","title":"EVP_KDF-SSHKDF","text":""},{"location":"man7/EVP_KDF-SSHKDF/#name","title":"NAME","text":"

                                                                                                                                                                                EVP_KDF-SSHKDF - The SSHKDF EVP_KDF implementation

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SSHKDF/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                Support for computing the SSHKDF KDF through the EVP_KDF API.

                                                                                                                                                                                The EVP_KDF-SSHKDF algorithm implements the SSHKDF key derivation function. It is defined in RFC 4253, section 7.2 and is used by SSH to derive IVs, encryption keys and integrity keys. Five inputs are required to perform key derivation: The hashing function (for example SHA256), the Initial Key, the Exchange Hash, the Session ID, and the derivation key type.

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SSHKDF/#identity","title":"Identity","text":"

                                                                                                                                                                                \"SSHKDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                                "},{"location":"man7/EVP_KDF-SSHKDF/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                The supported parameters are:

                                                                                                                                                                                • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                                • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                                                                                                                                                                • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                                                                                                                                                                  These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                                • \"xcghash\" (OSSL_KDF_PARAM_SSHKDF_XCGHASH) <octet string>

                                                                                                                                                                                • \"session_id\" (OSSL_KDF_PARAM_SSHKDF_SESSION_ID) <octet string>

                                                                                                                                                                                  These parameters set the respective values for the KDF. If a value is already set, the contents are replaced.

                                                                                                                                                                                • \"type\" (OSSL_KDF_PARAM_SSHKDF_TYPE)

                                                                                                                                                                                  This parameter sets the type for the SSHKDF operation. There are six supported types:

                                                                                                                                                                                  • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV

                                                                                                                                                                                    The Initial IV from client to server. A single char of value 65 (ASCII char 'A').

                                                                                                                                                                                  • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI

                                                                                                                                                                                    The Initial IV from server to client A single char of value 66 (ASCII char 'B').

                                                                                                                                                                                  • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV

                                                                                                                                                                                    The Encryption Key from client to server A single char of value 67 (ASCII char 'C').

                                                                                                                                                                                  • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI

                                                                                                                                                                                    The Encryption Key from server to client A single char of value 68 (ASCII char 'D').

                                                                                                                                                                                  • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV

                                                                                                                                                                                    The Integrity Key from client to server A single char of value 69 (ASCII char 'E').

                                                                                                                                                                                  • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI

                                                                                                                                                                                    The Integrity Key from client to server A single char of value 70 (ASCII char 'F').

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-SSHKDF/#notes","title":"NOTES","text":"

                                                                                                                                                                                  A context for SSHKDF can be obtained by calling:

                                                                                                                                                                                  EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"SSHKDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                                  The output length of the SSHKDF derivation is specified via the keylen parameter to the EVP_KDF_derive(3) function. Since the SSHKDF output length is variable, calling EVP_KDF_CTX_get_kdf_size(3) to obtain the requisite length is not meaningful. The caller must allocate a buffer of the desired length, and pass that buffer to the EVP_KDF_derive(3) function along with the desired length.

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-SSHKDF/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                  This example derives an 8 byte IV using SHA-256 with a 1K \"key\" and appropriate \"xcghash\" and \"session_id\" values:

                                                                                                                                                                                  EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nchar type = EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV;\nunsigned char key[1024] = \"01234...\";\nunsigned char xcghash[32] = \"012345...\";\nunsigned char session_id[32] = \"012345...\";\nunsigned char out[8];\nsize_t outlen = sizeof(out);\nOSSL_PARAM params[6], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"SSHKDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,\n                                         key, (size_t)1024);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SSHKDF_XCGHASH,\n                                         xcghash, (size_t)32);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SSHKDF_SESSION_ID,\n                                         session_id, (size_t)32);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_SSHKDF_TYPE,\n                                        &type, sizeof(type));\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, outlen, params) <= 0)\n    /* Error */\n
                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-SSHKDF/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                  RFC 4253

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-SSHKDF/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                  EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-SSHKDF/#history","title":"HISTORY","text":"

                                                                                                                                                                                  This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-SSHKDF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                  Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-TLS13_KDF/","title":"EVP_KDF-TLS13_KDF","text":""},{"location":"man7/EVP_KDF-TLS13_KDF/#name","title":"NAME","text":"

                                                                                                                                                                                  EVP_KDF-TLS13_KDF - The TLS 1.3 EVP_KDF implementation

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-TLS13_KDF/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                  Support for computing the TLS 1.3 version of the HKDF KDF through the EVP_KDF API.

                                                                                                                                                                                  The EVP_KDF-TLS13_KDF algorithm implements the HKDF key derivation function as used by TLS 1.3.

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-TLS13_KDF/#identity","title":"Identity","text":"

                                                                                                                                                                                  \"TLS13-KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                                  "},{"location":"man7/EVP_KDF-TLS13_KDF/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                  The supported parameters are:

                                                                                                                                                                                  • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                                  • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                                                                                                                                                                  • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>
                                                                                                                                                                                  • \"salt\" (OSSL_KDF_PARAM_SALT) <octet string>

                                                                                                                                                                                    These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                                  • \"prefix\" (OSSL_KDF_PARAM_PREFIX) <octet string>

                                                                                                                                                                                    This parameter sets the label prefix on the specified TLS 1.3 KDF context. For TLS 1.3 this should be set to the ASCII string \"tls13 \" without a trailing zero byte. Refer to RFC 8446 section 7.1 \"Key Schedule\" for details.

                                                                                                                                                                                  • \"label\" (OSSL_KDF_PARAM_LABEL) <octet string>

                                                                                                                                                                                    This parameter sets the label on the specified TLS 1.3 KDF context. Refer to RFC 8446 section 7.1 \"Key Schedule\" for details.

                                                                                                                                                                                  • \"data\" (OSSL_KDF_PARAM_DATA) <octet string>

                                                                                                                                                                                    This parameter sets the context data on the specified TLS 1.3 KDF context. Refer to RFC 8446 section 7.1 \"Key Schedule\" for details.

                                                                                                                                                                                  • \"mode\" (OSSL_KDF_PARAM_MODE) or <integer>

                                                                                                                                                                                    This parameter sets the mode for the TLS 1.3 KDF operation. There are two modes that are currently defined:

                                                                                                                                                                                    • \"EXTRACT_ONLY\" or EVP_KDF_HKDF_MODE_EXTRACT_ONLY

                                                                                                                                                                                      In this mode calling EVP_KDF_derive(3) will just perform the extract operation. The value returned will be the intermediate fixed-length pseudorandom key K. The keylen parameter must match the size of K, which can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest.

                                                                                                                                                                                      The digest, key and salt values must be set before a key is derived otherwise an error will occur.

                                                                                                                                                                                    • \"EXPAND_ONLY\" or EVP_KDF_HKDF_MODE_EXPAND_ONLY

                                                                                                                                                                                      In this mode calling EVP_KDF_derive(3) will just perform the expand operation. The input key should be set to the intermediate fixed-length pseudorandom key K returned from a previous extract operation.

                                                                                                                                                                                      The digest, key and info values must be set before a key is derived otherwise an error will occur.

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS13_KDF/#notes","title":"NOTES","text":"

                                                                                                                                                                                    This KDF is intended for use by the TLS 1.3 implementation in libssl. It does not support all the options and capabilities that HKDF does.

                                                                                                                                                                                    The OSSL_PARAM array passed to EVP_KDF_derive(3) or EVP_KDF_CTX_set_params(3) must specify all of the parameters required. This KDF does not support a piecemeal approach to providing these.

                                                                                                                                                                                    A context for a TLS 1.3 KDF can be obtained by calling:

                                                                                                                                                                                    EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"TLS13-KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                                    The output length of a TLS 1.3 KDF expand operation is specified via the keylen parameter to the EVP_KDF_derive(3) function. When using EVP_KDF_HKDF_MODE_EXTRACT_ONLY the keylen parameter must equal the size of the intermediate fixed-length pseudorandom key otherwise an error will occur. For that mode, the fixed output size can be looked up by calling EVP_KDF_CTX_get_kdf_size() after setting the mode and digest on the EVP_KDF_CTX.

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS13_KDF/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                    RFC 8446

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS13_KDF/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                    EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3), EVP_KDF-HKDF(7)

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS13_KDF/#history","title":"HISTORY","text":"

                                                                                                                                                                                    This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS13_KDF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                    Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS1_PRF/","title":"EVP_KDF-TLS1_PRF","text":""},{"location":"man7/EVP_KDF-TLS1_PRF/#name","title":"NAME","text":"

                                                                                                                                                                                    EVP_KDF-TLS1_PRF - The TLS1 PRF EVP_KDF implementation

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS1_PRF/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                    Support for computing the TLS1 PRF through the EVP_KDF API.

                                                                                                                                                                                    The EVP_KDF-TLS1_PRF algorithm implements the PRF used by TLS versions up to and including TLS 1.2.

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS1_PRF/#identity","title":"Identity","text":"

                                                                                                                                                                                    \"TLS1-PRF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                                    "},{"location":"man7/EVP_KDF-TLS1_PRF/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                    The supported parameters are:

                                                                                                                                                                                    • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                                    • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                                      These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                                      The OSSL_KDF_PARAM_DIGEST parameter is used to set the message digest associated with the TLS PRF. EVP_md5_sha1() is treated as a special case which uses the PRF algorithm using both MD5 and SHA1 as used in TLS 1.0 and 1.1.

                                                                                                                                                                                    • \"secret\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                                                                                                                                                                      This parameter sets the secret value of the TLS PRF. Any existing secret value is replaced.

                                                                                                                                                                                    • \"seed\" (OSSL_KDF_PARAM_SEED) <octet string>

                                                                                                                                                                                      This parameter sets the context seed. The length of the context seed cannot exceed 1024 bytes; this should be more than enough for any normal use of the TLS PRF.

                                                                                                                                                                                    • "},{"location":"man7/EVP_KDF-TLS1_PRF/#notes","title":"NOTES","text":"

                                                                                                                                                                                      A context for the TLS PRF can be obtained by calling:

                                                                                                                                                                                      EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"TLS1-PRF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                                      The digest, secret value and seed must be set before a key is derived otherwise an error will occur.

                                                                                                                                                                                      The output length of the PRF is specified by the keylen parameter to the EVP_KDF_derive() function.

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-TLS1_PRF/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                      This example derives 10 bytes using SHA-256 with the secret key \"secret\" and seed value \"seed\":

                                                                                                                                                                                      EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"TLS1-PRF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,\n                                         \"seed\", (size_t)4);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-TLS1_PRF/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                      RFC 2246, RFC 5246 and NIST SP 800-135 r1

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-TLS1_PRF/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                      EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-TLS1_PRF/#history","title":"HISTORY","text":"

                                                                                                                                                                                      This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-TLS1_PRF/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                      Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-X942-ASN1/","title":"EVP_KDF-X942-ASN1","text":""},{"location":"man7/EVP_KDF-X942-ASN1/#name","title":"NAME","text":"

                                                                                                                                                                                      EVP_KDF-X942-ASN1 - The X9.42-2003 asn1 EVP_KDF implementation

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-X942-ASN1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                      The EVP_KDF-X942-ASN1 algorithm implements the key derivation function X942KDF-ASN1. It is used by DH KeyAgreement, to derive a key using input such as a shared secret key and other info. The other info is DER encoded data that contains a 32 bit counter as well as optional fields for \"partyu-info\", \"partyv-info\", \"supp-pubinfo\" and \"supp-privinfo\". This kdf is used by Cryptographic Message Syntax (CMS).

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-X942-ASN1/#identity","title":"Identity","text":"

                                                                                                                                                                                      \"X942KDF-ASN1\" or \"X942KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                                      "},{"location":"man7/EVP_KDF-X942-ASN1/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                      The supported parameters are:

                                                                                                                                                                                      • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                                      • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                                        These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                                      • \"secret\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                                                                                                                                                                        The shared secret used for key derivation. This parameter sets the secret.

                                                                                                                                                                                      • \"acvp-info\" (OSSL_KDF_PARAM_X942_ACVPINFO) <octet string>

                                                                                                                                                                                        This value should not be used in production and should only be used for ACVP testing. It is an optional octet string containing a combined DER encoded blob of any of the optional fields related to \"partyu-info\", \"partyv-info\", \"supp-pubinfo\" and \"supp-privinfo\". If it is specified then none of these other fields should be used.

                                                                                                                                                                                      • \"partyu-info\" (OSSL_KDF_PARAM_X942_PARTYUINFO) <octet string>

                                                                                                                                                                                        An optional octet string containing public info contributed by the initiator.

                                                                                                                                                                                      • \"ukm\" (OSSL_KDF_PARAM_UKM) <octet string>

                                                                                                                                                                                        An alias for \"partyu-info\". In CMS this is the user keying material.

                                                                                                                                                                                      • \"partyv-info\" (OSSL_KDF_PARAM_X942_PARTYVINFO) <octet string>

                                                                                                                                                                                        An optional octet string containing public info contributed by the responder.

                                                                                                                                                                                      • \"supp-pubinfo\" (OSSL_KDF_PARAM_X942_SUPP_PUBINFO) <octet string>

                                                                                                                                                                                        An optional octet string containing some additional, mutually-known public information. Setting this value also sets \"use-keybits\" to 0.

                                                                                                                                                                                      • \"use-keybits\" (OSSL_KDF_PARAM_X942_USE_KEYBITS) <integer>

                                                                                                                                                                                        The default value of 1 will use the KEK key length (in bits) as the \"supp-pubinfo\". A value of 0 disables setting the \"supp-pubinfo\".

                                                                                                                                                                                      • \"supp-privinfo\" (OSSL_KDF_PARAM_X942_SUPP_PRIVINFO) <octet string>

                                                                                                                                                                                        An optional octet string containing some additional, mutually-known private information.

                                                                                                                                                                                      • \"cekalg\" (OSSL_KDF_PARAM_CEK_ALG)

                                                                                                                                                                                        This parameter sets the CEK wrapping algorithm name. Valid values are \"AES-128-WRAP\", \"AES-192-WRAP\", \"AES-256-WRAP\" and \"DES3-WRAP\".

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-ASN1/#notes","title":"NOTES","text":"

                                                                                                                                                                                        A context for X942KDF can be obtained by calling:

                                                                                                                                                                                        EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"X942KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                                        The output length of an X942KDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-ASN1/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                        This example derives 24 bytes, with the secret key \"secret\" and random user keying material:

                                                                                                                                                                                        EVP_KDF_CTX *kctx;\nEVP_KDF_CTX *kctx;\nunsigned char out[192/8];\nunsignred char ukm[64];\nOSSL_PARAM params[5], *p = params;\n\nif (RAND_bytes(ukm, sizeof(ukm)) <= 0)\n    error(\"RAND_bytes\");\n\nkdf = EVP_KDF_fetch(NULL, \"X942KDF\", NULL);\nif (kctx == NULL)\n    error(\"EVP_KDF_fetch\");\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\nif (kctx == NULL)\n    error(\"EVP_KDF_CTX_new\");\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, \"SHA256\", 0);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_UKM, ukm, sizeof(ukm));\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CEK_ALG, \"AES-256-WRAP, 0);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0)\n    error(\"EVP_KDF_derive\");\n\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-ASN1/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                        ANS1 X9.42-2003 RFC 2631

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-ASN1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                        EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-ASN1/#history","title":"HISTORY","text":"

                                                                                                                                                                                        This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-ASN1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                        Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-CONCAT/","title":"EVP_KDF-X942-CONCAT","text":""},{"location":"man7/EVP_KDF-X942-CONCAT/#name","title":"NAME","text":"

                                                                                                                                                                                        EVP_KDF-X942-CONCAT - The X942 Concat EVP_KDF implementation

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-CONCAT/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                        The EVP_KDF-X942-CONCAT algorithm is identical to EVP_KDF-X963. It is used for key agreement to derive a key using input such as a shared secret key and shared info.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-CONCAT/#identity","title":"Identity","text":"

                                                                                                                                                                                        \"X942KDF_CONCAT\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                                        This is an alias for \"X963KDF\".

                                                                                                                                                                                        See EVP_KDF-X963(7) for a list of supported parameters and examples.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-CONCAT/#history","title":"HISTORY","text":"

                                                                                                                                                                                        This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X942-CONCAT/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                        Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X963/","title":"EVP_KDF-X963","text":""},{"location":"man7/EVP_KDF-X963/#name","title":"NAME","text":"

                                                                                                                                                                                        EVP_KDF-X963 - The X9.63-2001 EVP_KDF implementation

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X963/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                        The EVP_KDF-X963 algorithm implements the key derivation function (X963KDF). X963KDF is used by Cryptographic Message Syntax (CMS) for EC KeyAgreement, to derive a key using input such as a shared secret key and shared info.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X963/#identity","title":"Identity","text":"

                                                                                                                                                                                        \"X963KDF\" is the name for this implementation; it can be used with the EVP_KDF_fetch() function.

                                                                                                                                                                                        "},{"location":"man7/EVP_KDF-X963/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                        The supported parameters are:

                                                                                                                                                                                        • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)
                                                                                                                                                                                        • \"digest\" (OSSL_KDF_PARAM_DIGEST)

                                                                                                                                                                                          These parameters work as described in \"PARAMETERS\" in EVP_KDF(3).

                                                                                                                                                                                        • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                                                                                                                                                                          The shared secret used for key derivation. This parameter sets the secret.

                                                                                                                                                                                        • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                                                                                                                                                                          This parameter specifies an optional value for shared info.

                                                                                                                                                                                        • "},{"location":"man7/EVP_KDF-X963/#notes","title":"NOTES","text":"

                                                                                                                                                                                          X963KDF is very similar to the SSKDF that uses a digest as the auxiliary function, X963KDF appends the counter to the secret, whereas SSKDF prepends the counter.

                                                                                                                                                                                          A context for X963KDF can be obtained by calling:

                                                                                                                                                                                          EVP_KDF *kdf = EVP_KDF_fetch(NULL, \"X963KDF\", NULL);\nEVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);\n

                                                                                                                                                                                          The output length of an X963KDF is specified via the keylen parameter to the EVP_KDF_derive(3) function.

                                                                                                                                                                                          "},{"location":"man7/EVP_KDF-X963/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                          This example derives 10 bytes, with the secret key \"secret\" and sharedinfo value \"label\":

                                                                                                                                                                                          EVP_KDF *kdf;\nEVP_KDF_CTX *kctx;\nunsigned char out[10];\nOSSL_PARAM params[4], *p = params;\n\nkdf = EVP_KDF_fetch(NULL, \"X963KDF\", NULL);\nkctx = EVP_KDF_CTX_new(kdf);\nEVP_KDF_free(kdf);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,\n                                        SN_sha256, strlen(SN_sha256));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,\n                                         \"secret\", (size_t)6);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,\n                                         \"label\", (size_t)5);\n*p = OSSL_PARAM_construct_end();\nif (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {\n    error(\"EVP_KDF_derive\");\n}\n\nEVP_KDF_CTX_free(kctx);\n
                                                                                                                                                                                          "},{"location":"man7/EVP_KDF-X963/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                          \"SEC 1: Elliptic Curve Cryptography\"

                                                                                                                                                                                          "},{"location":"man7/EVP_KDF-X963/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                          EVP_KDF(3), EVP_KDF_CTX_new(3), EVP_KDF_CTX_free(3), EVP_KDF_CTX_set_params(3), EVP_KDF_CTX_get_kdf_size(3), EVP_KDF_derive(3), \"PARAMETERS\" in EVP_KDF(3)

                                                                                                                                                                                          "},{"location":"man7/EVP_KDF-X963/#history","title":"HISTORY","text":"

                                                                                                                                                                                          This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                          "},{"location":"man7/EVP_KDF-X963/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                          Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                          "},{"location":"man7/EVP_KEM-RSA/","title":"EVP_KEM-RSA","text":""},{"location":"man7/EVP_KEM-RSA/#name","title":"NAME","text":"

                                                                                                                                                                                          EVP_KEM-RSA - EVP_KEM RSA keytype and algorithm support

                                                                                                                                                                                          "},{"location":"man7/EVP_KEM-RSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                          The RSA keytype and its parameters are described in EVP_PKEY-RSA(7). See EVP_PKEY_encapsulate(3) and EVP_PKEY_decapsulate(3) for more info.

                                                                                                                                                                                          "},{"location":"man7/EVP_KEM-RSA/#rsa-kem-parameters","title":"RSA KEM parameters","text":"
                                                                                                                                                                                          • \"operation\" (OSSL_KEM_PARAM_OPERATION)

                                                                                                                                                                                            The OpenSSL RSA Key Encapsulation Mechanism only currently supports the following operation

                                                                                                                                                                                            • \"RSASVE\"

                                                                                                                                                                                              The encapsulate function simply generates a secret using random bytes and then encrypts the secret using the RSA public key (with no padding). The decapsulate function recovers the secret using the RSA private key.

                                                                                                                                                                                            This can be set using EVP_PKEY_CTX_set_kem_op().

                                                                                                                                                                                            "},{"location":"man7/EVP_KEM-RSA/#conforming-to","title":"CONFORMING TO","text":"
                                                                                                                                                                                            • SP800-56Br2

                                                                                                                                                                                              Section 7.2.1.2 RSASVE Generate Operation (RSASVE.GENERATE). Section 7.2.1.3 RSASVE Recovery Operation (RSASVE.RECOVER).

                                                                                                                                                                                            "},{"location":"man7/EVP_KEM-RSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                            EVP_PKEY_CTX_set_kem_op(3), EVP_PKEY_encapsulate(3), EVP_PKEY_decapsulate(3) EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7)

                                                                                                                                                                                            "},{"location":"man7/EVP_KEM-RSA/#history","title":"HISTORY","text":"

                                                                                                                                                                                            This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                            "},{"location":"man7/EVP_KEM-RSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                            Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                            "},{"location":"man7/EVP_KEYEXCH-DH/","title":"EVP_KEYEXCH-DH","text":""},{"location":"man7/EVP_KEYEXCH-DH/#name","title":"NAME","text":"

                                                                                                                                                                                            EVP_KEYEXCH-DH - DH Key Exchange algorithm support

                                                                                                                                                                                            "},{"location":"man7/EVP_KEYEXCH-DH/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                            Key exchange support for the DH key type.

                                                                                                                                                                                            "},{"location":"man7/EVP_KEYEXCH-DH/#dh-key-exchange-parameters","title":"DH key exchange parameters","text":"
                                                                                                                                                                                            • \"pad\" (OSSL_EXCHANGE_PARAM_PAD) <unsigned integer>

                                                                                                                                                                                              Sets the padding mode for the associated key exchange ctx. Setting a value of 1 will turn padding on. Setting a value of 0 will turn padding off. If padding is off then the derived shared secret may be smaller than the largest possible secret size. If padding is on then the derived shared secret will have its first bytes filled with zeros where necessary to make the shared secret the same size as the largest possible secret size. The padding mode parameter is ignored (and padding implicitly enabled) when the KDF type is set to \"X942KDF-ASN1\" (OSSL_KDF_NAME_X942KDF_ASN1).

                                                                                                                                                                                            • \"kdf-type\" (OSSL_EXCHANGE_PARAM_KDF_TYPE)

                                                                                                                                                                                              See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                            • \"kdf-digest\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST)

                                                                                                                                                                                              See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                            • \"kdf-digest-props\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS)

                                                                                                                                                                                              See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                            • \"kdf-outlen\" (OSSL_EXCHANGE_PARAM_KDF_OUTLEN) <unsigned integer>

                                                                                                                                                                                              See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                            • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string>

                                                                                                                                                                                              See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                            • \"cekalg\" (OSSL_KDF_PARAM_CEK_ALG) <octet string ptr>

                                                                                                                                                                                              See \"KDF Parameters\" in provider-kdf(7).

                                                                                                                                                                                            • "},{"location":"man7/EVP_KEYEXCH-DH/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                              The examples assume a host and peer both generate keys using the same named group (or domain parameters). See \"Examples\" in EVP_PKEY-DH(7). Both the host and peer transfer their public key to each other.

                                                                                                                                                                                              To convert the peer's generated key pair to a public key in DER format in order to transfer to the host:

                                                                                                                                                                                              EVP_PKEY *peer_key; /* It is assumed this contains the peers generated key */\nunsigned char *peer_pub_der = NULL;\nint peer_pub_der_len;\n\npeer_pub_der_len = i2d_PUBKEY(peer_key, &peer_pub_der);\n...\nOPENSSL_free(peer_pub_der);\n

                                                                                                                                                                                              To convert the received peer's public key from DER format on the host:

                                                                                                                                                                                              const unsigned char *pd = peer_pub_der;\nEVP_PKEY *peer_pub_key = d2i_PUBKEY(NULL, &pd, peer_pub_der_len);\n...\nEVP_PKEY_free(peer_pub_key);\n

                                                                                                                                                                                              To derive a shared secret on the host using the host's key and the peer's public key:

                                                                                                                                                                                              /* It is assumed that the host_key and peer_pub_key are set up */\nvoid derive_secret(EVP_KEY *host_key, EVP_PKEY *peer_pub_key)\n{\n    unsigned int pad = 1;\n    OSSL_PARAM params[2];\n    unsigned char *secret = NULL;\n    size_t secret_len = 0;\n    EVP_PKEY_CTX *dctx = EVP_PKEY_CTX_new_from_pkey(NULL, host_key, NULL);\n\n    EVP_PKEY_derive_init(dctx);\n\n    /* Optionally set the padding */\n    params[0] = OSSL_PARAM_construct_uint(OSSL_EXCHANGE_PARAM_PAD, &pad);\n    params[1] = OSSL_PARAM_construct_end();\n    EVP_PKEY_CTX_set_params(dctx, params);\n\n    EVP_PKEY_derive_set_peer(dctx, peer_pub_key);\n\n    /* Get the size by passing NULL as the buffer */\n    EVP_PKEY_derive(dctx, NULL, &secret_len);\n    secret = OPENSSL_zalloc(secret_len);\n\n    EVP_PKEY_derive(dctx, secret, &secret_len);\n    ...\n    OPENSSL_clear_free(secret, secret_len);\n    EVP_PKEY_CTX_free(dctx);\n}\n

                                                                                                                                                                                              Very similar code can be used by the peer to derive the same shared secret using the host's public key and the peer's generated key pair.

                                                                                                                                                                                              "},{"location":"man7/EVP_KEYEXCH-DH/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                              EVP_PKEY-DH(7), EVP_PKEY-FFC(7), EVP_PKEY(3), provider-keyexch(7), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                                                                                                                                                              "},{"location":"man7/EVP_KEYEXCH-DH/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                              "},{"location":"man7/EVP_KEYEXCH-ECDH/","title":"EVP_KEYEXCH-ECDH","text":""},{"location":"man7/EVP_KEYEXCH-ECDH/#name","title":"NAME","text":"

                                                                                                                                                                                              EVP_KEYEXCH-ECDH - ECDH Key Exchange algorithm support

                                                                                                                                                                                              "},{"location":"man7/EVP_KEYEXCH-ECDH/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                              Key exchange support for the ECDH key type.

                                                                                                                                                                                              "},{"location":"man7/EVP_KEYEXCH-ECDH/#ecdh-key-exchange-parameters","title":"ECDH Key Exchange parameters","text":"
                                                                                                                                                                                              • \"ecdh-cofactor-mode\" (OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE) <integer>

                                                                                                                                                                                                Sets or gets the ECDH mode of operation for the associated key exchange ctx.

                                                                                                                                                                                                In the context of an Elliptic Curve Diffie-Hellman key exchange, this parameter can be used to select between the plain Diffie-Hellman (DH) or Cofactor Diffie-Hellman (CDH) variants of the key exchange algorithm.

                                                                                                                                                                                                When setting, the value should be 1, 0 or -1, respectively forcing cofactor mode on, off, or resetting it to the default for the private key associated with the given key exchange ctx.

                                                                                                                                                                                                When getting, the value should be either 1 or 0, respectively signaling if the cofactor mode is on or off.

                                                                                                                                                                                                See also provider-keymgmt(7) for the related OSSL_PKEY_PARAM_USE_COFACTOR_ECDH parameter that can be set on a per-key basis.

                                                                                                                                                                                              • \"kdf-type\" (OSSL_EXCHANGE_PARAM_KDF_TYPE)

                                                                                                                                                                                                See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                              • \"kdf-digest\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST)

                                                                                                                                                                                                See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                              • \"kdf-digest-props\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS)

                                                                                                                                                                                                See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                              • \"kdf-outlen\" (OSSL_EXCHANGE_PARAM_KDF_OUTLEN) <unsigned integer>

                                                                                                                                                                                                See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                              • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string>

                                                                                                                                                                                                See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                              • "},{"location":"man7/EVP_KEYEXCH-ECDH/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                Keys for the host and peer must be generated as shown in \"Examples\" in EVP_PKEY-EC(7) using the same curve name.

                                                                                                                                                                                                The code to generate a shared secret for the normal case is identical to \"Examples\" in EVP_KEYEXCH-DH(7).

                                                                                                                                                                                                To derive a shared secret on the host using the host's key and the peer's public key but also using X963KDF with a user key material:

                                                                                                                                                                                                /* It is assumed that the host_key, peer_pub_key and ukm are set up */\nvoid derive_secret(EVP_PKEY *host_key, EVP_PKEY *peer_key,\n                   unsigned char *ukm, size_t ukm_len)\n{\n    unsigned char secret[64];\n    size_t out_len = sizeof(secret);\n    size_t secret_len = out_len;\n    unsigned int pad = 1;\n    OSSL_PARAM params[6];\n    EVP_PKEY_CTX *dctx = EVP_PKEY_CTX_new_from_pkey(NULL, host_key, NULL);\n\n    EVP_PKEY_derive_init(dctx);\n\n    params[0] = OSSL_PARAM_construct_uint(OSSL_EXCHANGE_PARAM_PAD, &pad);\n    params[1] = OSSL_PARAM_construct_utf8_string(OSSL_EXCHANGE_PARAM_KDF_TYPE,\n                                                 \"X963KDF\", 0);\n    params[2] = OSSL_PARAM_construct_utf8_string(OSSL_EXCHANGE_PARAM_KDF_DIGEST,\n                                                 \"SHA1\", 0);\n    params[3] = OSSL_PARAM_construct_size_t(OSSL_EXCHANGE_PARAM_KDF_OUTLEN,\n                                            &out_len);\n    params[4] = OSSL_PARAM_construct_octet_string(OSSL_EXCHANGE_PARAM_KDF_UKM,\n                                                  ukm, ukm_len);\n    params[5] = OSSL_PARAM_construct_end();\n    EVP_PKEY_CTX_set_params(dctx, params);\n\n    EVP_PKEY_derive_set_peer(dctx, peer_pub_key);\n    EVP_PKEY_derive(dctx, secret, &secret_len);\n    ...\n    OPENSSL_clear_free(secret, secret_len);\n    EVP_PKEY_CTX_free(dctx);\n}\n
                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-ECDH/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                EVP_PKEY-EC(7) EVP_PKEY(3), provider-keyexch(7), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-ECDH/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-X25519/","title":"EVP_KEYEXCH-X25519","text":""},{"location":"man7/EVP_KEYEXCH-X25519/#name","title":"NAME","text":"

                                                                                                                                                                                                EVP_KEYEXCH-X25519, EVP_KEYEXCH-X448 - X25519 and X448 Key Exchange algorithm support

                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-X25519/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                Key exchange support for the X25519 and X448 key types.

                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-X25519/#key-exchange-parameters","title":"Key exchange parameters","text":"
                                                                                                                                                                                                • \"pad\" (OSSL_EXCHANGE_PARAM_PAD) <unsigned integer>

                                                                                                                                                                                                  See \"Common Key Exchange parameters\" in provider-keyexch(7).

                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-X25519/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                Keys for the host and peer can be generated as shown in \"Examples\" in EVP_PKEY-X25519(7).

                                                                                                                                                                                                The code to generate a shared secret is identical to \"Examples\" in EVP_KEYEXCH-DH(7).

                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-X25519/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                EVP_PKEY-FFC(7), EVP_PKEY-DH(7) EVP_PKEY(3), provider-keyexch(7), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                                                                                                                                                                "},{"location":"man7/EVP_KEYEXCH-X25519/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-BLAKE2/","title":"EVP_MAC-BLAKE2","text":""},{"location":"man7/EVP_MAC-BLAKE2/#name","title":"NAME","text":"

                                                                                                                                                                                                EVP_MAC-BLAKE2, EVP_MAC-BLAKE2BMAC, EVP_MAC-BLAKE2SMAC - The BLAKE2 EVP_MAC implementations

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-BLAKE2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                Support for computing BLAKE2 MACs through the EVP_MAC API.

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-BLAKE2/#identity","title":"Identity","text":"

                                                                                                                                                                                                These implementations are identified with one of these names and properties, to be used with EVP_MAC_fetch():

                                                                                                                                                                                                • \"BLAKE2BMAC\", \"provider=default\"
                                                                                                                                                                                                • \"BLAKE2SMAC\", \"provider=default\"
                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-BLAKE2/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                                                                                                                                                All these parameters (except for \"block-size\") can be set with EVP_MAC_CTX_set_params(). Furthermore, the \"size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of a size_t. Likewise, the \"block-size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_block_size().

                                                                                                                                                                                                • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                  Sets the MAC key. It may be at most 64 bytes for BLAKE2BMAC or 32 for BLAKE2SMAC and at least 1 byte in both cases. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                                                                                                                                                • \"custom\" (OSSL_MAC_PARAM_CUSTOM) <octet string>

                                                                                                                                                                                                  Sets the customization/personalization string. It is an optional value of at most 16 bytes for BLAKE2BMAC or 8 for BLAKE2SMAC, and is empty by default.

                                                                                                                                                                                                • \"salt\" (OSSL_MAC_PARAM_SALT) <octet string>

                                                                                                                                                                                                  Sets the salt. It is an optional value of at most 16 bytes for BLAKE2BMAC or 8 for BLAKE2SMAC, and is empty by default.

                                                                                                                                                                                                • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                  Sets the MAC size. It can be any number between 1 and 32 for EVP_MAC_BLAKE2S or between 1 and 64 for EVP_MAC_BLAKE2B. It is 32 and 64 respectively by default.

                                                                                                                                                                                                • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                                                                                                  Gets the MAC block size. It is 64 for EVP_MAC_BLAKE2S and 128 for EVP_MAC_BLAKE2B.

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-BLAKE2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-BLAKE2/#history","title":"HISTORY","text":"

                                                                                                                                                                                                The macros and functions described here were added to OpenSSL 3.0.

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-BLAKE2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-CMAC/","title":"EVP_MAC-CMAC","text":""},{"location":"man7/EVP_MAC-CMAC/#name","title":"NAME","text":"

                                                                                                                                                                                                EVP_MAC-CMAC - The CMAC EVP_MAC implementation

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-CMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                Support for computing CMAC MACs through the EVP_MAC API.

                                                                                                                                                                                                This implementation uses EVP_CIPHER functions to get access to the underlying cipher.

                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-CMAC/#identity","title":"Identity","text":"

                                                                                                                                                                                                This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                                                                                                                                                • \"CMAC\", \"provider=default\" or \"provider=fips\"
                                                                                                                                                                                                "},{"location":"man7/EVP_MAC-CMAC/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                                                                                                                                                The following parameter can be set with EVP_MAC_CTX_set_params():

                                                                                                                                                                                                • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                  Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                                                                                                                                                • \"cipher\" (OSSL_MAC_PARAM_CIPHER)

                                                                                                                                                                                                  Sets the name of the underlying cipher to be used. The mode of the cipher must be CBC.

                                                                                                                                                                                                • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

                                                                                                                                                                                                  Sets the properties to be queried when trying to fetch the underlying cipher. This must be given together with the cipher naming parameter to be considered valid.

                                                                                                                                                                                                  The following parameters can be retrieved with EVP_MAC_CTX_get_params():

                                                                                                                                                                                                  • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                    The \"size\" parameter can also be retrieved with with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter is equal to that of an unsigned int.

                                                                                                                                                                                                  • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                                                                                                    Gets the MAC block size. The \"block-size\" parameter can also be retrieved with EVP_MAC_CTX_get_block_size().

                                                                                                                                                                                                  "},{"location":"man7/EVP_MAC-CMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                  EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                                                                                                                                                  "},{"location":"man7/EVP_MAC-CMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                  Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                  "},{"location":"man7/EVP_MAC-GMAC/","title":"EVP_MAC-GMAC","text":""},{"location":"man7/EVP_MAC-GMAC/#name","title":"NAME","text":"

                                                                                                                                                                                                  EVP_MAC-GMAC - The GMAC EVP_MAC implementation

                                                                                                                                                                                                  "},{"location":"man7/EVP_MAC-GMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                  Support for computing GMAC MACs through the EVP_MAC API.

                                                                                                                                                                                                  This implementation uses EVP_CIPHER functions to get access to the underlying cipher.

                                                                                                                                                                                                  "},{"location":"man7/EVP_MAC-GMAC/#identity","title":"Identity","text":"

                                                                                                                                                                                                  This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                                                                                                                                                  • \"GMAC\", \"provider=default\" or \"provider=fips\"
                                                                                                                                                                                                  "},{"location":"man7/EVP_MAC-GMAC/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                  The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                                                                                                                                                  The following parameter can be set with EVP_MAC_CTX_set_params():

                                                                                                                                                                                                  • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                    Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                                                                                                                                                  • \"iv\" (OSSL_MAC_PARAM_IV) <octet string>

                                                                                                                                                                                                    Sets the IV of the underlying cipher, when applicable.

                                                                                                                                                                                                  • \"cipher\" (OSSL_MAC_PARAM_CIPHER)

                                                                                                                                                                                                    Sets the name of the underlying cipher to be used.

                                                                                                                                                                                                  • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

                                                                                                                                                                                                    Sets the properties to be queried when trying to fetch the underlying cipher. This must be given together with the cipher naming parameter to be considered valid.

                                                                                                                                                                                                    The following parameters can be retrieved with EVP_MAC_CTX_get_params():

                                                                                                                                                                                                    • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                      Gets the MAC size.

                                                                                                                                                                                                    The \"size\" parameter can also be retrieved with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter is equal to that of an unsigned int.

                                                                                                                                                                                                    "},{"location":"man7/EVP_MAC-GMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                    EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                                                                                                                                                    "},{"location":"man7/EVP_MAC-GMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                    Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                    "},{"location":"man7/EVP_MAC-HMAC/","title":"EVP_MAC-HMAC","text":""},{"location":"man7/EVP_MAC-HMAC/#name","title":"NAME","text":"

                                                                                                                                                                                                    EVP_MAC-HMAC - The HMAC EVP_MAC implementation

                                                                                                                                                                                                    "},{"location":"man7/EVP_MAC-HMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                    Support for computing HMAC MACs through the EVP_MAC API.

                                                                                                                                                                                                    This implementation uses EVP_MD functions to get access to the underlying digest.

                                                                                                                                                                                                    "},{"location":"man7/EVP_MAC-HMAC/#identity","title":"Identity","text":"

                                                                                                                                                                                                    This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                                                                                                                                                    • \"HMAC\", \"provider=default\" or \"provider=fips\"
                                                                                                                                                                                                    "},{"location":"man7/EVP_MAC-HMAC/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                    The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                                                                                                                                                    The following parameter can be set with EVP_MAC_CTX_set_params():

                                                                                                                                                                                                    • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                      Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                                                                                                                                                    • \"digest\" (OSSL_MAC_PARAM_DIGEST)

                                                                                                                                                                                                      Sets the name of the underlying digest to be used.

                                                                                                                                                                                                    • \"properties\" (OSSL_MAC_PARAM_PROPERTIES)

                                                                                                                                                                                                      Sets the properties to be queried when trying to fetch the underlying digest. This must be given together with the digest naming parameter (\"digest\", or OSSL_MAC_PARAM_DIGEST) to be considered valid.

                                                                                                                                                                                                    • \"digest-noinit\" (OSSL_MAC_PARAM_DIGEST_NOINIT) <integer>

                                                                                                                                                                                                      A flag to set the MAC digest to not initialise the implementation specific data. The value 0 or 1 is expected.

                                                                                                                                                                                                    • \"digest-oneshot\" (OSSL_MAC_PARAM_DIGEST_ONESHOT) <integer>

                                                                                                                                                                                                      A flag to set the MAC digest to be a one-shot operation. The value 0 or 1 is expected.

                                                                                                                                                                                                    • \"tls-data-size\" (OSSL_MAC_PARAM_TLS_DATA_SIZE) <unsigned integer>

                                                                                                                                                                                                    • The following parameter can be retrieved with EVP_MAC_CTX_get_params():

                                                                                                                                                                                                      • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                        The \"size\" parameter can also be retrieved with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter is equal to that of an unsigned int.

                                                                                                                                                                                                      • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                                                                                                        Gets the MAC block size. The \"block-size\" parameter can also be retrieved with EVP_MAC_CTX_get_block_size().

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-HMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3), HMAC(3)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-KMAC/","title":"EVP_MAC-KMAC","text":""},{"location":"man7/EVP_MAC-KMAC/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MAC-KMAC, EVP_MAC-KMAC128, EVP_MAC-KMAC256 - The KMAC EVP_MAC implementations

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-KMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing KMAC MACs through the EVP_MAC API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-KMAC/#identity","title":"Identity","text":"

                                                                                                                                                                                                      These implementations are identified with one of these names and properties, to be used with EVP_MAC_fetch():

                                                                                                                                                                                                      • \"KMAC-128\", \"provider=default\" or \"provider=fips\"
                                                                                                                                                                                                      • \"KMAC-256\", \"provider=default\" or \"provider=fips\"
                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-KMAC/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                      The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                                                                                                                                                      All these parameters (except for \"block-size\") can be set with EVP_MAC_CTX_set_params(). Furthermore, the \"size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of a size_t. Likewise, the \"block-size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_block_size().

                                                                                                                                                                                                      • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                        Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3). The length of the key (in bytes) must be in the range 4...512.

                                                                                                                                                                                                      • \"custom\" (OSSL_MAC_PARAM_CUSTOM) <octet string>

                                                                                                                                                                                                        Sets the customization string. It is an optional value with a length of at most 512 bytes, and is empty by default.

                                                                                                                                                                                                      • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                        Sets the MAC size. By default, it is 32 for KMAC-128 and 64 for KMAC-256.

                                                                                                                                                                                                      • \"block-size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                                                                                                        Gets the MAC block size. It is 168 for KMAC-128 and 136 for KMAC-256.

                                                                                                                                                                                                      • \"xof\" (OSSL_MAC_PARAM_XOF) <integer>

                                                                                                                                                                                                        The \"xof\" parameter value is expected to be 1 or 0. Use 1 to enable XOF mode. The default value is 0.

                                                                                                                                                                                                      The \"custom\" parameter must be set as part of or before the EVP_MAC_init() call. The \"xof\" and \"size\" parameters can be set at any time before EVP_MAC_final(). The \"key\" parameter is set as part of the EVP_MAC_init() call, but can be set before it instead.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-KMAC/#examples","title":"EXAMPLES","text":"
                                                                                                                                                                                                      #include <openssl/evp.h>\n#include <openssl/params.h>\n\nstatic int do_kmac(const unsigned char *in, size_t in_len,\n                   const unsigned char *key, size_t key_len,\n                   const unsigned char *custom, size_t custom_len,\n                   int xof_enabled, unsigned char *out, int out_len)\n{\n    EVP_MAC_CTX *ctx = NULL;\n    EVP_MAC *mac = NULL;\n    OSSL_PARAM params[4], *p;\n    int ret = 0;\n    size_t l = 0;\n\n    mac = EVP_MAC_fetch(NULL, \"KMAC-128\", NULL);\n    if (mac == NULL)\n        goto err;\n    ctx = EVP_MAC_CTX_new(mac);\n    /* The mac can be freed after it is used by EVP_MAC_CTX_new */\n    EVP_MAC_free(mac);\n    if (ctx == NULL)\n        goto err;\n\n    /*\n     * Setup parameters required before calling EVP_MAC_init()\n     * The parameters OSSL_MAC_PARAM_XOF and OSSL_MAC_PARAM_SIZE may also be\n     * used at this point.\n     */\n    p = params;\n    *p++ = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,\n                                             (void *)key, key_len);\n    if (custom != NULL && custom_len != 0)\n      *p++ = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_CUSTOM,\n                                               (void *)custom, custom_len);\n    *p = OSSL_PARAM_construct_end();\n    if (!EVP_MAC_CTX_set_params(ctx, params))\n        goto err;\n\n    if (!EVP_MAC_init(ctx))\n        goto err;\n\n    /*\n     * Note: the following optional parameters can be set any time\n     * before EVP_MAC_final().\n     */\n    p = params;\n    *p++ = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_XOF, &xof_enabled);\n    *p++ = OSSL_PARAM_construct_int(OSSL_MAC_PARAM_SIZE, &out_len);\n    *p = OSSL_PARAM_construct_end();\n    if (!EVP_MAC_CTX_set_params(ctx, params))\n        goto err;\n\n    /* The update may be called multiple times here for streamed input */\n    if (!EVP_MAC_update(ctx, in, in_len))\n        goto err;\n    if (!EVP_MAC_final(ctx, out, &l, out_len))\n        goto err;\n    ret = 1;\nerr:\n    EVP_MAC_CTX_free(ctx);\n    return ret;\n}\n
                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-KMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-KMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2018-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Poly1305/","title":"EVP_MAC-Poly1305","text":""},{"location":"man7/EVP_MAC-Poly1305/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MAC-Poly1305 - The Poly1305 EVP_MAC implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Poly1305/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing Poly1305 MACs through the EVP_MAC API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Poly1305/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                                                                                                                                                      • \"POLY1305\", \"provider=default\"
                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Poly1305/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                      The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                                                                                                                                                      The following parameter can be set with EVP_MAC_CTX_set_params():

                                                                                                                                                                                                      • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                        Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                                                                                                                                                      The following parameters can be retrieved with EVP_MAC_CTX_get_params():

                                                                                                                                                                                                      • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                        Gets the MAC size.

                                                                                                                                                                                                      The \"size\" parameter can also be retrieved with with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of an unsigned int.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Poly1305/#notes","title":"NOTES","text":"

                                                                                                                                                                                                      The OpenSSL implementation of the Poly 1305 MAC corresponds to RFC 7539.

                                                                                                                                                                                                      It is critical to never reuse the key. The security implication noted in RFC 8439 applies equally to the OpenSSL implementation.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Poly1305/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Poly1305/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Siphash/","title":"EVP_MAC-Siphash","text":""},{"location":"man7/EVP_MAC-Siphash/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MAC-Siphash - The Siphash EVP_MAC implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Siphash/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing Siphash MACs through the EVP_MAC API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Siphash/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is identified with this name and properties, to be used with EVP_MAC_fetch():

                                                                                                                                                                                                      • \"SIPHASH\", \"provider=default\"
                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Siphash/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                      The general description of these parameters can be found in \"PARAMETERS\" in EVP_MAC(3).

                                                                                                                                                                                                      All these parameters can be set with EVP_MAC_CTX_set_params(). Furthermore, the \"size\" parameter can be retrieved with EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size(). The length of the \"size\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                      • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                        Sets the MAC key. Setting this parameter is identical to passing a key to EVP_MAC_init(3).

                                                                                                                                                                                                      • \"size\" (OSSL_MAC_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                        Sets the MAC size.

                                                                                                                                                                                                      • \"c-rounds\" (OSSL_MAC_PARAM_C_ROUNDS) <unsigned integer>

                                                                                                                                                                                                        Specifies the number of rounds per message block. By default this is 2.

                                                                                                                                                                                                      • \"d-rounds\" (OSSL_MAC_PARAM_D_ROUNDS) <unsigned integer>

                                                                                                                                                                                                        Specifies the number of finalisation rounds. By default this is 4.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Siphash/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MAC_CTX_get_params(3), EVP_MAC_CTX_set_params(3), \"PARAMETERS\" in EVP_MAC(3), OSSL_PARAM(3)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MAC-Siphash/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-BLAKE2/","title":"EVP_MD-BLAKE2","text":""},{"location":"man7/EVP_MD-BLAKE2/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-BLAKE2 - The BLAKE2 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-BLAKE2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing BLAKE2 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-BLAKE2/#identities","title":"Identities","text":"

                                                                                                                                                                                                      This implementation is only available with the default provider, and includes the following varieties:

                                                                                                                                                                                                      • BLAKE2S-256

                                                                                                                                                                                                        Known names are \"BLAKE2S-256\" and \"BLAKE2s256\".

                                                                                                                                                                                                      • BLAKE2B-512

                                                                                                                                                                                                        Known names are \"BLAKE2B-512\" and \"BLAKE2b512\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-BLAKE2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-BLAKE2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-BLAKE2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD2/","title":"EVP_MD-MD2","text":""},{"location":"man7/EVP_MD-MD2/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-MD2 - The MD2 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing MD2 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD2/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is only available with the legacy provider, and is identified with the name \"MD2\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD4/","title":"EVP_MD-MD4","text":""},{"location":"man7/EVP_MD-MD4/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-MD4 - The MD4 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD4/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing MD4 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD4/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is only available with the legacy provider, and is identified with the name \"MD4\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD4/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD4/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD4/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5-SHA1/","title":"EVP_MD-MD5-SHA1","text":""},{"location":"man7/EVP_MD-MD5-SHA1/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-MD5-SHA1 - The MD5-SHA1 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5-SHA1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing MD5-SHA1 digests through the EVP_MD API.

                                                                                                                                                                                                      MD5-SHA1 is a rather special digest that's used with SSLv3.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5-SHA1/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is only available with the default provider, and is identified with the name \"MD5-SHA1\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5-SHA1/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5-SHA1/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                                                                                                                                                      This implementation supports the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                                                                                                                                                      • \"ssl3-ms\" (OSSL_DIGEST_PARAM_SSL3_MS) <octet string>

                                                                                                                                                                                                        This parameter is set by libssl in order to calculate a signature hash for an SSLv3 CertificateVerify message as per RFC6101. It is only set after all handshake messages have already been digested via OP_digest_update() calls. The parameter provides the master secret value to be added to the digest. The digest implementation should calculate the complete digest as per RFC6101 section 5.6.8. The next call after setting this parameter should be OP_digest_final().

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5-SHA1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5-SHA1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5/","title":"EVP_MD-MD5","text":""},{"location":"man7/EVP_MD-MD5/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-MD5 - The MD5 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing MD5 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is only available with the default provider, and is identified with the name \"MD5\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MD5/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MDC2/","title":"EVP_MD-MDC2","text":""},{"location":"man7/EVP_MD-MDC2/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-MDC2 - The MDC2 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MDC2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing MDC2 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MDC2/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is only available with the legacy provider, and is identified with the name \"MDC2\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MDC2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MDC2/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                                                                                                                                                      This implementation supports the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                                                                                                                                                      • \"pad-type\" (OSSL_DIGEST_PARAM_PAD_TYPE) <unsigned integer>

                                                                                                                                                                                                        Sets the padding type to be used. Normally the final MDC2 block is padded with zeros. If the pad type is set to 2 then the final block is padded with 0x80 followed by zeros.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MDC2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-MDC2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-NULL/","title":"EVP_MD-NULL","text":""},{"location":"man7/EVP_MD-NULL/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-NULL - The NULL EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-NULL/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for a NULL digest through the EVP_MD API. This algorithm does nothing and returns 1 for its init, update and final methods.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-NULL/#algorithm-name","title":"Algorithm Name","text":"

                                                                                                                                                                                                      The following algorithm is available in the default provider:

                                                                                                                                                                                                      • \"NULL\"
                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-NULL/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-NULL/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-NULL/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-RIPEMD160/","title":"EVP_MD-RIPEMD160","text":""},{"location":"man7/EVP_MD-RIPEMD160/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-RIPEMD160 - The RIPEMD160 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-RIPEMD160/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing RIPEMD160 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-RIPEMD160/#identities","title":"Identities","text":"

                                                                                                                                                                                                      This implementation is available in both the default and legacy providers, and is identified with any of the names \"RIPEMD-160\", \"RIPEMD160\", \"RIPEMD\" and \"RMD160\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-RIPEMD160/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-RIPEMD160/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-RIPEMD160/#history","title":"HISTORY","text":"

                                                                                                                                                                                                      This digest was added to the default provider in OpenSSL 3.0.7.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-RIPEMD160/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA1/","title":"EVP_MD-SHA1","text":""},{"location":"man7/EVP_MD-SHA1/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-SHA1 - The SHA1 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA1/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing SHA1 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA1/#identities","title":"Identities","text":"

                                                                                                                                                                                                      This implementation is available with the FIPS provider as well as the default provider, and is identified with the names \"SHA1\" and \"SHA-1\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA1/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA1/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                                                                                                                                                      This implementation supports the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                                                                                                                                                      • \"ssl3-ms\" (OSSL_DIGEST_PARAM_SSL3_MS) <octet string>

                                                                                                                                                                                                        This parameter is set by libssl in order to calculate a signature hash for an SSLv3 CertificateVerify message as per RFC6101. It is only set after all handshake messages have already been digested via OP_digest_update() calls. The parameter provides the master secret value to be added to the digest. The digest implementation should calculate the complete digest as per RFC6101 section 5.6.8. The next call after setting this parameter should be OP_digest_final().

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA1/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA1/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA2/","title":"EVP_MD-SHA2","text":""},{"location":"man7/EVP_MD-SHA2/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-SHA2 - The SHA2 EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing SHA2 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA2/#identities","title":"Identities","text":"

                                                                                                                                                                                                      This implementation includes the following varieties:

                                                                                                                                                                                                      • Available with the FIPS provider as well as the default provider:

                                                                                                                                                                                                        • SHA2-224

                                                                                                                                                                                                          Known names are \"SHA2-224\", \"SHA-224\" and \"SHA224\".

                                                                                                                                                                                                        • SHA2-256

                                                                                                                                                                                                          Known names are \"SHA2-256\", \"SHA-256\" and \"SHA256\".

                                                                                                                                                                                                        • SHA2-384

                                                                                                                                                                                                          Known names are \"SHA2-384\", \"SHA-384\" and \"SHA384\".

                                                                                                                                                                                                        • SHA2-512

                                                                                                                                                                                                          Known names are \"SHA2-512\", \"SHA-512\" and \"SHA512\". - Available with the default provider: - SHA2-512/224

                                                                                                                                                                                                          Known names are \"SHA2-512/224\", \"SHA-512/224\" and \"SHA512-224\".

                                                                                                                                                                                                        • SHA2-512/256

                                                                                                                                                                                                          Known names are \"SHA2-512/256\", \"SHA-512/256\" and \"SHA512-256\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA2/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA3/","title":"EVP_MD-SHA3","text":""},{"location":"man7/EVP_MD-SHA3/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-SHA3 - The SHA3 EVP_MD implementations

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA3/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing SHA3 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA3/#identities","title":"Identities","text":"

                                                                                                                                                                                                      This implementation is available with the FIPS provider as well as the default provider, and includes the following varieties:

                                                                                                                                                                                                      • \"SHA3-224\"
                                                                                                                                                                                                      • \"SHA3-256\"
                                                                                                                                                                                                      • \"SHA3-384\"
                                                                                                                                                                                                      • \"SHA3-512\"
                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA3/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA3/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHA3/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHAKE/","title":"EVP_MD-SHAKE","text":""},{"location":"man7/EVP_MD-SHAKE/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-SHAKE, EVP_MD-KECCAK-KMAC - The SHAKE / KECCAK family EVP_MD implementations

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHAKE/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing SHAKE or KECCAK-KMAC digests through the EVP_MD API.

                                                                                                                                                                                                      KECCAK-KMAC is an Extendable Output Function (XOF), with a definition similar to SHAKE, used by the KMAC EVP_MAC implementation (see EVP_MAC-KMAC(7)).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHAKE/#identities","title":"Identities","text":"

                                                                                                                                                                                                      This implementation is available in the FIPS provider as well as the default provider, and includes the following varieties:

                                                                                                                                                                                                      • KECCAK-KMAC-128

                                                                                                                                                                                                        Known names are \"KECCAK-KMAC-128\" and \"KECCAK-KMAC128\". This is used by EVP_MAC-KMAC128(7). Using the notation from NIST FIPS 202 (Section 6.2), we have KECCAK-KMAC-128(M,\u00a0d) = KECCAK[256](M\u00a0||\u00a000,\u00a0d) (see the description of KMAC128 in Appendix A of NIST SP 800-185).

                                                                                                                                                                                                      • KECCAK-KMAC-256

                                                                                                                                                                                                        Known names are \"KECCAK-KMAC-256\" and \"KECCAK-KMAC256\". This is used by EVP_MAC-KMAC256(7). Using the notation from NIST FIPS 202 (Section 6.2), we have KECCAK-KMAC-256(M,\u00a0d) = KECCAK[512](M\u00a0||\u00a000,\u00a0d) (see the description of KMAC256 in Appendix A of NIST SP 800-185).

                                                                                                                                                                                                      • SHAKE-128

                                                                                                                                                                                                        Known names are \"SHAKE-128\" and \"SHAKE128\".

                                                                                                                                                                                                      • SHAKE-256

                                                                                                                                                                                                        Known names are \"SHAKE-256\" and \"SHAKE256\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHAKE/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHAKE/#settable-context-parameters","title":"Settable Context Parameters","text":"

                                                                                                                                                                                                      These implementations support the following OSSL_PARAM(3) entries, settable for an EVP_MD_CTX with EVP_MD_CTX_set_params(3):

                                                                                                                                                                                                      • \"xoflen\" (OSSL_DIGEST_PARAM_XOFLEN) <unsigned integer>

                                                                                                                                                                                                        Sets the digest length for extendable output functions. The length of the \"xoflen\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                        For backwards compatibility reasons the default xoflen length for SHAKE-128 is 16 (bytes) which results in a security strength of only 64 bits. To ensure the maximum security strength of 128 bits, the xoflen should be set to at least 32.

                                                                                                                                                                                                        For backwards compatibility reasons the default xoflen length for SHAKE-256 is 32 (bytes) which results in a security strength of only 128 bits. To ensure the maximum security strength of 256 bits, the xoflen should be set to at least 64.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHAKE/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MD_CTX_set_params(3), provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SHAKE/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SM3/","title":"EVP_MD-SM3","text":""},{"location":"man7/EVP_MD-SM3/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-SM3 - The SM3 EVP_MD implementations

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SM3/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing SM3 digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SM3/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is only available with the default provider, and is identified with the name \"SM3\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SM3/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SM3/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-SM3/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-WHIRLPOOL/","title":"EVP_MD-WHIRLPOOL","text":""},{"location":"man7/EVP_MD-WHIRLPOOL/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-WHIRLPOOL - The WHIRLPOOL EVP_MD implementation

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-WHIRLPOOL/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      Support for computing WHIRLPOOL digests through the EVP_MD API.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-WHIRLPOOL/#identity","title":"Identity","text":"

                                                                                                                                                                                                      This implementation is only available with the legacy provider, and is identified with the name \"WHIRLPOOL\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-WHIRLPOOL/#gettable-parameters","title":"Gettable Parameters","text":"

                                                                                                                                                                                                      This implementation supports the common gettable parameters described in EVP_MD-common(7).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-WHIRLPOOL/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      provider-digest(7), OSSL_PROVIDER-default(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-WHIRLPOOL/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-common/","title":"EVP_MD-common","text":""},{"location":"man7/EVP_MD-common/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_MD-common - The OpenSSL EVP_MD implementations, common things

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-common/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      All the OpenSSL EVP_MD implementations understand the following OSSL_PARAM(3) entries that are gettable with EVP_MD_get_params(3), as well as these:

                                                                                                                                                                                                      • \"blocksize\" (OSSL_DIGEST_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                                                                                                        The digest block size. The length of the \"blocksize\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                        This value can also be retrieved with EVP_MD_get_block_size(3).

                                                                                                                                                                                                      • \"size\" (OSSL_DIGEST_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                        The digest output size. The length of the \"size\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                        This value can also be retrieved with EVP_MD_get_size(3).

                                                                                                                                                                                                      • \"flags\" (OSSL_DIGEST_PARAM_FLAGS) <unsigned integer>

                                                                                                                                                                                                        Diverse flags that describe exceptional behaviour for the digest. These flags are described in \"DESCRIPTION\" in EVP_MD_meth_set_flags(3).

                                                                                                                                                                                                        The length of the \"flags\" parameter should equal that of an unsigned long int.

                                                                                                                                                                                                        This value can also be retrieved with EVP_MD_get_flags(3).

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-common/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                      EVP_MD_get_params(3), provider-digest(7)

                                                                                                                                                                                                      "},{"location":"man7/EVP_MD-common/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-DH/","title":"EVP_PKEY-DH","text":""},{"location":"man7/EVP_PKEY-DH/#name","title":"NAME","text":"

                                                                                                                                                                                                      EVP_PKEY-DH, EVP_PKEY-DHX, EVP_KEYMGMT-DH, EVP_KEYMGMT-DHX - EVP_PKEY DH and DHX keytype and algorithm support

                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-DH/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                      For DH FFC key agreement, two classes of domain parameters can be used: \"safe\" domain parameters that are associated with approved named safe-prime groups, and a class of \"FIPS186-type\" domain parameters. FIPS186-type domain parameters should only be used for backward compatibility with existing applications that cannot be upgraded to use the approved safe-prime groups.

                                                                                                                                                                                                      See EVP_PKEY-FFC(7) for more information about FFC keys.

                                                                                                                                                                                                      The DH key type uses PKCS#3 format which saves p and g, but not the q value. The DHX key type uses X9.42 format which saves the value of q and this must be used for FIPS186-4. If key validation is required, users should be aware of the nuances associated with FIPS186-4 style parameters as discussed in \"DH key validation\".

                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-DH/#dh-and-dhx-domain-parameters","title":"DH and DHX domain parameters","text":"

                                                                                                                                                                                                      In addition to the common FCC parameters that all FFC keytypes should support (see \"FFC parameters\" in EVP_PKEY-FFC(7)) the DHX and DH keytype implementations support the following:

                                                                                                                                                                                                      • \"group\" (OSSL_PKEY_PARAM_GROUP_NAME)

                                                                                                                                                                                                        Sets or gets a string that associates a DH or DHX named safe prime group with known values for p, q and g.

                                                                                                                                                                                                        The following values can be used by the OpenSSL's default and FIPS providers: \"ffdhe2048\", \"ffdhe3072\", \"ffdhe4096\", \"ffdhe6144\", \"ffdhe8192\", \"modp_2048\", \"modp_3072\", \"modp_4096\", \"modp_6144\", \"modp_8192\".

                                                                                                                                                                                                        The following additional values can also be used by OpenSSL's default provider: \"modp_1536\", \"dh_1024_160\", \"dh_2048_224\", \"dh_2048_256\".

                                                                                                                                                                                                        DH/DHX named groups can be easily validated since the parameters are well known. For protocols that only transfer p and g the value of q can also be retrieved.

                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-DH/#dh-and-dhx-additional-parameters","title":"DH and DHX additional parameters","text":"
                                                                                                                                                                                                        • \"encoded-pub-key\" (OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY) <octet string>

                                                                                                                                                                                                          Used for getting and setting the encoding of the DH public key used in a key exchange message for the TLS protocol. See EVP_PKEY_set1_encoded_public_key() and EVP_PKEY_get1_encoded_public_key().

                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-DH/#dh-additional-domain-parameters","title":"DH additional domain parameters","text":"
                                                                                                                                                                                                        • \"safeprime-generator\" (OSSL_PKEY_PARAM_DH_GENERATOR) <integer>

                                                                                                                                                                                                          Used for DH generation of safe primes using the old safe prime generator code. The default value is 2. It is recommended to use a named safe prime group instead, if domain parameter validation is required.

                                                                                                                                                                                                          Randomly generated safe primes are not allowed by FIPS, so setting this value for the OpenSSL FIPS provider will instead choose a named safe prime group based on the size of p.

                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-DH/#dh-and-dhx-domain-parameter-key-generation-parameters","title":"DH and DHX domain parameter / key generation parameters","text":"

                                                                                                                                                                                                        In addition to the common FFC key generation parameters that all FFC key types should support (see \"FFC key generation parameters\" in EVP_PKEY-FFC(7)) the DH and DHX keytype implementation supports the following:

                                                                                                                                                                                                        • \"type\" (OSSL_PKEY_PARAM_FFC_TYPE)

                                                                                                                                                                                                          Sets the type of parameter generation. For DH valid values are:

                                                                                                                                                                                                          • \"fips186_4\"
                                                                                                                                                                                                          • \"default\"
                                                                                                                                                                                                          • \"fips186_2\"

                                                                                                                                                                                                            These are described in \"FFC key generation parameters\" in EVP_PKEY-FFC(7)

                                                                                                                                                                                                          • \"group\"

                                                                                                                                                                                                            This specifies that a named safe prime name will be chosen using the \"pbits\" type.

                                                                                                                                                                                                          • \"generator\"

                                                                                                                                                                                                            A safe prime generator. See the \"safeprime-generator\" type above. This is only valid for DH keys.

                                                                                                                                                                                                        • \"pbits\" (OSSL_PKEY_PARAM_FFC_PBITS) <unsigned integer>

                                                                                                                                                                                                          Sets the size (in bits) of the prime 'p'.

                                                                                                                                                                                                          For \"fips186_4\" this must be 2048. For \"fips186_2\" this must be 1024. For \"group\" this can be any one of 2048, 3072, 4096, 6144 or 8192.

                                                                                                                                                                                                        • \"priv_len\" (OSSL_PKEY_PARAM_DH_PRIV_LEN) <integer>

                                                                                                                                                                                                          An optional value to set the maximum length of the generated private key. The default value used if this is not set is the maximum value of BN_num_bits(q)). The minimum value that this can be set to is 2 * s. Where s is the security strength of the key which has values of 112, 128, 152, 176 and 200 for key sizes of 2048, 3072, 4096, 6144 and 8192.

                                                                                                                                                                                                        • "},{"location":"man7/EVP_PKEY-DH/#dh-key-validation","title":"DH key validation","text":"

                                                                                                                                                                                                          For DHX that is not a named group the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for seed, pcounter and gindex or hindex may need to be stored for validation purposes. For DHX the seed and pcounter can be stored in ASN1 data (but the gindex or hindex cannot be stored). It is recommended to use a named safe prime group instead.

                                                                                                                                                                                                          For DH keys, EVP_PKEY_param_check(3) behaves in the following way: The OpenSSL FIPS provider tests if the parameters are either an approved safe prime group OR that the FFC parameters conform to FIPS186-4 as defined in SP800-56Ar3 Assurances of Domain-Parameter Validity. The OpenSSL default provider uses simpler checks that allows there to be no q value for backwards compatibility.

                                                                                                                                                                                                          For DH keys, EVP_PKEY_param_check_quick(3) is equivalent to EVP_PKEY_param_check(3).

                                                                                                                                                                                                          For DH keys, EVP_PKEY_public_check(3) conforms to SP800-56Ar3 FFC Full Public-Key Validation.

                                                                                                                                                                                                          For DH keys, EVP_PKEY_public_check_quick(3) conforms to SP800-56Ar3 FFC Partial Public-Key Validation when the DH key is an approved named safe prime group, otherwise it is the same as EVP_PKEY_public_check(3).

                                                                                                                                                                                                          For DH Keys, EVP_PKEY_private_check(3) tests that the private key is in the correct range according to SP800-56Ar3. The OpenSSL FIPS provider requires the value of q to be set (note that this is set for named safe prime groups). For backwards compatibility the OpenSSL default provider only requires p to be set.

                                                                                                                                                                                                          For DH keys, EVP_PKEY_pairwise_check(3) conforms to SP800-56Ar3 Owner Assurance of Pair-wise Consistency.

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DH/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                          An EVP_PKEY context can be obtained by calling:

                                                                                                                                                                                                          EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"DH\", NULL);\n

                                                                                                                                                                                                          A DH key can be generated with a named safe prime group by calling:

                                                                                                                                                                                                          int priv_len = 2 * 112;\nOSSL_PARAM params[3];\nEVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"DH\", NULL);\n\nparams[0] = OSSL_PARAM_construct_utf8_string(\"group\", \"ffdhe2048\", 0);\n/* \"priv_len\" is optional */\nparams[1] = OSSL_PARAM_construct_int(\"priv_len\", &priv_len);\nparams[2] = OSSL_PARAM_construct_end();\n\nEVP_PKEY_keygen_init(pctx);\nEVP_PKEY_CTX_set_params(pctx, params);\nEVP_PKEY_generate(pctx, &pkey);\n...\nEVP_PKEY_free(pkey);\nEVP_PKEY_CTX_free(pctx);\n

                                                                                                                                                                                                          DHX domain parameters can be generated according to FIPS186-4 by calling:

                                                                                                                                                                                                          int gindex = 2;\nunsigned int pbits = 2048;\nunsigned int qbits = 256;\nOSSL_PARAM params[6];\nEVP_PKEY *param_key = NULL;\nEVP_PKEY_CTX *pctx = NULL;\n\npctx = EVP_PKEY_CTX_new_from_name(NULL, \"DHX\", NULL);\nEVP_PKEY_paramgen_init(pctx);\n\nparams[0] = OSSL_PARAM_construct_uint(\"pbits\", &pbits);\nparams[1] = OSSL_PARAM_construct_uint(\"qbits\", &qbits);\nparams[2] = OSSL_PARAM_construct_int(\"gindex\", &gindex);\nparams[3] = OSSL_PARAM_construct_utf8_string(\"type\", \"fips186_4\", 0);\nparams[4] = OSSL_PARAM_construct_utf8_string(\"digest\", \"SHA256\", 0);\nparams[5] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(pctx, params);\n\nEVP_PKEY_generate(pctx, &param_key);\n\nEVP_PKEY_print_params(bio_out, param_key, 0, NULL);\n...\nEVP_PKEY_free(param_key);\nEVP_PKEY_CTX_free(pctx);\n

                                                                                                                                                                                                          A DH key can be generated using domain parameters by calling:

                                                                                                                                                                                                          EVP_PKEY *key = NULL;\nEVP_PKEY_CTX *gctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);\n\nEVP_PKEY_keygen_init(gctx);\nEVP_PKEY_generate(gctx, &key);\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n...\nEVP_PKEY_free(key);\nEVP_PKEY_CTX_free(gctx);\n

                                                                                                                                                                                                          To validate FIPS186-4 DHX domain parameters decoded from PEM or DER data, additional values used during generation may be required to be set into the key.

                                                                                                                                                                                                          EVP_PKEY_todata(), OSSL_PARAM_merge(), and EVP_PKEY_fromdata() are useful to add these parameters to the original key or domain parameters before the actual validation. In production code the return values should be checked.

                                                                                                                                                                                                          EVP_PKEY *received_domp = ...; /* parameters received and decoded */\nunsigned char *seed = ...;     /* and additional parameters received */\nsize_t seedlen = ...;          /* by other means, required */\nint gindex = ...;              /* for the validation */\nint pcounter = ...;\nint hindex = ...;\nOSSL_PARAM extra_params[4];\nOSSL_PARAM *domain_params = NULL;\nOSSL_PARAM *merged_params = NULL;\nEVP_PKEY_CTX *ctx = NULL, *validate_ctx = NULL;\nEVP_PKEY *complete_domp = NULL;\n\nEVP_PKEY_todata(received_domp, OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,\n                &domain_params);\nextra_params[0] = OSSL_PARAM_construct_octet_string(\"seed\", seed, seedlen);\n/*\n * NOTE: For unverifiable g use \"hindex\" instead of \"gindex\"\n * extra_params[1] = OSSL_PARAM_construct_int(\"hindex\", &hindex);\n */\nextra_params[1] = OSSL_PARAM_construct_int(\"gindex\", &gindex);\nextra_params[2] = OSSL_PARAM_construct_int(\"pcounter\", &pcounter);\nextra_params[3] = OSSL_PARAM_construct_end();\nmerged_params = OSSL_PARAM_merge(domain_params, extra_params);\n\nctx = EVP_PKEY_CTX_new_from_name(NULL, \"DHX\", NULL);\nEVP_PKEY_fromdata_init(ctx);\nEVP_PKEY_fromdata(ctx, &complete_domp, OSSL_KEYMGMT_SELECT_ALL,\n                  merged_params);\n\nvalidate_ctx = EVP_PKEY_CTX_new_from_pkey(NULL, complete_domp, NULL);\nif (EVP_PKEY_param_check(validate_ctx) > 0)\n    /* validation_passed(); */\nelse\n    /* validation_failed(); */\n\nOSSL_PARAM_free(domain_params);\nOSSL_PARAM_free(merged_params);\nEVP_PKEY_CTX_free(ctx);\nEVP_PKEY_CTX_free(validate_ctx);\nEVP_PKEY_free(complete_domp);\n
                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DH/#conforming-to","title":"CONFORMING TO","text":"
                                                                                                                                                                                                          • RFC 7919 (TLS ffdhe named safe prime groups)
                                                                                                                                                                                                          • RFC 3526 (IKE modp named safe prime groups)
                                                                                                                                                                                                          • RFC 5114 (Additional DH named groups for dh_1024_160\", \"dh_2048_224\" and \"dh_2048_256\").

                                                                                                                                                                                                          The following sections of SP800-56Ar3:

                                                                                                                                                                                                          • 5.5.1.1 FFC Domain Parameter Selection/Generation
                                                                                                                                                                                                          • Appendix D: FFC Safe-prime Groups

                                                                                                                                                                                                          The following sections of FIPS186-4:

                                                                                                                                                                                                          • A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
                                                                                                                                                                                                          • A.2.3 Generation of canonical generator g.
                                                                                                                                                                                                          • A.2.1 Unverifiable Generation of the Generator g.
                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DH/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                          EVP_PKEY-FFC(7), EVP_KEYEXCH-DH(7) EVP_PKEY(3), provider-keymgmt(7), EVP_KEYMGMT(3), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7)

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DH/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/","title":"EVP_PKEY-DSA","text":""},{"location":"man7/EVP_PKEY-DSA/#name","title":"NAME","text":"

                                                                                                                                                                                                          EVP_PKEY-DSA, EVP_KEYMGMT-DSA - EVP_PKEY DSA keytype and algorithm support

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                          For DSA the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for seed, pcounter and gindex may need to be stored for validation purposes. For DSA these fields are not stored in the ASN1 data so they need to be stored externally if validation is required.

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#dsa-parameters","title":"DSA parameters","text":"

                                                                                                                                                                                                          The DSA key type supports the FFC parameters (see \"FFC parameters\" in EVP_PKEY-FFC(7)).

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#dsa-key-generation-parameters","title":"DSA key generation parameters","text":"

                                                                                                                                                                                                          The DSA key type supports the FFC key generation parameters (see \"FFC key generation parameters\" in EVP_PKEY-FFC(7)

                                                                                                                                                                                                          The following restrictions apply to the \"pbits\" field:

                                                                                                                                                                                                          For \"fips186_4\" this must be either 2048 or 3072. For \"fips186_2\" this must be 1024. For \"group\" this can be any one of 2048, 3072, 4096, 6144 or 8192.

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#dsa-key-validation","title":"DSA key validation","text":"

                                                                                                                                                                                                          For DSA keys, EVP_PKEY_param_check(3) behaves in the following way: The OpenSSL FIPS provider conforms to the rules within the FIPS186-4 standard for FFC parameter validation. For backwards compatibility the OpenSSL default provider uses a much simpler check (see below) for parameter validation, unless the seed parameter is set.

                                                                                                                                                                                                          For DSA keys, EVP_PKEY_param_check_quick(3) behaves in the following way: A simple check of L and N and partial g is performed. The default provider also supports validation of legacy \"fips186_2\" keys.

                                                                                                                                                                                                          For DSA keys, EVP_PKEY_public_check(3), EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3) the OpenSSL default and FIPS providers conform to the rules within SP800-56Ar3 for public, private and pairwise tests respectively.

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                          An EVP_PKEY context can be obtained by calling:

                                                                                                                                                                                                          EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"DSA\", NULL);\n

                                                                                                                                                                                                          The DSA domain parameters can be generated by calling:

                                                                                                                                                                                                          unsigned int pbits = 2048;\nunsigned int qbits = 256;\nint gindex = 1;\nOSSL_PARAM params[5];\nEVP_PKEY *param_key = NULL;\nEVP_PKEY_CTX *pctx = NULL;\n\npctx = EVP_PKEY_CTX_new_from_name(NULL, \"DSA\", NULL);\nEVP_PKEY_paramgen_init(pctx);\n\nparams[0] = OSSL_PARAM_construct_uint(\"pbits\", &pbits);\nparams[1] = OSSL_PARAM_construct_uint(\"qbits\", &qbits);\nparams[2] = OSSL_PARAM_construct_int(\"gindex\", &gindex);\nparams[3] = OSSL_PARAM_construct_utf8_string(\"digest\", \"SHA384\", 0);\nparams[4] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(pctx, params);\n\nEVP_PKEY_generate(pctx, &param_key);\nEVP_PKEY_CTX_free(pctx);\n\nEVP_PKEY_print_params(bio_out, param_key, 0, NULL);\n

                                                                                                                                                                                                          A DSA key can be generated using domain parameters by calling:

                                                                                                                                                                                                          EVP_PKEY *key = NULL;\nEVP_PKEY_CTX *gctx = NULL;\n\ngctx = EVP_PKEY_CTX_new_from_pkey(NULL, param_key, NULL);\nEVP_PKEY_keygen_init(gctx);\nEVP_PKEY_generate(gctx, &key);\nEVP_PKEY_CTX_free(gctx);\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n
                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                                          The following sections of FIPS186-4:

                                                                                                                                                                                                          • A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
                                                                                                                                                                                                          • A.2.3 Generation of canonical generator g.
                                                                                                                                                                                                          • A.2.1 Unverifiable Generation of the Generator g.
                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                          EVP_PKEY-FFC(7), EVP_SIGNATURE-DSA(7) EVP_PKEY(3), provider-keymgmt(7), EVP_KEYMGMT(3), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7)

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-DSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-EC/","title":"EVP_PKEY-EC","text":""},{"location":"man7/EVP_PKEY-EC/#name","title":"NAME","text":"

                                                                                                                                                                                                          EVP_PKEY-EC, EVP_KEYMGMT-EC - EVP_PKEY EC keytype and algorithm support

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-EC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                          The EC keytype is implemented in OpenSSL's default provider.

                                                                                                                                                                                                          "},{"location":"man7/EVP_PKEY-EC/#common-ec-parameters","title":"Common EC parameters","text":"

                                                                                                                                                                                                          The normal way of specifying domain parameters for an EC curve is via the curve name \"group\". For curves with no curve name, explicit parameters can be used that specify \"field-type\", \"p\", \"a\", \"b\", \"generator\" and \"order\". Explicit parameters are supported for backwards compatibility reasons, but they are not compliant with multiple standards (including RFC5915) which only allow named curves.

                                                                                                                                                                                                          The following KeyGen/Gettable/Import/Export types are available for the built-in EC algorithm:

                                                                                                                                                                                                          • \"group\" (OSSL_PKEY_PARAM_GROUP_NAME)

                                                                                                                                                                                                            The curve name.

                                                                                                                                                                                                          • \"field-type\" (OSSL_PKEY_PARAM_EC_FIELD_TYPE)

                                                                                                                                                                                                            The value should be either \"prime-field\" or \"characteristic-two-field\", which correspond to prime field Fp and binary field F2^m.

                                                                                                                                                                                                          • \"p\" (OSSL_PKEY_PARAM_EC_P) <unsigned integer>

                                                                                                                                                                                                            For a curve over Fp p is the prime for the field. For a curve over F2^m p represents the irreducible polynomial - each bit represents a term in the polynomial. Therefore, there will either be three or five bits set dependent on whether the polynomial is a trinomial or a pentanomial.

                                                                                                                                                                                                          • \"a\" (OSSL_PKEY_PARAM_EC_A) <unsigned integer>

                                                                                                                                                                                                          • \"b\" (OSSL_PKEY_PARAM_EC_B) <unsigned integer>
                                                                                                                                                                                                          • \"seed\" (OSSL_PKEY_PARAM_EC_SEED) <octet string>

                                                                                                                                                                                                            a and b represents the coefficients of the curve For Fp: y^2 mod p = x^3 +ax + b mod p OR For F2^m: y^2 + xy = x^3 + ax^2 + b

                                                                                                                                                                                                            seed is an optional value that is for information purposes only. It represents the random number seed used to generate the coefficient b from a random number.

                                                                                                                                                                                                          • \"generator\" (OSSL_PKEY_PARAM_EC_GENERATOR) <octet string>

                                                                                                                                                                                                          • \"order\" (OSSL_PKEY_PARAM_EC_ORDER) <unsigned integer>
                                                                                                                                                                                                          • \"cofactor\" (OSSL_PKEY_PARAM_EC_COFACTOR) <unsigned integer>

                                                                                                                                                                                                            The generator is a well defined point on the curve chosen for cryptographic operations. The encoding conforms with Sec. 2.3.3 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. See EC_POINT_oct2point(). Integers used for point multiplications will be between 0 and order - 1. cofactor is an optional value. order multiplied by the cofactor gives the number of points on the curve.

                                                                                                                                                                                                          • \"decoded-from-explicit\" (OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS) <integer>

                                                                                                                                                                                                            Gets a flag indicating whether the key or parameters were decoded from explicit curve parameters. Set to 1 if so or 0 if a named curve was used.

                                                                                                                                                                                                          • \"use-cofactor-flag\" (OSSL_PKEY_PARAM_USE_COFACTOR_ECDH) <integer>

                                                                                                                                                                                                            Enable Cofactor DH (ECC CDH) if this value is 1, otherwise it uses normal EC DH if the value is zero. The cofactor variant multiplies the shared secret by the EC curve's cofactor (note for some curves the cofactor is 1).

                                                                                                                                                                                                            See also EVP_KEYEXCH-ECDH(7) for the related OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE parameter that can be set on a per-operation basis.

                                                                                                                                                                                                          • \"encoding\" (OSSL_PKEY_PARAM_EC_ENCODING)

                                                                                                                                                                                                            Set the format used for serializing the EC group parameters. Valid values are \"explicit\" or \"named_curve\". The default value is \"named_curve\".

                                                                                                                                                                                                          • \"point-format\" (OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT)

                                                                                                                                                                                                            Sets or gets the point_conversion_form for the key. For a description of point_conversion_forms please see EC_POINT_new(3). Valid values are \"uncompressed\" or \"compressed\". The default value is \"uncompressed\".

                                                                                                                                                                                                          • \"group-check\" (OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE)

                                                                                                                                                                                                            Sets or Gets the type of group check done when EVP_PKEY_param_check() is called. Valid values are \"default\", \"named\" and \"named-nist\". The \"named\" type checks that the domain parameters match the inbuilt curve parameters, \"named-nist\" is similar but also checks that the named curve is a nist curve. The \"default\" type does domain parameter validation for the OpenSSL default provider, but is equivalent to \"named-nist\" for the OpenSSL FIPS provider.

                                                                                                                                                                                                          • \"include-public\" (OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC) <integer>

                                                                                                                                                                                                            Setting this value to 0 indicates that the public key should not be included when encoding the private key. The default value of 1 will include the public key.

                                                                                                                                                                                                          • \"pub\" (OSSL_PKEY_PARAM_PUB_KEY) <octet string>

                                                                                                                                                                                                            The public key value in encoded EC point format conforming to Sec. 2.3.3 and 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard. This parameter is used when importing or exporting the public key value with the EVP_PKEY_fromdata() and EVP_PKEY_todata() functions.

                                                                                                                                                                                                            Note, in particular, that the choice of point compression format used for encoding the exported value via EVP_PKEY_todata() depends on the underlying provider implementation. Before OpenSSL 3.0.8, the implementation of providers included with OpenSSL always opted for an encoding in compressed format, unconditionally. Since OpenSSL 3.0.8, the implementation has been changed to honor the OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT parameter, if set, or to default to uncompressed format.

                                                                                                                                                                                                          • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>

                                                                                                                                                                                                            The private key value.

                                                                                                                                                                                                          • \"encoded-pub-key\" (OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY) <octet string>

                                                                                                                                                                                                            Used for getting and setting the encoding of an EC public key. The public key is expected to be a point conforming to Sec. 2.3.4 of the SECG SEC 1 (\"Elliptic Curve Cryptography\") standard.

                                                                                                                                                                                                          • \"qx\" (OSSL_PKEY_PARAM_EC_PUB_X) <unsigned integer>

                                                                                                                                                                                                            Used for getting the EC public key X component.

                                                                                                                                                                                                          • \"qy\" (OSSL_PKEY_PARAM_EC_PUB_Y) <unsigned integer>

                                                                                                                                                                                                            Used for getting the EC public key Y component.

                                                                                                                                                                                                          • \"default-digest\" (OSSL_PKEY_PARAM_DEFAULT_DIGEST)

                                                                                                                                                                                                            Getter that returns the default digest name. (Currently returns \"SHA256\" as of OpenSSL 3.0).

                                                                                                                                                                                                            The following Gettable types are also available for the built-in EC algorithm:

                                                                                                                                                                                                            • \"basis-type\" (OSSL_PKEY_PARAM_EC_CHAR2_TYPE)

                                                                                                                                                                                                              Supports the values \"tpBasis\" for a trinomial or \"ppBasis\" for a pentanomial. This field is only used for a binary field F2^m.

                                                                                                                                                                                                            • \"m\" (OSSL_PKEY_PARAM_EC_CHAR2_M) <integer>

                                                                                                                                                                                                            • \"tp\" (OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS) <integer>
                                                                                                                                                                                                            • \"k1\" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K1) <integer>
                                                                                                                                                                                                            • \"k2\" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K2) <integer>
                                                                                                                                                                                                            • \"k3\" (OSSL_PKEY_PARAM_EC_CHAR2_PP_K3) <integer>

                                                                                                                                                                                                              These fields are only used for a binary field F2^m. m is the degree of the binary field.

                                                                                                                                                                                                              tp is the middle bit of a trinomial so its value must be in the range m > tp > 0.

                                                                                                                                                                                                              k1, k2 and k3 are used to get the middle bits of a pentanomial such that m > k3 > k2 > k1 > 0

                                                                                                                                                                                                            • "},{"location":"man7/EVP_PKEY-EC/#ec-key-validation","title":"EC key validation","text":"

                                                                                                                                                                                                              For EC keys, EVP_PKEY_param_check(3) behaves in the following way: For the OpenSSL default provider it uses either EC_GROUP_check(3) or EC_GROUP_check_named_curve(3) depending on the flag EC_FLAG_CHECK_NAMED_GROUP. The OpenSSL FIPS provider uses EC_GROUP_check_named_curve(3) in order to conform to SP800-56Ar3 Assurances of Domain-Parameter Validity.

                                                                                                                                                                                                              For EC keys, EVP_PKEY_param_check_quick(3) is equivalent to EVP_PKEY_param_check(3).

                                                                                                                                                                                                              For EC keys, EVP_PKEY_public_check(3) and EVP_PKEY_public_check_quick(3) conform to SP800-56Ar3 ECC Full Public-Key Validation and ECC Partial Public-Key Validation respectively.

                                                                                                                                                                                                              For EC Keys, EVP_PKEY_private_check(3) and EVP_PKEY_pairwise_check(3) conform to SP800-56Ar3 Private key validity and Owner Assurance of Pair-wise Consistency respectively.

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-EC/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                              An EVP_PKEY context can be obtained by calling:

                                                                                                                                                                                                              EVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n

                                                                                                                                                                                                              An EVP_PKEY ECDSA or ECDH key can be generated with a \"P-256\" named group by calling:

                                                                                                                                                                                                              pkey = EVP_EC_gen(\"P-256\");\n

                                                                                                                                                                                                              or like this:

                                                                                                                                                                                                              EVP_PKEY *key = NULL;\nOSSL_PARAM params[2];\nEVP_PKEY_CTX *gctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n\nEVP_PKEY_keygen_init(gctx);\n\nparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,\n                                             \"P-256\", 0);\nparams[1] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(gctx, params);\n\nEVP_PKEY_generate(gctx, &key);\n\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n...\nEVP_PKEY_free(key);\nEVP_PKEY_CTX_free(gctx);\n

                                                                                                                                                                                                              An EVP_PKEY EC CDH (Cofactor Diffie-Hellman) key can be generated with a \"K-571\" named group by calling:

                                                                                                                                                                                                              int use_cdh = 1;\nEVP_PKEY *key = NULL;\nOSSL_PARAM params[3];\nEVP_PKEY_CTX *gctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"EC\", NULL);\n\nEVP_PKEY_keygen_init(gctx);\n\nparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME,\n                                             \"K-571\", 0);\n/*\n * This curve has a cofactor that is not 1 - so setting CDH mode changes\n * the behaviour. For many curves the cofactor is 1 - so setting this has\n * no effect.\n */\nparams[1] = OSSL_PARAM_construct_int(OSSL_PKEY_PARAM_USE_COFACTOR_ECDH,\n                                     &use_cdh);\nparams[2] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(gctx, params);\n\nEVP_PKEY_generate(gctx, &key);\nEVP_PKEY_print_private(bio_out, key, 0, NULL);\n...\nEVP_PKEY_free(key);\nEVP_PKEY_CTX_free(gctx);\n
                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-EC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                              EVP_EC_gen(3), EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7), EVP_SIGNATURE-ECDSA(7), EVP_KEYEXCH-ECDH(7)

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-EC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                              Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-FFC/","title":"EVP_PKEY-FFC","text":""},{"location":"man7/EVP_PKEY-FFC/#name","title":"NAME","text":"

                                                                                                                                                                                                              EVP_PKEY-FFC - EVP_PKEY DSA and DH/DHX shared FFC parameters.

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-FFC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                              Finite field cryptography (FFC) is a method of implementing discrete logarithm cryptography using finite field mathematics. DSA is an example of FFC and Diffie-Hellman key establishment algorithms specified in SP800-56A can also be implemented as FFC.

                                                                                                                                                                                                              The DSA, DH and DHX keytypes are implemented in OpenSSL's default and FIPS providers. The implementations support the basic DSA, DH and DHX keys, containing the public and private keys pub and priv as well as the three main domain parameters p, q and g.

                                                                                                                                                                                                              For DSA (and DH that is not a named group) the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for seed, pcounter and gindex may need to be stored for validation purposes. For DH the seed and pcounter can be stored in ASN1 data (but the gindex is not). For DSA however, these fields are not stored in the ASN1 data so they need to be stored externally if validation is required.

                                                                                                                                                                                                              The DH key type uses PKCS#3 format which saves p and g, but not the 'q' value. The DHX key type uses X9.42 format which saves the value of 'q' and this must be used for FIPS186-4.

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-FFC/#ffc-parameters","title":"FFC parameters","text":"

                                                                                                                                                                                                              In addition to the common parameters that all keytypes should support (see \"Common parameters\" in provider-keymgmt(7)), the DSA, DH and DHX keytype implementations support the following.

                                                                                                                                                                                                              • \"pub\" (OSSL_PKEY_PARAM_PUB_KEY) <unsigned integer>

                                                                                                                                                                                                                The public key value.

                                                                                                                                                                                                              • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>

                                                                                                                                                                                                                The private key value.

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-FFC/#ffc-dsa-dh-and-dhx-domain-parameters","title":"FFC DSA, DH and DHX domain parameters","text":"
                                                                                                                                                                                                              • \"p\" (OSSL_PKEY_PARAM_FFC_P) <unsigned integer>

                                                                                                                                                                                                                A DSA or Diffie-Hellman prime \"p\" value.

                                                                                                                                                                                                              • \"g\" (OSSL_PKEY_PARAM_FFC_G) <unsigned integer>

                                                                                                                                                                                                                A DSA or Diffie-Hellman generator \"g\" value.

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-FFC/#ffc-dsa-and-dhx-domain-parameters","title":"FFC DSA and DHX domain parameters","text":"
                                                                                                                                                                                                              • \"q\" (OSSL_PKEY_PARAM_FFC_Q) <unsigned integer>

                                                                                                                                                                                                                A DSA or Diffie-Hellman prime \"q\" value.

                                                                                                                                                                                                              • \"seed\" (OSSL_PKEY_PARAM_FFC_SEED) <octet string>

                                                                                                                                                                                                                An optional domain parameter seed value used during generation and validation of p, q and canonical g. For validation this needs to set the seed that was produced during generation.

                                                                                                                                                                                                              • \"gindex\" (OSSL_PKEY_PARAM_FFC_GINDEX) <integer>

                                                                                                                                                                                                                Sets the index to use for canonical generation and verification of the generator g. Set this to a positive value from 0..FF to use this mode. This gindex can then be reused during key validation to verify the value of g. If this value is not set or is -1 then unverifiable generation of the generator g will be used.

                                                                                                                                                                                                              • \"pcounter\" (OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer>

                                                                                                                                                                                                                An optional domain parameter counter value that is output during generation of p. This value must be saved if domain parameter validation is required.

                                                                                                                                                                                                              • \"hindex\" (OSSL_PKEY_PARAM_FFC_H) <integer>

                                                                                                                                                                                                                For unverifiable generation of the generator g this value is output during generation of g. Its value is the first integer larger than one that satisfies g = h^j mod p (where g != 1 and \"j\" is the cofactor).

                                                                                                                                                                                                              • \"j\" (OSSL_PKEY_PARAM_FFC_COFACTOR) <unsigned integer>

                                                                                                                                                                                                                An optional informational cofactor parameter that should equal to (p - 1) / q.

                                                                                                                                                                                                              • \"validate-pq\" (OSSL_PKEY_PARAM_FFC_VALIDATE_PQ) <unsigned integer>

                                                                                                                                                                                                              • \"validate-g\" (OSSL_PKEY_PARAM_FFC_VALIDATE_G) <unsigned integer>

                                                                                                                                                                                                                These boolean values are used during FIPS186-4 or FIPS186-2 key validation checks (See EVP_PKEY_param_check(3)) to select validation options. By default validate-pq and validate-g are both set to 1 to check that p,q and g are valid. Either of these may be set to 0 to skip a test, which is mainly useful for testing purposes.

                                                                                                                                                                                                              • \"validate-legacy\" (OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY) <unsigned integer>

                                                                                                                                                                                                                This boolean value is used during key validation checks (See EVP_PKEY_param_check(3)) to select the validation type. The default value of 0 selects FIPS186-4 validation. Setting this value to 1 selects FIPS186-2 validation.

                                                                                                                                                                                                              "},{"location":"man7/EVP_PKEY-FFC/#ffc-key-generation-parameters","title":"FFC key generation parameters","text":"

                                                                                                                                                                                                              The following key generation types are available for DSA and DHX algorithms:

                                                                                                                                                                                                              • \"type\" (OSSL_PKEY_PARAM_FFC_TYPE)

                                                                                                                                                                                                                Sets the type of parameter generation. The shared valid values are:

                                                                                                                                                                                                                • \"fips186_4\"

                                                                                                                                                                                                                  The current standard.

                                                                                                                                                                                                                • \"fips186_2\"

                                                                                                                                                                                                                  The old standard that should only be used for legacy purposes.

                                                                                                                                                                                                                • \"default\"

                                                                                                                                                                                                                  This can choose one of \"fips186_4\" or \"fips186_2\" depending on other parameters set for parameter generation.

                                                                                                                                                                                                              • \"pbits\" (OSSL_PKEY_PARAM_FFC_PBITS) <unsigned integer>

                                                                                                                                                                                                                Sets the size (in bits) of the prime 'p'.

                                                                                                                                                                                                              • \"qbits\" (OSSL_PKEY_PARAM_FFC_QBITS) <unsigned integer>

                                                                                                                                                                                                                Sets the size (in bits) of the prime 'q'.

                                                                                                                                                                                                                For \"fips186_4\" this can be either 224 or 256. For \"fips186_2\" this has a size of 160.

                                                                                                                                                                                                              • \"digest\" (OSSL_PKEY_PARAM_FFC_DIGEST)

                                                                                                                                                                                                                Sets the Digest algorithm to be used as part of the Key Generation Function associated with the given Key Generation ctx. This must also be set for key validation.

                                                                                                                                                                                                              • \"properties\" (OSSL_PKEY_PARAM_FFC_DIGEST_PROPS)

                                                                                                                                                                                                                Sets properties to be used upon look up of the implementation for the selected Digest algorithm for the Key Generation Function associated with the given key generation ctx. This may also be set for key validation.

                                                                                                                                                                                                              • \"seed\" (OSSL_PKEY_PARAM_FFC_SEED) <octet string>

                                                                                                                                                                                                                For \"fips186_4\" or \"fips186_2\" generation this sets the seed data to use instead of generating a random seed internally. This should be used for testing purposes only. This will either produce fixed values for the generated parameters OR it will fail if the seed did not generate valid primes.

                                                                                                                                                                                                              • \"gindex\" (OSSL_PKEY_PARAM_FFC_GINDEX) <integer>

                                                                                                                                                                                                              • \"pcounter\" (OSSL_PKEY_PARAM_FFC_PCOUNTER) <integer>
                                                                                                                                                                                                              • \"hindex\" (OSSL_PKEY_PARAM_FFC_H) <integer>

                                                                                                                                                                                                                These types are described above.

                                                                                                                                                                                                              • "},{"location":"man7/EVP_PKEY-FFC/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                                                The following sections of SP800-56Ar3:

                                                                                                                                                                                                                • 5.5.1.1 FFC Domain Parameter Selection/Generation

                                                                                                                                                                                                                The following sections of FIPS186-4:

                                                                                                                                                                                                                • A.1.1.2 Generation of Probable Primes p and q Using an Approved Hash Function.
                                                                                                                                                                                                                • A.2.3 Generation of canonical generator g.
                                                                                                                                                                                                                • A.2.1 Unverifiable Generation of the Generator g.
                                                                                                                                                                                                                "},{"location":"man7/EVP_PKEY-FFC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_SIGNATURE-DSA(7), EVP_KEYEXCH-DH(7) EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7),

                                                                                                                                                                                                                "},{"location":"man7/EVP_PKEY-FFC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                "},{"location":"man7/EVP_PKEY-HMAC/","title":"EVP_PKEY-HMAC","text":""},{"location":"man7/EVP_PKEY-HMAC/#name","title":"NAME","text":"

                                                                                                                                                                                                                EVP_PKEY-HMAC, EVP_KEYMGMT-HMAC, EVP_PKEY-Siphash, EVP_KEYMGMT-Siphash, EVP_PKEY-Poly1305, EVP_KEYMGMT-Poly1305, EVP_PKEY-CMAC, EVP_KEYMGMT-CMAC - EVP_PKEY legacy MAC keytypes and algorithm support

                                                                                                                                                                                                                "},{"location":"man7/EVP_PKEY-HMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                The HMAC and CMAC key types are implemented in OpenSSL's default and FIPS providers. Additionally the Siphash and Poly1305 key types are implemented in the default provider. Performing MAC operations via an EVP_PKEY is considered legacy and are only available for backwards compatibility purposes and for a restricted set of algorithms. The preferred way of performing MAC operations is via the EVP_MAC APIs. See EVP_MAC_init(3).

                                                                                                                                                                                                                For further details on using EVP_PKEY based MAC keys see EVP_SIGNATURE-HMAC(7), EVP_SIGNATURE-Siphash(7), EVP_SIGNATURE-Poly1305(7) or EVP_SIGNATURE-CMAC(7).

                                                                                                                                                                                                                "},{"location":"man7/EVP_PKEY-HMAC/#common-mac-parameters","title":"Common MAC parameters","text":"

                                                                                                                                                                                                                All the MAC keytypes support the following parameters.

                                                                                                                                                                                                                • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string>

                                                                                                                                                                                                                  The MAC key value.

                                                                                                                                                                                                                • \"properties\" (OSSL_PKEY_PARAM_PROPERTIES)

                                                                                                                                                                                                                  A property query string to be used when any algorithms are fetched.

                                                                                                                                                                                                                  "},{"location":"man7/EVP_PKEY-HMAC/#cmac-parameters","title":"CMAC parameters","text":"

                                                                                                                                                                                                                  As well as the parameters described above, the CMAC keytype additionally supports the following parameters.

                                                                                                                                                                                                                  • \"cipher\" (OSSL_PKEY_PARAM_CIPHER)

                                                                                                                                                                                                                    The name of a cipher to be used when generating the MAC.

                                                                                                                                                                                                                  • \"engine\" (OSSL_PKEY_PARAM_ENGINE)

                                                                                                                                                                                                                    The name of an engine to be used for the specified cipher (if any).

                                                                                                                                                                                                                    "},{"location":"man7/EVP_PKEY-HMAC/#common-mac-key-generation-parameters","title":"Common MAC key generation parameters","text":"

                                                                                                                                                                                                                    MAC key generation is unusual in that no new key is actually generated. Instead a new provider side key object is created with the supplied raw key value. This is done for backwards compatibility with previous versions of OpenSSL.

                                                                                                                                                                                                                    • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string>

                                                                                                                                                                                                                      The MAC key value.

                                                                                                                                                                                                                    "},{"location":"man7/EVP_PKEY-HMAC/#cmac-key-generation-parameters","title":"CMAC key generation parameters","text":"

                                                                                                                                                                                                                    In addition to the common MAC key generation parameters, the CMAC key generation additionally recognises the following.

                                                                                                                                                                                                                    • \"cipher\" (OSSL_PKEY_PARAM_CIPHER)

                                                                                                                                                                                                                      The name of a cipher to be used when generating the MAC.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-HMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                      EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7)

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                      Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/","title":"EVP_PKEY-RSA","text":""},{"location":"man7/EVP_PKEY-RSA/#name","title":"NAME","text":"

                                                                                                                                                                                                                      EVP_PKEY-RSA, EVP_KEYMGMT-RSA, RSA - EVP_PKEY RSA keytype and algorithm support

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                      The RSA keytype is implemented in OpenSSL's default and FIPS providers. That implementation supports the basic RSA keys, containing the modulus n, the public exponent e, the private exponent d, and a collection of prime factors, exponents and coefficient for CRT calculations, of which the first few are known as p and q, dP and dQ, and qInv.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#common-rsa-parameters","title":"Common RSA parameters","text":"

                                                                                                                                                                                                                      In addition to the common parameters that all keytypes should support (see \"Common parameters\" in provider-keymgmt(7)), the RSA keytype implementation supports the following.

                                                                                                                                                                                                                      • \"n\" (OSSL_PKEY_PARAM_RSA_N) <unsigned integer>

                                                                                                                                                                                                                        The RSA modulus \"n\" value.

                                                                                                                                                                                                                      • \"e\" (OSSL_PKEY_PARAM_RSA_E) <unsigned integer>

                                                                                                                                                                                                                        The RSA public exponent \"e\" value. This value must always be set when creating a raw key using EVP_PKEY_fromdata(3). Note that when a decryption operation is performed, that this value is used for blinding purposes to prevent timing attacks.

                                                                                                                                                                                                                      • \"d\" (OSSL_PKEY_PARAM_RSA_D) <unsigned integer>

                                                                                                                                                                                                                        The RSA private exponent \"d\" value.

                                                                                                                                                                                                                      • \"rsa-factor1\" (OSSL_PKEY_PARAM_RSA_FACTOR1) <unsigned integer>

                                                                                                                                                                                                                      • \"rsa-factor2\" (OSSL_PKEY_PARAM_RSA_FACTOR2) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor3\" (OSSL_PKEY_PARAM_RSA_FACTOR3) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor4\" (OSSL_PKEY_PARAM_RSA_FACTOR4) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor5\" (OSSL_PKEY_PARAM_RSA_FACTOR5) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor6\" (OSSL_PKEY_PARAM_RSA_FACTOR6) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor7\" (OSSL_PKEY_PARAM_RSA_FACTOR7) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor8\" (OSSL_PKEY_PARAM_RSA_FACTOR8) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor9\" (OSSL_PKEY_PARAM_RSA_FACTOR9) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-factor10\" (OSSL_PKEY_PARAM_RSA_FACTOR10) <unsigned integer>

                                                                                                                                                                                                                        RSA prime factors. The factors are known as \"p\", \"q\" and \"r_i\" in RFC8017. Up to eight additional \"r_i\" prime factors are supported.

                                                                                                                                                                                                                      • \"rsa-exponent1\" (OSSL_PKEY_PARAM_RSA_EXPONENT1) <unsigned integer>

                                                                                                                                                                                                                      • \"rsa-exponent2\" (OSSL_PKEY_PARAM_RSA_EXPONENT2) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent3\" (OSSL_PKEY_PARAM_RSA_EXPONENT3) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent4\" (OSSL_PKEY_PARAM_RSA_EXPONENT4) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent5\" (OSSL_PKEY_PARAM_RSA_EXPONENT5) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent6\" (OSSL_PKEY_PARAM_RSA_EXPONENT6) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent7\" (OSSL_PKEY_PARAM_RSA_EXPONENT7) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent8\" (OSSL_PKEY_PARAM_RSA_EXPONENT8) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent9\" (OSSL_PKEY_PARAM_RSA_EXPONENT9) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-exponent10\" (OSSL_PKEY_PARAM_RSA_EXPONENT10) <unsigned integer>

                                                                                                                                                                                                                        RSA CRT (Chinese Remainder Theorem) exponents. The exponents are known as \"dP\", \"dQ\" and \"d_i\" in RFC8017. Up to eight additional \"d_i\" exponents are supported.

                                                                                                                                                                                                                      • \"rsa-coefficient1\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT1) <unsigned integer>

                                                                                                                                                                                                                      • \"rsa-coefficient2\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT2) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-coefficient3\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT3) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-coefficient4\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT4) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-coefficient5\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT5) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-coefficient6\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT6) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-coefficient7\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT7) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-coefficient8\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT8) <unsigned integer>
                                                                                                                                                                                                                      • \"rsa-coefficient9\" (OSSL_PKEY_PARAM_RSA_COEFFICIENT9) <unsigned integer>

                                                                                                                                                                                                                        RSA CRT (Chinese Remainder Theorem) coefficients. The coefficients are known as \"qInv\" and \"t_i\". Up to eight additional \"t_i\" exponents are supported.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-generation-parameters","title":"RSA key generation parameters","text":"

                                                                                                                                                                                                                      When generating RSA keys, the following key generation parameters may be used.

                                                                                                                                                                                                                      • \"bits\" (OSSL_PKEY_PARAM_RSA_BITS) <unsigned integer>

                                                                                                                                                                                                                        The value should be the cryptographic length for the RSA cryptosystem, in bits.

                                                                                                                                                                                                                      • \"primes\" (OSSL_PKEY_PARAM_RSA_PRIMES) <unsigned integer>

                                                                                                                                                                                                                        The value should be the number of primes for the generated RSA key. The default is 2. It isn't permitted to specify a larger number of primes than 10. Additionally, the number of primes is limited by the length of the key being generated so the maximum number could be less. Some providers may only support a value of 2.

                                                                                                                                                                                                                      • \"e\" (OSSL_PKEY_PARAM_RSA_E) <unsigned integer>

                                                                                                                                                                                                                        The RSA \"e\" value. The value may be any odd number greater than or equal to 65537. The default value is 65537. For legacy reasons a value of 3 is currently accepted but is deprecated.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-generation-parameters-for-fips-module-testing","title":"RSA key generation parameters for FIPS module testing","text":"

                                                                                                                                                                                                                      When generating RSA keys, the following additional key generation parameters may be used for algorithm testing purposes only. Do not use these to generate RSA keys for a production environment.

                                                                                                                                                                                                                      • \"xp\" (OSSL_PKEY_PARAM_RSA_TEST_XP) <unsigned integer>
                                                                                                                                                                                                                      • \"xq\" (OSSL_PKEY_PARAM_RSA_TEST_XQ) <unsigned integer>

                                                                                                                                                                                                                        These 2 fields are normally randomly generated and are used to generate \"p\" and \"q\".

                                                                                                                                                                                                                      • \"xp1\" (OSSL_PKEY_PARAM_RSA_TEST_XP1) <unsigned integer>

                                                                                                                                                                                                                      • \"xp2\" (OSSL_PKEY_PARAM_RSA_TEST_XP2) <unsigned integer>
                                                                                                                                                                                                                      • \"xq1\" (OSSL_PKEY_PARAM_RSA_TEST_XQ1) <unsigned integer>
                                                                                                                                                                                                                      • \"xq2\" (OSSL_PKEY_PARAM_RSA_TEST_XQ2) <unsigned integer>

                                                                                                                                                                                                                        These 4 fields are normally randomly generated. The prime factors \"p1\", \"p2\", \"q1\" and \"q2\" are determined from these values.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-parameters-for-fips-module-testing","title":"RSA key parameters for FIPS module testing","text":"

                                                                                                                                                                                                                      The following intermediate values can be retrieved only if the values specified in \"RSA key generation parameters for FIPS module testing\" are set. These should not be accessed in a production environment.

                                                                                                                                                                                                                      • \"p1\" (OSSL_PKEY_PARAM_RSA_TEST_P1) <unsigned integer>
                                                                                                                                                                                                                      • \"p2\" (OSSL_PKEY_PARAM_RSA_TEST_P2) <unsigned integer>
                                                                                                                                                                                                                      • \"q1\" (OSSL_PKEY_PARAM_RSA_TEST_Q1) <unsigned integer>
                                                                                                                                                                                                                      • \"q2\" (OSSL_PKEY_PARAM_RSA_TEST_Q2) <unsigned integer>

                                                                                                                                                                                                                        The auxiliary probable primes.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#rsa-key-validation","title":"RSA key validation","text":"

                                                                                                                                                                                                                      For RSA keys, EVP_PKEY_param_check(3) and EVP_PKEY_param_check_quick(3) both return 1 unconditionally.

                                                                                                                                                                                                                      For RSA keys, EVP_PKEY_public_check(3) conforms to the SP800-56Br1 public key check when the OpenSSL FIPS provider is used. The OpenSSL default provider performs similar tests but relaxes the keysize restrictions for backwards compatibility.

                                                                                                                                                                                                                      For RSA keys, EVP_PKEY_public_check_quick(3) is the same as EVP_PKEY_public_check(3).

                                                                                                                                                                                                                      For RSA keys, EVP_PKEY_private_check(3) conforms to the SP800-56Br1 private key test.

                                                                                                                                                                                                                      For RSA keys, EVP_PKEY_pairwise_check(3) conforms to the SP800-56Br1 KeyPair Validation check for the OpenSSL FIPS provider. The OpenSSL default provider allows testing of the validity of multi-primes.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#conforming-to","title":"CONFORMING TO","text":"
                                                                                                                                                                                                                      • FIPS186-4

                                                                                                                                                                                                                        Section B.3.6 Generation of Probable Primes with Conditions Based on Auxiliary Probable Primes

                                                                                                                                                                                                                      • RFC 8017, excluding RSA-PSS and RSA-OAEP

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                      An EVP_PKEY context can be obtained by calling:

                                                                                                                                                                                                                      EVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n

                                                                                                                                                                                                                      An RSA key can be generated simply like this:

                                                                                                                                                                                                                      pkey = EVP_RSA_gen(4096);\n

                                                                                                                                                                                                                      or like this:

                                                                                                                                                                                                                      EVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n\nEVP_PKEY_keygen_init(pctx);\nEVP_PKEY_generate(pctx, &pkey);\nEVP_PKEY_CTX_free(pctx);\n

                                                                                                                                                                                                                      An RSA key can be generated with key generation parameters:

                                                                                                                                                                                                                      unsigned int primes = 3;\nunsigned int bits = 4096;\nOSSL_PARAM params[3];\nEVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_from_name(NULL, \"RSA\", NULL);\n\nEVP_PKEY_keygen_init(pctx);\n\nparams[0] = OSSL_PARAM_construct_uint(\"bits\", &bits);\nparams[1] = OSSL_PARAM_construct_uint(\"primes\", &primes);\nparams[2] = OSSL_PARAM_construct_end();\nEVP_PKEY_CTX_set_params(pctx, params);\n\nEVP_PKEY_generate(pctx, &pkey);\nEVP_PKEY_print_private(bio_out, pkey, 0, NULL);\nEVP_PKEY_CTX_free(pctx);\n
                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                      EVP_RSA_gen(3), EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7)

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-RSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                      Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-SM2/","title":"EVP_PKEY-SM2","text":""},{"location":"man7/EVP_PKEY-SM2/#name","title":"NAME","text":"

                                                                                                                                                                                                                      EVP_PKEY-SM2, EVP_KEYMGMT-SM2, SM2 - EVP_PKEY keytype support for the Chinese SM2 signature and encryption algorithms

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-SM2/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                      The SM2 algorithm was first defined by the Chinese national standard GM/T 0003-2012 and was later standardized by ISO as ISO/IEC 14888. SM2 is actually an elliptic curve based algorithm. The current implementation in OpenSSL supports both signature and encryption schemes via the EVP interface.

                                                                                                                                                                                                                      When doing the SM2 signature algorithm, it requires a distinguishing identifier to form the message prefix which is hashed before the real message is hashed.

                                                                                                                                                                                                                      "},{"location":"man7/EVP_PKEY-SM2/#common-sm2-parameters","title":"Common SM2 parameters","text":"

                                                                                                                                                                                                                      SM2 uses the parameters defined in \"Common EC parameters\" in EVP_PKEY-EC(7). The following parameters are different:

                                                                                                                                                                                                                      • \"cofactor\" (OSSL_PKEY_PARAM_EC_COFACTOR) <unsigned integer>

                                                                                                                                                                                                                        This parameter is ignored for SM2.

                                                                                                                                                                                                                      • (OSSL_PKEY_PARAM_DEFAULT_DIGEST)

                                                                                                                                                                                                                        Getter that returns the default digest name. (Currently returns \"SM3\" as of OpenSSL 3.0).

                                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-SM2/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                        SM2 signatures can be generated by using the 'DigestSign' series of APIs, for instance, EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal(). Ditto for the verification process by calling the 'DigestVerify' series of APIs. Note that the SM2 algorithm requires the presence of the public key for signatures, as such the OSSL_PKEY_PARAM_PUB_KEY option must be set on any key used in signature generation.

                                                                                                                                                                                                                        Before computing an SM2 signature, an EVP_PKEY_CTX needs to be created, and an SM2 ID must be set for it, like this:

                                                                                                                                                                                                                        EVP_PKEY_CTX_set1_id(pctx, id, id_len);\n

                                                                                                                                                                                                                        Before calling the EVP_DigestSignInit() or EVP_DigestVerifyInit() functions, that EVP_PKEY_CTX should be assigned to the EVP_MD_CTX, like this:

                                                                                                                                                                                                                        EVP_MD_CTX_set_pkey_ctx(mctx, pctx);\n

                                                                                                                                                                                                                        There is normally no need to pass a pctx parameter to EVP_DigestSignInit() or EVP_DigestVerifyInit() in such a scenario.

                                                                                                                                                                                                                        SM2 can be tested with the openssl-speed(1) application since version 3.0. Currently, the only valid algorithm name is sm2.

                                                                                                                                                                                                                        Since version 3.0, SM2 keys can be generated and loaded only when the domain parameters specify the SM2 elliptic curve.

                                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-SM2/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                        This example demonstrates the calling sequence for using an EVP_PKEY to verify a message with the SM2 signature algorithm and the SM3 hash algorithm:

                                                                                                                                                                                                                        #include <openssl/evp.h>\n\n/* obtain an EVP_PKEY using whatever methods... */\nmctx = EVP_MD_CTX_new();\npctx = EVP_PKEY_CTX_new(pkey, NULL);\nEVP_PKEY_CTX_set1_id(pctx, id, id_len);\nEVP_MD_CTX_set_pkey_ctx(mctx, pctx);\nEVP_DigestVerifyInit(mctx, NULL, EVP_sm3(), NULL, pkey);\nEVP_DigestVerifyUpdate(mctx, msg, msg_len);\nEVP_DigestVerifyFinal(mctx, sig, sig_len)\n
                                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-SM2/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                        EVP_PKEY_CTX_new(3), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3), EVP_PKEY_CTX_set1_id(3), EVP_MD_CTX_set_pkey_ctx(3)

                                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-SM2/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                        Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-X25519/","title":"EVP_PKEY-X25519","text":""},{"location":"man7/EVP_PKEY-X25519/#name","title":"NAME","text":"

                                                                                                                                                                                                                        EVP_PKEY-X25519, EVP_PKEY-X448, EVP_PKEY-ED25519, EVP_PKEY-ED448, EVP_KEYMGMT-X25519, EVP_KEYMGMT-X448, EVP_KEYMGMT-ED25519, EVP_KEYMGMT-ED448 - EVP_PKEY X25519, X448, ED25519 and ED448 keytype and algorithm support

                                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-X25519/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                        The X25519, X448, ED25519 and ED448 keytypes are implemented in OpenSSL's default and FIPS providers. These implementations support the associated key, containing the public key pub and the private key priv.

                                                                                                                                                                                                                        No additional parameters can be set during key generation.

                                                                                                                                                                                                                        "},{"location":"man7/EVP_PKEY-X25519/#common-x25519-x448-ed25519-and-ed448-parameters","title":"Common X25519, X448, ED25519 and ED448 parameters","text":"

                                                                                                                                                                                                                        In addition to the common parameters that all keytypes should support (see \"Common parameters\" in provider-keymgmt(7)), the implementation of these keytypes support the following.

                                                                                                                                                                                                                        • \"group\" (OSSL_PKEY_PARAM_GROUP_NAME)

                                                                                                                                                                                                                          This is only supported by X25519 and X448. The group name must be \"x25519\" or \"x448\" respectively for those algorithms. This is only present for consistency with other key exchange algorithms and is typically not needed.

                                                                                                                                                                                                                        • \"pub\" (OSSL_PKEY_PARAM_PUB_KEY) <octet string>

                                                                                                                                                                                                                          The public key value.

                                                                                                                                                                                                                        • \"priv\" (OSSL_PKEY_PARAM_PRIV_KEY) <octet string>

                                                                                                                                                                                                                          The private key value.

                                                                                                                                                                                                                        • \"encoded-pub-key\" (OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY) <octet string>

                                                                                                                                                                                                                          Used for getting and setting the encoding of a public key for the X25519 and X448 key types. Public keys are expected be encoded in a format as defined by RFC7748.

                                                                                                                                                                                                                        • "},{"location":"man7/EVP_PKEY-X25519/#ed25519-and-ed448-parameters","title":"ED25519 and ED448 parameters","text":"
                                                                                                                                                                                                                          • \"mandatory-digest\" (OSSL_PKEY_PARAM_MANDATORY_DIGEST)

                                                                                                                                                                                                                            The empty string, signifying that no digest may be specified.

                                                                                                                                                                                                                            "},{"location":"man7/EVP_PKEY-X25519/#conforming-to","title":"CONFORMING TO","text":"
                                                                                                                                                                                                                            • RFC 8032
                                                                                                                                                                                                                            • RFC 8410
                                                                                                                                                                                                                            "},{"location":"man7/EVP_PKEY-X25519/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                            An EVP_PKEY context can be obtained by calling:

                                                                                                                                                                                                                            EVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"X25519\", NULL);\n\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"X448\", NULL);\n\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"ED25519\", NULL);\n\nEVP_PKEY_CTX *pctx =\n    EVP_PKEY_CTX_new_from_name(NULL, \"ED448\", NULL);\n

                                                                                                                                                                                                                            An X25519 key can be generated like this:

                                                                                                                                                                                                                            pkey = EVP_PKEY_Q_keygen(NULL, NULL, \"X25519\");\n

                                                                                                                                                                                                                            An X448, ED25519, or ED448 key can be generated likewise.

                                                                                                                                                                                                                            "},{"location":"man7/EVP_PKEY-X25519/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                            EVP_KEYMGMT(3), EVP_PKEY(3), provider-keymgmt(7), EVP_KEYEXCH-X25519(7), EVP_KEYEXCH-X448(7), EVP_SIGNATURE-ED25519(7), EVP_SIGNATURE-ED448(7)

                                                                                                                                                                                                                            "},{"location":"man7/EVP_PKEY-X25519/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                            Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                            "},{"location":"man7/EVP_RAND-CTR-DRBG/","title":"EVP_RAND-CTR-DRBG","text":""},{"location":"man7/EVP_RAND-CTR-DRBG/#name","title":"NAME","text":"

                                                                                                                                                                                                                            EVP_RAND-CTR-DRBG - The CTR DRBG EVP_RAND implementation

                                                                                                                                                                                                                            "},{"location":"man7/EVP_RAND-CTR-DRBG/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                            Support for the counter deterministic random bit generator through the EVP_RAND API.

                                                                                                                                                                                                                            "},{"location":"man7/EVP_RAND-CTR-DRBG/#identity","title":"Identity","text":"

                                                                                                                                                                                                                            \"CTR-DRBG\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                                                                                                                                                            "},{"location":"man7/EVP_RAND-CTR-DRBG/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                                            The supported parameters are:

                                                                                                                                                                                                                            • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                                                                                                                                                            • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                                                                                                                                                            • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
                                                                                                                                                                                                                            • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                                                                                                                                                            • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                                                                                                                                                            • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                            • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                            • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                            • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                            • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                                                                                                                                                            • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                                                                                                                                                            • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
                                                                                                                                                                                                                            • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)
                                                                                                                                                                                                                            • \"cipher\" (OSSL_DRBG_PARAM_CIPHER)

                                                                                                                                                                                                                              These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                                                                                                                                                            • \"use_derivation_function\" (OSSL_DRBG_PARAM_USE_DF) <integer>

                                                                                                                                                                                                                              This Boolean indicates if a derivation function should be used or not. A nonzero value (the default) uses the derivation function. A zero value does not.

                                                                                                                                                                                                                            • "},{"location":"man7/EVP_RAND-CTR-DRBG/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                              A context for CTR DRBG can be obtained by calling:

                                                                                                                                                                                                                              EVP_RAND *rand = EVP_RAND_fetch(NULL, \"CTR-DRBG\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-CTR-DRBG/#examples","title":"EXAMPLES","text":"
                                                                                                                                                                                                                              EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[2], *p = params;\nunsigned int strength = 128;\n\nrand = EVP_RAND_fetch(NULL, \"CTR-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,\n                                        SN_aes_256_ctr, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-CTR-DRBG/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                                                              NIST SP 800-90A and SP 800-90B

                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-CTR-DRBG/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                              EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3)

                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-CTR-DRBG/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                              Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-HASH-DRBG/","title":"EVP_RAND-HASH-DRBG","text":""},{"location":"man7/EVP_RAND-HASH-DRBG/#name","title":"NAME","text":"

                                                                                                                                                                                                                              EVP_RAND-HASH-DRBG - The HASH DRBG EVP_RAND implementation

                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-HASH-DRBG/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                              Support for the hash deterministic random bit generator through the EVP_RAND API.

                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-HASH-DRBG/#identity","title":"Identity","text":"

                                                                                                                                                                                                                              \"HASH-DRBG\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                                                                                                                                                              "},{"location":"man7/EVP_RAND-HASH-DRBG/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                                              The supported parameters are:

                                                                                                                                                                                                                              • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                                                                                                                                                              • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                                                                                                                                                              • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
                                                                                                                                                                                                                              • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                                                                                                                                                              • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                                                                                                                                                              • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                              • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                              • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                              • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                              • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                                                                                                                                                              • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                                                                                                                                                              • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
                                                                                                                                                                                                                              • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)
                                                                                                                                                                                                                              • \"digest\" (OSSL_DRBG_PARAM_DIGEST)

                                                                                                                                                                                                                                These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HASH-DRBG/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                When the FIPS provider is installed using the -no_drbg_truncated_digests option to fipsinstall, only these digests are permitted (as per FIPS 140-3 IG D.R):

                                                                                                                                                                                                                                • SHA-1
                                                                                                                                                                                                                                • SHA2-256
                                                                                                                                                                                                                                • SHA2-512
                                                                                                                                                                                                                                • SHA3-256
                                                                                                                                                                                                                                • SHA3-512

                                                                                                                                                                                                                                A context for HASH DRBG can be obtained by calling:

                                                                                                                                                                                                                                EVP_RAND *rand = EVP_RAND_fetch(NULL, \"HASH-DRBG\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HASH-DRBG/#examples","title":"EXAMPLES","text":"
                                                                                                                                                                                                                                EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[2], *p = params;\nunsigned int strength = 128;\n\nrand = EVP_RAND_fetch(NULL, \"HASH-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha512, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HASH-DRBG/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                                                                NIST SP 800-90A and SP 800-90B

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HASH-DRBG/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3), openssl-fipsinstall(1)

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HASH-DRBG/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                OpenSSL 3.1.1 introduced the -no_drbg_truncated_digests option to fipsinstall which restricts the permitted digests when using the FIPS provider in a complaint manner. For details refer to FIPS 140-3 IG D.R.

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HASH-DRBG/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HMAC-DRBG/","title":"EVP_RAND-HMAC-DRBG","text":""},{"location":"man7/EVP_RAND-HMAC-DRBG/#name","title":"NAME","text":"

                                                                                                                                                                                                                                EVP_RAND-HMAC-DRBG - The HMAC DRBG EVP_RAND implementation

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HMAC-DRBG/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                Support for the HMAC deterministic random bit generator through the EVP_RAND API.

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HMAC-DRBG/#identity","title":"Identity","text":"

                                                                                                                                                                                                                                \"HMAC-DRBG\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                                                                                                                                                                "},{"location":"man7/EVP_RAND-HMAC-DRBG/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                                                The supported parameters are:

                                                                                                                                                                                                                                • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                                                                                                                                                                • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                                                                                                                                                                • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
                                                                                                                                                                                                                                • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                                                                                                                                                                • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                                                                                                                                                                • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                                • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                                • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                                • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                                • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                                                                                                                                                                • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                                                                                                                                                                • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
                                                                                                                                                                                                                                • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)
                                                                                                                                                                                                                                • \"mac\" (OSSL_DRBG_PARAM_MAC)
                                                                                                                                                                                                                                • \"digest\" (OSSL_DRBG_PARAM_DIGEST)

                                                                                                                                                                                                                                  These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-HMAC-DRBG/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                  When using the FIPS provider, only these digests are permitted (as per FIPS 140-3 IG D.R):

                                                                                                                                                                                                                                  • SHA-1
                                                                                                                                                                                                                                  • SHA2-256
                                                                                                                                                                                                                                  • SHA2-512
                                                                                                                                                                                                                                  • SHA3-256
                                                                                                                                                                                                                                  • SHA3-512

                                                                                                                                                                                                                                  A context for HMAC DRBG can be obtained by calling:

                                                                                                                                                                                                                                  EVP_RAND *rand = EVP_RAND_fetch(NULL, \"HMAC-DRBG\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-HMAC-DRBG/#examples","title":"EXAMPLES","text":"
                                                                                                                                                                                                                                  EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[3], *p = params;\nunsigned int strength = 128;\n\nrand = EVP_RAND_fetch(NULL, \"HMAC-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_MAC, SN_hmac, 0);\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha256, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-HMAC-DRBG/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                                                                  NIST SP 800-90A and SP 800-90B

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-HMAC-DRBG/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                  EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3), openssl-fipsinstall(1)

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-HMAC-DRBG/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                  OpenSSL 3.1.1 introduced the -no_drbg_truncated_digests option to fipsinstall which restricts the permitted digests when using the FIPS provider in a complaint manner. For details refer to FIPS 140-3 IG D.R).

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-HMAC-DRBG/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                  Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/","title":"EVP_RAND-SEED-SRC","text":""},{"location":"man7/EVP_RAND-SEED-SRC/#name","title":"NAME","text":"

                                                                                                                                                                                                                                  EVP_RAND-SEED-SRC - The randomness seed source EVP_RAND implementation

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                  Support for deterministic random number generator seeding through the EVP_RAND API.

                                                                                                                                                                                                                                  The seed sources used are specified at the time OpenSSL is configured for building using the --with-rand-seed= option. By default, operating system randomness sources are used.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/#identity","title":"Identity","text":"

                                                                                                                                                                                                                                  \"SEED-SRC\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                                                  The supported parameters are:

                                                                                                                                                                                                                                  • \"state\" (OSSL_RAND_PARAM_STATE) <integer>
                                                                                                                                                                                                                                  • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
                                                                                                                                                                                                                                  • \"max_request\" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>

                                                                                                                                                                                                                                    These parameters work as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                  A context for the seed source can be obtained by calling:

                                                                                                                                                                                                                                  EVP_RAND *rand = EVP_RAND_fetch(NULL, \"SEED-SRC\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/#examples","title":"EXAMPLES","text":"
                                                                                                                                                                                                                                  EVP_RAND *rand;\nEVP_RAND_CTX *seed, *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[2], *p = params;\nunsigned int strength = 128;\n\n/* Create and instantiate a seed source */\nrand = EVP_RAND_fetch(NULL, \"SEED-SRC\", NULL);\nseed = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_instantiate(seed, strength, 0, NULL, 0, NULL);\nEVP_RAND_free(rand);\n\n/* Feed this into a DRBG */\nrand = EVP_RAND_fetch(NULL, \"CTR-DRBG\", NULL);\nrctx = EVP_RAND_CTX_new(rand, seed);\nEVP_RAND_free(rand);\n\n/* Configure the DRBG */\n*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,\n                                        SN_aes_256_ctr, 0);\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\nEVP_RAND_CTX_free(seed);\n
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                  EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3)

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-SEED-SRC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                  Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/","title":"EVP_RAND-TEST-RAND","text":""},{"location":"man7/EVP_RAND-TEST-RAND/#name","title":"NAME","text":"

                                                                                                                                                                                                                                  EVP_RAND-TEST-RAND - The test EVP_RAND implementation

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                  Support for a test generator through the EVP_RAND API. This generator is for test purposes only, it does not generate random numbers.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#identity","title":"Identity","text":"

                                                                                                                                                                                                                                  \"TEST-RAND\" is the name for this implementation; it can be used with the EVP_RAND_fetch() function.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#supported-parameters","title":"Supported parameters","text":"

                                                                                                                                                                                                                                  The supported parameters are:

                                                                                                                                                                                                                                  • \"state\" (OSSL_RAND_PARAM_STATE) <integer>

                                                                                                                                                                                                                                    These parameter works as described in \"PARAMETERS\" in EVP_RAND(3).

                                                                                                                                                                                                                                  • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>

                                                                                                                                                                                                                                  • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                                                                                                                                                                  • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
                                                                                                                                                                                                                                  • \"max_request\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
                                                                                                                                                                                                                                  • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                                  • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
                                                                                                                                                                                                                                  • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                                  • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
                                                                                                                                                                                                                                  • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
                                                                                                                                                                                                                                  • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
                                                                                                                                                                                                                                  • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>

                                                                                                                                                                                                                                    These parameters work as described in \"PARAMETERS\" in EVP_RAND(3), except that they can all be set as well as read.

                                                                                                                                                                                                                                  • \"test_entropy\" (OSSL_RAND_PARAM_TEST_ENTROPY) <octet string>

                                                                                                                                                                                                                                    Sets the bytes returned when the test generator is sent an entropy request. The current position is remembered across generate calls. If there are insufficient data present to satisfy a call, an error is returned.

                                                                                                                                                                                                                                  • \"test_nonce\" (OSSL_RAND_PARAM_TEST_NONCE) <octet string>

                                                                                                                                                                                                                                    Sets the bytes returned when the test generator is sent a nonce request. Each nonce request will return all of the bytes.

                                                                                                                                                                                                                                  • \"generate\" (OSSL_RAND_PARAM_GENERATE) <integer>

                                                                                                                                                                                                                                    If this parameter is zero, it will only emit the nonce and entropy data supplied via the aforementioned parameters. Otherwise, low quality non-cryptographic pseudorandom output is produced. This parameter defaults to zero.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                  A context for a test generator can be obtained by calling:

                                                                                                                                                                                                                                  EVP_RAND *rand = EVP_RAND_fetch(NULL, \"TEST-RAND\", NULL);\nEVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);\n
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#examples","title":"EXAMPLES","text":"
                                                                                                                                                                                                                                  EVP_RAND *rand;\nEVP_RAND_CTX *rctx;\nunsigned char bytes[100];\nOSSL_PARAM params[4], *p = params;\nunsigned char entropy[1000] = { ... };\nunsigned char nonce[20] = { ... };\nunsigned int strength = 48;\n\nrand = EVP_RAND_fetch(NULL, \"TEST-RAND\", NULL);\nrctx = EVP_RAND_CTX_new(rand, NULL);\nEVP_RAND_free(rand);\n\n*p++ = OSSL_PARAM_construct_uint(OSSL_RAND_PARAM_STRENGTH, &strength);\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_ENTROPY,\n                                         entropy, sizeof(entropy));\n*p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_NONCE,\n                                         nonce, sizeof(nonce));\n*p = OSSL_PARAM_construct_end();\nEVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);\n\nEVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);\n\nEVP_RAND_CTX_free(rctx);\n
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                  EVP_RAND(3), \"PARAMETERS\" in EVP_RAND(3)

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                  This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND-TEST-RAND/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                  Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/","title":"EVP_RAND","text":""},{"location":"man7/EVP_RAND/#name","title":"NAME","text":"

                                                                                                                                                                                                                                  EVP_RAND - the random bit generator

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                  #include <openssl/evp.h>\n#include <rand.h>\n
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                  The default OpenSSL RAND method is based on the EVP_RAND classes to provide non-deterministic inputs to other cryptographic algorithms.

                                                                                                                                                                                                                                  While the RAND API is the 'frontend' which is intended to be used by application developers for obtaining random bytes, the EVP_RAND API serves as the 'backend', connecting the former with the operating systems's entropy sources and providing access to deterministic random bit generators (DRBG) and their configuration parameters. A DRBG is a certain type of cryptographically-secure pseudo-random number generator (CSPRNG), which is described in [NIST SP 800-90A Rev. 1].

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#disclaimer","title":"Disclaimer","text":"

                                                                                                                                                                                                                                  Unless you have very specific requirements for your random generator, it is in general not necessary to utilize the EVP_RAND API directly. The usual way to obtain random bytes is to use RAND_bytes(3) or RAND_priv_bytes(3), see also RAND(7).

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#typical-use-cases","title":"Typical Use Cases","text":"

                                                                                                                                                                                                                                  Typical examples for such special use cases are the following:

                                                                                                                                                                                                                                  • You want to use your own private DRBG instances. Multiple DRBG instances which are accessed only by a single thread provide additional security (because their internal states are independent) and better scalability in multithreaded applications (because they don't need to be locked).
                                                                                                                                                                                                                                  • You need to integrate a previously unsupported entropy source. Refer to provider-rand(7) for the implementation details to support adding randomness sources to EVP_RAND.
                                                                                                                                                                                                                                  • You need to change the default settings of the standard OpenSSL RAND implementation to meet specific requirements.
                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#evp_rand-chaining","title":"EVP_RAND CHAINING","text":"

                                                                                                                                                                                                                                  An EVP_RAND instance can be used as the entropy source of another EVP_RAND instance, provided it has itself access to a valid entropy source. The EVP_RAND instance which acts as entropy source is called the parent, the other instance the child. Typically, the child will be a DRBG because it does not make sense for the child to be an entropy source.

                                                                                                                                                                                                                                  This is called chaining. A chained EVP_RAND instance is created by passing a pointer to the parent EVP_RAND_CTX as argument to the EVP_RAND_CTX_new() call. It is possible to create chains of more than two DRBG in a row. It is also possible to use any EVP_RAND_CTX class as the parent, however, only a live entropy source may ignore and not use its parent.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#the-three-shared-drbg-instances","title":"THE THREE SHARED DRBG INSTANCES","text":"

                                                                                                                                                                                                                                  Currently, there are three shared DRBG instances, the <primary>, <public>, and <private> DRBG. While the <primary> DRBG is a single global instance, the <public> and <private> DRBG are created per thread and accessed through thread-local storage.

                                                                                                                                                                                                                                  By default, the functions RAND_bytes(3) and RAND_priv_bytes(3) use the thread-local <public> and <private> DRBG instance, respectively.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#the-primary-drbg-instance","title":"The <primary> DRBG instance","text":"

                                                                                                                                                                                                                                  The <primary> DRBG is not used directly by the application, only for reseeding the two other two DRBG instances. It reseeds itself by obtaining randomness either from os entropy sources or by consuming randomness which was added previously by RAND_add(3).

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#the-public-drbg-instance","title":"The <public> DRBG instance","text":"

                                                                                                                                                                                                                                  This instance is used per default by RAND_bytes(3).

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#the-private-drbg-instance","title":"The <private> DRBG instance","text":"

                                                                                                                                                                                                                                  This instance is used per default by RAND_priv_bytes(3)

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#locking","title":"LOCKING","text":"

                                                                                                                                                                                                                                  The <primary> DRBG is intended to be accessed concurrently for reseeding by its child DRBG instances. The necessary locking is done internally. It is not thread-safe to access the <primary> DRBG directly via the EVP_RAND interface. The <public> and <private> DRBG are thread-local, i.e. there is an instance of each per thread. So they can safely be accessed without locking via the EVP_RAND interface.

                                                                                                                                                                                                                                  Pointers to these DRBG instances can be obtained using RAND_get0_primary(), RAND_get0_public() and RAND_get0_private(), respectively. Note that it is not allowed to store a pointer to one of the thread-local DRBG instances in a variable or other memory location where it will be accessed and used by multiple threads.

                                                                                                                                                                                                                                  All other DRBG instances created by an application don't support locking, because they are intended to be used by a single thread. Instead of accessing a single DRBG instance concurrently from different threads, it is recommended to instantiate a separate DRBG instance per thread. Using the <primary> DRBG as entropy source for multiple DRBG instances on different threads is thread-safe, because the DRBG instance will lock the <primary> DRBG automatically for obtaining random input.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#the-overall-picture","title":"THE OVERALL PICTURE","text":"

                                                                                                                                                                                                                                  The following picture gives an overview over how the DRBG instances work together and are being used.

                                                                                                                                                                                                                                             +--------------------+\n           | os entropy sources |\n           +--------------------+\n                    |\n                    v           +-----------------------------+\n RAND_add() ==> <primary>     <-| shared DRBG (with locking)  |\n                  /   \\         +-----------------------------+\n                 /     \\              +---------------------------+\n          <public>     <private>   <- | per-thread DRBG instances |\n             |             |          +---------------------------+\n             v             v\n           RAND_bytes()   RAND_priv_bytes()\n                |               ^\n                |               |\n+------------------+      +------------------------------------+\n| general purpose  |      | used for secrets like session keys |\n| random generator |      | and private keys for certificates  |\n+------------------+      +------------------------------------+\n

                                                                                                                                                                                                                                  The usual way to obtain random bytes is to call RAND_bytes(...) or RAND_priv_bytes(...). These calls are roughly equivalent to calling EVP_RAND_generate(<public>, ...) and EVP_RAND_generate(<private>, ...), respectively.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#reseeding","title":"RESEEDING","text":"

                                                                                                                                                                                                                                  A DRBG instance seeds itself automatically, pulling random input from its entropy source. The entropy source can be either a trusted operating system entropy source, or another DRBG with access to such a source.

                                                                                                                                                                                                                                  Automatic reseeding occurs after a predefined number of generate requests. The selection of the trusted entropy sources is configured at build time using the --with-rand-seed option. The following sections explain the reseeding process in more detail.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#automatic-reseeding","title":"Automatic Reseeding","text":"

                                                                                                                                                                                                                                  Before satisfying a generate request (EVP_RAND_generate(3)), the DRBG reseeds itself automatically, if one of the following conditions holds:

                                                                                                                                                                                                                                  - the DRBG was not instantiated (=seeded) yet or has been uninstantiated.

                                                                                                                                                                                                                                  - the number of generate requests since the last reseeding exceeds a certain threshold, the so called reseed_interval. This behaviour can be disabled by setting the reseed_interval to 0.

                                                                                                                                                                                                                                  - the time elapsed since the last reseeding exceeds a certain time interval, the so called reseed_time_interval. This can be disabled by setting the reseed_time_interval to 0.

                                                                                                                                                                                                                                  - the DRBG is in an error state.

                                                                                                                                                                                                                                  Note: An error state is entered if the entropy source fails while the DRBG is seeding or reseeding. The last case ensures that the DRBG automatically recovers from the error as soon as the entropy source is available again.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#manual-reseeding","title":"Manual Reseeding","text":"

                                                                                                                                                                                                                                  In addition to automatic reseeding, the caller can request an immediate reseeding of the DRBG with fresh entropy by setting the prediction resistance parameter to 1 when calling EVP_RAND_generate(3).

                                                                                                                                                                                                                                  The document [NIST SP 800-90C] describes prediction resistance requests in detail and imposes strict conditions on the entropy sources that are approved for providing prediction resistance. A request for prediction resistance can only be satisfied by pulling fresh entropy from a live entropy source (section 5.5.2 of [NIST SP 800-90C]). It is up to the user to ensure that a live entropy source is configured and is being used.

                                                                                                                                                                                                                                  For the three shared DRBGs (and only for these) there is another way to reseed them manually: If RAND_add(3) is called with a positive randomness argument (or RAND_seed(3)), then this will immediately reseed the <primary> DRBG. The <public> and <private> DRBG will detect this on their next generate call and reseed, pulling randomness from <primary>.

                                                                                                                                                                                                                                  The last feature has been added to support the common practice used with previous OpenSSL versions to call RAND_add() before calling RAND_bytes().

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#entropy-input-and-additional-data","title":"Entropy Input and Additional Data","text":"

                                                                                                                                                                                                                                  The DRBG distinguishes two different types of random input: entropy, which comes from a trusted source, and additional input', which can optionally be added by the user and is considered untrusted. It is possible to add additional input not only during reseeding, but also for every generate request.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#configuring-the-random-seed-source","title":"Configuring the Random Seed Source","text":"

                                                                                                                                                                                                                                  In most cases OpenSSL will automatically choose a suitable seed source for automatically seeding and reseeding its <primary> DRBG. In some cases however, it will be necessary to explicitly specify a seed source during configuration, using the --with-rand-seed option. For more information, see the INSTALL instructions. There are also operating systems where no seed source is available and automatic reseeding is disabled by default.

                                                                                                                                                                                                                                  The following two sections describe the reseeding process of the primary DRBG, depending on whether automatic reseeding is available or not.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#reseeding-the-primary-drbg-with-automatic-seeding-enabled","title":"Reseeding the primary DRBG with automatic seeding enabled","text":"

                                                                                                                                                                                                                                  Calling RAND_poll() or RAND_add() is not necessary, because the DRBG pulls the necessary entropy from its source automatically. However, both calls are permitted, and do reseed the RNG.

                                                                                                                                                                                                                                  RAND_add() can be used to add both kinds of random input, depending on the value of the randomness argument:

                                                                                                                                                                                                                                  • randomness == 0:

                                                                                                                                                                                                                                    The random bytes are mixed as additional input into the current state of the DRBG. Mixing in additional input is not considered a full reseeding, hence the reseed counter is not reset.

                                                                                                                                                                                                                                  • randomness > 0:

                                                                                                                                                                                                                                    The random bytes are used as entropy input for a full reseeding (resp. reinstantiation) if the DRBG is instantiated (resp. uninstantiated or in an error state). The number of random bits required for reseeding is determined by the security strength of the DRBG. Currently it defaults to 256 bits (32 bytes). It is possible to provide less randomness than required. In this case the missing randomness will be obtained by pulling random input from the trusted entropy sources.

                                                                                                                                                                                                                                  NOTE: Manual reseeding is *not allowed* in FIPS mode, because [NIST SP-800-90Ar1] mandates that entropy *shall not* be provided by the consuming application for instantiation (Section 9.1) or reseeding (Section 9.2). For that reason, the randomness argument is ignored and the random bytes provided by the RAND_add(3) and RAND_seed(3) calls are treated as additional data.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#reseeding-the-primary-drbg-with-automatic-seeding-disabled","title":"Reseeding the primary DRBG with automatic seeding disabled","text":"

                                                                                                                                                                                                                                  Calling RAND_poll() will always fail.

                                                                                                                                                                                                                                  RAND_add() needs to be called for initial seeding and periodic reseeding. At least 48 bytes (384 bits) of randomness have to be provided, otherwise the (re-)seeding of the DRBG will fail. This corresponds to one and a half times the security strength of the DRBG. The extra half is used for the nonce during instantiation.

                                                                                                                                                                                                                                  More precisely, the number of bytes needed for seeding depend on the security strength of the DRBG, which is set to 256 by default.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                  RAND(7), EVP_RAND(3)

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                  This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_RAND/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                  Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_SIGNATURE-DSA/","title":"EVP_SIGNATURE-DSA","text":""},{"location":"man7/EVP_SIGNATURE-DSA/#name","title":"NAME","text":"

                                                                                                                                                                                                                                  EVP_SIGNATURE-DSA - The EVP_PKEY DSA signature implementation

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_SIGNATURE-DSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                  Support for computing DSA signatures. See EVP_PKEY-DSA(7) for information related to DSA keys.

                                                                                                                                                                                                                                  "},{"location":"man7/EVP_SIGNATURE-DSA/#signature-parameters","title":"Signature Parameters","text":"

                                                                                                                                                                                                                                  The following signature parameters can be set using EVP_PKEY_CTX_set_params(). This may be called after EVP_PKEY_sign_init() or EVP_PKEY_verify_init(), and before calling EVP_PKEY_sign() or EVP_PKEY_verify().

                                                                                                                                                                                                                                  • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)
                                                                                                                                                                                                                                  • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                                                                                                                                                    The settable parameters are described in provider-signature(7).

                                                                                                                                                                                                                                    The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                                                                                                                                                    • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>
                                                                                                                                                                                                                                    • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                                                                                                                                                      The gettable parameters are described in provider-signature(7).

                                                                                                                                                                                                                                      "},{"location":"man7/EVP_SIGNATURE-DSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                      EVP_PKEY_CTX_set_params(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), provider-signature(7),

                                                                                                                                                                                                                                      "},{"location":"man7/EVP_SIGNATURE-DSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                      Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ECDSA/","title":"EVP_SIGNATURE-ECDSA","text":""},{"location":"man7/EVP_SIGNATURE-ECDSA/#name","title":"NAME","text":"

                                                                                                                                                                                                                                      EVP_SIGNATURE-ECDSA - The EVP_PKEY ECDSA signature implementation.

                                                                                                                                                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ECDSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                      Support for computing ECDSA signatures. See EVP_PKEY-EC(7) for information related to EC keys.

                                                                                                                                                                                                                                      "},{"location":"man7/EVP_SIGNATURE-ECDSA/#ecdsa-signature-parameters","title":"ECDSA Signature Parameters","text":"

                                                                                                                                                                                                                                      The following signature parameters can be set using EVP_PKEY_CTX_set_params(). This may be called after EVP_PKEY_sign_init() or EVP_PKEY_verify_init(), and before calling EVP_PKEY_sign() or EVP_PKEY_verify().

                                                                                                                                                                                                                                      • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)
                                                                                                                                                                                                                                      • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                                                                                                                                                        These parameters are described in provider-signature(7).

                                                                                                                                                                                                                                        The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                                                                                                                                                        • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>
                                                                                                                                                                                                                                        • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                                                                                                                                                          The parameters are described in provider-signature(7).

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ECDSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                          EVP_PKEY_CTX_set_params(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), provider-signature(7),

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ECDSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                          Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ED25519/","title":"EVP_SIGNATURE-ED25519","text":""},{"location":"man7/EVP_SIGNATURE-ED25519/#name","title":"NAME","text":"

                                                                                                                                                                                                                                          EVP_SIGNATURE-ED25519, EVP_SIGNATURE-ED448, Ed25519, Ed448 - EVP_PKEY Ed25519 and Ed448 support

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ED25519/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                          The Ed25519 and Ed448 EVP_PKEY implementation supports key generation, one-shot digest sign and digest verify using PureEdDSA and Ed25519 or Ed448 (see RFC8032). It has associated private and public key formats compatible with RFC 8410.

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ED25519/#ed25519-and-ed448-signature-parameters","title":"ED25519 and ED448 Signature Parameters","text":"

                                                                                                                                                                                                                                          No additional parameters can be set during one-shot signing or verification. In particular, because PureEdDSA is used, a digest must NOT be specified when signing or verifying. See EVP_PKEY-X25519(7) for information related to X25519 and X448 keys.

                                                                                                                                                                                                                                          The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                                                                                                                                                          • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>

                                                                                                                                                                                                                                            The parameters are described in provider-signature(7).

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ED25519/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                          The PureEdDSA algorithm does not support the streaming mechanism of other signature algorithms using, for example, EVP_DigestUpdate(). The message to sign or verify must be passed using the one-shot EVP_DigestSign() and EVP_DigestVerify() functions.

                                                                                                                                                                                                                                          When calling EVP_DigestSignInit() or EVP_DigestVerifyInit(), the digest type parameter MUST be set to NULL.

                                                                                                                                                                                                                                          Applications wishing to sign certificates (or other structures such as CRLs or certificate requests) using Ed25519 or Ed448 can either use X509_sign() or X509_sign_ctx() in the usual way.

                                                                                                                                                                                                                                          Ed25519 or Ed448 private keys can be set directly using EVP_PKEY_new_raw_private_key(3) or loaded from a PKCS#8 private key file using PEM_read_bio_PrivateKey(3) (or similar function). Completely new keys can also be generated (see the example below). Setting a private key also sets the associated public key.

                                                                                                                                                                                                                                          Ed25519 or Ed448 public keys can be set directly using EVP_PKEY_new_raw_public_key(3) or loaded from a SubjectPublicKeyInfo structure in a PEM file using PEM_read_bio_PUBKEY(3) (or similar function).

                                                                                                                                                                                                                                          Ed25519 and Ed448 can be tested with the openssl-speed(1) application since version 1.1.1. Valid algorithm names are ed25519, ed448 and eddsa. If eddsa is specified, then both Ed25519 and Ed448 are benchmarked.

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ED25519/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                                          To sign a message using a ED25519 or ED448 key:

                                                                                                                                                                                                                                          void do_sign(EVP_PKEY *ed_key, unsigned char *msg, size_t msg_len)\n{\n    size_t sig_len;\n    unsigned char *sig = NULL;\n    EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();\n\n    EVP_DigestSignInit(md_ctx, NULL, NULL, NULL, ed_key);\n    /* Calculate the requires size for the signature by passing a NULL buffer */\n    EVP_DigestSign(md_ctx, NULL, &sig_len, msg, msg_len);\n    sig = OPENSSL_zalloc(sig_len);\n\n    EVP_DigestSign(md_ctx, sig, &sig_len, msg, msg_len);\n    ...\n    OPENSSL_free(sig);\n    EVP_MD_CTX_free(md_ctx);\n}\n
                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ED25519/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                          EVP_PKEY-X25519(7) provider-signature(7), EVP_DigestSignInit(3), EVP_DigestVerifyInit(3),

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-ED25519/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                          Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-HMAC/","title":"EVP_SIGNATURE-HMAC","text":""},{"location":"man7/EVP_SIGNATURE-HMAC/#name","title":"NAME","text":"

                                                                                                                                                                                                                                          EVP_SIGNATURE-HMAC, EVP_SIGNATURE-Siphash, EVP_SIGNATURE-Poly1305, EVP_SIGNATURE-CMAC - The legacy EVP_PKEY MAC signature implementations

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-HMAC/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                          The algorithms described here have legacy support for creating MACs using EVP_DigestSignInit(3) and related functions. This is not the preferred way of creating MACs. Instead you should use the newer EVP_MAC_init(3) functions. This mechanism is provided for backwards compatibility with older versions of OpenSSL.

                                                                                                                                                                                                                                          The same signature parameters can be set using EVP_PKEY_CTX_set_params() as can be set via EVP_MAC_CTX_set_params() for the underlying EVP_MAC. See EVP_MAC-HMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7) and EVP_MAC-CMAC(7) for details.

                                                                                                                                                                                                                                          See L<EVP_PKEY-HMAC(7)>, L<EVP_PKEY-Siphash(7)>, L<EVP_PKEY-Poly1305(7)> or\nL<EVP_PKEY-CMAC(7)> for details about parameters that are supported during the\ncreation of an EVP_PKEY.\n
                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-HMAC/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                          EVP_MAC_init(3), EVP_DigestSignInit(3), EVP_PKEY-HMAC(7), EVP_PKEY-Siphash(7), EVP_PKEY-Poly1305(7), EVP_PKEY-CMAC(7), EVP_MAC-HMAC(7), EVP_MAC-Siphash(7), EVP_MAC-Poly1305(7), EVP_MAC-CMAC(7), provider-signature(7),

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-HMAC/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                          Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-RSA/","title":"EVP_SIGNATURE-RSA","text":""},{"location":"man7/EVP_SIGNATURE-RSA/#name","title":"NAME","text":"

                                                                                                                                                                                                                                          EVP_SIGNATURE-RSA - The EVP_PKEY RSA signature implementation

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-RSA/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                          Support for computing RSA signatures. See EVP_PKEY-RSA(7) for information related to RSA keys.

                                                                                                                                                                                                                                          "},{"location":"man7/EVP_SIGNATURE-RSA/#signature-parameters","title":"Signature Parameters","text":"

                                                                                                                                                                                                                                          The following signature parameters can be set using EVP_PKEY_CTX_set_params(). This may be called after EVP_PKEY_sign_init() or EVP_PKEY_verify_init(), and before calling EVP_PKEY_sign() or EVP_PKEY_verify().

                                                                                                                                                                                                                                          • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)
                                                                                                                                                                                                                                          • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                                                                                                                                                            These common parameters are described in provider-signature(7).

                                                                                                                                                                                                                                          • \"pad-mode\" (OSSL_SIGNATURE_PARAM_PAD_MODE)

                                                                                                                                                                                                                                            The type of padding to be used. Its value can be one of the following:

                                                                                                                                                                                                                                            • \"none\" (OSSL_PKEY_RSA_PAD_MODE_NONE)
                                                                                                                                                                                                                                            • \"pkcs1\" (OSSL_PKEY_RSA_PAD_MODE_PKCSV15)
                                                                                                                                                                                                                                            • \"x931\" (OSSL_PKEY_RSA_PAD_MODE_X931)
                                                                                                                                                                                                                                            • \"pss\" (OSSL_PKEY_RSA_PAD_MODE_PSS)
                                                                                                                                                                                                                                          • \"mgf1-digest\" (OSSL_SIGNATURE_PARAM_MGF1_DIGEST)

                                                                                                                                                                                                                                            The digest algorithm name to use for the maskGenAlgorithm used by \"pss\" mode.

                                                                                                                                                                                                                                          • \"mgf1-properties\" (OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES)

                                                                                                                                                                                                                                            Sets the name of the property query associated with the \"mgf1-digest\" algorithm. NULL is used if this optional value is not set.

                                                                                                                                                                                                                                          • \"saltlen\" (OSSL_SIGNATURE_PARAM_PSS_SALTLEN) <integer> or

                                                                                                                                                                                                                                            The \"pss\" mode minimum salt length. The value can either be an integer, a string value representing a number or one of the following string values:

                                                                                                                                                                                                                                            • \"digest\" (OSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST)

                                                                                                                                                                                                                                              Use the same length as the digest size.

                                                                                                                                                                                                                                            • \"max\" (OSSL_PKEY_RSA_PSS_SALT_LEN_MAX)

                                                                                                                                                                                                                                              Use the maximum salt length.

                                                                                                                                                                                                                                            • \"auto\" (OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO)

                                                                                                                                                                                                                                              Auto detect the salt length.

                                                                                                                                                                                                                                            • \"auto-digestmax\" (OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO_DIGEST_MAX)

                                                                                                                                                                                                                                              Auto detect the salt length when verifying. Maximize the salt length up to the digest size when signing to comply with FIPS 186-4 section 5.5.

                                                                                                                                                                                                                                            The following signature parameters can be retrieved using EVP_PKEY_CTX_get_params().

                                                                                                                                                                                                                                            • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>

                                                                                                                                                                                                                                              This common parameter is described in provider-signature(7).

                                                                                                                                                                                                                                            • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                                                                                                                                                            • \"pad-mode\" (OSSL_SIGNATURE_PARAM_PAD_MODE)
                                                                                                                                                                                                                                            • \"mgf1-digest\" (OSSL_SIGNATURE_PARAM_MGF1_DIGEST)
                                                                                                                                                                                                                                            • \"saltlen\" (OSSL_SIGNATURE_PARAM_PSS_SALTLEN) <integer> or

                                                                                                                                                                                                                                              These parameters are as described above.

                                                                                                                                                                                                                                              "},{"location":"man7/EVP_SIGNATURE-RSA/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              EVP_PKEY_CTX_set_params(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), provider-signature(7),

                                                                                                                                                                                                                                              "},{"location":"man7/EVP_SIGNATURE-RSA/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/","title":"OSSL_PROVIDER-FIPS","text":""},{"location":"man7/OSSL_PROVIDER-FIPS/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              OSSL_PROVIDER-FIPS - OpenSSL FIPS provider

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The OpenSSL FIPS provider is a special provider that conforms to the Federal Information Processing Standards (FIPS) specified in FIPS 140-3. This 'module' contains an approved set of cryptographic algorithms that is validated by an accredited testing laboratory.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#properties","title":"Properties","text":"

                                                                                                                                                                                                                                              The implementations in this provider specifically have these properties defined:

                                                                                                                                                                                                                                              • \"provider=fips\"
                                                                                                                                                                                                                                              • \"fips=yes\"

                                                                                                                                                                                                                                              It may be used in a property query string with fetching functions such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3), as well as with other functions that take a property query string, such as EVP_PKEY_CTX_new_from_name(3).

                                                                                                                                                                                                                                              To be FIPS compliant, it is mandatory to include fips=yes as part of all property queries. This ensures that only FIPS approved implementations are used for cryptographic operations. The fips=yes query may also include other non-crypto support operations that are not in the FIPS provider, such as asymmetric key encoders, see \"Asymmetric Key Management\" in OSSL_PROVIDER-default(7).

                                                                                                                                                                                                                                              It is not mandatory to include provider=fips as part of your property query. Including provider=fips in your property query guarantees that the OpenSSL FIPS provider is used for cryptographic operations rather than other FIPS capable providers.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#provider-parameters","title":"Provider parameters","text":"

                                                                                                                                                                                                                                              See \"Provider parameters\" in provider-base(7) for a list of base parameters. Additionally the OpenSSL FIPS provider also supports the following gettable parameters:

                                                                                                                                                                                                                                              • \"security-checks\" (OSSL_OSSL_PROV_PARAM_SECURITY_CHECKS) <unsigned integer>

                                                                                                                                                                                                                                                For further information refer to the openssl-fipsinstall(1) option -no_security_checks.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                                                                                                                                                              The OpenSSL FIPS provider supports these operations and algorithms:

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#hashing-algorithms-message-digests","title":"Hashing Algorithms / Message Digests","text":"
                                                                                                                                                                                                                                              • SHA1, see EVP_MD-SHA1(7)
                                                                                                                                                                                                                                              • SHA2, see EVP_MD-SHA2(7)
                                                                                                                                                                                                                                              • SHA3, see EVP_MD-SHA3(7)
                                                                                                                                                                                                                                              • KECCAK-KMAC, see EVP_MD-KECCAK-KMAC(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#symmetric-ciphers","title":"Symmetric Ciphers","text":"
                                                                                                                                                                                                                                              • AES, see EVP_CIPHER-AES(7)
                                                                                                                                                                                                                                              • DES-EDE3 (TripleDES), see EVP_CIPHER-DES(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#message-authentication-code-mac","title":"Message Authentication Code (MAC)","text":"
                                                                                                                                                                                                                                              • CMAC, see EVP_MAC-CMAC(7)
                                                                                                                                                                                                                                              • GMAC, see EVP_MAC-GMAC(7)
                                                                                                                                                                                                                                              • HMAC, see EVP_MAC-HMAC(7)
                                                                                                                                                                                                                                              • KMAC, see EVP_MAC-KMAC(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#key-derivation-function-kdf","title":"Key Derivation Function (KDF)","text":"
                                                                                                                                                                                                                                              • HKDF, see EVP_KDF-HKDF(7)
                                                                                                                                                                                                                                              • TLS13-KDF, see EVP_KDF-TLS13_KDF(7)
                                                                                                                                                                                                                                              • SSKDF, see EVP_KDF-SS(7)
                                                                                                                                                                                                                                              • PBKDF2, see EVP_KDF-PBKDF2(7)
                                                                                                                                                                                                                                              • SSHKDF, see EVP_KDF-SSHKDF(7)
                                                                                                                                                                                                                                              • TLS1-PRF, see EVP_KDF-TLS1_PRF(7)
                                                                                                                                                                                                                                              • KBKDF, see EVP_KDF-KB(7)
                                                                                                                                                                                                                                              • X942KDF-ASN1, see EVP_KDF-X942-ASN1(7)
                                                                                                                                                                                                                                              • X942KDF-CONCAT, see EVP_KDF-X942-CONCAT(7)
                                                                                                                                                                                                                                              • X963KDF, see EVP_KDF-X963(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#key-exchange","title":"Key Exchange","text":"
                                                                                                                                                                                                                                              • DH, see EVP_KEYEXCH-DH(7)
                                                                                                                                                                                                                                              • ECDH, see EVP_KEYEXCH-ECDH(7)
                                                                                                                                                                                                                                              • X25519, see EVP_KEYEXCH-X25519(7)
                                                                                                                                                                                                                                              • X448, see EVP_KEYEXCH-X448(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-signature","title":"Asymmetric Signature","text":"
                                                                                                                                                                                                                                              • RSA, see EVP_SIGNATURE-RSA(7)
                                                                                                                                                                                                                                              • X25519, see EVP_SIGNATURE-ED25519(7)
                                                                                                                                                                                                                                              • X448, see EVP_SIGNATURE-ED448(7)
                                                                                                                                                                                                                                              • HMAC, see EVP_SIGNATURE-HMAC(7)
                                                                                                                                                                                                                                              • CMAC, see EVP_SIGNATURE-CMAC(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-cipher","title":"Asymmetric Cipher","text":"
                                                                                                                                                                                                                                              • RSA, see EVP_ASYM_CIPHER-RSA(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-key-encapsulation","title":"Asymmetric Key Encapsulation","text":"
                                                                                                                                                                                                                                              • RSA, see EVP_KEM-RSA(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#asymmetric-key-management","title":"Asymmetric Key Management","text":"
                                                                                                                                                                                                                                              • DH, see EVP_KEYMGMT-DH(7)
                                                                                                                                                                                                                                              • DHX, see EVP_KEYMGMT-DHX(7)
                                                                                                                                                                                                                                              • DSA, see EVP_KEYMGMT-DSA(7)
                                                                                                                                                                                                                                              • RSA, see EVP_KEYMGMT-RSA(7)
                                                                                                                                                                                                                                              • EC, see EVP_KEYMGMT-EC(7)
                                                                                                                                                                                                                                              • X25519, see EVP_KEYMGMT-X25519(7)
                                                                                                                                                                                                                                              • X448, see EVP_KEYMGMT-X448(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#random-number-generation","title":"Random Number Generation","text":"
                                                                                                                                                                                                                                              • CTR-DRBG, see EVP_RAND-CTR-DRBG(7)
                                                                                                                                                                                                                                              • HASH-DRBG, see EVP_RAND-HASH-DRBG(7)
                                                                                                                                                                                                                                              • HMAC-DRBG, see EVP_RAND-HMAC-DRBG(7)
                                                                                                                                                                                                                                              • TEST-RAND, see EVP_RAND-TEST-RAND(7)

                                                                                                                                                                                                                                                TEST-RAND is an unapproved algorithm.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#self-testing","title":"SELF TESTING","text":"

                                                                                                                                                                                                                                              One of the requirements for the FIPS module is self testing. An optional callback mechanism is available to return information to the user using OSSL_SELF_TEST_set_callback(3).

                                                                                                                                                                                                                                              The parameters passed to the callback are described in OSSL_SELF_TEST_new(3)

                                                                                                                                                                                                                                              The OpenSSL FIPS module uses the following mechanism to provide information about the self tests as they run. This is useful for debugging if a self test is failing. The callback also allows forcing any self test to fail, in order to check that it operates correctly on failure. Note that all self tests run even if a self test failure occurs.

                                                                                                                                                                                                                                              The FIPS module passes the following type(s) to OSSL_SELF_TEST_onbegin().

                                                                                                                                                                                                                                              • \"Module_Integrity\" (OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY)

                                                                                                                                                                                                                                                Uses HMAC SHA256 on the module file to validate that the module has not been modified. The integrity value is compared to a value written to a configuration file during installation.

                                                                                                                                                                                                                                              • \"Install_Integrity\" (OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY)

                                                                                                                                                                                                                                                Uses HMAC SHA256 on a fixed string to validate that the installation process has already been performed and the self test KATS have already been tested, The integrity value is compared to a value written to a configuration file after successfully running the self tests during installation.

                                                                                                                                                                                                                                              • \"KAT_Cipher\" (OSSL_SELF_TEST_TYPE_KAT_CIPHER)

                                                                                                                                                                                                                                                Known answer test for a symmetric cipher.

                                                                                                                                                                                                                                              • \"KAT_AsymmetricCipher\" (OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER)

                                                                                                                                                                                                                                                Known answer test for a asymmetric cipher.

                                                                                                                                                                                                                                              • \"KAT_Digest\" (OSSL_SELF_TEST_TYPE_KAT_DIGEST)

                                                                                                                                                                                                                                                Known answer test for a digest.

                                                                                                                                                                                                                                              • \"KAT_Signature\" (OSSL_SELF_TEST_TYPE_KAT_SIGNATURE)

                                                                                                                                                                                                                                                Known answer test for a signature.

                                                                                                                                                                                                                                              • \"PCT_Signature\" (OSSL_SELF_TEST_TYPE_PCT_SIGNATURE)

                                                                                                                                                                                                                                                Pairwise Consistency check for a signature.

                                                                                                                                                                                                                                              • \"KAT_KDF\" (OSSL_SELF_TEST_TYPE_KAT_KDF)

                                                                                                                                                                                                                                                Known answer test for a key derivation function.

                                                                                                                                                                                                                                              • \"KAT_KA\" (OSSL_SELF_TEST_TYPE_KAT_KA)

                                                                                                                                                                                                                                                Known answer test for key agreement.

                                                                                                                                                                                                                                              • \"DRBG\" (OSSL_SELF_TEST_TYPE_DRBG)

                                                                                                                                                                                                                                                Known answer test for a Deterministic Random Bit Generator.

                                                                                                                                                                                                                                              • \"Conditional_PCT\" (OSSL_SELF_TEST_TYPE_PCT)

                                                                                                                                                                                                                                                Conditional test that is run during the generation of key pairs.

                                                                                                                                                                                                                                              • \"Continuous_RNG_Test\" (OSSL_SELF_TEST_TYPE_CRNG)

                                                                                                                                                                                                                                                Continuous random number generator test.

                                                                                                                                                                                                                                              The \"Module_Integrity\" self test is always run at startup. The \"Install_Integrity\" self test is used to check if the self tests have already been run at installation time. If they have already run then the self tests are not run on subsequent startups. All other self test categories are run once at installation time, except for the \"Pairwise_Consistency_Test\".

                                                                                                                                                                                                                                              There is only one instance of the \"Module_Integrity\" and \"Install_Integrity\" self tests. All other self tests may have multiple instances.

                                                                                                                                                                                                                                              The FIPS module passes the following descriptions(s) to OSSL_SELF_TEST_onbegin().

                                                                                                                                                                                                                                              • \"HMAC\" (OSSL_SELF_TEST_DESC_INTEGRITY_HMAC)

                                                                                                                                                                                                                                                \"Module_Integrity\" and \"Install_Integrity\" use this.

                                                                                                                                                                                                                                              • \"RSA\" (OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1)

                                                                                                                                                                                                                                              • \"ECDSA\" (OSSL_SELF_TEST_DESC_PCT_ECDSA)
                                                                                                                                                                                                                                              • \"DSA\" (OSSL_SELF_TEST_DESC_PCT_DSA)

                                                                                                                                                                                                                                                Key generation tests used with the \"Pairwise_Consistency_Test\" type.

                                                                                                                                                                                                                                              • \"RSA_Encrypt\" (OSSL_SELF_TEST_DESC_ASYM_RSA_ENC)

                                                                                                                                                                                                                                              • \"RSA_Decrypt\" (OSSL_SELF_TEST_DESC_ASYM_RSA_DEC)

                                                                                                                                                                                                                                                \"KAT_AsymmetricCipher\" uses this to indicate an encrypt or decrypt KAT.

                                                                                                                                                                                                                                              • \"AES_GCM\" (OSSL_SELF_TEST_DESC_CIPHER_AES_GCM)

                                                                                                                                                                                                                                              • \"AES_ECB_Decrypt\" (OSSL_SELF_TEST_DESC_CIPHER_AES_ECB)
                                                                                                                                                                                                                                              • \"TDES\" (OSSL_SELF_TEST_DESC_CIPHER_TDES)

                                                                                                                                                                                                                                                Symmetric cipher tests used with the \"KAT_Cipher\" type.

                                                                                                                                                                                                                                              • \"SHA1\" (OSSL_SELF_TEST_DESC_MD_SHA1)

                                                                                                                                                                                                                                              • \"SHA2\" (OSSL_SELF_TEST_DESC_MD_SHA2)
                                                                                                                                                                                                                                              • \"SHA3\" (OSSL_SELF_TEST_DESC_MD_SHA3)

                                                                                                                                                                                                                                                Digest tests used with the \"KAT_Digest\" type.

                                                                                                                                                                                                                                              • \"DSA\" (OSSL_SELF_TEST_DESC_SIGN_DSA)

                                                                                                                                                                                                                                              • \"RSA\" (OSSL_SELF_TEST_DESC_SIGN_RSA)
                                                                                                                                                                                                                                              • \"ECDSA\" (OSSL_SELF_TEST_DESC_SIGN_ECDSA)

                                                                                                                                                                                                                                                Signature tests used with the \"KAT_Signature\" type.

                                                                                                                                                                                                                                              • \"ECDH\" (OSSL_SELF_TEST_DESC_KA_ECDH)

                                                                                                                                                                                                                                              • \"DH\" (OSSL_SELF_TEST_DESC_KA_DH)

                                                                                                                                                                                                                                                Key agreement tests used with the \"KAT_KA\" type.

                                                                                                                                                                                                                                              • \"HKDF\" (OSSL_SELF_TEST_DESC_KDF_HKDF)

                                                                                                                                                                                                                                              • \"TLS13_KDF_EXTRACT\" (OSSL_SELF_TEST_DESC_KDF_TLS13_EXTRACT)
                                                                                                                                                                                                                                              • \"TLS13_KDF_EXPAND\" (OSSL_SELF_TEST_DESC_KDF_TLS13_EXPAND)
                                                                                                                                                                                                                                              • \"SSKDF\" (OSSL_SELF_TEST_DESC_KDF_SSKDF)
                                                                                                                                                                                                                                              • \"X963KDF\" (OSSL_SELF_TEST_DESC_KDF_X963KDF)
                                                                                                                                                                                                                                              • \"X942KDF\" (OSSL_SELF_TEST_DESC_KDF_X942KDF)
                                                                                                                                                                                                                                              • \"PBKDF2\" (OSSL_SELF_TEST_DESC_KDF_PBKDF2)
                                                                                                                                                                                                                                              • \"SSHKDF\" (OSSL_SELF_TEST_DESC_KDF_SSHKDF)
                                                                                                                                                                                                                                              • \"TLS12_PRF\" (OSSL_SELF_TEST_DESC_KDF_TLS12_PRF)
                                                                                                                                                                                                                                              • \"KBKDF\" (OSSL_SELF_TEST_DESC_KDF_KBKDF)

                                                                                                                                                                                                                                                Key Derivation Function tests used with the \"KAT_KDF\" type.

                                                                                                                                                                                                                                              • \"CTR\" (OSSL_SELF_TEST_DESC_DRBG_CTR)

                                                                                                                                                                                                                                              • \"HASH\" (OSSL_SELF_TEST_DESC_DRBG_HASH)
                                                                                                                                                                                                                                              • \"HMAC\" (OSSL_SELF_TEST_DESC_DRBG_HMAC)

                                                                                                                                                                                                                                                DRBG tests used with the \"DRBG\" type.

                                                                                                                                                                                                                                                = item \"RNG\" (OSSL_SELF_TEST_DESC_RNG)

                                                                                                                                                                                                                                                \"Continuous_RNG_Test\" uses this.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                                              A simple self test callback is shown below for illustrative purposes.

                                                                                                                                                                                                                                              #include <openssl/self_test.h>\n\nstatic OSSL_CALLBACK self_test_cb;\n\nstatic int self_test_cb(const OSSL_PARAM params[], void *arg)\n{\n  int ret = 0;\n  const OSSL_PARAM *p = NULL;\n  const char *phase = NULL, *type = NULL, *desc = NULL;\n\n  p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_PHASE);\n  if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)\n      goto err;\n  phase = (const char *)p->data;\n\n  p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_DESC);\n  if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)\n      goto err;\n  desc = (const char *)p->data;\n\n  p = OSSL_PARAM_locate_const(params, OSSL_PROV_PARAM_SELF_TEST_TYPE);\n  if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING)\n      goto err;\n  type = (const char *)p->data;\n\n  /* Do some logging */\n  if (strcmp(phase, OSSL_SELF_TEST_PHASE_START) == 0)\n      BIO_printf(bio_out, \"%s : (%s) : \", desc, type);\n  if (strcmp(phase, OSSL_SELF_TEST_PHASE_PASS) == 0\n          || strcmp(phase, OSSL_SELF_TEST_PHASE_FAIL) == 0)\n      BIO_printf(bio_out, \"%s\\n\", phase);\n\n  /* Corrupt the SHA1 self test during the 'corrupt' phase by returning 0 */\n  if (strcmp(phase, OSSL_SELF_TEST_PHASE_CORRUPT) == 0\n          && strcmp(desc, OSSL_SELF_TEST_DESC_MD_SHA1) == 0) {\n      BIO_printf(bio_out, \"%s %s\", phase, desc);\n      return 0;\n  }\n  ret = 1;\nerr:\n  return ret;\n}\n
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              Some released versions of OpenSSL do not include a validated FIPS provider. To determine which versions have undergone the validation process, please refer to the OpenSSL Downloads page. If you require FIPS-approved functionality, it is essential to build your FIPS provider using one of the validated versions listed there. Normally, it is possible to utilize a FIPS provider constructed from one of the validated versions alongside libcrypto and libssl compiled from any release within the same major release series. This flexibility enables you to address bug fixes and CVEs that fall outside the FIPS boundary.

                                                                                                                                                                                                                                              The FIPS provider in OpenSSL 3.1 includes some non-FIPS validated algorithms, consequently the property query fips=yes is mandatory for applications that want to operate in a FIPS approved manner. The algorithms are:

                                                                                                                                                                                                                                              • Triple DES ECB
                                                                                                                                                                                                                                              • Triple DES CBC
                                                                                                                                                                                                                                              • EdDSA
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              openssl-fipsinstall(1), fips_config(5), OSSL_SELF_TEST_set_callback(3), OSSL_SELF_TEST_new(3), OSSL_PARAM(3), openssl-core.h(7), openssl-core_dispatch.h(7), provider(7), https://www.openssl.org/source/

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-FIPS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/","title":"OSSL_PROVIDER-base","text":""},{"location":"man7/OSSL_PROVIDER-base/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              OSSL_PROVIDER-base - OpenSSL base provider

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The OpenSSL base provider supplies the encoding for OpenSSL's asymmetric cryptography.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/#properties","title":"Properties","text":"

                                                                                                                                                                                                                                              The implementations in this provider specifically have this property defined:

                                                                                                                                                                                                                                              • \"provider=base\"

                                                                                                                                                                                                                                              It may be used in a property query string with fetching functions.

                                                                                                                                                                                                                                              It isn't mandatory to query for this property, except to make sure to get implementations of this provider and none other.

                                                                                                                                                                                                                                              • \"type=parameters\"
                                                                                                                                                                                                                                              • \"type=private\"
                                                                                                                                                                                                                                              • \"type=public\"

                                                                                                                                                                                                                                              These may be used in a property query string with fetching functions to select which data are to be encoded. Either the private key material, the public key material or the domain parameters can be selected.

                                                                                                                                                                                                                                              • \"format=der\"
                                                                                                                                                                                                                                              • \"format=pem\"
                                                                                                                                                                                                                                              • \"format=text\"

                                                                                                                                                                                                                                              These may be used in a property query string with fetching functions to select the encoding output format. Either the DER, PEM and plaintext are currently permitted.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                                                                                                                                                              The OpenSSL base provider supports these operations and algorithms:

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/#asymmetric-key-encoder","title":"Asymmetric Key Encoder","text":"

                                                                                                                                                                                                                                              In addition to \"provider=base\", some of these encoders define the property \"fips=yes\", to allow them to be used together with the FIPS provider.

                                                                                                                                                                                                                                              • RSA, see OSSL_ENCODER-RSA(7)
                                                                                                                                                                                                                                              • DH, see OSSL_ENCODER-DH(7)
                                                                                                                                                                                                                                              • DSA, see OSSL_ENCODER-DSA(7)
                                                                                                                                                                                                                                              • EC, see OSSL_ENCODER-EC(7)
                                                                                                                                                                                                                                              • X25519, see OSSL_ENCODER-X25519(7)
                                                                                                                                                                                                                                              • X448, see OSSL_ENCODER-X448(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              OSSL_PROVIDER-default(7), openssl-core.h(7), openssl-core_dispatch.h(7), provider(7)

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-base/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/","title":"OSSL_PROVIDER-default","text":""},{"location":"man7/OSSL_PROVIDER-default/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              OSSL_PROVIDER-default - OpenSSL default provider

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The OpenSSL default provider supplies the majority of OpenSSL's diverse algorithm implementations. If an application doesn't specify anything else explicitly (e.g. in the application or via config), then this is the provider that will be used as fallback: It is loaded automatically the first time that an algorithm is fetched from a provider or a function acting on providers is called and no other provider has been loaded yet.

                                                                                                                                                                                                                                              If an attempt to load a provider has already been made (whether successful or not) then the default provider won't be loaded automatically. Therefore if the default provider is to be used in conjunction with other providers then it must be loaded explicitly. Automatic loading of the default provider only occurs a maximum of once; if the default provider is explicitly unloaded then the default provider will not be automatically loaded again.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#properties","title":"Properties","text":"

                                                                                                                                                                                                                                              The implementations in this provider specifically have this property defined:

                                                                                                                                                                                                                                              • \"provider=default\"

                                                                                                                                                                                                                                              It may be used in a property query string with fetching functions such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3), as well as with other functions that take a property query string, such as EVP_PKEY_CTX_new_from_name(3).

                                                                                                                                                                                                                                              It isn't mandatory to query for this property, except to make sure to get implementations of this provider and none other.

                                                                                                                                                                                                                                              Some implementations may define additional properties. Exact information is listed below

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                                                                                                                                                              The OpenSSL default provider supports these operations and algorithms:

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#hashing-algorithms-message-digests","title":"Hashing Algorithms / Message Digests","text":"
                                                                                                                                                                                                                                              • SHA1, see EVP_MD-SHA1(7)
                                                                                                                                                                                                                                              • SHA2, see EVP_MD-SHA2(7)
                                                                                                                                                                                                                                              • SHA3, see EVP_MD-SHA3(7)
                                                                                                                                                                                                                                              • KECCAK-KMAC, see EVP_MD-KECCAK-KMAC(7)
                                                                                                                                                                                                                                              • SHAKE, see EVP_MD-SHAKE(7)
                                                                                                                                                                                                                                              • BLAKE2, see EVP_MD-BLAKE2(7)
                                                                                                                                                                                                                                              • SM3, see EVP_MD-SM3(7)
                                                                                                                                                                                                                                              • MD5, see EVP_MD-MD5(7)
                                                                                                                                                                                                                                              • MD5-SHA1, see EVP_MD-MD5-SHA1(7)
                                                                                                                                                                                                                                              • RIPEMD160, see EVP_MD-RIPEMD160(7)
                                                                                                                                                                                                                                              • NULL, see EVP_MD-NULL(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#symmetric-ciphers","title":"Symmetric Ciphers","text":"
                                                                                                                                                                                                                                              • AES, see EVP_CIPHER-AES(7)
                                                                                                                                                                                                                                              • ARIA, see EVP_CIPHER-ARIA(7)
                                                                                                                                                                                                                                              • CAMELLIA, see EVP_CIPHER-CAMELLIA(7)
                                                                                                                                                                                                                                              • 3DES, see EVP_CIPHER-DES(7)
                                                                                                                                                                                                                                              • SEED, see EVP_CIPHER-SEED(7)
                                                                                                                                                                                                                                              • SM4, see EVP_CIPHER-SM4(7)
                                                                                                                                                                                                                                              • ChaCha20, see EVP_CIPHER-CHACHA(7)
                                                                                                                                                                                                                                              • ChaCha20-Poly1305, see EVP_CIPHER-CHACHA(7)
                                                                                                                                                                                                                                              • NULL, see EVP_CIPHER-NULL(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#message-authentication-code-mac","title":"Message Authentication Code (MAC)","text":"
                                                                                                                                                                                                                                              • BLAKE2, see EVP_MAC-BLAKE2(7)
                                                                                                                                                                                                                                              • CMAC, see EVP_MAC-CMAC(7)
                                                                                                                                                                                                                                              • GMAC, see EVP_MAC-GMAC(7)
                                                                                                                                                                                                                                              • HMAC, see EVP_MAC-HMAC(7)
                                                                                                                                                                                                                                              • KMAC, see EVP_MAC-KMAC(7)
                                                                                                                                                                                                                                              • SIPHASH, see EVP_MAC-Siphash(7)
                                                                                                                                                                                                                                              • POLY1305, see EVP_MAC-Poly1305(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#key-derivation-function-kdf","title":"Key Derivation Function (KDF)","text":"
                                                                                                                                                                                                                                              • HKDF, see EVP_KDF-HKDF(7)
                                                                                                                                                                                                                                              • SSKDF, see EVP_KDF-SS(7)
                                                                                                                                                                                                                                              • PBKDF2, see EVP_KDF-PBKDF2(7)
                                                                                                                                                                                                                                              • PKCS12KDF, see EVP_KDF-PKCS12KDF(7)
                                                                                                                                                                                                                                              • SSHKDF, see EVP_KDF-SSHKDF(7)
                                                                                                                                                                                                                                              • TLS1-PRF, see EVP_KDF-TLS1_PRF(7)
                                                                                                                                                                                                                                              • KBKDF, see EVP_KDF-KB(7)
                                                                                                                                                                                                                                              • X942KDF-ASN1, see EVP_KDF-X942-ASN1(7)
                                                                                                                                                                                                                                              • X942KDF-CONCAT, see EVP_KDF-X942-CONCAT(7)
                                                                                                                                                                                                                                              • X963KDF, see EVP_KDF-X963(7)
                                                                                                                                                                                                                                              • SCRYPT, see EVP_KDF-SCRYPT(7)
                                                                                                                                                                                                                                              • KRB5KDF, see EVP_KDF-KRB5KDF(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#key-exchange","title":"Key Exchange","text":"
                                                                                                                                                                                                                                              • DH, see EVP_KEYEXCH-DH(7)
                                                                                                                                                                                                                                              • ECDH, see EVP_KEYEXCH-ECDH(7)
                                                                                                                                                                                                                                              • X25519, see EVP_KEYEXCH-X25519(7)
                                                                                                                                                                                                                                              • X448, see EVP_KEYEXCH-X448(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-signature","title":"Asymmetric Signature","text":"
                                                                                                                                                                                                                                              • DSA, see EVP_SIGNATURE-DSA(7)
                                                                                                                                                                                                                                              • RSA, see EVP_SIGNATURE-RSA(7)
                                                                                                                                                                                                                                              • HMAC, see EVP_SIGNATURE-HMAC(7)
                                                                                                                                                                                                                                              • SIPHASH, see EVP_SIGNATURE-Siphash(7)
                                                                                                                                                                                                                                              • POLY1305, see EVP_SIGNATURE-Poly1305(7)
                                                                                                                                                                                                                                              • CMAC, see EVP_SIGNATURE-CMAC(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-cipher","title":"Asymmetric Cipher","text":"
                                                                                                                                                                                                                                              • RSA, see EVP_ASYM_CIPHER-RSA(7)
                                                                                                                                                                                                                                              • SM2, see EVP_ASYM_CIPHER-SM2(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-key-encapsulation","title":"Asymmetric Key Encapsulation","text":"
                                                                                                                                                                                                                                              • RSA, see EVP_KEM-RSA(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-key-management","title":"Asymmetric Key Management","text":"
                                                                                                                                                                                                                                              • DH, see EVP_KEYMGMT-DH(7)
                                                                                                                                                                                                                                              • DHX, see EVP_KEYMGMT-DHX(7)
                                                                                                                                                                                                                                              • DSA, see EVP_KEYMGMT-DSA(7)
                                                                                                                                                                                                                                              • RSA, see EVP_KEYMGMT-RSA(7)
                                                                                                                                                                                                                                              • EC, see EVP_KEYMGMT-EC(7)
                                                                                                                                                                                                                                              • X25519, see EVP_KEYMGMT-X25519(7)
                                                                                                                                                                                                                                              • X448, see EVP_KEYMGMT-X448(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#random-number-generation","title":"Random Number Generation","text":"
                                                                                                                                                                                                                                              • CTR-DRBG, see EVP_RAND-CTR-DRBG(7)
                                                                                                                                                                                                                                              • HASH-DRBG, see EVP_RAND-HASH-DRBG(7)
                                                                                                                                                                                                                                              • HMAC-DRBG, see EVP_RAND-HMAC-DRBG(7)
                                                                                                                                                                                                                                              • SEED-SRC, see EVP_RAND-SEED-SRC(7)
                                                                                                                                                                                                                                              • TEST-RAND, see EVP_RAND-TEST-RAND(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#asymmetric-key-encoder","title":"Asymmetric Key Encoder","text":"

                                                                                                                                                                                                                                              The default provider also includes all of the encoding algorithms present in the base provider. Some of these have the property \"fips=yes\", to allow them to be used together with the FIPS provider.

                                                                                                                                                                                                                                              • RSA, see OSSL_ENCODER-RSA(7)
                                                                                                                                                                                                                                              • DH, see OSSL_ENCODER-DH(7)
                                                                                                                                                                                                                                              • DSA, see OSSL_ENCODER-DSA(7)
                                                                                                                                                                                                                                              • EC, see OSSL_ENCODER-EC(7)
                                                                                                                                                                                                                                              • X25519, see OSSL_ENCODER-X25519(7)
                                                                                                                                                                                                                                              • X448, see OSSL_ENCODER-X448(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              openssl-core.h(7), openssl-core_dispatch.h(7), provider(7), OSSL_PROVIDER-base(7)

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The RIPEMD160 digest was added to the default provider in OpenSSL 3.0.7.

                                                                                                                                                                                                                                              All other functionality was added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-default/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/","title":"OSSL_PROVIDER-legacy","text":""},{"location":"man7/OSSL_PROVIDER-legacy/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              OSSL_PROVIDER-legacy - OpenSSL legacy provider

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The OpenSSL legacy provider supplies OpenSSL implementations of algorithms that have been deemed legacy. Such algorithms have commonly fallen out of use, have been deemed insecure by the cryptography community, or something similar.

                                                                                                                                                                                                                                              We can consider this the retirement home of cryptographic algorithms.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#properties","title":"Properties","text":"

                                                                                                                                                                                                                                              The implementations in this provider specifically has this property defined:

                                                                                                                                                                                                                                              • \"provider=legacy\"

                                                                                                                                                                                                                                              It may be used in a property query string with fetching functions such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3), as well as with other functions that take a property query string, such as EVP_PKEY_CTX_new_from_name(3).

                                                                                                                                                                                                                                              It isn't mandatory to query for any of these properties, except to make sure to get implementations of this provider and none other.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                                                                                                                                                              The OpenSSL legacy provider supports these operations and algorithms:

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#hashing-algorithms-message-digests","title":"Hashing Algorithms / Message Digests","text":"
                                                                                                                                                                                                                                              • MD2, see EVP_MD-MD2(7)
                                                                                                                                                                                                                                              • MD4, see EVP_MD-MD4(7)
                                                                                                                                                                                                                                              • MDC2, see EVP_MD-MDC2(7)
                                                                                                                                                                                                                                              • WHIRLPOOL, see EVP_MD-WHIRLPOOL(7)
                                                                                                                                                                                                                                              • RIPEMD160, see EVP_MD-RIPEMD160(7)
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#symmetric-ciphers","title":"Symmetric Ciphers","text":"

                                                                                                                                                                                                                                              Not all of these symmetric cipher algorithms are enabled by default.

                                                                                                                                                                                                                                              • Blowfish, see EVP_CIPHER-BLOWFISH(7)
                                                                                                                                                                                                                                              • CAST, see EVP_CIPHER-CAST(7)
                                                                                                                                                                                                                                              • DES, see EVP_CIPHER-DES(7)

                                                                                                                                                                                                                                                The algorithm names are: DES_ECB, DES_CBC, DES_OFB, DES_CFB, DES_CFB1, DES_CFB8 and DESX_CBC.

                                                                                                                                                                                                                                              • IDEA, see EVP_CIPHER-IDEA(7)

                                                                                                                                                                                                                                              • RC2, see EVP_CIPHER-RC2(7)
                                                                                                                                                                                                                                              • RC4, see EVP_CIPHER-RC4(7)
                                                                                                                                                                                                                                              • RC5, see EVP_CIPHER-RC5(7)

                                                                                                                                                                                                                                                Disabled by default. Use enable-rc5 config option to enable.

                                                                                                                                                                                                                                              • SEED, see EVP_CIPHER-SEED(7)

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#key-derivation-function-kdf","title":"Key Derivation Function (KDF)","text":"
                                                                                                                                                                                                                                              • PBKDF1
                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              OSSL_PARAM(3), openssl-core.h(7), openssl-core_dispatch.h(7), provider(7)

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-legacy/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-null/","title":"OSSL_PROVIDER-null","text":""},{"location":"man7/OSSL_PROVIDER-null/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              OSSL_PROVIDER-null - OpenSSL null provider

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-null/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The OpenSSL null provider supplies no algorithms.

                                                                                                                                                                                                                                              It can used to guarantee that the default library context and a fallback provider will not be accidentally accessed.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-null/#properties","title":"Properties","text":"

                                                                                                                                                                                                                                              The null provider defines no properties.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-null/#operations-and-algorithms","title":"OPERATIONS AND ALGORITHMS","text":"

                                                                                                                                                                                                                                              The OpenSSL null provider supports no operations and algorithms.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-null/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              provider(7)

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-null/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              This functionality was added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/OSSL_PROVIDER-null/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/RAND/","title":"RAND","text":""},{"location":"man7/RAND/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              RAND - the OpenSSL random generator

                                                                                                                                                                                                                                              "},{"location":"man7/RAND/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              Random numbers are a vital part of cryptography, they are needed to provide unpredictability for tasks like key generation, creating salts, and many more. Software-based generators must be seeded with external randomness before they can be used as a cryptographically-secure pseudo-random number generator (CSPRNG). The availability of common hardware with special instructions and modern operating systems, which may use items such as interrupt jitter and network packet timings, can be reasonable sources of seeding material.

                                                                                                                                                                                                                                              OpenSSL comes with a default implementation of the RAND API which is based on the deterministic random bit generator (DRBG) model as described in [NIST SP 800-90A Rev. 1]. The default random generator will initialize automatically on first use and will be fully functional without having to be initialized ('seeded') explicitly. It seeds and reseeds itself automatically using trusted random sources provided by the operating system.

                                                                                                                                                                                                                                              As a normal application developer, you do not have to worry about any details, just use RAND_bytes(3) to obtain random data. Having said that, there is one important rule to obey: Always check the error return value of RAND_bytes(3) and do not take randomness for granted. Although (re-)seeding is automatic, it can fail because no trusted random source is available or the trusted source(s) temporarily fail to provide sufficient random seed material. In this case the CSPRNG enters an error state and ceases to provide output, until it is able to recover from the error by reseeding itself. For more details on reseeding and error recovery, see EVP_RAND(7).

                                                                                                                                                                                                                                              For values that should remain secret, you can use RAND_priv_bytes(3) instead. This method does not provide 'better' randomness, it uses the same type of CSPRNG. The intention behind using a dedicated CSPRNG exclusively for private values is that none of its output should be visible to an attacker (e.g., used as salt value), in order to reveal as little information as possible about its internal state, and that a compromise of the \"public\" CSPRNG instance will not affect the secrecy of these private values.

                                                                                                                                                                                                                                              In the rare case where the default implementation does not satisfy your special requirements, the default RAND internals can be replaced by your own EVP_RAND(3) objects.

                                                                                                                                                                                                                                              Changing the default random generator should be necessary only in exceptional cases and is not recommended, unless you have a profound knowledge of cryptographic principles and understand the implications of your changes.

                                                                                                                                                                                                                                              "},{"location":"man7/RAND/#default-setup","title":"DEFAULT SETUP","text":"

                                                                                                                                                                                                                                              The default OpenSSL RAND method is based on the EVP_RAND deterministic random bit generator (DRBG) classes. A DRBG is a certain type of cryptographically-secure pseudo-random number generator (CSPRNG), which is described in [NIST SP 800-90A Rev. 1].

                                                                                                                                                                                                                                              "},{"location":"man7/RAND/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              RAND_bytes(3), RAND_priv_bytes(3), EVP_RAND(3), RAND_get0_primary(3), EVP_RAND(7)

                                                                                                                                                                                                                                              "},{"location":"man7/RAND/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/","title":"RSA-PSS","text":""},{"location":"man7/RSA-PSS/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              RSA-PSS - EVP_PKEY RSA-PSS algorithm support

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The RSA-PSS EVP_PKEY implementation is a restricted version of the RSA algorithm which only supports signing, verification and key generation using PSS padding modes with optional parameter restrictions.

                                                                                                                                                                                                                                              It has associated private key and public key formats.

                                                                                                                                                                                                                                              This algorithm shares several control operations with the RSA algorithm but with some restrictions described below.

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/#signing-and-verification","title":"Signing and Verification","text":"

                                                                                                                                                                                                                                              Signing and verification is similar to the RSA algorithm except the padding mode is always PSS. If the key in use has parameter restrictions then the corresponding signature parameters are set to the restrictions: for example, if the key can only be used with digest SHA256, MGF1 SHA256 and minimum salt length 32 then the digest, MGF1 digest and salt length will be set to SHA256, SHA256 and 32 respectively.

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/#key-generation","title":"Key Generation","text":"

                                                                                                                                                                                                                                              By default no parameter restrictions are placed on the generated key.

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              The public key format is documented in RFC4055.

                                                                                                                                                                                                                                              The PKCS#8 private key format used for RSA-PSS keys is similar to the RSA format except it uses the id-RSASSA-PSS OID and the parameters field, if present, restricts the key parameters in the same way as the public key.

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/#conforming-to","title":"CONFORMING TO","text":"

                                                                                                                                                                                                                                              RFC 4055

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              EVP_PKEY_CTX_set_rsa_pss_keygen_md(3), EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(3), EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(3), EVP_PKEY_CTX_new(3), EVP_PKEY_CTX_ctrl_str(3), EVP_PKEY_derive(3)

                                                                                                                                                                                                                                              "},{"location":"man7/RSA-PSS/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/X25519/","title":"X25519","text":""},{"location":"man7/X25519/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              X25519, X448 - EVP_PKEY X25519 and X448 support

                                                                                                                                                                                                                                              "},{"location":"man7/X25519/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The X25519 and X448 EVP_PKEY implementation supports key generation and key derivation using X25519 and X448. It has associated private and public key formats compatible with RFC 8410.

                                                                                                                                                                                                                                              No additional parameters can be set during key generation.

                                                                                                                                                                                                                                              The peer public key must be set using EVP_PKEY_derive_set_peer() when performing key derivation.

                                                                                                                                                                                                                                              "},{"location":"man7/X25519/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              A context for the X25519 algorithm can be obtained by calling:

                                                                                                                                                                                                                                              EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);\n

                                                                                                                                                                                                                                              For the X448 algorithm a context can be obtained by calling:

                                                                                                                                                                                                                                              EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X448, NULL);\n

                                                                                                                                                                                                                                              X25519 or X448 private keys can be set directly using EVP_PKEY_new_raw_private_key(3) or loaded from a PKCS#8 private key file using PEM_read_bio_PrivateKey(3) (or similar function). Completely new keys can also be generated (see the example below). Setting a private key also sets the associated public key.

                                                                                                                                                                                                                                              X25519 or X448 public keys can be set directly using EVP_PKEY_new_raw_public_key(3) or loaded from a SubjectPublicKeyInfo structure in a PEM file using PEM_read_bio_PUBKEY(3) (or similar function).

                                                                                                                                                                                                                                              "},{"location":"man7/X25519/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                                              This example generates an X25519 private key and writes it to standard output in PEM format:

                                                                                                                                                                                                                                              #include <openssl/evp.h>\n#include <openssl/pem.h>\n...\nEVP_PKEY *pkey = NULL;\nEVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);\nEVP_PKEY_keygen_init(pctx);\nEVP_PKEY_keygen(pctx, &pkey);\nEVP_PKEY_CTX_free(pctx);\nPEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);\n

                                                                                                                                                                                                                                              The key derivation example in EVP_PKEY_derive(3) can be used with X25519 and X448.

                                                                                                                                                                                                                                              "},{"location":"man7/X25519/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              EVP_PKEY_CTX_new(3), EVP_PKEY_keygen(3), EVP_PKEY_derive(3), EVP_PKEY_derive_set_peer(3)

                                                                                                                                                                                                                                              "},{"location":"man7/X25519/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/bio/","title":"bio","text":""},{"location":"man7/bio/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              bio - Basic I/O abstraction

                                                                                                                                                                                                                                              "},{"location":"man7/bio/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                              #include <openssl/bio.h>\n
                                                                                                                                                                                                                                              "},{"location":"man7/bio/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              A BIO is an I/O abstraction, it hides many of the underlying I/O details from an application. If an application uses a BIO for its I/O it can transparently handle SSL connections, unencrypted network connections and file I/O.

                                                                                                                                                                                                                                              There are two types of BIO, a source/sink BIO and a filter BIO.

                                                                                                                                                                                                                                              As its name implies a source/sink BIO is a source and/or sink of data, examples include a socket BIO and a file BIO.

                                                                                                                                                                                                                                              A filter BIO takes data from one BIO and passes it through to another, or the application. The data may be left unmodified (for example a message digest BIO) or translated (for example an encryption BIO). The effect of a filter BIO may change according to the I/O operation it is performing: for example an encryption BIO will encrypt data if it is being written to and decrypt data if it is being read from.

                                                                                                                                                                                                                                              BIOs can be joined together to form a chain (a single BIO is a chain with one component). A chain normally consists of one source/sink BIO and one or more filter BIOs. Data read from or written to the first BIO then traverses the chain to the end (normally a source/sink BIO).

                                                                                                                                                                                                                                              Some BIOs (such as memory BIOs) can be used immediately after calling BIO_new(). Others (such as file BIOs) need some additional initialization, and frequently a utility function exists to create and initialize such BIOs.

                                                                                                                                                                                                                                              If BIO_free() is called on a BIO chain it will only free one BIO resulting in a memory leak.

                                                                                                                                                                                                                                              Calling BIO_free_all() on a single BIO has the same effect as calling BIO_free() on it other than the discarded return value.

                                                                                                                                                                                                                                              Normally the type argument is supplied by a function which returns a pointer to a BIO_METHOD. There is a naming convention for such functions: a source/sink BIO typically starts with BIO_s_ and a filter BIO with BIO_f_.

                                                                                                                                                                                                                                              "},{"location":"man7/bio/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                                              Create a memory BIO:

                                                                                                                                                                                                                                              BIO *mem = BIO_new(BIO_s_mem());\n
                                                                                                                                                                                                                                              "},{"location":"man7/bio/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              BIO_ctrl(3), BIO_f_base64(3), BIO_f_buffer(3), BIO_f_cipher(3), BIO_f_md(3), BIO_f_null(3), BIO_f_ssl(3), BIO_f_readbuffer(3), BIO_find_type(3), BIO_new(3), BIO_new_bio_pair(3), BIO_push(3), BIO_read_ex(3), BIO_s_accept(3), BIO_s_bio(3), BIO_s_connect(3), BIO_s_fd(3), BIO_s_file(3), BIO_s_mem(3), BIO_s_null(3), BIO_s_socket(3), BIO_set_callback(3), BIO_should_retry(3)

                                                                                                                                                                                                                                              "},{"location":"man7/bio/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/","title":"crypto","text":""},{"location":"man7/crypto/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              crypto - OpenSSL cryptographic library

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                                                                                                              See the individual manual pages for details.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The OpenSSL crypto library (libcrypto) implements a wide range of cryptographic algorithms used in various Internet standards. The services provided by this library are used by the OpenSSL implementations of TLS and CMS, and they have also been used to implement many other third party products and protocols.

                                                                                                                                                                                                                                              The functionality includes symmetric encryption, public key cryptography, key agreement, certificate handling, cryptographic hash functions, cryptographic pseudo-random number generators, message authentication codes (MACs), key derivation functions (KDFs), and various utilities.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#algorithms","title":"Algorithms","text":"

                                                                                                                                                                                                                                              Cryptographic primitives such as the SHA256 digest, or AES encryption are referred to in OpenSSL as \"algorithms\". Each algorithm may have multiple implementations available for use. For example the RSA algorithm is available as a \"default\" implementation suitable for general use, and a \"fips\" implementation which has been validated to FIPS standards for situations where that is important. It is also possible that a third party could add additional implementations such as in a hardware security module (HSM).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#operations","title":"Operations","text":"

                                                                                                                                                                                                                                              Different algorithms can be grouped together by their purpose. For example there are algorithms for encryption, and different algorithms for digesting data. These different groups are known as \"operations\" in OpenSSL. Each operation has a different set of functions associated with it. For example to perform an encryption operation using AES (or any other encryption algorithm) you would use the encryption functions detailed on the EVP_EncryptInit(3) page. Or to perform a digest operation using SHA256 then you would use the digesting functions on the EVP_DigestInit(3) page.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#providers","title":"Providers","text":"

                                                                                                                                                                                                                                              A provider in OpenSSL is a component that collects together algorithm implementations. In order to use an algorithm you must have at least one provider loaded that contains an implementation of it. OpenSSL comes with a number of providers and they may also be obtained from third parties. If you don't load a provider explicitly (either in program code or via config) then the OpenSSL built-in \"default\" provider will be automatically loaded.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#library-contexts","title":"Library contexts","text":"

                                                                                                                                                                                                                                              A library context can be thought of as a \"scope\" within which configuration options take effect. When a provider is loaded, it is only loaded within the scope of a given library context. In this way it is possible for different components of a complex application to each use a different library context and have different providers loaded with different configuration settings.

                                                                                                                                                                                                                                              If an application does not explicitly create a library context then the \"default\" library context will be used.

                                                                                                                                                                                                                                              Library contexts are represented by the OSSL_LIB_CTX type. Many OpenSSL API functions take a library context as a parameter. Applications can always pass NULL for this parameter to just use the default library context.

                                                                                                                                                                                                                                              The default library context is automatically created the first time it is needed. This will automatically load any available configuration file and will initialise OpenSSL for use. Unlike in earlier versions of OpenSSL (prior to 1.1.0) no explicit initialisation steps need to be taken.

                                                                                                                                                                                                                                              Similarly when the application exits the default library context is automatically destroyed. No explicit de-initialisation steps need to be taken.

                                                                                                                                                                                                                                              See OSSL_LIB_CTX(3) for more information about library contexts. See also \"ALGORITHM FETCHING\".

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#multi-threaded-applications","title":"Multi-threaded applications","text":"

                                                                                                                                                                                                                                              As long as OpenSSL has been built with support for threads (the default case on most platforms) then most OpenSSL functions are thread-safe in the sense that it is safe to call the same function from multiple threads at the same time. However most OpenSSL data structures are not thread-safe. For example the BIO_write(3) and BIO_read(3) functions are thread safe. However it would not be thread safe to call BIO_write() from one thread while calling BIO_read() in another where both functions are passed the same BIO object since both of them may attempt to make changes to the same BIO object.

                                                                                                                                                                                                                                              There are exceptions to these rules. A small number of functions are not thread safe at all. Where this is the case this restriction should be noted in the documentation for the function. Similarly some data structures may be partially or fully thread safe. For example it is safe to use an OSSL_LIB_CTX in multiple threads.

                                                                                                                                                                                                                                              See openssl-threads(7) for a more detailed discussion on OpenSSL threading support.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#algorithm-fetching","title":"ALGORITHM FETCHING","text":"

                                                                                                                                                                                                                                              In order to use an algorithm an implementation for it must first be \"fetched\". Fetching is the process of looking through the available implementations, applying selection criteria (via a property query string), and finally choosing the implementation that will be used.

                                                                                                                                                                                                                                              Two types of fetching are supported by OpenSSL - explicit fetching and implicit fetching.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#property-query-strings","title":"Property query strings","text":"

                                                                                                                                                                                                                                              When fetching an algorithm it is possible to specify a property query string to guide the selection process. For example a property query string of \"provider=default\" could be used to force the selection to only consider algorithm implementations in the default provider.

                                                                                                                                                                                                                                              Property query strings can be specified explicitly as an argument to a function. It is also possible to specify a default property query string for the whole library context using the EVP_set_default_properties(3) or EVP_default_properties_enable_fips(3) functions. Where both default properties and function specific properties are specified then they are combined. Function specific properties will override default properties where there is a conflict.

                                                                                                                                                                                                                                              See property(7) for more information about properties.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#explicit-fetching","title":"Explicit fetching","text":"

                                                                                                                                                                                                                                              Users of the OpenSSL libraries never query a provider directly for an algorithm implementation. Instead, the diverse OpenSSL APIs often have explicit fetching functions that do the work, and they return an appropriate algorithm object back to the user. These functions usually have the name APINAME_fetch, where APINAME is the name of the operation. For example EVP_MD_fetch(3) can be used to explicitly fetch a digest algorithm implementation. The user is responsible for freeing the object returned from the APINAME_fetch function using APINAME_free when it is no longer needed.

                                                                                                                                                                                                                                              These fetching functions follow a fairly common pattern, where three arguments are passed:

                                                                                                                                                                                                                                              • The library context

                                                                                                                                                                                                                                                See OSSL_LIB_CTX(3) for a more detailed description. This may be NULL to signify the default (global) library context, or a context created by the user. Only providers loaded in this library context (see OSSL_PROVIDER_load(3)) will be considered by the fetching function. In case no provider has been loaded in this library context then the default provider will be loaded as a fallback (see OSSL_PROVIDER-default(7)).

                                                                                                                                                                                                                                              • An identifier

                                                                                                                                                                                                                                                For all currently implemented fetching functions this is the algorithm name.

                                                                                                                                                                                                                                              • A property query string

                                                                                                                                                                                                                                                The property query string used to guide selection of the algorithm implementation.

                                                                                                                                                                                                                                              The algorithm implementation that is fetched can then be used with other diverse functions that use them. For example the EVP_DigestInit_ex(3) function takes as a parameter an EVP_MD object which may have been returned from an earlier call to EVP_MD_fetch(3).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#implicit-fetching","title":"Implicit fetching","text":"

                                                                                                                                                                                                                                              OpenSSL has a number of functions that return an algorithm object with no associated implementation, such as EVP_sha256(3), EVP_aes_128_cbc(3), EVP_get_cipherbyname(3) or EVP_get_digestbyname(3). These are present for compatibility with OpenSSL before version 3.0 where explicit fetching was not available.

                                                                                                                                                                                                                                              When they are used with functions like EVP_DigestInit_ex(3) or EVP_CipherInit_ex(3), the actual implementation to be used is fetched implicitly using default search criteria.

                                                                                                                                                                                                                                              In some cases implicit fetching can also occur when a NULL algorithm parameter is supplied. In this case an algorithm implementation is implicitly fetched using default search criteria and an algorithm name that is consistent with the context in which it is being used.

                                                                                                                                                                                                                                              Functions that revolve around EVP_PKEY_CTX and EVP_PKEY(3), such as EVP_DigestSignInit(3) and friends, all fetch the implementations implicitly. Because these functions involve both an operation type (such as EVP_SIGNATURE(3)) and an EVP_KEYMGMT(3) for the EVP_PKEY(3), they try the following:

                                                                                                                                                                                                                                              1. Fetch the operation type implementation from any provider given a library context and property string stored in the EVP_PKEY_CTX.

                                                                                                                                                                                                                                                If the provider of the operation type implementation is different from the provider of the EVP_PKEY(3)'s EVP_KEYMGMT(3) implementation, try to fetch a EVP_KEYMGMT(3) implementation in the same provider as the operation type implementation and export the EVP_PKEY(3) to it (effectively making a temporary copy of the original key).

                                                                                                                                                                                                                                                If anything in this step fails, the next step is used as a fallback.

                                                                                                                                                                                                                                              2. As a fallback, try to fetch the operation type implementation from the same provider as the original EVP_PKEY(3)'s EVP_KEYMGMT(3), still using the property string from the EVP_PKEY_CTX.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#performance","title":"Performance","text":"

                                                                                                                                                                                                                                              If you perform the same operation many times then it is recommended to use \"Explicit fetching\" to prefetch an algorithm once initially, and then pass this created object to any operations that are currently using \"Implicit fetching\". See an example of Explicit fetching in \"USING ALGORITHMS IN APPLICATIONS\".

                                                                                                                                                                                                                                              Prior to OpenSSL 3.0, constant method tables (such as EVP_sha256()) were used directly to access methods. If you pass one of these convenience functions to an operation the fixed methods are ignored, and only the name is used to internally fetch methods from a provider.

                                                                                                                                                                                                                                              If the prefetched object is not passed to operations, then any implicit fetch will use the internally cached prefetched object, but it will still be slower than passing the prefetched object directly.

                                                                                                                                                                                                                                              Fetching via a provider offers more flexibility, but it is slower than the old method, since it must search for the algorithm in all loaded providers, and then populate the method table using provider supplied methods. Internally OpenSSL caches similar algorithms on the first fetch (so loading a digest caches all digests).

                                                                                                                                                                                                                                              The following methods can be used for prefetching:

                                                                                                                                                                                                                                              • EVP_MD_fetch(3)
                                                                                                                                                                                                                                              • EVP_CIPHER_fetch(3)
                                                                                                                                                                                                                                              • EVP_KDF_fetch(3)
                                                                                                                                                                                                                                              • EVP_MAC_fetch(3)
                                                                                                                                                                                                                                              • EVP_KEM_fetch(3)
                                                                                                                                                                                                                                              • OSSL_ENCODER_fetch(3)
                                                                                                                                                                                                                                              • OSSL_DECODER_fetch(3)
                                                                                                                                                                                                                                              • EVP_RAND_fetch(3)

                                                                                                                                                                                                                                              The following methods are used internally when performing operations:

                                                                                                                                                                                                                                              • EVP_KEYMGMT_fetch(3)
                                                                                                                                                                                                                                              • EVP_KEYEXCH_fetch(3)
                                                                                                                                                                                                                                              • EVP_SIGNATURE_fetch(3)
                                                                                                                                                                                                                                              • OSSL_STORE_LOADER_fetch(3)

                                                                                                                                                                                                                                              See OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7) and OSSL_PROVIDER-legacy(7) for a list of algorithm names that can be fetched.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#fetching-examples","title":"FETCHING EXAMPLES","text":"

                                                                                                                                                                                                                                              The following section provides a series of examples of fetching algorithm implementations.

                                                                                                                                                                                                                                              Fetch any available implementation of SHA2-256 in the default context. Note that some algorithms have aliases. So \"SHA256\" and \"SHA2-256\" are synonymous:

                                                                                                                                                                                                                                              EVP_MD *md = EVP_MD_fetch(NULL, \"SHA2-256\", NULL);\n...\nEVP_MD_free(md);\n

                                                                                                                                                                                                                                              Fetch any available implementation of AES-128-CBC in the default context:

                                                                                                                                                                                                                                              EVP_CIPHER *cipher = EVP_CIPHER_fetch(NULL, \"AES-128-CBC\", NULL);\n...\nEVP_CIPHER_free(cipher);\n

                                                                                                                                                                                                                                              Fetch an implementation of SHA2-256 from the default provider in the default context:

                                                                                                                                                                                                                                              EVP_MD *md = EVP_MD_fetch(NULL, \"SHA2-256\", \"provider=default\");\n...\nEVP_MD_free(md);\n

                                                                                                                                                                                                                                              Fetch an implementation of SHA2-256 that is not from the default provider in the default context:

                                                                                                                                                                                                                                              EVP_MD *md = EVP_MD_fetch(NULL, \"SHA2-256\", \"provider!=default\");\n...\nEVP_MD_free(md);\n

                                                                                                                                                                                                                                              Fetch an implementation of SHA2-256 from the default provider in the specified context:

                                                                                                                                                                                                                                              EVP_MD *md = EVP_MD_fetch(ctx, \"SHA2-256\", \"provider=default\");\n...\nEVP_MD_free(md);\n

                                                                                                                                                                                                                                              Load the legacy provider into the default context and then fetch an implementation of WHIRLPOOL from it:

                                                                                                                                                                                                                                              /* This only needs to be done once - usually at application start up */\nOSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, \"legacy\");\n\nEVP_MD *md = EVP_MD_fetch(NULL, \"WHIRLPOOL\", \"provider=legacy\");\n...\nEVP_MD_free(md);\n

                                                                                                                                                                                                                                              Note that in the above example the property string \"provider=legacy\" is optional since, assuming no other providers have been loaded, the only implementation of the \"whirlpool\" algorithm is in the \"legacy\" provider. Also note that the default provider should be explicitly loaded if it is required in addition to other providers:

                                                                                                                                                                                                                                              /* This only needs to be done once - usually at application start up */\nOSSL_PROVIDER *legacy = OSSL_PROVIDER_load(NULL, \"legacy\");\nOSSL_PROVIDER *default = OSSL_PROVIDER_load(NULL, \"default\");\n\nEVP_MD *md_whirlpool = EVP_MD_fetch(NULL, \"whirlpool\", NULL);\nEVP_MD *md_sha256 = EVP_MD_fetch(NULL, \"SHA2-256\", NULL);\n...\nEVP_MD_free(md_whirlpool);\nEVP_MD_free(md_sha256);\n
                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#openssl-providers","title":"OPENSSL PROVIDERS","text":"

                                                                                                                                                                                                                                              OpenSSL comes with a set of providers.

                                                                                                                                                                                                                                              The algorithms available in each of these providers may vary due to build time configuration options. The openssl-list(1) command can be used to list the currently available algorithms.

                                                                                                                                                                                                                                              The names of the algorithms shown from openssl-list(1) can be used as an algorithm identifier to the appropriate fetching function. Also see the provider specific manual pages linked below for further details about using the algorithms available in each of the providers.

                                                                                                                                                                                                                                              As well as the OpenSSL providers third parties can also implement providers. For information on writing a provider see provider(7).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#default-provider","title":"Default provider","text":"

                                                                                                                                                                                                                                              The default provider is built in as part of the libcrypto library and contains all of the most commonly used algorithm implementations. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string \"provider=default\" can be used as a search criterion for these implementations. The default provider includes all of the functionality in the base provider below.

                                                                                                                                                                                                                                              If you don't load any providers at all then the \"default\" provider will be automatically loaded. If you explicitly load any provider then the \"default\" provider would also need to be explicitly loaded if it is required.

                                                                                                                                                                                                                                              See OSSL_PROVIDER-default(7).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#base-provider","title":"Base provider","text":"

                                                                                                                                                                                                                                              The base provider is built in as part of the libcrypto library and contains algorithm implementations for encoding and decoding for OpenSSL keys. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string \"provider=base\" can be used as a search criterion for these implementations. Some encoding and decoding algorithm implementations are not FIPS algorithm implementations in themselves but support algorithms from the FIPS provider and are allowed for use in \"FIPS mode\". The property query string \"fips=yes\" can be used to select such algorithms.

                                                                                                                                                                                                                                              See OSSL_PROVIDER-base(7).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#fips-provider","title":"FIPS provider","text":"

                                                                                                                                                                                                                                              The FIPS provider is a dynamically loadable module, and must therefore be loaded explicitly, either in code or through OpenSSL configuration (see config(5)). It contains algorithm implementations that have been validated according to the FIPS 140-2 standard. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property query string \"provider=fips\" can be used as a search criterion for these implementations. All approved algorithm implementations in the FIPS provider can also be selected with the property \"fips=yes\". The FIPS provider may also contain non-approved algorithm implementations and these can be selected with the property \"fips=no\".

                                                                                                                                                                                                                                              See OSSL_PROVIDER-FIPS(7) and fips_module(7).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#legacy-provider","title":"Legacy provider","text":"

                                                                                                                                                                                                                                              The legacy provider is a dynamically loadable module, and must therefore be loaded explicitly, either in code or through OpenSSL configuration (see config(5)). It contains algorithm implementations that are considered insecure, or are no longer in common use such as MD2 or RC4. Should it be needed (if other providers are loaded and offer implementations of the same algorithms), the property \"provider=legacy\" can be used as a search criterion for these implementations.

                                                                                                                                                                                                                                              See OSSL_PROVIDER-legacy(7).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#null-provider","title":"Null provider","text":"

                                                                                                                                                                                                                                              The null provider is built in as part of the libcrypto library. It contains no algorithms in it at all. When fetching algorithms the default provider will be automatically loaded if no other provider has been explicitly loaded. To prevent that from happening you can explicitly load the null provider.

                                                                                                                                                                                                                                              See OSSL_PROVIDER-null(7).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#using-algorithms-in-applications","title":"USING ALGORITHMS IN APPLICATIONS","text":"

                                                                                                                                                                                                                                              Cryptographic algorithms are made available to applications through use of the \"EVP\" APIs. Each of the various operations such as encryption, digesting, message authentication codes, etc., have a set of EVP function calls that can be invoked to use them. See the evp(7) page for further details.

                                                                                                                                                                                                                                              Most of these follow a common pattern. A \"context\" object is first created. For example for a digest operation you would use an EVP_MD_CTX, and for an encryption/decryption operation you would use an EVP_CIPHER_CTX. The operation is then initialised ready for use via an \"init\" function - optionally passing in a set of parameters (using the OSSL_PARAM(3) type) to configure how the operation should behave. Next data is fed into the operation in a series of \"update\" calls. The operation is finalised using a \"final\" call which will typically provide some kind of output. Finally the context is cleaned up and freed.

                                                                                                                                                                                                                                              The following shows a complete example for doing this process for digesting data using SHA256. The process is similar for other operations such as encryption/decryption, signatures, message authentication codes, etc.

                                                                                                                                                                                                                                              #include <stdio.h>\n#include <openssl/evp.h>\n#include <openssl/bio.h>\n#include <openssl/err.h>\n\nint main(void)\n{\n    EVP_MD_CTX *ctx = NULL;\n    EVP_MD *sha256 = NULL;\n    const unsigned char msg[] = {\n        0x00, 0x01, 0x02, 0x03\n    };\n    unsigned int len = 0;\n    unsigned char *outdigest = NULL;\n    int ret = 1;\n\n    /* Create a context for the digest operation */\n    ctx = EVP_MD_CTX_new();\n    if (ctx == NULL)\n        goto err;\n\n    /*\n     * Fetch the SHA256 algorithm implementation for doing the digest. We're\n     * using the \"default\" library context here (first NULL parameter), and\n     * we're not supplying any particular search criteria for our SHA256\n     * implementation (second NULL parameter). Any SHA256 implementation will\n     * do.\n     * In a larger application this fetch would just be done once, and could\n     * be used for multiple calls to other operations such as EVP_DigestInit_ex().\n     */\n    sha256 = EVP_MD_fetch(NULL, \"SHA256\", NULL);\n    if (sha256 == NULL)\n        goto err;\n\n   /* Initialise the digest operation */\n   if (!EVP_DigestInit_ex(ctx, sha256, NULL))\n       goto err;\n\n    /*\n     * Pass the message to be digested. This can be passed in over multiple\n     * EVP_DigestUpdate calls if necessary\n     */\n    if (!EVP_DigestUpdate(ctx, msg, sizeof(msg)))\n        goto err;\n\n    /* Allocate the output buffer */\n    outdigest = OPENSSL_malloc(EVP_MD_get_size(sha256));\n    if (outdigest == NULL)\n        goto err;\n\n    /* Now calculate the digest itself */\n    if (!EVP_DigestFinal_ex(ctx, outdigest, &len))\n        goto err;\n\n    /* Print out the digest result */\n    BIO_dump_fp(stdout, outdigest, len);\n\n    ret = 0;\n\n err:\n    /* Clean up all the resources we allocated */\n    OPENSSL_free(outdigest);\n    EVP_MD_free(sha256);\n    EVP_MD_CTX_free(ctx);\n    if (ret != 0)\n       ERR_print_errors_fp(stderr);\n    return ret;\n}\n
                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#configuration","title":"CONFIGURATION","text":"

                                                                                                                                                                                                                                              By default OpenSSL will load a configuration file when it is first used. This will set up various configuration settings within the default library context. Applications that create their own library contexts may optionally configure them with a config file using the OSSL_LIB_CTX_load_config(3) function.

                                                                                                                                                                                                                                              The configuration file can be used to automatically load providers and set up default property query strings.

                                                                                                                                                                                                                                              For information on the OpenSSL configuration file format see config(5).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#encoding-and-decoding-keys","title":"ENCODING AND DECODING KEYS","text":"

                                                                                                                                                                                                                                              Many algorithms require the use of a key. Keys can be generated dynamically using the EVP APIs (for example see EVP_PKEY_Q_keygen(3)). However it is often necessary to save or load keys (or their associated parameters) to or from some external format such as PEM or DER (see openssl-glossary(7)). OpenSSL uses encoders and decoders to perform this task.

                                                                                                                                                                                                                                              Encoders and decoders are just algorithm implementations in the same way as any other algorithm implementation in OpenSSL. They are implemented by providers. The OpenSSL encoders and decoders are available in the default provider. They are also duplicated in the base provider.

                                                                                                                                                                                                                                              For information about encoders see OSSL_ENCODER_CTX_new_for_pkey(3). For information about decoders see OSSL_DECODER_CTX_new_for_pkey(3).

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#library-conventions","title":"LIBRARY CONVENTIONS","text":"

                                                                                                                                                                                                                                              Many OpenSSL functions that \"get\" or \"set\" a value follow a naming convention using the numbers 0 and 1, i.e. \"get0\", \"get1\", \"set0\" and \"set1\". This can also apply to some functions that \"add\" a value to an existing set, i.e. \"add0\" and \"add1\".

                                                                                                                                                                                                                                              For example the functions:

                                                                                                                                                                                                                                              int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);\nint X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj);\n

                                                                                                                                                                                                                                              In the 0 version the ownership of the object is passed to (for an add or set) or retained by (for a get) the parent object. For example after calling the X509_CRL_add0_revoked() function above, ownership of the rev object is passed to the crl object. Therefore, after calling this function rev should not be freed directly. It will be freed implicitly when crl is freed.

                                                                                                                                                                                                                                              In the 1 version the ownership of the object is not passed to or retained by the parent object. Instead a copy or \"up ref\" of the object is performed. So after calling the X509_add1_trust_object() function above the application will still be responsible for freeing the obj value where appropriate.

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              openssl(1), ssl(7), evp(7), OSSL_LIB_CTX(3), openssl-threads(7), property(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-base(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-legacy(7), OSSL_PROVIDER-null(7), openssl-glossary(7), provider(7)

                                                                                                                                                                                                                                              "},{"location":"man7/crypto/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/ct/","title":"ct","text":""},{"location":"man7/ct/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              ct - Certificate Transparency

                                                                                                                                                                                                                                              "},{"location":"man7/ct/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                              #include <openssl/ct.h>\n
                                                                                                                                                                                                                                              "},{"location":"man7/ct/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              This library implements Certificate Transparency (CT) verification for TLS clients, as defined in RFC 6962. This verification can provide some confidence that a certificate has been publicly logged in a set of CT logs.

                                                                                                                                                                                                                                              By default, these checks are disabled. They can be enabled using SSL_CTX_enable_ct(3) or SSL_enable_ct(3).

                                                                                                                                                                                                                                              This library can also be used to parse and examine CT data structures, such as Signed Certificate Timestamps (SCTs), or to read a list of CT logs. There are functions for: - decoding and encoding SCTs in DER and TLS wire format. - printing SCTs. - verifying the authenticity of SCTs. - loading a CT log list from a CONF file.

                                                                                                                                                                                                                                              "},{"location":"man7/ct/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              d2i_SCT_LIST(3), CTLOG_STORE_new(3), CTLOG_STORE_get0_log_by_id(3), SCT_new(3), SCT_print(3), SCT_validate(3), SCT_validate(3), CT_POLICY_EVAL_CTX_new(3), SSL_CTX_set_ct_validation_callback(3)

                                                                                                                                                                                                                                              "},{"location":"man7/ct/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The ct library was added in OpenSSL 1.1.0.

                                                                                                                                                                                                                                              "},{"location":"man7/ct/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/","title":"des_modes","text":""},{"location":"man7/des_modes/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              des_modes - the variants of DES and other crypto algorithms of OpenSSL

                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              Several crypto algorithms for OpenSSL can be used in a number of modes. Those are used for using block ciphers in a way similar to stream ciphers, among other things.

                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#overview","title":"OVERVIEW","text":""},{"location":"man7/des_modes/#electronic-codebook-mode-ecb","title":"Electronic Codebook Mode (ECB)","text":"

                                                                                                                                                                                                                                              Normally, this is found as the function algorithm_ecb_encrypt().

                                                                                                                                                                                                                                              • 64 bits are enciphered at a time.
                                                                                                                                                                                                                                              • The order of the blocks can be rearranged without detection.
                                                                                                                                                                                                                                              • The same plaintext block always produces the same ciphertext block (for the same key) making it vulnerable to a 'dictionary attack'.
                                                                                                                                                                                                                                              • An error will only affect one ciphertext block.
                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#cipher-block-chaining-mode-cbc","title":"Cipher Block Chaining Mode (CBC)","text":"

                                                                                                                                                                                                                                              Normally, this is found as the function algorithm_cbc_encrypt(). Be aware that des_cbc_encrypt() is not really DES CBC (it does not update the IV); use des_ncbc_encrypt() instead.

                                                                                                                                                                                                                                              • a multiple of 64 bits are enciphered at a time.
                                                                                                                                                                                                                                              • The CBC mode produces the same ciphertext whenever the same plaintext is encrypted using the same key and starting variable.
                                                                                                                                                                                                                                              • The chaining operation makes the ciphertext blocks dependent on the current and all preceding plaintext blocks and therefore blocks can not be rearranged.
                                                                                                                                                                                                                                              • The use of different starting variables prevents the same plaintext enciphering to the same ciphertext.
                                                                                                                                                                                                                                              • An error will affect the current and the following ciphertext blocks.
                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#cipher-feedback-mode-cfb","title":"Cipher Feedback Mode (CFB)","text":"

                                                                                                                                                                                                                                              Normally, this is found as the function algorithm_cfb_encrypt().

                                                                                                                                                                                                                                              • a number of bits (j) <= 64 are enciphered at a time.
                                                                                                                                                                                                                                              • The CFB mode produces the same ciphertext whenever the same plaintext is encrypted using the same key and starting variable.
                                                                                                                                                                                                                                              • The chaining operation makes the ciphertext variables dependent on the current and all preceding variables and therefore j-bit variables are chained together and can not be rearranged.
                                                                                                                                                                                                                                              • The use of different starting variables prevents the same plaintext enciphering to the same ciphertext.
                                                                                                                                                                                                                                              • The strength of the CFB mode depends on the size of k (maximal if j == k). In my implementation this is always the case.
                                                                                                                                                                                                                                              • Selection of a small value for j will require more cycles through the encipherment algorithm per unit of plaintext and thus cause greater processing overheads.
                                                                                                                                                                                                                                              • Only multiples of j bits can be enciphered.
                                                                                                                                                                                                                                              • An error will affect the current and the following ciphertext variables.
                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#output-feedback-mode-ofb","title":"Output Feedback Mode (OFB)","text":"

                                                                                                                                                                                                                                              Normally, this is found as the function algorithm_ofb_encrypt().

                                                                                                                                                                                                                                              • a number of bits (j) <= 64 are enciphered at a time.
                                                                                                                                                                                                                                              • The OFB mode produces the same ciphertext whenever the same plaintext enciphered using the same key and starting variable. More over, in the OFB mode the same key stream is produced when the same key and start variable are used. Consequently, for security reasons a specific start variable should be used only once for a given key.
                                                                                                                                                                                                                                              • The absence of chaining makes the OFB more vulnerable to specific attacks.
                                                                                                                                                                                                                                              • The use of different start variables values prevents the same plaintext enciphering to the same ciphertext, by producing different key streams.
                                                                                                                                                                                                                                              • Selection of a small value for j will require more cycles through the encipherment algorithm per unit of plaintext and thus cause greater processing overheads.
                                                                                                                                                                                                                                              • Only multiples of j bits can be enciphered.
                                                                                                                                                                                                                                              • OFB mode of operation does not extend ciphertext errors in the resultant plaintext output. Every bit error in the ciphertext causes only one bit to be in error in the deciphered plaintext.
                                                                                                                                                                                                                                              • OFB mode is not self-synchronizing. If the two operation of encipherment and decipherment get out of synchronism, the system needs to be re-initialized.
                                                                                                                                                                                                                                              • Each re-initialization should use a value of the start variable different from the start variable values used before with the same key. The reason for this is that an identical bit stream would be produced each time from the same parameters. This would be susceptible to a 'known plaintext' attack.
                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#triple-ecb-mode","title":"Triple ECB Mode","text":"

                                                                                                                                                                                                                                              Normally, this is found as the function algorithm_ecb3_encrypt().

                                                                                                                                                                                                                                              • Encrypt with key1, decrypt with key2 and encrypt with key3 again.
                                                                                                                                                                                                                                              • As for ECB encryption but increases the key length to 168 bits. There are theoretic attacks that can be used that make the effective key length 112 bits, but this attack also requires 2^56 blocks of memory, not very likely, even for the NSA.
                                                                                                                                                                                                                                              • If both keys are the same it is equivalent to encrypting once with just one key.
                                                                                                                                                                                                                                              • If the first and last key are the same, the key length is 112 bits. There are attacks that could reduce the effective key strength to only slightly more than 56 bits, but these require a lot of memory.
                                                                                                                                                                                                                                              • If all 3 keys are the same, this is effectively the same as normal ecb mode.
                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#triple-cbc-mode","title":"Triple CBC Mode","text":"

                                                                                                                                                                                                                                              Normally, this is found as the function algorithm_ede3_cbc_encrypt().

                                                                                                                                                                                                                                              • Encrypt with key1, decrypt with key2 and then encrypt with key3.
                                                                                                                                                                                                                                              • As for CBC encryption but increases the key length to 168 bits with the same restrictions as for triple ecb mode.
                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              This text was been written in large parts by Eric Young in his original documentation for SSLeay, the predecessor of OpenSSL. In turn, he attributed it to:

                                                                                                                                                                                                                                                  AS 2805.5.2\n    Australian Standard\n    Electronic funds transfer - Requirements for interfaces,\n    Part 5.2: Modes of operation for an n-bit block cipher algorithm\n    Appendix A\n
                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              BF_encrypt(3), DES_crypt(3)

                                                                                                                                                                                                                                              "},{"location":"man7/des_modes/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/evp/","title":"evp","text":""},{"location":"man7/evp/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              evp - high-level cryptographic functions

                                                                                                                                                                                                                                              "},{"location":"man7/evp/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                              #include <openssl/evp.h>\n
                                                                                                                                                                                                                                              "},{"location":"man7/evp/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The EVP library provides a high-level interface to cryptographic functions.

                                                                                                                                                                                                                                              The EVP_SealXXX and EVP_OpenXXX functions provide public key encryption and decryption to implement digital \"envelopes\".

                                                                                                                                                                                                                                              The EVP_DigestSignXXX and EVP_DigestVerifyXXX functions implement digital signatures and Message Authentication Codes (MACs). Also see the older EVP_SignXXX and EVP_VerifyXXX functions.

                                                                                                                                                                                                                                              Symmetric encryption is available with the EVP_EncryptXXX functions. The EVP_DigestXXX functions provide message digests.

                                                                                                                                                                                                                                              The EVP_PKEYXXX functions provide a high-level interface to asymmetric algorithms. To create a new EVP_PKEY see EVP_PKEY_new(3). EVP_PKEYs can be associated with a private key of a particular algorithm by using the functions described on the EVP_PKEY_fromdata(3) page, or new keys can be generated using EVP_PKEY_keygen(3). EVP_PKEYs can be compared using EVP_PKEY_eq(3), or printed using EVP_PKEY_print_private(3). EVP_PKEY_todata(3) can be used to convert a key back into an OSSL_PARAM(3) array.

                                                                                                                                                                                                                                              The EVP_PKEY functions support the full range of asymmetric algorithm operations:

                                                                                                                                                                                                                                              • For key agreement see EVP_PKEY_derive(3)
                                                                                                                                                                                                                                              • For signing and verifying see EVP_PKEY_sign(3), EVP_PKEY_verify(3) and EVP_PKEY_verify_recover(3). However, note that these functions do not perform a digest of the data to be signed. Therefore, normally you would use the EVP_DigestSignInit(3) functions for this purpose.
                                                                                                                                                                                                                                              • For encryption and decryption see EVP_PKEY_encrypt(3) and EVP_PKEY_decrypt(3) respectively. However, note that these functions perform encryption and decryption only. As public key encryption is an expensive operation, normally you would wrap an encrypted message in a \"digital envelope\" using the EVP_SealInit(3) and EVP_OpenInit(3) functions.

                                                                                                                                                                                                                                              The EVP_BytesToKey(3) function provides some limited support for password based encryption. Careful selection of the parameters will provide a PKCS#5 PBKDF1 compatible implementation. However, new applications should not typically use this (preferring, for example, PBKDF2 from PCKS#5).

                                                                                                                                                                                                                                              The EVP_EncodeXXX and EVP_DecodeXXX functions implement base 64 encoding and decoding.

                                                                                                                                                                                                                                              All the symmetric algorithms (ciphers), digests and asymmetric algorithms (public key algorithms) can be replaced by ENGINE modules providing alternative implementations. If ENGINE implementations of ciphers or digests are registered as defaults, then the various EVP functions will automatically use those implementations automatically in preference to built in software implementations. For more information, consult the engine(3) man page.

                                                                                                                                                                                                                                              Although low-level algorithm specific functions exist for many algorithms their use is discouraged. They cannot be used with an ENGINE and ENGINE versions of new algorithms cannot be accessed using the low-level functions. Also makes code harder to adapt to new algorithms and some options are not cleanly supported at the low-level and some operations are more efficient using the high-level interface.

                                                                                                                                                                                                                                              "},{"location":"man7/evp/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              EVP_DigestInit(3), EVP_EncryptInit(3), EVP_OpenInit(3), EVP_SealInit(3), EVP_DigestSignInit(3), EVP_SignInit(3), EVP_VerifyInit(3), EVP_EncodeInit(3), EVP_PKEY_new(3), EVP_PKEY_fromdata(3), EVP_PKEY_todata(3), EVP_PKEY_keygen(3), EVP_PKEY_print_private(3), EVP_PKEY_decrypt(3), EVP_PKEY_encrypt(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3), EVP_PKEY_derive(3), EVP_BytesToKey(3), ENGINE_by_id(3)

                                                                                                                                                                                                                                              "},{"location":"man7/evp/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/","title":"fips_module","text":""},{"location":"man7/fips_module/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              fips_module - OpenSSL fips module guide

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                                                                                                              See the individual manual pages for details.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              This guide details different ways that OpenSSL can be used in conjunction with the FIPS module. Which is the correct approach to use will depend on your own specific circumstances and what you are attempting to achieve.

                                                                                                                                                                                                                                              For information related to installing the FIPS module see https://github.com/openssl/openssl/blob/master/README-FIPS.md.

                                                                                                                                                                                                                                              Note that the old functions FIPS_mode() and FIPS_mode_set() are no longer present so you must remove them from your application if you use them.

                                                                                                                                                                                                                                              Applications written to use the OpenSSL 3.0 FIPS module should not use any legacy APIs or features that avoid the FIPS module. Specifically this includes:

                                                                                                                                                                                                                                              • Low level cryptographic APIs (use the high level APIs, such as EVP, instead)
                                                                                                                                                                                                                                              • Engines
                                                                                                                                                                                                                                              • Any functions that create or modify custom \"METHODS\" (for example EVP_MD_meth_new(), EVP_CIPHER_meth_new(), EVP_PKEY_meth_new(), RSA_meth_new(), EC_KEY_METHOD_new(), etc.)

                                                                                                                                                                                                                                              All of the above APIs are deprecated in OpenSSL 3.0 - so a simple rule is to avoid using all deprecated functions. See migration_guide(7) for a list of deprecated functions.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#making-all-applications-use-the-fips-module-by-default","title":"Making all applications use the FIPS module by default","text":"

                                                                                                                                                                                                                                              One simple approach is to cause all applications that are using OpenSSL to only use the FIPS module for cryptographic algorithms by default.

                                                                                                                                                                                                                                              This approach can be done purely via configuration. As long as applications are built and linked against OpenSSL 3.0 and do not override the loading of the default config file or its settings then they can automatically start using the FIPS module without the need for any further code changes.

                                                                                                                                                                                                                                              To do this the default OpenSSL config file will have to be modified. The location of this config file will depend on the platform, and any options that were given during the build process. You can check the location of the config file by running this command:

                                                                                                                                                                                                                                              $ openssl version -d\nOPENSSLDIR: \"/usr/local/ssl\"\n

                                                                                                                                                                                                                                              Caution: Many Operating Systems install OpenSSL by default. It is a common error to not have the correct version of OpenSSL in your $PATH. Check that you are running an OpenSSL 3.0 version like this:

                                                                                                                                                                                                                                              $ openssl version -v\nOpenSSL 3.0.0-dev xx XXX xxxx (Library: OpenSSL 3.0.0-dev xx XXX xxxx)\n

                                                                                                                                                                                                                                              The OPENSSLDIR value above gives the directory name for where the default config file is stored. So in this case the default config file will be called /usr/local/ssl/openssl.cnf.

                                                                                                                                                                                                                                              Edit the config file to add the following lines near the beginning:

                                                                                                                                                                                                                                              config_diagnostics = 1\nopenssl_conf = openssl_init\n\n.include /usr/local/ssl/fipsmodule.cnf\n\n[openssl_init]\nproviders = provider_sect\nalg_section = algorithm_sect\n\n[provider_sect]\nfips = fips_sect\nbase = base_sect\n\n[base_sect]\nactivate = 1\n\n[algorithm_sect]\ndefault_properties = fips=yes\n

                                                                                                                                                                                                                                              Obviously the include file location above should match the path and name of the FIPS module config file that you installed earlier. See https://github.com/openssl/openssl/blob/master/README-FIPS.md.

                                                                                                                                                                                                                                              For FIPS usage, it is recommended that the config_diagnostics option is enabled to prevent accidental use of non-FIPS validated algorithms via broken or mistaken configuration. See config(5).

                                                                                                                                                                                                                                              Any applications that use OpenSSL 3.0 and are started after these changes are made will start using only the FIPS module unless those applications take explicit steps to avoid this default behaviour. Note that this configuration also activates the \"base\" provider. The base provider does not include any cryptographic algorithms (and therefore does not impact the validation status of any cryptographic operations), but does include other supporting algorithms that may be required. It is designed to be used in conjunction with the FIPS module.

                                                                                                                                                                                                                                              This approach has the primary advantage that it is simple, and no code changes are required in applications in order to benefit from the FIPS module. There are some disadvantages to this approach:

                                                                                                                                                                                                                                              • You may not want all applications to use the FIPS module.

                                                                                                                                                                                                                                                It may be the case that some applications should and some should not use the FIPS module.

                                                                                                                                                                                                                                              • If applications take explicit steps to not load the default config file or set different settings.

                                                                                                                                                                                                                                                This method will not work for these cases.

                                                                                                                                                                                                                                              • The algorithms available in the FIPS module are a subset of the algorithms that are available in the default OpenSSL Provider.

                                                                                                                                                                                                                                                If any applications attempt to use any algorithms that are not present, then they will fail.

                                                                                                                                                                                                                                              • Usage of certain deprecated APIs avoids the use of the FIPS module.

                                                                                                                                                                                                                                                If any applications use those APIs then the FIPS module will not be used.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#selectively-making-applications-use-the-fips-module-by-default","title":"Selectively making applications use the FIPS module by default","text":"

                                                                                                                                                                                                                                              A variation on the above approach is to do the same thing on an individual application basis. The default OpenSSL config file depends on the compiled in value for OPENSSLDIR as described in the section above. However it is also possible to override the config file to be used via the OPENSSL_CONF environment variable. For example the following, on Unix, will cause the application to be executed with a non-standard config file location:

                                                                                                                                                                                                                                              $ OPENSSL_CONF=/my/nondefault/openssl.cnf myapplication\n

                                                                                                                                                                                                                                              Using this mechanism you can control which config file is loaded (and hence whether the FIPS module is loaded) on an application by application basis.

                                                                                                                                                                                                                                              This removes the disadvantage listed above that you may not want all applications to use the FIPS module. All the other advantages and disadvantages still apply.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#programmatically-loading-the-fips-module-default-library-context","title":"Programmatically loading the FIPS module (default library context)","text":"

                                                                                                                                                                                                                                              Applications may choose to load the FIPS provider explicitly rather than relying on config to do this. The config file is still necessary in order to hold the FIPS module config data (such as its self test status and integrity data). But in this case we do not automatically activate the FIPS provider via that config file.

                                                                                                                                                                                                                                              To do things this way configure as per \"Making all applications use the FIPS module by default\" above, but edit the fipsmodule.cnf file to remove or comment out the line which says activate = 1 (note that setting this value to 0 is not sufficient). This means all the required config information will be available to load the FIPS module, but it is not automatically loaded when the application starts. The FIPS provider can then be loaded programmatically like this:

                                                                                                                                                                                                                                              #include <openssl/provider.h>\n\nint main(void)\n{\n    OSSL_PROVIDER *fips;\n    OSSL_PROVIDER *base;\n\n    fips = OSSL_PROVIDER_load(NULL, \"fips\");\n    if (fips == NULL) {\n        printf(\"Failed to load FIPS provider\\n\");\n        exit(EXIT_FAILURE);\n    }\n    base = OSSL_PROVIDER_load(NULL, \"base\");\n    if (base == NULL) {\n        OSSL_PROVIDER_unload(fips);\n        printf(\"Failed to load base provider\\n\");\n        exit(EXIT_FAILURE);\n    }\n\n    /* Rest of application */\n\n    OSSL_PROVIDER_unload(base);\n    OSSL_PROVIDER_unload(fips);\n    exit(EXIT_SUCCESS);\n}\n

                                                                                                                                                                                                                                              Note that this should be one of the first things that you do in your application. If any OpenSSL functions get called that require the use of cryptographic functions before this occurs then, if no provider has yet been loaded, then the default provider will be automatically loaded. If you then later explicitly load the FIPS provider then you will have both the FIPS and the default provider loaded at the same time. It is undefined which implementation of an algorithm will be used if multiple implementations are available and you have not explicitly specified via a property query (see below) which one should be used.

                                                                                                                                                                                                                                              Also note that in this example we have additionally loaded the \"base\" provider. This loads a sub-set of algorithms that are also available in the default provider - specifically non cryptographic ones which may be used in conjunction with the FIPS provider. For example this contains algorithms for encoding and decoding keys. If you decide not to load the default provider then you will usually want to load the base provider instead.

                                                                                                                                                                                                                                              In this example we are using the \"default\" library context. OpenSSL functions operate within the scope of a library context. If no library context is explicitly specified then the default library context is used. For further details about library contexts see the OSSL_LIB_CTX(3) man page.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#loading-the-fips-module-at-the-same-time-as-other-providers","title":"Loading the FIPS module at the same time as other providers","text":"

                                                                                                                                                                                                                                              It is possible to have the FIPS provider and other providers (such as the default provider) all loaded at the same time into the same library context. You can use a property query string during algorithm fetches to specify which implementation you would like to use.

                                                                                                                                                                                                                                              For example to fetch an implementation of SHA256 which conforms to FIPS standards you can specify the property query fips=yes like this:

                                                                                                                                                                                                                                              EVP_MD *sha256;\n\nsha256 = EVP_MD_fetch(NULL, \"SHA2-256\", \"fips=yes\");\n

                                                                                                                                                                                                                                              If no property query is specified, or more than one implementation matches the property query then it is undefined which implementation of a particular algorithm will be returned.

                                                                                                                                                                                                                                              This example shows an explicit request for an implementation of SHA256 from the default provider:

                                                                                                                                                                                                                                              EVP_MD *sha256;\n\nsha256 = EVP_MD_fetch(NULL, \"SHA2-256\", \"provider=default\");\n

                                                                                                                                                                                                                                              It is also possible to set a default property query string. The following example sets the default property query of fips=yes for all fetches within the default library context:

                                                                                                                                                                                                                                              EVP_set_default_properties(NULL, \"fips=yes\");\n

                                                                                                                                                                                                                                              If a fetch function has both an explicit property query specified, and a default property query is defined then the two queries are merged together and both apply. The local property query overrides the default properties if the same property name is specified in both.

                                                                                                                                                                                                                                              There are two important built-in properties that you should be aware of:

                                                                                                                                                                                                                                              The \"provider\" property enables you to specify which provider you want an implementation to be fetched from, e.g. provider=default or provider=fips. All algorithms implemented in a provider have this property set on them.

                                                                                                                                                                                                                                              There is also the fips property. All FIPS algorithms match against the property query fips=yes. There are also some non-cryptographic algorithms available in the default and base providers that also have the fips=yes property defined for them. These are the encoder and decoder algorithms that can (for example) be used to write out a key generated in the FIPS provider to a file. The encoder and decoder algorithms are not in the FIPS module itself but are allowed to be used in conjunction with the FIPS algorithms.

                                                                                                                                                                                                                                              It is possible to specify default properties within a config file. For example the following config file automatically loads the default and FIPS providers and sets the default property value to be fips=yes. Note that this config file does not load the \"base\" provider. All supporting algorithms that are in \"base\" are also in \"default\", so it is unnecessary in this case:

                                                                                                                                                                                                                                              config_diagnostics = 1\nopenssl_conf = openssl_init\n\n.include /usr/local/ssl/fipsmodule.cnf\n\n[openssl_init]\nproviders = provider_sect\nalg_section = algorithm_sect\n\n[provider_sect]\nfips = fips_sect\ndefault = default_sect\n\n[default_sect]\nactivate = 1\n\n[algorithm_sect]\ndefault_properties = fips=yes\n
                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#programmatically-loading-the-fips-module-nondefault-library-context","title":"Programmatically loading the FIPS module (nondefault library context)","text":"

                                                                                                                                                                                                                                              In addition to using properties to separate usage of the FIPS module from other usages this can also be achieved using library contexts. In this example we create two library contexts. In one we assume the existence of a config file called openssl-fips.cnf that automatically loads and configures the FIPS and base providers. The other library context will just use the default provider.

                                                                                                                                                                                                                                              OSSL_LIB_CTX *fips_libctx, *nonfips_libctx;\nOSSL_PROVIDER *defctxnull = NULL;\nEVP_MD *fipssha256 = NULL, *nonfipssha256 = NULL;\nint ret = 1;\n\n/*\n * Create two nondefault library contexts. One for fips usage and\n * one for non-fips usage\n */\nfips_libctx = OSSL_LIB_CTX_new();\nnonfips_libctx = OSSL_LIB_CTX_new();\nif (fips_libctx == NULL || nonfips_libctx == NULL)\n    goto err;\n\n/* Prevent anything from using the default library context */\ndefctxnull = OSSL_PROVIDER_load(NULL, \"null\");\n\n/*\n * Load config file for the FIPS library context. We assume that\n * this config file will automatically activate the FIPS and base\n * providers so we don't need to explicitly load them here.\n */\nif (!OSSL_LIB_CTX_load_config(fips_libctx, \"openssl-fips.cnf\"))\n    goto err;\n\n/*\n * Set the default property query on the FIPS library context to\n * ensure that only FIPS algorithms can be used.  There are a few non-FIPS\n * approved algorithms in the FIPS provider for backward compatibility reasons.\n */\nif (!EVP_set_default_properties(fips_libctx, \"fips=yes\"))\n    goto err;\n\n/*\n * We don't need to do anything special to load the default\n * provider into nonfips_libctx. This happens automatically if no\n * other providers are loaded.\n * Because we don't call OSSL_LIB_CTX_load_config() explicitly for\n * nonfips_libctx it will just use the default config file.\n */\n\n/* As an example get some digests */\n\n/* Get a FIPS validated digest */\nfipssha256 = EVP_MD_fetch(fips_libctx, \"SHA2-256\", NULL);\nif (fipssha256 == NULL)\n    goto err;\n\n/* Get a non-FIPS validated digest */\nnonfipssha256 = EVP_MD_fetch(nonfips_libctx, \"SHA2-256\", NULL);\nif (nonfipssha256 == NULL)\n    goto err;\n\n/* Use the digests */\n\nprintf(\"Success\\n\");\nret = 0;\n\nerr:\nEVP_MD_free(fipssha256);\nEVP_MD_free(nonfipssha256);\nOSSL_LIB_CTX_free(fips_libctx);\nOSSL_LIB_CTX_free(nonfips_libctx);\nOSSL_PROVIDER_unload(defctxnull);\n\nreturn ret;\n

                                                                                                                                                                                                                                              Note that we have made use of the special \"null\" provider here which we load into the default library context. We could have chosen to use the default library context for FIPS usage, and just create one additional library context for other usages - or vice versa. However if code has not been converted to use library contexts then the default library context will be automatically used. This could be the case for your own existing applications as well as certain parts of OpenSSL itself. Not all parts of OpenSSL are library context aware. If this happens then you could \"accidentally\" use the wrong library context for a particular operation. To be sure this doesn't happen you can load the \"null\" provider into the default library context. Because a provider has been explicitly loaded, the default provider will not automatically load. This means code using the default context by accident will fail because no algorithms will be available.

                                                                                                                                                                                                                                              See \"Library Context\" in migration_guide(7) for additional information about the Library Context.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#using-encoders-and-decoders-with-the-fips-module","title":"Using Encoders and Decoders with the FIPS module","text":"

                                                                                                                                                                                                                                              Encoders and decoders are used to read and write keys or parameters from or to some external format (for example a PEM file). If your application generates keys or parameters that then need to be written into PEM or DER format then it is likely that you will need to use an encoder to do this. Similarly you need a decoder to read previously saved keys and parameters. In most cases this will be invisible to you if you are using APIs that existed in OpenSSL 1.1.1 or earlier such as i2d_PrivateKey(3). However the appropriate encoder/decoder will need to be available in the library context associated with the key or parameter object. The built-in OpenSSL encoders and decoders are implemented in both the default and base providers and are not in the FIPS module boundary. However since they are not cryptographic algorithms themselves it is still possible to use them in conjunction with the FIPS module, and therefore these encoders/decoders have the fips=yes property against them. You should ensure that either the default or base provider is loaded into the library context in this case.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#using-the-fips-module-in-ssltls","title":"Using the FIPS module in SSL/TLS","text":"

                                                                                                                                                                                                                                              Writing an application that uses libssl in conjunction with the FIPS module is much the same as writing a normal libssl application. If you are using global properties and the default library context to specify usage of FIPS validated algorithms then this will happen automatically for all cryptographic algorithms in libssl. If you are using a nondefault library context to load the FIPS provider then you can supply this to libssl using the function SSL_CTX_new_ex(3). This works as a drop in replacement for the function SSL_CTX_new(3) except it provides you with the capability to specify the library context to be used. You can also use the same function to specify libssl specific properties to use.

                                                                                                                                                                                                                                              In this first example we create two SSL_CTX objects using two different library contexts.

                                                                                                                                                                                                                                              /*\n * We assume that a nondefault library context with the FIPS\n * provider loaded has been created called fips_libctx.\n */\nSSL_CTX *fips_ssl_ctx = SSL_CTX_new_ex(fips_libctx, \"fips=yes\", TLS_method());\n/*\n * We assume that a nondefault library context with the default\n * provider loaded has been created called non_fips_libctx.\n */\nSSL_CTX *non_fips_ssl_ctx = SSL_CTX_new_ex(non_fips_libctx, NULL,\n                                           TLS_method());\n

                                                                                                                                                                                                                                              In this second example we create two SSL_CTX objects using different properties to specify FIPS usage:

                                                                                                                                                                                                                                              /*\n * The \"fips=yes\" property includes all FIPS approved algorithms\n * as well as encoders from the default provider that are allowed\n * to be used. The NULL below indicates that we are using the\n * default library context.\n */\nSSL_CTX *fips_ssl_ctx = SSL_CTX_new_ex(NULL, \"fips=yes\", TLS_method());\n/*\n * The \"provider!=fips\" property allows algorithms from any\n * provider except the FIPS provider\n */\nSSL_CTX *non_fips_ssl_ctx = SSL_CTX_new_ex(NULL, \"provider!=fips\",\n                                           TLS_method());\n
                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#confirming-that-an-algorithm-is-being-provided-by-the-fips-module","title":"Confirming that an algorithm is being provided by the FIPS module","text":"

                                                                                                                                                                                                                                              A chain of links needs to be followed to go from an algorithm instance to the provider that implements it. The process is similar for all algorithms. Here the example of a digest is used.

                                                                                                                                                                                                                                              To go from an EVP_MD_CTX to an EVP_MD, use EVP_MD_CTX_md(3) . To go from the EVP_MD to its OSSL_PROVIDER, use EVP_MD_get0_provider(3). To extract the name from the OSSL_PROVIDER, use OSSL_PROVIDER_get0_name(3).

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              Some released versions of OpenSSL do not include a validated FIPS provider. To determine which versions have undergone the validation process, please refer to the OpenSSL Downloads page. If you require FIPS-approved functionality, it is essential to build your FIPS provider using one of the validated versions listed there. Normally, it is possible to utilize a FIPS provider constructed from one of the validated versions alongside libcrypto and libssl compiled from any release within the same major release series. This flexibility enables you to address bug fixes and CVEs that fall outside the FIPS boundary.

                                                                                                                                                                                                                                              The FIPS provider in OpenSSL 3.1 includes some non-FIPS validated algorithms, consequently the property query fips=yes is mandatory for applications that want to operate in a FIPS approved manner. The algorithms are:

                                                                                                                                                                                                                                              • Triple DES ECB
                                                                                                                                                                                                                                              • Triple DES CBC
                                                                                                                                                                                                                                              • EdDSA
                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              migration_guide(7), crypto(7), fips_config(5), https://www.openssl.org/source/

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The FIPS module guide was created for use with the new FIPS provider in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/fips_module/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-cipher/","title":"life_cycle-cipher","text":""},{"location":"man7/life_cycle-cipher/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              life_cycle-cipher - The cipher algorithm life-cycle

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-cipher/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              All symmetric ciphers (CIPHERs) go through a number of stages in their life-cycle:

                                                                                                                                                                                                                                              • start

                                                                                                                                                                                                                                                This state represents the CIPHER before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                                                                                                                                                              • newed

                                                                                                                                                                                                                                                This state represents the CIPHER after it has been allocated.

                                                                                                                                                                                                                                              • initialised

                                                                                                                                                                                                                                                These states represent the CIPHER when it is set up and capable of processing input. There are three possible initialised states:

                                                                                                                                                                                                                                                • initialised using EVP_CipherInit
                                                                                                                                                                                                                                                • initialised for decryption using EVP_DecryptInit
                                                                                                                                                                                                                                                • initialised for encryption using EVP_EncryptInit
                                                                                                                                                                                                                                              • updated

                                                                                                                                                                                                                                                These states represent the CIPHER when it is set up and capable of processing additional input or generating output. The three possible states directly correspond to those for initialised above. The three different streams should not be mixed.

                                                                                                                                                                                                                                              • finaled

                                                                                                                                                                                                                                                This state represents the CIPHER when it has generated output.

                                                                                                                                                                                                                                              • freed

                                                                                                                                                                                                                                                This state is entered when the CIPHER is freed. It is the terminal state for all life-cycle transitions.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-cipher/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                                                                                                                                                              The usual life-cycle of a CIPHER is illustrated:

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-cipher/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                                                                                                                                                              This section defines all of the legal state transitions. This is the canonical list.

                                                                                                                                                                                                                                              Function Call Current State start newed initialised updated finaled initialiseddecryption updateddecryption initialisedencryption updatedencryption freed EVP_CIPHER_CTX_new newed EVP_CipherInit initialised initialised initialised initialised initialised initialised initialised initialised EVP_DecryptInit initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption initialiseddecryption EVP_EncryptInit initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption initialisedencryption EVP_CipherUpdate updated updated EVP_DecryptUpdate updateddecryption updateddecryption EVP_EncryptUpdate updatedencryption updatedencryption EVP_CipherFinal finaled EVP_DecryptFinal finaleddecryption EVP_EncryptFinal finaleddecryption EVP_CIPHER_CTX_free freed freed freed freed freed freed freed freed freed EVP_CIPHER_CTX_reset newed newed newed newed newed newed newed EVP_CIPHER_CTX_get_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption EVP_CIPHER_CTX_set_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption EVP_CIPHER_CTX_gettable_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption EVP_CIPHER_CTX_settable_params newed initialised updated initialiseddecryption updateddecryption initialisedencryption updatedencryption"},{"location":"man7/life_cycle-cipher/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              provider-cipher(7), EVP_EncryptInit(3)

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-digest/","title":"life_cycle-digest","text":""},{"location":"man7/life_cycle-digest/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              life_cycle-digest - The digest algorithm life-cycle

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-digest/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              All message digests (MDs) go through a number of stages in their life-cycle:

                                                                                                                                                                                                                                              • start

                                                                                                                                                                                                                                                This state represents the MD before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                                                                                                                                                              • newed

                                                                                                                                                                                                                                                This state represents the MD after it has been allocated.

                                                                                                                                                                                                                                              • initialised

                                                                                                                                                                                                                                                This state represents the MD when it is set up and capable of processing input.

                                                                                                                                                                                                                                              • updated

                                                                                                                                                                                                                                                This state represents the MD when it is set up and capable of processing additional input or generating output.

                                                                                                                                                                                                                                              • finaled

                                                                                                                                                                                                                                                This state represents the MD when it has generated output.

                                                                                                                                                                                                                                              • freed

                                                                                                                                                                                                                                                This state is entered when the MD is freed. It is the terminal state for all life-cycle transitions.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-digest/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                                                                                                                                                              The usual life-cycle of a MD is illustrated:

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-digest/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                                                                                                                                                              This section defines all of the legal state transitions. This is the canonical list.

                                                                                                                                                                                                                                              Function Call Current State start newed initialised updated finaled freed EVP_MD_CTX_new newed EVP_DigestInit initialised initialised initialised initialised EVP_DigestUpdate updated updated EVP_DigestFinal finaled EVP_DigestFinalXOF finaled EVP_MD_CTX_free freed freed freed freed freed EVP_MD_CTX_reset newed newed newed newed EVP_MD_CTX_get_params newed initialised updated EVP_MD_CTX_set_params newed initialised updated EVP_MD_CTX_gettable_params newed initialised updated EVP_MD_CTX_settable_params newed initialised updated"},{"location":"man7/life_cycle-digest/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-digest/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              provider-digest(7), EVP_DigestInit(3)

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-digest/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-kdf/","title":"life_cycle-kdf","text":""},{"location":"man7/life_cycle-kdf/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              life_cycle-kdf - The KDF algorithm life-cycle

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-kdf/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              All key derivation functions (KDFs) and pseudo random functions (PRFs) go through a number of stages in their life-cycle:

                                                                                                                                                                                                                                              • start

                                                                                                                                                                                                                                                This state represents the KDF/PRF before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                                                                                                                                                              • newed

                                                                                                                                                                                                                                                This state represents the KDF/PRF after it has been allocated.

                                                                                                                                                                                                                                              • deriving

                                                                                                                                                                                                                                                This state represents the KDF/PRF when it is set up and capable of generating output.

                                                                                                                                                                                                                                              • freed

                                                                                                                                                                                                                                                This state is entered when the KDF/PRF is freed. It is the terminal state for all life-cycle transitions.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-kdf/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                                                                                                                                                              The usual life-cycle of a KDF/PRF is illustrated:

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-kdf/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                                                                                                                                                              This section defines all of the legal state transitions. This is the canonical list.

                                                                                                                                                                                                                                              Function Call Current State start newed deriving freed EVP_KDF_CTX_new newed EVP_KDF_derive deriving deriving EVP_KDF_CTX_free freed freed freed EVP_KDF_CTX_reset newed newed EVP_KDF_CTX_get_params newed deriving EVP_KDF_CTX_set_params newed deriving EVP_KDF_CTX_gettable_params newed deriving EVP_KDF_CTX_settable_params newed deriving"},{"location":"man7/life_cycle-kdf/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-kdf/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              provider-kdf(7), EVP_KDF(3).

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-kdf/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The provider KDF interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-kdf/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-mac/","title":"life_cycle-mac","text":""},{"location":"man7/life_cycle-mac/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              life_cycle-mac - The MAC algorithm life-cycle

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-mac/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              All message authentication codes (MACs) go through a number of stages in their life-cycle:

                                                                                                                                                                                                                                              • start

                                                                                                                                                                                                                                                This state represents the MAC before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                                                                                                                                                              • newed

                                                                                                                                                                                                                                                This state represents the MAC after it has been allocated.

                                                                                                                                                                                                                                              • initialised

                                                                                                                                                                                                                                                This state represents the MAC when it is set up and capable of processing input.

                                                                                                                                                                                                                                              • updated

                                                                                                                                                                                                                                                This state represents the MAC when it is set up and capable of processing additional input or generating output.

                                                                                                                                                                                                                                              • finaled

                                                                                                                                                                                                                                                This state represents the MAC when it has generated output.

                                                                                                                                                                                                                                              • freed

                                                                                                                                                                                                                                                This state is entered when the MAC is freed. It is the terminal state for all life-cycle transitions.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-mac/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                                                                                                                                                              The usual life-cycle of a MAC is illustrated:

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-mac/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                                                                                                                                                              This section defines all of the legal state transitions. This is the canonical list.

                                                                                                                                                                                                                                              Function Call Current State start newed initialised updated finaled freed EVP_MAC_CTX_new newed EVP_MAC_init initialised initialised initialised initialised EVP_MAC_update updated updated EVP_MAC_final finaled EVP_MAC_finalXOF finaled EVP_MAC_CTX_free freed freed freed freed freed EVP_MAC_CTX_get_params newed initialised updated EVP_MAC_CTX_set_params newed initialised updated EVP_MAC_CTX_gettable_params newed initialised updated EVP_MAC_CTX_settable_params newed initialised updated"},{"location":"man7/life_cycle-mac/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-mac/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              provider-mac(7), EVP_MAC(3).

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-mac/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The provider MAC interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-mac/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-pkey/","title":"life_cycle-pkey","text":""},{"location":"man7/life_cycle-pkey/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              life_cycle-pkey - The PKEY algorithm life-cycle

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-pkey/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              All public keys (PKEYs) go through a number of stages in their life-cycle:

                                                                                                                                                                                                                                              • start

                                                                                                                                                                                                                                                This state represents the PKEY before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                                                                                                                                                              • newed

                                                                                                                                                                                                                                                This state represents the PKEY after it has been allocated.

                                                                                                                                                                                                                                              • decapsulate

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to perform a private key decapsulation operation.

                                                                                                                                                                                                                                              • decrypt

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to decrypt some ciphertext.

                                                                                                                                                                                                                                              • derive

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to derive a shared secret.

                                                                                                                                                                                                                                              • digest sign

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to perform a private key signature operation.

                                                                                                                                                                                                                                              • encapsulate

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to perform a public key encapsulation operation.

                                                                                                                                                                                                                                              • encrypt

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to encrypt some plaintext.

                                                                                                                                                                                                                                              • key generation

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to generate a new public/private key.

                                                                                                                                                                                                                                              • parameter generation

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to generate key parameters.

                                                                                                                                                                                                                                              • verify

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to verify a public key signature.

                                                                                                                                                                                                                                              • verify recover

                                                                                                                                                                                                                                                This state represents the PKEY when it is ready to recover a public key signature data.

                                                                                                                                                                                                                                              • freed

                                                                                                                                                                                                                                                This state is entered when the PKEY is freed. It is the terminal state for all life-cycle transitions.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-pkey/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                                                                                                                                                              The usual life-cycle of a PKEY object is illustrated:

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-pkey/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                                                                                                                                                              This section defines all of the legal state transitions. This is the canonical list.

                                                                                                                                                                                                                                              Function Call Current State start newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration freed EVP_PKEY_CTX_new newed EVP_PKEY_CTX_new_id newed EVP_PKEY_CTX_new_from_name newed EVP_PKEY_CTX_new_from_pkey newed EVP_PKEY_sign_init digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign digestsign EVP_PKEY_sign digestsign EVP_PKEY_verify_init verify verify verify verify verify verify verify verify verify verify verify EVP_PKEY_verify verify EVP_PKEY_verify_recover_init verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover verifyrecover EVP_PKEY_verify_recover verifyrecover EVP_PKEY_encrypt_init encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt encrypt EVP_PKEY_encrypt encrypt EVP_PKEY_decrypt_init decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt decrypt EVP_PKEY_decrypt decrypt EVP_PKEY_derive_init derive derive derive derive derive derive derive derive derive derive derive EVP_PKEY_derive_set_peer derive EVP_PKEY_derive derive EVP_PKEY_encapsulate_init encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate encapsulate EVP_PKEY_encapsulate encapsulate EVP_PKEY_decapsulate_init decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate decapsulate EVP_PKEY_decapsulate decapsulate EVP_PKEY_paramgen_init parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration parametergeneration EVP_PKEY_paramgen parametergeneration EVP_PKEY_keygen_init keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration keygeneration EVP_PKEY_keygen keygeneration EVP_PKEY_gen parametergeneration keygeneration EVP_PKEY_CTX_get_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_set_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_gettable_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_settable_params newed digestsign verify verifyrecover encrypt decrypt derive encapsulate decapsulate parametergeneration keygeneration EVP_PKEY_CTX_free freed freed freed freed freed freed freed freed freed freed freed freed"},{"location":"man7/life_cycle-pkey/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-pkey/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              EVP_PKEY_new(3), EVP_PKEY_decapsulate(3), EVP_PKEY_decrypt(3), EVP_PKEY_encapsulate(3), EVP_PKEY_encrypt(3), EVP_PKEY_derive(3), EVP_PKEY_keygen(3), EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3)

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-pkey/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The provider PKEY interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-pkey/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-rand/","title":"life_cycle-rand","text":""},{"location":"man7/life_cycle-rand/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              life_cycle-rand - The RAND algorithm life-cycle

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-rand/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              All random number generator (RANDs) go through a number of stages in their life-cycle:

                                                                                                                                                                                                                                              • start

                                                                                                                                                                                                                                                This state represents the RAND before it has been allocated. It is the starting state for any life-cycle transitions.

                                                                                                                                                                                                                                              • newed

                                                                                                                                                                                                                                                This state represents the RAND after it has been allocated but unable to generate any output.

                                                                                                                                                                                                                                              • instantiated

                                                                                                                                                                                                                                                This state represents the RAND when it is set up and capable of generating output.

                                                                                                                                                                                                                                              • uninstantiated

                                                                                                                                                                                                                                                This state represents the RAND when it has been shutdown and it is no longer capable of generating output.

                                                                                                                                                                                                                                              • freed

                                                                                                                                                                                                                                                This state is entered when the RAND is freed. It is the terminal state for all life-cycle transitions.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-rand/#state-transition-diagram","title":"State Transition Diagram","text":"

                                                                                                                                                                                                                                              The usual life-cycle of a RAND is illustrated:

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-rand/#formal-state-transitions","title":"Formal State Transitions","text":"

                                                                                                                                                                                                                                              This section defines all of the legal state transitions. This is the canonical list.

                                                                                                                                                                                                                                              Function Call Current State start newed instantiated uninstantiated freed EVP_RAND_CTX_new newed EVP_RAND_instantiate instantiated EVP_RAND_generate instantiated EVP_RAND_uninstantiate uninstantiated EVP_RAND_CTX_free freed freed freed freed EVP_RAND_CTX_get_params newed instantiated uninstantiated EVP_RAND_CTX_set_params newed instantiated uninstantiated EVP_RAND_CTX_gettable_params newed instantiated uninstantiated EVP_RAND_CTX_settable_params newed instantiated uninstantiated"},{"location":"man7/life_cycle-rand/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              At some point the EVP layer will begin enforcing the transitions described herein.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-rand/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              provider-rand(7), EVP_RAND(3).

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-rand/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The provider RAND interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/life_cycle-rand/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/","title":"migration_guide","text":""},{"location":"man7/migration_guide/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              migration_guide - OpenSSL migration guide

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                                                                                                              See the individual manual pages for details.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              This guide details the changes required to migrate to new versions of OpenSSL. Currently this covers OpenSSL 3.0 & 3.1. For earlier versions refer to https://github.com/openssl/openssl/blob/master/CHANGES.md. For an overview of some of the key concepts introduced in OpenSSL 3.0 see crypto(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#openssl-31","title":"OPENSSL 3.1","text":""},{"location":"man7/migration_guide/#main-changes-from-openssl-30","title":"Main Changes from OpenSSL 3.0","text":"

                                                                                                                                                                                                                                              The FIPS provider in OpenSSL 3.1 includes some non-FIPS validated algorithms, consequently the property query fips=yes is mandatory for applications that want to operate in a FIPS approved manner. The algorithms are:

                                                                                                                                                                                                                                              • Triple DES ECB
                                                                                                                                                                                                                                              • Triple DES CBC
                                                                                                                                                                                                                                              • EdDSA

                                                                                                                                                                                                                                              There are no other changes requiring additional migration measures since OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#openssl-30","title":"OPENSSL 3.0","text":""},{"location":"man7/migration_guide/#main-changes-from-openssl-111","title":"Main Changes from OpenSSL 1.1.1","text":""},{"location":"man7/migration_guide/#major-release","title":"Major Release","text":"

                                                                                                                                                                                                                                              OpenSSL 3.0 is a major release and consequently any application that currently uses an older version of OpenSSL will at the very least need to be recompiled in order to work with the new version. It is the intention that the large majority of applications will work unchanged with OpenSSL 3.0 if those applications previously worked with OpenSSL 1.1.1. However this is not guaranteed and some changes may be required in some cases. Changes may also be required if applications need to take advantage of some of the new features available in OpenSSL 3.0 such as the availability of the FIPS module.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#license-change","title":"License Change","text":"

                                                                                                                                                                                                                                              In previous versions, OpenSSL was licensed under the dual OpenSSL and SSLeay licenses (both licenses apply). From OpenSSL 3.0 this is replaced by the Apache License v2.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#providers-and-fips-support","title":"Providers and FIPS support","text":"

                                                                                                                                                                                                                                              One of the key changes from OpenSSL 1.1.1 is the introduction of the Provider concept. Providers collect together and make available algorithm implementations. With OpenSSL 3.0 it is possible to specify, either programmatically or via a config file, which providers you want to use for any given application. OpenSSL 3.0 comes with 5 different providers as standard. Over time third parties may distribute additional providers that can be plugged into OpenSSL. All algorithm implementations available via providers are accessed through the \"high level\" APIs (for example those functions prefixed with EVP). They cannot be accessed using the \"Low Level APIs\".

                                                                                                                                                                                                                                              One of the standard providers available is the FIPS provider. This makes available FIPS validated cryptographic algorithms. The FIPS provider is disabled by default and needs to be enabled explicitly at configuration time using the enable-fips option. If it is enabled, the FIPS provider gets built and installed in addition to the other standard providers. No separate installation procedure is necessary. There is however a dedicated install_fips make target, which serves the special purpose of installing only the FIPS provider into an existing OpenSSL installation.

                                                                                                                                                                                                                                              Not all algorithms may be available for the application at a particular moment. If the application code uses any digest or cipher algorithm via the EVP interface, the application should verify the result of the EVP_EncryptInit(3), EVP_EncryptInit_ex(3), and EVP_DigestInit(3) functions. In case when the requested algorithm is not available, these functions will fail.

                                                                                                                                                                                                                                              See also \"Legacy Algorithms\" for information on the legacy provider.

                                                                                                                                                                                                                                              See also \"Completing the installation of the FIPS Module\" and \"Using the FIPS Module in applications\".

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#low-level-apis","title":"Low Level APIs","text":"

                                                                                                                                                                                                                                              OpenSSL has historically provided two sets of APIs for invoking cryptographic algorithms: the \"high level\" APIs (such as the EVP APIs) and the \"low level\" APIs. The high level APIs are typically designed to work across all algorithm types. The \"low level\" APIs are targeted at a specific algorithm implementation. For example, the EVP APIs provide the functions EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal(3) to perform symmetric encryption. Those functions can be used with the algorithms AES, CHACHA, 3DES etc. On the other hand, to do AES encryption using the low level APIs you would have to call AES specific functions such as AES_set_encrypt_key(3), AES_encrypt(3), and so on. The functions for 3DES are different. Use of the low level APIs has been informally discouraged by the OpenSSL development team for a long time. However in OpenSSL 3.0 this is made more formal. All such low level APIs have been deprecated. You may still use them in your applications, but you may start to see deprecation warnings during compilation (dependent on compiler support for this). Deprecated APIs may be removed from future versions of OpenSSL so you are strongly encouraged to update your code to use the high level APIs instead.

                                                                                                                                                                                                                                              This is described in more detail in \"Deprecation of Low Level Functions\"

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#legacy-algorithms","title":"Legacy Algorithms","text":"

                                                                                                                                                                                                                                              Some cryptographic algorithms such as MD2 and DES that were available via the EVP APIs are now considered legacy and their use is strongly discouraged. These legacy EVP algorithms are still available in OpenSSL 3.0 but not by default. If you want to use them then you must load the legacy provider. This can be as simple as a config file change, or can be done programmatically. See OSSL_PROVIDER-legacy(7) for a complete list of algorithms. Applications using the EVP APIs to access these algorithms should instead use more modern algorithms. If that is not possible then these applications should ensure that the legacy provider has been loaded. This can be achieved either programmatically or via configuration. See crypto(7) man page for more information about providers.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#engines-and-method-apis","title":"Engines and \"METHOD\" APIs","text":"

                                                                                                                                                                                                                                              The refactoring to support Providers conflicts internally with the APIs used to support engines, including the ENGINE API and any function that creates or modifies custom \"METHODS\" (for example EVP_MD_meth_new(3), EVP_CIPHER_meth_new(3), EVP_PKEY_meth_new(3), RSA_meth_new(3), EC_KEY_METHOD_new(3), etc.). These functions are being deprecated in OpenSSL 3.0, and users of these APIs should know that their use can likely bypass provider selection and configuration, with unintended consequences. This is particularly relevant for applications written to use the OpenSSL 3.0 FIPS module, as detailed below. Authors and maintainers of external engines are strongly encouraged to refactor their code transforming engines into providers using the new Provider API and avoiding deprecated methods.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#support-of-legacy-engines","title":"Support of legacy engines","text":"

                                                                                                                                                                                                                                              If openssl is not built without engine support or deprecated API support, engines will still work. However, their applicability will be limited.

                                                                                                                                                                                                                                              New algorithms provided via engines will still work.

                                                                                                                                                                                                                                              Engine-backed keys can be loaded via custom OSSL_STORE implementation. In this case the EVP_PKEY objects created via ENGINE_load_private_key(3) will be considered legacy and will continue to work.

                                                                                                                                                                                                                                              To ensure the future compatibility, the engines should be turned to providers. To prefer the provider-based hardware offload, you can specify the default properties to prefer your provider.

                                                                                                                                                                                                                                              Setting engine-based or application-based default low-level crypto method such as RSA_METHOD or EC_KEY_METHOD is still possible and keys inside the default provider will use the engine-based implementation for the crypto operations. However EVP_PKEYs created by decoding by using OSSL_DECODER, PEM_ or d2i_ APIs will be provider-based. To create a fully legacy EVP_PKEYs EVP_PKEY_set1_RSA(3), EVP_PKEY_set1_EC_KEY(3) or similar functions must be used.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#versioning-scheme","title":"Versioning Scheme","text":"

                                                                                                                                                                                                                                              The OpenSSL versioning scheme has changed with the OpenSSL 3.0 release. The new versioning scheme has this format:

                                                                                                                                                                                                                                              MAJOR.MINOR.PATCH

                                                                                                                                                                                                                                              For OpenSSL 1.1.1 and below, different patch levels were indicated by a letter at the end of the release version number. This will no longer be used and instead the patch level is indicated by the final number in the version. A change in the second (MINOR) number indicates that new features may have been added. OpenSSL versions with the same major number are API and ABI compatible. If the major number changes then API and ABI compatibility is not guaranteed.

                                                                                                                                                                                                                                              For more information, see OpenSSL_version(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#other-major-new-features","title":"Other major new features","text":""},{"location":"man7/migration_guide/#certificate-management-protocol-cmp-rfc-4210","title":"Certificate Management Protocol (CMP, RFC 4210)","text":"

                                                                                                                                                                                                                                              This also covers CRMF (RFC 4211) and HTTP transfer (RFC 6712) See openssl-cmp(1) and OSSL_CMP_exec_certreq(3) as starting points.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#https-client","title":"HTTP(S) client","text":"

                                                                                                                                                                                                                                              A proper HTTP(S) client that supports GET and POST, redirection, plain and ASN.1-encoded contents, proxies, and timeouts.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#key-derivation-function-api-evp_kdf","title":"Key Derivation Function API (EVP_KDF)","text":"

                                                                                                                                                                                                                                              This simplifies the process of adding new KDF and PRF implementations.

                                                                                                                                                                                                                                              Previously KDF algorithms had been shoe-horned into using the EVP_PKEY object which was not a logical mapping. Existing applications that use KDF algorithms using EVP_PKEY (scrypt, TLS1 PRF and HKDF) may be slower as they use an EVP_KDF bridge internally. All new applications should use the new EVP_KDF(3) interface. See also \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-default(7) and \"Key Derivation Function (KDF)\" in OSSL_PROVIDER-FIPS(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#message-authentication-code-api-evp_mac","title":"Message Authentication Code API (EVP_MAC)","text":"

                                                                                                                                                                                                                                              This simplifies the process of adding MAC implementations.

                                                                                                                                                                                                                                              This includes a generic EVP_PKEY to EVP_MAC bridge, to facilitate the continued use of MACs through raw private keys in functionality such as EVP_DigestSign(3) and EVP_DigestVerify(3).

                                                                                                                                                                                                                                              All new applications should use the new EVP_MAC(3) interface. See also \"Message Authentication Code (MAC)\" in OSSL_PROVIDER-default(7) and \"Message Authentication Code (MAC)\" in OSSL_PROVIDER-FIPS(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#algorithm-fetching","title":"Algorithm Fetching","text":"

                                                                                                                                                                                                                                              Using calls to convenience functions such as EVP_sha256() and EVP_aes_256_gcm() may incur a performance penalty when using providers. Retrieving algorithms from providers involves searching for an algorithm by name. This is much slower than directly accessing a method table. It is recommended to prefetch algorithms if an algorithm is used many times. See \"Performance\" in crypto(7), \"Explicit fetching\" in crypto(7) and \"Implicit fetching\" in crypto(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#support-for-linux-kernel-tls","title":"Support for Linux Kernel TLS","text":"

                                                                                                                                                                                                                                              In order to use KTLS, support for it must be compiled in using the enable-ktls configuration option. It must also be enabled at run time using the SSL_OP_ENABLE_KTLS option.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#new-algorithms","title":"New Algorithms","text":"
                                                                                                                                                                                                                                              • KDF algorithms \"SINGLE STEP\" and \"SSH\"

                                                                                                                                                                                                                                                See EVP_KDF-SS(7) and EVP_KDF-SSHKDF(7)

                                                                                                                                                                                                                                              • MAC Algorithms \"GMAC\" and \"KMAC\"

                                                                                                                                                                                                                                                See EVP_MAC-GMAC(7) and EVP_MAC-KMAC(7).

                                                                                                                                                                                                                                              • KEM Algorithm \"RSASVE\"

                                                                                                                                                                                                                                                See EVP_KEM-RSA(7).

                                                                                                                                                                                                                                              • Cipher Algorithm \"AES-SIV\"

                                                                                                                                                                                                                                                See \"SIV Mode\" in EVP_EncryptInit(3).

                                                                                                                                                                                                                                              • AES Key Wrap inverse ciphers supported by EVP layer.

                                                                                                                                                                                                                                                The inverse ciphers use AES decryption for wrapping, and AES encryption for unwrapping. The algorithms are: \"AES-128-WRAP-INV\", \"AES-192-WRAP-INV\", \"AES-256-WRAP-INV\", \"AES-128-WRAP-PAD-INV\", \"AES-192-WRAP-PAD-INV\" and \"AES-256-WRAP-PAD-INV\".

                                                                                                                                                                                                                                              • CTS ciphers added to EVP layer.

                                                                                                                                                                                                                                                The algorithms are \"AES-128-CBC-CTS\", \"AES-192-CBC-CTS\", \"AES-256-CBC-CTS\", \"CAMELLIA-128-CBC-CTS\", \"CAMELLIA-192-CBC-CTS\" and \"CAMELLIA-256-CBC-CTS\". CS1, CS2 and CS3 variants are supported.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#cms-and-pkcs7-updates","title":"CMS and PKCS#7 updates","text":"
                                                                                                                                                                                                                                              • Added CAdES-BES signature verification support.
                                                                                                                                                                                                                                              • Added CAdES-BES signature scheme and attributes support (RFC 5126) to CMS API.
                                                                                                                                                                                                                                              • Added AuthEnvelopedData content type structure (RFC 5083) using AES_GCM

                                                                                                                                                                                                                                                This uses the AES-GCM parameter (RFC 5084) for the Cryptographic Message Syntax. Its purpose is to support encryption and decryption of a digital envelope that is both authenticated and encrypted using AES GCM mode.

                                                                                                                                                                                                                                              • PKCS7_get_octet_string(3) and PKCS7_type_is_other(3) were made public.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#pkcs12-api-updates","title":"PKCS#12 API updates","text":"

                                                                                                                                                                                                                                              The default algorithms for pkcs12 creation with the PKCS12_create() function were changed to more modern PBKDF2 and AES based algorithms. The default MAC iteration count was changed to PKCS12_DEFAULT_ITER to make it equal with the password-based encryption iteration count. The default digest algorithm for the MAC computation was changed to SHA-256. The pkcs12 application now supports -legacy option that restores the previous default algorithms to support interoperability with legacy systems.

                                                                                                                                                                                                                                              Added enhanced PKCS#12 APIs which accept a library context OSSL_LIB_CTX and (where relevant) a property query. Other APIs which handle PKCS#7 and PKCS#8 objects have also been enhanced where required. This includes:

                                                                                                                                                                                                                                              PKCS12_add_key_ex(3), PKCS12_add_safe_ex(3), PKCS12_add_safes_ex(3), PKCS12_create_ex(3), PKCS12_decrypt_skey_ex(3), PKCS12_init_ex(3), PKCS12_item_decrypt_d2i_ex(3), PKCS12_item_i2d_encrypt_ex(3), PKCS12_key_gen_asc_ex(3), PKCS12_key_gen_uni_ex(3), PKCS12_key_gen_utf8_ex(3), PKCS12_pack_p7encdata_ex(3), PKCS12_pbe_crypt_ex(3), PKCS12_PBE_keyivgen_ex(3), PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(3), PKCS5_pbe2_set_iv_ex(3), PKCS5_pbe_set0_algor_ex(3), PKCS5_pbe_set_ex(3), PKCS5_pbkdf2_set_ex(3), PKCS5_v2_PBE_keyivgen_ex(3), PKCS5_v2_scrypt_keyivgen_ex(3), PKCS8_decrypt_ex(3), PKCS8_encrypt_ex(3), PKCS8_set0_pbe_ex(3).

                                                                                                                                                                                                                                              As part of this change the EVP_PBE_xxx APIs can also accept a library context and property query and will call an extended version of the key/IV derivation function which supports these parameters. This includes EVP_PBE_CipherInit_ex(3), EVP_PBE_find_ex(3) and EVP_PBE_scrypt_ex(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#pkcs12-kdf-versus-fips","title":"PKCS#12 KDF versus FIPS","text":"

                                                                                                                                                                                                                                              Unlike in 1.x.y, the PKCS12KDF algorithm used when a PKCS#12 structure is created with a MAC that does not work with the FIPS provider as the PKCS12KDF is not a FIPS approvable mechanism.

                                                                                                                                                                                                                                              See EVP_KDF-PKCS12KDF(7), PKCS12_create(3), openssl-pkcs12(1), OSSL_PROVIDER-FIPS(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#windows-thread-synchronization-changes","title":"Windows thread synchronization changes","text":"

                                                                                                                                                                                                                                              Windows thread synchronization uses read/write primitives (SRWLock) when supported by the OS, otherwise CriticalSection continues to be used.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#trace-api","title":"Trace API","text":"

                                                                                                                                                                                                                                              A new generic trace API has been added which provides support for enabling instrumentation through trace output. This feature is mainly intended as an aid for developers and is disabled by default. To utilize it, OpenSSL needs to be configured with the enable-trace option.

                                                                                                                                                                                                                                              If the tracing API is enabled, the application can activate trace output by registering BIOs as trace channels for a number of tracing and debugging categories. See OSSL_trace_enabled(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#key-validation-updates","title":"Key validation updates","text":"

                                                                                                                                                                                                                                              EVP_PKEY_public_check(3) and EVP_PKEY_param_check(3) now work for more key types. This includes RSA, DSA, ED25519, X25519, ED448 and X448. Previously (in 1.1.1) they would return -2. For key types that do not have parameters then EVP_PKEY_param_check(3) will always return 1.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#other-notable-deprecations-and-changes","title":"Other notable deprecations and changes","text":""},{"location":"man7/migration_guide/#the-function-code-part-of-an-openssl-error-code-is-no-longer-relevant","title":"The function code part of an OpenSSL error code is no longer relevant","text":"

                                                                                                                                                                                                                                              This code is now always set to zero. Related functions are deprecated.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#stack-and-hash-macros-have-been-cleaned-up","title":"STACK and HASH macros have been cleaned up","text":"

                                                                                                                                                                                                                                              The type-safe wrappers are declared everywhere and implemented once. See DEFINE_STACK_OF(3) and DEFINE_LHASH_OF_EX(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#the-rand_drbg-subsystem-has-been-removed","title":"The RAND_DRBG subsystem has been removed","text":"

                                                                                                                                                                                                                                              The new EVP_RAND(3) is a partial replacement: the DRBG callback framework is absent. The RAND_DRBG API did not fit well into the new provider concept as implemented by EVP_RAND and EVP_RAND_CTX.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#removed-fips_mode-and-fips_mode_set","title":"Removed FIPS_mode() and FIPS_mode_set()","text":"

                                                                                                                                                                                                                                              These functions are legacy APIs that are not applicable to the new provider model. Applications should instead use EVP_default_properties_is_fips_enabled(3) and EVP_default_properties_enable_fips(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#key-generation-is-slower","title":"Key generation is slower","text":"

                                                                                                                                                                                                                                              The Miller-Rabin test now uses 64 rounds, which is used for all prime generation, including RSA key generation. This affects the time for larger keys sizes.

                                                                                                                                                                                                                                              The default key generation method for the regular 2-prime RSA keys was changed to the FIPS186-4 B.3.6 method (Generation of Probable Primes with Conditions Based on Auxiliary Probable Primes). This method is slower than the original method.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#change-pbkdf2-to-conform-to-sp800-132-instead-of-the-older-pkcs5-rfc2898","title":"Change PBKDF2 to conform to SP800-132 instead of the older PKCS5 RFC2898","text":"

                                                                                                                                                                                                                                              This checks that the salt length is at least 128 bits, the derived key length is at least 112 bits, and that the iteration count is at least 1000. For backwards compatibility these checks are disabled by default in the default provider, but are enabled by default in the FIPS provider.

                                                                                                                                                                                                                                              To enable or disable the checks see OSSL_KDF_PARAM_PKCS5 in EVP_KDF-PBKDF2(7). The parameter can be set using EVP_KDF_derive(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#enforce-a-minimum-dh-modulus-size-of-512-bits","title":"Enforce a minimum DH modulus size of 512 bits","text":"

                                                                                                                                                                                                                                              Smaller sizes now result in an error.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#sm2-key-changes","title":"SM2 key changes","text":"

                                                                                                                                                                                                                                              EC EVP_PKEYs with the SM2 curve have been reworked to automatically become EVP_PKEY_SM2 rather than EVP_PKEY_EC.

                                                                                                                                                                                                                                              Unlike in previous OpenSSL versions, this means that applications cannot call EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2) to get SM2 computations.

                                                                                                                                                                                                                                              Parameter and key generation is also reworked to make it possible to generate EVP_PKEY_SM2 parameters and keys. Applications must now generate SM2 keys directly and must not create an EVP_PKEY_EC key first. It is no longer possible to import an SM2 key with domain parameters other than the SM2 elliptic curve ones.

                                                                                                                                                                                                                                              Validation of SM2 keys has been separated from the validation of regular EC keys, allowing to improve the SM2 validation process to reject loaded private keys that are not conforming to the SM2 ISO standard. In particular, a private scalar k outside the range 1 <= k < n-1 is now correctly rejected.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#evp_pkey_set_alias_type-method-has-been-removed","title":"EVP_PKEY_set_alias_type() method has been removed","text":"

                                                                                                                                                                                                                                              This function made a EVP_PKEY object mutable after it had been set up. In OpenSSL 3.0 it was decided that a provided key should not be able to change its type, so this function has been removed.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#functions-that-return-an-internal-key-should-be-treated-as-read-only","title":"Functions that return an internal key should be treated as read only","text":"

                                                                                                                                                                                                                                              Functions such as EVP_PKEY_get0_RSA(3) behave slightly differently in OpenSSL 3.0. Previously they returned a pointer to the low-level key used internally by libcrypto. From OpenSSL 3.0 this key may now be held in a provider. Calling these functions will only return a handle on the internal key where the EVP_PKEY was constructed using this key in the first place, for example using a function or macro such as EVP_PKEY_assign_RSA(3), EVP_PKEY_set1_RSA(3), etc. Where the EVP_PKEY holds a provider managed key, then these functions now return a cached copy of the key. Changes to the internal provider key that take place after the first time the cached key is accessed will not be reflected back in the cached copy. Similarly any changes made to the cached copy by application code will not be reflected back in the internal provider key.

                                                                                                                                                                                                                                              For the above reasons the keys returned from these functions should typically be treated as read-only. To emphasise this the value returned from EVP_PKEY_get0_RSA(3), EVP_PKEY_get0_DSA(3), EVP_PKEY_get0_EC_KEY(3) and EVP_PKEY_get0_DH(3) have been made const. This may break some existing code. Applications broken by this change should be modified. The preferred solution is to refactor the code to avoid the use of these deprecated functions. Failing this the code should be modified to use a const pointer instead. The EVP_PKEY_get1_RSA(3), EVP_PKEY_get1_DSA(3), EVP_PKEY_get1_EC_KEY(3) and EVP_PKEY_get1_DH(3) functions continue to return a non-const pointer to enable them to be \"freed\". However they should also be treated as read-only.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#the-public-key-check-has-moved-from-evp_pkey_derive-to-evp_pkey_derive_set_peer","title":"The public key check has moved from EVP_PKEY_derive() to EVP_PKEY_derive_set_peer()","text":"

                                                                                                                                                                                                                                              This may mean result in an error in EVP_PKEY_derive_set_peer(3) rather than during EVP_PKEY_derive(3). To disable this check use EVP_PKEY_derive_set_peer_ex(dh, peer, 0).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#the-print-format-has-cosmetic-changes-for-some-functions","title":"The print format has cosmetic changes for some functions","text":"

                                                                                                                                                                                                                                              The output from numerous \"printing\" functions such as X509_signature_print(3), X509_print_ex(3), X509_CRL_print_ex(3), and other similar functions has been amended such that there may be cosmetic differences between the output observed in 1.1.1 and 3.0. This also applies to the -text output from the openssl x509 and openssl crl applications.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#interactive-mode-from-the-openssl-program-has-been-removed","title":"Interactive mode from the openssl program has been removed","text":"

                                                                                                                                                                                                                                              From now on, running it without arguments is equivalent to openssl help.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#the-error-return-values-from-some-control-calls-ctrl-have-changed","title":"The error return values from some control calls (ctrl) have changed","text":"

                                                                                                                                                                                                                                              One significant change is that controls which used to return -2 for invalid inputs, now return -1 indicating a generic error condition instead.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#dh-and-dhx-key-types-have-different-settable-parameters","title":"DH and DHX key types have different settable parameters","text":"

                                                                                                                                                                                                                                              Previously (in 1.1.1) these conflicting parameters were allowed, but will now result in errors. See EVP_PKEY-DH(7) for further details. This affects the behaviour of openssl-genpkey(1) for DH parameter generation.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#evp_cipher_ctx_set_flags-ordering-change","title":"EVP_CIPHER_CTX_set_flags() ordering change","text":"

                                                                                                                                                                                                                                              If using a cipher from a provider the EVP_CIPH_FLAG_LENGTH_BITS flag can only be set after the cipher has been assigned to the cipher context. See \"FLAGS\" in EVP_EncryptInit(3) for more information.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#validation-of-operation-context-parameters","title":"Validation of operation context parameters","text":"

                                                                                                                                                                                                                                              Due to move of the implementation of cryptographic operations to the providers, validation of various operation parameters can be postponed until the actual operation is executed where previously it happened immediately when an operation parameter was set.

                                                                                                                                                                                                                                              For example when setting an unsupported curve with EVP_PKEY_CTX_set_ec_paramgen_curve_nid() this function call will not fail but later keygen operations with the EVP_PKEY_CTX will fail.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#removal-of-function-code-from-the-error-codes","title":"Removal of function code from the error codes","text":"

                                                                                                                                                                                                                                              The function code part of the error code is now always set to 0. For that reason the ERR_GET_FUNC() macro was removed. Applications must resolve the error codes only using the library number and the reason code.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#chacha20-poly1305-cipher-does-not-allow-a-truncated-iv-length-to-be-used","title":"ChaCha20-Poly1305 cipher does not allow a truncated IV length to be used","text":"

                                                                                                                                                                                                                                              In OpenSSL 3.0 setting the IV length to any value other than 12 will result in an error. Prior to OpenSSL 3.0 the ivlen could be smaller that the required 12 byte length, using EVP_CIPHER_CTX_ctrl(ctx, EVP_CRTL_AEAD_SET_IVLEN, ivlen, NULL). This resulted in an IV that had leading zero padding.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#installation-and-compilation","title":"Installation and Compilation","text":"

                                                                                                                                                                                                                                              Please refer to the INSTALL.md file in the top of the distribution for instructions on how to build and install OpenSSL 3.0. Please also refer to the various platform specific NOTES files for your specific platform.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#upgrading-from-openssl-111","title":"Upgrading from OpenSSL 1.1.1","text":"

                                                                                                                                                                                                                                              Upgrading to OpenSSL 3.0 from OpenSSL 1.1.1 should be relatively straight forward in most cases. The most likely area where you will encounter problems is if you have used low level APIs in your code (as discussed above). In that case you are likely to start seeing deprecation warnings when compiling your application. If this happens you have 3 options:

                                                                                                                                                                                                                                              1. Ignore the warnings. They are just warnings. The deprecated functions are still present and you may still use them. However be aware that they may be removed from a future version of OpenSSL.
                                                                                                                                                                                                                                              2. Suppress the warnings. Refer to your compiler documentation on how to do this.
                                                                                                                                                                                                                                              3. Remove your usage of the low level APIs. In this case you will need to rewrite your code to use the high level APIs instead
                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#error-code-changes","title":"Error code changes","text":"

                                                                                                                                                                                                                                              As OpenSSL 3.0 provides a brand new Encoder/Decoder mechanism for working with widely used file formats, application code that checks for particular error reason codes on key loading failures might need an update.

                                                                                                                                                                                                                                              Password-protected keys may deserve special attention. If only some errors are treated as an indicator that the user should be asked about the password again, it's worth testing these scenarios and processing the newly relevant codes.

                                                                                                                                                                                                                                              There may be more cases to treat specially, depending on the calling application code.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#upgrading-from-openssl-102","title":"Upgrading from OpenSSL 1.0.2","text":"

                                                                                                                                                                                                                                              Upgrading to OpenSSL 3.0 from OpenSSL 1.0.2 is likely to be significantly more difficult. In addition to the issues discussed above in the section about \"Upgrading from OpenSSL 1.1.1\", the main things to be aware of are:

                                                                                                                                                                                                                                              1. The build and installation procedure has changed significantly.

                                                                                                                                                                                                                                                Check the file INSTALL.md in the top of the installation for instructions on how to build and install OpenSSL for your platform. Also read the various NOTES files in the same directory, as applicable for your platform.

                                                                                                                                                                                                                                              2. Many structures have been made opaque in OpenSSL 3.0.

                                                                                                                                                                                                                                                The structure definitions have been removed from the public header files and moved to internal header files. In practice this means that you can no longer stack allocate some structures. Instead they must be heap allocated through some function call (typically those function names have a _new suffix to them). Additionally you must use \"setter\" or \"getter\" functions to access the fields within those structures.

                                                                                                                                                                                                                                                For example code that previously looked like this:

                                                                                                                                                                                                                                                EVP_MD_CTX md_ctx;\n\n/* This line will now generate compiler errors */\nEVP_MD_CTX_init(&md_ctx);\n

                                                                                                                                                                                                                                                The code needs to be amended to look like this:

                                                                                                                                                                                                                                                EVP_MD_CTX *md_ctx;\n\nmd_ctx = EVP_MD_CTX_new();\n...\n...\nEVP_MD_CTX_free(md_ctx);\n
                                                                                                                                                                                                                                              3. Support for TLSv1.3 has been added.

                                                                                                                                                                                                                                                This has a number of implications for SSL/TLS applications. See the TLS1.3 page for further details.

                                                                                                                                                                                                                                              More details about the breaking changes between OpenSSL versions 1.0.2 and 1.1.0 can be found on the OpenSSL 1.1.0 Changes page.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#upgrading-from-the-openssl-20-fips-object-module","title":"Upgrading from the OpenSSL 2.0 FIPS Object Module","text":"

                                                                                                                                                                                                                                              The OpenSSL 2.0 FIPS Object Module was a separate download that had to be built separately and then integrated into your main OpenSSL 1.0.2 build. In OpenSSL 3.0 the FIPS support is fully integrated into the mainline version of OpenSSL and is no longer a separate download. For further information see \"Completing the installation of the FIPS Module\".

                                                                                                                                                                                                                                              The function calls FIPS_mode() and FIPS_mode_set() have been removed from OpenSSL 3.0. You should rewrite your application to not use them. See fips_module(7) and OSSL_PROVIDER-FIPS(7) for details.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#completing-the-installation-of-the-fips-module","title":"Completing the installation of the FIPS Module","text":"

                                                                                                                                                                                                                                              The FIPS Module will be built and installed automatically if FIPS support has been configured. The current documentation can be found in the README-FIPS file.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#programming","title":"Programming","text":"

                                                                                                                                                                                                                                              Applications written to work with OpenSSL 1.1.1 will mostly just work with OpenSSL 3.0. However changes will be required if you want to take advantage of some of the new features that OpenSSL 3.0 makes available. In order to do that you need to understand some new concepts introduced in OpenSSL 3.0. Read \"Library contexts\" in crypto(7) for further information.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#library-context","title":"Library Context","text":"

                                                                                                                                                                                                                                              A library context allows different components of a complex application to each use a different library context and have different providers loaded with different configuration settings. See \"Library contexts\" in crypto(7) for further info.

                                                                                                                                                                                                                                              If the user creates an OSSL_LIB_CTX via OSSL_LIB_CTX_new(3) then many functions may need to be changed to pass additional parameters to handle the library context.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#using-a-library-context-old-functions-that-should-be-changed","title":"Using a Library Context - Old functions that should be changed","text":"

                                                                                                                                                                                                                                              If a library context is needed then all EVP_* digest functions that return a const EVP_MD * such as EVP_sha256() should be replaced with a call to EVP_MD_fetch(3). See \"ALGORITHM FETCHING\" in crypto(7).

                                                                                                                                                                                                                                              If a library context is needed then all EVP_* cipher functions that return a const EVP_CIPHER * such as EVP_aes_128_cbc() should be replaced vith a call to EVP_CIPHER_fetch(3). See \"ALGORITHM FETCHING\" in crypto(7).

                                                                                                                                                                                                                                              Some functions can be passed an object that has already been set up with a library context such as d2i_X509(3), d2i_X509_CRL(3), d2i_X509_REQ(3) and d2i_X509_PUBKEY(3). If NULL is passed instead then the created object will be set up with the default library context. Use X509_new_ex(3), X509_CRL_new_ex(3), X509_REQ_new_ex(3) and X509_PUBKEY_new_ex(3) if a library context is required.

                                                                                                                                                                                                                                              All functions listed below with a NAME have a replacement function NAME_ex that takes OSSL_LIB_CTX as an additional argument. Functions that have other mappings are listed along with the respective name.

                                                                                                                                                                                                                                              • ASN1_item_new(3), ASN1_item_d2i(3), ASN1_item_d2i_fp(3), ASN1_item_d2i_bio(3), ASN1_item_sign(3) and ASN1_item_verify(3)
                                                                                                                                                                                                                                              • BIO_new(3)
                                                                                                                                                                                                                                              • b2i_RSA_PVK_bio() and i2b_PVK_bio()
                                                                                                                                                                                                                                              • BN_CTX_new(3) and BN_CTX_secure_new(3)
                                                                                                                                                                                                                                              • CMS_AuthEnvelopedData_create(3), CMS_ContentInfo_new(3), CMS_data_create(3), CMS_digest_create(3), CMS_EncryptedData_encrypt(3), CMS_encrypt(3), CMS_EnvelopedData_create(3), CMS_ReceiptRequest_create0(3) and CMS_sign(3)
                                                                                                                                                                                                                                              • CONF_modules_load_file(3)
                                                                                                                                                                                                                                              • CTLOG_new(3), CTLOG_new_from_base64(3) and CTLOG_STORE_new(3)
                                                                                                                                                                                                                                              • CT_POLICY_EVAL_CTX_new(3)
                                                                                                                                                                                                                                              • d2i_AutoPrivateKey(3), d2i_PrivateKey(3) and d2i_PUBKEY(3)
                                                                                                                                                                                                                                              • d2i_PrivateKey_bio(3) and d2i_PrivateKey_fp(3)

                                                                                                                                                                                                                                                Use d2i_PrivateKey_ex_bio(3) and d2i_PrivateKey_ex_fp(3)

                                                                                                                                                                                                                                              • EC_GROUP_new(3)

                                                                                                                                                                                                                                                Use EC_GROUP_new_by_curve_name_ex(3) or EC_GROUP_new_from_params(3).

                                                                                                                                                                                                                                              • EVP_DigestSignInit(3) and EVP_DigestVerifyInit(3)

                                                                                                                                                                                                                                              • EVP_PBE_CipherInit(3), EVP_PBE_find(3) and EVP_PBE_scrypt(3)
                                                                                                                                                                                                                                              • PKCS5_PBE_keyivgen(3)
                                                                                                                                                                                                                                              • EVP_PKCS82PKEY(3)
                                                                                                                                                                                                                                              • EVP_PKEY_CTX_new_id(3)

                                                                                                                                                                                                                                                Use EVP_PKEY_CTX_new_from_name(3)

                                                                                                                                                                                                                                              • EVP_PKEY_derive_set_peer(3), EVP_PKEY_new_raw_private_key(3) and EVP_PKEY_new_raw_public_key(3)

                                                                                                                                                                                                                                              • EVP_SignFinal(3) and EVP_VerifyFinal(3)
                                                                                                                                                                                                                                              • NCONF_new(3)
                                                                                                                                                                                                                                              • OCSP_RESPID_match(3) and OCSP_RESPID_set_by_key(3)
                                                                                                                                                                                                                                              • OPENSSL_thread_stop(3)
                                                                                                                                                                                                                                              • OSSL_STORE_open(3)
                                                                                                                                                                                                                                              • PEM_read_bio_Parameters(3), PEM_read_bio_PrivateKey(3), PEM_read_bio_PUBKEY(3), PEM_read_PrivateKey(3) and PEM_read_PUBKEY(3)
                                                                                                                                                                                                                                              • PEM_write_bio_PrivateKey(3), PEM_write_bio_PUBKEY(3), PEM_write_PrivateKey(3) and PEM_write_PUBKEY(3)
                                                                                                                                                                                                                                              • PEM_X509_INFO_read_bio(3) and PEM_X509_INFO_read(3)
                                                                                                                                                                                                                                              • PKCS12_add_key(3), PKCS12_add_safe(3), PKCS12_add_safes(3), PKCS12_create(3), PKCS12_decrypt_skey(3), PKCS12_init(3), PKCS12_item_decrypt_d2i(3), PKCS12_item_i2d_encrypt(3), PKCS12_key_gen_asc(3), PKCS12_key_gen_uni(3), PKCS12_key_gen_utf8(3), PKCS12_pack_p7encdata(3), PKCS12_pbe_crypt(3), PKCS12_PBE_keyivgen(3), PKCS12_SAFEBAG_create_pkcs8_encrypt(3)
                                                                                                                                                                                                                                              • PKCS5_pbe_set0_algor(3), PKCS5_pbe_set(3), PKCS5_pbe2_set_iv(3), PKCS5_pbkdf2_set(3) and PKCS5_v2_scrypt_keyivgen(3)
                                                                                                                                                                                                                                              • PKCS7_encrypt(3), PKCS7_new(3) and PKCS7_sign(3)
                                                                                                                                                                                                                                              • PKCS8_decrypt(3), PKCS8_encrypt(3) and PKCS8_set0_pbe(3)
                                                                                                                                                                                                                                              • RAND_bytes(3) and RAND_priv_bytes(3)
                                                                                                                                                                                                                                              • SMIME_write_ASN1(3)
                                                                                                                                                                                                                                              • SSL_load_client_CA_file(3)
                                                                                                                                                                                                                                              • SSL_CTX_new(3)
                                                                                                                                                                                                                                              • TS_RESP_CTX_new(3)
                                                                                                                                                                                                                                              • X509_CRL_new(3)
                                                                                                                                                                                                                                              • X509_load_cert_crl_file(3) and X509_load_cert_file(3)
                                                                                                                                                                                                                                              • X509_LOOKUP_by_subject(3) and X509_LOOKUP_ctrl(3)
                                                                                                                                                                                                                                              • X509_NAME_hash(3)
                                                                                                                                                                                                                                              • X509_new(3)
                                                                                                                                                                                                                                              • X509_REQ_new(3) and X509_REQ_verify(3)
                                                                                                                                                                                                                                              • X509_STORE_CTX_new(3), X509_STORE_set_default_paths(3), X509_STORE_load_file(3), X509_STORE_load_locations(3) and X509_STORE_load_store(3)
                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#new-functions-that-use-a-library-context","title":"New functions that use a Library context","text":"

                                                                                                                                                                                                                                              The following functions can be passed a library context if required. Passing NULL will use the default library context.

                                                                                                                                                                                                                                              • BIO_new_from_core_bio(3)
                                                                                                                                                                                                                                              • EVP_ASYM_CIPHER_fetch(3) and EVP_ASYM_CIPHER_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_CIPHER_fetch(3) and EVP_CIPHER_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_default_properties_enable_fips(3) and EVP_default_properties_is_fips_enabled(3)
                                                                                                                                                                                                                                              • EVP_KDF_fetch(3) and EVP_KDF_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_KEM_fetch(3) and EVP_KEM_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_KEYEXCH_fetch(3) and EVP_KEYEXCH_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_KEYMGMT_fetch(3) and EVP_KEYMGMT_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_MAC_fetch(3) and EVP_MAC_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_MD_fetch(3) and EVP_MD_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_PKEY_CTX_new_from_pkey(3)
                                                                                                                                                                                                                                              • EVP_PKEY_Q_keygen(3)
                                                                                                                                                                                                                                              • EVP_Q_mac(3) and EVP_Q_digest(3)
                                                                                                                                                                                                                                              • EVP_RAND(3) and EVP_RAND_do_all_provided(3)
                                                                                                                                                                                                                                              • EVP_set_default_properties(3)
                                                                                                                                                                                                                                              • EVP_SIGNATURE_fetch(3) and EVP_SIGNATURE_do_all_provided(3)
                                                                                                                                                                                                                                              • OSSL_CMP_CTX_new(3) and OSSL_CMP_SRV_CTX_new(3)
                                                                                                                                                                                                                                              • OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(3)
                                                                                                                                                                                                                                              • OSSL_CRMF_MSG_create_popo(3) and OSSL_CRMF_MSGS_verify_popo(3)
                                                                                                                                                                                                                                              • OSSL_CRMF_pbm_new(3) and OSSL_CRMF_pbmp_new(3)
                                                                                                                                                                                                                                              • OSSL_DECODER_CTX_add_extra(3) and OSSL_DECODER_CTX_new_for_pkey(3)
                                                                                                                                                                                                                                              • OSSL_DECODER_fetch(3) and OSSL_DECODER_do_all_provided(3)
                                                                                                                                                                                                                                              • OSSL_ENCODER_CTX_add_extra(3)
                                                                                                                                                                                                                                              • OSSL_ENCODER_fetch(3) and OSSL_ENCODER_do_all_provided(3)
                                                                                                                                                                                                                                              • OSSL_LIB_CTX_free(3), OSSL_LIB_CTX_load_config(3) and OSSL_LIB_CTX_set0_default(3)
                                                                                                                                                                                                                                              • OSSL_PROVIDER_add_builtin(3), OSSL_PROVIDER_available(3), OSSL_PROVIDER_do_all(3), OSSL_PROVIDER_load(3), OSSL_PROVIDER_set_default_search_path(3) and OSSL_PROVIDER_try_load(3)
                                                                                                                                                                                                                                              • OSSL_SELF_TEST_get_callback(3) and OSSL_SELF_TEST_set_callback(3)
                                                                                                                                                                                                                                              • OSSL_STORE_attach(3)
                                                                                                                                                                                                                                              • OSSL_STORE_LOADER_fetch(3) and OSSL_STORE_LOADER_do_all_provided(3)
                                                                                                                                                                                                                                              • RAND_get0_primary(3), RAND_get0_private(3), RAND_get0_public(3), RAND_set_DRBG_type(3) and RAND_set_seed_source_type(3)
                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#providers","title":"Providers","text":"

                                                                                                                                                                                                                                              Providers are described in detail here \"Providers\" in crypto(7). See also \"OPENSSL PROVIDERS\" in crypto(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#fetching-algorithms-and-property-queries","title":"Fetching algorithms and property queries","text":"

                                                                                                                                                                                                                                              Implicit and Explicit Fetching is described in detail here \"ALGORITHM FETCHING\" in crypto(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#mapping-evp-controls-and-flags-to-provider-ossl_param3-parameters","title":"Mapping EVP controls and flags to provider OSSL_PARAM(3) parameters","text":"

                                                                                                                                                                                                                                              The existing functions for controls (such as EVP_CIPHER_CTX_ctrl(3)) and manipulating flags (such as EVP_MD_CTX_set_flags(3))internally use OSSL_PARAMS to pass information to/from provider objects. See OSSL_PARAM(3) for additional information related to parameters.

                                                                                                                                                                                                                                              For ciphers see \"CONTROLS\" in EVP_EncryptInit(3), \"FLAGS\" in EVP_EncryptInit(3) and \"PARAMETERS\" in EVP_EncryptInit(3).

                                                                                                                                                                                                                                              For digests see \"CONTROLS\" in EVP_DigestInit(3), \"FLAGS\" in EVP_DigestInit(3) and \"PARAMETERS\" in EVP_DigestInit(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecation-of-low-level-functions","title":"Deprecation of Low Level Functions","text":"

                                                                                                                                                                                                                                              A significant number of APIs have been deprecated in OpenSSL 3.0. This section describes some common categories of deprecations. See \"Deprecated function mappings\" for the list of deprecated functions that refer to these categories.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#providers-are-a-replacement-for-engines-and-low-level-method-overrides","title":"Providers are a replacement for engines and low-level method overrides","text":"

                                                                                                                                                                                                                                              Any accessor that uses an ENGINE is deprecated (such as EVP_PKEY_set1_engine()). Applications using engines should instead use providers.

                                                                                                                                                                                                                                              Before providers were added algorithms were overridden by changing the methods used by algorithms. All these methods such as RSA_new_method() and RSA_meth_new() are now deprecated and can be replaced by using providers instead.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-i2d-and-d2i-functions-for-low-level-key-types","title":"Deprecated i2d and d2i functions for low-level key types","text":"

                                                                                                                                                                                                                                              Any i2d and d2i functions such as d2i_DHparams() that take a low-level key type have been deprecated. Applications should instead use the OSSL_DECODER(3) and OSSL_ENCODER(3) APIs to read and write files. See \"Migration\" in d2i_RSAPrivateKey(3) for further details.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-key-object-getters-and-setters","title":"Deprecated low-level key object getters and setters","text":"

                                                                                                                                                                                                                                              Applications that set or get low-level key objects (such as EVP_PKEY_set1_DH() or EVP_PKEY_get0()) should instead use the OSSL_ENCODER (See OSSL_ENCODER_to_bio(3)) or OSSL_DECODER (See OSSL_DECODER_from_bio(3)) APIs, or alternatively use EVP_PKEY_fromdata(3) or EVP_PKEY_todata(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-key-parameter-getters","title":"Deprecated low-level key parameter getters","text":"

                                                                                                                                                                                                                                              Functions that access low-level objects directly such as RSA_get0_n(3) are now deprecated. Applications should use one of EVP_PKEY_get_bn_param(3), EVP_PKEY_get_int_param(3), l, EVP_PKEY_get_utf8_string_param(3), EVP_PKEY_get_octet_string_param(3) or EVP_PKEY_get_params(3) to access fields from an EVP_PKEY. Gettable parameters are listed in \"Common RSA parameters\" in EVP_PKEY-RSA(7), \"DH parameters\" in EVP_PKEY-DH(7), \"DSA parameters\" in EVP_PKEY-DSA(7), \"FFC parameters\" in EVP_PKEY-FFC(7), \"Common EC parameters\" in EVP_PKEY-EC(7) and \"Common X25519, X448, ED25519 and ED448 parameters\" in EVP_PKEY-X25519(7). Applications may also use EVP_PKEY_todata(3) to return all fields."},{"location":"man7/migration_guide/#deprecated-low-level-key-parameter-setters","title":"Deprecated low-level key parameter setters","text":"

                                                                                                                                                                                                                                              Functions that access low-level objects directly such as RSA_set0_crt_params(3) are now deprecated. Applications should use EVP_PKEY_fromdata(3) to create new keys from user provided key data. Keys should be immutable once they are created, so if required the user may use EVP_PKEY_todata(3), OSSL_PARAM_merge(3), and EVP_PKEY_fromdata(3) to create a modified key. See \"Examples\" in EVP_PKEY-DH(7) for more information. See \"Deprecated low-level key generation functions\" for information on generating a key using parameters.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-object-creation","title":"Deprecated low-level object creation","text":"

                                                                                                                                                                                                                                              Low-level objects were created using methods such as RSA_new(3), RSA_up_ref(3) and RSA_free(3). Applications should instead use the high-level EVP_PKEY APIs, e.g. EVP_PKEY_new(3), EVP_PKEY_up_ref(3) and EVP_PKEY_free(3). See also EVP_PKEY_CTX_new_from_name(3) and EVP_PKEY_CTX_new_from_pkey(3).

                                                                                                                                                                                                                                              EVP_PKEYs may be created in a variety of ways: See also \"Deprecated low-level key generation functions\", \"Deprecated low-level key reading and writing functions\" and \"Deprecated low-level key parameter setters\".

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-encryption-functions","title":"Deprecated low-level encryption functions","text":"

                                                                                                                                                                                                                                              Low-level encryption functions such as AES_encrypt(3) and AES_decrypt(3) have been informally discouraged from use for a long time. Applications should instead use the high level EVP APIs EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3), and EVP_EncryptFinal_ex(3) or EVP_DecryptInit_ex(3), EVP_DecryptUpdate(3) and EVP_DecryptFinal_ex(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-digest-functions","title":"Deprecated low-level digest functions","text":"

                                                                                                                                                                                                                                              Use of low-level digest functions such as SHA1_Init(3) have been informally discouraged from use for a long time. Applications should instead use the the high level EVP APIs EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal_ex(3), or the quick one-shot EVP_Q_digest(3).

                                                                                                                                                                                                                                              Note that the functions SHA1(3), SHA224(3), SHA256(3), SHA384(3) and SHA512(3) have changed to macros that use EVP_Q_digest(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-signing-functions","title":"Deprecated low-level signing functions","text":"

                                                                                                                                                                                                                                              Use of low-level signing functions such as DSA_sign(3) have been informally discouraged for a long time. Instead applications should use EVP_DigestSign(3) and EVP_DigestVerify(3). See also EVP_SIGNATURE-RSA(7), EVP_SIGNATURE-DSA(7), EVP_SIGNATURE-ECDSA(7) and EVP_SIGNATURE-ED25519(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-mac-functions","title":"Deprecated low-level MAC functions","text":"

                                                                                                                                                                                                                                              Low-level mac functions such as CMAC_Init(3) are deprecated. Applications should instead use the new EVP_MAC(3) interface, using EVP_MAC_CTX_new(3), EVP_MAC_CTX_free(3), EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3) or the single-shot MAC function EVP_Q_mac(3). See EVP_MAC(3), EVP_MAC-HMAC(7), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-KMAC(7), EVP_MAC-BLAKE2(7), EVP_MAC-Poly1305(7) and EVP_MAC-Siphash(7) for additional information.

                                                                                                                                                                                                                                              Note that the one-shot method HMAC() is still available for compatibility purposes, but this can also be replaced by using EVP_Q_MAC if a library context is required.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-validation-functions","title":"Deprecated low-level validation functions","text":"

                                                                                                                                                                                                                                              Low-level validation functions such as DH_check(3) have been informally discouraged from use for a long time. Applications should instead use the high-level EVP_PKEY APIs such as EVP_PKEY_check(3), EVP_PKEY_param_check(3), EVP_PKEY_param_check_quick(3), EVP_PKEY_public_check(3), EVP_PKEY_public_check_quick(3), EVP_PKEY_private_check(3), and EVP_PKEY_pairwise_check(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-key-exchange-functions","title":"Deprecated low-level key exchange functions","text":"

                                                                                                                                                                                                                                              Many low-level functions have been informally discouraged from use for a long time. Applications should instead use EVP_PKEY_derive(3). See EVP_KEYEXCH-DH(7), EVP_KEYEXCH-ECDH(7) and EVP_KEYEXCH-X25519(7).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-key-generation-functions","title":"Deprecated low-level key generation functions","text":"

                                                                                                                                                                                                                                              Many low-level functions have been informally discouraged from use for a long time. Applications should instead use EVP_PKEY_keygen_init(3) and EVP_PKEY_generate(3) as described in EVP_PKEY-DSA(7), EVP_PKEY-DH(7), EVP_PKEY-RSA(7), EVP_PKEY-EC(7) and EVP_PKEY-X25519(7). The 'quick' one-shot function EVP_PKEY_Q_keygen(3) and macros for the most common cases: and EVP_EC_gen(3) may also be used."},{"location":"man7/migration_guide/#deprecated-low-level-key-reading-and-writing-functions","title":"Deprecated low-level key reading and writing functions","text":"

                                                                                                                                                                                                                                              Use of low-level objects (such as DSA) has been informally discouraged from use for a long time. Functions to read and write these low-level objects (such as PEM_read_DSA_PUBKEY()) should be replaced. Applications should instead use OSSL_ENCODER_to_bio(3) and OSSL_DECODER_from_bio(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-low-level-key-printing-functions","title":"Deprecated low-level key printing functions","text":"

                                                                                                                                                                                                                                              Use of low-level objects (such as DSA) has been informally discouraged from use for a long time. Functions to print these low-level objects such as DSA_print() should be replaced with the equivalent EVP_PKEY functions. Application should use one of EVP_PKEY_print_public(3), EVP_PKEY_print_private(3), EVP_PKEY_print_params(3), EVP_PKEY_print_public_fp(3), EVP_PKEY_print_private_fp(3) or EVP_PKEY_print_params_fp(3). Note that internally these use OSSL_ENCODER_to_bio(3) and OSSL_DECODER_from_bio(3).

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-function-mappings","title":"Deprecated function mappings","text":"

                                                                                                                                                                                                                                              The following functions have been deprecated in 3.0.

                                                                                                                                                                                                                                              • AES_bi_ige_encrypt() and AES_ige_encrypt()

                                                                                                                                                                                                                                                There is no replacement for the IGE functions. New code should not use these modes. These undocumented functions were never integrated into the EVP layer. They implemented the AES Infinite Garble Extension (IGE) mode and AES Bi-directional IGE mode. These modes were never formally standardised and usage of these functions is believed to be very small. In particular AES_bi_ige_encrypt() has a known bug. It accepts 2 AES keys, but only one is ever used. The security implications are believed to be minimal, but this issue was never fixed for backwards compatibility reasons.

                                                                                                                                                                                                                                              • AES_encrypt(), AES_decrypt(), AES_set_encrypt_key(), AES_set_decrypt_key(), AES_cbc_encrypt(), AES_cfb128_encrypt(), AES_cfb1_encrypt(), AES_cfb8_encrypt(), AES_ecb_encrypt(), AES_ofb128_encrypt()

                                                                                                                                                                                                                                              • AES_unwrap_key(), AES_wrap_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\"

                                                                                                                                                                                                                                              • AES_options()

                                                                                                                                                                                                                                                There is no replacement. It returned a string indicating if the AES code was unrolled.

                                                                                                                                                                                                                                              • ASN1_digest(), ASN1_sign(), ASN1_verify()

                                                                                                                                                                                                                                                There are no replacements. These old functions are not used, and could be disabled with the macro NO_ASN1_OLD since OpenSSL 0.9.7.

                                                                                                                                                                                                                                              • ASN1_STRING_length_set()

                                                                                                                                                                                                                                                Use ASN1_STRING_set(3) or ASN1_STRING_set0(3) instead. This was a potentially unsafe function that could change the bounds of a previously passed in pointer.

                                                                                                                                                                                                                                              • BF_encrypt(), BF_decrypt(), BF_set_key(), BF_cbc_encrypt(), BF_cfb64_encrypt(), BF_ecb_encrypt(), BF_ofb64_encrypt()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". The Blowfish algorithm has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • BF_options()

                                                                                                                                                                                                                                                There is no replacement. This option returned a constant string.

                                                                                                                                                                                                                                              • BIO_get_callback(), BIO_set_callback(), BIO_debug_callback()

                                                                                                                                                                                                                                                Use the respective non-deprecated _ex() functions.

                                                                                                                                                                                                                                              • BN_is_prime_ex(), BN_is_prime_fasttest_ex()

                                                                                                                                                                                                                                                Use BN_check_prime(3) which avoids possible misuse and always uses at least 64 rounds of the Miller-Rabin primality test.

                                                                                                                                                                                                                                              • BN_pseudo_rand(), BN_pseudo_rand_range()

                                                                                                                                                                                                                                                Use BN_rand(3) and BN_rand_range(3).

                                                                                                                                                                                                                                              • BN_X931_derive_prime_ex(), BN_X931_generate_prime_ex(), BN_X931_generate_Xpq()

                                                                                                                                                                                                                                                There are no replacements for these low-level functions. They were used internally by RSA_X931_derive_ex() and RSA_X931_generate_key_ex() which are also deprecated. Use EVP_PKEY_keygen(3) instead.

                                                                                                                                                                                                                                              • Camellia_encrypt(), Camellia_decrypt(), Camellia_set_key(), Camellia_cbc_encrypt(), Camellia_cfb128_encrypt(), Camellia_cfb1_encrypt(), Camellia_cfb8_encrypt(), Camellia_ctr128_encrypt(), Camellia_ecb_encrypt(), Camellia_ofb128_encrypt()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\".

                                                                                                                                                                                                                                              • CAST_encrypt(), CAST_decrypt(), CAST_set_key(), CAST_cbc_encrypt(), CAST_cfb64_encrypt(), CAST_ecb_encrypt(), CAST_ofb64_encrypt()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". The CAST algorithm has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • CMAC_CTX_new(), CMAC_CTX_cleanup(), CMAC_CTX_copy(), CMAC_CTX_free(), CMAC_CTX_get0_cipher_ctx()

                                                                                                                                                                                                                                                See \"Deprecated low-level MAC functions\".

                                                                                                                                                                                                                                              • CMAC_Init(), CMAC_Update(), CMAC_Final(), CMAC_resume()

                                                                                                                                                                                                                                                See \"Deprecated low-level MAC functions\".

                                                                                                                                                                                                                                              • CRYPTO_mem_ctrl(), CRYPTO_mem_debug_free(), CRYPTO_mem_debug_malloc(), CRYPTO_mem_debug_pop(), CRYPTO_mem_debug_push(), CRYPTO_mem_debug_realloc(), CRYPTO_mem_leaks(), CRYPTO_mem_leaks_cb(), CRYPTO_mem_leaks_fp(), CRYPTO_set_mem_debug()

                                                                                                                                                                                                                                                Memory-leak checking has been deprecated in favor of more modern development tools, such as compiler memory and leak sanitizers or Valgrind.

                                                                                                                                                                                                                                              • CRYPTO_cts128_encrypt_block(), CRYPTO_cts128_encrypt(), CRYPTO_cts128_decrypt_block(), CRYPTO_cts128_decrypt(), CRYPTO_nistcts128_encrypt_block(), CRYPTO_nistcts128_encrypt(), CRYPTO_nistcts128_decrypt_block(), CRYPTO_nistcts128_decrypt()

                                                                                                                                                                                                                                                Use the higher level functions EVP_CipherInit_ex2(), EVP_CipherUpdate() and EVP_CipherFinal_ex() instead. See the \"cts_mode\" parameter in \"Gettable and Settable EVP_CIPHER_CTX parameters\" in EVP_EncryptInit(3). See \"EXAMPLES\" in EVP_EncryptInit(3) for a AES-256-CBC-CTS example.

                                                                                                                                                                                                                                              • d2i_DHparams(), d2i_DHxparams(), d2i_DSAparams(), d2i_DSAPrivateKey(), d2i_DSAPrivateKey_bio(), d2i_DSAPrivateKey_fp(), d2i_DSA_PUBKEY(), d2i_DSA_PUBKEY_bio(), d2i_DSA_PUBKEY_fp(), d2i_DSAPublicKey(), d2i_ECParameters(), d2i_ECPrivateKey(), d2i_ECPrivateKey_bio(), d2i_ECPrivateKey_fp(), d2i_EC_PUBKEY(), d2i_EC_PUBKEY_bio(), d2i_EC_PUBKEY_fp(), d2i_RSAPrivateKey(), d2i_RSAPrivateKey_bio(), d2i_RSAPrivateKey_fp(), d2i_RSA_PUBKEY(), d2i_RSA_PUBKEY_bio(), d2i_RSA_PUBKEY_fp(), d2i_RSAPublicKey(), d2i_RSAPublicKey_bio(), d2i_RSAPublicKey_fp()

                                                                                                                                                                                                                                                See \"Deprecated i2d and d2i functions for low-level key types\"

                                                                                                                                                                                                                                              • o2i_ECPublicKey()

                                                                                                                                                                                                                                                Use EVP_PKEY_set1_encoded_public_key(3). See \"Deprecated low-level key parameter setters\"

                                                                                                                                                                                                                                              • DES_crypt(), DES_fcrypt(), DES_encrypt1(), DES_encrypt2(), DES_encrypt3(), DES_decrypt3(), DES_ede3_cbc_encrypt(), DES_ede3_cfb64_encrypt(), DES_ede3_cfb_encrypt(),DES_ede3_ofb64_encrypt(), DES_ecb_encrypt(), DES_ecb3_encrypt(), DES_ofb64_encrypt(), DES_ofb_encrypt(), DES_cfb64_encrypt DES_cfb_encrypt(), DES_cbc_encrypt(), DES_ncbc_encrypt(), DES_pcbc_encrypt(), DES_xcbc_encrypt(), DES_cbc_cksum(), DES_quad_cksum(), DES_check_key_parity(), DES_is_weak_key(), DES_key_sched(), DES_options(), DES_random_key(), DES_set_key(), DES_set_key_checked(), DES_set_key_unchecked(), DES_set_odd_parity(), DES_string_to_2keys(), DES_string_to_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". Algorithms for \"DESX-CBC\", \"DES-ECB\", \"DES-CBC\", \"DES-OFB\", \"DES-CFB\", \"DES-CFB1\" and \"DES-CFB8\" have been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • DH_bits(), DH_security_bits(), DH_size()

                                                                                                                                                                                                                                                Use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                                                                                                                                                              • DH_check(), DH_check_ex(), DH_check_params(), DH_check_params_ex(), DH_check_pub_key(), DH_check_pub_key_ex()

                                                                                                                                                                                                                                                See \"Deprecated low-level validation functions\"

                                                                                                                                                                                                                                              • DH_clear_flags(), DH_test_flags(), DH_set_flags()

                                                                                                                                                                                                                                                The DH_FLAG_CACHE_MONT_P flag has been deprecated without replacement. The DH_FLAG_TYPE_DH and DH_FLAG_TYPE_DHX have been deprecated. Use EVP_PKEY_is_a() to determine the type of a key. There is no replacement for setting these flags.

                                                                                                                                                                                                                                              • DH_compute_key() DH_compute_key_padded()

                                                                                                                                                                                                                                                See \"Deprecated low-level key exchange functions\".

                                                                                                                                                                                                                                              • DH_new(), DH_new_by_nid(), DH_free(), DH_up_ref()

                                                                                                                                                                                                                                                See \"Deprecated low-level object creation\"

                                                                                                                                                                                                                                              • DH_generate_key(), DH_generate_parameters_ex()

                                                                                                                                                                                                                                                See \"Deprecated low-level key generation functions\".

                                                                                                                                                                                                                                              • DH_get0_pqg(), DH_get0_p(), DH_get0_q(), DH_get0_g(), DH_get0_key(), DH_get0_priv_key(), DH_get0_pub_key(), DH_get_length(), DH_get_nid()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter getters\"

                                                                                                                                                                                                                                              • DH_get_1024_160(), DH_get_2048_224(), DH_get_2048_256()

                                                                                                                                                                                                                                                Applications should instead set the OSSL_PKEY_PARAM_GROUP_NAME as specified in \"DH parameters\" in EVP_PKEY-DH(7)) to one of \"dh_1024_160\", \"dh_2048_224\" or \"dh_2048_256\" when generating a DH key.

                                                                                                                                                                                                                                              • DH_KDF_X9_42()

                                                                                                                                                                                                                                                Applications should use EVP_PKEY_CTX_set_dh_kdf_type(3) instead.

                                                                                                                                                                                                                                              • DH_get_default_method(), DH_get0_engine(), DH_meth_*(), DH_new_method(), DH_OpenSSL(), DH_get_ex_data(), DH_set_default_method(), DH_set_method(), DH_set_ex_data()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                                                                                                                                                              • DHparams_print(), DHparams_print_fp()

                                                                                                                                                                                                                                                See \"Deprecated low-level key printing functions\"

                                                                                                                                                                                                                                              • DH_set0_key(), DH_set0_pqg(), DH_set_length()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter setters\"

                                                                                                                                                                                                                                              • DSA_bits(), DSA_security_bits(), DSA_size()

                                                                                                                                                                                                                                                Use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                                                                                                                                                              • DHparams_dup(), DSA_dup_DH()

                                                                                                                                                                                                                                                There is no direct replacement. Applications may use EVP_PKEY_copy_parameters(3) and EVP_PKEY_dup(3) instead.

                                                                                                                                                                                                                                              • DSA_generate_key(), DSA_generate_parameters_ex()

                                                                                                                                                                                                                                                See \"Deprecated low-level key generation functions\".

                                                                                                                                                                                                                                              • DSA_get0_engine(), DSA_get_default_method(), DSA_get_ex_data(), DSA_get_method(), DSA_meth_*(), DSA_new_method(), DSA_OpenSSL(), DSA_set_default_method(), DSA_set_ex_data(), DSA_set_method()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                                                                                                                                                              • DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_pqg(), DSA_get0_key(), DSA_get0_priv_key(), DSA_get0_pub_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter getters\".

                                                                                                                                                                                                                                              • DSA_new(), DSA_free(), DSA_up_ref()

                                                                                                                                                                                                                                                See \"Deprecated low-level object creation\"

                                                                                                                                                                                                                                              • DSAparams_dup()

                                                                                                                                                                                                                                                There is no direct replacement. Applications may use EVP_PKEY_copy_parameters(3) and EVP_PKEY_dup(3) instead.

                                                                                                                                                                                                                                              • DSAparams_print(), DSAparams_print_fp(), DSA_print(), DSA_print_fp()

                                                                                                                                                                                                                                                See \"Deprecated low-level key printing functions\"

                                                                                                                                                                                                                                              • DSA_set0_key(), DSA_set0_pqg()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter setters\"

                                                                                                                                                                                                                                              • DSA_set_flags(), DSA_clear_flags(), DSA_test_flags()

                                                                                                                                                                                                                                                The DSA_FLAG_CACHE_MONT_P flag has been deprecated without replacement.

                                                                                                                                                                                                                                              • DSA_sign(), DSA_do_sign(), DSA_sign_setup(), DSA_verify(), DSA_do_verify()

                                                                                                                                                                                                                                                See \"Deprecated low-level signing functions\".

                                                                                                                                                                                                                                              • ECDH_compute_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level key exchange functions\".

                                                                                                                                                                                                                                              • ECDH_KDF_X9_62()

                                                                                                                                                                                                                                                Applications may either set this using the helper function EVP_PKEY_CTX_set_ecdh_kdf_type(3) or by setting an OSSL_PARAM(3) using the \"kdf-type\" as shown in \"EXAMPLES\" in EVP_KEYEXCH-ECDH(7)

                                                                                                                                                                                                                                              • ECDSA_sign(), ECDSA_sign_ex(), ECDSA_sign_setup(), ECDSA_do_sign(), ECDSA_do_sign_ex(), ECDSA_verify(), ECDSA_do_verify()

                                                                                                                                                                                                                                                See \"Deprecated low-level signing functions\".

                                                                                                                                                                                                                                              • ECDSA_size()

                                                                                                                                                                                                                                                Applications should use EVP_PKEY_get_size(3).

                                                                                                                                                                                                                                              • EC_GF2m_simple_method(), EC_GFp_mont_method(), EC_GFp_nist_method(), EC_GFp_nistp224_method(), EC_GFp_nistp256_method(), EC_GFp_nistp521_method(), EC_GFp_simple_method()

                                                                                                                                                                                                                                                There are no replacements for these functions. Applications should rely on the library automatically assigning a suitable method internally when an EC_GROUP is constructed.

                                                                                                                                                                                                                                              • EC_GROUP_clear_free()

                                                                                                                                                                                                                                                Use EC_GROUP_free(3) instead.

                                                                                                                                                                                                                                              • EC_GROUP_get_curve_GF2m(), EC_GROUP_get_curve_GFp(), EC_GROUP_set_curve_GF2m(), EC_GROUP_set_curve_GFp()

                                                                                                                                                                                                                                                Applications should use EC_GROUP_get_curve(3) and EC_GROUP_set_curve(3).

                                                                                                                                                                                                                                              • EC_GROUP_have_precompute_mult(), EC_GROUP_precompute_mult(), EC_KEY_precompute_mult()

                                                                                                                                                                                                                                                These functions are not widely used. Applications should instead switch to named curves which OpenSSL has hardcoded lookup tables for.

                                                                                                                                                                                                                                              • EC_GROUP_new(), EC_GROUP_method_of(), EC_POINT_method_of()

                                                                                                                                                                                                                                                EC_METHOD is now an internal-only concept and a suitable EC_METHOD is assigned internally without application intervention. Users of EC_GROUP_new() should switch to a different suitable constructor.

                                                                                                                                                                                                                                              • EC_KEY_can_sign()

                                                                                                                                                                                                                                                Applications should use EVP_PKEY_can_sign(3) instead.

                                                                                                                                                                                                                                              • EC_KEY_check_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level validation functions\"

                                                                                                                                                                                                                                              • EC_KEY_set_flags(), EC_KEY_get_flags(), EC_KEY_clear_flags()

                                                                                                                                                                                                                                                See \"Common EC parameters\" in EVP_PKEY-EC(7) which handles flags as separate parameters for OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT, OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE, OSSL_PKEY_PARAM_EC_ENCODING, OSSL_PKEY_PARAM_USE_COFACTOR_ECDH and OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC. See also \"EXAMPLES\" in EVP_PKEY-EC(7)

                                                                                                                                                                                                                                              • EC_KEY_dup(), EC_KEY_copy()

                                                                                                                                                                                                                                                There is no direct replacement. Applications may use EVP_PKEY_copy_parameters(3) and EVP_PKEY_dup(3) instead.

                                                                                                                                                                                                                                              • EC_KEY_decoded_from_explicit_params()

                                                                                                                                                                                                                                                There is no replacement.

                                                                                                                                                                                                                                              • EC_KEY_generate_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level key generation functions\".

                                                                                                                                                                                                                                              • EC_KEY_get0_group(), EC_KEY_get0_private_key(), EC_KEY_get0_public_key(), EC_KEY_get_conv_form(), EC_KEY_get_enc_flags()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter getters\".

                                                                                                                                                                                                                                              • EC_KEY_get0_engine(), EC_KEY_get_default_method(), EC_KEY_get_method(), EC_KEY_new_method(), EC_KEY_get_ex_data(), EC_KEY_OpenSSL(), EC_KEY_set_ex_data(), EC_KEY_set_default_method(), EC_KEY_METHOD_*(), EC_KEY_set_method()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                                                                                                                                                              • EC_METHOD_get_field_type()

                                                                                                                                                                                                                                                Use EC_GROUP_get_field_type(3) instead. See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                                                                                                                                                              • EC_KEY_key2buf(), EC_KEY_oct2key(), EC_KEY_oct2priv(), EC_KEY_priv2buf(), EC_KEY_priv2oct()

                                                                                                                                                                                                                                                There are no replacements for these.

                                                                                                                                                                                                                                              • EC_KEY_new(), EC_KEY_new_by_curve_name(), EC_KEY_free(), EC_KEY_up_ref()

                                                                                                                                                                                                                                                See \"Deprecated low-level object creation\"

                                                                                                                                                                                                                                              • EC_KEY_print(), EC_KEY_print_fp()

                                                                                                                                                                                                                                                See \"Deprecated low-level key printing functions\"

                                                                                                                                                                                                                                              • EC_KEY_set_asn1_flag(), EC_KEY_set_conv_form(), EC_KEY_set_enc_flags()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter setters\".

                                                                                                                                                                                                                                              • EC_KEY_set_group(), EC_KEY_set_private_key(), EC_KEY_set_public_key(), EC_KEY_set_public_key_affine_coordinates()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter setters\".

                                                                                                                                                                                                                                              • ECParameters_print(), ECParameters_print_fp(), ECPKParameters_print(), ECPKParameters_print_fp()

                                                                                                                                                                                                                                                See \"Deprecated low-level key printing functions\"

                                                                                                                                                                                                                                              • EC_POINT_bn2point(), EC_POINT_point2bn()

                                                                                                                                                                                                                                                These functions were not particularly useful, since EC point serialization formats are not individual big-endian integers.

                                                                                                                                                                                                                                              • EC_POINT_get_affine_coordinates_GF2m(), EC_POINT_get_affine_coordinates_GFp(), EC_POINT_set_affine_coordinates_GF2m(), EC_POINT_set_affine_coordinates_GFp()

                                                                                                                                                                                                                                                Applications should use EC_POINT_get_affine_coordinates(3) and EC_POINT_set_affine_coordinates(3) instead.

                                                                                                                                                                                                                                              • EC_POINT_get_Jprojective_coordinates_GFp(), EC_POINT_set_Jprojective_coordinates_GFp()

                                                                                                                                                                                                                                                These functions are not widely used. Applications should instead use the EC_POINT_set_affine_coordinates(3) and EC_POINT_get_affine_coordinates(3) functions.

                                                                                                                                                                                                                                              • EC_POINT_make_affine(), EC_POINTs_make_affine()

                                                                                                                                                                                                                                                There is no replacement. These functions were not widely used, and OpenSSL automatically performs this conversion when needed.

                                                                                                                                                                                                                                              • EC_POINT_set_compressed_coordinates_GF2m(), EC_POINT_set_compressed_coordinates_GFp()

                                                                                                                                                                                                                                                Applications should use EC_POINT_set_compressed_coordinates(3) instead.

                                                                                                                                                                                                                                              • EC_POINTs_mul()

                                                                                                                                                                                                                                                This function is not widely used. Applications should instead use the EC_POINT_mul(3) function.

                                                                                                                                                                                                                                              • ENGINE_*()

                                                                                                                                                                                                                                                All engine functions are deprecated. An engine should be rewritten as a provider. See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                                                                                                                                                              • ERR_load_*(), ERR_func_error_string(), ERR_get_error_line(), ERR_get_error_line_data(), ERR_get_state()

                                                                                                                                                                                                                                                OpenSSL now loads error strings automatically so these functions are not needed.

                                                                                                                                                                                                                                              • ERR_peek_error_line_data(), ERR_peek_last_error_line_data()

                                                                                                                                                                                                                                                The new functions are ERR_peek_error_func(3), ERR_peek_last_error_func(3), ERR_peek_error_data(3), ERR_peek_last_error_data(3), ERR_get_error_all(3), ERR_peek_error_all(3) and ERR_peek_last_error_all(3). Applications should use ERR_get_error_all(3), or pick information with ERR_peek functions and finish off with getting the error code by using ERR_get_error(3).

                                                                                                                                                                                                                                              • EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_iv_noconst(), EVP_CIPHER_CTX_original_iv()

                                                                                                                                                                                                                                                Applications should instead use EVP_CIPHER_CTX_get_updated_iv(3), EVP_CIPHER_CTX_get_updated_iv(3) and EVP_CIPHER_CTX_get_original_iv(3) respectively. See EVP_CIPHER_CTX_get_original_iv(3) for further information.

                                                                                                                                                                                                                                              • EVP_CIPHER_meth_*(), EVP_MD_CTX_set_update_fn(), EVP_MD_CTX_update_fn(), EVP_MD_meth_*()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                                                                                                                                                              • EVP_PKEY_CTRL_PKCS7_ENCRYPT(), EVP_PKEY_CTRL_PKCS7_DECRYPT(), EVP_PKEY_CTRL_PKCS7_SIGN(), EVP_PKEY_CTRL_CMS_ENCRYPT(), EVP_PKEY_CTRL_CMS_DECRYPT(), and EVP_PKEY_CTRL_CMS_SIGN()

                                                                                                                                                                                                                                                These control operations are not invoked by the OpenSSL library anymore and are replaced by direct checks of the key operation against the key type when the operation is initialized.

                                                                                                                                                                                                                                              • EVP_PKEY_CTX_get0_dh_kdf_ukm(), EVP_PKEY_CTX_get0_ecdh_kdf_ukm()

                                                                                                                                                                                                                                                See the \"kdf-ukm\" item in \"DH key exchange parameters\" in EVP_KEYEXCH-DH(7) and \"ECDH Key Exchange parameters\" in EVP_KEYEXCH-ECDH(7). These functions are obsolete and should not be required.

                                                                                                                                                                                                                                              • EVP_PKEY_CTX_set_rsa_keygen_pubexp()

                                                                                                                                                                                                                                                Applications should use EVP_PKEY_CTX_set1_rsa_keygen_pubexp(3) instead.

                                                                                                                                                                                                                                              • EVP_PKEY_cmp(), EVP_PKEY_cmp_parameters()

                                                                                                                                                                                                                                                Applications should use EVP_PKEY_eq(3) and EVP_PKEY_parameters_eq(3) instead. See EVP_PKEY_copy_parameters(3) for further details.

                                                                                                                                                                                                                                              • EVP_PKEY_encrypt_old(), EVP_PKEY_decrypt_old(),

                                                                                                                                                                                                                                                Applications should use EVP_PKEY_encrypt_init(3) and EVP_PKEY_encrypt(3) or EVP_PKEY_decrypt_init(3) and EVP_PKEY_decrypt(3) instead.

                                                                                                                                                                                                                                              • EVP_PKEY_get0()

                                                                                                                                                                                                                                                This function returns NULL if the key comes from a provider.

                                                                                                                                                                                                                                              • EVP_PKEY_get0_DH(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_EC_KEY(), EVP_PKEY_get0_RSA(), EVP_PKEY_get1_DH(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_EC_KEY and EVP_PKEY_get1_RSA(), EVP_PKEY_get0_hmac(), EVP_PKEY_get0_poly1305(), EVP_PKEY_get0_siphash()

                                                                                                                                                                                                                                                See \"Functions that return an internal key should be treated as read only\".

                                                                                                                                                                                                                                              • EVP_PKEY_meth_*()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                                                                                                                                                              • EVP_PKEY_new_CMAC_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level MAC functions\".

                                                                                                                                                                                                                                              • EVP_PKEY_assign(), EVP_PKEY_set1_DH(), EVP_PKEY_set1_DSA(), EVP_PKEY_set1_EC_KEY(), EVP_PKEY_set1_RSA()

                                                                                                                                                                                                                                                See \"Deprecated low-level key object getters and setters\"

                                                                                                                                                                                                                                              • EVP_PKEY_set1_tls_encodedpoint() EVP_PKEY_get1_tls_encodedpoint()

                                                                                                                                                                                                                                                These functions were previously used by libssl to set or get an encoded public key into/from an EVP_PKEY object. With OpenSSL 3.0 these are replaced by the more generic functions EVP_PKEY_set1_encoded_public_key(3) and EVP_PKEY_get1_encoded_public_key(3). The old versions have been converted to deprecated macros that just call the new functions.

                                                                                                                                                                                                                                              • EVP_PKEY_set1_engine(), EVP_PKEY_get0_engine()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                                                                                                                                                              • EVP_PKEY_set_alias_type()

                                                                                                                                                                                                                                                This function has been removed. There is no replacement. See \"EVP_PKEY_set_alias_type() method has been removed\"

                                                                                                                                                                                                                                              • HMAC_Init_ex(), HMAC_Update(), HMAC_Final(), HMAC_size()

                                                                                                                                                                                                                                                See \"Deprecated low-level MAC functions\".

                                                                                                                                                                                                                                              • HMAC_CTX_new(), HMAC_CTX_free(), HMAC_CTX_copy(), HMAC_CTX_reset(), HMAC_CTX_set_flags(), HMAC_CTX_get_md()

                                                                                                                                                                                                                                                See \"Deprecated low-level MAC functions\".

                                                                                                                                                                                                                                              • i2d_DHparams(), i2d_DHxparams()

                                                                                                                                                                                                                                                See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                                                                                                                                                              • i2d_DSAparams(), i2d_DSAPrivateKey(), i2d_DSAPrivateKey_bio(), i2d_DSAPrivateKey_fp(), i2d_DSA_PUBKEY(), i2d_DSA_PUBKEY_bio(), i2d_DSA_PUBKEY_fp(), i2d_DSAPublicKey()

                                                                                                                                                                                                                                                See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                                                                                                                                                              • i2d_ECParameters(), i2d_ECPrivateKey(), i2d_ECPrivateKey_bio(), i2d_ECPrivateKey_fp(), i2d_EC_PUBKEY(), i2d_EC_PUBKEY_bio(), i2d_EC_PUBKEY_fp()

                                                                                                                                                                                                                                                See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                                                                                                                                                              • i2o_ECPublicKey()

                                                                                                                                                                                                                                                Use EVP_PKEY_get1_encoded_public_key(3). See \"Deprecated low-level key parameter getters\"

                                                                                                                                                                                                                                              • i2d_RSAPrivateKey(), i2d_RSAPrivateKey_bio(), i2d_RSAPrivateKey_fp(), i2d_RSA_PUBKEY(), i2d_RSA_PUBKEY_bio(), i2d_RSA_PUBKEY_fp(), i2d_RSAPublicKey(), i2d_RSAPublicKey_bio(), i2d_RSAPublicKey_fp()

                                                                                                                                                                                                                                                See \"Deprecated low-level key reading and writing functions\" and \"Migration\" in d2i_RSAPrivateKey(3)

                                                                                                                                                                                                                                              • IDEA_encrypt(), IDEA_set_decrypt_key(), IDEA_set_encrypt_key(), IDEA_cbc_encrypt(), IDEA_cfb64_encrypt(), IDEA_ecb_encrypt(), IDEA_ofb64_encrypt()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". IDEA has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • IDEA_options()

                                                                                                                                                                                                                                                There is no replacement. This function returned a constant string.

                                                                                                                                                                                                                                              • MD2(), MD2_Init(), MD2_Update(), MD2_Final()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". MD2 has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • MD2_options()

                                                                                                                                                                                                                                                There is no replacement. This function returned a constant string.

                                                                                                                                                                                                                                              • MD4(), MD4_Init(), MD4_Update(), MD4_Final(), MD4_Transform()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". MD4 has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • MDC2(), MDC2_Init(), MDC2_Update(), MDC2_Final()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". MDC2 has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • MD5(), MD5_Init(), MD5_Update(), MD5_Final(), MD5_Transform()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\".

                                                                                                                                                                                                                                              • NCONF_WIN32()

                                                                                                                                                                                                                                                This undocumented function has no replacement. See \"HISTORY\" in config(5) for more details.

                                                                                                                                                                                                                                              • OCSP_parse_url()

                                                                                                                                                                                                                                                Use OSSL_HTTP_parse_url(3) instead.

                                                                                                                                                                                                                                              • OCSP_REQ_CTX type and OCSP_REQ_CTX_*() functions

                                                                                                                                                                                                                                                These methods were used to collect all necessary data to form a HTTP request, and to perform the HTTP transfer with that request. With OpenSSL 3.0, the type is OSSL_HTTP_REQ_CTX, and the deprecated functions are replaced with OSSL_HTTP_REQ_CTX_*(). See OSSL_HTTP_REQ_CTX(3) for additional details.

                                                                                                                                                                                                                                              • OPENSSL_fork_child(), OPENSSL_fork_parent(), OPENSSL_fork_prepare()

                                                                                                                                                                                                                                                There is no replacement for these functions. These pthread fork support methods were unused by OpenSSL.

                                                                                                                                                                                                                                              • OSSL_STORE_ctrl(), OSSL_STORE_do_all_loaders(), OSSL_STORE_LOADER_get0_engine(), OSSL_STORE_LOADER_get0_scheme(), OSSL_STORE_LOADER_new(), OSSL_STORE_LOADER_set_attach(), OSSL_STORE_LOADER_set_close(), OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_eof(), OSSL_STORE_LOADER_set_error(), OSSL_STORE_LOADER_set_expect(), OSSL_STORE_LOADER_set_find(), OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_register_loader(), OSSL_STORE_unregister_loader(), OSSL_STORE_vctrl()

                                                                                                                                                                                                                                                These functions helped applications and engines create loaders for schemes they supported. These are all deprecated and discouraged in favour of provider implementations, see provider-storemgmt(7).

                                                                                                                                                                                                                                              • PEM_read_DHparams(), PEM_read_bio_DHparams(), PEM_read_DSAparams(), PEM_read_bio_DSAparams(), PEM_read_DSAPrivateKey(), PEM_read_DSA_PUBKEY(), PEM_read_bio_DSAPrivateKey and PEM_read_bio_DSA_PUBKEY(), PEM_read_ECPKParameters(), PEM_read_ECPrivateKey(), PEM_read_EC_PUBKEY(), PEM_read_bio_ECPKParameters(), PEM_read_bio_ECPrivateKey(), PEM_read_bio_EC_PUBKEY(), PEM_read_RSAPrivateKey(), PEM_read_RSA_PUBKEY(), PEM_read_RSAPublicKey(), PEM_read_bio_RSAPrivateKey(), PEM_read_bio_RSA_PUBKEY(), PEM_read_bio_RSAPublicKey(), PEM_write_bio_DHparams(), PEM_write_bio_DHxparams(), PEM_write_DHparams(), PEM_write_DHxparams(), PEM_write_DSAparams(), PEM_write_DSAPrivateKey(), PEM_write_DSA_PUBKEY(), PEM_write_bio_DSAparams(), PEM_write_bio_DSAPrivateKey(), PEM_write_bio_DSA_PUBKEY(), PEM_write_ECPKParameters(), PEM_write_ECPrivateKey(), PEM_write_EC_PUBKEY(), PEM_write_bio_ECPKParameters(), PEM_write_bio_ECPrivateKey(), PEM_write_bio_EC_PUBKEY(), PEM_write_RSAPrivateKey(), PEM_write_RSA_PUBKEY(), PEM_write_RSAPublicKey(), PEM_write_bio_RSAPrivateKey(), PEM_write_bio_RSA_PUBKEY(), PEM_write_bio_RSAPublicKey(),

                                                                                                                                                                                                                                                See \"Deprecated low-level key reading and writing functions\"

                                                                                                                                                                                                                                              • PKCS1_MGF1()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\".

                                                                                                                                                                                                                                              • RAND_get_rand_method(), RAND_set_rand_method(), RAND_OpenSSL(), RAND_set_rand_engine()

                                                                                                                                                                                                                                                Applications should instead use RAND_set_DRBG_type(3), EVP_RAND(3) and EVP_RAND(7). See RAND_set_rand_method(3) for more details.

                                                                                                                                                                                                                                              • RC2_encrypt(), RC2_decrypt(), RC2_set_key(), RC2_cbc_encrypt(), RC2_cfb64_encrypt(), RC2_ecb_encrypt(), RC2_ofb64_encrypt(), RC4(), RC4_set_key(), RC4_options(), RC5_32_encrypt(), RC5_32_set_key(), RC5_32_decrypt(), RC5_32_cbc_encrypt(), RC5_32_cfb64_encrypt(), RC5_32_ecb_encrypt(), RC5_32_ofb64_encrypt()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". The Algorithms \"RC2\", \"RC4\" and \"RC5\" have been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • RIPEMD160(), RIPEMD160_Init(), RIPEMD160_Update(), RIPEMD160_Final(), RIPEMD160_Transform()

                                                                                                                                                                                                                                                See \"Deprecated low-level digest functions\". The RIPE algorithm has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • RSA_bits(), RSA_security_bits(), RSA_size()

                                                                                                                                                                                                                                                Use EVP_PKEY_get_bits(3), EVP_PKEY_get_security_bits(3) and EVP_PKEY_get_size(3).

                                                                                                                                                                                                                                              • RSA_check_key(), RSA_check_key_ex()

                                                                                                                                                                                                                                                See \"Deprecated low-level validation functions\"

                                                                                                                                                                                                                                              • RSA_clear_flags(), RSA_flags(), RSA_set_flags(), RSA_test_flags(), RSA_setup_blinding(), RSA_blinding_off(), RSA_blinding_on()

                                                                                                                                                                                                                                                All of these RSA flags have been deprecated without replacement:

                                                                                                                                                                                                                                                RSA_FLAG_BLINDING, RSA_FLAG_CACHE_PRIVATE, RSA_FLAG_CACHE_PUBLIC, RSA_FLAG_EXT_PKEY, RSA_FLAG_NO_BLINDING, RSA_FLAG_THREAD_SAFE RSA_METHOD_FLAG_NO_CHECK

                                                                                                                                                                                                                                              • RSA_generate_key_ex(), RSA_generate_multi_prime_key()

                                                                                                                                                                                                                                                See \"Deprecated low-level key generation functions\".

                                                                                                                                                                                                                                              • RSA_get0_engine()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                                                                                                                                                              • RSA_get0_crt_params(), RSA_get0_d(), RSA_get0_dmp1(), RSA_get0_dmq1(), RSA_get0_e(), RSA_get0_factors(), RSA_get0_iqmp(), RSA_get0_key(), RSA_get0_multi_prime_crt_params(), RSA_get0_multi_prime_factors(), RSA_get0_n(), RSA_get0_p(), RSA_get0_pss_params(), RSA_get0_q(), RSA_get_multi_prime_extra_count()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter getters\"

                                                                                                                                                                                                                                              • RSA_new(), RSA_free(), RSA_up_ref()

                                                                                                                                                                                                                                                See \"Deprecated low-level object creation\".

                                                                                                                                                                                                                                              • RSA_get_default_method(), RSA_get_ex_data and RSA_get_method()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                                                                                                                                                              • RSA_get_version()

                                                                                                                                                                                                                                                There is no replacement.

                                                                                                                                                                                                                                              • RSA_meth_*(), RSA_new_method(), RSA_null_method and RSA_PKCS1_OpenSSL()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\".

                                                                                                                                                                                                                                              • RSA_padding_add_*(), RSA_padding_check_*()

                                                                                                                                                                                                                                                See \"Deprecated low-level signing functions\" and \"Deprecated low-level encryption functions\".

                                                                                                                                                                                                                                              • RSA_print(), RSA_print_fp()

                                                                                                                                                                                                                                                See \"Deprecated low-level key printing functions\"

                                                                                                                                                                                                                                              • RSA_public_encrypt(), RSA_private_decrypt()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\"

                                                                                                                                                                                                                                              • RSA_private_encrypt(), RSA_public_decrypt()

                                                                                                                                                                                                                                                This is equivalent to doing sign and verify recover operations (with a padding mode of none). See \"Deprecated low-level signing functions\".

                                                                                                                                                                                                                                              • RSAPrivateKey_dup(), RSAPublicKey_dup()

                                                                                                                                                                                                                                                There is no direct replacement. Applications may use EVP_PKEY_dup(3).

                                                                                                                                                                                                                                              • RSAPublicKey_it(), RSAPrivateKey_it()

                                                                                                                                                                                                                                                See \"Deprecated low-level key reading and writing functions\"

                                                                                                                                                                                                                                              • RSA_set0_crt_params(), RSA_set0_factors(), RSA_set0_key(), RSA_set0_multi_prime_params()

                                                                                                                                                                                                                                                See \"Deprecated low-level key parameter setters\".

                                                                                                                                                                                                                                              • RSA_set_default_method(), RSA_set_method(), RSA_set_ex_data()

                                                                                                                                                                                                                                                See \"Providers are a replacement for engines and low-level method overrides\"

                                                                                                                                                                                                                                              • RSA_sign(), RSA_sign_ASN1_OCTET_STRING(), RSA_verify(), RSA_verify_ASN1_OCTET_STRING(), RSA_verify_PKCS1_PSS(), RSA_verify_PKCS1_PSS_mgf1()

                                                                                                                                                                                                                                                See \"Deprecated low-level signing functions\".

                                                                                                                                                                                                                                              • RSA_X931_derive_ex(), RSA_X931_generate_key_ex(), RSA_X931_hash_id()

                                                                                                                                                                                                                                                There are no replacements for these functions. X931 padding can be set using \"Signature Parameters\" in EVP_SIGNATURE-RSA(7). See OSSL_SIGNATURE_PARAM_PAD_MODE.

                                                                                                                                                                                                                                              • SEED_encrypt(), SEED_decrypt(), SEED_set_key(), SEED_cbc_encrypt(), SEED_cfb128_encrypt(), SEED_ecb_encrypt(), SEED_ofb128_encrypt()

                                                                                                                                                                                                                                                See \"Deprecated low-level encryption functions\". The SEED algorithm has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • SHA1_Init(), SHA1_Update(), SHA1_Final(), SHA1_Transform(), SHA224_Init(), SHA224_Update(), SHA224_Final(), SHA256_Init(), SHA256_Update(), SHA256_Final(), SHA256_Transform(), SHA384_Init(), SHA384_Update(), SHA384_Final(), SHA512_Init(), SHA512_Update(), SHA512_Final(), SHA512_Transform()

                                                                                                                                                                                                                                                See \"Deprecated low-level digest functions\".

                                                                                                                                                                                                                                              • SRP_Calc_A(), SRP_Calc_B(), SRP_Calc_client_key(), SRP_Calc_server_key(), SRP_Calc_u(), SRP_Calc_x(), SRP_check_known_gN_param(), SRP_create_verifier(), SRP_create_verifier_BN(), SRP_get_default_gN(), SRP_user_pwd_free(), SRP_user_pwd_new(), SRP_user_pwd_set0_sv(), SRP_user_pwd_set1_ids(), SRP_user_pwd_set_gN(), SRP_VBASE_add0_user(), SRP_VBASE_free(), SRP_VBASE_get1_by_user(), SRP_VBASE_init(), SRP_VBASE_new(), SRP_Verify_A_mod_N(), SRP_Verify_B_mod_N()

                                                                                                                                                                                                                                                There are no replacements for the SRP functions.

                                                                                                                                                                                                                                              • SSL_CTX_set_tmp_dh_callback(), SSL_set_tmp_dh_callback(), SSL_CTX_set_tmp_dh(), SSL_set_tmp_dh()

                                                                                                                                                                                                                                                These are used to set the Diffie-Hellman (DH) parameters that are to be used by servers requiring ephemeral DH keys. Instead applications should consider using the built-in DH parameters that are available by calling SSL_CTX_set_dh_auto(3) or SSL_set_dh_auto(3). If custom parameters are necessary then applications can use the alternative functions SSL_CTX_set0_tmp_dh_pkey(3) and SSL_set0_tmp_dh_pkey(3). There is no direct replacement for the \"callback\" functions. The callback was originally useful in order to have different parameters for export and non-export ciphersuites. Export ciphersuites are no longer supported by OpenSSL. Use of the callback functions should be replaced by one of the other methods described above.

                                                                                                                                                                                                                                              • SSL_CTX_set_tlsext_ticket_key_cb()

                                                                                                                                                                                                                                                Use the new SSL_CTX_set_tlsext_ticket_key_evp_cb(3) function instead.

                                                                                                                                                                                                                                              • WHIRLPOOL(), WHIRLPOOL_Init(), WHIRLPOOL_Update(), WHIRLPOOL_Final(), WHIRLPOOL_BitUpdate()

                                                                                                                                                                                                                                                See \"Deprecated low-level digest functions\". The Whirlpool algorithm has been moved to the Legacy Provider.

                                                                                                                                                                                                                                              • X509_certificate_type()

                                                                                                                                                                                                                                                This was an undocumented function. Applications can use X509_get0_pubkey(3) and X509_get0_signature(3) instead.

                                                                                                                                                                                                                                              • X509_http_nbio(), X509_CRL_http_nbio()

                                                                                                                                                                                                                                                Use X509_load_http(3) and X509_CRL_load_http(3) instead.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#nid-handling-for-provided-keys-and-algorithms","title":"NID handling for provided keys and algorithms","text":"

                                                                                                                                                                                                                                              The following functions for NID (numeric id) handling have changed semantics.

                                                                                                                                                                                                                                              • EVP_PKEY_id(), EVP_PKEY_get_id()

                                                                                                                                                                                                                                                This function was previously used to reliably return the NID of an EVP_PKEY object, e.g., to look up the name of the algorithm of such EVP_PKEY by calling OBJ_nid2sn(3). With the introduction of provider(7)s EVP_PKEY_id() or its new equivalent EVP_PKEY_get_id(3) might now also return the value -1 (EVP_PKEY_KEYMGMT) indicating the use of a provider to implement the EVP_PKEY object. Therefore, the use of EVP_PKEY_get0_type_name(3) is recommended for retrieving the name of the EVP_PKEY algorithm.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#using-the-fips-module-in-applications","title":"Using the FIPS Module in applications","text":"

                                                                                                                                                                                                                                              See fips_module(7) and OSSL_PROVIDER-FIPS(7) for details.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#openssl-command-line-application-changes","title":"OpenSSL command line application changes","text":""},{"location":"man7/migration_guide/#new-applications","title":"New applications","text":"

                                                                                                                                                                                                                                              openssl kdf uses the new EVP_KDF(3) API. openssl kdf uses the new EVP_MAC(3) API.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#added-options","title":"Added options","text":"

                                                                                                                                                                                                                                              -provider_path and -provider are available to all apps and can be used multiple times to load any providers, such as the 'legacy' provider or third party providers. If used then the 'default' provider would also need to be specified if required. The -provider_path must be specified before the -provider option.

                                                                                                                                                                                                                                              The list app has many new options. See openssl-list(1) for more information.

                                                                                                                                                                                                                                              -crl_lastupdate and -crl_nextupdate used by openssl ca allows explicit setting of fields in the generated CRL.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#removed-options","title":"Removed options","text":"

                                                                                                                                                                                                                                              Interactive mode is not longer available.

                                                                                                                                                                                                                                              The -crypt option used by openssl passwd. The -c option used by openssl x509, openssl dhparam, openssl dsaparam, and openssl ecparam.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#other-changes","title":"Other Changes","text":"

                                                                                                                                                                                                                                              The output of Command line applications may have minor changes. These are primarily changes in capitalisation and white space. However, in some cases, there are additional differences. For example, the DH parameters output from openssl dhparam now lists 'P', 'Q', 'G' and 'pcounter' instead of 'prime', 'generator', 'subgroup order' and 'counter' respectively.

                                                                                                                                                                                                                                              The openssl commands that read keys, certificates, and CRLs now automatically detect the PEM or DER format of the input files so it is not necessary to explicitly specify the input format anymore. However if the input format option is used the specified format will be required.

                                                                                                                                                                                                                                              openssl speed no longer uses low-level API calls. This implies some of the performance numbers might not be comparable with the previous releases due to higher overhead. This applies particularly to measuring performance on smaller data chunks.

                                                                                                                                                                                                                                              b<openssl dhparam>, openssl dsa, openssl gendsa, openssl dsaparam, openssl genrsa and openssl rsa have been modified to use PKEY APIs. openssl genrsa and openssl rsa now write PKCS #8 keys by default.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#default-settings","title":"Default settings","text":"

                                                                                                                                                                                                                                              \"SHA256\" is now the default digest for TS query used by openssl ts.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#deprecated-apps","title":"Deprecated apps","text":"

                                                                                                                                                                                                                                              openssl rsautl is deprecated, use openssl pkeyutl instead. openssl dhparam, openssl dsa, openssl gendsa, openssl dsaparam, openssl genrsa, openssl rsa, openssl genrsa and openssl rsa are now in maintenance mode and no new features will be added to them.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#tls-changes","title":"TLS Changes","text":"
                                                                                                                                                                                                                                              • TLS 1.3 FFDHE key exchange support added

                                                                                                                                                                                                                                                This uses DH safe prime named groups.

                                                                                                                                                                                                                                              • Support for fully \"pluggable\" TLSv1.3 groups.

                                                                                                                                                                                                                                                This means that providers may supply their own group implementations (using either the \"key exchange\" or the \"key encapsulation\" methods) which will automatically be detected and used by libssl.

                                                                                                                                                                                                                                              • SSL and SSL_CTX options are now 64 bit instead of 32 bit.

                                                                                                                                                                                                                                                The signatures of the functions to get and set options on SSL and SSL_CTX objects changed from \"unsigned long\" to \"uint64_t\" type.

                                                                                                                                                                                                                                                This may require source code changes. For example it is no longer possible to use the SSL_OP_ macro values in preprocessor #if conditions. However it is still possible to test whether these macros are defined or not.

                                                                                                                                                                                                                                                See SSL_CTX_get_options(3), SSL_CTX_set_options(3), SSL_get_options(3) and SSL_set_options(3).

                                                                                                                                                                                                                                              • SSL_set1_host() and SSL_add1_host() Changes

                                                                                                                                                                                                                                                These functions now take IP literal addresses as well as actual hostnames.

                                                                                                                                                                                                                                              • Added SSL option SSL_OP_CLEANSE_PLAINTEXT

                                                                                                                                                                                                                                                If the option is set, openssl cleanses (zeroizes) plaintext bytes from internal buffers after delivering them to the application. Note, the application is still responsible for cleansing other copies (e.g.: data received by SSL_read(3)).

                                                                                                                                                                                                                                              • Client-initiated renegotiation is disabled by default.

                                                                                                                                                                                                                                                To allow it, use the -client_renegotiation option, the SSL_OP_ALLOW_CLIENT_RENEGOTIATION flag, or the ClientRenegotiation config parameter as appropriate.

                                                                                                                                                                                                                                              • Secure renegotiation is now required by default for TLS connections

                                                                                                                                                                                                                                                Support for RFC 5746 secure renegotiation is now required by default for SSL or TLS connections to succeed. Applications that require the ability to connect to legacy peers will need to explicitly set SSL_OP_LEGACY_SERVER_CONNECT. Accordingly, SSL_OP_LEGACY_SERVER_CONNECT is no longer set as part of SSL_OP_ALL.

                                                                                                                                                                                                                                              • Combining the Configure options no-ec and no-dh no longer disables TLSv1.3

                                                                                                                                                                                                                                                Typically if OpenSSL has no EC or DH algorithms then it cannot support connections with TLSv1.3. However OpenSSL now supports \"pluggable\" groups through providers. Therefore third party providers may supply group implementations even where there are no built-in ones. Attempting to create TLS connections in such a build without also disabling TLSv1.3 at run time or using third party provider groups may result in handshake failures. TLSv1.3 can be disabled at compile time using the \"no-tls1_3\" Configure option.

                                                                                                                                                                                                                                              • SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() changes.

                                                                                                                                                                                                                                                The methods now ignore unknown ciphers.

                                                                                                                                                                                                                                              • Security callback change.

                                                                                                                                                                                                                                                The security callback, which can be customised by application code, supports the security operation SSL_SECOP_TMP_DH. This is defined to take an EVP_PKEY in the \"other\" parameter. In most places this is what is passed. All these places occur server side. However there was one client side call of this security operation and it passed a DH object instead. This is incorrect according to the definition of SSL_SECOP_TMP_DH, and is inconsistent with all of the other locations. Therefore this client side call has been changed to pass an EVP_PKEY instead.

                                                                                                                                                                                                                                              • New SSL option SSL_OP_IGNORE_UNEXPECTED_EOF

                                                                                                                                                                                                                                                The SSL option SSL_OP_IGNORE_UNEXPECTED_EOF is introduced. If that option is set, an unexpected EOF is ignored, it pretends a close notify was received instead and so the returned error becomes SSL_ERROR_ZERO_RETURN.

                                                                                                                                                                                                                                              • The security strength of SHA1 and MD5 based signatures in TLS has been reduced.

                                                                                                                                                                                                                                                This results in SSL 3, TLS 1.0, TLS 1.1 and DTLS 1.0 no longer working at the default security level of 1 and instead requires security level 0. The security level can be changed either using the cipher string with @SECLEVEL, or calling SSL_CTX_set_security_level(3). This also means that where the signature algorithms extension is missing from a ClientHello then the handshake will fail in TLS 1.2 at security level 1. This is because, although this extension is optional, failing to provide one means that OpenSSL will fallback to a default set of signature algorithms. This default set requires the availability of SHA1.

                                                                                                                                                                                                                                              • X509 certificates signed using SHA1 are no longer allowed at security level 1 and above.

                                                                                                                                                                                                                                                In TLS/SSL the default security level is 1. It can be set either using the cipher string with @SECLEVEL, or calling SSL_CTX_set_security_level(3). If the leaf certificate is signed with SHA-1, a call to SSL_CTX_use_certificate(3) will fail if the security level is not lowered first. Outside TLS/SSL, the default security level is -1 (effectively 0). It can be set using X509_VERIFY_PARAM_set_auth_level(3) or using the -auth_level options of the commands.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              fips_module(7)

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The migration guide was created for OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/migration_guide/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core.h/","title":"openssl-core.h","text":""},{"location":"man7/openssl-core.h/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              openssl/core.h - OpenSSL Core types

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core.h/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                              #include <openssl/core.h>\n
                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core.h/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The <openssl/core.h> header defines a number of public types that are used to communicate between the OpenSSL libraries and implementation providers. These types are designed to minimise the need for intimate knowledge of internal structures between the OpenSSL libraries and the providers.

                                                                                                                                                                                                                                              The types are:

                                                                                                                                                                                                                                              • OSSL_DISPATCH(3)
                                                                                                                                                                                                                                              • OSSL_ITEM(3)
                                                                                                                                                                                                                                              • OSSL_ALGORITHM(3)
                                                                                                                                                                                                                                              • OSSL_PARAM(3)
                                                                                                                                                                                                                                              • OSSL_CALLBACK(3)
                                                                                                                                                                                                                                              • OSSL_PASSPHRASE_CALLBACK(3)
                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core.h/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              openssl-core_dispatch.h(7)

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core.h/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The types described here were added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core.h/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_dispatch.h/","title":"openssl-core_dispatch.h","text":""},{"location":"man7/openssl-core_dispatch.h/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              openssl/core_dispatch.h - OpenSSL provider dispatch numbers and function types

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_dispatch.h/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                              #include <openssl/core_dispatch.h>\n
                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_dispatch.h/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The <openssl/core_dispatch.h> header defines all the operation numbers, dispatch numbers and provider interface function types currently available.

                                                                                                                                                                                                                                              The operation and dispatch numbers are represented with macros, which are named as follows:

                                                                                                                                                                                                                                              • operation numbers

                                                                                                                                                                                                                                                These macros have the form OSSL_OP__opname_.

                                                                                                                                                                                                                                              • dipatch numbers

                                                                                                                                                                                                                                                These macros have the form OSSL_FUNC__opname___funcname_, where _opname_ is the same as in the macro for the operation this function belongs to.

                                                                                                                                                                                                                                              With every dispatch number, there is an associated function type.

                                                                                                                                                                                                                                              For further information, please see the provider(7)

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_dispatch.h/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              provider(7)

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_dispatch.h/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The types and macros described here were added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_dispatch.h/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_names.h/","title":"openssl-core_names.h","text":""},{"location":"man7/openssl-core_names.h/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              openssl/core_names.h - OpenSSL provider parameter names

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_names.h/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                              #include <openssl/core_names.h>\n
                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_names.h/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The <openssl/core_names.h> header defines a multitude of macros for OSSL_PARAM(3) names, algorithm names and other known names used with OpenSSL's providers, made available for practical purposes only.

                                                                                                                                                                                                                                              Existing names are further described in the manuals for OpenSSL's providers (see \"SEE ALSO\") and the manuals for each algorithm they provide (listed in those provider manuals).

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_names.h/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              OSSL_PROVIDER-default(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-legacy(7)

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_names.h/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              The macros described here were added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_names.h/#caveats","title":"CAVEATS","text":"

                                                                                                                                                                                                                                              This header file does not constitute a general registry of names. Providers that implement new algorithms are to be responsible for their own parameter names.

                                                                                                                                                                                                                                              However, authors of provider that implement their own variants of algorithms that OpenSSL providers support will want to pay attention to the names provided in this header to work in a compatible manner.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-core_names.h/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-env/","title":"openssl-env","text":""},{"location":"man7/openssl-env/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              openssl-env - OpenSSL environment variables

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-env/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              The OpenSSL libraries use environment variables to override the compiled-in default paths for various data. To avoid security risks, the environment is usually not consulted when the executable is set-user-ID or set-group-ID.

                                                                                                                                                                                                                                              • CTLOG_FILE

                                                                                                                                                                                                                                                Specifies the path to a certificate transparency log list. See CTLOG_STORE_new(3).

                                                                                                                                                                                                                                              • OPENSSL

                                                                                                                                                                                                                                                Specifies the path to the openssl executable. Used by the rehash script (see \"Script Configuration\" in openssl-rehash(1)) and by the CA.pl script (see \"NOTES\" in CA.pl(1)

                                                                                                                                                                                                                                              • OPENSSL_CONF, OPENSSL_CONF_INCLUDE

                                                                                                                                                                                                                                                Specifies the path to a configuration file and the directory for included files. See config(5).

                                                                                                                                                                                                                                              • OPENSSL_CONFIG

                                                                                                                                                                                                                                                Specifies a configuration option and filename for the req and ca commands invoked by the CA.pl script. See CA.pl(1).

                                                                                                                                                                                                                                              • OPENSSL_ENGINES

                                                                                                                                                                                                                                                Specifies the directory from which dynamic engines are loaded. See openssl-engine(1).

                                                                                                                                                                                                                                              • OPENSSL_MALLOC_FD, OPENSSL_MALLOC_FAILURES

                                                                                                                                                                                                                                                If built with debugging, this allows memory allocation to fail. See OPENSSL_malloc(3).

                                                                                                                                                                                                                                              • OPENSSL_MODULES

                                                                                                                                                                                                                                                Specifies the directory from which cryptographic providers are loaded. Equivalently, the generic -provider-path command-line option may be used.

                                                                                                                                                                                                                                              • OPENSSL_WIN32_UTF8

                                                                                                                                                                                                                                                If set, then UI_OpenSSL(3) returns UTF-8 encoded strings, rather than ones encoded in the current code page, and the openssl(1) program also transcodes the command-line parameters from the current code page to UTF-8. This environment variable is only checked on Microsoft Windows platforms.

                                                                                                                                                                                                                                              • RANDFILE

                                                                                                                                                                                                                                                The state file for the random number generator. This should not be needed in normal use. See RAND_load_file(3).

                                                                                                                                                                                                                                              • SSL_CERT_DIR, SSL_CERT_FILE

                                                                                                                                                                                                                                                Specify the default directory or file containing CA certificates. See SSL_CTX_load_verify_locations(3).

                                                                                                                                                                                                                                              • TSGET

                                                                                                                                                                                                                                                Additional arguments for the tsget(1) command.

                                                                                                                                                                                                                                              • OPENSSL_ia32cap, OPENSSL_sparcv9cap, OPENSSL_ppccap, OPENSSL_armcap, OPENSSL_s390xcap, OPENSSL_riscvcap

                                                                                                                                                                                                                                                OpenSSL supports a number of different algorithm implementations for various machines and, by default, it determines which to use based on the processor capabilities and run time feature enquiry. These environment variables can be used to exert more control over this selection process. See OPENSSL_ia32cap(3), OPENSSL_s390xcap(3).

                                                                                                                                                                                                                                              • NO_PROXY, HTTPS_PROXY, HTTP_PROXY

                                                                                                                                                                                                                                                Specify a proxy hostname. See OSSL_HTTP_parse_url(3).

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-env/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-glossary/","title":"openssl-glossary","text":""},{"location":"man7/openssl-glossary/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              openssl-glossary - An OpenSSL Glossary

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-glossary/#description","title":"DESCRIPTION","text":"
                                                                                                                                                                                                                                              • Algorithm

                                                                                                                                                                                                                                                Cryptographic primitives such as the SHA256 digest, or AES encryption are referred to in OpenSSL as \"algorithms\". There can be more than one implementation for any given algorithm available for use.

                                                                                                                                                                                                                                                crypto(7)

                                                                                                                                                                                                                                              • ASN.1, ASN1

                                                                                                                                                                                                                                                ASN.1 (\"Abstract Syntax Notation One\") is a notation for describing abstract types and values. It is defined in the ITU-T documents X.680 to X.683:

                                                                                                                                                                                                                                                https://www.itu.int/rec/T-REC-X.680, https://www.itu.int/rec/T-REC-X.681, https://www.itu.int/rec/T-REC-X.682, https://www.itu.int/rec/T-REC-X.683

                                                                                                                                                                                                                                              • Base Provider

                                                                                                                                                                                                                                                An OpenSSL Provider that contains encoders and decoders for OpenSSL keys. All the algorithm implementations in the Base Provider are also available in the Default Provider.

                                                                                                                                                                                                                                                OSSL_PROVIDER-base(7)

                                                                                                                                                                                                                                              • Decoder

                                                                                                                                                                                                                                                A decoder is a type of algorithm used for decoding keys and parameters from some external format such as PEM or DER.

                                                                                                                                                                                                                                                OSSL_DECODER_CTX_new_for_pkey(3)

                                                                                                                                                                                                                                              • Default Provider

                                                                                                                                                                                                                                                An OpenSSL Provider that contains the most common OpenSSL algorithm implementations. It is loaded by default if no other provider is available. All the algorithm implementations in the Base Provider are also available in the Default Provider.

                                                                                                                                                                                                                                                OSSL_PROVIDER-default(7)

                                                                                                                                                                                                                                              • DER (\"Distinguished Encoding Rules\")

                                                                                                                                                                                                                                                DER is a binary encoding of data, structured according to an ASN.1 specification. This is a common encoding used for cryptographic objects such as private and public keys, certificates, CRLs, ...

                                                                                                                                                                                                                                                It is defined in ITU-T document X.690:

                                                                                                                                                                                                                                                https://www.itu.int/rec/T-REC-X.690

                                                                                                                                                                                                                                              • Encoder

                                                                                                                                                                                                                                                An encoder is a type of algorithm used for encoding keys and parameters to some external format such as PEM or DER.

                                                                                                                                                                                                                                                OSSL_ENCODER_CTX_new_for_pkey(3)

                                                                                                                                                                                                                                              • Explicit Fetching

                                                                                                                                                                                                                                                Explicit Fetching is a type of Fetching (see Fetching). Explicit Fetching is where a function call is made to obtain an algorithm object representing an implementation such as EVP_MD_fetch(3) or EVP_CIPHER_fetch(3)

                                                                                                                                                                                                                                              • Fetching

                                                                                                                                                                                                                                                Fetching is the process of looking through the available algorithm implementations, applying selection criteria (via a property query string), and finally choosing the implementation that will be used.

                                                                                                                                                                                                                                                Also see Explicit Fetching and Implicit Fetching.

                                                                                                                                                                                                                                                crypto(7)

                                                                                                                                                                                                                                              • FIPS Provider

                                                                                                                                                                                                                                                An OpenSSL Provider that contains OpenSSL algorithm implementations that have been validated according to the FIPS 140-2 standard.

                                                                                                                                                                                                                                                OSSL_PROVIDER-FIPS(7)

                                                                                                                                                                                                                                              • Implicit Fetching

                                                                                                                                                                                                                                                Implicit Fetching is a type of Fetching (see Fetching). Implicit Fetching is where an algorithm object with no associated implementation is used such as the return value from EVP_sha256(3) or EVP_aes_128_cbc(3). With implicit fetching an implementation is fetched automatically using default selection criteria the first time the algorithm is used.

                                                                                                                                                                                                                                              • Legacy Provider

                                                                                                                                                                                                                                                An OpenSSL Provider that contains algorithm implementations that are considered insecure or are no longer in common use.

                                                                                                                                                                                                                                                OSSL_PROVIDER-legacy(7)

                                                                                                                                                                                                                                              • Library Context

                                                                                                                                                                                                                                                A Library Context in OpenSSL is represented by the type OSSL_LIB_CTX. It can be thought of as a scope within which configuration options apply. If an application does not explicitly create a library context then the \"default\" one is used. Many OpenSSL functions can take a library context as an argument. A NULL value can always be passed to indicate the default library context.

                                                                                                                                                                                                                                                OSSL_LIB_CTX(3)

                                                                                                                                                                                                                                              • MSBLOB

                                                                                                                                                                                                                                                MSBLOB is a Microsoft specific binary format for RSA and DSA keys, both private and public. This form is never passphrase protected.

                                                                                                                                                                                                                                              • Null Provider

                                                                                                                                                                                                                                                An OpenSSL Provider that contains no algorithm implementations. This can be useful to prevent the default provider from being automatically loaded in a library context.

                                                                                                                                                                                                                                                OSSL_PROVIDER-null(7)

                                                                                                                                                                                                                                              • Operation

                                                                                                                                                                                                                                                An operation is a group of OpenSSL functions with a common purpose such as encryption, or digesting.

                                                                                                                                                                                                                                                crypto(7)

                                                                                                                                                                                                                                              • PEM (\"Privacy Enhanced Message\")

                                                                                                                                                                                                                                                PEM is a format used for encoding of binary content into a mail and ASCII friendly form. The content is a series of base64-encoded lines, surrounded by begin/end markers each on their own line. For example:

                                                                                                                                                                                                                                                -----BEGIN PRIVATE KEY-----\nMIICdg....\n... bhTQ==\n-----END PRIVATE KEY-----\n

                                                                                                                                                                                                                                                Optional header line(s) may appear after the begin line, and their existence depends on the type of object being written or read.

                                                                                                                                                                                                                                                For all OpenSSL uses, the binary content is expected to be a DER encoded structure.

                                                                                                                                                                                                                                                This is defined in IETF RFC 1421:

                                                                                                                                                                                                                                                https://tools.ietf.org/html/rfc1421

                                                                                                                                                                                                                                              • PKCS#8

                                                                                                                                                                                                                                                PKCS#8 is a specification of ASN.1 structures that OpenSSL uses for storing or transmitting any private key in a key type agnostic manner. There are two structures worth noting for OpenSSL use, one that contains the key data in unencrypted form (known as \"PrivateKeyInfo\") and an encrypted wrapper structure (known as \"EncryptedPrivateKeyInfo\").

                                                                                                                                                                                                                                                This is specified in RFC 5208:

                                                                                                                                                                                                                                                https://tools.ietf.org/html/rfc5208

                                                                                                                                                                                                                                              • Property

                                                                                                                                                                                                                                                A property is a way of classifying and selecting algorithm implementations. A property is a key/value pair expressed as a string. For example all algorithm implementations in the default provider have the property \"provider=default\". An algorithm implementation can have multiple properties defined against it.

                                                                                                                                                                                                                                                Also see Property Query String.

                                                                                                                                                                                                                                                property(7)

                                                                                                                                                                                                                                              • Property Query String

                                                                                                                                                                                                                                                A property query string is a string containing a sequence of properties that can be used to select an algorithm implementation. For example the query string \"provider=example,foo=bar\" will select algorithms from the \"example\" provider that have a \"foo\" property defined for them with a value of \"bar\".

                                                                                                                                                                                                                                                Property Query Strings are used during fetching. See Fetching.

                                                                                                                                                                                                                                                property(7)

                                                                                                                                                                                                                                              • Provider

                                                                                                                                                                                                                                                A provider in OpenSSL is a component that groups together algorithm implementations. Providers can come from OpenSSL itself or from third parties.

                                                                                                                                                                                                                                                provider(7)

                                                                                                                                                                                                                                              • PVK

                                                                                                                                                                                                                                                PVK is a Microsoft specific binary format for RSA and DSA private keys. This form may be passphrase protected.

                                                                                                                                                                                                                                              • SubjectPublicKeyInfo

                                                                                                                                                                                                                                                SubjectPublicKeyInfo is an ASN.1 structure that OpenSSL uses for storing and transmitting any public key in a key type agnostic manner.

                                                                                                                                                                                                                                                This is specified as part of the specification for certificates, RFC 5280:

                                                                                                                                                                                                                                                https://tools.ietf.org/html/rfc5280

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-glossary/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              This glossary was added in OpenSSL 3.0.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-glossary/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-threads/","title":"openssl-threads","text":""},{"location":"man7/openssl-threads/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              openssl-threads - Overview of thread safety in OpenSSL

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-threads/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              In this man page, we use the term thread-safe to indicate that an object or function can be used by multiple threads at the same time.

                                                                                                                                                                                                                                              OpenSSL can be built with or without threads support. The most important use of this support is so that OpenSSL itself can use a single consistent API, as shown in \"EXAMPLES\" in CRYPTO_THREAD_run_once(3). Multi-platform applications can also use this API.

                                                                                                                                                                                                                                              In particular, being configured for threads support does not imply that all OpenSSL objects are thread-safe. To emphasize: most objects are not safe for simultaneous use. Exceptions to this should be documented on the specific manual pages, and some general high-level guidance is given here.

                                                                                                                                                                                                                                              One major use of the OpenSSL thread API is to implement reference counting. Many objects within OpenSSL are reference-counted, so resources are not released, until the last reference is removed. References are often increased automatically (such as when an X509 certificate object is added into an X509_STORE trust store). There is often an object_up_ref() function that can be used to increase the reference count. Failure to match object_up_ref() calls with the right number of object_free() calls is a common source of memory leaks when a program exits.

                                                                                                                                                                                                                                              Many objects have set and get API's to set attributes in the object. A set0 passes ownership from the caller to the object and a get0 returns a pointer but the attribute ownership remains with the object and a reference to it is returned. A set1 or get1 function does not change the ownership, but instead updates the attribute's reference count so that the object is shared between the caller and the object; the caller must free the returned attribute when finished. Functions that involve attributes that have reference counts themselves, but are named with just set or get are historical; and the documentation must state how the references are handled. Get methods are often thread-safe as long as the ownership requirements are met and shared objects are not modified. Set methods, or modifying shared objects, are generally not thread-safe as discussed below.

                                                                                                                                                                                                                                              Objects are thread-safe as long as the API's being invoked don't modify the object; in this case the parameter is usually marked in the API as const. Not all parameters are marked this way. Note that a const declaration does not mean immutable; for example X509_cmp(3) takes pointers to const objects, but the implementation uses a C cast to remove that so it can lock objects, generate and cache a DER encoding, and so on.

                                                                                                                                                                                                                                              Another instance of thread-safety is when updates to an object's internal state, such as cached values, are done with locks. One example of this is the reference counting API's described above.

                                                                                                                                                                                                                                              In all cases, however, it is generally not safe for one thread to mutate an object, such as setting elements of a private or public key, while another thread is using that object, such as verifying a signature.

                                                                                                                                                                                                                                              The same API's can usually be used simultaneously on different objects without interference. For example, two threads can calculate a signature using two different EVP_PKEY_CTX objects.

                                                                                                                                                                                                                                              For implicit global state or singletons, thread-safety depends on the facility. The CRYPTO_secure_malloc(3) and related API's have their own lock, while CRYPTO_malloc(3) assumes the underlying platform allocation will do any necessary locking. Some API's, such as NCONF_load(3) and related do no locking at all; this can be considered a bug.

                                                                                                                                                                                                                                              A separate, although related, issue is modifying \"factory\" objects when other objects have been created from that. For example, an SSL_CTX object created by SSL_CTX_new(3) is used to create per-connection SSL objects by calling SSL_new(3). In this specific case, and probably for factory methods in general, it is not safe to modify the factory object after it has been used to create other objects.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-threads/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              CRYPTO_THREAD_run_once(3), local system threads documentation.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-threads/#bugs","title":"BUGS","text":"

                                                                                                                                                                                                                                              This page is admittedly very incomplete.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl-threads/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2021-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl_user_macros/","title":"openssl_user_macros","text":""},{"location":"man7/openssl_user_macros/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              openssl_user_macros, OPENSSL_API_COMPAT, OPENSSL_NO_DEPRECATED - User defined macros

                                                                                                                                                                                                                                              "},{"location":"man7/openssl_user_macros/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              User defined macros allow the programmer to control certain aspects of what is exposed by the OpenSSL headers.

                                                                                                                                                                                                                                              NOTE: to be effective, a user defined macro must be defined before including any header file that depends on it, either in the compilation command (cc -DMACRO=value) or by defining the macro in source before including any headers.

                                                                                                                                                                                                                                              Other manual pages may refer to this page when declarations depend on user defined macros.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl_user_macros/#the-macros","title":"The macros","text":"
                                                                                                                                                                                                                                              • OPENSSL_API_COMPAT

                                                                                                                                                                                                                                                The value is a version number, given in one of the following two forms:

                                                                                                                                                                                                                                                • 0xMNNFF000L

                                                                                                                                                                                                                                                  This is the form supported for all versions up to 1.1.x, where M represents the major number, NN represents the minor number, and FF represents the fix number, as a hexadecimal number. For version 1.1.0, that's 0x10100000L.

                                                                                                                                                                                                                                                  Any version number may be given, but these numbers are the current known major deprecation points, making them the most meaningful:

                                                                                                                                                                                                                                                  • 0x00908000L (version 0.9.8)
                                                                                                                                                                                                                                                  • 0x10000000L (version 1.0.0)
                                                                                                                                                                                                                                                  • 0x10100000L (version 1.1.0)

                                                                                                                                                                                                                                                  For convenience, higher numbers are accepted as well, as long as feasible. For example, 0x60000000L will work as expected. However, it is recommended to start using the second form instead:

                                                                                                                                                                                                                                                • mmnnpp

                                                                                                                                                                                                                                                  This form is a simple decimal number calculated with this formula:

                                                                                                                                                                                                                                                  major * 10000 + minor * 100 + patch

                                                                                                                                                                                                                                                  where major, minor and patch are the desired major, minor and patch components of the version number. For example:

                                                                                                                                                                                                                                                  • 30000 corresponds to version 3.0.0
                                                                                                                                                                                                                                                  • 10002 corresponds to version 1.0.2
                                                                                                                                                                                                                                                  • 420101 corresponds to version 42.1.1

                                                                                                                                                                                                                                                If OPENSSL_API_COMPAT is undefined, this default value is used in its place: 30100

                                                                                                                                                                                                                                              • OPENSSL_NO_DEPRECATED

                                                                                                                                                                                                                                                If this macro is defined, all deprecated public symbols in all OpenSSL versions up to and including the version given by OPENSSL_API_COMPAT (or the default value given above, when OPENSSL_API_COMPAT isn't defined) will be hidden.

                                                                                                                                                                                                                                              "},{"location":"man7/openssl_user_macros/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store-file/","title":"ossl_store-file","text":""},{"location":"man7/ossl_store-file/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              ossl_store-file - The store 'file' scheme loader

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store-file/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                                                                                                              #include <openssl/store.h>

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store-file/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              Support for the 'file' scheme is built into libcrypto. Since files come in all kinds of formats and content types, the 'file' scheme has its own layer of functionality called \"file handlers\", which are used to try to decode diverse types of file contents.

                                                                                                                                                                                                                                              In case a file is formatted as PEM, each called file handler receives the PEM name (everything following any '-----BEGIN') as well as possible PEM headers, together with the decoded PEM body. Since PEM formatted files can contain more than one object, the file handlers are called upon for each such object.

                                                                                                                                                                                                                                              If the file isn't determined to be formatted as PEM, the content is loaded in raw form in its entirety and passed to the available file handlers as is, with no PEM name or headers.

                                                                                                                                                                                                                                              Each file handler is expected to handle PEM and non-PEM content as appropriate. Some may refuse non-PEM content for the sake of determinism (for example, there are keys out in the wild that are represented as an ASN.1 OCTET STRING. In raw form, it's not easily possible to distinguish those from any other data coming as an ASN.1 OCTET STRING, so such keys would naturally be accepted as PEM files only).

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store-file/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                              When needed, the 'file' scheme loader will require a pass phrase by using the UI_METHOD that was passed via OSSL_STORE_open(). This pass phrase is expected to be UTF-8 encoded, anything else will give an undefined result. The files made accessible through this loader are expected to be standard compliant with regards to pass phrase encoding. Files that aren't should be re-generated with a correctly encoded pass phrase. See passphrase-encoding(7) for more information.

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store-file/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              ossl_store(7), passphrase-encoding(7)

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store-file/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/","title":"ossl_store","text":""},{"location":"man7/ossl_store/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              ossl_store - Store retrieval functions

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                                                                                                              #include <openssl/store.h>

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/#description","title":"DESCRIPTION","text":""},{"location":"man7/ossl_store/#general","title":"General","text":"

                                                                                                                                                                                                                                              A STORE is a layer of functionality to retrieve a number of supported objects from a repository of any kind, addressable as a filename or as a URI.

                                                                                                                                                                                                                                              The functionality supports the pattern \"open a channel to the repository\", \"loop and retrieve one object at a time\", and \"finish up by closing the channel\".

                                                                                                                                                                                                                                              The retrieved objects are returned as a wrapper type OSSL_STORE_INFO, from which an OpenSSL type can be retrieved.

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/#uri-schemes-and-loaders","title":"URI schemes and loaders","text":"

                                                                                                                                                                                                                                              Support for a URI scheme is called a STORE \"loader\", and can be added dynamically from the calling application or from a loadable engine.

                                                                                                                                                                                                                                              Support for the 'file' scheme is built into libcrypto. See ossl_store-file(7) for more information.

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/#ui_method-and-pass-phrases","title":"UI_METHOD and pass phrases","text":"

                                                                                                                                                                                                                                              The OSS_STORE API does nothing to enforce any specific format or encoding on the pass phrase that the UI_METHOD provides. However, the pass phrase is expected to be UTF-8 encoded. The result of any other encoding is undefined.

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/#examples","title":"EXAMPLES","text":""},{"location":"man7/ossl_store/#a-generic-call","title":"A generic call","text":"
                                                                                                                                                                                                                                              #include <openssl/ui.h> /* for UI_get_default_method */\n#include <openssl/store.h>\n\nOSSL_STORE_CTX *ctx = OSSL_STORE_open(\"file:/foo/bar/data.pem\",\n                       UI_get_default_method(), NULL, NULL, NULL);\n\n/*\n * OSSL_STORE_eof() simulates file semantics for any repository to signal\n * that no more data can be expected\n */\nwhile (!OSSL_STORE_eof(ctx)) {\n    OSSL_STORE_INFO *info = OSSL_STORE_load(ctx);\n\n    /*\n     * Do whatever is necessary with the OSSL_STORE_INFO,\n     * here just one example\n     */\n    switch (OSSL_STORE_INFO_get_type(info)) {\n    case OSSL_STORE_INFO_CERT:\n        /* Print the X.509 certificate text */\n        X509_print_fp(stdout, OSSL_STORE_INFO_get0_CERT(info));\n        /* Print the X.509 certificate PEM output */\n        PEM_write_X509(stdout, OSSL_STORE_INFO_get0_CERT(info));\n        break;\n    }\n    OSSL_STORE_INFO_free(info);\n}\n\nOSSL_STORE_close(ctx);\n
                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              OSSL_STORE_INFO(3), OSSL_STORE_LOADER(3), OSSL_STORE_open(3), OSSL_STORE_expect(3), OSSL_STORE_SEARCH(3)

                                                                                                                                                                                                                                              "},{"location":"man7/ossl_store/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/","title":"passphrase-encoding","text":""},{"location":"man7/passphrase-encoding/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              passphrase-encoding - How diverse parts of OpenSSL treat pass phrases character encoding

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              In a modern world with all sorts of character encodings, the treatment of pass phrases has become increasingly complex. This manual page attempts to give an overview over how this problem is currently addressed in different parts of the OpenSSL library.

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#the-general-case","title":"The general case","text":"

                                                                                                                                                                                                                                              The OpenSSL library doesn't treat pass phrases in any special way as a general rule, and trusts the application or user to choose a suitable character set and stick to that throughout the lifetime of affected objects. This means that for an object that was encrypted using a pass phrase encoded in ISO-8859-1, that object needs to be decrypted using a pass phrase encoded in ISO-8859-1. Using the wrong encoding is expected to cause a decryption failure.

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#pkcs12","title":"PKCS#12","text":"

                                                                                                                                                                                                                                              PKCS#12 is a bit different regarding pass phrase encoding. The standard stipulates that the pass phrase shall be encoded as an ASN.1 BMPString, which consists of the code points of the basic multilingual plane, encoded in big endian (UCS-2 BE).

                                                                                                                                                                                                                                              OpenSSL tries to adapt to this requirements in one of the following manners:

                                                                                                                                                                                                                                              1. Treats the received pass phrase as UTF-8 encoded and tries to re-encode it to UTF-16 (which is the same as UCS-2 for characters U+0000 to U+D7FF and U+E000 to U+FFFF, but becomes an expansion for any other character), or failing that, proceeds with step 2.
                                                                                                                                                                                                                                              2. Assumes that the pass phrase is encoded in ASCII or ISO-8859-1 and opportunistically prepends each byte with a zero byte to obtain the UCS-2 encoding of the characters, which it stores as a BMPString.

                                                                                                                                                                                                                                                Note that since there is no check of your locale, this may produce UCS-2 / UTF-16 characters that do not correspond to the original pass phrase characters for other character sets, such as any ISO-8859-X encoding other than ISO-8859-1 (or for Windows, CP 1252 with exception for the extra \"graphical\" characters in the 0x80-0x9F range).

                                                                                                                                                                                                                                              OpenSSL versions older than 1.1.0 do variant 2 only, and that is the reason why OpenSSL still does this, to be able to read files produced with older versions.

                                                                                                                                                                                                                                              It should be noted that this approach isn't entirely fault free.

                                                                                                                                                                                                                                              A pass phrase encoded in ISO-8859-2 could very well have a sequence such as 0xC3 0xAF (which is the two characters \"LATIN CAPITAL LETTER A WITH BREVE\" and \"LATIN CAPITAL LETTER Z WITH DOT ABOVE\" in ISO-8859-2 encoding), but would be misinterpreted as the perfectly valid UTF-8 encoded code point U+00EF (LATIN SMALL LETTER I WITH DIAERESIS) if the pass phrase doesn't contain anything that would be invalid UTF-8. A pass phrase that contains this kind of byte sequence will give a different outcome in OpenSSL 1.1.0 and newer than in OpenSSL older than 1.1.0.

                                                                                                                                                                                                                                              0x00 0xC3 0x00 0xAF                 #   # OpenSSL older than 1.1.0\n0x00 0xEF                           #   # OpenSSL 1.1.0 and newer\n

                                                                                                                                                                                                                                              On the same accord, anything encoded in UTF-8 that was given to OpenSSL older than 1.1.0 was misinterpreted as ISO-8859-1 sequences.

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#ossl_store","title":"OSSL_STORE","text":"

                                                                                                                                                                                                                                              ossl_store(7) acts as a general interface to access all kinds of objects, potentially protected with a pass phrase, a PIN or something else. This API stipulates that pass phrases should be UTF-8 encoded, and that any other pass phrase encoding may give undefined results. This API relies on the application to ensure UTF-8 encoding, and doesn't check that this is the case, so what it gets, it will also pass to the underlying loader.

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#recommendations","title":"RECOMMENDATIONS","text":"

                                                                                                                                                                                                                                              This section assumes that you know what pass phrase was used for encryption, but that it may have been encoded in a different character encoding than the one used by your current input method. For example, the pass phrase may have been used at a time when your default encoding was ISO-8859-1 (i.e. \"na\u00efve\" resulting in the byte sequence 0x6E 0x61 0xEF 0x76 0x65), and you're now in an environment where your default encoding is UTF-8 (i.e. \"na\u00efve\" resulting in the byte sequence 0x6E 0x61 0xC3 0xAF 0x76 0x65). Whenever it's mentioned that you should use a certain character encoding, it should be understood that you either change the input method to use the mentioned encoding when you type in your pass phrase, or use some suitable tool to convert your pass phrase from your default encoding to the target encoding.

                                                                                                                                                                                                                                              Also note that the sub-sections below discuss human readable pass phrases. This is particularly relevant for PKCS#12 objects, where human readable pass phrases are assumed. For other objects, it's as legitimate to use any byte sequence (such as a sequence of bytes from /dev/urandom that's been saved away), which makes any character encoding discussion irrelevant; in such cases, simply use the same byte sequence as it is.

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#creating-new-objects","title":"Creating new objects","text":"

                                                                                                                                                                                                                                              For creating new pass phrase protected objects, make sure the pass phrase is encoded using UTF-8. This is default on most modern Unixes, but may involve an effort on other platforms. Specifically for Windows, setting the environment variable OPENSSL_WIN32_UTF8 will have anything entered on [Windows] console prompt converted to UTF-8 (command line and separately prompted pass phrases alike).

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#opening-existing-objects","title":"Opening existing objects","text":"

                                                                                                                                                                                                                                              For opening pass phrase protected objects where you know what character encoding was used for the encryption pass phrase, make sure to use the same encoding again.

                                                                                                                                                                                                                                              For opening pass phrase protected objects where the character encoding that was used is unknown, or where the producing application is unknown, try one of the following:

                                                                                                                                                                                                                                              1. Try the pass phrase that you have as it is in the character encoding of your environment. It's possible that its byte sequence is exactly right.
                                                                                                                                                                                                                                              2. Convert the pass phrase to UTF-8 and try with the result. Specifically with PKCS#12, this should open up any object that was created according to the specification.
                                                                                                                                                                                                                                              3. Do a na\u00efve (i.e. purely mathematical) ISO-8859-1 to UTF-8 conversion and try with the result. This differs from the previous attempt because ISO-8859-1 maps directly to U+0000 to U+00FF, which other non-UTF-8 character sets do not.

                                                                                                                                                                                                                                                This also takes care of the case when a UTF-8 encoded string was used with OpenSSL older than 1.1.0. (for example, \u00ef, which is 0xC3 0xAF when encoded in UTF-8, would become 0xC3 0x83 0xC2 0xAF when re-encoded in the na\u00efve manner. The conversion to BMPString would then yield 0x00 0xC3 0x00 0xA4 0x00 0x00, the erroneous/non-compliant encoding used by OpenSSL older than 1.1.0)

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                              evp(7), ossl_store(7), EVP_BytesToKey(3), EVP_DecryptInit(3), PEM_do_header(3), PKCS12_parse(3), PKCS12_newpass(3), d2i_PKCS8PrivateKey_bio(3)

                                                                                                                                                                                                                                              "},{"location":"man7/passphrase-encoding/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/property/","title":"property","text":""},{"location":"man7/property/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              property - Properties, a selection mechanism for algorithm implementations

                                                                                                                                                                                                                                              "},{"location":"man7/property/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              As of OpenSSL 3.0, a new method has been introduced to decide which of multiple implementations of an algorithm will be used. The method is centered around the concept of properties. Each implementation defines a number of properties and when an algorithm is being selected, filters based on these properties can be used to choose the most appropriate implementation of the algorithm.

                                                                                                                                                                                                                                              Properties are like variables, they are referenced by name and have a value assigned.

                                                                                                                                                                                                                                              "},{"location":"man7/property/#property-names","title":"Property Names","text":"

                                                                                                                                                                                                                                              Property names fall into two categories: those reserved by the OpenSSL project and user defined names. A reserved property name consists of a single C-style identifier (except for leading underscores not being permitted), which begins with a letter and can be followed by any number of letters, numbers and underscores. Property names are case-insensitive, but OpenSSL will only use lowercase letters.

                                                                                                                                                                                                                                              A user defined property name is similar, but it must consist of two or more C-style identifiers, separated by periods. The last identifier in the name can be considered the 'true' property name, which is prefixed by some sort of 'namespace'. Providers for example could include their name in the prefix and use property names like

                                                                                                                                                                                                                                              <provider_name>.<property_name>\n<provider_name>.<algorithm_name>.<property_name>\n
                                                                                                                                                                                                                                              "},{"location":"man7/property/#properties","title":"Properties","text":"

                                                                                                                                                                                                                                              A property is a name=value pair. A property definition is a sequence of comma separated properties. There can be any number of properties in a definition, however each name must be unique. For example: \"\" defines an empty property definition (i.e., no restriction); \"my.foo=bar\" defines a property named my.foo which has a string value bar and \"iteration.count=3\" defines a property named iteration.count which has a numeric value of 3. The full syntax for property definitions appears below.

                                                                                                                                                                                                                                              "},{"location":"man7/property/#implementations","title":"Implementations","text":"

                                                                                                                                                                                                                                              Each implementation of an algorithm can define any number of properties. For example, the default provider defines the property provider=default for all of its algorithms. Likewise, OpenSSL's FIPS provider defines provider=fips and the legacy provider defines provider=legacy for all of their algorithms.

                                                                                                                                                                                                                                              "},{"location":"man7/property/#queries","title":"Queries","text":"

                                                                                                                                                                                                                                              A property query clause is a single conditional test. For example, \"fips=yes\", \"provider!=default\" or \"?iteration.count=3\". The first two represent mandatory clauses, such clauses must match for any algorithm to even be under consideration. The third clause represents an optional clause. Matching such clauses is not a requirement, but any additional optional match counts in favor of the algorithm. More details about that in the Lookups section. A property query is a sequence of comma separated property query clauses. It is an error if a property name appears in more than one query clause. The full syntax for property queries appears below, but the available syntactic features are:

                                                                                                                                                                                                                                              • = is an infix operator providing an equality test.
                                                                                                                                                                                                                                              • != is an infix operator providing an inequality test.
                                                                                                                                                                                                                                              • ? is a prefix operator that means that the following clause is optional but preferred.
                                                                                                                                                                                                                                              • - is a prefix operator that means any global query clause involving the following property name should be ignored.
                                                                                                                                                                                                                                              • \"...\" is a quoted string. The quotes are not included in the body of the string.
                                                                                                                                                                                                                                              • '...' is a quoted string. The quotes are not included in the body of the string.
                                                                                                                                                                                                                                              "},{"location":"man7/property/#lookups","title":"Lookups","text":"

                                                                                                                                                                                                                                              When an algorithm is looked up, a property query is used to determine the best matching algorithm. All mandatory query clauses must be present and the implementation that additionally has the largest number of matching optional query clauses will be used. If there is more than one such optimal candidate, the result will be chosen from amongst those in an indeterminate way. Ordering of optional clauses is not significant.

                                                                                                                                                                                                                                              "},{"location":"man7/property/#shortcut","title":"Shortcut","text":"

                                                                                                                                                                                                                                              In order to permit a more concise expression of boolean properties, there is one short cut: a property name alone (e.g. \"my.property\") is exactly equivalent to \"my.property=yes\" in both definitions and queries.

                                                                                                                                                                                                                                              "},{"location":"man7/property/#global-and-local","title":"Global and Local","text":"

                                                                                                                                                                                                                                              Two levels of property query are supported. A context based property query that applies to all fetch operations and a local property query. Where both the context and local queries include a clause with the same name, the local clause overrides the context clause.

                                                                                                                                                                                                                                              It is possible for a local property query to remove a clause in the context property query by preceding the property name with a '-'. For example, a context property query that contains \"fips=yes\" would normally result in implementations that have \"fips=yes\".

                                                                                                                                                                                                                                              However, if the setting of the \"fips\" property is irrelevant to the operations being performed, the local property query can include the clause \"-fips\". Note that the local property query could not use \"fips=no\" because that would disallow any implementations with \"fips=yes\" rather than not caring about the setting.

                                                                                                                                                                                                                                              "},{"location":"man7/property/#syntax","title":"SYNTAX","text":"

                                                                                                                                                                                                                                              The lexical syntax in EBNF is given by:

                                                                                                                                                                                                                                              Definition     ::= PropertyName ( '=' Value )?\n                       ( ',' PropertyName ( '=' Value )? )*\nQuery          ::= PropertyQuery ( ',' PropertyQuery )*\nPropertyQuery  ::= '-' PropertyName\n                 | '?'? ( PropertyName (( '=' | '!=' ) Value)?)\nValue          ::= NumberLiteral | StringLiteral\nStringLiteral  ::= QuotedString | UnquotedString\nQuotedString   ::= '\"' [^\"]* '\"' | \"'\" [^']* \"'\"\nUnquotedString ::= [A-Za-z] [^{space},]+\nNumberLiteral  ::= '0' ( [0-7]* | 'x' [0-9A-Fa-f]+ ) | '-'? [1-9] [0-9]+\nPropertyName   ::= [A-Za-z] [A-Za-z0-9_]* ( '.' [A-Za-z] [A-Za-z0-9_]* )*\n

                                                                                                                                                                                                                                              The flavour of EBNF being used is defined by: https://www.w3.org/TR/2010/REC-xquery-20101214/#EBNFNotation.

                                                                                                                                                                                                                                              "},{"location":"man7/property/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                              Properties were added in OpenSSL 3.0

                                                                                                                                                                                                                                              "},{"location":"man7/property/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                              Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                              "},{"location":"man7/provider-asym_cipher/","title":"provider-asym_cipher","text":""},{"location":"man7/provider-asym_cipher/#name","title":"NAME","text":"

                                                                                                                                                                                                                                              provider-asym_cipher - The asym_cipher library <-> provider functions

                                                                                                                                                                                                                                              "},{"location":"man7/provider-asym_cipher/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                              #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_asym_cipher_newctx(void *provctx);\nvoid OSSL_FUNC_asym_cipher_freectx(void *ctx);\nvoid *OSSL_FUNC_asym_cipher_dupctx(void *ctx);\n\n/* Encryption */\nint OSSL_FUNC_asym_cipher_encrypt_init(void *ctx, void *provkey,\n                                       const OSSL_PARAM params[]);\nint OSSL_FUNC_asym_cipher_encrypt(void *ctx, unsigned char *out, size_t *outlen,\n                                  size_t outsize, const unsigned char *in,\n                                  size_t inlen);\n\n/* Decryption */\nint OSSL_FUNC_asym_cipher_decrypt_init(void *ctx, void *provkey,\n                                       const OSSL_PARAM params[]);\nint OSSL_FUNC_asym_cipher_decrypt(void *ctx, unsigned char *out, size_t *outlen,\n                                  size_t outsize, const unsigned char *in,\n                                  size_t inlen);\n\n/* Asymmetric Cipher parameters */\nint OSSL_FUNC_asym_cipher_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_asym_cipher_gettable_ctx_params(void *provctx);\nint OSSL_FUNC_asym_cipher_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_asym_cipher_settable_ctx_params(void *provctx);\n
                                                                                                                                                                                                                                              "},{"location":"man7/provider-asym_cipher/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                              This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                              The asymmetric cipher (OSSL_OP_ASYM_CIPHER) operation enables providers to implement asymmetric cipher algorithms and make them available to applications via the API functions EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3) and other related functions).

                                                                                                                                                                                                                                              All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                              All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_asym_cipher_newctx() has these:

                                                                                                                                                                                                                                              typedef void *(OSSL_FUNC_asym_cipher_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_asym_cipher_newctx_fn\n    OSSL_FUNC_asym_cipher_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                              OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_newctx               OSSL_FUNC_ASYM_CIPHER_NEWCTX\nOSSL_FUNC_asym_cipher_freectx              OSSL_FUNC_ASYM_CIPHER_FREECTX\nOSSL_FUNC_asym_cipher_dupctx               OSSL_FUNC_ASYM_CIPHER_DUPCTX\n\nOSSL_FUNC_asym_cipher_encrypt_init         OSSL_FUNC_ASYM_CIPHER_ENCRYPT_INIT\nOSSL_FUNC_asym_cipher_encrypt              OSSL_FUNC_ASYM_CIPHER_ENCRYPT\n\nOSSL_FUNC_asym_cipher_decrypt_init         OSSL_FUNC_ASYM_CIPHER_DECRYPT_INIT\nOSSL_FUNC_asym_cipher_decrypt              OSSL_FUNC_ASYM_CIPHER_DECRYPT\n\nOSSL_FUNC_asym_cipher_get_ctx_params       OSSL_FUNC_ASYM_CIPHER_GET_CTX_PARAMS\nOSSL_FUNC_asym_cipher_gettable_ctx_params  OSSL_FUNC_ASYM_CIPHER_GETTABLE_CTX_PARAMS\nOSSL_FUNC_asym_cipher_set_ctx_params       OSSL_FUNC_ASYM_CIPHER_SET_CTX_PARAMS\nOSSL_FUNC_asym_cipher_settable_ctx_params  OSSL_FUNC_ASYM_CIPHER_SETTABLE_CTX_PARAMS\n

                                                                                                                                                                                                                                              An asymmetric cipher algorithm implementation may not implement all of these functions. In order to be a consistent set of functions a provider must implement OSSL_FUNC_asym_cipher_newctx and OSSL_FUNC_asym_cipher_freectx. It must also implement both of OSSL_FUNC_asym_cipher_encrypt_init and OSSL_FUNC_asym_cipher_encrypt, or both of OSSL_FUNC_asym_cipher_decrypt_init and OSSL_FUNC_asym_cipher_decrypt. OSSL_FUNC_asym_cipher_get_ctx_params is optional but if it is present then so must OSSL_FUNC_asym_cipher_gettable_ctx_params. Similarly, OSSL_FUNC_asym_cipher_set_ctx_params is optional but if it is present then so must OSSL_FUNC_asym_cipher_settable_ctx_params.

                                                                                                                                                                                                                                              An asymmetric cipher algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                                                                                                                                                              "},{"location":"man7/provider-asym_cipher/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_newctx() should create and return a pointer to a provider side structure for holding context information during an asymmetric cipher operation. A pointer to this context will be passed back in a number of the other asymmetric cipher operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_freectx() is passed a pointer to the provider side asymmetric cipher context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_dupctx() should duplicate the provider side asymmetric cipher context in the ctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                              "},{"location":"man7/provider-asym_cipher/#encryption-functions","title":"Encryption Functions","text":"

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_encrypt_init() initialises a context for an asymmetric encryption given a provider side asymmetric cipher context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_asym_cipher_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)). OSSL_FUNC_asym_cipher_encrypt() performs the actual encryption itself. A previously initialised asymmetric cipher context is passed in the ctx parameter. The data to be encrypted is pointed to by the in parameter which is inlen bytes long. Unless out is NULL, the encrypted data should be written to the location pointed to by the out parameter and it should not exceed outsize bytes in length. The length of the encrypted data should be written to *outlen. If out is NULL then the maximum length of the encrypted data should be written to *outlen.

                                                                                                                                                                                                                                              "},{"location":"man7/provider-asym_cipher/#decryption-functions","title":"Decryption Functions","text":"

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_decrypt_init() initialises a context for an asymmetric decryption given a provider side asymmetric cipher context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_asym_cipher_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)).

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_decrypt() performs the actual decryption itself. A previously initialised asymmetric cipher context is passed in the ctx parameter. The data to be decrypted is pointed to by the in parameter which is inlen bytes long. Unless out is NULL, the decrypted data should be written to the location pointed to by the out parameter and it should not exceed outsize bytes in length. The length of the decrypted data should be written to *outlen. If out is NULL then the maximum length of the decrypted data should be written to *outlen.

                                                                                                                                                                                                                                              "},{"location":"man7/provider-asym_cipher/#asymmetric-cipher-parameters","title":"Asymmetric Cipher Parameters","text":"

                                                                                                                                                                                                                                              See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_asym_cipher_get_ctx_params() and OSSL_FUNC_asym_cipher_set_ctx_params() functions.

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_get_ctx_params() gets asymmetric cipher parameters associated with the given provider side asymmetric cipher context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                              OSSL_FUNC_asym_cipher_set_ctx_params() sets the asymmetric cipher parameters associated with the given provider side asymmetric cipher context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                              Parameters currently recognised by built-in asymmetric cipher algorithms are as follows. Not all parameters are relevant to, or are understood by all asymmetric cipher algorithms:

                                                                                                                                                                                                                                              • \"pad-mode\" (OSSL_ASYM_CIPHER_PARAM_PAD_MODE) OR <integer>

                                                                                                                                                                                                                                                The type of padding to be used. The interpretation of this value will depend on the algorithm in use.

                                                                                                                                                                                                                                              • \"digest\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST)

                                                                                                                                                                                                                                                Gets or sets the name of the OAEP digest algorithm used when OAEP padding is in use.

                                                                                                                                                                                                                                              • \"digest\" (OSSL_ASYM_CIPHER_PARAM_DIGEST)

                                                                                                                                                                                                                                                Gets or sets the name of the digest algorithm used by the algorithm (where applicable).

                                                                                                                                                                                                                                              • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS)

                                                                                                                                                                                                                                                Gets or sets the properties to use when fetching the OAEP digest algorithm.

                                                                                                                                                                                                                                              • \"digest-props\" (OSSL_ASYM_CIPHER_PARAM_DIGEST_PROPS)

                                                                                                                                                                                                                                                Gets or sets the properties to use when fetching the cipher digest algorithm.

                                                                                                                                                                                                                                              • \"mgf1-digest\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST)

                                                                                                                                                                                                                                                Gets or sets the name of the MGF1 digest algorithm used when OAEP or PSS padding is in use.

                                                                                                                                                                                                                                              • \"mgf1-digest-props\" (OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS)

                                                                                                                                                                                                                                                Gets or sets the properties to use when fetching the MGF1 digest algorithm.

                                                                                                                                                                                                                                              • \"oaep-label\" (OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL) <octet string ptr>

                                                                                                                                                                                                                                                Gets the OAEP label used when OAEP padding is in use.

                                                                                                                                                                                                                                              • \"oaep-label\" (OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL) <octet string>

                                                                                                                                                                                                                                                Sets the OAEP label used when OAEP padding is in use.

                                                                                                                                                                                                                                              • \"tls-client-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                                                                                                                                                                                                                                                The TLS protocol version first requested by the client.

                                                                                                                                                                                                                                              • \"tls-negotiated-version\" (OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION) <unsigned integer>

                                                                                                                                                                                                                                                The negotiated TLS protocol version.

                                                                                                                                                                                                                                              • OSSL_FUNC_asym_cipher_gettable_ctx_params() and OSSL_FUNC_asym_cipher_settable_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters, i.e. parameters that can be used with OSSL_FUNC_asym_cipherget_ctx_params() and OSSL_FUNC_asym_cipher_set_ctx_params() respectively.

                                                                                                                                                                                                                                                "},{"location":"man7/provider-asym_cipher/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                OSSL_FUNC_asym_cipher_newctx() and OSSL_FUNC_asym_cipher_dupctx() should return the newly created provider side asymmetric cipher context, or NULL on failure.

                                                                                                                                                                                                                                                All other functions should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                "},{"location":"man7/provider-asym_cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                provider(7)

                                                                                                                                                                                                                                                "},{"location":"man7/provider-asym_cipher/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                The provider ASYM_CIPHER interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                "},{"location":"man7/provider-asym_cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                "},{"location":"man7/provider-base/","title":"provider-base","text":""},{"location":"man7/provider-base/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                provider-base - The basic OpenSSL library <-> provider functions

                                                                                                                                                                                                                                                "},{"location":"man7/provider-base/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Functions offered by libcrypto to the providers */\nconst OSSL_ITEM *core_gettable_params(const OSSL_CORE_HANDLE *handle);\nint core_get_params(const OSSL_CORE_HANDLE *handle, OSSL_PARAM params[]);\n\ntypedef void (*OSSL_thread_stop_handler_fn)(void *arg);\nint core_thread_start(const OSSL_CORE_HANDLE *handle,\n                      OSSL_thread_stop_handler_fn handfn,\n                      void *arg);\n\nOPENSSL_CORE_CTX *core_get_libctx(const OSSL_CORE_HANDLE *handle);\nvoid core_new_error(const OSSL_CORE_HANDLE *handle);\nvoid core_set_error_debug(const OSSL_CORE_HANDLE *handle,\n                          const char *file, int line, const char *func);\nvoid core_vset_error(const OSSL_CORE_HANDLE *handle,\n                     uint32_t reason, const char *fmt, va_list args);\n\nint core_obj_add_sigid(const OSSL_CORE_HANDLE *prov, const char  *sign_name,\n                       const char *digest_name, const char *pkey_name);\nint core_obj_create(const OSSL_CORE_HANDLE *handle, const char *oid,\n                    const char *sn, const char *ln);\n\n/*\n * Some OpenSSL functionality is directly offered to providers via\n * dispatch\n */\nvoid *CRYPTO_malloc(size_t num, const char *file, int line);\nvoid *CRYPTO_zalloc(size_t num, const char *file, int line);\nvoid CRYPTO_free(void *ptr, const char *file, int line);\nvoid CRYPTO_clear_free(void *ptr, size_t num,\n                       const char *file, int line);\nvoid *CRYPTO_realloc(void *addr, size_t num,\n                     const char *file, int line);\nvoid *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,\n                           const char *file, int line);\nvoid *CRYPTO_secure_malloc(size_t num, const char *file, int line);\nvoid *CRYPTO_secure_zalloc(size_t num, const char *file, int line);\nvoid CRYPTO_secure_free(void *ptr, const char *file, int line);\nvoid CRYPTO_secure_clear_free(void *ptr, size_t num,\n                              const char *file, int line);\nint CRYPTO_secure_allocated(const void *ptr);\nvoid OPENSSL_cleanse(void *ptr, size_t len);\n\nunsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);\n\nOSSL_CORE_BIO *BIO_new_file(const char *filename, const char *mode);\nOSSL_CORE_BIO *BIO_new_membuf(const void *buf, int len);\nint BIO_read_ex(OSSL_CORE_BIO *bio, void *data, size_t data_len,\n                size_t *bytes_read);\nint BIO_write_ex(OSSL_CORE_BIO *bio, const void *data, size_t data_len,\n                 size_t *written);\nint BIO_up_ref(OSSL_CORE_BIO *bio);\nint BIO_free(OSSL_CORE_BIO *bio);\nint BIO_vprintf(OSSL_CORE_BIO *bio, const char *format, va_list args);\nint BIO_vsnprintf(char *buf, size_t n, const char *fmt, va_list args);\n\nvoid OSSL_SELF_TEST_set_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK *cb,\n                                 void *cbarg);\n\nsize_t get_entropy(const OSSL_CORE_HANDLE *handle,\n                   unsigned char **pout, int entropy,\n                   size_t min_len, size_t max_len);\nsize_t get_user_entropy(const OSSL_CORE_HANDLE *handle,\n                        unsigned char **pout, int entropy,\n                        size_t min_len, size_t max_len);\nvoid cleanup_entropy(const OSSL_CORE_HANDLE *handle,\n                     unsigned char *buf, size_t len);\nvoid cleanup_user_entropy(const OSSL_CORE_HANDLE *handle,\n                          unsigned char *buf, size_t len);\nsize_t get_nonce(const OSSL_CORE_HANDLE *handle,\n                 unsigned char **pout, size_t min_len, size_t max_len,\n                 const void *salt, size_t salt_len);\nsize_t get_user_nonce(const OSSL_CORE_HANDLE *handle,\n                      unsigned char **pout, size_t min_len, size_t max_len,\n                      const void *salt, size_t salt_len);\nvoid cleanup_nonce(const OSSL_CORE_HANDLE *handle,\n                   unsigned char *buf, size_t len);\nvoid cleanup_user_nonce(const OSSL_CORE_HANDLE *handle,\n                        unsigned char *buf, size_t len);\n\n/* Functions for querying the providers in the application library context */\nint provider_register_child_cb(const OSSL_CORE_HANDLE *handle,\n                    int (*create_cb)(const OSSL_CORE_HANDLE *provider,\n                                     void *cbdata),\n                    int (*remove_cb)(const OSSL_CORE_HANDLE *provider,\n                                     void *cbdata),\n                    int (*global_props_cb)(const char *props, void *cbdata),\n                    void *cbdata);\nvoid provider_deregister_child_cb(const OSSL_CORE_HANDLE *handle);\nconst char *provider_name(const OSSL_CORE_HANDLE *prov);\nvoid *provider_get0_provider_ctx(const OSSL_CORE_HANDLE *prov);\nconst OSSL_DISPATCH *provider_get0_dispatch(const OSSL_CORE_HANDLE *prov);\nint provider_up_ref(const OSSL_CORE_HANDLE *prov, int activate);\nint provider_free(const OSSL_CORE_HANDLE *prov, int deactivate);\n\n/* Functions offered by the provider to libcrypto */\nvoid provider_teardown(void *provctx);\nconst OSSL_ITEM *provider_gettable_params(void *provctx);\nint provider_get_params(void *provctx, OSSL_PARAM params[]);\nconst OSSL_ALGORITHM *provider_query_operation(void *provctx,\n                                               int operation_id,\n                                               const int *no_store);\nvoid provider_unquery_operation(void *provctx, int operation_id,\n                                const OSSL_ALGORITHM *algs);\nconst OSSL_ITEM *provider_get_reason_strings(void *provctx);\nint provider_get_capabilities(void *provctx, const char *capability,\n                              OSSL_CALLBACK *cb, void *arg);\nint provider_self_test(void *provctx);\n
                                                                                                                                                                                                                                                "},{"location":"man7/provider-base/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays, in the call of the provider initialization function. See \"Provider\" in provider(7) for a description of the initialization function. They are known as \"upcalls\".

                                                                                                                                                                                                                                                All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from a OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" core_gettable_params() has these:

                                                                                                                                                                                                                                                typedef OSSL_PARAM *\n    (OSSL_FUNC_core_gettable_params_fn)(const OSSL_CORE_HANDLE *handle);\nstatic ossl_inline OSSL_NAME_core_gettable_params_fn\n    OSSL_FUNC_core_gettable_params(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                For in (the OSSL_DISPATCH(3) array passed from libcrypto to the provider):

                                                                                                                                                                                                                                                core_gettable_params           OSSL_FUNC_CORE_GETTABLE_PARAMS\ncore_get_params                OSSL_FUNC_CORE_GET_PARAMS\ncore_thread_start              OSSL_FUNC_CORE_THREAD_START\ncore_get_libctx                OSSL_FUNC_CORE_GET_LIBCTX\ncore_new_error                 OSSL_FUNC_CORE_NEW_ERROR\ncore_set_error_debug           OSSL_FUNC_CORE_SET_ERROR_DEBUG\ncore_vset_error                OSSL_FUNC_CORE_VSET_ERROR\ncore_obj_add_sigid             OSSL_FUNC_CORE_OBJ_ADD_SIGID\ncore_obj_create                OSSL_FUNC_CORE_OBJ_CREATE\nCRYPTO_malloc                  OSSL_FUNC_CRYPTO_MALLOC\nCRYPTO_zalloc                  OSSL_FUNC_CRYPTO_ZALLOC\nCRYPTO_free                    OSSL_FUNC_CRYPTO_FREE\nCRYPTO_clear_free              OSSL_FUNC_CRYPTO_CLEAR_FREE\nCRYPTO_realloc                 OSSL_FUNC_CRYPTO_REALLOC\nCRYPTO_clear_realloc           OSSL_FUNC_CRYPTO_CLEAR_REALLOC\nCRYPTO_secure_malloc           OSSL_FUNC_CRYPTO_SECURE_MALLOC\nCRYPTO_secure_zalloc           OSSL_FUNC_CRYPTO_SECURE_ZALLOC\nCRYPTO_secure_free             OSSL_FUNC_CRYPTO_SECURE_FREE\nCRYPTO_secure_clear_free       OSSL_FUNC_CRYPTO_SECURE_CLEAR_FREE\nCRYPTO_secure_allocated        OSSL_FUNC_CRYPTO_SECURE_ALLOCATED\nBIO_new_file                   OSSL_FUNC_BIO_NEW_FILE\nBIO_new_mem_buf                OSSL_FUNC_BIO_NEW_MEMBUF\nBIO_read_ex                    OSSL_FUNC_BIO_READ_EX\nBIO_write_ex                   OSSL_FUNC_BIO_WRITE_EX\nBIO_up_ref                     OSSL_FUNC_BIO_UP_REF\nBIO_free                       OSSL_FUNC_BIO_FREE\nBIO_vprintf                    OSSL_FUNC_BIO_VPRINTF\nBIO_vsnprintf                  OSSL_FUNC_BIO_VSNPRINTF\nBIO_puts                       OSSL_FUNC_BIO_PUTS\nBIO_gets                       OSSL_FUNC_BIO_GETS\nBIO_ctrl                       OSSL_FUNC_BIO_CTRL\nOPENSSL_cleanse                OSSL_FUNC_OPENSSL_CLEANSE\nOSSL_SELF_TEST_set_callback    OSSL_FUNC_SELF_TEST_CB\nossl_rand_get_entropy          OSSL_FUNC_GET_ENTROPY\nossl_rand_get_user_entropy     OSSL_FUNC_GET_USER_ENTROPY\nossl_rand_cleanup_entropy      OSSL_FUNC_CLEANUP_ENTROPY\nossl_rand_cleanup_user_entropy OSSL_FUNC_CLEANUP_USER_ENTROPY\nossl_rand_get_nonce            OSSL_FUNC_GET_NONCE\nossl_rand_get_user_nonce       OSSL_FUNC_GET_USER_NONCE\nossl_rand_cleanup_nonce        OSSL_FUNC_CLEANUP_NONCE\nossl_rand_cleanup_user_nonce   OSSL_FUNC_CLEANUP_USER_NONCE\nprovider_register_child_cb     OSSL_FUNC_PROVIDER_REGISTER_CHILD_CB\nprovider_deregister_child_cb   OSSL_FUNC_PROVIDER_DEREGISTER_CHILD_CB\nprovider_name                  OSSL_FUNC_PROVIDER_NAME\nprovider_get0_provider_ctx     OSSL_FUNC_PROVIDER_GET0_PROVIDER_CTX\nprovider_get0_dispatch         OSSL_FUNC_PROVIDER_GET0_DISPATCH\nprovider_up_ref                OSSL_FUNC_PROVIDER_UP_REF\nprovider_free                  OSSL_FUNC_PROVIDER_FREE\n

                                                                                                                                                                                                                                                For *out (the OSSL_DISPATCH(3) array passed from the provider to libcrypto):

                                                                                                                                                                                                                                                provider_teardown              OSSL_FUNC_PROVIDER_TEARDOWN\nprovider_gettable_params       OSSL_FUNC_PROVIDER_GETTABLE_PARAMS\nprovider_get_params            OSSL_FUNC_PROVIDER_GET_PARAMS\nprovider_query_operation       OSSL_FUNC_PROVIDER_QUERY_OPERATION\nprovider_unquery_operation     OSSL_FUNC_PROVIDER_UNQUERY_OPERATION\nprovider_get_reason_strings    OSSL_FUNC_PROVIDER_GET_REASON_STRINGS\nprovider_get_capabilities      OSSL_FUNC_PROVIDER_GET_CAPABILITIES\nprovider_self_test             OSSL_FUNC_PROVIDER_SELF_TEST\n
                                                                                                                                                                                                                                                "},{"location":"man7/provider-base/#core-functions","title":"Core functions","text":"

                                                                                                                                                                                                                                                core_gettable_params() returns a constant array of descriptor OSSL_PARAM(3), for parameters that core_get_params() can handle.

                                                                                                                                                                                                                                                core_get_params() retrieves parameters from the core for the given handle. See \"Core parameters\" below for a description of currently known parameters.

                                                                                                                                                                                                                                                The core_thread_start() function informs the core that the provider has stated an interest in the current thread. The core will inform the provider when the thread eventually stops. It must be passed the handle for this provider, as well as a callback handfn which will be called when the thread stops. The callback will subsequently be called, with the supplied argument arg, from the thread that is stopping and gets passed the provider context as an argument. This may be useful to perform thread specific clean up such as freeing thread local variables.

                                                                                                                                                                                                                                                core_get_libctx() retrieves the core context in which the library object for the current provider is stored, accessible through the handle. This function is useful only for built-in providers such as the default provider. Never cast this to OSSL_LIB_CTX in a provider that is not built-in as the OSSL_LIB_CTX of the library loading the provider might be a completely different structure than the OSSL_LIB_CTX of the library the provider is linked to. Use OSSL_LIB_CTX_new_child(3) instead to obtain a proper library context that is linked to the application library context.

                                                                                                                                                                                                                                                core_new_error(), core_set_error_debug() and core_vset_error() are building blocks for reporting an error back to the core, with reference to the handle.

                                                                                                                                                                                                                                                • core_new_error()

                                                                                                                                                                                                                                                  allocates a new thread specific error record.

                                                                                                                                                                                                                                                  This corresponds to the OpenSSL function ERR_new(3).

                                                                                                                                                                                                                                                • core_set_error_debug()

                                                                                                                                                                                                                                                  sets debugging information in the current thread specific error record. The debugging information includes the name of the file file, the line line and the function name func where the error occurred.

                                                                                                                                                                                                                                                  This corresponds to the OpenSSL function ERR_set_debug(3).

                                                                                                                                                                                                                                                • core_vset_error()

                                                                                                                                                                                                                                                  sets the reason for the error, along with any addition data. The reason is a number defined by the provider and used to index the reason strings table that's returned by provider_get_reason_strings(). The additional data is given as a format string fmt and a set of arguments args, which are treated in the same manner as with BIO_vsnprintf(). file and line may also be passed to indicate exactly where the error occurred or was reported.

                                                                                                                                                                                                                                                  This corresponds to the OpenSSL function ERR_vset_error(3).

                                                                                                                                                                                                                                                The core_obj_create() function registers a new OID and associated short name sn and long name ln for the given handle. It is similar to the OpenSSL function OBJ_create(3) except that it returns 1 on success or 0 on failure. It will treat as success the case where the OID already exists (even if the short name sn or long name ln provided as arguments differ from those associated with the existing OID, in which case the new names are not associated).

                                                                                                                                                                                                                                                The core_obj_add_sigid() function registers a new composite signature algorithm (sign_name) consisting of an underlying signature algorithm (pkey_name) and digest algorithm (digest_name) for the given handle. It assumes that the OIDs for the composite signature algorithm as well as for the underlying signature and digest algorithms are either already known to OpenSSL or have been registered via a call to core_obj_create(). It corresponds to the OpenSSL function OBJ_add_sigid(3), except that the objects are identified by name rather than a numeric NID. Any name (OID, short name or long name) can be used to identify the object. It will treat as success the case where the composite signature algorithm already exists (even if registered against a different underlying signature or digest algorithm). For digest_name, NULL or an empty string is permissible for signature algorithms that do not need a digest to operate correctly. The function returns 1 on success or 0 on failure.

                                                                                                                                                                                                                                                CRYPTO_malloc(), CRYPTO_zalloc(), CRYPTO_free(), CRYPTO_clear_free(), CRYPTO_realloc(), CRYPTO_clear_realloc(), CRYPTO_secure_malloc(), CRYPTO_secure_zalloc(), CRYPTO_secure_free(), CRYPTO_secure_clear_free(), CRYPTO_secure_allocated(), BIO_new_file(), BIO_new_mem_buf(), BIO_read_ex(), BIO_write_ex(), BIO_up_ref(), BIO_free(), BIO_vprintf(), BIO_vsnprintf(), BIO_gets(), BIO_puts(), BIO_ctrl(), OPENSSL_cleanse() and OPENSSL_hexstr2buf() correspond exactly to the public functions with the same name. As a matter of fact, the pointers in the OSSL_DISPATCH(3) array are typically direct pointers to those public functions. Note that the BIO functions take an OSSL_CORE_BIO type rather than the standard BIO type. This is to ensure that a provider does not mix BIOs from the core with BIOs used on the provider side (the two are not compatible). OSSL_SELF_TEST_set_callback() is used to set an optional callback that can be passed into a provider. This may be ignored by a provider.

                                                                                                                                                                                                                                                get_entropy() retrieves seeding material from the operating system. The seeding material will have at least entropy bytes of randomness and the output will have at least min_len and at most max_len bytes. The buffer address is stored in *pout and the buffer length is returned to the caller. On error, zero is returned.

                                                                                                                                                                                                                                                get_user_entropy() is the same as get_entropy() except that it will attempt to gather seed material via the seed source specified by a call to RAND_set_seed_source_type(3) or via \"Random Configuration\" in config(5).

                                                                                                                                                                                                                                                cleanup_entropy() is used to clean up and free the buffer returned by get_entropy(). The entropy pointer returned by get_entropy() is passed in buf and its length in len.

                                                                                                                                                                                                                                                cleanup_user_entropy() is used to clean up and free the buffer returned by get_user_entropy(). The entropy pointer returned by get_user_entropy() is passed in buf and its length in len.

                                                                                                                                                                                                                                                get_nonce() retrieves a nonce using the passed salt parameter of length salt_len and operating system specific information. The salt should contain uniquely identifying information and this is included, in an unspecified manner, as part of the output. The output is stored in a buffer which contains at least min_len and at most max_len bytes. The buffer address is stored in *pout and the buffer length returned to the caller. On error, zero is returned.

                                                                                                                                                                                                                                                get_user_nonce() is the same as get_nonce() except that it will attempt to gather seed material via the seed source specified by a call to RAND_set_seed_source_type(3) or via \"Random Configuration\" in config(5).

                                                                                                                                                                                                                                                cleanup_nonce() is used to clean up and free the buffer returned by get_nonce(). The nonce pointer returned by get_nonce() is passed in buf and its length in len.

                                                                                                                                                                                                                                                cleanup_user_nonce() is used to clean up and free the buffer returned by get_user_nonce(). The nonce pointer returned by get_user_nonce() is passed in buf and its length in len.

                                                                                                                                                                                                                                                provider_register_child_cb() registers callbacks for being informed about the loading and unloading of providers in the application's library context. handle is this provider's handle and cbdata is this provider's data that will be passed back to the callbacks. It returns 1 on success or 0 otherwise. These callbacks may be called while holding locks in libcrypto. In order to avoid deadlocks the callback implementation must not be long running and must not call other OpenSSL API functions or upcalls.

                                                                                                                                                                                                                                                create_cb is a callback that will be called when a new provider is loaded into the application's library context. It is also called for any providers that are already loaded at the point that this callback is registered. The callback is passed the handle being used for the new provider being loadded and this provider's data in cbdata. It should return 1 on success or 0 on failure.

                                                                                                                                                                                                                                                remove_cb is a callback that will be called when a new provider is unloaded from the application's library context. It is passed the handle being used for the provider being unloaded and this provider's data in cbdata. It should return 1 on success or 0 on failure.

                                                                                                                                                                                                                                                global_props_cb is a callback that will be called when the global properties from the parent library context are changed. It should return 1 on success or 0 on failure.

                                                                                                                                                                                                                                                provider_deregister_child_cb() unregisters callbacks previously registered via provider_register_child_cb(). If provider_register_child_cb() has been called then provider_deregister_child_cb() should be called at or before the point that this provider's teardown function is called.

                                                                                                                                                                                                                                                provider_name() returns a string giving the name of the provider identified by handle.

                                                                                                                                                                                                                                                provider_get0_provider_ctx() returns the provider context that is associated with the provider identified by prov.

                                                                                                                                                                                                                                                provider_get0_dispatch() gets the dispatch table registered by the provider identified by prov when it initialised.

                                                                                                                                                                                                                                                provider_up_ref() increments the reference count on the provider prov. If activate is nonzero then the provider is also loaded if it is not already loaded. It returns 1 on success or 0 on failure.

                                                                                                                                                                                                                                                provider_free() decrements the reference count on the provider prov. If deactivate is nonzero then the provider is also unloaded if it is not already loaded. It returns 1 on success or 0 on failure.

                                                                                                                                                                                                                                                "},{"location":"man7/provider-base/#provider-functions","title":"Provider functions","text":"

                                                                                                                                                                                                                                                provider_teardown() is called when a provider is shut down and removed from the core's provider store. It must free the passed provctx.

                                                                                                                                                                                                                                                provider_gettable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that provider_get_params() can handle.

                                                                                                                                                                                                                                                provider_get_params() should process the OSSL_PARAM(3) array params, setting the values of the parameters it understands.

                                                                                                                                                                                                                                                provider_query_operation() should return a constant OSSL_ALGORITHM(3) that corresponds to the given operation_id. It should indicate if the core may store a reference to this array by setting *no_store to 0 (core may store a reference) or 1 (core may not store a reference).

                                                                                                                                                                                                                                                provider_unquery_operation() informs the provider that the result of a provider_query_operation() is no longer directly required and that the function pointers have been copied. The operation_id should match that passed to provider_query_operation() and algs should be its return value.

                                                                                                                                                                                                                                                provider_get_reason_strings() should return a constant OSSL_ITEM(3) array that provides reason strings for reason codes the provider may use when reporting errors using core_put_error().

                                                                                                                                                                                                                                                The provider_get_capabilities() function should call the callback cb passing it a set of OSSL_PARAM(3)s and the caller supplied argument arg. The OSSL_PARAM(3)s should provide details about the capability with the name given in the capability argument relevant for the provider context provctx. If a provider supports multiple capabilities with the given name then it may call the callback multiple times (one for each capability). Capabilities can be useful for describing the services that a provider can offer. For further details see the \"CAPABILITIES\" section below. It should return 1 on success or 0 on error.

                                                                                                                                                                                                                                                The provider_self_test() function should perform known answer tests on a subset of the algorithms that it uses, and may also verify the integrity of the provider module. It should return 1 on success or 0 on error. It will return 1 if this function is not used.

                                                                                                                                                                                                                                                None of these functions are mandatory, but a provider is fairly useless without at least provider_query_operation(), and provider_gettable_params() is fairly useless if not accompanied by provider_get_params().

                                                                                                                                                                                                                                                "},{"location":"man7/provider-base/#provider-parameters","title":"Provider parameters","text":"

                                                                                                                                                                                                                                                provider_get_params() can return the following provider parameters to the core:

                                                                                                                                                                                                                                                • \"name\" (OSSL_PROV_PARAM_NAME)

                                                                                                                                                                                                                                                  This points to a string that should give a unique name for the provider.

                                                                                                                                                                                                                                                • \"version\" (OSSL_PROV_PARAM_VERSION)

                                                                                                                                                                                                                                                  This points to a string that is a version number associated with this provider. OpenSSL in-built providers use OPENSSL_VERSION_STR, but this may be different for any third party provider. This string is for informational purposes only.

                                                                                                                                                                                                                                                • \"buildinfo\" (OSSL_PROV_PARAM_BUILDINFO)

                                                                                                                                                                                                                                                  This points to a string that is a build information associated with this provider. OpenSSL in-built providers use OPENSSL_FULL_VERSION_STR, but this may be different for any third party provider.

                                                                                                                                                                                                                                                • \"status\" (OSSL_PROV_PARAM_STATUS) <unsigned integer>

                                                                                                                                                                                                                                                  This returns 0 if the provider has entered an error state, otherwise it returns 1.

                                                                                                                                                                                                                                                • provider_gettable_params() should return the above parameters.

                                                                                                                                                                                                                                                  "},{"location":"man7/provider-base/#core-parameters","title":"Core parameters","text":"

                                                                                                                                                                                                                                                  core_get_params() can retrieve the following core parameters for each provider:

                                                                                                                                                                                                                                                  • \"openssl-version\" (OSSL_PROV_PARAM_CORE_VERSION)

                                                                                                                                                                                                                                                    This points to the OpenSSL libraries' full version string, i.e. the string expanded from the macro OPENSSL_VERSION_STR.

                                                                                                                                                                                                                                                  • \"provider-name\" (OSSL_PROV_PARAM_CORE_PROV_NAME)

                                                                                                                                                                                                                                                    This points to the OpenSSL libraries' idea of what the calling provider is named.

                                                                                                                                                                                                                                                  • \"module-filename\" (OSSL_PROV_PARAM_CORE_MODULE_FILENAME)

                                                                                                                                                                                                                                                    This points to a string containing the full filename of the providers module file.

                                                                                                                                                                                                                                                    Additionally, provider specific configuration parameters from the config file are available, in dotted name form. The dotted name form is a concatenation of section names and final config command name separated by periods.

                                                                                                                                                                                                                                                    For example, let's say we have the following config example:

                                                                                                                                                                                                                                                    config_diagnostics = 1\nopenssl_conf = openssl_init\n\n[openssl_init]\nproviders = providers_sect\n\n[providers_sect]\nfoo = foo_sect\n\n[foo_sect]\nactivate = 1\ndata1 = 2\ndata2 = str\nmore = foo_more\n\n[foo_more]\ndata3 = foo,bar\n

                                                                                                                                                                                                                                                    The provider will have these additional parameters available:

                                                                                                                                                                                                                                                    • \"activate\"

                                                                                                                                                                                                                                                      pointing at the string \"1\"

                                                                                                                                                                                                                                                    • \"data1\"

                                                                                                                                                                                                                                                      pointing at the string \"2\"

                                                                                                                                                                                                                                                    • \"data2\"

                                                                                                                                                                                                                                                      pointing at the string \"str\"

                                                                                                                                                                                                                                                    • \"more.data3\"

                                                                                                                                                                                                                                                      pointing at the string \"foo,bar\"

                                                                                                                                                                                                                                                    For more information on handling parameters, see OSSL_PARAM(3) as OSSL_PARAM_int(3).

                                                                                                                                                                                                                                                    "},{"location":"man7/provider-base/#capabilities","title":"CAPABILITIES","text":"

                                                                                                                                                                                                                                                    Capabilities describe some of the services that a provider can offer. Applications can query the capabilities to discover those services.

                                                                                                                                                                                                                                                    "},{"location":"man7/provider-base/#tls-group-capability","title":"\"TLS-GROUP\" Capability","text":"

                                                                                                                                                                                                                                                    The \"TLS-GROUP\" capability can be queried by libssl to discover the list of TLS groups that a provider can support. Each group supported can be used for key exchange (KEX) or key encapsulation method (KEM) during a TLS handshake. TLS clients can advertise the list of TLS groups they support in the supported_groups extension, and TLS servers can select a group from the offered list that they also support. In this way a provider can add to the list of groups that libssl already supports with additional ones.

                                                                                                                                                                                                                                                    Each TLS group that a provider supports should be described via the callback passed in through the provider_get_capabilities function. Each group should have the following details supplied (all are mandatory, except OSSL_CAPABILITY_TLS_GROUP_IS_KEM):

                                                                                                                                                                                                                                                    • \"tls-group-name\" (OSSL_CAPABILITY_TLS_GROUP_NAME)

                                                                                                                                                                                                                                                      The name of the group as given in the IANA TLS Supported Groups registry https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8.

                                                                                                                                                                                                                                                    • \"tls-group-name-internal\" (OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL)

                                                                                                                                                                                                                                                      The name of the group as known by the provider. This could be the same as the \"tls-group-name\", but does not have to be.

                                                                                                                                                                                                                                                    • \"tls-group-id\" (OSSL_CAPABILITY_TLS_GROUP_ID) <unsigned integer>

                                                                                                                                                                                                                                                      The TLS group id value as given in the IANA TLS Supported Groups registry.

                                                                                                                                                                                                                                                    • \"tls-group-alg\" (OSSL_CAPABILITY_TLS_GROUP_ALG)

                                                                                                                                                                                                                                                      The name of a Key Management algorithm that the provider offers and that should be used with this group. Keys created should be able to support key exchange or key encapsulation method (KEM), as implied by the optional OSSL_CAPABILITY_TLS_GROUP_IS_KEM flag. The algorithm must support key and parameter generation as well as the key/parameter generation parameter, OSSL_PKEY_PARAM_GROUP_NAME. The group name given via \"tls-group-name-internal\" above will be passed via OSSL_PKEY_PARAM_GROUP_NAME when libssl wishes to generate keys/parameters.

                                                                                                                                                                                                                                                    • \"tls-group-sec-bits\" (OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS) <unsigned integer>

                                                                                                                                                                                                                                                      The number of bits of security offered by keys in this group. The number of bits should be comparable with the ones given in table 2 and 3 of the NIST SP800-57 document.

                                                                                                                                                                                                                                                    • \"tls-group-is-kem\" (OSSL_CAPABILITY_TLS_GROUP_IS_KEM) <unsigned integer>

                                                                                                                                                                                                                                                      Boolean flag to describe if the group should be used in key exchange (KEX) mode (0, default) or in key encapsulation method (KEM) mode (1).

                                                                                                                                                                                                                                                      This parameter is optional: if not specified, KEX mode is assumed as the default mode for the group.

                                                                                                                                                                                                                                                      In KEX mode, in a typical Diffie-Hellman fashion, both sides execute keygen then derive against the peer public key. To operate in KEX mode, the group implementation must support the provider functions as described in provider-keyexch(7).

                                                                                                                                                                                                                                                      In KEM mode, the client executes keygen and sends its public key, the server executes encapsulate using the client's public key and sends back the resulting ciphertext, finally the client executes decapsulate to retrieve the same shared secret generated by the server's encapsulate. To operate in KEM mode, the group implementation must support the provider functions as described in provider-kem(7).

                                                                                                                                                                                                                                                      Both in KEX and KEM mode, the resulting shared secret is then used according to the protocol specification.

                                                                                                                                                                                                                                                    • \"tls-min-tls\" (OSSL_CAPABILITY_TLS_GROUP_MIN_TLS) <integer>

                                                                                                                                                                                                                                                    • \"tls-max-tls\" (OSSL_CAPABILITY_TLS_GROUP_MAX_TLS) <integer>
                                                                                                                                                                                                                                                    • \"tls-min-dtls\" (OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS) <integer>
                                                                                                                                                                                                                                                    • \"tls-max-dtls\" (OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS) <integer>

                                                                                                                                                                                                                                                      These parameters can be used to describe the minimum and maximum TLS and DTLS versions supported by the group. The values equate to the on-the-wire encoding of the various TLS versions. For example TLSv1.3 is 0x0304 (772 decimal), and TLSv1.2 is 0x0303 (771 decimal). A 0 indicates that there is no defined minimum or maximum. A -1 indicates that the group should not be used in that protocol.

                                                                                                                                                                                                                                                    • "},{"location":"man7/provider-base/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                                      The core_obj_create() and core_obj_add_sigid() functions were not thread safe in OpenSSL 3.0.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-base/#examples","title":"EXAMPLES","text":"

                                                                                                                                                                                                                                                      This is an example of a simple provider made available as a dynamically loadable module. It implements the fictitious algorithm FOO for the fictitious operation BAR.

                                                                                                                                                                                                                                                      #include <malloc.h>\n#include <openssl/core.h>\n#include <openssl/core_dispatch.h>\n\n/* Errors used in this provider */\n#define E_MALLOC       1\n\nstatic const OSSL_ITEM reasons[] = {\n    { E_MALLOC, \"memory allocation failure\" }.\n    { 0, NULL } /* Termination */\n};\n\n/*\n * To ensure we get the function signature right, forward declare\n * them using function types provided by openssl/core_dispatch.h\n */\nOSSL_FUNC_bar_newctx_fn foo_newctx;\nOSSL_FUNC_bar_freectx_fn foo_freectx;\nOSSL_FUNC_bar_init_fn foo_init;\nOSSL_FUNC_bar_update_fn foo_update;\nOSSL_FUNC_bar_final_fn foo_final;\n\nOSSL_FUNC_provider_query_operation_fn p_query;\nOSSL_FUNC_provider_get_reason_strings_fn p_reasons;\nOSSL_FUNC_provider_teardown_fn p_teardown;\n\nOSSL_provider_init_fn OSSL_provider_init;\n\nOSSL_FUNC_core_put_error *c_put_error = NULL;\n\n/* Provider context */\nstruct prov_ctx_st {\n    OSSL_CORE_HANDLE *handle;\n}\n\n/* operation context for the algorithm FOO */\nstruct foo_ctx_st {\n    struct prov_ctx_st *provctx;\n    int b;\n};\n\nstatic void *foo_newctx(void *provctx)\n{\n    struct foo_ctx_st *fooctx = malloc(sizeof(*fooctx));\n\n    if (fooctx != NULL)\n        fooctx->provctx = provctx;\n    else\n        c_put_error(provctx->handle, E_MALLOC, __FILE__, __LINE__);\n    return fooctx;\n}\n\nstatic void foo_freectx(void *fooctx)\n{\n    free(fooctx);\n}\n\nstatic int foo_init(void *vfooctx)\n{\n    struct foo_ctx_st *fooctx = vfooctx;\n\n    fooctx->b = 0x33;\n}\n\nstatic int foo_update(void *vfooctx, unsigned char *in, size_t inl)\n{\n    struct foo_ctx_st *fooctx = vfooctx;\n\n    /* did you expect something serious? */\n    if (inl == 0)\n        return 1;\n    for (; inl-- > 0; in++)\n        *in ^= fooctx->b;\n    return 1;\n}\n\nstatic int foo_final(void *vfooctx)\n{\n    struct foo_ctx_st *fooctx = vfooctx;\n\n    fooctx->b = 0x66;\n}\n\nstatic const OSSL_DISPATCH foo_fns[] = {\n    { OSSL_FUNC_BAR_NEWCTX, (void (*)(void))foo_newctx },\n    { OSSL_FUNC_BAR_FREECTX, (void (*)(void))foo_freectx },\n    { OSSL_FUNC_BAR_INIT, (void (*)(void))foo_init },\n    { OSSL_FUNC_BAR_UPDATE, (void (*)(void))foo_update },\n    { OSSL_FUNC_BAR_FINAL, (void (*)(void))foo_final },\n    { 0, NULL }\n};\n\nstatic const OSSL_ALGORITHM bars[] = {\n    { \"FOO\", \"provider=chumbawamba\", foo_fns },\n    { NULL, NULL, NULL }\n};\n\nstatic const OSSL_ALGORITHM *p_query(void *provctx, int operation_id,\n                                     int *no_store)\n{\n    switch (operation_id) {\n    case OSSL_OP_BAR:\n        return bars;\n    }\n    return NULL;\n}\n\nstatic const OSSL_ITEM *p_reasons(void *provctx)\n{\n    return reasons;\n}\n\nstatic void p_teardown(void *provctx)\n{\n    free(provctx);\n}\n\nstatic const OSSL_DISPATCH prov_fns[] = {\n    { OSSL_FUNC_PROVIDER_TEARDOWN, (void (*)(void))p_teardown },\n    { OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))p_query },\n    { OSSL_FUNC_PROVIDER_GET_REASON_STRINGS, (void (*)(void))p_reasons },\n    { 0, NULL }\n};\n\nint OSSL_provider_init(const OSSL_CORE_HANDLE *handle,\n                       const OSSL_DISPATCH *in,\n                       const OSSL_DISPATCH **out,\n                       void **provctx)\n{\n    struct prov_ctx_st *pctx = NULL;\n\n    for (; in->function_id != 0; in++)\n        switch (in->function_id) {\n        case OSSL_FUNC_CORE_PUT_ERROR:\n            c_put_error = OSSL_FUNC_core_put_error(in);\n            break;\n        }\n\n    *out = prov_fns;\n\n    if ((pctx = malloc(sizeof(*pctx))) == NULL) {\n        /*\n         * ALEA IACTA EST, if the core retrieves the reason table\n         * regardless, that string will be displayed, otherwise not.\n         */\n        c_put_error(handle, E_MALLOC, __FILE__, __LINE__);\n        return 0;\n    }\n    pctx->handle = handle;\n    return 1;\n}\n

                                                                                                                                                                                                                                                      This relies on a few things existing in openssl/core_dispatch.h:

                                                                                                                                                                                                                                                      #define OSSL_OP_BAR            4711\n\n#define OSSL_FUNC_BAR_NEWCTX      1\ntypedef void *(OSSL_FUNC_bar_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_bar_newctx(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_newctx_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_FREECTX     2\ntypedef void (OSSL_FUNC_bar_freectx_fn)(void *ctx);\nstatic ossl_inline OSSL_FUNC_bar_freectx(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_freectx_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_INIT        3\ntypedef void *(OSSL_FUNC_bar_init_fn)(void *ctx);\nstatic ossl_inline OSSL_FUNC_bar_init(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_init_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_UPDATE      4\ntypedef void *(OSSL_FUNC_bar_update_fn)(void *ctx,\n                                      unsigned char *in, size_t inl);\nstatic ossl_inline OSSL_FUNC_bar_update(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_update_fn *)opf->function; }\n\n#define OSSL_FUNC_BAR_FINAL       5\ntypedef void *(OSSL_FUNC_bar_final_fn)(void *ctx);\nstatic ossl_inline OSSL_FUNC_bar_final(const OSSL_DISPATCH *opf)\n{ return (OSSL_FUNC_bar_final_fn *)opf->function; }\n
                                                                                                                                                                                                                                                      "},{"location":"man7/provider-base/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                      provider(7)

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-base/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                      The concept of providers and everything surrounding them was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-base/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                      Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/","title":"provider-cipher","text":""},{"location":"man7/provider-cipher/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                      provider-cipher - The cipher library <-> provider functions

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                      #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_cipher_newctx(void *provctx);\nvoid OSSL_FUNC_cipher_freectx(void *cctx);\nvoid *OSSL_FUNC_cipher_dupctx(void *cctx);\n\n/* Encryption/decryption */\nint OSSL_FUNC_cipher_encrypt_init(void *cctx, const unsigned char *key,\n                                  size_t keylen, const unsigned char *iv,\n                                  size_t ivlen, const OSSL_PARAM params[]);\nint OSSL_FUNC_cipher_decrypt_init(void *cctx, const unsigned char *key,\n                                  size_t keylen, const unsigned char *iv,\n                                  size_t ivlen, const OSSL_PARAM params[]);\nint OSSL_FUNC_cipher_update(void *cctx, unsigned char *out, size_t *outl,\n                            size_t outsize, const unsigned char *in, size_t inl);\nint OSSL_FUNC_cipher_final(void *cctx, unsigned char *out, size_t *outl,\n                           size_t outsize);\nint OSSL_FUNC_cipher_cipher(void *cctx, unsigned char *out, size_t *outl,\n                            size_t outsize, const unsigned char *in, size_t inl);\n\n/* Cipher parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_cipher_gettable_params(void *provctx);\n\n/* Cipher operation parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_cipher_gettable_ctx_params(void *cctx,\n                                                       void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_cipher_settable_ctx_params(void *cctx,\n                                                       void *provctx);\n\n/* Cipher parameters */\nint OSSL_FUNC_cipher_get_params(OSSL_PARAM params[]);\n\n/* Cipher operation parameters */\nint OSSL_FUNC_cipher_get_ctx_params(void *cctx, OSSL_PARAM params[]);\nint OSSL_FUNC_cipher_set_ctx_params(void *cctx, const OSSL_PARAM params[]);\n
                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                      This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                      The CIPHER operation enables providers to implement cipher algorithms and make them available to applications via the API functions EVP_EncryptInit_ex(3), EVP_EncryptUpdate(3) and EVP_EncryptFinal(3) (as well as the decrypt equivalents and other related functions).

                                                                                                                                                                                                                                                      All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                      All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_cipher_newctx() has these:

                                                                                                                                                                                                                                                      typedef void *(OSSL_FUNC_cipher_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_cipher_newctx_fn\n    OSSL_FUNC_cipher_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                      OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_newctx               OSSL_FUNC_CIPHER_NEWCTX\nOSSL_FUNC_cipher_freectx              OSSL_FUNC_CIPHER_FREECTX\nOSSL_FUNC_cipher_dupctx               OSSL_FUNC_CIPHER_DUPCTX\n\nOSSL_FUNC_cipher_encrypt_init         OSSL_FUNC_CIPHER_ENCRYPT_INIT\nOSSL_FUNC_cipher_decrypt_init         OSSL_FUNC_CIPHER_DECRYPT_INIT\nOSSL_FUNC_cipher_update               OSSL_FUNC_CIPHER_UPDATE\nOSSL_FUNC_cipher_final                OSSL_FUNC_CIPHER_FINAL\nOSSL_FUNC_cipher_cipher               OSSL_FUNC_CIPHER_CIPHER\n\nOSSL_FUNC_cipher_get_params           OSSL_FUNC_CIPHER_GET_PARAMS\nOSSL_FUNC_cipher_get_ctx_params       OSSL_FUNC_CIPHER_GET_CTX_PARAMS\nOSSL_FUNC_cipher_set_ctx_params       OSSL_FUNC_CIPHER_SET_CTX_PARAMS\n\nOSSL_FUNC_cipher_gettable_params      OSSL_FUNC_CIPHER_GETTABLE_PARAMS\nOSSL_FUNC_cipher_gettable_ctx_params  OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS\nOSSL_FUNC_cipher_settable_ctx_params  OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS\n

                                                                                                                                                                                                                                                      A cipher algorithm implementation may not implement all of these functions. In order to be a consistent set of functions there must at least be a complete set of \"encrypt\" functions, or a complete set of \"decrypt\" functions, or a single \"cipher\" function. In all cases both the OSSL_FUNC_cipher_newctx and OSSL_FUNC_cipher_freectx functions must be present. All other functions are optional.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_newctx() should create and return a pointer to a provider side structure for holding context information during a cipher operation. A pointer to this context will be passed back in a number of the other cipher operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_freectx() is passed a pointer to the provider side cipher context in the cctx parameter. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_dupctx() should duplicate the provider side cipher context in the cctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#encryptiondecryption-functions","title":"Encryption/Decryption Functions","text":"

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_encrypt_init() initialises a cipher operation for encryption given a newly created provider side cipher context in the cctx parameter. The key to be used is given in key which is keylen bytes long. The IV to be used is given in iv which is ivlen bytes long. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_cipher_set_ctx_params().

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_decrypt_init() is the same as OSSL_FUNC_cipher_encrypt_init() except that it initialises the context for a decryption operation.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_update() is called to supply data to be encrypted/decrypted as part of a previously initialised cipher operation. The cctx parameter contains a pointer to a previously initialised provider side context. OSSL_FUNC_cipher_update() should encrypt/decrypt inl bytes of data at the location pointed to by in. The encrypted data should be stored in out and the amount of data written to *outl which should not exceed outsize bytes. OSSL_FUNC_cipher_update() may be called multiple times for a single cipher operation. It is the responsibility of the cipher implementation to handle input lengths that are not multiples of the block length. In such cases a cipher implementation will typically cache partial blocks of input data until a complete block is obtained. The pointers out and in may point to the same location, in which case the encryption must be done in-place. If out and in point to different locations, the requirements of EVP_EncryptUpdate(3) and EVP_DecryptUpdate(3) guarantee that the two buffers are disjoint. Similarly, the requirements of EVP_EncryptUpdate(3) and EVP_DecryptUpdate(3) ensure that the buffer pointed to by out contains sufficient room for the operation being performed.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_final() completes an encryption or decryption started through previous OSSL_FUNC_cipher_encrypt_init() or OSSL_FUNC_cipher_decrypt_init(), and OSSL_FUNC_cipher_update() calls. The cctx parameter contains a pointer to the provider side context. Any final encryption/decryption output should be written to out and the amount of data written to *outl which should not exceed outsize bytes. The same expectations apply to outsize as documented for EVP_EncryptFinal(3) and EVP_DecryptFinal(3).

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_cipher() performs encryption/decryption using the provider side cipher context in the cctx parameter that should have been previously initialised via a call to OSSL_FUNC_cipher_encrypt_init() or OSSL_FUNC_cipher_decrypt_init(). This should call the raw underlying cipher function without any padding. This will be invoked in the provider as a result of the application calling EVP_Cipher(3). The application is responsible for ensuring that the input is a multiple of the block length. The data to be encrypted/decrypted will be in in, and it will be inl bytes in length. The output from the encryption/decryption should be stored in out and the amount of data stored should be put in *outl which should be no more than outsize bytes.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#cipher-parameters","title":"Cipher Parameters","text":"

                                                                                                                                                                                                                                                      See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_get_params() gets details of the algorithm implementation and stores them in params.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_set_ctx_params() sets cipher operation parameters for the provider side cipher context cctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_get_ctx_params() gets cipher operation details details from the given provider side cipher context cctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_gettable_params(), OSSL_FUNC_cipher_gettable_ctx_params(), and OSSL_FUNC_cipher_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_cipher_get_params(), OSSL_FUNC_cipher_get_ctx_params(), and OSSL_FUNC_cipher_set_ctx_params() can handle, respectively. OSSL_FUNC_cipher_gettable_ctx_params() and OSSL_FUNC_cipher_settable_ctx_params() will return the parameters associated with the provider side context cctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                                                                                                                                                      Parameters currently recognised by built-in ciphers are listed in \"PARAMETERS\" in EVP_EncryptInit(3). Not all parameters are relevant to, or are understood by all ciphers.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_newctx() and OSSL_FUNC_cipher_dupctx() should return the newly created provider side cipher context, or NULL on failure.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_encrypt_init(), OSSL_FUNC_cipher_decrypt_init(), OSSL_FUNC_cipher_update(), OSSL_FUNC_cipher_final(), OSSL_FUNC_cipher_cipher(), OSSL_FUNC_cipher_get_params(), OSSL_FUNC_cipher_get_ctx_params() and OSSL_FUNC_cipher_set_ctx_params() should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                      OSSL_FUNC_cipher_gettable_params(), OSSL_FUNC_cipher_gettable_ctx_params() and OSSL_FUNC_cipher_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                      provider(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-legacy(7), EVP_CIPHER-AES(7), EVP_CIPHER-ARIA(7), EVP_CIPHER-BLOWFISH(7), EVP_CIPHER-CAMELLIA(7), EVP_CIPHER-CAST(7), EVP_CIPHER-CHACHA(7), EVP_CIPHER-DES(7), EVP_CIPHER-IDEA(7), EVP_CIPHER-RC2(7), EVP_CIPHER-RC4(7), EVP_CIPHER-RC5(7), EVP_CIPHER-SEED(7), EVP_CIPHER-SM4(7), EVP_CIPHER-NULL(7), life_cycle-cipher(7), EVP_EncryptInit(3)

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                      The provider CIPHER interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-cipher/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                      Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/","title":"provider-decoder","text":""},{"location":"man7/provider-decoder/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                      provider-decoder - The OSSL_DECODER library <-> provider functions

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                      #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Decoder parameter accessor and descriptor */\nconst OSSL_PARAM *OSSL_FUNC_decoder_gettable_params(void *provctx);\nint OSSL_FUNC_decoder_get_params(OSSL_PARAM params[]);\n\n/* Functions to construct / destruct / manipulate the decoder context */\nvoid *OSSL_FUNC_decoder_newctx(void *provctx);\nvoid OSSL_FUNC_decoder_freectx(void *ctx);\nconst OSSL_PARAM *OSSL_FUNC_decoder_settable_ctx_params(void *provctx);\nint OSSL_FUNC_decoder_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\n\n/* Functions to check selection support */\nint OSSL_FUNC_decoder_does_selection(void *provctx, int selection);\n\n/* Functions to decode object data */\nint OSSL_FUNC_decoder_decode(void *ctx, OSSL_CORE_BIO *in,\n                             int selection,\n                             OSSL_CALLBACK *data_cb, void *data_cbarg,\n                             OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg);\n\n/* Functions to export a decoded object */\nint OSSL_FUNC_decoder_export_object(void *ctx,\n                                      const void *objref, size_t objref_sz,\n                                      OSSL_CALLBACK *export_cb,\n                                      void *export_cbarg);\n
                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                      The term \"decode\" is used throughout this manual. This includes but is not limited to deserialization as individual decoders can also do decoding into intermediate data formats.

                                                                                                                                                                                                                                                      The DECODER operation is a generic method to create a provider-native object reference or intermediate decoded data from an encoded form read from the given OSSL_CORE_BIO. If the caller wants to decode data from memory, it should provide a BIO_s_mem(3) BIO. The decoded data or object reference is passed along with eventual metadata to the metadata_cb as OSSL_PARAM(3) parameters.

                                                                                                                                                                                                                                                      The decoder doesn't need to know more about the OSSL_CORE_BIO pointer than being able to pass it to the appropriate BIO upcalls (see \"Core functions\" in provider-base(7)).

                                                                                                                                                                                                                                                      The DECODER implementation may be part of a chain, where data is passed from one to the next. For example, there may be an implementation to decode an object from PEM to DER, and another one that decodes DER to a provider-native object.

                                                                                                                                                                                                                                                      The last decoding step in the decoding chain is usually supposed to create a provider-native object referenced by an object reference. To import that object into a different provider the OSSL_FUNC_decoder_export_object() can be called as the final step of the decoding process.

                                                                                                                                                                                                                                                      All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                      All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_decoder_decode() has these:

                                                                                                                                                                                                                                                      typedef int\n    (OSSL_FUNC_decoder_decode_fn)(void *ctx, OSSL_CORE_BIO *in,\n                                  int selection,\n                                  OSSL_CALLBACK *data_cb, void *data_cbarg,\n                                  OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg);\nstatic ossl_inline OSSL_FUNC_decoder_decode_fn*\n    OSSL_FUNC_decoder_decode(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                      OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_get_params          OSSL_FUNC_DECODER_GET_PARAMS\nOSSL_FUNC_decoder_gettable_params     OSSL_FUNC_DECODER_GETTABLE_PARAMS\n\nOSSL_FUNC_decoder_newctx              OSSL_FUNC_DECODER_NEWCTX\nOSSL_FUNC_decoder_freectx             OSSL_FUNC_DECODER_FREECTX\nOSSL_FUNC_decoder_set_ctx_params      OSSL_FUNC_DECODER_SET_CTX_PARAMS\nOSSL_FUNC_decoder_settable_ctx_params OSSL_FUNC_DECODER_SETTABLE_CTX_PARAMS\n\nOSSL_FUNC_decoder_does_selection      OSSL_FUNC_DECODER_DOES_SELECTION\n\nOSSL_FUNC_decoder_decode              OSSL_FUNC_DECODER_DECODE\n\nOSSL_FUNC_decoder_export_object       OSSL_FUNC_DECODER_EXPORT_OBJECT\n
                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#names-and-properties","title":"Names and properties","text":"

                                                                                                                                                                                                                                                      The name of an implementation should match the target type of object it decodes. For example, an implementation that decodes an RSA key should be named \"RSA\". Likewise, an implementation that decodes DER data from PEM input should be named \"DER\".

                                                                                                                                                                                                                                                      Properties can be used to further specify details about an implementation:

                                                                                                                                                                                                                                                      • input

                                                                                                                                                                                                                                                        This property is used to specify what format of input the implementation can decode.

                                                                                                                                                                                                                                                        This property is mandatory.

                                                                                                                                                                                                                                                        OpenSSL providers recognize the following input types:

                                                                                                                                                                                                                                                        • pem

                                                                                                                                                                                                                                                          An implementation with that input type decodes PEM formatted data.

                                                                                                                                                                                                                                                        • der

                                                                                                                                                                                                                                                          An implementation with that input type decodes DER formatted data.

                                                                                                                                                                                                                                                        • msblob

                                                                                                                                                                                                                                                          An implementation with that input type decodes MSBLOB formatted data.

                                                                                                                                                                                                                                                        • pvk

                                                                                                                                                                                                                                                          An implementation with that input type decodes PVK formatted data.

                                                                                                                                                                                                                                                      • structure

                                                                                                                                                                                                                                                        This property is used to specify the structure that the decoded data is expected to have.

                                                                                                                                                                                                                                                        This property is optional.

                                                                                                                                                                                                                                                        Structures currently recognised by built-in decoders:

                                                                                                                                                                                                                                                        • \"type-specific\"

                                                                                                                                                                                                                                                          Type specific structure.

                                                                                                                                                                                                                                                        • \"pkcs8\"

                                                                                                                                                                                                                                                          Structure according to the PKCS#8 specification.

                                                                                                                                                                                                                                                        • \"SubjectPublicKeyInfo\"

                                                                                                                                                                                                                                                          Encoding of public keys according to the Subject Public Key Info of RFC 5280.

                                                                                                                                                                                                                                                      The possible values of both these properties is open ended. A provider may very well specify input types and structures that libcrypto doesn't know anything about.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#subset-selections","title":"Subset selections","text":"

                                                                                                                                                                                                                                                      Sometimes, an object has more than one subset of data that is interesting to treat separately or together. It's possible to specify what subsets are to be decoded, with a set of bits selection that are passed in an int.

                                                                                                                                                                                                                                                      This set of bits depend entirely on what kind of provider-side object is to be decoded. For example, those bits are assumed to be the same as those used with provider-keymgmt(7) (see \"Key Objects\" in provider-keymgmt(7)) when the object is an asymmetric keypair - e.g., OSSL_KEYMGMT_SELECT_PRIVATE_KEY if the object to be decoded is supposed to contain private key components.

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_does_selection() should tell if a particular implementation supports any of the combinations given by selection.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#context-functions","title":"Context functions","text":"

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_newctx() returns a context to be used with the rest of the functions.

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_freectx() frees the given ctx as created by OSSL_FUNC_decoder_newctx().

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_set_ctx_params() sets context data according to parameters from params that it recognises. Unrecognised parameters should be ignored. Passing NULL for params should return true.

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_settable_ctx_params() returns a constant OSSL_PARAM(3) array describing the parameters that OSSL_FUNC_decoder_set_ctx_params() can handle.

                                                                                                                                                                                                                                                      See OSSL_PARAM(3) for further details on the parameters structure used by OSSL_FUNC_decoder_set_ctx_params() and OSSL_FUNC_decoder_settable_ctx_params().

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#export-function","title":"Export function","text":"

                                                                                                                                                                                                                                                      When a provider-native object is created by a decoder it would be unsuitable for direct use with a foreign provider. The export function allows for exporting the object into that foreign provider if the foreign provider supports the type of the object and provides an import function.

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_export_object() should export the object of size objref_sz referenced by objref as an OSSL_PARAM(3) array and pass that into the export_cb as well as the given export_cbarg.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#decoding-functions","title":"Decoding functions","text":"

                                                                                                                                                                                                                                                      OSSL_FUNC_decoder_decode() should decode the data as read from the OSSL_CORE_BIO in to produce decoded data or an object to be passed as reference in an OSSL_PARAM(3) array along with possible other metadata that was decoded from the input. This OSSL_PARAM(3) array is then passed to the data_cb callback. The selection bits, if relevant, should determine what the input data should contain. The decoding functions also take an OSSL_PASSPHRASE_CALLBACK(3) function pointer along with a pointer to application data cbarg, which should be used when a pass phrase prompt is needed.

                                                                                                                                                                                                                                                      It's important to understand that the return value from this function is interpreted as follows:

                                                                                                                                                                                                                                                      • True (1)

                                                                                                                                                                                                                                                        This means \"carry on the decoding process\", and is meaningful even though this function couldn't decode the input into anything, because there may be another decoder implementation that can decode it into something.

                                                                                                                                                                                                                                                        The data_cb callback should never be called when this function can't decode the input into anything.

                                                                                                                                                                                                                                                      • False (0)

                                                                                                                                                                                                                                                        This means \"stop the decoding process\", and is meaningful when the input could be decoded into some sort of object that this function understands, but further treatment of that object results into errors that won't be possible for some other decoder implementation to get a different result.

                                                                                                                                                                                                                                                      The conditions to stop the decoding process are at the discretion of the implementation.

                                                                                                                                                                                                                                                      "},{"location":"man7/provider-decoder/#decoder-operation-parameters","title":"Decoder operation parameters","text":"

                                                                                                                                                                                                                                                      There are currently no operation parameters currently recognised by the built-in decoders.

                                                                                                                                                                                                                                                      Parameters currently recognised by the built-in pass phrase callback:

                                                                                                                                                                                                                                                      • \"info\" (OSSL_PASSPHRASE_PARAM_INFO)

                                                                                                                                                                                                                                                        A string of information that will become part of the pass phrase prompt. This could be used to give the user information on what kind of object it's being prompted for.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-decoder/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                        OSSL_FUNC_decoder_newctx() returns a pointer to a context, or NULL on failure.

                                                                                                                                                                                                                                                        OSSL_FUNC_decoder_set_ctx_params() returns 1, unless a recognised parameter was invalid or caused an error, for which 0 is returned.

                                                                                                                                                                                                                                                        OSSL_FUNC_decoder_settable_ctx_params() returns a pointer to an array of constant OSSL_PARAM(3) elements.

                                                                                                                                                                                                                                                        OSSL_FUNC_decoder_does_selection() returns 1 if the decoder implementation supports any of the selection bits, otherwise 0.

                                                                                                                                                                                                                                                        OSSL_FUNC_decoder_decode() returns 1 to signal that the decoding process should continue, or 0 to signal that it should stop.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-decoder/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                        provider(7)

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-decoder/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                        The DECODER interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-decoder/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                        Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/","title":"provider-digest","text":""},{"location":"man7/provider-digest/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                        provider-digest - The digest library <-> provider functions

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                        #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * Digests support the following function signatures in OSSL_DISPATCH arrays.\n * (The function signatures are not actual functions).\n */\n\n/* Context management */\nvoid *OSSL_FUNC_digest_newctx(void *provctx);\nvoid OSSL_FUNC_digest_freectx(void *dctx);\nvoid *OSSL_FUNC_digest_dupctx(void *dctx);\n\n/* Digest generation */\nint OSSL_FUNC_digest_init(void *dctx, const OSSL_PARAM params[]);\nint OSSL_FUNC_digest_update(void *dctx, const unsigned char *in, size_t inl);\nint OSSL_FUNC_digest_final(void *dctx, unsigned char *out, size_t *outl,\n                           size_t outsz);\nint OSSL_FUNC_digest_digest(void *provctx, const unsigned char *in, size_t inl,\n                            unsigned char *out, size_t *outl, size_t outsz);\n\n/* Digest parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_digest_gettable_params(void *provctx);\n\n/* Digest operation parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_digest_gettable_ctx_params(void *dctx,\n                                                       void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_digest_settable_ctx_params(void *dctx,\n                                                       void *provctx);\n\n/* Digest parameters */\nint OSSL_FUNC_digest_get_params(OSSL_PARAM params[]);\n\n/* Digest operation parameters */\nint OSSL_FUNC_digest_set_ctx_params(void *dctx, const OSSL_PARAM params[]);\nint OSSL_FUNC_digest_get_ctx_params(void *dctx, OSSL_PARAM params[]);\n
                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                        This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                        The DIGEST operation enables providers to implement digest algorithms and make them available to applications via the API functions EVP_DigestInit_ex(3), EVP_DigestUpdate(3) and EVP_DigestFinal(3) (and other related functions).

                                                                                                                                                                                                                                                        All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                        All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_digest_newctx() has these:

                                                                                                                                                                                                                                                        typedef void *(OSSL_FUNC_digest_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_digest_newctx_fn\n    OSSL_FUNC_digest_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                        OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_newctx               OSSL_FUNC_DIGEST_NEWCTX\nOSSL_FUNC_digest_freectx              OSSL_FUNC_DIGEST_FREECTX\nOSSL_FUNC_digest_dupctx               OSSL_FUNC_DIGEST_DUPCTX\n\nOSSL_FUNC_digest_init                 OSSL_FUNC_DIGEST_INIT\nOSSL_FUNC_digest_update               OSSL_FUNC_DIGEST_UPDATE\nOSSL_FUNC_digest_final                OSSL_FUNC_DIGEST_FINAL\nOSSL_FUNC_digest_digest               OSSL_FUNC_DIGEST_DIGEST\n\nOSSL_FUNC_digest_get_params           OSSL_FUNC_DIGEST_GET_PARAMS\nOSSL_FUNC_digest_get_ctx_params       OSSL_FUNC_DIGEST_GET_CTX_PARAMS\nOSSL_FUNC_digest_set_ctx_params       OSSL_FUNC_DIGEST_SET_CTX_PARAMS\n\nOSSL_FUNC_digest_gettable_params      OSSL_FUNC_DIGEST_GETTABLE_PARAMS\nOSSL_FUNC_digest_gettable_ctx_params  OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS\nOSSL_FUNC_digest_settable_ctx_params  OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS\n

                                                                                                                                                                                                                                                        A digest algorithm implementation may not implement all of these functions. In order to be usable all or none of OSSL_FUNC_digest_newctx, OSSL_FUNC_digest_freectx, OSSL_FUNC_digest_init, OSSL_FUNC_digest_update and OSSL_FUNC_digest_final should be implemented. All other functions are optional.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_newctx() should create and return a pointer to a provider side structure for holding context information during a digest operation. A pointer to this context will be passed back in a number of the other digest operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_freectx() is passed a pointer to the provider side digest context in the dctx parameter. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_dupctx() should duplicate the provider side digest context in the dctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#digest-generation-functions","title":"Digest Generation Functions","text":"

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_init() initialises a digest operation given a newly created provider side digest context in the dctx parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_digest_set_ctx_params().

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_update() is called to supply data to be digested as part of a previously initialised digest operation. The dctx parameter contains a pointer to a previously initialised provider side context. OSSL_FUNC_digest_update() should digest inl bytes of data at the location pointed to by in. OSSL_FUNC_digest_update() may be called multiple times for a single digest operation.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_final() generates a digest started through previous OSSL_FUNC_digest_init() and OSSL_FUNC_digest_update() calls. The dctx parameter contains a pointer to the provider side context. The digest should be written to *out and the length of the digest to *outl. The digest should not exceed outsz bytes.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_digest() is a \"oneshot\" digest function. No provider side digest context is used. Instead the provider context that was created during provider initialisation is passed in the provctx parameter (see provider(7)). inl bytes at in should be digested and the result should be stored at out. The length of the digest should be stored in *outl which should not exceed outsz bytes.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#digest-parameters","title":"Digest Parameters","text":"

                                                                                                                                                                                                                                                        See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_get_params() gets details of the algorithm implementation and stores them in params.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_set_ctx_params() sets digest operation parameters for the provider side digest context dctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_get_ctx_params() gets digest operation details details from the given provider side digest context dctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_gettable_params() returns a constant OSSL_PARAM(3) array containing descriptors of the parameters that OSSL_FUNC_digest_get_params() can handle.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_gettable_ctx_params() and OSSL_FUNC_digest_settable_ctx_params() both return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_digest_get_ctx_params() and OSSL_FUNC_digest_set_ctx_params() can handle, respectively. The array is based on the current state of the provider side context if dctx is not NULL and on the provider side algorithm provctx otherwise.

                                                                                                                                                                                                                                                        Parameters currently recognised by built-in digests with this function are as follows. Not all parameters are relevant to, or are understood by all digests:

                                                                                                                                                                                                                                                        • \"blocksize\" (OSSL_DIGEST_PARAM_BLOCK_SIZE) <unsigned integer>

                                                                                                                                                                                                                                                          The digest block size. The length of the \"blocksize\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                                                                        • \"size\" (OSSL_DIGEST_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                                                                          The digest output size. The length of the \"size\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                                                                        • \"flags\" (OSSL_DIGEST_PARAM_FLAGS) <unsigned integer>

                                                                                                                                                                                                                                                          Diverse flags that describe exceptional behaviour for the digest:

                                                                                                                                                                                                                                                          • EVP_MD_FLAG_ONESHOT

                                                                                                                                                                                                                                                            This digest method can only handle one block of input.

                                                                                                                                                                                                                                                          • EVP_MD_FLAG_XOF

                                                                                                                                                                                                                                                            This digest method is an extensible-output function (XOF) and supports setting the OSSL_DIGEST_PARAM_XOFLEN parameter.

                                                                                                                                                                                                                                                          • EVP_MD_FLAG_DIGALGID_NULL

                                                                                                                                                                                                                                                            When setting up a DigestAlgorithmIdentifier, this flag will have the parameter set to NULL by default. Use this for PKCS#1. Note: if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override.

                                                                                                                                                                                                                                                          • EVP_MD_FLAG_DIGALGID_ABSENT

                                                                                                                                                                                                                                                            When setting up a DigestAlgorithmIdentifier, this flag will have the parameter be left absent by default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.

                                                                                                                                                                                                                                                          • EVP_MD_FLAG_DIGALGID_CUSTOM

                                                                                                                                                                                                                                                            Custom DigestAlgorithmIdentifier handling via ctrl, with EVP_MD_FLAG_DIGALGID_ABSENT as default. Note: if combined with EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden. Currently unused.

                                                                                                                                                                                                                                                          The length of the \"flags\" parameter should equal that of an unsigned long int.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#digest-context-parameters","title":"Digest Context Parameters","text":"

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_set_ctx_params() sets digest parameters associated with the given provider side digest context dctx to params. Any parameter settings are additional to any that were previously set. See OSSL_PARAM(3) for further details on the parameters structure.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_get_ctx_params() gets details of currently set parameters values associated with the give provider side digest context dctx and stores them in params. See OSSL_PARAM(3) for further details on the parameters structure.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_newctx() and OSSL_FUNC_digest_dupctx() should return the newly created provider side digest context, or NULL on failure.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_init(), OSSL_FUNC_digest_update(), OSSL_FUNC_digest_final(), OSSL_FUNC_digest_digest(), OSSL_FUNC_digest_set_params() and OSSL_FUNC_digest_get_params() should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_size() should return the digest size.

                                                                                                                                                                                                                                                        OSSL_FUNC_digest_block_size() should return the block size of the underlying digest algorithm.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#bugs","title":"BUGS","text":"

                                                                                                                                                                                                                                                        The EVP_Q_digest(), EVP_Digest() and EVP_DigestFinal_ex() API calls do not expect the digest size to be larger than EVP_MAX_MD_SIZE. Any algorithm which produces larger digests is unusable with those API calls.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                        provider(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7), OSSL_PROVIDER-legacy(7), EVP_MD-common(7), EVP_MD-BLAKE2(7), EVP_MD-MD2(7), EVP_MD-MD4(7), EVP_MD-MD5(7), EVP_MD-MD5-SHA1(7), EVP_MD-MDC2(7), EVP_MD-RIPEMD160(7), EVP_MD-SHA1(7), EVP_MD-SHA2(7), EVP_MD-SHA3(7), EVP_MD-SHAKE(7), EVP_MD-SM3(7), EVP_MD-WHIRLPOOL(7), EVP_MD-NULL(7), life_cycle-digest(7), EVP_DigestInit(3)

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                        The provider DIGEST interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-digest/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                        Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/","title":"provider-encoder","text":""},{"location":"man7/provider-encoder/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                        provider-encoder - The OSSL_ENCODER library <-> provider functions

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                        #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Encoder parameter accessor and descriptor */\nconst OSSL_PARAM *OSSL_FUNC_encoder_gettable_params(void *provctx);\nint OSSL_FUNC_encoder_get_params(OSSL_PARAM params[]);\n\n/* Functions to construct / destruct / manipulate the encoder context */\nvoid *OSSL_FUNC_encoder_newctx(void *provctx);\nvoid OSSL_FUNC_encoder_freectx(void *ctx);\nint OSSL_FUNC_encoder_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_encoder_settable_ctx_params(void *provctx);\n\n/* Functions to check selection support */\nint OSSL_FUNC_encoder_does_selection(void *provctx, int selection);\n\n/* Functions to encode object data */\nint OSSL_FUNC_encoder_encode(void *ctx, OSSL_CORE_BIO *out,\n                             const void *obj_raw,\n                             const OSSL_PARAM obj_abstract[],\n                             int selection,\n                             OSSL_PASSPHRASE_CALLBACK *cb,\n                             void *cbarg);\n\n/* Functions to import and free a temporary object to be encoded */\nvoid *OSSL_FUNC_encoder_import_object(void *ctx, int selection,\n                                      const OSSL_PARAM params[]);\nvoid OSSL_FUNC_encoder_free_object(void *obj);\n
                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                        We use the wide term \"encode\" in this manual. This includes but is not limited to serialization.

                                                                                                                                                                                                                                                        The ENCODER operation is a generic method to encode a provider-native object (obj_raw) or an object abstraction (object_abstract, see provider-object(7)) into an encoded form, and write the result to the given OSSL_CORE_BIO. If the caller wants to get the encoded stream to memory, it should provide a BIO_s_mem(3) BIO.

                                                                                                                                                                                                                                                        The encoder doesn't need to know more about the OSSL_CORE_BIO pointer than being able to pass it to the appropriate BIO upcalls (see \"Core functions\" in provider-base(7)).

                                                                                                                                                                                                                                                        The ENCODER implementation may be part of a chain, where data is passed from one to the next. For example, there may be an implementation to encode an object to DER (that object is assumed to be provider-native and thereby passed via obj_raw), and another one that encodes DER to PEM (that one would receive the DER encoding via obj_abstract).

                                                                                                                                                                                                                                                        The encoding using the OSSL_PARAM(3) array form allows a encoder to be used for data that's been exported from another provider, and thereby allow them to exist independently of each other.

                                                                                                                                                                                                                                                        The encoding using a provider side object can only be safely used with provider data coming from the same provider, for example keys with the KEYMGMT provider.

                                                                                                                                                                                                                                                        All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                        All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_encoder_encode() has these:

                                                                                                                                                                                                                                                        typedef int\n    (OSSL_FUNC_encoder_encode_fn)(void *ctx, OSSL_CORE_BIO *out,\n                                  const void *obj_raw,\n                                  const OSSL_PARAM obj_abstract[],\n                                  int selection,\n                                  OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg);\nstatic ossl_inline OSSL_FUNC_encoder_encode_fn\n    OSSL_FUNC_encoder_encode(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                        OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_get_params          OSSL_FUNC_ENCODER_GET_PARAMS\nOSSL_FUNC_encoder_gettable_params     OSSL_FUNC_ENCODER_GETTABLE_PARAMS\n\nOSSL_FUNC_encoder_newctx              OSSL_FUNC_ENCODER_NEWCTX\nOSSL_FUNC_encoder_freectx             OSSL_FUNC_ENCODER_FREECTX\nOSSL_FUNC_encoder_set_ctx_params      OSSL_FUNC_ENCODER_SET_CTX_PARAMS\nOSSL_FUNC_encoder_settable_ctx_params OSSL_FUNC_ENCODER_SETTABLE_CTX_PARAMS\n\nOSSL_FUNC_encoder_does_selection      OSSL_FUNC_ENCODER_DOES_SELECTION\n\nOSSL_FUNC_encoder_encode              OSSL_FUNC_ENCODER_ENCODE\n\nOSSL_FUNC_encoder_import_object       OSSL_FUNC_ENCODER_IMPORT_OBJECT\nOSSL_FUNC_encoder_free_object         OSSL_FUNC_ENCODER_FREE_OBJECT\n
                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#names-and-properties","title":"Names and properties","text":"

                                                                                                                                                                                                                                                        The name of an implementation should match the type of object it handles. For example, an implementation that encodes an RSA key should be named \"RSA\". Likewise, an implementation that further encodes DER should be named \"DER\".

                                                                                                                                                                                                                                                        Properties can be used to further specify details about an implementation:

                                                                                                                                                                                                                                                        • output

                                                                                                                                                                                                                                                          This property is used to specify what type of output the implementation produces.

                                                                                                                                                                                                                                                          This property is mandatory.

                                                                                                                                                                                                                                                          OpenSSL providers recognize the following output types:

                                                                                                                                                                                                                                                          • text

                                                                                                                                                                                                                                                            An implementation with that output type outputs human readable text, making that implementation suitable for -text output in diverse openssl(1) commands.

                                                                                                                                                                                                                                                          • pem

                                                                                                                                                                                                                                                            An implementation with that output type outputs PEM formatted data.

                                                                                                                                                                                                                                                          • der

                                                                                                                                                                                                                                                            An implementation with that output type outputs DER formatted data.

                                                                                                                                                                                                                                                          • msblob

                                                                                                                                                                                                                                                            An implementation with that output type outputs MSBLOB formatted data.

                                                                                                                                                                                                                                                          • pvk

                                                                                                                                                                                                                                                            An implementation with that output type outputs PVK formatted data.

                                                                                                                                                                                                                                                        • structure

                                                                                                                                                                                                                                                          This property is used to specify the structure that is used for the encoded object. An example could be pkcs8, to specify explicitly that an object (presumably an asymmetric key pair, in this case) will be wrapped in a PKCS#8 structure as part of the encoding.

                                                                                                                                                                                                                                                          This property is optional.

                                                                                                                                                                                                                                                        The possible values of both these properties is open ended. A provider may very well specify output types and structures that libcrypto doesn't know anything about.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#subset-selections","title":"Subset selections","text":"

                                                                                                                                                                                                                                                        Sometimes, an object has more than one subset of data that is interesting to treat separately or together. It's possible to specify what subsets are to be encoded, with a set of bits selection that are passed in an int.

                                                                                                                                                                                                                                                        This set of bits depend entirely on what kind of provider-side object is passed. For example, those bits are assumed to be the same as those used with provider-keymgmt(7) (see \"Key Objects\" in provider-keymgmt(7)) when the object is an asymmetric keypair.

                                                                                                                                                                                                                                                        ENCODER implementations are free to regard the selection as a set of hints, but must do so with care. In the end, the output must make sense, and if there's a corresponding decoder, the resulting decoded object must match the original object that was encoded.

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_does_selection() should tell if a particular implementation supports any of the combinations given by selection.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#context-functions","title":"Context functions","text":"

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_newctx() returns a context to be used with the rest of the functions.

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_freectx() frees the given ctx, if it was created by OSSL_FUNC_encoder_newctx().

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_set_ctx_params() sets context data according to parameters from params that it recognises. Unrecognised parameters should be ignored. Passing NULL for params should return true.

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_settable_ctx_params() returns a constant OSSL_PARAM(3) array describing the parameters that OSSL_FUNC_encoder_set_ctx_params() can handle.

                                                                                                                                                                                                                                                        See OSSL_PARAM(3) for further details on the parameters structure used by OSSL_FUNC_encoder_set_ctx_params() and OSSL_FUNC_encoder_settable_ctx_params().

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#import-functions","title":"Import functions","text":"

                                                                                                                                                                                                                                                        A provider-native object may be associated with a foreign provider, and may therefore be unsuitable for direct use with a given ENCODER implementation. Provided that the foreign provider's implementation to handle the object has a function to export that object in OSSL_PARAM(3) array form, the ENCODER implementation should be able to import that array and create a suitable object to be passed to OSSL_FUNC_encoder_encode()'s obj_raw.

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_import_object() should import the subset of params given with selection to create a provider-native object that can be passed as obj_raw to OSSL_FUNC_encoder_encode().

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_free_object() should free the object that was created with OSSL_FUNC_encoder_import_object().

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#encoding-functions","title":"Encoding functions","text":"

                                                                                                                                                                                                                                                        OSSL_FUNC_encoder_encode() should take a provider-native object (in obj_raw) or an object abstraction (in obj_abstract), and should output the object in encoded form to the OSSL_CORE_BIO. The selection bits, if relevant, should determine in greater detail what will be output. The encoding functions also take an OSSL_PASSPHRASE_CALLBACK(3) function pointer along with a pointer to application data cbarg, which should be used when a pass phrase prompt is needed.

                                                                                                                                                                                                                                                        "},{"location":"man7/provider-encoder/#encoder-operation-parameters","title":"Encoder operation parameters","text":"

                                                                                                                                                                                                                                                        Operation parameters currently recognised by built-in encoders are as follows:

                                                                                                                                                                                                                                                        • \"cipher\" (OSSL_ENCODER_PARAM_CIPHER)

                                                                                                                                                                                                                                                          The name of the encryption cipher to be used when generating encrypted encoding. This is used when encoding private keys, as well as other objects that need protection.

                                                                                                                                                                                                                                                          If this name is invalid for the encoding implementation, the implementation should refuse to perform the encoding, i.e. OSSL_FUNC_encoder_encode_data() and OSSL_FUNC_encoder_encode_object() should return an error.

                                                                                                                                                                                                                                                        • \"properties\" (OSSL_ENCODER_PARAM_PROPERTIES)

                                                                                                                                                                                                                                                          The properties to be queried when trying to fetch the algorithm given with the \"cipher\" parameter. This must be given together with the \"cipher\" parameter to be considered valid.

                                                                                                                                                                                                                                                          The encoding implementation isn't obligated to use this value. However, it is recommended that implementations that do not handle property strings return an error on receiving this parameter unless its value NULL or the empty string.

                                                                                                                                                                                                                                                        • \"save-parameters\" (OSSL_ENCODER_PARAM_SAVE_PARAMETERS) <integer>

                                                                                                                                                                                                                                                          If set to 0 disables saving of key domain parameters. Default is 1. It currently has an effect only on DSA keys.

                                                                                                                                                                                                                                                        • Parameters currently recognised by the built-in pass phrase callback:

                                                                                                                                                                                                                                                          • \"info\" (OSSL_PASSPHRASE_PARAM_INFO)

                                                                                                                                                                                                                                                            A string of information that will become part of the pass phrase prompt. This could be used to give the user information on what kind of object it's being prompted for.

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-encoder/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                            OSSL_FUNC_encoder_newctx() returns a pointer to a context, or NULL on failure.

                                                                                                                                                                                                                                                            OSSL_FUNC_encoder_set_ctx_params() returns 1, unless a recognised parameter was invalid or caused an error, for which 0 is returned.

                                                                                                                                                                                                                                                            OSSL_FUNC_encoder_settable_ctx_params() returns a pointer to an array of constant OSSL_PARAM(3) elements.

                                                                                                                                                                                                                                                            OSSL_FUNC_encoder_does_selection() returns 1 if the encoder implementation supports any of the selection bits, otherwise 0.

                                                                                                                                                                                                                                                            OSSL_FUNC_encoder_encode() returns 1 on success, or 0 on failure.

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-encoder/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                            provider(7)

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-encoder/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                            The ENCODER interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-encoder/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                            Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                            Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-kdf/","title":"provider-kdf","text":""},{"location":"man7/provider-kdf/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                            provider-kdf - The KDF library <-> provider functions

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-kdf/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                            #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_kdf_newctx(void *provctx);\nvoid OSSL_FUNC_kdf_freectx(void *kctx);\nvoid *OSSL_FUNC_kdf_dupctx(void *src);\n\n/* Encryption/decryption */\nint OSSL_FUNC_kdf_reset(void *kctx);\nint OSSL_FUNC_kdf_derive(void *kctx, unsigned char *key, size_t keylen,\n                         const OSSL_PARAM params[]);\n\n/* KDF parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_kdf_gettable_params(void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_kdf_gettable_ctx_params(void *kcxt, void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_kdf_settable_ctx_params(void *kcxt, void *provctx);\n\n/* KDF parameters */\nint OSSL_FUNC_kdf_get_params(OSSL_PARAM params[]);\nint OSSL_FUNC_kdf_get_ctx_params(void *kctx, OSSL_PARAM params[]);\nint OSSL_FUNC_kdf_set_ctx_params(void *kctx, const OSSL_PARAM params[]);\n
                                                                                                                                                                                                                                                            "},{"location":"man7/provider-kdf/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                            This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                            The KDF operation enables providers to implement KDF algorithms and make them available to applications via the API functions EVP_KDF_CTX_reset(3), and EVP_KDF_derive(3).

                                                                                                                                                                                                                                                            All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                            All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_kdf_newctx() has these:

                                                                                                                                                                                                                                                            typedef void *(OSSL_FUNC_kdf_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_kdf_newctx_fn\n    OSSL_FUNC_kdf_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                            OSSL_DISPATCH(3) array entries are identified by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_newctx               OSSL_FUNC_KDF_NEWCTX\nOSSL_FUNC_kdf_freectx              OSSL_FUNC_KDF_FREECTX\nOSSL_FUNC_kdf_dupctx               OSSL_FUNC_KDF_DUPCTX\n\nOSSL_FUNC_kdf_reset                OSSL_FUNC_KDF_RESET\nOSSL_FUNC_kdf_derive               OSSL_FUNC_KDF_DERIVE\n\nOSSL_FUNC_kdf_get_params           OSSL_FUNC_KDF_GET_PARAMS\nOSSL_FUNC_kdf_get_ctx_params       OSSL_FUNC_KDF_GET_CTX_PARAMS\nOSSL_FUNC_kdf_set_ctx_params       OSSL_FUNC_KDF_SET_CTX_PARAMS\n\nOSSL_FUNC_kdf_gettable_params      OSSL_FUNC_KDF_GETTABLE_PARAMS\nOSSL_FUNC_kdf_gettable_ctx_params  OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS\nOSSL_FUNC_kdf_settable_ctx_params  OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS\n

                                                                                                                                                                                                                                                            A KDF algorithm implementation may not implement all of these functions. In order to be a consistent set of functions, at least the following functions must be implemented: OSSL_FUNC_kdf_newctx(), OSSL_FUNC_kdf_freectx(), OSSL_FUNC_kdf_set_ctx_params(), OSSL_FUNC_kdf_derive(). All other functions are optional.

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-kdf/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_newctx() should create and return a pointer to a provider side structure for holding context information during a KDF operation. A pointer to this context will be passed back in a number of the other KDF operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_freectx() is passed a pointer to the provider side KDF context in the kctx parameter. If it receives NULL as kctx value, it should not do anything other than return. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_dupctx() should duplicate the provider side KDF context in the kctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-kdf/#encryptiondecryption-functions","title":"Encryption/Decryption Functions","text":"

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_reset() initialises a KDF operation given a provider side KDF context in the kctx parameter.

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_derive() performs the KDF operation after processing the params as per OSSL_FUNC_kdf_set_ctx_params(). The kctx parameter contains a pointer to the provider side context. The resulting key of the desired keylen should be written to key. If the algorithm does not support the requested keylen the function must return error.

                                                                                                                                                                                                                                                            "},{"location":"man7/provider-kdf/#kdf-parameters","title":"KDF Parameters","text":"

                                                                                                                                                                                                                                                            See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_get_params() gets details of parameter values associated with the provider algorithm and stores them in params.

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_set_ctx_params() sets KDF parameters associated with the given provider side KDF context kctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_get_ctx_params() retrieves gettable parameter values associated with the given provider side KDF context kctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                            OSSL_FUNC_kdf_gettable_params(), OSSL_FUNC_kdf_gettable_ctx_params(), and OSSL_FUNC_kdf_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_kdf_get_params(), OSSL_FUNC_kdf_get_ctx_params(), and OSSL_FUNC_kdf_set_ctx_params() can handle, respectively. OSSL_FUNC_kdf_gettable_ctx_params() and OSSL_FUNC_kdf_settable_ctx_params() will return the parameters associated with the provider side context kctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                                                                                                                                                            Parameters currently recognised by built-in KDFs are as follows. Not all parameters are relevant to, or are understood by all KDFs:

                                                                                                                                                                                                                                                            • \"size\" (OSSL_KDF_PARAM_SIZE) <unsigned integer>

                                                                                                                                                                                                                                                              Gets the output size from the associated KDF ctx. If the algorithm produces a variable amount of output, SIZE_MAX should be returned. If the input parameters required to calculate the fixed output size have not yet been supplied, 0 should be returned indicating an error.

                                                                                                                                                                                                                                                            • \"key\" (OSSL_KDF_PARAM_KEY) <octet string>

                                                                                                                                                                                                                                                              Sets the key in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"secret\" (OSSL_KDF_PARAM_SECRET) <octet string>

                                                                                                                                                                                                                                                              Sets the secret in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"pass\" (OSSL_KDF_PARAM_PASSWORD) <octet string>

                                                                                                                                                                                                                                                              Sets the password in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"cipher\" (OSSL_KDF_PARAM_CIPHER)

                                                                                                                                                                                                                                                            • \"digest\" (OSSL_KDF_PARAM_DIGEST)
                                                                                                                                                                                                                                                            • \"mac\" (OSSL_KDF_PARAM_MAC)

                                                                                                                                                                                                                                                              Sets the name of the underlying cipher, digest or MAC to be used. It must name a suitable algorithm for the KDF that's being used.

                                                                                                                                                                                                                                                            • \"maclen\" (OSSL_KDF_PARAM_MAC_SIZE) <octet string>

                                                                                                                                                                                                                                                              Sets the length of the MAC in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"properties\" (OSSL_KDF_PARAM_PROPERTIES)

                                                                                                                                                                                                                                                              Sets the properties to be queried when trying to fetch the underlying algorithm. This must be given together with the algorithm naming parameter to be considered valid.

                                                                                                                                                                                                                                                            • \"iter\" (OSSL_KDF_PARAM_ITER) <unsigned integer>

                                                                                                                                                                                                                                                              Sets the number of iterations in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"mode\" (OSSL_KDF_PARAM_MODE)

                                                                                                                                                                                                                                                              Sets the mode in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"pkcs5\" (OSSL_KDF_PARAM_PKCS5) <integer>

                                                                                                                                                                                                                                                              Enables or disables the SP800-132 compliance checks. A mode of 0 enables the compliance checks.

                                                                                                                                                                                                                                                              The checks performed are:

                                                                                                                                                                                                                                                                • the iteration count is at least 1000.
                                                                                                                                                                                                                                                                • the salt length is at least 128 bits.
                                                                                                                                                                                                                                                                • the derived key length is at least 112 bits.
                                                                                                                                                                                                                                                            • \"ukm\" (OSSL_KDF_PARAM_UKM) <octet string>

                                                                                                                                                                                                                                                              Sets an optional random string that is provided by the sender called \"partyAInfo\". In CMS this is the user keying material.

                                                                                                                                                                                                                                                            • \"cekalg\" (OSSL_KDF_PARAM_CEK_ALG)

                                                                                                                                                                                                                                                              Sets the CEK wrapping algorithm name in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"n\" (OSSL_KDF_PARAM_SCRYPT_N) <unsigned integer>

                                                                                                                                                                                                                                                              Sets the scrypt work factor parameter N in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"r\" (OSSL_KDF_PARAM_SCRYPT_R) <unsigned integer>

                                                                                                                                                                                                                                                              Sets the scrypt work factor parameter r in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"p\" (OSSL_KDF_PARAM_SCRYPT_P) <unsigned integer>

                                                                                                                                                                                                                                                              Sets the scrypt work factor parameter p in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"maxmem_bytes\" (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>

                                                                                                                                                                                                                                                              Sets the scrypt work factor parameter maxmem in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"prefix\" (OSSL_KDF_PARAM_PREFIX) <octet string>

                                                                                                                                                                                                                                                              Sets the prefix string using by the TLS 1.3 version of HKDF in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"label\" (OSSL_KDF_PARAM_LABEL) <octet string>

                                                                                                                                                                                                                                                              Sets the label string using by the TLS 1.3 version of HKDF in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"data\" (OSSL_KDF_PARAM_DATA) <octet string>

                                                                                                                                                                                                                                                              Sets the context string using by the TLS 1.3 version of HKDF in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"info\" (OSSL_KDF_PARAM_INFO) <octet string>

                                                                                                                                                                                                                                                              Sets the optional shared info in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"seed\" (OSSL_KDF_PARAM_SEED) <octet string>

                                                                                                                                                                                                                                                              Sets the IV in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"xcghash\" (OSSL_KDF_PARAM_SSHKDF_XCGHASH) <octet string>

                                                                                                                                                                                                                                                              Sets the xcghash in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"session_id\" (OSSL_KDF_PARAM_SSHKDF_SESSION_ID) <octet string>

                                                                                                                                                                                                                                                              Sets the session ID in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"type\" (OSSL_KDF_PARAM_SSHKDF_TYPE)

                                                                                                                                                                                                                                                              Sets the SSH KDF type parameter in the associated KDF ctx. There are six supported types:

                                                                                                                                                                                                                                                              • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV

                                                                                                                                                                                                                                                                The Initial IV from client to server. A single char of value 65 (ASCII char 'A').

                                                                                                                                                                                                                                                              • EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI

                                                                                                                                                                                                                                                                The Initial IV from server to client A single char of value 66 (ASCII char 'B').

                                                                                                                                                                                                                                                              • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV

                                                                                                                                                                                                                                                                The Encryption Key from client to server A single char of value 67 (ASCII char 'C').

                                                                                                                                                                                                                                                              • EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI

                                                                                                                                                                                                                                                                The Encryption Key from server to client A single char of value 68 (ASCII char 'D').

                                                                                                                                                                                                                                                              • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV

                                                                                                                                                                                                                                                                The Integrity Key from client to server A single char of value 69 (ASCII char 'E').

                                                                                                                                                                                                                                                              • EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI

                                                                                                                                                                                                                                                                The Integrity Key from client to server A single char of value 70 (ASCII char 'F').

                                                                                                                                                                                                                                                            • \"constant\" (OSSL_KDF_PARAM_CONSTANT) <octet string>

                                                                                                                                                                                                                                                              Sets the constant value in the associated KDF ctx.

                                                                                                                                                                                                                                                            • \"id\" (OSSL_KDF_PARAM_PKCS12_ID) <integer>

                                                                                                                                                                                                                                                              Sets the intended usage of the output bits in the associated KDF ctx. It is defined as per RFC 7292 section B.3.

                                                                                                                                                                                                                                                            • "},{"location":"man7/provider-kdf/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_kdf_newctx() and OSSL_FUNC_kdf_dupctx() should return the newly created provider side KDF context, or NULL on failure.

                                                                                                                                                                                                                                                              OSSL_FUNC_kdf_derive(), OSSL_FUNC_kdf_get_params(), OSSL_FUNC_kdf_get_ctx_params() and OSSL_FUNC_kdf_set_ctx_params() should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                              OSSL_FUNC_kdf_gettable_params(), OSSL_FUNC_kdf_gettable_ctx_params() and OSSL_FUNC_kdf_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kdf/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                                              The KDF life-cycle is described in life_cycle-kdf(7). Providers should ensure that the various transitions listed there are supported. At some point the EVP layer will begin enforcing the listed transitions.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kdf/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                              provider(7), life_cycle-kdf(7), EVP_KDF(3).

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kdf/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                              The provider KDF interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kdf/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/","title":"provider-kem","text":""},{"location":"man7/provider-kem/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                              provider-kem - The kem library <-> provider functions

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                              #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_kem_newctx(void *provctx);\nvoid OSSL_FUNC_kem_freectx(void *ctx);\nvoid *OSSL_FUNC_kem_dupctx(void *ctx);\n\n/* Encapsulation */\nint OSSL_FUNC_kem_encapsulate_init(void *ctx, void *provkey, const char *name,\n                                   const OSSL_PARAM params[]);\nint OSSL_FUNC_kem_encapsulate(void *ctx, unsigned char *out, size_t *outlen,\n                              unsigned char *secret, size_t *secretlen);\n\n/* Decapsulation */\nint OSSL_FUNC_kem_decapsulate_init(void *ctx, void *provkey, const char *name);\nint OSSL_FUNC_kem_decapsulate(void *ctx, unsigned char *out, size_t *outlen,\n                              const unsigned char *in, size_t inlen);\n\n/* KEM parameters */\nint OSSL_FUNC_kem_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_kem_gettable_ctx_params(void *ctx, void *provctx);\nint OSSL_FUNC_kem_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_kem_settable_ctx_params(void *ctx, void *provctx);\n
                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                              This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                              The asymmetric kem (OSSL_OP_KEM) operation enables providers to implement asymmetric kem algorithms and make them available to applications via the API functions EVP_PKEY_encapsulate(3), EVP_PKEY_decapsulate(3) and other related functions.

                                                                                                                                                                                                                                                              All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                              All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_kem_newctx() has these:

                                                                                                                                                                                                                                                              typedef void *(OSSL_FUNC_kem_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_kem_newctx_fn\n    OSSL_FUNC_kem_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                              OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_newctx               OSSL_FUNC_KEM_NEWCTX\nOSSL_FUNC_kem_freectx              OSSL_FUNC_KEM_FREECTX\nOSSL_FUNC_kem_dupctx               OSSL_FUNC_KEM_DUPCTX\n\nOSSL_FUNC_kem_encapsulate_init     OSSL_FUNC_KEM_ENCAPSULATE_INIT\nOSSL_FUNC_kem_encapsulate          OSSL_FUNC_KEM_ENCAPSULATE\n\nOSSL_FUNC_kem_decapsulate_init     OSSL_FUNC_KEM_DECAPSULATE_INIT\nOSSL_FUNC_kem_decapsulate          OSSL_FUNC_KEM_DECAPSULATE\n\nOSSL_FUNC_kem_get_ctx_params       OSSL_FUNC_KEM_GET_CTX_PARAMS\nOSSL_FUNC_kem_gettable_ctx_params  OSSL_FUNC_KEM_GETTABLE_CTX_PARAMS\nOSSL_FUNC_kem_set_ctx_params       OSSL_FUNC_KEM_SET_CTX_PARAMS\nOSSL_FUNC_kem_settable_ctx_params  OSSL_FUNC_KEM_SETTABLE_CTX_PARAMS\n

                                                                                                                                                                                                                                                              An asymmetric kem algorithm implementation may not implement all of these functions. In order to be a consistent set of functions a provider must implement OSSL_FUNC_kem_newctx and OSSL_FUNC_kem_freectx. It must also implement both of OSSL_FUNC_kem_encapsulate_init and OSSL_FUNC_kem_encapsulate, or both of OSSL_FUNC_kem_decapsulate_init and OSSL_FUNC_kem_decapsulate. OSSL_FUNC_kem_get_ctx_params is optional but if it is present then so must OSSL_FUNC_kem_gettable_ctx_params. Similarly, OSSL_FUNC_kem_set_ctx_params is optional but if it is present then so must OSSL_FUNC_kem_settable_ctx_params.

                                                                                                                                                                                                                                                              An asymmetric kem algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_newctx() should create and return a pointer to a provider side structure for holding context information during an asymmetric kem operation. A pointer to this context will be passed back in a number of the other asymmetric kem operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_freectx() is passed a pointer to the provider side asymmetric kem context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_dupctx() should duplicate the provider side asymmetric kem context in the ctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#asymmetric-key-encapsulation-functions","title":"Asymmetric Key Encapsulation Functions","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_encapsulate_init() initialises a context for an asymmetric encapsulation given a provider side asymmetric kem context in the ctx parameter, a pointer to a provider key object in the provkey parameter and the name of the algorithm. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_kem_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_encapsulate() performs the actual encapsulation itself. A previously initialised asymmetric kem context is passed in the ctx parameter. Unless out is NULL, the data to be encapsulated is internally generated, and returned into the buffer pointed to by the secret parameter and the encapsulated data should also be written to the location pointed to by the out parameter. The length of the encapsulated data should be written to *outlen and the length of the generated secret should be written to *secretlen.

                                                                                                                                                                                                                                                              If out is NULL then the maximum length of the encapsulated data should be written to *outlen, and the maximum length of the generated secret should be written to *secretlen.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#decapsulation-functions","title":"Decapsulation Functions","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_decapsulate_init() initialises a context for an asymmetric decapsulation given a provider side asymmetric kem context in the ctx parameter, a pointer to a provider key object in the provkey parameter, and a name of the algorithm. The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_decapsulate() performs the actual decapsulation itself. A previously initialised asymmetric kem context is passed in the ctx parameter. The data to be decapsulated is pointed to by the in parameter which is inlen bytes long. Unless out is NULL, the decapsulated data should be written to the location pointed to by the out parameter. The length of the decapsulated data should be written to *outlen. If out is NULL then the maximum length of the decapsulated data should be written to *outlen.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#asymmetric-key-encapsulation-parameters","title":"Asymmetric Key Encapsulation Parameters","text":"

                                                                                                                                                                                                                                                              See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_kem_get_ctx_params() and OSSL_FUNC_kem_set_ctx_params() functions.

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_get_ctx_params() gets asymmetric kem parameters associated with the given provider side asymmetric kem context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_set_ctx_params() sets the asymmetric kem parameters associated with the given provider side asymmetric kem context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                              No parameters are currently recognised by built-in asymmetric kem algorithms.

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_gettable_ctx_params() and OSSL_FUNC_kem_settable_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters, i.e. parameters that can be used with OSSL_FUNC_kem_get_ctx_params() and OSSL_FUNC_kem_set_ctx_params() respectively.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_kem_newctx() and OSSL_FUNC_kem_dupctx() should return the newly created provider side asymmetric kem context, or NULL on failure.

                                                                                                                                                                                                                                                              All other functions should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                              provider(7)

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                              The provider KEM interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-kem/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                              Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                              Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-keyexch/","title":"provider-keyexch","text":""},{"location":"man7/provider-keyexch/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                              provider-keyexch - The keyexch library <-> provider functions

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-keyexch/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                              #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_keyexch_newctx(void *provctx);\nvoid OSSL_FUNC_keyexch_freectx(void *ctx);\nvoid *OSSL_FUNC_keyexch_dupctx(void *ctx);\n\n/* Shared secret derivation */\nint OSSL_FUNC_keyexch_init(void *ctx, void *provkey,\n                           const OSSL_PARAM params[]);\nint OSSL_FUNC_keyexch_set_peer(void *ctx, void *provkey);\nint OSSL_FUNC_keyexch_derive(void *ctx, unsigned char *secret, size_t *secretlen,\n                             size_t outlen);\n\n/* Key Exchange parameters */\nint OSSL_FUNC_keyexch_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keyexch_settable_ctx_params(void *ctx,\n                                                        void *provctx);\nint OSSL_FUNC_keyexch_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keyexch_gettable_ctx_params(void *ctx,\n                                                        void *provctx);\n
                                                                                                                                                                                                                                                              "},{"location":"man7/provider-keyexch/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                              This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                              The key exchange (OSSL_OP_KEYEXCH) operation enables providers to implement key exchange algorithms and make them available to applications via EVP_PKEY_derive(3) and other related functions).

                                                                                                                                                                                                                                                              All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                              All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_keyexch_newctx() has these:

                                                                                                                                                                                                                                                              typedef void *(OSSL_FUNC_keyexch_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_keyexch_newctx_fn\n    OSSL_FUNC_keyexch_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                              OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_newctx                OSSL_FUNC_KEYEXCH_NEWCTX\nOSSL_FUNC_keyexch_freectx               OSSL_FUNC_KEYEXCH_FREECTX\nOSSL_FUNC_keyexch_dupctx                OSSL_FUNC_KEYEXCH_DUPCTX\n\nOSSL_FUNC_keyexch_init                  OSSL_FUNC_KEYEXCH_INIT\nOSSL_FUNC_keyexch_set_peer              OSSL_FUNC_KEYEXCH_SET_PEER\nOSSL_FUNC_keyexch_derive                OSSL_FUNC_KEYEXCH_DERIVE\n\nOSSL_FUNC_keyexch_set_ctx_params        OSSL_FUNC_KEYEXCH_SET_CTX_PARAMS\nOSSL_FUNC_keyexch_settable_ctx_params   OSSL_FUNC_KEYEXCH_SETTABLE_CTX_PARAMS\nOSSL_FUNC_keyexch_get_ctx_params        OSSL_FUNC_KEYEXCH_GET_CTX_PARAMS\nOSSL_FUNC_keyexch_gettable_ctx_params   OSSL_FUNC_KEYEXCH_GETTABLE_CTX_PARAMS\n

                                                                                                                                                                                                                                                              A key exchange algorithm implementation may not implement all of these functions. In order to be a consistent set of functions a provider must implement OSSL_FUNC_keyexch_newctx, OSSL_FUNC_keyexch_freectx, OSSL_FUNC_keyexch_init and OSSL_FUNC_keyexch_derive. All other functions are optional.

                                                                                                                                                                                                                                                              A key exchange algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-keyexch/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_newctx() should create and return a pointer to a provider side structure for holding context information during a key exchange operation. A pointer to this context will be passed back in a number of the other key exchange operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_freectx() is passed a pointer to the provider side key exchange context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_dupctx() should duplicate the provider side key exchange context in the ctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-keyexch/#shared-secret-derivation-functions","title":"Shared Secret Derivation Functions","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_init() initialises a key exchange operation given a provider side key exchange context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_keyexch_set_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_set_peer() is called to supply the peer's public key (in the provkey parameter) to be used when deriving the shared secret. It is also passed a previously initialised key exchange context in the ctx parameter. The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_derive() performs the actual key exchange itself by deriving a shared secret. A previously initialised key exchange context is passed in the ctx parameter. The derived secret should be written to the location secret which should not exceed outlen bytes. The length of the shared secret should be written to *secretlen. If secret is NULL then the maximum length of the shared secret should be written to *secretlen.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-keyexch/#key-exchange-parameters-functions","title":"Key Exchange Parameters Functions","text":"

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_set_ctx_params() sets key exchange parameters associated with the given provider side key exchange context ctx to params, see \"Common Key Exchange parameters\". Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_get_ctx_params() gets key exchange parameters associated with the given provider side key exchange context ctx into params, see \"Common Key Exchange parameters\". Passing NULL for params should return true.

                                                                                                                                                                                                                                                              OSSL_FUNC_keyexch_settable_ctx_params() yields a constant OSSL_PARAM(3) array that describes the settable parameters, i.e. parameters that can be used with OP_signature_set_ctx_params(). If OSSL_FUNC_keyexch_settable_ctx_params() is present, OSSL_FUNC_keyexch_set_ctx_params() must also be present, and vice versa. Similarly, OSSL_FUNC_keyexch_gettable_ctx_params() yields a constant OSSL_PARAM(3) array that describes the gettable parameters, i.e. parameters that can be handled by OP_signature_get_ctx_params(). If OSSL_FUNC_keyexch_gettable_ctx_params() is present, OSSL_FUNC_keyexch_get_ctx_params() must also be present, and vice versa.

                                                                                                                                                                                                                                                              Notice that not all settable parameters are also gettable, and vice versa.

                                                                                                                                                                                                                                                              "},{"location":"man7/provider-keyexch/#common-key-exchange-parameters","title":"Common Key Exchange parameters","text":"

                                                                                                                                                                                                                                                              See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_keyexch_set_ctx_params() and OSSL_FUNC_keyexch_get_ctx_params() functions.

                                                                                                                                                                                                                                                              Common parameters currently recognised by built-in key exchange algorithms are as follows.

                                                                                                                                                                                                                                                              • \"kdf-type\" (OSSL_EXCHANGE_PARAM_KDF_TYPE)

                                                                                                                                                                                                                                                                Sets or gets the Key Derivation Function type to apply within the associated key exchange ctx.

                                                                                                                                                                                                                                                              • \"kdf-digest\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST)

                                                                                                                                                                                                                                                                Sets or gets the Digest algorithm to be used as part of the Key Derivation Function associated with the given key exchange ctx.

                                                                                                                                                                                                                                                              • \"kdf-digest-props\" (OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS)

                                                                                                                                                                                                                                                                Sets properties to be used upon look up of the implementation for the selected Digest algorithm for the Key Derivation Function associated with the given key exchange ctx.

                                                                                                                                                                                                                                                              • \"kdf-outlen\" (OSSL_EXCHANGE_PARAM_KDF_OUTLEN) <unsigned integer>

                                                                                                                                                                                                                                                                Sets or gets the desired size for the output of the chosen Key Derivation Function associated with the given key exchange ctx. The length of the \"kdf-outlen\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                                                                              • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string>

                                                                                                                                                                                                                                                                Sets the User Key Material to be used as part of the selected Key Derivation Function associated with the given key exchange ctx.

                                                                                                                                                                                                                                                              • \"kdf-ukm\" (OSSL_EXCHANGE_PARAM_KDF_UKM) <octet string ptr>

                                                                                                                                                                                                                                                                Gets a pointer to the User Key Material to be used as part of the selected Key Derivation Function associated with the given key exchange ctx. Providers usually do not need to support this gettable parameter as its sole purpose is to support functionality of the deprecated EVP_PKEY_CTX_get0_ecdh_kdf_ukm() and EVP_PKEY_CTX_get0_dh_kdf_ukm() functions.

                                                                                                                                                                                                                                                              • "},{"location":"man7/provider-keyexch/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                                OSSL_FUNC_keyexch_newctx() and OSSL_FUNC_keyexch_dupctx() should return the newly created provider side key exchange context, or NULL on failure.

                                                                                                                                                                                                                                                                OSSL_FUNC_keyexch_init(), OSSL_FUNC_keyexch_set_peer(), OSSL_FUNC_keyexch_derive(), OSSL_FUNC_keyexch_set_params(), and OSSL_FUNC_keyexch_get_params() should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                                OSSL_FUNC_keyexch_settable_ctx_params() and OSSL_FUNC_keyexch_gettable_ctx_params() should always return a constant OSSL_PARAM(3) array.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keyexch/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                provider(7)

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keyexch/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                The provider KEYEXCH interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keyexch/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/","title":"provider-keymgmt","text":""},{"location":"man7/provider-keymgmt/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                provider-keymgmt - The KEYMGMT library <-> provider functions

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                                #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Key object (keydata) creation and destruction */\nvoid *OSSL_FUNC_keymgmt_new(void *provctx);\nvoid OSSL_FUNC_keymgmt_free(void *keydata);\n\n/* Generation, a more complex constructor */\nvoid *OSSL_FUNC_keymgmt_gen_init(void *provctx, int selection,\n                                 const OSSL_PARAM params[]);\nint OSSL_FUNC_keymgmt_gen_set_template(void *genctx, void *template);\nint OSSL_FUNC_keymgmt_gen_set_params(void *genctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_gen_settable_params(void *genctx,\n                                                        void *provctx);\nvoid *OSSL_FUNC_keymgmt_gen(void *genctx, OSSL_CALLBACK *cb, void *cbarg);\nvoid OSSL_FUNC_keymgmt_gen_cleanup(void *genctx);\n\n/* Key loading by object reference, also a constructor */\nvoid *OSSL_FUNC_keymgmt_load(const void *reference, size_t *reference_sz);\n\n/* Key object information */\nint OSSL_FUNC_keymgmt_get_params(void *keydata, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_gettable_params(void *provctx);\nint OSSL_FUNC_keymgmt_set_params(void *keydata, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_settable_params(void *provctx);\n\n/* Key object content checks */\nint OSSL_FUNC_keymgmt_has(const void *keydata, int selection);\nint OSSL_FUNC_keymgmt_match(const void *keydata1, const void *keydata2,\n                            int selection);\n\n/* Discovery of supported operations */\nconst char *OSSL_FUNC_keymgmt_query_operation_name(int operation_id);\n\n/* Key object import and export functions */\nint OSSL_FUNC_keymgmt_import(void *keydata, int selection, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_import_types(int selection);\nint OSSL_FUNC_keymgmt_export(void *keydata, int selection,\n                             OSSL_CALLBACK *param_cb, void *cbarg);\nconst OSSL_PARAM *OSSL_FUNC_keymgmt_export_types(int selection);\n\n/* Key object duplication, a constructor */\nvoid *OSSL_FUNC_keymgmt_dup(const void *keydata_from, int selection);\n\n/* Key object validation */\nint OSSL_FUNC_keymgmt_validate(const void *keydata, int selection, int checktype);\n
                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                The KEYMGMT operation doesn't have much public visibility in OpenSSL libraries, it's rather an internal operation that's designed to work in tandem with operations that use private/public key pairs.

                                                                                                                                                                                                                                                                Because the KEYMGMT operation shares knowledge with the operations it works with in tandem, they must belong to the same provider. The OpenSSL libraries will ensure that they do.

                                                                                                                                                                                                                                                                The primary responsibility of the KEYMGMT operation is to hold the provider side key data for the OpenSSL library EVP_PKEY structure.

                                                                                                                                                                                                                                                                All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                                All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from a OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_keymgmt_new() has these:

                                                                                                                                                                                                                                                                typedef void *(OSSL_FUNC_keymgmt_new_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_keymgmt_new_fn\n    OSSL_FUNC_keymgmt_new(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                                OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_new                  OSSL_FUNC_KEYMGMT_NEW\nOSSL_FUNC_keymgmt_free                 OSSL_FUNC_KEYMGMT_FREE\n\nOSSL_FUNC_keymgmt_gen_init             OSSL_FUNC_KEYMGMT_GEN_INIT\nOSSL_FUNC_keymgmt_gen_set_template     OSSL_FUNC_KEYMGMT_GEN_SET_TEMPLATE\nOSSL_FUNC_keymgmt_gen_set_params       OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS\nOSSL_FUNC_keymgmt_gen_settable_params  OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS\nOSSL_FUNC_keymgmt_gen                  OSSL_FUNC_KEYMGMT_GEN\nOSSL_FUNC_keymgmt_gen_cleanup          OSSL_FUNC_KEYMGMT_GEN_CLEANUP\n\nOSSL_FUNC_keymgmt_load                 OSSL_FUNC_KEYMGMT_LOAD\n\nOSSL_FUNC_keymgmt_get_params           OSSL_FUNC_KEYMGMT_GET_PARAMS\nOSSL_FUNC_keymgmt_gettable_params      OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS\nOSSL_FUNC_keymgmt_set_params           OSSL_FUNC_KEYMGMT_SET_PARAMS\nOSSL_FUNC_keymgmt_settable_params      OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS\n\nOSSL_FUNC_keymgmt_query_operation_name OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME\n\nOSSL_FUNC_keymgmt_has                  OSSL_FUNC_KEYMGMT_HAS\nOSSL_FUNC_keymgmt_validate             OSSL_FUNC_KEYMGMT_VALIDATE\nOSSL_FUNC_keymgmt_match                OSSL_FUNC_KEYMGMT_MATCH\n\nOSSL_FUNC_keymgmt_import               OSSL_FUNC_KEYMGMT_IMPORT\nOSSL_FUNC_keymgmt_import_types         OSSL_FUNC_KEYMGMT_IMPORT_TYPES\nOSSL_FUNC_keymgmt_export               OSSL_FUNC_KEYMGMT_EXPORT\nOSSL_FUNC_keymgmt_export_types         OSSL_FUNC_KEYMGMT_EXPORT_TYPES\n\nOSSL_FUNC_keymgmt_dup                  OSSL_FUNC_KEYMGMT_DUP\n
                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#key-objects","title":"Key Objects","text":"

                                                                                                                                                                                                                                                                A key object is a collection of data for an asymmetric key, and is represented as keydata in this manual.

                                                                                                                                                                                                                                                                The exact contents of a key object are defined by the provider, and it is assumed that different operations in one and the same provider use the exact same structure to represent this collection of data, so that for example, a key object that has been created using the KEYMGMT interface that we document here can be passed as is to other provider operations, such as OP_signature_sign_init() (see provider-signature(7)).

                                                                                                                                                                                                                                                                With some of the KEYMGMT functions, it's possible to select a specific subset of data to handle, governed by the bits in a selection indicator. The bits are:

                                                                                                                                                                                                                                                                • OSSL_KEYMGMT_SELECT_PRIVATE_KEY

                                                                                                                                                                                                                                                                  Indicating that the private key data in a key object should be considered.

                                                                                                                                                                                                                                                                • OSSL_KEYMGMT_SELECT_PUBLIC_KEY

                                                                                                                                                                                                                                                                  Indicating that the public key data in a key object should be considered.

                                                                                                                                                                                                                                                                • OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS

                                                                                                                                                                                                                                                                  Indicating that the domain parameters in a key object should be considered.

                                                                                                                                                                                                                                                                • OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS

                                                                                                                                                                                                                                                                  Indicating that other parameters in a key object should be considered.

                                                                                                                                                                                                                                                                  Other parameters are key parameters that don't fit any other classification. In other words, this particular selector bit works as a last resort bit bucket selector.

                                                                                                                                                                                                                                                                Some selector bits have also been combined for easier use:

                                                                                                                                                                                                                                                                • OSSL_KEYMGMT_SELECT_ALL_PARAMETERS

                                                                                                                                                                                                                                                                  Indicating that all key object parameters should be considered, regardless of their more granular classification.

                                                                                                                                                                                                                                                                  This is a combination of OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS and OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS.

                                                                                                                                                                                                                                                                • OSSL_KEYMGMT_SELECT_KEYPAIR

                                                                                                                                                                                                                                                                  Indicating that both the whole key pair in a key object should be considered, i.e. the combination of public and private key.

                                                                                                                                                                                                                                                                  This is a combination of OSSL_KEYMGMT_SELECT_PRIVATE_KEY and OSSL_KEYMGMT_SELECT_PUBLIC_KEY.

                                                                                                                                                                                                                                                                • OSSL_KEYMGMT_SELECT_ALL

                                                                                                                                                                                                                                                                  Indicating that everything in a key object should be considered.

                                                                                                                                                                                                                                                                The exact interpretation of those bits or how they combine is left to each function where you can specify a selector.

                                                                                                                                                                                                                                                                It's left to the provider implementation to decide what is reasonable to do with regards to received selector bits and how to do it. Among others, an implementation of OSSL_FUNC_keymgmt_match() might opt to not compare the private half if it has compared the public half, since a match of one half implies a match of the other half.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#constructing-and-destructing-functions","title":"Constructing and Destructing Functions","text":"

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_new() should create a provider side key object. The provider context provctx is passed and may be incorporated in the key object, but that is not mandatory.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_free() should free the passed keydata.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gen_init(), OSSL_FUNC_keymgmt_gen_set_template(), OSSL_FUNC_keymgmt_gen_set_params(), OSSL_FUNC_keymgmt_gen_settable_params(), OSSL_FUNC_keymgmt_gen() and OSSL_FUNC_keymgmt_gen_cleanup() work together as a more elaborate context based key object constructor.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gen_init() should create the key object generation context and initialize it with selections, which will determine what kind of contents the key object to be generated should get. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_keymgmt_set_params().

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gen_set_template() should add template to the context genctx. The template is assumed to be a key object constructed with the same KEYMGMT, and from which content that the implementation chooses can be used as a template for the key object to be generated. Typically, the generation of a DSA or DH key would get the domain parameters from this template.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gen_set_params() should set additional parameters from params in the key object generation context genctx.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gen_settable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_keymgmt_gen_set_params() can handle.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gen() should perform the key object generation itself, and return the result. The callback cb should be called at regular intervals with indications on how the key object generation progresses.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gen_cleanup() should clean up and free the key object generation context genctx

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_load() creates a provider side key object based on a reference object with a size of reference_sz bytes, that only the provider knows how to interpret, but that may come from other operations. Outside the provider, this reference is simply an array of bytes.

                                                                                                                                                                                                                                                                At least one of OSSL_FUNC_keymgmt_new(), OSSL_FUNC_keymgmt_gen() and OSSL_FUNC_keymgmt_load() are mandatory, as well as OSSL_FUNC_keymgmt_free() and OSSL_FUNC_keymgmt_has(). Additionally, if OSSL_FUNC_keymgmt_gen() is present, OSSL_FUNC_keymgmt_gen_init() and OSSL_FUNC_keymgmt_gen_cleanup() must be present as well.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#key-object-information-functions","title":"Key Object Information Functions","text":"

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_get_params() should extract information data associated with the given keydata, see \"Common Information Parameters\".

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_gettable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_keymgmt_get_params() can handle.

                                                                                                                                                                                                                                                                If OSSL_FUNC_keymgmt_gettable_params() is present, OSSL_FUNC_keymgmt_get_params() must also be present, and vice versa.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_set_params() should update information data associated with the given keydata, see \"Common Information Parameters\".

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_settable_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_keymgmt_set_params() can handle.

                                                                                                                                                                                                                                                                If OSSL_FUNC_keymgmt_settable_params() is present, OSSL_FUNC_keymgmt_set_params() must also be present, and vice versa.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#key-object-checking-functions","title":"Key Object Checking Functions","text":"

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_query_operation_name() should return the name of the supported algorithm for the operation operation_id. This is similar to provider_query_operation() (see provider-base(7)), but only works as an advisory. If this function is not present, or returns NULL, the caller is free to assume that there's an algorithm from the same provider, of the same name as the one used to fetch the keymgmt and try to use that.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_has() should check whether the given keydata contains the subsets of data indicated by the selector. A combination of several selector bits must consider all those subsets, not just one. An implementation is, however, free to consider an empty subset of data to still be a valid subset. For algorithms where some selection is not meaningful such as OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS for RSA keys the function should just return 1 as the selected subset is not really missing in the key.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_validate() should check if the keydata contains valid data subsets indicated by selection. Some combined selections of data subsets may cause validation of the combined data. For example, the combination of OSSL_KEYMGMT_SELECT_PRIVATE_KEY and OSSL_KEYMGMT_SELECT_PUBLIC_KEY (or OSSL_KEYMGMT_SELECT_KEYPAIR for short) is expected to check that the pairwise consistency of keydata is valid. The checktype parameter controls what type of check is performed on the subset of data. Two types of check are defined: OSSL_KEYMGMT_VALIDATE_FULL_CHECK and OSSL_KEYMGMT_VALIDATE_QUICK_CHECK. The interpretation of how much checking is performed in a full check versus a quick check is key type specific. Some providers may have no distinction between a full check and a quick check. For algorithms where some selection is not meaningful such as OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS for RSA keys the function should just return 1 as there is nothing to validate for that selection.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_match() should check if the data subset indicated by selection in keydata1 and keydata2 match. It is assumed that the caller has ensured that keydata1 and keydata2 are both owned by the implementation of this function.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#key-object-import-export-and-duplication-functions","title":"Key Object Import, Export and Duplication Functions","text":"

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_import() should import data indicated by selection into keydata with values taken from the OSSL_PARAM(3) array params.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_export() should extract values indicated by selection from keydata, create an OSSL_PARAM(3) array with them and call param_cb with that array as well as the given cbarg.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_import_types() should return a constant array of descriptor OSSL_PARAM(3) for data indicated by selection, for parameters that OSSL_FUNC_keymgmt_import() can handle.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_export_types() should return a constant array of descriptor OSSL_PARAM(3) for data indicated by selection, that the OSSL_FUNC_keymgmt_export() callback can expect to receive.

                                                                                                                                                                                                                                                                OSSL_FUNC_keymgmt_dup() should duplicate data subsets indicated by selection or the whole key data keydata_from and create a new provider side key object with the data.

                                                                                                                                                                                                                                                                "},{"location":"man7/provider-keymgmt/#common-information-parameters","title":"Common Information Parameters","text":"

                                                                                                                                                                                                                                                                See OSSL_PARAM(3) for further details on the parameters structure.

                                                                                                                                                                                                                                                                Common information parameters currently recognised by all built-in keymgmt algorithms are as follows:

                                                                                                                                                                                                                                                                • \"bits\" (OSSL_PKEY_PARAM_BITS) <integer>

                                                                                                                                                                                                                                                                  The value should be the cryptographic length of the cryptosystem to which the key belongs, in bits. The definition of cryptographic length is specific to the key cryptosystem.

                                                                                                                                                                                                                                                                • \"max-size\" (OSSL_PKEY_PARAM_MAX_SIZE) <integer>

                                                                                                                                                                                                                                                                  The value should be the maximum size that a caller should allocate to safely store a signature (called sig in provider-signature(7)), the result of asymmetric encryption / decryption (out in provider-asym_cipher(7), a derived secret (secret in provider-keyexch(7), and similar data).

                                                                                                                                                                                                                                                                  Because an EVP_KEYMGMT method is always tightly bound to another method (signature, asymmetric cipher, key exchange, ...) and must be of the same provider, this number only needs to be synchronised with the dimensions handled in the rest of the same provider.

                                                                                                                                                                                                                                                                • \"security-bits\" (OSSL_PKEY_PARAM_SECURITY_BITS) <integer>

                                                                                                                                                                                                                                                                  The value should be the number of security bits of the given key. Bits of security is defined in SP800-57.

                                                                                                                                                                                                                                                                • \"mandatory-digest\" (OSSL_PKEY_PARAM_MANDATORY_DIGEST)

                                                                                                                                                                                                                                                                  If there is a mandatory digest for performing a signature operation with keys from this keymgmt, this parameter should get its name as value.

                                                                                                                                                                                                                                                                  When EVP_PKEY_get_default_digest_name() queries this parameter and it's filled in by the implementation, its return value will be 2.

                                                                                                                                                                                                                                                                  If the keymgmt implementation fills in the value \"\" or \"UNDEF\", EVP_PKEY_get_default_digest_name(3) will place the string \"UNDEF\" into its argument mdname. This signifies that no digest should be specified with the corresponding signature operation.

                                                                                                                                                                                                                                                                • \"default-digest\" (OSSL_PKEY_PARAM_DEFAULT_DIGEST)

                                                                                                                                                                                                                                                                  If there is a default digest for performing a signature operation with keys from this keymgmt, this parameter should get its name as value.

                                                                                                                                                                                                                                                                  When EVP_PKEY_get_default_digest_name(3) queries this parameter and it's filled in by the implementation, its return value will be 1. Note that if OSSL_PKEY_PARAM_MANDATORY_DIGEST is responded to as well, EVP_PKEY_get_default_digest_name(3) ignores the response to this parameter.

                                                                                                                                                                                                                                                                  If the keymgmt implementation fills in the value \"\" or \"UNDEF\", EVP_PKEY_get_default_digest_name(3) will place the string \"UNDEF\" into its argument mdname. This signifies that no digest has to be specified with the corresponding signature operation, but may be specified as an option.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-keymgmt/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                                  OSSL_FUNC_keymgmt_new() and OSSL_FUNC_keymgmt_dup() should return a valid reference to the newly created provider side key object, or NULL on failure.

                                                                                                                                                                                                                                                                  OSSL_FUNC_keymgmt_import(), OSSL_FUNC_keymgmt_export(), OSSL_FUNC_keymgmt_get_params() and OSSL_FUNC_keymgmt_set_params() should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                                  OSSL_FUNC_keymgmt_validate() should return 1 on successful validation, or 0 on failure.

                                                                                                                                                                                                                                                                  OSSL_FUNC_keymgmt_has() should return 1 if all the selected data subsets are contained in the given keydata or 0 otherwise.

                                                                                                                                                                                                                                                                  OSSL_FUNC_keymgmt_query_operation_name() should return a pointer to a string matching the requested operation, or NULL if the same name used to fetch the keymgmt applies.

                                                                                                                                                                                                                                                                  OSSL_FUNC_keymgmt_gettable_params() and OSSL_FUNC_keymgmt_settable_params() OSSL_FUNC_keymgmt_import_types(), OSSL_FUNC_keymgmt_export_types() should always return a constant OSSL_PARAM(3) array.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-keymgmt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                  provider(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), EVP_PKEY-ED25519(7), EVP_PKEY-ED448(7), EVP_PKEY-EC(7), EVP_PKEY-RSA(7), EVP_PKEY-DSA(7), EVP_PKEY-DH(7)

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-keymgmt/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                  The KEYMGMT interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-keymgmt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                  Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/","title":"provider-mac","text":""},{"location":"man7/provider-mac/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                  provider-mac - The mac library <-> provider functions

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                                  #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_mac_newctx(void *provctx);\nvoid OSSL_FUNC_mac_freectx(void *mctx);\nvoid *OSSL_FUNC_mac_dupctx(void *src);\n\n/* Encryption/decryption */\nint OSSL_FUNC_mac_init(void *mctx, unsigned char *key, size_t keylen,\n                       const OSSL_PARAM params[]);\nint OSSL_FUNC_mac_update(void *mctx, const unsigned char *in, size_t inl);\nint OSSL_FUNC_mac_final(void *mctx, unsigned char *out, size_t *outl, size_t outsize);\n\n/* MAC parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_mac_gettable_params(void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_mac_gettable_ctx_params(void *mctx, void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_mac_settable_ctx_params(void *mctx, void *provctx);\n\n/* MAC parameters */\nint OSSL_FUNC_mac_get_params(OSSL_PARAM params[]);\nint OSSL_FUNC_mac_get_ctx_params(void *mctx, OSSL_PARAM params[]);\nint OSSL_FUNC_mac_set_ctx_params(void *mctx, const OSSL_PARAM params[]);\n
                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                  This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                                  The MAC operation enables providers to implement mac algorithms and make them available to applications via the API functions EVP_MAC_init(3), EVP_MAC_update(3) and EVP_MAC_final(3).

                                                                                                                                                                                                                                                                  All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                                  All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_mac_newctx() has these:

                                                                                                                                                                                                                                                                  typedef void *(OSSL_FUNC_mac_newctx_fn)(void *provctx);\nstatic ossl_inline OSSL_FUNC_mac_newctx_fn\n    OSSL_FUNC_mac_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                                  OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_newctx               OSSL_FUNC_MAC_NEWCTX\nOSSL_FUNC_mac_freectx              OSSL_FUNC_MAC_FREECTX\nOSSL_FUNC_mac_dupctx               OSSL_FUNC_MAC_DUPCTX\n\nOSSL_FUNC_mac_init                 OSSL_FUNC_MAC_INIT\nOSSL_FUNC_mac_update               OSSL_FUNC_MAC_UPDATE\nOSSL_FUNC_mac_final                OSSL_FUNC_MAC_FINAL\n\nOSSL_FUNC_mac_get_params           OSSL_FUNC_MAC_GET_PARAMS\nOSSL_FUNC_mac_get_ctx_params       OSSL_FUNC_MAC_GET_CTX_PARAMS\nOSSL_FUNC_mac_set_ctx_params       OSSL_FUNC_MAC_SET_CTX_PARAMS\n\nOSSL_FUNC_mac_gettable_params      OSSL_FUNC_MAC_GETTABLE_PARAMS\nOSSL_FUNC_mac_gettable_ctx_params  OSSL_FUNC_MAC_GETTABLE_CTX_PARAMS\nOSSL_FUNC_mac_settable_ctx_params  OSSL_FUNC_MAC_SETTABLE_CTX_PARAMS\n

                                                                                                                                                                                                                                                                  A mac algorithm implementation may not implement all of these functions. In order to be a consistent set of functions, at least the following functions must be implemented: OSSL_FUNC_mac_newctx(), OSSL_FUNC_mac_freectx(), OSSL_FUNC_mac_init(), OSSL_FUNC_mac_update(), OSSL_FUNC_mac_final(). All other functions are optional.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_newctx() should create and return a pointer to a provider side structure for holding context information during a mac operation. A pointer to this context will be passed back in a number of the other mac operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)).

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_freectx() is passed a pointer to the provider side mac context in the mctx parameter. If it receives NULL as mctx value, it should not do anything other than return. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_dupctx() should duplicate the provider side mac context in the mctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#encryptiondecryption-functions","title":"Encryption/Decryption Functions","text":"

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_init() initialises a mac operation given a newly created provider side mac context in the mctx parameter. The params are set before setting the MAC key of keylen bytes.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_update() is called to supply data for MAC computation of a previously initialised mac operation. The mctx parameter contains a pointer to a previously initialised provider side context. OSSL_FUNC_mac_update() may be called multiple times for a single mac operation.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_final() completes the MAC computation started through previous OSSL_FUNC_mac_init() and OSSL_FUNC_mac_update() calls. The mctx parameter contains a pointer to the provider side context. The resulting MAC should be written to out and the amount of data written to *outl, which should not exceed outsize bytes. The same expectations apply to outsize as documented for EVP_MAC_final(3).

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#mac-parameters","title":"Mac Parameters","text":"

                                                                                                                                                                                                                                                                  See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_get_params() gets details of parameter values associated with the provider algorithm and stores them in params.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_set_ctx_params() sets mac parameters associated with the given provider side mac context mctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_get_ctx_params() gets details of currently set parameter values associated with the given provider side mac context mctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_gettable_params(), OSSL_FUNC_mac_gettable_ctx_params(), and OSSL_FUNC_mac_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_mac_get_params(), OSSL_FUNC_mac_get_ctx_params(), and OSSL_FUNC_mac_set_ctx_params() can handle, respectively. OSSL_FUNC_mac_gettable_ctx_params() and OSSL_FUNC_mac_settable_ctx_params() will return the parameters associated with the provider side context mctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                                                                                                                                                                  All MAC implementations are expected to handle the following parameters:

                                                                                                                                                                                                                                                                  • with OSSL_FUNC_set_ctx_params():

                                                                                                                                                                                                                                                                    • \"key\" (OSSL_MAC_PARAM_KEY) <octet string>

                                                                                                                                                                                                                                                                      Sets the key in the associated MAC ctx. This is identical to passing a key argument to the OSSL_FUNC_mac_init() function. - with OSSL_FUNC_get_params(): - \"size\" (OSSL_MAC_PARAM_SIZE) <integer>

                                                                                                                                                                                                                                                                      Can be used to get the default MAC size (which might be the only allowable MAC size for the implementation).

                                                                                                                                                                                                                                                                      Note that some implementations allow setting the size that the resulting MAC should have as well, see the documentation of the implementation.

                                                                                                                                                                                                                                                                    • \"size\" (OSSL_MAC_PARAM_BLOCK_SIZE) <integer>

                                                                                                                                                                                                                                                                      Can be used to get the MAC block size (if supported by the algorithm).

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                                                  The MAC life-cycle is described in life_cycle-rand(7). Providers should ensure that the various transitions listed there are supported. At some point the EVP layer will begin enforcing the listed transitions.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_newctx() and OSSL_FUNC_mac_dupctx() should return the newly created provider side mac context, or NULL on failure.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_init(), OSSL_FUNC_mac_update(), OSSL_FUNC_mac_final(), OSSL_FUNC_mac_get_params(), OSSL_FUNC_mac_get_ctx_params() and OSSL_FUNC_mac_set_ctx_params() should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                                  OSSL_FUNC_mac_gettable_params(), OSSL_FUNC_mac_gettable_ctx_params() and OSSL_FUNC_mac_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                  provider(7), EVP_MAC-BLAKE2(7), EVP_MAC-CMAC(7), EVP_MAC-GMAC(7), EVP_MAC-HMAC(7), EVP_MAC-KMAC(7), EVP_MAC-Poly1305(7), EVP_MAC-Siphash(7), life_cycle-mac(7), EVP_MAC(3)

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                  The provider MAC interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-mac/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                  Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                  Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-object/","title":"provider-object","text":""},{"location":"man7/provider-object/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                  provider-object - A specification for a provider-native object abstraction

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-object/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                                  #include <openssl/core_object.h>\n#include <openssl/core_names.h>\n
                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-object/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                  The provider-native object abstraction is a set of OSSL_PARAM(3) keys and values that can be used to pass provider-native objects to OpenSSL library code or between different provider operation implementations with the help of OpenSSL library code.

                                                                                                                                                                                                                                                                  The intention is that certain provider-native operations can pass any sort of object that belong with other operations, or with OpenSSL library code.

                                                                                                                                                                                                                                                                  An object may be passed in the following manners:

                                                                                                                                                                                                                                                                  1. By value

                                                                                                                                                                                                                                                                    This means that the object data is passed as an octet string or an UTF8 string, which can be handled in diverse ways by other provided implementations. The encoding of the object depends on the context it's used in; for example, OSSL_DECODER(3) allows multiple encodings, depending on existing decoders. If central OpenSSL library functionality is to handle the data directly, it must be encoded in DER for all object types except for OSSL_OBJECT_NAME (see \"Parameter reference\" below), where it's assumed to a plain UTF8 string.

                                                                                                                                                                                                                                                                  2. By reference

                                                                                                                                                                                                                                                                    This means that the object data isn't passed directly, an object reference is passed instead. It's an octet string that only the correct provider understands correctly.

                                                                                                                                                                                                                                                                  Objects by value can be used by anything that handles DER encoded objects.

                                                                                                                                                                                                                                                                  Objects by reference need a higher level of cooperation from the implementation where the object originated (let's call it X) and its target implementation (let's call it Y):

                                                                                                                                                                                                                                                                  1. An object loading function in the target implementation

                                                                                                                                                                                                                                                                    The target implementation (Y) may have a function that can take an object reference. This can only be used if the target implementation is from the same provider as the one originating the object abstraction in question (X).

                                                                                                                                                                                                                                                                    The exact target implementation to use is determined from the object type and possibly the object data type. For example, when the OpenSSL library receives an object abstraction with the object type OSSL_OBJECT_PKEY, it will fetch a provider-keymgmt(7) using the object data type as its key type (the second argument in EVP_KEYMGMT_fetch(3)).

                                                                                                                                                                                                                                                                  2. An object exporter in the originating implementation

                                                                                                                                                                                                                                                                    The originating implementation (X) may have an exporter function. This exporter function can be used to export the object in OSSL_PARAM(3) form, that can then be imported by the target implementation's imported function.

                                                                                                                                                                                                                                                                    This can be used when it's not possible to fetch the target implementation (Y) from the same provider.

                                                                                                                                                                                                                                                                  "},{"location":"man7/provider-object/#parameter-reference","title":"Parameter reference","text":"

                                                                                                                                                                                                                                                                  A provider-native object abstraction is an OSSL_PARAM(3) with a selection of the following parameters:

                                                                                                                                                                                                                                                                  • \"data\" (OSSL_OBJECT_PARAM_DATA) <octet string> or

                                                                                                                                                                                                                                                                    The object data passed by value.

                                                                                                                                                                                                                                                                  • \"reference\" (OSSL_OBJECT_PARAM_REFERENCE) <octet string>

                                                                                                                                                                                                                                                                    The object data passed by reference.

                                                                                                                                                                                                                                                                  • \"type\" (OSSL_OBJECT_PARAM_TYPE) <integer>

                                                                                                                                                                                                                                                                    The object type, a number that may have any of the following values (all defined in <openssl/core_object.h>):

                                                                                                                                                                                                                                                                    • OSSL_OBJECT_NAME

                                                                                                                                                                                                                                                                      The object data may only be passed by value, and should be a UTF8 string.

                                                                                                                                                                                                                                                                      This is useful for provider-storemgmt(7) when a URI load results in new URIs.

                                                                                                                                                                                                                                                                    • OSSL_OBJECT_PKEY

                                                                                                                                                                                                                                                                      The object data is suitable as provider-native EVP_PKEY key data. The object data may be passed by value or passed by reference.

                                                                                                                                                                                                                                                                    • OSSL_OBJECT_CERT

                                                                                                                                                                                                                                                                      The object data is suitable as X509 data. The object data for this object type can only be passed by value, and should be an octet string.

                                                                                                                                                                                                                                                                      Since there's no provider-native X.509 object, OpenSSL libraries that receive this object abstraction are expected to convert the data to a X509 object with d2i_X509().

                                                                                                                                                                                                                                                                    • OSSL_OBJECT_CRL

                                                                                                                                                                                                                                                                      The object data is suitable as X509_CRL data. The object data can only be passed by value, and should be an octet string.

                                                                                                                                                                                                                                                                      Since there's no provider-native X.509 CRL object, OpenSSL libraries that receive this object abstraction are expected to convert the data to a X509_CRL object with d2i_X509_CRL().

                                                                                                                                                                                                                                                                  • \"data-type\" (OSSL_OBJECT_PARAM_DATA_TYPE)

                                                                                                                                                                                                                                                                    The specific type of the object content. Legitimate values depend on the object type; if it is OSSL_OBJECT_PKEY, the data type is expected to be a key type suitable for fetching a provider-keymgmt(7) that can handle the data.

                                                                                                                                                                                                                                                                  • \"data-structure\" (OSSL_OBJECT_PARAM_DATA_STRUCTURE)

                                                                                                                                                                                                                                                                    The outermost structure of the object content. Legitimate values depend on the object type.

                                                                                                                                                                                                                                                                  • \"desc\" (OSSL_OBJECT_PARAM_DESC)

                                                                                                                                                                                                                                                                    A human readable text that describes extra details on the object.

                                                                                                                                                                                                                                                                    When a provider-native object abstraction is used, it must contain object data in at least one form (object data passed by value, i.e. the \"data\" item, or object data passed by reference, i.e. the \"reference\" item). Both may be present at once, in which case the OpenSSL library code that receives this will use the most optimal variant.

                                                                                                                                                                                                                                                                    For objects with the object type OSSL_OBJECT_NAME, that object type must be given.

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-object/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                    provider(7), OSSL_DECODER(3)

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-object/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                    The concept of providers and everything surrounding them was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-object/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                    Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                    Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/","title":"provider-rand","text":""},{"location":"man7/provider-rand/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                    provider-rand - The random number generation library <-> provider functions

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                                    #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_rand_newctx(void *provctx, void *parent,\n                            const OSSL_DISPATCH *parent_calls);\nvoid OSSL_FUNC_rand_freectx(void *ctx);\n\n/* Random number generator functions: NIST */\nint OSSL_FUNC_rand_instantiate(void *ctx, unsigned int strength,\n                               int prediction_resistance,\n                               const unsigned char *pstr, size_t pstr_len,\n                               const OSSL_PARAM params[]);\nint OSSL_FUNC_rand_uninstantiate(void *ctx);\nint OSSL_FUNC_rand_generate(void *ctx, unsigned char *out, size_t outlen,\n                            unsigned int strength, int prediction_resistance,\n                            const unsigned char *addin, size_t addin_len);\nint OSSL_FUNC_rand_reseed(void *ctx, int prediction_resistance,\n                          const unsigned char *ent, size_t ent_len,\n                          const unsigned char *addin, size_t addin_len);\n\n/* Random number generator functions: additional */\nsize_t OSSL_FUNC_rand_nonce(void *ctx, unsigned char *out, size_t outlen,\n                            int strength, size_t min_noncelen,\n                            size_t max_noncelen);\nsize_t OSSL_FUNC_rand_get_seed(void *ctx, unsigned char **buffer,\n                               int entropy, size_t min_len, size_t max_len,\n                               int prediction_resistance,\n                               const unsigned char *adin, size_t adin_len);\nvoid OSSL_FUNC_rand_clear_seed(void *ctx, unsigned char *buffer, size_t b_len);\nint OSSL_FUNC_rand_verify_zeroization(void *ctx);\n\n/* Context Locking */\nint OSSL_FUNC_rand_enable_locking(void *ctx);\nint OSSL_FUNC_rand_lock(void *ctx);\nvoid OSSL_FUNC_rand_unlock(void *ctx);\n\n/* RAND parameter descriptors */\nconst OSSL_PARAM *OSSL_FUNC_rand_gettable_params(void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_rand_gettable_ctx_params(void *ctx, void *provctx);\nconst OSSL_PARAM *OSSL_FUNC_rand_settable_ctx_params(void *ctx, void *provctx);\n\n/* RAND parameters */\nint OSSL_FUNC_rand_get_params(OSSL_PARAM params[]);\nint OSSL_FUNC_rand_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nint OSSL_FUNC_rand_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\n
                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                    This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                                    The RAND operation enables providers to implement random number generation algorithms and random number sources and make them available to applications via the API function EVP_RAND(3).

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_newctx() should create and return a pointer to a provider side structure for holding context information during a rand operation. A pointer to this context will be passed back in a number of the other rand operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)). The parameter parent specifies another rand instance to be used for seeding purposes. If NULL and the specific instance supports it, the operating system will be used for seeding. The parameter parent_calls points to the dispatch table for parent. Thus, the parent need not be from the same provider as the new instance.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_freectx() is passed a pointer to the provider side rand context in the mctx parameter. If it receives NULL as ctx value, it should not do anything other than return. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/#random-number-generator-functions-nist","title":"Random Number Generator Functions: NIST","text":"

                                                                                                                                                                                                                                                                    These functions correspond to those defined in NIST SP 800-90A and SP 800-90C.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_instantiate() is used to instantiate the DRBG ctx at a requested security strength. In addition, prediction_resistance can be requested. Additional input addin of length addin_len bytes can optionally be provided. The parameters specified in params configure the DRBG and these should be processed before instantiation.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_uninstantiate() is used to uninstantiate the DRBG ctx. After being uninstantiated, a DRBG is unable to produce output until it is instantiated anew.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_generate() is used to generate random bytes from the DRBG ctx. It will generate outlen bytes placing them into the buffer pointed to by out. The generated bytes will meet the specified security strength and, if prediction_resistance is true, the bytes will be produced after reseeding from a live entropy source. Additional input addin of length addin_len bytes can optionally be provided.

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/#random-number-generator-functions-additional","title":"Random Number Generator Functions: Additional","text":"

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_nonce() is used to generate a nonce of the given strength with a length from min_noncelen to max_noncelen. If the output buffer out is NULL, the length of the nonce should be returned.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_get_seed() is used by deterministic generators to obtain their seeding material from their parent. The seed bytes will meet the specified security level of entropy bits and there will be between min_len and max_len inclusive bytes in total. If prediction_resistance is true, the bytes will be produced from a live entropy source. Additional input addin of length addin_len bytes can optionally be provided. A pointer to the seed material is returned in *buffer and this must be freed by a later call to OSSL_FUNC_rand_clear_seed().

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_clear_seed() frees a seed buffer of length b_len bytes which was previously allocated by OSSL_FUNC_rand_get_seed().

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_verify_zeroization() is used to determine if the internal state of the DRBG is zero. This capability is mandated by NIST as part of the self tests, it is unlikely to be useful in other circumstances.

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/#context-locking","title":"Context Locking","text":"

                                                                                                                                                                                                                                                                    When DRBGs are used by multiple threads, there must be locking employed to ensure their proper operation. Because locking introduces an overhead, it is disabled by default.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_enable_locking() allows locking to be turned on for a DRBG and all of its parent DRBGs. From this call onwards, the DRBG can be used in a thread safe manner.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_lock() is used to lock a DRBG. Once locked, exclusive access is guaranteed.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_unlock() is used to unlock a DRBG.

                                                                                                                                                                                                                                                                    "},{"location":"man7/provider-rand/#rand-parameters","title":"Rand Parameters","text":"

                                                                                                                                                                                                                                                                    See OSSL_PARAM(3) for further details on the parameters structure used by these functions.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_get_params() gets details of parameter values associated with the provider algorithm and stores them in params.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_set_ctx_params() sets rand parameters associated with the given provider side rand context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_get_ctx_params() gets details of currently set parameter values associated with the given provider side rand context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                    OSSL_FUNC_rand_gettable_params(), OSSL_FUNC_rand_gettable_ctx_params(), and OSSL_FUNC_rand_settable_ctx_params() all return constant OSSL_PARAM(3) arrays as descriptors of the parameters that OSSL_FUNC_rand_get_params(), OSSL_FUNC_rand_get_ctx_params(), and OSSL_FUNC_rand_set_ctx_params() can handle, respectively. OSSL_FUNC_rand_gettable_ctx_params() and OSSL_FUNC_rand_settable_ctx_params() will return the parameters associated with the provider side context ctx in its current state if it is not NULL. Otherwise, they return the parameters associated with the provider side algorithm provctx.

                                                                                                                                                                                                                                                                    Parameters currently recognised by built-in rands are as follows. Not all parameters are relevant to, or are understood by all rands:

                                                                                                                                                                                                                                                                    • \"state\" (OSSL_RAND_PARAM_STATE) <integer>

                                                                                                                                                                                                                                                                      Returns the state of the random number generator.

                                                                                                                                                                                                                                                                    • \"strength\" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>

                                                                                                                                                                                                                                                                      Returns the bit strength of the random number generator.

                                                                                                                                                                                                                                                                    For rands that are also deterministic random bit generators (DRBGs), these additional parameters are recognised. Not all parameters are relevant to, or are understood by all DRBG rands:

                                                                                                                                                                                                                                                                    • \"reseed_requests\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

                                                                                                                                                                                                                                                                      Reads or set the number of generate requests before reseeding the associated RAND ctx.

                                                                                                                                                                                                                                                                    • \"reseed_time_interval\" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>

                                                                                                                                                                                                                                                                      Reads or set the number of elapsed seconds before reseeding the associated RAND ctx.

                                                                                                                                                                                                                                                                    • \"max_request\" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>

                                                                                                                                                                                                                                                                      Specifies the maximum number of bytes that can be generated in a single call to OSSL_FUNC_rand_generate.

                                                                                                                                                                                                                                                                    • \"min_entropylen\" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>

                                                                                                                                                                                                                                                                    • \"max_entropylen\" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>

                                                                                                                                                                                                                                                                      Specify the minimum and maximum number of bytes of random material that can be used to seed the DRBG.

                                                                                                                                                                                                                                                                    • \"min_noncelen\" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>

                                                                                                                                                                                                                                                                    • \"max_noncelen\" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>

                                                                                                                                                                                                                                                                      Specify the minimum and maximum number of bytes of nonce that can be used to instantiate the DRBG.

                                                                                                                                                                                                                                                                    • \"max_perslen\" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>

                                                                                                                                                                                                                                                                    • \"max_adinlen\" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>

                                                                                                                                                                                                                                                                      Specify the minimum and maximum number of bytes of personalisation string that can be used with the DRBG.

                                                                                                                                                                                                                                                                    • \"reseed_counter\" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>

                                                                                                                                                                                                                                                                      Specifies the number of times the DRBG has been seeded or reseeded.

                                                                                                                                                                                                                                                                    • \"digest\" (OSSL_DRBG_PARAM_DIGEST)

                                                                                                                                                                                                                                                                    • \"cipher\" (OSSL_DRBG_PARAM_CIPHER)
                                                                                                                                                                                                                                                                    • \"mac\" (OSSL_DRBG_PARAM_MAC)

                                                                                                                                                                                                                                                                      Sets the name of the underlying cipher, digest or MAC to be used. It must name a suitable algorithm for the DRBG that's being used.

                                                                                                                                                                                                                                                                    • \"properties\" (OSSL_DRBG_PARAM_PROPERTIES)

                                                                                                                                                                                                                                                                      Sets the properties to be queried when trying to fetch an underlying algorithm. This must be given together with the algorithm naming parameter to be considered valid.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-rand/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                                      OSSL_FUNC_rand_newctx() should return the newly created provider side rand context, or NULL on failure.

                                                                                                                                                                                                                                                                      OSSL_FUNC_rand_gettable_params(), OSSL_FUNC_rand_gettable_ctx_params() and OSSL_FUNC_rand_settable_ctx_params() should return a constant OSSL_PARAM(3) array, or NULL if none is offered.

                                                                                                                                                                                                                                                                      OSSL_FUNC_rand_nonce() returns the size of the generated nonce, or 0 on error.

                                                                                                                                                                                                                                                                      OSSL_FUNC_rand_get_seed() returns the size of the generated seed, or 0 on error.

                                                                                                                                                                                                                                                                      All of the remaining functions should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-rand/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                                                      The RAND life-cycle is described in life_cycle-rand(7). Providers should ensure that the various transitions listed there are supported. At some point the EVP layer will begin enforcing the listed transitions.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-rand/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                      provider(7), RAND(7), EVP_RAND(7), life_cycle-rand(7), EVP_RAND(3)

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-rand/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                      The provider RAND interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-rand/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                      Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                      Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/","title":"provider-signature","text":""},{"location":"man7/provider-signature/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                      provider-signature - The signature library <-> provider functions

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                                      #include <openssl/core_dispatch.h>\n#include <openssl/core_names.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\n/* Context management */\nvoid *OSSL_FUNC_signature_newctx(void *provctx, const char *propq);\nvoid OSSL_FUNC_signature_freectx(void *ctx);\nvoid *OSSL_FUNC_signature_dupctx(void *ctx);\n\n/* Signing */\nint OSSL_FUNC_signature_sign_init(void *ctx, void *provkey,\n                                  const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_sign(void *ctx, unsigned char *sig, size_t *siglen,\n                             size_t sigsize, const unsigned char *tbs, size_t tbslen);\n\n/* Verifying */\nint OSSL_FUNC_signature_verify_init(void *ctx, void *provkey,\n                                    const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_verify(void *ctx, const unsigned char *sig, size_t siglen,\n                               const unsigned char *tbs, size_t tbslen);\n\n/* Verify Recover */\nint OSSL_FUNC_signature_verify_recover_init(void *ctx, void *provkey,\n                                            const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_verify_recover(void *ctx, unsigned char *rout,\n                                       size_t *routlen, size_t routsize,\n                                       const unsigned char *sig, size_t siglen);\n\n/* Digest Sign */\nint OSSL_FUNC_signature_digest_sign_init(void *ctx, const char *mdname,\n                                         void *provkey,\n                                         const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_digest_sign_update(void *ctx, const unsigned char *data,\n                                    size_t datalen);\nint OSSL_FUNC_signature_digest_sign_final(void *ctx, unsigned char *sig,\n                                          size_t *siglen, size_t sigsize);\nint OSSL_FUNC_signature_digest_sign(void *ctx,\n                             unsigned char *sig, size_t *siglen,\n                             size_t sigsize, const unsigned char *tbs,\n                             size_t tbslen);\n\n/* Digest Verify */\nint OSSL_FUNC_signature_digest_verify_init(void *ctx, const char *mdname,\n                                           void *provkey,\n                                           const OSSL_PARAM params[]);\nint OSSL_FUNC_signature_digest_verify_update(void *ctx,\n                                             const unsigned char *data,\n                                             size_t datalen);\nint OSSL_FUNC_signature_digest_verify_final(void *ctx, const unsigned char *sig,\n                                     size_t siglen);\nint OSSL_FUNC_signature_digest_verify(void *ctx, const unsigned char *sig,\n                               size_t siglen, const unsigned char *tbs,\n                               size_t tbslen);\n\n/* Signature parameters */\nint OSSL_FUNC_signature_get_ctx_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_signature_gettable_ctx_params(void *ctx,\n                                                          void *provctx);\nint OSSL_FUNC_signature_set_ctx_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM *OSSL_FUNC_signature_settable_ctx_params(void *ctx,\n                                                          void *provctx);\n/* MD parameters */\nint OSSL_FUNC_signature_get_ctx_md_params(void *ctx, OSSL_PARAM params[]);\nconst OSSL_PARAM * OSSL_FUNC_signature_gettable_ctx_md_params(void *ctx);\nint OSSL_FUNC_signature_set_ctx_md_params(void *ctx, const OSSL_PARAM params[]);\nconst OSSL_PARAM * OSSL_FUNC_signature_settable_ctx_md_params(void *ctx);\n
                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                      This documentation is primarily aimed at provider authors. See provider(7) for further information.

                                                                                                                                                                                                                                                                      The signature (OSSL_OP_SIGNATURE) operation enables providers to implement signature algorithms and make them available to applications via the API functions EVP_PKEY_sign(3), EVP_PKEY_verify(3), and EVP_PKEY_verify_recover(3) (as well as other related functions).

                                                                                                                                                                                                                                                                      All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                                      All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. For example, the \"function\" OSSL_FUNC_signature_newctx() has these:

                                                                                                                                                                                                                                                                      typedef void *(OSSL_FUNC_signature_newctx_fn)(void *provctx, const char *propq);\nstatic ossl_inline OSSL_FUNC_signature_newctx_fn\n    OSSL_FUNC_signature_newctx(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                                      OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_newctx                 OSSL_FUNC_SIGNATURE_NEWCTX\nOSSL_FUNC_signature_freectx                OSSL_FUNC_SIGNATURE_FREECTX\nOSSL_FUNC_signature_dupctx                 OSSL_FUNC_SIGNATURE_DUPCTX\n\nOSSL_FUNC_signature_sign_init              OSSL_FUNC_SIGNATURE_SIGN_INIT\nOSSL_FUNC_signature_sign                   OSSL_FUNC_SIGNATURE_SIGN\n\nOSSL_FUNC_signature_verify_init            OSSL_FUNC_SIGNATURE_VERIFY_INIT\nOSSL_FUNC_signature_verify                 OSSL_FUNC_SIGNATURE_VERIFY\n\nOSSL_FUNC_signature_verify_recover_init    OSSL_FUNC_SIGNATURE_VERIFY_RECOVER_INIT\nOSSL_FUNC_signature_verify_recover         OSSL_FUNC_SIGNATURE_VERIFY_RECOVER\n\nOSSL_FUNC_signature_digest_sign_init       OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT\nOSSL_FUNC_signature_digest_sign_update     OSSL_FUNC_SIGNATURE_DIGEST_SIGN_UPDATE\nOSSL_FUNC_signature_digest_sign_final      OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL\nOSSL_FUNC_signature_digest_sign            OSSL_FUNC_SIGNATURE_DIGEST_SIGN\n\nOSSL_FUNC_signature_digest_verify_init     OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT\nOSSL_FUNC_signature_digest_verify_update   OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_UPDATE\nOSSL_FUNC_signature_digest_verify_final    OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL\nOSSL_FUNC_signature_digest_verify          OSSL_FUNC_SIGNATURE_DIGEST_VERIFY\n\nOSSL_FUNC_signature_get_ctx_params         OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS\nOSSL_FUNC_signature_gettable_ctx_params    OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS\nOSSL_FUNC_signature_set_ctx_params         OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS\nOSSL_FUNC_signature_settable_ctx_params    OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS\n\nOSSL_FUNC_signature_get_ctx_md_params      OSSL_FUNC_SIGNATURE_GET_CTX_MD_PARAMS\nOSSL_FUNC_signature_gettable_ctx_md_params OSSL_FUNC_SIGNATURE_GETTABLE_CTX_MD_PARAMS\nOSSL_FUNC_signature_set_ctx_md_params      OSSL_FUNC_SIGNATURE_SET_CTX_MD_PARAMS\nOSSL_FUNC_signature_settable_ctx_md_params OSSL_FUNC_SIGNATURE_SETTABLE_CTX_MD_PARAMS\n

                                                                                                                                                                                                                                                                      A signature algorithm implementation may not implement all of these functions. In order to be a consistent set of functions we must have at least a set of context functions (OSSL_FUNC_signature_newctx and OSSL_FUNC_signature_freectx) as well as a set of \"signature\" functions, i.e. at least one of:

                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_sign_init and OSSL_FUNC_signature_sign
                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_verify_init and OSSL_FUNC_signature_verify
                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_verify_recover_init and OSSL_FUNC_signature_verify_recover
                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_digest_sign_init, OSSL_FUNC_signature_digest_sign_update and OSSL_FUNC_signature_digest_sign_final
                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_digest_verify_init, OSSL_FUNC_signature_digest_verify_update and OSSL_FUNC_signature_digest_verify_final
                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_digest_sign_init and OSSL_FUNC_signature_digest_sign
                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_digest_verify_init and OSSL_FUNC_signature_digest_verify

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_set_ctx_params and OSSL_FUNC_signature_settable_ctx_params are optional, but if one of them is present then the other one must also be present. The same applies to OSSL_FUNC_signature_get_ctx_params and OSSL_FUNC_signature_gettable_ctx_params, as well as the \"md_params\" functions. The OSSL_FUNC_signature_dupctx function is optional.

                                                                                                                                                                                                                                                                      A signature algorithm must also implement some mechanism for generating, loading or importing keys via the key management (OSSL_OP_KEYMGMT) operation. See provider-keymgmt(7) for further details.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#context-management-functions","title":"Context Management Functions","text":"

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_newctx() should create and return a pointer to a provider side structure for holding context information during a signature operation. A pointer to this context will be passed back in a number of the other signature operation function calls. The parameter provctx is the provider context generated during provider initialisation (see provider(7)). The propq parameter is a property query string that may be (optionally) used by the provider during any \"fetches\" that it may perform (if it performs any).

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_freectx() is passed a pointer to the provider side signature context in the ctx parameter. This function should free any resources associated with that context.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_dupctx() should duplicate the provider side signature context in the ctx parameter and return the duplicate copy.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#signing-functions","title":"Signing Functions","text":"

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_sign_init() initialises a context for signing given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_sign() performs the actual signing itself. A previously initialised signature context is passed in the ctx parameter. The data to be signed is pointed to be the tbs parameter which is tbslen bytes long. Unless sig is NULL, the signature should be written to the location pointed to by the sig parameter and it should not exceed sigsize bytes in length. The length of the signature should be written to *siglen. If sig is NULL then the maximum length of the signature should be written to *siglen.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#verify-functions","title":"Verify Functions","text":"

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_verify_init() initialises a context for verifying a signature given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_verify() performs the actual verification itself. A previously initialised signature context is passed in the ctx parameter. The data that the signature covers is pointed to be the tbs parameter which is tbslen bytes long. The signature is pointed to by the sig parameter which is siglen bytes long.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#verify-recover-functions","title":"Verify Recover Functions","text":"

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_verify_recover_init() initialises a context for recovering the signed data given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_verify_recover() performs the actual verify recover itself. A previously initialised signature context is passed in the ctx parameter. The signature is pointed to by the sig parameter which is siglen bytes long. Unless rout is NULL, the recovered data should be written to the location pointed to by rout which should not exceed routsize bytes in length. The length of the recovered data should be written to *routlen. If rout is NULL then the maximum size of the output buffer is written to the routlen parameter.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#digest-sign-functions","title":"Digest Sign Functions","text":"

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digeset_sign_init() initialises a context for signing given a provider side signature context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to using OSSL_FUNC_signature_set_ctx_params() and OSSL_FUNC_signature_set_ctx_md_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>. The name of the digest to be used will be in the mdname parameter.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digest_sign_update() provides data to be signed in the data parameter which should be of length datalen. A previously initialised signature context is passed in the ctx parameter. This function may be called multiple times to cumulatively add data to be signed.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digest_sign_final() finalises a signature operation previously started through OSSL_FUNC_signature_digest_sign_init() and OSSL_FUNC_signature_digest_sign_update() calls. Once finalised no more data will be added through OSSL_FUNC_signature_digest_sign_update(). A previously initialised signature context is passed in the ctx parameter. Unless sig is NULL, the signature should be written to the location pointed to by the sig parameter and it should not exceed sigsize bytes in length. The length of the signature should be written to *siglen. If sig is NULL then the maximum length of the signature should be written to *siglen.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digest_sign() implements a \"one shot\" digest sign operation previously started through OSSL_FUNC_signature_digeset_sign_init(). A previously initialised signature context is passed in the ctx parameter. The data to be signed is in tbs which should be tbslen bytes long. Unless sig is NULL, the signature should be written to the location pointed to by the sig parameter and it should not exceed sigsize bytes in length. The length of the signature should be written to *siglen. If sig is NULL then the maximum length of the signature should be written to *siglen.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#digest-verify-functions","title":"Digest Verify Functions","text":"

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digeset_verify_init() initialises a context for verifying given a provider side verification context in the ctx parameter, and a pointer to a provider key object in the provkey parameter. The params, if not NULL, should be set on the context in a manner similar to OSSL_FUNC_signature_set_ctx_params() and OSSL_FUNC_signature_set_ctx_md_params(). The key object should have been previously generated, loaded or imported into the provider using the key management (OSSL_OP_KEYMGMT) operation (see provider-keymgmt(7)>. The name of the digest to be used will be in the mdname parameter.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digest_verify_update() provides data to be verified in the data parameter which should be of length datalen. A previously initialised verification context is passed in the ctx parameter. This function may be called multiple times to cumulatively add data to be verified.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digest_verify_final() finalises a verification operation previously started through OSSL_FUNC_signature_digest_verify_init() and OSSL_FUNC_signature_digest_verify_update() calls. Once finalised no more data will be added through OSSL_FUNC_signature_digest_verify_update(). A previously initialised verification context is passed in the ctx parameter. The signature to be verified is in sig which is siglen bytes long.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_digest_verify() implements a \"one shot\" digest verify operation previously started through OSSL_FUNC_signature_digeset_verify_init(). A previously initialised verification context is passed in the ctx parameter. The data to be verified is in tbs which should be tbslen bytes long. The signature to be verified is in sig which is siglen bytes long.

                                                                                                                                                                                                                                                                      "},{"location":"man7/provider-signature/#signature-parameters","title":"Signature parameters","text":"

                                                                                                                                                                                                                                                                      See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_signature_get_ctx_params() and OSSL_FUNC_signature_set_ctx_params() functions.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_get_ctx_params() gets signature parameters associated with the given provider side signature context ctx and stored them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                      OSSL_FUNC_signature_set_ctx_params() sets the signature parameters associated with the given provider side signature context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                      Common parameters currently recognised by built-in signature algorithms are as follows.

                                                                                                                                                                                                                                                                      • \"digest\" (OSSL_SIGNATURE_PARAM_DIGEST)

                                                                                                                                                                                                                                                                        Get or sets the name of the digest algorithm used for the input to the signature functions. It is required in order to calculate the \"algorithm-id\".

                                                                                                                                                                                                                                                                      • \"properties\" (OSSL_SIGNATURE_PARAM_PROPERTIES)

                                                                                                                                                                                                                                                                        Sets the name of the property query associated with the \"digest\" algorithm. NULL is used if this optional value is not set.

                                                                                                                                                                                                                                                                      • \"digest-size\" (OSSL_SIGNATURE_PARAM_DIGEST_SIZE) <unsigned integer>

                                                                                                                                                                                                                                                                        Gets or sets the output size of the digest algorithm used for the input to the signature functions. The length of the \"digest-size\" parameter should not exceed that of a size_t.

                                                                                                                                                                                                                                                                      • \"algorithm-id\" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>

                                                                                                                                                                                                                                                                        Gets the DER encoded AlgorithmIdentifier that corresponds to the combination of signature algorithm and digest algorithm for the signature operation.

                                                                                                                                                                                                                                                                      • \"kat\" (OSSL_SIGNATURE_PARAM_KAT) <unsigned integer>

                                                                                                                                                                                                                                                                        Sets a flag to modify the sign operation to return an error if the initial calculated signature is invalid. In the normal mode of operation - new random values are chosen until the signature operation succeeds. By default it retries until a signature is calculated. Setting the value to 0 causes the sign operation to retry, otherwise the sign operation is only tried once and returns whether or not it was successful. Known answer tests can be performed if the random generator is overridden to supply known values that either pass or fail.

                                                                                                                                                                                                                                                                      • OSSL_FUNC_signature_gettable_ctx_params() and OSSL_FUNC_signature_settable_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable parameters, i.e. parameters that can be used with OSSL_FUNC_signature_get_ctx_params() and OSSL_FUNC_signature_set_ctx_params() respectively.

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-signature/#md-parameters","title":"MD parameters","text":"

                                                                                                                                                                                                                                                                        See OSSL_PARAM(3) for further details on the parameters structure used by the OSSL_FUNC_signature_get_md_ctx_params() and OSSL_FUNC_signature_set_md_ctx_params() functions.

                                                                                                                                                                                                                                                                        OSSL_FUNC_signature_get_md_ctx_params() gets digest parameters associated with the given provider side digest signature context ctx and stores them in params. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                        OSSL_FUNC_signature_set_ms_ctx_params() sets the digest parameters associated with the given provider side digest signature context ctx to params. Any parameter settings are additional to any that were previously set. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                        Parameters currently recognised by built-in signature algorithms are the same as those for built-in digest algorithms. See \"Digest Parameters\" in provider-digest(7) for further information.

                                                                                                                                                                                                                                                                        OSSL_FUNC_signature_gettable_md_ctx_params() and OSSL_FUNC_signature_settable_md_ctx_params() get a constant OSSL_PARAM(3) array that describes the gettable and settable digest parameters, i.e. parameters that can be used with OSSL_FUNC_signature_get_md_ctx_params() and OSSL_FUNC_signature_set_md_ctx_params() respectively.

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-signature/#return-values","title":"RETURN VALUES","text":"

                                                                                                                                                                                                                                                                        OSSL_FUNC_signature_newctx() and OSSL_FUNC_signature_dupctx() should return the newly created provider side signature context, or NULL on failure.

                                                                                                                                                                                                                                                                        OSSL_FUNC_signature_gettable_ctx_params(), OSSL_FUNC_signature_settable_ctx_params(), OSSL_FUNC_signature_gettable_md_ctx_params() and OSSL_FUNC_signature_settable_md_ctx_params(), return the gettable or settable parameters in a constant OSSL_PARAM(3) array.

                                                                                                                                                                                                                                                                        All other functions should return 1 for success or 0 on error.

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-signature/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                        provider(7)

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-signature/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                        The provider SIGNATURE interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-signature/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                        Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                        Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-storemgmt/","title":"provider-storemgmt","text":""},{"location":"man7/provider-storemgmt/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                        provider-storemgmt - The OSSL_STORE library <-> provider functions

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-storemgmt/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                                        #include <openssl/core_dispatch.h>\n\n/*\n * None of these are actual functions, but are displayed like this for\n * the function signatures for functions that are offered as function\n * pointers in OSSL_DISPATCH arrays.\n */\n\nvoid *OSSL_FUNC_store_open(void *provctx, const char *uri);\nvoid *OSSL_FUNC_store_attach(void *provctx, OSSL_CORE_BIO *bio);\nconst OSSL_PARAM *store_settable_ctx_params(void *provctx);\nint OSSL_FUNC_store_set_ctx_params(void *loaderctx, const OSSL_PARAM[]);\nint OSSL_FUNC_store_load(void *loaderctx,\n                         OSSL_CALLBACK *object_cb, void *object_cbarg,\n                         OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg);\nint OSSL_FUNC_store_eof(void *loaderctx);\nint OSSL_FUNC_store_close(void *loaderctx);\n\nint OSSL_FUNC_store_export_object\n    (void *loaderctx, const void *objref, size_t objref_sz,\n     OSSL_CALLBACK *export_cb, void *export_cbarg);\n
                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-storemgmt/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                        The STORE operation is the provider side of the ossl_store(7) API.

                                                                                                                                                                                                                                                                        The primary responsibility of the STORE operation is to load all sorts of objects from a container indicated by URI. These objects are given to the OpenSSL library in provider-native object abstraction form (see provider-object(7)). The OpenSSL library is then responsible for passing on that abstraction to suitable provided functions.

                                                                                                                                                                                                                                                                        Examples of functions that the OpenSSL library can pass the abstraction to include OSSL_FUNC_keymgmt_load() (provider-keymgmt(7)), OSSL_FUNC_store_export_object() (which exports the object in parameterized form).

                                                                                                                                                                                                                                                                        All \"functions\" mentioned here are passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays that are returned by the provider's provider_query_operation() function (see \"Provider Functions\" in provider-base(7)).

                                                                                                                                                                                                                                                                        All these \"functions\" have a corresponding function type definition named OSSL_FUNC_{name}_fn, and a helper function to retrieve the function pointer from a OSSL_DISPATCH(3) element named OSSL_get_{name}. For example, the \"function\" OSSL_FUNC_store_attach() has these:

                                                                                                                                                                                                                                                                        typedef void *(OSSL_FUNC_store_attach_fn)(void *provctx,\n                                          OSSL_CORE_BIO * bio);\nstatic ossl_inline OSSL_FUNC_store_attach_fn\n    OSSL_FUNC_store_attach(const OSSL_DISPATCH *opf);\n

                                                                                                                                                                                                                                                                        OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), as follows:

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_open                 OSSL_FUNC_STORE_OPEN\nOSSL_FUNC_store_attach               OSSL_FUNC_STORE_ATTACH\nOSSL_FUNC_store_settable_ctx_params  OSSL_FUNC_STORE_SETTABLE_CTX_PARAMS\nOSSL_FUNC_store_set_ctx_params       OSSL_FUNC_STORE_SET_CTX_PARAMS\nOSSL_FUNC_store_load                 OSSL_FUNC_STORE_LOAD\nOSSL_FUNC_store_eof                  OSSL_FUNC_STORE_EOF\nOSSL_FUNC_store_close                OSSL_FUNC_STORE_CLOSE\nOSSL_FUNC_store_export_object        OSSL_FUNC_STORE_EXPORT_OBJECT\n
                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-storemgmt/#functions","title":"Functions","text":"

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_open() should create a provider side context with data based on the input uri. The implementation is entirely responsible for the interpretation of the URI.

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_attach() should create a provider side context with the core BIO bio attached. This is an alternative to using a URI to find storage, supporting OSSL_STORE_attach(3).

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_settable_ctx_params() should return a constant array of descriptor OSSL_PARAM(3), for parameters that OSSL_FUNC_store_set_ctx_params() can handle.

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_set_ctx_params() should set additional parameters, such as what kind of data to expect, search criteria, and so on. More on those below, in \"Load Parameters\". Whether unrecognised parameters are an error or simply ignored is at the implementation's discretion. Passing NULL for params should return true.

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_load() loads the next object from the URI opened by OSSL_FUNC_store_open(), creates an object abstraction for it (see provider-object(7)), and calls object_cb with it as well as object_cbarg. object_cb will then interpret the object abstraction and do what it can to wrap it or decode it into an OpenSSL structure. In case a passphrase needs to be prompted to unlock an object, pw_cb should be called.

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_eof() indicates if the end of the set of objects from the URI has been reached. When that happens, there's no point trying to do any further loading.

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_close() frees the provider side context ctx.

                                                                                                                                                                                                                                                                        When a provider-native object is created by a store manager it would be unsuitable for direct use with a foreign provider. The export function allows for exporting the object to that foreign provider if the foreign provider supports the type of the object and provides an import function.

                                                                                                                                                                                                                                                                        OSSL_FUNC_store_export_object() should export the object of size objref_sz referenced by objref as an OSSL_PARAM(3) array and pass that to the export_cb as well as the given export_cbarg.

                                                                                                                                                                                                                                                                        "},{"location":"man7/provider-storemgmt/#load-parameters","title":"Load Parameters","text":"
                                                                                                                                                                                                                                                                        • \"expect\" (OSSL_STORE_PARAM_EXPECT) <integer>

                                                                                                                                                                                                                                                                          Is a hint of what type of data the OpenSSL library expects to get. This is only useful for optimization, as the library will check that the object types match the expectation too.

                                                                                                                                                                                                                                                                          The number that can be given through this parameter is found in <openssl/store.h>, with the macros having names starting with OSSL_STORE_INFO_. These are further described in \"SUPPORTED OBJECTS\" in OSSL_STORE_INFO(3).

                                                                                                                                                                                                                                                                        • \"subject\" (OSSL_STORE_PARAM_SUBJECT) <octet string>

                                                                                                                                                                                                                                                                          Indicates that the caller wants to search for an object with the given subject associated. This can be used to select specific certificates by subject.

                                                                                                                                                                                                                                                                          The contents of the octet string is expected to be in DER form.

                                                                                                                                                                                                                                                                        • \"issuer\" (OSSL_STORE_PARAM_ISSUER) <octet string>

                                                                                                                                                                                                                                                                          Indicates that the caller wants to search for an object with the given issuer associated. This can be used to select specific certificates by issuer.

                                                                                                                                                                                                                                                                          The contents of the octet string is expected to be in DER form.

                                                                                                                                                                                                                                                                        • \"serial\" (OSSL_STORE_PARAM_SERIAL) <integer>

                                                                                                                                                                                                                                                                          Indicates that the caller wants to search for an object with the given serial number associated.

                                                                                                                                                                                                                                                                        • \"digest\" (OSSL_STORE_PARAM_DIGEST)

                                                                                                                                                                                                                                                                        • \"fingerprint\" (OSSL_STORE_PARAM_FINGERPRINT) <octet string>

                                                                                                                                                                                                                                                                          Indicates that the caller wants to search for an object with the given fingerprint, computed with the given digest.

                                                                                                                                                                                                                                                                        • \"alias\" (OSSL_STORE_PARAM_ALIAS)

                                                                                                                                                                                                                                                                          Indicates that the caller wants to search for an object with the given alias (some call it a \"friendly name\").

                                                                                                                                                                                                                                                                        • \"properties\" (OSSL_STORE_PARAM_PROPERTIES) <utf8 string>

                                                                                                                                                                                                                                                                          Property string to use when querying for algorithms such as the OSSL_DECODER decoder implementations.

                                                                                                                                                                                                                                                                        • \"input-type\" (OSSL_STORE_PARAM_INPUT_TYPE) <utf8 string>

                                                                                                                                                                                                                                                                          Type of the input format as a hint to use when decoding the objects in the store.

                                                                                                                                                                                                                                                                        • Several of these search criteria may be combined. For example, to search for a certificate by issuer+serial, both the \"issuer\" and the \"serial\" parameters will be given.

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider-storemgmt/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                          provider(7)

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider-storemgmt/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                          The STORE interface was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider-storemgmt/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                          Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/","title":"provider","text":""},{"location":"man7/provider/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                          provider - OpenSSL operation implementation providers

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                                                                                                                                          #include <openssl/provider.h>

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#description","title":"DESCRIPTION","text":""},{"location":"man7/provider/#general","title":"General","text":"

                                                                                                                                                                                                                                                                          This page contains information useful to provider authors.

                                                                                                                                                                                                                                                                          A provider, in OpenSSL terms, is a unit of code that provides one or more implementations for various operations for diverse algorithms that one might want to perform.

                                                                                                                                                                                                                                                                          An operation is something one wants to do, such as encryption and decryption, key derivation, MAC calculation, signing and verification, etc.

                                                                                                                                                                                                                                                                          An algorithm is a named method to perform an operation. Very often, the algorithms revolve around cryptographic operations, but may also revolve around other types of operation, such as managing certain types of objects.

                                                                                                                                                                                                                                                                          See crypto(7) for further details.

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#provider_1","title":"Provider","text":"

                                                                                                                                                                                                                                                                          A provider offers an initialization function, as a set of base functions in the form of an OSSL_DISPATCH(3) array, and by extension, a set of OSSL_ALGORITHM(3)s (see openssl-core.h(7)). It may be a dynamically loadable module, or may be built-in, in OpenSSL libraries or in the application. If it's a dynamically loadable module, the initialization function must be named OSSL_provider_init and must be exported. If it's built-in, the initialization function may have any name.

                                                                                                                                                                                                                                                                          The initialization function must have the following signature:

                                                                                                                                                                                                                                                                          int NAME(const OSSL_CORE_HANDLE *handle,\n         const OSSL_DISPATCH *in, const OSSL_DISPATCH **out,\n         void **provctx);\n

                                                                                                                                                                                                                                                                          handle is the OpenSSL library object for the provider, and works as a handle for everything the OpenSSL libraries need to know about the provider. For the provider itself, it is passed to some of the functions given in the dispatch array in.

                                                                                                                                                                                                                                                                          in is a dispatch array of base functions offered by the OpenSSL libraries, and the available functions are further described in provider-base(7).

                                                                                                                                                                                                                                                                          *out must be assigned a dispatch array of base functions that the provider offers to the OpenSSL libraries. The functions that may be offered are further described in provider-base(7), and they are the central means of communication between the OpenSSL libraries and the provider.

                                                                                                                                                                                                                                                                          *provctx should be assigned a provider specific context to allow the provider multiple simultaneous uses. This pointer will be passed to various operation functions offered by the provider.

                                                                                                                                                                                                                                                                          Note that the provider will not be made available for applications to use until the initialization function has completed and returned successfully.

                                                                                                                                                                                                                                                                          One of the functions the provider offers to the OpenSSL libraries is the central mechanism for the OpenSSL libraries to get access to operation implementations for diverse algorithms. Its referred to with the number OSSL_FUNC_PROVIDER_QUERY_OPERATION and has the following signature:

                                                                                                                                                                                                                                                                          const OSSL_ALGORITHM *provider_query_operation(void *provctx,\n                                               int operation_id,\n                                               const int *no_store);\n

                                                                                                                                                                                                                                                                          provctx is the provider specific context that was passed back by the initialization function.

                                                                                                                                                                                                                                                                          operation_id is an operation identity (see \"Operations\" below).

                                                                                                                                                                                                                                                                          no_store is a flag back to the OpenSSL libraries which, when nonzero, signifies that the OpenSSL libraries will not store a reference to the returned data in their internal store of implementations.

                                                                                                                                                                                                                                                                          The returned OSSL_ALGORITHM(3) is the foundation of any OpenSSL library API that uses providers for their implementation, most commonly in the fetching type of functions (see \"ALGORITHM FETCHING\" in crypto(7)).

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#operations","title":"Operations","text":"

                                                                                                                                                                                                                                                                          Operations are referred to with numbers, via macros with names starting with OSSL_OP_.

                                                                                                                                                                                                                                                                          With each operation comes a set of defined function types that a provider may or may not offer, depending on its needs.

                                                                                                                                                                                                                                                                          Currently available operations are:

                                                                                                                                                                                                                                                                          • Digests

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is EVP_MD. The number for this operation is OSSL_OP_DIGEST. The functions the provider can offer are described in provider-digest(7).

                                                                                                                                                                                                                                                                          • Symmetric ciphers

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is EVP_CIPHER. The number for this operation is OSSL_OP_CIPHER. The functions the provider can offer are described in provider-cipher(7).

                                                                                                                                                                                                                                                                          • Message Authentication Code (MAC)

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is EVP_MAC. The number for this operation is OSSL_OP_MAC. The functions the provider can offer are described in provider-mac(7).

                                                                                                                                                                                                                                                                          • Key Derivation Function (KDF)

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is EVP_KDF. The number for this operation is OSSL_OP_KDF. The functions the provider can offer are described in provider-kdf(7).

                                                                                                                                                                                                                                                                          • Key Exchange

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is EVP_KEYEXCH. The number for this operation is OSSL_OP_KEYEXCH. The functions the provider can offer are described in provider-keyexch(7).

                                                                                                                                                                                                                                                                          • Asymmetric Ciphers

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is EVP_ASYM_CIPHER. The number for this operation is OSSL_OP_ASYM_CIPHER. The functions the provider can offer are described in provider-asym_cipher(7).

                                                                                                                                                                                                                                                                          • Asymmetric Key Encapsulation

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is EVP_KEM. The number for this operation is OSSL_OP_KEM. The functions the provider can offer are described in provider-kem(7).

                                                                                                                                                                                                                                                                          • Encoding

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is OSSL_ENCODER. The number for this operation is OSSL_OP_ENCODER. The functions the provider can offer are described in provider-encoder(7).

                                                                                                                                                                                                                                                                          • Decoding

                                                                                                                                                                                                                                                                            In the OpenSSL libraries, the corresponding method object is OSSL_DECODER. The number for this operation is OSSL_OP_DECODER. The functions the provider can offer are described in provider-decoder(7).

                                                                                                                                                                                                                                                                          • Random Number Generation

                                                                                                                                                                                                                                                                            The number for this operation is OSSL_OP_RAND. The functions the provider can offer for random number generation are described in provider-rand(7).

                                                                                                                                                                                                                                                                          • Key Management

                                                                                                                                                                                                                                                                            The number for this operation is OSSL_OP_KEYMGMT. The functions the provider can offer for key management are described in provider-keymgmt(7).

                                                                                                                                                                                                                                                                          • Signing and Signature Verification

                                                                                                                                                                                                                                                                            The number for this operation is OSSL_OP_SIGNATURE. The functions the provider can offer for digital signatures are described in provider-signature(7).

                                                                                                                                                                                                                                                                          • Store Management

                                                                                                                                                                                                                                                                            The number for this operation is OSSL_OP_STORE. The functions the provider can offer for store management are described in provider-storemgmt(7).

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#algorithm-naming","title":"Algorithm naming","text":"

                                                                                                                                                                                                                                                                          Algorithm names are case insensitive. Any particular algorithm can have multiple aliases associated with it. The canonical OpenSSL naming scheme follows this format:

                                                                                                                                                                                                                                                                          ALGNAME[VERSION?][-SUBNAME[VERSION?]?][-SIZE?][-MODE?]

                                                                                                                                                                                                                                                                          VERSION is only present if there are multiple versions of an algorithm (e.g. MD2, MD4, MD5). It may be omitted if there is only one version.

                                                                                                                                                                                                                                                                          SUBNAME may be present where multiple algorithms are combined together, e.g. MD5-SHA1.

                                                                                                                                                                                                                                                                          SIZE is only present if multiple versions of an algorithm exist with different sizes (e.g. AES-128-CBC, AES-256-CBC)

                                                                                                                                                                                                                                                                          MODE is only present where applicable.

                                                                                                                                                                                                                                                                          Other aliases may exist for example where standards bodies or common practice use alternative names or names that OpenSSL has used historically.

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#openssl-providers","title":"OPENSSL PROVIDERS","text":"

                                                                                                                                                                                                                                                                          OpenSSL provides a number of its own providers. These are the default, base, fips, legacy and null providers. See crypto(7) for an overview of these providers.

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                          EVP_DigestInit_ex(3), EVP_EncryptInit_ex(3), OSSL_LIB_CTX(3), EVP_set_default_properties(3), EVP_MD_fetch(3), EVP_CIPHER_fetch(3), EVP_KEYMGMT_fetch(3), openssl-core.h(7), provider-base(7), provider-digest(7), provider-cipher(7), provider-keyexch(7)

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#history","title":"HISTORY","text":"

                                                                                                                                                                                                                                                                          The concept of providers and everything surrounding them was introduced in OpenSSL 3.0.

                                                                                                                                                                                                                                                                          "},{"location":"man7/provider/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                          Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/","title":"proxy-certificates","text":""},{"location":"man7/proxy-certificates/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                          proxy-certificates - Proxy certificates in OpenSSL

                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                          Proxy certificates are defined in RFC 3820. They are used to extend rights to some other entity (a computer process, typically, or sometimes to the user itself). This allows the entity to perform operations on behalf of the owner of the EE (End Entity) certificate.

                                                                                                                                                                                                                                                                          The requirements for a valid proxy certificate are:

                                                                                                                                                                                                                                                                          • They are issued by an End Entity, either a normal EE certificate, or another proxy certificate.
                                                                                                                                                                                                                                                                          • They must not have the subjectAltName or issuerAltName extensions.
                                                                                                                                                                                                                                                                          • They must have the proxyCertInfo extension.
                                                                                                                                                                                                                                                                          • They must have the subject of their issuer, with one commonName added.
                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/#enabling-proxy-certificate-verification","title":"Enabling proxy certificate verification","text":"

                                                                                                                                                                                                                                                                          OpenSSL expects applications that want to use proxy certificates to be specially aware of them, and make that explicit. This is done by setting an X509 verification flag:

                                                                                                                                                                                                                                                                          X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS);\n

                                                                                                                                                                                                                                                                          or

                                                                                                                                                                                                                                                                          X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_ALLOW_PROXY_CERTS);\n

                                                                                                                                                                                                                                                                          See \"NOTES\" for a discussion on this requirement.

                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/#creating-proxy-certificates","title":"Creating proxy certificates","text":"

                                                                                                                                                                                                                                                                          Creating proxy certificates can be done using the openssl-x509(1) command, with some extra extensions:

                                                                                                                                                                                                                                                                          [ proxy ]\n

                                                                                                                                                                                                                                                                          # # A proxy certificate MUST NEVER be a CA certificate. basicConstraints = CA:FALSE # # Usual authority key ID authorityKeyIdentifier = keyid,issuer:always # # The extension which marks this certificate as a proxy proxyCertInfo = critical,language:id-ppl-anyLanguage,pathlen:1,policy:text:AB

                                                                                                                                                                                                                                                                          It's also possible to specify the proxy extension in a separate section:

                                                                                                                                                                                                                                                                          proxyCertInfo = critical,@proxy_ext\n\n[ proxy_ext ]\nlanguage = id-ppl-anyLanguage\npathlen = 0\npolicy = text:BC\n

                                                                                                                                                                                                                                                                          The policy value has a specific syntax, syntag:string, where the syntag determines what will be done with the string. The following _syntag_s are recognised:

                                                                                                                                                                                                                                                                          • text

                                                                                                                                                                                                                                                                            indicates that the string is a byte sequence, without any encoding:

                                                                                                                                                                                                                                                                            policy=text:r\u00e4ksm\u00f6rg\u00e5s\n
                                                                                                                                                                                                                                                                          • hex

                                                                                                                                                                                                                                                                            indicates the string is encoded hexadecimal encoded binary data, with colons between each byte (every second hex digit):

                                                                                                                                                                                                                                                                            policy=hex:72:E4:6B:73:6D:F6:72:67:E5:73\n
                                                                                                                                                                                                                                                                          • file

                                                                                                                                                                                                                                                                            indicates that the text of the policy should be taken from a file. The string is then a filename. This is useful for policies that are more than a few lines, such as XML or other markup.

                                                                                                                                                                                                                                                                          Note that the proxy policy value is what determines the rights granted to the process during the proxy certificate, and it is up to the application to interpret and combine these policies.>

                                                                                                                                                                                                                                                                          With a proxy extension, creating a proxy certificate is a matter of two commands:

                                                                                                                                                                                                                                                                          openssl req -new -config proxy.cnf \\\n    -out proxy.req -keyout proxy.key \\\n    -subj \"/DC=org/DC=openssl/DC=users/CN=proxy\"\n\nopenssl x509 -req -CAcreateserial -in proxy.req -out proxy.crt \\\n    -CA user.crt -CAkey user.key -days 7 \\\n    -extfile proxy.cnf -extensions proxy\n

                                                                                                                                                                                                                                                                          You can also create a proxy certificate using another proxy certificate as issuer. Note that this example uses a different configuration section for the proxy extensions:

                                                                                                                                                                                                                                                                          openssl req -new -config proxy.cnf \\\n    -out proxy2.req -keyout proxy2.key \\\n    -subj \"/DC=org/DC=openssl/DC=users/CN=proxy/CN=proxy 2\"\n\nopenssl x509 -req -CAcreateserial -in proxy2.req -out proxy2.crt \\\n    -CA proxy.crt -CAkey proxy.key -days 7 \\\n    -extfile proxy.cnf -extensions proxy_2\n
                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/#using-proxy-certs-in-applications","title":"Using proxy certs in applications","text":"

                                                                                                                                                                                                                                                                          To interpret proxy policies, the application would normally start with some default rights (perhaps none at all), then compute the resulting rights by checking the rights against the chain of proxy certificates, user certificate and CA certificates.

                                                                                                                                                                                                                                                                          The complicated part is figuring out how to pass data between your application and the certificate validation procedure.

                                                                                                                                                                                                                                                                          The following ingredients are needed for such processing:

                                                                                                                                                                                                                                                                          • a callback function that will be called for every certificate being validated. The callback is called several times for each certificate, so you must be careful to do the proxy policy interpretation at the right time. You also need to fill in the defaults when the EE certificate is checked.
                                                                                                                                                                                                                                                                          • a data structure that is shared between your application code and the callback.
                                                                                                                                                                                                                                                                          • a wrapper function that sets it all up.
                                                                                                                                                                                                                                                                          • an ex_data index function that creates an index into the generic ex_data store that is attached to an X509 validation context.

                                                                                                                                                                                                                                                                          The following skeleton code can be used as a starting point:

                                                                                                                                                                                                                                                                          #include <string.h>\n#include <netdb.h>\n#include <openssl/x509.h>\n#include <openssl/x509v3.h>\n\n#define total_rights 25\n\n/*\n * In this example, I will use a view of granted rights as a bit\n * array, one bit for each possible right.\n */\ntypedef struct your_rights {\n    unsigned char rights[(total_rights + 7) / 8];\n} YOUR_RIGHTS;\n\n/*\n * The following procedure will create an index for the ex_data\n * store in the X509 validation context the first time it's\n * called.  Subsequent calls will return the same index.\n */\nstatic int get_proxy_auth_ex_data_idx(X509_STORE_CTX *ctx)\n{\n    static volatile int idx = -1;\n\n    if (idx < 0) {\n        X509_STORE_lock(X509_STORE_CTX_get0_store(ctx));\n        if (idx < 0) {\n            idx = X509_STORE_CTX_get_ex_new_index(0,\n                                                  \"for verify callback\",\n                                                  NULL,NULL,NULL);\n        }\n        X509_STORE_unlock(X509_STORE_CTX_get0_store(ctx));\n    }\n    return idx;\n}\n\n/* Callback to be given to the X509 validation procedure.  */\nstatic int verify_callback(int ok, X509_STORE_CTX *ctx)\n{\n    if (ok == 1) {\n        /*\n         * It's REALLY important you keep the proxy policy check\n         * within this section.  It's important to know that when\n         * ok is 1, the certificates are checked from top to\n         * bottom.  You get the CA root first, followed by the\n         * possible chain of intermediate CAs, followed by the EE\n         * certificate, followed by the possible proxy\n         * certificates.\n         */\n        X509 *xs = X509_STORE_CTX_get_current_cert(ctx);\n\n        if (X509_get_extension_flags(xs) & EXFLAG_PROXY) {\n            YOUR_RIGHTS *rights =\n                (YOUR_RIGHTS *)X509_STORE_CTX_get_ex_data(ctx,\n                    get_proxy_auth_ex_data_idx(ctx));\n            PROXY_CERT_INFO_EXTENSION *pci =\n                X509_get_ext_d2i(xs, NID_proxyCertInfo, NULL, NULL);\n\n            switch (OBJ_obj2nid(pci->proxyPolicy->policyLanguage)) {\n            case NID_Independent:\n                /*\n                 * Do whatever you need to grant explicit rights\n                 * to this particular proxy certificate, usually\n                 * by pulling them from some database.  If there\n                 * are none to be found, clear all rights (making\n                 * this and any subsequent proxy certificate void\n                 * of any rights).\n                 */\n                memset(rights->rights, 0, sizeof(rights->rights));\n                break;\n            case NID_id_ppl_inheritAll:\n                /*\n                 * This is basically a NOP, we simply let the\n                 * current rights stand as they are.\n                 */\n                break;\n            default:\n                /*\n                 * This is usually the most complex section of\n                 * code.  You really do whatever you want as long\n                 * as you follow RFC 3820.  In the example we use\n                 * here, the simplest thing to do is to build\n                 * another, temporary bit array and fill it with\n                 * the rights granted by the current proxy\n                 * certificate, then use it as a mask on the\n                 * accumulated rights bit array, and voil\u00e0, you\n                 * now have a new accumulated rights bit array.\n                 */\n                {\n                    int i;\n                    YOUR_RIGHTS tmp_rights;\n                    memset(tmp_rights.rights, 0,\n                           sizeof(tmp_rights.rights));\n\n                    /*\n                     * process_rights() is supposed to be a\n                     * procedure that takes a string and its\n                     * length, interprets it and sets the bits\n                     * in the YOUR_RIGHTS pointed at by the\n                     * third argument.\n                     */\n                    process_rights((char *) pci->proxyPolicy->policy->data,\n                                   pci->proxyPolicy->policy->length,\n                                   &tmp_rights);\n\n                    for(i = 0; i < total_rights / 8; i++)\n                        rights->rights[i] &= tmp_rights.rights[i];\n                }\n                break;\n            }\n            PROXY_CERT_INFO_EXTENSION_free(pci);\n        } else if (!(X509_get_extension_flags(xs) & EXFLAG_CA)) {\n            /* We have an EE certificate, let's use it to set default! */\n            YOUR_RIGHTS *rights =\n                (YOUR_RIGHTS *)X509_STORE_CTX_get_ex_data(ctx,\n                    get_proxy_auth_ex_data_idx(ctx));\n\n            /*\n             * The following procedure finds out what rights the\n             * owner of the current certificate has, and sets them\n             * in the YOUR_RIGHTS structure pointed at by the\n             * second argument.\n             */\n            set_default_rights(xs, rights);\n        }\n    }\n    return ok;\n}\n\nstatic int my_X509_verify_cert(X509_STORE_CTX *ctx,\n                               YOUR_RIGHTS *needed_rights)\n{\n    int ok;\n    int (*save_verify_cb)(int ok,X509_STORE_CTX *ctx) =\n        X509_STORE_CTX_get_verify_cb(ctx);\n    YOUR_RIGHTS rights;\n\n    X509_STORE_CTX_set_verify_cb(ctx, verify_callback);\n    X509_STORE_CTX_set_ex_data(ctx, get_proxy_auth_ex_data_idx(ctx),\n                               &rights);\n    X509_STORE_CTX_set_flags(ctx, X509_V_FLAG_ALLOW_PROXY_CERTS);\n    ok = X509_verify_cert(ctx);\n\n    if (ok == 1) {\n        ok = check_needed_rights(rights, needed_rights);\n    }\n\n    X509_STORE_CTX_set_verify_cb(ctx, save_verify_cb);\n\n    return ok;\n}\n

                                                                                                                                                                                                                                                                          If you use SSL or TLS, you can easily set up a callback to have the certificates checked properly, using the code above:

                                                                                                                                                                                                                                                                          SSL_CTX_set_cert_verify_callback(s_ctx, my_X509_verify_cert,\n                                 &needed_rights);\n
                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/#notes","title":"NOTES","text":"

                                                                                                                                                                                                                                                                          To this date, it seems that proxy certificates have only been used in environments that are aware of them, and no one seems to have investigated how they can be used or misused outside of such an environment.

                                                                                                                                                                                                                                                                          For that reason, OpenSSL requires that applications aware of proxy certificates must also make that explicit.

                                                                                                                                                                                                                                                                          subjectAltName and issuerAltName are forbidden in proxy certificates, and this is enforced in OpenSSL. The subject must be the same as the issuer, with one commonName added on.

                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                          X509_STORE_CTX_set_flags(3), X509_STORE_CTX_set_verify_cb(3), X509_VERIFY_PARAM_set_flags(3), SSL_CTX_set_cert_verify_callback(3), openssl-req(1), openssl-x509(1), RFC 3820

                                                                                                                                                                                                                                                                          "},{"location":"man7/proxy-certificates/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                          Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                          "},{"location":"man7/ssl/","title":"ssl","text":""},{"location":"man7/ssl/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                          ssl - OpenSSL SSL/TLS library

                                                                                                                                                                                                                                                                          "},{"location":"man7/ssl/#synopsis","title":"SYNOPSIS","text":"

                                                                                                                                                                                                                                                                          See the individual manual pages for details.

                                                                                                                                                                                                                                                                          "},{"location":"man7/ssl/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                          The OpenSSL ssl library implements several versions of the Secure Sockets Layer, Transport Layer Security, and Datagram Transport Layer Security protocols. This page gives a brief overview of the extensive API and data types provided by the library.

                                                                                                                                                                                                                                                                          An SSL_CTX object is created as a framework to establish TLS/SSL enabled connections (see SSL_CTX_new(3)). Various options regarding certificates, algorithms etc. can be set in this object.

                                                                                                                                                                                                                                                                          When a network connection has been created, it can be assigned to an SSL object. After the SSL object has been created using SSL_new(3), SSL_set_fd(3) or SSL_set_bio(3) can be used to associate the network connection with the object.

                                                                                                                                                                                                                                                                          When the TLS/SSL handshake is performed using SSL_accept(3) or SSL_connect(3) respectively. SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) and SSL_write(3) are used to read and write data on the TLS/SSL connection. SSL_shutdown(3) can be used to shut down the TLS/SSL connection.

                                                                                                                                                                                                                                                                          "},{"location":"man7/ssl/#data-structures","title":"DATA STRUCTURES","text":"

                                                                                                                                                                                                                                                                          Here are some of the main data structures in the library.

                                                                                                                                                                                                                                                                          • SSL_METHOD (SSL Method)

                                                                                                                                                                                                                                                                            This is a dispatch structure describing the internal ssl library methods/functions which implement the various protocol versions (SSLv3 TLSv1, ...). It's needed to create an SSL_CTX.

                                                                                                                                                                                                                                                                          • SSL_CIPHER (SSL Cipher)

                                                                                                                                                                                                                                                                            This structure holds the algorithm information for a particular cipher which are a core part of the SSL/TLS protocol. The available ciphers are configured on a SSL_CTX basis and the actual ones used are then part of the SSL_SESSION.

                                                                                                                                                                                                                                                                          • SSL_CTX (SSL Context)

                                                                                                                                                                                                                                                                            This is the global context structure which is created by a server or client once per program life-time and which holds mainly default values for the SSL structures which are later created for the connections.

                                                                                                                                                                                                                                                                          • SSL_SESSION (SSL Session)

                                                                                                                                                                                                                                                                            This is a structure containing the current TLS/SSL session details for a connection: SSL_CIPHERs, client and server certificates, keys, etc.

                                                                                                                                                                                                                                                                          • SSL (SSL Connection)

                                                                                                                                                                                                                                                                            This is the main SSL/TLS structure which is created by a server or client per established connection. This actually is the core structure in the SSL API. At run-time the application usually deals with this structure which has links to mostly all other structures.

                                                                                                                                                                                                                                                                          "},{"location":"man7/ssl/#header-files","title":"HEADER FILES","text":"

                                                                                                                                                                                                                                                                          Currently the OpenSSL ssl library provides the following C header files containing the prototypes for the data structures and functions:

                                                                                                                                                                                                                                                                          • <openssl/ssl.h>

                                                                                                                                                                                                                                                                            This is the common header file for the SSL/TLS API. Include it into your program to make the API of the ssl library available. It internally includes both more private SSL headers and headers from the crypto library. Whenever you need hard-core details on the internals of the SSL API, look inside this header file. This file also includes the others listed below.

                                                                                                                                                                                                                                                                          • <openssl/ssl2.h>

                                                                                                                                                                                                                                                                            Unused. Present for backwards compatibility only.

                                                                                                                                                                                                                                                                          • <openssl/ssl3.h>

                                                                                                                                                                                                                                                                            This is the sub header file dealing with the SSLv3 protocol only.

                                                                                                                                                                                                                                                                          • <openssl/tls1.h>

                                                                                                                                                                                                                                                                            This is the sub header file dealing with the TLSv1 protocol only.

                                                                                                                                                                                                                                                                          "},{"location":"man7/ssl/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                          Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                          "},{"location":"man7/x509/","title":"x509","text":""},{"location":"man7/x509/#name","title":"NAME","text":"

                                                                                                                                                                                                                                                                          x509 - X.509 certificate handling

                                                                                                                                                                                                                                                                          "},{"location":"man7/x509/#synopsis","title":"SYNOPSIS","text":"
                                                                                                                                                                                                                                                                          #include <openssl/x509.h>\n
                                                                                                                                                                                                                                                                          "},{"location":"man7/x509/#description","title":"DESCRIPTION","text":"

                                                                                                                                                                                                                                                                          An X.509 certificate is a structured grouping of information about an individual, a device, or anything one can imagine. An X.509 CRL (certificate revocation list) is a tool to help determine if a certificate is still valid. The exact definition of those can be found in the X.509 document from ITU-T, or in RFC3280 from PKIX. In OpenSSL, the type X509 is used to express such a certificate, and the type X509_CRL is used to express a CRL.

                                                                                                                                                                                                                                                                          A related structure is a certificate request, defined in PKCS#10 from RSA Security, Inc, also reflected in RFC2896. In OpenSSL, the type X509_REQ is used to express such a certificate request.

                                                                                                                                                                                                                                                                          To handle some complex parts of a certificate, there are the types X509_NAME (to express a certificate name), X509_ATTRIBUTE (to express a certificate attribute), X509_EXTENSION (to express a certificate extension) and a few more.

                                                                                                                                                                                                                                                                          Finally, there's the supertype X509_INFO, which can contain a CRL, a certificate and a corresponding private key.

                                                                                                                                                                                                                                                                          X509_XXX, d2i_X509_XXX, and i2d_X509_XXX functions handle X.509 certificates, with some exceptions, shown below.

                                                                                                                                                                                                                                                                          X509_CRL_XXX, d2i_X509_CRL_XXX, and i2d_X509_CRL_XXX functions handle X.509 CRLs.

                                                                                                                                                                                                                                                                          X509_REQ_XXX, d2i_X509_REQ_XXX, and i2d_X509_REQ_XXX functions handle PKCS#10 certificate requests.

                                                                                                                                                                                                                                                                          X509_NAME_XXX functions handle certificate names.

                                                                                                                                                                                                                                                                          X509_ATTRIBUTE_XXX functions handle certificate attributes.

                                                                                                                                                                                                                                                                          X509_EXTENSION_XXX functions handle certificate extensions.

                                                                                                                                                                                                                                                                          "},{"location":"man7/x509/#see-also","title":"SEE ALSO","text":"

                                                                                                                                                                                                                                                                          X509_NAME_ENTRY_get_object(3), X509_NAME_add_entry_by_txt(3), X509_NAME_add_entry_by_NID(3), X509_NAME_print_ex(3), X509_NAME_new(3), PEM_X509_INFO_read(3), d2i_X509(3), d2i_X509_ALGOR(3), d2i_X509_CRL(3), d2i_X509_NAME(3), d2i_X509_REQ(3), d2i_X509_SIG(3), crypto(7)

                                                                                                                                                                                                                                                                          "},{"location":"man7/x509/#copyright","title":"COPYRIGHT","text":"

                                                                                                                                                                                                                                                                          Copyright 2003-2021 The OpenSSL Project Authors. All Rights Reserved.

                                                                                                                                                                                                                                                                          Licensed under the Apache License 2.0 (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 https://www.openssl.org/source/license.html.

                                                                                                                                                                                                                                                                          "}]} \ No newline at end of file diff --git a/3.1/sitemap.xml b/3.1/sitemap.xml index 8cc38f71a..1e0c3f9ac 100644 --- a/3.1/sitemap.xml +++ b/3.1/sitemap.xml @@ -2,4017 +2,4017 @@ https://docs.openssl.org/3.1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/fips/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/CA.pl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-asn1parse/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-ca/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-ciphers/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-cmds/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-cmp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-cms/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-crl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-crl2pkcs7/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-dgst/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-dhparam/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-dsa/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-dsaparam/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-ec/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-ecparam/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-enc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-engine/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-errstr/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-fipsinstall/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-format-options/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-gendsa/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-genpkey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-genrsa/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-info/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-kdf/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-list/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-mac/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-namedisplay-options/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-nseq/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-ocsp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-passphrase-options/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-passwd/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-pkcs12/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-pkcs7/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-pkcs8/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-pkey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-pkeyparam/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-pkeyutl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-prime/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-rand/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-rehash/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-req/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-rsa/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-rsautl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-s_client/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-s_server/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-s_time/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-sess_id/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-smime/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-speed/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-spkac/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-srp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-storeutl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-ts/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-verification-options/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-verify/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-version/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl-x509/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/openssl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man1/tsget/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ADMISSIONS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_EXTERN_FUNCS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_INTEGER_get_int64/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_INTEGER_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_ITEM_lookup/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_OBJECT_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_STRING_TABLE_add/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_STRING_length/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_STRING_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_STRING_print_ex/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_TIME_set/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_TYPE_get/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_aux_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_generate_nconf/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_item_d2i_bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_item_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASN1_item_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASYNC_WAIT_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ASYNC_start_job/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BF_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_ADDR/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_ADDRINFO/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_connect/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_ctrl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_base64/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_buffer/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_cipher/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_md/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_null/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_prefix/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_readbuffer/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_f_ssl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_find_type/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_get_data/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_get_ex_new_index/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_new_CMS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_parse_hostserv/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_printf/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_push/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_read/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_accept/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_connect/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_core/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_datagram/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_fd/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_file/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_mem/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_null/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_s_socket/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_set_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_should_retry/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BIO_socket_wait/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_BLINDING_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_CTX_start/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_add/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_add_word/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_bn2bin/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_cmp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_copy/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_generate_prime/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_mod_exp_mont/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_mod_inverse/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_mod_mul_montgomery/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_mod_mul_reciprocal/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_num_bytes/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_rand/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_security_bits/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_set_bit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_swap/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BN_zero/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/BUF_MEM_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_EncryptedData_decrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_EncryptedData_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_EnvelopedData_create/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_add0_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_add1_recipient_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_add1_signer/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_compress/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_data_create/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_decrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_digest_create/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_final/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_get0_RecipientInfos/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_get0_SignerInfos/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_get0_type/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_get1_ReceiptRequest/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_sign_receipt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_signed_get_attr/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_uncompress/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_verify/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CMS_verify_receipt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CONF_modules_free/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CONF_modules_load_file/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CRYPTO_THREAD_run_once/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CRYPTO_get_ex_new_index/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CRYPTO_memcmp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CTLOG_STORE_get0_log_by_id/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CTLOG_STORE_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CTLOG_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/CT_POLICY_EVAL_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DEFINE_STACK_OF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DES_random_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_generate_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_generate_parameters/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_get0_pqg/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_get_1024_160/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_new_by_nid/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_set_method/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DH_size/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_SIG_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_do_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_dup_DH/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_generate_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_generate_parameters/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_get0_pqg/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_set_method/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DSA_size/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DTLS_get_data_mtu/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DTLS_set_timer_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/DTLSv1_listen/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ECDSA_SIG_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ECDSA_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ECPKParameters_print/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EC_GFp_simple_method/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EC_GROUP_copy/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EC_GROUP_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EC_KEY_get_enc_flags/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EC_KEY_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EC_POINT_add/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EC_POINT_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ENGINE_add/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_GET_LIB/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_clear_error/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_error_string/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_get_error/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_load_crypto_strings/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_load_strings/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_print_errors/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_put_error/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_remove_state/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/ERR_set_mark/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_ASYM_CIPHER_free/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_BytesToKey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_CIPHER_CTX_get_cipher_data/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_CIPHER_CTX_get_original_iv/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_CIPHER_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_DigestInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_DigestSignInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_DigestVerifyInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_EncodeInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_EncryptInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_KDF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_KEM_free/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_KEYEXCH_free/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_KEYMGMT/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_MAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_MD_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_OpenInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PBE_CipherInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY2PKCS8/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_ASN1_METHOD/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_ctrl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_get0_libctx/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_get0_pkey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_set1_pbe_pass/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_set_hkdf_md/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_set_params/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_set_scrypt_N/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_CTX_set_tls1_prf_md/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_asn1_get_count/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_check/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_copy_parameters/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_decapsulate/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_decrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_derive/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_digestsign_supports_digest/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_encapsulate/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_fromdata/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_get_attr/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_get_default_digest_nid/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_get_field_type/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_get_group_name/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_get_size/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_gettable_params/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_is_a/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_keygen/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_meth_get_count/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_print_private/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_set1_RSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_set1_encoded_public_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_set_type/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_settable_params/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_todata/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_verify/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_PKEY_verify_recover/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_RAND/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_SIGNATURE/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_SealInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_SignInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_VerifyInit/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_aes_128_gcm/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_aria_128_gcm/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_bf_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_blake2b512/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_camellia_128_ecb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_cast5_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_chacha20/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_des_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_desx_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_idea_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_md2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_md4/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_md5/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_mdc2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_rc2_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_rc4/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_rc5_32_12_16_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_ripemd160/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_seed_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_set_default_properties/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_sha1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_sha224/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_sha3_224/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_sm3/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_sm4_cbc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/EVP_whirlpool/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/HMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/MD5/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/MDC2_Init/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/NCONF_new_ex/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OBJ_nid2obj/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OCSP_REQUEST_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OCSP_cert_to_id/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OCSP_request_add1_nonce/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OCSP_resp_find_status/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OCSP_response_status/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OCSP_sendreq_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_Applink/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_FILE/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_LH_COMPFUNC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_LH_stats/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_config/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_fork_prepare/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_gmtime/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_hexchar2int/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_ia32cap/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_init_crypto/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_init_ssl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_instrument_bus/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_load_builtin_modules/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_malloc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_s390xcap/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_secure_malloc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OPENSSL_strcasecmp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_ALGORITHM/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CALLBACK/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_HDR_get0_transactionID/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_ITAV_set0/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_MSG_get0_header/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_MSG_http_perform/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_SRV_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_STATUSINFO_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_exec_certreq/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_log_open/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CMP_validate_msg/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CORE_MAKE_FUNC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CRMF_MSG_get0_tmpl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CRMF_MSG_set0_validity/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CRMF_MSG_set1_regCtrl_regToken/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CRMF_MSG_set1_regInfo_certReq/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_CRMF_pbmp_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_DECODER/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_DECODER_CTX/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_DECODER_CTX_new_for_pkey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_DECODER_from_bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_DISPATCH/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_ENCODER/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_ENCODER_CTX/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_ENCODER_CTX_new_for_pkey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_ENCODER_to_bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_ESS_check_signing_certs/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_HTTP_REQ_CTX/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_HTTP_parse_url/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_HTTP_transfer/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_ITEM/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_LIB_CTX/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_PARAM/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_PARAM_BLD/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_PARAM_allocate_from_text/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_PARAM_dup/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_PARAM_int/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_PROVIDER/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_SELF_TEST_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_SELF_TEST_set_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_STORE_INFO/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_STORE_LOADER/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_STORE_SEARCH/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_STORE_attach/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_STORE_expect/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_STORE_open/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_trace_enabled/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_trace_get_category_num/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OSSL_trace_set_channel/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OpenSSL_add_all_algorithms/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/OpenSSL_version/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_X509_INFO_read_bio_ex/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_bytes_read_bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_read/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_read_CMS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_read_bio_PrivateKey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_read_bio_ex/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_write_bio_CMS_stream/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PEM_write_bio_PKCS7_stream/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_PBE_keyivgen/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_SAFEBAG_create_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_SAFEBAG_get0_attrs/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_SAFEBAG_get1_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_add1_attr_by_NID/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_add_CSPName_asc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_add_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_add_friendlyname_asc/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_add_localkeyid/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_add_safe/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_create/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_decrypt_skey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_gen_mac/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_get_friendlyname/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_init/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_item_decrypt_d2i/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_key_gen_utf8_ex/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_newpass/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_pack_p7encdata/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS12_parse/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS5_PBE_keyivgen/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS5_PBKDF2_HMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS7_decrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS7_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS7_get_octet_string/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS7_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS7_sign_add_signer/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS7_type_is_other/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS7_verify/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS8_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/PKCS8_pkey_add1_attr/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_add/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_bytes/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_cleanup/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_egd/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_get0_primary/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_load_file/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_set_DRBG_type/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RAND_set_rand_method/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RC4_set_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RIPEMD160_Init/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_blinding_on/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_check_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_generate_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_get0_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_padding_add_PKCS1_type_1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_print/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_private_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_public_encrypt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_set_method/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_sign_ASN1_OCTET_STRING/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/RSA_size/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SCT_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SCT_print/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SCT_validate/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SHA256_Init/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SMIME_read_ASN1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SMIME_read_CMS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SMIME_read_PKCS7/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SMIME_write_ASN1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SMIME_write_CMS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SMIME_write_PKCS7/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SRP_Calc_B/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SRP_VBASE_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SRP_create_verifier/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SRP_user_pwd_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CIPHER_get_name/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_COMP_add_compression_method/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CONF_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CONF_CTX_set1_prefix/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CONF_CTX_set_flags/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CONF_CTX_set_ssl_ctx/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CONF_cmd/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CONF_cmd_argv/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_add1_chain_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_add_extra_chain_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_add_session/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_config/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_ctrl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_dane_enable/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_flush_sessions/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_free/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_get0_param/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_get_verify_mode/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_has_client_custom_ext/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_load_verify_locations/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_sess_number/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_sess_set_cache_size/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_sess_set_get_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_sessions/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set0_CA_list/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set1_curves/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set1_sigalgs/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set1_verify_cert_store/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_alpn_select_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_cert_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_cert_store/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_cert_verify_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_cipher_list/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_client_cert_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_client_hello_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_ct_validation_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_ctlog_list_file/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_default_passwd_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_generate_session_id/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_info_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_keylog_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_max_cert_list/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_min_proto_version/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_mode/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_msg_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_num_tickets/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_options/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_psk_client_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_quiet_shutdown/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_read_ahead/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_record_padding_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_security_level/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_session_cache_mode/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_session_id_context/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_session_ticket_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_split_send_fragment/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_srp_password/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_ssl_version/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_stateless_cookie_generate_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_timeout/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_tlsext_servername_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_tlsext_status_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_tlsext_ticket_key_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_tlsext_use_srtp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_tmp_dh_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_tmp_ecdh/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_set_verify/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_use_certificate/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_use_psk_identity_hint/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_CTX_use_serverinfo/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_free/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_get0_cipher/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_get0_hostname/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_get0_id_context/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_get0_peer/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_get_compress_id/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_get_protocol_version/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_get_time/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_has_ticket/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_is_resumable/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_print/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_SESSION_set1_id/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_accept/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_alert_type_string/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_alloc_buffers/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_check_chain/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_clear/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_connect/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_do_handshake/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_export_keying_material/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_extension_supported/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_free/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get0_peer_scts/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_SSL_CTX/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_all_async_fds/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_certificate/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_ciphers/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_client_random/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_current_cipher/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_default_timeout/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_error/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_extms_support/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_fd/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_peer_cert_chain/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_peer_certificate/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_peer_signature_nid/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_peer_tmp_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_psk_identity/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_rbio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_session/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_shared_sigalgs/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_verify_result/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_get_version/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_group_to_name/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_in_init/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_key_update/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_library_init/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_load_client_CA_file/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_pending/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_read/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_read_early_data/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_rstate_string/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_session_reused/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set1_host/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_async_callback/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_connect_state/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_fd/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_retry_verify/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_session/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_shutdown/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_set_verify_result/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_shutdown/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_state_string/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_want/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/SSL_write/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/TS_RESP_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/TS_VERIFY_CTX_set_certs/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/UI_STRING/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/UI_UTIL_read_pw/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/UI_create_method/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/UI_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509V3_get_d2i/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509V3_set_ctx/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_ALGOR_dup/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_ATTRIBUTE/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_CRL_get0_by_serial/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_EXTENSION_set_object/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_LOOKUP/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_LOOKUP_hash_dir/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_LOOKUP_meth_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_NAME_ENTRY_get_object/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_NAME_add_entry_by_txt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_NAME_get0_der/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_NAME_get_index_by_NID/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_NAME_print_ex/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_PUBKEY_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_REQ_get_attr/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_REQ_get_extensions/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_SIG_get0/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_STORE_CTX_get_error/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_STORE_CTX_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_STORE_CTX_set_verify_cb/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_STORE_add_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_STORE_get0_param/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_STORE_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_STORE_set_verify_cb_func/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_VERIFY_PARAM_set_flags/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_add_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_check_ca/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_check_host/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_check_issued/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_check_private_key/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_check_purpose/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_cmp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_cmp_time/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_digest/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_dup/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get0_distinguishing_id/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get0_notBefore/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get0_signature/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get0_uids/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get_extension_flags/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get_pubkey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get_serialNumber/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get_subject_name/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_get_version/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_load_http/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_new/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_sign/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_verify/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509_verify_cert/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/X509v3_get_ext_by_NID/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/b2i_PVK_bio_ex/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/d2i_PKCS8PrivateKey_bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/d2i_PrivateKey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/d2i_RSAPrivateKey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/d2i_SSL_SESSION/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/d2i_X509/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/i2d_CMS_bio_stream/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/i2d_PKCS7_bio_stream/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/i2d_re_X509_tbs/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/o2i_SCT_LIST/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man3/s2i_ASN1_IA5STRING/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man5/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man5/config/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man5/fips_config/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man5/x509v3_config/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_ASYM_CIPHER-RSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_ASYM_CIPHER-SM2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-AES/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-ARIA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-BLOWFISH/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-CAMELLIA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-CAST/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-CHACHA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-DES/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-IDEA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-NULL/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-RC2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-RC4/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-RC5/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-SEED/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_CIPHER-SM4/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-HKDF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-KB/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-KRB5KDF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-PBKDF1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-PBKDF2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-PKCS12KDF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-SCRYPT/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-SS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-SSHKDF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-TLS13_KDF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-TLS1_PRF/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-X942-ASN1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-X942-CONCAT/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KDF-X963/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KEM-RSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KEYEXCH-DH/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KEYEXCH-ECDH/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_KEYEXCH-X25519/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MAC-BLAKE2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MAC-CMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MAC-GMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MAC-HMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MAC-KMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MAC-Poly1305/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MAC-Siphash/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-BLAKE2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-MD2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-MD4/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-MD5-SHA1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-MD5/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-MDC2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-NULL/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-RIPEMD160/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-SHA1/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-SHA2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-SHA3/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-SHAKE/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-SM3/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-WHIRLPOOL/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_MD-common/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-DH/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-DSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-EC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-FFC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-HMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-RSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-SM2/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_PKEY-X25519/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_RAND-CTR-DRBG/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_RAND-HASH-DRBG/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_RAND-HMAC-DRBG/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_RAND-SEED-SRC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_RAND-TEST-RAND/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_RAND/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_SIGNATURE-DSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_SIGNATURE-ECDSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_SIGNATURE-ED25519/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_SIGNATURE-HMAC/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/EVP_SIGNATURE-RSA/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/OSSL_PROVIDER-FIPS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/OSSL_PROVIDER-base/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/OSSL_PROVIDER-default/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/OSSL_PROVIDER-legacy/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/OSSL_PROVIDER-null/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/RAND/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/RSA-PSS/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/X25519/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/bio/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/crypto/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/ct/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/des_modes/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/evp/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/fips_module/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/life_cycle-cipher/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/life_cycle-digest/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/life_cycle-kdf/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/life_cycle-mac/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/life_cycle-pkey/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/life_cycle-rand/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/migration_guide/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/openssl-core.h/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/openssl-core_dispatch.h/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/openssl-core_names.h/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/openssl-env/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/openssl-glossary/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/openssl-threads/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/openssl_user_macros/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/ossl_store-file/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/ossl_store/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/passphrase-encoding/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/property/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-asym_cipher/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-base/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-cipher/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-decoder/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-digest/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-encoder/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-kdf/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-kem/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-keyexch/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-keymgmt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-mac/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-object/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-rand/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-signature/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider-storemgmt/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/provider/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/proxy-certificates/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/ssl/ - 2024-07-11 + 2024-07-12 daily https://docs.openssl.org/3.1/man7/x509/ - 2024-07-11 + 2024-07-12 daily \ No newline at end of file diff --git a/3.1/sitemap.xml.gz b/3.1/sitemap.xml.gz index 9bb7a347c09e44e862bdfaf6c24d37474786709b..8eca34685faa231f577f5c2b045d9dcf8421a353 100644 GIT binary patch delta 30 mcmX@FcV3TOzMF%Cp=iQH_6Lj^8(+kWam@V~$2C)ii2(qn_zGeG delta 30 mcmX@FcV3TOzMF%iL7{&l`vb;=jW6QGIA%z`csEmqi2(qtEejX`